mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-02-22 21:03:56 +01:00
AMOLED dark theme is now available.
This commit is contained in:
parent
66b0eeef99
commit
11f6b5dc91
@ -13,8 +13,6 @@ import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
@ -30,10 +28,8 @@ import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.ContentFontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
import ml.docilealligator.infinityforreddit.FontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.PostFragment;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.UserThingSortTypeBottomSheetFragment;
|
||||
import ml.docilealligator.infinityforreddit.FragmentCommunicator;
|
||||
@ -41,15 +37,8 @@ import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.PostDataSource;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.TitleFontStyle;
|
||||
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||
|
||||
public class AccountPostsActivity extends AppCompatActivity implements UserThingSortTypeBottomSheetFragment.UserThingSortTypeSelectionCallback {
|
||||
public class AccountPostsActivity extends BaseActivity implements UserThingSortTypeBottomSheetFragment.UserThingSortTypeSelectionCallback {
|
||||
|
||||
static final String EXTRA_USER_WHERE = "EUW";
|
||||
|
||||
@ -80,18 +69,9 @@ public class AccountPostsActivity extends AppCompatActivity implements UserThing
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
|
||||
getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_account_posts);
|
||||
|
||||
@ -140,24 +120,6 @@ public class AccountPostsActivity extends AppCompatActivity implements UserThing
|
||||
}
|
||||
}
|
||||
|
||||
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||
switch (themeType) {
|
||||
case 0:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||
break;
|
||||
case 1:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||
break;
|
||||
case 2:
|
||||
if (systemDefault) {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||
} else {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
mUserWhere = getIntent().getExtras().getString(EXTRA_USER_WHERE);
|
||||
if (mUserWhere.equals(PostDataSource.USER_WHERE_UPVOTED)) {
|
||||
toolbar.setTitle(R.string.upvoted);
|
||||
@ -190,6 +152,11 @@ public class AccountPostsActivity extends AppCompatActivity implements UserThing
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SharedPreferences getSharedPreferences() {
|
||||
return mSharedPreferences;
|
||||
}
|
||||
|
||||
private void getCurrentAccountAndInitializeFragment() {
|
||||
new GetCurrentAccountAsyncTask(mRedditDataRoomDatabase.accountDao(), account -> {
|
||||
if (account == null) {
|
||||
|
@ -13,8 +13,6 @@ import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
@ -35,10 +33,8 @@ import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.ContentFontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
import ml.docilealligator.infinityforreddit.FontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.CommentsListingFragment;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.PostFragment;
|
||||
import ml.docilealligator.infinityforreddit.FragmentCommunicator;
|
||||
@ -46,16 +42,9 @@ import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.PostDataSource;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.TitleFontStyle;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||
|
||||
public class AccountSavedThingActivity extends AppCompatActivity {
|
||||
public class AccountSavedThingActivity extends BaseActivity {
|
||||
|
||||
private static final String NULL_ACCESS_TOKEN_STATE = "NATS";
|
||||
private static final String ACCESS_TOKEN_STATE = "ATS";
|
||||
@ -89,18 +78,9 @@ public class AccountSavedThingActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
|
||||
getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_account_saved_thing);
|
||||
|
||||
@ -149,24 +129,6 @@ public class AccountSavedThingActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||
switch (themeType) {
|
||||
case 0:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||
break;
|
||||
case 1:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||
break;
|
||||
case 2:
|
||||
if (systemDefault) {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||
} else {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
@ -187,6 +149,11 @@ public class AccountSavedThingActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SharedPreferences getSharedPreferences() {
|
||||
return mSharedPreferences;
|
||||
}
|
||||
|
||||
private void getCurrentAccountAndInitializeViewPager() {
|
||||
new GetCurrentAccountAsyncTask(mRedditDataRoomDatabase.accountDao(), account -> {
|
||||
if (account == null) {
|
||||
|
@ -0,0 +1,86 @@
|
||||
package ml.docilealligator.infinityforreddit.Activity;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
|
||||
import ml.docilealligator.infinityforreddit.ContentFontStyle;
|
||||
import ml.docilealligator.infinityforreddit.FontStyle;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.TitleFontStyle;
|
||||
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||
|
||||
public abstract class BaseActivity extends AppCompatActivity {
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
SharedPreferences mSharedPreferences = getSharedPreferences();
|
||||
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||
switch (themeType) {
|
||||
case 0:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||
getTheme().applyStyle(R.style.Theme_Default, true);
|
||||
break;
|
||||
case 1:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||
if(mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) {
|
||||
getTheme().applyStyle(R.style.Theme_Default_AmoledDark, true);
|
||||
} else {
|
||||
getTheme().applyStyle(R.style.Theme_Default_NormalDark, true);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (systemDefault) {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||
} else {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||
}
|
||||
if((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_NO) {
|
||||
getTheme().applyStyle(R.style.Theme_Default, true);
|
||||
} else {
|
||||
if(mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) {
|
||||
getTheme().applyStyle(R.style.Theme_Default_AmoledDark, true);
|
||||
} else {
|
||||
getTheme().applyStyle(R.style.Theme_Default_NormalDark, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
Window window = getWindow();
|
||||
if ((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
||||
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
TypedValue typedValue = new TypedValue();
|
||||
getTheme().resolveAttribute(R.attr.navBarColor, typedValue, true);
|
||||
int navBarColor = typedValue.data;
|
||||
window.setNavigationBarColor(navBarColor);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract SharedPreferences getSharedPreferences();
|
||||
}
|
@ -3,15 +3,11 @@ package ml.docilealligator.infinityforreddit.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.util.Linkify;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
@ -19,11 +15,8 @@ import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
@ -41,23 +34,14 @@ import io.noties.markwon.MarkwonConfiguration;
|
||||
import io.noties.markwon.linkify.LinkifyPlugin;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.CommentData;
|
||||
import ml.docilealligator.infinityforreddit.ContentFontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
import ml.docilealligator.infinityforreddit.FontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SendComment;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.TitleFontStyle;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||
|
||||
public class CommentActivity extends AppCompatActivity {
|
||||
public class CommentActivity extends BaseActivity {
|
||||
|
||||
public static final String EXTRA_COMMENT_PARENT_TEXT_KEY = "ECPTK";
|
||||
public static final String EXTRA_PARENT_FULLNAME_KEY = "EPFK";
|
||||
@ -94,18 +78,9 @@ public class CommentActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
|
||||
getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_comment);
|
||||
|
||||
@ -113,32 +88,6 @@ public class CommentActivity extends AppCompatActivity {
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
Window window = getWindow();
|
||||
if ((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
||||
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor));
|
||||
}
|
||||
|
||||
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||
switch (themeType) {
|
||||
case 0:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||
break;
|
||||
case 1:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||
break;
|
||||
case 2:
|
||||
if (systemDefault) {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||
} else {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
getCurrentAccount();
|
||||
} else {
|
||||
@ -186,6 +135,11 @@ public class CommentActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SharedPreferences getSharedPreferences() {
|
||||
return mSharedPreferences;
|
||||
}
|
||||
|
||||
private void getCurrentAccount() {
|
||||
new GetCurrentAccountAsyncTask(mRedditDataRoomDatabase.accountDao(), account -> {
|
||||
if (account == null) {
|
||||
|
@ -3,23 +3,16 @@ package ml.docilealligator.infinityforreddit.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
@ -34,26 +27,17 @@ import javax.inject.Named;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.ContentFontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
import ml.docilealligator.infinityforreddit.FontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditAPI;
|
||||
import ml.docilealligator.infinityforreddit.RedditUtils;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.TitleFontStyle;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||
|
||||
public class EditCommentActivity extends AppCompatActivity {
|
||||
public class EditCommentActivity extends BaseActivity {
|
||||
|
||||
public static final String EXTRA_CONTENT = "EC";
|
||||
public static final String EXTRA_FULLNAME = "EF";
|
||||
@ -80,18 +64,9 @@ public class EditCommentActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
|
||||
getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_edit_comment);
|
||||
|
||||
@ -99,38 +74,12 @@ public class EditCommentActivity extends AppCompatActivity {
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
Window window = getWindow();
|
||||
if ((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
||||
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor));
|
||||
}
|
||||
|
||||
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||
switch (themeType) {
|
||||
case 0:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||
break;
|
||||
case 1:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||
break;
|
||||
case 2:
|
||||
if (systemDefault) {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||
} else {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
mFullName = getIntent().getExtras().getString(EXTRA_FULLNAME);
|
||||
mAccessToken = getIntent().getExtras().getString(EXTRA_ACCESS_TOKEN);
|
||||
contentEditText.setText(getIntent().getExtras().getString(EXTRA_CONTENT));
|
||||
mFullName = getIntent().getStringExtra(EXTRA_FULLNAME);
|
||||
mAccessToken = getIntent().getStringExtra(EXTRA_ACCESS_TOKEN);
|
||||
contentEditText.setText(getIntent().getStringExtra(EXTRA_CONTENT));
|
||||
|
||||
contentEditText.requestFocus();
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
@ -139,6 +88,11 @@ public class EditCommentActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SharedPreferences getSharedPreferences() {
|
||||
return mSharedPreferences;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
|
@ -3,24 +3,17 @@ package ml.docilealligator.infinityforreddit.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
@ -35,26 +28,17 @@ import javax.inject.Named;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.ContentFontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
import ml.docilealligator.infinityforreddit.FontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditAPI;
|
||||
import ml.docilealligator.infinityforreddit.RedditUtils;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.TitleFontStyle;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||
|
||||
public class EditPostActivity extends AppCompatActivity {
|
||||
public class EditPostActivity extends BaseActivity {
|
||||
|
||||
static final String EXTRA_TITLE = "ET";
|
||||
static final String EXTRA_CONTENT = "EC";
|
||||
@ -80,18 +64,9 @@ public class EditPostActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
|
||||
getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_edit_post);
|
||||
|
||||
@ -99,39 +74,13 @@ public class EditPostActivity extends AppCompatActivity {
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
Window window = getWindow();
|
||||
if ((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
||||
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor));
|
||||
}
|
||||
|
||||
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||
switch (themeType) {
|
||||
case 0:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||
break;
|
||||
case 1:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||
break;
|
||||
case 2:
|
||||
if (systemDefault) {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||
} else {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
mFullName = getIntent().getExtras().getString(EXTRA_FULLNAME);
|
||||
mAccessToken = getIntent().getExtras().getString(EXTRA_ACCESS_TOKEN);
|
||||
titleTextView.setText(getIntent().getExtras().getString(EXTRA_TITLE));
|
||||
contentEditText.setText(getIntent().getExtras().getString(EXTRA_CONTENT));
|
||||
mFullName = getIntent().getStringExtra(EXTRA_FULLNAME);
|
||||
mAccessToken = getIntent().getStringExtra(EXTRA_ACCESS_TOKEN);
|
||||
titleTextView.setText(getIntent().getStringExtra(EXTRA_TITLE));
|
||||
contentEditText.setText(getIntent().getStringExtra(EXTRA_CONTENT));
|
||||
|
||||
contentEditText.requestFocus();
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
@ -140,6 +89,11 @@ public class EditPostActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SharedPreferences getSharedPreferences() {
|
||||
return mSharedPreferences;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
|
@ -13,8 +13,6 @@ import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
@ -30,9 +28,7 @@ import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.ContentFontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
import ml.docilealligator.infinityforreddit.FontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.PostFragment;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.SearchPostSortTypeBottomSheetFragment;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.SortTypeBottomSheetFragment;
|
||||
@ -43,15 +39,8 @@ import ml.docilealligator.infinityforreddit.Post;
|
||||
import ml.docilealligator.infinityforreddit.PostDataSource;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.TitleFontStyle;
|
||||
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||
|
||||
public class FilteredThingActivity extends AppCompatActivity implements SortTypeBottomSheetFragment.SortTypeSelectionCallback,
|
||||
public class FilteredThingActivity extends BaseActivity implements SortTypeBottomSheetFragment.SortTypeSelectionCallback,
|
||||
SearchPostSortTypeBottomSheetFragment.SearchSortTypeSelectionCallback, UserThingSortTypeBottomSheetFragment.UserThingSortTypeSelectionCallback {
|
||||
|
||||
public static final String EXTRA_NAME = "ESN";
|
||||
@ -92,18 +81,9 @@ public class FilteredThingActivity extends AppCompatActivity implements SortType
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
|
||||
getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_filtered_thing);
|
||||
|
||||
@ -152,24 +132,6 @@ public class FilteredThingActivity extends AppCompatActivity implements SortType
|
||||
}
|
||||
}
|
||||
|
||||
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||
switch (themeType) {
|
||||
case 0:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||
break;
|
||||
case 1:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||
break;
|
||||
case 2:
|
||||
if (systemDefault) {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||
} else {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
@ -196,6 +158,11 @@ public class FilteredThingActivity extends AppCompatActivity implements SortType
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SharedPreferences getSharedPreferences() {
|
||||
return mSharedPreferences;
|
||||
}
|
||||
|
||||
private void getCurrentAccountAndBindView(int filter, String sortType) {
|
||||
new GetCurrentAccountAsyncTask(mRedditDataRoomDatabase.accountDao(), account -> {
|
||||
if (account == null) {
|
||||
|
@ -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;
|
||||
@ -14,8 +13,6 @@ import android.webkit.WebViewClient;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
|
||||
import org.json.JSONException;
|
||||
@ -37,18 +34,12 @@ import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditAPI;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.RedditUtils;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||
|
||||
public class LoginActivity extends AppCompatActivity {
|
||||
public class LoginActivity extends BaseActivity {
|
||||
|
||||
@BindView(R.id.toolbar_login_activity)
|
||||
Toolbar toolbar;
|
||||
@ -66,33 +57,15 @@ public class LoginActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_login);
|
||||
|
||||
ButterKnife.bind(this);
|
||||
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||
switch (themeType) {
|
||||
case 0:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||
break;
|
||||
case 1:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||
break;
|
||||
case 2:
|
||||
if (systemDefault) {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||
} else {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
WebView webView = findViewById(R.id.webview_login_activity);
|
||||
@ -218,6 +191,11 @@ public class LoginActivity extends AppCompatActivity {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public SharedPreferences getSharedPreferences() {
|
||||
return mSharedPreferences;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
|
@ -20,8 +20,6 @@ import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.core.view.GravityCompat;
|
||||
@ -68,13 +66,11 @@ import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.InsertSubscribedThingsAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.SwitchAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.SwitchToAnonymousAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.ContentFontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Event.ChangeFontSizeEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.RecreateActivityEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
import ml.docilealligator.infinityforreddit.FetchMyInfo;
|
||||
import ml.docilealligator.infinityforreddit.FetchSubscribedThing;
|
||||
import ml.docilealligator.infinityforreddit.FontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.PostFragment;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.PostTypeBottomSheetFragment;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.SortTypeBottomSheetFragment;
|
||||
@ -90,16 +86,10 @@ import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditData;
|
||||
import ml.docilealligator.infinityforreddit.SubscribedSubredditDatabase.SubscribedSubredditData;
|
||||
import ml.docilealligator.infinityforreddit.SubscribedUserDatabase.SubscribedUserData;
|
||||
import ml.docilealligator.infinityforreddit.TitleFontStyle;
|
||||
import pl.droidsonroids.gif.GifImageView;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||
|
||||
public class MainActivity extends AppCompatActivity implements SortTypeBottomSheetFragment.SortTypeSelectionCallback,
|
||||
public class MainActivity extends BaseActivity implements SortTypeBottomSheetFragment.SortTypeSelectionCallback,
|
||||
PostTypeBottomSheetFragment.PostTypeSelectionCallback {
|
||||
|
||||
static final String EXTRA_POST_TYPE = "EPT";
|
||||
@ -202,21 +192,12 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
|
||||
setTheme(R.style.AppTheme_NoActionBarWithTransparentStatusBar);
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
|
||||
getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
ButterKnife.bind(this);
|
||||
@ -273,24 +254,6 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe
|
||||
}
|
||||
}
|
||||
|
||||
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||
switch (themeType) {
|
||||
case 0:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||
break;
|
||||
case 1:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||
break;
|
||||
case 2:
|
||||
if (systemDefault) {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||
} else {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
postTypeBottomSheetFragment = new PostTypeBottomSheetFragment();
|
||||
|
||||
bestSortTypeBottomSheetFragment = new SortTypeBottomSheetFragment();
|
||||
@ -348,6 +311,11 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public SharedPreferences getSharedPreferences() {
|
||||
return mSharedPreferences;
|
||||
}
|
||||
|
||||
private void getCurrentAccountAndBindView() {
|
||||
new GetCurrentAccountAsyncTask(mRedditDataRoomDatabase.accountDao(), account -> {
|
||||
boolean enableNotification = mSharedPreferences.getBoolean(SharedPreferencesUtils.ENABLE_NOTIFICATION_KEY, true);
|
||||
@ -944,7 +912,7 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onChangeFontSizeEvent(ChangeFontSizeEvent changeFontSizeEvent) {
|
||||
public void onRecreateActivityEvent(RecreateActivityEvent recreateActivityEvent) {
|
||||
recreate();
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,6 @@ package ml.docilealligator.infinityforreddit.Activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
@ -11,7 +10,6 @@ import android.provider.MediaStore;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
@ -19,12 +17,9 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.content.FileProvider;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
@ -49,27 +44,18 @@ import butterknife.ButterKnife;
|
||||
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.LoadSubredditIconAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.ContentFontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Event.SubmitImagePostEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
import ml.docilealligator.infinityforreddit.Flair;
|
||||
import ml.docilealligator.infinityforreddit.FontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.FlairBottomSheetFragment;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.SubmitPostService;
|
||||
import ml.docilealligator.infinityforreddit.TitleFontStyle;
|
||||
import pl.droidsonroids.gif.GifImageView;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||
|
||||
public class PostImageActivity extends AppCompatActivity implements FlairBottomSheetFragment.FlairSelectionCallback {
|
||||
public class PostImageActivity extends BaseActivity implements FlairBottomSheetFragment.FlairSelectionCallback {
|
||||
|
||||
static final String EXTRA_SUBREDDIT_NAME = "ESN";
|
||||
|
||||
@ -152,18 +138,9 @@ public class PostImageActivity extends AppCompatActivity implements FlairBottomS
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
|
||||
getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_post_image);
|
||||
|
||||
@ -171,32 +148,6 @@ public class PostImageActivity extends AppCompatActivity implements FlairBottomS
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
Window window = getWindow();
|
||||
if ((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
||||
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor));
|
||||
}
|
||||
|
||||
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||
switch (themeType) {
|
||||
case 0:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||
break;
|
||||
case 1:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||
break;
|
||||
case 2:
|
||||
if (systemDefault) {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||
} else {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
@ -367,6 +318,11 @@ public class PostImageActivity extends AppCompatActivity implements FlairBottomS
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public SharedPreferences getSharedPreferences() {
|
||||
return mSharedPreferences;
|
||||
}
|
||||
|
||||
private void getCurrentAccount() {
|
||||
new GetCurrentAccountAsyncTask(mRedditDataRoomDatabase.accountDao(), account -> {
|
||||
if (account == null) {
|
||||
|
@ -2,24 +2,18 @@ package ml.docilealligator.infinityforreddit.Activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.RequestManager;
|
||||
@ -39,28 +33,19 @@ import butterknife.ButterKnife;
|
||||
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.LoadSubredditIconAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.ContentFontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Event.SubmitTextOrLinkPostEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
import ml.docilealligator.infinityforreddit.Flair;
|
||||
import ml.docilealligator.infinityforreddit.FontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.FlairBottomSheetFragment;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.RedditUtils;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.SubmitPostService;
|
||||
import ml.docilealligator.infinityforreddit.TitleFontStyle;
|
||||
import pl.droidsonroids.gif.GifImageView;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||
|
||||
public class PostLinkActivity extends AppCompatActivity implements FlairBottomSheetFragment.FlairSelectionCallback {
|
||||
public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFragment.FlairSelectionCallback {
|
||||
|
||||
static final String EXTRA_SUBREDDIT_NAME = "ESN";
|
||||
static final String EXTRA_LINK = "EL";
|
||||
@ -127,18 +112,9 @@ public class PostLinkActivity extends AppCompatActivity implements FlairBottomSh
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
|
||||
getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_post_link);
|
||||
|
||||
@ -146,32 +122,6 @@ public class PostLinkActivity extends AppCompatActivity implements FlairBottomSh
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
Window window = getWindow();
|
||||
if ((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
||||
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor));
|
||||
}
|
||||
|
||||
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||
switch (themeType) {
|
||||
case 0:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||
break;
|
||||
case 1:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||
break;
|
||||
case 2:
|
||||
if (systemDefault) {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||
} else {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
@ -306,6 +256,11 @@ public class PostLinkActivity extends AppCompatActivity implements FlairBottomSh
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public SharedPreferences getSharedPreferences() {
|
||||
return mSharedPreferences;
|
||||
}
|
||||
|
||||
private void getCurrentAccount() {
|
||||
new GetCurrentAccountAsyncTask(mRedditDataRoomDatabase.accountDao(), account -> {
|
||||
if (account == null) {
|
||||
|
@ -2,24 +2,18 @@ package ml.docilealligator.infinityforreddit.Activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.RequestManager;
|
||||
@ -39,28 +33,19 @@ import butterknife.ButterKnife;
|
||||
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.LoadSubredditIconAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.ContentFontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Event.SubmitTextOrLinkPostEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
import ml.docilealligator.infinityforreddit.Flair;
|
||||
import ml.docilealligator.infinityforreddit.FontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.FlairBottomSheetFragment;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.RedditUtils;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.SubmitPostService;
|
||||
import ml.docilealligator.infinityforreddit.TitleFontStyle;
|
||||
import pl.droidsonroids.gif.GifImageView;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||
|
||||
public class PostTextActivity extends AppCompatActivity implements FlairBottomSheetFragment.FlairSelectionCallback {
|
||||
public class PostTextActivity extends BaseActivity implements FlairBottomSheetFragment.FlairSelectionCallback {
|
||||
|
||||
static final String EXTRA_SUBREDDIT_NAME = "ESN";
|
||||
static final String EXTRA_CONTENT = "EC";
|
||||
@ -127,18 +112,9 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
|
||||
getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_post_text);
|
||||
|
||||
@ -146,32 +122,6 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
Window window = getWindow();
|
||||
if ((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
||||
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor));
|
||||
}
|
||||
|
||||
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||
switch (themeType) {
|
||||
case 0:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||
break;
|
||||
case 1:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||
break;
|
||||
case 2:
|
||||
if (systemDefault) {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||
} else {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
@ -310,6 +260,11 @@ public class PostTextActivity extends AppCompatActivity implements FlairBottomSh
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public SharedPreferences getSharedPreferences() {
|
||||
return mSharedPreferences;
|
||||
}
|
||||
|
||||
private void getCurrentAccount() {
|
||||
new GetCurrentAccountAsyncTask(mRedditDataRoomDatabase.accountDao(), account -> {
|
||||
if (account == null) {
|
||||
|
@ -2,7 +2,6 @@ package ml.docilealligator.infinityforreddit.Activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
@ -10,19 +9,15 @@ import android.provider.MediaStore;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.RequestManager;
|
||||
@ -51,27 +46,18 @@ import butterknife.ButterKnife;
|
||||
import jp.wasabeef.glide.transformations.RoundedCornersTransformation;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.LoadSubredditIconAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.ContentFontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Event.SubmitVideoPostEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
import ml.docilealligator.infinityforreddit.Flair;
|
||||
import ml.docilealligator.infinityforreddit.FontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.FlairBottomSheetFragment;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.SubmitPostService;
|
||||
import ml.docilealligator.infinityforreddit.TitleFontStyle;
|
||||
import pl.droidsonroids.gif.GifImageView;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||
|
||||
public class PostVideoActivity extends AppCompatActivity implements FlairBottomSheetFragment.FlairSelectionCallback {
|
||||
public class PostVideoActivity extends BaseActivity implements FlairBottomSheetFragment.FlairSelectionCallback {
|
||||
|
||||
static final String EXTRA_SUBREDDIT_NAME = "ESN";
|
||||
|
||||
@ -160,18 +146,9 @@ public class PostVideoActivity extends AppCompatActivity implements FlairBottomS
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
|
||||
getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_post_video);
|
||||
|
||||
@ -179,32 +156,6 @@ public class PostVideoActivity extends AppCompatActivity implements FlairBottomS
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
Window window = getWindow();
|
||||
if ((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
||||
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor));
|
||||
}
|
||||
|
||||
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||
switch (themeType) {
|
||||
case 0:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||
break;
|
||||
case 1:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||
break;
|
||||
case 2:
|
||||
if (systemDefault) {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||
} else {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
@ -372,6 +323,11 @@ public class PostVideoActivity extends AppCompatActivity implements FlairBottomS
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public SharedPreferences getSharedPreferences() {
|
||||
return mSharedPreferences;
|
||||
}
|
||||
|
||||
private void getCurrentAccount() {
|
||||
new GetCurrentAccountAsyncTask(mRedditDataRoomDatabase.accountDao(), account -> {
|
||||
if (account == null) {
|
||||
|
@ -15,8 +15,6 @@ import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@ -38,28 +36,19 @@ import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.Adapter.RulesRecyclerViewAdapter;
|
||||
import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
|
||||
import ml.docilealligator.infinityforreddit.ContentFontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
import ml.docilealligator.infinityforreddit.FontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.JSONUtils;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditAPI;
|
||||
import ml.docilealligator.infinityforreddit.Rule;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.TitleFontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Utils;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||
|
||||
public class RulesActivity extends AppCompatActivity {
|
||||
public class RulesActivity extends BaseActivity {
|
||||
|
||||
static final String EXTRA_SUBREDDIT_NAME = "ESN";
|
||||
|
||||
@ -83,18 +72,9 @@ public class RulesActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
|
||||
getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_rules);
|
||||
|
||||
@ -150,24 +130,6 @@ public class RulesActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||
switch (themeType) {
|
||||
case 0:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||
break;
|
||||
case 1:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||
break;
|
||||
case 2:
|
||||
if (systemDefault) {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||
} else {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
@ -180,6 +142,11 @@ public class RulesActivity extends AppCompatActivity {
|
||||
fetchRules();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SharedPreferences getSharedPreferences() {
|
||||
return mSharedPreferences;
|
||||
}
|
||||
|
||||
private void fetchRules() {
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
errorTextView.setVisibility(View.GONE);
|
||||
|
@ -4,23 +4,17 @@ import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.ferfalk.simplesearchview.SimpleSearchView;
|
||||
|
||||
@ -31,20 +25,11 @@ import javax.inject.Inject;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.ContentFontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
import ml.docilealligator.infinityforreddit.FontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.TitleFontStyle;
|
||||
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||
|
||||
public class SearchActivity extends AppCompatActivity {
|
||||
public class SearchActivity extends BaseActivity {
|
||||
|
||||
static final String EXTRA_QUERY = "EQ";
|
||||
static final String EXTRA_SUBREDDIT_NAME = "ESN";
|
||||
@ -75,18 +60,9 @@ public class SearchActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
|
||||
getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_search);
|
||||
|
||||
@ -94,35 +70,9 @@ public class SearchActivity extends AppCompatActivity {
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
Window window = getWindow();
|
||||
if ((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
||||
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor));
|
||||
}
|
||||
|
||||
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||
switch (themeType) {
|
||||
case 0:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||
break;
|
||||
case 1:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||
break;
|
||||
case 2:
|
||||
if (systemDefault) {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||
} else {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
boolean searchOnlySubreddits = getIntent().getExtras().getBoolean(EXTRA_SEARCH_ONLY_SUBREDDITS);
|
||||
boolean searchOnlySubreddits = getIntent().getBooleanExtra(EXTRA_SEARCH_ONLY_SUBREDDITS, false);
|
||||
|
||||
simpleSearchView.setOnSearchViewListener(new SimpleSearchView.SearchViewListener() {
|
||||
@Override
|
||||
@ -211,6 +161,11 @@ public class SearchActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SharedPreferences getSharedPreferences() {
|
||||
return mSharedPreferences;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
|
@ -14,8 +14,6 @@ import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
@ -34,10 +32,8 @@ import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.ContentFontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
import ml.docilealligator.infinityforreddit.FontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.PostFragment;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.SearchPostSortTypeBottomSheetFragment;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.SearchUserAndSubredditSortTypeBottomSheetFragment;
|
||||
@ -48,15 +44,8 @@ import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.PostDataSource;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.TitleFontStyle;
|
||||
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||
|
||||
public class SearchResultActivity extends AppCompatActivity implements SearchPostSortTypeBottomSheetFragment.SearchSortTypeSelectionCallback,
|
||||
public class SearchResultActivity extends BaseActivity implements SearchPostSortTypeBottomSheetFragment.SearchSortTypeSelectionCallback,
|
||||
SearchUserAndSubredditSortTypeBottomSheetFragment.SearchUserAndSubredditSortTypeSelectionCallback {
|
||||
static final String EXTRA_QUERY = "QK";
|
||||
static final String EXTRA_SUBREDDIT_NAME = "ESN";
|
||||
@ -87,18 +76,9 @@ public class SearchResultActivity extends AppCompatActivity implements SearchPos
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
|
||||
getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_search_result);
|
||||
|
||||
@ -144,24 +124,6 @@ public class SearchResultActivity extends AppCompatActivity implements SearchPos
|
||||
}
|
||||
}
|
||||
|
||||
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||
switch (themeType) {
|
||||
case 0:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||
break;
|
||||
case 1:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||
break;
|
||||
case 2:
|
||||
if (systemDefault) {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||
} else {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
@ -196,6 +158,11 @@ public class SearchResultActivity extends AppCompatActivity implements SearchPos
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SharedPreferences getSharedPreferences() {
|
||||
return mSharedPreferences;
|
||||
}
|
||||
|
||||
private void getCurrentAccountAndInitializeViewPager() {
|
||||
new GetCurrentAccountAsyncTask(mRedditDataRoomDatabase.accountDao(), account -> {
|
||||
if (account == null) {
|
||||
|
@ -14,8 +14,6 @@ import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
@ -30,22 +28,13 @@ import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.ContentFontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
import ml.docilealligator.infinityforreddit.FontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.SubredditListingFragment;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.TitleFontStyle;
|
||||
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||
|
||||
public class SearchSubredditsResultActivity extends AppCompatActivity {
|
||||
public class SearchSubredditsResultActivity extends BaseActivity {
|
||||
|
||||
static final String EXTRA_QUERY = "EQ";
|
||||
static final String EXTRA_RETURN_SUBREDDIT_NAME = "ERSN";
|
||||
@ -71,18 +60,9 @@ public class SearchSubredditsResultActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
|
||||
getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_search_subreddits_result);
|
||||
|
||||
@ -128,24 +108,6 @@ public class SearchSubredditsResultActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||
switch (themeType) {
|
||||
case 0:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||
break;
|
||||
case 1:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||
break;
|
||||
case 2:
|
||||
if (systemDefault) {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||
} else {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
@ -166,6 +128,11 @@ public class SearchSubredditsResultActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SharedPreferences getSharedPreferences() {
|
||||
return mSharedPreferences;
|
||||
}
|
||||
|
||||
private void getCurrentAccountAndInitializeFragment(String query) {
|
||||
new GetCurrentAccountAsyncTask(mRedditDataRoomDatabase.accountDao(), account -> {
|
||||
if (account == null) {
|
||||
|
@ -4,15 +4,13 @@ import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.TypedValue;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
@ -21,21 +19,12 @@ import javax.inject.Inject;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.ContentFontStyle;
|
||||
import ml.docilealligator.infinityforreddit.FontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.Settings.AboutPreferenceFragment;
|
||||
import ml.docilealligator.infinityforreddit.Settings.MainPreferenceFragment;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.TitleFontStyle;
|
||||
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||
|
||||
public class SettingsActivity extends AppCompatActivity implements
|
||||
public class SettingsActivity extends BaseActivity implements
|
||||
PreferenceFragmentCompat.OnPreferenceStartFragmentCallback {
|
||||
|
||||
private static final String TITLE_STATE = "TS";
|
||||
@ -48,20 +37,11 @@ public class SettingsActivity extends AppCompatActivity implements
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
|
||||
getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
setContentView(R.layout.settings_activity);
|
||||
setContentView(R.layout.activity_settings);
|
||||
|
||||
ButterKnife.bind(this);
|
||||
|
||||
@ -70,25 +50,10 @@ public class SettingsActivity extends AppCompatActivity implements
|
||||
if ((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
||||
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
window.setNavigationBarColor(ContextCompat.getColor(this, R.color.navBarColor));
|
||||
}
|
||||
|
||||
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||
switch (themeType) {
|
||||
case 0:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||
break;
|
||||
case 1:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||
break;
|
||||
case 2:
|
||||
if (systemDefault) {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||
} else {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||
}
|
||||
|
||||
TypedValue typedValue = new TypedValue();
|
||||
getTheme().resolveAttribute(R.attr.navBarColor, typedValue, true);
|
||||
int navBarColor = typedValue.data;
|
||||
window.setNavigationBarColor(navBarColor);
|
||||
}
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
@ -108,8 +73,11 @@ public class SettingsActivity extends AppCompatActivity implements
|
||||
setTitle(R.string.settings_about_master_title);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SharedPreferences getSharedPreferences() {
|
||||
return mSharedPreferences;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,8 +16,6 @@ import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
@ -36,27 +34,18 @@ import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.InsertSubscribedThingsAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.ContentFontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
import ml.docilealligator.infinityforreddit.FetchSubscribedThing;
|
||||
import ml.docilealligator.infinityforreddit.FontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.SubscribedSubredditsListingFragment;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditData;
|
||||
import ml.docilealligator.infinityforreddit.SubscribedSubredditDatabase.SubscribedSubredditData;
|
||||
import ml.docilealligator.infinityforreddit.SubscribedUserDatabase.SubscribedUserData;
|
||||
import ml.docilealligator.infinityforreddit.TitleFontStyle;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||
|
||||
public class SubredditSelectionActivity extends AppCompatActivity {
|
||||
public class SubredditSelectionActivity extends BaseActivity {
|
||||
|
||||
static final String EXTRA_EXTRA_CLEAR_SELECTION = "EECS";
|
||||
static final String EXTRA_RETURN_SUBREDDIT_NAME = "ERSN";
|
||||
@ -91,18 +80,9 @@ public class SubredditSelectionActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
|
||||
getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_subreddit_selection);
|
||||
|
||||
@ -151,24 +131,6 @@ public class SubredditSelectionActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||
switch (themeType) {
|
||||
case 0:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||
break;
|
||||
case 1:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||
break;
|
||||
case 2:
|
||||
if (systemDefault) {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||
} else {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
@ -190,6 +152,11 @@ public class SubredditSelectionActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SharedPreferences getSharedPreferences() {
|
||||
return mSharedPreferences;
|
||||
}
|
||||
|
||||
private void getCurrentAccountAndBindView() {
|
||||
new GetCurrentAccountAsyncTask(mRedditDataRoomDatabase.accountDao(), account -> {
|
||||
if (account == null) {
|
||||
|
@ -12,8 +12,6 @@ import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
@ -36,28 +34,19 @@ import butterknife.ButterKnife;
|
||||
import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.InsertSubscribedThingsAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.ContentFontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
import ml.docilealligator.infinityforreddit.FetchSubscribedThing;
|
||||
import ml.docilealligator.infinityforreddit.FontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.FollowedUsersListingFragment;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.SubscribedSubredditsListingFragment;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditData;
|
||||
import ml.docilealligator.infinityforreddit.SubscribedSubredditDatabase.SubscribedSubredditData;
|
||||
import ml.docilealligator.infinityforreddit.SubscribedUserDatabase.SubscribedUserData;
|
||||
import ml.docilealligator.infinityforreddit.TitleFontStyle;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||
|
||||
public class SubscribedThingListingActivity extends AppCompatActivity {
|
||||
public class SubscribedThingListingActivity extends BaseActivity {
|
||||
|
||||
private static final String INSERT_SUBSCRIBED_SUBREDDIT_STATE = "ISSS";
|
||||
private static final String NULL_ACCESS_TOKEN_STATE = "NATS";
|
||||
@ -87,18 +76,9 @@ public class SubscribedThingListingActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
|
||||
getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_subscribed_thing_listing);
|
||||
|
||||
@ -147,24 +127,6 @@ public class SubscribedThingListingActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||
switch (themeType) {
|
||||
case 0:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||
break;
|
||||
case 1:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||
break;
|
||||
case 2:
|
||||
if (systemDefault) {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||
} else {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
@ -183,6 +145,11 @@ public class SubscribedThingListingActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SharedPreferences getSharedPreferences() {
|
||||
return mSharedPreferences;
|
||||
}
|
||||
|
||||
private void getCurrentAccountAndInitializeViewPager() {
|
||||
new GetCurrentAccountAsyncTask(mRedditDataRoomDatabase.accountDao(), account -> {
|
||||
if (account == null) {
|
||||
|
@ -17,8 +17,6 @@ import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
@ -43,25 +41,16 @@ import ml.docilealligator.infinityforreddit.Adapter.MessageRecyclerViewAdapter;
|
||||
import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.SwitchAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.ContentFontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
import ml.docilealligator.infinityforreddit.FetchMessages;
|
||||
import ml.docilealligator.infinityforreddit.FontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.MessageViewModel;
|
||||
import ml.docilealligator.infinityforreddit.NetworkState;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.TitleFontStyle;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||
|
||||
public class ViewMessageActivity extends AppCompatActivity {
|
||||
public class ViewMessageActivity extends BaseActivity {
|
||||
|
||||
public static final String EXTRA_NEW_ACCOUNT_NAME = "ENAN";
|
||||
|
||||
@ -101,18 +90,9 @@ public class ViewMessageActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
|
||||
getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_view_message);
|
||||
|
||||
@ -168,24 +148,6 @@ public class ViewMessageActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||
switch (themeType) {
|
||||
case 0:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||
break;
|
||||
case 1:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||
break;
|
||||
case 2:
|
||||
if (systemDefault) {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||
} else {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
toolbar.setTitle(R.string.inbox);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
@ -205,6 +167,11 @@ public class ViewMessageActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SharedPreferences getSharedPreferences() {
|
||||
return mSharedPreferences;
|
||||
}
|
||||
|
||||
private void getCurrentAccountAndFetchMessage() {
|
||||
new GetCurrentAccountAsyncTask(mRedditDataRoomDatabase.accountDao(), account -> {
|
||||
if (mNewAccountName != null) {
|
||||
|
@ -20,8 +20,6 @@ import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
@ -53,7 +51,6 @@ import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.SwitchAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.CommentData;
|
||||
import ml.docilealligator.infinityforreddit.ContentFontStyle;
|
||||
import ml.docilealligator.infinityforreddit.DeleteThing;
|
||||
import ml.docilealligator.infinityforreddit.Event.ChangeNSFWBlurEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.ChangeSpoilerBlurEvent;
|
||||
@ -63,7 +60,6 @@ import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
import ml.docilealligator.infinityforreddit.FetchComment;
|
||||
import ml.docilealligator.infinityforreddit.FetchPost;
|
||||
import ml.docilealligator.infinityforreddit.Flair;
|
||||
import ml.docilealligator.infinityforreddit.FontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.FlairBottomSheetFragment;
|
||||
import ml.docilealligator.infinityforreddit.HidePost;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
@ -77,20 +73,15 @@ import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.RedditUtils;
|
||||
import ml.docilealligator.infinityforreddit.SaveThing;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.TitleFontStyle;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||
import static ml.docilealligator.infinityforreddit.Activity.CommentActivity.EXTRA_COMMENT_DATA_KEY;
|
||||
import static ml.docilealligator.infinityforreddit.Activity.CommentActivity.WRITE_COMMENT_REQUEST_CODE;
|
||||
|
||||
public class ViewPostDetailActivity extends AppCompatActivity implements FlairBottomSheetFragment.FlairSelectionCallback {
|
||||
public class ViewPostDetailActivity extends BaseActivity implements FlairBottomSheetFragment.FlairSelectionCallback {
|
||||
|
||||
public static final String EXTRA_POST_DATA = "EPD";
|
||||
public static final String EXTRA_POST_LIST_POSITION = "EPLI";
|
||||
@ -168,18 +159,9 @@ public class ViewPostDetailActivity extends AppCompatActivity implements FlairBo
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
|
||||
getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_view_post_detail);
|
||||
|
||||
@ -236,24 +218,6 @@ public class ViewPostDetailActivity extends AppCompatActivity implements FlairBo
|
||||
}
|
||||
}
|
||||
|
||||
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||
switch (themeType) {
|
||||
case 0:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||
break;
|
||||
case 1:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||
break;
|
||||
case 2:
|
||||
if (systemDefault) {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||
} else {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
toolbar.setTitle("");
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
@ -288,6 +252,11 @@ public class ViewPostDetailActivity extends AppCompatActivity implements FlairBo
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SharedPreferences getSharedPreferences() {
|
||||
return mSharedPreferences;
|
||||
}
|
||||
|
||||
private void getCurrentAccountAndBindView() {
|
||||
new GetCurrentAccountAsyncTask(mRedditDataRoomDatabase.accountDao(), account -> {
|
||||
if (mNewAccountName != null) {
|
||||
|
@ -17,8 +17,6 @@ import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.fragment.app.Fragment;
|
||||
@ -46,11 +44,9 @@ import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.CheckIsSubscribedToSubredditAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.SwitchAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.ContentFontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
import ml.docilealligator.infinityforreddit.FetchSubredditData;
|
||||
import ml.docilealligator.infinityforreddit.FontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.PostFragment;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.PostTypeBottomSheetFragment;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.SortTypeBottomSheetFragment;
|
||||
@ -60,21 +56,14 @@ import ml.docilealligator.infinityforreddit.PostDataSource;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.ReadMessage;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditDao;
|
||||
import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditData;
|
||||
import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditViewModel;
|
||||
import ml.docilealligator.infinityforreddit.SubredditSubscription;
|
||||
import ml.docilealligator.infinityforreddit.TitleFontStyle;
|
||||
import pl.droidsonroids.gif.GifImageView;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||
|
||||
public class ViewSubredditDetailActivity extends AppCompatActivity implements SortTypeBottomSheetFragment.SortTypeSelectionCallback,
|
||||
public class ViewSubredditDetailActivity extends BaseActivity implements SortTypeBottomSheetFragment.SortTypeSelectionCallback,
|
||||
PostTypeBottomSheetFragment.PostTypeSelectionCallback {
|
||||
|
||||
public static final String EXTRA_SUBREDDIT_NAME_KEY = "ESN";
|
||||
@ -146,18 +135,9 @@ public class ViewSubredditDetailActivity extends AppCompatActivity implements So
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
|
||||
getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_view_subreddit_detail);
|
||||
|
||||
@ -205,24 +185,6 @@ public class ViewSubredditDetailActivity extends AppCompatActivity implements So
|
||||
}
|
||||
}
|
||||
|
||||
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||
switch (themeType) {
|
||||
case 0:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||
break;
|
||||
case 1:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||
break;
|
||||
case 2:
|
||||
if (systemDefault) {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||
} else {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
subredditName = getIntent().getStringExtra(EXTRA_SUBREDDIT_NAME_KEY);
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
@ -349,6 +311,11 @@ public class ViewSubredditDetailActivity extends AppCompatActivity implements So
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public SharedPreferences getSharedPreferences() {
|
||||
return mSharedPreferences;
|
||||
}
|
||||
|
||||
private void getCurrentAccountAndBindView() {
|
||||
new GetCurrentAccountAsyncTask(mRedditDataRoomDatabase.accountDao(), account -> {
|
||||
if (mNewAccountName != null) {
|
||||
|
@ -7,6 +7,7 @@ import android.content.res.Resources;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
@ -17,8 +18,6 @@ import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.fragment.app.Fragment;
|
||||
@ -50,12 +49,10 @@ import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.CheckIsFollowingUserAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.AsyncTask.SwitchAccountAsyncTask;
|
||||
import ml.docilealligator.infinityforreddit.ContentFontStyle;
|
||||
import ml.docilealligator.infinityforreddit.DeleteThing;
|
||||
import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||
import ml.docilealligator.infinityforreddit.FetchUserData;
|
||||
import ml.docilealligator.infinityforreddit.FontStyle;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.CommentsListingFragment;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.PostFragment;
|
||||
import ml.docilealligator.infinityforreddit.Fragment.UserThingSortTypeBottomSheetFragment;
|
||||
@ -65,9 +62,7 @@ import ml.docilealligator.infinityforreddit.PostDataSource;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.ReadMessage;
|
||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
import ml.docilealligator.infinityforreddit.SubscribedUserDatabase.SubscribedUserDao;
|
||||
import ml.docilealligator.infinityforreddit.TitleFontStyle;
|
||||
import ml.docilealligator.infinityforreddit.User.UserDao;
|
||||
import ml.docilealligator.infinityforreddit.User.UserData;
|
||||
import ml.docilealligator.infinityforreddit.User.UserViewModel;
|
||||
@ -75,12 +70,7 @@ import ml.docilealligator.infinityforreddit.UserFollowing;
|
||||
import pl.droidsonroids.gif.GifImageView;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
|
||||
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
|
||||
|
||||
public class ViewUserDetailActivity extends AppCompatActivity implements UserThingSortTypeBottomSheetFragment.UserThingSortTypeSelectionCallback {
|
||||
public class ViewUserDetailActivity extends BaseActivity implements UserThingSortTypeBottomSheetFragment.UserThingSortTypeSelectionCallback {
|
||||
|
||||
public static final String EXTRA_USER_NAME_KEY = "EUNK";
|
||||
public static final String EXTRA_MESSAGE_FULLNAME = "ENF";
|
||||
@ -150,18 +140,9 @@ public class ViewUserDetailActivity extends AppCompatActivity implements UserThi
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
((Infinity) getApplication()).getAppComponent().inject(this);
|
||||
|
||||
getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true);
|
||||
|
||||
getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences
|
||||
.getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.activity_view_user_detail);
|
||||
|
||||
@ -169,24 +150,6 @@ public class ViewUserDetailActivity extends AppCompatActivity implements UserThi
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||
int themeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2"));
|
||||
switch (themeType) {
|
||||
case 0:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO);
|
||||
break;
|
||||
case 1:
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES);
|
||||
break;
|
||||
case 2:
|
||||
if (systemDefault) {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_FOLLOW_SYSTEM);
|
||||
} else {
|
||||
AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
username = getIntent().getStringExtra(EXTRA_USER_NAME_KEY);
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
@ -234,13 +197,19 @@ public class ViewUserDetailActivity extends AppCompatActivity implements UserThi
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
expandedTabTextColor = resources.getColor(R.color.tabLayoutWithExpandedCollapsingToolbarTextColor);
|
||||
expandedTabBackgroundColor = resources.getColor(R.color.tabLayoutWithExpandedCollapsingToolbarTabBackground);
|
||||
expandedTabIndicatorColor = resources.getColor(R.color.tabLayoutWithExpandedCollapsingToolbarTabIndicator);
|
||||
|
||||
TypedValue expandedTabBackgroundColorTypedValue = new TypedValue();
|
||||
getTheme().resolveAttribute(R.attr.tabLayoutWithExpandedCollapsingToolbarTabBackground, expandedTabBackgroundColorTypedValue, true);
|
||||
expandedTabBackgroundColor = expandedTabBackgroundColorTypedValue.data;
|
||||
|
||||
collapsedTabTextColor = resources.getColor(R.color.tabLayoutWithCollapsedCollapsingToolbarTextColor);
|
||||
collapsedTabBackgroundColor = resources.getColor(R.color.tabLayoutWithCollapsedCollapsingToolbarTabBackground);
|
||||
collapsedTabIndicatorColor = resources.getColor(R.color.tabLayoutWithCollapsedCollapsingToolbarTabIndicator);
|
||||
|
||||
TypedValue collapsedTabBackgroundColorTypedValue = new TypedValue();
|
||||
getTheme().resolveAttribute(R.attr.tabLayoutWithCollapsedCollapsingToolbarTabBackground, collapsedTabBackgroundColorTypedValue, true);
|
||||
collapsedTabBackgroundColor = collapsedTabBackgroundColorTypedValue.data;
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1
|
||||
&& (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT
|
||||
|| resources.getBoolean(R.bool.isTablet))) {
|
||||
@ -418,6 +387,11 @@ public class ViewUserDetailActivity extends AppCompatActivity implements UserThi
|
||||
userThingSortTypeBottomSheetFragment = new UserThingSortTypeBottomSheetFragment();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SharedPreferences getSharedPreferences() {
|
||||
return mSharedPreferences;
|
||||
}
|
||||
|
||||
private void getCurrentAccountAndInitializeViewPager() {
|
||||
new GetCurrentAccountAsyncTask(mRedditDataRoomDatabase.accountDao(), account -> {
|
||||
if (mNewAccountName != null) {
|
||||
|
@ -9,6 +9,7 @@ import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.util.Linkify;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -106,6 +107,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
||||
private boolean isInitiallyLoadingFailed;
|
||||
private boolean mHasMoreComments;
|
||||
private boolean loadMoreCommentsFailed;
|
||||
private int mCommentBackgroundColor;
|
||||
|
||||
public CommentAndPostRecyclerViewAdapter(Activity activity, Retrofit retrofit, Retrofit oauthRetrofit,
|
||||
RedditDataRoomDatabase redditDataRoomDatabase, RequestManager glide,
|
||||
@ -152,6 +154,10 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
||||
isInitiallyLoadingFailed = false;
|
||||
mHasMoreComments = false;
|
||||
loadMoreCommentsFailed = false;
|
||||
|
||||
TypedValue typedValue = new TypedValue();
|
||||
mActivity.getTheme().resolveAttribute(R.attr.cardViewBackgroundColor, typedValue, true);
|
||||
mCommentBackgroundColor = typedValue.data;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1204,8 +1210,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
||||
params.width = 0;
|
||||
((CommentViewHolder) holder).verticalBlock.setLayoutParams(params);
|
||||
((CommentViewHolder) holder).itemView.setPadding(0, 0, 0, 0);
|
||||
((CommentViewHolder) holder).itemView.setBackgroundColor(
|
||||
mActivity.getResources().getColor(R.color.cardViewBackgroundColor));
|
||||
((CommentViewHolder) holder).itemView.setBackgroundColor(mCommentBackgroundColor);
|
||||
} else if (holder instanceof PostDetailViewHolder) {
|
||||
((PostDetailViewHolder) holder).mUpvoteButton.clearColorFilter();
|
||||
((PostDetailViewHolder) holder).mScoreTextView.setTextColor(ContextCompat.getColor(mActivity, R.color.defaultTextColor));
|
||||
|
@ -5,6 +5,7 @@ import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.net.Uri;
|
||||
import android.text.util.Linkify;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -53,6 +54,7 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl
|
||||
private Resources mResources;
|
||||
private NetworkState networkState;
|
||||
private RetryLoadingMoreCallback mRetryLoadingMoreCallback;
|
||||
private int mMessageBackgroundColor;
|
||||
|
||||
public MessageRecyclerViewAdapter(Context context, Retrofit oauthRetrofit, String accessToken,
|
||||
RetryLoadingMoreCallback retryLoadingMoreCallback) {
|
||||
@ -81,6 +83,10 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl
|
||||
.build();
|
||||
mAccessToken = accessToken;
|
||||
mResources = context.getResources();
|
||||
|
||||
TypedValue typedValue = new TypedValue();
|
||||
mContext.getTheme().resolveAttribute(R.attr.cardViewBackgroundColor, typedValue, true);
|
||||
mMessageBackgroundColor = typedValue.data;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@ -126,7 +132,7 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl
|
||||
}
|
||||
|
||||
if (message.isNew()) {
|
||||
((DataViewHolder) holder).itemView.setBackgroundColor(mResources.getColor(R.color.backgroundColor));
|
||||
((DataViewHolder) holder).itemView.setBackgroundColor(mMessageBackgroundColor);
|
||||
message.setNew(false);
|
||||
|
||||
ReadMessage.readMessage(mOauthRetrofit, mAccessToken, message.getFullname(),
|
||||
@ -183,7 +189,7 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl
|
||||
public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) {
|
||||
super.onViewRecycled(holder);
|
||||
if (holder instanceof DataViewHolder) {
|
||||
((DataViewHolder) holder).itemView.setBackgroundColor(mResources.getColor(R.color.backgroundColor));
|
||||
((DataViewHolder) holder).itemView.setBackgroundColor(mMessageBackgroundColor);
|
||||
((DataViewHolder) holder).titleTextView.setVisibility(View.VISIBLE);
|
||||
((DataViewHolder) holder).authorTextView.setTextColor(mResources.getColor(R.color.primaryTextColor));
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package ml.docilealligator.infinityforreddit.Event;
|
||||
|
||||
public class ChangeFontSizeEvent {
|
||||
public class RecreateActivityEvent {
|
||||
}
|
@ -48,31 +48,33 @@ public class PostTypeBottomSheetFragment extends RoundedBottomSheetDialogFragmen
|
||||
|
||||
Activity activity = getActivity();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||
&& (getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
||||
rootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
if (activity != null) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||
&& (getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_YES) {
|
||||
rootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
|
||||
textTypeLinearLayout.setOnClickListener(view -> {
|
||||
((PostTypeSelectionCallback) activity).postTypeSelected(TYPE_TEXT);
|
||||
dismiss();
|
||||
});
|
||||
|
||||
linkTypeLinearLayout.setOnClickListener(view -> {
|
||||
((PostTypeSelectionCallback) activity).postTypeSelected(TYPE_LINK);
|
||||
dismiss();
|
||||
});
|
||||
|
||||
imageTypeLinearLayout.setOnClickListener(view -> {
|
||||
((PostTypeSelectionCallback) activity).postTypeSelected(TYPE_IMAGE);
|
||||
dismiss();
|
||||
});
|
||||
|
||||
videoTypeLinearLayout.setOnClickListener(view -> {
|
||||
((PostTypeSelectionCallback) activity).postTypeSelected(TYPE_VIDEO);
|
||||
dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
textTypeLinearLayout.setOnClickListener(view -> {
|
||||
((PostTypeSelectionCallback) activity).postTypeSelected(TYPE_TEXT);
|
||||
dismiss();
|
||||
});
|
||||
|
||||
linkTypeLinearLayout.setOnClickListener(view -> {
|
||||
((PostTypeSelectionCallback) activity).postTypeSelected(TYPE_LINK);
|
||||
dismiss();
|
||||
});
|
||||
|
||||
imageTypeLinearLayout.setOnClickListener(view -> {
|
||||
((PostTypeSelectionCallback) activity).postTypeSelected(TYPE_IMAGE);
|
||||
dismiss();
|
||||
});
|
||||
|
||||
videoTypeLinearLayout.setOnClickListener(view -> {
|
||||
((PostTypeSelectionCallback) activity).postTypeSelected(TYPE_VIDEO);
|
||||
dismiss();
|
||||
});
|
||||
|
||||
return rootView;
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ import androidx.preference.PreferenceFragmentCompat;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import ml.docilealligator.infinityforreddit.Event.ChangeFontSizeEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.RecreateActivityEvent;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
|
||||
@ -25,7 +25,7 @@ public class FontSizePreferenceFragment extends PreferenceFragmentCompat {
|
||||
|
||||
if (fontSizePreference != null) {
|
||||
fontSizePreference.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
EventBus.getDefault().post(new ChangeFontSizeEvent());
|
||||
EventBus.getDefault().post(new RecreateActivityEvent());
|
||||
activity.recreate();
|
||||
return true;
|
||||
});
|
||||
@ -33,14 +33,14 @@ public class FontSizePreferenceFragment extends PreferenceFragmentCompat {
|
||||
|
||||
if (titleFontSizePreference != null) {
|
||||
titleFontSizePreference.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
EventBus.getDefault().post(new ChangeFontSizeEvent());
|
||||
EventBus.getDefault().post(new RecreateActivityEvent());
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
if (contentFontSizePreference != null) {
|
||||
contentFontSizePreference.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
EventBus.getDefault().post(new ChangeFontSizeEvent());
|
||||
EventBus.getDefault().post(new RecreateActivityEvent());
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package ml.docilealligator.infinityforreddit.Settings;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
||||
@ -18,6 +19,7 @@ import javax.inject.Inject;
|
||||
import ml.docilealligator.infinityforreddit.Event.ChangeNSFWBlurEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.ChangeSpoilerBlurEvent;
|
||||
import ml.docilealligator.infinityforreddit.Event.RecreateActivityEvent;
|
||||
import ml.docilealligator.infinityforreddit.Infinity;
|
||||
import ml.docilealligator.infinityforreddit.R;
|
||||
import ml.docilealligator.infinityforreddit.SharedPreferencesUtils;
|
||||
@ -43,11 +45,22 @@ public class MainPreferenceFragment extends PreferenceFragmentCompat {
|
||||
if (activity != null) {
|
||||
((Infinity) activity.getApplication()).getAppComponent().inject(this);
|
||||
|
||||
SwitchPreference amoledDarkSwitch = findPreference(SharedPreferencesUtils.AMOLED_DARK_KEY);
|
||||
SwitchPreference nsfwSwitch = findPreference(SharedPreferencesUtils.NSFW_KEY);
|
||||
SwitchPreference blurNSFWSwitch = findPreference(SharedPreferencesUtils.BLUR_NSFW_KEY);
|
||||
SwitchPreference blurSpoilerSwitch = findPreference(SharedPreferencesUtils.BLUR_SPOILER_KEY);
|
||||
ListPreference themePreference = findPreference(SharedPreferencesUtils.THEME_KEY);
|
||||
|
||||
if(amoledDarkSwitch != null) {
|
||||
amoledDarkSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
if((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_NO) {
|
||||
EventBus.getDefault().post(new RecreateActivityEvent());
|
||||
activity.recreate();
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
if (nsfwSwitch != null) {
|
||||
nsfwSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
EventBus.getDefault().post(new ChangeNSFWEvent((Boolean) newValue));
|
||||
|
@ -27,4 +27,5 @@ public class SharedPreferencesUtils {
|
||||
public static final String FONT_SIZE_KEY = "font_size";
|
||||
public static final String TITLE_FONT_SIZE_KEY = "title_font_size";
|
||||
public static final String CONTENT_FONT_SIZE_KEY = "content_font_size";
|
||||
public static final String AMOLED_DARK_KEY = "amoled_dark";
|
||||
}
|
||||
|
@ -4,12 +4,14 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/backgroundColor"
|
||||
tools:context=".Activity.AccountPostsActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar_layout_account_posts_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
|
@ -4,12 +4,14 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/backgroundColor"
|
||||
tools:context=".Activity.AccountPostsActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar_layout_account_saved_thing_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
@ -35,7 +37,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@color/greyTabBackgroundColor"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
app:tabGravity="fill"
|
||||
app:tabIndicatorColor="@android:color/white"
|
||||
|
@ -5,11 +5,13 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/coordinator_layout_comment_activity"
|
||||
android:background="?attr/backgroundColor"
|
||||
tools:application=".CommentActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
|
@ -5,11 +5,13 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/coordinator_layout_edit_comment_activity"
|
||||
android:background="?attr/backgroundColor"
|
||||
tools:context=".Activity.EditCommentActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
|
@ -5,11 +5,13 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/coordinator_layout_edit_post_activity"
|
||||
android:background="?attr/backgroundColor"
|
||||
tools:context=".Activity.EditPostActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
|
@ -4,12 +4,14 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/backgroundColor"
|
||||
tools:application=".FilteredPostsActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar_layout_filtered_posts_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
|
@ -4,11 +4,13 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/backgroundColor"
|
||||
tools:application="ml.docilealligator.infinityforreddit.Activity.LoginActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
|
@ -5,6 +5,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
android:background="?attr/backgroundColor"
|
||||
tools:openDrawer="start">
|
||||
|
||||
<include
|
||||
@ -16,7 +17,8 @@
|
||||
android:id="@+id/nav_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start">
|
||||
android:layout_gravity="start"
|
||||
android:background="?attr/backgroundColor">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/nested_scroll_view_main_activity"
|
||||
|
@ -5,11 +5,13 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/coordinator_layout_post_image_activity"
|
||||
android:background="?attr/backgroundColor"
|
||||
tools:application=".PostImageActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
|
@ -5,11 +5,13 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/coordinator_layout_post_link_activity"
|
||||
android:background="?attr/backgroundColor"
|
||||
tools:application=".PostTextActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
|
@ -5,11 +5,13 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/coordinator_layout_post_text_activity"
|
||||
android:background="?attr/backgroundColor"
|
||||
tools:application=".PostTextActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
|
@ -5,11 +5,13 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/coordinator_layout_post_video_activity"
|
||||
android:background="?attr/backgroundColor"
|
||||
tools:application=".PostImageActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
|
@ -4,12 +4,14 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/backgroundColor"
|
||||
tools:application=".RulesActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar_layout_rules_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
|
@ -4,11 +4,13 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/backgroundColor"
|
||||
tools:application=".SearchActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<FrameLayout
|
||||
@ -34,7 +36,7 @@
|
||||
app:hintColor="#E0E0E0"
|
||||
app:iconsAlpha="1"
|
||||
app:iconsTint="@android:color/white"
|
||||
app:searchBackground="@color/colorPrimary"
|
||||
app:searchBackground="?attr/colorPrimary"
|
||||
app:voiceSearch="true" />
|
||||
|
||||
</FrameLayout>
|
||||
|
@ -3,12 +3,14 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/backgroundColor">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar_layout_search_result_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
@ -30,7 +32,7 @@
|
||||
android:id="@+id/tab_layout_search_result_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/greyTabBackgroundColor"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
app:tabGravity="fill"
|
||||
app:tabMode="fixed"
|
||||
|
@ -4,12 +4,14 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/backgroundColor"
|
||||
tools:application=".SearchSubredditsResultActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar_layout_search_subreddits_result_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
|
@ -1,11 +1,13 @@
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
android:background="?attr/backgroundColor">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
@ -4,12 +4,14 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/backgroundColor"
|
||||
tools:application=".SubredditSelectionActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar_layout_subreddit_selection_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
|
@ -4,12 +4,14 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/backgroundColor"
|
||||
tools:application=".SubscribedThingListingActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar_layout_subscribed_thing_listing_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
@ -33,7 +35,7 @@
|
||||
android:id="@+id/tab_layout_subscribed_thing_listing_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/greyTabBackgroundColor"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
app:tabGravity="fill"
|
||||
app:tabMode="fixed"
|
||||
|
@ -4,12 +4,14 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/backgroundColor"
|
||||
tools:context=".Activity.ViewMessageActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar_layout_view_message_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
@ -45,7 +47,7 @@
|
||||
android:layout_marginBottom="16dp"
|
||||
app:mlpb_progress_stoke_width="3dp"
|
||||
app:mlpb_progress_color="@color/colorAccent"
|
||||
app:mlpb_background_color="@color/circularProgressBarBackground" />
|
||||
app:mlpb_background_color="?attr/circularProgressBarBackground" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view_view_message_activity"
|
||||
|
@ -5,13 +5,14 @@
|
||||
android:id="@+id/coordinator_layout_view_post_detail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/cardViewBackgroundColor"
|
||||
android:background="?attr/backgroundColor"
|
||||
tools:application=".ViewPostDetailActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar_layout_view_post_detail_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
|
@ -5,12 +5,14 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/coordinator_layout_view_subreddit_detail_activity"
|
||||
android:background="?attr/backgroundColor"
|
||||
tools:application=".ViewSubredditDetailActivity">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appbar_layout_view_subreddit_detail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
@ -50,7 +52,7 @@
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:layout_below="@id/banner_image_view_view_subreddit_detail_activity"
|
||||
android:background="@color/backgroundColor">
|
||||
android:background="?attr/backgroundColor">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subreddit_name_text_view_view_subreddit_detail_activity"
|
||||
|
@ -5,6 +5,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/coordinator_layout_view_user_detail_activity"
|
||||
android:background="?attr/backgroundColor"
|
||||
tools:application=".ViewUserDetailActivity">
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
@ -17,6 +18,7 @@
|
||||
android:id="@+id/appbar_layout_view_user_detail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
@ -56,7 +58,7 @@
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:layout_below="@id/banner_image_view_view_user_detail_activity"
|
||||
android:background="@color/backgroundColor">
|
||||
android:background="?attr/backgroundColor">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/user_name_text_view_view_user_detail_activity"
|
||||
@ -106,6 +108,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
app:tabGravity="fill"
|
||||
app:tabMode="fixed"
|
||||
|
@ -11,6 +11,7 @@
|
||||
android:id="@+id/appbar_layout_main_activity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
@ -36,7 +37,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@color/greyTabBackgroundColor"
|
||||
android:background="?attr/toolbarAndTabBackgroundColor"
|
||||
app:layout_scrollFlags="scroll|enterAlways"
|
||||
app:tabGravity="fill"
|
||||
app:tabIndicatorColor="@android:color/white"
|
||||
|
@ -15,7 +15,7 @@
|
||||
android:layout_marginBottom="16dp"
|
||||
app:mlpb_progress_stoke_width="3dp"
|
||||
app:mlpb_progress_color="@color/colorAccent"
|
||||
app:mlpb_background_color="@color/circularProgressBarBackground"
|
||||
app:mlpb_background_color="?attr/circularProgressBarBackground"
|
||||
android:layout_gravity="center_horizontal"/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
|
@ -4,6 +4,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="?attr/backgroundColor"
|
||||
tools:application=".FlairBottomSheetFragment">
|
||||
|
||||
<TextView
|
||||
|
@ -13,7 +13,7 @@
|
||||
android:layout_marginBottom="16dp"
|
||||
app:mlpb_progress_stoke_width="3dp"
|
||||
app:mlpb_progress_color="@color/colorAccent"
|
||||
app:mlpb_background_color="@color/circularProgressBarBackground"
|
||||
app:mlpb_background_color="?attr/circularProgressBarBackground"
|
||||
android:layout_gravity="center_horizontal"/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
|
@ -15,7 +15,7 @@
|
||||
android:layout_marginBottom="16dp"
|
||||
app:mlpb_progress_stoke_width="3dp"
|
||||
app:mlpb_progress_color="@color/colorAccent"
|
||||
app:mlpb_background_color="@color/circularProgressBarBackground"
|
||||
app:mlpb_background_color="?attr/circularProgressBarBackground"
|
||||
android:layout_gravity="center_horizontal"/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
|
@ -15,7 +15,7 @@
|
||||
android:layout_marginBottom="16dp"
|
||||
app:mlpb_progress_stoke_width="3dp"
|
||||
app:mlpb_progress_color="@color/colorAccent"
|
||||
app:mlpb_background_color="@color/circularProgressBarBackground"
|
||||
app:mlpb_background_color="?attr/circularProgressBarBackground"
|
||||
android:layout_gravity="center_horizontal"/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
|
@ -5,7 +5,7 @@
|
||||
android:id="@+id/linear_layout_item_comment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/cardViewBackgroundColor">
|
||||
android:background="?attr/cardViewBackgroundColor">
|
||||
|
||||
<View
|
||||
android:id="@+id/vertical_block_item_post_comment"
|
||||
|
@ -12,7 +12,7 @@
|
||||
android:layout_margin="16dp"
|
||||
app:mlpb_progress_stoke_width="3dp"
|
||||
app:mlpb_progress_color="@color/colorAccent"
|
||||
app:mlpb_background_color="@color/circularProgressBarBackground"
|
||||
app:mlpb_background_color="?attr/circularProgressBarBackground"
|
||||
android:layout_gravity="center_horizontal"/>
|
||||
|
||||
</LinearLayout>
|
@ -2,7 +2,7 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/cardViewBackgroundColor">
|
||||
android:background="?attr/cardViewBackgroundColor">
|
||||
|
||||
<View
|
||||
android:id="@+id/vertical_block_item_load_more_comments"
|
||||
|
@ -2,7 +2,8 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp">
|
||||
android:padding="16dp"
|
||||
android:background="?attr/cardViewBackgroundColor">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/author_text_view_item_message"
|
||||
|
@ -1,12 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.google.android.material.card.MaterialCardView 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:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:id="@+id/card_view_item_post"
|
||||
app:cardBackgroundColor="?attr/cardViewBackgroundColor"
|
||||
app:cardElevation="2dp"
|
||||
app:cardCornerRadius="16dp">
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/cardViewBackgroundColor">
|
||||
android:background="?attr/cardViewBackgroundColor">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/relative_layout_item_post_detail"
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/nav_header_height"
|
||||
android:background="@drawable/side_nav_bar"
|
||||
|
@ -5,15 +5,13 @@
|
||||
<color name="colorAccent">#FF4081</color>
|
||||
|
||||
<color name="transparentActionBarAndExoPlayerControllerColor">#88000000</color>
|
||||
|
||||
|
||||
<color name="gold">#FFC107</color>
|
||||
|
||||
<color name="primaryTextColor">#FFFFFF</color>
|
||||
|
||||
<color name="colorPrimaryDarkDayNightTheme">#1E88E5</color>
|
||||
|
||||
<color name="circularProgressBarBackground">#242424</color>
|
||||
|
||||
<color name="dividerColor">#69666C</color>
|
||||
|
||||
<color name="grey">#424242</color>
|
||||
@ -62,5 +60,5 @@
|
||||
<color name="commentVerticalBar6">#00B925</color>
|
||||
<color name="commentVerticalBar7">#EE4602</color>
|
||||
|
||||
<color name="greyTabBackgroundColor">#282828</color>
|
||||
<color name="toolbarAndTabBackgroundColor">#282828</color>
|
||||
</resources>
|
||||
|
@ -25,4 +25,17 @@
|
||||
<attr name="content_font_18" format="dimension"/>
|
||||
<attr name="content_font_20" format="dimension"/>
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="Theme">
|
||||
<attr name="colorPrimary" format="color"/>
|
||||
<attr name="colorPrimaryDark" format="color"/>
|
||||
<attr name="backgroundColor" format="color"/>
|
||||
<attr name="roundedBottomSheetPrimaryBackground" format="color"/>
|
||||
<attr name="cardViewBackgroundColor" format="color"/>
|
||||
<attr name="toolbarAndTabBackgroundColor" format="color"/>
|
||||
<attr name="circularProgressBarBackground" format="color"/>
|
||||
<attr name="tabLayoutWithExpandedCollapsingToolbarTabBackground" format="color"/>
|
||||
<attr name="tabLayoutWithCollapsedCollapsingToolbarTabBackground" format="color"/>
|
||||
<attr name="navBarColor" format="color" />
|
||||
</declare-styleable>
|
||||
</resources>
|
@ -12,8 +12,6 @@
|
||||
|
||||
<color name="colorPrimaryDarkDayNightTheme">@color/colorPrimaryDark</color>
|
||||
|
||||
<color name="circularProgressBarBackground">#FFFFFF</color>
|
||||
|
||||
<color name="dividerColor">#E0E0E0</color>
|
||||
|
||||
<color name="grey">#E0E0E0</color>
|
||||
@ -70,7 +68,7 @@
|
||||
<color name="commentVerticalBar6">#02EE6E</color>
|
||||
<color name="commentVerticalBar7">#EE4602</color>
|
||||
|
||||
<color name="greyTabBackgroundColor">@color/colorPrimary</color>
|
||||
<color name="toolbarAndTabBackgroundColor">@color/colorPrimary</color>
|
||||
|
||||
<color name="submitter">#EE8A02</color>
|
||||
|
||||
|
@ -273,6 +273,7 @@
|
||||
<string name="settings_theme_light__theme_summary">Light Theme</string>
|
||||
<string name="settings_theme_dark_theme_summary">Dark Theme</string>
|
||||
<string name="settings_theme_system_default_summary">Device default</string>
|
||||
<string name="settings_amoled_dark_title">Amoled Dark</string>
|
||||
<string name="settings_lazy_mode_interval_title">Lazy Mode Interval</string>
|
||||
<string name="settings_font_size_title">Font Size</string>
|
||||
<string name="settings_title_font_size_title">Title Font Size</string>
|
||||
|
@ -3,8 +3,8 @@
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorPrimary">?attr/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">?attr/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
<item name="android:navigationBarColor">@android:color/black</item>
|
||||
<item name="android:textColorPrimary">@android:color/white</item>
|
||||
@ -46,6 +46,7 @@
|
||||
|
||||
<style name="MaterialAlertDialogTheme" parent="ThemeOverlay.MaterialComponents.MaterialAlertDialog">
|
||||
<item name="android:textSize">?attr/font_default</item>
|
||||
<item name="android:background">?attr/cardViewBackgroundColor</item>
|
||||
<item name="materialAlertDialogTitleTextStyle">@style/MaterialAlertDialogTitleTextStyle</item>
|
||||
<item name="materialAlertDialogBodyTextStyle">@style/MaterialAlertDialogBodyTextStyle</item>
|
||||
<item name="buttonBarPositiveButtonStyle">@style/MaterialAlertDialogPositiveButtonStyle</item>
|
||||
@ -74,6 +75,7 @@
|
||||
<item name="android:textColorPrimary">@color/primaryTextColor</item>
|
||||
<item name="buttonBarPositiveButtonStyle">@style/MaterialAlertDialogPositiveButtonStyle</item>
|
||||
<item name="buttonBarNegativeButtonStyle">@style/MaterialAlertDialogNegativeButtonStyle</item>
|
||||
<item name="alertDialogTheme">@style/ListPreferenceStyle</item>
|
||||
</style>
|
||||
|
||||
<style name="PreferenceTitleTextStyle">
|
||||
@ -85,6 +87,10 @@
|
||||
<item name="android:textSize">?attr/font_default</item>
|
||||
</style>
|
||||
|
||||
<style name="ListPreferenceStyle" parent="ThemeOverlay.AppCompat.Dialog.Alert">
|
||||
<item name="android:background">?attr/cardViewBackgroundColor</item>
|
||||
</style>
|
||||
|
||||
<style name="FontStyle" />
|
||||
|
||||
<style name="FontStyle.Small">
|
||||
@ -195,4 +201,45 @@
|
||||
<item name="content_font_20">26sp</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme" />
|
||||
|
||||
<style name="Theme.Default">
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="backgroundColor">@color/backgroundColor</item>
|
||||
<item name="roundedBottomSheetPrimaryBackground">@color/roundedBottomSheetPrimaryBackground</item>
|
||||
<item name="cardViewBackgroundColor">@color/cardViewBackgroundColor</item>
|
||||
<item name="toolbarAndTabBackgroundColor">@color/toolbarAndTabBackgroundColor</item>
|
||||
<item name="circularProgressBarBackground">#FFFFFF</item>
|
||||
<item name="tabLayoutWithExpandedCollapsingToolbarTabBackground">#FFFFFF</item>
|
||||
<item name="tabLayoutWithCollapsedCollapsingToolbarTabBackground">@color/colorPrimary</item>
|
||||
<item name="navBarColor">@color/backgroundColor</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Default.NormalDark">
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="backgroundColor">@color/backgroundColor</item>
|
||||
<item name="roundedBottomSheetPrimaryBackground">@color/roundedBottomSheetPrimaryBackground</item>
|
||||
<item name="cardViewBackgroundColor">@color/cardViewBackgroundColor</item>
|
||||
<item name="toolbarAndTabBackgroundColor">@color/toolbarAndTabBackgroundColor</item>
|
||||
<item name="circularProgressBarBackground">@color/colorPrimary</item>
|
||||
<item name="tabLayoutWithExpandedCollapsingToolbarTabBackground">@color/backgroundColor</item>
|
||||
<item name="tabLayoutWithCollapsedCollapsingToolbarTabBackground">@color/colorPrimary</item>
|
||||
<item name="navBarColor">@color/backgroundColor</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Default.AmoledDark">
|
||||
<item name="colorPrimary">#000000</item>
|
||||
<item name="colorPrimaryDark">#000000</item>
|
||||
<item name="backgroundColor">#000000</item>
|
||||
<item name="roundedBottomSheetPrimaryBackground">#000000</item>
|
||||
<item name="cardViewBackgroundColor">#000000</item>
|
||||
<item name="toolbarAndTabBackgroundColor">#000000</item>
|
||||
<item name="circularProgressBarBackground">#000000</item>
|
||||
<item name="tabLayoutWithExpandedCollapsingToolbarTabBackground">#000000</item>
|
||||
<item name="tabLayoutWithCollapsedCollapsingToolbarTabBackground">#000000</item>
|
||||
<item name="navBarColor">#000000</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
@ -15,6 +15,11 @@
|
||||
app:title="@string/settings_theme_title"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
|
||||
<SwitchPreference
|
||||
app:defaultValue="false"
|
||||
app:key="amoled_dark"
|
||||
app:title="@string/settings_amoled_dark_title" />
|
||||
|
||||
<ListPreference
|
||||
app:defaultValue="2.5"
|
||||
android:entries="@array/settings_lazy_mode_interval"
|
||||
|
Loading…
x
Reference in New Issue
Block a user