aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java18
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java12
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MultiRedditListingActivity.java7
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubscribedThingListingActivity.java32
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ThemePreviewActivity.java6
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewGIFActivity.java18
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageActivity.java18
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImgurMediaActivity.java18
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewVideoActivity.java17
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/MultiRedditOptionsBottomSheetFragment.java10
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Font/ContentFontFamily.java29
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Font/ContentFontStyle.java (renamed from app/src/main/java/ml/docilealligator/infinityforreddit/ContentFontStyle.java)4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Font/FontFamily.java29
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Font/FontStyle.java (renamed from app/src/main/java/ml/docilealligator/infinityforreddit/FontStyle.java)4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Font/TitleFontFamily.java29
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Font/TitleFontStyle.java (renamed from app/src/main/java/ml/docilealligator/infinityforreddit/TitleFontStyle.java)4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ThemePreviewPostsFragment.java6
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CustomizeMainPageTabsFragment.java7
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Settings/FontPreferenceFragment.java (renamed from app/src/main/java/ml/docilealligator/infinityforreddit/Settings/FontSizePreferenceFragment.java)29
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java3
20 files changed, 258 insertions, 42 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java
index 1eb8aa0a..883d0ce8 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java
@@ -27,11 +27,14 @@ import com.google.android.material.tabs.TabLayout;
import ml.docilealligator.infinityforreddit.ActivityToolbarInterface;
import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
-import ml.docilealligator.infinityforreddit.ContentFontStyle;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
-import ml.docilealligator.infinityforreddit.FontStyle;
+import ml.docilealligator.infinityforreddit.Font.ContentFontFamily;
+import ml.docilealligator.infinityforreddit.Font.ContentFontStyle;
+import ml.docilealligator.infinityforreddit.Font.FontFamily;
+import ml.docilealligator.infinityforreddit.Font.FontStyle;
+import ml.docilealligator.infinityforreddit.Font.TitleFontFamily;
+import ml.docilealligator.infinityforreddit.Font.TitleFontStyle;
import ml.docilealligator.infinityforreddit.R;
-import ml.docilealligator.infinityforreddit.TitleFontStyle;
import ml.docilealligator.infinityforreddit.Utils.CustomThemeSharedPreferencesUtils;
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
@@ -113,6 +116,15 @@ public abstract class BaseActivity extends AppCompatActivity {
getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences
.getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true);
+ getTheme().applyStyle(FontFamily.valueOf(mSharedPreferences
+ .getString(SharedPreferencesUtils.FONT_FAMILY_KEY, FontFamily.Default.name())).getResId(), true);
+
+ getTheme().applyStyle(TitleFontFamily.valueOf(mSharedPreferences
+ .getString(SharedPreferencesUtils.TITLE_FONT_FAMILY_KEY, TitleFontFamily.Default.name())).getResId(), true);
+
+ getTheme().applyStyle(ContentFontFamily.valueOf(mSharedPreferences
+ .getString(SharedPreferencesUtils.CONTENT_FONT_FAMILY_KEY, ContentFontFamily.Default.name())).getResId(), true);
+
Window window = getWindow();
View decorView = window.getDecorView();
if (!hasDrawerLayout) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java
index 14c12d2e..ad7458f7 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java
@@ -1366,9 +1366,17 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
void goBackToTop() {
if (viewPager.getCurrentItem() == 0) {
- tab1.goBackToTop();
+ if (mAccessToken != null && tab1 != null) {
+ tab1.goBackToTop();
+ } else if (tab2 != null) {
+ tab2.goBackToTop();
+ }
} else if (viewPager.getCurrentItem() == 1) {
- tab2.goBackToTop();
+ if (mAccessToken != null && tab2 != null) {
+ tab2.goBackToTop();
+ } else if (tab3 != null) {
+ tab3.goBackToTop();
+ }
} else {
tab3.goBackToTop();
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MultiRedditListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MultiRedditListingActivity.java
index 2ef1d14f..2db98f2c 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MultiRedditListingActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MultiRedditListingActivity.java
@@ -27,8 +27,6 @@ import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
-import org.greenrobot.eventbus.Subscribe;
-
import java.util.ArrayList;
import javax.inject.Inject;
@@ -41,7 +39,6 @@ import ml.docilealligator.infinityforreddit.Adapter.MultiRedditListingRecyclerVi
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
import ml.docilealligator.infinityforreddit.AsyncTask.InsertMultiRedditAsyncTask;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
-import ml.docilealligator.infinityforreddit.Event.RefreshMultiRedditsEvent;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.MultiReddit.DeleteMultiReddit;
import ml.docilealligator.infinityforreddit.MultiReddit.FetchMyMultiReddits;
@@ -292,8 +289,8 @@ public class MultiRedditListingActivity extends BaseActivity {
.show();
}
- @Subscribe
+ /*@Subscribe
public void onRefreshMultiRedditsEvent(RefreshMultiRedditsEvent event) {
loadMultiReddits();
- }
+ }*/
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubscribedThingListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubscribedThingListingActivity.java
index c1919782..e6f3d8b7 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubscribedThingListingActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubscribedThingListingActivity.java
@@ -18,6 +18,7 @@ import androidx.fragment.app.FragmentPagerAdapter;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.appbar.AppBarLayout;
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.tabs.TabLayout;
import org.greenrobot.eventbus.EventBus;
@@ -36,6 +37,7 @@ import ml.docilealligator.infinityforreddit.AsyncTask.InsertMultiRedditAsyncTask
import ml.docilealligator.infinityforreddit.AsyncTask.InsertSubscribedThingsAsyncTask;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.Event.GoBackToMainPageEvent;
+import ml.docilealligator.infinityforreddit.Event.RefreshMultiRedditsEvent;
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
import ml.docilealligator.infinityforreddit.FetchSubscribedThing;
import ml.docilealligator.infinityforreddit.Fragment.FollowedUsersListingFragment;
@@ -43,6 +45,7 @@ import ml.docilealligator.infinityforreddit.Fragment.MultiRedditListingFragment;
import ml.docilealligator.infinityforreddit.Fragment.SubscribedSubredditsListingFragment;
import ml.docilealligator.infinityforreddit.FragmentCommunicator;
import ml.docilealligator.infinityforreddit.Infinity;
+import ml.docilealligator.infinityforreddit.MultiReddit.DeleteMultiReddit;
import ml.docilealligator.infinityforreddit.MultiReddit.FetchMyMultiReddits;
import ml.docilealligator.infinityforreddit.MultiReddit.MultiReddit;
import ml.docilealligator.infinityforreddit.R;
@@ -261,6 +264,30 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti
});
}
+ public void deleteMultiReddit(MultiReddit multiReddit) {
+ new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme)
+ .setTitle(R.string.delete)
+ .setMessage(R.string.delete_multi_reddit_dialog_message)
+ .setPositiveButton(R.string.delete, (dialogInterface, i)
+ -> DeleteMultiReddit.deleteMultiReddit(mOauthRetrofit, mRedditDataRoomDatabase,
+ mAccessToken, mAccountName, multiReddit.getPath(), new DeleteMultiReddit.DeleteMultiRedditListener() {
+ @Override
+ public void success() {
+ Toast.makeText(SubscribedThingListingActivity.this,
+ R.string.delete_multi_reddit_success, Toast.LENGTH_SHORT).show();
+ loadMultiReddits();
+ }
+
+ @Override
+ public void failed() {
+ Toast.makeText(SubscribedThingListingActivity.this,
+ R.string.delete_multi_reddit_failed, Toast.LENGTH_SHORT).show();
+ }
+ }))
+ .setNegativeButton(R.string.cancel, null)
+ .show();
+ }
+
@Subscribe
public void onAccountSwitchEvent(SwitchAccountEvent event) {
finish();
@@ -271,6 +298,11 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti
finish();
}
+ @Subscribe
+ public void onRefreshMultiRedditsEvent(RefreshMultiRedditsEvent event) {
+ loadMultiReddits();
+ }
+
@Override
public void onLongPress() {
if (sectionsPagerAdapter != null) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ThemePreviewActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ThemePreviewActivity.java
index c9a08f48..015f0a37 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ThemePreviewActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ThemePreviewActivity.java
@@ -41,15 +41,15 @@ import javax.inject.Named;
import butterknife.BindView;
import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
-import ml.docilealligator.infinityforreddit.ContentFontStyle;
+import ml.docilealligator.infinityforreddit.Font.ContentFontStyle;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomTheme;
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeSettingsItem;
-import ml.docilealligator.infinityforreddit.FontStyle;
+import ml.docilealligator.infinityforreddit.Font.FontStyle;
import ml.docilealligator.infinityforreddit.Fragment.ThemePreviewCommentsFragment;
import ml.docilealligator.infinityforreddit.Fragment.ThemePreviewPostsFragment;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
-import ml.docilealligator.infinityforreddit.TitleFontStyle;
+import ml.docilealligator.infinityforreddit.Font.TitleFontStyle;
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewGIFActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewGIFActivity.java
index 8bdc82fe..cafbaed4 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewGIFActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewGIFActivity.java
@@ -47,11 +47,14 @@ import butterknife.BindView;
import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.AsyncTask.SaveGIFToFileAsyncTask;
import ml.docilealligator.infinityforreddit.BuildConfig;
-import ml.docilealligator.infinityforreddit.ContentFontStyle;
-import ml.docilealligator.infinityforreddit.FontStyle;
+import ml.docilealligator.infinityforreddit.Font.ContentFontFamily;
+import ml.docilealligator.infinityforreddit.Font.ContentFontStyle;
+import ml.docilealligator.infinityforreddit.Font.FontFamily;
+import ml.docilealligator.infinityforreddit.Font.FontStyle;
+import ml.docilealligator.infinityforreddit.Font.TitleFontFamily;
+import ml.docilealligator.infinityforreddit.Font.TitleFontStyle;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
-import ml.docilealligator.infinityforreddit.TitleFontStyle;
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
import pl.droidsonroids.gif.GifImageView;
@@ -96,6 +99,15 @@ public class ViewGIFActivity extends AppCompatActivity {
getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences
.getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true);
+ getTheme().applyStyle(FontFamily.valueOf(mSharedPreferences
+ .getString(SharedPreferencesUtils.FONT_FAMILY_KEY, FontFamily.Default.name())).getResId(), true);
+
+ getTheme().applyStyle(TitleFontFamily.valueOf(mSharedPreferences
+ .getString(SharedPreferencesUtils.TITLE_FONT_FAMILY_KEY, TitleFontFamily.Default.name())).getResId(), true);
+
+ getTheme().applyStyle(ContentFontFamily.valueOf(mSharedPreferences
+ .getString(SharedPreferencesUtils.CONTENT_FONT_FAMILY_KEY, ContentFontFamily.Default.name())).getResId(), true);
+
setContentView(R.layout.activity_view_gif);
ButterKnife.bind(this);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageActivity.java
index 779d7fe7..ea3bde7f 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageActivity.java
@@ -49,11 +49,14 @@ import butterknife.BindView;
import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.AsyncTask.SaveImageToFileAsyncTask;
import ml.docilealligator.infinityforreddit.BuildConfig;
-import ml.docilealligator.infinityforreddit.ContentFontStyle;
-import ml.docilealligator.infinityforreddit.FontStyle;
+import ml.docilealligator.infinityforreddit.Font.ContentFontFamily;
+import ml.docilealligator.infinityforreddit.Font.ContentFontStyle;
+import ml.docilealligator.infinityforreddit.Font.FontFamily;
+import ml.docilealligator.infinityforreddit.Font.FontStyle;
+import ml.docilealligator.infinityforreddit.Font.TitleFontFamily;
+import ml.docilealligator.infinityforreddit.Font.TitleFontStyle;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
-import ml.docilealligator.infinityforreddit.TitleFontStyle;
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
public class ViewImageActivity extends AppCompatActivity {
@@ -97,6 +100,15 @@ public class ViewImageActivity extends AppCompatActivity {
getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences
.getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true);
+ getTheme().applyStyle(FontFamily.valueOf(mSharedPreferences
+ .getString(SharedPreferencesUtils.FONT_FAMILY_KEY, FontFamily.Default.name())).getResId(), true);
+
+ getTheme().applyStyle(TitleFontFamily.valueOf(mSharedPreferences
+ .getString(SharedPreferencesUtils.TITLE_FONT_FAMILY_KEY, TitleFontFamily.Default.name())).getResId(), true);
+
+ getTheme().applyStyle(ContentFontFamily.valueOf(mSharedPreferences
+ .getString(SharedPreferencesUtils.CONTENT_FONT_FAMILY_KEY, ContentFontFamily.Default.name())).getResId(), true);
+
setContentView(R.layout.activity_view_image);
ButterKnife.bind(this);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImgurMediaActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImgurMediaActivity.java
index 9e0b95e7..f38315db 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImgurMediaActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImgurMediaActivity.java
@@ -33,14 +33,17 @@ import javax.inject.Named;
import butterknife.BindView;
import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.API.ImgurAPI;
-import ml.docilealligator.infinityforreddit.ContentFontStyle;
-import ml.docilealligator.infinityforreddit.FontStyle;
+import ml.docilealligator.infinityforreddit.Font.ContentFontFamily;
+import ml.docilealligator.infinityforreddit.Font.ContentFontStyle;
+import ml.docilealligator.infinityforreddit.Font.FontFamily;
+import ml.docilealligator.infinityforreddit.Font.FontStyle;
+import ml.docilealligator.infinityforreddit.Font.TitleFontFamily;
+import ml.docilealligator.infinityforreddit.Font.TitleFontStyle;
import ml.docilealligator.infinityforreddit.Fragment.ViewImgurImageFragment;
import ml.docilealligator.infinityforreddit.Fragment.ViewImgurVideoFragment;
import ml.docilealligator.infinityforreddit.ImgurMedia;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
-import ml.docilealligator.infinityforreddit.TitleFontStyle;
import ml.docilealligator.infinityforreddit.Utils.APIUtils;
import ml.docilealligator.infinityforreddit.Utils.JSONUtils;
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
@@ -92,6 +95,15 @@ public class ViewImgurMediaActivity extends AppCompatActivity {
getTheme().applyStyle(ContentFontStyle.valueOf(sharedPreferences
.getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true);
+ getTheme().applyStyle(FontFamily.valueOf(sharedPreferences
+ .getString(SharedPreferencesUtils.FONT_FAMILY_KEY, FontFamily.Default.name())).getResId(), true);
+
+ getTheme().applyStyle(TitleFontFamily.valueOf(sharedPreferences
+ .getString(SharedPreferencesUtils.TITLE_FONT_FAMILY_KEY, TitleFontFamily.Default.name())).getResId(), true);
+
+ getTheme().applyStyle(ContentFontFamily.valueOf(sharedPreferences
+ .getString(SharedPreferencesUtils.CONTENT_FONT_FAMILY_KEY, ContentFontFamily.Default.name())).getResId(), true);
+
setContentView(R.layout.activity_view_imgur_media);
ButterKnife.bind(this);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewVideoActivity.java
index 0bd5f7fc..1bccf67b 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewVideoActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewVideoActivity.java
@@ -57,6 +57,9 @@ import javax.inject.Named;
import butterknife.BindView;
import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.FetchGfycatVideoLinks;
+import ml.docilealligator.infinityforreddit.Font.ContentFontFamily;
+import ml.docilealligator.infinityforreddit.Font.FontFamily;
+import ml.docilealligator.infinityforreddit.Font.TitleFontFamily;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.Service.DownloadRedditVideoService;
@@ -119,11 +122,21 @@ public class ViewVideoActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+
+ ((Infinity) getApplication()).getAppComponent().inject(this);
+
getTheme().applyStyle(R.style.Theme_Normal, true);
- setContentView(R.layout.activity_view_video);
+ getTheme().applyStyle(FontFamily.valueOf(mSharedPreferences
+ .getString(SharedPreferencesUtils.FONT_FAMILY_KEY, FontFamily.Default.name())).getResId(), true);
- ((Infinity) getApplication()).getAppComponent().inject(this);
+ getTheme().applyStyle(TitleFontFamily.valueOf(mSharedPreferences
+ .getString(SharedPreferencesUtils.TITLE_FONT_FAMILY_KEY, TitleFontFamily.Default.name())).getResId(), true);
+
+ getTheme().applyStyle(ContentFontFamily.valueOf(mSharedPreferences
+ .getString(SharedPreferencesUtils.CONTENT_FONT_FAMILY_KEY, ContentFontFamily.Default.name())).getResId(), true);
+
+ setContentView(R.layout.activity_view_video);
ButterKnife.bind(this);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/MultiRedditOptionsBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/MultiRedditOptionsBottomSheetFragment.java
index 60b065ba..27a9ccdc 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/MultiRedditOptionsBottomSheetFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/MultiRedditOptionsBottomSheetFragment.java
@@ -16,7 +16,7 @@ import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment;
import butterknife.BindView;
import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.Activity.EditMultiRedditActivity;
-import ml.docilealligator.infinityforreddit.Activity.MultiRedditListingActivity;
+import ml.docilealligator.infinityforreddit.Activity.SubscribedThingListingActivity;
import ml.docilealligator.infinityforreddit.MultiReddit.MultiReddit;
import ml.docilealligator.infinityforreddit.R;
@@ -31,7 +31,7 @@ public class MultiRedditOptionsBottomSheetFragment extends RoundedBottomSheetDia
TextView editMultiRedditTextView;
@BindView(R.id.delete_multi_reddit_text_view_multi_reddit_options_bottom_sheet_fragment)
TextView deleteMultiRedditTextView;
- private MultiRedditListingActivity multiRedditListingActivity;
+ private SubscribedThingListingActivity subscribedThingListingActivity;
public MultiRedditOptionsBottomSheetFragment() {
// Required empty public constructor
@@ -48,14 +48,14 @@ public class MultiRedditOptionsBottomSheetFragment extends RoundedBottomSheetDia
MultiReddit multiReddit = getArguments().getParcelable(EXTRA_MULTI_REDDIT);
editMultiRedditTextView.setOnClickListener(view -> {
- Intent editIntent = new Intent(multiRedditListingActivity, EditMultiRedditActivity.class);
+ Intent editIntent = new Intent(subscribedThingListingActivity, EditMultiRedditActivity.class);
editIntent.putExtra(EditMultiRedditActivity.EXTRA_MULTI_REDDIT, multiReddit);
startActivity(editIntent);
dismiss();
});
deleteMultiRedditTextView.setOnClickListener(view -> {
- multiRedditListingActivity.deleteMultiReddit(multiReddit);
+ subscribedThingListingActivity.deleteMultiReddit(multiReddit);
dismiss();
});
@@ -65,6 +65,6 @@ public class MultiRedditOptionsBottomSheetFragment extends RoundedBottomSheetDia
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
- multiRedditListingActivity = (MultiRedditListingActivity) context;
+ subscribedThingListingActivity = (SubscribedThingListingActivity) context;
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Font/ContentFontFamily.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/ContentFontFamily.java
new file mode 100644
index 00000000..8b43545f
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/ContentFontFamily.java
@@ -0,0 +1,29 @@
+package ml.docilealligator.infinityforreddit.Font;
+
+import ml.docilealligator.infinityforreddit.R;
+
+public enum ContentFontFamily {
+ Default(R.style.ContentFontFamily, "Default"),
+ BalsamiqSans(R.style.ContentFontFamily_BalsamiqSans, "BalsamiqSans"),
+ NotoSans(R.style.ContentFontFamily_NotoSans, "NotoSans"),
+ RobotoCondensed(R.style.ContentFontFamily_RobotoCondensed, "RobotoCondensed"),
+ HarmoniaSans(R.style.ContentFontFamily_HarmoniaSans, "HarmoniaSans"),
+ Selawk(R.style.ContentFontFamily_Selawk, "Selawk"),
+ Inter(R.style.ContentFontFamily_Inter, "Inter");
+
+ private int resId;
+ private String title;
+
+ ContentFontFamily(int resId, String title) {
+ this.resId = resId;
+ this.title = title;
+ }
+
+ public int getResId() {
+ return resId;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ContentFontStyle.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/ContentFontStyle.java
index 4eee6b53..654cff07 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ContentFontStyle.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/ContentFontStyle.java
@@ -1,4 +1,6 @@
-package ml.docilealligator.infinityforreddit;
+package ml.docilealligator.infinityforreddit.Font;
+
+import ml.docilealligator.infinityforreddit.R;
public enum ContentFontStyle {
Small(R.style.ContentFontStyle_Small, "Small"),
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Font/FontFamily.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/FontFamily.java
new file mode 100644
index 00000000..40540060
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/FontFamily.java
@@ -0,0 +1,29 @@
+package ml.docilealligator.infinityforreddit.Font;
+
+import ml.docilealligator.infinityforreddit.R;
+
+public enum FontFamily {
+ Default(R.style.FontFamily, "Default"),
+ BalsamiqSans(R.style.FontFamily_BalsamiqSans, "BalsamiqSans"),
+ NotoSans(R.style.FontFamily_NotoSans, "NotoSans"),
+ RobotoCondensed(R.style.FontFamily_RobotoCondensed, "RobotoCondensed"),
+ HarmoniaSans(R.style.FontFamily_HarmoniaSans, "HarmoniaSans"),
+ Selawk(R.style.FontFamily_Selawk, "Selawk"),
+ Inter(R.style.FontFamily_Inter, "Inter");
+
+ private int resId;
+ private String title;
+
+ FontFamily(int resId, String title) {
+ this.resId = resId;
+ this.title = title;
+ }
+
+ public int getResId() {
+ return resId;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FontStyle.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/FontStyle.java
index 61d4cfb8..101b17b4 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/FontStyle.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/FontStyle.java
@@ -1,4 +1,6 @@
-package ml.docilealligator.infinityforreddit;
+package ml.docilealligator.infinityforreddit.Font;
+
+import ml.docilealligator.infinityforreddit.R;
public enum FontStyle {
Small(R.style.FontStyle_Small, "Small"),
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Font/TitleFontFamily.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/TitleFontFamily.java
new file mode 100644
index 00000000..9e348bec
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/TitleFontFamily.java
@@ -0,0 +1,29 @@
+package ml.docilealligator.infinityforreddit.Font;
+
+import ml.docilealligator.infinityforreddit.R;
+
+public enum TitleFontFamily {
+ Default(R.style.TitleFontFamily, "Default"),
+ BalsamiqSans(R.style.TitleFontFamily_BalsamiqSans, "BalsamiqSans"),
+ NotoSans(R.style.TitleFontFamily_NotoSans, "NotoSans"),
+ RobotoCondensed(R.style.TitleFontFamily_RobotoCondensed, "RobotoCondensed"),
+ HarmoniaSans(R.style.TitleFontFamily_HarmoniaSans, "HarmoniaSans"),
+ Selawk(R.style.TitleFontFamily_Selawk, "Selawk"),
+ Inter(R.style.TitleFontFamily_Inter, "Inter");
+
+ private int resId;
+ private String title;
+
+ TitleFontFamily(int resId, String title) {
+ this.resId = resId;
+ this.title = title;
+ }
+
+ public int getResId() {
+ return resId;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/TitleFontStyle.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/TitleFontStyle.java
index 5dc32c9d..9ac48525 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/TitleFontStyle.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/TitleFontStyle.java
@@ -1,4 +1,6 @@
-package ml.docilealligator.infinityforreddit;
+package ml.docilealligator.infinityforreddit.Font;
+
+import ml.docilealligator.infinityforreddit.R;
public enum TitleFontStyle {
Small(R.style.TitleFontStyle_Small, "Small"),
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ThemePreviewPostsFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ThemePreviewPostsFragment.java
index e8963f92..eeefeaa0 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ThemePreviewPostsFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ThemePreviewPostsFragment.java
@@ -15,7 +15,6 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.cardview.widget.CardView;
import androidx.core.graphics.drawable.DrawableCompat;
-import androidx.core.widget.NestedScrollView;
import androidx.fragment.app.Fragment;
import com.bumptech.glide.Glide;
@@ -59,6 +58,8 @@ public class ThemePreviewPostsFragment extends Fragment {
CustomTextView nsfwTextView;
@BindView(R.id.flair_custom_text_view_theme_preview_posts_fragment)
CustomTextView flairTextView;
+ @BindView(R.id.awards_text_view_theme_preview_posts_fragment)
+ CustomTextView awardsTextView;
@BindView(R.id.archived_image_view_theme_preview_posts_fragment)
ImageView archivedImageView;
@BindView(R.id.locked_image_view_theme_preview_posts_fragment)
@@ -120,6 +121,9 @@ public class ThemePreviewPostsFragment extends Fragment {
flairTextView.setBackgroundColor(customTheme.flairBackgroundColor);
flairTextView.setBorderColor(customTheme.flairBackgroundColor);
flairTextView.setTextColor(customTheme.flairTextColor);
+ awardsTextView.setBackgroundColor(customTheme.awardsBackgroundColor);
+ awardsTextView.setBorderColor(customTheme.awardsBackgroundColor);
+ awardsTextView.setTextColor(customTheme.awardsTextColor);
archivedImageView.setColorFilter(customTheme.archivedTint, PorterDuff.Mode.SRC_IN);
lockedImageView.setColorFilter(customTheme.lockedIconTint, PorterDuff.Mode.SRC_IN);
crosspostImageView.setColorFilter(customTheme.crosspostIconTint, PorterDuff.Mode.SRC_IN);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CustomizeMainPageTabsFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CustomizeMainPageTabsFragment.java
index 01e2c28e..33ad2ea9 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CustomizeMainPageTabsFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CustomizeMainPageTabsFragment.java
@@ -5,7 +5,6 @@ import android.content.SharedPreferences;
import android.os.Bundle;
import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.preference.EditTextPreference;
import androidx.preference.ListPreference;
@@ -33,12 +32,6 @@ public class CustomizeMainPageTabsFragment extends PreferenceFragmentCompat {
private SettingsActivity activity;
@Override
- public void onCreate(@Nullable Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- }
-
- @Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
setPreferencesFromResource(R.xml.customize_main_page_tabs_preferences, rootKey);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/FontSizePreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/FontPreferenceFragment.java
index 5d4a0a5a..78ae7d82 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/FontSizePreferenceFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/FontPreferenceFragment.java
@@ -14,16 +14,41 @@ import ml.docilealligator.infinityforreddit.Event.RecreateActivityEvent;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
-public class FontSizePreferenceFragment extends PreferenceFragmentCompat {
+public class FontPreferenceFragment extends PreferenceFragmentCompat {
private Activity activity;
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
- setPreferencesFromResource(R.xml.font_size_preferences, rootKey);
+ setPreferencesFromResource(R.xml.font_preferences, rootKey);
+ ListPreference fontFamilyPreference = findPreference(SharedPreferencesUtils.FONT_FAMILY_KEY);
+ ListPreference titleFontFamilyPreference = findPreference(SharedPreferencesUtils.TITLE_FONT_FAMILY_KEY);
+ ListPreference contentFontFamilyPreference = findPreference(SharedPreferencesUtils.CONTENT_FONT_FAMILY_KEY);
ListPreference fontSizePreference = findPreference(SharedPreferencesUtils.FONT_SIZE_KEY);
ListPreference titleFontSizePreference = findPreference(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY);
ListPreference contentFontSizePreference = findPreference(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY);
+ if (fontFamilyPreference != null) {
+ fontFamilyPreference.setOnPreferenceChangeListener((preference, newValue) -> {
+ EventBus.getDefault().post(new RecreateActivityEvent());
+ activity.recreate();
+ return true;
+ });
+ }
+
+ if (titleFontFamilyPreference != null) {
+ titleFontFamilyPreference.setOnPreferenceChangeListener((preference, newValue) -> {
+ EventBus.getDefault().post(new RecreateActivityEvent());
+ return true;
+ });
+ }
+
+ if (contentFontFamilyPreference != null) {
+ contentFontFamilyPreference.setOnPreferenceChangeListener((preference, newValue) -> {
+ EventBus.getDefault().post(new RecreateActivityEvent());
+ return true;
+ });
+ }
+
if (fontSizePreference != null) {
fontSizePreference.setOnPreferenceChangeListener((preference, newValue) -> {
EventBus.getDefault().post(new RecreateActivityEvent());
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java
index a51c9e0b..b29ff3ed 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java
@@ -29,6 +29,9 @@ 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 FONT_FAMILY_KEY = "font_family";
+ public static final String TITLE_FONT_FAMILY_KEY = "title_font_family";
+ public static final String CONTENT_FONT_FAMILY_KEY = "content_font_family";
public static final String AMOLED_DARK_KEY = "amoled_dark";
public static final String IMMERSIVE_INTERFACE_KEY = "immersive_interface";
public static final String IMMERSIVE_INTERFACE_IGNORE_NAV_BAR_KEY = "immersive_interface_ignore_nav_bar";