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

View File

@ -192,6 +192,11 @@ public class SearchActivity extends BaseActivity {
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar);
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());
subredditNameTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor());
}

View File

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

View File

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

View File

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