diff options
author | Alex Ning <chineseperson5@gmail.com> | 2019-08-08 12:05:45 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2019-08-08 12:05:45 +0000 |
commit | e542ac51388b9293297bb74b851dcb5ded621a3e (patch) | |
tree | c6c7073946063ca1a430f85ce0335d51d8d0812b /app/src/main/res/layout | |
parent | 5b5da3d3fd44d79bc301546b7be94de0a206e020 (diff) | |
download | infinity-for-reddit-e542ac51388b9293297bb74b851dcb5ded621a3e.tar infinity-for-reddit-e542ac51388b9293297bb74b851dcb5ded621a3e.tar.gz infinity-for-reddit-e542ac51388b9293297bb74b851dcb5ded621a3e.tar.bz2 infinity-for-reddit-e542ac51388b9293297bb74b851dcb5ded621a3e.tar.lz infinity-for-reddit-e542ac51388b9293297bb74b851dcb5ded621a3e.tar.xz infinity-for-reddit-e542ac51388b9293297bb74b851dcb5ded621a3e.tar.zst infinity-for-reddit-e542ac51388b9293297bb74b851dcb5ded621a3e.zip |
Log in other reddit accounts are available. Add an account switcher in the navigation drawer in MainActivity.
Diffstat (limited to '')
-rw-r--r-- | app/src/main/res/layout/activity_main.xml | 160 | ||||
-rw-r--r-- | app/src/main/res/layout/app_bar_main.xml | 43 | ||||
-rw-r--r-- | app/src/main/res/layout/item_account.xml | 25 | ||||
-rw-r--r-- | app/src/main/res/layout/nav_header_main.xml | 17 |
4 files changed, 138 insertions, 107 deletions
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index fc198172..ba4d146c 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -33,87 +33,101 @@ layout="@layout/nav_header_main" /> <LinearLayout - android:id="@+id/profile_linear_layout_main_activity" + android:id="@+id/all_drawer_items_linear_layout_main_activity" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="?attr/selectableItemBackground" - android:clickable="true" - android:focusable="true" - android:padding="16dp"> - - <ImageView - android:layout_width="24dp" - android:layout_height="24dp" - android:layout_gravity="center_vertical" - android:layout_marginEnd="32dp" - android:src="@drawable/ic_outline_account_circle_24px" - android:tint="@color/primaryTextColor"/> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:text="@string/profile" - android:textColor="@color/primaryTextColor" /> - - </LinearLayout> + android:orientation="vertical"> - <LinearLayout - android:id="@+id/subscriptions_linear_layout_main_activity" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?attr/selectableItemBackground" - android:clickable="true" - android:focusable="true" - android:padding="16dp"> - - <ImageView - android:layout_width="24dp" - android:layout_height="24dp" - android:layout_gravity="center_vertical" - android:layout_marginEnd="32dp" - android:src="@drawable/ic_outline_check_circle_outline_24px" - android:tint="@color/primaryTextColor"/> - - <TextView - android:layout_width="wrap_content" + <LinearLayout + android:id="@+id/profile_linear_layout_main_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" + android:clickable="true" + android:focusable="true" + android:padding="16dp"> + + <ImageView + android:layout_width="24dp" + android:layout_height="24dp" + android:layout_gravity="center_vertical" + android:layout_marginEnd="32dp" + android:src="@drawable/ic_outline_account_circle_24px" + android:tint="@color/primaryTextColor"/> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:text="@string/profile" + android:textColor="@color/primaryTextColor" /> + + </LinearLayout> + + <LinearLayout + android:id="@+id/subscriptions_linear_layout_main_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" + android:clickable="true" + android:focusable="true" + android:padding="16dp"> + + <ImageView + android:layout_width="24dp" + android:layout_height="24dp" + android:layout_gravity="center_vertical" + android:layout_marginEnd="32dp" + android:src="@drawable/ic_outline_check_circle_outline_24px" + android:tint="@color/primaryTextColor"/> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:text="@string/subscriptions" + android:textColor="@color/primaryTextColor" /> + + </LinearLayout> + + <View + android:layout_width="match_parent" + android:layout_height="1dp" + android:background="@color/dividerColor" /> + + <LinearLayout + android:id="@+id/settings_linear_layout_main_activity" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:text="@string/subscriptions" - android:textColor="@color/primaryTextColor" /> + android:background="?attr/selectableItemBackground" + android:clickable="true" + android:focusable="true" + android:padding="16dp"> + + <ImageView + android:layout_width="24dp" + android:layout_height="24dp" + android:layout_gravity="center_vertical" + android:layout_marginEnd="32dp" + android:src="@drawable/ic_outline_settings_24px" + android:tint="@color/primaryTextColor"/> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:text="@string/settings" + android:textColor="@color/primaryTextColor" /> + + </LinearLayout> </LinearLayout> - <View + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/account_recycler_view_main_activity" android:layout_width="match_parent" - android:layout_height="1dp" - android:background="@color/dividerColor" /> - - <LinearLayout - android:id="@+id/settings_linear_layout_main_activity" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="?attr/selectableItemBackground" - android:clickable="true" - android:focusable="true" - android:padding="16dp"> - - <ImageView - android:layout_width="24dp" - android:layout_height="24dp" - android:layout_gravity="center_vertical" - android:layout_marginEnd="32dp" - android:src="@drawable/ic_outline_settings_24px" - android:tint="@color/primaryTextColor"/> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_vertical" - android:text="@string/settings" - android:textColor="@color/primaryTextColor" /> - - </LinearLayout> + android:layout_height="match_parent" + android:visibility="gone" /> </LinearLayout> diff --git a/app/src/main/res/layout/app_bar_main.xml b/app/src/main/res/layout/app_bar_main.xml index 8bec0647..46a388a9 100644 --- a/app/src/main/res/layout/app_bar_main.xml +++ b/app/src/main/res/layout/app_bar_main.xml @@ -15,39 +15,18 @@ android:id="@+id/collapsing_toolbar_layout_main_activity" android:layout_width="match_parent" android:layout_height="match_parent" - app:titleEnabled="false" app:layout_scrollFlags="scroll|enterAlways" + app:titleEnabled="false" app:toolbarId="@+id/toolbar"> - <FrameLayout - android:id="@+id/toolbar_frame_layout_main_activity" + <androidx.appcompat.widget.Toolbar + android:id="@+id/toolbar" android:layout_width="match_parent" - android:layout_height="wrap_content"> - - <androidx.appcompat.widget.Toolbar - android:id="@+id/toolbar" - android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" - android:background="?attr/colorPrimary" - app:layout_collapseMode="pin" - app:layout_scrollFlags="scroll|enterAlways" - app:popupTheme="@style/AppTheme.PopupOverlay" /> - - <com.ferfalk.simplesearchview.SimpleSearchView - android:id="@+id/search_view_main_activity" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:textColor="@android:color/white" - app:voiceSearch="true" - app:searchBackground="@color/colorPrimary" - app:cursorColor="@android:color/white" - app:hintColor="#E0E0E0" - app:iconsTint="@android:color/white" - app:backIconTint="@android:color/white" - app:iconsAlpha="1" - app:backIconAlpha="1"/> - - </FrameLayout> + android:layout_height="?attr/actionBarSize" + android:background="?attr/colorPrimary" + app:layout_collapseMode="pin" + app:layout_scrollFlags="scroll|enterAlways" + app:popupTheme="@style/AppTheme.PopupOverlay" /> </com.google.android.material.appbar.CollapsingToolbarLayout> @@ -59,12 +38,12 @@ android:background="@color/colorPrimary" app:layout_scrollFlags="scroll|enterAlways" app:tabGravity="fill" - app:tabMode="fixed" app:tabIndicatorColor="@android:color/white" app:tabIndicatorHeight="3dp" + app:tabMode="fixed" + app:tabRippleColor="?attr/colorControlHighlight" app:tabSelectedTextColor="@android:color/white" app:tabTextColor="@android:color/white" - app:tabRippleColor="?attr/colorControlHighlight" app:tabUnboundedRipple="false" /> </com.google.android.material.appbar.AppBarLayout> @@ -75,7 +54,7 @@ android:layout_height="match_parent" android:background="#40000000" android:elevation="1dp" - android:visibility="gone"/> + android:visibility="gone" /> <!--<include layout="@layout/content_main" />--> diff --git a/app/src/main/res/layout/item_account.xml b/app/src/main/res/layout/item_account.xml new file mode 100644 index 00000000..d347dd67 --- /dev/null +++ b/app/src/main/res/layout/item_account.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:padding="16dp" + android:background="?attr/selectableItemBackground" + android:clickable="true" + android:focusable="true"> + + <pl.droidsonroids.gif.GifImageView + android:id="@+id/profile_image_item_account" + android:layout_width="24dp" + android:layout_height="24dp" + android:layout_marginEnd="16dp" /> + + <TextView + android:id="@+id/username_text_view_item_account" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:layout_marginEnd="16dp" + android:layout_gravity="center_vertical" + android:textColor="@color/primaryTextColor" /> + +</LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/nav_header_main.xml b/app/src/main/res/layout/nav_header_main.xml index 593385f1..9938d47c 100644 --- a/app/src/main/res/layout/nav_header_main.xml +++ b/app/src/main/res/layout/nav_header_main.xml @@ -30,8 +30,10 @@ android:layout_marginTop="@dimen/nav_header_vertical_spacing" android:layout_marginStart="16dp" android:layout_marginEnd="16dp" + android:layout_alignParentStart="true" android:textAppearance="@style/TextAppearance.AppCompat.Body1" - android:layout_below="@id/profile_image_view_nav_header_main"/> + android:layout_below="@id/profile_image_view_nav_header_main" + android:layout_toStartOf="@id/account_switcher_image_view_nav_header_main" /> <TextView android:id="@+id/karma_text_view_nav_header_main" @@ -39,6 +41,17 @@ android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginEnd="16dp" - android:layout_below="@id/name_text_view_nav_header_main"/> + android:layout_alignParentStart="true" + android:layout_below="@id/name_text_view_nav_header_main" + android:layout_toStartOf="@id/account_switcher_image_view_nav_header_main" /> + + <ImageView + android:id="@+id/account_switcher_image_view_nav_header_main" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_margin="16dp" + android:layout_alignParentBottom="true" + android:layout_alignParentEnd="true" + android:src="@drawable/ic_baseline_arrow_drop_down_24px" /> </RelativeLayout> |