aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2019-04-23 00:03:29 +0000
committerAlex Ning <chineseperson5@gmail.com>2019-04-23 00:03:29 +0000
commit6bd4b41f8c7eeb112d00bc42658eace8ed3bcb85 (patch)
treec9a9403b6d2759b71f36fc95c648fb2a9cbb9fd1 /app
parentd8ddad9522596a6f8fb2e5a5d46ba74f6ed1e234 (diff)
downloadinfinity-for-reddit-6bd4b41f8c7eeb112d00bc42658eace8ed3bcb85.tar
infinity-for-reddit-6bd4b41f8c7eeb112d00bc42658eace8ed3bcb85.tar.gz
infinity-for-reddit-6bd4b41f8c7eeb112d00bc42658eace8ed3bcb85.tar.bz2
infinity-for-reddit-6bd4b41f8c7eeb112d00bc42658eace8ed3bcb85.tar.lz
infinity-for-reddit-6bd4b41f8c7eeb112d00bc42658eace8ed3bcb85.tar.xz
infinity-for-reddit-6bd4b41f8c7eeb112d00bc42658eace8ed3bcb85.tar.zst
infinity-for-reddit-6bd4b41f8c7eeb112d00bc42658eace8ed3bcb85.zip
Hide Toolbar when scrolling content up.
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java5
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ViewUserDetailActivity.java4
-rw-r--r--app/src/main/res/layout/activity_main.xml129
-rw-r--r--app/src/main/res/layout/activity_view_subreddit_detail.xml3
-rw-r--r--app/src/main/res/layout/activity_view_user_detail.xml3
-rw-r--r--app/src/main/res/layout/app_bar_main.xml55
-rw-r--r--app/src/main/res/layout/fragment_post.xml8
7 files changed, 97 insertions, 110 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java
index e5f94cf3..70cdda82 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java
@@ -20,7 +20,6 @@ import androidx.lifecycle.ViewModelProviders;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestManager;
import com.bumptech.glide.request.RequestOptions;
-import com.google.android.material.appbar.CollapsingToolbarLayout;
import com.google.android.material.chip.Chip;
import com.google.android.material.snackbar.Snackbar;
@@ -93,10 +92,6 @@ public class ViewSubredditDetailActivity extends AppCompatActivity {
String title = "r/" + subredditName;
subredditNameTextView.setText(title);
-
- CollapsingToolbarLayout collapsingToolbarLayout = findViewById(R.id.collapsing_toolbar_layout_view_subreddit_detail_activity);
- collapsingToolbarLayout.setTitleEnabled(false);
-
Toolbar toolbar = findViewById(R.id.toolbar);
toolbar.setTitle(title);
setSupportActionBar(toolbar);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewUserDetailActivity.java
index 00b9fe4b..0fb312fb 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewUserDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewUserDetailActivity.java
@@ -19,7 +19,6 @@ import androidx.lifecycle.ViewModelProviders;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestManager;
import com.bumptech.glide.request.RequestOptions;
-import com.google.android.material.appbar.CollapsingToolbarLayout;
import com.google.android.material.chip.Chip;
import com.google.android.material.snackbar.Snackbar;
@@ -90,9 +89,6 @@ public class ViewUserDetailActivity extends AppCompatActivity {
String title = "u/" + userName;
userNameTextView.setText(title);
- CollapsingToolbarLayout collapsingToolbarLayout = findViewById(R.id.collapsing_toolbar_layout_view_user_detail_activity);
- collapsingToolbarLayout.setTitleEnabled(false);
-
Toolbar toolbar = findViewById(R.id.toolbar);
toolbar.setTitle(title);
setSupportActionBar(toolbar);
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 13eec540..12eff6dc 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
@@ -13,86 +12,86 @@
android:layout_width="match_parent"
android:layout_height="match_parent" />
- <com.google.android.material.navigation.NavigationView
- android:id="@+id/nav_view"
- android:layout_width="wrap_content"
+ <com.google.android.material.navigation.NavigationView
+ android:id="@+id/nav_view"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_gravity="start">
+
+ <androidx.core.widget.NestedScrollView
+ android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_gravity="start">
+ android:scrollbars="vertical">
- <androidx.core.widget.NestedScrollView
+ <LinearLayout
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:scrollbars="vertical">
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <include
+ android:id="@+id/nav_header_main_activity"
+ layout="@layout/nav_header_main" />
<LinearLayout
+ android:id="@+id/profile_linear_layout_main_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:orientation="vertical">
-
- <include
- android:id="@+id/nav_header_main_activity"
- layout="@layout/nav_header_main" />
-
- <LinearLayout
- android:id="@+id/profile_linear_layout_main_activity"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:padding="16dp"
- android:clickable="true"
- android:focusable="true"
- android:background="?attr/selectableItemBackground">
-
- <ImageView
- android:layout_width="24dp"
- android:layout_height="24dp"
- android:layout_marginEnd="32dp"
- android:layout_gravity="center_vertical"
- android:src="@drawable/ic_outline_account_circle_24px"/>
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/profile"
- android:textColor="@android:color/black"
- android:layout_gravity="center_vertical"/>
-
- </LinearLayout>
-
- <View
- android:layout_width="match_parent"
- android:layout_height="1dp"
- android:background="#E0E0E0"/>
+ 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" />
<TextView
- android:id="@+id/following_label_main_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="@string/following"
- android:layout_margin="16dp"
- android:visibility="gone"/>
+ android:layout_gravity="center_vertical"
+ android:text="@string/profile"
+ android:textColor="@android:color/black" />
- <androidx.recyclerview.widget.RecyclerView
- android:id="@+id/subscribed_user_recycler_view_main_activity"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
+ </LinearLayout>
- <TextView
- android:id="@+id/subscriptions_label_main_activity"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/subscriptions"
- android:layout_margin="16dp"
- android:visibility="gone"/>
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="1dp"
+ android:background="#E0E0E0" />
- <androidx.recyclerview.widget.RecyclerView
- android:id="@+id/subscribed_subreddit_recycler_view_main_activity"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
+ <TextView
+ android:id="@+id/following_label_main_activity"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="16dp"
+ android:text="@string/following"
+ android:visibility="gone" />
- </LinearLayout>
+ <androidx.recyclerview.widget.RecyclerView
+ android:id="@+id/subscribed_user_recycler_view_main_activity"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ <TextView
+ android:id="@+id/subscriptions_label_main_activity"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="16dp"
+ android:text="@string/subscriptions"
+ android:visibility="gone" />
+
+ <androidx.recyclerview.widget.RecyclerView
+ android:id="@+id/subscribed_subreddit_recycler_view_main_activity"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ </LinearLayout>
- </androidx.core.widget.NestedScrollView>
+ </androidx.core.widget.NestedScrollView>
- </com.google.android.material.navigation.NavigationView>
+ </com.google.android.material.navigation.NavigationView>
</androidx.drawerlayout.widget.DrawerLayout>
diff --git a/app/src/main/res/layout/activity_view_subreddit_detail.xml b/app/src/main/res/layout/activity_view_subreddit_detail.xml
index 5d83b5fa..5fff46ca 100644
--- a/app/src/main/res/layout/activity_view_subreddit_detail.xml
+++ b/app/src/main/res/layout/activity_view_subreddit_detail.xml
@@ -8,15 +8,14 @@
tools:context=".ViewSubredditDetailActivity">
<com.google.android.material.appbar.AppBarLayout
- android:id="@+id/app_bar_layout_view_subreddit_detail_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<com.google.android.material.appbar.CollapsingToolbarLayout
- android:id="@+id/collapsing_toolbar_layout_view_subreddit_detail_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ app:titleEnabled="false"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed"
app:toolbarId="@+id/toolbar">
diff --git a/app/src/main/res/layout/activity_view_user_detail.xml b/app/src/main/res/layout/activity_view_user_detail.xml
index ca8625d3..9bd70a72 100644
--- a/app/src/main/res/layout/activity_view_user_detail.xml
+++ b/app/src/main/res/layout/activity_view_user_detail.xml
@@ -8,15 +8,14 @@
tools:context=".ViewUserDetailActivity">
<com.google.android.material.appbar.AppBarLayout
- android:id="@+id/app_bar_layout_view_user_detail_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<com.google.android.material.appbar.CollapsingToolbarLayout
- android:id="@+id/collapsing_toolbar_layout_view_user_detail_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ app:titleEnabled="false"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed"
app:toolbarId="@+id/toolbar">
diff --git a/app/src/main/res/layout/app_bar_main.xml b/app/src/main/res/layout/app_bar_main.xml
index 94727b02..cfd4637b 100644
--- a/app/src/main/res/layout/app_bar_main.xml
+++ b/app/src/main/res/layout/app_bar_main.xml
@@ -11,33 +11,40 @@
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
- <FrameLayout
- android:id="@+id/toolbar_frame_layout_main_activity"
+ <com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content">
+ android:layout_height="match_parent"
+ app:titleEnabled="false"
+ app:layout_scrollFlags="scroll|enterAlways"
+ app:toolbarId="@+id/toolbar">
- <androidx.appcompat.widget.Toolbar
- android:id="@+id/toolbar"
+ <FrameLayout
+ android:id="@+id/toolbar_frame_layout_main_activity"
android:layout_width="match_parent"
- android:layout_height="?attr/actionBarSize"
- android:background="?attr/colorPrimary"
- 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="wrap_content">
+
+ <androidx.appcompat.widget.Toolbar
+ android:id="@+id/toolbar"
+ android:layout_width="match_parent"
+ android:layout_height="?attr/actionBarSize"/>
+
+ <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>
+
+ </com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
diff --git a/app/src/main/res/layout/fragment_post.xml b/app/src/main/res/layout/fragment_post.xml
index 3b073f08..ad9e23d7 100644
--- a/app/src/main/res/layout/fragment_post.xml
+++ b/app/src/main/res/layout/fragment_post.xml
@@ -43,12 +43,4 @@
</LinearLayout>
- <!--<android.support.design.widget.FloatingActionButton
- android:id="@+id/fab_post_fragment"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="bottom|end"
- android:layout_margin="@dimen/fab_margin"
- app:srcCompat="@drawable/baseline_add_white_24" />-->
-
</androidx.coordinatorlayout.widget.CoordinatorLayout>