Fixed UI issues in dark theme.

This commit is contained in:
Alex Ning 2019-09-26 21:57:51 +08:00
parent 03c97e912e
commit 81c259edcb
6 changed files with 25 additions and 53 deletions

View File

@ -215,12 +215,11 @@ public class AccountSavedThingActivity extends AppCompatActivity {
MenuItem lazyModeItem = mMenu.findItem(R.id.action_lazy_mode_account_saved_thing_activity); MenuItem lazyModeItem = mMenu.findItem(R.id.action_lazy_mode_account_saved_thing_activity);
if (isInLazyMode) { if (isInLazyMode) {
lazyModeItem.setTitle(R.string.action_stop_lazy_mode); lazyModeItem.setTitle(R.string.action_stop_lazy_mode);
params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_EXIT_UNTIL_COLLAPSED); params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_NO_SCROLL);
collapsingToolbarLayout.setLayoutParams(params); collapsingToolbarLayout.setLayoutParams(params);
} else { } else {
lazyModeItem.setTitle(R.string.action_start_lazy_mode); lazyModeItem.setTitle(R.string.action_start_lazy_mode);
params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS | params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS);
AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS_COLLAPSED);
collapsingToolbarLayout.setLayoutParams(params); collapsingToolbarLayout.setLayoutParams(params);
} }
@ -245,15 +244,14 @@ public class AccountSavedThingActivity extends AppCompatActivity {
isInLazyMode = false; isInLazyMode = false;
sectionsPagerAdapter.stopLazyMode(); sectionsPagerAdapter.stopLazyMode();
lazyModeItem.setTitle(R.string.action_start_lazy_mode); lazyModeItem.setTitle(R.string.action_start_lazy_mode);
params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS | params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS);
AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS_COLLAPSED);
collapsingToolbarLayout.setLayoutParams(params); collapsingToolbarLayout.setLayoutParams(params);
} else { } else {
isInLazyMode = true; isInLazyMode = true;
if(sectionsPagerAdapter.startLazyMode()) { if(sectionsPagerAdapter.startLazyMode()) {
lazyModeItem.setTitle(R.string.action_stop_lazy_mode); lazyModeItem.setTitle(R.string.action_stop_lazy_mode);
appBarLayout.setExpanded(false); appBarLayout.setExpanded(false);
params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_EXIT_UNTIL_COLLAPSED); params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_NO_SCROLL);
collapsingToolbarLayout.setLayoutParams(params); collapsingToolbarLayout.setLayoutParams(params);
} else { } else {
isInLazyMode = false; isInLazyMode = false;

View File

@ -103,8 +103,9 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
@Override @Override
public boolean areContentsTheSame(@NonNull Post post, @NonNull Post t1) { public boolean areContentsTheSame(@NonNull Post post, @NonNull Post t1) {
return post.getTitle().equals(t1.getTitle()) && post.getSelfText().equals(t1.getSelfText()) return post.getTitle().equals(t1.getTitle()) && !(post.getSelfText() != null && t1.getSelfText() != null
&& post.getScore() == t1.getScore(); && !post.getSelfText().equals(t1.getSelfText()))
&& post.getScore() == t1.getScore() && post.getVoteType() == t1.getVoteType();
} }
}; };

View File

@ -6,12 +6,6 @@
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".AccountPostsActivity"> tools:context=".AccountPostsActivity">
<androidx.viewpager.widget.ViewPager
android:id="@+id/view_pager_account_saved_thing_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_layout_account_saved_thing_activity" android:id="@+id/appbar_layout_account_saved_thing_activity"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -30,8 +24,9 @@
android:id="@+id/toolbar_account_saved_thing_activity" android:id="@+id/toolbar_account_saved_thing_activity"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/AppTheme.PopupOverlay" app:layout_collapseMode="pin"
app:navigationIcon="?attr/homeAsUpIndicator" /> app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</com.google.android.material.appbar.CollapsingToolbarLayout> </com.google.android.material.appbar.CollapsingToolbarLayout>
@ -40,7 +35,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:background="@color/colorPrimary" android:background="@color/greyTabBackgroundColor"
app:layout_scrollFlags="scroll|enterAlways" app:layout_scrollFlags="scroll|enterAlways"
app:tabGravity="fill" app:tabGravity="fill"
app:tabIndicatorColor="@android:color/white" app:tabIndicatorColor="@android:color/white"
@ -53,4 +48,10 @@
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<androidx.viewpager.widget.ViewPager
android:id="@+id/view_pager_account_saved_thing_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -18,31 +18,11 @@
app:titleEnabled="false" app:titleEnabled="false"
app:toolbarId="@+id/toolbar_search_result_activity"> app:toolbarId="@+id/toolbar_search_result_activity">
<FrameLayout <androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar_search_result_activity"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/AppTheme.PopupOverlay" />
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar_search_result_activity"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/AppTheme.PopupOverlay" />
<com.ferfalk.simplesearchview.SimpleSearchView
android:id="@+id/search_view_search_result_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.CollapsingToolbarLayout>

View File

@ -23,7 +23,8 @@
android:id="@+id/toolbar_subscribed_thing_listing_activity" android:id="@+id/toolbar_subscribed_thing_listing_activity"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" app:layout_collapseMode="pin"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay" /> app:popupTheme="@style/AppTheme.PopupOverlay" />
</com.google.android.material.appbar.CollapsingToolbarLayout> </com.google.android.material.appbar.CollapsingToolbarLayout>
@ -32,7 +33,7 @@
android:id="@+id/tab_layout_subscribed_thing_listing_activity" android:id="@+id/tab_layout_subscribed_thing_listing_activity"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/colorPrimary" android:background="@color/greyTabBackgroundColor"
app:layout_scrollFlags="scroll|enterAlways" app:layout_scrollFlags="scroll|enterAlways"
app:tabGravity="fill" app:tabGravity="fill"
app:tabMode="fixed" app:tabMode="fixed"
@ -49,7 +50,6 @@
android:id="@+id/view_pager_subscribed_thing_listing_activity" android:id="@+id/view_pager_subscribed_thing_listing_activity"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" app:layout_behavior="@string/appbar_scrolling_view_behavior" />
tools:application=".SubscribedThingListingActivity" />
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -49,14 +49,6 @@
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<View
android:id="@+id/transparent_overlay_main_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#40000000"
android:elevation="1dp"
android:visibility="gone" />
<androidx.viewpager.widget.ViewPager <androidx.viewpager.widget.ViewPager
android:id="@+id/view_pager_main_activity" android:id="@+id/view_pager_main_activity"
android:layout_width="match_parent" android:layout_width="match_parent"