Still implementing custom themes.

This commit is contained in:
Alex Ning 2020-03-18 09:19:26 +08:00
parent 9b796cf621
commit 21c47eaa4c
5 changed files with 12 additions and 30 deletions

View File

@ -5,7 +5,6 @@ import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.net.Uri; import android.net.Uri;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.view.MenuItem; import android.view.MenuItem;
import android.webkit.CookieManager; import android.webkit.CookieManager;
@ -15,7 +14,6 @@ import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.appbar.AppBarLayout;
@ -46,8 +44,6 @@ import retrofit2.Retrofit;
public class LoginActivity extends BaseActivity { public class LoginActivity extends BaseActivity {
@BindView(R.id.coordinator_layout_login_activity)
CoordinatorLayout coordinatorLayout;
@BindView(R.id.appbar_layout_login_activity) @BindView(R.id.appbar_layout_login_activity)
AppBarLayout appBarLayout; AppBarLayout appBarLayout;
@BindView(R.id.toolbar_login_activity) @BindView(R.id.toolbar_login_activity)
@ -80,10 +76,6 @@ public class LoginActivity extends BaseActivity {
applyCustomTheme(); applyCustomTheme();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isChangeStatusBarIconColor()) {
addOnOffsetChangedListener(appBarLayout);
}
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
@ -222,7 +214,6 @@ public class LoginActivity extends BaseActivity {
@Override @Override
protected void applyCustomTheme() { protected void applyCustomTheme() {
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar); applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar);
} }

View File

@ -192,6 +192,11 @@ public class SearchActivity extends BaseActivity {
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar); applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar);
simpleSearchView.setSearchBackground(new ColorDrawable(mCustomThemeWrapper.getColorPrimary())); simpleSearchView.setSearchBackground(new ColorDrawable(mCustomThemeWrapper.getColorPrimary()));
int toolbarPrimaryTextAndIconColorColor = mCustomThemeWrapper.getToolbarPrimaryTextAndIconColor();
simpleSearchView.setIconsColor(toolbarPrimaryTextAndIconColorColor);
simpleSearchView.setTextColor(toolbarPrimaryTextAndIconColorColor);
simpleSearchView.setBackIconColor(toolbarPrimaryTextAndIconColorColor);
simpleSearchView.setHintTextColor(mCustomThemeWrapper.getSecondaryTextColor());
searchInTextView.setTextColor(mCustomThemeWrapper.getColorAccent()); searchInTextView.setTextColor(mCustomThemeWrapper.getColorAccent());
subredditNameTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor()); subredditNameTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor());
} }

View File

@ -2169,7 +2169,6 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
super(itemView); super(itemView);
ButterKnife.bind(this, itemView); ButterKnife.bind(this, itemView);
itemView.setOnClickListener(view -> mCommentRecyclerViewAdapterCallback.retryFetchingComments()); itemView.setOnClickListener(view -> mCommentRecyclerViewAdapterCallback.retryFetchingComments());
itemView.setBackgroundColor(mCommentBackgroundColor);
errorTextView.setTextColor(mSecondaryTextColor); errorTextView.setTextColor(mSecondaryTextColor);
} }
} }
@ -2181,7 +2180,6 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
NoCommentViewHolder(@NonNull View itemView) { NoCommentViewHolder(@NonNull View itemView) {
super(itemView); super(itemView);
ButterKnife.bind(this, itemView); ButterKnife.bind(this, itemView);
itemView.setBackgroundColor(mCommentBackgroundColor);
errorTextView.setTextColor(mSecondaryTextColor); errorTextView.setTextColor(mSecondaryTextColor);
} }
} }
@ -2193,7 +2191,6 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
IsLoadingMoreCommentsViewHolder(@NonNull View itemView) { IsLoadingMoreCommentsViewHolder(@NonNull View itemView) {
super(itemView); super(itemView);
ButterKnife.bind(this, itemView); ButterKnife.bind(this, itemView);
itemView.setBackgroundColor(mCommentBackgroundColor);
progressbar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent)); progressbar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent));
} }
} }
@ -2209,7 +2206,6 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
ButterKnife.bind(this, itemView); ButterKnife.bind(this, itemView);
errorTextView.setText(R.string.load_comments_failed); errorTextView.setText(R.string.load_comments_failed);
retryButton.setOnClickListener(view -> mCommentRecyclerViewAdapterCallback.retryFetchingMoreComments()); retryButton.setOnClickListener(view -> mCommentRecyclerViewAdapterCallback.retryFetchingMoreComments());
itemView.setBackgroundColor(mCommentBackgroundColor);
errorTextView.setTextColor(mSecondaryTextColor); errorTextView.setTextColor(mSecondaryTextColor);
retryButton.setBackgroundTintList(ColorStateList.valueOf(mColorPrimaryLightTheme)); retryButton.setBackgroundTintList(ColorStateList.valueOf(mColorPrimaryLightTheme));
retryButton.setTextColor(mButtonTextColor); retryButton.setTextColor(mButtonTextColor);

View File

@ -122,12 +122,12 @@ public class CustomThemeWrapper {
public int getPostIconAndInfoColor() { public int getPostIconAndInfoColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.POST_ICON_AND_INFO_COLOR, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.POST_ICON_AND_INFO_COLOR,
getDefaultColor("#808080", "#808080", "#808080")); getDefaultColor("#8A000000", "#B3FFFFFF", "#B3FFFFFF"));
} }
public int getCommentIconAndInfoColor() { public int getCommentIconAndInfoColor() {
return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COMMENT_ICON_AND_INFO_COLOR, return themeSharedPreferences.getInt(CustomThemeSharedPreferencesUtils.COMMENT_ICON_AND_INFO_COLOR,
getDefaultColor("#808080", "#808080", "#808080")); getDefaultColor("#8A000000", "#B3FFFFFF", "#B3FFFFFF"));
} }
public int getToolbarPrimaryTextAndIconColor() { public int getToolbarPrimaryTextAndIconColor() {

View File

@ -4,7 +4,6 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:id="@+id/coordinator_layout_login_activity"
android:background="?attr/backgroundColor" android:background="?attr/backgroundColor"
tools:application="ml.docilealligator.infinityforreddit.Activity.LoginActivity"> tools:application="ml.docilealligator.infinityforreddit.Activity.LoginActivity">
@ -15,21 +14,12 @@
android:background="?attr/toolbarAndTabBackgroundColor" android:background="?attr/toolbarAndTabBackgroundColor"
android:theme="@style/AppTheme.AppBarOverlay"> android:theme="@style/AppTheme.AppBarOverlay">
<com.google.android.material.appbar.CollapsingToolbarLayout <androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar_login_activity"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways" app:popupTheme="@style/AppTheme.PopupOverlay"
app:titleEnabled="false" app:navigationIcon="?attr/homeAsUpIndicator" />
app:toolbarId="@+id/toolbar_login_activity">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar_login_activity"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/AppTheme.PopupOverlay"
app:navigationIcon="?attr/homeAsUpIndicator" />
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>