aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountPostsActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/FilteredThingActivity.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java21
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/SharedPreferencesUtils.java4
-rw-r--r--app/src/main/res/layout/item_post_compact.xml8
-rw-r--r--app/src/main/res/values/attr.xml1
-rw-r--r--app/src/main/res/values/styles.xml4
10 files changed, 30 insertions, 22 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountPostsActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountPostsActivity.java
index c760160e..a2a48e35 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountPostsActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountPostsActivity.java
@@ -286,7 +286,7 @@ public class AccountPostsActivity extends BaseActivity implements SortTypeSelect
@Override
public void postLayoutSelected(int postLayout) {
if (mFragment != null) {
- mSharedPreferences.edit().putInt(SharedPreferencesUtils.POST_LAYOUT_USER_POST, postLayout).apply();
+ mSharedPreferences.edit().putInt(SharedPreferencesUtils.POST_LAYOUT_USER_POST_BASE + mAccountName, postLayout).apply();
((FragmentCommunicator) mFragment).changePostLayout(postLayout);
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/FilteredThingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/FilteredThingActivity.java
index e797ab33..68ec15d0 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/FilteredThingActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/FilteredThingActivity.java
@@ -384,10 +384,10 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec
mSharedPreferences.edit().putInt(SharedPreferencesUtils.POST_LAYOUT_FRONT_PAGE_POST, postLayout).apply();
break;
case PostDataSource.TYPE_SUBREDDIT:
- mSharedPreferences.edit().putInt(SharedPreferencesUtils.POST_LAYOUT_SUBREDDIT_POST, postLayout).apply();
+ mSharedPreferences.edit().putInt(SharedPreferencesUtils.POST_LAYOUT_SUBREDDIT_POST_BASE + name, postLayout).apply();
break;
case PostDataSource.TYPE_USER:
- mSharedPreferences.edit().putInt(SharedPreferencesUtils.POST_LAYOUT_USER_POST, postLayout).apply();
+ mSharedPreferences.edit().putInt(SharedPreferencesUtils.POST_LAYOUT_USER_POST_BASE + name, postLayout).apply();
break;
case PostDataSource.TYPE_SEARCH:
mSharedPreferences.edit().putInt(SharedPreferencesUtils.POST_LAYOUT_SEARCH_POST, postLayout).apply();
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java
index 45731b52..c0628bb4 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java
@@ -626,7 +626,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
@Override
public void postLayoutSelected(int postLayout) {
if (mFragment != null) {
- mSharedPreferences.edit().putInt(SharedPreferencesUtils.POST_LAYOUT_SUBREDDIT_POST, postLayout).apply();
+ mSharedPreferences.edit().putInt(SharedPreferencesUtils.POST_LAYOUT_SUBREDDIT_POST_BASE + subredditName, postLayout).apply();
((FragmentCommunicator) mFragment).changePostLayout(postLayout);
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java
index de6cbd9a..133e6875 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java
@@ -808,7 +808,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
void changePostLayout(int postLayout) {
if (postFragment != null) {
- mSharedPreferences.edit().putInt(SharedPreferencesUtils.POST_LAYOUT_USER_POST, postLayout).apply();
+ mSharedPreferences.edit().putInt(SharedPreferencesUtils.POST_LAYOUT_USER_POST_BASE + username, postLayout).apply();
((FragmentCommunicator) postFragment).changePostLayout(postLayout);
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
index 09a5bcad..6e6649c7 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
@@ -260,8 +260,6 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
}
}
- ((PostViewHolder) holder).subredditTextView.setTextColor(mContext.getResources().getColor(R.color.colorAccent));
-
((PostViewHolder) holder).subredditTextView.setOnClickListener(view -> {
if (canStartActivity) {
canStartActivity = false;
@@ -273,7 +271,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
} else {
Intent intent = new Intent(mContext, ViewSubredditDetailActivity.class);
intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY,
- post.getSubredditNamePrefixed().substring(2));
+ post.getSubredditName());
mContext.startActivity(intent);
}
}
@@ -315,19 +313,24 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
.into(((PostViewHolder) holder).iconGifImageView);
}
- ((PostViewHolder) holder).subredditTextView.setTextColor(mContext.getResources().getColor(R.color.colorPrimaryDarkDayNightTheme));
-
((PostViewHolder) holder).subredditTextView.setOnClickListener(view -> {
if (canStartActivity) {
canStartActivity = false;
- Intent intent = new Intent(mContext, ViewUserDetailActivity.class);
- intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, post.getAuthor());
- mContext.startActivity(intent);
+ if (post.getSubredditNamePrefixed().startsWith("u/")) {
+ Intent intent = new Intent(mContext, ViewUserDetailActivity.class);
+ intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, post.getAuthor());
+ mContext.startActivity(intent);
+ } else {
+ Intent intent = new Intent(mContext, ViewSubredditDetailActivity.class);
+ intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY,
+ post.getSubredditName());
+ mContext.startActivity(intent);
+ }
}
});
((PostViewHolder) holder).iconGifImageView.setOnClickListener(view ->
- ((PostViewHolder) holder).subredditTextView.performClick());
+ ((PostViewHolder) holder).userTextView.performClick());
}
((PostViewHolder) holder).postTimeTextView.setText(postTime);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java
index 5651ac0b..1a3ea761 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java
@@ -345,7 +345,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
if(sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) {
sortTime = mSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_SUBREDDIT_POST, SortType.Time.ALL.name());
}
- postLayout = mSharedPreferences.getInt(SharedPreferencesUtils.POST_LAYOUT_SUBREDDIT_POST, SharedPreferencesUtils.POST_LAYOUT_CARD);
+ postLayout = mSharedPreferences.getInt(SharedPreferencesUtils.POST_LAYOUT_SUBREDDIT_POST_BASE + subredditName, SharedPreferencesUtils.POST_LAYOUT_CARD);
}
if(sortTime != null) {
@@ -398,7 +398,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
} else {
sortType = new SortType(SortType.Type.valueOf(sort));
}
- postLayout = mSharedPreferences.getInt(SharedPreferencesUtils.POST_LAYOUT_USER_POST, SharedPreferencesUtils.POST_LAYOUT_CARD);
+ postLayout = mSharedPreferences.getInt(SharedPreferencesUtils.POST_LAYOUT_USER_POST_BASE + username, SharedPreferencesUtils.POST_LAYOUT_CARD);
mAdapter = new PostRecyclerViewAdapter(activity, mOauthRetrofit, mRetrofit, mRedditDataRoomDatabase,
accessToken, postType, postLayout, true, needBlurNsfw, needBlurSpoiler,
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SharedPreferencesUtils.java
index 1fd5c9f9..f1aa91cd 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/SharedPreferencesUtils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SharedPreferencesUtils.java
@@ -50,8 +50,8 @@ public class SharedPreferencesUtils {
public static final String POST_LAYOUT_FRONT_PAGE_POST = "post_layout_best_post";
public static final String POST_LAYOUT_POPULAR_POST = "post_layout_popular_post";
public static final String POST_LAYOUT_ALL_POST = "post_layout_all_post";
- public static final String POST_LAYOUT_SUBREDDIT_POST = "post_layout_subreddit_post";
- public static final String POST_LAYOUT_USER_POST = "post_layout_user_post";
+ public static final String POST_LAYOUT_SUBREDDIT_POST_BASE = "post_layout_subreddit_post_";
+ public static final String POST_LAYOUT_USER_POST_BASE = "post_layout_user_post_";
public static final String POST_LAYOUT_SEARCH_POST = "post_layout_search_post";
public static final int POST_LAYOUT_CARD = 0;
public static final int POST_LAYOUT_COMPACT = 1;
diff --git a/app/src/main/res/layout/item_post_compact.xml b/app/src/main/res/layout/item_post_compact.xml
index dc0f5876..ecef2387 100644
--- a/app/src/main/res/layout/item_post_compact.xml
+++ b/app/src/main/res/layout/item_post_compact.xml
@@ -113,7 +113,7 @@
android:layout_height="wrap_content"
android:padding="4dp"
android:textColor="@android:color/white"
- android:textSize="?attr/font_12"
+ android:textSize="?attr/font_10"
app:lib_setRadius="3dp"
app:lib_setRoundedBGColor="@color/backgroundColorPrimaryDark"
app:lib_setRoundedBorderColor="@color/backgroundColorPrimaryDark"
@@ -128,7 +128,7 @@
android:padding="4dp"
android:text="@string/spoiler"
android:textColor="@android:color/white"
- android:textSize="?attr/font_12"
+ android:textSize="?attr/font_10"
android:visibility="gone"
app:lib_setRadius="3dp"
app:lib_setRoundedBGColor="@color/spoilerBackgroundColor"
@@ -143,7 +143,7 @@
android:padding="4dp"
android:text="@string/nsfw"
android:textColor="@android:color/white"
- android:textSize="?attr/font_12"
+ android:textSize="?attr/font_10"
android:visibility="gone"
app:lib_setRadius="3dp"
app:lib_setRoundedBGColor="@color/colorAccent"
@@ -158,7 +158,7 @@
android:layout_gravity="center"
android:padding="4dp"
android:textColor="@android:color/white"
- android:textSize="?attr/font_12"
+ android:textSize="?attr/font_10"
android:visibility="gone"
app:lib_setRadius="3dp"
app:lib_setRoundedBGColor="@color/flairBackgroundColor"
diff --git a/app/src/main/res/values/attr.xml b/app/src/main/res/values/attr.xml
index bd522e6e..37fc5341 100644
--- a/app/src/main/res/values/attr.xml
+++ b/app/src/main/res/values/attr.xml
@@ -4,6 +4,7 @@
<declare-styleable name="FontStyle">
<attr name="font_default" format="dimension"/>
+ <attr name="font_10" format="dimension" />
<attr name="font_12" format="dimension"/>
<attr name="font_16" format="dimension"/>
<attr name="font_18" format="dimension"/>
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 698057fd..57a528fd 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -95,6 +95,7 @@
<style name="FontStyle.Small">
<item name="font_default">12sp</item>
+ <item name="font_10">10sp</item>
<item name="font_12">12sp</item>
<item name="font_16">14sp</item>
<item name="font_18">16sp</item>
@@ -103,6 +104,7 @@
<style name="FontStyle.Normal">
<item name="font_default">14sp</item>
+ <item name="font_10">10sp</item>
<item name="font_12">12sp</item>
<item name="font_16">16sp</item>
<item name="font_18">18sp</item>
@@ -111,6 +113,7 @@
<style name="FontStyle.Large">
<item name="font_default">16sp</item>
+ <item name="font_10">12sp</item>
<item name="font_12">14sp</item>
<item name="font_16">18sp</item>
<item name="font_18">20sp</item>
@@ -119,6 +122,7 @@
<style name="FontStyle.XLarge">
<item name="font_default">18sp</item>
+ <item name="font_10">14sp</item>
<item name="font_12">16sp</item>
<item name="font_16">20sp</item>
<item name="font_18">22sp</item>