aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2019-09-20 13:27:00 +0000
committerAlex Ning <chineseperson5@gmail.com>2019-09-20 13:27:00 +0000
commit9ca494d4b5409b12b8262194f736284036858c01 (patch)
treeeabfd8bda9a18cf2c8053d6916627f7ee6f06759 /app/src/main/java/ml
parent010c323769faf9703a84144576ba33eb4410562e (diff)
downloadinfinity-for-reddit-9ca494d4b5409b12b8262194f736284036858c01.tar
infinity-for-reddit-9ca494d4b5409b12b8262194f736284036858c01.tar.gz
infinity-for-reddit-9ca494d4b5409b12b8262194f736284036858c01.tar.bz2
infinity-for-reddit-9ca494d4b5409b12b8262194f736284036858c01.tar.lz
infinity-for-reddit-9ca494d4b5409b12b8262194f736284036858c01.tar.xz
infinity-for-reddit-9ca494d4b5409b12b8262194f736284036858c01.tar.zst
infinity-for-reddit-9ca494d4b5409b12b8262194f736284036858c01.zip
Changing font size is available. Delete duplicate Edit menu in comments.
Diffstat (limited to 'app/src/main/java/ml')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/AccountPostsActivity.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/AccountSavedThingActivity.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java1
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ChangeFontSizeEvent.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/CommentActivity.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/EditCommentActivity.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/EditPostActivity.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/FilteredThingActivity.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/FontStyle.java24
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java12
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSource.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSourceFactory.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostFragment.java1
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostViewModel.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/RulesActivity.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/SearchActivity.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/SearchResultActivity.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/SearchSubredditsResultActivity.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/SettingsActivity.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/SharedPreferencesUtils.java1
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSelectionActivity.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/SubscribedThingListingActivity.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ViewImageActivity.java13
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ViewMessageActivity.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ViewUserDetailActivity.java8
31 files changed, 196 insertions, 43 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AccountPostsActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AccountPostsActivity.java
index e2e0a5b8..3a99ebf1 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/AccountPostsActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AccountPostsActivity.java
@@ -67,12 +67,16 @@ 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);
+
setContentView(R.layout.activity_account_posts);
ButterKnife.bind(this);
- ((Infinity) getApplication()).getAppComponent().inject(this);
-
EventBus.getDefault().register(this);
Resources resources = getResources();
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AccountSavedThingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AccountSavedThingActivity.java
index 2b8206e4..ccd56a77 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/AccountSavedThingActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AccountSavedThingActivity.java
@@ -75,12 +75,16 @@ 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);
+
setContentView(R.layout.activity_account_saved_thing);
ButterKnife.bind(this);
- ((Infinity) getApplication()).getAppComponent().inject(this);
-
EventBus.getDefault().register(this);
Resources resources = getResources();
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java
index 4cbc8e2f..1c134841 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java
@@ -44,4 +44,5 @@ public interface AppComponent {
void inject(SettingsActivity settingsActivity);
void inject(MainPreferenceFragment mainPreferenceFragment);
void inject(AccountSavedThingActivity accountSavedThingActivity);
+ void inject(ViewImageActivity viewImageActivity);
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ChangeFontSizeEvent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ChangeFontSizeEvent.java
new file mode 100644
index 00000000..78846c79
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ChangeFontSizeEvent.java
@@ -0,0 +1,8 @@
+package ml.docilealligator.infinityforreddit;
+
+public class ChangeFontSizeEvent {
+ public String fontSize;
+ public ChangeFontSizeEvent(String fontSize) {
+ this.fontSize = fontSize;
+ }
+}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentActivity.java
index 17e4061c..5104bef8 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentActivity.java
@@ -83,12 +83,16 @@ 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);
+
setContentView(R.layout.activity_comment);
ButterKnife.bind(this);
- ((Infinity) getApplication()).getAppComponent().inject(this);
-
EventBus.getDefault().register(this);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/EditCommentActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/EditCommentActivity.java
index c5606ae8..602095ea 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/EditCommentActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/EditCommentActivity.java
@@ -72,12 +72,16 @@ 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);
+
setContentView(R.layout.activity_edit_comment);
ButterKnife.bind(this);
- ((Infinity) getApplication()).getAppComponent().inject(this);
-
EventBus.getDefault().register(this);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/EditPostActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/EditPostActivity.java
index 882fe11c..d1352cdf 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/EditPostActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/EditPostActivity.java
@@ -71,12 +71,16 @@ 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);
+
setContentView(R.layout.activity_edit_post);
ButterKnife.bind(this);
- ((Infinity) getApplication()).getAppComponent().inject(this);
-
EventBus.getDefault().register(this);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FilteredThingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/FilteredThingActivity.java
index 27a9ddf0..66ce2fcf 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/FilteredThingActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/FilteredThingActivity.java
@@ -78,12 +78,16 @@ 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);
+
setContentView(R.layout.activity_filtered_thing);
ButterKnife.bind(this);
- ((Infinity) getApplication()).getAppComponent().inject(this);
-
EventBus.getDefault().register(this);
Resources resources = getResources();
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FontStyle.java b/app/src/main/java/ml/docilealligator/infinityforreddit/FontStyle.java
new file mode 100644
index 00000000..bb2448ca
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/FontStyle.java
@@ -0,0 +1,24 @@
+package ml.docilealligator.infinityforreddit;
+
+public enum FontStyle {
+ Small(R.style.FontStyle_Small, "Small"),
+ Normal(R.style.FontStyle_Normal, "Normal"),
+ Large(R.style.FontStyle_Large, "Large"),
+ XLarge(R.style.FontStyle_XLarge, "XLarge");
+
+ private int resId;
+ private String title;
+
+ public int getResId() {
+ return resId;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ FontStyle(int resId, String title) {
+ this.resId = resId;
+ this.title = title;
+ }
+}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java
index d4365b0a..38cf5cc0 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/MainActivity.java
@@ -166,11 +166,16 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe
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);
+
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
- ((Infinity) getApplication()).getAppComponent().inject(this);
EventBus.getDefault().register(this);
@@ -885,6 +890,11 @@ public class MainActivity extends AppCompatActivity implements SortTypeBottomShe
sectionsPagerAdapter.changeNSFW(changeNSFWEvent.nsfw);
}
+ @Subscribe
+ public void onChangeFontSizeEvent(ChangeFontSizeEvent changeFontSizeEvent) {
+ recreate();
+ }
+
private class SectionsPagerAdapter extends FragmentPagerAdapter {
private PostFragment frontPagePostFragment;
private PostFragment popularPostFragment;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSource.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSource.java
index 4b8deadd..0d13dc2e 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSource.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSource.java
@@ -1,5 +1,7 @@
package ml.docilealligator.infinityforreddit;
+import android.util.Log;
+
import androidx.annotation.NonNull;
import androidx.lifecycle.MutableLiveData;
import androidx.paging.PageKeyedDataSource;
@@ -69,6 +71,7 @@ class PostDataSource extends PageKeyedDataSource<String, Post> {
PostDataSource(Retrofit retrofit, String accessToken, Locale locale, String subredditOrUserName, int postType,
String sortType, int filter, boolean nsfw) {
+ Log.i("asfdasdf", "datasource: " + sortType);
this.retrofit = retrofit;
this.accessToken = accessToken;
this.locale = locale;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSourceFactory.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSourceFactory.java
index 3942bec3..6e2aaa89 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSourceFactory.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSourceFactory.java
@@ -1,5 +1,7 @@
package ml.docilealligator.infinityforreddit;
+import android.util.Log;
+
import androidx.annotation.NonNull;
import androidx.lifecycle.MutableLiveData;
import androidx.paging.DataSource;
@@ -37,6 +39,7 @@ class PostDataSourceFactory extends DataSource.Factory {
PostDataSourceFactory(Retrofit retrofit, String accessToken, Locale locale, String subredditName,
int postType, String sortType, int filter, boolean nsfw) {
+ Log.i("asfdasdf", "datasource factory: " + sortType);
this.retrofit = retrofit;
this.accessToken = accessToken;
this.locale = locale;
@@ -86,6 +89,7 @@ class PostDataSourceFactory extends DataSource.Factory {
postDataSource = new PostDataSource(retrofit, accessToken, locale, subredditName, query,
postType, sortType, filter, nsfw);
} else if(postType == PostDataSource.TYPE_SUBREDDIT) {
+ Log.i("asfdasdf", "datasource create: " + sortType);
postDataSource = new PostDataSource(retrofit, accessToken, locale, subredditName, postType,
sortType, filter, nsfw);
} else {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostFragment.java
index 67a0b247..6497f57c 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostFragment.java
@@ -255,6 +255,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
int postType = getArguments().getInt(EXTRA_POST_TYPE);
String sortType = getArguments().getString(EXTRA_SORT_TYPE);
+
int filter = getArguments().getInt(EXTRA_FILTER);
String accessToken = getArguments().getString(EXTRA_ACCESS_TOKEN);
boolean nsfw = mSharedPreferences.getBoolean(SharedPreferencesUtils.NSFW_KEY, false);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java
index 27c27fd2..1e2dc155 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostImageActivity.java
@@ -133,14 +133,18 @@ 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);
+
setContentView(R.layout.activity_post_image);
ButterKnife.bind(this);
EventBus.getDefault().register(this);
- ((Infinity) getApplication()).getAppComponent().inject(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) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java
index cab3288d..cf384682 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostLinkActivity.java
@@ -110,14 +110,18 @@ 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);
+
setContentView(R.layout.activity_post_link);
ButterKnife.bind(this);
EventBus.getDefault().register(this);
- ((Infinity) getApplication()).getAppComponent().inject(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) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java
index b8e967f2..5f1200b3 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostTextActivity.java
@@ -110,14 +110,18 @@ 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);
+
setContentView(R.layout.activity_post_text);
ButterKnife.bind(this);
EventBus.getDefault().register(this);
- ((Infinity) getApplication()).getAppComponent().inject(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) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java
index eb3e51ff..f287fd07 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostVideoActivity.java
@@ -143,14 +143,18 @@ 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);
+
setContentView(R.layout.activity_post_video);
ButterKnife.bind(this);
EventBus.getDefault().register(this);
- ((Infinity) getApplication()).getAppComponent().inject(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) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostViewModel.java
index 412a0d0e..9340e20b 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostViewModel.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostViewModel.java
@@ -1,5 +1,7 @@
package ml.docilealligator.infinityforreddit;
+import android.util.Log;
+
import androidx.annotation.NonNull;
import androidx.core.util.Pair;
import androidx.lifecycle.LiveData;
@@ -58,6 +60,7 @@ public class PostViewModel extends ViewModel {
public PostViewModel(Retrofit retrofit, String accessToken, Locale locale, String subredditName, int postType,
String sortType, int filter, boolean nsfw) {
+ Log.i("asfdasdf", "viewmodel: " + sortType);
postDataSourceFactory = new PostDataSourceFactory(retrofit, accessToken, locale, subredditName,
postType, sortType, filter, nsfw);
@@ -206,6 +209,7 @@ public class PostViewModel extends ViewModel {
public Factory(Retrofit retrofit, String accessToken, Locale locale, String subredditName, int postType,
String sortType, int filter, boolean nsfw) {
+ Log.i("asfdasdf", "viewmodel factory: " + sortType);
this.retrofit = retrofit;
this.accessToken = accessToken;
this.locale = locale;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/RulesActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/RulesActivity.java
index e519797a..8923e364 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/RulesActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/RulesActivity.java
@@ -70,12 +70,16 @@ 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);
+
setContentView(R.layout.activity_rules);
ButterKnife.bind(this);
- ((Infinity) getApplication()).getAppComponent().inject(this);
-
EventBus.getDefault().register(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SearchActivity.java
index b1627f0b..a715014f 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SearchActivity.java
@@ -67,12 +67,16 @@ 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);
+
setContentView(R.layout.activity_search);
ButterKnife.bind(this);
- ((Infinity) getApplication()).getAppComponent().inject(this);
-
EventBus.getDefault().register(this);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SearchResultActivity.java
index 9a6652c5..b0640071 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchResultActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SearchResultActivity.java
@@ -72,12 +72,16 @@ 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);
+
setContentView(R.layout.activity_search_result);
ButterKnife.bind(this);
- ((Infinity) getApplication()).getAppComponent().inject(this);
-
EventBus.getDefault().register(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchSubredditsResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SearchSubredditsResultActivity.java
index c6bd9685..31118441 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/SearchSubredditsResultActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SearchSubredditsResultActivity.java
@@ -63,12 +63,16 @@ 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);
+
setContentView(R.layout.activity_search_subreddits_result);
ButterKnife.bind(this);
- ((Infinity) getApplication()).getAppComponent().inject(this);
-
EventBus.getDefault().register(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SettingsActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SettingsActivity.java
index f963b0a4..4e8b0a64 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/SettingsActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SettingsActivity.java
@@ -42,12 +42,16 @@ 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);
+
setContentView(R.layout.settings_activity);
ButterKnife.bind(this);
- ((Infinity) getApplication()).getAppComponent().inject(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) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SharedPreferencesUtils.java
index e0b6672a..6bc34647 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/SharedPreferencesUtils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SharedPreferencesUtils.java
@@ -23,4 +23,5 @@ public class SharedPreferencesUtils {
public static final String EMAIL_KEY = "email";
public static final String REDDIT_ACCOUNT_KEY = "reddit_account";
public static final String SUBREDDIT_KEY = "subreddit";
+ public static final String FONT_SIZE_KEY = "font_size";
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSelectionActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSelectionActivity.java
index 4bb67e27..e3d5d82d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSelectionActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SubredditSelectionActivity.java
@@ -82,12 +82,16 @@ 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);
+
setContentView(R.layout.activity_subreddit_selection);
ButterKnife.bind(this);
- ((Infinity) getApplication()).getAppComponent().inject(this);
-
EventBus.getDefault().register(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SubscribedThingListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SubscribedThingListingActivity.java
index 35d49eeb..15380d86 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/SubscribedThingListingActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SubscribedThingListingActivity.java
@@ -75,12 +75,16 @@ 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);
+
setContentView(R.layout.activity_subscribed_thing_listing);
ButterKnife.bind(this);
- ((Infinity) getApplication()).getAppComponent().inject(this);
-
EventBus.getDefault().register(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewImageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewImageActivity.java
index 3f81263f..2db793e5 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewImageActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewImageActivity.java
@@ -7,6 +7,7 @@ import android.animation.ValueAnimator;
import android.app.DownloadManager;
import android.content.Context;
import android.content.Intent;
+import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.graphics.PorterDuff;
import android.graphics.drawable.ColorDrawable;
@@ -45,6 +46,8 @@ import com.github.pwittchen.swipe.library.rx2.Swipe;
import java.io.File;
+import javax.inject.Inject;
+
import butterknife.BindView;
import butterknife.ButterKnife;
@@ -76,10 +79,20 @@ public class ViewImageActivity extends AppCompatActivity {
private boolean isSwiping = false;
+ @Inject
+ SharedPreferences mSharedPreferences;
+
@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);
+
setContentView(R.layout.activity_view_image);
+
ButterKnife.bind(this);
ActionBar actionBar = getSupportActionBar();
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewMessageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewMessageActivity.java
index 34f1d653..5d748643 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewMessageActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewMessageActivity.java
@@ -86,12 +86,16 @@ 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);
+
setContentView(R.layout.activity_view_message);
ButterKnife.bind(this);
- ((Infinity) getApplication()).getAppComponent().inject(this);
-
EventBus.getDefault().register(this);
mGlide = Glide.with(this);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java
index 3063e0c0..d6d6c0b7 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewPostDetailActivity.java
@@ -139,6 +139,12 @@ 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);
+
setContentView(R.layout.activity_view_post_detail);
Bridge.restoreInstanceState(this, savedInstanceState);
@@ -147,8 +153,6 @@ public class ViewPostDetailActivity extends AppCompatActivity implements FlairBo
EventBus.getDefault().register(this);
- ((Infinity) getApplication()).getAppComponent().inject(this);
-
Resources resources = getResources();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java
index cf950b2b..f567349f 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java
@@ -121,12 +121,16 @@ 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);
+
setContentView(R.layout.activity_view_subreddit_detail);
ButterKnife.bind(this);
- ((Infinity) getApplication()).getAppComponent().inject(this);
-
EventBus.getDefault().register(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewUserDetailActivity.java
index 91525a3e..d57e57f8 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewUserDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewUserDetailActivity.java
@@ -127,12 +127,16 @@ 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);
+
setContentView(R.layout.activity_view_user_detail);
ButterKnife.bind(this);
- ((Infinity) getApplication()).getAppComponent().inject(this);
-
EventBus.getDefault().register(this);
boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;