mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-30 21:07:11 +01:00
Version 4.0.3. Only save scrolled position for Best posts in HOME. Set Save Scrolled Position in HOME to false by default. Apply link color in CommentActivity.
This commit is contained in:
parent
d10a3bd52a
commit
74a4206cd2
@ -6,8 +6,8 @@ android {
|
|||||||
applicationId "ml.docilealligator.infinityforreddit"
|
applicationId "ml.docilealligator.infinityforreddit"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode 38
|
versionCode 39
|
||||||
versionName "4.0.2"
|
versionName "4.0.3"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
javaCompileOptions {
|
javaCompileOptions {
|
||||||
annotationProcessorOptions {
|
annotationProcessorOptions {
|
||||||
|
@ -41,6 +41,7 @@ import butterknife.ButterKnife;
|
|||||||
import io.noties.markwon.AbstractMarkwonPlugin;
|
import io.noties.markwon.AbstractMarkwonPlugin;
|
||||||
import io.noties.markwon.Markwon;
|
import io.noties.markwon.Markwon;
|
||||||
import io.noties.markwon.MarkwonConfiguration;
|
import io.noties.markwon.MarkwonConfiguration;
|
||||||
|
import io.noties.markwon.core.MarkwonTheme;
|
||||||
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
||||||
import io.noties.markwon.linkify.LinkifyPlugin;
|
import io.noties.markwon.linkify.LinkifyPlugin;
|
||||||
import io.noties.markwon.recycler.MarkwonAdapter;
|
import io.noties.markwon.recycler.MarkwonAdapter;
|
||||||
@ -49,14 +50,14 @@ import io.noties.markwon.recycler.table.TableEntryPlugin;
|
|||||||
import io.noties.markwon.simple.ext.SimpleExtPlugin;
|
import io.noties.markwon.simple.ext.SimpleExtPlugin;
|
||||||
import io.noties.markwon.urlprocessor.UrlProcessorRelativeToAbsolute;
|
import io.noties.markwon.urlprocessor.UrlProcessorRelativeToAbsolute;
|
||||||
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask;
|
||||||
|
import ml.docilealligator.infinityforreddit.BottomSheetFragment.CopyTextBottomSheetFragment;
|
||||||
import ml.docilealligator.infinityforreddit.Comment.Comment;
|
import ml.docilealligator.infinityforreddit.Comment.Comment;
|
||||||
|
import ml.docilealligator.infinityforreddit.Comment.SendComment;
|
||||||
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
|
import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
|
||||||
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent;
|
||||||
import ml.docilealligator.infinityforreddit.BottomSheetFragment.CopyTextBottomSheetFragment;
|
|
||||||
import ml.docilealligator.infinityforreddit.Infinity;
|
import ml.docilealligator.infinityforreddit.Infinity;
|
||||||
import ml.docilealligator.infinityforreddit.R;
|
import ml.docilealligator.infinityforreddit.R;
|
||||||
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
|
||||||
import ml.docilealligator.infinityforreddit.Comment.SendComment;
|
|
||||||
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
|
import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils;
|
||||||
import ml.docilealligator.infinityforreddit.Utils.Utils;
|
import ml.docilealligator.infinityforreddit.Utils.Utils;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
@ -146,6 +147,8 @@ public class CommentActivity extends BaseActivity {
|
|||||||
String parentTextMarkdown = intent.getStringExtra(EXTRA_COMMENT_PARENT_TEXT_MARKDOWN_KEY);
|
String parentTextMarkdown = intent.getStringExtra(EXTRA_COMMENT_PARENT_TEXT_MARKDOWN_KEY);
|
||||||
String parentText = intent.getStringExtra(EXTRA_COMMENT_PARENT_TEXT_KEY);
|
String parentText = intent.getStringExtra(EXTRA_COMMENT_PARENT_TEXT_KEY);
|
||||||
CopyTextBottomSheetFragment copyTextBottomSheetFragment = new CopyTextBottomSheetFragment();
|
CopyTextBottomSheetFragment copyTextBottomSheetFragment = new CopyTextBottomSheetFragment();
|
||||||
|
|
||||||
|
int linkColor = mCustomThemeWrapper.getLinkColor();
|
||||||
Markwon markwon = Markwon.builder(this)
|
Markwon markwon = Markwon.builder(this)
|
||||||
.usePlugin(new AbstractMarkwonPlugin() {
|
.usePlugin(new AbstractMarkwonPlugin() {
|
||||||
@Override
|
@Override
|
||||||
@ -161,6 +164,11 @@ public class CommentActivity extends BaseActivity {
|
|||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configureTheme(@NonNull MarkwonTheme.Builder builder) {
|
||||||
|
builder.linkColor(linkColor);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS))
|
.usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS))
|
||||||
.usePlugin(SimpleExtPlugin.create(plugin ->
|
.usePlugin(SimpleExtPlugin.create(plugin ->
|
||||||
@ -220,6 +228,11 @@ public class CommentActivity extends BaseActivity {
|
|||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}).urlProcessor(new UrlProcessorRelativeToAbsolute("https://www.reddit.com"));
|
}).urlProcessor(new UrlProcessorRelativeToAbsolute("https://www.reddit.com"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configureTheme(@NonNull MarkwonTheme.Builder builder) {
|
||||||
|
builder.linkColor(linkColor);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.usePlugin(StrikethroughPlugin.create())
|
.usePlugin(StrikethroughPlugin.create())
|
||||||
.usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS))
|
.usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS))
|
||||||
|
@ -369,7 +369,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
|||||||
accountName = getArguments().getString(EXTRA_ACCOUNT_NAME);
|
accountName = getArguments().getString(EXTRA_ACCOUNT_NAME);
|
||||||
boolean nsfw = mSharedPreferences.getBoolean(SharedPreferencesUtils.NSFW_KEY, false);
|
boolean nsfw = mSharedPreferences.getBoolean(SharedPreferencesUtils.NSFW_KEY, false);
|
||||||
int defaultPostLayout = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.DEFAULT_POST_LAYOUT_KEY, "0"));
|
int defaultPostLayout = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.DEFAULT_POST_LAYOUT_KEY, "0"));
|
||||||
savePostFeedScrolledPosition = mSharedPreferences.getBoolean(SharedPreferencesUtils.SAVE_FRONT_PAGE_SCROLLED_POSITION, true);
|
savePostFeedScrolledPosition = mSharedPreferences.getBoolean(SharedPreferencesUtils.SAVE_FRONT_PAGE_SCROLLED_POSITION, false);
|
||||||
Locale locale = getResources().getConfiguration().locale;
|
Locale locale = getResources().getConfiguration().locale;
|
||||||
|
|
||||||
if (postType == PostDataSource.TYPE_SEARCH) {
|
if (postType == PostDataSource.TYPE_SEARCH) {
|
||||||
@ -717,7 +717,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void saveCache() {
|
private void saveCache() {
|
||||||
if (savePostFeedScrolledPosition && postType == PostDataSource.TYPE_FRONT_PAGE && mAdapter != null) {
|
if (savePostFeedScrolledPosition && postType == PostDataSource.TYPE_FRONT_PAGE && sortType != null && sortType.getType() == SortType.Type.BEST && mAdapter != null) {
|
||||||
Post currentPost = mAdapter.getItemByPosition(maxPosition);
|
Post currentPost = mAdapter.getItemByPosition(maxPosition);
|
||||||
if (currentPost != null) {
|
if (currentPost != null) {
|
||||||
String accountNameForCache = accountName == null ? SharedPreferencesUtils.FRONT_PAGE_SCROLLED_POSITION_ANONYMOUS : accountName;
|
String accountNameForCache = accountName == null ? SharedPreferencesUtils.FRONT_PAGE_SCROLLED_POSITION_ANONYMOUS : accountName;
|
||||||
|
@ -176,7 +176,7 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> {
|
|||||||
initialLoadStateLiveData.postValue(NetworkState.LOADING);
|
initialLoadStateLiveData.postValue(NetworkState.LOADING);
|
||||||
switch (postType) {
|
switch (postType) {
|
||||||
case TYPE_FRONT_PAGE:
|
case TYPE_FRONT_PAGE:
|
||||||
boolean savePostFeedScrolledPosition = sharedPreferences.getBoolean(SharedPreferencesUtils.SAVE_FRONT_PAGE_SCROLLED_POSITION, true);
|
boolean savePostFeedScrolledPosition = sortType != null && sortType.getType() == SortType.Type.BEST && sharedPreferences.getBoolean(SharedPreferencesUtils.SAVE_FRONT_PAGE_SCROLLED_POSITION, false);
|
||||||
String accountNameForCache = accountName == null ? SharedPreferencesUtils.FRONT_PAGE_SCROLLED_POSITION_ANONYMOUS : accountName;
|
String accountNameForCache = accountName == null ? SharedPreferencesUtils.FRONT_PAGE_SCROLLED_POSITION_ANONYMOUS : accountName;
|
||||||
if (savePostFeedScrolledPosition) {
|
if (savePostFeedScrolledPosition) {
|
||||||
loadBestPostsInitial(callback, postFeedScrolledPositionSharedPreferences.getString(accountNameForCache + SharedPreferencesUtils.FRONT_PAGE_SCROLLED_POSITION_FRONT_PAGE_BASE, null));
|
loadBestPostsInitial(callback, postFeedScrolledPositionSharedPreferences.getString(accountNameForCache + SharedPreferencesUtils.FRONT_PAGE_SCROLLED_POSITION_FRONT_PAGE_BASE, null));
|
||||||
|
@ -349,7 +349,7 @@
|
|||||||
<string name="settings_interface_title">Interface</string>
|
<string name="settings_interface_title">Interface</string>
|
||||||
<string name="settings_gestures_and_buttons_title">Gestures & Buttons</string>
|
<string name="settings_gestures_and_buttons_title">Gestures & Buttons</string>
|
||||||
<string name="settings_save_front_page_scrolled_position_title">Save Scrolled Position in HOME</string>
|
<string name="settings_save_front_page_scrolled_position_title">Save Scrolled Position in HOME</string>
|
||||||
<string name="settings_save_front_page_scrolled_position_summary">Browse new posts after refreshing in HOME (Front Page)</string>
|
<string name="settings_save_front_page_scrolled_position_summary">Browse new posts after refreshing in HOME (Front Page, sort type: Best)</string>
|
||||||
<string name="settings_open_link_in_app_title">Open Link In App</string>
|
<string name="settings_open_link_in_app_title">Open Link In App</string>
|
||||||
<string name="settigns_video_title">Video</string>
|
<string name="settigns_video_title">Video</string>
|
||||||
<string name="settings_video_autoplay_title">Video Autoplay</string>
|
<string name="settings_video_autoplay_title">Video Autoplay</string>
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
app:useSimpleSummaryProvider="true" />
|
app:useSimpleSummaryProvider="true" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
app:defaultValue="true"
|
app:defaultValue="false"
|
||||||
app:key="save_front_page_scrolled_position"
|
app:key="save_front_page_scrolled_position"
|
||||||
app:title="@string/settings_save_front_page_scrolled_position_title"
|
app:title="@string/settings_save_front_page_scrolled_position_title"
|
||||||
app:summary="@string/settings_save_front_page_scrolled_position_summary" />
|
app:summary="@string/settings_save_front_page_scrolled_position_summary" />
|
||||||
|
Loading…
Reference in New Issue
Block a user