diff options
166 files changed, 9946 insertions, 3806 deletions
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..7e527e4a --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +patreon: docile_alligator @@ -1,4 +1,4 @@ -# Infinity-For-Reddit +# Infinity-For-Reddit [<img src="https://img.shields.io/badge/Patreon-F96854?style=for-the-badge&logo=patreon&logoColor=white" alt="Patreon">](https://www.patreon.com/docile_alligator) This is a Reddit client on Android written in Java. It does not have any ads and it features clean UI and smooth browsing experience. [<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png" @@ -8,6 +8,9 @@ This is a Reddit client on Android written in Java. It does not have any ads and alt="Get it on Google Play" height="100">](https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforreddit) +## Donation +Patreon: https://www.patreon.com/docile_alligator + ## Translation POEditor: https://poeditor.com/join/project?hash=b2IRyfaJv6 diff --git a/app/build.gradle b/app/build.gradle index 25cbdf73..ae211bd8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,12 +6,12 @@ android { applicationId "ml.docilealligator.infinityforreddit" minSdkVersion 21 targetSdkVersion 30 - versionCode 50 - versionName "4.1.0" + versionCode 53 + versionName "4.2.0-beta1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" javaCompileOptions { annotationProcessorOptions { - arguments = [ eventBusIndex : 'ml.docilealligator.infinityforreddit.EventBusIndex' ] + arguments = [eventBusIndex: 'ml.docilealligator.infinityforreddit.EventBusIndex'] } } } @@ -35,77 +35,134 @@ android { } dependencies { +/** AndroidX **/ implementation 'androidx.appcompat:appcompat:1.2.0' - implementation 'androidx.browser:browser:1.2.0' + implementation 'androidx.biometric:biometric:1.1.0-rc01' + implementation 'androidx.browser:browser:1.3.0' implementation 'androidx.cardview:cardview:1.0.0' implementation 'androidx.constraintlayout:constraintlayout:2.0.4' - // Lifecycle components - def lifecycleVersion = '2.2.0' - implementation "androidx.lifecycle:lifecycle-extensions:$lifecycleVersion" - implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0' + def lifecycleVersion = "2.2.0" + implementation "androidx.lifecycle:lifecycle-livedata:$lifecycleVersion" + implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycleVersion" annotationProcessor "androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion" implementation 'androidx.paging:paging-runtime:2.1.2' implementation 'androidx.preference:preference:1.1.1' - // Room components - def roomVersion = '2.2.5' + def roomVersion = "2.2.6" implementation "androidx.room:room-runtime:$roomVersion" annotationProcessor "androidx.room:room-compiler:$roomVersion" implementation 'androidx.work:work-runtime:2.4.0' - implementation 'com.google.android.material:material:1.3.0-alpha03' - - implementation 'com.google.android.exoplayer:exoplayer-core:2.10.4' - implementation 'com.google.android.exoplayer:exoplayer-hls:2.10.4' - implementation 'com.google.android.exoplayer:exoplayer-dash:2.10.4' - implementation 'com.google.android.exoplayer:exoplayer-ui:2.10.4' - implementation 'com.alexvasilkov:gesture-views:2.6.0' - implementation 'com.github.bumptech.glide:glide:4.11.0' - annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0' + implementation 'com.google.android.material:material:1.3.0-alpha04' + +/** ExoPlayer **/ + def exoplayerVersion = "2.10.8" + implementation "com.google.android.exoplayer:exoplayer-core:$exoplayerVersion" + implementation "com.google.android.exoplayer:exoplayer-dash:$exoplayerVersion" + implementation "com.google.android.exoplayer:exoplayer-hls:$exoplayerVersion" + implementation "com.google.android.exoplayer:exoplayer-ui:$exoplayerVersion" + def toroVersion = "3.7.0.2010003" + implementation "im.ene.toro3:toro:$toroVersion" + implementation("im.ene.toro3:toro-ext-exoplayer:$toroVersion") { + exclude module: 'extension-ima' + } + +/** Third-party **/ + +/**** Backend logic ****/ + + // Reactive stuff for event and async related implementation 'io.reactivex.rxjava2:rxandroid:2.1.1' implementation 'io.reactivex.rxjava2:rxjava:2.2.20' - implementation 'com.squareup.retrofit2:retrofit:2.9.0' - implementation 'com.squareup.retrofit2:converter-scalars:2.9.0' - implementation 'jp.wasabeef:glide-transformations:4.1.0' - implementation 'com.google.dagger:dagger:2.29.1' - annotationProcessor 'com.google.dagger:dagger-compiler:2.29.1' - implementation 'com.jakewharton:butterknife:10.2.3' - annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.3' + + // HTTP clients + def retrofitVersion = "2.9.0" + implementation "com.squareup.retrofit2:retrofit:$retrofitVersion" + implementation "com.squareup.retrofit2:converter-scalars:$retrofitVersion" + implementation 'com.squareup.okhttp3:okhttp:4.2.2' + + // Dependency injection + def daggerVersion = "2.30.1" + implementation "com.google.dagger:dagger:$daggerVersion" + annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion" + + // Binding + // NOTE: Deprecated in favor of viewbinding + def butterknifeVersion = "10.2.3" + implementation "com.jakewharton:butterknife:$butterknifeVersion" + annotationProcessor "com.jakewharton:butterknife-compiler:$butterknifeVersion" + + // Events + def eventbusVersion = "3.2.0" + implementation "org.greenrobot:eventbus:$eventbusVersion" + annotationProcessor "org.greenrobot:eventbus-annotation-processor:$eventbusVersion" + + // TransactionTooLargeException avoidance + implementation 'com.github.livefront:bridge:v1.3.0' + + // Bundle-saving without boilerplate + // NOTE: Deprecated + def stateVersion = "1.4.1" + implementation "com.evernote:android-state:$stateVersion" + annotationProcessor "com.evernote:android-state-processor:$stateVersion" + + // Object to JSON + // NOTE: Replace with Squareup's Moshi? + implementation 'com.google.code.gson:gson:2.8.6' + + +/**** User Interface (frontend) ****/ + + //Image loading + def glideVersion = "4.11.0" + implementation "com.github.bumptech.glide:glide:$glideVersion" + annotationProcessor "com.github.bumptech.glide:compiler:$glideVersion" + implementation 'jp.wasabeef:glide-transformations:4.3.0' implementation 'com.github.santalu:aspect-ratio-imageview:1.0.9' - implementation 'com.lsjwzh:materialloadingprogressbar:0.5.8-RELEASE' - implementation 'io.noties.markwon:core:4.5.0' - implementation 'io.noties.markwon:linkify:4.5.0' - implementation 'io.noties.markwon:ext-strikethrough:4.5.0' - implementation 'io.noties.markwon:simple-ext:4.5.0' - implementation 'io.noties.markwon:recycler-table:4.5.0' implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.21' + def bivVersion = "1.7.0" + implementation "com.github.Piasy.BigImageViewer:BigImageViewer:$bivVersion" + implementation "com.github.Piasy.BigImageViewer:GlideImageLoader:$bivVersion" + implementation "com.github.Piasy.BigImageViewer:GlideImageViewFactory:$bivVersion" + + // Markdown + def markwonVersion = "4.6.0" + implementation "io.noties.markwon:core:$markwonVersion" + implementation "io.noties.markwon:ext-strikethrough:$markwonVersion" + implementation "io.noties.markwon:linkify:$markwonVersion" + implementation "io.noties.markwon:recycler-table:$markwonVersion" + implementation "io.noties.markwon:simple-ext:$markwonVersion" + implementation 'com.atlassian.commonmark:commonmark-ext-gfm-tables:0.14.0' + + // Animations + implementation 'com.airbnb.android:lottie:3.4.4' + + // Loading ProgressBar + implementation 'com.lsjwzh:materialloadingprogressbar:0.5.8-RELEASE' + + // SearchView implementation 'com.github.Ferfalk:SimpleSearchView:0.1.4' - def eventbusVersion = '3.2.0' - implementation "org.greenrobot:eventbus:$eventbusVersion" - annotationProcessor "org.greenrobot:eventbus-annotation-processor:$eventbusVersion" + // Customizable TextView implementation 'com.libRG:customtextview:2.4' - implementation 'com.github.Deishelon:RoundedBottomSheet:1.0.1' - implementation 'com.github.livefront:bridge:v1.2.1' - implementation 'com.evernote:android-state:1.4.1' - annotationProcessor 'com.evernote:android-state-processor:1.4.1' - implementation 'com.nex3z:flow-layout:1.3.0' + + // Dismiss gesturing implementation 'com.r0adkll:slidableactivity:2.1.0' - implementation 'com.atlassian.commonmark:commonmark:0.14.0' - implementation 'com.google.code.gson:gson:2.8.6' - implementation 'me.zhanghai.android.fastscroll:library:1.1.2' - implementation "com.thefuntasty.hauler:core:3.1.0" - implementation 'com.github.Piasy:BigImageViewer:1.6.5' - implementation 'androidx.biometric:biometric:1.1.0-beta01' - implementation 'com.airbnb.android:lottie:3.4.4' - //implementation 'com.melegy.redscreenofdeath:red-screen-of-death:0.1.2' + implementation 'com.thefuntasty.hauler:core:3.1.0' + + // Bottom sheet with rounded corners + implementation 'com.github.Deishelon:RoundedBottomSheet:1.0.1' + + // FlowLayout (auto-spacing) + implementation 'com.nex3z:flow-layout:1.3.3' + + // RecyclerView fast scrolling + implementation 'me.zhanghai.android.fastscroll:library:1.1.5' + + // Crash screen + implementation 'com.melegy.redscreenofdeath:red-screen-of-death:0.1.2' - def toroVersion = '3.7.0.2010003' - implementation "im.ene.toro3:toro:$toroVersion" - implementation("im.ene.toro3:toro-ext-exoplayer:$toroVersion") { - exclude module: 'extension-ima' - } - testImplementation 'junit:junit:4.13.1' - androidTestImplementation 'androidx.test:runner:1.3.0' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' +/**** Builds and flavors ****/ + // debugImplementation because LeakCanary should only run in debug builds. + debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.5' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d3ad80b3..910d92b6 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -32,8 +32,17 @@ android:theme="@style/AppTheme" android:usesCleartextTraffic="true" tools:replace="android:label"> - <activity android:name=".activities.SubredditFilterPopularAndAllActivity" - android:label="@string/subreddit_filter_popular_and_all_activity_label" + <activity android:name=".activities.PostFilterUsageListingActivity" + android:parentActivityName=".activities.SettingsActivity" + android:theme="@style/AppTheme.NoActionBar" /> + <activity + android:name=".activities.PostFilterPreferenceActivity" + android:label="@string/post_filter_preference_activity_label" + android:parentActivityName=".activities.SettingsActivity" + android:theme="@style/AppTheme.NoActionBar" /> + <activity + android:name=".activities.CustomizePostFilterActivity" + android:label="@string/customize_post_filter_activity_label" android:parentActivityName=".activities.SettingsActivity" android:theme="@style/AppTheme.NoActionBar" android:windowSoftInputMode="adjustResize" /> @@ -193,7 +202,7 @@ android:theme="@style/AppTheme.Slidable" android:windowSoftInputMode="adjustResize" /> <activity - android:name=".activities.FilteredThingActivity" + android:name=".activities.FilteredPostsActivity" android:parentActivityName=".activities.MainActivity" android:theme="@style/AppTheme.Slidable" /> <activity diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java index 717a1e83..45b0eba0 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java @@ -6,21 +6,24 @@ import dagger.Component; import ml.docilealligator.infinityforreddit.activities.AccountPostsActivity; import ml.docilealligator.infinityforreddit.activities.AccountSavedThingActivity; import ml.docilealligator.infinityforreddit.activities.CommentActivity; -import ml.docilealligator.infinityforreddit.activities.FullMarkdownActivity; import ml.docilealligator.infinityforreddit.activities.CreateMultiRedditActivity; import ml.docilealligator.infinityforreddit.activities.CustomThemeListingActivity; import ml.docilealligator.infinityforreddit.activities.CustomThemePreviewActivity; +import ml.docilealligator.infinityforreddit.activities.CustomizePostFilterActivity; import ml.docilealligator.infinityforreddit.activities.CustomizeThemeActivity; import ml.docilealligator.infinityforreddit.activities.EditCommentActivity; import ml.docilealligator.infinityforreddit.activities.EditMultiRedditActivity; import ml.docilealligator.infinityforreddit.activities.EditPostActivity; import ml.docilealligator.infinityforreddit.activities.FetchRandomSubredditOrPostActivity; -import ml.docilealligator.infinityforreddit.activities.FilteredThingActivity; +import ml.docilealligator.infinityforreddit.activities.FilteredPostsActivity; +import ml.docilealligator.infinityforreddit.activities.FullMarkdownActivity; import ml.docilealligator.infinityforreddit.activities.GiveAwardActivity; import ml.docilealligator.infinityforreddit.activities.InboxActivity; import ml.docilealligator.infinityforreddit.activities.LinkResolverActivity; import ml.docilealligator.infinityforreddit.activities.LoginActivity; import ml.docilealligator.infinityforreddit.activities.MainActivity; +import ml.docilealligator.infinityforreddit.activities.PostFilterUsageListingActivity; +import ml.docilealligator.infinityforreddit.activities.PostFilterPreferenceActivity; import ml.docilealligator.infinityforreddit.activities.PostImageActivity; import ml.docilealligator.infinityforreddit.activities.PostLinkActivity; import ml.docilealligator.infinityforreddit.activities.PostTextActivity; @@ -35,7 +38,6 @@ import ml.docilealligator.infinityforreddit.activities.SelectedSubredditsActivit import ml.docilealligator.infinityforreddit.activities.SendPrivateMessageActivity; import ml.docilealligator.infinityforreddit.activities.SettingsActivity; import ml.docilealligator.infinityforreddit.activities.SubmitCrosspostActivity; -import ml.docilealligator.infinityforreddit.activities.SubredditFilterPopularAndAllActivity; import ml.docilealligator.infinityforreddit.activities.SubredditMultiselectionActivity; import ml.docilealligator.infinityforreddit.activities.SubredditSelectionActivity; import ml.docilealligator.infinityforreddit.activities.SubscribedThingListingActivity; @@ -72,6 +74,7 @@ import ml.docilealligator.infinityforreddit.settings.MainPreferenceFragment; import ml.docilealligator.infinityforreddit.settings.MiscellaneousPreferenceFragment; import ml.docilealligator.infinityforreddit.settings.NotificationPreferenceFragment; import ml.docilealligator.infinityforreddit.settings.NsfwAndBlurringFragment; +import ml.docilealligator.infinityforreddit.settings.PostHistoryFragment; import ml.docilealligator.infinityforreddit.settings.SecurityPreferenceFragment; import ml.docilealligator.infinityforreddit.settings.ThemePreferenceFragment; import ml.docilealligator.infinityforreddit.settings.TranslationFragment; @@ -118,7 +121,7 @@ public interface AppComponent { void inject(SubmitPostService submitPostService); - void inject(FilteredThingActivity filteredPostsActivity); + void inject(FilteredPostsActivity filteredPostsActivity); void inject(SearchResultActivity searchResultActivity); @@ -226,5 +229,11 @@ public interface AppComponent { void inject(MiscellaneousPreferenceFragment miscellaneousPreferenceFragment); - void inject(SubredditFilterPopularAndAllActivity subredditFilterPopularAndAllActivity); + void inject(CustomizePostFilterActivity customizePostFilterActivity); + + void inject(PostHistoryFragment postHistoryFragment); + + void inject(PostFilterPreferenceActivity postFilterPreferenceActivity); + + void inject(PostFilterUsageListingActivity postFilterUsageListingActivity); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AppModule.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AppModule.java index 8e483803..64a552cf 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/AppModule.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AppModule.java @@ -11,6 +11,8 @@ import com.google.android.exoplayer2.upstream.cache.LeastRecentlyUsedCacheEvicto import com.google.android.exoplayer2.upstream.cache.SimpleCache; import java.io.File; +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import javax.inject.Named; @@ -223,6 +225,12 @@ class AppModule { } @Provides + @Named("post_history") + SharedPreferences providePostHistorySharedPreferences() { + return mApplication.getSharedPreferences(SharedPreferencesUtils.POST_HISTORY_SHARED_PREFERENCES_FILE, Context.MODE_PRIVATE); + } + + @Provides @Singleton CustomThemeWrapper provideCustomThemeWrapper(@Named("light_theme") SharedPreferences lightThemeSharedPreferences, @Named("dark_theme") SharedPreferences darkThemeSharedPreferences, @@ -239,4 +247,10 @@ class AppModule { .build(); return ToroExo.with(mApplication).getCreator(config); } + + @Provides + @Singleton + Executor provideExecutor() { + return Executors.newFixedThreadPool(4); + } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchPostFilterAndReadPosts.java b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchPostFilterAndReadPosts.java new file mode 100644 index 00000000..fc9e54f5 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchPostFilterAndReadPosts.java @@ -0,0 +1,31 @@ +package ml.docilealligator.infinityforreddit; + +import android.os.Handler; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.Executor; + +import ml.docilealligator.infinityforreddit.postfilter.PostFilter; +import ml.docilealligator.infinityforreddit.readpost.ReadPost; + +public class FetchPostFilterAndReadPosts { + public interface FetchPostFilterAndReadPostsListener { + void success(PostFilter postFilter, ArrayList<ReadPost> readPostList); + } + + public static void fetchPostFilterAndReadPosts(RedditDataRoomDatabase redditDataRoomDatabase, Executor executor, + Handler handler, String accountName, int postFilterUsage, + String nameOfUsage, FetchPostFilterAndReadPostsListener fetchPostFilterAndReadPostsListener) { + executor.execute(() -> { + List<PostFilter> postFilters = redditDataRoomDatabase.postFilterDao().getValidPostFilters(postFilterUsage, nameOfUsage); + PostFilter mergedPostFilter = PostFilter.mergePostFilter(postFilters); + if (accountName != null) { + ArrayList<ReadPost> readPosts = (ArrayList<ReadPost>) redditDataRoomDatabase.readPostDao().getAllReadPosts(accountName); + handler.post(() -> fetchPostFilterAndReadPostsListener.success(mergedPostFilter, readPosts)); + } else { + handler.post(() -> fetchPostFilterAndReadPostsListener.success(mergedPostFilter, null)); + } + }); + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FragmentCommunicator.java b/app/src/main/java/ml/docilealligator/infinityforreddit/FragmentCommunicator.java index 07a18a72..3ee75984 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/FragmentCommunicator.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/FragmentCommunicator.java @@ -1,5 +1,7 @@ package ml.docilealligator.infinityforreddit; +import ml.docilealligator.infinityforreddit.postfilter.PostFilter; + public interface FragmentCommunicator { default void refresh() { } @@ -35,4 +37,18 @@ public interface FragmentCommunicator { } void applyTheme(); + + default void hideReadPosts() { + } + + default void changePostFilter(PostFilter postFilter) { + } + + default PostFilter getPostFilter() { + return null; + } + + default void filterPosts() { + + } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/MarkPostAsReadInterface.java b/app/src/main/java/ml/docilealligator/infinityforreddit/MarkPostAsReadInterface.java new file mode 100644 index 00000000..d14c1c09 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/MarkPostAsReadInterface.java @@ -0,0 +1,7 @@ +package ml.docilealligator.infinityforreddit; + +import ml.docilealligator.infinityforreddit.post.Post; + +public interface MarkPostAsReadInterface { + void markPostAsRead(Post post); +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostFragmentContentScrollingInterface.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostFragmentContentScrollingInterface.java new file mode 100644 index 00000000..75d5271d --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostFragmentContentScrollingInterface.java @@ -0,0 +1,7 @@ +package ml.docilealligator.infinityforreddit; + +public interface PostFragmentContentScrollingInterface { + void contentScrollUp(); + + void contentScrollDown(); +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java index 6c376569..a385ff4a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/RedditDataRoomDatabase.java @@ -16,12 +16,16 @@ import ml.docilealligator.infinityforreddit.customtheme.CustomTheme; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeDao; import ml.docilealligator.infinityforreddit.multireddit.MultiReddit; import ml.docilealligator.infinityforreddit.multireddit.MultiRedditDao; +import ml.docilealligator.infinityforreddit.postfilter.PostFilter; +import ml.docilealligator.infinityforreddit.postfilter.PostFilterDao; +import ml.docilealligator.infinityforreddit.postfilter.PostFilterUsage; +import ml.docilealligator.infinityforreddit.postfilter.PostFilterUsageDao; +import ml.docilealligator.infinityforreddit.readpost.ReadPost; +import ml.docilealligator.infinityforreddit.readpost.ReadPostDao; import ml.docilealligator.infinityforreddit.recentsearchquery.RecentSearchQuery; import ml.docilealligator.infinityforreddit.recentsearchquery.RecentSearchQueryDao; import ml.docilealligator.infinityforreddit.subreddit.SubredditDao; import ml.docilealligator.infinityforreddit.subreddit.SubredditData; -import ml.docilealligator.infinityforreddit.subredditfilter.SubredditFilter; -import ml.docilealligator.infinityforreddit.subredditfilter.SubredditFilterDao; import ml.docilealligator.infinityforreddit.subscribedsubreddit.SubscribedSubredditDao; import ml.docilealligator.infinityforreddit.subscribedsubreddit.SubscribedSubredditData; import ml.docilealligator.infinityforreddit.subscribeduser.SubscribedUserDao; @@ -30,7 +34,8 @@ import ml.docilealligator.infinityforreddit.user.UserDao; import ml.docilealligator.infinityforreddit.user.UserData; @Database(entities = {Account.class, SubredditData.class, SubscribedSubredditData.class, UserData.class, - SubscribedUserData.class, MultiReddit.class, CustomTheme.class, RecentSearchQuery.class, SubredditFilter.class}, version = 13) + SubscribedUserData.class, MultiReddit.class, CustomTheme.class, RecentSearchQuery.class, + ReadPost.class, PostFilter.class, PostFilterUsage.class}, version = 16) public abstract class RedditDataRoomDatabase extends RoomDatabase { private static RedditDataRoomDatabase INSTANCE; @@ -42,7 +47,8 @@ public abstract class RedditDataRoomDatabase extends RoomDatabase { RedditDataRoomDatabase.class, "reddit_data") .addMigrations(MIGRATION_1_2, MIGRATION_2_3, MIGRATION_3_4, MIGRATION_4_5, MIGRATION_5_6, MIGRATION_6_7, MIGRATION_7_8, MIGRATION_8_9, - MIGRATION_9_10, MIGRATION_10_11, MIGRATION_11_12, MIGRATION_12_13) + MIGRATION_9_10, MIGRATION_10_11, MIGRATION_11_12, MIGRATION_12_13, + MIGRATION_13_14, MIGRATION_14_15, MIGRATION_15_16) .build(); } } @@ -66,7 +72,11 @@ public abstract class RedditDataRoomDatabase extends RoomDatabase { public abstract RecentSearchQueryDao recentSearchQueryDao(); - public abstract SubredditFilterDao subredditFilterDao(); + public abstract ReadPostDao readPostDao(); + + public abstract PostFilterDao postFilterDao(); + + public abstract PostFilterUsageDao postFilterUsageDao(); private static final Migration MIGRATION_1_2 = new Migration(1, 2) { @Override @@ -263,4 +273,40 @@ public abstract class RedditDataRoomDatabase extends RoomDatabase { + " ADD COLUMN no_preview_post_type_icon_tint INTEGER DEFAULT " + Color.parseColor("#808080") + " NOT NULL"); } }; + + private static final Migration MIGRATION_13_14 = new Migration(13, 14) { + @Override + public void migrate(@NonNull SupportSQLiteDatabase database) { + database.execSQL("CREATE TABLE read_posts" + + "(username TEXT NOT NULL, id TEXT NOT NULL, PRIMARY KEY(username, id), " + + "FOREIGN KEY(username) REFERENCES accounts(username) ON DELETE CASCADE)"); + database.execSQL("ALTER TABLE custom_themes ADD COLUMN read_post_title_color INTEGER DEFAULT " + Color.parseColor("#9D9D9D") + " NOT NULL"); + database.execSQL("ALTER TABLE custom_themes ADD COLUMN read_post_content_color INTEGER DEFAULT " + Color.parseColor("#9D9D9D") + " NOT NULL"); + database.execSQL("ALTER TABLE custom_themes ADD COLUMN read_post_card_view_background_color INTEGER DEFAULT " + Color.parseColor("#F5F5F5") + " NOT NULL"); + } + }; + + private static final Migration MIGRATION_14_15 = new Migration(14, 15) { + @Override + public void migrate(@NonNull SupportSQLiteDatabase database) { + database.execSQL("CREATE TABLE post_filter" + + "(name TEXT NOT NULL PRIMARY KEY, max_vote INTEGER NOT NULL, min_vote INTEGER NOT NULL, " + + "max_comments INTEGER NOT NULL, min_comments INTEGER NOT NULL, max_awards INTEGER NOT NULL, " + + "min_awards INTEGER NOT NULL, only_nsfw INTEGER NOT NULL, only_spoiler INTEGER NOT NULL, " + + "post_title_excludes_regex TEXT, post_title_excludes_strings TEXT, exclude_subreddits TEXT, " + + "exclude_users TEXT, contain_flairs TEXT, exclude_flairs TEXT, contain_text_type INTEGER NOT NULL, " + + "contain_link_type INTEGER NOT NULL, contain_image_type INTEGER NOT NULL, " + + "contain_gif_type INTEGER NOT NULL, contain_video_type INTEGER NOT NULL, " + + "contain_gallery_type INTEGER NOT NULL)"); + database.execSQL("CREATE TABLE post_filter_usage (name TEXT NOT NULL, usage INTEGER NOT NULL, " + + "name_of_usage TEXT NOT NULL, PRIMARY KEY(name, usage, name_of_usage), FOREIGN KEY(name) REFERENCES post_filter(name) ON DELETE CASCADE)"); + } + }; + + private static final Migration MIGRATION_15_16 = new Migration(15, 16) { + @Override + public void migrate(@NonNull SupportSQLiteDatabase database) { + database.execSQL("DROP TABLE subreddit_filter"); + } + }; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountPostsActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountPostsActivity.java index 74cf5393..06628e3e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountPostsActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountPostsActivity.java @@ -143,10 +143,12 @@ public class AccountPostsActivity extends BaseActivity implements SortTypeSelect mAccessToken = savedInstanceState.getString(ACCESS_TOKEN_STATE); mAccountName = savedInstanceState.getString(ACCOUNT_NAME_STATE); isInLazyMode = savedInstanceState.getBoolean(IS_IN_LAZY_MODE_STATE); - mFragment = getSupportFragmentManager().getFragment(savedInstanceState, FRAGMENT_OUT_STATE); - getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_account_posts_activity, mFragment).commit(); + if (!mNullAccessToken && mAccessToken == null) { getCurrentAccountAndInitializeFragment(); + } else { + mFragment = getSupportFragmentManager().getFragment(savedInstanceState, FRAGMENT_OUT_STATE); + getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_account_posts_activity, mFragment).commit(); } } else { getCurrentAccountAndInitializeFragment(); @@ -196,9 +198,9 @@ public class AccountPostsActivity extends BaseActivity implements SortTypeSelect bundle.putInt(PostFragment.EXTRA_POST_TYPE, PostDataSource.TYPE_USER); bundle.putString(PostFragment.EXTRA_USER_NAME, mAccountName); bundle.putString(PostFragment.EXTRA_USER_WHERE, mUserWhere); - bundle.putInt(PostFragment.EXTRA_FILTER, PostFragment.EXTRA_NO_FILTER); bundle.putString(PostFragment.EXTRA_ACCESS_TOKEN, mAccessToken); bundle.putString(PostFragment.EXTRA_ACCOUNT_NAME, mAccountName); + bundle.putBoolean(PostFragment.EXTRA_DISABLE_READ_POSTS, true); mFragment.setArguments(bundle); getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_account_posts_activity, mFragment).commit(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountSavedThingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountSavedThingActivity.java index 46b474fc..e7349698 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountSavedThingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountSavedThingActivity.java @@ -15,8 +15,8 @@ import androidx.annotation.Nullable; import androidx.appcompat.widget.Toolbar; import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentManager; -import androidx.lifecycle.Lifecycle; import androidx.viewpager2.adapter.FragmentStateAdapter; import androidx.viewpager2.widget.ViewPager2; @@ -30,12 +30,19 @@ import com.r0adkll.slidr.model.SlidrInterface; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; +import java.util.concurrent.Executor; + import javax.inject.Inject; import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.ActivityToolbarInterface; +import ml.docilealligator.infinityforreddit.FragmentCommunicator; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.MarkPostAsReadInterface; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; import ml.docilealligator.infinityforreddit.asynctasks.GetCurrentAccountAsyncTask; import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostLayoutBottomSheetFragment; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; @@ -43,16 +50,14 @@ import ml.docilealligator.infinityforreddit.events.ChangeNSFWEvent; import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent; import ml.docilealligator.infinityforreddit.fragments.CommentsListingFragment; import ml.docilealligator.infinityforreddit.fragments.PostFragment; -import ml.docilealligator.infinityforreddit.FragmentCommunicator; -import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.post.Post; import ml.docilealligator.infinityforreddit.post.PostDataSource; -import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.readpost.InsertReadPost; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; import retrofit2.Retrofit; public class AccountSavedThingActivity extends BaseActivity implements ActivityToolbarInterface, - PostLayoutBottomSheetFragment.PostLayoutSelectionCallback { + PostLayoutBottomSheetFragment.PostLayoutSelectionCallback, MarkPostAsReadInterface { private static final String NULL_ACCESS_TOKEN_STATE = "NATS"; private static final String ACCESS_TOKEN_STATE = "ATS"; @@ -84,6 +89,8 @@ public class AccountSavedThingActivity extends BaseActivity implements ActivityT SharedPreferences mPostLayoutSharedPreferences; @Inject CustomThemeWrapper mCustomThemeWrapper; + @Inject + Executor mExecutor; private FragmentManager fragmentManager; private SectionsPagerAdapter sectionsPagerAdapter; private SlidrInterface mSlidrInterface; @@ -196,7 +203,7 @@ public class AccountSavedThingActivity extends BaseActivity implements ActivityT } private void initializeViewPager() { - sectionsPagerAdapter = new SectionsPagerAdapter(fragmentManager, getLifecycle()); + sectionsPagerAdapter = new SectionsPagerAdapter(this); viewPager2.setAdapter(sectionsPagerAdapter); viewPager2.setOffscreenPageLimit(2); viewPager2.setUserInputEnabled(!mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_SWIPING_BETWEEN_TABS, false)); @@ -335,10 +342,15 @@ public class AccountSavedThingActivity extends BaseActivity implements ActivityT } } + @Override + public void markPostAsRead(Post post) { + InsertReadPost.insertReadPost(mRedditDataRoomDatabase, mExecutor, mAccountName, post.getId()); + } + private class SectionsPagerAdapter extends FragmentStateAdapter { - SectionsPagerAdapter(FragmentManager fm, Lifecycle lifecycle) { - super(fm, lifecycle); + SectionsPagerAdapter(FragmentActivity fa) { + super(fa); } @NonNull @@ -350,9 +362,9 @@ public class AccountSavedThingActivity extends BaseActivity implements ActivityT bundle.putInt(PostFragment.EXTRA_POST_TYPE, PostDataSource.TYPE_USER); bundle.putString(PostFragment.EXTRA_USER_NAME, mAccountName); bundle.putString(PostFragment.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_SAVED); - bundle.putInt(PostFragment.EXTRA_FILTER, PostFragment.EXTRA_NO_FILTER); bundle.putString(PostFragment.EXTRA_ACCESS_TOKEN, mAccessToken); bundle.putString(PostFragment.EXTRA_ACCOUNT_NAME, mAccountName); + bundle.putBoolean(PostFragment.EXTRA_DISABLE_READ_POSTS, true); fragment.setArguments(bundle); return fragment; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/BaseActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/BaseActivity.java index e01c0430..e2f02bdd 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/BaseActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/BaseActivity.java @@ -29,9 +29,11 @@ import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.tabs.TabLayout; import java.lang.reflect.Field; +import java.util.Locale; import ml.docilealligator.infinityforreddit.ActivityToolbarInterface; import ml.docilealligator.infinityforreddit.AppBarStateChangeListener; +import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.font.ContentFontFamily; import ml.docilealligator.infinityforreddit.font.ContentFontStyle; @@ -39,7 +41,6 @@ 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.utils.CustomThemeSharedPreferencesUtils; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; @@ -64,6 +65,26 @@ public abstract class BaseActivity extends AppCompatActivity { customThemeWrapper = getCustomThemeWrapper(); SharedPreferences mSharedPreferences = getDefaultSharedPreferences(); + + String language = mSharedPreferences.getString(SharedPreferencesUtils.LANGUAGE, SharedPreferencesUtils.LANGUAGE_DEFAULT_VALUE); + Locale systemLocale = Resources.getSystem().getConfiguration().locale; + Locale locale; + if (language.equals(SharedPreferencesUtils.LANGUAGE_DEFAULT_VALUE)) { + language = systemLocale.getLanguage(); + locale = new Locale(language, systemLocale.getCountry()); + } else { + if (language.contains("-")) { + locale = new Locale(language.substring(0, 2), language.substring(4)); + } else { + locale = new Locale(language); + } + } + Locale.setDefault(locale); + Resources resources = getResources(); + Configuration config = resources.getConfiguration(); + config.setLocale(locale); + resources.updateConfiguration(config, resources.getDisplayMetrics()); + boolean systemDefault = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q; int systemThemeType = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.THEME_KEY, "2")); immersiveInterface = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomThemeListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomThemeListingActivity.java index c30cc188..a42c3fa4 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomThemeListingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomThemeListingActivity.java @@ -14,6 +14,7 @@ import android.widget.Toast; import androidx.annotation.NonNull; import androidx.appcompat.widget.Toolbar; import androidx.coordinatorlayout.widget.CoordinatorLayout; +import androidx.core.app.ActivityCompat; import androidx.lifecycle.ViewModelProvider; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -153,8 +154,8 @@ public class CustomThemeListingActivity extends BaseActivity implements @Override public void changeName(String oldThemeName) { - View dialogView = getLayoutInflater().inflate(R.layout.dialog_edit_theme_name, null); - EditText themeNameEditText = dialogView.findViewById(R.id.theme_name_edit_text_edit_theme_name_dialog); + View dialogView = getLayoutInflater().inflate(R.layout.dialog_edit_name, null); + EditText themeNameEditText = dialogView.findViewById(R.id.name_edit_text_edit_name_dialog); themeNameEditText.setText(oldThemeName); themeNameEditText.requestFocus(); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); @@ -248,7 +249,7 @@ public class CustomThemeListingActivity extends BaseActivity implements @Subscribe public void onRecreateActivityEvent(RecreateActivityEvent recreateActivityEvent) { - recreate(); + ActivityCompat.recreate(this); } @Override @@ -292,8 +293,8 @@ public class CustomThemeListingActivity extends BaseActivity implements .setMessage(getString(R.string.duplicate_theme_name_dialog_message, customTheme.name)) .setPositiveButton(R.string.rename, (dialogInterface, i) -> { - View dialogView = getLayoutInflater().inflate(R.layout.dialog_edit_theme_name, null); - EditText themeNameEditText = dialogView.findViewById(R.id.theme_name_edit_text_edit_theme_name_dialog); + View dialogView = getLayoutInflater().inflate(R.layout.dialog_edit_name, null); + EditText themeNameEditText = dialogView.findViewById(R.id.name_edit_text_edit_name_dialog); themeNameEditText.setText(customTheme.name); themeNameEditText.requestFocus(); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizePostFilterActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizePostFilterActivity.java new file mode 100644 index 00000000..04d19eda --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomizePostFilterActivity.java @@ -0,0 +1,398 @@ +package ml.docilealligator.infinityforreddit.activities; + +import android.app.Activity; +import android.content.Intent; +import android.content.SharedPreferences; +import android.content.res.ColorStateList; +import android.os.Build; +import android.os.Bundle; +import android.os.Handler; +import android.view.Menu; +import android.view.MenuItem; +import android.widget.LinearLayout; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.annotation.NonNull; +import androidx.appcompat.widget.Toolbar; +import androidx.coordinatorlayout.widget.CoordinatorLayout; + +import com.google.android.material.appbar.AppBarLayout; +import com.google.android.material.appbar.CollapsingToolbarLayout; +import com.google.android.material.checkbox.MaterialCheckBox; +import com.google.android.material.switchmaterial.SwitchMaterial; +import com.google.android.material.textfield.TextInputEditText; +import com.google.android.material.textfield.TextInputLayout; +import com.r0adkll.slidr.Slidr; + +import java.util.concurrent.Executor; + +import javax.inject.Inject; +import javax.inject.Named; + +import butterknife.BindView; +import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; +import ml.docilealligator.infinityforreddit.postfilter.PostFilter; +import ml.docilealligator.infinityforreddit.postfilter.SavePostFilter; +import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; + +public class CustomizePostFilterActivity extends BaseActivity { + + public static final String EXTRA_POST_FILTER = "EPF"; + public static final String EXTRA_FROM_SETTINGS = "EFS"; + public static final String RETURN_EXTRA_POST_FILTER = "REPF"; + private static final String POST_FILTER_STATE = "PFS"; + + @BindView(R.id.coordinator_layout_customize_post_filter_activity) + CoordinatorLayout coordinatorLayout; + @BindView(R.id.appbar_layout_customize_post_filter_activity) + AppBarLayout appBarLayout; + @BindView(R.id.collapsing_toolbar_layout_customize_post_filter_activity) + CollapsingToolbarLayout collapsingToolbarLayout; + @BindView(R.id.toolbar_customize_post_filter_activity) + Toolbar toolbar; + @BindView(R.id.name_text_input_layout_customize_post_filter_activity) + TextInputLayout nameTextInputLayout; + @BindView(R.id.name_text_input_edit_text_customize_post_filter_activity) + TextInputEditText nameTextInputEditText; + @BindView(R.id.post_type_text_linear_layout_customize_post_filter_activity) + LinearLayout postTypeTextLinearLayout; + @BindView(R.id.post_type_text_text_view_customize_post_filter_activity) + TextView postTypeTextTextView; + @BindView(R.id.post_type_text_check_box_customize_post_filter_activity) + MaterialCheckBox postTypeTextCheckBox; + @BindView(R.id.post_type_link_linear_layout_customize_post_filter_activity) + LinearLayout postTypeLinkLinearLayout; + @BindView(R.id.post_type_link_text_view_customize_post_filter_activity) + TextView postTypeLinkTextView; + @BindView(R.id.post_type_link_check_box_customize_post_filter_activity) + MaterialCheckBox postTypeLinkCheckBox; + @BindView(R.id.post_type_image_linear_layout_customize_post_filter_activity) + LinearLayout postTypeImageLinearLayout; + @BindView(R.id.post_type_image_text_view_customize_post_filter_activity) + TextView postTypeImageTextView; + @BindView(R.id.post_type_image_check_box_customize_post_filter_activity) + MaterialCheckBox postTypeImageCheckBox; + @BindView(R.id.post_type_gif_linear_layout_customize_post_filter_activity) + LinearLayout postTypeGifLinearLayout; + @BindView(R.id.post_type_gif_text_view_customize_post_filter_activity) + TextView postTypeGifTextView; + @BindView(R.id.post_type_gif_check_box_customize_post_filter_activity) + MaterialCheckBox postTypeGifCheckBox; + @BindView(R.id.post_type_video_linear_layout_customize_post_filter_activity) + LinearLayout postTypeVideoLinearLayout; + @BindView(R.id.post_type_video_text_view_customize_post_filter_activity) + TextView postTypeVideoTextView; + @BindView(R.id.post_type_video_check_box_customize_post_filter_activity) + MaterialCheckBox postTypeVideoCheckBox; + @BindView(R.id.post_type_gallery_linear_layout_customize_post_filter_activity) + LinearLayout postTypeGalleryLinearLayout; + @BindView(R.id.post_type_gallery_text_view_customize_post_filter_activity) + TextView postTypeGalleryTextView; + @BindView(R.id.post_type_gallery_check_box_customize_post_filter_activity) + MaterialCheckBox postTypeGalleryCheckBox; + @BindView(R.id.only_nsfw_linear_layout_customize_post_filter_activity) + LinearLayout onlyNSFWLinearLayout; + @BindView(R.id.only_nsfw_text_view_customize_post_filter_activity) + TextView onlyNSFWTextView; + @BindView(R.id.only_nsfw_switch_customize_post_filter_activity) + SwitchMaterial onlyNSFWSwitch; + @BindView(R.id.only_spoiler_linear_layout_customize_post_filter_activity) + LinearLayout onlySpoilerLinearLayout; + @BindView(R.id.only_spoiler_text_view_customize_post_filter_activity) + TextView onlySpoilerTextView; + @BindView(R.id.only_spoiler_switch_customize_post_filter_activity) + SwitchMaterial onlySpoilerSwitch; + @BindView(R.id.title_excludes_strings_text_input_layout_customize_post_filter_activity) + TextInputLayout titleExcludesStringsTextInputLayout; + @BindView(R.id.title_excludes_strings_text_input_edit_text_customize_post_filter_activity) + TextInputEditText titleExcludesStringsTextInputEditText; + @BindView(R.id.title_excludes_regex_text_input_layout_customize_post_filter_activity) + TextInputLayout titleExcludesRegexTextInputLayout; + @BindView(R.id.title_excludes_regex_text_input_edit_text_customize_post_filter_activity) + TextInputEditText titleExcludesRegexTextInputEditText; + @BindView(R.id.excludes_subreddits_text_input_layout_customize_post_filter_activity) + TextInputLayout excludesSubredditsTextInputLayout; + @BindView(R.id.excludes_subreddits_text_input_edit_text_customize_post_filter_activity) + TextInputEditText excludesSubredditsTextInputEditText; + @BindView(R.id.excludes_users_text_input_layout_customize_post_filter_activity) + TextInputLayout excludesUsersTextInputLayout; + @BindView(R.id.excludes_users_text_input_edit_text_customize_post_filter_activity) + TextInputEditText excludesUsersTextInputEditText; + @BindView(R.id.excludes_flairs_text_input_layout_customize_post_filter_activity) + TextInputLayout excludesFlairsTextInputLayout; + @BindView(R.id.excludes_flairs_text_input_edit_text_customize_post_filter_activity) + TextInputEditText excludesFlairsTextInputEditText; + @BindView(R.id.contains_flairs_text_input_layout_customize_post_filter_activity) + TextInputLayout containsFlairsTextInputLayout; + @BindView(R.id.contains_flairs_text_input_edit_text_customize_post_filter_activity) + TextInputEditText containsFlairsTextInputEditText; + @BindView(R.id.min_vote_text_input_layout_customize_post_filter_activity) + TextInputLayout minVoteTextInputLayout; + @BindView(R.id.min_vote_text_input_edit_text_customize_post_filter_activity) + TextInputEditText minVoteTextInputEditText; + @BindView(R.id.max_vote_text_input_layout_customize_post_filter_activity) + TextInputLayout maxVoteTextInputLayout; + @BindView(R.id.max_vote_text_input_edit_text_customize_post_filter_activity) + TextInputEditText maxVoteTextInputEditText; + @BindView(R.id.min_comments_text_input_layout_customize_post_filter_activity) + TextInputLayout minCommentsTextInputLayout; + @BindView(R.id.min_comments_text_input_edit_text_customize_post_filter_activity) + TextInputEditText minCommentsTextInputEditText; + @BindView(R.id.max_comments_text_input_layout_customize_post_filter_activity) + TextInputLayout maxCommentsTextInputLayout; + @BindView(R.id.max_comments_text_input_edit_text_customize_post_filter_activity) + TextInputEditText maxCommentsTextInputEditText; + @BindView(R.id.min_awards_text_input_layout_customize_post_filter_activity) + TextInputLayout minAwardsTextInputLayout; + @BindView(R.id.min_awards_text_input_edit_text_customize_post_filter_activity) + TextInputEditText minAwardsTextInputEditText; + @BindView(R.id.max_awards_text_input_layout_customize_post_filter_activity) + TextInputLayout maxAwardsTextInputLayout; + @BindView(R.id.max_awards_text_input_edit_text_customize_post_filter_activity) + TextInputEditText maxAwardsTextInputEditText; + @Inject + RedditDataRoomDatabase mRedditDataRoomDatabase; + @Inject + @Named("default") + SharedPreferences mSharedPreferences; + @Inject + CustomThemeWrapper mCustomThemeWrapper; + @Inject + Executor mExecutor; + private PostFilter postFilter; + private boolean fromSettings; + + @Override + protected void onCreate(Bundle savedInstanceState) { + ((Infinity) getApplication()).getAppComponent().inject(this); + + setImmersiveModeNotApplicable(); + + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_customize_post_filter); + + ButterKnife.bind(this); + + applyCustomTheme(); + + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK, true)) { + Slidr.attach(this); + } + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isChangeStatusBarIconColor()) { + addOnOffsetChangedListener(appBarLayout); + } + + setSupportActionBar(toolbar); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + setToolbarGoToTop(toolbar); + + fromSettings = getIntent().getBooleanExtra(EXTRA_FROM_SETTINGS, false); + + postTypeTextLinearLayout.setOnClickListener(view -> { + postTypeTextCheckBox.performClick(); + }); + + postTypeLinkLinearLayout.setOnClickListener(view -> { + postTypeLinkCheckBox.performClick(); + }); + + postTypeImageLinearLayout.setOnClickListener(view -> { + postTypeImageCheckBox.performClick(); + }); + + postTypeGifLinearLayout.setOnClickListener(view -> { + postTypeGifCheckBox.performClick(); + }); + + postTypeVideoLinearLayout.setOnClickListener(view -> { + postTypeVideoCheckBox.performClick(); + }); + + postTypeGalleryLinearLayout.setOnClickListener(view -> { + postTypeGalleryCheckBox.performClick(); + }); + + onlyNSFWLinearLayout.setOnClickListener(view -> { + onlyNSFWSwitch.performClick(); + }); + + onlySpoilerLinearLayout.setOnClickListener(view -> { + onlySpoilerSwitch.performClick(); + }); + + if (savedInstanceState != null) { + postFilter = savedInstanceState.getParcelable(POST_FILTER_STATE); + } else { + postFilter = getIntent().getParcelableExtra(EXTRA_POST_FILTER); + if (postFilter == null) { + postFilter = new PostFilter(); + } + bindView(); + } + } + + private void bindView() { + nameTextInputEditText.setText(postFilter.name); + postTypeTextCheckBox.setChecked(postFilter.containTextType); + postTypeLinkCheckBox.setChecked(postFilter.containLinkType); + postTypeImageCheckBox.setChecked(postFilter.containImageType); + postTypeGifCheckBox.setChecked(postFilter.containGifType); + postTypeVideoCheckBox.setChecked(postFilter.containVideoType); + postTypeGalleryCheckBox.setChecked(postFilter.containGalleryType); + onlyNSFWSwitch.setChecked(postFilter.onlyNSFW); + onlySpoilerSwitch.setChecked(postFilter.onlySpoiler); + titleExcludesStringsTextInputEditText.setText(postFilter.postTitleExcludesStrings); + titleExcludesRegexTextInputEditText.setText(postFilter.postTitleExcludesRegex); + excludesSubredditsTextInputEditText.setText(postFilter.excludeSubreddits); + excludesUsersTextInputEditText.setText(postFilter.excludeUsers); + excludesFlairsTextInputEditText.setText(postFilter.excludeFlairs); + containsFlairsTextInputEditText.setText(postFilter.containFlairs); + minVoteTextInputEditText.setText(Integer.toString(postFilter.minVote)); + maxVoteTextInputEditText.setText(Integer.toString(postFilter.maxVote)); + minCommentsTextInputEditText.setText(Integer.toString(postFilter.minComments)); + maxCommentsTextInputEditText.setText(Integer.toString(postFilter.maxComments)); + minAwardsTextInputEditText.setText(Integer.toString(postFilter.minAwards)); + maxAwardsTextInputEditText.setText(Integer.toString(postFilter.maxAwards)); + } + + @Override + protected SharedPreferences getDefaultSharedPreferences() { + return mSharedPreferences; + } + + @Override + protected CustomThemeWrapper getCustomThemeWrapper() { + return mCustomThemeWrapper; + } + + @Override + protected void applyCustomTheme() { + coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar); + int primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor(); + nameTextInputLayout.setBoxStrokeColor(primaryTextColor); + nameTextInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor)); + nameTextInputEditText.setTextColor(primaryTextColor); + postTypeTextTextView.setTextColor(primaryTextColor); + postTypeLinkTextView.setTextColor(primaryTextColor); + postTypeImageTextView.setTextColor(primaryTextColor); + postTypeGifTextView.setTextColor(primaryTextColor); + postTypeVideoTextView.setTextColor(primaryTextColor); + postTypeGalleryTextView.setTextColor(primaryTextColor); + onlyNSFWTextView.setTextColor(primaryTextColor); + onlySpoilerTextView.setTextColor(primaryTextColor); + titleExcludesStringsTextInputLayout.setBoxStrokeColor(primaryTextColor); + titleExcludesStringsTextInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor)); + titleExcludesStringsTextInputEditText.setTextColor(primaryTextColor); + titleExcludesRegexTextInputLayout.setBoxStrokeColor(primaryTextColor); + titleExcludesRegexTextInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor)); + titleExcludesRegexTextInputEditText.setTextColor(primaryTextColor); + excludesSubredditsTextInputLayout.setBoxStrokeColor(primaryTextColor); + excludesSubredditsTextInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor)); + excludesSubredditsTextInputEditText.setTextColor(primaryTextColor); + excludesUsersTextInputLayout.setBoxStrokeColor(primaryTextColor); + excludesUsersTextInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor)); + excludesUsersTextInputEditText.setTextColor(primaryTextColor); + excludesFlairsTextInputLayout.setBoxStrokeColor(primaryTextColor); + excludesFlairsTextInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor)); + excludesFlairsTextInputEditText.setTextColor(primaryTextColor); + containsFlairsTextInputLayout.setBoxStrokeColor(primaryTextColor); + containsFlairsTextInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor)); + containsFlairsTextInputEditText.setTextColor(primaryTextColor); + minVoteTextInputLayout.setBoxStrokeColor(primaryTextColor); + minVoteTextInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor)); + minVoteTextInputEditText.setTextColor(primaryTextColor); + maxVoteTextInputLayout.setBoxStrokeColor(primaryTextColor); + maxVoteTextInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor)); + maxVoteTextInputEditText.setTextColor(primaryTextColor); + minCommentsTextInputLayout.setBoxStrokeColor(primaryTextColor); + minCommentsTextInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor)); + minCommentsTextInputEditText.setTextColor(primaryTextColor); + maxCommentsTextInputLayout.setBoxStrokeColor(primaryTextColor); + maxCommentsTextInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor)); + maxCommentsTextInputEditText.setTextColor(primaryTextColor); + minAwardsTextInputLayout.setBoxStrokeColor(primaryTextColor); + minAwardsTextInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor)); + minAwardsTextInputEditText.setTextColor(primaryTextColor); + maxAwardsTextInputLayout.setBoxStrokeColor(primaryTextColor); + maxAwardsTextInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor)); + maxAwardsTextInputEditText.setTextColor(primaryTextColor); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.customize_post_filter_activity, menu); + if (fromSettings) { + menu.findItem(R.id.action_save_customize_post_filter_activity).setVisible(false); + } + applyMenuItemTheme(menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(@NonNull MenuItem item) { + if (item.getItemId() == android.R.id.home) { + finish(); + return true; + } else if (item.getItemId() == R.id.action_save_customize_post_filter_activity) { + constructPostFilter(); + Intent returnIntent = new Intent(); + returnIntent.putExtra(RETURN_EXTRA_POST_FILTER, postFilter); + setResult(Activity.RESULT_OK, returnIntent); + finish(); + + return true; + } else if (item.getItemId() == R.id.action_save_to_database_customize_post_filter_activity) { + constructPostFilter(); + + if (!postFilter.name.equals("")) { + Handler handler = new Handler(); + SavePostFilter.savePostFilter(mRedditDataRoomDatabase, mExecutor, postFilter, () -> handler.post(() -> { + Intent returnIntent = new Intent(); + returnIntent.putExtra(RETURN_EXTRA_POST_FILTER, postFilter); + setResult(Activity.RESULT_OK, returnIntent); + finish(); + })); + } else { + Toast.makeText(CustomizePostFilterActivity.this, R.string.post_filter_requires_a_name, Toast.LENGTH_LONG).show(); + } + } + return false; + } + + private void constructPostFilter() { + postFilter.name = nameTextInputEditText.getText().toString(); + postFilter.maxVote = maxVoteTextInputEditText.getText() == null || maxVoteTextInputEditText.getText().toString().equals("") ? -1 : Integer.parseInt(maxVoteTextInputEditText.getText().toString()); + postFilter.minVote = minVoteTextInputEditText.getText() == null || minVoteTextInputEditText.getText().toString().equals("") ? -1 : Integer.parseInt(minVoteTextInputEditText.getText().toString()); + postFilter.maxComments = maxCommentsTextInputEditText.getText() == null || maxCommentsTextInputEditText.getText().toString().equals("") ? -1 : Integer.parseInt(maxCommentsTextInputEditText.getText().toString()); + postFilter.minComments = minCommentsTextInputEditText.getText() == null || minCommentsTextInputEditText.getText().toString().equals("") ? -1 : Integer.parseInt(minCommentsTextInputEditText.getText().toString()); + postFilter.maxAwards = maxAwardsTextInputEditText.getText() == null || maxAwardsTextInputEditText.getText().toString().equals("") ? -1 : Integer.parseInt(maxAwardsTextInputEditText.getText().toString()); + postFilter.minAwards = minAwardsTextInputEditText.getText() == null || minAwardsTextInputEditText.getText().toString().equals("") ? -1 : Integer.parseInt(minAwardsTextInputEditText.getText().toString()); + postFilter.postTitleExcludesRegex = titleExcludesRegexTextInputEditText.getText().toString(); + postFilter.postTitleExcludesStrings = titleExcludesStringsTextInputEditText.getText().toString(); + postFilter.excludeSubreddits = excludesSubredditsTextInputEditText.getText().toString(); + postFilter.excludeUsers = excludesUsersTextInputEditText.getText().toString(); + postFilter.excludeFlairs = excludesUsersTextInputEditText.getText().toString(); + postFilter.containFlairs = containsFlairsTextInputEditText.getText().toString(); + postFilter.containTextType = postTypeTextCheckBox.isChecked(); + postFilter.containLinkType = postTypeLinkCheckBox.isChecked(); + postFilter.containImageType = postTypeImageCheckBox.isChecked(); + postFilter.containGifType = postTypeGifCheckBox.isChecked(); + postFilter.containVideoType = postTypeVideoCheckBox.isChecked(); + postFilter.containGalleryType = postTypeGalleryCheckBox.isChecked(); + postFilter.onlyNSFW = onlyNSFWSwitch.isChecked(); + postFilter.onlySpoiler = onlySpoilerSwitch.isChecked(); + } + + @Override + protected void onSaveInstanceState(@NonNull Bundle outState) { + super.onSaveInstanceState(outState); + outState.putParcelable(POST_FILTER_STATE, postFilter); + } +}
\ No newline at end of file diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditMultiRedditActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditMultiRedditActivity.java index ab3ddfd3..e8171567 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditMultiRedditActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditMultiRedditActivity.java @@ -94,6 +94,9 @@ public class EditMultiRedditActivity extends BaseActivity { @Override protected void onCreate(Bundle savedInstanceState) { ((Infinity) getApplication()).getAppComponent().inject(this); + + setImmersiveModeNotApplicable(); + super.onCreate(savedInstanceState); setContentView(R.layout.activity_edit_multi_reddit); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredThingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredPostsActivity.java index 42a366e9..a4ea7760 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredThingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredPostsActivity.java @@ -1,5 +1,6 @@ package ml.docilealligator.infinityforreddit.activities; +import android.content.Intent; import android.content.SharedPreferences; import android.os.Build; import android.os.Bundle; @@ -11,24 +12,36 @@ import android.view.Window; import android.view.WindowManager; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import androidx.appcompat.widget.Toolbar; import androidx.coordinatorlayout.widget.CoordinatorLayout; -import androidx.fragment.app.Fragment; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.appbar.CollapsingToolbarLayout; +import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.r0adkll.slidr.Slidr; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; +import java.util.concurrent.Executor; + import javax.inject.Inject; import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.ActivityToolbarInterface; +import ml.docilealligator.infinityforreddit.FragmentCommunicator; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.MarkPostAsReadInterface; +import ml.docilealligator.infinityforreddit.PostFragmentContentScrollingInterface; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.SortType; +import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback; import ml.docilealligator.infinityforreddit.asynctasks.GetCurrentAccountAsyncTask; +import ml.docilealligator.infinityforreddit.bottomsheetfragments.FilteredThingFABMoreOptionsBottomSheetFragment; import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostLayoutBottomSheetFragment; import ml.docilealligator.infinityforreddit.bottomsheetfragments.SearchPostSortTypeBottomSheetFragment; import ml.docilealligator.infinityforreddit.bottomsheetfragments.SortTimeBottomSheetFragment; @@ -37,18 +50,16 @@ import ml.docilealligator.infinityforreddit.bottomsheetfragments.UserThingSortTy import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent; import ml.docilealligator.infinityforreddit.fragments.PostFragment; -import ml.docilealligator.infinityforreddit.FragmentCommunicator; -import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.post.Post; import ml.docilealligator.infinityforreddit.post.PostDataSource; -import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; -import ml.docilealligator.infinityforreddit.SortType; -import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback; +import ml.docilealligator.infinityforreddit.postfilter.PostFilter; +import ml.docilealligator.infinityforreddit.readpost.InsertReadPost; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; -public class FilteredThingActivity extends BaseActivity implements SortTypeSelectionCallback, - PostLayoutBottomSheetFragment.PostLayoutSelectionCallback, ActivityToolbarInterface { +public class FilteredPostsActivity extends BaseActivity implements SortTypeSelectionCallback, + PostLayoutBottomSheetFragment.PostLayoutSelectionCallback, ActivityToolbarInterface, + MarkPostAsReadInterface, FilteredThingFABMoreOptionsBottomSheetFragment.FABOptionSelectionCallback, + PostFragmentContentScrollingInterface { public static final String EXTRA_NAME = "ESN"; public static final String EXTRA_QUERY = "EQ"; @@ -61,6 +72,7 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec private static final String ACCESS_TOKEN_STATE = "ATS"; private static final String ACCOUNT_NAME_STATE = "ANS"; private static final String FRAGMENT_OUT_STATE = "FOS"; + private static final int CUSTOMIZE_POST_FILTER_ACTIVITY_REQUEST_CODE = 1000; @BindView(R.id.coordinator_layout_filtered_thing_activity) CoordinatorLayout coordinatorLayout; @@ -70,6 +82,8 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec CollapsingToolbarLayout collapsingToolbarLayout; @BindView(R.id.toolbar_filtered_posts_activity) Toolbar toolbar; + @BindView(R.id.fab_filtered_thing_activity) + FloatingActionButton fab; @Inject RedditDataRoomDatabase mRedditDataRoomDatabase; @Inject @@ -80,6 +94,8 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec SharedPreferences mPostLayoutSharedPreferences; @Inject CustomThemeWrapper mCustomThemeWrapper; + @Inject + Executor mExecutor; private boolean isInLazyMode = false; private boolean mNullAccessToken = false; private String mAccessToken; @@ -87,7 +103,7 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec private String name; private String userWhere; private int postType; - private Fragment mFragment; + private PostFragment mFragment; private Menu mMenu; private AppBarLayout.LayoutParams params; private SortTypeBottomSheetFragment bestSortTypeBottomSheetFragment; @@ -133,6 +149,13 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); } adjustToolbar(toolbar); + + int navBarHeight = getNavBarHeight(); + if (navBarHeight > 0) { + CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) fab.getLayoutParams(); + params.bottomMargin += navBarHeight; + fab.setLayoutParams(params); + } } } @@ -144,7 +167,61 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec name = getIntent().getStringExtra(EXTRA_NAME); postType = getIntent().getIntExtra(EXTRA_POST_TYPE, PostDataSource.TYPE_FRONT_PAGE); - int filter = getIntent().getIntExtra(EXTRA_FILTER, Post.TEXT_TYPE); + int filter = getIntent().getIntExtra(EXTRA_FILTER, -1000); + PostFilter postFilter = new PostFilter(); + switch (filter) { + case Post.NSFW_TYPE: + postFilter.onlyNSFW = true; + break; + case Post.TEXT_TYPE: + postFilter.containTextType = true; + postFilter.containLinkType = false; + postFilter.containImageType = false; + postFilter.containGifType = false; + postFilter.containVideoType = false; + postFilter.containGalleryType = false; + break; + case Post.LINK_TYPE: + postFilter.containTextType = false; + postFilter.containLinkType = true; + postFilter.containImageType = false; + postFilter.containGifType = false; + postFilter.containVideoType = false; + postFilter.containGalleryType = false; + break; + case Post.IMAGE_TYPE: + postFilter.containTextType = false; + postFilter.containLinkType = false; + postFilter.containImageType = true; + postFilter.containGifType = false; + postFilter.containVideoType = false; + postFilter.containGalleryType = false; + break; + case Post.GIF_TYPE: + postFilter.containTextType = false; + postFilter.containLinkType = false; + postFilter.containImageType = false; + postFilter.containGifType = true; + postFilter.containVideoType = false; + postFilter.containGalleryType = false; + break; + case Post.VIDEO_TYPE: + postFilter.containTextType = false; + postFilter.containLinkType = false; + postFilter.containImageType = false; + postFilter.containGifType = false; + postFilter.containVideoType = true; + postFilter.containGalleryType = false; + break; + case Post.GALLERY_TYPE: + postFilter.containTextType = false; + postFilter.containLinkType = false; + postFilter.containImageType = false; + postFilter.containGifType = false; + postFilter.containVideoType = false; + postFilter.containGalleryType = true; + break; + } if (postType == PostDataSource.TYPE_USER) { userWhere = getIntent().getStringExtra(EXTRA_USER_WHERE); @@ -159,16 +236,15 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec mAccessToken = savedInstanceState.getString(ACCESS_TOKEN_STATE); mAccountName = savedInstanceState.getString(ACCOUNT_NAME_STATE); - mFragment = getSupportFragmentManager().getFragment(savedInstanceState, FRAGMENT_OUT_STATE); - getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_filtered_posts_activity, mFragment).commit(); - if (!mNullAccessToken && mAccessToken == null) { - getCurrentAccountAndBindView(filter); + getCurrentAccountAndBindView(postFilter); } else { - bindView(filter, false); + mFragment = (PostFragment) getSupportFragmentManager().getFragment(savedInstanceState, FRAGMENT_OUT_STATE); + getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_filtered_posts_activity, mFragment).commit(); + bindView(postFilter, false); } } else { - getCurrentAccountAndBindView(filter); + getCurrentAccountAndBindView(postFilter); } postLayoutBottomSheetFragment = new PostLayoutBottomSheetFragment(); @@ -197,9 +273,10 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec protected void applyCustomTheme() { coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar); + applyFABTheme(fab); } - private void getCurrentAccountAndBindView(int filter) { + private void getCurrentAccountAndBindView(PostFilter postFilter) { new GetCurrentAccountAsyncTask(mRedditDataRoomDatabase.accountDao(), account -> { if (account == null) { mNullAccessToken = true; @@ -207,11 +284,11 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec mAccessToken = account.getAccessToken(); mAccountName = account.getUsername(); } - bindView(filter, true); + bindView(postFilter, true); }).execute(); } - private void bindView(int filter, boolean initializeFragment) { + private void bindView(PostFilter postFilter, boolean initializeFragment) { switch (postType) { case PostDataSource.TYPE_FRONT_PAGE: getSupportActionBar().setTitle(name); @@ -271,35 +348,11 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec sortTimeBottomSheetFragment = new SortTimeBottomSheetFragment(); - switch (filter) { - case Post.NSFW_TYPE: - toolbar.setSubtitle(R.string.nsfw); - break; - case Post.TEXT_TYPE: - toolbar.setSubtitle(R.string.text); - break; - case Post.LINK_TYPE: - case Post.NO_PREVIEW_LINK_TYPE: - toolbar.setSubtitle(R.string.link); - break; - case Post.IMAGE_TYPE: - toolbar.setSubtitle(R.string.image); - break; - case Post.VIDEO_TYPE: - toolbar.setSubtitle(R.string.video); - break; - case Post.GIF_TYPE: - toolbar.setSubtitle(R.string.gif); - break; - case Post.GALLERY_TYPE: - toolbar.setSubtitle(R.string.gallery); - } - if (initializeFragment) { mFragment = new PostFragment(); Bundle bundle = new Bundle(); bundle.putInt(PostFragment.EXTRA_POST_TYPE, postType); - bundle.putInt(PostFragment.EXTRA_FILTER, filter); + bundle.putParcelable(PostFragment.EXTRA_FILTER, postFilter); bundle.putString(PostFragment.EXTRA_ACCESS_TOKEN, mAccessToken); bundle.putString(PostFragment.EXTRA_ACCOUNT_NAME, mAccountName); if (postType == PostDataSource.TYPE_USER) { @@ -314,6 +367,23 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec mFragment.setArguments(bundle); getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_filtered_posts_activity, mFragment).commit(); } + + fab.setOnClickListener(view -> { + Intent intent = new Intent(this, CustomizePostFilterActivity.class); + if (mFragment != null) { + intent.putExtra(CustomizePostFilterActivity.EXTRA_POST_FILTER, mFragment.getPostFilter()); + } + startActivityForResult(intent, CUSTOMIZE_POST_FILTER_ACTIVITY_REQUEST_CODE); + }); + + if (mAccessToken != null) { + fab.setOnLongClickListener(view -> { + FilteredThingFABMoreOptionsBottomSheetFragment filteredThingFABMoreOptionsBottomSheetFragment + = new FilteredThingFABMoreOptionsBottomSheetFragment(); + filteredThingFABMoreOptionsBottomSheetFragment.show(getSupportFragmentManager(), filteredThingFABMoreOptionsBottomSheetFragment.getTag()); + return true; + }); + } } @Override @@ -399,6 +469,16 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec } @Override + protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { + super.onActivityResult(requestCode, resultCode, data); + if (requestCode == CUSTOMIZE_POST_FILTER_ACTIVITY_REQUEST_CODE && resultCode == RESULT_OK) { + if (mFragment != null) { + mFragment.changePostFilter(data.getParcelableExtra(CustomizePostFilterActivity.RETURN_EXTRA_POST_FILTER)); + } + } + } + + @Override protected void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); getSupportFragmentManager().putFragment(outState, FRAGMENT_OUT_STATE, mFragment); @@ -416,7 +496,7 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec @Override public void sortTypeSelected(SortType sortType) { - ((PostFragment) mFragment).changeSortType(sortType); + mFragment.changeSortType(sortType); } @Override @@ -455,7 +535,33 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec @Override public void onLongPress() { if (mFragment != null) { - ((PostFragment) mFragment).goBackToTop(); + mFragment.goBackToTop(); + } + } + + @Override + public void markPostAsRead(Post post) { + InsertReadPost.insertReadPost(mRedditDataRoomDatabase, mExecutor, mAccountName, post.getId()); + } + + @Override + public void fabOptionSelected(int option) { + if (option == FilteredThingFABMoreOptionsBottomSheetFragment.FAB_OPTION_FILTER) { + + } else if (option == FilteredThingFABMoreOptionsBottomSheetFragment.FAB_OPTION_HIDE_READ_POSTS) { + if (mFragment != null) { + mFragment.hideReadPosts(); + } } } + + @Override + public void contentScrollUp() { + fab.show(); + } + + @Override + public void contentScrollDown() { + fab.hide(); + } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java index f874244c..5e0ce147 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java @@ -145,6 +145,11 @@ public class FullMarkdownActivity extends BaseActivity { int start = 0; boolean find = false; while (matcher.find(start)) { + if (markdownStringBuilder.length() < 4 + || matcher.start() < 0 + || matcher.end() > markdownStringBuilder.length()) { + break; + } find = true; markdownStringBuilder.delete(matcher.end() - 2, matcher.end()); markdownStringBuilder.delete(matcher.start(), matcher.start() + 2); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java index bac8f3da..27fa8298 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java @@ -10,7 +10,9 @@ import android.os.Bundle; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; +import androidx.browser.customtabs.CustomTabColorSchemeParams; import androidx.browser.customtabs.CustomTabsIntent; +import androidx.browser.customtabs.CustomTabsService; import java.util.ArrayList; import java.util.List; @@ -23,8 +25,6 @@ import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; -import static androidx.browser.customtabs.CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION; - public class LinkResolverActivity extends AppCompatActivity { public static final String EXTRA_MESSAGE_FULLNAME = "ENF"; @@ -276,7 +276,7 @@ public class LinkResolverActivity extends AppCompatActivity { ArrayList<ResolveInfo> packagesSupportingCustomTabs = new ArrayList<>(); for (ResolveInfo info : resolvedActivityList) { Intent serviceIntent = new Intent(); - serviceIntent.setAction(ACTION_CUSTOM_TABS_CONNECTION); + serviceIntent.setAction(CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION); serviceIntent.setPackage(info.activityInfo.packageName); // Check if this package also resolves the Custom Tabs service. if (pm.resolveService(serviceIntent, 0) != null) { @@ -291,8 +291,11 @@ public class LinkResolverActivity extends AppCompatActivity { if (!resolveInfos.isEmpty()) { CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(); // add share action to menu list - builder.addDefaultShareMenuItem(); - builder.setToolbarColor(mCustomThemeWrapper.getColorPrimary()); + builder.setShareState(CustomTabsIntent.SHARE_STATE_ON); + builder.setDefaultColorSchemeParams( + new CustomTabColorSchemeParams.Builder() + .setToolbarColor(mCustomThemeWrapper.getColorPrimary()) + .build()); CustomTabsIntent customTabsIntent = builder.build(); customTabsIntent.intent.setPackage(resolveInfos.get(0).activityInfo.packageName); if (uri.getScheme() == null) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java index ed20aaf3..6fa85ca5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java @@ -27,11 +27,12 @@ import androidx.appcompat.app.ActionBarDrawerToggle; import androidx.appcompat.app.AppCompatDelegate; import androidx.appcompat.widget.Toolbar; import androidx.coordinatorlayout.widget.CoordinatorLayout; +import androidx.core.app.ActivityCompat; import androidx.core.view.GravityCompat; import androidx.drawerlayout.widget.DrawerLayout; import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentManager; -import androidx.lifecycle.Lifecycle; import androidx.lifecycle.ViewModelProvider; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -57,6 +58,7 @@ import org.greenrobot.eventbus.Subscribe; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.Executor; import java.util.concurrent.TimeUnit; import javax.inject.Inject; @@ -64,8 +66,18 @@ import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; -import ml.docilealligator.infinityforreddit.account.AccountViewModel; import ml.docilealligator.infinityforreddit.ActivityToolbarInterface; +import ml.docilealligator.infinityforreddit.FetchMyInfo; +import ml.docilealligator.infinityforreddit.FetchSubscribedThing; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.MarkPostAsReadInterface; +import ml.docilealligator.infinityforreddit.PostFragmentContentScrollingInterface; +import ml.docilealligator.infinityforreddit.PullNotificationWorker; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.SortType; +import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback; +import ml.docilealligator.infinityforreddit.account.AccountViewModel; import ml.docilealligator.infinityforreddit.adapters.NavigationDrawerRecyclerViewAdapter; import ml.docilealligator.infinityforreddit.asynctasks.GetCurrentAccountAsyncTask; import ml.docilealligator.infinityforreddit.asynctasks.InsertSubscribedThingsAsyncTask; @@ -85,17 +97,11 @@ import ml.docilealligator.infinityforreddit.events.ChangeNSFWEvent; import ml.docilealligator.infinityforreddit.events.ChangeRequireAuthToAccountSectionEvent; import ml.docilealligator.infinityforreddit.events.RecreateActivityEvent; import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent; -import ml.docilealligator.infinityforreddit.FetchMyInfo; -import ml.docilealligator.infinityforreddit.FetchSubscribedThing; import ml.docilealligator.infinityforreddit.fragments.PostFragment; -import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.message.ReadMessage; +import ml.docilealligator.infinityforreddit.post.Post; import ml.docilealligator.infinityforreddit.post.PostDataSource; -import ml.docilealligator.infinityforreddit.PullNotificationWorker; -import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; -import ml.docilealligator.infinityforreddit.SortType; -import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback; +import ml.docilealligator.infinityforreddit.readpost.InsertReadPost; import ml.docilealligator.infinityforreddit.subreddit.SubredditData; import ml.docilealligator.infinityforreddit.subscribedsubreddit.SubscribedSubredditData; import ml.docilealligator.infinityforreddit.subscribedsubreddit.SubscribedSubredditViewModel; @@ -110,7 +116,8 @@ import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES; public class MainActivity extends BaseActivity implements SortTypeSelectionCallback, PostTypeBottomSheetFragment.PostTypeSelectionCallback, PostLayoutBottomSheetFragment.PostLayoutSelectionCallback, - ActivityToolbarInterface, FABMoreOptionsBottomSheetFragment.FABOptionSelectionCallback, RandomBottomSheetFragment.RandomOptionSelectionCallback { + ActivityToolbarInterface, FABMoreOptionsBottomSheetFragment.FABOptionSelectionCallback, + RandomBottomSheetFragment.RandomOptionSelectionCallback, MarkPostAsReadInterface, PostFragmentContentScrollingInterface { static final String EXTRA_MESSSAGE_FULLNAME = "ENF"; static final String EXTRA_NEW_ACCOUNT_NAME = "ENAN"; @@ -148,17 +155,17 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb RecyclerView navDrawerRecyclerView; @BindView(R.id.tab_layout_main_activity) TabLayout tabLayout; - @BindView(R.id.bottom_app_bar_main_activity) + @BindView(R.id.bottom_app_bar_bottom_app_bar) BottomAppBar bottomAppBar; - @BindView(R.id.linear_layout_bottom_app_bar_main_activity) + @BindView(R.id.linear_layout_bottom_app_bar) LinearLayout linearLayoutBottomAppBar; - @BindView(R.id.option_1_bottom_app_bar_main_activity) + @BindView(R.id.option_1_bottom_app_bar) ImageView option1BottomAppBar; - @BindView(R.id.option_2_bottom_app_bar_main_activity) + @BindView(R.id.option_2_bottom_app_bar) ImageView option2BottomAppBar; - @BindView(R.id.option_3_bottom_app_bar_main_activity) + @BindView(R.id.option_3_bottom_app_bar) ImageView option3BottomAppBar; - @BindView(R.id.option_4_bottom_app_bar_main_activity) + @BindView(R.id.option_4_bottom_app_bar) ImageView option4BottomAppBar; @BindView(R.id.fab_main_activity) FloatingActionButton fab; @@ -192,14 +199,11 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb SharedPreferences bottomAppBarSharedPreference; @Inject CustomThemeWrapper mCustomThemeWrapper; + @Inject + Executor mExecutor; private FragmentManager fragmentManager; private SectionsPagerAdapter sectionsPagerAdapter; private AppBarLayout.LayoutParams params; - private PostTypeBottomSheetFragment postTypeBottomSheetFragment; - private SortTypeBottomSheetFragment sortTypeBottomSheetFragment; - private SortTimeBottomSheetFragment sortTimeBottomSheetFragment; - private PostLayoutBottomSheetFragment postLayoutBottomSheetFragment; - private FABMoreOptionsBottomSheetFragment fabMoreOptionsBottomSheetFragment; private NavigationDrawerRecyclerViewAdapter adapter; private boolean mNullAccessToken = false; private String mAccessToken; @@ -220,6 +224,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb private boolean mDisableSwipingBetweenTabs; private boolean mShowFavoriteSubscribedSubreddits; private boolean mShowSubscribedSubreddits; + private int fabOption; @Override protected void onCreate(Bundle savedInstanceState) { @@ -272,12 +277,6 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb } } - postTypeBottomSheetFragment = new PostTypeBottomSheetFragment(); - sortTypeBottomSheetFragment = new SortTypeBottomSheetFragment(); - sortTimeBottomSheetFragment = new SortTimeBottomSheetFragment(); - postLayoutBottomSheetFragment = new PostLayoutBottomSheetFragment(); - fabMoreOptionsBottomSheetFragment = new FABMoreOptionsBottomSheetFragment(); - setSupportActionBar(toolbar); setToolbarGoToTop(toolbar); @@ -507,8 +506,11 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb } if (mAccessToken == null) { + CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) fab.getLayoutParams(); + lp.setAnchorId(View.NO_ID); + lp.gravity = Gravity.END | Gravity.BOTTOM; + fab.setLayoutParams(lp); bottomAppBar.setVisibility(View.GONE); - fab.setVisibility(View.GONE); } else { if (showBottomAppBar) { int optionCount = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_OPTION_COUNT, 4); @@ -563,196 +565,229 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb lp.gravity = Gravity.END | Gravity.BOTTOM; fab.setLayoutParams(lp); } + } - int fabOption = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB, SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_SUBMIT_POSTS); + fabOption = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB, + SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_SUBMIT_POSTS); + switch (fabOption) { + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_REFRESH: + fab.setImageResource(R.drawable.ic_refresh_24dp); + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE: + fab.setImageResource(R.drawable.ic_sort_toolbar_24dp); + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT: + fab.setImageResource(R.drawable.ic_post_layout_24dp); + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_SEARCH: + fab.setImageResource(R.drawable.ic_search_black_24dp); + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT: + fab.setImageResource(R.drawable.ic_subreddit_24dp); + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_GO_TO_USER: + fab.setImageResource(R.drawable.ic_user_24dp); + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_RANDOM: + fab.setImageResource(R.drawable.ic_random_24dp); + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS: + if (mAccessToken == null) { + fab.setImageResource(R.drawable.ic_filter_24dp); + fabOption = SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_FILTER_POSTS; + } else { + fab.setImageResource(R.drawable.ic_hide_read_posts_24dp); + } + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_FILTER_POSTS: + fab.setImageResource(R.drawable.ic_filter_24dp); + break; + default: + if (mAccessToken == null) { + fab.setImageResource(R.drawable.ic_filter_24dp); + fabOption = SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_FILTER_POSTS; + } else { + fab.setImageResource(R.drawable.ic_add_day_night_24dp); + } + break; + } + fab.setOnClickListener(view -> { switch (fabOption) { - case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_REFRESH: - fab.setImageResource(R.drawable.ic_refresh_24dp); + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_REFRESH: { + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.refresh(); + } break; - case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE: - fab.setImageResource(R.drawable.ic_sort_toolbar_24dp); + } + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE: { + changeSortType(); break; - case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT: - fab.setImageResource(R.drawable.ic_post_layout_24dp); + } + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT: { + PostLayoutBottomSheetFragment postLayoutBottomSheetFragment = new PostLayoutBottomSheetFragment(); + postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag()); break; - case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_SEARCH: - fab.setImageResource(R.drawable.ic_search_black_24dp); + } + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_SEARCH: { + Intent intent = new Intent(this, SearchActivity.class); + startActivity(intent); break; + } case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT: - fab.setImageResource(R.drawable.ic_subreddit_24dp); + goToSubreddit(); break; case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_GO_TO_USER: - fab.setImageResource(R.drawable.ic_user_24dp); + goToUser(); break; case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_RANDOM: - fab.setImageResource(R.drawable.ic_random_24dp); + randomThing(); + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS: + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.hideReadPosts(); + } + break; + case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_FILTER_POSTS: + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.filterPosts(); + } break; default: - fab.setImageResource(R.drawable.ic_add_day_night_24dp); + PostTypeBottomSheetFragment postTypeBottomSheetFragment = new PostTypeBottomSheetFragment(); + postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag()); break; } - fab.setOnClickListener(view -> { - switch (fabOption) { - case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_REFRESH: { - if (sectionsPagerAdapter != null) { - sectionsPagerAdapter.refresh(); - } - break; - } - case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE: { - changeSortType(); - break; - } - case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT: { - postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag()); - break; - } - case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_SEARCH: { - Intent intent = new Intent(this, SearchActivity.class); - startActivity(intent); - break; - } - case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT: - goToSubreddit(); - break; - case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_GO_TO_USER: - goToUser(); - break; - case SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_RANDOM: - randomThing(); - break; - default: - postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag()); - break; - } - }); - fab.setOnLongClickListener(view -> { - fabMoreOptionsBottomSheetFragment.show(getSupportFragmentManager(), fabMoreOptionsBottomSheetFragment.getTag()); - return true; - }); - fab.setVisibility(View.VISIBLE); - } + }); + fab.setOnLongClickListener(view -> { + FABMoreOptionsBottomSheetFragment fabMoreOptionsBottomSheetFragment= new FABMoreOptionsBottomSheetFragment(); + Bundle bundle = new Bundle(); + bundle.putBoolean(FABMoreOptionsBottomSheetFragment.EXTRA_ANONYMOUS_MODE, mAccessToken == null); + fabMoreOptionsBottomSheetFragment.setArguments(bundle); + fabMoreOptionsBottomSheetFragment.show(getSupportFragmentManager(), fabMoreOptionsBottomSheetFragment.getTag()); + return true; + }); + fab.setVisibility(View.VISIBLE); adapter = new NavigationDrawerRecyclerViewAdapter(this, mSharedPreferences, mNsfwAndSpoilerSharedPreferences, mCustomThemeWrapper, mAccountName, mProfileImageUrl, mBannerImageUrl, mKarma, new NavigationDrawerRecyclerViewAdapter.ItemClickListener() { - @Override - public void onMenuClick(int stringId) { - Intent intent = null; - switch (stringId) { - case R.string.profile: - intent = new Intent(MainActivity.this, ViewUserDetailActivity.class); - intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, mAccountName); - break; - case R.string.subscriptions: - intent = new Intent(MainActivity.this, SubscribedThingListingActivity.class); - break; - case R.string.multi_reddit: - intent = new Intent(MainActivity.this, SubscribedThingListingActivity.class); - intent.putExtra(SubscribedThingListingActivity.EXTRA_SHOW_MULTIREDDITS, true); - break; - case R.string.inbox: - intent = new Intent(MainActivity.this, InboxActivity.class); - break; - case R.string.upvoted: - intent = new Intent(MainActivity.this, AccountPostsActivity.class); - intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_UPVOTED); - break; - case R.string.downvoted: - intent = new Intent(MainActivity.this, AccountPostsActivity.class); - intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_DOWNVOTED); - break; - case R.string.hidden: - intent = new Intent(MainActivity.this, AccountPostsActivity.class); - intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_HIDDEN); - break; - case R.string.saved: - intent = new Intent(MainActivity.this, AccountSavedThingActivity.class); - break; - case R.string.gilded: - intent = new Intent(MainActivity.this, AccountPostsActivity.class); - intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_GILDED); - break; - case R.string.light_theme: - mSharedPreferences.edit().putString(SharedPreferencesUtils.THEME_KEY, "0").apply(); - AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO); - mCustomThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.LIGHT); - break; - case R.string.dark_theme: - mSharedPreferences.edit().putString(SharedPreferencesUtils.THEME_KEY, "1").apply(); - AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES); - if (mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) { - mCustomThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.AMOLED); - } else { - mCustomThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.DARK); - } - break; - case R.string.enable_nsfw: - if (sectionsPagerAdapter != null) { - mNsfwAndSpoilerSharedPreferences.edit().putBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.NSFW_BASE, true).apply(); - sectionsPagerAdapter.changeNSFW(true); + @Override + public void onMenuClick(int stringId) { + Intent intent = null; + switch (stringId) { + case R.string.profile: + intent = new Intent(MainActivity.this, ViewUserDetailActivity.class); + intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, mAccountName); + break; + case R.string.subscriptions: + intent = new Intent(MainActivity.this, SubscribedThingListingActivity.class); + break; + case R.string.multi_reddit: + intent = new Intent(MainActivity.this, SubscribedThingListingActivity.class); + intent.putExtra(SubscribedThingListingActivity.EXTRA_SHOW_MULTIREDDITS, true); + break; + case R.string.inbox: + intent = new Intent(MainActivity.this, InboxActivity.class); + break; + case R.string.upvoted: + intent = new Intent(MainActivity.this, AccountPostsActivity.class); + intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_UPVOTED); + break; + case R.string.downvoted: + intent = new Intent(MainActivity.this, AccountPostsActivity.class); + intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_DOWNVOTED); + break; + case R.string.hidden: + intent = new Intent(MainActivity.this, AccountPostsActivity.class); + intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_HIDDEN); + break; + case R.string.saved: + intent = new Intent(MainActivity.this, AccountSavedThingActivity.class); + break; + case R.string.gilded: + intent = new Intent(MainActivity.this, AccountPostsActivity.class); + intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_GILDED); + break; + case R.string.light_theme: + mSharedPreferences.edit().putString(SharedPreferencesUtils.THEME_KEY, "0").apply(); + AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_NO); + mCustomThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.LIGHT); + break; + case R.string.dark_theme: + mSharedPreferences.edit().putString(SharedPreferencesUtils.THEME_KEY, "1").apply(); + AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) { + mCustomThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.AMOLED); + } else { + mCustomThemeWrapper.setThemeType(CustomThemeSharedPreferencesUtils.DARK); + } + break; + case R.string.enable_nsfw: + if (sectionsPagerAdapter != null) { + mNsfwAndSpoilerSharedPreferences.edit().putBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.NSFW_BASE, true).apply(); + sectionsPagerAdapter.changeNSFW(true); + } + break; + case R.string.disable_nsfw: + if (sectionsPagerAdapter != null) { + mNsfwAndSpoilerSharedPreferences.edit().putBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.NSFW_BASE, false).apply(); + sectionsPagerAdapter.changeNSFW(false); + } + break; + case R.string.settings: + intent = new Intent(MainActivity.this, SettingsActivity.class); + break; + case R.string.add_account: + Intent addAccountIntent = new Intent(MainActivity.this, LoginActivity.class); + startActivityForResult(addAccountIntent, LOGIN_ACTIVITY_REQUEST_CODE); + break; + case R.string.anonymous_account: + new SwitchToAnonymousAccountAsyncTask(mRedditDataRoomDatabase, false, + () -> { + Intent anonymousIntent = new Intent(MainActivity.this, MainActivity.class); + startActivity(anonymousIntent); + finish(); + }).execute(); + break; + case R.string.log_out: + new SwitchToAnonymousAccountAsyncTask(mRedditDataRoomDatabase, true, + () -> { + Intent logOutIntent = new Intent(MainActivity.this, MainActivity.class); + startActivity(logOutIntent); + finish(); + }).execute(); + } - break; - case R.string.disable_nsfw: - if (sectionsPagerAdapter != null) { - mNsfwAndSpoilerSharedPreferences.edit().putBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.NSFW_BASE, false).apply(); - sectionsPagerAdapter.changeNSFW(false); + if (intent != null) { + startActivity(intent); } - break; - case R.string.settings: - intent = new Intent(MainActivity.this, SettingsActivity.class); - break; - case R.string.add_account: - Intent addAccountIntent = new Intent(MainActivity.this, LoginActivity.class); - startActivityForResult(addAccountIntent, LOGIN_ACTIVITY_REQUEST_CODE); - break; - case R.string.anonymous_account: - new SwitchToAnonymousAccountAsyncTask(mRedditDataRoomDatabase, false, - () -> { - Intent anonymousIntent = new Intent(MainActivity.this, MainActivity.class); - startActivity(anonymousIntent); - finish(); - }).execute(); - break; - case R.string.log_out: - new SwitchToAnonymousAccountAsyncTask(mRedditDataRoomDatabase, true, - () -> { - Intent logOutIntent = new Intent(MainActivity.this, MainActivity.class); - startActivity(logOutIntent); - finish(); - }).execute(); - - } - if (intent != null) { - startActivity(intent); - } - drawer.closeDrawers(); - } + drawer.closeDrawers(); + } - @Override - public void onSubscribedSubredditClick(String subredditName) { - Intent intent = new Intent(MainActivity.this, ViewSubredditDetailActivity.class); - intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, subredditName); - startActivity(intent); - } + @Override + public void onSubscribedSubredditClick(String subredditName) { + Intent intent = new Intent(MainActivity.this, ViewSubredditDetailActivity.class); + intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, subredditName); + startActivity(intent); + } - @Override - public void onAccountClick(String accountName) { - new SwitchAccountAsyncTask(mRedditDataRoomDatabase, accountName, newAccount -> { - Intent intent = new Intent(MainActivity.this, MainActivity.class); - startActivity(intent); - finish(); - }).execute(); - } - }); + @Override + public void onAccountClick(String accountName) { + new SwitchAccountAsyncTask(mRedditDataRoomDatabase, accountName, newAccount -> { + Intent intent = new Intent(MainActivity.this, MainActivity.class); + startActivity(intent); + finish(); + }).execute(); + } + }); navDrawerRecyclerView.setLayoutManager(new LinearLayoutManager(this)); navDrawerRecyclerView.setAdapter(adapter); int tabCount = mMainActivityTabsSharedPreferences.getInt((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_COUNT, 3); mShowFavoriteSubscribedSubreddits = mMainActivityTabsSharedPreferences.getBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.MAIN_PAGE_SHOW_FAVORITE_SUBSCRIBED_SUBREDDITS, false); mShowSubscribedSubreddits = mMainActivityTabsSharedPreferences.getBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.MAIN_PAGE_SHOW_SUBSCRIBED_SUBREDDITS, false); - sectionsPagerAdapter = new SectionsPagerAdapter(fragmentManager, getLifecycle(), tabCount, + sectionsPagerAdapter = new SectionsPagerAdapter(this, tabCount, mShowFavoriteSubscribedSubreddits, mShowSubscribedSubreddits); viewPager2.setAdapter(sectionsPagerAdapter); viewPager2.setOffscreenPageLimit(1); @@ -807,8 +842,8 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb if (showBottomAppBar) { bottomAppBar.performShow(); } - fab.show(); } + fab.show(); sectionsPagerAdapter.displaySortTypeInToolbar(); } }); @@ -906,7 +941,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb public void onFetchMyInfoFailed(boolean parseFailed) { mFetchUserInfoSuccess = false; } - }); + }); } } @@ -949,6 +984,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb } else { bundle.putBoolean(SortTypeBottomSheetFragment.EXTRA_NO_BEST_TYPE, false); } + SortTypeBottomSheetFragment sortTypeBottomSheetFragment = new SortTypeBottomSheetFragment(); sortTypeBottomSheetFragment.setArguments(bundle); sortTypeBottomSheetFragment.show(getSupportFragmentManager(), sortTypeBottomSheetFragment.getTag()); } @@ -989,6 +1025,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb } return true; case R.id.action_change_post_layout_main_activity: + PostLayoutBottomSheetFragment postLayoutBottomSheetFragment = new PostLayoutBottomSheetFragment(); postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag()); return true; } @@ -1052,6 +1089,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb @Override public void sortTypeSelected(String sortType) { + SortTimeBottomSheetFragment sortTimeBottomSheetFragment = new SortTimeBottomSheetFragment(); Bundle bundle = new Bundle(); bundle.putString(SortTimeBottomSheetFragment.EXTRA_SORT_TYPE, sortType); sortTimeBottomSheetFragment.setArguments(bundle); @@ -1085,25 +1123,23 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb sectionsPagerAdapter.changePostLayout(postLayout); } - public void postScrollUp() { - if (mAccessToken != null) { - if (showBottomAppBar && !mLockBottomAppBar) { - bottomAppBar.performShow(); - } - if (!(showBottomAppBar && mLockBottomAppBar)) { - fab.show(); - } + @Override + public void contentScrollUp() { + if (mAccessToken != null && showBottomAppBar && !mLockBottomAppBar) { + bottomAppBar.performShow(); + } + if (!(mAccessToken != null && showBottomAppBar && mLockBottomAppBar)) { + fab.show(); } } - public void postScrollDown() { - if (mAccessToken != null) { - if (!(showBottomAppBar && mLockBottomAppBar)) { - fab.hide(); - } - if (showBottomAppBar && !mLockBottomAppBar) { - bottomAppBar.performHide(); - } + @Override + public void contentScrollDown() { + if (!(mAccessToken != null && showBottomAppBar && mLockBottomAppBar)) { + fab.hide(); + } + if (mAccessToken != null && showBottomAppBar && !mLockBottomAppBar) { + bottomAppBar.performHide(); } } @@ -1124,7 +1160,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb @Subscribe public void onRecreateActivityEvent(RecreateActivityEvent recreateActivityEvent) { - recreate(); + ActivityCompat.recreate(this); } @Subscribe @@ -1166,6 +1202,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb public void fabOptionSelected(int option) { switch (option) { case FABMoreOptionsBottomSheetFragment.FAB_OPTION_SUBMIT_POST: + PostTypeBottomSheetFragment postTypeBottomSheetFragment = new PostTypeBottomSheetFragment(); postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag()); break; case FABMoreOptionsBottomSheetFragment.FAB_OPTION_REFRESH: @@ -1177,6 +1214,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb changeSortType(); break; case FABMoreOptionsBottomSheetFragment.FAB_OPTION_CHANGE_POST_LAYOUT: + PostLayoutBottomSheetFragment postLayoutBottomSheetFragment = new PostLayoutBottomSheetFragment(); postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag()); break; case FABMoreOptionsBottomSheetFragment.FAB_OPTION_SEARCH: @@ -1195,6 +1233,18 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb randomThing(); break; } + case FABMoreOptionsBottomSheetFragment.FAB_HIDE_READ_POSTS: { + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.hideReadPosts(); + } + break; + } + case FABMoreOptionsBottomSheetFragment.FAB_FILTER_POSTS: { + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.filterPosts(); + } + break; + } } } @@ -1269,6 +1319,11 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb startActivity(intent); } + @Override + public void markPostAsRead(Post post) { + InsertReadPost.insertReadPost(mRedditDataRoomDatabase, mExecutor, mAccountName, post.getId()); + } + private class SectionsPagerAdapter extends FragmentStateAdapter { int tabCount; boolean showFavoriteSubscribedSubreddits; @@ -1276,8 +1331,8 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb List<SubscribedSubredditData> favoriteSubscribedSubreddits; List<SubscribedSubredditData> subscribedSubreddits; - SectionsPagerAdapter(FragmentManager fm, Lifecycle lifecycle, int tabCount, boolean showFavoriteSubscribedSubreddits, boolean showSubscribedSubreddits) { - super(fm, lifecycle); + SectionsPagerAdapter(FragmentActivity fa, int tabCount, boolean showFavoriteSubscribedSubreddits, boolean showSubscribedSubreddits) { + super(fa); this.tabCount = tabCount; favoriteSubscribedSubreddits = new ArrayList<>(); subscribedSubreddits = new ArrayList<>(); @@ -1294,7 +1349,6 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb Bundle bundle = new Bundle(); bundle.putInt(PostFragment.EXTRA_POST_TYPE, PostDataSource.TYPE_SUBREDDIT); bundle.putString(PostFragment.EXTRA_NAME, "popular"); - bundle.putInt(PostFragment.EXTRA_FILTER, PostFragment.EXTRA_NO_FILTER); bundle.putString(PostFragment.EXTRA_ACCESS_TOKEN, mAccessToken); bundle.putString(PostFragment.EXTRA_ACCOUNT_NAME, mAccountName); fragment.setArguments(bundle); @@ -1304,7 +1358,6 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb Bundle bundle = new Bundle(); bundle.putInt(PostFragment.EXTRA_POST_TYPE, PostDataSource.TYPE_SUBREDDIT); bundle.putString(PostFragment.EXTRA_NAME, "all"); - bundle.putInt(PostFragment.EXTRA_FILTER, PostFragment.EXTRA_NO_FILTER); bundle.putString(PostFragment.EXTRA_ACCESS_TOKEN, mAccessToken); bundle.putString(PostFragment.EXTRA_ACCOUNT_NAME, mAccountName); fragment.setArguments(bundle); @@ -1356,7 +1409,6 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb PostFragment fragment = new PostFragment(); Bundle bundle = new Bundle(); bundle.putInt(PostFragment.EXTRA_POST_TYPE, PostDataSource.TYPE_FRONT_PAGE); - bundle.putInt(PostFragment.EXTRA_FILTER, PostFragment.EXTRA_NO_FILTER); bundle.putString(PostFragment.EXTRA_ACCESS_TOKEN, mAccessToken); bundle.putString(PostFragment.EXTRA_ACCOUNT_NAME, mAccountName); fragment.setArguments(bundle); @@ -1366,7 +1418,6 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb Bundle bundle = new Bundle(); bundle.putInt(PostFragment.EXTRA_POST_TYPE, PostDataSource.TYPE_SUBREDDIT); bundle.putString(PostFragment.EXTRA_NAME, "all"); - bundle.putInt(PostFragment.EXTRA_FILTER, PostFragment.EXTRA_NO_FILTER); bundle.putString(PostFragment.EXTRA_ACCESS_TOKEN, mAccessToken); bundle.putString(PostFragment.EXTRA_ACCOUNT_NAME, mAccountName); fragment.setArguments(bundle); @@ -1376,7 +1427,6 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb Bundle bundle = new Bundle(); bundle.putInt(PostFragment.EXTRA_POST_TYPE, PostDataSource.TYPE_SUBREDDIT); bundle.putString(PostFragment.EXTRA_NAME, name); - bundle.putInt(PostFragment.EXTRA_FILTER, PostFragment.EXTRA_NO_FILTER); bundle.putString(PostFragment.EXTRA_ACCESS_TOKEN, mAccessToken); bundle.putString(PostFragment.EXTRA_ACCOUNT_NAME, mAccountName); fragment.setArguments(bundle); @@ -1386,7 +1436,6 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb Bundle bundle = new Bundle(); bundle.putString(PostFragment.EXTRA_NAME, name); bundle.putInt(PostFragment.EXTRA_POST_TYPE, PostDataSource.TYPE_MULTI_REDDIT); - bundle.putInt(PostFragment.EXTRA_FILTER, PostFragment.EXTRA_NO_FILTER); bundle.putString(PostFragment.EXTRA_ACCESS_TOKEN, mAccessToken); bundle.putString(PostFragment.EXTRA_ACCOUNT_NAME, mAccountName); fragment.setArguments(bundle); @@ -1397,7 +1446,6 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb bundle.putInt(PostFragment.EXTRA_POST_TYPE, PostDataSource.TYPE_USER); bundle.putString(PostFragment.EXTRA_USER_NAME, name); bundle.putString(PostFragment.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_SUBMITTED); - bundle.putInt(PostFragment.EXTRA_FILTER, PostFragment.EXTRA_NO_FILTER); bundle.putString(PostFragment.EXTRA_ACCESS_TOKEN, mAccessToken); bundle.putString(PostFragment.EXTRA_ACCOUNT_NAME, mAccountName); fragment.setArguments(bundle); @@ -1407,7 +1455,6 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb Bundle bundle = new Bundle(); bundle.putInt(PostFragment.EXTRA_POST_TYPE, PostDataSource.TYPE_SUBREDDIT); bundle.putString(PostFragment.EXTRA_NAME, "popular"); - bundle.putInt(PostFragment.EXTRA_FILTER, PostFragment.EXTRA_NO_FILTER); bundle.putString(PostFragment.EXTRA_ACCESS_TOKEN, mAccessToken); bundle.putString(PostFragment.EXTRA_ACCOUNT_NAME, mAccountName); fragment.setArguments(bundle); @@ -1514,5 +1561,19 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb Utils.displaySortTypeInToolbar(sortType, toolbar); } } + + void hideReadPosts() { + PostFragment currentFragment = getCurrentFragment(); + if (currentFragment != null) { + currentFragment.hideReadPosts(); + } + } + + void filterPosts() { + PostFragment currentFragment = getCurrentFragment(); + if (currentFragment != null) { + currentFragment.filterPosts(); + } + } } -} +}
\ No newline at end of file diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterPreferenceActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterPreferenceActivity.java new file mode 100644 index 00000000..f75f08f7 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterPreferenceActivity.java @@ -0,0 +1,136 @@ +package ml.docilealligator.infinityforreddit.activities; + +import android.content.Intent; +import android.content.SharedPreferences; +import android.os.Bundle; +import android.view.MenuItem; + +import androidx.annotation.NonNull; +import androidx.appcompat.widget.Toolbar; +import androidx.coordinatorlayout.widget.CoordinatorLayout; +import androidx.lifecycle.ViewModelProvider; +import androidx.recyclerview.widget.RecyclerView; + +import com.google.android.material.appbar.AppBarLayout; +import com.google.android.material.floatingactionbutton.FloatingActionButton; + +import java.util.concurrent.Executor; + +import javax.inject.Inject; +import javax.inject.Named; + +import butterknife.BindView; +import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.adapters.PostFilterRecyclerViewAdapter; +import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostFilterOptionsBottomSheetFragment; +import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; +import ml.docilealligator.infinityforreddit.postfilter.DeletePostFilter; +import ml.docilealligator.infinityforreddit.postfilter.PostFilter; +import ml.docilealligator.infinityforreddit.postfilter.PostFilterViewModel; + +public class PostFilterPreferenceActivity extends BaseActivity { + + @BindView(R.id.coordinator_layout_post_filter_preference_activity) + CoordinatorLayout coordinatorLayout; + @BindView(R.id.appbar_layout_post_filter_preference_activity) + AppBarLayout appBarLayout; + @BindView(R.id.toolbar_post_filter_preference_activity) + Toolbar toolbar; + @BindView(R.id.recycler_view_post_filter_preference_activity) + RecyclerView recyclerView; + @BindView(R.id.fab_post_filter_preference_activity) + FloatingActionButton fab; + @Inject + @Named("default") + SharedPreferences sharedPreferences; + @Inject + RedditDataRoomDatabase redditDataRoomDatabase; + @Inject + CustomThemeWrapper customThemeWrapper; + @Inject + Executor executor; + public PostFilterViewModel postFilterViewModel; + private PostFilterRecyclerViewAdapter adapter; + + @Override + protected void onCreate(Bundle savedInstanceState) { + ((Infinity) getApplication()).getAppComponent().inject(this); + + setImmersiveModeNotApplicable(); + + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_post_filter_preference); + + ButterKnife.bind(this); + + applyCustomTheme(); + + setSupportActionBar(toolbar); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + + fab.setOnClickListener(view -> { + Intent intent = new Intent(PostFilterPreferenceActivity.this, CustomizePostFilterActivity.class); + intent.putExtra(CustomizePostFilterActivity.EXTRA_FROM_SETTINGS, true); + startActivity(intent); + }); + + adapter = new PostFilterRecyclerViewAdapter(postFilter -> { + PostFilterOptionsBottomSheetFragment postFilterOptionsBottomSheetFragment = new PostFilterOptionsBottomSheetFragment(); + Bundle bundle = new Bundle(); + bundle.putParcelable(PostFilterOptionsBottomSheetFragment.EXTRA_POST_FILTER, postFilter); + postFilterOptionsBottomSheetFragment.setArguments(bundle); + postFilterOptionsBottomSheetFragment.show(getSupportFragmentManager(), postFilterOptionsBottomSheetFragment.getTag()); + }); + + recyclerView.setAdapter(adapter); + + postFilterViewModel = new ViewModelProvider(this, + new PostFilterViewModel.Factory(redditDataRoomDatabase)).get(PostFilterViewModel.class); + + postFilterViewModel.getPostFilterListLiveData().observe(this, postFilters -> adapter.setPostFilterList(postFilters)); + } + + public void editPostFilter(PostFilter postFilter) { + Intent intent = new Intent(PostFilterPreferenceActivity.this, CustomizePostFilterActivity.class); + intent.putExtra(CustomizePostFilterActivity.EXTRA_POST_FILTER, postFilter); + intent.putExtra(CustomizePostFilterActivity.EXTRA_FROM_SETTINGS, true); + startActivity(intent); + } + + public void applyPostFilterTo(PostFilter postFilter) { + Intent intent = new Intent(this, PostFilterUsageListingActivity.class); + intent.putExtra(PostFilterUsageListingActivity.EXTRA_POST_FILTER, postFilter); + startActivity(intent); + } + + public void deletePostFilter(PostFilter postFilter) { + DeletePostFilter.deletePostFilter(redditDataRoomDatabase, executor, postFilter); + } + + @Override + protected SharedPreferences getDefaultSharedPreferences() { + return sharedPreferences; + } + + @Override + protected CustomThemeWrapper getCustomThemeWrapper() { + return customThemeWrapper; + } + + @Override + protected void applyCustomTheme() { + applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar); + } + + @Override + public boolean onOptionsItemSelected(@NonNull MenuItem item) { + if (item.getItemId() == android.R.id.home) { + finish(); + return true; + } + return false; + } +}
\ No newline at end of file diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterUsageListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterUsageListingActivity.java new file mode 100644 index 00000000..daf9a704 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostFilterUsageListingActivity.java @@ -0,0 +1,211 @@ +package ml.docilealligator.infinityforreddit.activities; + +import android.content.Context; +import android.content.SharedPreferences; +import android.content.res.ColorStateList; +import android.os.Bundle; +import android.view.MenuItem; +import android.view.View; +import android.view.inputmethod.InputMethodManager; + +import androidx.annotation.NonNull; +import androidx.appcompat.widget.Toolbar; +import androidx.coordinatorlayout.widget.CoordinatorLayout; +import androidx.lifecycle.ViewModelProvider; +import androidx.recyclerview.widget.RecyclerView; + +import com.google.android.material.appbar.AppBarLayout; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; +import com.google.android.material.floatingactionbutton.FloatingActionButton; +import com.google.android.material.textfield.TextInputEditText; +import com.google.android.material.textfield.TextInputLayout; + +import java.util.concurrent.Executor; + +import javax.inject.Inject; +import javax.inject.Named; + +import butterknife.BindView; +import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.adapters.PostFilterUsageRecyclerViewAdapter; +import ml.docilealligator.infinityforreddit.bottomsheetfragments.NewPostFilterUsageBottomSheetFragment; +import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostFilterUsageOptionsBottomSheetFragment; +import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; +import ml.docilealligator.infinityforreddit.postfilter.DeletePostFilterUsage; +import ml.docilealligator.infinityforreddit.postfilter.PostFilter; +import ml.docilealligator.infinityforreddit.postfilter.PostFilterUsage; +import ml.docilealligator.infinityforreddit.postfilter.PostFilterUsageViewModel; +import ml.docilealligator.infinityforreddit.postfilter.SavePostFilterUsage; + +public class PostFilterUsageListingActivity extends BaseActivity { + + public static final String EXTRA_POST_FILTER = "EPF"; + @BindView(R.id.coordinator_layout_post_filter_application_activity) + CoordinatorLayout coordinatorLayout; + @BindView(R.id.appbar_layout_post_filter_application_activity) + AppBarLayout appBarLayout; + @BindView(R.id.toolbar_post_filter_application_activity) + Toolbar toolbar; + @BindView(R.id.recycler_view_post_filter_application_activity) + RecyclerView recyclerView; + @BindView(R.id.fab_post_filter_application_activity) + FloatingActionButton fab; + @Inject + @Named("default") + SharedPreferences sharedPreferences; + @Inject + RedditDataRoomDatabase redditDataRoomDatabase; + @Inject + CustomThemeWrapper customThemeWrapper; + @Inject + Executor executor; + public PostFilterUsageViewModel postFilterUsageViewModel; + private PostFilterUsageRecyclerViewAdapter adapter; + private PostFilter postFilter; + + @Override + protected void onCreate(Bundle savedInstanceState) { + ((Infinity) getApplication()).getAppComponent().inject(this); + + setImmersiveModeNotApplicable(); + + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_post_filter_application); + + ButterKnife.bind(this); + + applyCustomTheme(); + + setSupportActionBar(toolbar); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + + postFilter = getIntent().getParcelableExtra(EXTRA_POST_FILTER); + + setTitle(postFilter.name); + + fab.setOnClickListener(view -> { + NewPostFilterUsageBottomSheetFragment newPostFilterUsageBottomSheetFragment = new NewPostFilterUsageBottomSheetFragment(); + newPostFilterUsageBottomSheetFragment.show(getSupportFragmentManager(), newPostFilterUsageBottomSheetFragment.getTag()); + }); + + adapter = new PostFilterUsageRecyclerViewAdapter(this, postFilterUsage -> { + PostFilterUsageOptionsBottomSheetFragment postFilterUsageOptionsBottomSheetFragment = new PostFilterUsageOptionsBottomSheetFragment(); + Bundle bundle = new Bundle(); + bundle.putParcelable(PostFilterUsageOptionsBottomSheetFragment.EXTRA_POST_FILTER_USAGE, postFilterUsage); + postFilterUsageOptionsBottomSheetFragment.setArguments(bundle); + postFilterUsageOptionsBottomSheetFragment.show(getSupportFragmentManager(), postFilterUsageOptionsBottomSheetFragment.getTag()); + }); + recyclerView.setAdapter(adapter); + + postFilterUsageViewModel = new ViewModelProvider(this, + new PostFilterUsageViewModel.Factory(redditDataRoomDatabase, postFilter.name)).get(PostFilterUsageViewModel.class); + + postFilterUsageViewModel.getPostFilterUsageListLiveData().observe(this, postFilterUsages -> adapter.setPostFilterUsages(postFilterUsages)); + } + + public void newPostFilterUsage(int type) { + switch (type) { + case PostFilterUsage.HOME_TYPE: + case PostFilterUsage.SEARCH_TYPE: + PostFilterUsage postFilterUsage = new PostFilterUsage(postFilter.name, type, PostFilterUsage.NO_USAGE); + SavePostFilterUsage.savePostFilterUsage(redditDataRoomDatabase, executor, postFilterUsage); + break; + case PostFilterUsage.SUBREDDIT_TYPE: + case PostFilterUsage.USER_TYPE: + case PostFilterUsage.MULTIREDDIT_TYPE: + editAndPostFilterUsageNameOfUsage(type, null); + break; + } + } + + private void editAndPostFilterUsageNameOfUsage(int type, String nameOfUsage) { + View dialogView = getLayoutInflater().inflate(R.layout.dialog_edit_post_filter_name_of_usage, null); + TextInputLayout textInputLayout = dialogView.findViewById(R.id.text_input_layout_edit_post_filter_name_of_usage_dialog); + TextInputEditText textInputEditText = dialogView.findViewById(R.id.text_input_edit_text_edit_post_filter_name_of_usage_dialog); + int primaryTextColor = customThemeWrapper.getPrimaryTextColor(); + textInputLayout.setBoxStrokeColor(primaryTextColor); + textInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(primaryTextColor)); + textInputEditText.setTextColor(primaryTextColor); + if (nameOfUsage != null && !nameOfUsage.equals(PostFilterUsage.NO_USAGE)) { + textInputEditText.setText(nameOfUsage); + } + textInputEditText.requestFocus(); + switch (type) { + case PostFilterUsage.SUBREDDIT_TYPE: + textInputEditText.setHint(R.string.settings_tab_subreddit_name); + break; + case PostFilterUsage.USER_TYPE: + textInputEditText.setHint(R.string.settings_tab_username); + break; + case PostFilterUsage.MULTIREDDIT_TYPE: + textInputEditText.setHint(R.string.settings_tab_multi_reddit_name); + break; + } + + InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); + if (imm != null) { + imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); + } + new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme) + .setTitle(R.string.edit_post_filter_name_of_usage_info) + .setView(dialogView) + .setPositiveButton(R.string.ok, (editTextDialogInterface, i1) + -> { + if (imm != null) { + imm.hideSoftInputFromWindow(textInputEditText.getWindowToken(), 0); + } + + PostFilterUsage postFilterUsage; + if (textInputEditText.getText().toString().equals("")) { + postFilterUsage = new PostFilterUsage(postFilter.name, type, PostFilterUsage.NO_USAGE); + } else { + postFilterUsage = new PostFilterUsage(postFilter.name, type, textInputEditText.getText().toString()); + } + + SavePostFilterUsage.savePostFilterUsage(redditDataRoomDatabase, executor, postFilterUsage); + }) + .setNegativeButton(R.string.cancel, null) + .setOnDismissListener(editTextDialogInterface -> { + if (imm != null) { + imm.hideSoftInputFromWindow(textInputEditText.getWindowToken(), 0); + } + }) + .show(); + } + + public void editPostFilterUsage(PostFilterUsage postFilterUsage) { + editAndPostFilterUsageNameOfUsage(postFilterUsage.usage, postFilterUsage.nameOfUsage); + } + + public void deletePostFilterUsage(PostFilterUsage postFilterUsage) { + DeletePostFilterUsage.deletePostFilterUsage(redditDataRoomDatabase, executor, postFilterUsage); + } + + @Override + public boolean onOptionsItemSelected(@NonNull MenuItem item) { + if (item.getItemId() == android.R.id.home) { + finish(); + return true; + } + + return false; + } + + @Override + protected SharedPreferences getDefaultSharedPreferences() { + return sharedPreferences; + } + + @Override + protected CustomThemeWrapper getCustomThemeWrapper() { + return customThemeWrapper; + } + + @Override + protected void applyCustomTheme() { + applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar); + } +}
\ No newline at end of file diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostImageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostImageActivity.java index a8517925..85601581 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostImageActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostImageActivity.java @@ -22,6 +22,7 @@ import androidx.annotation.Nullable; import androidx.appcompat.widget.Toolbar; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.coordinatorlayout.widget.CoordinatorLayout; +import androidx.core.content.ContextCompat; import androidx.core.content.FileProvider; import com.bumptech.glide.Glide; @@ -528,11 +529,7 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF } intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - startForegroundService(intent); - } else { - startService(intent); - } + ContextCompat.startForegroundService(this, intent); return true; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostLinkActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostLinkActivity.java index 2f76cd9d..c53d43c5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostLinkActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostLinkActivity.java @@ -17,6 +17,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.widget.Toolbar; import androidx.coordinatorlayout.widget.CoordinatorLayout; +import androidx.core.content.ContextCompat; import com.bumptech.glide.Glide; import com.bumptech.glide.RequestManager; @@ -449,7 +450,7 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr intent.putExtra(SubmitPostService.EXTRA_IS_SPOILER, isSpoiler); intent.putExtra(SubmitPostService.EXTRA_IS_NSFW, isNSFW); intent.putExtra(SubmitPostService.EXTRA_POST_TYPE, SubmitPostService.EXTRA_POST_TEXT_OR_LINK); - startService(intent); + ContextCompat.startForegroundService(this, intent); return true; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostTextActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostTextActivity.java index 31814057..7d04e456 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostTextActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostTextActivity.java @@ -17,6 +17,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.widget.Toolbar; import androidx.coordinatorlayout.widget.CoordinatorLayout; +import androidx.core.content.ContextCompat; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -466,7 +467,7 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr intent.putExtra(SubmitPostService.EXTRA_IS_SPOILER, isSpoiler); intent.putExtra(SubmitPostService.EXTRA_IS_NSFW, isNSFW); intent.putExtra(SubmitPostService.EXTRA_POST_TYPE, SubmitPostService.EXTRA_POST_TEXT_OR_LINK); - startService(intent); + ContextCompat.startForegroundService(this, intent); return true; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostVideoActivity.java index fb9bca66..6d8e8f26 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostVideoActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostVideoActivity.java @@ -20,6 +20,7 @@ import androidx.annotation.Nullable; import androidx.appcompat.widget.Toolbar; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.coordinatorlayout.widget.CoordinatorLayout; +import androidx.core.content.ContextCompat; import com.bumptech.glide.Glide; import com.bumptech.glide.RequestManager; @@ -27,7 +28,7 @@ import com.bumptech.glide.request.RequestOptions; import com.google.android.exoplayer2.ExoPlayerFactory; import com.google.android.exoplayer2.Player; import com.google.android.exoplayer2.SimpleExoPlayer; -import com.google.android.exoplayer2.source.ExtractorMediaSource; +import com.google.android.exoplayer2.source.ProgressiveMediaSource; import com.google.android.exoplayer2.ui.PlayerView; import com.google.android.exoplayer2.upstream.DataSource; import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory; @@ -424,7 +425,7 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF constraintLayout.setVisibility(View.GONE); selectAgainTextView.setVisibility(View.VISIBLE); videoPlayerView.setVisibility(View.VISIBLE); - player.prepare(new ExtractorMediaSource.Factory(dataSourceFactory).createMediaSource(videoUri)); + player.prepare(new ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(videoUri)); player.setPlayWhenReady(true); wasPlaying = true; } @@ -528,11 +529,7 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF intent.putExtra(SubmitPostService.EXTRA_POST_TYPE, SubmitPostService.EXTRA_POST_TYPE_VIDEO); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - startForegroundService(intent); - } else { - startService(intent); - } + ContextCompat.startForegroundService(this, intent); return true; } @@ -635,6 +632,8 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF protected void onDestroy() { EventBus.getDefault().unregister(this); super.onDestroy(); + player.seekToDefaultPosition(); + player.stop(true); player.release(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchActivity.java index b0b96ccb..03eaa6f3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchActivity.java @@ -226,23 +226,27 @@ public class SearchActivity extends BaseActivity { DeleteRecentSearchQuery.deleteRecentSearchQueryListener(mRedditDataRoomDatabase, recentSearchQuery, () -> {}); } }); + recyclerView.setVisibility(View.VISIBLE); recyclerView.setNestedScrollingEnabled(false); recyclerView.setLayoutManager(new LinearLayoutManager(this)); recyclerView.setAdapter(adapter); - mRecentSearchQueryViewModel = new ViewModelProvider(this, - new RecentSearchQueryViewModel.Factory(mRedditDataRoomDatabase, mAccountName)) - .get(RecentSearchQueryViewModel.class); - - mRecentSearchQueryViewModel.getAllRecentSearchQueries().observe(this, recentSearchQueries -> { - if (recentSearchQueries != null && !recentSearchQueries.isEmpty()) { - divider.setVisibility(View.VISIBLE); - recentSummaryTextView.setVisibility(View.VISIBLE); - } else { - divider.setVisibility(View.GONE); - recentSummaryTextView.setVisibility(View.GONE); - } - adapter.setRecentSearchQueries(recentSearchQueries); - }); + + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.ENABLE_SEARCH_HISTORY, true)) { + mRecentSearchQueryViewModel = new ViewModelProvider(this, + new RecentSearchQueryViewModel.Factory(mRedditDataRoomDatabase, mAccountName)) + .get(RecentSearchQueryViewModel.class); + + mRecentSearchQueryViewModel.getAllRecentSearchQueries().observe(this, recentSearchQueries -> { + if (recentSearchQueries != null && !recentSearchQueries.isEmpty()) { + divider.setVisibility(View.VISIBLE); + recentSummaryTextView.setVisibility(View.VISIBLE); + } else { + divider.setVisibility(View.GONE); + recentSummaryTextView.setVisibility(View.GONE); + } + adapter.setRecentSearchQueries(recentSearchQueries); + }); + } } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java index 249e6ed2..49f95985 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java @@ -1,5 +1,6 @@ package ml.docilealligator.infinityforreddit.activities; +import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Build; @@ -10,18 +11,22 @@ import android.view.MenuItem; import android.view.View; import android.view.Window; import android.view.WindowManager; +import android.view.inputmethod.InputMethodManager; +import android.widget.EditText; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.widget.Toolbar; import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentManager; -import androidx.lifecycle.Lifecycle; import androidx.viewpager2.adapter.FragmentStateAdapter; import androidx.viewpager2.widget.ViewPager2; import com.google.android.material.appbar.AppBarLayout; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; +import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.tabs.TabLayout; import com.google.android.material.tabs.TabLayoutMediator; import com.r0adkll.slidr.Slidr; @@ -36,8 +41,18 @@ import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.ActivityToolbarInterface; +import ml.docilealligator.infinityforreddit.FragmentCommunicator; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.PostFragmentContentScrollingInterface; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.SortType; +import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback; import ml.docilealligator.infinityforreddit.asynctasks.GetCurrentAccountAsyncTask; +import ml.docilealligator.infinityforreddit.bottomsheetfragments.FABMoreOptionsBottomSheetFragment; import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostLayoutBottomSheetFragment; +import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostTypeBottomSheetFragment; +import ml.docilealligator.infinityforreddit.bottomsheetfragments.RandomBottomSheetFragment; import ml.docilealligator.infinityforreddit.bottomsheetfragments.SearchPostSortTypeBottomSheetFragment; import ml.docilealligator.infinityforreddit.bottomsheetfragments.SearchUserAndSubredditSortTypeBottomSheetFragment; import ml.docilealligator.infinityforreddit.bottomsheetfragments.SortTimeBottomSheetFragment; @@ -47,19 +62,15 @@ import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent; import ml.docilealligator.infinityforreddit.fragments.PostFragment; import ml.docilealligator.infinityforreddit.fragments.SubredditListingFragment; import ml.docilealligator.infinityforreddit.fragments.UserListingFragment; -import ml.docilealligator.infinityforreddit.FragmentCommunicator; -import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.post.PostDataSource; -import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.recentsearchquery.InsertRecentSearchQuery; -import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; -import ml.docilealligator.infinityforreddit.SortType; -import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; import ml.docilealligator.infinityforreddit.utils.Utils; public class SearchResultActivity extends BaseActivity implements SortTypeSelectionCallback, - PostLayoutBottomSheetFragment.PostLayoutSelectionCallback, ActivityToolbarInterface { + PostLayoutBottomSheetFragment.PostLayoutSelectionCallback, ActivityToolbarInterface, + FABMoreOptionsBottomSheetFragment.FABOptionSelectionCallback, RandomBottomSheetFragment.RandomOptionSelectionCallback, + PostTypeBottomSheetFragment.PostTypeSelectionCallback, PostFragmentContentScrollingInterface { static final String EXTRA_QUERY = "QK"; static final String EXTRA_SUBREDDIT_NAME = "ESN"; @@ -77,6 +88,8 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect TabLayout tabLayout; @BindView(R.id.view_pager_search_result_activity) ViewPager2 viewPager2; + @BindView(R.id.fab_search_result_activity) + FloatingActionButton fab; @Inject RedditDataRoomDatabase mRedditDataRoomDatabase; @Inject @@ -89,6 +102,12 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect @Named("post_layout") SharedPreferences mPostLayoutSharedPreferences; @Inject + @Named("bottom_app_bar") + SharedPreferences bottomAppBarSharedPreference; + @Inject + @Named("nsfw_and_spoiler") + SharedPreferences mNsfwAndSpoilerSharedPreferences; + @Inject CustomThemeWrapper mCustomThemeWrapper; private boolean mNullAccessToken = false; private String mAccessToken; @@ -98,11 +117,8 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect private boolean mInsertSearchQuerySuccess; private FragmentManager fragmentManager; private SectionsPagerAdapter sectionsPagerAdapter; - private SearchPostSortTypeBottomSheetFragment searchPostSortTypeBottomSheetFragment; - private SortTimeBottomSheetFragment sortTimeBottomSheetFragment; - private SearchUserAndSubredditSortTypeBottomSheetFragment searchUserAndSubredditSortTypeBottomSheetFragment; - private PostLayoutBottomSheetFragment postLayoutBottomSheetFragment; private SlidrInterface mSlidrInterface; + private int fabOption; @Override protected void onCreate(Bundle savedInstanceState) { @@ -138,6 +154,13 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); } adjustToolbar(toolbar); + + int navBarHeight = getNavBarHeight(); + if (navBarHeight > 0) { + CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) fab.getLayoutParams(); + params.bottomMargin += navBarHeight; + fab.setLayoutParams(params); + } } } @@ -168,19 +191,9 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect if (!mNullAccessToken && mAccessToken == null) { getCurrentAccountAndInitializeViewPager(); } else { - initializeViewPager(); + bindView(); } } - - searchPostSortTypeBottomSheetFragment = new SearchPostSortTypeBottomSheetFragment(); - Bundle bundle = new Bundle(); - searchPostSortTypeBottomSheetFragment.setArguments(bundle); - - sortTimeBottomSheetFragment = new SortTimeBottomSheetFragment(); - - searchUserAndSubredditSortTypeBottomSheetFragment = new SearchUserAndSubredditSortTypeBottomSheetFragment(); - - postLayoutBottomSheetFragment = new PostLayoutBottomSheetFragment(); } @Override @@ -206,6 +219,7 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar); applyTabLayoutTheme(tabLayout); + applyFABTheme(fab); } private void getCurrentAccountAndInitializeViewPager() { @@ -216,18 +230,19 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect mAccessToken = account.getAccessToken(); mAccountName = account.getUsername(); } - initializeViewPager(); + bindView(); }).execute(); } - private void initializeViewPager() { - sectionsPagerAdapter = new SectionsPagerAdapter(fragmentManager, getLifecycle()); + private void bindView() { + sectionsPagerAdapter = new SectionsPagerAdapter(this); viewPager2.setAdapter(sectionsPagerAdapter); viewPager2.setOffscreenPageLimit(3); viewPager2.setUserInputEnabled(!mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_SWIPING_BETWEEN_TABS, false)); viewPager2.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { @Override public void onPageSelected(int position) { + fab.show(); sectionsPagerAdapter.displaySortTypeInToolbar(); if (position == 0) { unlockSwipeRightToGoBack(); @@ -251,12 +266,134 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect }).attach(); fixViewPager2Sensitivity(viewPager2); - if (mAccountName != null && !mInsertSearchQuerySuccess && mQuery != null) { + fabOption = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB, SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SUBMIT_POSTS); + switch (fabOption) { + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_REFRESH: + fab.setImageResource(R.drawable.ic_refresh_24dp); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE: + fab.setImageResource(R.drawable.ic_sort_toolbar_24dp); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT: + fab.setImageResource(R.drawable.ic_post_layout_24dp); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH: + fab.setImageResource(R.drawable.ic_search_black_24dp); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT: + fab.setImageResource(R.drawable.ic_subreddit_24dp); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_USER: + fab.setImageResource(R.drawable.ic_user_24dp); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_RANDOM: + fab.setImageResource(R.drawable.ic_random_24dp); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS: + if (mAccessToken == null) { + fab.setImageResource(R.drawable.ic_filter_24dp); + fabOption = SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_FILTER_POSTS; + } else { + fab.setImageResource(R.drawable.ic_hide_read_posts_24dp); + } + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS: + fab.setImageResource(R.drawable.ic_filter_24dp); + break; + default: + if (mAccessToken == null) { + fab.setImageResource(R.drawable.ic_filter_24dp); + fabOption = SharedPreferencesUtils.MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_FILTER_POSTS; + } else { + fab.setImageResource(R.drawable.ic_add_day_night_24dp); + } + break; + } + fab.setOnClickListener(view -> { + switch (fabOption) { + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_REFRESH: { + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.refresh(); + } + break; + } + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE: { + SearchPostSortTypeBottomSheetFragment searchPostSortTypeBottomSheetFragment = new SearchPostSortTypeBottomSheetFragment(); + searchPostSortTypeBottomSheetFragment.show(getSupportFragmentManager(), searchPostSortTypeBottomSheetFragment.getTag()); + break; + } + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT: { + PostLayoutBottomSheetFragment postLayoutBottomSheetFragment = new PostLayoutBottomSheetFragment(); + postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag()); + break; + } + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH: { + Intent intent = new Intent(this, SearchActivity.class); + if (mSubredditName != null && !mSubredditName.equals("")) { + intent.putExtra(SearchActivity.EXTRA_SUBREDDIT_NAME, mSubredditName); + } + startActivity(intent); + break; + } + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT: + goToSubreddit(); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_USER: + goToUser(); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_RANDOM: + random(); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS: + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.hideReadPosts(); + } + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS: + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.filterPosts(); + } + break; + default: + PostTypeBottomSheetFragment postTypeBottomSheetFragment = new PostTypeBottomSheetFragment(); + postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag()); + break; + } + }); + fab.setOnLongClickListener(view -> { + FABMoreOptionsBottomSheetFragment fabMoreOptionsBottomSheetFragment = new FABMoreOptionsBottomSheetFragment(); + Bundle bundle = new Bundle(); + bundle.putBoolean(FABMoreOptionsBottomSheetFragment.EXTRA_ANONYMOUS_MODE, mAccessToken == null); + fabMoreOptionsBottomSheetFragment.setArguments(bundle); + fabMoreOptionsBottomSheetFragment.show(getSupportFragmentManager(), fabMoreOptionsBottomSheetFragment.getTag()); + return true; + }); + + if (mAccountName != null && mSharedPreferences.getBoolean(SharedPreferencesUtils.ENABLE_SEARCH_HISTORY, true) && !mInsertSearchQuerySuccess && mQuery != null) { InsertRecentSearchQuery.insertRecentSearchQueryListener(mRedditDataRoomDatabase, mAccountName, mQuery, () -> mInsertSearchQuerySuccess = true); } } + private void displaySortTypeBottomSheetFragment() { + switch (viewPager2.getCurrentItem()) { + case 0: { + SearchPostSortTypeBottomSheetFragment searchPostSortTypeBottomSheetFragment = new SearchPostSortTypeBottomSheetFragment(); + searchPostSortTypeBottomSheetFragment.show(getSupportFragmentManager(), searchPostSortTypeBottomSheetFragment.getTag()); + break; + } + case 1: + case 2: + SearchUserAndSubredditSortTypeBottomSheetFragment searchUserAndSubredditSortTypeBottomSheetFragment + = new SearchUserAndSubredditSortTypeBottomSheetFragment(); + Bundle bundle = new Bundle(); + bundle.putInt(SearchUserAndSubredditSortTypeBottomSheetFragment.EXTRA_FRAGMENT_POSITION, viewPager2.getCurrentItem()); + searchUserAndSubredditSortTypeBottomSheetFragment.setArguments(bundle); + searchUserAndSubredditSortTypeBottomSheetFragment.show(getSupportFragmentManager(), searchUserAndSubredditSortTypeBottomSheetFragment.getTag()); + break; + } + } + @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.search_result_activity, menu); @@ -271,19 +408,7 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect onBackPressed(); return true; case R.id.action_sort_search_result_activity: - switch (viewPager2.getCurrentItem()) { - case 0: { - searchPostSortTypeBottomSheetFragment.show(getSupportFragmentManager(), searchPostSortTypeBottomSheetFragment.getTag()); - break; - } - case 1: - case 2: - Bundle bundle = new Bundle(); - bundle.putInt(SearchUserAndSubredditSortTypeBottomSheetFragment.EXTRA_FRAGMENT_POSITION, viewPager2.getCurrentItem()); - searchUserAndSubredditSortTypeBottomSheetFragment.setArguments(bundle); - searchUserAndSubredditSortTypeBottomSheetFragment.show(getSupportFragmentManager(), searchUserAndSubredditSortTypeBottomSheetFragment.getTag()); - break; - } + displaySortTypeBottomSheetFragment(); return true; case R.id.action_search_search_result_activity: Intent intent = new Intent(this, SearchActivity.class); @@ -295,9 +420,12 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect startActivity(intent); return true; case R.id.action_refresh_search_result_activity: - sectionsPagerAdapter.refresh(); + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.refresh(); + } return true; case R.id.action_change_post_layout_search_result_activity: + PostLayoutBottomSheetFragment postLayoutBottomSheetFragment = new PostLayoutBottomSheetFragment(); postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag()); return true; } @@ -321,25 +449,35 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect @Override public void sortTypeSelected(SortType sortType) { - sectionsPagerAdapter.changeSortType(sortType); + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.changeSortType(sortType); + } + } @Override public void sortTypeSelected(String sortType) { Bundle bundle = new Bundle(); bundle.putString(SortTimeBottomSheetFragment.EXTRA_SORT_TYPE, sortType); + SortTimeBottomSheetFragment sortTimeBottomSheetFragment = new SortTimeBottomSheetFragment(); sortTimeBottomSheetFragment.setArguments(bundle); sortTimeBottomSheetFragment.show(getSupportFragmentManager(), sortTimeBottomSheetFragment.getTag()); } @Override public void searchUserAndSubredditSortTypeSelected(SortType sortType, int fragmentPosition) { - sectionsPagerAdapter.changeSortType(sortType, fragmentPosition); + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.changeSortType(sortType, fragmentPosition); + } + } @Override public void postLayoutSelected(int postLayout) { - sectionsPagerAdapter.changePostLayout(postLayout); + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.changePostLayout(postLayout); + } + } @Subscribe @@ -349,7 +487,9 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect @Subscribe public void onChangeNSFWEvent(ChangeNSFWEvent changeNSFWEvent) { - sectionsPagerAdapter.changeNSFW(changeNSFWEvent.nsfw); + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.changeNSFW(changeNSFWEvent.nsfw); + } } @Override @@ -366,10 +506,166 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect } } + @Override + public void fabOptionSelected(int option) { + switch (option) { + case FABMoreOptionsBottomSheetFragment.FAB_OPTION_SUBMIT_POST: + PostTypeBottomSheetFragment postTypeBottomSheetFragment = new PostTypeBottomSheetFragment(); + postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag()); + break; + case FABMoreOptionsBottomSheetFragment.FAB_OPTION_REFRESH: + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.refresh(); + } + break; + case FABMoreOptionsBottomSheetFragment.FAB_OPTION_CHANGE_SORT_TYPE: + displaySortTypeBottomSheetFragment(); + break; + case FABMoreOptionsBottomSheetFragment.FAB_OPTION_CHANGE_POST_LAYOUT: + PostLayoutBottomSheetFragment postLayoutBottomSheetFragment = new PostLayoutBottomSheetFragment(); + postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag()); + break; + case FABMoreOptionsBottomSheetFragment.FAB_OPTION_SEARCH: + Intent intent = new Intent(this, SearchActivity.class); + if (mSubredditName != null && !mSubredditName.equals("")) { + intent.putExtra(SearchActivity.EXTRA_SUBREDDIT_NAME, mSubredditName); + } + startActivity(intent); + break; + case FABMoreOptionsBottomSheetFragment.FAB_OPTION_GO_TO_SUBREDDIT: { + goToSubreddit(); + break; + } + case FABMoreOptionsBottomSheetFragment.FAB_OPTION_GO_TO_USER: { + goToUser(); + break; + } + case FABMoreOptionsBottomSheetFragment.FAB_RANDOM: { + random(); + break; + } + case FABMoreOptionsBottomSheetFragment.FAB_HIDE_READ_POSTS: { + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.hideReadPosts(); + } + break; + } + case FABMoreOptionsBottomSheetFragment.FAB_FILTER_POSTS: { + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.filterPosts(); + } + break; + } + } + } + + private void goToSubreddit() { + EditText thingEditText = (EditText) getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, null); + thingEditText.requestFocus(); + InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); + if (imm != null) { + imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); + } + new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme) + .setTitle(R.string.go_to_subreddit) + .setView(thingEditText) + .setPositiveButton(R.string.ok, (dialogInterface, i) + -> { + if (imm != null) { + imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0); + } + Intent subredditIntent = new Intent(this, ViewSubredditDetailActivity.class); + subredditIntent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, thingEditText.getText().toString()); + startActivity(subredditIntent); + }) + .setNegativeButton(R.string.cancel, null) + .setOnDismissListener(dialogInterface -> { + if (imm != null) { + imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0); + } + }) + .show(); + } + + private void goToUser() { + EditText thingEditText = (EditText) getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, null); + thingEditText.requestFocus(); + InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); + if (imm != null) { + imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); + } + new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme) + .setTitle(R.string.go_to_user) + .setView(thingEditText) + .setPositiveButton(R.string.ok, (dialogInterface, i) + -> { + if (imm != null) { + imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0); + } + Intent userIntent = new Intent(this, ViewUserDetailActivity.class); + userIntent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, thingEditText.getText().toString()); + startActivity(userIntent); + }) + .setNegativeButton(R.string.cancel, null) + .setOnDismissListener(dialogInterface -> { + if (imm != null) { + imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0); + } + }) + .show(); + } + + private void random() { + RandomBottomSheetFragment randomBottomSheetFragment = new RandomBottomSheetFragment(); + Bundle bundle = new Bundle(); + bundle.putBoolean(RandomBottomSheetFragment.EXTRA_IS_NSFW, mNsfwAndSpoilerSharedPreferences.getBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.NSFW_BASE, false)); + randomBottomSheetFragment.setArguments(bundle); + randomBottomSheetFragment.show(getSupportFragmentManager(), randomBottomSheetFragment.getTag()); + } + + @Override + public void postTypeSelected(int postType) { + Intent intent; + switch (postType) { + case PostTypeBottomSheetFragment.TYPE_TEXT: + intent = new Intent(this, PostTextActivity.class); + startActivity(intent); + break; + case PostTypeBottomSheetFragment.TYPE_LINK: + intent = new Intent(this, PostLinkActivity.class); + startActivity(intent); + break; + case PostTypeBottomSheetFragment.TYPE_IMAGE: + intent = new Intent(this, PostImageActivity.class); + startActivity(intent); + break; + case PostTypeBottomSheetFragment.TYPE_VIDEO: + intent = new Intent(this, PostVideoActivity.class); + startActivity(intent); + } + } + + @Override + public void contentScrollUp() { + fab.show(); + } + + @Override + public void contentScrollDown() { + fab.hide(); + } + + @Override + public void randomOptionSelected(int option) { + Intent intent = new Intent(this, FetchRandomSubredditOrPostActivity.class); + intent.putExtra(FetchRandomSubredditOrPostActivity.EXTRA_RANDOM_OPTION, option); + startActivity(intent); + } + private class SectionsPagerAdapter extends FragmentStateAdapter { - public SectionsPagerAdapter(FragmentManager fm, Lifecycle lifecycle) { - super(fm, lifecycle); + public SectionsPagerAdapter(FragmentActivity fa) { + super(fa); } @NonNull @@ -382,7 +678,6 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect bundle.putInt(PostFragment.EXTRA_POST_TYPE, PostDataSource.TYPE_SEARCH); bundle.putString(PostFragment.EXTRA_NAME, mSubredditName); bundle.putString(PostFragment.EXTRA_QUERY, mQuery); - bundle.putInt(PostFragment.EXTRA_FILTER, PostFragment.EXTRA_NO_FILTER); bundle.putString(PostFragment.EXTRA_ACCESS_TOKEN, mAccessToken); bundle.putString(PostFragment.EXTRA_ACCOUNT_NAME, mAccountName); mFragment.setArguments(bundle); @@ -493,6 +788,20 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect } } + void filterPosts() { + Fragment fragment = fragmentManager.findFragmentByTag("f0"); + if (fragment instanceof PostFragment) { + ((PostFragment) fragment).filterPosts(); + } + } + + void hideReadPosts() { + Fragment fragment = fragmentManager.findFragmentByTag("f0"); + if (fragment instanceof PostFragment) { + ((PostFragment) fragment).hideReadPosts(); + } + } + @Override public int getItemCount() { return 3; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchSubredditsResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchSubredditsResultActivity.java index 21ebd255..9014ce1a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchSubredditsResultActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchSubredditsResultActivity.java @@ -114,6 +114,7 @@ public class SearchSubredditsResultActivity extends BaseActivity implements Acti mNullAccessToken = savedInstanceState.getBoolean(NULL_ACCESS_TOKEN_STATE); mAccessToken = savedInstanceState.getString(ACCESS_TOKEN_STATE); mAccountName = savedInstanceState.getString(ACCOUNT_NAME_STATE); + if (!mNullAccessToken && mAccessToken == null) { getCurrentAccountAndInitializeFragment(query); } else { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SelectedSubredditsActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SelectedSubredditsActivity.java index f6100535..3097538b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SelectedSubredditsActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SelectedSubredditsActivity.java @@ -61,6 +61,9 @@ public class SelectedSubredditsActivity extends BaseActivity implements Activity @Override protected void onCreate(Bundle savedInstanceState) { ((Infinity) getApplication()).getAppComponent().inject(this); + + setImmersiveModeNotApplicable(); + super.onCreate(savedInstanceState); setContentView(R.layout.activity_selected_subreddits); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SettingsActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SettingsActivity.java index f9c8c39e..c8e19cb3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SettingsActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SettingsActivity.java @@ -7,6 +7,7 @@ import android.view.MenuItem; import androidx.annotation.NonNull; import androidx.appcompat.widget.Toolbar; +import androidx.core.app.ActivityCompat; import androidx.fragment.app.Fragment; import androidx.preference.Preference; import androidx.preference.PreferenceFragmentCompat; @@ -21,12 +22,12 @@ import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; -import ml.docilealligator.infinityforreddit.asynctasks.GetCurrentAccountAsyncTask; -import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; -import ml.docilealligator.infinityforreddit.events.RecreateActivityEvent; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.asynctasks.GetCurrentAccountAsyncTask; +import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; +import ml.docilealligator.infinityforreddit.events.RecreateActivityEvent; import ml.docilealligator.infinityforreddit.settings.AboutPreferenceFragment; import ml.docilealligator.infinityforreddit.settings.CustomizeBottomAppBarFragment; import ml.docilealligator.infinityforreddit.settings.CustomizeMainPageTabsFragment; @@ -35,6 +36,7 @@ import ml.docilealligator.infinityforreddit.settings.GesturesAndButtonsPreferenc import ml.docilealligator.infinityforreddit.settings.InterfacePreferenceFragment; import ml.docilealligator.infinityforreddit.settings.MainPreferenceFragment; import ml.docilealligator.infinityforreddit.settings.NsfwAndBlurringFragment; +import ml.docilealligator.infinityforreddit.settings.PostHistoryFragment; public class SettingsActivity extends BaseActivity implements PreferenceFragmentCompat.OnPreferenceStartFragmentCallback { @@ -83,13 +85,16 @@ public class SettingsActivity extends BaseActivity implements getSupportFragmentManager().addOnBackStackChangedListener(() -> { if (getSupportFragmentManager().getBackStackEntryCount() == 0) { setTitle(R.string.settings_activity_label); - } else if (getSupportFragmentManager().findFragmentById(R.id.frame_layout_settings_activity) instanceof AboutPreferenceFragment) { + return; + } + Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.frame_layout_settings_activity); + if (fragment instanceof AboutPreferenceFragment) { setTitle(R.string.settings_about_master_title); - } else if (getSupportFragmentManager().findFragmentById(R.id.frame_layout_settings_activity) instanceof InterfacePreferenceFragment) { + } else if (fragment instanceof InterfacePreferenceFragment) { setTitle(R.string.settings_interface_title); - } else if (getSupportFragmentManager().findFragmentById(R.id.frame_layout_settings_activity) instanceof FontPreferenceFragment) { + } else if (fragment instanceof FontPreferenceFragment) { setTitle(R.string.settings_font_title); - } else if (getSupportFragmentManager().findFragmentById(R.id.frame_layout_settings_activity) instanceof GesturesAndButtonsPreferenceFragment) { + } else if (fragment instanceof GesturesAndButtonsPreferenceFragment) { setTitle(R.string.settings_gestures_and_buttons_title); } }); @@ -168,6 +173,8 @@ public class SettingsActivity extends BaseActivity implements args.putString(NsfwAndBlurringFragment.EXTRA_ACCOUNT_NAME, mAccountName); } else if (fragment instanceof CustomizeBottomAppBarFragment) { args.putString(CustomizeBottomAppBarFragment.EXTRA_ACCOUNT_NAME, mAccountName); + } else if (fragment instanceof PostHistoryFragment) { + args.putString(PostHistoryFragment.EXTRA_ACCOUNT_NAME, mAccountName); } fragment.setArguments(args); fragment.setTargetFragment(caller, 0); @@ -189,6 +196,6 @@ public class SettingsActivity extends BaseActivity implements @Subscribe public void onRecreateActivityEvent(RecreateActivityEvent recreateActivityEvent) { - recreate(); + ActivityCompat.recreate(this); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubmitCrosspostActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubmitCrosspostActivity.java index 04c70dc4..fb7e5a0b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubmitCrosspostActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubmitCrosspostActivity.java @@ -21,6 +21,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.widget.Toolbar; import androidx.coordinatorlayout.widget.CoordinatorLayout; +import androidx.core.content.ContextCompat; import com.bumptech.glide.Glide; import com.bumptech.glide.RequestManager; @@ -520,7 +521,7 @@ public class SubmitCrosspostActivity extends BaseActivity implements FlairBottom intent.putExtra(SubmitPostService.EXTRA_IS_SPOILER, isSpoiler); intent.putExtra(SubmitPostService.EXTRA_IS_NSFW, isNSFW); intent.putExtra(SubmitPostService.EXTRA_POST_TYPE, SubmitPostService.EXTRA_POST_TYPE_CROSSPOST); - startService(intent); + ContextCompat.startForegroundService(this, intent); return true; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubredditFilterPopularAndAllActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubredditFilterPopularAndAllActivity.java deleted file mode 100644 index 292e65be..00000000 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubredditFilterPopularAndAllActivity.java +++ /dev/null @@ -1,168 +0,0 @@ -package ml.docilealligator.infinityforreddit.activities; - -import android.content.Context; -import android.content.Intent; -import android.content.SharedPreferences; -import android.os.Bundle; -import android.view.MenuItem; -import android.view.inputmethod.InputMethodManager; -import android.widget.EditText; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.appcompat.widget.Toolbar; -import androidx.coordinatorlayout.widget.CoordinatorLayout; -import androidx.lifecycle.ViewModelProvider; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; - -import com.google.android.material.appbar.AppBarLayout; -import com.google.android.material.dialog.MaterialAlertDialogBuilder; -import com.google.android.material.floatingactionbutton.FloatingActionButton; - -import javax.inject.Inject; -import javax.inject.Named; - -import butterknife.BindView; -import butterknife.ButterKnife; -import ml.docilealligator.infinityforreddit.adapters.SubredditFilterRecyclerViewAdapter; -import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; -import ml.docilealligator.infinityforreddit.Infinity; -import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; -import ml.docilealligator.infinityforreddit.subredditfilter.DeleteSubredditFilter; -import ml.docilealligator.infinityforreddit.subredditfilter.InsertSubredditFilter; -import ml.docilealligator.infinityforreddit.subredditfilter.SubredditFilter; -import ml.docilealligator.infinityforreddit.subredditfilter.SubredditFilterViewModel; - -public class SubredditFilterPopularAndAllActivity extends BaseActivity { - - private static final int SUBREDDIT_SEARCH_REQUEST_CODE = 1; - @BindView(R.id.coordinator_layout_subreddit_filter_popular_and_all_activity) - CoordinatorLayout coordinatorLayout; - @BindView(R.id.appbar_layout_subreddit_filter_popular_and_all_activity) - AppBarLayout appBarLayout; - @BindView(R.id.toolbar_subreddit_filter_popular_and_all_activity) - Toolbar toolbar; - @BindView(R.id.recycler_view_subreddit_filter_popular_and_all_activity) - RecyclerView recyclerView; - @BindView(R.id.fab_subreddit_filter_popular_and_all_activity) - FloatingActionButton fab; - @Inject - @Named("default") - SharedPreferences sharedPreferences; - @Inject - RedditDataRoomDatabase redditDataRoomDatabase; - @Inject - CustomThemeWrapper customThemeWrapper; - SubredditFilterViewModel subredditFilterViewModel; - private SubredditFilterRecyclerViewAdapter adapter; - - @Override - protected void onCreate(Bundle savedInstanceState) { - ((Infinity) getApplication()).getAppComponent().inject(this); - - setImmersiveModeNotApplicable(); - - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_subreddit_filter_popular_and_all); - - ButterKnife.bind(this); - - applyCustomTheme(); - - setSupportActionBar(toolbar); - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - - adapter = new SubredditFilterRecyclerViewAdapter(subredditFilter -> DeleteSubredditFilter.deleteSubredditFilter(redditDataRoomDatabase, subredditFilter, () -> {})); - recyclerView.setLayoutManager(new LinearLayoutManager(this)); - recyclerView.setAdapter(adapter); - recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { - @Override - public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { - if (dy > 0) { - fab.hide(); - } else if (dy < 0) { - fab.show(); - } - } - }); - - subredditFilterViewModel = new ViewModelProvider(this, - new SubredditFilterViewModel.Factory(redditDataRoomDatabase)) - .get(SubredditFilterViewModel.class); - subredditFilterViewModel.getSubredditFilterLiveData().observe(this, subredditFilters -> adapter.updateSubredditsName(subredditFilters)); - - fab.setOnClickListener(view -> { - EditText thingEditText = (EditText) getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, null); - thingEditText.requestFocus(); - InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); - if (imm != null) { - imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); - } - new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme) - .setTitle(R.string.choose_a_subreddit) - .setView(thingEditText) - .setPositiveButton(R.string.ok, (dialogInterface, i) - -> { - if (imm != null) { - imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0); - } - SubredditFilter subredditFilter = new SubredditFilter(thingEditText.getText().toString(), SubredditFilter.TYPE_POPULAR_AND_ALL); - InsertSubredditFilter.insertSubredditFilter(redditDataRoomDatabase, subredditFilter, - () -> {}); - }) - .setNegativeButton(R.string.cancel, null) - .setNeutralButton(R.string.search, (dialogInterface, i) -> { - if (imm != null) { - imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0); - } - - Intent intent = new Intent(this, SearchActivity.class); - intent.putExtra(SearchActivity.EXTRA_SEARCH_ONLY_SUBREDDITS, true); - startActivityForResult(intent, SUBREDDIT_SEARCH_REQUEST_CODE); - }) - .setOnDismissListener(dialogInterface -> { - if (imm != null) { - imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0); - } - }) - .show(); - }); - } - - @Override - public boolean onOptionsItemSelected(@NonNull MenuItem item) { - if (item.getItemId() == android.R.id.home) { - finish(); - return true; - } - - return false; - } - - @Override - protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { - super.onActivityResult(requestCode, resultCode, data); - if (requestCode == SUBREDDIT_SEARCH_REQUEST_CODE && resultCode == RESULT_OK && data != null) { - SubredditFilter subredditFilter = new SubredditFilter(data.getStringExtra(SearchActivity.EXTRA_RETURN_SUBREDDIT_NAME), SubredditFilter.TYPE_POPULAR_AND_ALL); - InsertSubredditFilter.insertSubredditFilter(redditDataRoomDatabase, subredditFilter, - () -> {}); - } - } - - @Override - protected SharedPreferences getDefaultSharedPreferences() { - return sharedPreferences; - } - - @Override - protected CustomThemeWrapper getCustomThemeWrapper() { - return customThemeWrapper; - } - - @Override - protected void applyCustomTheme() { - applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar); - } -}
\ No newline at end of file diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubredditSelectionActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubredditSelectionActivity.java index 3a81c202..eb63d756 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubredditSelectionActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubredditSelectionActivity.java @@ -133,12 +133,11 @@ public class SubredditSelectionActivity extends BaseActivity implements Activity mAccountName = savedInstanceState.getString(ACCOUNT_NAME_STATE); mAccountProfileImageUrl = savedInstanceState.getString(ACCOUNT_PROFILE_IMAGE_URL); - mFragment = getSupportFragmentManager().getFragment(savedInstanceState, FRAGMENT_OUT_STATE); - getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_subreddit_selection_activity, mFragment).commit(); - if (!mNullAccessToken && mAccountName == null) { getCurrentAccountAndBindView(); } else { + mFragment = getSupportFragmentManager().getFragment(savedInstanceState, FRAGMENT_OUT_STATE); + getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_subreddit_selection_activity, mFragment).commit(); bindView(false); } } @@ -174,6 +173,10 @@ public class SubredditSelectionActivity extends BaseActivity implements Activity } private void bindView(boolean initializeFragment) { + if (isFinishing() || isDestroyed()) { + return; + } + loadSubscriptions(); if (initializeFragment) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java index f336f94f..a86e2c86 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java @@ -283,7 +283,7 @@ public class ViewImageOrGifActivity extends AppCompatActivity implements SetAsWa isDownloading = true; - if (Build.VERSION.SDK_INT >= 23) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { @@ -341,11 +341,7 @@ public class ViewImageOrGifActivity extends AppCompatActivity implements SetAsWa intent.putExtra(DownloadMediaService.EXTRA_MEDIA_TYPE, isGif ? DownloadMediaService.EXTRA_MEDIA_TYPE_GIF : DownloadMediaService.EXTRA_MEDIA_TYPE_IMAGE); intent.putExtra(DownloadMediaService.EXTRA_FILE_NAME, mImageFileName); intent.putExtra(DownloadMediaService.EXTRA_SUBREDDIT_NAME, mSubredditName); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - startForegroundService(intent); - } else { - startService(intent); - } + ContextCompat.startForegroundService(this, intent); Toast.makeText(this, R.string.download_started, Toast.LENGTH_SHORT).show(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewMultiRedditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewMultiRedditDetailActivity.java index 72ff2341..abcd21bd 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewMultiRedditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewMultiRedditDetailActivity.java @@ -23,12 +23,21 @@ import com.r0adkll.slidr.Slidr; import org.greenrobot.eventbus.EventBus; +import java.util.concurrent.Executor; + import javax.inject.Inject; import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.ActivityToolbarInterface; +import ml.docilealligator.infinityforreddit.FragmentCommunicator; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.MarkPostAsReadInterface; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.SortType; +import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback; import ml.docilealligator.infinityforreddit.asynctasks.GetCurrentAccountAsyncTask; import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostLayoutBottomSheetFragment; import ml.docilealligator.infinityforreddit.bottomsheetfragments.SortTimeBottomSheetFragment; @@ -36,21 +45,17 @@ import ml.docilealligator.infinityforreddit.bottomsheetfragments.SortTypeBottomS import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.events.RefreshMultiRedditsEvent; import ml.docilealligator.infinityforreddit.fragments.PostFragment; -import ml.docilealligator.infinityforreddit.FragmentCommunicator; -import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.multireddit.DeleteMultiReddit; import ml.docilealligator.infinityforreddit.multireddit.MultiReddit; +import ml.docilealligator.infinityforreddit.post.Post; import ml.docilealligator.infinityforreddit.post.PostDataSource; -import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; -import ml.docilealligator.infinityforreddit.SortType; -import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback; +import ml.docilealligator.infinityforreddit.readpost.InsertReadPost; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; import ml.docilealligator.infinityforreddit.utils.Utils; import retrofit2.Retrofit; public class ViewMultiRedditDetailActivity extends BaseActivity implements SortTypeSelectionCallback, - PostLayoutBottomSheetFragment.PostLayoutSelectionCallback, ActivityToolbarInterface { + PostLayoutBottomSheetFragment.PostLayoutSelectionCallback, ActivityToolbarInterface, MarkPostAsReadInterface { public static final String EXTRA_MULTIREDDIT_DATA = "EMD"; public static final String EXTRA_MULTIREDDIT_PATH = "EMP"; @@ -88,6 +93,8 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT SharedPreferences mPostLayoutSharedPreferences; @Inject CustomThemeWrapper mCustomThemeWrapper; + @Inject + Executor mExecutor; private boolean mNullAccessToken = false; private String mAccessToken; private String mAccountName; @@ -158,11 +165,11 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT mAccountName = savedInstanceState.getString(ACCOUNT_NAME_STATE); isInLazyMode = savedInstanceState.getBoolean(IS_IN_LAZY_MODE_STATE); - mFragment = getSupportFragmentManager().getFragment(savedInstanceState, FRAGMENT_OUT_STATE_KEY); - getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_view_multi_reddit_detail_activity, mFragment).commit(); - if (!mNullAccessToken && mAccessToken == null) { getCurrentAccountAndInitializeFragment(); + } else { + mFragment = getSupportFragmentManager().getFragment(savedInstanceState, FRAGMENT_OUT_STATE_KEY); + getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_view_multi_reddit_detail_activity, mFragment).commit(); } } else { getCurrentAccountAndInitializeFragment(); @@ -197,7 +204,6 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT Bundle bundle = new Bundle(); bundle.putString(PostFragment.EXTRA_NAME, multiPath); bundle.putInt(PostFragment.EXTRA_POST_TYPE, PostDataSource.TYPE_MULTI_REDDIT); - bundle.putInt(PostFragment.EXTRA_FILTER, PostFragment.EXTRA_NO_FILTER); bundle.putString(PostFragment.EXTRA_ACCESS_TOKEN, mAccessToken); bundle.putString(PostFragment.EXTRA_ACCOUNT_NAME, mAccountName); mFragment.setArguments(bundle); @@ -361,4 +367,9 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT Utils.displaySortTypeInToolbar(sortType, toolbar); } } + + @Override + public void markPostAsRead(Post post) { + InsertReadPost.insertReadPost(mRedditDataRoomDatabase, mExecutor, mAccountName, post.getId()); + } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java index 9a6f765a..386f15cd 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java @@ -281,7 +281,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS int navBarHeight = getNavBarHeight(); if (navBarHeight > 0) { CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) fab.getLayoutParams(); - params.bottomMargin = navBarHeight; + params.bottomMargin += navBarHeight; fab.setLayoutParams(params); mRecyclerView.setPadding(0, 0, 0, navBarHeight + mRecyclerView.getPaddingBottom()); showToast = true; @@ -505,9 +505,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS } mMessageFullname = getIntent().getStringExtra(EXTRA_MESSAGE_FULLNAME); mNewAccountName = getIntent().getStringExtra(EXTRA_NEW_ACCOUNT_NAME); - } - if (savedInstanceState == null) { if (!mRespectSubredditRecommendedSortType || isSingleCommentThreadMode) { sortType = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_POST_COMMENT, SortType.Type.BEST.value.toUpperCase()); if (sortType != null) { @@ -937,7 +935,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS mToolbar.setTitle(new SortType(SortType.Type.valueOf(ViewPostDetailActivity.this.sortType)).getType().fullName); ViewPostDetailActivity.this.sortType = ViewPostDetailActivity.this.sortType.toLowerCase(); } - fetchComments(changeRefreshState, checkSortState, sortType); + fetchComments(changeRefreshState, checkSortState, ViewPostDetailActivity.this.sortType); } else { ViewPostDetailActivity.this.sortType = subredditData.getSuggestedCommentSort(); String sortTypeTemp = ViewPostDetailActivity.this.sortType.toLowerCase().substring(0, 1).toUpperCase() + ViewPostDetailActivity.this.sortType.substring(1); @@ -1825,10 +1823,9 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS children.clear(); } this.sortType = sortType.getType().value; - if (!mRespectSubredditRecommendedSortType) { + if (!mSharedPreferences.getBoolean(SharedPreferencesUtils.RESPECT_SUBREDDIT_RECOMMENDED_COMMENT_SORT_TYPE, false)) { mSortTypeSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TYPE_POST_COMMENT, sortType.getType().name()).apply(); } - mRespectSubredditRecommendedSortType = false; fetchCommentsRespectRecommendedSort(false, false, sortType.getType().value); mToolbar.setTitle(sortType.getType().fullName); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java index ff6b6875..1316dfc1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java @@ -4,16 +4,13 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.res.ColorStateList; -import android.graphics.Point; import android.os.Build; import android.os.Bundle; -import android.view.Display; import android.view.Gravity; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; import android.view.View; -import android.view.ViewTreeObserver; import android.view.Window; import android.view.WindowManager; import android.view.inputmethod.InputMethodManager; @@ -28,8 +25,8 @@ import androidx.annotation.Nullable; import androidx.appcompat.widget.Toolbar; import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentManager; -import androidx.lifecycle.Lifecycle; import androidx.lifecycle.ViewModelProvider; import androidx.viewpager2.adapter.FragmentStateAdapter; import androidx.viewpager2.widget.ViewPager2; @@ -54,6 +51,7 @@ import org.greenrobot.eventbus.Subscribe; import java.text.SimpleDateFormat; import java.util.Locale; +import java.util.concurrent.Executor; import javax.inject.Inject; import javax.inject.Named; @@ -63,6 +61,14 @@ import butterknife.ButterKnife; import jp.wasabeef.glide.transformations.RoundedCornersTransformation; import ml.docilealligator.infinityforreddit.ActivityToolbarInterface; import ml.docilealligator.infinityforreddit.AppBarStateChangeListener; +import ml.docilealligator.infinityforreddit.FragmentCommunicator; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.MarkPostAsReadInterface; +import ml.docilealligator.infinityforreddit.PostFragmentContentScrollingInterface; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.SortType; +import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback; import ml.docilealligator.infinityforreddit.asynctasks.CheckIsSubscribedToSubredditAsyncTask; import ml.docilealligator.infinityforreddit.asynctasks.GetCurrentAccountAsyncTask; import ml.docilealligator.infinityforreddit.asynctasks.InsertSubredditDataAsyncTask; @@ -79,14 +85,10 @@ import ml.docilealligator.infinityforreddit.events.GoBackToMainPageEvent; import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent; import ml.docilealligator.infinityforreddit.fragments.PostFragment; import ml.docilealligator.infinityforreddit.fragments.SidebarFragment; -import ml.docilealligator.infinityforreddit.FragmentCommunicator; -import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.message.ReadMessage; +import ml.docilealligator.infinityforreddit.post.Post; import ml.docilealligator.infinityforreddit.post.PostDataSource; -import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; -import ml.docilealligator.infinityforreddit.SortType; -import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback; +import ml.docilealligator.infinityforreddit.readpost.InsertReadPost; import ml.docilealligator.infinityforreddit.subreddit.FetchSubredditData; import ml.docilealligator.infinityforreddit.subreddit.SubredditData; import ml.docilealligator.infinityforreddit.subreddit.SubredditSubscription; @@ -99,7 +101,7 @@ import retrofit2.Retrofit; public class ViewSubredditDetailActivity extends BaseActivity implements SortTypeSelectionCallback, PostTypeBottomSheetFragment.PostTypeSelectionCallback, PostLayoutBottomSheetFragment.PostLayoutSelectionCallback, ActivityToolbarInterface, FABMoreOptionsBottomSheetFragment.FABOptionSelectionCallback, - RandomBottomSheetFragment.RandomOptionSelectionCallback { + RandomBottomSheetFragment.RandomOptionSelectionCallback, MarkPostAsReadInterface, PostFragmentContentScrollingInterface { public static final String EXTRA_SUBREDDIT_NAME_KEY = "ESN"; public static final String EXTRA_MESSAGE_FULLNAME = "ENF"; @@ -147,17 +149,17 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp TextView creationTimeTextView; @BindView(R.id.description_text_view_view_subreddit_detail_activity) TextView descriptionTextView; - @BindView(R.id.bottom_navigation_view_subreddit_detail_activity) + @BindView(R.id.bottom_app_bar_bottom_app_bar) BottomAppBar bottomNavigationView; - @BindView(R.id.linear_layout_bottom_app_bar_view_subreddit_detail_activity) + @BindView(R.id.linear_layout_bottom_app_bar) LinearLayout linearLayoutBottomAppBar; - @BindView(R.id.option_1_bottom_app_bar_view_subreddit_detail_activity) + @BindView(R.id.option_1_bottom_app_bar) ImageView option1BottomAppBar; - @BindView(R.id.option_2_bottom_app_bar_view_subreddit_detail_activity) + @BindView(R.id.option_2_bottom_app_bar) ImageView option2BottomAppBar; - @BindView(R.id.option_3_bottom_app_bar_view_subreddit_detail_activity) + @BindView(R.id.option_3_bottom_app_bar) ImageView option3BottomAppBar; - @BindView(R.id.option_4_bottom_app_bar_view_subreddit_detail_activity) + @BindView(R.id.option_4_bottom_app_bar) ImageView option4BottomAppBar; @BindView(R.id.fab_view_subreddit_detail_activity) FloatingActionButton fab; @@ -186,6 +188,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp SharedPreferences bottomAppBarSharedPreference; @Inject CustomThemeWrapper mCustomThemeWrapper; + @Inject + Executor mExecutor; public SubredditViewModel mSubredditViewModel; private FragmentManager fragmentManager; private SectionsPagerAdapter sectionsPagerAdapter; @@ -218,6 +222,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp private int collapsedTabIndicatorColor; private int unsubscribedColor; private int subscribedColor; + private int fabOption; private SlidrInterface mSlidrInterface; private MaterialAlertDialogBuilder nsfwWarningBuilder; @@ -251,30 +256,16 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp } else { window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); } - showToast = true; int navBarHeight = getNavBarHeight(); if (navBarHeight > 0) { CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) fab.getLayoutParams(); params.bottomMargin += navBarHeight; fab.setLayoutParams(params); - coordinatorLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { - @Override - public void onGlobalLayout() { - coordinatorLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this); - - Display display = getWindowManager().getDefaultDisplay(); - Point size = new Point(); - display.getRealSize(size); - if (size.y == coordinatorLayout.getHeight()) { - linearLayoutBottomAppBar.setPadding(0, - linearLayoutBottomAppBar.getPaddingTop(), 0, navBarHeight); - } - } - }); - - showToast = true; + bottomNavigationView.setPadding(0, 0, 0, navBarHeight); } + + showToast = true; } View decorView = window.getDecorView(); @@ -684,80 +675,110 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp lp.gravity = Gravity.END | Gravity.BOTTOM; fab.setLayoutParams(lp); } - - int fabOption = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB, SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SUBMIT_POSTS); + } else { + CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) fab.getLayoutParams(); + lp.setAnchorId(View.NO_ID); + lp.gravity = Gravity.END | Gravity.BOTTOM; + fab.setLayoutParams(lp); + bottomNavigationView.setVisibility(View.GONE); + } + fabOption = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB, SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SUBMIT_POSTS); + switch (fabOption) { + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_REFRESH: + fab.setImageResource(R.drawable.ic_refresh_24dp); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE: + fab.setImageResource(R.drawable.ic_sort_toolbar_24dp); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT: + fab.setImageResource(R.drawable.ic_post_layout_24dp); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH: + fab.setImageResource(R.drawable.ic_search_black_24dp); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT: + fab.setImageResource(R.drawable.ic_subreddit_24dp); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_USER: + fab.setImageResource(R.drawable.ic_user_24dp); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_RANDOM: + fab.setImageResource(R.drawable.ic_random_24dp); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS: + if (mAccessToken == null) { + fab.setImageResource(R.drawable.ic_filter_24dp); + fabOption = SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS; + } else { + fab.setImageResource(R.drawable.ic_hide_read_posts_24dp); + } + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS: + fab.setImageResource(R.drawable.ic_filter_24dp); + break; + default: + if (mAccessToken == null) { + fab.setImageResource(R.drawable.ic_filter_24dp); + fabOption = SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS; + } else { + fab.setImageResource(R.drawable.ic_add_day_night_24dp); + } + break; + } + fab.setOnClickListener(view -> { switch (fabOption) { - case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_REFRESH: - fab.setImageResource(R.drawable.ic_refresh_24dp); + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_REFRESH: { + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.refresh(); + } break; - case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE: - fab.setImageResource(R.drawable.ic_sort_toolbar_24dp); + } + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE: { + sortTypeBottomSheetFragment.show(getSupportFragmentManager(), sortTypeBottomSheetFragment.getTag()); break; - case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT: - fab.setImageResource(R.drawable.ic_post_layout_24dp); + } + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT: { + postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag()); break; - case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH: - fab.setImageResource(R.drawable.ic_search_black_24dp); + } + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH: { + Intent intent = new Intent(this, SearchActivity.class); + intent.putExtra(SearchActivity.EXTRA_SUBREDDIT_NAME, subredditName); + startActivity(intent); break; + } case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT: - fab.setImageResource(R.drawable.ic_subreddit_24dp); + goToSubreddit(); break; case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_USER: - fab.setImageResource(R.drawable.ic_user_24dp); + goToUser(); break; case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_RANDOM: - fab.setImageResource(R.drawable.ic_random_24dp); + random(); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS: + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.hideReadPosts(); + } + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS: + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.filterPosts(); + } break; default: - fab.setImageResource(R.drawable.ic_add_day_night_24dp); + postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag()); break; } - fab.setOnClickListener(view -> { - switch (fabOption) { - case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_REFRESH: { - if (sectionsPagerAdapter != null) { - sectionsPagerAdapter.refresh(); - } - break; - } - case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE: { - sortTypeBottomSheetFragment.show(getSupportFragmentManager(), sortTypeBottomSheetFragment.getTag()); - break; - } - case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT: { - postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag()); - break; - } - case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH: { - Intent intent = new Intent(this, SearchActivity.class); - intent.putExtra(SearchActivity.EXTRA_SUBREDDIT_NAME, subredditName); - startActivity(intent); - break; - } - case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT: - goToSubreddit(); - break; - case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_USER: - goToUser(); - break; - case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_RANDOM: - random(); - break; - default: - postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag()); - break; - } - }); - fab.setOnLongClickListener(view -> { - fabMoreOptionsBottomSheetFragment.show(getSupportFragmentManager(), fabMoreOptionsBottomSheetFragment.getTag()); - return true; - }); - - fab.setVisibility(View.VISIBLE); - } else { - bottomNavigationView.setVisibility(View.GONE); - fab.setVisibility(View.GONE); - } + }); + fab.setOnLongClickListener(view -> { + Bundle bundle = new Bundle(); + bundle.putBoolean(FABMoreOptionsBottomSheetFragment.EXTRA_ANONYMOUS_MODE, mAccessToken == null); + fabMoreOptionsBottomSheetFragment.setArguments(bundle); + fabMoreOptionsBottomSheetFragment.show(getSupportFragmentManager(), fabMoreOptionsBottomSheetFragment.getTag()); + return true; + }); + fab.setVisibility(View.VISIBLE); subscribeSubredditChip.setOnClickListener(view -> { if (mAccessToken == null) { @@ -824,7 +845,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp } }).execute(); - sectionsPagerAdapter = new SectionsPagerAdapter(fragmentManager, getLifecycle()); + sectionsPagerAdapter = new SectionsPagerAdapter(this); viewPager2.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { @Override public void onPageSelected(int position) { @@ -838,8 +859,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp if (showBottomAppBar) { bottomNavigationView.performShow(); } - fab.show(); } + fab.show(); sectionsPagerAdapter.displaySortTypeInToolbar(); } @@ -901,9 +922,11 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp if (mMenu != null) { mMenu.findItem(R.id.action_lazy_mode_view_subreddit_detail_activity).setTitle(R.string.action_start_lazy_mode); } - sectionsPagerAdapter.refresh(); - mFetchSubredditInfoSuccess = false; - fetchSubredditData(); + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.refresh(); + mFetchSubredditInfoSuccess = false; + fetchSubredditData(); + } return true; case R.id.action_lazy_mode_view_subreddit_detail_activity: if (sectionsPagerAdapter != null) { @@ -1033,6 +1056,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp sectionsPagerAdapter.changePostLayout(postLayout); } + @Override public void contentScrollUp() { if (mAccessToken != null) { if (showBottomAppBar && !lockBottomAppBar) { @@ -1044,6 +1068,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp } } + @Override public void contentScrollDown() { if (mAccessToken != null) { if (!(showBottomAppBar && lockBottomAppBar)) { @@ -1120,6 +1145,18 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp random(); break; } + case FABMoreOptionsBottomSheetFragment.FAB_HIDE_READ_POSTS: { + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.hideReadPosts(); + } + break; + } + case FABMoreOptionsBottomSheetFragment.FAB_FILTER_POSTS: { + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.filterPosts(); + } + break; + } } } @@ -1194,10 +1231,15 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp startActivity(intent); } + @Override + public void markPostAsRead(Post post) { + InsertReadPost.insertReadPost(mRedditDataRoomDatabase, mExecutor, mAccountName, post.getId()); + } + private class SectionsPagerAdapter extends FragmentStateAdapter { - SectionsPagerAdapter(FragmentManager fm, Lifecycle lifecycle) { - super(fm, lifecycle); + SectionsPagerAdapter(FragmentActivity fa) { + super(fa); } @NonNull @@ -1208,7 +1250,6 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp Bundle bundle = new Bundle(); bundle.putString(PostFragment.EXTRA_NAME, subredditName); bundle.putInt(PostFragment.EXTRA_POST_TYPE, PostDataSource.TYPE_SUBREDDIT); - bundle.putInt(PostFragment.EXTRA_FILTER, PostFragment.EXTRA_NO_FILTER); bundle.putString(PostFragment.EXTRA_ACCESS_TOKEN, mAccessToken); bundle.putString(PostFragment.EXTRA_ACCOUNT_NAME, mAccountName); fragment.setArguments(bundle); @@ -1304,6 +1345,24 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp } } + void hideReadPosts() { + if (fragmentManager != null) { + Fragment fragment = fragmentManager.findFragmentByTag("f0"); + if (fragment instanceof PostFragment) { + ((PostFragment) fragment).hideReadPosts(); + } + } + } + + void filterPosts() { + if (fragmentManager != null) { + Fragment fragment = fragmentManager.findFragmentByTag("f0"); + if (fragment instanceof PostFragment) { + ((PostFragment) fragment).filterPosts(); + } + } + } + @Override public int getItemCount() { return 2; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java index f7b77dbe..579afc03 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java @@ -1,5 +1,6 @@ package ml.docilealligator.infinityforreddit.activities; +import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.res.ColorStateList; @@ -8,12 +9,16 @@ import android.net.Uri; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; +import android.view.Gravity; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.Window; import android.view.WindowManager; +import android.view.inputmethod.InputMethodManager; +import android.widget.EditText; +import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; @@ -23,8 +28,8 @@ import androidx.annotation.Nullable; import androidx.appcompat.widget.Toolbar; import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentManager; -import androidx.lifecycle.Lifecycle; import androidx.lifecycle.ViewModelProvider; import androidx.viewpager2.adapter.FragmentStateAdapter; import androidx.viewpager2.widget.ViewPager2; @@ -34,8 +39,10 @@ import com.bumptech.glide.RequestManager; import com.bumptech.glide.request.RequestOptions; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.appbar.CollapsingToolbarLayout; +import com.google.android.material.bottomappbar.BottomAppBar; import com.google.android.material.chip.Chip; import com.google.android.material.dialog.MaterialAlertDialogBuilder; +import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.snackbar.Snackbar; import com.google.android.material.tabs.TabLayout; import com.google.android.material.tabs.TabLayoutMediator; @@ -47,6 +54,7 @@ import org.greenrobot.eventbus.Subscribe; import java.text.SimpleDateFormat; import java.util.Locale; +import java.util.concurrent.Executor; import javax.inject.Inject; import javax.inject.Named; @@ -56,26 +64,34 @@ import butterknife.ButterKnife; import jp.wasabeef.glide.transformations.RoundedCornersTransformation; import ml.docilealligator.infinityforreddit.ActivityToolbarInterface; import ml.docilealligator.infinityforreddit.AppBarStateChangeListener; +import ml.docilealligator.infinityforreddit.DeleteThing; +import ml.docilealligator.infinityforreddit.FragmentCommunicator; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.MarkPostAsReadInterface; +import ml.docilealligator.infinityforreddit.PostFragmentContentScrollingInterface; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.SortType; +import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback; import ml.docilealligator.infinityforreddit.asynctasks.CheckIsFollowingUserAsyncTask; import ml.docilealligator.infinityforreddit.asynctasks.GetCurrentAccountAsyncTask; import ml.docilealligator.infinityforreddit.asynctasks.SwitchAccountAsyncTask; +import ml.docilealligator.infinityforreddit.bottomsheetfragments.FABMoreOptionsBottomSheetFragment; import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostLayoutBottomSheetFragment; +import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostTypeBottomSheetFragment; +import ml.docilealligator.infinityforreddit.bottomsheetfragments.RandomBottomSheetFragment; import ml.docilealligator.infinityforreddit.bottomsheetfragments.SortTimeBottomSheetFragment; import ml.docilealligator.infinityforreddit.bottomsheetfragments.UserThingSortTypeBottomSheetFragment; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; -import ml.docilealligator.infinityforreddit.DeleteThing; import ml.docilealligator.infinityforreddit.events.ChangeNSFWEvent; +import ml.docilealligator.infinityforreddit.events.GoBackToMainPageEvent; import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent; import ml.docilealligator.infinityforreddit.fragments.CommentsListingFragment; import ml.docilealligator.infinityforreddit.fragments.PostFragment; -import ml.docilealligator.infinityforreddit.FragmentCommunicator; -import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.message.ReadMessage; +import ml.docilealligator.infinityforreddit.post.Post; import ml.docilealligator.infinityforreddit.post.PostDataSource; -import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; -import ml.docilealligator.infinityforreddit.SortType; -import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback; +import ml.docilealligator.infinityforreddit.readpost.InsertReadPost; import ml.docilealligator.infinityforreddit.subscribeduser.SubscribedUserDao; import ml.docilealligator.infinityforreddit.user.BlockUser; import ml.docilealligator.infinityforreddit.user.FetchUserData; @@ -89,7 +105,9 @@ import pl.droidsonroids.gif.GifImageView; import retrofit2.Retrofit; public class ViewUserDetailActivity extends BaseActivity implements SortTypeSelectionCallback, - PostLayoutBottomSheetFragment.PostLayoutSelectionCallback, ActivityToolbarInterface { + PostTypeBottomSheetFragment.PostTypeSelectionCallback, PostLayoutBottomSheetFragment.PostLayoutSelectionCallback, + ActivityToolbarInterface, FABMoreOptionsBottomSheetFragment.FABOptionSelectionCallback, + RandomBottomSheetFragment.RandomOptionSelectionCallback, MarkPostAsReadInterface, PostFragmentContentScrollingInterface { public static final String EXTRA_USER_NAME_KEY = "EUNK"; public static final String EXTRA_MESSAGE_FULLNAME = "ENF"; @@ -133,6 +151,20 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele TextView cakedayTextView; @BindView(R.id.description_text_view_view_user_detail_activity) TextView descriptionTextView; + @BindView(R.id.bottom_app_bar_bottom_app_bar) + BottomAppBar bottomNavigationView; + @BindView(R.id.linear_layout_bottom_app_bar) + LinearLayout linearLayoutBottomAppBar; + @BindView(R.id.option_1_bottom_app_bar) + ImageView option1BottomAppBar; + @BindView(R.id.option_2_bottom_app_bar) + ImageView option2BottomAppBar; + @BindView(R.id.option_3_bottom_app_bar) + ImageView option3BottomAppBar; + @BindView(R.id.option_4_bottom_app_bar) + ImageView option4BottomAppBar; + @BindView(R.id.fab_view_user_detail_activity) + FloatingActionButton fab; @Inject @Named("no_oauth") Retrofit mRetrofit; @@ -154,7 +186,12 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele @Named("nsfw_and_spoiler") SharedPreferences mNsfwAndSpoilerSharedPreferences; @Inject + @Named("bottom_app_bar") + SharedPreferences bottomAppBarSharedPreference; + @Inject CustomThemeWrapper mCustomThemeWrapper; + @Inject + Executor mExecutor; public UserViewModel userViewModel; private FragmentManager fragmentManager; private SectionsPagerAdapter sectionsPagerAdapter; @@ -180,11 +217,14 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele private int collapsedTabIndicatorColor; private int unsubscribedColor; private int subscribedColor; + private int fabOption; private boolean showToast = false; + private boolean showBottomAppBar; + private boolean lockBottomAppBar; private String mMessageFullname; private String mNewAccountName; private SlidrInterface mSlidrInterface; - private MaterialAlertDialogBuilder nsfwWarningBuilder; + //private MaterialAlertDialogBuilder nsfwWarningBuilder; @Override protected void onCreate(Bundle savedInstanceState) { @@ -255,6 +295,14 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele } else { window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); } + + int navBarHeight = getNavBarHeight(); + if (navBarHeight > 0) { + CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) fab.getLayoutParams(); + params.bottomMargin += navBarHeight; + fab.setLayoutParams(params); + bottomNavigationView.setPadding(0, 0, 0, navBarHeight); + } showToast = true; } @@ -309,6 +357,9 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele }); } + showBottomAppBar = mSharedPreferences.getBoolean(SharedPreferencesUtils.BOTTOM_APP_BAR_KEY, false); + lockBottomAppBar = mSharedPreferences.getBoolean(SharedPreferencesUtils.LOCK_BOTTOM_APP_BAR, false); + subscribedUserDao = mRedditDataRoomDatabase.subscribedUserDao(); glide = Glide.with(this); Locale locale = getResources().getConfiguration().locale; @@ -435,7 +486,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele descriptionTextView.setText(userData.getDescription()); } - if (userData.isNSFW()) { + /*if (userData.isNSFW()) { if (nsfwWarningBuilder == null && !mNsfwAndSpoilerSharedPreferences.getBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.NSFW_BASE, false)) { nsfwWarningBuilder = new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme) @@ -448,7 +499,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele .setNegativeButton(R.string.dismiss, null); nsfwWarningBuilder.show(); } - } + }*/ } }); @@ -493,6 +544,13 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele userNameTextView.setTextColor(mCustomThemeWrapper.getUsername()); karmaTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor()); cakedayTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor()); + bottomNavigationView.setBackgroundTint(ColorStateList.valueOf(mCustomThemeWrapper.getBottomAppBarBackgroundColor())); + int bottomAppBarIconColor = mCustomThemeWrapper.getBottomAppBarIconColor(); + option2BottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN); + option1BottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN); + option3BottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN); + option4BottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN); + applyFABTheme(fab); descriptionTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor()); subscribeUserChip.setTextColor(mCustomThemeWrapper.getChipTextColor()); applyTabLayoutTheme(tabLayout); @@ -535,7 +593,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele } private void initializeViewPager() { - sectionsPagerAdapter = new SectionsPagerAdapter(fragmentManager, getLifecycle()); + sectionsPagerAdapter = new SectionsPagerAdapter(this); viewPager2.setAdapter(sectionsPagerAdapter); viewPager2.setOffscreenPageLimit(2); viewPager2.setUserInputEnabled(!mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_SWIPING_BETWEEN_TABS, false)); @@ -558,24 +616,239 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele } else { lockSwipeRightToGoBack(); } + + if (mAccessToken != null) { + if (showBottomAppBar) { + bottomNavigationView.performShow(); + } + } + fab.show(); + sectionsPagerAdapter.displaySortTypeInToolbar(); } }); fixViewPager2Sensitivity(viewPager2); - if (mAccessToken != null && mMessageFullname != null) { - ReadMessage.readMessage(mOauthRetrofit, mAccessToken, mMessageFullname, new ReadMessage.ReadMessageListener() { - @Override - public void readSuccess() { - mMessageFullname = null; - } + if (mAccessToken != null) { + if (mMessageFullname != null) { + ReadMessage.readMessage(mOauthRetrofit, mAccessToken, mMessageFullname, new ReadMessage.ReadMessageListener() { + @Override + public void readSuccess() { + mMessageFullname = null; + } - @Override - public void readFailed() { + @Override + public void readFailed() { + + } + }); + } + + if (showBottomAppBar) { + int optionCount = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_COUNT, 4); + int option1 = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_1, SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_HOME); + int option2 = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_2, SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SUBSCRIPTIONS); + + bottomNavigationView.setVisibility(View.VISIBLE); + + if (optionCount == 2) { + linearLayoutBottomAppBar.setWeightSum(3); + option1BottomAppBar.setVisibility(View.GONE); + option3BottomAppBar.setVisibility(View.GONE); + + option2BottomAppBar.setImageResource(getBottomAppBarOptionDrawableResource(option1)); + option4BottomAppBar.setImageResource(getBottomAppBarOptionDrawableResource(option2)); + + option2BottomAppBar.setOnClickListener(view -> { + bottomAppBarOptionAction(option1); + }); + + option4BottomAppBar.setOnClickListener(view -> { + bottomAppBarOptionAction(option2); + }); + } else { + int option3 = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_3, SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_INBOX); + int option4 = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_4, SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_PROFILE); + + option1BottomAppBar.setImageResource(getBottomAppBarOptionDrawableResource(option1)); + option2BottomAppBar.setImageResource(getBottomAppBarOptionDrawableResource(option2)); + option3BottomAppBar.setImageResource(getBottomAppBarOptionDrawableResource(option3)); + option4BottomAppBar.setImageResource(getBottomAppBarOptionDrawableResource(option4)); + + option1BottomAppBar.setOnClickListener(view -> { + bottomAppBarOptionAction(option1); + }); + option2BottomAppBar.setOnClickListener(view -> { + bottomAppBarOptionAction(option2); + }); + + option3BottomAppBar.setOnClickListener(view -> { + bottomAppBarOptionAction(option3); + }); + + option4BottomAppBar.setOnClickListener(view -> { + bottomAppBarOptionAction(option4); + }); } - }); + } else { + CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) fab.getLayoutParams(); + lp.setAnchorId(View.NO_ID); + lp.gravity = Gravity.END | Gravity.BOTTOM; + fab.setLayoutParams(lp); + } + } else { + CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) fab.getLayoutParams(); + lp.setAnchorId(View.NO_ID); + lp.gravity = Gravity.END | Gravity.BOTTOM; + fab.setLayoutParams(lp); + bottomNavigationView.setVisibility(View.GONE); + } + fabOption = bottomAppBarSharedPreference.getInt(SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB, SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SUBMIT_POSTS); + switch (fabOption) { + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_REFRESH: + fab.setImageResource(R.drawable.ic_refresh_24dp); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE: + fab.setImageResource(R.drawable.ic_sort_toolbar_24dp); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT: + fab.setImageResource(R.drawable.ic_post_layout_24dp); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH: + fab.setImageResource(R.drawable.ic_search_black_24dp); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT: + fab.setImageResource(R.drawable.ic_subreddit_24dp); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_USER: + fab.setImageResource(R.drawable.ic_user_24dp); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_RANDOM: + fab.setImageResource(R.drawable.ic_random_24dp); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS: + if (mAccessToken == null) { + fab.setImageResource(R.drawable.ic_filter_24dp); + fabOption = SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS; + } else { + fab.setImageResource(R.drawable.ic_hide_read_posts_24dp); + } + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS: + fab.setImageResource(R.drawable.ic_filter_24dp); + break; + default: + if (mAccessToken == null) { + fab.setImageResource(R.drawable.ic_filter_24dp); + fabOption = SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS; + } else { + fab.setImageResource(R.drawable.ic_add_day_night_24dp); + } + break; + } + fab.setOnClickListener(view -> { + switch (fabOption) { + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_REFRESH: { + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.refresh(); + } + break; + } + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_SORT_TYPE: { + userThingSortTypeBottomSheetFragment.show(getSupportFragmentManager(), userThingSortTypeBottomSheetFragment.getTag()); + break; + } + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_CHANGE_POST_LAYOUT: { + postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag()); + break; + } + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH: { + Intent intent = new Intent(this, SearchActivity.class); + startActivity(intent); + break; + } + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT: + goToSubreddit(); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_USER: + goToUser(); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_RANDOM: + random(); + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS: + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.hideReadPosts(); + } + break; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS: + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.filterPosts(); + } + break; + default: + PostTypeBottomSheetFragment postTypeBottomSheetFragment = new PostTypeBottomSheetFragment(); + postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag()); + break; + } + }); + fab.setOnLongClickListener(view -> { + FABMoreOptionsBottomSheetFragment fabMoreOptionsBottomSheetFragment = new FABMoreOptionsBottomSheetFragment(); + Bundle bundle = new Bundle(); + bundle.putBoolean(FABMoreOptionsBottomSheetFragment.EXTRA_ANONYMOUS_MODE, mAccessToken == null); + fabMoreOptionsBottomSheetFragment.setArguments(bundle); + fabMoreOptionsBottomSheetFragment.show(getSupportFragmentManager(), fabMoreOptionsBottomSheetFragment.getTag()); + return true; + }); + + fab.setVisibility(View.VISIBLE); + } + + private void bottomAppBarOptionAction(int option) { + switch (option) { + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_HOME: { + EventBus.getDefault().post(new GoBackToMainPageEvent()); + break; + } + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SUBSCRIPTIONS: { + Intent intent = new Intent(this, SubscribedThingListingActivity.class); + startActivity(intent); + break; + } + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_INBOX: { + Intent intent = new Intent(this, InboxActivity.class); + startActivity(intent); + break; + } + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_PROFILE: { + Intent intent = new Intent(this, ViewUserDetailActivity.class); + intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, mAccountName); + startActivity(intent); + break; + } + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_MULTIREDDITS: { + Intent intent = new Intent(this, SubscribedThingListingActivity.class); + intent.putExtra(SubscribedThingListingActivity.EXTRA_SHOW_MULTIREDDITS, true); + startActivity(intent); + break; + } + } + } + + private int getBottomAppBarOptionDrawableResource(int option) { + switch (option) { + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_HOME: + return R.drawable.ic_home_black_24dp; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SUBSCRIPTIONS: + return R.drawable.ic_subscritptions_bottom_app_bar_24dp; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_INBOX: + return R.drawable.ic_inbox_24dp; + case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_MULTIREDDITS: + return R.drawable.ic_multi_reddit_24dp; + default: + return R.drawable.ic_account_circle_24dp; } } @@ -809,6 +1082,150 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele sectionsPagerAdapter.changePostLayout(postLayout); } + @Override + public void fabOptionSelected(int option) { + switch (option) { + case FABMoreOptionsBottomSheetFragment.FAB_OPTION_SUBMIT_POST: + PostTypeBottomSheetFragment postTypeBottomSheetFragment = new PostTypeBottomSheetFragment(); + postTypeBottomSheetFragment.show(getSupportFragmentManager(), postTypeBottomSheetFragment.getTag()); + break; + case FABMoreOptionsBottomSheetFragment.FAB_OPTION_REFRESH: + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.refresh(); + } + break; + case FABMoreOptionsBottomSheetFragment.FAB_OPTION_CHANGE_SORT_TYPE: + userThingSortTypeBottomSheetFragment.show(getSupportFragmentManager(), userThingSortTypeBottomSheetFragment.getTag()); + break; + case FABMoreOptionsBottomSheetFragment.FAB_OPTION_CHANGE_POST_LAYOUT: + postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag()); + break; + case FABMoreOptionsBottomSheetFragment.FAB_OPTION_SEARCH: + Intent intent = new Intent(this, SearchActivity.class); + startActivity(intent); + break; + case FABMoreOptionsBottomSheetFragment.FAB_OPTION_GO_TO_SUBREDDIT: { + goToSubreddit(); + break; + } + case FABMoreOptionsBottomSheetFragment.FAB_OPTION_GO_TO_USER: { + goToUser(); + break; + } + case FABMoreOptionsBottomSheetFragment.FAB_RANDOM: { + random(); + break; + } + case FABMoreOptionsBottomSheetFragment.FAB_HIDE_READ_POSTS: { + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.hideReadPosts(); + } + break; + } + case FABMoreOptionsBottomSheetFragment.FAB_FILTER_POSTS: { + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.filterPosts(); + } + break; + } + } + } + + private void goToSubreddit() { + EditText thingEditText = (EditText) getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, null); + thingEditText.requestFocus(); + InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); + if (imm != null) { + imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); + } + new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme) + .setTitle(R.string.go_to_subreddit) + .setView(thingEditText) + .setPositiveButton(R.string.ok, (dialogInterface, i) + -> { + if (imm != null) { + imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0); + } + Intent subredditIntent = new Intent(this, ViewSubredditDetailActivity.class); + subredditIntent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, thingEditText.getText().toString()); + startActivity(subredditIntent); + }) + .setNegativeButton(R.string.cancel, null) + .setOnDismissListener(dialogInterface -> { + if (imm != null) { + imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0); + } + }) + .show(); + } + + private void goToUser() { + EditText thingEditText = (EditText) getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, null); + thingEditText.requestFocus(); + InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); + if (imm != null) { + imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); + } + new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme) + .setTitle(R.string.go_to_user) + .setView(thingEditText) + .setPositiveButton(R.string.ok, (dialogInterface, i) + -> { + if (imm != null) { + imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0); + } + Intent userIntent = new Intent(this, ViewUserDetailActivity.class); + userIntent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, thingEditText.getText().toString()); + startActivity(userIntent); + }) + .setNegativeButton(R.string.cancel, null) + .setOnDismissListener(dialogInterface -> { + if (imm != null) { + imm.hideSoftInputFromWindow(thingEditText.getWindowToken(), 0); + } + }) + .show(); + } + + private void random() { + RandomBottomSheetFragment randomBottomSheetFragment = new RandomBottomSheetFragment(); + Bundle bundle = new Bundle(); + bundle.putBoolean(RandomBottomSheetFragment.EXTRA_IS_NSFW, mNsfwAndSpoilerSharedPreferences.getBoolean((mAccountName == null ? "" : mAccountName) + SharedPreferencesUtils.NSFW_BASE, false)); + randomBottomSheetFragment.setArguments(bundle); + randomBottomSheetFragment.show(getSupportFragmentManager(), randomBottomSheetFragment.getTag()); + } + + @Override + public void randomOptionSelected(int option) { + Intent intent = new Intent(this, FetchRandomSubredditOrPostActivity.class); + intent.putExtra(FetchRandomSubredditOrPostActivity.EXTRA_RANDOM_OPTION, option); + startActivity(intent); + } + + @Override + public void contentScrollUp() { + if (mAccessToken != null) { + if (showBottomAppBar && !lockBottomAppBar) { + bottomNavigationView.performShow(); + } + if (!(showBottomAppBar && lockBottomAppBar)) { + fab.show(); + } + } + } + + @Override + public void contentScrollDown() { + if (mAccessToken != null) { + if (!(showBottomAppBar && lockBottomAppBar)) { + fab.hide(); + } + if (showBottomAppBar && !lockBottomAppBar) { + bottomNavigationView.performHide(); + } + } + } + @Subscribe public void onAccountSwitchEvent(SwitchAccountEvent event) { if (!getClass().getName().equals(event.excludeActivityClassName)) { @@ -821,6 +1238,11 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele sectionsPagerAdapter.changeNSFW(changeNSFWEvent.nsfw); } + @Subscribe + public void goBackToMainPageEvent(GoBackToMainPageEvent event) { + finish(); + } + @Override public void onLongPress() { if (sectionsPagerAdapter != null) { @@ -835,6 +1257,33 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele } } + @Override + public void markPostAsRead(Post post) { + InsertReadPost.insertReadPost(mRedditDataRoomDatabase, mExecutor, mAccountName, post.getId()); + } + + @Override + public void postTypeSelected(int postType) { + Intent intent; + switch (postType) { + case PostTypeBottomSheetFragment.TYPE_TEXT: + intent = new Intent(this, PostTextActivity.class); + startActivity(intent); + break; + case PostTypeBottomSheetFragment.TYPE_LINK: + intent = new Intent(this, PostLinkActivity.class); + startActivity(intent); + break; + case PostTypeBottomSheetFragment.TYPE_IMAGE: + intent = new Intent(this, PostImageActivity.class); + startActivity(intent); + break; + case PostTypeBottomSheetFragment.TYPE_VIDEO: + intent = new Intent(this, PostVideoActivity.class); + startActivity(intent); + } + } + private static class InsertUserDataAsyncTask extends AsyncTask<Void, Void, Void> { private UserDao userDao; @@ -865,8 +1314,8 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele private class SectionsPagerAdapter extends FragmentStateAdapter { - SectionsPagerAdapter(FragmentManager fm, Lifecycle lifecycle) { - super(fm, lifecycle); + SectionsPagerAdapter(FragmentActivity fa) { + super(fa); } @NonNull @@ -878,7 +1327,6 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele bundle.putInt(PostFragment.EXTRA_POST_TYPE, PostDataSource.TYPE_USER); bundle.putString(PostFragment.EXTRA_USER_NAME, username); bundle.putString(PostFragment.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_SUBMITTED); - bundle.putInt(PostFragment.EXTRA_FILTER, PostFragment.EXTRA_NO_FILTER); bundle.putString(PostFragment.EXTRA_ACCESS_TOKEN, mAccessToken); bundle.putString(PostFragment.EXTRA_ACCOUNT_NAME, mAccountName); fragment.setArguments(bundle); @@ -1009,6 +1457,24 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele } } } + + void hideReadPosts() { + if (fragmentManager != null) { + Fragment fragment = fragmentManager.findFragmentByTag("f0"); + if (fragment instanceof PostFragment) { + ((PostFragment) fragment).hideReadPosts(); + } + } + } + + void filterPosts() { + if (fragmentManager != null) { + Fragment fragment = fragmentManager.findFragmentByTag("f0"); + if (fragment instanceof PostFragment) { + ((PostFragment) fragment).filterPosts(); + } + } + } } private void lockSwipeRightToGoBack() { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java index 66bd7b73..417d8de7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java @@ -397,6 +397,8 @@ public class ViewVideoActivity extends AppCompatActivity { @Override protected void onDestroy() { super.onDestroy(); + player.seekToDefaultPosition(); + player.stop(true); player.release(); } @@ -417,7 +419,7 @@ public class ViewVideoActivity extends AppCompatActivity { } isDownloading = true; - if (Build.VERSION.SDK_INT >= 23) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { @@ -470,29 +472,20 @@ public class ViewVideoActivity extends AppCompatActivity { private void download() { isDownloading = false; + Intent intent; if (videoType != VIDEO_TYPE_NORMAL) { - Intent intent = new Intent(this, DownloadMediaService.class); + intent = new Intent(this, DownloadMediaService.class); intent.putExtra(DownloadMediaService.EXTRA_URL, videoDownloadUrl); intent.putExtra(DownloadMediaService.EXTRA_MEDIA_TYPE, DownloadMediaService.EXTRA_MEDIA_TYPE_VIDEO); intent.putExtra(DownloadMediaService.EXTRA_FILE_NAME, videoFileName); intent.putExtra(DownloadMediaService.EXTRA_SUBREDDIT_NAME, subredditName); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - startForegroundService(intent); - } else { - startService(intent); - } } else { - Intent intent = new Intent(this, DownloadRedditVideoService.class); + intent = new Intent(this, DownloadRedditVideoService.class); intent.putExtra(DownloadRedditVideoService.EXTRA_VIDEO_URL, videoDownloadUrl); intent.putExtra(DownloadRedditVideoService.EXTRA_POST_ID, id); intent.putExtra(DownloadRedditVideoService.EXTRA_SUBREDDIT, subredditName); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - startForegroundService(intent); - } else { - startService(intent); - } } + ContextCompat.startForegroundService(this, intent); Toast.makeText(this, R.string.download_started, Toast.LENGTH_SHORT).show(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentAndPostRecyclerViewAdapter.java index 6204934f..f86a84a2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentAndPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentAndPostRecyclerViewAdapter.java @@ -86,7 +86,7 @@ import io.noties.markwon.simple.ext.SimpleExtPlugin; import jp.wasabeef.glide.transformations.BlurTransformation; import jp.wasabeef.glide.transformations.RoundedCornersTransformation; import ml.docilealligator.infinityforreddit.activities.CommentActivity; -import ml.docilealligator.infinityforreddit.activities.FilteredThingActivity; +import ml.docilealligator.infinityforreddit.activities.FilteredPostsActivity; import ml.docilealligator.infinityforreddit.activities.LinkResolverActivity; import ml.docilealligator.infinityforreddit.activities.ViewImageOrGifActivity; import ml.docilealligator.infinityforreddit.activities.ViewPostDetailActivity; @@ -229,8 +229,6 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy private Drawable mCommentIcon; private float mScale; - private ShareLinkBottomSheetFragment mShareLinkBottomSheetFragment; - private CopyTextBottomSheetFragment mCopyTextBottomSheetFragment; private ExoCreator mExoCreator; public CommentAndPostRecyclerViewAdapter(AppCompatActivity activity, CustomThemeWrapper customThemeWrapper, @@ -279,6 +277,11 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy int start = 0; boolean find = false; while (matcher.find(start)) { + if (markdownStringBuilder.length() < 4 + || matcher.start() < 0 + || matcher.end() > markdownStringBuilder.length()) { + break; + } find = true; markdownStringBuilder.delete(matcher.end() - 2, matcher.end()); markdownStringBuilder.delete(matcher.start(), matcher.start() + 2); @@ -317,8 +320,9 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy Bundle bundle = new Bundle(); bundle.putString(CopyTextBottomSheetFragment.EXTRA_RAW_TEXT, mPost.getSelfTextPlain()); bundle.putString(CopyTextBottomSheetFragment.EXTRA_MARKDOWN, mPost.getSelfText()); - mCopyTextBottomSheetFragment.setArguments(bundle); - mCopyTextBottomSheetFragment.show(mActivity.getSupportFragmentManager(), mCopyTextBottomSheetFragment.getTag()); + CopyTextBottomSheetFragment copyTextBottomSheetFragment = new CopyTextBottomSheetFragment(); + copyTextBottomSheetFragment.setArguments(bundle); + copyTextBottomSheetFragment.show(mActivity.getSupportFragmentManager(), copyTextBottomSheetFragment.getTag()); return true; }); } @@ -375,6 +379,11 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy int start = 0; boolean find = false; while (matcher.find(start)) { + if (markdownStringBuilder.length() < 4 + || matcher.start() < 0 + || matcher.end() > markdownStringBuilder.length()) { + break; + } find = true; markdownStringBuilder.delete(matcher.end() - 2, matcher.end()); markdownStringBuilder.delete(matcher.start(), matcher.start() + 2); @@ -544,8 +553,6 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy DrawableCompat.setTint(mCommentIcon, mPostIconAndInfoColor); } - mShareLinkBottomSheetFragment = new ShareLinkBottomSheetFragment(); - mCopyTextBottomSheetFragment = new CopyTextBottomSheetFragment(); mExoCreator = exoCreator; } @@ -1112,11 +1119,13 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy ((CommentViewHolder) holder).upvoteButton .setColorFilter(mUpvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); ((CommentViewHolder) holder).scoreTextView.setTextColor(mUpvotedColor); + ((CommentViewHolder) holder).topScoreTextView.setTextColor(mUpvotedColor); break; case Comment.VOTE_TYPE_DOWNVOTE: ((CommentViewHolder) holder).downvoteButton .setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); ((CommentViewHolder) holder).scoreTextView.setTextColor(mDownvotedColor); + ((CommentViewHolder) holder).topScoreTextView.setTextColor(mDownvotedColor); break; } @@ -1442,27 +1451,29 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy previewIndex = 0; } preview = previews.get(previewIndex); - if (preview.getPreviewWidth() * preview.getPreviewHeight() >= 65 * 1000 * 1000) { + if (preview.getPreviewWidth() * preview.getPreviewHeight() > 35_000_000) { for (int i = previews.size() - 1; i >= 1; i--) { preview = previews.get(i); if (mImageViewWidth >= preview.getPreviewWidth()) { - if (preview.getPreviewWidth() * preview.getPreviewHeight() <= 75 * 1000 * 1000) { + if (preview.getPreviewWidth() * preview.getPreviewHeight() <= 35_000_000) { return preview; } } else { int height = mImageViewWidth / preview.getPreviewWidth() * preview.getPreviewHeight(); - if (mImageViewWidth * height <= 75 * 1000 * 1000) { + if (mImageViewWidth * height <= 35_000_000) { return preview; } } } } - int divisor = 2; - while (preview.getPreviewWidth() * preview.getPreviewHeight() / divisor / divisor > 75 * 1000 * 1000) { - preview.setPreviewWidth(preview.getPreviewWidth() / divisor); - preview.setPreviewHeight(preview.getPreviewHeight() / divisor); - divisor *= 2; + if (preview.getPreviewWidth() * preview.getPreviewHeight() > 35_000_000) { + int divisor = 2; + do { + preview.setPreviewWidth(preview.getPreviewWidth() / divisor); + preview.setPreviewHeight(preview.getPreviewHeight() / divisor); + divisor *= 2; + } while (preview.getPreviewWidth() * preview.getPreviewHeight() / divisor / divisor > 35_000_000); } return preview; @@ -2124,18 +2135,18 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy }); mTypeTextView.setOnClickListener(view -> { - Intent intent = new Intent(mActivity, FilteredThingActivity.class); - intent.putExtra(FilteredThingActivity.EXTRA_NAME, mSubredditNamePrefixed.substring(2)); - intent.putExtra(FilteredThingActivity.EXTRA_POST_TYPE, PostDataSource.TYPE_SUBREDDIT); - intent.putExtra(FilteredThingActivity.EXTRA_FILTER, mPost.getPostType()); + Intent intent = new Intent(mActivity, FilteredPostsActivity.class); + intent.putExtra(FilteredPostsActivity.EXTRA_NAME, mSubredditNamePrefixed.substring(2)); + intent.putExtra(FilteredPostsActivity.EXTRA_POST_TYPE, PostDataSource.TYPE_SUBREDDIT); + intent.putExtra(FilteredPostsActivity.EXTRA_FILTER, mPost.getPostType()); mActivity.startActivity(intent); }); mNSFWTextView.setOnClickListener(view -> { - Intent intent = new Intent(mActivity, FilteredThingActivity.class); - intent.putExtra(FilteredThingActivity.EXTRA_NAME, mSubredditNamePrefixed.substring(2)); - intent.putExtra(FilteredThingActivity.EXTRA_POST_TYPE, PostDataSource.TYPE_SUBREDDIT); - intent.putExtra(FilteredThingActivity.EXTRA_FILTER, Post.NSFW_TYPE); + Intent intent = new Intent(mActivity, FilteredPostsActivity.class); + intent.putExtra(FilteredPostsActivity.EXTRA_NAME, mSubredditNamePrefixed.substring(2)); + intent.putExtra(FilteredPostsActivity.EXTRA_POST_TYPE, PostDataSource.TYPE_SUBREDDIT); + intent.putExtra(FilteredPostsActivity.EXTRA_FILTER, Post.NSFW_TYPE); mActivity.startActivity(intent); }); @@ -2379,8 +2390,9 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy break; } } - mShareLinkBottomSheetFragment.setArguments(bundle); - mShareLinkBottomSheetFragment.show(mActivity.getSupportFragmentManager(), mShareLinkBottomSheetFragment.getTag()); + ShareLinkBottomSheetFragment shareLinkBottomSheetFragment = new ShareLinkBottomSheetFragment(); + shareLinkBottomSheetFragment.setArguments(bundle); + shareLinkBottomSheetFragment.show(mActivity.getSupportFragmentManager(), shareLinkBottomSheetFragment.getTag()); }); if (mVoteButtonsOnTheRight) { @@ -3459,12 +3471,14 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy newVoteType = APIUtils.DIR_UPVOTE; upvoteButton.setColorFilter(mUpvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); scoreTextView.setTextColor(mUpvotedColor); + topScoreTextView.setTextColor(mUpvotedColor); } else { //Upvoted before comment.setVoteType(Comment.VOTE_TYPE_NO_VOTE); newVoteType = APIUtils.DIR_UNVOTE; upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); scoreTextView.setTextColor(mCommentIconAndInfoColor); + topScoreTextView.setTextColor(mSecondaryTextColor); } scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, @@ -3473,25 +3487,35 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy Utils.getNVotes(mShowAbsoluteNumberOfVotes, comment.getScore() + comment.getVoteType()))); + int position = getAdapterPosition(); VoteThing.voteThing(mActivity, mOauthRetrofit, mAccessToken, new VoteThing.VoteThingListener() { @Override public void onVoteThingSuccess(int position) { + int currentPosition = getAdapterPosition(); if (newVoteType.equals(APIUtils.DIR_UPVOTE)) { comment.setVoteType(Comment.VOTE_TYPE_UPVOTE); - upvoteButton.setColorFilter(mUpvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); - scoreTextView.setTextColor(mUpvotedColor); + if (currentPosition == position) { + upvoteButton.setColorFilter(mUpvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); + scoreTextView.setTextColor(mUpvotedColor); + topScoreTextView.setTextColor(mUpvotedColor); + } } else { comment.setVoteType(Comment.VOTE_TYPE_NO_VOTE); - upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); - scoreTextView.setTextColor(mCommentIconAndInfoColor); + if (currentPosition == position) { + upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + scoreTextView.setTextColor(mCommentIconAndInfoColor); + topScoreTextView.setTextColor(mSecondaryTextColor); + } } - downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); - scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, - comment.getScore() + comment.getVoteType())); - topScoreTextView.setText(mActivity.getString(R.string.top_score, - Utils.getNVotes(mShowAbsoluteNumberOfVotes, - comment.getScore() + comment.getVoteType()))); + if (currentPosition == position) { + downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, + comment.getScore() + comment.getVoteType())); + topScoreTextView.setText(mActivity.getString(R.string.top_score, + Utils.getNVotes(mShowAbsoluteNumberOfVotes, + comment.getScore() + comment.getVoteType()))); + } } @Override @@ -3525,12 +3549,14 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy newVoteType = APIUtils.DIR_DOWNVOTE; downvoteButton.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); scoreTextView.setTextColor(mDownvotedColor); + topScoreTextView.setTextColor(mDownvotedColor); } else { //Downvoted before comment.setVoteType(Comment.VOTE_TYPE_NO_VOTE); newVoteType = APIUtils.DIR_UNVOTE; downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); scoreTextView.setTextColor(mCommentIconAndInfoColor); + topScoreTextView.setTextColor(mSecondaryTextColor); } scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, @@ -3539,25 +3565,35 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy Utils.getNVotes(mShowAbsoluteNumberOfVotes, comment.getScore() + comment.getVoteType()))); + int position = getAdapterPosition(); VoteThing.voteThing(mActivity, mOauthRetrofit, mAccessToken, new VoteThing.VoteThingListener() { @Override public void onVoteThingSuccess(int position1) { + int currentPosition = getAdapterPosition(); if (newVoteType.equals(APIUtils.DIR_DOWNVOTE)) { comment.setVoteType(Comment.VOTE_TYPE_DOWNVOTE); - downvoteButton.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); - scoreTextView.setTextColor(mDownvotedColor); + if (currentPosition == position) { + downvoteButton.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); + scoreTextView.setTextColor(mDownvotedColor); + topScoreTextView.setTextColor(mDownvotedColor); + } } else { comment.setVoteType(Comment.VOTE_TYPE_NO_VOTE); - downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); - scoreTextView.setTextColor(mCommentIconAndInfoColor); + if (currentPosition == position) { + downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + scoreTextView.setTextColor(mCommentIconAndInfoColor); + topScoreTextView.setTextColor(mSecondaryTextColor); + } } - upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); - scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, - comment.getScore() + comment.getVoteType())); - topScoreTextView.setText(mActivity.getString(R.string.top_score, - Utils.getNVotes(mShowAbsoluteNumberOfVotes, - comment.getScore() + comment.getVoteType()))); + if (currentPosition == position) { + upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, + comment.getScore() + comment.getVoteType())); + topScoreTextView.setText(mActivity.getString(R.string.top_score, + Utils.getNVotes(mShowAbsoluteNumberOfVotes, + comment.getScore() + comment.getVoteType()))); + } } @Override @@ -3570,20 +3606,25 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy saveButton.setOnClickListener(view -> { Comment comment = getCurrentComment(this); if (comment != null) { + int position = getAdapterPosition(); if (comment.isSaved()) { comment.setSaved(false); SaveThing.unsaveThing(mOauthRetrofit, mAccessToken, comment.getFullName(), new SaveThing.SaveThingListener() { @Override public void success() { comment.setSaved(false); - saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp); + if (getAdapterPosition() == position) { + saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp); + } Toast.makeText(mActivity, R.string.comment_unsaved_success, Toast.LENGTH_SHORT).show(); } @Override public void failed() { comment.setSaved(true); - saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); + if (getAdapterPosition() == position) { + saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); + } Toast.makeText(mActivity, R.string.comment_unsaved_failed, Toast.LENGTH_SHORT).show(); } }); @@ -3593,14 +3634,18 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy @Override public void success() { comment.setSaved(true); - saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); + if (getAdapterPosition() == position) { + saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); + } Toast.makeText(mActivity, R.string.comment_saved_success, Toast.LENGTH_SHORT).show(); } @Override public void failed() { comment.setSaved(false); - saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp); + if (getAdapterPosition() == position) { + saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp); + } Toast.makeText(mActivity, R.string.comment_saved_failed, Toast.LENGTH_SHORT).show(); } }); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java index fad4476f..ced75d0e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java @@ -136,6 +136,11 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment int start = 0; boolean find = false; while (matcher.find(start)) { + if (markdownStringBuilder.length() < 4 + || matcher.start() < 0 + || matcher.end() > markdownStringBuilder.length()) { + break; + } find = true; markdownStringBuilder.delete(matcher.end() - 2, matcher.end()); markdownStringBuilder.delete(matcher.start(), matcher.start() + 2); @@ -571,20 +576,27 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment VoteThing.voteThing(mContext, mOauthRetrofit, mAccessToken, new VoteThing.VoteThingListener() { @Override - public void onVoteThingSuccess(int position) { + public void onVoteThingSuccess(int position1) { + int currentPosition = getAdapterPosition(); if (newVoteType.equals(APIUtils.DIR_UPVOTE)) { comment.setVoteType(Comment.VOTE_TYPE_UPVOTE); - upvoteButton.setColorFilter(mUpvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); - scoreTextView.setTextColor(mUpvotedColor); + if (currentPosition == position) { + upvoteButton.setColorFilter(mUpvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); + scoreTextView.setTextColor(mUpvotedColor); + } } else { comment.setVoteType(Comment.VOTE_TYPE_NO_VOTE); - upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); - scoreTextView.setTextColor(mCommentIconAndInfoColor); + if (currentPosition == position) { + upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + scoreTextView.setTextColor(mCommentIconAndInfoColor); + } } - downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); - scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, - comment.getScore() + comment.getVoteType())); + if (currentPosition == position) { + downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, + comment.getScore() + comment.getVoteType())); + } } @Override @@ -631,19 +643,26 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment VoteThing.voteThing(mContext, mOauthRetrofit, mAccessToken, new VoteThing.VoteThingListener() { @Override public void onVoteThingSuccess(int position1) { + int currentPosition = getAdapterPosition(); if (newVoteType.equals(APIUtils.DIR_DOWNVOTE)) { comment.setVoteType(Comment.VOTE_TYPE_DOWNVOTE); - downvoteButton.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); - scoreTextView.setTextColor(mDownvotedColor); + if (currentPosition == position) { + downvoteButton.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); + scoreTextView.setTextColor(mDownvotedColor); + } } else { comment.setVoteType(Comment.VOTE_TYPE_NO_VOTE); - downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); - scoreTextView.setTextColor(mCommentIconAndInfoColor); + if (currentPosition == position) { + downvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + scoreTextView.setTextColor(mCommentIconAndInfoColor); + } } - upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); - scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, - comment.getScore() + comment.getVoteType())); + if (currentPosition == position) { + upvoteButton.setColorFilter(mCommentIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, + comment.getScore() + comment.getVoteType())); + } } @Override @@ -658,7 +677,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment if (position < 0) { return; } - Comment comment = getItem(getAdapterPosition()); + Comment comment = getItem(position); if (comment != null) { if (comment.isSaved()) { comment.setSaved(false); @@ -666,14 +685,18 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment @Override public void success() { comment.setSaved(false); - saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp); + if (getAdapterPosition() == position) { + saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp); + } Toast.makeText(mContext, R.string.comment_unsaved_success, Toast.LENGTH_SHORT).show(); } @Override public void failed() { comment.setSaved(true); - saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); + if (getAdapterPosition() == position) { + saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); + } Toast.makeText(mContext, R.string.comment_unsaved_failed, Toast.LENGTH_SHORT).show(); } }); @@ -683,14 +706,18 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment @Override public void success() { comment.setSaved(true); - saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); + if (getAdapterPosition() == position) { + saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); + } Toast.makeText(mContext, R.string.comment_saved_success, Toast.LENGTH_SHORT).show(); } @Override public void failed() { comment.setSaved(false); - saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp); + if (getAdapterPosition() == position) { + saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp); + } Toast.makeText(mContext, R.string.comment_saved_failed, Toast.LENGTH_SHORT).show(); } }); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CustomizeThemeRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CustomizeThemeRecyclerViewAdapter.java index eb8189dd..37af8c46 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CustomizeThemeRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CustomizeThemeRecyclerViewAdapter.java @@ -87,8 +87,8 @@ public class CustomizeThemeRecyclerViewAdapter extends RecyclerView.Adapter<Recy } else if (holder instanceof ThemeNameItemViewHolder) { ((ThemeNameItemViewHolder) holder).themeNameTextView.setText(themeName); holder.itemView.setOnClickListener(view -> { - View dialogView = activity.getLayoutInflater().inflate(R.layout.dialog_edit_theme_name, null); - EditText themeNameEditText = dialogView.findViewById(R.id.theme_name_edit_text_edit_theme_name_dialog); + View dialogView = activity.getLayoutInflater().inflate(R.layout.dialog_edit_name, null); + EditText themeNameEditText = dialogView.findViewById(R.id.name_edit_text_edit_name_dialog); themeNameEditText.setText(themeName); themeNameEditText.requestFocus(); InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FollowedUsersRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FollowedUsersRecyclerViewAdapter.java index 05c85ed1..40107a03 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FollowedUsersRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FollowedUsersRecyclerViewAdapter.java @@ -102,11 +102,6 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc int offset = (mFavoriteSubscribedUserData != null && mFavoriteSubscribedUserData.size() > 0) ? mFavoriteSubscribedUserData.size() + 2 : 0; - viewHolder.itemView.setOnClickListener(view -> { - Intent intent = new Intent(mContext, ViewUserDetailActivity.class); - intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, mSubscribedUserData.get(viewHolder.getAdapterPosition() - offset).getName()); - mContext.startActivity(intent); - }); if (!mSubscribedUserData.get(viewHolder.getAdapterPosition() - offset).getIconUrl().equals("")) { glide.load(mSubscribedUserData.get(viewHolder.getAdapterPosition() - offset).getIconUrl()) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) @@ -125,66 +120,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc } else { ((UserViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_border_24dp); } - - ((UserViewHolder) viewHolder).favoriteImageView.setOnClickListener(view -> { - if(mSubscribedUserData.get(viewHolder.getAdapterPosition() - offset).isFavorite()) { - ((UserViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_border_24dp); - mSubscribedUserData.get(viewHolder.getAdapterPosition() - offset).setFavorite(false); - FavoriteThing.unfavoriteUser(mOauthRetrofit, mRedditDataRoomDatabase, mAccessToken, - mSubscribedUserData.get(viewHolder.getAdapterPosition() - offset), - new FavoriteThing.FavoriteThingListener() { - @Override - public void success() { - int position = viewHolder.getAdapterPosition() - offset; - if(position >= 0 && mFavoriteSubscribedUserData.size() > position) { - mFavoriteSubscribedUserData.get(position).setFavorite(false); - } - ((UserViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_border_24dp); - } - - @Override - public void failed() { - Toast.makeText(mContext, R.string.thing_unfavorite_failed, Toast.LENGTH_SHORT).show(); - int position = viewHolder.getAdapterPosition() - offset; - if(position >= 0 && mFavoriteSubscribedUserData.size() > position) { - mFavoriteSubscribedUserData.get(position).setFavorite(true); - } - ((UserViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_24dp); - } - }); - } else { - ((UserViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_24dp); - mSubscribedUserData.get(viewHolder.getAdapterPosition() - offset).setFavorite(true); - FavoriteThing.favoriteUser(mOauthRetrofit, mRedditDataRoomDatabase, mAccessToken, - mSubscribedUserData.get(viewHolder.getAdapterPosition() - offset), - new FavoriteThing.FavoriteThingListener() { - @Override - public void success() { - int position = viewHolder.getAdapterPosition() - offset; - if(position >= 0 && mFavoriteSubscribedUserData.size() > position) { - mFavoriteSubscribedUserData.get(position).setFavorite(true); - } - ((UserViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_24dp); - } - - @Override - public void failed() { - Toast.makeText(mContext, R.string.thing_favorite_failed, Toast.LENGTH_SHORT).show(); - int position = viewHolder.getAdapterPosition() - offset; - if(position >= 0 && mFavoriteSubscribedUserData.size() > position) { - mFavoriteSubscribedUserData.get(position).setFavorite(false); - } - ((UserViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_border_24dp); - } - }); - } - }); } else if (viewHolder instanceof FavoriteUserViewHolder) { - viewHolder.itemView.setOnClickListener(view -> { - Intent intent = new Intent(mContext, ViewUserDetailActivity.class); - intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, mFavoriteSubscribedUserData.get(viewHolder.getAdapterPosition() - 1).getName()); - mContext.startActivity(intent); - }); if (!mFavoriteSubscribedUserData.get(viewHolder.getAdapterPosition() - 1).getIconUrl().equals("")) { glide.load(mFavoriteSubscribedUserData.get(viewHolder.getAdapterPosition() - 1).getIconUrl()) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) @@ -203,60 +139,6 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc } else { ((FavoriteUserViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_border_24dp); } - - ((FavoriteUserViewHolder) viewHolder).favoriteImageView.setOnClickListener(view -> { - if(mFavoriteSubscribedUserData.get(viewHolder.getAdapterPosition() - 1).isFavorite()) { - ((FavoriteUserViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_border_24dp); - mFavoriteSubscribedUserData.get(viewHolder.getAdapterPosition() - 1).setFavorite(false); - FavoriteThing.unfavoriteUser(mOauthRetrofit, mRedditDataRoomDatabase, mAccessToken, - mFavoriteSubscribedUserData.get(viewHolder.getAdapterPosition() - 1), - new FavoriteThing.FavoriteThingListener() { - @Override - public void success() { - int position = viewHolder.getAdapterPosition() - 1; - if(position >= 0 && mFavoriteSubscribedUserData.size() > position) { - mFavoriteSubscribedUserData.get(position).setFavorite(false); - } - ((FavoriteUserViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_border_24dp); - } - - @Override - public void failed() { - Toast.makeText(mContext, R.string.thing_unfavorite_failed, Toast.LENGTH_SHORT).show(); - int position = viewHolder.getAdapterPosition() - 1; - if(position >= 0 && mFavoriteSubscribedUserData.size() > position) { - mFavoriteSubscribedUserData.get(position).setFavorite(true); - } - ((FavoriteUserViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_24dp); - } - }); - } else { - ((FavoriteUserViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_24dp); - mFavoriteSubscribedUserData.get(viewHolder.getAdapterPosition() - 1).setFavorite(true); - FavoriteThing.favoriteUser(mOauthRetrofit, mRedditDataRoomDatabase, mAccessToken, - mFavoriteSubscribedUserData.get(viewHolder.getAdapterPosition() - 1), - new FavoriteThing.FavoriteThingListener() { - @Override - public void success() { - int position = viewHolder.getAdapterPosition() - 1; - if(position >= 0 && mFavoriteSubscribedUserData.size() > position) { - mFavoriteSubscribedUserData.get(position).setFavorite(true); - } - ((FavoriteUserViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_24dp); - } - - @Override - public void failed() { - Toast.makeText(mContext, R.string.thing_favorite_failed, Toast.LENGTH_SHORT).show(); - int position = viewHolder.getAdapterPosition() - 1; - if(position >= 0 && mFavoriteSubscribedUserData.size() > position) { - mFavoriteSubscribedUserData.get(position).setFavorite(false); - } - ((FavoriteUserViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_border_24dp); - } - }); - } - }); } } @@ -317,6 +199,72 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc super(itemView); ButterKnife.bind(this, itemView); userNameTextView.setTextColor(mPrimaryTextColor); + + itemView.setOnClickListener(view -> { + int position = getAdapterPosition() - 1; + if(position >= 0 && mFavoriteSubscribedUserData.size() > position) { + Intent intent = new Intent(mContext, ViewUserDetailActivity.class); + intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, mFavoriteSubscribedUserData.get(position).getName()); + mContext.startActivity(intent); + } + }); + + favoriteImageView.setOnClickListener(view -> { + int position = getAdapterPosition() - 1; + if(position >= 0 && mFavoriteSubscribedUserData.size() > position) { + if(mFavoriteSubscribedUserData.get(position).isFavorite()) { + favoriteImageView.setImageResource(R.drawable.ic_favorite_border_24dp); + mFavoriteSubscribedUserData.get(position).setFavorite(false); + FavoriteThing.unfavoriteUser(mOauthRetrofit, mRedditDataRoomDatabase, mAccessToken, + mFavoriteSubscribedUserData.get(position), + new FavoriteThing.FavoriteThingListener() { + @Override + public void success() { + int position = getAdapterPosition() - 1; + if(position >= 0 && mFavoriteSubscribedUserData.size() > position) { + mFavoriteSubscribedUserData.get(position).setFavorite(false); + } + favoriteImageView.setImageResource(R.drawable.ic_favorite_border_24dp); + } + + @Override + public void failed() { + Toast.makeText(mContext, R.string.thing_unfavorite_failed, Toast.LENGTH_SHORT).show(); + int position = getAdapterPosition() - 1; + if(position >= 0 && mFavoriteSubscribedUserData.size() > position) { + mFavoriteSubscribedUserData.get(position).setFavorite(true); + } + favoriteImageView.setImageResource(R.drawable.ic_favorite_24dp); + } + }); + } else { + favoriteImageView.setImageResource(R.drawable.ic_favorite_24dp); + mFavoriteSubscribedUserData.get(position).setFavorite(true); + FavoriteThing.favoriteUser(mOauthRetrofit, mRedditDataRoomDatabase, mAccessToken, + mFavoriteSubscribedUserData.get(position), + new FavoriteThing.FavoriteThingListener() { + @Override + public void success() { + int position = getAdapterPosition() - 1; + if(position >= 0 && mFavoriteSubscribedUserData.size() > position) { + mFavoriteSubscribedUserData.get(position).setFavorite(true); + } + favoriteImageView.setImageResource(R.drawable.ic_favorite_24dp); + } + + @Override + public void failed() { + Toast.makeText(mContext, R.string.thing_favorite_failed, Toast.LENGTH_SHORT).show(); + int position = getAdapterPosition() - 1; + if(position >= 0 && mFavoriteSubscribedUserData.size() > position) { + mFavoriteSubscribedUserData.get(position).setFavorite(false); + } + favoriteImageView.setImageResource(R.drawable.ic_favorite_border_24dp); + } + }); + } + } + }); } } @@ -332,6 +280,77 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc super(itemView); ButterKnife.bind(this, itemView); userNameTextView.setTextColor(mPrimaryTextColor); + + itemView.setOnClickListener(view -> { + int offset = (mFavoriteSubscribedUserData != null && mFavoriteSubscribedUserData.size() > 0) ? + mFavoriteSubscribedUserData.size() + 2 : 0; + int position = getAdapterPosition() - offset; + if(position >= 0 && mSubscribedUserData.size() > position) { + Intent intent = new Intent(mContext, ViewUserDetailActivity.class); + intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, mSubscribedUserData.get(position).getName()); + mContext.startActivity(intent); + } + }); + + favoriteImageView.setOnClickListener(view -> { + int offset = (mFavoriteSubscribedUserData != null && mFavoriteSubscribedUserData.size() > 0) ? + mFavoriteSubscribedUserData.size() + 2 : 0; + int position = getAdapterPosition() - offset; + + if(position >= 0 && mSubscribedUserData.size() > position) { + if(mSubscribedUserData.get(position).isFavorite()) { + favoriteImageView.setImageResource(R.drawable.ic_favorite_border_24dp); + mSubscribedUserData.get(position).setFavorite(false); + FavoriteThing.unfavoriteUser(mOauthRetrofit, mRedditDataRoomDatabase, mAccessToken, + mSubscribedUserData.get(position), + new FavoriteThing.FavoriteThingListener() { + @Override + public void success() { + int position = getAdapterPosition() - offset; + if(position >= 0 && mSubscribedUserData.size() > position) { + mSubscribedUserData.get(position).setFavorite(false); + } + favoriteImageView.setImageResource(R.drawable.ic_favorite_border_24dp); + } + + @Override + public void failed() { + Toast.makeText(mContext, R.string.thing_unfavorite_failed, Toast.LENGTH_SHORT).show(); + int position = getAdapterPosition() - offset; + if(position >= 0 && mSubscribedUserData.size() > position) { + mSubscribedUserData.get(position).setFavorite(true); + } + favoriteImageView.setImageResource(R.drawable.ic_favorite_24dp); + } + }); + } else { + favoriteImageView.setImageResource(R.drawable.ic_favorite_24dp); + mSubscribedUserData.get(position).setFavorite(true); + FavoriteThing.favoriteUser(mOauthRetrofit, mRedditDataRoomDatabase, mAccessToken, + mSubscribedUserData.get(position), + new FavoriteThing.FavoriteThingListener() { + @Override + public void success() { + int position = getAdapterPosition() - offset; + if(position >= 0 && mSubscribedUserData.size() > position) { + mSubscribedUserData.get(position).setFavorite(true); + } + favoriteImageView.setImageResource(R.drawable.ic_favorite_24dp); + } + + @Override + public void failed() { + Toast.makeText(mContext, R.string.thing_favorite_failed, Toast.LENGTH_SHORT).show(); + int position = getAdapterPosition() - offset; + if(position >= 0 && mSubscribedUserData.size() > position) { + mSubscribedUserData.get(position).setFavorite(false); + } + favoriteImageView.setImageResource(R.drawable.ic_favorite_border_24dp); + } + }); + } + } + }); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java index b4d74f96..04ec62f2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java @@ -121,6 +121,11 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl int start = 0; boolean find = false; while (matcher.find(start)) { + if (markdownStringBuilder.length() < 4 + || matcher.start() < 0 + || matcher.end() > markdownStringBuilder.length()) { + break; + } find = true; markdownStringBuilder.delete(matcher.end() - 2, matcher.end()); markdownStringBuilder.delete(matcher.start(), matcher.start() + 2); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterRecyclerViewAdapter.java new file mode 100644 index 00000000..344e968c --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterRecyclerViewAdapter.java @@ -0,0 +1,85 @@ +package ml.docilealligator.infinityforreddit.adapters; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import java.util.List; + +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.postfilter.PostFilter; + +public class PostFilterRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { + + private static final int VIEW_TYPE_HEADER = 1; + private static final int VIEW_TYPE_POST_FILTER = 2; + + private final OnItemClickListener onItemClickListener; + private List<PostFilter> postFilterList; + + public interface OnItemClickListener { + void onItemClick(PostFilter postFilter); + } + + public PostFilterRecyclerViewAdapter(OnItemClickListener onItemClickListener) { + this.onItemClickListener = onItemClickListener; + } + + @Override + public int getItemViewType(int position) { + if (position == 0) { + return VIEW_TYPE_HEADER; + } + return VIEW_TYPE_POST_FILTER; + } + + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + if (viewType == VIEW_TYPE_HEADER) { + return new HeaderViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_filter_fragment_header, parent, false)); + } else { + return new PostFilterViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_filter, parent, false)); + } + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + if (holder instanceof PostFilterViewHolder) { + ((PostFilterViewHolder) holder).textView.setText(postFilterList.get(position - 1).name); + } + } + + @Override + public int getItemCount() { + return postFilterList == null ? 1 : 1 + postFilterList.size(); + } + + public void setPostFilterList(List<PostFilter> postFilterList) { + this.postFilterList = postFilterList; + notifyDataSetChanged(); + } + + private class PostFilterViewHolder extends RecyclerView.ViewHolder { + TextView textView; + + public PostFilterViewHolder(@NonNull View itemView) { + super(itemView); + textView = (TextView) itemView; + itemView.setOnClickListener(view -> { + onItemClickListener.onItemClick(postFilterList.get(getAdapterPosition() - 1)); + }); + } + } + + private static class HeaderViewHolder extends RecyclerView.ViewHolder { + + public HeaderViewHolder(@NonNull View itemView) { + super(itemView); + } + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterUsageRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterUsageRecyclerViewAdapter.java new file mode 100644 index 00000000..d6d4c938 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterUsageRecyclerViewAdapter.java @@ -0,0 +1,93 @@ +package ml.docilealligator.infinityforreddit.adapters; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import java.util.List; + +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.postfilter.PostFilterUsage; + +public class PostFilterUsageRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { + private List<PostFilterUsage> postFilterUsages; + private OnItemClickListener onItemClickListener; + private Context context; + + public interface OnItemClickListener { + void onClick(PostFilterUsage postFilterUsage); + } + + public PostFilterUsageRecyclerViewAdapter(Context context, + OnItemClickListener onItemClickListener) { + this.context = context; + this.onItemClickListener = onItemClickListener; + } + + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + return new PostFilterUsageViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_filter_usage, parent, false)); + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + PostFilterUsage postFilterUsage = postFilterUsages.get(position); + switch (postFilterUsage.usage) { + case PostFilterUsage.HOME_TYPE: + ((PostFilterUsageViewHolder) holder).usageTextView.setText(R.string.post_filter_usage_home); + break; + case PostFilterUsage.SUBREDDIT_TYPE: + if (postFilterUsage.nameOfUsage.equals(PostFilterUsage.NO_USAGE)) { + ((PostFilterUsageViewHolder) holder).usageTextView.setText(R.string.post_filter_usage_subreddit_all); + } else { + ((PostFilterUsageViewHolder) holder).usageTextView.setText(context.getString(R.string.post_filter_usage_subreddit, postFilterUsage.nameOfUsage)); + } + break; + case PostFilterUsage.USER_TYPE: + if (postFilterUsage.nameOfUsage.equals(PostFilterUsage.NO_USAGE)) { + ((PostFilterUsageViewHolder) holder).usageTextView.setText(R.string.post_filter_usage_user_all); + } else { + ((PostFilterUsageViewHolder) holder).usageTextView.setText(context.getString(R.string.post_filter_usage_user, postFilterUsage.nameOfUsage)); + } + break; + case PostFilterUsage.MULTIREDDIT_TYPE: + if (postFilterUsage.nameOfUsage.equals(PostFilterUsage.NO_USAGE)) { + ((PostFilterUsageViewHolder) holder).usageTextView.setText(R.string.post_filter_usage_multireddit_all); + } else { + ((PostFilterUsageViewHolder) holder).usageTextView.setText(context.getString(R.string.post_filter_usage_multireddit, postFilterUsage.nameOfUsage)); + } + break; + case PostFilterUsage.SEARCH_TYPE: + ((PostFilterUsageViewHolder) holder).usageTextView.setText(R.string.post_filter_usage_search); + } + } + + @Override + public int getItemCount() { + return postFilterUsages == null ? 0 : postFilterUsages.size(); + } + + public void setPostFilterUsages(List<PostFilterUsage> postFilterUsages) { + this.postFilterUsages = postFilterUsages; + notifyDataSetChanged(); + } + + private class PostFilterUsageViewHolder extends RecyclerView.ViewHolder { + TextView usageTextView; + + public PostFilterUsageViewHolder(@NonNull View itemView) { + super(itemView); + usageTextView = (TextView) itemView; + + usageTextView.setOnClickListener(view -> { + onItemClickListener.onClick(postFilterUsages.get(getAdapterPosition())); + }); + } + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java index 52e25fe5..4abf2e55 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java @@ -69,7 +69,14 @@ import im.ene.toro.media.PlaybackInfo; import im.ene.toro.widget.Container; import jp.wasabeef.glide.transformations.BlurTransformation; import jp.wasabeef.glide.transformations.RoundedCornersTransformation; -import ml.docilealligator.infinityforreddit.activities.FilteredThingActivity; +import ml.docilealligator.infinityforreddit.FetchGfycatOrRedgifsVideoLinks; +import ml.docilealligator.infinityforreddit.MarkPostAsReadInterface; +import ml.docilealligator.infinityforreddit.NetworkState; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.SaveThing; +import ml.docilealligator.infinityforreddit.VoteThing; +import ml.docilealligator.infinityforreddit.activities.FilteredPostsActivity; import ml.docilealligator.infinityforreddit.activities.LinkResolverActivity; import ml.docilealligator.infinityforreddit.activities.ViewImageOrGifActivity; import ml.docilealligator.infinityforreddit.activities.ViewPostDetailActivity; @@ -83,18 +90,12 @@ import ml.docilealligator.infinityforreddit.bottomsheetfragments.ShareLinkBottom import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customviews.AspectRatioGifImageView; import ml.docilealligator.infinityforreddit.events.PostUpdateEventToDetailActivity; -import ml.docilealligator.infinityforreddit.FetchGfycatOrRedgifsVideoLinks; -import ml.docilealligator.infinityforreddit.NetworkState; import ml.docilealligator.infinityforreddit.post.Post; import ml.docilealligator.infinityforreddit.post.PostDataSource; -import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; -import ml.docilealligator.infinityforreddit.SaveThing; import ml.docilealligator.infinityforreddit.user.UserDao; import ml.docilealligator.infinityforreddit.utils.APIUtils; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; import ml.docilealligator.infinityforreddit.utils.Utils; -import ml.docilealligator.infinityforreddit.VoteThing; import pl.droidsonroids.gif.GifImageView; import retrofit2.Retrofit; @@ -141,10 +142,13 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView private int mColorPrimaryLightTheme; private int mColorAccent; private int mCardViewBackgroundColor; + private int mReadPostCardViewBackgroundColor; private int mPrimaryTextColor; private int mSecondaryTextColor; private int mPostTitleColor; private int mPostContentColor; + private int mReadPostTitleColor; + private int mReadPostContentColor; private int mStickiedPostIconTint; private int mPostTypeBackgroundColor; private int mPostTypeTextColor; @@ -169,6 +173,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView private int mButtonTextColor; private int mPostIconAndInfoColor; private int mDividerColor; + private int mHideReadPostsIndex = 0; private float mScale; private boolean mDisplaySubredditName; private boolean mVoteButtonsOnTheRight; @@ -189,11 +194,13 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView private boolean mCompactLayoutToolbarHiddenByDefault; private boolean mDataSavingMode = false; private boolean mDisableImagePreview = false; + private boolean mMarkPostsAsRead; + private boolean mMarkPostsAsReadAfterVoting; + private boolean mHideReadPostsAutomatically; private Drawable mCommentIcon; private NetworkState networkState; private ExoCreator mExoCreator; private Callback mCallback; - private ShareLinkBottomSheetFragment mShareLinkBottomSheetFragment; public PostRecyclerViewAdapter(AppCompatActivity activity, Retrofit oauthRetrofit, Retrofit retrofit, Retrofit gfycatRetrofit, Retrofit redgifsRetrofit, @@ -201,6 +208,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView CustomThemeWrapper customThemeWrapper, Locale locale, int imageViewWidth, String accessToken, String accountName, int postType, int postLayout, boolean displaySubredditName, SharedPreferences sharedPreferences, SharedPreferences nsfwAndSpoilerSharedPreferences, + SharedPreferences postHistorySharedPreferences, ExoCreator exoCreator, Callback callback) { super(DIFF_CALLBACK); if (activity != null) { @@ -251,15 +259,22 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView } mDisableImagePreview = sharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_IMAGE_PREVIEW, false); + mMarkPostsAsRead = postHistorySharedPreferences.getBoolean((accountName == null ? "" : accountName) + SharedPreferencesUtils.MARK_POSTS_AS_READ_BASE, false); + mMarkPostsAsReadAfterVoting = postHistorySharedPreferences.getBoolean((accountName == null ? "" : accountName) + SharedPreferencesUtils.MARK_POSTS_AS_READ_AFTER_VOTING_BASE, false); + mHideReadPostsAutomatically = postHistorySharedPreferences.getBoolean((accountName == null ? "" : accountName) + SharedPreferencesUtils.HIDE_READ_POSTS_AUTOMATICALLY_BASE, false); + mPostLayout = postLayout; mColorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme(); mColorAccent = customThemeWrapper.getColorAccent(); mCardViewBackgroundColor = customThemeWrapper.getCardViewBackgroundColor(); + mReadPostCardViewBackgroundColor = customThemeWrapper.getReadPostCardViewBackgroundColor(); mPrimaryTextColor = customThemeWrapper.getPrimaryTextColor(); mSecondaryTextColor = customThemeWrapper.getSecondaryTextColor(); mPostTitleColor = customThemeWrapper.getPostTitleColor(); mPostContentColor = customThemeWrapper.getPostContentColor(); + mReadPostTitleColor = customThemeWrapper.getReadPostTitleColor(); + mReadPostContentColor = customThemeWrapper.getReadPostContentColor(); mStickiedPostIconTint = customThemeWrapper.getStickiedPostIconTint(); mPostTypeBackgroundColor = customThemeWrapper.getPostTypeBackgroundColor(); mPostTypeTextColor = customThemeWrapper.getPostTypeTextColor(); @@ -297,7 +312,6 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView mUserDao = redditDataRoomDatabase.userDao(); mExoCreator = exoCreator; mCallback = callback; - mShareLinkBottomSheetFragment = new ShareLinkBottomSheetFragment(); } } @@ -388,11 +402,25 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView if (holder instanceof PostBaseViewHolder) { Post post = getItem(position); if (post != null) { + if (post.isRead()) { + if (mHideReadPostsAutomatically || position < mHideReadPostsIndex) { + post.hidePostInRecyclerView(); + holder.itemView.setVisibility(View.GONE); + RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) holder.itemView.getLayoutParams(); + params.height = 0; + params.topMargin = 0; + params.bottomMargin = 0; + holder.itemView.setLayoutParams(params); + return; + } + holder.itemView.setBackgroundTintList(ColorStateList.valueOf(mReadPostCardViewBackgroundColor)); + ((PostBaseViewHolder) holder).titleTextView.setTextColor(mReadPostTitleColor); + } String subredditNamePrefixed = post.getSubredditNamePrefixed(); String subredditName = subredditNamePrefixed.substring(2); String authorPrefixed = "u/" + post.getAuthor(); String flair = post.getFlair(); - int nAwards = post.getnAwards(); + int nAwards = post.getNAwards(); ((PostBaseViewHolder) holder).subredditTextView.setText(subredditNamePrefixed); ((PostBaseViewHolder) holder).userTextView.setText(authorPrefixed); @@ -685,6 +713,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView } else if (holder instanceof PostTextTypeViewHolder) { if (!post.isSpoiler() && post.getSelfTextPlainTrimmed() != null && !post.getSelfTextPlainTrimmed().equals("")) { ((PostTextTypeViewHolder) holder).contentTextView.setVisibility(View.VISIBLE); + if (post.isRead()) { + ((PostTextTypeViewHolder) holder).contentTextView.setTextColor(mReadPostContentColor); + } ((PostTextTypeViewHolder) holder).contentTextView.setText(post.getSelfTextPlainTrimmed()); } } @@ -693,6 +724,18 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView } else if (holder instanceof PostCompactBaseViewHolder) { Post post = getItem(position); if (post != null) { + if (post.isRead()) { + if (mHideReadPostsAutomatically || position < mHideReadPostsIndex) { + post.hidePostInRecyclerView(); + holder.itemView.setVisibility(View.GONE); + ViewGroup.LayoutParams params = holder.itemView.getLayoutParams(); + params.height = 0; + holder.itemView.setLayoutParams(params); + return; + } + holder.itemView.setBackgroundColor(mReadPostCardViewBackgroundColor); + ((PostCompactBaseViewHolder) holder).titleTextView.setTextColor(mReadPostTitleColor); + } final String subredditNamePrefixed = post.getSubredditNamePrefixed(); String subredditName = subredditNamePrefixed.substring(2); String authorPrefixed = "u/" + post.getAuthor(); @@ -701,7 +744,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView boolean nsfw = post.isNSFW(); boolean spoiler = post.isSpoiler(); String flair = post.getFlair(); - int nAwards = post.getnAwards(); + int nAwards = post.getNAwards(); boolean isArchived = post.isArchived(); if (mDisplaySubredditName) { @@ -996,27 +1039,29 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView previewIndex = 0; } preview = previews.get(previewIndex); - if (preview.getPreviewWidth() * preview.getPreviewHeight() >= 75_000_000) { + if (preview.getPreviewWidth() * preview.getPreviewHeight() > 35_000_000) { for (int i = previews.size() - 1; i >= 1; i--) { preview = previews.get(i); if (mImageViewWidth >= preview.getPreviewWidth()) { - if (preview.getPreviewWidth() * preview.getPreviewHeight() <= 75_000_000) { + if (preview.getPreviewWidth() * preview.getPreviewHeight() <= 35_000_000) { return preview; } } else { int height = mImageViewWidth / preview.getPreviewWidth() * preview.getPreviewHeight(); - if (mImageViewWidth * height <= 75_000_000) { + if (mImageViewWidth * height <= 35_000_000) { return preview; } } } } - int divisor = 2; - while (preview.getPreviewWidth() * preview.getPreviewHeight() / divisor / divisor > 75_000_000) { - preview.setPreviewWidth(preview.getPreviewWidth() / divisor); - preview.setPreviewHeight(preview.getPreviewHeight() / divisor); - divisor *= 2; + if (preview.getPreviewWidth() * preview.getPreviewHeight() > 35_000_000) { + int divisor = 2; + do { + preview.setPreviewWidth(preview.getPreviewWidth() / divisor); + preview.setPreviewHeight(preview.getPreviewHeight() / divisor); + divisor *= 2; + } while (preview.getPreviewWidth() * preview.getPreviewHeight() / divisor / divisor > 35_000_000); } return preview; @@ -1117,8 +1162,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView break; } } - mShareLinkBottomSheetFragment.setArguments(bundle); - mShareLinkBottomSheetFragment.show(mActivity.getSupportFragmentManager(), mShareLinkBottomSheetFragment.getTag()); + ShareLinkBottomSheetFragment shareLinkBottomSheetFragment = new ShareLinkBottomSheetFragment(); + shareLinkBottomSheetFragment.setArguments(bundle); + shareLinkBottomSheetFragment.show(mActivity.getSupportFragmentManager(), shareLinkBottomSheetFragment.getTag()); } @Override @@ -1170,6 +1216,32 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView mShowAbsoluteNumberOfVotes = showAbsoluteNumberOfVotes; } + public int getHideReadPostsIndex() { + return mHideReadPostsIndex; + } + + public void setHideReadPostsIndex(int hideReadPostsIndex) { + mHideReadPostsIndex = hideReadPostsIndex; + } + + public void prepareToHideReadPosts() { + mHideReadPostsIndex = getItemCount(); + } + + public int getNextItemPositionWithoutBeingHidden(int fromPosition) { + int temp = fromPosition; + while (temp >= 0 && temp < super.getItemCount()) { + Post post = getItem(temp); + if (post != null && post.isHiddenInRecyclerView()) { + temp++; + } else { + break; + } + } + + return temp; + } + private boolean hasExtraRow() { return networkState != null && networkState.getStatus() != NetworkState.Status.SUCCESS; } @@ -1246,6 +1318,15 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) { super.onViewRecycled(holder); if (holder instanceof PostBaseViewHolder) { + ((PostBaseViewHolder) holder).itemView.setVisibility(View.VISIBLE); + RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) holder.itemView.getLayoutParams(); + params.height = ViewGroup.LayoutParams.WRAP_CONTENT; + int marginPixel = (int) Utils.convertDpToPixel(8, mActivity); + params.topMargin = marginPixel; + params.bottomMargin = marginPixel; + holder.itemView.setLayoutParams(params); + ((PostBaseViewHolder) holder).itemView.setBackgroundTintList(ColorStateList.valueOf(mCardViewBackgroundColor)); + ((PostBaseViewHolder) holder).titleTextView.setTextColor(mPostTitleColor); if (holder instanceof PostVideoAutoplayViewHolder) { ((PostVideoAutoplayViewHolder) holder).mediaUri = null; if (((PostVideoAutoplayViewHolder) holder).fetchGfycatOrRedgifsVideoLinks != null) { @@ -1266,6 +1347,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView ((PostWithPreviewTypeViewHolder) holder).linkTextView.setVisibility(View.GONE); } else if (holder instanceof PostTextTypeViewHolder) { ((PostTextTypeViewHolder) holder).contentTextView.setText(""); + ((PostTextTypeViewHolder) holder).contentTextView.setTextColor(mPostContentColor); ((PostTextTypeViewHolder) holder).contentTextView.setVisibility(View.GONE); } @@ -1284,6 +1366,12 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView ((PostBaseViewHolder) holder).scoreTextView.setTextColor(mPostIconAndInfoColor); ((PostBaseViewHolder) holder).downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); } else if (holder instanceof PostCompactBaseViewHolder) { + ((PostCompactBaseViewHolder) holder).itemView.setVisibility(View.VISIBLE); + ViewGroup.LayoutParams params = holder.itemView.getLayoutParams(); + params.height = ViewGroup.LayoutParams.WRAP_CONTENT; + holder.itemView.setLayoutParams(params); + ((PostCompactBaseViewHolder) holder).itemView.setBackgroundColor(mCardViewBackgroundColor); + ((PostCompactBaseViewHolder) holder).titleTextView.setTextColor(mPostTitleColor); mGlide.clear(((PostCompactBaseViewHolder) holder).imageView); mGlide.clear(((PostCompactBaseViewHolder) holder).iconGifImageView); ((PostCompactBaseViewHolder) holder).stickiedPostImageView.setVisibility(View.GONE); @@ -1364,6 +1452,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView void typeChipClicked(int filter); + void nsfwChipClicked(); + void currentlyBindItem(int position); void delayTransition(); @@ -1498,12 +1588,16 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView cardView.setOnClickListener(view -> { int position = getAdapterPosition(); if (position >= 0 && canStartActivity) { - canStartActivity = false; + Post post = getItem(position); + if (post != null) { + markPostRead(post); + canStartActivity = false; - Intent intent = new Intent(mActivity, ViewPostDetailActivity.class); - intent.putExtra(ViewPostDetailActivity.EXTRA_POST_DATA, getItem(position)); - intent.putExtra(ViewPostDetailActivity.EXTRA_POST_LIST_POSITION, getAdapterPosition()); - mActivity.startActivity(intent); + Intent intent = new Intent(mActivity, ViewPostDetailActivity.class); + intent.putExtra(ViewPostDetailActivity.EXTRA_POST_DATA, post); + intent.putExtra(ViewPostDetailActivity.EXTRA_POST_LIST_POSITION, getAdapterPosition()); + mActivity.startActivity(intent); + } } }); @@ -1576,7 +1670,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView iconGifImageView.setOnClickListener(view -> userTextView.performClick()); } - if (!(mActivity instanceof FilteredThingActivity)) { + if (!(mActivity instanceof FilteredPostsActivity)) { nsfwTextView.setOnClickListener(view -> { int position = getAdapterPosition(); if (position < 0) { @@ -1584,11 +1678,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView } Post post = getItem(position); if (post != null) { - Intent intent = new Intent(mActivity, FilteredThingActivity.class); - intent.putExtra(FilteredThingActivity.EXTRA_NAME, post.getSubredditNamePrefixed().substring(2)); - intent.putExtra(FilteredThingActivity.EXTRA_POST_TYPE, PostDataSource.TYPE_SUBREDDIT); - intent.putExtra(FilteredThingActivity.EXTRA_FILTER, Post.NSFW_TYPE); - mActivity.startActivity(intent); + mCallback.nsfwChipClicked(); } }); typeTextView.setOnClickListener(view -> { @@ -1615,6 +1705,10 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView return; } + if (mMarkPostsAsReadAfterVoting) { + markPostRead(post); + } + if (post.isArchived()) { Toast.makeText(mActivity, R.string.archived_post_vote_unavailable, Toast.LENGTH_SHORT).show(); return; @@ -1649,19 +1743,25 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView VoteThing.voteThing(mActivity, mOauthRetrofit, mAccessToken, new VoteThing.VoteThingListener() { @Override public void onVoteThingSuccess(int position1) { + int currentPosition = getAdapterPosition(); if (newVoteType.equals(APIUtils.DIR_UPVOTE)) { post.setVoteType(1); - upvoteButton - .setColorFilter(mUpvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); - scoreTextView.setTextColor(mUpvotedColor); + if (currentPosition == position) { + upvoteButton.setColorFilter(mUpvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); + scoreTextView.setTextColor(mUpvotedColor); + } } else { post.setVoteType(0); - upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); - scoreTextView.setTextColor(mPostIconAndInfoColor); + if (currentPosition == position) { + upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + scoreTextView.setTextColor(mPostIconAndInfoColor); + } } - downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); - scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); + if (currentPosition == position) { + downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); + } EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post)); } @@ -1670,10 +1770,12 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView public void onVoteThingFail(int position1) { Toast.makeText(mActivity, R.string.vote_failed, Toast.LENGTH_SHORT).show(); post.setVoteType(previousVoteType); - scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + previousVoteType)); - upvoteButton.setColorFilter(previousUpvoteButtonColorFilter); - downvoteButton.setColorFilter(previousDownvoteButtonColorFilter); - scoreTextView.setTextColor(previousScoreTextViewColor); + if (getAdapterPosition() == position) { + scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + previousVoteType)); + upvoteButton.setColorFilter(previousUpvoteButtonColorFilter); + downvoteButton.setColorFilter(previousDownvoteButtonColorFilter); + scoreTextView.setTextColor(previousScoreTextViewColor); + } EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post)); } @@ -1693,6 +1795,10 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView return; } + if (mMarkPostsAsReadAfterVoting) { + markPostRead(post); + } + if (post.isArchived()) { Toast.makeText(mActivity, R.string.archived_post_vote_unavailable, Toast.LENGTH_SHORT).show(); return; @@ -1727,19 +1833,25 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView VoteThing.voteThing(mActivity, mOauthRetrofit, mAccessToken, new VoteThing.VoteThingListener() { @Override public void onVoteThingSuccess(int position1) { + int currentPosition = getAdapterPosition(); if (newVoteType.equals(APIUtils.DIR_DOWNVOTE)) { post.setVoteType(-1); - downvoteButton - .setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); - scoreTextView.setTextColor(mDownvotedColor); + if (currentPosition == position) { + downvoteButton.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); + scoreTextView.setTextColor(mDownvotedColor); + } } else { post.setVoteType(0); - downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); - scoreTextView.setTextColor(mPostIconAndInfoColor); + if (currentPosition == position) { + downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + scoreTextView.setTextColor(mPostIconAndInfoColor); + } } - upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); - scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); + if (currentPosition == position) { + upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); + } EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post)); } @@ -1748,10 +1860,12 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView public void onVoteThingFail(int position1) { Toast.makeText(mActivity, R.string.vote_failed, Toast.LENGTH_SHORT).show(); post.setVoteType(previousVoteType); - scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + previousVoteType)); - upvoteButton.setColorFilter(previousUpvoteButtonColorFilter); - downvoteButton.setColorFilter(previousDownvoteButtonColorFilter); - scoreTextView.setTextColor(previousScoreTextViewColor); + if (getAdapterPosition() == position) { + scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + previousVoteType)); + upvoteButton.setColorFilter(previousUpvoteButtonColorFilter); + downvoteButton.setColorFilter(previousDownvoteButtonColorFilter); + scoreTextView.setTextColor(previousScoreTextViewColor); + } EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post)); } @@ -1778,7 +1892,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView @Override public void success() { post.setSaved(false); - saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp); + if (getAdapterPosition() == position) { + saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp); + } Toast.makeText(mActivity, R.string.post_unsaved_success, Toast.LENGTH_SHORT).show(); EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post)); } @@ -1786,7 +1902,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView @Override public void failed() { post.setSaved(true); - saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); + if (getAdapterPosition() == position) { + saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); + } Toast.makeText(mActivity, R.string.post_unsaved_failed, Toast.LENGTH_SHORT).show(); EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post)); } @@ -1798,7 +1916,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView @Override public void success() { post.setSaved(true); - saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); + if (getAdapterPosition() == position) { + saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); + } Toast.makeText(mActivity, R.string.post_saved_success, Toast.LENGTH_SHORT).show(); EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post)); } @@ -1806,7 +1926,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView @Override public void failed() { post.setSaved(false); - saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp); + if (getAdapterPosition() == position) { + saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp); + } Toast.makeText(mActivity, R.string.post_saved_failed, Toast.LENGTH_SHORT).show(); EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post)); } @@ -1826,6 +1948,20 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView } }); } + + void markPostRead(Post post) { + if (mAccessToken != null && !post.isRead() && mMarkPostsAsRead) { + post.markAsRead(); + cardView.setBackgroundTintList(ColorStateList.valueOf(mReadPostCardViewBackgroundColor)); + titleTextView.setTextColor(mReadPostTitleColor); + if (this instanceof PostTextTypeViewHolder) { + ((PostTextTypeViewHolder) this).contentTextView.setTextColor(mReadPostContentColor); + } + if (mActivity != null && mActivity instanceof MarkPostAsReadInterface) { + ((MarkPostAsReadInterface) mActivity).markPostAsRead(post); + } + } + } } class PostVideoAutoplayViewHolder extends PostBaseViewHolder implements ToroPlayer { @@ -1941,6 +2077,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView } Post post = getItem(position); if (post != null) { + markPostRead(post); Intent intent = new Intent(mActivity, ViewVideoActivity.class); if (post.isGfycat()) { intent.putExtra(ViewVideoActivity.EXTRA_VIDEO_TYPE, ViewVideoActivity.VIDEO_TYPE_GFYCAT); @@ -2185,6 +2322,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView } Post post = getItem(position); if (post != null) { + ((PostBaseViewHolder) this).markPostRead(post); if (post.getPostType() == Post.VIDEO_TYPE) { Intent intent = new Intent(mActivity, ViewVideoActivity.class); if (post.isGfycat()) { @@ -2470,6 +2608,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView } Post post = getItem(position); if (post != null && canStartActivity) { + markPostRead(post); canStartActivity = false; Intent intent = new Intent(mActivity, ViewPostDetailActivity.class); @@ -2532,12 +2671,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView return; } Post post = getItem(position); - if (post != null && !(mActivity instanceof FilteredThingActivity)) { - Intent intent = new Intent(mActivity, FilteredThingActivity.class); - intent.putExtra(FilteredThingActivity.EXTRA_NAME, post.getSubredditNamePrefixed().substring(2)); - intent.putExtra(FilteredThingActivity.EXTRA_POST_TYPE, PostDataSource.TYPE_SUBREDDIT); - intent.putExtra(FilteredThingActivity.EXTRA_FILTER, Post.NSFW_TYPE); - mActivity.startActivity(intent); + if (post != null && !(mActivity instanceof FilteredPostsActivity)) { + mCallback.nsfwChipClicked(); } }); @@ -2547,7 +2682,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView return; } Post post = getItem(position); - if (post != null && !(mActivity instanceof FilteredThingActivity)) { + if (post != null && !(mActivity instanceof FilteredPostsActivity)) { mCallback.typeChipClicked(post.getPostType()); } }); @@ -2559,6 +2694,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView } Post post = getItem(position); if (post != null) { + markPostRead(post); if (post.getPostType() == Post.VIDEO_TYPE) { Intent intent = new Intent(mActivity, ViewVideoActivity.class); if (post.isGfycat()) { @@ -2627,6 +2763,10 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView } Post post = getItem(position); if (post != null) { + if (mMarkPostsAsReadAfterVoting) { + markPostRead(post); + } + if (post.isArchived()) { Toast.makeText(mActivity, R.string.archived_post_vote_unavailable, Toast.LENGTH_SHORT).show(); return; @@ -2661,19 +2801,25 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView VoteThing.voteThing(mActivity, mOauthRetrofit, mAccessToken, new VoteThing.VoteThingListener() { @Override public void onVoteThingSuccess(int position1) { + int currentPosition = getAdapterPosition(); if (newVoteType.equals(APIUtils.DIR_UPVOTE)) { post.setVoteType(1); - upvoteButton - .setColorFilter(mUpvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); - scoreTextView.setTextColor(mUpvotedColor); + if (currentPosition == position) { + upvoteButton.setColorFilter(mUpvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); + scoreTextView.setTextColor(mUpvotedColor); + } } else { post.setVoteType(0); - upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); - scoreTextView.setTextColor(mPostIconAndInfoColor); + if (currentPosition == position) { + upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + scoreTextView.setTextColor(mPostIconAndInfoColor); + } } - downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); - scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); + if (currentPosition == position) { + downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); + } EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post)); } @@ -2682,10 +2828,12 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView public void onVoteThingFail(int position1) { Toast.makeText(mActivity, R.string.vote_failed, Toast.LENGTH_SHORT).show(); post.setVoteType(previousVoteType); - scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + previousVoteType)); - upvoteButton.setColorFilter(previousUpvoteButtonColorFilter); - downvoteButton.setColorFilter(previousDownvoteButtonColorFilter); - scoreTextView.setTextColor(previousScoreTextViewColor); + if (getAdapterPosition() == position) { + scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + previousVoteType)); + upvoteButton.setColorFilter(previousUpvoteButtonColorFilter); + downvoteButton.setColorFilter(previousDownvoteButtonColorFilter); + scoreTextView.setTextColor(previousScoreTextViewColor); + } EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post)); } @@ -2705,6 +2853,10 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView } Post post = getItem(position); if (post != null) { + if (mMarkPostsAsReadAfterVoting) { + markPostRead(post); + } + if (post.isArchived()) { Toast.makeText(mActivity, R.string.archived_post_vote_unavailable, Toast.LENGTH_SHORT).show(); return; @@ -2739,19 +2891,26 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView VoteThing.voteThing(mActivity, mOauthRetrofit, mAccessToken, new VoteThing.VoteThingListener() { @Override public void onVoteThingSuccess(int position1) { + int currentPosition = getAdapterPosition(); if (newVoteType.equals(APIUtils.DIR_DOWNVOTE)) { post.setVoteType(-1); - downvoteButton - .setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); - scoreTextView.setTextColor(mDownvotedColor); + if (currentPosition == position) { + downvoteButton.setColorFilter(mDownvotedColor, android.graphics.PorterDuff.Mode.SRC_IN); + scoreTextView.setTextColor(mDownvotedColor); + } + } else { post.setVoteType(0); - downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); - scoreTextView.setTextColor(mPostIconAndInfoColor); + if (currentPosition == position) { + downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + scoreTextView.setTextColor(mPostIconAndInfoColor); + } } - upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); - scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); + if (currentPosition == position) { + upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + post.getVoteType())); + } EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post)); } @@ -2760,10 +2919,12 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView public void onVoteThingFail(int position1) { Toast.makeText(mActivity, R.string.vote_failed, Toast.LENGTH_SHORT).show(); post.setVoteType(previousVoteType); - scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + previousVoteType)); - upvoteButton.setColorFilter(previousUpvoteButtonColorFilter); - downvoteButton.setColorFilter(previousDownvoteButtonColorFilter); - scoreTextView.setTextColor(previousScoreTextViewColor); + if (getAdapterPosition() == position) { + scoreTextView.setText(Utils.getNVotes(mShowAbsoluteNumberOfVotes, post.getScore() + previousVoteType)); + upvoteButton.setColorFilter(previousUpvoteButtonColorFilter); + downvoteButton.setColorFilter(previousDownvoteButtonColorFilter); + scoreTextView.setTextColor(previousScoreTextViewColor); + } EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post)); } @@ -2790,7 +2951,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView @Override public void success() { post.setSaved(false); - saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp); + if (getAdapterPosition() == position) { + saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp); + } Toast.makeText(mActivity, R.string.post_unsaved_success, Toast.LENGTH_SHORT).show(); EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post)); } @@ -2798,7 +2961,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView @Override public void failed() { post.setSaved(true); - saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); + if (getAdapterPosition() == position) { + saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); + } Toast.makeText(mActivity, R.string.post_unsaved_failed, Toast.LENGTH_SHORT).show(); EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post)); } @@ -2810,7 +2975,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView @Override public void success() { post.setSaved(true); - saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); + if (getAdapterPosition() == position) { + saveButton.setImageResource(R.drawable.ic_bookmark_grey_24dp); + } Toast.makeText(mActivity, R.string.post_saved_success, Toast.LENGTH_SHORT).show(); EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post)); } @@ -2818,7 +2985,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView @Override public void failed() { post.setSaved(false); - saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp); + if (getAdapterPosition() == position) { + saveButton.setImageResource(R.drawable.ic_bookmark_border_grey_24dp); + } Toast.makeText(mActivity, R.string.post_saved_failed, Toast.LENGTH_SHORT).show(); EventBus.getDefault().post(new PostUpdateEventToDetailActivity(post)); } @@ -2838,6 +3007,17 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView } }); } + + void markPostRead(Post post) { + if (mAccessToken != null && !post.isRead() && mMarkPostsAsRead) { + post.markAsRead(); + itemView.setBackgroundColor(mReadPostCardViewBackgroundColor); + titleTextView.setTextColor(mReadPostTitleColor); + if (mActivity != null && mActivity instanceof MarkPostAsReadInterface) { + ((MarkPostAsReadInterface) mActivity).markPostAsRead(post); + } + } + } } class PostCompactLeftThumbnailViewHolder extends PostCompactBaseViewHolder { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/ReportReasonRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/ReportReasonRecyclerViewAdapter.java index 4bb9c255..5e5572ff 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/ReportReasonRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/ReportReasonRecyclerViewAdapter.java @@ -62,9 +62,11 @@ public class ReportReasonRecyclerViewAdapter extends RecyclerView.Adapter<Recycl } public ReportReason getSelectedReason() { - for (ReportReason reportReason : rules) { - if (reportReason.isSelected()) { - return reportReason; + if (rules != null) { + for (ReportReason reportReason : rules) { + if (reportReason.isSelected()) { + return reportReason; + } } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SubredditFilterRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SubredditFilterRecyclerViewAdapter.java deleted file mode 100644 index 330eab39..00000000 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SubredditFilterRecyclerViewAdapter.java +++ /dev/null @@ -1,72 +0,0 @@ -package ml.docilealligator.infinityforreddit.adapters; - -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.recyclerview.widget.RecyclerView; - -import java.util.List; - -import butterknife.BindView; -import butterknife.ButterKnife; -import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.subredditfilter.SubredditFilter; - -public class SubredditFilterRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { - private List<SubredditFilter> subredditFilters; - private ItemClickListener itemClickListener; - - public SubredditFilterRecyclerViewAdapter(ItemClickListener itemClickListener) { - this.itemClickListener = itemClickListener; - } - - public interface ItemClickListener { - void onItemDelete(SubredditFilter subredditFilter); - } - - @NonNull - @Override - public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - return new SubredditNameViewHolder(LayoutInflater.from(parent.getContext()) - .inflate(R.layout.item_selected_subreddit, parent, false)); - } - - @Override - public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { - if (holder instanceof SubredditNameViewHolder) { - ((SubredditNameViewHolder) holder).subredditRedditNameTextView.setText(subredditFilters.get(position).getSubredditName()); - } - } - - @Override - public int getItemCount() { - return subredditFilters == null ? 0 : subredditFilters.size(); - } - - public void updateSubredditsName(List<SubredditFilter> subredditFilters) { - this.subredditFilters = subredditFilters; - notifyDataSetChanged(); - } - - class SubredditNameViewHolder extends RecyclerView.ViewHolder { - @BindView(R.id.subreddit_name_item_selected_subreddit) - TextView subredditRedditNameTextView; - @BindView(R.id.delete_image_view_item_selected_subreddit) - ImageView deleteImageView; - - public SubredditNameViewHolder(@NonNull View itemView) { - super(itemView); - - ButterKnife.bind(this, itemView); - - deleteImageView.setOnClickListener(view -> { - itemClickListener.onItemDelete(subredditFilters.get(getAdapterPosition())); - }); - } - } - -} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/DeleteAllReadPostsAsyncTask.java b/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/DeleteAllReadPostsAsyncTask.java new file mode 100644 index 00000000..34098ef2 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/DeleteAllReadPostsAsyncTask.java @@ -0,0 +1,33 @@ +package ml.docilealligator.infinityforreddit.asynctasks; + +import android.os.AsyncTask; + +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; + +public class DeleteAllReadPostsAsyncTask extends AsyncTask<Void, Void, Void> { + + public interface DeleteAllReadPostsAsyncTaskListener { + void success(); + } + + private RedditDataRoomDatabase redditDataRoomDatabase; + private DeleteAllReadPostsAsyncTaskListener deleteAllReadPostsAsyncTaskListener; + + public DeleteAllReadPostsAsyncTask(RedditDataRoomDatabase redditDataRoomDatabase, + DeleteAllReadPostsAsyncTaskListener deleteAllReadPostsAsyncTaskListener) { + this.redditDataRoomDatabase = redditDataRoomDatabase; + this.deleteAllReadPostsAsyncTaskListener = deleteAllReadPostsAsyncTaskListener; + } + + @Override + protected Void doInBackground(Void... voids) { + redditDataRoomDatabase.readPostDao().deleteAllReadPosts(); + return null; + } + + @Override + protected void onPostExecute(Void aVoid) { + super.onPostExecute(aVoid); + deleteAllReadPostsAsyncTaskListener.success(); + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/FABMoreOptionsBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/FABMoreOptionsBottomSheetFragment.java index a0061ff8..13cc45cf 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/FABMoreOptionsBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/FABMoreOptionsBottomSheetFragment.java @@ -17,6 +17,7 @@ import ml.docilealligator.infinityforreddit.R; public class FABMoreOptionsBottomSheetFragment extends RoundedBottomSheetDialogFragment { + public static final String EXTRA_ANONYMOUS_MODE = "EAM"; public static final int FAB_OPTION_SUBMIT_POST = 0; public static final int FAB_OPTION_REFRESH = 1; public static final int FAB_OPTION_CHANGE_SORT_TYPE = 2; @@ -25,6 +26,8 @@ public class FABMoreOptionsBottomSheetFragment extends RoundedBottomSheetDialogF public static final int FAB_OPTION_GO_TO_SUBREDDIT = 5; public static final int FAB_OPTION_GO_TO_USER = 6; public static final int FAB_RANDOM = 7; + public static final int FAB_HIDE_READ_POSTS = 8; + public static final int FAB_FILTER_POSTS = 9; @BindView(R.id.submit_post_text_view_fab_more_options_bottom_sheet_fragment) TextView submitPostTextView; @@ -42,6 +45,10 @@ public class FABMoreOptionsBottomSheetFragment extends RoundedBottomSheetDialogF TextView goToUserTextView; @BindView(R.id.random_text_view_fab_more_options_bottom_sheet_fragment) TextView randomTextView; + @BindView(R.id.hide_read_posts_text_view_fab_more_options_bottom_sheet_fragment) + TextView hideReadPostsTextView; + @BindView(R.id.filter_posts_text_view_fab_more_options_bottom_sheet_fragment) + TextView filterPostsTextView; private FABOptionSelectionCallback activity; public FABMoreOptionsBottomSheetFragment() { @@ -56,10 +63,20 @@ public class FABMoreOptionsBottomSheetFragment extends RoundedBottomSheetDialogF ButterKnife.bind(this, rootView); - submitPostTextView.setOnClickListener(view -> { - activity.fabOptionSelected(FAB_OPTION_SUBMIT_POST); - dismiss(); - }); + if (getArguments() != null && getArguments().getBoolean(EXTRA_ANONYMOUS_MODE, false)) { + submitPostTextView.setVisibility(View.GONE); + hideReadPostsTextView.setVisibility(View.GONE); + } else { + submitPostTextView.setOnClickListener(view -> { + activity.fabOptionSelected(FAB_OPTION_SUBMIT_POST); + dismiss(); + }); + + hideReadPostsTextView.setOnClickListener(view -> { + activity.fabOptionSelected(FAB_HIDE_READ_POSTS); + dismiss(); + }); + } refreshTextView.setOnClickListener(view -> { activity.fabOptionSelected(FAB_OPTION_REFRESH); @@ -96,6 +113,11 @@ public class FABMoreOptionsBottomSheetFragment extends RoundedBottomSheetDialogF dismiss(); }); + filterPostsTextView.setOnClickListener(view -> { + activity.fabOptionSelected(FAB_FILTER_POSTS); + dismiss(); + }); + return rootView; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/FilteredThingFABMoreOptionsBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/FilteredThingFABMoreOptionsBottomSheetFragment.java new file mode 100644 index 00000000..af70869d --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/FilteredThingFABMoreOptionsBottomSheetFragment.java @@ -0,0 +1,63 @@ +package ml.docilealligator.infinityforreddit.bottomsheetfragments; + +import android.content.Context; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import androidx.annotation.NonNull; + +import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; + +import butterknife.BindView; +import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.R; + +public class FilteredThingFABMoreOptionsBottomSheetFragment extends RoundedBottomSheetDialogFragment { + + public static final int FAB_OPTION_FILTER = 0; + public static final int FAB_OPTION_HIDE_READ_POSTS = 1; + + @BindView(R.id.filter_text_view_filtered_thing_fab_more_options_bottom_sheet_fragment) + TextView filterTextView; + @BindView(R.id.hide_read_posts_text_view_filtered_thing_fab_more_options_bottom_sheet_fragment) + TextView hideReadPostsTextView; + private FABOptionSelectionCallback activity; + + public FilteredThingFABMoreOptionsBottomSheetFragment() { + // Required empty public constructor + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + View rootView = inflater.inflate(R.layout.fragment_filtered_thing_fab_more_options_bottom_sheet, container, false); + + ButterKnife.bind(this, rootView); + + filterTextView.setOnClickListener(view -> { + activity.fabOptionSelected(FAB_OPTION_FILTER); + dismiss(); + }); + + hideReadPostsTextView.setOnClickListener(view -> { + activity.fabOptionSelected(FAB_OPTION_HIDE_READ_POSTS); + dismiss(); + }); + + return rootView; + } + + @Override + public void onAttach(@NonNull Context context) { + super.onAttach(context); + activity = (FABOptionSelectionCallback) context; + } + + public interface FABOptionSelectionCallback { + void fabOptionSelected(int option); + } +}
\ No newline at end of file diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/NewPostFilterUsageBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/NewPostFilterUsageBottomSheetFragment.java new file mode 100644 index 00000000..fed822c4 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/NewPostFilterUsageBottomSheetFragment.java @@ -0,0 +1,79 @@ +package ml.docilealligator.infinityforreddit.bottomsheetfragments; + +import android.content.Context; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import androidx.annotation.NonNull; + +import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; + +import butterknife.BindView; +import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.activities.PostFilterUsageListingActivity; +import ml.docilealligator.infinityforreddit.postfilter.PostFilterUsage; + +public class NewPostFilterUsageBottomSheetFragment extends RoundedBottomSheetDialogFragment { + + @BindView(R.id.home_text_view_new_post_filter_usage_bottom_sheet_fragment) + TextView homeTextView; + @BindView(R.id.subreddit_text_view_new_post_filter_usage_bottom_sheet_fragment) + TextView subredditTextView; + @BindView(R.id.user_text_view_new_post_filter_usage_bottom_sheet_fragment) + TextView userTextView; + @BindView(R.id.multireddit_text_view_new_post_filter_usage_bottom_sheet_fragment) + TextView multiRedditTextView; + @BindView(R.id.search_text_view_new_post_filter_usage_bottom_sheet_fragment) + TextView searchTextView; + private PostFilterUsageListingActivity activity; + + public NewPostFilterUsageBottomSheetFragment() { + // Required empty public constructor + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + View rootView = inflater.inflate(R.layout.fragment_new_post_filter_usage_bottom_sheet, container, false); + + ButterKnife.bind(this, rootView); + + homeTextView.setOnClickListener(view -> { + activity.newPostFilterUsage(PostFilterUsage.HOME_TYPE); + dismiss(); + }); + + subredditTextView.setOnClickListener(view -> { + activity.newPostFilterUsage(PostFilterUsage.SUBREDDIT_TYPE); + dismiss(); + }); + + userTextView.setOnClickListener(view -> { + activity.newPostFilterUsage(PostFilterUsage.USER_TYPE); + dismiss(); + }); + + multiRedditTextView.setOnClickListener(view -> { + activity.newPostFilterUsage(PostFilterUsage.MULTIREDDIT_TYPE); + dismiss(); + }); + + searchTextView.setOnClickListener(view -> { + activity.newPostFilterUsage(PostFilterUsage.SEARCH_TYPE); + dismiss(); + }); + + return rootView; + } + + @Override + public void onAttach(@NonNull Context context) { + super.onAttach(context); + activity = (PostFilterUsageListingActivity) context; + } +}
\ No newline at end of file diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostFilterOptionsBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostFilterOptionsBottomSheetFragment.java new file mode 100644 index 00000000..bf1aff0b --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostFilterOptionsBottomSheetFragment.java @@ -0,0 +1,68 @@ +package ml.docilealligator.infinityforreddit.bottomsheetfragments; + +import android.content.Context; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import androidx.annotation.NonNull; + +import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; + +import butterknife.BindView; +import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.activities.PostFilterPreferenceActivity; +import ml.docilealligator.infinityforreddit.postfilter.PostFilter; + +public class PostFilterOptionsBottomSheetFragment extends RoundedBottomSheetDialogFragment { + + @BindView(R.id.edit_text_view_post_filter_options_bottom_sheet_fragment) + TextView editTextView; + @BindView(R.id.apply_to_text_view_post_filter_options_bottom_sheet_fragment) + TextView applyToTextView; + @BindView(R.id.delete_text_view_post_filter_options_bottom_sheet_fragment) + TextView deleteTextView; + public static final String EXTRA_POST_FILTER = "EPF"; + private PostFilterPreferenceActivity activity; + + public PostFilterOptionsBottomSheetFragment() { + // Required empty public constructor + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + View rootView = inflater.inflate(R.layout.fragment_post_filter_options_bottom_sheet, container, false); + + ButterKnife.bind(this, rootView); + + PostFilter postFilter = getArguments().getParcelable(EXTRA_POST_FILTER); + + editTextView.setOnClickListener(view -> { + activity.editPostFilter(postFilter); + dismiss(); + }); + + applyToTextView.setOnClickListener(view -> { + activity.applyPostFilterTo(postFilter); + dismiss(); + }); + + deleteTextView.setOnClickListener(view -> { + activity.deletePostFilter(postFilter); + dismiss(); + }); + + return rootView; + } + + @Override + public void onAttach(@NonNull Context context) { + super.onAttach(context); + activity = (PostFilterPreferenceActivity) context; + } +}
\ No newline at end of file diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostFilterUsageOptionsBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostFilterUsageOptionsBottomSheetFragment.java new file mode 100644 index 00000000..6e9ccd15 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/PostFilterUsageOptionsBottomSheetFragment.java @@ -0,0 +1,66 @@ +package ml.docilealligator.infinityforreddit.bottomsheetfragments; + +import android.content.Context; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import androidx.annotation.NonNull; + +import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; + +import butterknife.BindView; +import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.activities.PostFilterUsageListingActivity; +import ml.docilealligator.infinityforreddit.postfilter.PostFilterUsage; + +public class PostFilterUsageOptionsBottomSheetFragment extends RoundedBottomSheetDialogFragment { + + public static final String EXTRA_POST_FILTER_USAGE = "EPFU"; + + @BindView(R.id.edit_text_view_post_filter_usage_options_bottom_sheet_fragment) + TextView editTextView; + @BindView(R.id.delete_text_view_post_filter_usage_options_bottom_sheet_fragment) + TextView deleteTextView; + private PostFilterUsageListingActivity activity; + + public PostFilterUsageOptionsBottomSheetFragment() { + // Required empty public constructor + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + View rootView = inflater.inflate(R.layout.fragment_post_filter_usage_options_bottom_sheet, container, false); + + ButterKnife.bind(this, rootView); + + PostFilterUsage postFilterUsage = getArguments().getParcelable(EXTRA_POST_FILTER_USAGE); + + if (postFilterUsage.usage == PostFilterUsage.HOME_TYPE || postFilterUsage.usage == PostFilterUsage.SEARCH_TYPE) { + editTextView.setVisibility(View.GONE); + } else { + editTextView.setOnClickListener(view -> { + activity.editPostFilterUsage(postFilterUsage); + dismiss(); + }); + } + + deleteTextView.setOnClickListener(view -> { + activity.deletePostFilterUsage(postFilterUsage); + dismiss(); + }); + + return rootView; + } + + @Override + public void onAttach(@NonNull Context context) { + super.onAttach(context); + activity = (PostFilterUsageListingActivity) context; + } +}
\ No newline at end of file diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SetAsWallpaperBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SetAsWallpaperBottomSheetFragment.java index 05d31cf3..1dd45fe2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SetAsWallpaperBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/bottomsheetfragments/SetAsWallpaperBottomSheetFragment.java @@ -2,6 +2,7 @@ package ml.docilealligator.infinityforreddit.bottomsheetfragments; import android.app.Activity; import android.content.Context; +import android.os.Build; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; @@ -49,7 +50,7 @@ public class SetAsWallpaperBottomSheetFragment extends RoundedBottomSheetDialogF dismiss(); }); - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { homeScreenTextvView.setVisibility(View.VISIBLE); lockScreenTextView.setVisibility(View.VISIBLE); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomTheme.java b/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomTheme.java index fb9bda02..c428efb9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomTheme.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomTheme.java @@ -37,6 +37,10 @@ public class CustomTheme { public int postTitleColor; @ColumnInfo(name = "post_content_color") public int postContentColor; + @ColumnInfo(name = "read_post_title_color") + public int readPostTitleColor; + @ColumnInfo(name = "read_post_content_color") + public int readPostContentColor; @ColumnInfo(name = "comment_color") public int commentColor; @ColumnInfo(name = "button_text_color") @@ -45,6 +49,8 @@ public class CustomTheme { public int backgroundColor; @ColumnInfo(name = "card_view_background_color") public int cardViewBackgroundColor; + @ColumnInfo(name = "read_post_card_view_background_color") + public int readPostCardViewBackgroundColor; @ColumnInfo(name = "comment_background_color") public int commentBackgroundColor; @ColumnInfo(name = "bottom_app_bar_background_color") @@ -205,75 +211,78 @@ public class CustomTheme { customTheme.secondaryTextColor = customThemeSettingsItems.get(8).colorValue; customTheme.postTitleColor = customThemeSettingsItems.get(9).colorValue; customTheme.postContentColor = customThemeSettingsItems.get(10).colorValue; - customTheme.commentColor = customThemeSettingsItems.get(11).colorValue; - customTheme.buttonTextColor = customThemeSettingsItems.get(12).colorValue; - customTheme.chipTextColor = customThemeSettingsItems.get(13).colorValue; - customTheme.linkColor = customThemeSettingsItems.get(14).colorValue; - customTheme.receivedMessageTextColor = customThemeSettingsItems.get(15).colorValue; - customTheme.sentMessageTextColor = customThemeSettingsItems.get(16).colorValue; - customTheme.backgroundColor = customThemeSettingsItems.get(17).colorValue; - customTheme.cardViewBackgroundColor = customThemeSettingsItems.get(18).colorValue; - customTheme.commentBackgroundColor = customThemeSettingsItems.get(19).colorValue; - customTheme.fullyCollapsedCommentBackgroundColor = customThemeSettingsItems.get(20).colorValue; - customTheme.awardedCommentBackgroundColor = customThemeSettingsItems.get(21).colorValue; - customTheme.receivedMessageBackgroundColor = customThemeSettingsItems.get(22).colorValue; - customTheme.sentMessageBackgroundColor = customThemeSettingsItems.get(23).colorValue; - customTheme.bottomAppBarBackgroundColor = customThemeSettingsItems.get(24).colorValue; - customTheme.primaryIconColor = customThemeSettingsItems.get(25).colorValue; - customTheme.bottomAppBarIconColor = customThemeSettingsItems.get(26).colorValue; - customTheme.postIconAndInfoColor = customThemeSettingsItems.get(27).colorValue; - customTheme.commentIconAndInfoColor = customThemeSettingsItems.get(28).colorValue; - customTheme.fabIconColor = customThemeSettingsItems.get(29).colorValue; - customTheme.sendMessageIconColor = customThemeSettingsItems.get(30).colorValue; - customTheme.toolbarPrimaryTextAndIconColor = customThemeSettingsItems.get(31).colorValue; - customTheme.toolbarSecondaryTextColor = customThemeSettingsItems.get(32).colorValue; - customTheme.circularProgressBarBackground = customThemeSettingsItems.get(33).colorValue; - customTheme.tabLayoutWithExpandedCollapsingToolbarTabBackground = customThemeSettingsItems.get(34).colorValue; - customTheme.tabLayoutWithExpandedCollapsingToolbarTextColor = customThemeSettingsItems.get(35).colorValue; - customTheme.tabLayoutWithExpandedCollapsingToolbarTabIndicator = customThemeSettingsItems.get(36).colorValue; - customTheme.tabLayoutWithCollapsedCollapsingToolbarTabBackground = customThemeSettingsItems.get(37).colorValue; - customTheme.tabLayoutWithCollapsedCollapsingToolbarTextColor = customThemeSettingsItems.get(38).colorValue; - customTheme.tabLayoutWithCollapsedCollapsingToolbarTabIndicator = customThemeSettingsItems.get(39).colorValue; - customTheme.upvoted = customThemeSettingsItems.get(40).colorValue; - customTheme.downvoted = customThemeSettingsItems.get(41).colorValue; - customTheme.postTypeBackgroundColor = customThemeSettingsItems.get(42).colorValue; - customTheme.postTypeTextColor = customThemeSettingsItems.get(43).colorValue; - customTheme.spoilerBackgroundColor = customThemeSettingsItems.get(44).colorValue; - customTheme.spoilerTextColor = customThemeSettingsItems.get(45).colorValue; - customTheme.nsfwBackgroundColor = customThemeSettingsItems.get(46).colorValue; - customTheme.nsfwTextColor = customThemeSettingsItems.get(47).colorValue; - customTheme.flairBackgroundColor = customThemeSettingsItems.get(48).colorValue; - customTheme.flairTextColor = customThemeSettingsItems.get(49).colorValue; - customTheme.awardsBackgroundColor = customThemeSettingsItems.get(50).colorValue; - customTheme.awardsTextColor = customThemeSettingsItems.get(51).colorValue; - customTheme.archivedTint = customThemeSettingsItems.get(52).colorValue; - customTheme.lockedIconTint = customThemeSettingsItems.get(53).colorValue; - customTheme.crosspostIconTint = customThemeSettingsItems.get(54).colorValue; - customTheme.stickiedPostIconTint = customThemeSettingsItems.get(55).colorValue; - customTheme.noPreviewPostTypeIconTint = customThemeSettingsItems.get(56).colorValue; - customTheme.subscribed = customThemeSettingsItems.get(57).colorValue; - customTheme.unsubscribed = customThemeSettingsItems.get(58).colorValue; - customTheme.username = customThemeSettingsItems.get(59).colorValue; - customTheme.subreddit = customThemeSettingsItems.get(60).colorValue; - customTheme.authorFlairTextColor = customThemeSettingsItems.get(61).colorValue; - customTheme.submitter = customThemeSettingsItems.get(62).colorValue; - customTheme.moderator = customThemeSettingsItems.get(63).colorValue; - customTheme.singleCommentThreadBackgroundColor = customThemeSettingsItems.get(64).colorValue; - customTheme.unreadMessageBackgroundColor = customThemeSettingsItems.get(65).colorValue; - customTheme.dividerColor = customThemeSettingsItems.get(66).colorValue; - customTheme.noPreviewPostTypeBackgroundColor = customThemeSettingsItems.get(67).colorValue; - customTheme.voteAndReplyUnavailableButtonColor = customThemeSettingsItems.get(68).colorValue; - customTheme.commentVerticalBarColor1 = customThemeSettingsItems.get(69).colorValue; - customTheme.commentVerticalBarColor2 = customThemeSettingsItems.get(70).colorValue; - customTheme.commentVerticalBarColor3 = customThemeSettingsItems.get(71).colorValue; - customTheme.commentVerticalBarColor4 = customThemeSettingsItems.get(72).colorValue; - customTheme.commentVerticalBarColor5 = customThemeSettingsItems.get(73).colorValue; - customTheme.commentVerticalBarColor6 = customThemeSettingsItems.get(74).colorValue; - customTheme.commentVerticalBarColor7 = customThemeSettingsItems.get(75).colorValue; - customTheme.navBarColor = customThemeSettingsItems.get(76).colorValue; - customTheme.isLightStatusBar = customThemeSettingsItems.get(77).isEnabled; - customTheme.isLightNavBar = customThemeSettingsItems.get(78).isEnabled; - customTheme.isChangeStatusBarIconColorAfterToolbarCollapsedInImmersiveInterface = customThemeSettingsItems.get(79).isEnabled; + customTheme.readPostTitleColor = customThemeSettingsItems.get(11).colorValue; + customTheme.readPostContentColor = customThemeSettingsItems.get(12).colorValue; + customTheme.commentColor = customThemeSettingsItems.get(13).colorValue; + customTheme.buttonTextColor = customThemeSettingsItems.get(14).colorValue; + customTheme.chipTextColor = customThemeSettingsItems.get(15).colorValue; + customTheme.linkColor = customThemeSettingsItems.get(16).colorValue; + customTheme.receivedMessageTextColor = customThemeSettingsItems.get(17).colorValue; + customTheme.sentMessageTextColor = customThemeSettingsItems.get(18).colorValue; + customTheme.backgroundColor = customThemeSettingsItems.get(19).colorValue; + customTheme.cardViewBackgroundColor = customThemeSettingsItems.get(20).colorValue; + customTheme.readPostCardViewBackgroundColor = customThemeSettingsItems.get(21).colorValue; + customTheme.commentBackgroundColor = customThemeSettingsItems.get(22).colorValue; + customTheme.fullyCollapsedCommentBackgroundColor = customThemeSettingsItems.get(23).colorValue; + customTheme.awardedCommentBackgroundColor = customThemeSettingsItems.get(24).colorValue; + customTheme.receivedMessageBackgroundColor = customThemeSettingsItems.get(25).colorValue; + customTheme.sentMessageBackgroundColor = customThemeSettingsItems.get(26).colorValue; + customTheme.bottomAppBarBackgroundColor = customThemeSettingsItems.get(27).colorValue; + customTheme.primaryIconColor = customThemeSettingsItems.get(28).colorValue; + customTheme.bottomAppBarIconColor = customThemeSettingsItems.get(29).colorValue; + customTheme.postIconAndInfoColor = customThemeSettingsItems.get(30).colorValue; + customTheme.commentIconAndInfoColor = customThemeSettingsItems.get(31).colorValue; + customTheme.fabIconColor = customThemeSettingsItems.get(32).colorValue; + customTheme.sendMessageIconColor = customThemeSettingsItems.get(33).colorValue; + customTheme.toolbarPrimaryTextAndIconColor = customThemeSettingsItems.get(34).colorValue; + customTheme.toolbarSecondaryTextColor = customThemeSettingsItems.get(35).colorValue; + customTheme.circularProgressBarBackground = customThemeSettingsItems.get(36).colorValue; + customTheme.tabLayoutWithExpandedCollapsingToolbarTabBackground = customThemeSettingsItems.get(37).colorValue; + customTheme.tabLayoutWithExpandedCollapsingToolbarTextColor = customThemeSettingsItems.get(38).colorValue; + customTheme.tabLayoutWithExpandedCollapsingToolbarTabIndicator = customThemeSettingsItems.get(39).colorValue; + customTheme.tabLayoutWithCollapsedCollapsingToolbarTabBackground = customThemeSettingsItems.get(40).colorValue; + customTheme.tabLayoutWithCollapsedCollapsingToolbarTextColor = customThemeSettingsItems.get(41).colorValue; + customTheme.tabLayoutWithCollapsedCollapsingToolbarTabIndicator = customThemeSettingsItems.get(42).colorValue; + customTheme.upvoted = customThemeSettingsItems.get(43).colorValue; + customTheme.downvoted = customThemeSettingsItems.get(44).colorValue; + customTheme.postTypeBackgroundColor = customThemeSettingsItems.get(45).colorValue; + customTheme.postTypeTextColor = customThemeSettingsItems.get(46).colorValue; + customTheme.spoilerBackgroundColor = customThemeSettingsItems.get(47).colorValue; + customTheme.spoilerTextColor = customThemeSettingsItems.get(48).colorValue; + customTheme.nsfwBackgroundColor = customThemeSettingsItems.get(49).colorValue; + customTheme.nsfwTextColor = customThemeSettingsItems.get(50).colorValue; + customTheme.flairBackgroundColor = customThemeSettingsItems.get(51).colorValue; + customTheme.flairTextColor = customThemeSettingsItems.get(52).colorValue; + customTheme.awardsBackgroundColor = customThemeSettingsItems.get(53).colorValue; + customTheme.awardsTextColor = customThemeSettingsItems.get(54).colorValue; + customTheme.archivedTint = customThemeSettingsItems.get(55).colorValue; + customTheme.lockedIconTint = customThemeSettingsItems.get(56).colorValue; + customTheme.crosspostIconTint = customThemeSettingsItems.get(57).colorValue; + customTheme.stickiedPostIconTint = customThemeSettingsItems.get(58).colorValue; + customTheme.noPreviewPostTypeIconTint = customThemeSettingsItems.get(59).colorValue; + customTheme.subscribed = customThemeSettingsItems.get(60).colorValue; + customTheme.unsubscribed = customThemeSettingsItems.get(61).colorValue; + customTheme.username = customThemeSettingsItems.get(62).colorValue; + customTheme.subreddit = customThemeSettingsItems.get(63).colorValue; + customTheme.authorFlairTextColor = customThemeSettingsItems.get(64).colorValue; + customTheme.submitter = customThemeSettingsItems.get(65).colorValue; + customTheme.moderator = customThemeSettingsItems.get(66).colorValue; + customTheme.singleCommentThreadBackgroundColor = customThemeSettingsItems.get(67).colorValue; + customTheme.unreadMessageBackgroundColor = customThemeSettingsItems.get(68).colorValue; + customTheme.dividerColor = customThemeSettingsItems.get(69).colorValue; + customTheme.noPreviewPostTypeBackgroundColor = customThemeSettingsItems.get(70).colorValue; + customTheme.voteAndReplyUnavailableButtonColor = customThemeSettingsItems.get(71).colorValue; + customTheme.commentVerticalBarColor1 = customThemeSettingsItems.get(72).colorValue; + customTheme.commentVerticalBarColor2 = customThemeSettingsItems.get(73).colorValue; + customTheme.commentVerticalBarColor3 = customThemeSettingsItems.get(74).colorValue; + customTheme.commentVerticalBarColor4 = customThemeSettingsItems.get(75).colorValue; + customTheme.commentVerticalBarColor5 = customThemeSettingsItems.get(76).colorValue; + customTheme.commentVerticalBarColor6 = customThemeSettingsItems.get(77).colorValue; + customTheme.commentVerticalBarColor7 = customThemeSettingsItems.get(78).colorValue; + customTheme.navBarColor = customThemeSettingsItems.get(79).colorValue; + customTheme.isLightStatusBar = customThemeSettingsItems.get(80).isEnabled; + customTheme.isLightNavBar = customThemeSettingsItems.get(81).isEnabled; + customTheme.isChangeStatusBarIconColorAfterToolbarCollapsedInImmersiveInterface = customThemeSettingsItems.get(82).isEnabled; return customTheme; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomThemeSettingsItem.java b/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomThemeSettingsItem.java index 56ad8718..e61d87c9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomThemeSettingsItem.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomThemeSettingsItem.java @@ -99,6 +99,16 @@ public class CustomThemeSettingsItem implements Parcelable { context.getString(R.string.theme_item_post_content_color_detail), customTheme.postContentColor)); customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_read_post_title_color), + context.getString(R.string.theme_item_read_post_title_color_detail), + customTheme.readPostTitleColor + )); + customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_read_post_content_color), + context.getString(R.string.theme_item_read_post_content_color_detail), + customTheme.readPostContentColor + )); + customThemeSettingsItems.add(new CustomThemeSettingsItem( context.getString(R.string.theme_item_comment_color), context.getString(R.string.theme_item_comment_color_detail), customTheme.commentColor)); @@ -131,6 +141,10 @@ public class CustomThemeSettingsItem implements Parcelable { context.getString(R.string.theme_item_card_view_background_color_detail), customTheme.cardViewBackgroundColor)); customThemeSettingsItems.add(new CustomThemeSettingsItem( + context.getString(R.string.theme_item_read_post_card_view_background_color), + context.getString(R.string.theme_item_read_post_card_view_background_color_detail), + customTheme.readPostCardViewBackgroundColor)); + customThemeSettingsItems.add(new CustomThemeSettingsItem( context.getString(R.string.theme_item_comment_background_color), context.getString(R.string.theme_item_comment_background_color_detail), customTheme.commentBackgroundColor)); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomThemeWrapper.java b/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomThemeWrapper.java index 8621559f..f0a8c0b7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomThemeWrapper.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomThemeWrapper.java @@ -92,6 +92,16 @@ public class CustomThemeWrapper { getDefaultColor("#8A000000", "#B3FFFFFF", "#B3FFFFFF")); } + public int getReadPostTitleColor() { + return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.READ_POST_TITLE_COLOR, + getDefaultColor("#9D9D9D", "#979797", "#979797")); + } + + public int getReadPostContentColor() { + return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.READ_POST_CONTENT_COLOR, + getDefaultColor("#9D9D9D", "#979797", "#979797")); + } + public int getCommentColor() { return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.COMMENT_COLOR, getDefaultColor("#000000", "#FFFFFF", "#FFFFFF")); @@ -112,6 +122,11 @@ public class CustomThemeWrapper { getDefaultColor("#FFFFFF", "#242424", "#000000")); } + public int getReadPostCardViewBackgroundColor() { + return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.READ_POST_CARD_VIEW_BACKGROUND_COLOR, + getDefaultColor("#F5F5F5", "#101010", "#000000")); + } + public int getCommentBackgroundColor() { return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.COMMENT_BACKGROUND_COLOR, getDefaultColor("#FFFFFF", "#242424", "#000000")); @@ -492,10 +507,13 @@ public class CustomThemeWrapper { customTheme.secondaryTextColor = Color.parseColor("#8A000000"); customTheme.postTitleColor = Color.parseColor("#000000"); customTheme.postContentColor = Color.parseColor("#8A000000"); + customTheme.readPostTitleColor = Color.parseColor("#9D9D9D"); + customTheme.readPostContentColor = Color.parseColor("#9D9D9D"); customTheme.commentColor = Color.parseColor("#000000"); customTheme.buttonTextColor = Color.parseColor("#FFFFFF"); customTheme.backgroundColor = Color.parseColor("#FFFFFF"); customTheme.cardViewBackgroundColor = Color.parseColor("#FFFFFF"); + customTheme.readPostCardViewBackgroundColor = Color.parseColor("#F5F5F5"); customTheme.commentBackgroundColor = Color.parseColor("#FFFFFF"); customTheme.bottomAppBarBackgroundColor = Color.parseColor("#FFFFFF"); customTheme.primaryIconColor = Color.parseColor("#000000"); @@ -578,10 +596,13 @@ public class CustomThemeWrapper { customTheme.secondaryTextColor = Color.parseColor("#B3FFFFFF"); customTheme.postTitleColor = Color.parseColor("#FFFFFF"); customTheme.postContentColor = Color.parseColor("#B3FFFFFF"); + customTheme.readPostTitleColor = Color.parseColor("#979797"); + customTheme.readPostContentColor = Color.parseColor("#979797"); customTheme.commentColor = Color.parseColor("#FFFFFF"); customTheme.buttonTextColor = Color.parseColor("#FFFFFF"); customTheme.backgroundColor = Color.parseColor("#121212"); customTheme.cardViewBackgroundColor = Color.parseColor("#242424"); + customTheme.readPostCardViewBackgroundColor = Color.parseColor("#101010"); customTheme.commentBackgroundColor = Color.parseColor("#242424"); customTheme.bottomAppBarBackgroundColor = Color.parseColor("#121212"); customTheme.primaryIconColor = Color.parseColor("#FFFFFF"); @@ -664,10 +685,13 @@ public class CustomThemeWrapper { customTheme.secondaryTextColor = Color.parseColor("#B3FFFFFF"); customTheme.postTitleColor = Color.parseColor("#FFFFFF"); customTheme.postContentColor = Color.parseColor("#B3FFFFFF"); + customTheme.readPostTitleColor = Color.parseColor("#979797"); + customTheme.readPostContentColor = Color.parseColor("#979797"); customTheme.commentColor = Color.parseColor("#FFFFFF"); customTheme.buttonTextColor = Color.parseColor("#FFFFFF"); customTheme.backgroundColor = Color.parseColor("#000000"); customTheme.cardViewBackgroundColor = Color.parseColor("#000000"); + customTheme.readPostCardViewBackgroundColor = Color.parseColor("#000000"); customTheme.commentBackgroundColor = Color.parseColor("#000000"); customTheme.bottomAppBarBackgroundColor = Color.parseColor("#000000"); customTheme.primaryIconColor = Color.parseColor("#FFFFFF"); @@ -750,10 +774,13 @@ public class CustomThemeWrapper { customTheme.secondaryTextColor = Color.parseColor("#8A000000"); customTheme.postTitleColor = Color.parseColor("#000000"); customTheme.postContentColor = Color.parseColor("#8A000000"); + customTheme.readPostTitleColor = Color.parseColor("#9D9D9D"); + customTheme.readPostContentColor = Color.parseColor("#9D9D9D"); customTheme.commentColor = Color.parseColor("#000000"); customTheme.buttonTextColor = Color.parseColor("#000000"); customTheme.backgroundColor = Color.parseColor("#FFFFFF"); customTheme.cardViewBackgroundColor = Color.parseColor("#FFFFFF"); + customTheme.readPostCardViewBackgroundColor = Color.parseColor("#F5F5F5"); customTheme.commentBackgroundColor = Color.parseColor("#FFFFFF"); customTheme.bottomAppBarBackgroundColor = Color.parseColor("#FFFFFF"); customTheme.primaryIconColor = Color.parseColor("#000000"); @@ -836,10 +863,13 @@ public class CustomThemeWrapper { customTheme.secondaryTextColor = Color.parseColor("#B3FFFFFF"); customTheme.postTitleColor = Color.parseColor("#FFFFFF"); customTheme.postContentColor = Color.parseColor("#B3FFFFFF"); + customTheme.readPostTitleColor = Color.parseColor("#979797"); + customTheme.readPostContentColor = Color.parseColor("#979797"); customTheme.commentColor = Color.parseColor("#FFFFFF"); customTheme.buttonTextColor = Color.parseColor("#FFFFFF"); customTheme.backgroundColor = Color.parseColor("#121212"); customTheme.cardViewBackgroundColor = Color.parseColor("#242424"); + customTheme.readPostCardViewBackgroundColor = Color.parseColor("#101010"); customTheme.commentBackgroundColor = Color.parseColor("#242424"); customTheme.bottomAppBarBackgroundColor = Color.parseColor("#121212"); customTheme.primaryIconColor = Color.parseColor("#FFFFFF"); @@ -922,10 +952,13 @@ public class CustomThemeWrapper { customTheme.secondaryTextColor = Color.parseColor("#B3FFFFFF"); customTheme.postTitleColor = Color.parseColor("#FFFFFF"); customTheme.postContentColor = Color.parseColor("#B3FFFFFF"); + customTheme.readPostTitleColor = Color.parseColor("#979797"); + customTheme.readPostContentColor = Color.parseColor("#979797"); customTheme.commentColor = Color.parseColor("#FFFFFF"); customTheme.buttonTextColor = Color.parseColor("#FFFFFF"); customTheme.backgroundColor = Color.parseColor("#000000"); customTheme.cardViewBackgroundColor = Color.parseColor("#000000"); + customTheme.readPostCardViewBackgroundColor = Color.parseColor("#000000"); customTheme.commentBackgroundColor = Color.parseColor("#000000"); customTheme.bottomAppBarBackgroundColor = Color.parseColor("#000000"); customTheme.primaryIconColor = Color.parseColor("#FFFFFF"); @@ -1008,10 +1041,13 @@ public class CustomThemeWrapper { customTheme.secondaryTextColor = Color.parseColor("#8A000000"); customTheme.postTitleColor = Color.parseColor("#000000"); customTheme.postContentColor = Color.parseColor("#8A000000"); + customTheme.readPostTitleColor = Color.parseColor("#9D9D9D"); + customTheme.readPostContentColor = Color.parseColor("#9D9D9D"); customTheme.commentColor = Color.parseColor("#000000"); customTheme.buttonTextColor = Color.parseColor("#FFFFFF"); customTheme.backgroundColor = Color.parseColor("#FFFFFF"); customTheme.cardViewBackgroundColor = Color.parseColor("#FFFFFF"); + customTheme.readPostCardViewBackgroundColor = Color.parseColor("#F5F5F5"); customTheme.commentBackgroundColor = Color.parseColor("#FFFFFF"); customTheme.bottomAppBarBackgroundColor = Color.parseColor("#FFFFFF"); customTheme.primaryIconColor = Color.parseColor("#000000"); @@ -1094,10 +1130,13 @@ public class CustomThemeWrapper { customTheme.secondaryTextColor = Color.parseColor("#B3FFFFFF"); customTheme.postTitleColor = Color.parseColor("#FFFFFF"); customTheme.postContentColor = Color.parseColor("#B3FFFFFF"); + customTheme.readPostTitleColor = Color.parseColor("#979797"); + customTheme.readPostContentColor = Color.parseColor("#979797"); customTheme.commentColor = Color.parseColor("#FFFFFF"); customTheme.buttonTextColor = Color.parseColor("#FFFFFF"); customTheme.backgroundColor = Color.parseColor("#121212"); customTheme.cardViewBackgroundColor = Color.parseColor("#242424"); + customTheme.readPostCardViewBackgroundColor = Color.parseColor("#101010"); customTheme.commentBackgroundColor = Color.parseColor("#242424"); customTheme.bottomAppBarBackgroundColor = Color.parseColor("#121212"); customTheme.primaryIconColor = Color.parseColor("#FFFFFF"); @@ -1180,10 +1219,13 @@ public class CustomThemeWrapper { customTheme.secondaryTextColor = Color.parseColor("#B3FFFFFF"); customTheme.postTitleColor = Color.parseColor("#FFFFFF"); customTheme.postContentColor = Color.parseColor("#B3FFFFFF"); + customTheme.readPostTitleColor = Color.parseColor("#979797"); + customTheme.readPostContentColor = Color.parseColor("#979797"); customTheme.commentColor = Color.parseColor("#FFFFFF"); customTheme.buttonTextColor = Color.parseColor("#FFFFFF"); customTheme.backgroundColor = Color.parseColor("#000000"); customTheme.cardViewBackgroundColor = Color.parseColor("#000000"); + customTheme.readPostCardViewBackgroundColor = Color.parseColor("#000000"); customTheme.commentBackgroundColor = Color.parseColor("#000000"); customTheme.bottomAppBarBackgroundColor = Color.parseColor("#000000"); customTheme.primaryIconColor = Color.parseColor("#FFFFFF"); @@ -1266,10 +1308,13 @@ public class CustomThemeWrapper { customTheme.secondaryTextColor = Color.parseColor("#B3FFFFFF"); customTheme.postTitleColor = Color.parseColor("#FFFFFF"); customTheme.postContentColor = Color.parseColor("#B3FFFFFF"); + customTheme.readPostTitleColor = Color.parseColor("#9D9D9D"); + customTheme.readPostContentColor = Color.parseColor("#9D9D9D"); customTheme.commentColor = Color.parseColor("#FFFFFF"); customTheme.buttonTextColor = Color.parseColor("#FFFFFF"); customTheme.backgroundColor = Color.parseColor("#282A36"); customTheme.cardViewBackgroundColor = Color.parseColor("#393A59"); + customTheme.readPostCardViewBackgroundColor = Color.parseColor("#1C1F3D"); customTheme.commentBackgroundColor = Color.parseColor("#393A59"); customTheme.bottomAppBarBackgroundColor = Color.parseColor("#393A59"); customTheme.primaryIconColor = Color.parseColor("#FFFFFF"); @@ -1352,10 +1397,13 @@ public class CustomThemeWrapper { customTheme.secondaryTextColor = Color.parseColor("#8A000000"); customTheme.postTitleColor = Color.parseColor("#000000"); customTheme.postContentColor = Color.parseColor("#8A000000"); + customTheme.readPostTitleColor = Color.parseColor("#979797"); + customTheme.readPostContentColor = Color.parseColor("#979797"); customTheme.commentColor = Color.parseColor("#000000"); customTheme.buttonTextColor = Color.parseColor("#FFFFFF"); customTheme.backgroundColor = Color.parseColor("#DAD0DE"); customTheme.cardViewBackgroundColor = Color.parseColor("#C0F0F4"); + customTheme.readPostCardViewBackgroundColor = Color.parseColor("#D2E7EA"); customTheme.commentBackgroundColor = Color.parseColor("#C0F0F4"); customTheme.bottomAppBarBackgroundColor = Color.parseColor("#D48AE0"); customTheme.primaryIconColor = Color.parseColor("#000000"); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/LollipopBugFixedWebView.java b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/LollipopBugFixedWebView.java index 6392902d..71387a2f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/LollipopBugFixedWebView.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/LollipopBugFixedWebView.java @@ -21,7 +21,8 @@ public class LollipopBugFixedWebView extends WebView{ // To fix Android Lollipop WebView problem create a new configuration on that Android version only private static Context getFixedContext(Context context) { - if (Build.VERSION.SDK_INT == 21 || Build.VERSION.SDK_INT == 22) // Android Lollipop 5.0 & 5.1 + if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP + || Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP_MR1) // Android Lollipop 5.0 & 5.1 return context.createConfigurationContext(new Configuration()); return context; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/CommentsListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/CommentsListingFragment.java index 75ed77db..af34d5a3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/CommentsListingFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/CommentsListingFragment.java @@ -36,17 +36,18 @@ import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; -import ml.docilealligator.infinityforreddit.activities.BaseActivity; -import ml.docilealligator.infinityforreddit.adapters.CommentsListingRecyclerViewAdapter; -import ml.docilealligator.infinityforreddit.asynctasks.GetCurrentAccountAsyncTask; -import ml.docilealligator.infinityforreddit.comment.CommentViewModel; -import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.FragmentCommunicator; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.NetworkState; +import ml.docilealligator.infinityforreddit.PostFragmentContentScrollingInterface; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; import ml.docilealligator.infinityforreddit.SortType; +import ml.docilealligator.infinityforreddit.activities.BaseActivity; +import ml.docilealligator.infinityforreddit.adapters.CommentsListingRecyclerViewAdapter; +import ml.docilealligator.infinityforreddit.asynctasks.GetCurrentAccountAsyncTask; +import ml.docilealligator.infinityforreddit.comment.CommentViewModel; +import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; import ml.docilealligator.infinityforreddit.utils.Utils; import retrofit2.Retrofit; @@ -289,6 +290,19 @@ public class CommentsListingFragment extends Fragment implements FragmentCommuni mCommentRecyclerView.setAdapter(mAdapter); + if (mActivity instanceof PostFragmentContentScrollingInterface) { + mCommentRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { + @Override + public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { + if (dy > 0) { + ((PostFragmentContentScrollingInterface) mActivity).contentScrollDown(); + } else if (dy < 0) { + ((PostFragmentContentScrollingInterface) mActivity).contentScrollUp(); + } + } + }); + } + CommentViewModel.Factory factory; if (mAccessToken == null) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java index fbc7d0cb..f8a5a9d7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java @@ -52,20 +52,28 @@ import org.greenrobot.eventbus.Subscribe; import java.util.ArrayList; import java.util.Locale; +import java.util.concurrent.Executor; import javax.inject.Inject; import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; +import butterknife.Unbinder; import im.ene.toro.exoplayer.ExoCreator; import im.ene.toro.media.PlaybackInfo; import im.ene.toro.media.VolumeInfo; -import ml.docilealligator.infinityforreddit.activities.BaseActivity; -import ml.docilealligator.infinityforreddit.activities.FilteredThingActivity; -import ml.docilealligator.infinityforreddit.activities.MainActivity; -import ml.docilealligator.infinityforreddit.activities.ViewSubredditDetailActivity; import ml.docilealligator.infinityforreddit.ActivityToolbarInterface; +import ml.docilealligator.infinityforreddit.FetchPostFilterAndReadPosts; +import ml.docilealligator.infinityforreddit.FragmentCommunicator; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.NetworkState; +import ml.docilealligator.infinityforreddit.PostFragmentContentScrollingInterface; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.SortType; +import ml.docilealligator.infinityforreddit.activities.BaseActivity; +import ml.docilealligator.infinityforreddit.activities.FilteredPostsActivity; import ml.docilealligator.infinityforreddit.adapters.PostRecyclerViewAdapter; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customviews.CustomToroContainer; @@ -95,17 +103,12 @@ import ml.docilealligator.infinityforreddit.events.ChangeVoteButtonsPositionEven import ml.docilealligator.infinityforreddit.events.PostUpdateEventToPostList; import ml.docilealligator.infinityforreddit.events.ShowDividerInCompactLayoutPreferenceEvent; import ml.docilealligator.infinityforreddit.events.ShowThumbnailOnTheRightInCompactLayoutEvent; -import ml.docilealligator.infinityforreddit.FragmentCommunicator; -import ml.docilealligator.infinityforreddit.Infinity; -import ml.docilealligator.infinityforreddit.NetworkState; import ml.docilealligator.infinityforreddit.post.Post; import ml.docilealligator.infinityforreddit.post.PostDataSource; import ml.docilealligator.infinityforreddit.post.PostViewModel; -import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; -import ml.docilealligator.infinityforreddit.SortType; -import ml.docilealligator.infinityforreddit.subredditfilter.FetchSubredditFilters; -import ml.docilealligator.infinityforreddit.subredditfilter.SubredditFilter; +import ml.docilealligator.infinityforreddit.postfilter.PostFilter; +import ml.docilealligator.infinityforreddit.postfilter.PostFilterUsage; +import ml.docilealligator.infinityforreddit.readpost.ReadPost; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; import ml.docilealligator.infinityforreddit.utils.Utils; import retrofit2.Retrofit; @@ -125,13 +128,15 @@ public class PostFragment extends Fragment implements FragmentCommunicator { public static final String EXTRA_QUERY = "EQ"; public static final String EXTRA_POST_TYPE = "EPT"; public static final String EXTRA_FILTER = "EF"; - public static final int EXTRA_NO_FILTER = -2; public static final String EXTRA_ACCESS_TOKEN = "EAT"; public static final String EXTRA_ACCOUNT_NAME = "EAN"; + public static final String EXTRA_DISABLE_READ_POSTS = "EDRP"; private static final String IS_IN_LAZY_MODE_STATE = "IILMS"; private static final String RECYCLER_VIEW_POSITION_STATE = "RVPS"; - private static final String SUBREDDIT_FILTER_LIST_STATE = "SFLS"; + private static final String READ_POST_LIST_STATE = "RPLS"; + private static final String HIDE_READ_POSTS_INDEX_STATE = "HRPIS"; + private static final String POST_FILTER_STATE = "PFS"; @BindView(R.id.swipe_refresh_layout_post_fragment) SwipeRefreshLayout mSwipeRefreshLayout; @@ -171,12 +176,17 @@ public class PostFragment extends Fragment implements FragmentCommunicator { @Named("nsfw_and_spoiler") SharedPreferences mNsfwAndSpoilerSharedPreferences; @Inject - CustomThemeWrapper customThemeWrapper; - @Inject - ExoCreator exoCreator; + @Named("post_history") + SharedPreferences mPostHistorySharedPreferences; @Inject @Named("post_feed_scrolled_position_cache") - SharedPreferences postFeedScrolledPositionSharedPreferences; + SharedPreferences mPostFeedScrolledPositionSharedPreferences; + @Inject + CustomThemeWrapper mCustomThemeWrapper; + @Inject + ExoCreator mExoCreator; + @Inject + Executor mExecutor; private RequestManager mGlide; private AppCompatActivity activity; private LinearLayoutManager mLinearLayoutManager; @@ -197,10 +207,13 @@ public class PostFragment extends Fragment implements FragmentCommunicator { private String accountName; private String subredditName; private String username; + private String query; + private String where; private String multiRedditPath; private int maxPosition = -1; private int postLayout; private SortType sortType; + private PostFilter postFilter; private ColorDrawable backgroundSwipeRight; private ColorDrawable backgroundSwipeLeft; private Drawable drawableSwipeRight; @@ -210,7 +223,8 @@ public class PostFragment extends Fragment implements FragmentCommunicator { private boolean vibrateWhenActionTriggered; private float swipeActionThreshold; private ItemTouchHelper touchHelper; - private ArrayList<SubredditFilter> subredditFilterList; + private ArrayList<ReadPost> readPosts; + private Unbinder unbinder; public PostFragment() { // Required empty public constructor @@ -264,7 +278,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator { ((Infinity) activity.getApplication()).getAppComponent().inject(this); - ButterKnife.bind(this, rootView); + unbinder = ButterKnife.bind(this, rootView); EventBus.getDefault().register(this); @@ -324,20 +338,20 @@ public class PostFragment extends Fragment implements FragmentCommunicator { @Override public void run() { - if (isInLazyMode && !isLazyModePaused) { + if (isInLazyMode && !isLazyModePaused && mAdapter != null) { int nPosts = mAdapter.getItemCount(); if (getCurrentPosition() == -1) { if (mLinearLayoutManager != null) { - setCurrentPosition(mLinearLayoutManager.findFirstVisibleItemPosition()); + setCurrentPosition(mAdapter.getNextItemPositionWithoutBeingHidden(mLinearLayoutManager.findFirstVisibleItemPosition())); } else { int[] into = new int[2]; - setCurrentPosition(mStaggeredGridLayoutManager.findFirstVisibleItemPositions(into)[1]); + setCurrentPosition(mAdapter.getNextItemPositionWithoutBeingHidden(mStaggeredGridLayoutManager.findFirstVisibleItemPositions(into)[1])); } } if (getCurrentPosition() != RecyclerView.NO_POSITION && nPosts > getCurrentPosition()) { incrementCurrentPosition(); - smoothScroller.setTargetPosition(getCurrentPosition()); + smoothScroller.setTargetPosition(mAdapter.getNextItemPositionWithoutBeingHidden(getCurrentPosition())); if (mLinearLayoutManager != null) { mLinearLayoutManager.startSmoothScroll(smoothScroller); } else { @@ -364,6 +378,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator { mSwipeRefreshLayout.setEnabled(mSharedPreferences.getBoolean(SharedPreferencesUtils.PULL_TO_REFRESH, true)); mSwipeRefreshLayout.setOnRefreshListener(this::refresh); + int hideReadPostsIndex = 0; if (savedInstanceState != null) { int recyclerViewPosition = savedInstanceState.getInt(RECYCLER_VIEW_POSITION_STATE); if (recyclerViewPosition > 0) { @@ -371,7 +386,11 @@ public class PostFragment extends Fragment implements FragmentCommunicator { } isInLazyMode = savedInstanceState.getBoolean(IS_IN_LAZY_MODE_STATE); - subredditFilterList = savedInstanceState.getParcelableArrayList(SUBREDDIT_FILTER_LIST_STATE); + readPosts = savedInstanceState.getParcelableArrayList(READ_POST_LIST_STATE); + hideReadPostsIndex = savedInstanceState.getInt(HIDE_READ_POSTS_INDEX_STATE, 0); + postFilter = savedInstanceState.getParcelable(POST_FILTER_STATE); + } else { + postFilter = getArguments().getParcelable(EXTRA_FILTER); } mPostRecyclerView.setOnTouchListener((view, motionEvent) -> { @@ -381,45 +400,36 @@ public class PostFragment extends Fragment implements FragmentCommunicator { return false; }); - if (activity instanceof MainActivity) { + if (activity instanceof PostFragmentContentScrollingInterface) { mPostRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { if (dy > 0) { - ((MainActivity) activity).postScrollDown(); + ((PostFragmentContentScrollingInterface) activity).contentScrollDown(); } else if (dy < 0) { - ((MainActivity) activity).postScrollUp(); + ((PostFragmentContentScrollingInterface) activity).contentScrollUp(); } - - } - }); - } else if (activity instanceof ViewSubredditDetailActivity) { - mPostRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { - @Override - public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { - if (dy > 0) { - ((ViewSubredditDetailActivity) activity).contentScrollDown(); - } else if (dy < 0) { - ((ViewSubredditDetailActivity) activity).contentScrollUp(); - } - } }); } postType = getArguments().getInt(EXTRA_POST_TYPE); - int filter = getArguments().getInt(EXTRA_FILTER); String accessToken = getArguments().getString(EXTRA_ACCESS_TOKEN); accountName = getArguments().getString(EXTRA_ACCOUNT_NAME); - boolean nsfw = mNsfwAndSpoilerSharedPreferences.getBoolean((accountName == null ? "" : accountName) + SharedPreferencesUtils.NSFW_BASE, false); int defaultPostLayout = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.DEFAULT_POST_LAYOUT_KEY, "0")); savePostFeedScrolledPosition = mSharedPreferences.getBoolean(SharedPreferencesUtils.SAVE_FRONT_PAGE_SCROLLED_POSITION, false); Locale locale = getResources().getConfiguration().locale; + int usage; + String nameOfUsage; + if (postType == PostDataSource.TYPE_SEARCH) { subredditName = getArguments().getString(EXTRA_NAME); - String query = getArguments().getString(EXTRA_QUERY); + query = getArguments().getString(EXTRA_QUERY); + + usage = PostFilterUsage.SEARCH_TYPE; + nameOfUsage = PostFilterUsage.NO_USAGE; String sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_SEARCH_POST, SortType.Type.RELEVANCE.name()); String sortTime = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_SEARCH_POST, SortType.Time.ALL.name()); @@ -427,9 +437,10 @@ public class PostFragment extends Fragment implements FragmentCommunicator { postLayout = mPostLayoutSharedPreferences.getInt(SharedPreferencesUtils.POST_LAYOUT_SEARCH_POST, defaultPostLayout); mAdapter = new PostRecyclerViewAdapter(activity, mOauthRetrofit, mRetrofit, mGfycatRetrofit, - mRedgifsRetrofit, mRedditDataRoomDatabase, customThemeWrapper, locale, + mRedgifsRetrofit, mRedditDataRoomDatabase, mCustomThemeWrapper, locale, windowWidth, accessToken, accountName, postType, postLayout, true, - mSharedPreferences, mNsfwAndSpoilerSharedPreferences, exoCreator, new PostRecyclerViewAdapter.Callback() { + mSharedPreferences, mNsfwAndSpoilerSharedPreferences, mPostHistorySharedPreferences, + mExoCreator, new PostRecyclerViewAdapter.Callback() { @Override public void retryLoadingMore() { mPostViewModel.retryLoadingMore(); @@ -437,11 +448,21 @@ public class PostFragment extends Fragment implements FragmentCommunicator { @Override public void typeChipClicked(int filter) { - Intent intent = new Intent(activity, FilteredThingActivity.class); - intent.putExtra(FilteredThingActivity.EXTRA_NAME, subredditName); - intent.putExtra(FilteredThingActivity.EXTRA_QUERY, query); - intent.putExtra(FilteredThingActivity.EXTRA_POST_TYPE, postType); - intent.putExtra(FilteredThingActivity.EXTRA_FILTER, filter); + Intent intent = new Intent(activity, FilteredPostsActivity.class); + intent.putExtra(FilteredPostsActivity.EXTRA_NAME, subredditName); + intent.putExtra(FilteredPostsActivity.EXTRA_QUERY, query); + intent.putExtra(FilteredPostsActivity.EXTRA_POST_TYPE, postType); + intent.putExtra(FilteredPostsActivity.EXTRA_FILTER, filter); + startActivity(intent); + } + + @Override + public void nsfwChipClicked() { + Intent intent = new Intent(activity, FilteredPostsActivity.class); + intent.putExtra(FilteredPostsActivity.EXTRA_NAME, subredditName); + intent.putExtra(FilteredPostsActivity.EXTRA_QUERY, query); + intent.putExtra(FilteredPostsActivity.EXTRA_POST_TYPE, postType); + intent.putExtra(FilteredPostsActivity.EXTRA_FILTER, Post.NSFW_TYPE); startActivity(intent); } @@ -457,32 +478,33 @@ public class PostFragment extends Fragment implements FragmentCommunicator { TransitionManager.beginDelayedTransition(mPostRecyclerView, new AutoTransition()); } }); - - mPostViewModel = new ViewModelProvider(this, new PostViewModel.Factory(accessToken == null ? mRetrofit : mOauthRetrofit, accessToken, - accountName, locale, mSharedPreferences, - postFeedScrolledPositionSharedPreferences, subredditName, query, postType, sortType, filter, nsfw)).get(PostViewModel.class); } else if (postType == PostDataSource.TYPE_SUBREDDIT) { subredditName = getArguments().getString(EXTRA_NAME); + + usage = PostFilterUsage.SUBREDDIT_TYPE; + nameOfUsage = subredditName; + String sort; String sortTime = null; sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_SUBREDDIT_POST_BASE + subredditName, SortType.Type.HOT.name()); - if(sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) { + if (sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) { sortTime = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_SUBREDDIT_POST_BASE + subredditName, SortType.Time.ALL.name()); } boolean displaySubredditName = subredditName != null && (subredditName.equals("popular") || subredditName.equals("all")); postLayout = mPostLayoutSharedPreferences.getInt(SharedPreferencesUtils.POST_LAYOUT_SUBREDDIT_POST_BASE + subredditName, defaultPostLayout); - if(sortTime != null) { + if (sortTime != null) { sortType = new SortType(SortType.Type.valueOf(sort), SortType.Time.valueOf(sortTime)); } else { sortType = new SortType(SortType.Type.valueOf(sort)); } mAdapter = new PostRecyclerViewAdapter(activity, mOauthRetrofit, mRetrofit, mGfycatRetrofit, - mRedgifsRetrofit, mRedditDataRoomDatabase, customThemeWrapper, locale, + mRedgifsRetrofit, mRedditDataRoomDatabase, mCustomThemeWrapper, locale, windowWidth, accessToken, accountName, postType, postLayout, displaySubredditName, - mSharedPreferences, mNsfwAndSpoilerSharedPreferences, exoCreator, new PostRecyclerViewAdapter.Callback() { + mSharedPreferences, mNsfwAndSpoilerSharedPreferences, mPostHistorySharedPreferences, + mExoCreator, new PostRecyclerViewAdapter.Callback() { @Override public void retryLoadingMore() { mPostViewModel.retryLoadingMore(); @@ -490,10 +512,19 @@ public class PostFragment extends Fragment implements FragmentCommunicator { @Override public void typeChipClicked(int filter) { - Intent intent = new Intent(activity, FilteredThingActivity.class); - intent.putExtra(FilteredThingActivity.EXTRA_NAME, subredditName); - intent.putExtra(FilteredThingActivity.EXTRA_POST_TYPE, postType); - intent.putExtra(FilteredThingActivity.EXTRA_FILTER, filter); + Intent intent = new Intent(activity, FilteredPostsActivity.class); + intent.putExtra(FilteredPostsActivity.EXTRA_NAME, subredditName); + intent.putExtra(FilteredPostsActivity.EXTRA_POST_TYPE, postType); + intent.putExtra(FilteredPostsActivity.EXTRA_FILTER, filter); + startActivity(intent); + } + + @Override + public void nsfwChipClicked() { + Intent intent = new Intent(activity, FilteredPostsActivity.class); + intent.putExtra(FilteredPostsActivity.EXTRA_NAME, subredditName); + intent.putExtra(FilteredPostsActivity.EXTRA_POST_TYPE, postType); + intent.putExtra(FilteredPostsActivity.EXTRA_FILTER, Post.NSFW_TYPE); startActivity(intent); } @@ -509,53 +540,35 @@ public class PostFragment extends Fragment implements FragmentCommunicator { TransitionManager.beginDelayedTransition(mPostRecyclerView, new AutoTransition()); } }); - - if (subredditName.equals("all") || subredditName.equals("popular")) { - if (subredditFilterList != null) { - mPostViewModel = new ViewModelProvider(this, new PostViewModel.Factory(accessToken == null ? mRetrofit : mOauthRetrofit, accessToken, - accountName, locale, mSharedPreferences, - postFeedScrolledPositionSharedPreferences, subredditName, postType, sortType, filter, nsfw, subredditFilterList)).get(PostViewModel.class); - } else { - FetchSubredditFilters.fetchSubredditFilters(mRedditDataRoomDatabase, subredditFilters -> { - if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) { - subredditFilterList = subredditFilters; - mPostViewModel = new ViewModelProvider(PostFragment.this, new PostViewModel.Factory(accessToken == null ? mRetrofit : mOauthRetrofit, accessToken, - accountName, locale, mSharedPreferences, - postFeedScrolledPositionSharedPreferences, subredditName, postType, sortType, filter, nsfw, subredditFilters)).get(PostViewModel.class); - - bindPostViewModel(); - } - }); - } - } else { - mPostViewModel = new ViewModelProvider(this, new PostViewModel.Factory(accessToken == null ? mRetrofit : mOauthRetrofit, accessToken, - accountName, locale, mSharedPreferences, - postFeedScrolledPositionSharedPreferences, subredditName, postType, sortType, filter, nsfw)).get(PostViewModel.class); - } - } else if(postType == PostDataSource.TYPE_MULTI_REDDIT) { + } else if (postType == PostDataSource.TYPE_MULTI_REDDIT) { multiRedditPath = getArguments().getString(EXTRA_NAME); + + usage = PostFilterUsage.MULTIREDDIT_TYPE; + nameOfUsage = multiRedditPath; + String sort; String sortTime = null; sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_MULTI_REDDIT_POST_BASE + multiRedditPath, SortType.Type.HOT.name()); - if(sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) { + if (sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) { sortTime = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_MULTI_REDDIT_POST_BASE + multiRedditPath, SortType.Time.ALL.name()); } postLayout = mPostLayoutSharedPreferences.getInt(SharedPreferencesUtils.POST_LAYOUT_MULTI_REDDIT_POST_BASE + multiRedditPath, defaultPostLayout); - if(sortTime != null) { + if (sortTime != null) { sortType = new SortType(SortType.Type.valueOf(sort), SortType.Time.valueOf(sortTime)); } else { sortType = new SortType(SortType.Type.valueOf(sort)); } mAdapter = new PostRecyclerViewAdapter(activity, mOauthRetrofit, mRetrofit, mGfycatRetrofit, - mRedgifsRetrofit, mRedditDataRoomDatabase, customThemeWrapper, locale, + mRedgifsRetrofit, mRedditDataRoomDatabase, mCustomThemeWrapper, locale, windowWidth, accessToken, accountName, postType, postLayout, true, - mSharedPreferences, mNsfwAndSpoilerSharedPreferences, exoCreator, new PostRecyclerViewAdapter.Callback() { + mSharedPreferences, mNsfwAndSpoilerSharedPreferences, mPostHistorySharedPreferences, + mExoCreator, new PostRecyclerViewAdapter.Callback() { @Override public void retryLoadingMore() { mPostViewModel.retryLoadingMore(); @@ -563,10 +576,19 @@ public class PostFragment extends Fragment implements FragmentCommunicator { @Override public void typeChipClicked(int filter) { - Intent intent = new Intent(activity, FilteredThingActivity.class); - intent.putExtra(FilteredThingActivity.EXTRA_NAME, multiRedditPath); - intent.putExtra(FilteredThingActivity.EXTRA_POST_TYPE, postType); - intent.putExtra(FilteredThingActivity.EXTRA_FILTER, filter); + Intent intent = new Intent(activity, FilteredPostsActivity.class); + intent.putExtra(FilteredPostsActivity.EXTRA_NAME, multiRedditPath); + intent.putExtra(FilteredPostsActivity.EXTRA_POST_TYPE, postType); + intent.putExtra(FilteredPostsActivity.EXTRA_FILTER, filter); + startActivity(intent); + } + + @Override + public void nsfwChipClicked() { + Intent intent = new Intent(activity, FilteredPostsActivity.class); + intent.putExtra(FilteredPostsActivity.EXTRA_NAME, multiRedditPath); + intent.putExtra(FilteredPostsActivity.EXTRA_POST_TYPE, postType); + intent.putExtra(FilteredPostsActivity.EXTRA_FILTER, Post.NSFW_TYPE); startActivity(intent); } @@ -582,13 +604,13 @@ public class PostFragment extends Fragment implements FragmentCommunicator { TransitionManager.beginDelayedTransition(mPostRecyclerView, new AutoTransition()); } }); - - mPostViewModel = new ViewModelProvider(this, new PostViewModel.Factory(accessToken == null ? mRetrofit : mOauthRetrofit, accessToken, - accountName, locale, mSharedPreferences, - postFeedScrolledPositionSharedPreferences, multiRedditPath, postType, sortType, filter, nsfw)).get(PostViewModel.class); } else if (postType == PostDataSource.TYPE_USER) { username = getArguments().getString(EXTRA_USER_NAME); - String where = getArguments().getString(EXTRA_USER_WHERE); + where = getArguments().getString(EXTRA_USER_WHERE); + + usage = PostFilterUsage.USER_TYPE; + nameOfUsage = username; + if (where != null && where.equals(PostDataSource.USER_WHERE_SUBMITTED)) { CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) mFetchPostInfoLinearLayout.getLayoutParams(); params.height = ViewGroup.LayoutParams.WRAP_CONTENT; @@ -596,7 +618,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator { } String sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_USER_POST_BASE + username, SortType.Type.NEW.name()); - if(sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) { + if (sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) { String sortTime = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_USER_POST_BASE + username, SortType.Time.ALL.name()); sortType = new SortType(SortType.Type.valueOf(sort), SortType.Time.valueOf(sortTime)); } else { @@ -605,9 +627,10 @@ public class PostFragment extends Fragment implements FragmentCommunicator { postLayout = mPostLayoutSharedPreferences.getInt(SharedPreferencesUtils.POST_LAYOUT_USER_POST_BASE + username, defaultPostLayout); mAdapter = new PostRecyclerViewAdapter(activity, mOauthRetrofit, mRetrofit, mGfycatRetrofit, - mRedgifsRetrofit, mRedditDataRoomDatabase, customThemeWrapper, locale, + mRedgifsRetrofit, mRedditDataRoomDatabase, mCustomThemeWrapper, locale, windowWidth, accessToken, accountName, postType, postLayout, true, - mSharedPreferences, mNsfwAndSpoilerSharedPreferences, exoCreator, new PostRecyclerViewAdapter.Callback() { + mSharedPreferences, mNsfwAndSpoilerSharedPreferences, mPostHistorySharedPreferences, + mExoCreator, new PostRecyclerViewAdapter.Callback() { @Override public void retryLoadingMore() { mPostViewModel.retryLoadingMore(); @@ -615,11 +638,21 @@ public class PostFragment extends Fragment implements FragmentCommunicator { @Override public void typeChipClicked(int filter) { - Intent intent = new Intent(activity, FilteredThingActivity.class); - intent.putExtra(FilteredThingActivity.EXTRA_NAME, username); - intent.putExtra(FilteredThingActivity.EXTRA_POST_TYPE, postType); - intent.putExtra(FilteredThingActivity.EXTRA_USER_WHERE, where); - intent.putExtra(FilteredThingActivity.EXTRA_FILTER, filter); + Intent intent = new Intent(activity, FilteredPostsActivity.class); + intent.putExtra(FilteredPostsActivity.EXTRA_NAME, username); + intent.putExtra(FilteredPostsActivity.EXTRA_POST_TYPE, postType); + intent.putExtra(FilteredPostsActivity.EXTRA_USER_WHERE, where); + intent.putExtra(FilteredPostsActivity.EXTRA_FILTER, filter); + startActivity(intent); + } + + @Override + public void nsfwChipClicked() { + Intent intent = new Intent(activity, FilteredPostsActivity.class); + intent.putExtra(FilteredPostsActivity.EXTRA_NAME, username); + intent.putExtra(FilteredPostsActivity.EXTRA_POST_TYPE, postType); + intent.putExtra(FilteredPostsActivity.EXTRA_USER_WHERE, where); + intent.putExtra(FilteredPostsActivity.EXTRA_FILTER, Post.NSFW_TYPE); startActivity(intent); } @@ -635,13 +668,12 @@ public class PostFragment extends Fragment implements FragmentCommunicator { TransitionManager.beginDelayedTransition(mPostRecyclerView, new AutoTransition()); } }); - - mPostViewModel = new ViewModelProvider(this, new PostViewModel.Factory(accessToken == null ? mRetrofit : mOauthRetrofit, accessToken, - accountName, locale, mSharedPreferences, - postFeedScrolledPositionSharedPreferences, username, postType, sortType, where, filter, nsfw)).get(PostViewModel.class); } else { + usage = PostFilterUsage.HOME_TYPE; + nameOfUsage = PostFilterUsage.NO_USAGE; + String sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_BEST_POST, SortType.Type.BEST.name()); - if(sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) { + if (sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) { String sortTime = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_BEST_POST, SortType.Time.ALL.name()); sortType = new SortType(SortType.Type.valueOf(sort), SortType.Time.valueOf(sortTime)); } else { @@ -650,9 +682,10 @@ public class PostFragment extends Fragment implements FragmentCommunicator { postLayout = mPostLayoutSharedPreferences.getInt(SharedPreferencesUtils.POST_LAYOUT_FRONT_PAGE_POST, defaultPostLayout); mAdapter = new PostRecyclerViewAdapter(activity, mOauthRetrofit, mRetrofit, mGfycatRetrofit, - mRedgifsRetrofit, mRedditDataRoomDatabase, customThemeWrapper, locale, + mRedgifsRetrofit, mRedditDataRoomDatabase, mCustomThemeWrapper, locale, windowWidth, accessToken, accountName, postType, postLayout, true, - mSharedPreferences, mNsfwAndSpoilerSharedPreferences, exoCreator, new PostRecyclerViewAdapter.Callback() { + mSharedPreferences, mNsfwAndSpoilerSharedPreferences, mPostHistorySharedPreferences, + mExoCreator, new PostRecyclerViewAdapter.Callback() { @Override public void retryLoadingMore() { mPostViewModel.retryLoadingMore(); @@ -660,10 +693,19 @@ public class PostFragment extends Fragment implements FragmentCommunicator { @Override public void typeChipClicked(int filter) { - Intent intent = new Intent(activity, FilteredThingActivity.class); - intent.putExtra(FilteredThingActivity.EXTRA_NAME, activity.getString(R.string.best)); - intent.putExtra(FilteredThingActivity.EXTRA_POST_TYPE, postType); - intent.putExtra(FilteredThingActivity.EXTRA_FILTER, filter); + Intent intent = new Intent(activity, FilteredPostsActivity.class); + intent.putExtra(FilteredPostsActivity.EXTRA_NAME, activity.getString(R.string.best)); + intent.putExtra(FilteredPostsActivity.EXTRA_POST_TYPE, postType); + intent.putExtra(FilteredPostsActivity.EXTRA_FILTER, filter); + startActivity(intent); + } + + @Override + public void nsfwChipClicked() { + Intent intent = new Intent(activity, FilteredPostsActivity.class); + intent.putExtra(FilteredPostsActivity.EXTRA_NAME, activity.getString(R.string.best)); + intent.putExtra(FilteredPostsActivity.EXTRA_POST_TYPE, postType); + intent.putExtra(FilteredPostsActivity.EXTRA_FILTER, Post.NSFW_TYPE); startActivity(intent); } @@ -679,16 +721,71 @@ public class PostFragment extends Fragment implements FragmentCommunicator { TransitionManager.beginDelayedTransition(mPostRecyclerView, new AutoTransition()); } }); - - mPostViewModel = new ViewModelProvider(this, new PostViewModel.Factory(mOauthRetrofit, accessToken, - accountName, locale, mSharedPreferences, postFeedScrolledPositionSharedPreferences, - postType, sortType, filter, nsfw)).get(PostViewModel.class); } + mAdapter.setHideReadPostsIndex(hideReadPostsIndex); + if (activity instanceof ActivityToolbarInterface) { ((ActivityToolbarInterface) activity).displaySortType(); } + if (accountName != null && !accountName.equals("")) { + if (mPostHistorySharedPreferences.getBoolean(accountName + SharedPreferencesUtils.MARK_POSTS_AS_READ_BASE, false) && readPosts == null) { + if (getArguments().getBoolean(EXTRA_DISABLE_READ_POSTS, false)) { + if (postFilter == null) { + FetchPostFilterAndReadPosts.fetchPostFilterAndReadPosts(mRedditDataRoomDatabase, mExecutor, + new Handler(), null, usage, nameOfUsage, (postFilter, readPostList) -> { + if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) { + this.postFilter = postFilter; + postFilter.allowNSFW = mNsfwAndSpoilerSharedPreferences.getBoolean((accountName == null ? "" : accountName) + SharedPreferencesUtils.NSFW_BASE, false); + initializeAndBindPostViewModel(accessToken); + } + }); + } else { + initializeAndBindPostViewModel(accessToken); + } + } else { + FetchPostFilterAndReadPosts.fetchPostFilterAndReadPosts(mRedditDataRoomDatabase, mExecutor, + new Handler(), accountName, usage, nameOfUsage, (postFilter, readPostList) -> { + if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) { + if (this.postFilter == null) { + this.postFilter = postFilter; + postFilter.allowNSFW = mNsfwAndSpoilerSharedPreferences.getBoolean((accountName == null ? "" : accountName) + SharedPreferencesUtils.NSFW_BASE, false); + } + this.readPosts = readPostList; + initializeAndBindPostViewModel(accessToken); + } + }); + } + } else { + if (postFilter == null) { + FetchPostFilterAndReadPosts.fetchPostFilterAndReadPosts(mRedditDataRoomDatabase, mExecutor, + new Handler(), null, usage, nameOfUsage, (postFilter, readPostList) -> { + if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) { + this.postFilter = postFilter; + postFilter.allowNSFW = mNsfwAndSpoilerSharedPreferences.getBoolean((accountName == null ? "" : accountName) + SharedPreferencesUtils.NSFW_BASE, false); + initializeAndBindPostViewModel(accessToken); + } + }); + } else { + initializeAndBindPostViewModel(accessToken); + } + } + } else { + if (postFilter == null) { + FetchPostFilterAndReadPosts.fetchPostFilterAndReadPosts(mRedditDataRoomDatabase, mExecutor, + new Handler(), null, usage, nameOfUsage, (postFilter, readPostList) -> { + if (activity != null && !activity.isFinishing() && !activity.isDestroyed()) { + this.postFilter = postFilter; + postFilter.allowNSFW = mNsfwAndSpoilerSharedPreferences.getBoolean((accountName == null ? "" : accountName) + SharedPreferencesUtils.NSFW_BASE, false); + initializeAndBindPostViewModelForAnonymous(accessToken); + } + }); + } else { + initializeAndBindPostViewModelForAnonymous(accessToken); + } + } + vibrateWhenActionTriggered = mSharedPreferences.getBoolean(SharedPreferencesUtils.VIBRATE_WHEN_ACTION_TRIGGERED, true); swipeActionThreshold = Float.parseFloat(mSharedPreferences.getString(SharedPreferencesUtils.SWIPE_ACTION_THRESHOLD, "0.3")); swipeRightAction = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.SWIPE_RIGHT_ACTION, "1")); @@ -795,11 +892,68 @@ public class PostFragment extends Fragment implements FragmentCommunicator { return new PlaybackInfo(INDEX_UNSET, TIME_UNSET, volumeInfo); }); - if (mPostViewModel != null) { - bindPostViewModel(); + return rootView; + } + + private void initializeAndBindPostViewModel(String accessToken) { + if (postType == PostDataSource.TYPE_SEARCH) { + mPostViewModel = new ViewModelProvider(PostFragment.this, new PostViewModel.Factory(accessToken == null ? mRetrofit : mOauthRetrofit, accessToken, + accountName, mSharedPreferences, + mPostFeedScrolledPositionSharedPreferences, subredditName, query, postType, sortType, + postFilter, readPosts)).get(PostViewModel.class); + } else if (postType == PostDataSource.TYPE_SUBREDDIT) { + mPostViewModel = new ViewModelProvider(PostFragment.this, new PostViewModel.Factory(accessToken == null ? mRetrofit : mOauthRetrofit, accessToken, + accountName, mSharedPreferences, + mPostFeedScrolledPositionSharedPreferences, subredditName, postType, sortType, + postFilter, readPosts)).get(PostViewModel.class); + } else if (postType == PostDataSource.TYPE_MULTI_REDDIT) { + mPostViewModel = new ViewModelProvider(PostFragment.this, new PostViewModel.Factory(accessToken == null ? mRetrofit : mOauthRetrofit, accessToken, + accountName, mSharedPreferences, + mPostFeedScrolledPositionSharedPreferences, multiRedditPath, postType, sortType, + postFilter, readPosts)).get(PostViewModel.class); + } else if (postType == PostDataSource.TYPE_USER) { + mPostViewModel = new ViewModelProvider(PostFragment.this, new PostViewModel.Factory(accessToken == null ? mRetrofit : mOauthRetrofit, accessToken, + accountName, mSharedPreferences, + mPostFeedScrolledPositionSharedPreferences, username, postType, sortType, postFilter, + where, readPosts)).get(PostViewModel.class); + } else { + mPostViewModel = new ViewModelProvider(PostFragment.this, new PostViewModel.Factory(mOauthRetrofit, accessToken, + accountName, mSharedPreferences, mPostFeedScrolledPositionSharedPreferences, + postType, sortType, postFilter, readPosts)).get(PostViewModel.class); } - return rootView; + bindPostViewModel(); + } + + private void initializeAndBindPostViewModelForAnonymous(String accessToken) { + //For anonymous user + if (postType == PostDataSource.TYPE_SEARCH) { + mPostViewModel = new ViewModelProvider(PostFragment.this, new PostViewModel.Factory(accessToken == null ? mRetrofit : mOauthRetrofit, accessToken, + accountName, mSharedPreferences, + mPostFeedScrolledPositionSharedPreferences, subredditName, query, postType, sortType, + postFilter, readPosts)).get(PostViewModel.class); + } else if (postType == PostDataSource.TYPE_SUBREDDIT) { + mPostViewModel = new ViewModelProvider(this, new PostViewModel.Factory(accessToken == null ? mRetrofit : mOauthRetrofit, accessToken, + accountName, mSharedPreferences, + mPostFeedScrolledPositionSharedPreferences, subredditName, postType, sortType, + postFilter, readPosts)).get(PostViewModel.class); + } else if (postType == PostDataSource.TYPE_MULTI_REDDIT) { + mPostViewModel = new ViewModelProvider(PostFragment.this, new PostViewModel.Factory(accessToken == null ? mRetrofit : mOauthRetrofit, accessToken, + accountName, mSharedPreferences, + mPostFeedScrolledPositionSharedPreferences, multiRedditPath, postType, sortType, postFilter, + readPosts)).get(PostViewModel.class); + } else if (postType == PostDataSource.TYPE_USER) { + mPostViewModel = new ViewModelProvider(PostFragment.this, new PostViewModel.Factory(accessToken == null ? mRetrofit : mOauthRetrofit, accessToken, + accountName, mSharedPreferences, + mPostFeedScrolledPositionSharedPreferences, username, postType, sortType, postFilter, + where, readPosts)).get(PostViewModel.class); + } else { + mPostViewModel = new ViewModelProvider(PostFragment.this, new PostViewModel.Factory(mOauthRetrofit, accessToken, + accountName, mSharedPreferences, mPostFeedScrolledPositionSharedPreferences, + postType, sortType, postFilter, readPosts)).get(PostViewModel.class); + } + + bindPostViewModel(); } private void bindPostViewModel() { @@ -852,13 +1006,13 @@ public class PostFragment extends Fragment implements FragmentCommunicator { break; case PostDataSource.TYPE_USER: mSortTypeSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TYPE_USER_POST_BASE + username, sortType.getType().name()).apply(); - if(sortType.getTime() != null) { + if (sortType.getTime() != null) { mSortTypeSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TIME_USER_POST_BASE + username, sortType.getTime().name()).apply(); } break; case PostDataSource.TYPE_SEARCH: mSortTypeSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TYPE_SEARCH_POST, sortType.getType().name()).apply(); - if(sortType.getTime() != null) { + if (sortType.getTime() != null) { mSortTypeSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TIME_SEARCH_POST, sortType.getTime().name()).apply(); } break; @@ -886,18 +1040,18 @@ public class PostFragment extends Fragment implements FragmentCommunicator { private void initializeSwipeActionDrawable() { if (swipeRightAction == SharedPreferencesUtils.SWIPE_ACITON_DOWNVOTE) { - backgroundSwipeRight = new ColorDrawable(customThemeWrapper.getDownvoted()); + backgroundSwipeRight = new ColorDrawable(mCustomThemeWrapper.getDownvoted()); drawableSwipeRight = ResourcesCompat.getDrawable(activity.getResources(), R.drawable.ic_arrow_downward_black_24dp, null); } else { - backgroundSwipeRight = new ColorDrawable(customThemeWrapper.getUpvoted()); + backgroundSwipeRight = new ColorDrawable(mCustomThemeWrapper.getUpvoted()); drawableSwipeRight = ResourcesCompat.getDrawable(activity.getResources(), R.drawable.ic_arrow_upward_black_24dp, null); } if (swipeLeftAction == SharedPreferencesUtils.SWIPE_ACITON_UPVOTE) { - backgroundSwipeLeft = new ColorDrawable(customThemeWrapper.getUpvoted()); + backgroundSwipeLeft = new ColorDrawable(mCustomThemeWrapper.getUpvoted()); drawableSwipeLeft = ResourcesCompat.getDrawable(activity.getResources(), R.drawable.ic_arrow_upward_black_24dp, null); } else { - backgroundSwipeLeft = new ColorDrawable(customThemeWrapper.getDownvoted()); + backgroundSwipeLeft = new ColorDrawable(mCustomThemeWrapper.getDownvoted()); drawableSwipeLeft = ResourcesCompat.getDrawable(activity.getResources(), R.drawable.ic_arrow_downward_black_24dp, null); } } @@ -912,7 +1066,10 @@ public class PostFragment extends Fragment implements FragmentCommunicator { public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); outState.putBoolean(IS_IN_LAZY_MODE_STATE, isInLazyMode); - outState.putParcelableArrayList(SUBREDDIT_FILTER_LIST_STATE, subredditFilterList); + outState.putParcelableArrayList(READ_POST_LIST_STATE, readPosts); + if (mAdapter != null) { + outState.putInt(HIDE_READ_POSTS_INDEX_STATE, mAdapter.getHideReadPostsIndex()); + } if (mLinearLayoutManager != null) { outState.putInt(RECYCLER_VIEW_POSITION_STATE, mLinearLayoutManager.findFirstVisibleItemPosition()); } else if (mStaggeredGridLayoutManager != null) { @@ -920,6 +1077,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator { outState.putInt(RECYCLER_VIEW_POSITION_STATE, mStaggeredGridLayoutManager.findFirstVisibleItemPositions(into)[0]); } + outState.putParcelable(POST_FILTER_STATE, postFilter); } @Override @@ -935,7 +1093,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator { String accountNameForCache = accountName == null ? SharedPreferencesUtils.FRONT_PAGE_SCROLLED_POSITION_ANONYMOUS : accountName; String key = accountNameForCache + SharedPreferencesUtils.FRONT_PAGE_SCROLLED_POSITION_FRONT_PAGE_BASE; String value = currentPost.getFullName(); - postFeedScrolledPositionSharedPreferences.edit().putString(key, value).apply(); + mPostFeedScrolledPositionSharedPreferences.edit().putString(key, value).apply(); } } } @@ -963,7 +1121,8 @@ public class PostFragment extends Fragment implements FragmentCommunicator { @Override public void changeNSFW(boolean nsfw) { - mPostViewModel.changeNSFW(nsfw); + postFilter.allowNSFW = nsfw; + mPostViewModel.changePostFilter(postFilter); } @Override @@ -1075,9 +1234,63 @@ public class PostFragment extends Fragment implements FragmentCommunicator { @Override public void applyTheme() { - mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(customThemeWrapper.getCircularProgressBarBackground()); - mSwipeRefreshLayout.setColorSchemeColors(customThemeWrapper.getColorAccent()); - mFetchPostInfoTextView.setTextColor(customThemeWrapper.getSecondaryTextColor()); + mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(mCustomThemeWrapper.getCircularProgressBarBackground()); + mSwipeRefreshLayout.setColorSchemeColors(mCustomThemeWrapper.getColorAccent()); + mFetchPostInfoTextView.setTextColor(mCustomThemeWrapper.getSecondaryTextColor()); + } + + @Override + public void hideReadPosts() { + if (mAdapter != null) { + mAdapter.prepareToHideReadPosts(); + refreshAdapter(); + } + } + + @Override + public void changePostFilter(PostFilter postFilter) { + this.postFilter = postFilter; + postFilter.allowNSFW = mNsfwAndSpoilerSharedPreferences.getBoolean((accountName == null ? "" : accountName) + SharedPreferencesUtils.NSFW_BASE, false); + if (mPostViewModel != null) { + mPostViewModel.changePostFilter(postFilter); + } + } + + @Override + public PostFilter getPostFilter() { + return postFilter; + } + + @Override + public void filterPosts() { + if (postType == PostDataSource.TYPE_SEARCH) { + Intent intent = new Intent(activity, FilteredPostsActivity.class); + intent.putExtra(FilteredPostsActivity.EXTRA_NAME, subredditName); + intent.putExtra(FilteredPostsActivity.EXTRA_QUERY, query); + intent.putExtra(FilteredPostsActivity.EXTRA_POST_TYPE, postType); + startActivity(intent); + } else if (postType == PostDataSource.TYPE_SUBREDDIT) { + Intent intent = new Intent(activity, FilteredPostsActivity.class); + intent.putExtra(FilteredPostsActivity.EXTRA_NAME, subredditName); + intent.putExtra(FilteredPostsActivity.EXTRA_POST_TYPE, postType); + startActivity(intent); + } else if (postType == PostDataSource.TYPE_MULTI_REDDIT) { + Intent intent = new Intent(activity, FilteredPostsActivity.class); + intent.putExtra(FilteredPostsActivity.EXTRA_NAME, multiRedditPath); + intent.putExtra(FilteredPostsActivity.EXTRA_POST_TYPE, postType); + startActivity(intent); + } else if (postType == PostDataSource.TYPE_USER) { + Intent intent = new Intent(activity, FilteredPostsActivity.class); + intent.putExtra(FilteredPostsActivity.EXTRA_NAME, username); + intent.putExtra(FilteredPostsActivity.EXTRA_POST_TYPE, postType); + intent.putExtra(FilteredPostsActivity.EXTRA_USER_WHERE, where); + startActivity(intent); + } else { + Intent intent = new Intent(activity, FilteredPostsActivity.class); + intent.putExtra(FilteredPostsActivity.EXTRA_NAME, activity.getString(R.string.best)); + intent.putExtra(FilteredPostsActivity.EXTRA_POST_TYPE, postType); + startActivity(intent); + } } @Subscribe @@ -1399,6 +1612,12 @@ public class PostFragment extends Fragment implements FragmentCommunicator { } @Override + public void onDestroyView() { + super.onDestroyView(); + unbinder.unbind(); + } + + @Override public void onDestroy() { EventBus.getDefault().unregister(this); super.onDestroy(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SubredditListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SubredditListingFragment.java index 14bfbf0a..2924b393 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SubredditListingFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SubredditListingFragment.java @@ -30,17 +30,18 @@ import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; -import ml.docilealligator.infinityforreddit.activities.BaseActivity; -import ml.docilealligator.infinityforreddit.activities.SearchSubredditsResultActivity; -import ml.docilealligator.infinityforreddit.activities.ViewSubredditDetailActivity; -import ml.docilealligator.infinityforreddit.adapters.SubredditListingRecyclerViewAdapter; -import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.FragmentCommunicator; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.NetworkState; +import ml.docilealligator.infinityforreddit.PostFragmentContentScrollingInterface; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; import ml.docilealligator.infinityforreddit.SortType; +import ml.docilealligator.infinityforreddit.activities.BaseActivity; +import ml.docilealligator.infinityforreddit.activities.SearchSubredditsResultActivity; +import ml.docilealligator.infinityforreddit.activities.ViewSubredditDetailActivity; +import ml.docilealligator.infinityforreddit.adapters.SubredditListingRecyclerViewAdapter; +import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.subreddit.SubredditListingViewModel; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; import retrofit2.Retrofit; @@ -156,6 +157,19 @@ public class SubredditListingFragment extends Fragment implements FragmentCommun mSubredditListingRecyclerView.setAdapter(mAdapter); + if (mActivity instanceof PostFragmentContentScrollingInterface) { + mSubredditListingRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { + @Override + public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { + if (dy > 0) { + ((PostFragmentContentScrollingInterface) mActivity).contentScrollDown(); + } else if (dy < 0) { + ((PostFragmentContentScrollingInterface) mActivity).contentScrollUp(); + } + } + }); + } + SubredditListingViewModel.Factory factory = new SubredditListingViewModel.Factory( accessToken == null ? mRetrofit : mOauthRetrofit, query, sortType, accessToken, nsfw); mSubredditListingViewModel = new ViewModelProvider(this, factory).get(SubredditListingViewModel.class); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/UserListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/UserListingFragment.java index 6d833f4e..c663bd63 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/UserListingFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/UserListingFragment.java @@ -29,15 +29,16 @@ import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; -import ml.docilealligator.infinityforreddit.activities.BaseActivity; -import ml.docilealligator.infinityforreddit.adapters.UserListingRecyclerViewAdapter; -import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.FragmentCommunicator; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.NetworkState; +import ml.docilealligator.infinityforreddit.PostFragmentContentScrollingInterface; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; import ml.docilealligator.infinityforreddit.SortType; +import ml.docilealligator.infinityforreddit.activities.BaseActivity; +import ml.docilealligator.infinityforreddit.adapters.UserListingRecyclerViewAdapter; +import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.user.UserListingViewModel; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; import retrofit2.Retrofit; @@ -135,6 +136,19 @@ public class UserListingFragment extends Fragment implements FragmentCommunicato mUserListingRecyclerView.setAdapter(mAdapter); + if (mActivity instanceof PostFragmentContentScrollingInterface) { + mUserListingRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { + @Override + public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { + if (dy > 0) { + ((PostFragmentContentScrollingInterface) mActivity).contentScrollDown(); + } else if (dy < 0) { + ((PostFragmentContentScrollingInterface) mActivity).contentScrollUp(); + } + } + }); + } + UserListingViewModel.Factory factory = new UserListingViewModel.Factory(mRetrofit, mQuery, sortType, nsfw); mUserListingViewModel = new ViewModelProvider(this, factory).get(UserListingViewModel.class); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurImageFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurImageFragment.java index d97fedd4..51bfeb6c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurImageFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurImageFragment.java @@ -157,7 +157,7 @@ public class ViewImgurImageFragment extends Fragment { isDownloading = true; - if (Build.VERSION.SDK_INT >= 23) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (ContextCompat.checkSelfPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { @@ -238,11 +238,7 @@ public class ViewImgurImageFragment extends Fragment { intent.putExtra(DownloadMediaService.EXTRA_URL, imgurMedia.getLink()); intent.putExtra(DownloadMediaService.EXTRA_MEDIA_TYPE, DownloadMediaService.EXTRA_MEDIA_TYPE_IMAGE); intent.putExtra(DownloadMediaService.EXTRA_FILE_NAME, imgurMedia.getFileName()); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - activity.startForegroundService(intent); - } else { - activity.startService(intent); - } + ContextCompat.startForegroundService(activity, intent); Toast.makeText(activity, R.string.download_started, Toast.LENGTH_SHORT).show(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java index e95306bb..01961e17 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java @@ -149,7 +149,7 @@ public class ViewImgurVideoFragment extends Fragment { public boolean onOptionsItemSelected(@NonNull MenuItem item) { if (item.getItemId() == R.id.action_download_view_imgur_video_fragment) { isDownloading = true; - if (Build.VERSION.SDK_INT >= 23) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (ContextCompat.checkSelfPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { @@ -189,11 +189,7 @@ public class ViewImgurVideoFragment extends Fragment { intent.putExtra(DownloadMediaService.EXTRA_URL, imgurMedia.getLink()); intent.putExtra(DownloadMediaService.EXTRA_MEDIA_TYPE, DownloadMediaService.EXTRA_MEDIA_TYPE_VIDEO); intent.putExtra(DownloadMediaService.EXTRA_FILE_NAME, imgurMedia.getFileName()); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - activity.startForegroundService(intent); - } else { - activity.startService(intent); - } + ContextCompat.startForegroundService(activity, intent); Toast.makeText(activity, R.string.download_started, Toast.LENGTH_SHORT).show(); } @@ -278,6 +274,8 @@ public class ViewImgurVideoFragment extends Fragment { @Override public void onDestroy() { super.onDestroy(); + player.seekToDefaultPosition(); + player.stop(true); player.release(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryImageOrGifFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryImageOrGifFragment.java index 12e4a884..585730d5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryImageOrGifFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryImageOrGifFragment.java @@ -223,7 +223,7 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment { isDownloading = true; - if (Build.VERSION.SDK_INT >= 23) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (ContextCompat.checkSelfPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { @@ -272,11 +272,7 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment { intent.putExtra(DownloadMediaService.EXTRA_MEDIA_TYPE, media.mediaType == Post.Gallery.TYPE_GIF ? DownloadMediaService.EXTRA_MEDIA_TYPE_GIF: DownloadMediaService.EXTRA_MEDIA_TYPE_IMAGE); intent.putExtra(DownloadMediaService.EXTRA_FILE_NAME, media.fileName); intent.putExtra(DownloadMediaService.EXTRA_SUBREDDIT_NAME, subredditName); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - activity.startForegroundService(intent); - } else { - activity.startService(intent); - } + ContextCompat.startForegroundService(activity, intent); Toast.makeText(activity, R.string.download_started, Toast.LENGTH_SHORT).show(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java index e2d16f22..a1258ce2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java @@ -152,7 +152,7 @@ public class ViewRedditGalleryVideoFragment extends Fragment { public boolean onOptionsItemSelected(@NonNull MenuItem item) { if (item.getItemId() == R.id.action_download_view_reddit_gallery_video_fragment) { isDownloading = true; - if (Build.VERSION.SDK_INT >= 23) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (ContextCompat.checkSelfPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { @@ -193,11 +193,7 @@ public class ViewRedditGalleryVideoFragment extends Fragment { intent.putExtra(DownloadMediaService.EXTRA_MEDIA_TYPE, DownloadMediaService.EXTRA_MEDIA_TYPE_VIDEO); intent.putExtra(DownloadMediaService.EXTRA_FILE_NAME, galleryVideo.fileName); intent.putExtra(DownloadMediaService.EXTRA_SUBREDDIT_NAME, subredditName); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - activity.startForegroundService(intent); - } else { - activity.startService(intent); - } + ContextCompat.startForegroundService(activity, intent); Toast.makeText(activity, R.string.download_started, Toast.LENGTH_SHORT).show(); } @@ -282,6 +278,8 @@ public class ViewRedditGalleryVideoFragment extends Fragment { @Override public void onDestroy() { super.onDestroy(); + player.seekToDefaultPosition(); + player.stop(true); player.release(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/post/ParsePost.java b/app/src/main/java/ml/docilealligator/infinityforreddit/post/ParsePost.java index 708f4e75..c5aa3990 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/ParsePost.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/ParsePost.java @@ -3,17 +3,19 @@ package ml.docilealligator.infinityforreddit.post; import android.net.Uri; import android.os.AsyncTask; import android.text.Html; +import android.util.Log; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; +import java.util.HashSet; import java.util.LinkedHashSet; import java.util.List; -import ml.docilealligator.infinityforreddit.fragments.PostFragment; -import ml.docilealligator.infinityforreddit.subredditfilter.SubredditFilter; +import ml.docilealligator.infinityforreddit.postfilter.PostFilter; +import ml.docilealligator.infinityforreddit.readpost.ReadPost; import ml.docilealligator.infinityforreddit.utils.JSONUtils; import ml.docilealligator.infinityforreddit.utils.Utils; @@ -22,18 +24,15 @@ import ml.docilealligator.infinityforreddit.utils.Utils; */ public class ParsePost { - public static void parsePosts(String response, int nPosts, int filter, boolean nsfw, + public static void parsePosts(String response, int nPosts, PostFilter postFilter, List<ReadPost> readPostList, ParsePostsListingListener parsePostsListingListener) { - new ParsePostDataAsyncTask(response, nPosts, filter, nsfw, parsePostsListingListener).execute(); - } - - public static void parsePosts(String response, int nPosts, int filter, boolean nsfw, - List<SubredditFilter> subredditFilterList, ParsePostsListingListener parsePostsListingListener) { - new ParsePostDataAsyncTask(response, nPosts, filter, nsfw, subredditFilterList, parsePostsListingListener).execute(); + new ParsePostDataAsyncTask(response, nPosts, postFilter, readPostList, parsePostsListingListener).execute(); } public static void parsePost(String response, ParsePostListener parsePostListener) { - new ParsePostDataAsyncTask(response, true, parsePostListener).execute(); + PostFilter postFilter = new PostFilter(); + postFilter.allowNSFW = true; + new ParsePostDataAsyncTask(response, postFilter, parsePostListener).execute(); } private static Post parseBasicData(JSONObject data) throws JSONException { @@ -243,6 +242,9 @@ public class ParsePost { //Video post JSONObject redditVideoObject = data.getJSONObject(JSONUtils.MEDIA_KEY).getJSONObject(JSONUtils.REDDIT_VIDEO_KEY); int postType = Post.VIDEO_TYPE; + if (!redditVideoObject.has(JSONUtils.HLS_URL_KEY)) { + Log.i("afasd", "s " + redditVideoObject); + } String videoUrl = Html.fromHtml(redditVideoObject.getString(JSONUtils.HLS_URL_KEY)).toString(); String videoDownloadUrl = redditVideoObject.getString(JSONUtils.FALLBACK_URL_KEY); @@ -488,9 +490,8 @@ public class ParsePost { private static class ParsePostDataAsyncTask extends AsyncTask<Void, Void, Void> { private JSONArray allData; private int nPosts; - private int filter; - private boolean nsfw; - private List<SubredditFilter> subredditFilterList; + private PostFilter postFilter; + private List<ReadPost> readPostList; private ParsePostsListingListener parsePostsListingListener; private ParsePostListener parsePostListener; private LinkedHashSet<Post> newPosts; @@ -498,7 +499,7 @@ public class ParsePost { private String lastItem; private boolean parseFailed; - ParsePostDataAsyncTask(String response, int nPosts, int filter, boolean nsfw, + ParsePostDataAsyncTask(String response, int nPosts, PostFilter postFilter, List<ReadPost> readPostList, ParsePostsListingListener parsePostsListingListener) { this.parsePostsListingListener = parsePostsListingListener; try { @@ -506,8 +507,8 @@ public class ParsePost { allData = jsonResponse.getJSONObject(JSONUtils.DATA_KEY).getJSONArray(JSONUtils.CHILDREN_KEY); lastItem = jsonResponse.getJSONObject(JSONUtils.DATA_KEY).getString(JSONUtils.AFTER_KEY); this.nPosts = nPosts; - this.filter = filter; - this.nsfw = nsfw; + this.postFilter = postFilter; + this.readPostList = readPostList; newPosts = new LinkedHashSet<>(); parseFailed = false; } catch (JSONException e) { @@ -516,18 +517,12 @@ public class ParsePost { } } - ParsePostDataAsyncTask(String response, int nPosts, int filter, boolean nsfw, - List<SubredditFilter> subredditFilterList, ParsePostsListingListener parsePostsListingListener) { - this(response, nPosts, filter, nsfw, parsePostsListingListener); - this.subredditFilterList = subredditFilterList; - } - - ParsePostDataAsyncTask(String response, boolean nsfw, + ParsePostDataAsyncTask(String response, PostFilter postFilter, ParsePostListener parsePostListener) { this.parsePostListener = parsePostListener; try { allData = new JSONArray(response).getJSONObject(0).getJSONObject(JSONUtils.DATA_KEY).getJSONArray(JSONUtils.CHILDREN_KEY); - this.nsfw = nsfw; + this.postFilter = postFilter; parseFailed = false; } catch (JSONException e) { e.printStackTrace(); @@ -564,30 +559,20 @@ public class ParsePost { size = nPosts; } + HashSet<ReadPost> readPostHashSet = null; + if (readPostList != null) { + readPostHashSet = new HashSet<>(readPostList); + } for (int i = 0; i < size; i++) { try { if (allData.getJSONObject(i).getString(JSONUtils.KIND_KEY).equals("t3")) { JSONObject data = allData.getJSONObject(i).getJSONObject(JSONUtils.DATA_KEY); Post post = parseBasicData(data); - boolean availablePost = true; - if (subredditFilterList != null) { - for (SubredditFilter subredditFilter : subredditFilterList) { - if (subredditFilter.getSubredditName().equals(post.getSubredditName())) { - availablePost = false; - break; - } - } + if (readPostHashSet != null && readPostHashSet.contains(ReadPost.convertPost(post))) { + post.markAsRead(); } - if (availablePost && !(!nsfw && post.isNSFW())) { - if (filter == PostFragment.EXTRA_NO_FILTER) { - newPosts.add(post); - } else if (filter == post.getPostType()) { - newPosts.add(post); - } else if (filter == Post.LINK_TYPE && post.getPostType() == Post.NO_PREVIEW_LINK_TYPE) { - newPosts.add(post); - } else if (filter == Post.NSFW_TYPE && post.isNSFW()) { - newPosts.add(post); - } + if (PostFilter.isPostAllowed(post, postFilter)) { + newPosts.add(post); } } } catch (JSONException e) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/post/Post.java b/app/src/main/java/ml/docilealligator/infinityforreddit/post/Post.java index 1e220487..9449b050 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/Post.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/Post.java @@ -71,6 +71,8 @@ public class Post implements Parcelable { private boolean locked; private boolean saved; private boolean isCrosspost; + private boolean isRead; + private boolean isHiddenInRecyclerView = false; private String crosspostParentId; private ArrayList<Preview> previews = new ArrayList<>(); private ArrayList<Gallery> gallery = new ArrayList<>(); @@ -107,6 +109,7 @@ public class Post implements Parcelable { this.locked = locked; this.saved = saved; this.isCrosspost = isCrosspost; + isRead = false; } public Post(String id, String fullName, String subredditName, String subredditNamePrefixed, @@ -142,6 +145,7 @@ public class Post implements Parcelable { this.locked = locked; this.saved = saved; this.isCrosspost = isCrosspost; + isRead = false; } protected Post(Parcel in) { @@ -183,6 +187,8 @@ public class Post implements Parcelable { locked = in.readByte() != 0; saved = in.readByte() != 0; isCrosspost = in.readByte() != 0; + isRead = in.readByte() != 0; + isHiddenInRecyclerView = in.readByte() != 0; crosspostParentId = in.readString(); in.readTypedList(previews, Preview.CREATOR); in.readTypedList(gallery, Gallery.CREATOR); @@ -353,7 +359,7 @@ public class Post implements Parcelable { awards += newAwardsHTML; } - public int getnAwards() { + public int getNAwards() { return nAwards; } @@ -446,6 +452,22 @@ public class Post implements Parcelable { return isCrosspost; } + public void markAsRead() { + isRead = true; + } + + public boolean isRead() { + return isRead; + } + + public boolean isHiddenInRecyclerView() { + return isHiddenInRecyclerView; + } + + public void hidePostInRecyclerView() { + isHiddenInRecyclerView = true; + } + public String getCrosspostParentId() { return crosspostParentId; } @@ -510,6 +532,8 @@ public class Post implements Parcelable { parcel.writeByte((byte) (locked ? 1 : 0)); parcel.writeByte((byte) (saved ? 1 : 0)); parcel.writeByte((byte) (isCrosspost ? 1 : 0)); + parcel.writeByte((byte) (isRead ? 1 : 0)); + parcel.writeByte((byte) (isHiddenInRecyclerView ? 1 : 0)); parcel.writeString(crosspostParentId); parcel.writeTypedList(previews); parcel.writeTypedList(gallery); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostDataSource.java b/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostDataSource.java index e1e50733..ceeccb94 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostDataSource.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostDataSource.java @@ -9,12 +9,12 @@ import androidx.paging.PageKeyedDataSource; import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; -import java.util.Locale; -import ml.docilealligator.infinityforreddit.apis.RedditAPI; import ml.docilealligator.infinityforreddit.NetworkState; import ml.docilealligator.infinityforreddit.SortType; -import ml.docilealligator.infinityforreddit.subredditfilter.SubredditFilter; +import ml.docilealligator.infinityforreddit.apis.RedditAPI; +import ml.docilealligator.infinityforreddit.postfilter.PostFilter; +import ml.docilealligator.infinityforreddit.readpost.ReadPost; import ml.docilealligator.infinityforreddit.utils.APIUtils; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; import retrofit2.Call; @@ -39,16 +39,14 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> { private Retrofit retrofit; private String accessToken; private String accountName; - private Locale locale; private SharedPreferences sharedPreferences; private SharedPreferences postFeedScrolledPositionSharedPreferences; private String subredditOrUserName; private String query; private int postType; private SortType sortType; - private boolean nsfw; - private int filter; - private List<SubredditFilter> subredditFilterList; + private PostFilter postFilter; + private List<ReadPost> readPostList; private String userWhere; private String multiRedditPath; private LinkedHashSet<Post> postLinkedHashSet; @@ -60,13 +58,13 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> { private LoadParams<String> params; private LoadCallback<String, Post> callback; - PostDataSource(Retrofit retrofit, String accessToken, String accountName, Locale locale, - SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences, int postType, - SortType sortType, int filter, boolean nsfw) { + PostDataSource(Retrofit retrofit, String accessToken, String accountName, + SharedPreferences sharedPreferences, + SharedPreferences postFeedScrolledPositionSharedPreferences, int postType, + SortType sortType, PostFilter postFilter, List<ReadPost> readPostList) { this.retrofit = retrofit; this.accessToken = accessToken; this.accountName = accountName; - this.locale = locale; this.sharedPreferences = sharedPreferences; this.postFeedScrolledPositionSharedPreferences = postFeedScrolledPositionSharedPreferences; paginationNetworkStateLiveData = new MutableLiveData<>(); @@ -74,18 +72,18 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> { hasPostLiveData = new MutableLiveData<>(); this.postType = postType; this.sortType = sortType == null ? new SortType(SortType.Type.BEST) : sortType; - this.filter = filter; - this.nsfw = nsfw; + this.postFilter = postFilter; + this.readPostList = readPostList; postLinkedHashSet = new LinkedHashSet<>(); } - PostDataSource(Retrofit retrofit, String accessToken, String accountName, Locale locale, + PostDataSource(Retrofit retrofit, String accessToken, String accountName, SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences, - String path, int postType, SortType sortType, int filter, boolean nsfw, List<SubredditFilter> subredditFilterList) { + String path, int postType, SortType sortType, PostFilter postFilter, + List<ReadPost> readPostList) { this.retrofit = retrofit; this.accessToken = accessToken; this.accountName = accountName; - this.locale = locale; this.sharedPreferences = sharedPreferences; this.postFeedScrolledPositionSharedPreferences = postFeedScrolledPositionSharedPreferences; if (postType == TYPE_SUBREDDIT) { @@ -114,19 +112,18 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> { } else { this.sortType = sortType; } - this.filter = filter; - this.nsfw = nsfw; - this.subredditFilterList = subredditFilterList; + this.postFilter = postFilter; + this.readPostList = readPostList; postLinkedHashSet = new LinkedHashSet<>(); } - PostDataSource(Retrofit retrofit, String accessToken, String accountName, Locale locale, - SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences, String subredditOrUserName, - int postType, SortType sortType, String where, int filter, boolean nsfw) { + PostDataSource(Retrofit retrofit, String accessToken, String accountName, + SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences, + String subredditOrUserName, int postType, SortType sortType, PostFilter postFilter, + String where, List<ReadPost> readPostList) { this.retrofit = retrofit; this.accessToken = accessToken; this.accountName = accountName; - this.locale = locale; this.sharedPreferences = sharedPreferences; this.postFeedScrolledPositionSharedPreferences = postFeedScrolledPositionSharedPreferences; this.subredditOrUserName = subredditOrUserName; @@ -135,19 +132,19 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> { hasPostLiveData = new MutableLiveData<>(); this.postType = postType; this.sortType = sortType == null ? new SortType(SortType.Type.NEW) : sortType; + this.postFilter = postFilter; userWhere = where; - this.filter = filter; - this.nsfw = nsfw; + this.readPostList = readPostList; postLinkedHashSet = new LinkedHashSet<>(); } - PostDataSource(Retrofit retrofit, String accessToken, String accountName, Locale locale, - SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences, String subredditOrUserName, - String query, int postType, SortType sortType, int filter, boolean nsfw) { + PostDataSource(Retrofit retrofit, String accessToken, String accountName, + SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences, + String subredditOrUserName, String query, int postType, SortType sortType, PostFilter postFilter, + List<ReadPost> readPostList) { this.retrofit = retrofit; this.accessToken = accessToken; this.accountName = accountName; - this.locale = locale; this.sharedPreferences = sharedPreferences; this.postFeedScrolledPositionSharedPreferences = postFeedScrolledPositionSharedPreferences; this.subredditOrUserName = subredditOrUserName; @@ -157,9 +154,9 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> { hasPostLiveData = new MutableLiveData<>(); this.postType = postType; this.sortType = sortType == null ? new SortType(SortType.Type.RELEVANCE) : sortType; - this.filter = filter; - this.nsfw = nsfw; + this.postFilter = postFilter; postLinkedHashSet = new LinkedHashSet<>(); + this.readPostList = readPostList; } MutableLiveData<NetworkState> getPaginationNetworkStateLiveData() { @@ -250,7 +247,7 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> { @Override public void onResponse(@NonNull Call<String> call, @NonNull retrofit2.Response<String> response) { if (response.isSuccessful()) { - ParsePost.parsePosts(response.body(), -1, filter, nsfw, + ParsePost.parsePosts(response.body(), -1, postFilter, readPostList, new ParsePost.ParsePostsListingListener() { @Override public void onParsePostsListingSuccess(LinkedHashSet<Post> newPosts, String lastItem) { @@ -313,7 +310,7 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> { @Override public void onResponse(@NonNull Call<String> call, @NonNull retrofit2.Response<String> response) { if (response.isSuccessful()) { - ParsePost.parsePosts(response.body(), -1, filter, nsfw, + ParsePost.parsePosts(response.body(), -1, postFilter, readPostList, new ParsePost.ParsePostsListingListener() { @Override public void onParsePostsListingSuccess(LinkedHashSet<Post> newPosts, String lastItem) { @@ -323,7 +320,7 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> { int currentPostsSize = postLinkedHashSet.size(); postLinkedHashSet.addAll(newPosts); if (currentPostsSize == postLinkedHashSet.size()) { - callback.onResult(new ArrayList<>(), lastItem); + loadBestPostsAfter(params, callback, lastItem); } else { List<Post> newPostsList = new ArrayList<>(postLinkedHashSet).subList(currentPostsSize, postLinkedHashSet.size()); callback.onResult(newPostsList, lastItem); @@ -373,7 +370,7 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> { @Override public void onResponse(@NonNull Call<String> call, @NonNull retrofit2.Response<String> response) { if (response.isSuccessful()) { - ParsePost.parsePosts(response.body(), -1, filter, nsfw, subredditFilterList, + ParsePost.parsePosts(response.body(), -1, postFilter, readPostList, new ParsePost.ParsePostsListingListener() { @Override public void onParsePostsListingSuccess(LinkedHashSet<Post> newPosts, String lastItem) { @@ -447,7 +444,7 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> { @Override public void onResponse(@NonNull Call<String> call, @NonNull retrofit2.Response<String> response) { if (response.isSuccessful()) { - ParsePost.parsePosts(response.body(), -1, filter, nsfw, subredditFilterList, + ParsePost.parsePosts(response.body(), -1, postFilter, readPostList, new ParsePost.ParsePostsListingListener() { @Override public void onParsePostsListingSuccess(LinkedHashSet<Post> newPosts, String lastItem) { @@ -457,7 +454,7 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> { int currentPostsSize = postLinkedHashSet.size(); postLinkedHashSet.addAll(newPosts); if (currentPostsSize == postLinkedHashSet.size()) { - callback.onResult(new ArrayList<>(), lastItem); + loadSubredditPostsAfter(params, callback, lastItem); } else { List<Post> newPostsList = new ArrayList<>(postLinkedHashSet).subList(currentPostsSize, postLinkedHashSet.size()); callback.onResult(newPostsList, lastItem); @@ -508,7 +505,7 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> { @Override public void onResponse(@NonNull Call<String> call, @NonNull retrofit2.Response<String> response) { if (response.isSuccessful()) { - ParsePost.parsePosts(response.body(), -1, filter, nsfw, + ParsePost.parsePosts(response.body(), -1, postFilter, readPostList, new ParsePost.ParsePostsListingListener() { @Override public void onParsePostsListingSuccess(LinkedHashSet<Post> newPosts, String lastItem) { @@ -579,7 +576,7 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> { @Override public void onResponse(@NonNull Call<String> call, @NonNull retrofit2.Response<String> response) { if (response.isSuccessful()) { - ParsePost.parsePosts(response.body(), -1, filter, nsfw, + ParsePost.parsePosts(response.body(), -1, postFilter, readPostList, new ParsePost.ParsePostsListingListener() { @Override public void onParsePostsListingSuccess(LinkedHashSet<Post> newPosts, String lastItem) { @@ -589,7 +586,7 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> { int currentPostsSize = postLinkedHashSet.size(); postLinkedHashSet.addAll(newPosts); if (currentPostsSize == postLinkedHashSet.size()) { - callback.onResult(new ArrayList<>(), lastItem); + loadUserPostsAfter(params, callback, lastItem); } else { List<Post> newPostsList = new ArrayList<>(postLinkedHashSet).subList(currentPostsSize, postLinkedHashSet.size()); callback.onResult(newPostsList, lastItem); @@ -662,7 +659,7 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> { @Override public void onResponse(@NonNull Call<String> call, @NonNull retrofit2.Response<String> response) { if (response.isSuccessful()) { - ParsePost.parsePosts(response.body(), -1, filter, nsfw, + ParsePost.parsePosts(response.body(), -1, postFilter, readPostList, new ParsePost.ParsePostsListingListener() { @Override public void onParsePostsListingSuccess(LinkedHashSet<Post> newPosts, String lastItem) { @@ -753,7 +750,7 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> { @Override public void onResponse(@NonNull Call<String> call, @NonNull retrofit2.Response<String> response) { if (response.isSuccessful()) { - ParsePost.parsePosts(response.body(), -1, filter, nsfw, + ParsePost.parsePosts(response.body(), -1, postFilter, readPostList, new ParsePost.ParsePostsListingListener() { @Override public void onParsePostsListingSuccess(LinkedHashSet<Post> newPosts, String lastItem) { @@ -763,7 +760,7 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> { int currentPostsSize = postLinkedHashSet.size(); postLinkedHashSet.addAll(newPosts); if (currentPostsSize == postLinkedHashSet.size()) { - callback.onResult(new ArrayList<>(), lastItem); + loadSearchPostsAfter(params, callback, lastItem); } else { List<Post> newPostsList = new ArrayList<>(postLinkedHashSet).subList(currentPostsSize, postLinkedHashSet.size()); callback.onResult(newPostsList, lastItem); @@ -813,7 +810,7 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> { @Override public void onResponse(@NonNull Call<String> call, @NonNull retrofit2.Response<String> response) { if (response.isSuccessful()) { - ParsePost.parsePosts(response.body(), -1, filter, nsfw, + ParsePost.parsePosts(response.body(), -1, postFilter, readPostList, new ParsePost.ParsePostsListingListener() { @Override public void onParsePostsListingSuccess(LinkedHashSet<Post> newPosts, String lastItem) { @@ -884,7 +881,7 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> { @Override public void onResponse(@NonNull Call<String> call, @NonNull retrofit2.Response<String> response) { if (response.isSuccessful()) { - ParsePost.parsePosts(response.body(), -1, filter, nsfw, + ParsePost.parsePosts(response.body(), -1, postFilter, readPostList, new ParsePost.ParsePostsListingListener() { @Override public void onParsePostsListingSuccess(LinkedHashSet<Post> newPosts, String lastItem) { @@ -894,7 +891,7 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> { int currentPostsSize = postLinkedHashSet.size(); postLinkedHashSet.addAll(newPosts); if (currentPostsSize == postLinkedHashSet.size()) { - callback.onResult(new ArrayList<>(), lastItem); + loadMultiRedditPostsAfter(params, callback, lastItem); } else { List<Post> newPostsList = new ArrayList<>(postLinkedHashSet).subList(currentPostsSize, postLinkedHashSet.size()); callback.onResult(newPostsList, lastItem); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostDataSourceFactory.java b/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostDataSourceFactory.java index 5973e009..37da54fd 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostDataSourceFactory.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostDataSourceFactory.java @@ -1,99 +1,94 @@ package ml.docilealligator.infinityforreddit.post; import android.content.SharedPreferences; +import android.util.Log; import androidx.annotation.NonNull; import androidx.lifecycle.MutableLiveData; import androidx.paging.DataSource; import java.util.List; -import java.util.Locale; +import ml.docilealligator.infinityforreddit.postfilter.PostFilter; import ml.docilealligator.infinityforreddit.SortType; -import ml.docilealligator.infinityforreddit.subredditfilter.SubredditFilter; +import ml.docilealligator.infinityforreddit.readpost.ReadPost; import retrofit2.Retrofit; class PostDataSourceFactory extends DataSource.Factory { private Retrofit retrofit; private String accessToken; private String accountName; - private Locale locale; private SharedPreferences sharedPreferences; private SharedPreferences postFeedScrolledPositionSharedPreferences; private String subredditName; private String query; private int postType; private SortType sortType; + private PostFilter postFilter; private String userWhere; - private int filter; - private boolean nsfw; - private List<SubredditFilter> subredditFilterList; + private List<ReadPost> readPostList; private PostDataSource postDataSource; private MutableLiveData<PostDataSource> postDataSourceLiveData; - PostDataSourceFactory(Retrofit retrofit, String accessToken, String accountName, Locale locale, - SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences, - int postType, SortType sortType, int filter, boolean nsfw) { + PostDataSourceFactory(Retrofit retrofit, String accessToken, String accountName, + SharedPreferences sharedPreferences, + SharedPreferences postFeedScrolledPositionSharedPreferences, int postType, + SortType sortType, PostFilter postFilter, List<ReadPost> readPostList) { this.retrofit = retrofit; this.accessToken = accessToken; this.accountName = accountName; - this.locale = locale; this.sharedPreferences = sharedPreferences; this.postFeedScrolledPositionSharedPreferences = postFeedScrolledPositionSharedPreferences; postDataSourceLiveData = new MutableLiveData<>(); this.postType = postType; this.sortType = sortType; - this.filter = filter; - this.nsfw = nsfw; + this.postFilter = postFilter; + this.readPostList = readPostList; } - PostDataSourceFactory(Retrofit retrofit, String accessToken, String accountName, Locale locale, + PostDataSourceFactory(Retrofit retrofit, String accessToken, String accountName, SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences, - String subredditName, int postType, SortType sortType, int filter, boolean nsfw, - List<SubredditFilter> subredditFilterList) { + String subredditName, int postType, SortType sortType, PostFilter postFilter, + List<ReadPost> readPostList) { this.retrofit = retrofit; this.accessToken = accessToken; this.accountName = accountName; - this.locale = locale; this.sharedPreferences = sharedPreferences; this.postFeedScrolledPositionSharedPreferences = postFeedScrolledPositionSharedPreferences; this.subredditName = subredditName; postDataSourceLiveData = new MutableLiveData<>(); this.postType = postType; this.sortType = sortType; - this.filter = filter; - this.nsfw = nsfw; - this.subredditFilterList = subredditFilterList; + this.postFilter = postFilter; + this.readPostList = readPostList; } - PostDataSourceFactory(Retrofit retrofit, String accessToken, String accountName, Locale locale, + PostDataSourceFactory(Retrofit retrofit, String accessToken, String accountName, SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences, - String subredditName, int postType, SortType sortType, String where, int filter, - boolean nsfw) { + String subredditName, int postType, SortType sortType, PostFilter postFilter, + String where, List<ReadPost> readPostList) { this.retrofit = retrofit; this.accessToken = accessToken; this.accountName = accountName; - this.locale = locale; this.sharedPreferences = sharedPreferences; this.postFeedScrolledPositionSharedPreferences = postFeedScrolledPositionSharedPreferences; this.subredditName = subredditName; postDataSourceLiveData = new MutableLiveData<>(); this.postType = postType; this.sortType = sortType; + this.postFilter = postFilter; userWhere = where; - this.filter = filter; - this.nsfw = nsfw; + this.readPostList = readPostList; } - PostDataSourceFactory(Retrofit retrofit, String accessToken, String accountName, Locale locale, + PostDataSourceFactory(Retrofit retrofit, String accessToken, String accountName, SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences, - String subredditName, String query, int postType, SortType sortType, int filter, - boolean nsfw) { + String subredditName, String query, int postType, SortType sortType, PostFilter postFilter, + List<ReadPost> readPostList) { this.retrofit = retrofit; this.accessToken = accessToken; this.accountName = accountName; - this.locale = locale; this.sharedPreferences = sharedPreferences; this.postFeedScrolledPositionSharedPreferences = postFeedScrolledPositionSharedPreferences; this.subredditName = subredditName; @@ -101,25 +96,30 @@ class PostDataSourceFactory extends DataSource.Factory { postDataSourceLiveData = new MutableLiveData<>(); this.postType = postType; this.sortType = sortType; - this.filter = filter; - this.nsfw = nsfw; + this.postFilter = postFilter; + this.readPostList = readPostList; } @NonNull @Override public DataSource<String, Post> create() { if (postType == PostDataSource.TYPE_FRONT_PAGE) { - postDataSource = new PostDataSource(retrofit, accessToken, accountName, locale, - sharedPreferences, postFeedScrolledPositionSharedPreferences, postType, sortType, filter, nsfw); + postDataSource = new PostDataSource(retrofit, accessToken, accountName, + sharedPreferences, postFeedScrolledPositionSharedPreferences, postType, sortType, + postFilter, readPostList); } else if (postType == PostDataSource.TYPE_SEARCH) { - postDataSource = new PostDataSource(retrofit, accessToken, accountName, locale, - sharedPreferences, postFeedScrolledPositionSharedPreferences, subredditName, query, postType, sortType, filter, nsfw); + postDataSource = new PostDataSource(retrofit, accessToken, accountName, + sharedPreferences, postFeedScrolledPositionSharedPreferences, subredditName, query, + postType, sortType, postFilter, readPostList); } else if (postType == PostDataSource.TYPE_SUBREDDIT || postType == PostDataSource.TYPE_MULTI_REDDIT) { - postDataSource = new PostDataSource(retrofit, accessToken, accountName, locale, - sharedPreferences, postFeedScrolledPositionSharedPreferences, subredditName, postType, sortType, filter, nsfw, subredditFilterList); + Log.i("asdasfd", "s5 " + (postFilter == null)); + postDataSource = new PostDataSource(retrofit, accessToken, accountName, + sharedPreferences, postFeedScrolledPositionSharedPreferences, subredditName, postType, + sortType, postFilter, readPostList); } else { - postDataSource = new PostDataSource(retrofit, accessToken, accountName, locale, - sharedPreferences, postFeedScrolledPositionSharedPreferences, subredditName, postType, sortType, userWhere, filter, nsfw); + postDataSource = new PostDataSource(retrofit, accessToken, accountName, + sharedPreferences, postFeedScrolledPositionSharedPreferences, subredditName, postType, + sortType, postFilter, userWhere, readPostList); } postDataSourceLiveData.postValue(postDataSource); @@ -134,8 +134,9 @@ class PostDataSourceFactory extends DataSource.Factory { return postDataSource; } - void changeNSFWAndSortType(boolean nsfw, SortType sortType) { - this.nsfw = nsfw; + void changeSortTypeAndPostFilter(SortType sortType, PostFilter postFilter) { + Log.i("asdasfd", "s6 " + (postFilter == null)); this.sortType = sortType; + this.postFilter = postFilter; } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostViewModel.java index 114c68ee..2fc1ef33 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostViewModel.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostViewModel.java @@ -14,11 +14,11 @@ import androidx.paging.LivePagedListBuilder; import androidx.paging.PagedList; import java.util.List; -import java.util.Locale; import ml.docilealligator.infinityforreddit.NetworkState; +import ml.docilealligator.infinityforreddit.postfilter.PostFilter; import ml.docilealligator.infinityforreddit.SortType; -import ml.docilealligator.infinityforreddit.subredditfilter.SubredditFilter; +import ml.docilealligator.infinityforreddit.readpost.ReadPost; import retrofit2.Retrofit; public class PostViewModel extends ViewModel { @@ -27,15 +27,15 @@ public class PostViewModel extends ViewModel { private LiveData<NetworkState> initialLoadingState; private LiveData<Boolean> hasPostLiveData; private LiveData<PagedList<Post>> posts; - private MutableLiveData<Boolean> nsfwLiveData; private MutableLiveData<SortType> sortTypeLiveData; - private NSFWAndSortTypeLiveData nsfwAndSortTypeLiveData; + private MutableLiveData<PostFilter> postFilterLiveData; + private SortTypeAndPostFilterLiveData sortTypeAndPostFilterLiveData; - public PostViewModel(Retrofit retrofit, String accessToken, String accountName, Locale locale, + public PostViewModel(Retrofit retrofit, String accessToken, String accountName, SharedPreferences sharedPreferences, SharedPreferences cache, int postType, - SortType sortType, int filter, boolean nsfw) { - postDataSourceFactory = new PostDataSourceFactory(retrofit, accessToken, accountName, locale, - sharedPreferences, cache, postType, sortType, filter, nsfw); + SortType sortType, PostFilter postFilter, List<ReadPost> readPostList) { + postDataSourceFactory = new PostDataSourceFactory(retrofit, accessToken, accountName, + sharedPreferences, cache, postType, sortType, postFilter, readPostList); initialLoadingState = Transformations.switchMap(postDataSourceFactory.getPostDataSourceLiveData(), PostDataSource::getInitialLoadStateLiveData); @@ -44,12 +44,12 @@ public class PostViewModel extends ViewModel { hasPostLiveData = Transformations.switchMap(postDataSourceFactory.getPostDataSourceLiveData(), PostDataSource::hasPostLiveData); - nsfwLiveData = new MutableLiveData<>(); - nsfwLiveData.postValue(nsfw); sortTypeLiveData = new MutableLiveData<>(); sortTypeLiveData.postValue(sortType); + postFilterLiveData = new MutableLiveData<>(); + postFilterLiveData.postValue(postFilter); - nsfwAndSortTypeLiveData = new NSFWAndSortTypeLiveData(nsfwLiveData, sortTypeLiveData); + sortTypeAndPostFilterLiveData = new SortTypeAndPostFilterLiveData(sortTypeLiveData, postFilterLiveData); PagedList.Config pagedListConfig = (new PagedList.Config.Builder()) @@ -57,17 +57,20 @@ public class PostViewModel extends ViewModel { .setPageSize(25) .build(); - posts = Transformations.switchMap(nsfwAndSortTypeLiveData, nsfwAndSort -> { - postDataSourceFactory.changeNSFWAndSortType(nsfwLiveData.getValue(), sortTypeLiveData.getValue()); + posts = Transformations.switchMap(sortTypeAndPostFilterLiveData, sortAndPostFilter -> { + postDataSourceFactory.changeSortTypeAndPostFilter( + sortTypeLiveData.getValue(), postFilterLiveData.getValue()); return (new LivePagedListBuilder(postDataSourceFactory, pagedListConfig)).build(); }); } - public PostViewModel(Retrofit retrofit, String accessToken, String accountName, Locale locale, + public PostViewModel(Retrofit retrofit, String accessToken, String accountName, SharedPreferences sharedPreferences, SharedPreferences cache, String subredditName, - int postType, SortType sortType, int filter, boolean nsfw, List<SubredditFilter> subredditFilterList) { - postDataSourceFactory = new PostDataSourceFactory(retrofit, accessToken, accountName, locale, - sharedPreferences, cache, subredditName, postType, sortType, filter, nsfw, subredditFilterList); + int postType, SortType sortType, PostFilter postFilter, + List<ReadPost> readPostList) { + postDataSourceFactory = new PostDataSourceFactory(retrofit, accessToken, accountName, + sharedPreferences, cache, subredditName, postType, sortType, postFilter, + readPostList); initialLoadingState = Transformations.switchMap(postDataSourceFactory.getPostDataSourceLiveData(), PostDataSource::getInitialLoadStateLiveData); @@ -76,12 +79,12 @@ public class PostViewModel extends ViewModel { hasPostLiveData = Transformations.switchMap(postDataSourceFactory.getPostDataSourceLiveData(), PostDataSource::hasPostLiveData); - nsfwLiveData = new MutableLiveData<>(); - nsfwLiveData.postValue(nsfw); sortTypeLiveData = new MutableLiveData<>(); sortTypeLiveData.postValue(sortType); + postFilterLiveData = new MutableLiveData<>(); + postFilterLiveData.postValue(postFilter); - nsfwAndSortTypeLiveData = new NSFWAndSortTypeLiveData(nsfwLiveData, sortTypeLiveData); + sortTypeAndPostFilterLiveData = new SortTypeAndPostFilterLiveData(sortTypeLiveData, postFilterLiveData); PagedList.Config pagedListConfig = (new PagedList.Config.Builder()) @@ -89,18 +92,19 @@ public class PostViewModel extends ViewModel { .setPageSize(25) .build(); - posts = Transformations.switchMap(nsfwAndSortTypeLiveData, nsfwAndSort -> { - postDataSourceFactory.changeNSFWAndSortType(nsfwLiveData.getValue(), sortTypeLiveData.getValue()); + posts = Transformations.switchMap(sortTypeAndPostFilterLiveData, sortAndPostFilter -> { + postDataSourceFactory.changeSortTypeAndPostFilter( + sortTypeLiveData.getValue(), postFilterLiveData.getValue()); return (new LivePagedListBuilder(postDataSourceFactory, pagedListConfig)).build(); }); } - public PostViewModel(Retrofit retrofit, String accessToken, String accountName, Locale locale, + public PostViewModel(Retrofit retrofit, String accessToken, String accountName, SharedPreferences sharedPreferences, SharedPreferences cache, String subredditName, - int postType, SortType sortType, String where, int filter, - boolean nsfw) { - postDataSourceFactory = new PostDataSourceFactory(retrofit, accessToken, accountName, locale, - sharedPreferences, cache, subredditName, postType, sortType, where, filter, nsfw); + int postType, SortType sortType, PostFilter postFilter, String where, + List<ReadPost> readPostList) { + postDataSourceFactory = new PostDataSourceFactory(retrofit, accessToken, accountName, + sharedPreferences, cache, subredditName, postType, sortType, postFilter, where, readPostList); initialLoadingState = Transformations.switchMap(postDataSourceFactory.getPostDataSourceLiveData(), PostDataSource::getInitialLoadStateLiveData); @@ -109,12 +113,12 @@ public class PostViewModel extends ViewModel { hasPostLiveData = Transformations.switchMap(postDataSourceFactory.getPostDataSourceLiveData(), PostDataSource::hasPostLiveData); - nsfwLiveData = new MutableLiveData<>(); - nsfwLiveData.postValue(nsfw); sortTypeLiveData = new MutableLiveData<>(); sortTypeLiveData.postValue(sortType); + postFilterLiveData = new MutableLiveData<>(); + postFilterLiveData.postValue(postFilter); - nsfwAndSortTypeLiveData = new NSFWAndSortTypeLiveData(nsfwLiveData, sortTypeLiveData); + sortTypeAndPostFilterLiveData = new SortTypeAndPostFilterLiveData(sortTypeLiveData, postFilterLiveData); PagedList.Config pagedListConfig = (new PagedList.Config.Builder()) @@ -122,18 +126,19 @@ public class PostViewModel extends ViewModel { .setPageSize(25) .build(); - posts = Transformations.switchMap(nsfwAndSortTypeLiveData, nsfwAndSort -> { - postDataSourceFactory.changeNSFWAndSortType(nsfwLiveData.getValue(), sortTypeLiveData.getValue()); + posts = Transformations.switchMap(sortTypeAndPostFilterLiveData, sortAndPostFilter -> { + postDataSourceFactory.changeSortTypeAndPostFilter( + sortTypeLiveData.getValue(), postFilterLiveData.getValue()); return (new LivePagedListBuilder(postDataSourceFactory, pagedListConfig)).build(); }); } - public PostViewModel(Retrofit retrofit, String accessToken, String accountName, Locale locale, + public PostViewModel(Retrofit retrofit, String accessToken, String accountName, SharedPreferences sharedPreferences, SharedPreferences cache, String subredditName, - String query, int postType, SortType sortType, int filter, - boolean nsfw) { - postDataSourceFactory = new PostDataSourceFactory(retrofit, accessToken, accountName, locale, - sharedPreferences, cache, subredditName, query, postType, sortType, filter, nsfw); + String query, int postType, SortType sortType, PostFilter postFilter, List<ReadPost> readPostList) { + postDataSourceFactory = new PostDataSourceFactory(retrofit, accessToken, accountName, + sharedPreferences, cache, subredditName, query, postType, sortType, postFilter, + readPostList); initialLoadingState = Transformations.switchMap(postDataSourceFactory.getPostDataSourceLiveData(), PostDataSource::getInitialLoadStateLiveData); @@ -142,12 +147,12 @@ public class PostViewModel extends ViewModel { hasPostLiveData = Transformations.switchMap(postDataSourceFactory.getPostDataSourceLiveData(), PostDataSource::hasPostLiveData); - nsfwLiveData = new MutableLiveData<>(); - nsfwLiveData.postValue(nsfw); sortTypeLiveData = new MutableLiveData<>(); sortTypeLiveData.postValue(sortType); + postFilterLiveData = new MutableLiveData<>(); + postFilterLiveData.postValue(postFilter); - nsfwAndSortTypeLiveData = new NSFWAndSortTypeLiveData(nsfwLiveData, sortTypeLiveData); + sortTypeAndPostFilterLiveData = new SortTypeAndPostFilterLiveData(sortTypeLiveData, postFilterLiveData); PagedList.Config pagedListConfig = (new PagedList.Config.Builder()) @@ -155,8 +160,9 @@ public class PostViewModel extends ViewModel { .setPageSize(25) .build(); - posts = Transformations.switchMap(nsfwAndSortTypeLiveData, nsfwAndSort -> { - postDataSourceFactory.changeNSFWAndSortType(nsfwLiveData.getValue(), sortTypeLiveData.getValue()); + posts = Transformations.switchMap(sortTypeAndPostFilterLiveData, sortAndPostFilter -> { + postDataSourceFactory.changeSortTypeAndPostFilter(sortTypeLiveData.getValue(), + postFilterLiveData.getValue()); return (new LivePagedListBuilder(postDataSourceFactory, pagedListConfig)).build(); }); } @@ -189,134 +195,113 @@ public class PostViewModel extends ViewModel { sortTypeLiveData.postValue(sortType); } - public void changeNSFW(boolean nsfw) { - nsfwLiveData.postValue(nsfw); + public void changePostFilter(PostFilter postFilter) { + postFilterLiveData.postValue(postFilter); } public static class Factory extends ViewModelProvider.NewInstanceFactory { private Retrofit retrofit; private String accessToken; private String accountName; - private Locale locale; private SharedPreferences sharedPreferences; private SharedPreferences postFeedScrolledPositionSharedPreferences; private String subredditName; private String query; private int postType; private SortType sortType; + private PostFilter postFilter; private String userWhere; - private int filter; - private boolean nsfw; - private List<SubredditFilter> subredditFilterList; + private List<ReadPost> readPostList; - public Factory(Retrofit retrofit, String accessToken, String accountName, Locale locale, + public Factory(Retrofit retrofit, String accessToken, String accountName, SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences, - int postType, SortType sortType, int filter, boolean nsfw) { + int postType, SortType sortType, PostFilter postFilter, List<ReadPost> readPostList) { this.retrofit = retrofit; this.accessToken = accessToken; this.accountName = accountName; - this.locale = locale; this.sharedPreferences = sharedPreferences; this.postFeedScrolledPositionSharedPreferences = postFeedScrolledPositionSharedPreferences; this.postType = postType; this.sortType = sortType; - this.filter = filter; - this.nsfw = nsfw; + this.postFilter = postFilter; + this.readPostList = readPostList; } - public Factory(Retrofit retrofit, String accessToken, String accountName, Locale locale, - SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences, String subredditName, - int postType, SortType sortType, int filter, boolean nsfw) { - this.retrofit = retrofit; - this.accessToken = accessToken; - this.accountName = accountName; - this.locale = locale; - this.sharedPreferences = sharedPreferences; - this.postFeedScrolledPositionSharedPreferences = postFeedScrolledPositionSharedPreferences; - this.subredditName = subredditName; - this.postType = postType; - this.sortType = sortType; - this.filter = filter; - this.nsfw = nsfw; - } - - //With subreddit filter - public Factory(Retrofit retrofit, String accessToken, String accountName, Locale locale, - SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences, String subredditName, - int postType, SortType sortType, int filter, boolean nsfw, List<SubredditFilter> subredditFilterList) { + public Factory(Retrofit retrofit, String accessToken, String accountName, + SharedPreferences sharedPreferences, + SharedPreferences postFeedScrolledPositionSharedPreferences, String subredditName, + int postType, SortType sortType, PostFilter postFilter, List<ReadPost> readPostList) { this.retrofit = retrofit; this.accessToken = accessToken; this.accountName = accountName; - this.locale = locale; this.sharedPreferences = sharedPreferences; this.postFeedScrolledPositionSharedPreferences = postFeedScrolledPositionSharedPreferences; this.subredditName = subredditName; this.postType = postType; this.sortType = sortType; - this.filter = filter; - this.nsfw = nsfw; - this.subredditFilterList = subredditFilterList; + this.postFilter = postFilter; + this.readPostList = readPostList; } //User posts - public Factory(Retrofit retrofit, String accessToken, String accountName, Locale locale, + public Factory(Retrofit retrofit, String accessToken, String accountName, SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences, String subredditName, - int postType, SortType sortType, String where, int filter, - boolean nsfw) { + int postType, SortType sortType, PostFilter postFilter, String where, List<ReadPost> readPostList) { this.retrofit = retrofit; this.accessToken = accessToken; this.accountName = accountName; - this.locale = locale; this.sharedPreferences = sharedPreferences; this.postFeedScrolledPositionSharedPreferences = postFeedScrolledPositionSharedPreferences; this.subredditName = subredditName; this.postType = postType; this.sortType = sortType; + this.postFilter = postFilter; userWhere = where; - this.filter = filter; - this.nsfw = nsfw; + this.readPostList = readPostList; } - public Factory(Retrofit retrofit, String accessToken, String accountName, Locale locale, + public Factory(Retrofit retrofit, String accessToken, String accountName, SharedPreferences sharedPreferences, SharedPreferences postFeedScrolledPositionSharedPreferences, String subredditName, - String query, int postType, SortType sortType, int filter, boolean nsfw) { + String query, int postType, SortType sortType, PostFilter postFilter, List<ReadPost> readPostList) { this.retrofit = retrofit; this.accessToken = accessToken; this.accountName = accountName; - this.locale = locale; this.sharedPreferences = sharedPreferences; this.postFeedScrolledPositionSharedPreferences = postFeedScrolledPositionSharedPreferences; this.subredditName = subredditName; this.query = query; this.postType = postType; this.sortType = sortType; - this.filter = filter; - this.nsfw = nsfw; + this.postFilter = postFilter; + this.readPostList = readPostList; } @NonNull @Override public <T extends ViewModel> T create(@NonNull Class<T> modelClass) { if (postType == PostDataSource.TYPE_FRONT_PAGE) { - return (T) new PostViewModel(retrofit, accessToken, accountName, locale, sharedPreferences, - postFeedScrolledPositionSharedPreferences, postType, sortType, filter, nsfw); + return (T) new PostViewModel(retrofit, accessToken, accountName, sharedPreferences, + postFeedScrolledPositionSharedPreferences, postType, sortType, postFilter, readPostList); } else if (postType == PostDataSource.TYPE_SEARCH) { - return (T) new PostViewModel(retrofit, accessToken, accountName, locale, sharedPreferences, - postFeedScrolledPositionSharedPreferences, subredditName, query, postType, sortType, filter, nsfw); + return (T) new PostViewModel(retrofit, accessToken, accountName, sharedPreferences, + postFeedScrolledPositionSharedPreferences, subredditName, query, postType, sortType, + postFilter, readPostList); } else if (postType == PostDataSource.TYPE_SUBREDDIT || postType == PostDataSource.TYPE_MULTI_REDDIT) { - return (T) new PostViewModel(retrofit, accessToken, accountName, locale, sharedPreferences, - postFeedScrolledPositionSharedPreferences, subredditName, postType, sortType, filter, nsfw, subredditFilterList); + return (T) new PostViewModel(retrofit, accessToken, accountName, sharedPreferences, + postFeedScrolledPositionSharedPreferences, subredditName, postType, sortType, + postFilter, readPostList); } else { - return (T) new PostViewModel(retrofit, accessToken, accountName, locale, sharedPreferences, - postFeedScrolledPositionSharedPreferences, subredditName, postType, sortType, userWhere, filter, nsfw); + return (T) new PostViewModel(retrofit, accessToken, accountName, sharedPreferences, + postFeedScrolledPositionSharedPreferences, subredditName, postType, sortType, + postFilter, userWhere, readPostList); } } } - private static class NSFWAndSortTypeLiveData extends MediatorLiveData<Pair<Boolean, SortType>> { - public NSFWAndSortTypeLiveData(LiveData<Boolean> nsfw, LiveData<SortType> sortType) { - addSource(nsfw, accessToken1 -> setValue(Pair.create(accessToken1, sortType.getValue()))); - addSource(sortType, sortType1 -> setValue(Pair.create(nsfw.getValue(), sortType1))); + private static class SortTypeAndPostFilterLiveData extends MediatorLiveData<Pair<PostFilter, SortType>> { + public SortTypeAndPostFilterLiveData(LiveData<SortType> sortTypeLiveData, LiveData<PostFilter> postFilterLiveData) { + addSource(sortTypeLiveData, sortType -> setValue(Pair.create(postFilterLiveData.getValue(), sortType))); + addSource(postFilterLiveData, postFilter -> setValue(Pair.create(postFilter, sortTypeLiveData.getValue()))); } } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/DeletePostFilter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/DeletePostFilter.java new file mode 100644 index 00000000..0ed06ba8 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/DeletePostFilter.java @@ -0,0 +1,11 @@ +package ml.docilealligator.infinityforreddit.postfilter; + +import java.util.concurrent.Executor; + +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; + +public class DeletePostFilter { + public static void deletePostFilter(RedditDataRoomDatabase redditDataRoomDatabase, Executor executor, PostFilter postFilter) { + executor.execute(() -> redditDataRoomDatabase.postFilterDao().deletePostFilter(postFilter)); + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/DeletePostFilterUsage.java b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/DeletePostFilterUsage.java new file mode 100644 index 00000000..5e465afc --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/DeletePostFilterUsage.java @@ -0,0 +1,12 @@ +package ml.docilealligator.infinityforreddit.postfilter; + +import java.util.concurrent.Executor; + +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; + +public class DeletePostFilterUsage { + public static void deletePostFilterUsage(RedditDataRoomDatabase redditDataRoomDatabase, Executor executor, + PostFilterUsage postFilterUsage) { + executor.execute(() -> redditDataRoomDatabase.postFilterUsageDao().deletePostFilterUsage(postFilterUsage)); + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilter.java new file mode 100644 index 00000000..5eaf70bc --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilter.java @@ -0,0 +1,290 @@ +package ml.docilealligator.infinityforreddit.postfilter; + +import android.os.Parcel; +import android.os.Parcelable; + +import androidx.annotation.NonNull; +import androidx.room.ColumnInfo; +import androidx.room.Entity; +import androidx.room.Ignore; +import androidx.room.PrimaryKey; + +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import ml.docilealligator.infinityforreddit.post.Post; + +@Entity(tableName = "post_filter") +public class PostFilter implements Parcelable { + @PrimaryKey + @NonNull + @ColumnInfo(name = "name") + public String name = "New Filter"; + @ColumnInfo(name = "max_vote") + public int maxVote = -1; + @ColumnInfo(name = "min_vote") + public int minVote = -1; + @ColumnInfo(name = "max_comments") + public int maxComments = -1; + @ColumnInfo(name = "min_comments") + public int minComments = -1; + @ColumnInfo(name = "max_awards") + public int maxAwards = -1; + @ColumnInfo(name = "min_awards") + public int minAwards = -1; + @Ignore + public boolean allowNSFW; + @ColumnInfo(name = "only_nsfw") + public boolean onlyNSFW; + @ColumnInfo(name = "only_spoiler") + public boolean onlySpoiler; + @ColumnInfo(name = "post_title_excludes_regex") + public String postTitleExcludesRegex; + @ColumnInfo(name = "post_title_excludes_strings") + public String postTitleExcludesStrings; + @ColumnInfo(name = "exclude_subreddits") + public String excludeSubreddits; + @ColumnInfo(name = "exclude_users") + public String excludeUsers; + @ColumnInfo(name = "contain_flairs") + public String containFlairs; + @ColumnInfo(name = "exclude_flairs") + public String excludeFlairs; + @ColumnInfo(name = "contain_text_type") + public boolean containTextType = true; + @ColumnInfo(name = "contain_link_type") + public boolean containLinkType = true; + @ColumnInfo(name = "contain_image_type") + public boolean containImageType = true; + @ColumnInfo(name = "contain_gif_type") + public boolean containGifType = true; + @ColumnInfo(name = "contain_video_type") + public boolean containVideoType = true; + @ColumnInfo(name = "contain_gallery_type") + public boolean containGalleryType = true; + + public PostFilter() { + + } + + public static boolean isPostAllowed(Post post, PostFilter postFilter) { + if (postFilter == null || post == null) { + return true; + } + if (post.isNSFW() && !postFilter.allowNSFW) { + return false; + } + if (postFilter.maxVote > 0 && post.getVoteType() + post.getScore() > postFilter.maxVote) { + return false; + } + if (postFilter.minVote > 0 && post.getVoteType() + post.getScore() < postFilter.minVote) { + return false; + } + if (postFilter.maxComments > 0 && post.getNComments() > postFilter.maxComments) { + return false; + } + if (postFilter.minComments > 0 && post.getNComments() < postFilter.minComments) { + return false; + } + if (postFilter.maxAwards > 0 && post.getNAwards() > postFilter.maxAwards) { + return false; + } + if (postFilter.minAwards > 0 && post.getNAwards() < postFilter.minAwards) { + return false; + } + if (postFilter.onlyNSFW && !post.isNSFW()) { + return false; + } + if (postFilter.onlySpoiler && !post.isSpoiler()) { + return false; + } + if (!postFilter.containTextType && post.getPostType() == Post.TEXT_TYPE) { + return false; + } + if (!postFilter.containLinkType && (post.getPostType() == Post.LINK_TYPE || post.getPostType() == Post.NO_PREVIEW_LINK_TYPE)) { + return false; + } + if (!postFilter.containImageType && post.getPostType() == Post.IMAGE_TYPE) { + return false; + } + if (!postFilter.containGifType && post.getPostType() == Post.GIF_TYPE) { + return false; + } + if (!postFilter.containVideoType && post.getPostType() == Post.VIDEO_TYPE) { + return false; + } + if (!postFilter.containGalleryType && post.getPostType() == Post.GALLERY_TYPE) { + return false; + } + if (postFilter.postTitleExcludesRegex != null && !postFilter.postTitleExcludesRegex.equals("")) { + Pattern pattern = Pattern.compile(postFilter.postTitleExcludesRegex); + Matcher matcher = pattern.matcher(post.getTitle()); + if (matcher.find()) { + return false; + } + } + if (postFilter.postTitleExcludesStrings != null && !postFilter.postTitleExcludesStrings.equals("")) { + String[] titles = postFilter.postTitleExcludesStrings.split(",", 0); + for (String t : titles) { + if (!t.equals("") && post.getTitle().contains(t)) { + return false; + } + } + } + if (postFilter.excludeSubreddits != null && !postFilter.excludeSubreddits.equals("")) { + String[] subreddits = postFilter.excludeSubreddits.split(",", 0); + for (String s : subreddits) { + if (!s.equals("") && post.getSubredditName().equalsIgnoreCase(s)) { + return false; + } + } + } + if (postFilter.excludeUsers != null && !postFilter.excludeUsers.equals("")) { + String[] users = postFilter.excludeUsers.split(",", 0); + for (String u : users) { + if (!u.equals("") && post.getAuthor().equalsIgnoreCase(u)) { + return false; + } + } + } + if (postFilter.excludeFlairs != null && !postFilter.excludeFlairs.equals("")) { + String[] flairs = postFilter.excludeFlairs.split(",", 0); + for (String f : flairs) { + if (!f.equals("") && post.getFlair().equalsIgnoreCase(f)) { + return false; + } + } + } + if (postFilter.containFlairs != null && !postFilter.containFlairs.equals("")) { + String[] flairs = postFilter.containFlairs.split(",", 0); + for (String f : flairs) { + if (!f.equals("") && post.getFlair().equalsIgnoreCase(f)) { + return false; + } + } + } + + return true; + } + + public static PostFilter mergePostFilter(List<PostFilter> postFilterList) { + PostFilter postFilter = new PostFilter(); + if (postFilterList.size() == 1) { + return postFilterList.get(0); + } + StringBuilder stringBuilder; + postFilter.name = "Merged"; + for (PostFilter p : postFilterList) { + postFilter.maxVote = Math.min(p.maxVote, postFilter.maxVote); + postFilter.minVote = Math.max(p.minVote, postFilter.minVote); + postFilter.maxComments = Math.min(p.maxComments, postFilter.maxComments); + postFilter.minComments = Math.max(p.minComments, postFilter.minComments); + postFilter.maxAwards = Math.min(p.maxAwards, postFilter.maxAwards); + postFilter.minAwards = Math.max(p.minAwards, postFilter.minAwards); + + postFilter.onlyNSFW = p.onlyNSFW ? p.onlyNSFW : postFilter.onlyNSFW; + postFilter.onlySpoiler = p.onlySpoiler ? p.onlySpoiler : postFilter.onlySpoiler; + + postFilter.postTitleExcludesRegex = p.postTitleExcludesRegex.equals("") ? postFilter.postTitleExcludesRegex : p.postTitleExcludesRegex; + stringBuilder = new StringBuilder(postFilter.postTitleExcludesStrings); + stringBuilder.append(",").append(p.postTitleExcludesStrings); + postFilter.postTitleExcludesStrings = stringBuilder.toString(); + + postFilter.excludeSubreddits = p.excludeSubreddits.equals("") ? postFilter.excludeSubreddits : p.postTitleExcludesRegex; + stringBuilder = new StringBuilder(postFilter.excludeSubreddits); + stringBuilder.append(",").append(p.excludeSubreddits); + postFilter.excludeSubreddits = stringBuilder.toString(); + + postFilter.excludeUsers = p.excludeUsers.equals("") ? postFilter.excludeUsers : p.postTitleExcludesRegex; + stringBuilder = new StringBuilder(postFilter.excludeUsers); + stringBuilder.append(",").append(p.excludeUsers); + postFilter.excludeUsers = stringBuilder.toString(); + + postFilter.containFlairs = p.containFlairs.equals("") ? postFilter.containFlairs : p.postTitleExcludesRegex; + stringBuilder = new StringBuilder(postFilter.containFlairs); + stringBuilder.append(",").append(p.containFlairs); + postFilter.containFlairs = stringBuilder.toString(); + + postFilter.excludeFlairs = p.excludeFlairs.equals("") ? postFilter.excludeFlairs : p.postTitleExcludesRegex; + stringBuilder = new StringBuilder(postFilter.excludeFlairs); + stringBuilder.append(",").append(p.excludeFlairs); + postFilter.excludeFlairs = stringBuilder.toString(); + + postFilter.containTextType = p.containTextType || postFilter.containTextType; + postFilter.containLinkType = p.containLinkType || postFilter.containLinkType; + postFilter.containImageType = p.containImageType || postFilter.containImageType; + postFilter.containGifType = p.containGifType || postFilter.containGifType; + postFilter.containVideoType = p.containVideoType || postFilter.containVideoType; + postFilter.containGalleryType = p.containGalleryType || postFilter.containGalleryType; + } + + return postFilter; + } + + protected PostFilter(Parcel in) { + name = in.readString(); + maxVote = in.readInt(); + minVote = in.readInt(); + maxComments = in.readInt(); + minComments = in.readInt(); + maxAwards = in.readInt(); + minAwards = in.readInt(); + allowNSFW = in.readByte() != 0; + onlyNSFW = in.readByte() != 0; + onlySpoiler = in.readByte() != 0; + postTitleExcludesRegex = in.readString(); + postTitleExcludesStrings = in.readString(); + excludeSubreddits = in.readString(); + excludeUsers = in.readString(); + containFlairs = in.readString(); + excludeFlairs = in.readString(); + containTextType = in.readByte() != 0; + containLinkType = in.readByte() != 0; + containImageType = in.readByte() != 0; + containVideoType = in.readByte() != 0; + containGalleryType = in.readByte() != 0; + } + + public static final Creator<PostFilter> CREATOR = new Creator<PostFilter>() { + @Override + public PostFilter createFromParcel(Parcel in) { + return new PostFilter(in); + } + + @Override + public PostFilter[] newArray(int size) { + return new PostFilter[size]; + } + }; + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel parcel, int i) { + parcel.writeString(name); + parcel.writeInt(maxVote); + parcel.writeInt(minVote); + parcel.writeInt(maxComments); + parcel.writeInt(minComments); + parcel.writeInt(maxAwards); + parcel.writeInt(minAwards); + parcel.writeByte((byte) (allowNSFW ? 1 : 0)); + parcel.writeByte((byte) (onlyNSFW ? 1 : 0)); + parcel.writeByte((byte) (onlySpoiler ? 1 : 0)); + parcel.writeString(postTitleExcludesRegex); + parcel.writeString(postTitleExcludesStrings); + parcel.writeString(excludeSubreddits); + parcel.writeString(excludeUsers); + parcel.writeString(containFlairs); + parcel.writeString(excludeFlairs); + parcel.writeByte((byte) (containTextType ? 1 : 0)); + parcel.writeByte((byte) (containLinkType ? 1 : 0)); + parcel.writeByte((byte) (containImageType ? 1 : 0)); + parcel.writeByte((byte) (containVideoType ? 1 : 0)); + parcel.writeByte((byte) (containGalleryType ? 1 : 0)); + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterDao.java b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterDao.java new file mode 100644 index 00000000..05a27120 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterDao.java @@ -0,0 +1,33 @@ +package ml.docilealligator.infinityforreddit.postfilter; + +import androidx.lifecycle.LiveData; +import androidx.room.Dao; +import androidx.room.Delete; +import androidx.room.Insert; +import androidx.room.OnConflictStrategy; +import androidx.room.Query; + +import java.util.List; + +@Dao +public interface PostFilterDao { + @Insert(onConflict = OnConflictStrategy.REPLACE) + void insert(PostFilter postFilter); + + @Query("DELETE FROM post_filter") + void deleteAllPostFilters(); + + @Delete + void deletePostFilter(PostFilter postFilter); + + @Query("SELECT * FROM post_filter WHERE name = :name LIMIT 1") + PostFilter getPostFilter(String name); + + @Query("SELECT * FROM post_filter") + LiveData<List<PostFilter>> getAllPostFiltersLiveData(); + + @Query("SELECT * FROM post_filter WHERE post_filter.name IN " + + "(SELECT post_filter_usage.name FROM post_filter_usage WHERE (usage = :usage AND name_of_usage = :nameOfUsage) " + + "OR (usage =:usage AND name_of_usage = '--'))") + List<PostFilter> getValidPostFilters(int usage, String nameOfUsage); +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterUsage.java b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterUsage.java new file mode 100644 index 00000000..558abeeb --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterUsage.java @@ -0,0 +1,70 @@ +package ml.docilealligator.infinityforreddit.postfilter; + +import android.os.Parcel; +import android.os.Parcelable; + +import androidx.annotation.NonNull; +import androidx.room.ColumnInfo; +import androidx.room.Entity; +import androidx.room.ForeignKey; + +@Entity(tableName = "post_filter_usage", primaryKeys = {"name", "usage", "name_of_usage"}, + foreignKeys = @ForeignKey(entity = PostFilter.class, parentColumns = "name", + childColumns = "name", onDelete = ForeignKey.CASCADE)) +public class PostFilterUsage implements Parcelable { + public static final int HOME_TYPE = 1; + public static final int SUBREDDIT_TYPE = 2; + public static final int USER_TYPE = 3; + public static final int MULTIREDDIT_TYPE = 4; + public static final int SEARCH_TYPE = 5; + public static final String NO_USAGE = "--"; + + @NonNull + @ColumnInfo(name = "name") + public String name; + @ColumnInfo(name = "usage") + public int usage; + @NonNull + @ColumnInfo(name = "name_of_usage") + public String nameOfUsage; + + public PostFilterUsage(@NonNull String name, int usage, String nameOfUsage) { + this.name = name; + this.usage = usage; + if (nameOfUsage == null || nameOfUsage.equals("")) { + this.nameOfUsage = NO_USAGE; + } else { + this.nameOfUsage = nameOfUsage; + } + } + + protected PostFilterUsage(Parcel in) { + name = in.readString(); + usage = in.readInt(); + nameOfUsage = in.readString(); + } + + public static final Creator<PostFilterUsage> CREATOR = new Creator<PostFilterUsage>() { + @Override + public PostFilterUsage createFromParcel(Parcel in) { + return new PostFilterUsage(in); + } + + @Override + public PostFilterUsage[] newArray(int size) { + return new PostFilterUsage[size]; + } + }; + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel parcel, int i) { + parcel.writeString(name); + parcel.writeInt(usage); + parcel.writeString(nameOfUsage); + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterUsageDao.java b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterUsageDao.java new file mode 100644 index 00000000..a0ba8843 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterUsageDao.java @@ -0,0 +1,22 @@ +package ml.docilealligator.infinityforreddit.postfilter; + +import androidx.lifecycle.LiveData; +import androidx.room.Dao; +import androidx.room.Delete; +import androidx.room.Insert; +import androidx.room.OnConflictStrategy; +import androidx.room.Query; + +import java.util.List; + +@Dao +public interface PostFilterUsageDao { + @Query("SELECT * FROM post_filter_usage WHERE name = :name") + LiveData<List<PostFilterUsage>> getAllPostFilterUsageLiveData(String name); + + @Insert(onConflict = OnConflictStrategy.REPLACE) + void insertPostFilterUsage(PostFilterUsage postFilterUsage); + + @Delete + void deletePostFilterUsage(PostFilterUsage postFilterUsage); +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterUsageViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterUsageViewModel.java new file mode 100644 index 00000000..f63ed46a --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterUsageViewModel.java @@ -0,0 +1,38 @@ +package ml.docilealligator.infinityforreddit.postfilter; + +import androidx.lifecycle.LiveData; +import androidx.lifecycle.ViewModel; +import androidx.lifecycle.ViewModelProvider; + +import java.util.List; + +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; + +public class PostFilterUsageViewModel extends ViewModel { + private LiveData<List<PostFilterUsage>> mPostFilterUsageListLiveData; + + public PostFilterUsageViewModel(RedditDataRoomDatabase redditDataRoomDatabase, String name) { + mPostFilterUsageListLiveData = redditDataRoomDatabase.postFilterUsageDao().getAllPostFilterUsageLiveData(name); + } + + public LiveData<List<PostFilterUsage>> getPostFilterUsageListLiveData() { + return mPostFilterUsageListLiveData; + } + + public static class Factory extends ViewModelProvider.NewInstanceFactory { + + private final RedditDataRoomDatabase mRedditDataRoomDatabase; + private final String mName; + + public Factory(RedditDataRoomDatabase redditDataRoomDatabase, String name) { + mRedditDataRoomDatabase = redditDataRoomDatabase; + mName = name; + } + + @Override + public <T extends ViewModel> T create(Class<T> modelClass) { + //noinspection unchecked + return (T) new PostFilterUsageViewModel(mRedditDataRoomDatabase, mName); + } + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterViewModel.java new file mode 100644 index 00000000..48acd7f7 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/PostFilterViewModel.java @@ -0,0 +1,36 @@ +package ml.docilealligator.infinityforreddit.postfilter; + +import androidx.lifecycle.LiveData; +import androidx.lifecycle.ViewModel; +import androidx.lifecycle.ViewModelProvider; + +import java.util.List; + +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; + +public class PostFilterViewModel extends ViewModel { + private LiveData<List<PostFilter>> mPostFilterListLiveData; + + public PostFilterViewModel(RedditDataRoomDatabase redditDataRoomDatabase) { + mPostFilterListLiveData = redditDataRoomDatabase.postFilterDao().getAllPostFiltersLiveData(); + } + + public LiveData<List<PostFilter>> getPostFilterListLiveData() { + return mPostFilterListLiveData; + } + + public static class Factory extends ViewModelProvider.NewInstanceFactory { + + private final RedditDataRoomDatabase mRedditDataRoomDatabase; + + public Factory(RedditDataRoomDatabase redditDataRoomDatabase) { + mRedditDataRoomDatabase = redditDataRoomDatabase; + } + + @Override + public <T extends ViewModel> T create(Class<T> modelClass) { + //noinspection unchecked + return (T) new PostFilterViewModel(mRedditDataRoomDatabase); + } + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/SavePostFilter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/SavePostFilter.java new file mode 100644 index 00000000..f7362925 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/SavePostFilter.java @@ -0,0 +1,20 @@ +package ml.docilealligator.infinityforreddit.postfilter; + +import java.util.concurrent.Executor; + +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; + +public class SavePostFilter { + public interface SavePostFilterListener { + //Need to make sure it is running in the UI thread. + void success(); + } + + public static void savePostFilter(RedditDataRoomDatabase redditDataRoomDatabase, Executor executor, + PostFilter postFilter, SavePostFilterListener savePostFilterListener) { + executor.execute(() -> { + redditDataRoomDatabase.postFilterDao().insert(postFilter); + savePostFilterListener.success(); + }); + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/SavePostFilterUsage.java b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/SavePostFilterUsage.java new file mode 100644 index 00000000..567da3b1 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/postfilter/SavePostFilterUsage.java @@ -0,0 +1,12 @@ +package ml.docilealligator.infinityforreddit.postfilter; + +import java.util.concurrent.Executor; + +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; + +public class SavePostFilterUsage { + public static void savePostFilterUsage(RedditDataRoomDatabase redditDataRoomDatabase, Executor executor, + PostFilterUsage postFilterUsage) { + executor.execute(() -> redditDataRoomDatabase.postFilterUsageDao().insertPostFilterUsage(postFilterUsage)); + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/readpost/InsertReadPost.java b/app/src/main/java/ml/docilealligator/infinityforreddit/readpost/InsertReadPost.java new file mode 100644 index 00000000..be548700 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/readpost/InsertReadPost.java @@ -0,0 +1,20 @@ +package ml.docilealligator.infinityforreddit.readpost; + +import java.util.concurrent.Executor; + +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; + +public class InsertReadPost { + public static void insertReadPost(RedditDataRoomDatabase redditDataRoomDatabase, Executor executor, + String username, String postId) { + executor.execute(() -> { + ReadPostDao readPostDao = redditDataRoomDatabase.readPostDao(); + if (readPostDao.getReadPostsCount() > 500) { + readPostDao.deleteOldestReadPosts(username); + } + if (username != null && !username.equals("")) { + readPostDao.insert(new ReadPost(username, postId)); + } + }); + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/readpost/ReadPost.java b/app/src/main/java/ml/docilealligator/infinityforreddit/readpost/ReadPost.java new file mode 100644 index 00000000..df704f3d --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/readpost/ReadPost.java @@ -0,0 +1,93 @@ +package ml.docilealligator.infinityforreddit.readpost; + +import android.os.Parcel; +import android.os.Parcelable; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.room.ColumnInfo; +import androidx.room.Entity; +import androidx.room.ForeignKey; + +import ml.docilealligator.infinityforreddit.account.Account; +import ml.docilealligator.infinityforreddit.post.Post; + +@Entity(tableName = "read_posts", primaryKeys = {"username", "id"}, + foreignKeys = @ForeignKey(entity = Account.class, parentColumns = "username", + childColumns = "username", onDelete = ForeignKey.CASCADE)) +public class ReadPost implements Parcelable { + @NonNull + @ColumnInfo(name = "username") + private String username; + @NonNull + @ColumnInfo(name = "id") + private String id; + + public static ReadPost convertPost(Post post) { + return new ReadPost("temp", post.getId()); + } + + public ReadPost(@NonNull String username, @NonNull String id) { + this.username = username; + this.id = id; + } + + protected ReadPost(Parcel in) { + username = in.readString(); + id = in.readString(); + } + + public static final Creator<ReadPost> CREATOR = new Creator<ReadPost>() { + @Override + public ReadPost createFromParcel(Parcel in) { + return new ReadPost(in); + } + + @Override + public ReadPost[] newArray(int size) { + return new ReadPost[size]; + } + }; + + @NonNull + public String getUsername() { + return username; + } + + public void setUsername(@NonNull String username) { + this.username = username; + } + + @NonNull + public String getId() { + return id; + } + + public void setId(@NonNull String id) { + this.id = id; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel parcel, int i) { + parcel.writeString(username); + parcel.writeString(id); + } + + @Override + public boolean equals(@Nullable Object obj) { + if (obj instanceof ReadPost) { + return ((ReadPost) obj).id.equals(id); + } + return false; + } + + @Override + public int hashCode() { + return id.hashCode(); + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/readpost/ReadPostDao.java b/app/src/main/java/ml/docilealligator/infinityforreddit/readpost/ReadPostDao.java new file mode 100644 index 00000000..2390f59a --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/readpost/ReadPostDao.java @@ -0,0 +1,26 @@ +package ml.docilealligator.infinityforreddit.readpost; + +import androidx.room.Dao; +import androidx.room.Insert; +import androidx.room.OnConflictStrategy; +import androidx.room.Query; + +import java.util.List; + +@Dao +public interface ReadPostDao { + @Insert(onConflict = OnConflictStrategy.REPLACE) + void insert(ReadPost readPost); + + @Query("SELECT * FROM read_posts WHERE username = :username") + List<ReadPost> getAllReadPosts(String username); + + @Query("SELECT COUNT(id) FROM read_posts") + int getReadPostsCount(); + + @Query("DELETE FROM read_posts WHERE rowid IN (SELECT rowid FROM read_posts LIMIT 100) AND username = :username") + void deleteOldestReadPosts(String username); + + @Query("DELETE FROM read_posts") + void deleteAllReadPosts(); +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java b/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java index 7e933906..a326d81f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java @@ -11,13 +11,17 @@ import android.content.Intent; import android.content.SharedPreferences; import android.media.MediaScannerConnection; import android.net.Uri; -import android.os.AsyncTask; import android.os.Build; +import android.os.Bundle; import android.os.Environment; +import android.os.Handler; +import android.os.HandlerThread; import android.os.IBinder; +import android.os.Looper; +import android.os.Message; +import android.os.Process; import android.provider.MediaStore; -import androidx.annotation.NonNull; import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationManagerCompat; import androidx.documentfile.provider.DocumentFile; @@ -29,6 +33,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.util.Random; import javax.inject.Inject; import javax.inject.Named; @@ -43,8 +48,6 @@ import ml.docilealligator.infinityforreddit.utils.NotificationUtils; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; import okhttp3.OkHttpClient; import okhttp3.ResponseBody; -import retrofit2.Call; -import retrofit2.Callback; import retrofit2.Response; import retrofit2.Retrofit; @@ -71,11 +74,9 @@ public class DownloadMediaService extends Service { SharedPreferences mSharedPreferences; @Inject CustomThemeWrapper mCustomThemeWrapper; - private int mediaType; - private String mimeType; private NotificationManagerCompat notificationManager; private NotificationCompat.Builder builder; - private boolean downloadFinished; + private ServiceHandler serviceHandler; public DownloadMediaService() { } @@ -85,144 +86,76 @@ public class DownloadMediaService extends Service { return null; } - private String getNotificationChannelId() { - switch (mediaType) { - case EXTRA_MEDIA_TYPE_GIF: - return NotificationUtils.CHANNEL_ID_DOWNLOAD_GIF; - case EXTRA_MEDIA_TYPE_VIDEO: - return NotificationUtils.CHANNEL_ID_DOWNLOAD_VIDEO; - default: - return NotificationUtils.CHANNEL_ID_DOWNLOAD_IMAGE; - } - } - - private String getNotificationChannel() { - switch (mediaType) { - case EXTRA_MEDIA_TYPE_GIF: - return NotificationUtils.CHANNEL_DOWNLOAD_GIF; - case EXTRA_MEDIA_TYPE_VIDEO: - return NotificationUtils.CHANNEL_DOWNLOAD_VIDEO; - default: - return NotificationUtils.CHANNEL_DOWNLOAD_IMAGE; - } - } - - private int getNotificationId() { - switch (mediaType) { - case EXTRA_MEDIA_TYPE_GIF: - return NotificationUtils.DOWNLOAD_GIF_NOTIFICATION_ID; - case EXTRA_MEDIA_TYPE_VIDEO: - return NotificationUtils.DOWNLOAD_VIDEO_NOTIFICATION_ID; - default: - return NotificationUtils.DOWNLOAD_IMAGE_NOTIFICATION_ID; - } - } - - private String getDownloadLocation() { - switch (mediaType) { - case EXTRA_MEDIA_TYPE_GIF: - return mSharedPreferences.getString(SharedPreferencesUtils.GIF_DOWNLOAD_LOCATION, ""); - case EXTRA_MEDIA_TYPE_VIDEO: - return mSharedPreferences.getString(SharedPreferencesUtils.VIDEO_DOWNLOAD_LOCATION, ""); - default: - return mSharedPreferences.getString(SharedPreferencesUtils.IMAGE_DOWNLOAD_LOCATION, ""); - } - } - - @Override - public int onStartCommand(Intent intent, int flags, int startId) { - ((Infinity) getApplication()).getAppComponent().inject(this); - - downloadFinished = false; - String fileUrl = intent.getStringExtra(EXTRA_URL); - final String[] fileName = {intent.getStringExtra(EXTRA_FILE_NAME)}; - String subredditName = intent.getStringExtra(EXTRA_SUBREDDIT_NAME); - mediaType = intent.getIntExtra(EXTRA_MEDIA_TYPE, EXTRA_MEDIA_TYPE_IMAGE); - mimeType = mediaType == EXTRA_MEDIA_TYPE_VIDEO ? "video/*" : "image/*"; - - notificationManager = NotificationManagerCompat.from(this); - builder = new NotificationCompat.Builder(this, getNotificationChannelId()); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - NotificationChannel serviceChannel; - serviceChannel = new NotificationChannel( - getNotificationChannelId(), - getNotificationChannel(), - NotificationManager.IMPORTANCE_LOW - ); + // Handler that receives messages from the thread + private final class ServiceHandler extends Handler { + private boolean downloadFinished; - notificationManager.createNotificationChannel(serviceChannel); - } - - switch (mediaType) { - case EXTRA_MEDIA_TYPE_GIF: - startForeground( - NotificationUtils.DOWNLOAD_GIF_NOTIFICATION_ID, - createNotification(fileName[0]) - ); - break; - case EXTRA_MEDIA_TYPE_VIDEO: - startForeground( - NotificationUtils.DOWNLOAD_VIDEO_NOTIFICATION_ID, - createNotification(fileName[0]) - ); - break; - default: - startForeground( - NotificationUtils.DOWNLOAD_IMAGE_NOTIFICATION_ID, - createNotification(fileName[0]) - ); + public ServiceHandler(Looper looper) { + super(looper); } - - final DownloadProgressResponseBody.ProgressListener progressListener = new DownloadProgressResponseBody.ProgressListener() { - long time = 0; - - @Override public void update(long bytesRead, long contentLength, boolean done) { - if (!done) { - if (contentLength != -1) { - long currentTime = System.currentTimeMillis(); - if (currentTime - time > 1000) { - time = currentTime; - updateNotification(0, (int) ((100 * bytesRead) / contentLength), null); + @Override + public void handleMessage(Message msg) { + int randomNotificationIdOffset = msg.arg1; + Bundle intent = msg.getData(); + downloadFinished = false; + String fileUrl = intent.getString(EXTRA_URL); + String fileName = intent.getString(EXTRA_FILE_NAME); + String subredditName = intent.getString(EXTRA_SUBREDDIT_NAME); + int mediaType = intent.getInt(EXTRA_MEDIA_TYPE, EXTRA_MEDIA_TYPE_IMAGE); + String mimeType = mediaType == EXTRA_MEDIA_TYPE_VIDEO ? "video/*" : "image/*"; + + final DownloadProgressResponseBody.ProgressListener progressListener = new DownloadProgressResponseBody.ProgressListener() { + long time = 0; + + @Override public void update(long bytesRead, long contentLength, boolean done) { + if (!done) { + if (contentLength != -1) { + long currentTime = System.currentTimeMillis(); + if (currentTime - time > 1000) { + time = currentTime; + updateNotification(mediaType, 0, + (int) ((100 * bytesRead) / contentLength), randomNotificationIdOffset, null); + } } } } - } - }; - - OkHttpClient client = new OkHttpClient.Builder() - .addNetworkInterceptor(chain -> { - okhttp3.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new DownloadProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - }) - .build(); + }; - retrofit = retrofit.newBuilder().client(client).build(); + OkHttpClient client = new OkHttpClient.Builder() + .addNetworkInterceptor(chain -> { + okhttp3.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new DownloadProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + }) + .build(); - boolean separateDownloadFolder = mSharedPreferences.getBoolean(SharedPreferencesUtils.SEPARATE_FOLDER_FOR_EACH_SUBREDDIT, false); + retrofit = retrofit.newBuilder().client(client).build(); - retrofit.create(DownloadFile.class).downloadFile(fileUrl).enqueue(new Callback<ResponseBody>() { - @Override - public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> response) { + boolean separateDownloadFolder = mSharedPreferences.getBoolean(SharedPreferencesUtils.SEPARATE_FOLDER_FOR_EACH_SUBREDDIT, false); + + Response<ResponseBody> response = null; + String destinationFileUriString = null; + boolean isDefaultDestination = true; + try { + response = retrofit.create(DownloadFile.class).downloadFile(fileUrl).execute(); if (response.isSuccessful() && response.body() != null) { - String destinationFileDirectory = getDownloadLocation(); - String destinationFileUriString; - boolean isDefaultDestination; + String destinationFileDirectory = getDownloadLocation(mediaType); if (destinationFileDirectory.equals("")) { - if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) { File directory = getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES); if (directory != null) { String directoryPath = separateDownloadFolder && subredditName != null && !subredditName.equals("") ? directory.getAbsolutePath() + "/Infinity/" + subredditName + "/" : directory.getAbsolutePath() + "/Infinity/"; File infinityDir = new File(directoryPath); if (!infinityDir.exists() && !infinityDir.mkdirs()) { - downloadFinished(null, ERROR_CANNOT_GET_DESTINATION_DIRECTORY); + downloadFinished(mediaType, randomNotificationIdOffset, mimeType, + null, ERROR_CANNOT_GET_DESTINATION_DIRECTORY); return; } - destinationFileUriString = directoryPath + fileName[0]; + destinationFileUriString = directoryPath + fileName; } else { - downloadFinished(null, ERROR_CANNOT_GET_DESTINATION_DIRECTORY); + downloadFinished(mediaType, randomNotificationIdOffset, mimeType, + null, ERROR_CANNOT_GET_DESTINATION_DIRECTORY); return; } } else { @@ -237,166 +170,72 @@ public class DownloadMediaService extends Service { if (separateDownloadFolder && subredditName != null && !subredditName.equals("")) { dir = DocumentFile.fromTreeUri(DownloadMediaService.this, Uri.parse(destinationFileDirectory)); if (dir == null) { - downloadFinished(null, ERROR_CANNOT_GET_DESTINATION_DIRECTORY); + downloadFinished(mediaType, randomNotificationIdOffset, mimeType, + null, ERROR_CANNOT_GET_DESTINATION_DIRECTORY); return; } dir = dir.findFile(subredditName); if (dir == null) { dir = DocumentFile.fromTreeUri(DownloadMediaService.this, Uri.parse(destinationFileDirectory)).createDirectory(subredditName); if (dir == null) { - downloadFinished(null, ERROR_CANNOT_GET_DESTINATION_DIRECTORY); + downloadFinished(mediaType, randomNotificationIdOffset, mimeType, + null, ERROR_CANNOT_GET_DESTINATION_DIRECTORY); return; } } } else { dir = DocumentFile.fromTreeUri(DownloadMediaService.this, Uri.parse(destinationFileDirectory)); if (dir == null) { - downloadFinished(null, ERROR_CANNOT_GET_DESTINATION_DIRECTORY); + downloadFinished(mediaType, randomNotificationIdOffset, mimeType, + null, ERROR_CANNOT_GET_DESTINATION_DIRECTORY); return; } } - DocumentFile checkForDuplicates = dir.findFile(fileName[0]); - int extensionPosition = fileName[0].lastIndexOf('.'); - String extension = fileName[0].substring(extensionPosition); + DocumentFile checkForDuplicates = dir.findFile(fileName); + int extensionPosition = fileName.lastIndexOf('.'); + String extension = fileName.substring(extensionPosition); int num = 1; while (checkForDuplicates != null) { - fileName[0] = fileName[0].substring(0, extensionPosition) + " (" + num + ")" + extension; - checkForDuplicates = dir.findFile(fileName[0]); + fileName = fileName.substring(0, extensionPosition) + " (" + num + ")" + extension; + checkForDuplicates = dir.findFile(fileName); num++; } - picFile = dir.createFile(mimeType, fileName[0]); + picFile = dir.createFile(mimeType, fileName); if (picFile == null) { - downloadFinished(null, ERROR_CANNOT_GET_DESTINATION_DIRECTORY); + downloadFinished(mediaType, randomNotificationIdOffset, mimeType, + null, ERROR_CANNOT_GET_DESTINATION_DIRECTORY); return; } destinationFileUriString = picFile.getUri().toString(); } - - new SaveImageOrGifAndCopyToExternalStorageAsyncTask(response.body(), mediaType, - isDefaultDestination, fileName[0], destinationFileUriString, getContentResolver(), - (destinationFileUri, errorCode) -> downloadFinished(destinationFileUri, errorCode)).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + } else { + downloadFinished(mediaType, randomNotificationIdOffset, mimeType, null, + ERROR_FILE_CANNOT_DOWNLOAD); } + } catch (IOException e) { + e.printStackTrace(); } - @Override - public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) { - downloadFinished(null, ERROR_FILE_CANNOT_DOWNLOAD); - } - }); - - return START_NOT_STICKY; - } - - private Notification createNotification(String fileName) { - builder.setContentTitle(fileName).setContentText(getString(R.string.downloading)).setProgress(100, 0, false); - return builder.setSmallIcon(R.drawable.ic_notification) - .setColor(mCustomThemeWrapper.getColorPrimaryLightTheme()) - .build(); - } - - private void updateNotification(int contentStringResId, int progress, PendingIntent pendingIntent) { - if (notificationManager != null) { - if (progress < 0) { - builder.setProgress(0, 0, false); - } else { - builder.setProgress(100, progress, false); - } - if (contentStringResId != 0) { - builder.setContentText(getString(contentStringResId)); - } - if (pendingIntent != null) { - builder.setContentIntent(pendingIntent); - } - notificationManager.notify(getNotificationId(), builder.build()); - } - } - - private void downloadFinished(Uri destinationFileUri, int errorCode) { - if (downloadFinished) { - return; - } - - downloadFinished = true; - if (errorCode != NO_ERROR) { - switch (errorCode) { - case ERROR_CANNOT_GET_DESTINATION_DIRECTORY: - updateNotification(R.string.downloading_image_or_gif_failed_cannot_get_destination_directory, -1, null); - break; - case ERROR_FILE_CANNOT_DOWNLOAD: - updateNotification(R.string.downloading_media_failed_cannot_download_media, -1, null); - break; - case ERROR_FILE_CANNOT_SAVE: - updateNotification(R.string.downloading_media_failed_cannot_save_to_destination_directory, -1, null); - break; - } - EventBus.getDefault().post(new DownloadMediaEvent(false)); - } else { - MediaScannerConnection.scanFile( - this, new String[]{destinationFileUri.toString()}, null, - (path, uri) -> { - Intent intent = new Intent(); - intent.setAction(android.content.Intent.ACTION_VIEW); - intent.setDataAndType(destinationFileUri, mimeType); - intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); - PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT); - updateNotification(R.string.downloading_media_finished, -1, pendingIntent); - EventBus.getDefault().post(new DownloadMediaEvent(true)); - } - ); - } - stopForeground(false); - } - - private static class SaveImageOrGifAndCopyToExternalStorageAsyncTask extends AsyncTask<Void, Integer, Void> { - - private ResponseBody response; - private int mediaType; - private boolean isDefaultDestination; - private String destinationFileName; - @NonNull - private String destinationFileUriString; - private ContentResolver contentResolver; - private SaveImageOrGifAndCopyToExternalStorageAsyncTaskListener saveImageOrGifAndCopyToExternalStorageAsyncTaskListener; - private int errorCode = NO_ERROR; - - interface SaveImageOrGifAndCopyToExternalStorageAsyncTaskListener { - void finished(Uri destinationFileUri, int errorCode); - } - - public SaveImageOrGifAndCopyToExternalStorageAsyncTask(ResponseBody response, int mediaType, - boolean isDefaultDestination, - String destinationFileName, - @NonNull String destinationFileUriString, - ContentResolver contentResolver, - SaveImageOrGifAndCopyToExternalStorageAsyncTaskListener saveImageOrGifAndCopyToExternalStorageAsyncTaskListener) { - this.response = response; - this.mediaType = mediaType; - this.isDefaultDestination = isDefaultDestination; - this.destinationFileName = destinationFileName; - this.destinationFileUriString = destinationFileUriString; - this.contentResolver = contentResolver; - this.saveImageOrGifAndCopyToExternalStorageAsyncTaskListener = saveImageOrGifAndCopyToExternalStorageAsyncTaskListener; - } - - @Override - protected Void doInBackground(Void... voids) { try { - writeResponseBodyToDisk(response); + if (response != null && response.body() != null) { + Uri destinationFileUri = writeResponseBodyToDisk(response.body(), isDefaultDestination, destinationFileUriString, + fileName, mediaType); + downloadFinished(mediaType, randomNotificationIdOffset, + mimeType, destinationFileUri, NO_ERROR); + } } catch (IOException e) { - errorCode = ERROR_FILE_CANNOT_SAVE; + e.printStackTrace(); + downloadFinished(mediaType, randomNotificationIdOffset, + mimeType, null, ERROR_FILE_CANNOT_SAVE); } - return null; - } - - @Override - protected void onPostExecute(Void aVoid) { - super.onPostExecute(aVoid); - saveImageOrGifAndCopyToExternalStorageAsyncTaskListener.finished(Uri.parse(destinationFileUriString), errorCode); } - private void writeResponseBodyToDisk(ResponseBody body) throws IOException { + private Uri writeResponseBodyToDisk(ResponseBody body, boolean isDefaultDestination, + String destinationFileUriString, String destinationFileName, + int mediaType) throws IOException { + ContentResolver contentResolver = getContentResolver(); if (isDefaultDestination) { - if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) { InputStream inputStream = body.byteStream(); OutputStream outputStream = new FileOutputStream(destinationFileUriString); byte[] fileReader = new byte[4096]; @@ -424,7 +263,7 @@ public class DownloadMediaService extends Service { contentValues.put(MediaStore.MediaColumns.RELATIVE_PATH, destinationFileUriString); contentValues.put(mediaType == EXTRA_MEDIA_TYPE_VIDEO ? MediaStore.Video.Media.IS_PENDING : MediaStore.Images.Media.IS_PENDING, 1); - final Uri contentUri = mediaType == EXTRA_MEDIA_TYPE_VIDEO ? MediaStore.Video.Media.EXTERNAL_CONTENT_URI : MediaStore.Images.Media.EXTERNAL_CONTENT_URI; + final Uri contentUri = mediaType == EXTRA_MEDIA_TYPE_VIDEO ? MediaStore.Video.Media.getContentUri(MediaStore.VOLUME_EXTERNAL) : MediaStore.Images.Media.getContentUri(MediaStore.VOLUME_EXTERNAL); Uri uri = contentResolver.insert(contentUri, contentValues); if (uri == null) { @@ -463,6 +302,178 @@ public class DownloadMediaService extends Service { } } } + return Uri.parse(destinationFileUriString); + } + + private void downloadFinished(int mediaType, int randomNotificationIdOffset, String mimeType, Uri destinationFileUri, int errorCode) { + if (downloadFinished) { + return; + } + + downloadFinished = true; + if (errorCode != NO_ERROR) { + switch (errorCode) { + case ERROR_CANNOT_GET_DESTINATION_DIRECTORY: + updateNotification(mediaType, R.string.downloading_image_or_gif_failed_cannot_get_destination_directory, + -1, randomNotificationIdOffset, null); + break; + case ERROR_FILE_CANNOT_DOWNLOAD: + updateNotification(mediaType, R.string.downloading_media_failed_cannot_download_media, + -1, randomNotificationIdOffset, null); + break; + case ERROR_FILE_CANNOT_SAVE: + updateNotification(mediaType, R.string.downloading_media_failed_cannot_save_to_destination_directory, + -1, randomNotificationIdOffset, null); + break; + } + EventBus.getDefault().post(new DownloadMediaEvent(false)); + } else { + MediaScannerConnection.scanFile( + DownloadMediaService.this, new String[]{destinationFileUri.toString()}, null, + (path, uri) -> { + Intent intent = new Intent(); + intent.setAction(android.content.Intent.ACTION_VIEW); + intent.setDataAndType(destinationFileUri, mimeType); + intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + PendingIntent pendingIntent = PendingIntent.getActivity(DownloadMediaService.this, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT); + updateNotification(mediaType, R.string.downloading_media_finished, -1, + randomNotificationIdOffset, pendingIntent); + EventBus.getDefault().post(new DownloadMediaEvent(true)); + } + ); + } + stopForeground(false); + } + } + + @Override + public void onCreate() { + ((Infinity) getApplication()).getAppComponent().inject(this); + notificationManager = NotificationManagerCompat.from(this); + // Start up the thread running the service. Note that we create a + // separate thread because the service normally runs in the process's + // main thread, which we don't want to block. We also make it + // background priority so CPU-intensive work doesn't disrupt our UI. + HandlerThread thread = new HandlerThread("ServiceStartArguments", + Process.THREAD_PRIORITY_BACKGROUND); + thread.start(); + + // Get the HandlerThread's Looper and use it for our Handler + serviceHandler = new ServiceHandler(thread.getLooper()); + } + + @Override + public int onStartCommand(Intent intent, int flags, int startId) { + int mediaType = intent.getIntExtra(EXTRA_MEDIA_TYPE, EXTRA_MEDIA_TYPE_IMAGE); + builder = new NotificationCompat.Builder(this, getNotificationChannelId(mediaType)); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + NotificationChannel serviceChannel; + serviceChannel = new NotificationChannel( + getNotificationChannelId(mediaType), + getNotificationChannel(mediaType), + NotificationManager.IMPORTANCE_LOW + ); + + notificationManager.createNotificationChannel(serviceChannel); + } + + int randomNotificationIdOffset = new Random().nextInt(10000); + switch (intent.getIntExtra(EXTRA_MEDIA_TYPE, EXTRA_MEDIA_TYPE_IMAGE)) { + case EXTRA_MEDIA_TYPE_GIF: + startForeground( + NotificationUtils.DOWNLOAD_GIF_NOTIFICATION_ID + randomNotificationIdOffset, + createNotification(intent.getStringExtra(EXTRA_FILE_NAME)) + ); + break; + case EXTRA_MEDIA_TYPE_VIDEO: + startForeground( + NotificationUtils.DOWNLOAD_VIDEO_NOTIFICATION_ID + randomNotificationIdOffset, + createNotification(intent.getStringExtra(EXTRA_FILE_NAME)) + ); + break; + default: + startForeground( + NotificationUtils.DOWNLOAD_IMAGE_NOTIFICATION_ID + randomNotificationIdOffset, + createNotification(intent.getStringExtra(EXTRA_FILE_NAME)) + ); + } + + Message msg = serviceHandler.obtainMessage(); + Bundle bundle = intent.getExtras(); + msg.setData(bundle); + msg.arg1 = randomNotificationIdOffset; + serviceHandler.sendMessage(msg); + + return START_NOT_STICKY; + } + + private Notification createNotification(String fileName) { + builder.setContentTitle(fileName).setContentText(getString(R.string.downloading)).setProgress(100, 0, false); + return builder.setSmallIcon(R.drawable.ic_notification) + .setColor(mCustomThemeWrapper.getColorPrimaryLightTheme()) + .build(); + } + + private void updateNotification(int mediaType, int contentStringResId, int progress, int randomNotificationIdOffset, + PendingIntent pendingIntent) { + if (notificationManager != null) { + if (progress < 0) { + builder.setProgress(0, 0, false); + } else { + builder.setProgress(100, progress, false); + } + if (contentStringResId != 0) { + builder.setContentText(getString(contentStringResId)); + } + if (pendingIntent != null) { + builder.setContentIntent(pendingIntent); + } + notificationManager.notify(getNotificationId(mediaType, randomNotificationIdOffset), builder.build()); + } + } + + private String getNotificationChannelId(int mediaType) { + switch (mediaType) { + case EXTRA_MEDIA_TYPE_GIF: + return NotificationUtils.CHANNEL_ID_DOWNLOAD_GIF; + case EXTRA_MEDIA_TYPE_VIDEO: + return NotificationUtils.CHANNEL_ID_DOWNLOAD_VIDEO; + default: + return NotificationUtils.CHANNEL_ID_DOWNLOAD_IMAGE; + } + } + + private String getNotificationChannel(int mediaType) { + switch (mediaType) { + case EXTRA_MEDIA_TYPE_GIF: + return NotificationUtils.CHANNEL_DOWNLOAD_GIF; + case EXTRA_MEDIA_TYPE_VIDEO: + return NotificationUtils.CHANNEL_DOWNLOAD_VIDEO; + default: + return NotificationUtils.CHANNEL_DOWNLOAD_IMAGE; + } + } + + private int getNotificationId(int mediaType, int randomNotificationIdOffset) { + switch (mediaType) { + case EXTRA_MEDIA_TYPE_GIF: + return NotificationUtils.DOWNLOAD_GIF_NOTIFICATION_ID + randomNotificationIdOffset; + case EXTRA_MEDIA_TYPE_VIDEO: + return NotificationUtils.DOWNLOAD_VIDEO_NOTIFICATION_ID + randomNotificationIdOffset; + default: + return NotificationUtils.DOWNLOAD_IMAGE_NOTIFICATION_ID + randomNotificationIdOffset; + } + } + + private String getDownloadLocation(int mediaType) { + switch (mediaType) { + case EXTRA_MEDIA_TYPE_GIF: + return mSharedPreferences.getString(SharedPreferencesUtils.GIF_DOWNLOAD_LOCATION, ""); + case EXTRA_MEDIA_TYPE_VIDEO: + return mSharedPreferences.getString(SharedPreferencesUtils.VIDEO_DOWNLOAD_LOCATION, ""); + default: + return mSharedPreferences.getString(SharedPreferencesUtils.IMAGE_DOWNLOAD_LOCATION, ""); } } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java b/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java index 091877cd..73839464 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java @@ -15,13 +15,17 @@ import android.media.MediaFormat; import android.media.MediaMuxer; import android.media.MediaScannerConnection; import android.net.Uri; -import android.os.AsyncTask; import android.os.Build; +import android.os.Bundle; import android.os.Environment; +import android.os.Handler; +import android.os.HandlerThread; import android.os.IBinder; +import android.os.Looper; +import android.os.Message; +import android.os.Process; import android.provider.MediaStore; -import androidx.annotation.NonNull; import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationManagerCompat; import androidx.documentfile.provider.DocumentFile; @@ -35,6 +39,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.nio.ByteBuffer; +import java.util.Random; import javax.inject.Inject; import javax.inject.Named; @@ -49,8 +54,6 @@ import ml.docilealligator.infinityforreddit.utils.NotificationUtils; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; import okhttp3.OkHttpClient; import okhttp3.ResponseBody; -import retrofit2.Call; -import retrofit2.Callback; import retrofit2.Response; import retrofit2.Retrofit; @@ -79,101 +82,82 @@ public class DownloadRedditVideoService extends Service { SharedPreferences sharedPreferences; @Inject CustomThemeWrapper customThemeWrapper; - String resultFile; + private ServiceHandler serviceHandler; private NotificationManagerCompat notificationManager; private NotificationCompat.Builder builder; public DownloadRedditVideoService() { } - @Override - public IBinder onBind(Intent intent) { - return null; - } - - @Override - public int onStartCommand(Intent intent, int flags, int startId) { - ((Infinity) getApplication()).getAppComponent().inject(this); - - String videoUrl = intent.getStringExtra(EXTRA_VIDEO_URL); - String audioUrl = videoUrl.substring(0, videoUrl.lastIndexOf('/')) + "/DASH_audio.mp4"; - String subredditName = intent.getStringExtra(EXTRA_SUBREDDIT); - final String[] fileNameWithoutExtension = {subredditName + "-" + intent.getStringExtra(EXTRA_POST_ID)}; - - notificationManager = NotificationManagerCompat.from(this); - builder = new NotificationCompat.Builder(this, NotificationUtils.CHANNEL_ID_DOWNLOAD_REDDIT_VIDEO); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - NotificationChannel serviceChannel; - serviceChannel = new NotificationChannel( - NotificationUtils.CHANNEL_ID_DOWNLOAD_REDDIT_VIDEO, - NotificationUtils.CHANNEL_DOWNLOAD_REDDIT_VIDEO, - NotificationManager.IMPORTANCE_LOW - ); - - notificationManager.createNotificationChannel(serviceChannel); + private final class ServiceHandler extends Handler { + public ServiceHandler(Looper looper) { + super(looper); } - - startForeground( - NotificationUtils.DOWNLOAD_REDDIT_VIDEO_NOTIFICATION_ID, - createNotification(fileNameWithoutExtension[0] + ".mp4") - ); - - final DownloadProgressResponseBody.ProgressListener progressListener = new DownloadProgressResponseBody.ProgressListener() { - long time = 0; - - @Override public void update(long bytesRead, long contentLength, boolean done) { - if (!done) { - if (contentLength != -1) { - long currentTime = System.currentTimeMillis(); - if (currentTime - time > 1000) { - time = currentTime; - updateNotification(0, (int) ((100 * bytesRead) / contentLength), null); + @Override + public void handleMessage(Message msg) { + Bundle intent = msg.getData(); + String videoUrl = intent.getString(EXTRA_VIDEO_URL); + String audioUrl = videoUrl.substring(0, videoUrl.lastIndexOf('/')) + "/DASH_audio.mp4"; + String subredditName = intent.getString(EXTRA_SUBREDDIT); + String fileNameWithoutExtension = subredditName + "-" + intent.getString(EXTRA_POST_ID); + int randomNotificationIdOffset = msg.arg1; + + final DownloadProgressResponseBody.ProgressListener progressListener = new DownloadProgressResponseBody.ProgressListener() { + long time = 0; + + @Override public void update(long bytesRead, long contentLength, boolean done) { + if (!done) { + if (contentLength != -1) { + long currentTime = System.currentTimeMillis(); + if (currentTime - time > 1000) { + time = currentTime; + updateNotification(0, (int) ((100 * bytesRead) / contentLength), + randomNotificationIdOffset, null); + } } } } - } - }; - - OkHttpClient client = new OkHttpClient.Builder() - .addNetworkInterceptor(chain -> { - okhttp3.Response originalResponse = chain.proceed(chain.request()); - return originalResponse.newBuilder() - .body(new DownloadProgressResponseBody(originalResponse.body(), progressListener)) - .build(); - }) - .build(); + }; + + OkHttpClient client = new OkHttpClient.Builder() + .addNetworkInterceptor(chain -> { + okhttp3.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new DownloadProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + }) + .build(); - retrofit = retrofit.newBuilder().client(client).build(); + retrofit = retrofit.newBuilder().client(client).build(); - DownloadFile downloadFile = retrofit.create(DownloadFile.class); + DownloadFile downloadFile = retrofit.create(DownloadFile.class); - boolean separateDownloadFolder = sharedPreferences.getBoolean(SharedPreferencesUtils.SEPARATE_FOLDER_FOR_EACH_SUBREDDIT, false); + boolean separateDownloadFolder = sharedPreferences.getBoolean(SharedPreferencesUtils.SEPARATE_FOLDER_FOR_EACH_SUBREDDIT, false); - File directory = getExternalCacheDir(); - String destinationFileName = fileNameWithoutExtension[0] + ".mp4"; - if (directory != null) { - String directoryPath = directory.getAbsolutePath() + "/"; - downloadFile.downloadFile(videoUrl).enqueue(new Callback<ResponseBody>() { - @Override - public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> videoResponse) { + File externalCacheDirectory = getExternalCacheDir(); + if (externalCacheDirectory != null) { + String destinationFileName = fileNameWithoutExtension + ".mp4"; + + try { + Response<ResponseBody> videoResponse = downloadFile.downloadFile(videoUrl).execute(); if (videoResponse.isSuccessful() && videoResponse.body() != null) { + String externalCacheDirectoryPath = externalCacheDirectory.getAbsolutePath() + "/"; String destinationFileDirectory = sharedPreferences.getString(SharedPreferencesUtils.VIDEO_DOWNLOAD_LOCATION, ""); String destinationFileUriString; boolean isDefaultDestination; if (destinationFileDirectory.equals("")) { - if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) { - File directory = getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES); - if (directory != null) { - String directoryPath = separateDownloadFolder ? directory.getAbsolutePath() + "/Infinity/" + subredditName + "/" : directory.getAbsolutePath() + "/Infinity/"; - File infinityDir = new File(directoryPath); + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) { + File destinationDirectory = getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES); + if (destinationDirectory != null) { + String destinationDirectoryPath = separateDownloadFolder ? destinationDirectory.getAbsolutePath() + "/Infinity/" + subredditName + "/" : destinationDirectory.getAbsolutePath() + "/Infinity/"; + File infinityDir = new File(destinationDirectoryPath); if (!infinityDir.exists() && !infinityDir.mkdir()) { - downloadFinished(null, ERROR_CANNOT_GET_DESTINATION_DIRECTORY); + downloadFinished(null, ERROR_CANNOT_GET_DESTINATION_DIRECTORY, randomNotificationIdOffset); return; } - destinationFileUriString = directoryPath + destinationFileName; + destinationFileUriString = destinationDirectoryPath + destinationFileName; } else { - downloadFinished(null, ERROR_CANNOT_GET_DESTINATION_DIRECTORY); + downloadFinished(null, ERROR_CANNOT_GET_DESTINATION_DIRECTORY, randomNotificationIdOffset); return; } } else { @@ -187,272 +171,104 @@ public class DownloadRedditVideoService extends Service { if (separateDownloadFolder) { dir = DocumentFile.fromTreeUri(DownloadRedditVideoService.this, Uri.parse(destinationFileDirectory)); if (dir == null) { - downloadFinished(null, ERROR_CANNOT_GET_DESTINATION_DIRECTORY); + downloadFinished(null, ERROR_CANNOT_GET_DESTINATION_DIRECTORY, randomNotificationIdOffset); return; } dir = dir.findFile(subredditName); if (dir == null) { dir = DocumentFile.fromTreeUri(DownloadRedditVideoService.this, Uri.parse(destinationFileDirectory)).createDirectory(subredditName); if (dir == null) { - downloadFinished(null, ERROR_CANNOT_GET_DESTINATION_DIRECTORY); + downloadFinished(null, ERROR_CANNOT_GET_DESTINATION_DIRECTORY, randomNotificationIdOffset); return; } } } else { dir = DocumentFile.fromTreeUri(DownloadRedditVideoService.this, Uri.parse(destinationFileDirectory)); if (dir == null) { - downloadFinished(null, ERROR_CANNOT_GET_DESTINATION_DIRECTORY); + downloadFinished(null, ERROR_CANNOT_GET_DESTINATION_DIRECTORY, randomNotificationIdOffset); return; } } DocumentFile checkForDuplicates = dir.findFile(destinationFileName); int num = 1; while (checkForDuplicates != null) { - fileNameWithoutExtension[0] = fileNameWithoutExtension[0] + " (" + num + ")"; - checkForDuplicates = dir.findFile(fileNameWithoutExtension[0] + ".mp4"); + fileNameWithoutExtension = fileNameWithoutExtension + " (" + num + ")"; + checkForDuplicates = dir.findFile(fileNameWithoutExtension + ".mp4"); num++; } - picFile = dir.createFile("video/*", fileNameWithoutExtension[0] + ".mp4"); + picFile = dir.createFile("video/*", fileNameWithoutExtension + ".mp4"); if (picFile == null) { - downloadFinished(null, ERROR_CANNOT_GET_DESTINATION_DIRECTORY); + downloadFinished(null, ERROR_CANNOT_GET_DESTINATION_DIRECTORY, randomNotificationIdOffset); return; } destinationFileUriString = picFile.getUri().toString(); } - updateNotification(R.string.downloading_reddit_video_audio_track, 0, null); - downloadFile.downloadFile(audioUrl).enqueue(new Callback<ResponseBody>() { - @Override - public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> audioResponse) { - if (audioResponse.isSuccessful() && audioResponse.body() != null) { - String videoFilePath = directoryPath + fileNameWithoutExtension[0] + "-cache.mp4"; - String audioFilePath = directoryPath + fileNameWithoutExtension[0] + "-cache.mp3"; - String outputFilePath = directoryPath + fileNameWithoutExtension[0] + ".mp4"; - new SaveTempMuxAndCopyAsyncTask(videoResponse.body(), - audioResponse.body(), videoFilePath, audioFilePath, outputFilePath, - destinationFileName, destinationFileUriString, isDefaultDestination, - getContentResolver(), - new SaveTempMuxAndCopyAsyncTask.SaveTempMuxAndCopyAsyncTaskListener() { - @Override - public void finished(Uri destinationFileUri, int errorCode) { - new File(videoFilePath).delete(); - new File(audioFilePath).delete(); - new File(outputFilePath).delete(); - downloadFinished(destinationFileUri, errorCode); - } - - @Override - public void updateProgressNotification(int stringResId) { - updateNotification(stringResId, -1, null); - } - }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); - } else { - String videoFilePath = directoryPath + fileNameWithoutExtension[0] + "-cache.mp4"; - new SaveTempMuxAndCopyAsyncTask(videoResponse.body(), - null, videoFilePath, null, null, - destinationFileName, destinationFileUriString, isDefaultDestination, - getContentResolver(), - new SaveTempMuxAndCopyAsyncTask.SaveTempMuxAndCopyAsyncTaskListener() { - @Override - public void finished(Uri destinationFileUri, int errorCode) { - new File(videoFilePath).delete(); - downloadFinished(destinationFileUri, errorCode); - } - - @Override - public void updateProgressNotification(int stringResId) { - updateNotification(stringResId, -1, null); - } - }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); - } + updateNotification(R.string.downloading_reddit_video_audio_track, 0, + randomNotificationIdOffset, null); + + Response<ResponseBody> audioResponse = downloadFile.downloadFile(audioUrl).execute(); + if (audioResponse.isSuccessful() && audioResponse.body() != null) { + String videoFilePath = externalCacheDirectoryPath + fileNameWithoutExtension + "-cache.mp4"; + String audioFilePath = externalCacheDirectoryPath + fileNameWithoutExtension + "-cache.mp3"; + String outputFilePath = externalCacheDirectoryPath + fileNameWithoutExtension + ".mp4"; + + String savedVideoFilePath = writeResponseBodyToDisk(videoResponse.body(), videoFilePath); + if (savedVideoFilePath == null) { + downloadFinished(null, ERROR_VIDEO_FILE_CANNOT_SAVE, randomNotificationIdOffset); + return; + } + String savedAudioFilePath = writeResponseBodyToDisk(audioResponse.body(), audioFilePath); + if (savedAudioFilePath == null) { + downloadFinished(null, ERROR_AUDIO_FILE_CANNOT_SAVE, randomNotificationIdOffset); + return; } - @Override - public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) { - String videoFilePath = directoryPath + fileNameWithoutExtension[0] + "-cache.mp4"; - new SaveTempMuxAndCopyAsyncTask(videoResponse.body(), - null, videoFilePath, null, null, - destinationFileName, destinationFileUriString, isDefaultDestination, - getContentResolver(), - new SaveTempMuxAndCopyAsyncTask.SaveTempMuxAndCopyAsyncTaskListener() { - @Override - public void finished(Uri destinationFileUri, int errorCode) { - new File(videoFilePath).delete(); - downloadFinished(destinationFileUri, errorCode); - } - - @Override - public void updateProgressNotification(int stringResId) { - updateNotification(stringResId, -1, null); - } - }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + updateNotification(R.string.downloading_reddit_video_muxing, -1, + randomNotificationIdOffset, null); + if (!muxVideoAndAudio(videoFilePath, audioFilePath, outputFilePath)) { + downloadFinished(null, ERROR_MUX_FAILED, randomNotificationIdOffset); + return; } - }); - } else { - downloadFinished(null, ERROR_VIDEO_FILE_CANNOT_DOWNLOAD); - } - } - @Override - public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) { - downloadFinished(null, ERROR_VIDEO_FILE_CANNOT_DOWNLOAD); - } - }); - } else { - downloadFinished(null, ERROR_CANNOT_GET_CACHE_DIRECTORY); - } + updateNotification(R.string.downloading_reddit_video_save_file_to_public_dir, -1, + randomNotificationIdOffset, null); + try { + Uri destinationFileUri = copyToDestination(outputFilePath, destinationFileUriString, destinationFileName, isDefaultDestination); - return START_NOT_STICKY; - } + new File(videoFilePath).delete(); + new File(audioFilePath).delete(); + new File(outputFilePath).delete(); - private void downloadFinished(Uri destinationFileUri, int errorCode) { - if (errorCode != NO_ERROR) { - switch (errorCode) { - case ERROR_CANNOT_GET_CACHE_DIRECTORY: - updateNotification(R.string.downloading_reddit_video_failed_cannot_get_cache_directory, -1, null); - break; - case ERROR_VIDEO_FILE_CANNOT_DOWNLOAD: - updateNotification(R.string.downloading_reddit_video_failed_cannot_download_video, -1, null); - break; - case ERROR_VIDEO_FILE_CANNOT_SAVE: - updateNotification(R.string.downloading_reddit_video_failed_cannot_save_video, -1, null); - break; - case ERROR_AUDIO_FILE_CANNOT_SAVE: - updateNotification(R.string.downloading_reddit_video_failed_cannot_save_audio, -1, null); - break; - case ERROR_MUX_FAILED: - updateNotification(R.string.downloading_reddit_video_failed_cannot_mux, -1, null); - break; - case ERROR_MUXED_VIDEO_FILE_CANNOT_SAVE: - updateNotification(R.string.downloading_reddit_video_failed_cannot_save_mux_video, -1, null); - break; - case ERROR_CANNOT_GET_DESTINATION_DIRECTORY: - updateNotification(R.string.downloading_media_failed_cannot_save_to_destination_directory, -1, null); - break; - } - EventBus.getDefault().post(new DownloadRedditVideoEvent(false)); - } else { - MediaScannerConnection.scanFile( - this, new String[]{destinationFileUri.toString()}, null, - (path, uri) -> { - Intent intent = new Intent(); - intent.setAction(android.content.Intent.ACTION_VIEW); - intent.setDataAndType(destinationFileUri, "video/*"); - intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); - PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT); - updateNotification(R.string.downloading_reddit_video_finished, -1, pendingIntent); - EventBus.getDefault().post(new DownloadRedditVideoEvent(true)); + downloadFinished(destinationFileUri, NO_ERROR, randomNotificationIdOffset); + } catch (IOException e) { + e.printStackTrace(); + downloadFinished(null, ERROR_MUXED_VIDEO_FILE_CANNOT_SAVE, randomNotificationIdOffset); + } + } else { + String videoFilePath = externalCacheDirectoryPath + fileNameWithoutExtension + "-cache.mp4"; + + updateNotification(R.string.downloading_reddit_video_save_file_to_public_dir, -1, + randomNotificationIdOffset, null); + try { + Uri destinationFileUri = copyToDestination(videoFilePath, destinationFileUriString, destinationFileName, isDefaultDestination); + new File(videoFilePath).delete(); + downloadFinished(destinationFileUri, NO_ERROR, randomNotificationIdOffset); + } catch (IOException e) { + e.printStackTrace(); + downloadFinished(null, ERROR_MUXED_VIDEO_FILE_CANNOT_SAVE, randomNotificationIdOffset); + } + } + } else { + downloadFinished(null, ERROR_VIDEO_FILE_CANNOT_DOWNLOAD, randomNotificationIdOffset); } - ); - } - stopForeground(false); - } - - private Notification createNotification(String fileName) { - builder.setContentTitle(fileName).setContentText(getString(R.string.downloading_reddit_video)).setProgress(100, 0, false); - return builder.setSmallIcon(R.drawable.ic_notification) - .setColor(customThemeWrapper.getColorPrimaryLightTheme()) - .build(); - } - - private void updateNotification(int contentStringResId, int progress, PendingIntent pendingIntent) { - if (notificationManager != null) { - if (progress < 0) { - builder.setProgress(0, 0, false); - } else { - builder.setProgress(100, progress, false); - } - if (contentStringResId != 0) { - builder.setContentText(getString(contentStringResId)); - } - if (pendingIntent != null) { - builder.setContentIntent(pendingIntent); - } - notificationManager.notify(NotificationUtils.DOWNLOAD_REDDIT_VIDEO_NOTIFICATION_ID, builder.build()); - } - } - - private static class SaveTempMuxAndCopyAsyncTask extends AsyncTask<Void, Integer, Void> { - - private ResponseBody videoResponse; - private ResponseBody audioResponse; - private String videoFilePath; - private String audioFilePath; - private String outputFilePath; - private String destinationFileName; - @NonNull - private String destinationFileUriString; - private boolean isDefaultDestination; - private ContentResolver contentResolver; - private SaveTempMuxAndCopyAsyncTaskListener saveTempMuxAndCopyAsyncTaskListener; - private int errorCode = NO_ERROR; - - public SaveTempMuxAndCopyAsyncTask(ResponseBody videoResponse, ResponseBody audioResponse, - String videoFilePath, String audioFilePath, String outputFilePath, - String destinationFileName, @NonNull String destinationFileUriString, - boolean isDefaultDestination, ContentResolver contentResolver, - SaveTempMuxAndCopyAsyncTaskListener saveTempMuxAndCopyAsyncTaskListener) { - this.videoResponse = videoResponse; - this.audioResponse = audioResponse; - this.videoFilePath = videoFilePath; - this.audioFilePath = audioFilePath; - this.outputFilePath = outputFilePath; - this.destinationFileName = destinationFileName; - this.destinationFileUriString = destinationFileUriString; - this.isDefaultDestination = isDefaultDestination; - this.contentResolver = contentResolver; - this.saveTempMuxAndCopyAsyncTaskListener = saveTempMuxAndCopyAsyncTaskListener; - } - - @Override - protected void onProgressUpdate(Integer... values) { - super.onProgressUpdate(values); - saveTempMuxAndCopyAsyncTaskListener.updateProgressNotification(values[0]); - } - - @Override - protected Void doInBackground(Void... voids) { - String savedVideoFilePath = writeResponseBodyToDisk(videoResponse, videoFilePath); - if (savedVideoFilePath == null) { - errorCode = ERROR_VIDEO_FILE_CANNOT_SAVE; - return null; - } - if (audioResponse != null) { - String savedAudioFilePath = writeResponseBodyToDisk(audioResponse, audioFilePath); - if (savedAudioFilePath == null) { - errorCode = ERROR_AUDIO_FILE_CANNOT_SAVE; - return null; - } - - publishProgress(R.string.downloading_reddit_video_muxing); - if (!muxVideoAndAudio(videoFilePath, audioFilePath, outputFilePath)) { - errorCode = ERROR_MUX_FAILED; - return null; - } - - publishProgress(R.string.downloading_reddit_video_save_file_to_public_dir); - try { - copyToDestination(outputFilePath); } catch (IOException e) { e.printStackTrace(); - errorCode = ERROR_MUXED_VIDEO_FILE_CANNOT_SAVE; + downloadFinished(null, ERROR_VIDEO_FILE_CANNOT_DOWNLOAD, randomNotificationIdOffset); } } else { - publishProgress(R.string.downloading_reddit_video_save_file_to_public_dir); - try { - copyToDestination(videoFilePath); - } catch (IOException e) { - e.printStackTrace(); - errorCode = ERROR_MUXED_VIDEO_FILE_CANNOT_SAVE; - } + downloadFinished(null, ERROR_CANNOT_GET_CACHE_DIRECTORY, randomNotificationIdOffset); } - return null; - } - - @Override - protected void onPostExecute(Void aVoid) { - super.onPostExecute(aVoid); - saveTempMuxAndCopyAsyncTaskListener.finished(Uri.parse(destinationFileUriString), errorCode); } private String writeResponseBodyToDisk(ResponseBody body, String filePath) { @@ -567,7 +383,7 @@ public class DownloadRedditVideoService extends Service { muxer.stop(); muxer.release(); - } catch (IllegalArgumentException ignore) { + } catch (IllegalArgumentException | IllegalStateException ignore) { } catch (IOException e) { e.printStackTrace(); return false; @@ -576,9 +392,11 @@ public class DownloadRedditVideoService extends Service { return true; } - private void copyToDestination(String srcPath) throws IOException { + private Uri copyToDestination(String srcPath, String destinationFileUriString, String destinationFileName, + boolean isDefaultDestination) throws IOException { + ContentResolver contentResolver = getContentResolver(); if (isDefaultDestination) { - if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) { InputStream in = new FileInputStream(srcPath); OutputStream out = new FileOutputStream(destinationFileUriString); byte[] buf = new byte[1024]; @@ -599,7 +417,7 @@ public class DownloadRedditVideoService extends Service { Uri uri = null; try { - final Uri contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI; + final Uri contentUri = MediaStore.Video.Media.getContentUri(MediaStore.VOLUME_EXTERNAL); uri = contentResolver.insert(contentUri, contentValues); if (uri == null) { @@ -623,7 +441,7 @@ public class DownloadRedditVideoService extends Service { contentValues.clear(); contentValues.put(MediaStore.Video.Media.IS_PENDING, 0); contentResolver.update(uri, contentValues, null, null); - destinationFileUriString = uri.toString(); + return uri; } catch (IOException e) { if (uri != null) { // Don't leave an orphan entry in the MediaStore @@ -651,11 +469,136 @@ public class DownloadRedditVideoService extends Service { stream.write(buf, 0, len); } } + + return Uri.parse(destinationFileUriString); + } + } + + @Override + public void onCreate() { + ((Infinity) getApplication()).getAppComponent().inject(this); + notificationManager = NotificationManagerCompat.from(this); + // Start up the thread running the service. Note that we create a + // separate thread because the service normally runs in the process's + // main thread, which we don't want to block. We also make it + // background priority so CPU-intensive work doesn't disrupt our UI. + HandlerThread thread = new HandlerThread("ServiceStartArguments", + Process.THREAD_PRIORITY_BACKGROUND); + thread.start(); + + // Get the HandlerThread's Looper and use it for our Handler + serviceHandler = new ServiceHandler(thread.getLooper()); + } + + @Override + public IBinder onBind(Intent intent) { + return null; + } + + @Override + public int onStartCommand(Intent intent, int flags, int startId) { + builder = new NotificationCompat.Builder(DownloadRedditVideoService.this, NotificationUtils.CHANNEL_ID_DOWNLOAD_REDDIT_VIDEO); + + String subredditName = intent.getStringExtra(EXTRA_SUBREDDIT); + String fileNameWithoutExtension = subredditName + "-" + intent.getStringExtra(EXTRA_POST_ID); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + NotificationChannel serviceChannel; + serviceChannel = new NotificationChannel( + NotificationUtils.CHANNEL_ID_DOWNLOAD_REDDIT_VIDEO, + NotificationUtils.CHANNEL_DOWNLOAD_REDDIT_VIDEO, + NotificationManager.IMPORTANCE_LOW + ); + + notificationManager.createNotificationChannel(serviceChannel); + } + + int randomNotificationIdOffset = new Random().nextInt(10000); + startForeground( + NotificationUtils.DOWNLOAD_REDDIT_VIDEO_NOTIFICATION_ID + randomNotificationIdOffset, + createNotification(fileNameWithoutExtension + ".mp4") + ); + + Message msg = serviceHandler.obtainMessage(); + Bundle bundle = intent.getExtras(); + msg.setData(bundle); + msg.arg1 = randomNotificationIdOffset; + serviceHandler.sendMessage(msg); + + return START_NOT_STICKY; + } + + private void downloadFinished(Uri destinationFileUri, int errorCode, int randomNotificationIdOffset) { + if (errorCode != NO_ERROR) { + switch (errorCode) { + case ERROR_CANNOT_GET_CACHE_DIRECTORY: + updateNotification(R.string.downloading_reddit_video_failed_cannot_get_cache_directory, -1, + randomNotificationIdOffset, null); + break; + case ERROR_VIDEO_FILE_CANNOT_DOWNLOAD: + updateNotification(R.string.downloading_reddit_video_failed_cannot_download_video, -1, + randomNotificationIdOffset, null); + break; + case ERROR_VIDEO_FILE_CANNOT_SAVE: + updateNotification(R.string.downloading_reddit_video_failed_cannot_save_video, -1, + randomNotificationIdOffset, null); + break; + case ERROR_AUDIO_FILE_CANNOT_SAVE: + updateNotification(R.string.downloading_reddit_video_failed_cannot_save_audio, -1, + randomNotificationIdOffset, null); + break; + case ERROR_MUX_FAILED: + updateNotification(R.string.downloading_reddit_video_failed_cannot_mux, -1, + randomNotificationIdOffset, null); + break; + case ERROR_MUXED_VIDEO_FILE_CANNOT_SAVE: + updateNotification(R.string.downloading_reddit_video_failed_cannot_save_mux_video, -1, + randomNotificationIdOffset, null); + break; + case ERROR_CANNOT_GET_DESTINATION_DIRECTORY: + updateNotification(R.string.downloading_media_failed_cannot_save_to_destination_directory, -1, + randomNotificationIdOffset, null); + break; + } + EventBus.getDefault().post(new DownloadRedditVideoEvent(false)); + } else { + MediaScannerConnection.scanFile( + this, new String[]{destinationFileUri.toString()}, null, + (path, uri) -> { + Intent intent = new Intent(); + intent.setAction(android.content.Intent.ACTION_VIEW); + intent.setDataAndType(destinationFileUri, "video/*"); + intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT); + updateNotification(R.string.downloading_reddit_video_finished, -1, randomNotificationIdOffset, pendingIntent); + EventBus.getDefault().post(new DownloadRedditVideoEvent(true)); + } + ); } + stopForeground(false); + } - interface SaveTempMuxAndCopyAsyncTaskListener { - void finished(Uri destinationFileUri, int errorCode); - void updateProgressNotification(int stringResId); + private Notification createNotification(String fileName) { + builder.setContentTitle(fileName).setContentText(getString(R.string.downloading_reddit_video)).setProgress(100, 0, false); + return builder.setSmallIcon(R.drawable.ic_notification) + .setColor(customThemeWrapper.getColorPrimaryLightTheme()) + .build(); + } + + private void updateNotification(int contentStringResId, int progress, int randomNotificationIdOffset, PendingIntent pendingIntent) { + if (notificationManager != null) { + if (progress < 0) { + builder.setProgress(0, 0, false); + } else { + builder.setProgress(100, progress, false); + } + if (contentStringResId != 0) { + builder.setContentText(getString(contentStringResId)); + } + if (pendingIntent != null) { + builder.setContentIntent(pendingIntent); + } + notificationManager.notify(NotificationUtils.DOWNLOAD_REDDIT_VIDEO_NOTIFICATION_ID + randomNotificationIdOffset, builder.build()); } } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/AdvancedPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/AdvancedPreferenceFragment.java index 4c3e602e..7b586b5c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/AdvancedPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/AdvancedPreferenceFragment.java @@ -20,6 +20,7 @@ import javax.inject.Inject; import javax.inject.Named; import ml.docilealligator.infinityforreddit.asynctasks.DeleteAllPostLayoutsAsyncTask; +import ml.docilealligator.infinityforreddit.asynctasks.DeleteAllReadPostsAsyncTask; import ml.docilealligator.infinityforreddit.asynctasks.DeleteAllSortTypesAsyncTask; import ml.docilealligator.infinityforreddit.asynctasks.DeleteAllSubredditsAsyncTask; import ml.docilealligator.infinityforreddit.asynctasks.DeleteAllThemesAsyncTask; @@ -78,6 +79,7 @@ public class AdvancedPreferenceFragment extends PreferenceFragmentCompat { Preference deletePostLaoutPreference = findPreference(SharedPreferencesUtils.DELETE_ALL_POST_LAYOUT_DATA_IN_DATABASE); Preference deleteAllThemesPreference = findPreference(SharedPreferencesUtils.DELETE_ALL_THEMES_IN_DATABASE); Preference deletePostFeedScrolledPositionsPreference = findPreference(SharedPreferencesUtils.DELETE_FRONT_PAGE_SCROLLED_POSITIONS_IN_DATABASE); + Preference deleteReadPostsPreference = findPreference(SharedPreferencesUtils.DELETE_READ_POSTS_IN_DATABASE); Preference deleteAllLegacySettingsPreference = findPreference(SharedPreferencesUtils.DELETE_ALL_LEGACY_SETTINGS); Preference resetAllSettingsPreference = findPreference(SharedPreferencesUtils.RESET_ALL_SETTINGS); @@ -168,6 +170,20 @@ public class AdvancedPreferenceFragment extends PreferenceFragmentCompat { }); } + if (deleteReadPostsPreference != null) { + deleteReadPostsPreference.setOnPreferenceClickListener(preference -> { + new MaterialAlertDialogBuilder(activity, R.style.MaterialAlertDialogTheme) + .setTitle(R.string.are_you_sure) + .setPositiveButton(R.string.yes, (dialogInterface, i) + -> new DeleteAllReadPostsAsyncTask(mRedditDataRoomDatabase, () -> { + Toast.makeText(activity, R.string.delete_all_read_posts_success, Toast.LENGTH_SHORT).show(); + }).execute()) + .setNegativeButton(R.string.no, null) + .show(); + return true; + }); + } + if (deleteAllLegacySettingsPreference != null) { deleteAllLegacySettingsPreference.setOnPreferenceClickListener(preference -> { new MaterialAlertDialogBuilder(activity, R.style.MaterialAlertDialogTheme) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/FilterPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/FilterPreferenceFragment.java deleted file mode 100644 index 91f40c98..00000000 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/FilterPreferenceFragment.java +++ /dev/null @@ -1,38 +0,0 @@ -package ml.docilealligator.infinityforreddit.settings; - -import android.app.Activity; -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; - -import androidx.annotation.NonNull; -import androidx.preference.Preference; -import androidx.preference.PreferenceFragmentCompat; - -import ml.docilealligator.infinityforreddit.activities.SubredditFilterPopularAndAllActivity; -import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; - -public class FilterPreferenceFragment extends PreferenceFragmentCompat { - - private Activity activity; - - @Override - public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { - setPreferencesFromResource(R.xml.filter_preferences, rootKey); - - Preference subredditFilterPopularAndAllPreference = findPreference(SharedPreferencesUtils.SUBREDDIT_FILTER_POPULAR_AND_ALL); - - subredditFilterPopularAndAllPreference.setOnPreferenceClickListener(preference -> { - Intent intent = new Intent(activity, SubredditFilterPopularAndAllActivity.class); - activity.startActivity(intent); - return true; - }); - } - - @Override - public void onAttach(@NonNull Context context) { - super.onAttach(context); - activity = (Activity) context; - } -}
\ No newline at end of file diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/FontPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/FontPreferenceFragment.java index 2d608ca5..0d43e619 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/FontPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/FontPreferenceFragment.java @@ -5,6 +5,7 @@ import android.content.Context; import android.os.Bundle; import androidx.annotation.NonNull; +import androidx.core.app.ActivityCompat; import androidx.preference.ListPreference; import androidx.preference.PreferenceFragmentCompat; @@ -30,7 +31,7 @@ public class FontPreferenceFragment extends PreferenceFragmentCompat { if (fontFamilyPreference != null) { fontFamilyPreference.setOnPreferenceChangeListener((preference, newValue) -> { EventBus.getDefault().post(new RecreateActivityEvent()); - activity.recreate(); + ActivityCompat.recreate(activity); return true; }); } @@ -52,7 +53,7 @@ public class FontPreferenceFragment extends PreferenceFragmentCompat { if (fontSizePreference != null) { fontSizePreference.setOnPreferenceChangeListener((preference, newValue) -> { EventBus.getDefault().post(new RecreateActivityEvent()); - activity.recreate(); + ActivityCompat.recreate(activity); return true; }); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/MainPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/MainPreferenceFragment.java index e9adbe8b..92a53a90 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/MainPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/MainPreferenceFragment.java @@ -2,6 +2,7 @@ package ml.docilealligator.infinityforreddit.settings; import android.content.Context; +import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; @@ -16,6 +17,7 @@ import javax.inject.Named; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.activities.PostFilterPreferenceActivity; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; import static androidx.biometric.BiometricManager.Authenticators.BIOMETRIC_STRONG; @@ -34,6 +36,7 @@ public class MainPreferenceFragment extends PreferenceFragmentCompat { ((Infinity) activity.getApplication()).getAppComponent().inject(this); Preference securityPreference = findPreference(SharedPreferencesUtils.SECURITY); + Preference postFilterPreference = findPreference(SharedPreferencesUtils.POST_FILTER); BiometricManager biometricManager = BiometricManager.from(activity); if (biometricManager.canAuthenticate(BIOMETRIC_STRONG | DEVICE_CREDENTIAL) != BiometricManager.BIOMETRIC_SUCCESS) { @@ -41,6 +44,14 @@ public class MainPreferenceFragment extends PreferenceFragmentCompat { securityPreference.setVisible(false); } } + + if (postFilterPreference != null) { + postFilterPreference.setOnPreferenceClickListener(preference -> { + Intent intent = new Intent(activity, PostFilterPreferenceActivity.class); + activity.startActivity(intent); + return true; + }); + } } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/MiscellaneousPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/MiscellaneousPreferenceFragment.java index c27e7eec..f33dd57f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/MiscellaneousPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/MiscellaneousPreferenceFragment.java @@ -7,6 +7,7 @@ import android.os.Bundle; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; +import androidx.preference.ListPreference; import androidx.preference.PreferenceFragmentCompat; import androidx.preference.SwitchPreference; @@ -15,10 +16,10 @@ import org.greenrobot.eventbus.EventBus; import javax.inject.Inject; import javax.inject.Named; -import ml.docilealligator.infinityforreddit.events.ChangeSavePostFeedScrolledPositionEvent; -import ml.docilealligator.infinityforreddit.events.RecreateActivityEvent; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.events.ChangeSavePostFeedScrolledPositionEvent; +import ml.docilealligator.infinityforreddit.events.RecreateActivityEvent; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; public class MiscellaneousPreferenceFragment extends PreferenceFragmentCompat { @@ -40,6 +41,7 @@ public class MiscellaneousPreferenceFragment extends PreferenceFragmentCompat { SwitchPreference confirmToExitSwitch = findPreference(SharedPreferencesUtils.CONFIRM_TO_EXIT); SwitchPreference savePostFeedScrolledPositionSwitch = findPreference(SharedPreferencesUtils.SAVE_FRONT_PAGE_SCROLLED_POSITION); + ListPreference languageListPreference = findPreference(SharedPreferencesUtils.LANGUAGE); if (confirmToExitSwitch != null) { confirmToExitSwitch.setOnPreferenceChangeListener((preference, newValue) -> { @@ -57,6 +59,13 @@ public class MiscellaneousPreferenceFragment extends PreferenceFragmentCompat { return true; }); } + + if (languageListPreference != null) { + languageListPreference.setOnPreferenceChangeListener((preference, newValue) -> { + EventBus.getDefault().post(new RecreateActivityEvent()); + return true; + }); + } } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/PostHistoryFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/PostHistoryFragment.java new file mode 100644 index 00000000..5d5a9e16 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/PostHistoryFragment.java @@ -0,0 +1,104 @@ +package ml.docilealligator.infinityforreddit.settings; + +import android.app.Activity; +import android.content.Context; +import android.content.SharedPreferences; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.LinearLayout; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import androidx.fragment.app.Fragment; + +import com.google.android.material.switchmaterial.SwitchMaterial; + +import javax.inject.Inject; +import javax.inject.Named; + +import butterknife.BindView; +import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; + +public class PostHistoryFragment extends Fragment { + + public static final String EXTRA_ACCOUNT_NAME = "EAN"; + + @BindView(R.id.info_text_view_post_history_fragment) + TextView infoTextView; + @BindView(R.id.mark_posts_as_read_linear_layout_post_history_fragment) + LinearLayout markPostsAsReadLinearLayout; + @BindView(R.id.mark_posts_as_read_switch_post_history_fragment) + SwitchMaterial markPostsAsReadSwitch; + @BindView(R.id.mark_posts_as_read_after_voting_linear_layout_post_history_fragment) + LinearLayout markPostsAsReadAfterVotingLinearLayout; + @BindView(R.id.mark_posts_as_read_after_voting_switch_post_history_fragment) + SwitchMaterial markPostsAsReadAfterVotingSwitch; + @BindView(R.id.hide_read_posts_automatically_linear_layout_post_history_fragment) + LinearLayout hideReadPostsAutomaticallyLinearLayout; + @BindView(R.id.hide_read_posts_automatically_switch_post_history_fragment) + SwitchMaterial hideReadPostsAutomaticallySwitch; + @Inject + @Named("post_history") + SharedPreferences postHistorySharedPreferences; + private Activity activity; + + public PostHistoryFragment() { + // Required empty public constructor + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + View rootView = inflater.inflate(R.layout.fragment_post_history, container, false); + + ((Infinity) activity.getApplication()).getAppComponent().inject(this); + + ButterKnife.bind(this, rootView); + + String accountName = getArguments().getString(EXTRA_ACCOUNT_NAME); + if (accountName == null) { + infoTextView.setText(R.string.only_for_logged_in_user); + markPostsAsReadLinearLayout.setVisibility(View.GONE); + markPostsAsReadAfterVotingLinearLayout.setVisibility(View.GONE); + return rootView; + } + + markPostsAsReadSwitch.setChecked(postHistorySharedPreferences.getBoolean( + accountName + SharedPreferencesUtils.MARK_POSTS_AS_READ_BASE, false)); + markPostsAsReadAfterVotingSwitch.setChecked(postHistorySharedPreferences.getBoolean( + accountName + SharedPreferencesUtils.MARK_POSTS_AS_READ_AFTER_VOTING_BASE, false)); + hideReadPostsAutomaticallySwitch.setChecked(postHistorySharedPreferences.getBoolean( + accountName + SharedPreferencesUtils.HIDE_READ_POSTS_AUTOMATICALLY_BASE, false)); + + markPostsAsReadLinearLayout.setOnClickListener(view -> { + markPostsAsReadSwitch.performClick(); + }); + + markPostsAsReadSwitch.setOnCheckedChangeListener((compoundButton, b) -> + postHistorySharedPreferences.edit().putBoolean(accountName + SharedPreferencesUtils.MARK_POSTS_AS_READ_BASE, b).apply()); + + markPostsAsReadAfterVotingLinearLayout.setOnClickListener(view -> markPostsAsReadAfterVotingSwitch.performClick()); + + markPostsAsReadAfterVotingSwitch.setOnCheckedChangeListener((compoundButton, b) -> + postHistorySharedPreferences.edit().putBoolean(accountName + SharedPreferencesUtils.MARK_POSTS_AS_READ_AFTER_VOTING_BASE, b).apply()); + + hideReadPostsAutomaticallyLinearLayout.setOnClickListener(view -> hideReadPostsAutomaticallySwitch.performClick()); + + hideReadPostsAutomaticallySwitch.setOnCheckedChangeListener((compoundButton, b) -> postHistorySharedPreferences.edit().putBoolean(accountName + SharedPreferencesUtils.HIDE_READ_POSTS_AUTOMATICALLY_BASE, b).apply()); + + return rootView; + } + + @Override + public void onAttach(@NonNull Context context) { + super.onAttach(context); + this.activity = (AppCompatActivity) context; + } +}
\ No newline at end of file diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/ThemePreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/ThemePreferenceFragment.java index e28cd52f..fba59d25 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/ThemePreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/ThemePreferenceFragment.java @@ -9,6 +9,7 @@ import android.os.Bundle; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; +import androidx.core.app.ActivityCompat; import androidx.fragment.app.Fragment; import androidx.lifecycle.ViewModelProvider; import androidx.preference.ListPreference; @@ -109,7 +110,7 @@ public class ThemePreferenceFragment extends PreferenceFragmentCompat { amoledDarkSwitch.setOnPreferenceChangeListener((preference, newValue) -> { if ((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) != Configuration.UI_MODE_NIGHT_NO) { EventBus.getDefault().post(new RecreateActivityEvent()); - activity.recreate(); + ActivityCompat.recreate(activity); } return true; }); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/Translation.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/Translation.java index 408e3dbd..766a57af 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/Translation.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/Translation.java @@ -18,27 +18,27 @@ public class Translation { public static ArrayList<Translation> getTranslationContributors() { ArrayList<Translation> translationContributors = new ArrayList<>(); translationContributors.add(new Translation("български", "zerw, Кристиян", R.drawable.flag_bulgaria)); - translationContributors.add(new Translation("简体中文", "Angela Thayer, cdggqa, Gloria, Justin, Ray, Steps", R.drawable.flag_china)); + translationContributors.add(new Translation("简体中文", "1, 3273676671, AaronFeng, Angela Thayer, cdggqa, Gloria, History_exe, Justin, Ray, Steps, Tunicar, wert", R.drawable.flag_china)); translationContributors.add(new Translation("繁體中文", "Angela Thayer, Ray", R.drawable.flag_china)); translationContributors.add(new Translation("Hrvatski", "Josip", R.drawable.flag_croatia)); translationContributors.add(new Translation("Nederlands", "Khawkfist, Mert", R.drawable.flag_netherlands)); - translationContributors.add(new Translation("Française", "367, Darlene Sonalder, Finn Olmsted, Imperator, oursonbleu, Owen, pinembour", R.drawable.flag_france)); - translationContributors.add(new Translation("Deutsche", "Jorge, Netto Hikari, Nikodiamond3, translatewingman, translatorwiz", R.drawable.flag_germany)); + translationContributors.add(new Translation("Française", "367, Darlene Sonalder, Finn Olmsted, Imperator, Johan, oursonbleu, Owen, pinembour", R.drawable.flag_france)); + translationContributors.add(new Translation("Deutsche", "adth03, ducc1, Joe, Jorge, Netto Hikari, Nikodiamond3, NotABot34, translatewingman, translatorwiz", R.drawable.flag_germany)); translationContributors.add(new Translation("Ελληνικά", "Marios, Viktor", R.drawable.flag_greece)); - translationContributors.add(new Translation("हिंदी", "a, Arya, charu, Mrigendra Bhandari, prat, raghav, Sachin, Ved", R.drawable.flag_india)); + translationContributors.add(new Translation("हिंदी", "a, Arya, charu, Harshit S Lawaniya, Mrigendra Bhandari, prat, raghav, Sachin, Ved", R.drawable.flag_india)); translationContributors.add(new Translation("Magyar", "Zoltan", R.drawable.flag_hungary)); translationContributors.add(new Translation("Italiana", "Daniele Basso, DanOlivaw, Gianni00palmieri, Gillauino, Matisse, Simoneg. work, ztiaa", R.drawable.flag_italy)); - translationContributors.add(new Translation("日本語", "Hira, Issa, Mrigendra Bhandari, Ryan", R.drawable.flag_japan)); + translationContributors.add(new Translation("日本語", "Hira, Issa, Kerim Demirkaynak, Mrigendra Bhandari, Ryan", R.drawable.flag_japan)); translationContributors.add(new Translation("한국어", "noname", R.drawable.flag_south_korea)); translationContributors.add(new Translation("norsk", "", R.drawable.flag_norway)); translationContributors.add(new Translation("Polskie", "Chupacabra, Maks", R.drawable.flag_poland)); - translationContributors.add(new Translation("Português", "Bruno Guerreiro, Lucas, Ricky", R.drawable.flag_portugal)); - translationContributors.add(new Translation("Português (BR)", "., Laura Vasconcellos Pereira Felippe, Ricardo, Ricky, Super_Iguanna", R.drawable.flag_brazil)); + translationContributors.add(new Translation("Português", "., Bruno Guerreiro, Lucas, Ricky", R.drawable.flag_portugal)); + translationContributors.add(new Translation("Português (BR)", "., Davy, Laura Vasconcellos Pereira Felippe, Ricardo, Ricky, Super_Iguanna", R.drawable.flag_brazil)); translationContributors.add(new Translation("Română", "Loading Official", R.drawable.flag_romania)); - translationContributors.add(new Translation("русский язык", "Angela Thayer, aveblazer, flexagoon, Georgiy, Vova", R.drawable.flag_russia)); - translationContributors.add(new Translation("Español", "Alejandro, Angela Thayer, Gaynus, Jorge, Miguel, mvstermoe, Nana Snixx, Sofia Flores", R.drawable.flag_spain)); + translationContributors.add(new Translation("русский язык", "Angela Thayer, aveblazer, Coolant, flexagoon, Georgiy, Vova", R.drawable.flag_russia)); + translationContributors.add(new Translation("Español", "Alejandro, Alfredo, Angel, Angela Thayer, Gaynus, Jorge, Luis Antonio, Miguel, mvstermoe, Nana Snixx, Sofia Flores", R.drawable.flag_spain)); translationContributors.add(new Translation("svenska", "Marcus Nordberg", R.drawable.flag_sweden)); - translationContributors.add(new Translation("Türkçe", "Emir481, Faoiltiarna, Kerim Demirkaynak, Mehmet Yavuz, Serif", R.drawable.flag_turkey)); + translationContributors.add(new Translation("Türkçe", "adth03, Berk Bakır \"Faoiltiarna\", Emir481, Faoiltiarna, Kerim Demirkaynak, Mehmet Yavuz, Serif", R.drawable.flag_turkey)); translationContributors.add(new Translation("Tiếng Việt", "Kai, Laezzy, Lmao, Ryan, viecdet69", R.drawable.flag_vietnam)); return translationContributors; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/FetchSubredditData.java b/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/FetchSubredditData.java index a7a9eb21..37587ede 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/FetchSubredditData.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/FetchSubredditData.java @@ -2,9 +2,9 @@ package ml.docilealligator.infinityforreddit.subreddit; import androidx.annotation.NonNull; -import com.facebook.common.internal.ImmutableMap; - import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; import java.util.Map; import ml.docilealligator.infinityforreddit.apis.RedditAPI; @@ -50,7 +50,8 @@ public class FetchSubredditData { boolean nsfw, final FetchSubredditListingDataListener fetchSubredditListingDataListener) { RedditAPI api = retrofit.create(RedditAPI.class); - Map<String, String> headers = accessToken != null ? APIUtils.getOAuthHeader(accessToken) : ImmutableMap.of(); + Map<String, String> map = new HashMap<>(); + Map<String, String> headers = accessToken != null ? APIUtils.getOAuthHeader(accessToken) : Collections.unmodifiableMap(map); Call<String> subredditDataCall = api.searchSubreddits(query, after, sortType, nsfw ? 1 : 0, headers); subredditDataCall.enqueue(new Callback<String>() { @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditListingDataSource.java b/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditListingDataSource.java index 3757cde9..a9dad4b7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditListingDataSource.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditListingDataSource.java @@ -83,7 +83,7 @@ public class SubredditListingDataSource extends PageKeyedDataSource<String, Subr this.params = params; this.callback = callback; - if (params.key.equals("") || params.key.equals("null")) { + if (params.key == null || params.key.equals("") || params.key.equals("null")) { return; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/subredditfilter/DeleteSubredditFilter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/subredditfilter/DeleteSubredditFilter.java deleted file mode 100644 index 051d247a..00000000 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/subredditfilter/DeleteSubredditFilter.java +++ /dev/null @@ -1,41 +0,0 @@ -package ml.docilealligator.infinityforreddit.subredditfilter; - -import android.os.AsyncTask; - -import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; - -public class DeleteSubredditFilter { - public interface DeleteSubredditFilterListener { - void success(); - } - - public static void deleteSubredditFilter(RedditDataRoomDatabase redditDataRoomDatabase, SubredditFilter subredditFilter, - DeleteSubredditFilterListener deleteSubredditFilterListener) { - new DeleteSubredditFilterAsyncTask(redditDataRoomDatabase, subredditFilter, deleteSubredditFilterListener).execute(); - } - - private static class DeleteSubredditFilterAsyncTask extends AsyncTask<Void, Void, Void> { - private RedditDataRoomDatabase redditDataRoomDatabase; - private SubredditFilter subredditFilter; - private DeleteSubredditFilterListener deleteSubredditFilterListener; - - DeleteSubredditFilterAsyncTask(RedditDataRoomDatabase redditDataRoomDatabase, SubredditFilter subredditFilter, - DeleteSubredditFilterListener deleteSubredditFilterListener) { - this.redditDataRoomDatabase = redditDataRoomDatabase; - this.subredditFilter = subredditFilter; - this.deleteSubredditFilterListener = deleteSubredditFilterListener; - } - - @Override - protected Void doInBackground(Void... voids) { - redditDataRoomDatabase.subredditFilterDao().deleteSubredditFilter(subredditFilter); - return null; - } - - @Override - protected void onPostExecute(Void aVoid) { - super.onPostExecute(aVoid); - deleteSubredditFilterListener.success(); - } - } -} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/subredditfilter/FetchSubredditFilters.java b/app/src/main/java/ml/docilealligator/infinityforreddit/subredditfilter/FetchSubredditFilters.java deleted file mode 100644 index e9c6f406..00000000 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/subredditfilter/FetchSubredditFilters.java +++ /dev/null @@ -1,42 +0,0 @@ -package ml.docilealligator.infinityforreddit.subredditfilter; - -import android.os.AsyncTask; - -import java.util.ArrayList; - -import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; - -public class FetchSubredditFilters { - public interface FetchSubredditFiltersListener { - void success(ArrayList<SubredditFilter>subredditFilters); - } - - public static void fetchSubredditFilters(RedditDataRoomDatabase redditDataRoomDatabase, - FetchSubredditFiltersListener fetchSubredditFiltersListener) { - new FetchSubredditFiltersAsyncTask(redditDataRoomDatabase, fetchSubredditFiltersListener).execute(); - } - - private static class FetchSubredditFiltersAsyncTask extends AsyncTask<Void, Void, Void> { - private RedditDataRoomDatabase redditDataRoomDatabase; - private ArrayList<SubredditFilter> subredditFilters; - private FetchSubredditFiltersListener fetchSubredditFiltersListener; - - FetchSubredditFiltersAsyncTask(RedditDataRoomDatabase redditDataRoomDatabase, - FetchSubredditFiltersListener fetchSubredditFiltersListener) { - this.redditDataRoomDatabase = redditDataRoomDatabase; - this.fetchSubredditFiltersListener = fetchSubredditFiltersListener; - } - - @Override - protected Void doInBackground(Void... voids) { - subredditFilters = (ArrayList<SubredditFilter>) redditDataRoomDatabase.subredditFilterDao().getAllSubredditFilters(); - return null; - } - - @Override - protected void onPostExecute(Void aVoid) { - super.onPostExecute(aVoid); - fetchSubredditFiltersListener.success(subredditFilters); - } - } -} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/subredditfilter/InsertSubredditFilter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/subredditfilter/InsertSubredditFilter.java deleted file mode 100644 index eb26a964..00000000 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/subredditfilter/InsertSubredditFilter.java +++ /dev/null @@ -1,41 +0,0 @@ -package ml.docilealligator.infinityforreddit.subredditfilter; - -import android.os.AsyncTask; - -import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; - -public class InsertSubredditFilter { - public interface InsertSubredditFilterListener { - void success(); - } - - public static void insertSubredditFilter(RedditDataRoomDatabase redditDataRoomDatabase, SubredditFilter subredditFilter, - InsertSubredditFilterListener insertSubredditFilterListener) { - new InsertSubredditFilterAsyncTask(redditDataRoomDatabase, subredditFilter, insertSubredditFilterListener).execute(); - } - - private static class InsertSubredditFilterAsyncTask extends AsyncTask<Void, Void, Void> { - private RedditDataRoomDatabase redditDataRoomDatabase; - private SubredditFilter subredditFilter; - private InsertSubredditFilterListener insertSubredditFilterListener; - - InsertSubredditFilterAsyncTask(RedditDataRoomDatabase redditDataRoomDatabase, SubredditFilter subredditFilter, - InsertSubredditFilterListener insertSubredditFilterListener) { - this.redditDataRoomDatabase = redditDataRoomDatabase; - this.subredditFilter = subredditFilter; - this.insertSubredditFilterListener = insertSubredditFilterListener; - } - - @Override - protected Void doInBackground(Void... voids) { - redditDataRoomDatabase.subredditFilterDao().insert(subredditFilter); - return null; - } - - @Override - protected void onPostExecute(Void aVoid) { - super.onPostExecute(aVoid); - insertSubredditFilterListener.success(); - } - } -} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/subredditfilter/SubredditFilter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/subredditfilter/SubredditFilter.java deleted file mode 100644 index 337ebab4..00000000 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/subredditfilter/SubredditFilter.java +++ /dev/null @@ -1,68 +0,0 @@ -package ml.docilealligator.infinityforreddit.subredditfilter; - -import android.os.Parcel; -import android.os.Parcelable; - -import androidx.annotation.NonNull; -import androidx.room.ColumnInfo; -import androidx.room.Entity; - -@Entity(tableName = "subreddit_filter", primaryKeys = {"subreddit_name", "type"}) -public class SubredditFilter implements Parcelable { - public static int TYPE_POPULAR_AND_ALL = 0; - @NonNull - @ColumnInfo(name = "subreddit_name") - private String subredditName; - @ColumnInfo(name = "type") - private int type; - - public SubredditFilter(@NonNull String subredditName, int type) { - this.subredditName = subredditName; - this.type = type; - } - - protected SubredditFilter(Parcel in) { - subredditName = in.readString(); - type = in.readInt(); - } - - public static final Creator<SubredditFilter> CREATOR = new Creator<SubredditFilter>() { - @Override - public SubredditFilter createFromParcel(Parcel in) { - return new SubredditFilter(in); - } - - @Override - public SubredditFilter[] newArray(int size) { - return new SubredditFilter[size]; - } - }; - - @NonNull - public String getSubredditName() { - return subredditName; - } - - public void setSubredditName(@NonNull String subredditName) { - this.subredditName = subredditName; - } - - public int getType() { - return type; - } - - public void setType(int type) { - this.type = type; - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel parcel, int i) { - parcel.writeString(subredditName); - parcel.writeInt(type); - } -} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/subredditfilter/SubredditFilterDao.java b/app/src/main/java/ml/docilealligator/infinityforreddit/subredditfilter/SubredditFilterDao.java deleted file mode 100644 index 1cdcd22b..00000000 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/subredditfilter/SubredditFilterDao.java +++ /dev/null @@ -1,25 +0,0 @@ -package ml.docilealligator.infinityforreddit.subredditfilter; - -import androidx.lifecycle.LiveData; -import androidx.room.Dao; -import androidx.room.Delete; -import androidx.room.Insert; -import androidx.room.OnConflictStrategy; -import androidx.room.Query; - -import java.util.List; - -@Dao -public interface SubredditFilterDao { - @Insert(onConflict = OnConflictStrategy.REPLACE) - void insert(SubredditFilter subredditFilter); - - @Query("SELECT * FROM subreddit_filter") - LiveData<List<SubredditFilter>> getAllSubredditFiltersLiveData(); - - @Query("SELECT * FROM subreddit_filter") - List<SubredditFilter> getAllSubredditFilters(); - - @Delete - void deleteSubredditFilter(SubredditFilter subredditFilter); -} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/subredditfilter/SubredditFilterViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/subredditfilter/SubredditFilterViewModel.java deleted file mode 100644 index 9f571f30..00000000 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/subredditfilter/SubredditFilterViewModel.java +++ /dev/null @@ -1,36 +0,0 @@ -package ml.docilealligator.infinityforreddit.subredditfilter; - -import androidx.annotation.NonNull; -import androidx.lifecycle.LiveData; -import androidx.lifecycle.ViewModel; -import androidx.lifecycle.ViewModelProvider; - -import java.util.List; - -import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; - -public class SubredditFilterViewModel extends ViewModel { - private LiveData<List<SubredditFilter>> subredditFilterLiveData; - - public SubredditFilterViewModel(RedditDataRoomDatabase redditDataRoomDatabase) { - subredditFilterLiveData = redditDataRoomDatabase.subredditFilterDao().getAllSubredditFiltersLiveData(); - } - - public LiveData<List<SubredditFilter>> getSubredditFilterLiveData() { - return subredditFilterLiveData; - } - - public static class Factory extends ViewModelProvider.NewInstanceFactory { - private RedditDataRoomDatabase redditDataRoomDatabase; - - public Factory(RedditDataRoomDatabase redditDataRoomDatabase) { - this.redditDataRoomDatabase = redditDataRoomDatabase; - } - - @NonNull - @Override - public <T extends ViewModel> T create(@NonNull Class<T> modelClass) { - return (T) new SubredditFilterViewModel(redditDataRoomDatabase); - } - } -} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/user/ParseUserData.java b/app/src/main/java/ml/docilealligator/infinityforreddit/user/ParseUserData.java index 8e56b3ab..5416e056 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/user/ParseUserData.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/user/ParseUserData.java @@ -70,28 +70,29 @@ public class ParseUserData { private static class ParseUserDataAsyncTask extends AsyncTask<Void, Void, Void> { private JSONObject jsonResponse; private ParseUserDataListener parseUserDataListener; - private boolean parseFailed; + private boolean parseFailed = false; private UserData userData; ParseUserDataAsyncTask(String response, ParseUserDataListener parseUserDataListener) { + this.parseUserDataListener = parseUserDataListener; try { jsonResponse = new JSONObject(response); - this.parseUserDataListener = parseUserDataListener; - parseFailed = false; } catch (JSONException e) { + parseFailed = true; e.printStackTrace(); - parseUserDataListener.onParseUserDataFailed(); } } @Override protected Void doInBackground(Void... voids) { - try { - userData = parseUserDataBase(jsonResponse, true); - } catch (JSONException e) { - parseFailed = true; - e.printStackTrace(); + if (!parseFailed) { + try { + userData = parseUserDataBase(jsonResponse, true); + } catch (JSONException e) { + parseFailed = true; + e.printStackTrace(); + } } return null; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/APIUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/APIUtils.java index cb0c8ccb..fb49b49e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/APIUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/APIUtils.java @@ -41,7 +41,7 @@ public class APIUtils { public static final String AUTHORIZATION_KEY = "Authorization"; public static final String AUTHORIZATION_BASE = "bearer "; public static final String USER_AGENT_KEY = "User-Agent"; - public static final String USER_AGENT = "android:ml.docilealligator.infinityforreddit:v4.1.0 (by /u/Hostilenemy)"; + public static final String USER_AGENT = "android:ml.docilealligator.infinityforreddit:v4.1.1 (by /u/Hostilenemy)"; public static final String GRANT_TYPE_KEY = "grant_type"; public static final String GRANT_TYPE_REFRESH_TOKEN = "refresh_token"; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/CustomThemeSharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/CustomThemeSharedPreferencesUtils.java index 0f3e991c..db7520d7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/CustomThemeSharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/CustomThemeSharedPreferencesUtils.java @@ -20,12 +20,15 @@ public class CustomThemeSharedPreferencesUtils { public static final String COLOR_PRIMARY_LIGHT_THEME = "colorPrimaryLightTheme"; public static final String POST_TITLE_COLOR = "postTitleColor"; public static final String POST_CONTENT_COLOR = "postContentColor"; + public static final String READ_POST_TITLE_COLOR = "readPostTitleColor"; + public static final String READ_POST_CONTENT_COLOR = "readPostContentColor"; public static final String COMMENT_COLOR = "commentColor"; public static final String PRIMARY_TEXT_COLOR = "primaryTextColor"; public static final String SECONDARY_TEXT_COLOR = "secondaryTextColor"; public static final String BUTTON_TEXT_COLOR = "buttonTextColor"; public static final String BACKGROUND_COLOR = "backgroundColor"; public static final String CARD_VIEW_BACKGROUND_COLOR = "cardViewBackgroundColor"; + public static final String READ_POST_CARD_VIEW_BACKGROUND_COLOR = "readPostCardViewBackgroundColor"; public static final String COMMENT_BACKGROUND_COLOR = "commentBackgroundColor"; public static final String BOTTOM_APP_BAR_BACKGROUND_COLOR = "bottomAppBarBackgroundColor"; public static final String PRIMARY_ICON_COLOR = "primaryIconColor"; @@ -99,10 +102,13 @@ public class CustomThemeSharedPreferencesUtils { editor.putInt(SECONDARY_TEXT_COLOR, customTheme.secondaryTextColor); editor.putInt(POST_TITLE_COLOR, customTheme.postTitleColor); editor.putInt(POST_CONTENT_COLOR, customTheme.postContentColor); + editor.putInt(READ_POST_TITLE_COLOR, customTheme.readPostTitleColor); + editor.putInt(READ_POST_CONTENT_COLOR, customTheme.readPostContentColor); editor.putInt(COMMENT_COLOR, customTheme.commentColor); editor.putInt(BUTTON_TEXT_COLOR, customTheme.buttonTextColor); editor.putInt(BACKGROUND_COLOR, customTheme.backgroundColor); editor.putInt(CARD_VIEW_BACKGROUND_COLOR, customTheme.cardViewBackgroundColor); + editor.putInt(READ_POST_CARD_VIEW_BACKGROUND_COLOR, customTheme.readPostCardViewBackgroundColor); editor.putInt(COMMENT_BACKGROUND_COLOR, customTheme.commentBackgroundColor); editor.putInt(BOTTOM_APP_BAR_BACKGROUND_COLOR, customTheme.bottomAppBarBackgroundColor); editor.putInt(PRIMARY_ICON_COLOR, customTheme.primaryIconColor); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/GetPathUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/GetPathUtils.java deleted file mode 100644 index 2424b167..00000000 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/GetPathUtils.java +++ /dev/null @@ -1,238 +0,0 @@ -package ml.docilealligator.infinityforreddit.utils; - -import android.annotation.TargetApi; -import android.content.ContentUris; -import android.content.Context; -import android.database.Cursor; -import android.net.Uri; -import android.os.Build; -import android.os.Environment; -import android.provider.DocumentsContract; -import android.provider.MediaStore; - -import androidx.core.content.ContextCompat; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -public class GetPathUtils { - - private static final String PATH_TREE = "tree"; - private static final String PRIMARY_TYPE = "primary"; - private static final String RAW_TYPE = "raw"; - - @TargetApi(Build.VERSION_CODES.KITKAT) - public static String getFilePathFromUri(final Context context, final Uri uri) { - - // DocumentProvider - if (DocumentsContract.isDocumentUri(context, uri)) { - // ExternalStorageProvider - if (isExternalStorageDocument(uri)) { - final String docId = DocumentsContract.getDocumentId(uri); - //Timber.d("docId -> %s", docId); - final String[] split = docId.split(":"); - final String type = split[0]; - - if (PRIMARY_TYPE.equalsIgnoreCase(type)) { - return Environment.getExternalStorageDirectory() + "/" + split[1]; - } else { - // TODO handle non-primary volumes - StringBuilder path = new StringBuilder(); - String pathSegment[] = docId.split(":"); - return path.append(getRemovableStorageRootPath(context, pathSegment[0])).append(File.separator).append(pathSegment[1]).toString(); - } - } else if (isDownloadsDocument(uri)) { // DownloadsProvider - - final String id = DocumentsContract.getDocumentId(uri); - - if (id.contains("raw:")) { - return id.substring(id.indexOf(File.separator)); - } else { - Uri contentUri = ContentUris.withAppendedId( - Uri.parse("content://downloads/public_downloads"), Long.valueOf(id)); - - return getDataColumn(context, contentUri, null, null); - } - - } else if (isMediaDocument(uri)) { // MediaProvider - final String docId = DocumentsContract.getDocumentId(uri); - final String[] split = docId.split(":"); - final String type = split[0]; - - Uri contentUri = null; - if ("image".equals(type)) { - contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; - } else if ("video".equals(type)) { - contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI; - } else if ("audio".equals(type)) { - contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; - } - - final String selection = "_id=?"; - final String[] selectionArgs = new String[]{ - split[1] - }; - - return getDataColumn(context, contentUri, selection, selectionArgs); - } - } else if ("content".equalsIgnoreCase(uri.getScheme())) { // MediaStore (and general) - return getDataColumn(context, uri, null, null); - } else if ("file".equalsIgnoreCase(uri.getScheme())) { // File - return uri.getPath(); - } - - return null; - } - - /** - * Get the value of the data column for this Uri. This is useful for - * MediaStore Uris, and other file-based ContentProviders. - * - * @param context The context. - * @param uri The Uri to query. - * @param selection (Optional) Filter used in the query. - * @param selectionArgs (Optional) Selection arguments used in the query. - * @return The value of the _data column, which is typically a file path. - */ - public static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) { - - Cursor cursor = null; - final String column = MediaStore.MediaColumns.DATA; - final String[] projection = {column}; - try { - cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, - null); - if (cursor != null && cursor.moveToFirst()) { - final int column_index = cursor.getColumnIndexOrThrow(column); - return cursor.getString(column_index); - } - } finally { - if (cursor != null) - cursor.close(); - } - - return null; - } - - /** - * @param uri The Uri to check. - * @return Whether the Uri authority is ExternalStorageProvider. - */ - public static boolean isExternalStorageDocument(Uri uri) { - return "com.android.externalstorage.documents".equals(uri.getAuthority()); - } - - /** - * @param uri The Uri to check. - * @return Whether the Uri authority is DownloadsProvider. - */ - public static boolean isDownloadsDocument(Uri uri) { - return "com.android.providers.downloads.documents".equals(uri.getAuthority()); - } - - /** - * @param uri The Uri to check. - * @return Whether the Uri authority is MediaProvider. - */ - public static boolean isMediaDocument(Uri uri) { - return "com.android.providers.media.documents".equals(uri.getAuthority()); - } - - /** - * @param uri - * @return file path of Uri - */ - public static String getDirectoryPathFromUri(Context context, Uri uri) { - - if ("file".equals(uri.getScheme())) { - return uri.getPath(); - } - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT - && isTreeUri(uri)) { - - String treeId = getTreeDocumentId(uri); - - if (treeId != null) { - String[] paths = treeId.split(":"); - String type = paths[0]; - String subPath = paths.length == 2 ? paths[1] : ""; - - if (RAW_TYPE.equalsIgnoreCase(type)) { - return treeId.substring(treeId.indexOf(File.separator)); - } else if (PRIMARY_TYPE.equalsIgnoreCase(type)) { - return Environment.getExternalStorageDirectory() + File.separator + subPath; - } else { - StringBuilder path = new StringBuilder(); - String[] pathSegment = treeId.split(":"); - if (pathSegment.length == 1) { - path.append(getRemovableStorageRootPath(context, paths[0])); - } else { - String rootPath = getRemovableStorageRootPath(context, paths[0]); - path.append(rootPath).append(File.separator).append(pathSegment[1]); - } - - return path.toString(); - } - } - } - return null; - } - - private static String getRemovableStorageRootPath(Context context, String storageId) { - StringBuilder rootPath = new StringBuilder(); - File[] externalFilesDirs = ContextCompat.getExternalFilesDirs(context, null); - for (File fileDir : externalFilesDirs) { - if (fileDir.getPath().contains(storageId)) { - String[] pathSegment = fileDir.getPath().split(File.separator); - for (String segment : pathSegment) { - if (segment.equals(storageId)) { - rootPath.append(storageId); - break; - } - rootPath.append(segment).append(File.separator); - } - //rootPath.append(fileDir.getPath().split("/Android")[0]); // faster - break; - } - } - return rootPath.toString(); - } - - @TargetApi(Build.VERSION_CODES.LOLLIPOP) - public static List<String> getListRemovableStorage(Context context) { - - List<String> paths = new ArrayList<>(); - - File[] externalFilesDirs = ContextCompat.getExternalFilesDirs(context, null); - for (File fileDir : externalFilesDirs) { - if (Environment.isExternalStorageRemovable(fileDir)) { - String path = fileDir.getPath(); - if (path.contains("/Android")) { - paths.add(path.substring(0, path.indexOf("/Android"))); - } - } - } - - return paths; - } - - //https://github.com/rcketscientist/DocumentActivity/blob/master/library/src/main/java/com/anthonymandra/framework/DocumentUtil.java#L56 - /** - * Extract the via {@link DocumentsContract.Document#COLUMN_DOCUMENT_ID} from the given URI. - * From {@link DocumentsContract} but return null instead of throw - */ - public static String getTreeDocumentId(Uri uri) { - final List<String> paths = uri.getPathSegments(); - if (paths.size() >= 2 && PATH_TREE.equals(paths.get(0))) { - return paths.get(1); - } - return null; - } - - public static boolean isTreeUri(Uri uri) { - final List<String> paths = uri.getPathSegments(); - return (paths.size() == 2 && PATH_TREE.equals(paths.get(0))); - } -} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/GlideImageGetter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/GlideImageGetter.java index 28ba6dce..215e991c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/GlideImageGetter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/GlideImageGetter.java @@ -24,25 +24,19 @@ import java.lang.ref.WeakReference; public class GlideImageGetter implements Html.ImageGetter { private WeakReference<TextView> container; - private boolean matchParentWidth; private boolean enlargeImage; private HtmlImagesHandler imagesHandler; private float density = 1.0f; private float textSize; public GlideImageGetter(TextView textView, boolean enlargeImage) { - this(textView, false, false, null); + this(textView, false, null); this.enlargeImage = enlargeImage; } - public GlideImageGetter(TextView textView, boolean matchParentWidth, HtmlImagesHandler imagesHandler) { - this(textView, matchParentWidth, false, imagesHandler); - } - - public GlideImageGetter(TextView textView, boolean matchParentWidth, boolean densityAware, + public GlideImageGetter(TextView textView, boolean densityAware, @Nullable HtmlImagesHandler imagesHandler) { this.container = new WeakReference<>(textView); - this.matchParentWidth = matchParentWidth; this.imagesHandler = imagesHandler; if (densityAware) { density = container.get().getResources().getDisplayMetrics().density; @@ -97,15 +91,8 @@ public class GlideImageGetter implements Html.ImageGetter { float ratio = (float) drawableWidth / (float) drawableHeight; drawableHeight = enlargeImage ? (int) (textSize * 1.5) : (int) textSize; drawableWidth = (int) (drawableHeight * ratio); - int maxWidth = container.get().getMeasuredWidth(); - if ((maxWidth > 0 && (drawableWidth > maxWidth)) || matchParentWidth) { - int calculatedHeight = maxWidth * drawableHeight / drawableWidth; - drawable.setBounds(0, 0, maxWidth, calculatedHeight); - setBounds(0, 0, maxWidth, calculatedHeight); - } else { - drawable.setBounds(0, 0, drawableWidth, drawableHeight); - setBounds(0, 0, drawableWidth, drawableHeight); - } + drawable.setBounds(0, 0, drawableWidth, drawableHeight); + setBounds(0, 0, drawableWidth, drawableHeight); container.get().setText(container.get().getText()); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/NotificationUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/NotificationUtils.java index 940838af..3c3255de 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/NotificationUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/NotificationUtils.java @@ -3,6 +3,7 @@ package ml.docilealligator.infinityforreddit.utils; import android.app.NotificationChannel; import android.app.NotificationManager; import android.content.Context; +import android.os.Build; import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationManagerCompat; @@ -26,7 +27,6 @@ public class NotificationUtils { public static final int DOWNLOAD_VIDEO_NOTIFICATION_ID = 30000; public static final int DOWNLOAD_IMAGE_NOTIFICATION_ID = 40000; public static final int DOWNLOAD_GIF_NOTIFICATION_ID = 50000; - public static final int PULL_NOTIFICATION_ALARM_RECEIVER_REQUEST_CODE = 12; private static final int SUMMARY_BASE_ID_UNREAD_MESSAGE = 0; private static final int NOTIFICATION_BASE_ID_UNREAD_MESSAGE = 1; @@ -37,7 +37,7 @@ public class NotificationUtils { Context context, String title, String content, String summary, String channelId, String channelName, String group, int color) { - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { NotificationChannel channel = new NotificationChannel(channelId, channelName, NotificationManager.IMPORTANCE_DEFAULT); notificationManager.createNotificationChannel(channel); } @@ -57,7 +57,7 @@ public class NotificationUtils { public static NotificationCompat.Builder buildSummaryNotification(Context context, NotificationManagerCompat notificationManager, String title, String content, String channelId, String channelName, String group, int color) { - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { NotificationChannel channel = new NotificationChannel(channelId, channelName, NotificationManager.IMPORTANCE_DEFAULT); notificationManager.createNotificationChannel(channel); } 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 ebfa20fe..a8f0aa34 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java @@ -110,6 +110,7 @@ public class SharedPreferencesUtils { public static final String DELETE_ALL_POST_LAYOUT_DATA_IN_DATABASE = "delete_all_post_layout_data_in_database"; public static final String DELETE_ALL_THEMES_IN_DATABASE = "delete_all_themes_in_database"; public static final String DELETE_FRONT_PAGE_SCROLLED_POSITIONS_IN_DATABASE = "delete_front_page_scrolled_positions_in_database"; + public static final String DELETE_READ_POSTS_IN_DATABASE = "delete_read_posts_in_database"; public static final String DELETE_ALL_LEGACY_SETTINGS = "delete_all_legacy_settings"; public static final String RESET_ALL_SETTINGS = "reset_all_settings"; public static final String IMAGE_DOWNLOAD_LOCATION = "image_download_location"; @@ -144,6 +145,10 @@ public class SharedPreferencesUtils { public static final String SWIPE_RIGHT_ACTION = "swipe_right_action"; public static final int SWIPE_ACITON_UPVOTE = 0; public static final int SWIPE_ACITON_DOWNVOTE = 1; + public static final String LANGUAGE = "language"; + public static final String LANGUAGE_DEFAULT_VALUE = "auto"; + public static final String ENABLE_SEARCH_HISTORY = "enable_search_history"; + public static final String POST_FILTER = "post_filter"; public static final String MAIN_PAGE_TABS_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.main_page_tabs"; public static final String MAIN_PAGE_TAB_COUNT = "_main_page_tab_count"; @@ -191,6 +196,8 @@ public class SharedPreferencesUtils { public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT = 5; public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_GO_TO_USER = 6; public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_RANDOM = 7; + public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS = 8; + public static final int MAIN_ACTIVITY_BOTTOM_APP_BAR_FAB_FILTER_POSTS = 9; public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_HOME = 0; public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SUBSCRIPTIONS = 1; public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_INBOX = 2; @@ -204,12 +211,19 @@ public class SharedPreferencesUtils { public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_SUBREDDIT = 5; public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_GO_TO_USER = 6; public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_RANDOM = 7; + public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_HIDE_READ_POSTS = 8; + public static final int OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_FILTER_POSTS = 9; public static final String NSFW_AND_SPOILER_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.nsfw_and_spoiler"; public static final String NSFW_BASE = "_nsfw"; public static final String BLUR_NSFW_BASE = "_blur_nsfw"; public static final String BLUR_SPOILER_BASE = "_blur_spoiler"; + public static final String POST_HISTORY_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.post_history"; + public static final String MARK_POSTS_AS_READ_BASE = "_mark_posts_as_read"; + public static final String MARK_POSTS_AS_READ_AFTER_VOTING_BASE = "_mark_posts_as_read_after_voting"; + public static final String HIDE_READ_POSTS_AUTOMATICALLY_BASE = "_hide_read_posts_automatically"; + //Legacy Settings public static final String MAIN_PAGE_TAB_1_TITLE_LEGACY = "main_page_tab_1_title"; public static final String MAIN_PAGE_TAB_2_TITLE_LEGACY = "main_page_tab_2_title"; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java index 8d51256d..2a59f2a5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java @@ -8,7 +8,6 @@ import android.net.Network; import android.net.NetworkCapabilities; import android.net.NetworkInfo; import android.os.Build; -import android.text.Html; import android.text.Spannable; import android.util.DisplayMetrics; import android.view.inputmethod.InputMethodManager; @@ -17,6 +16,7 @@ import android.widget.TextView; import androidx.annotation.Nullable; import androidx.appcompat.widget.Toolbar; import androidx.core.graphics.drawable.DrawableCompat; +import androidx.core.text.HtmlCompat; import java.text.SimpleDateFormat; import java.util.Calendar; @@ -135,13 +135,10 @@ public class Utils { } public static void setHTMLWithImageToTextView(TextView textView, String content, boolean enlargeImage) { - Spannable html; GlideImageGetter glideImageGetter = new GlideImageGetter(textView, enlargeImage); - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) { - html = (Spannable) Html.fromHtml(content, Html.FROM_HTML_MODE_LEGACY, glideImageGetter, null); - } else { - html = (Spannable) Html.fromHtml(content, glideImageGetter, null); - } + Spannable html = (Spannable) HtmlCompat.fromHtml( + content, HtmlCompat.FROM_HTML_MODE_LEGACY, glideImageGetter, null); + textView.setText(html); } diff --git a/app/src/main/res/drawable-night/ic_apply_to_24dp.xml b/app/src/main/res/drawable-night/ic_apply_to_24dp.xml new file mode 100644 index 00000000..ee73a4df --- /dev/null +++ b/app/src/main/res/drawable-night/ic_apply_to_24dp.xml @@ -0,0 +1,9 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:pathData="M11,11h2.12l6.16,-6.16l-2.12,-2.12L11,8.88V11zM20.71,2L20,1.29c-0.39,-0.39 -1.02,-0.39 -1.41,0l-0.72,0.72l2.12,2.12l0.72,-0.72C21.1,3.02 21.1,2.39 20.71,2zM17.9,9.05C17.96,9.41 18,9.79 18,10.2c0,1.71 -1.08,4.64 -6,9.14c-4.92,-4.49 -6,-7.43 -6,-9.14C6,6.17 9.09,4 12,4c0.32,0 0.65,0.03 0.97,0.08l1.65,-1.65C13.78,2.16 12.9,2 12,2c-4.2,0 -8,3.22 -8,8.2c0,3.32 2.67,7.25 8,11.8c5.33,-4.55 8,-8.48 8,-11.8c0,-1.01 -0.16,-1.94 -0.45,-2.8L17.9,9.05z" + android:fillColor="#FFFFFF"/> +</vector> diff --git a/app/src/main/res/drawable-night/ic_hide_read_posts_24dp.xml b/app/src/main/res/drawable-night/ic_hide_read_posts_24dp.xml new file mode 100644 index 00000000..ea2c937f --- /dev/null +++ b/app/src/main/res/drawable-night/ic_hide_read_posts_24dp.xml @@ -0,0 +1,9 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:fillColor="#FFFFFF" + android:pathData="M12,6c3.79,0 7.17,2.13 8.82,5.5 -0.59,1.22 -1.42,2.27 -2.41,3.12l1.41,1.41c1.39,-1.23 2.49,-2.77 3.18,-4.53C21.27,7.11 17,4 12,4c-1.27,0 -2.49,0.2 -3.64,0.57l1.65,1.65C10.66,6.09 11.32,6 12,6zM10.93,7.14L13,9.21c0.57,0.25 1.03,0.71 1.28,1.28l2.07,2.07c0.08,-0.34 0.14,-0.7 0.14,-1.07C16.5,9.01 14.48,7 12,7c-0.37,0 -0.72,0.05 -1.07,0.14zM2.01,3.87l2.68,2.68C3.06,7.83 1.77,9.53 1,11.5 2.73,15.89 7,19 12,19c1.52,0 2.98,-0.29 4.32,-0.82l3.42,3.42 1.41,-1.41L3.42,2.45 2.01,3.87zM9.51,11.37l2.61,2.61c-0.04,0.01 -0.08,0.02 -0.12,0.02 -1.38,0 -2.5,-1.12 -2.5,-2.5 0,-0.05 0.01,-0.08 0.01,-0.13zM6.11,7.97l1.75,1.75c-0.23,0.55 -0.36,1.15 -0.36,1.78 0,2.48 2.02,4.5 4.5,4.5 0.63,0 1.23,-0.13 1.77,-0.36l0.98,0.98c-0.88,0.24 -1.8,0.38 -2.75,0.38 -3.79,0 -7.17,-2.13 -8.82,-5.5 0.7,-1.43 1.72,-2.61 2.93,-3.53z"/> +</vector> diff --git a/app/src/main/res/drawable-night/ic_history_24dp.xml b/app/src/main/res/drawable-night/ic_history_24dp.xml new file mode 100644 index 00000000..af91e161 --- /dev/null +++ b/app/src/main/res/drawable-night/ic_history_24dp.xml @@ -0,0 +1,9 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:pathData="M13,3c-4.97,0 -9,4.03 -9,9L1,12l3.89,3.89 0.07,0.14L9,12L6,12c0,-3.87 3.13,-7 7,-7s7,3.13 7,7 -3.13,7 -7,7c-1.93,0 -3.68,-0.79 -4.94,-2.06l-1.42,1.42C8.27,19.99 10.51,21 13,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,8v5l4.28,2.54 0.72,-1.21 -3.5,-2.08L13.5,8L12,8z" + android:fillColor="#FFFFFF"/> +</vector> diff --git a/app/src/main/res/drawable-night/ic_language_24dp.xml b/app/src/main/res/drawable-night/ic_language_24dp.xml new file mode 100644 index 00000000..e6e0586d --- /dev/null +++ b/app/src/main/res/drawable-night/ic_language_24dp.xml @@ -0,0 +1,9 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:fillColor="#FFFFFF" + android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM18.92,8h-2.95c-0.32,-1.25 -0.78,-2.45 -1.38,-3.56 1.84,0.63 3.37,1.91 4.33,3.56zM12,4.04c0.83,1.2 1.48,2.53 1.91,3.96h-3.82c0.43,-1.43 1.08,-2.76 1.91,-3.96zM4.26,14C4.1,13.36 4,12.69 4,12s0.1,-1.36 0.26,-2h3.38c-0.08,0.66 -0.14,1.32 -0.14,2s0.06,1.34 0.14,2L4.26,14zM5.08,16h2.95c0.32,1.25 0.78,2.45 1.38,3.56 -1.84,-0.63 -3.37,-1.9 -4.33,-3.56zM8.03,8L5.08,8c0.96,-1.66 2.49,-2.93 4.33,-3.56C8.81,5.55 8.35,6.75 8.03,8zM12,19.96c-0.83,-1.2 -1.48,-2.53 -1.91,-3.96h3.82c-0.43,1.43 -1.08,2.76 -1.91,3.96zM14.34,14L9.66,14c-0.09,-0.66 -0.16,-1.32 -0.16,-2s0.07,-1.35 0.16,-2h4.68c0.09,0.65 0.16,1.32 0.16,2s-0.07,1.34 -0.16,2zM14.59,19.56c0.6,-1.11 1.06,-2.31 1.38,-3.56h2.95c-0.96,1.65 -2.49,2.93 -4.33,3.56zM16.36,14c0.08,-0.66 0.14,-1.32 0.14,-2s-0.06,-1.34 -0.14,-2h3.38c0.16,0.64 0.26,1.31 0.26,2s-0.1,1.36 -0.26,2h-3.38z"/> +</vector> diff --git a/app/src/main/res/drawable-night/ic_save_to_database_24dp.xml b/app/src/main/res/drawable-night/ic_save_to_database_24dp.xml new file mode 100644 index 00000000..b10b206f --- /dev/null +++ b/app/src/main/res/drawable-night/ic_save_to_database_24dp.xml @@ -0,0 +1,9 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:pathData="M17,3L5,3c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,7l-4,-4zM12,19c-1.66,0 -3,-1.34 -3,-3s1.34,-3 3,-3 3,1.34 3,3 -1.34,3 -3,3zM15,9L5,9L5,5h10v4z" + android:fillColor="#000000"/> +</vector> diff --git a/app/src/main/res/drawable/ic_apply_to_24dp.xml b/app/src/main/res/drawable/ic_apply_to_24dp.xml new file mode 100644 index 00000000..23e47b34 --- /dev/null +++ b/app/src/main/res/drawable/ic_apply_to_24dp.xml @@ -0,0 +1,9 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:pathData="M11,11h2.12l6.16,-6.16l-2.12,-2.12L11,8.88V11zM20.71,2L20,1.29c-0.39,-0.39 -1.02,-0.39 -1.41,0l-0.72,0.72l2.12,2.12l0.72,-0.72C21.1,3.02 21.1,2.39 20.71,2zM17.9,9.05C17.96,9.41 18,9.79 18,10.2c0,1.71 -1.08,4.64 -6,9.14c-4.92,-4.49 -6,-7.43 -6,-9.14C6,6.17 9.09,4 12,4c0.32,0 0.65,0.03 0.97,0.08l1.65,-1.65C13.78,2.16 12.9,2 12,2c-4.2,0 -8,3.22 -8,8.2c0,3.32 2.67,7.25 8,11.8c5.33,-4.55 8,-8.48 8,-11.8c0,-1.01 -0.16,-1.94 -0.45,-2.8L17.9,9.05z" + android:fillColor="#000000"/> +</vector> diff --git a/app/src/main/res/drawable/ic_hide_read_posts_24dp.xml b/app/src/main/res/drawable/ic_hide_read_posts_24dp.xml new file mode 100644 index 00000000..f69f3ff8 --- /dev/null +++ b/app/src/main/res/drawable/ic_hide_read_posts_24dp.xml @@ -0,0 +1,9 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:fillColor="#000000" + android:pathData="M12,6c3.79,0 7.17,2.13 8.82,5.5 -0.59,1.22 -1.42,2.27 -2.41,3.12l1.41,1.41c1.39,-1.23 2.49,-2.77 3.18,-4.53C21.27,7.11 17,4 12,4c-1.27,0 -2.49,0.2 -3.64,0.57l1.65,1.65C10.66,6.09 11.32,6 12,6zM10.93,7.14L13,9.21c0.57,0.25 1.03,0.71 1.28,1.28l2.07,2.07c0.08,-0.34 0.14,-0.7 0.14,-1.07C16.5,9.01 14.48,7 12,7c-0.37,0 -0.72,0.05 -1.07,0.14zM2.01,3.87l2.68,2.68C3.06,7.83 1.77,9.53 1,11.5 2.73,15.89 7,19 12,19c1.52,0 2.98,-0.29 4.32,-0.82l3.42,3.42 1.41,-1.41L3.42,2.45 2.01,3.87zM9.51,11.37l2.61,2.61c-0.04,0.01 -0.08,0.02 -0.12,0.02 -1.38,0 -2.5,-1.12 -2.5,-2.5 0,-0.05 0.01,-0.08 0.01,-0.13zM6.11,7.97l1.75,1.75c-0.23,0.55 -0.36,1.15 -0.36,1.78 0,2.48 2.02,4.5 4.5,4.5 0.63,0 1.23,-0.13 1.77,-0.36l0.98,0.98c-0.88,0.24 -1.8,0.38 -2.75,0.38 -3.79,0 -7.17,-2.13 -8.82,-5.5 0.7,-1.43 1.72,-2.61 2.93,-3.53z"/> +</vector> diff --git a/app/src/main/res/drawable/ic_language_24dp.xml b/app/src/main/res/drawable/ic_language_24dp.xml new file mode 100644 index 00000000..b7840867 --- /dev/null +++ b/app/src/main/res/drawable/ic_language_24dp.xml @@ -0,0 +1,9 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:fillColor="#000000" + android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM18.92,8h-2.95c-0.32,-1.25 -0.78,-2.45 -1.38,-3.56 1.84,0.63 3.37,1.91 4.33,3.56zM12,4.04c0.83,1.2 1.48,2.53 1.91,3.96h-3.82c0.43,-1.43 1.08,-2.76 1.91,-3.96zM4.26,14C4.1,13.36 4,12.69 4,12s0.1,-1.36 0.26,-2h3.38c-0.08,0.66 -0.14,1.32 -0.14,2s0.06,1.34 0.14,2L4.26,14zM5.08,16h2.95c0.32,1.25 0.78,2.45 1.38,3.56 -1.84,-0.63 -3.37,-1.9 -4.33,-3.56zM8.03,8L5.08,8c0.96,-1.66 2.49,-2.93 4.33,-3.56C8.81,5.55 8.35,6.75 8.03,8zM12,19.96c-0.83,-1.2 -1.48,-2.53 -1.91,-3.96h3.82c-0.43,1.43 -1.08,2.76 -1.91,3.96zM14.34,14L9.66,14c-0.09,-0.66 -0.16,-1.32 -0.16,-2s0.07,-1.35 0.16,-2h4.68c0.09,0.65 0.16,1.32 0.16,2s-0.07,1.34 -0.16,2zM14.59,19.56c0.6,-1.11 1.06,-2.31 1.38,-3.56h2.95c-0.96,1.65 -2.49,2.93 -4.33,3.56zM16.36,14c0.08,-0.66 0.14,-1.32 0.14,-2s-0.06,-1.34 -0.14,-2h3.38c0.16,0.64 0.26,1.31 0.26,2s-0.1,1.36 -0.26,2h-3.38z"/> +</vector> diff --git a/app/src/main/res/drawable/ic_save_to_database_24dp.xml b/app/src/main/res/drawable/ic_save_to_database_24dp.xml new file mode 100644 index 00000000..4402c5df --- /dev/null +++ b/app/src/main/res/drawable/ic_save_to_database_24dp.xml @@ -0,0 +1,9 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:pathData="M17,3L5,3c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,7l-4,-4zM12,19c-1.66,0 -3,-1.34 -3,-3s1.34,-3 3,-3 3,1.34 3,3 -1.34,3 -3,3zM15,9L5,9L5,5h10v4z" + android:fillColor="#FFFFFF"/> +</vector> diff --git a/app/src/main/res/layout/activity_customize_post_filter.xml b/app/src/main/res/layout/activity_customize_post_filter.xml new file mode 100644 index 00000000..b7940c7a --- /dev/null +++ b/app/src/main/res/layout/activity_customize_post_filter.xml @@ -0,0 +1,556 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:id="@+id/coordinator_layout_customize_post_filter_activity" + tools:application=".CustomizePostFilterActivity"> + + <com.google.android.material.appbar.AppBarLayout + android:id="@+id/appbar_layout_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:theme="@style/AppTheme.AppBarOverlay"> + + <com.google.android.material.appbar.CollapsingToolbarLayout + android:id="@+id/collapsing_toolbar_layout_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="match_parent" + app:layout_scrollFlags="scroll|enterAlways" + app:titleEnabled="false" + app:toolbarId="@+id/toolbar_customize_post_filter_activity"> + + <androidx.appcompat.widget.Toolbar + android:id="@+id/toolbar_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" + app:popupTheme="@style/AppTheme.PopupOverlay" + app:navigationIcon="?attr/homeAsUpIndicator" /> + + </com.google.android.material.appbar.CollapsingToolbarLayout> + + </com.google.android.material.appbar.AppBarLayout> + + <androidx.core.widget.NestedScrollView + android:layout_width="match_parent" + android:layout_height="match_parent" + app:layout_behavior="@string/appbar_scrolling_view_behavior"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + + <com.google.android.material.textfield.TextInputLayout + android:id="@+id/name_text_input_layout_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="8dp" + android:paddingBottom="8dp" + android:paddingStart="16dp" + android:paddingEnd="16dp" + style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"> + + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/name_text_input_edit_text_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:fontFamily="?attr/font_family" + android:textSize="?attr/font_default" + android:hint="@string/post_filter_name_hint" /> + + </com.google.android.material.textfield.TextInputLayout> + + <LinearLayout + android:id="@+id/post_type_text_linear_layout_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="4dp" + android:paddingBottom="4dp" + android:paddingStart="32dp" + android:paddingEnd="8dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground"> + + <TextView + android:id="@+id/post_type_text_text_view_customize_post_filter_activity" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:layout_gravity="center_vertical" + android:text="@string/bottom_sheet_post_text" + android:fontFamily="?attr/font_default" + android:textSize="?attr/font_default" /> + + <com.google.android.material.checkbox.MaterialCheckBox + android:id="@+id/post_type_text_check_box_customize_post_filter_activity" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" /> + + </LinearLayout> + + <LinearLayout + android:id="@+id/post_type_link_linear_layout_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="4dp" + android:paddingBottom="4dp" + android:paddingStart="32dp" + android:paddingEnd="8dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground"> + + <TextView + android:id="@+id/post_type_link_text_view_customize_post_filter_activity" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:layout_gravity="center_vertical" + android:text="@string/bottom_sheet_post_link" + android:fontFamily="?attr/font_default" + android:textSize="?attr/font_default" /> + + <com.google.android.material.checkbox.MaterialCheckBox + android:id="@+id/post_type_link_check_box_customize_post_filter_activity" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" /> + + </LinearLayout> + + <LinearLayout + android:id="@+id/post_type_image_linear_layout_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="4dp" + android:paddingBottom="4dp" + android:paddingStart="32dp" + android:paddingEnd="8dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground"> + + <TextView + android:id="@+id/post_type_image_text_view_customize_post_filter_activity" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:layout_gravity="center_vertical" + android:text="@string/bottom_sheet_post_image" + android:fontFamily="?attr/font_default" + android:textSize="?attr/font_default" /> + + <com.google.android.material.checkbox.MaterialCheckBox + android:id="@+id/post_type_image_check_box_customize_post_filter_activity" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" /> + + </LinearLayout> + + <LinearLayout + android:id="@+id/post_type_gif_linear_layout_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="4dp" + android:paddingBottom="4dp" + android:paddingStart="32dp" + android:paddingEnd="8dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground"> + + <TextView + android:id="@+id/post_type_gif_text_view_customize_post_filter_activity" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:layout_gravity="center_vertical" + android:text="@string/post_type_gif" + android:fontFamily="?attr/font_default" + android:textSize="?attr/font_default" /> + + <com.google.android.material.checkbox.MaterialCheckBox + android:id="@+id/post_type_gif_check_box_customize_post_filter_activity" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" /> + + </LinearLayout> + + <LinearLayout + android:id="@+id/post_type_video_linear_layout_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="4dp" + android:paddingBottom="4dp" + android:paddingStart="32dp" + android:paddingEnd="8dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground"> + + <TextView + android:id="@+id/post_type_video_text_view_customize_post_filter_activity" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:layout_gravity="center_vertical" + android:text="@string/bottom_sheet_post_video" + android:fontFamily="?attr/font_default" + android:textSize="?attr/font_default" /> + + <com.google.android.material.checkbox.MaterialCheckBox + android:id="@+id/post_type_video_check_box_customize_post_filter_activity" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" /> + + </LinearLayout> + + <LinearLayout + android:id="@+id/post_type_gallery_linear_layout_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="4dp" + android:paddingBottom="4dp" + android:paddingStart="32dp" + android:paddingEnd="8dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground"> + + <TextView + android:id="@+id/post_type_gallery_text_view_customize_post_filter_activity" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:layout_gravity="center_vertical" + android:text="@string/post_type_gallery" + android:fontFamily="?attr/font_default" + android:textSize="?attr/font_default" /> + + <com.google.android.material.checkbox.MaterialCheckBox + android:id="@+id/post_type_gallery_check_box_customize_post_filter_activity" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" /> + + </LinearLayout> + + <LinearLayout + android:id="@+id/only_nsfw_linear_layout_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="4dp" + android:paddingBottom="4dp" + android:paddingStart="32dp" + android:paddingEnd="16dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground"> + + <TextView + android:id="@+id/only_nsfw_text_view_customize_post_filter_activity" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:layout_gravity="center_vertical" + android:text="@string/only_nsfw" + android:fontFamily="?attr/font_default" + android:textSize="?attr/font_default" /> + + <com.google.android.material.switchmaterial.SwitchMaterial + android:id="@+id/only_nsfw_switch_customize_post_filter_activity" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" /> + + </LinearLayout> + + <LinearLayout + android:id="@+id/only_spoiler_linear_layout_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="4dp" + android:paddingBottom="4dp" + android:paddingStart="32dp" + android:paddingEnd="16dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground"> + + <TextView + android:id="@+id/only_spoiler_text_view_customize_post_filter_activity" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:layout_gravity="center_vertical" + android:text="@string/only_spoiler" + android:fontFamily="?attr/font_default" + android:textSize="?attr/font_default" /> + + <com.google.android.material.switchmaterial.SwitchMaterial + android:id="@+id/only_spoiler_switch_customize_post_filter_activity" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" /> + + </LinearLayout> + + <com.google.android.material.textfield.TextInputLayout + android:id="@+id/title_excludes_strings_text_input_layout_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="8dp" + android:paddingBottom="8dp" + android:paddingStart="16dp" + android:paddingEnd="16dp" + style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"> + + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/title_excludes_strings_text_input_edit_text_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:fontFamily="?attr/font_family" + android:textSize="?attr/font_default" + android:hint="@string/title_excludes_strings_hint" /> + + </com.google.android.material.textfield.TextInputLayout> + + <com.google.android.material.textfield.TextInputLayout + android:id="@+id/title_excludes_regex_text_input_layout_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="8dp" + android:paddingBottom="8dp" + android:paddingStart="16dp" + android:paddingEnd="16dp" + style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"> + + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/title_excludes_regex_text_input_edit_text_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:fontFamily="?attr/font_family" + android:textSize="?attr/font_default" + android:hint="@string/title_excludes_regex_hint" /> + + </com.google.android.material.textfield.TextInputLayout> + + <com.google.android.material.textfield.TextInputLayout + android:id="@+id/excludes_subreddits_text_input_layout_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="8dp" + android:paddingBottom="8dp" + android:paddingStart="16dp" + android:paddingEnd="16dp" + style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"> + + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/excludes_subreddits_text_input_edit_text_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:fontFamily="?attr/font_family" + android:textSize="?attr/font_default" + android:hint="@string/exclude_subreddits_hint" /> + + </com.google.android.material.textfield.TextInputLayout> + + <com.google.android.material.textfield.TextInputLayout + android:id="@+id/excludes_users_text_input_layout_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="8dp" + android:paddingBottom="8dp" + android:paddingStart="16dp" + android:paddingEnd="16dp" + style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"> + + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/excludes_users_text_input_edit_text_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:fontFamily="?attr/font_family" + android:textSize="?attr/font_default" + android:hint="@string/exclude_users_hint" /> + + </com.google.android.material.textfield.TextInputLayout> + + <com.google.android.material.textfield.TextInputLayout + android:id="@+id/excludes_flairs_text_input_layout_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="8dp" + android:paddingBottom="8dp" + android:paddingStart="16dp" + android:paddingEnd="16dp" + style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"> + + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/excludes_flairs_text_input_edit_text_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:fontFamily="?attr/font_family" + android:textSize="?attr/font_default" + android:hint="@string/exclude_flairs_hint" /> + + </com.google.android.material.textfield.TextInputLayout> + + <com.google.android.material.textfield.TextInputLayout + android:id="@+id/contains_flairs_text_input_layout_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="8dp" + android:paddingBottom="8dp" + android:paddingStart="16dp" + android:paddingEnd="16dp" + style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"> + + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/contains_flairs_text_input_edit_text_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:fontFamily="?attr/font_family" + android:textSize="?attr/font_default" + android:hint="@string/contain_flairs_hint" /> + + </com.google.android.material.textfield.TextInputLayout> + + <com.google.android.material.textfield.TextInputLayout + android:id="@+id/min_vote_text_input_layout_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="8dp" + android:paddingBottom="8dp" + android:paddingStart="16dp" + android:paddingEnd="16dp" + style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"> + + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/min_vote_text_input_edit_text_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:inputType="numberSigned" + android:fontFamily="?attr/font_family" + android:textSize="?attr/font_default" + android:hint="@string/min_vote_hint" /> + + </com.google.android.material.textfield.TextInputLayout> + + <com.google.android.material.textfield.TextInputLayout + android:id="@+id/max_vote_text_input_layout_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="8dp" + android:paddingBottom="8dp" + android:paddingStart="16dp" + android:paddingEnd="16dp" + style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"> + + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/max_vote_text_input_edit_text_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:inputType="numberSigned" + android:fontFamily="?attr/font_family" + android:textSize="?attr/font_default" + android:hint="@string/max_vote_hint" /> + + </com.google.android.material.textfield.TextInputLayout> + + <com.google.android.material.textfield.TextInputLayout + android:id="@+id/min_comments_text_input_layout_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="8dp" + android:paddingBottom="8dp" + android:paddingStart="16dp" + android:paddingEnd="16dp" + style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"> + + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/min_comments_text_input_edit_text_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:inputType="numberSigned" + android:fontFamily="?attr/font_family" + android:textSize="?attr/font_default" + android:hint="@string/min_comments_hint" /> + + </com.google.android.material.textfield.TextInputLayout> + + <com.google.android.material.textfield.TextInputLayout + android:id="@+id/max_comments_text_input_layout_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="8dp" + android:paddingBottom="8dp" + android:paddingStart="16dp" + android:paddingEnd="16dp" + style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"> + + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/max_comments_text_input_edit_text_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:inputType="numberSigned" + android:fontFamily="?attr/font_family" + android:textSize="?attr/font_default" + android:hint="@string/max_comments_hint" /> + + </com.google.android.material.textfield.TextInputLayout> + + <com.google.android.material.textfield.TextInputLayout + android:id="@+id/min_awards_text_input_layout_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="8dp" + android:paddingBottom="8dp" + android:paddingStart="16dp" + android:paddingEnd="16dp" + style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"> + + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/min_awards_text_input_edit_text_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:inputType="numberSigned" + android:fontFamily="?attr/font_family" + android:textSize="?attr/font_default" + android:hint="@string/min_awards_hint" /> + + </com.google.android.material.textfield.TextInputLayout> + + <com.google.android.material.textfield.TextInputLayout + android:id="@+id/max_awards_text_input_layout_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="8dp" + android:paddingBottom="8dp" + android:paddingStart="16dp" + android:paddingEnd="16dp" + style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"> + + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/max_awards_text_input_edit_text_customize_post_filter_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:inputType="numberSigned" + android:fontFamily="?attr/font_family" + android:textSize="?attr/font_default" + android:hint="@string/max_awards_hint" /> + + </com.google.android.material.textfield.TextInputLayout> + + </LinearLayout> + + </androidx.core.widget.NestedScrollView> + +</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/activity_filtered_thing.xml b/app/src/main/res/layout/activity_filtered_thing.xml index a84e5140..5aa0207b 100644 --- a/app/src/main/res/layout/activity_filtered_thing.xml +++ b/app/src/main/res/layout/activity_filtered_thing.xml @@ -26,6 +26,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?attr/actionBarSize" + app:subtitle="@string/filtered_posts_activity_subtitle" app:popupTheme="@style/AppTheme.PopupOverlay" app:navigationIcon="?attr/homeAsUpIndicator" /> @@ -39,4 +40,12 @@ android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> + <com.google.android.material.floatingactionbutton.FloatingActionButton + android:id="@+id/fab_filtered_thing_activity" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_margin="@dimen/fab_margin" + android:layout_gravity="bottom|end" + android:src="@drawable/ic_filter_24dp" /> + </androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/activity_post_filter_application.xml b/app/src/main/res/layout/activity_post_filter_application.xml new file mode 100644 index 00000000..6708bb4e --- /dev/null +++ b/app/src/main/res/layout/activity_post_filter_application.xml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:id="@+id/coordinator_layout_post_filter_application_activity" + tools:context=".activities.PostFilterUsageListingActivity"> + + <com.google.android.material.appbar.AppBarLayout + android:id="@+id/appbar_layout_post_filter_application_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:theme="@style/AppTheme.AppBarOverlay"> + + <com.google.android.material.appbar.CollapsingToolbarLayout + android:id="@+id/collapsing_toolbar_layout_post_filter_application_activity" + android:layout_width="match_parent" + android:layout_height="match_parent" + app:layout_scrollFlags="scroll|enterAlways" + app:titleEnabled="false" + app:toolbarId="@+id/toolbar_post_filter_application_activity"> + + <androidx.appcompat.widget.Toolbar + android:id="@+id/toolbar_post_filter_application_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" + app:popupTheme="@style/AppTheme.PopupOverlay" + app:navigationIcon="?attr/homeAsUpIndicator" /> + + </com.google.android.material.appbar.CollapsingToolbarLayout> + + </com.google.android.material.appbar.AppBarLayout> + + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/recycler_view_post_filter_application_activity" + android:layout_width="match_parent" + android:layout_height="match_parent" + app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" + app:layout_behavior="@string/appbar_scrolling_view_behavior" /> + + <com.google.android.material.floatingactionbutton.FloatingActionButton + android:id="@+id/fab_post_filter_application_activity" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_margin="@dimen/fab_margin" + android:layout_gravity="bottom|end" + app:backgroundTint="?attr/colorPrimaryLightTheme" + app:srcCompat="@drawable/ic_add_day_night_24dp" + app:tint="@android:color/white" /> + +</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/activity_subreddit_filter_popular_and_all.xml b/app/src/main/res/layout/activity_post_filter_preference.xml index b854ae21..7db6ad95 100644 --- a/app/src/main/res/layout/activity_subreddit_filter_popular_and_all.xml +++ b/app/src/main/res/layout/activity_post_filter_preference.xml @@ -4,25 +4,25 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:id="@+id/coordinator_layout_subreddit_filter_popular_and_all_activity" - tools:context=".activities.SubredditFilterPopularAndAllActivity"> + android:id="@+id/coordinator_layout_post_filter_preference_activity" + tools:context=".activities.PostFilterPreferenceActivity"> <com.google.android.material.appbar.AppBarLayout - android:id="@+id/appbar_layout_subreddit_filter_popular_and_all_activity" + android:id="@+id/appbar_layout_post_filter_preference_activity" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/AppTheme.AppBarOverlay"> <com.google.android.material.appbar.CollapsingToolbarLayout - android:id="@+id/collapsing_toolbar_layout_subreddit_filter_popular_and_all_activity" + android:id="@+id/collapsing_toolbar_layout_post_filter_preference_activity" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_scrollFlags="scroll|enterAlways" app:titleEnabled="false" - app:toolbarId="@+id/toolbar_subreddit_filter_popular_and_all_activity"> + app:toolbarId="@+id/toolbar_post_filter_preference_activity"> <androidx.appcompat.widget.Toolbar - android:id="@+id/toolbar_subreddit_filter_popular_and_all_activity" + android:id="@+id/toolbar_post_filter_preference_activity" android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?attr/actionBarSize" @@ -34,13 +34,14 @@ </com.google.android.material.appbar.AppBarLayout> <androidx.recyclerview.widget.RecyclerView - android:id="@+id/recycler_view_subreddit_filter_popular_and_all_activity" + android:id="@+id/recycler_view_post_filter_preference_activity" android:layout_width="match_parent" android:layout_height="match_parent" + app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> <com.google.android.material.floatingactionbutton.FloatingActionButton - android:id="@+id/fab_subreddit_filter_popular_and_all_activity" + android:id="@+id/fab_post_filter_preference_activity" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="@dimen/fab_margin" diff --git a/app/src/main/res/layout/activity_search.xml b/app/src/main/res/layout/activity_search.xml index 972ba2af..9418ce8f 100644 --- a/app/src/main/res/layout/activity_search.xml +++ b/app/src/main/res/layout/activity_search.xml @@ -89,7 +89,8 @@ <View android:id="@+id/divider_search_activity" android:layout_width="match_parent" - android:layout_height="1dp" /> + android:layout_height="1dp" + android:visibility="gone" /> <TextView android:id="@+id/recent_summary_text_view_search_activity" @@ -103,7 +104,8 @@ <androidx.recyclerview.widget.RecyclerView android:id="@+id/recycler_view_search_activity" android:layout_width="match_parent" - android:layout_height="wrap_content" /> + android:layout_height="wrap_content" + android:visibility="gone" /> </LinearLayout> diff --git a/app/src/main/res/layout/activity_search_result.xml b/app/src/main/res/layout/activity_search_result.xml index 889a1732..58100f8d 100644 --- a/app/src/main/res/layout/activity_search_result.xml +++ b/app/src/main/res/layout/activity_search_result.xml @@ -47,4 +47,11 @@ android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> + <com.google.android.material.floatingactionbutton.FloatingActionButton + android:id="@+id/fab_search_result_activity" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_margin="@dimen/fab_margin" + android:layout_gravity="bottom|end" /> + </androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/activity_view_subreddit_detail.xml b/app/src/main/res/layout/activity_view_subreddit_detail.xml index 6020b138..d8c471fd 100644 --- a/app/src/main/res/layout/activity_view_subreddit_detail.xml +++ b/app/src/main/res/layout/activity_view_subreddit_detail.xml @@ -7,6 +7,12 @@ android:id="@+id/coordinator_layout_view_subreddit_detail_activity" tools:application=".Activity.ViewSubredditDetailActivity"> + <androidx.viewpager2.widget.ViewPager2 + android:id="@+id/view_pager_view_subreddit_detail_activity" + android:layout_width="match_parent" + android:layout_height="wrap_content" + app:layout_behavior="@string/appbar_scrolling_view_behavior" /> + <com.google.android.material.appbar.AppBarLayout android:id="@+id/appbar_layout_view_subreddit_detail_activity" android:layout_width="match_parent" @@ -166,81 +172,11 @@ </com.google.android.material.appbar.AppBarLayout> - <androidx.viewpager2.widget.ViewPager2 - android:id="@+id/view_pager_view_subreddit_detail_activity" - android:layout_width="match_parent" - android:layout_height="wrap_content" - app:layout_behavior="@string/appbar_scrolling_view_behavior" /> - - <com.google.android.material.bottomappbar.BottomAppBar - android:id="@+id/bottom_navigation_view_subreddit_detail_activity" + <include + layout="@layout/bottom_app_bar" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_gravity="bottom" - android:visibility="gone" - app:fabAlignmentMode="center"> - - <LinearLayout - android:id="@+id/linear_layout_bottom_app_bar_view_subreddit_detail_activity" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingTop="6dp" - android:weightSum="5"> - - <ImageView - android:id="@+id/option_1_bottom_app_bar_view_subreddit_detail_activity" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" - android:gravity="center" - android:paddingTop="8dp" - android:paddingBottom="8dp" - android:src="@drawable/ic_home_black_24dp" - android:background="?attr/selectableItemBackgroundBorderless" /> - - <ImageView - android:id="@+id/option_2_bottom_app_bar_view_subreddit_detail_activity" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" - android:gravity="center" - android:paddingTop="8dp" - android:paddingBottom="8dp" - android:src="@drawable/ic_subscritptions_bottom_app_bar_24dp" - android:background="?attr/selectableItemBackgroundBorderless" /> - - <TextView - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" - android:background="@android:color/transparent"/> - - <ImageView - android:id="@+id/option_3_bottom_app_bar_view_subreddit_detail_activity" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" - android:gravity="center" - android:paddingTop="8dp" - android:paddingBottom="8dp" - android:src="@drawable/ic_inbox_24dp" - android:background="?attr/selectableItemBackgroundBorderless" /> - - <ImageView - android:id="@+id/option_4_bottom_app_bar_view_subreddit_detail_activity" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" - android:layout_marginEnd="16dp" - android:paddingTop="8dp" - android:paddingBottom="8dp" - android:gravity="center" - android:src="@drawable/ic_account_circle_24dp" - android:background="?attr/selectableItemBackgroundBorderless" /> - - </LinearLayout> - - </com.google.android.material.bottomappbar.BottomAppBar> + android:layout_gravity="bottom" /> <com.google.android.material.floatingactionbutton.FloatingActionButton android:id="@+id/fab_view_subreddit_detail_activity" @@ -248,8 +184,6 @@ android:layout_height="wrap_content" android:layout_margin="@dimen/fab_margin" android:visibility="gone" - app:srcCompat="@drawable/ic_add_day_night_24dp" - app:tint="@android:color/white" - app:layout_anchor="@id/bottom_navigation_view_subreddit_detail_activity" /> + app:layout_anchor="@id/bottom_app_bar_bottom_app_bar" /> </androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/activity_view_user_detail.xml b/app/src/main/res/layout/activity_view_user_detail.xml index 5886f720..4711b75d 100644 --- a/app/src/main/res/layout/activity_view_user_detail.xml +++ b/app/src/main/res/layout/activity_view_user_detail.xml @@ -139,4 +139,18 @@ </com.google.android.material.appbar.AppBarLayout> + <include + layout="@layout/bottom_app_bar" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_gravity="bottom" /> + + <com.google.android.material.floatingactionbutton.FloatingActionButton + android:id="@+id/fab_view_user_detail_activity" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_margin="@dimen/fab_margin" + android:visibility="gone" + app:layout_anchor="@id/bottom_app_bar_bottom_app_bar" /> + </androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/app_bar_main.xml b/app/src/main/res/layout/app_bar_main.xml index e28e8138..9aef7ff3 100644 --- a/app/src/main/res/layout/app_bar_main.xml +++ b/app/src/main/res/layout/app_bar_main.xml @@ -51,71 +51,11 @@ android:layout_height="wrap_content" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> - <com.google.android.material.bottomappbar.BottomAppBar - android:id="@+id/bottom_app_bar_main_activity" + <include + layout="@layout/bottom_app_bar" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_gravity="bottom" - android:visibility="gone" - app:fabAlignmentMode="center"> - - <LinearLayout - android:id="@+id/linear_layout_bottom_app_bar_main_activity" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingTop="6dp" - android:weightSum="5"> - - <ImageView - android:id="@+id/option_1_bottom_app_bar_main_activity" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" - android:gravity="center" - android:paddingTop="8dp" - android:paddingBottom="8dp" - android:background="?attr/selectableItemBackgroundBorderless" /> - - <ImageView - android:id="@+id/option_2_bottom_app_bar_main_activity" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" - android:gravity="center" - android:paddingTop="8dp" - android:paddingBottom="8dp" - android:background="?attr/selectableItemBackgroundBorderless" /> - - <TextView - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" - android:background="@android:color/transparent"/> - - <ImageView - android:id="@+id/option_3_bottom_app_bar_main_activity" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" - android:gravity="center" - android:paddingTop="8dp" - android:paddingBottom="8dp" - android:background="?attr/selectableItemBackgroundBorderless" /> - - <ImageView - android:id="@+id/option_4_bottom_app_bar_main_activity" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" - android:layout_marginEnd="16dp" - android:paddingTop="8dp" - android:paddingBottom="8dp" - android:gravity="center" - android:background="?attr/selectableItemBackgroundBorderless" /> - - </LinearLayout> - - </com.google.android.material.bottomappbar.BottomAppBar> + android:layout_gravity="bottom" /> <com.google.android.material.floatingactionbutton.FloatingActionButton android:id="@+id/fab_main_activity" @@ -123,7 +63,6 @@ android:layout_height="wrap_content" android:layout_margin="@dimen/fab_margin" android:visibility="gone" - app:tint="@android:color/white" - app:layout_anchor="@id/bottom_app_bar_main_activity" /> + app:layout_anchor="@id/bottom_app_bar_bottom_app_bar" /> </androidx.coordinatorlayout.widget.CoordinatorLayout> diff --git a/app/src/main/res/layout/bottom_app_bar.xml b/app/src/main/res/layout/bottom_app_bar.xml new file mode 100644 index 00000000..fa1d886f --- /dev/null +++ b/app/src/main/res/layout/bottom_app_bar.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="utf-8"?> +<com.google.android.material.bottomappbar.BottomAppBar xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:id="@+id/bottom_app_bar_bottom_app_bar" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:visibility="gone" + app:fabAlignmentMode="center"> + + <LinearLayout + android:id="@+id/linear_layout_bottom_app_bar" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="6dp" + android:weightSum="5"> + + <ImageView + android:id="@+id/option_1_bottom_app_bar" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:gravity="center" + android:paddingTop="8dp" + android:paddingBottom="8dp" + android:background="?attr/selectableItemBackgroundBorderless" /> + + <ImageView + android:id="@+id/option_2_bottom_app_bar" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:gravity="center" + android:paddingTop="8dp" + android:paddingBottom="8dp" + android:background="?attr/selectableItemBackgroundBorderless" /> + + <TextView + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:background="@android:color/transparent"/> + + <ImageView + android:id="@+id/option_3_bottom_app_bar" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:gravity="center" + android:paddingTop="8dp" + android:paddingBottom="8dp" + android:background="?attr/selectableItemBackgroundBorderless" /> + + <ImageView + android:id="@+id/option_4_bottom_app_bar" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:layout_marginEnd="16dp" + android:paddingTop="8dp" + android:paddingBottom="8dp" + android:gravity="center" + android:background="?attr/selectableItemBackgroundBorderless" /> + + </LinearLayout> + +</com.google.android.material.bottomappbar.BottomAppBar>
\ No newline at end of file diff --git a/app/src/main/res/layout/dialog_edit_theme_name.xml b/app/src/main/res/layout/dialog_edit_name.xml index 9e126bc5..747d2d32 100644 --- a/app/src/main/res/layout/dialog_edit_theme_name.xml +++ b/app/src/main/res/layout/dialog_edit_name.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <EditText xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/theme_name_edit_text_edit_theme_name_dialog" + android:id="@+id/name_edit_text_edit_name_dialog" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="24dp" diff --git a/app/src/main/res/layout/dialog_edit_post_filter_name_of_usage.xml b/app/src/main/res/layout/dialog_edit_post_filter_name_of_usage.xml new file mode 100644 index 00000000..0b6ffc3f --- /dev/null +++ b/app/src/main/res/layout/dialog_edit_post_filter_name_of_usage.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="24dp" + android:paddingEnd="24dp" + android:text="@string/edit_post_filter_name_of_usage_info" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> + + <com.google.android.material.textfield.TextInputLayout + android:id="@+id/text_input_layout_edit_post_filter_name_of_usage_dialog" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="8dp" + android:paddingBottom="8dp" + android:paddingStart="16dp" + android:paddingEnd="16dp" + style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"> + + <com.google.android.material.textfield.TextInputEditText + android:id="@+id/text_input_edit_text_edit_post_filter_name_of_usage_dialog" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:fontFamily="?attr/font_family" + android:textSize="?attr/font_default" /> + + </com.google.android.material.textfield.TextInputLayout> + +</LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/fragment_fab_more_options_bottom_sheet.xml b/app/src/main/res/layout/fragment_fab_more_options_bottom_sheet.xml index 92ef8b02..3fd3c62b 100644 --- a/app/src/main/res/layout/fragment_fab_more_options_bottom_sheet.xml +++ b/app/src/main/res/layout/fragment_fab_more_options_bottom_sheet.xml @@ -163,6 +163,44 @@ android:focusable="true" android:background="?attr/selectableItemBackground" /> + <TextView + android:id="@+id/hide_read_posts_text_view_fab_more_options_bottom_sheet_fragment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="32dp" + android:paddingEnd="32dp" + android:text="@string/hide_read_posts" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" + app:drawableStartCompat="@drawable/ic_hide_read_posts_24dp" + android:drawablePadding="48dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground" /> + + <TextView + android:id="@+id/filter_posts_text_view_fab_more_options_bottom_sheet_fragment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="32dp" + android:paddingEnd="32dp" + android:text="@string/filter_posts" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" + app:drawableStartCompat="@drawable/ic_filter_24dp" + android:drawablePadding="48dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground" /> + </LinearLayout> </androidx.core.widget.NestedScrollView>
\ No newline at end of file diff --git a/app/src/main/res/layout/fragment_filtered_thing_fab_more_options_bottom_sheet.xml b/app/src/main/res/layout/fragment_filtered_thing_fab_more_options_bottom_sheet.xml new file mode 100644 index 00000000..c1820f61 --- /dev/null +++ b/app/src/main/res/layout/fragment_filtered_thing_fab_more_options_bottom_sheet.xml @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + xmlns:app="http://schemas.android.com/apk/res-auto" + tools:context=".bottomsheetfragments.FABMoreOptionsBottomSheetFragment"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + + <TextView + android:id="@+id/filter_text_view_filtered_thing_fab_more_options_bottom_sheet_fragment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="32dp" + android:paddingEnd="32dp" + android:text="@string/submit_post" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" + app:drawableStartCompat="@drawable/ic_filter_24dp" + android:drawablePadding="48dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground" /> + + <TextView + android:id="@+id/hide_read_posts_text_view_filtered_thing_fab_more_options_bottom_sheet_fragment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="32dp" + android:paddingEnd="32dp" + android:text="@string/hide_read_posts" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" + app:drawableStartCompat="@drawable/ic_hide_read_posts_24dp" + android:drawablePadding="48dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground" /> + + </LinearLayout> + +</androidx.core.widget.NestedScrollView>
\ No newline at end of file diff --git a/app/src/main/res/layout/fragment_new_post_filter_usage_bottom_sheet.xml b/app/src/main/res/layout/fragment_new_post_filter_usage_bottom_sheet.xml new file mode 100644 index 00000000..11515ec4 --- /dev/null +++ b/app/src/main/res/layout/fragment_new_post_filter_usage_bottom_sheet.xml @@ -0,0 +1,106 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="wrap_content" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:paddingBottom="8dp" + android:overScrollMode="never"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + + <TextView + android:id="@+id/home_text_view_new_post_filter_usage_bottom_sheet_fragment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/home" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="32dp" + android:paddingEnd="32dp" + app:drawableStartCompat="@drawable/ic_home_black_24dp" + android:drawablePadding="48dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground" /> + + <TextView + android:id="@+id/subreddit_text_view_new_post_filter_usage_bottom_sheet_fragment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/subreddit" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="32dp" + android:paddingEnd="32dp" + app:drawableStartCompat="@drawable/ic_subreddit_24dp" + android:drawablePadding="48dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground" /> + + <TextView + android:id="@+id/user_text_view_new_post_filter_usage_bottom_sheet_fragment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/user" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="32dp" + android:paddingEnd="32dp" + app:drawableStartCompat="@drawable/ic_user_24dp" + android:drawablePadding="48dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground" /> + + <TextView + android:id="@+id/multireddit_text_view_new_post_filter_usage_bottom_sheet_fragment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/multi_reddit" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="32dp" + android:paddingEnd="32dp" + app:drawableStartCompat="@drawable/ic_multi_reddit_24dp" + android:drawablePadding="48dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground" /> + + <TextView + android:id="@+id/search_text_view_new_post_filter_usage_bottom_sheet_fragment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/search" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="32dp" + android:paddingEnd="32dp" + app:drawableStartCompat="@drawable/ic_search_24dp" + android:drawablePadding="48dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground" /> + + </LinearLayout> + +</androidx.core.widget.NestedScrollView>
\ No newline at end of file diff --git a/app/src/main/res/layout/fragment_post_filter_options_bottom_sheet.xml b/app/src/main/res/layout/fragment_post_filter_options_bottom_sheet.xml new file mode 100644 index 00000000..a9c9310e --- /dev/null +++ b/app/src/main/res/layout/fragment_post_filter_options_bottom_sheet.xml @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="wrap_content" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:paddingBottom="8dp" + android:overScrollMode="never"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + + <TextView + android:id="@+id/edit_text_view_post_filter_options_bottom_sheet_fragment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/edit" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="32dp" + android:paddingEnd="32dp" + app:drawableStartCompat="@drawable/ic_edit_24dp" + android:drawablePadding="48dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground" /> + + <TextView + android:id="@+id/apply_to_text_view_post_filter_options_bottom_sheet_fragment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/apply_post_filter_to" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="32dp" + android:paddingEnd="32dp" + app:drawableStartCompat="@drawable/ic_apply_to_24dp" + android:drawablePadding="48dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground" /> + + <TextView + android:id="@+id/delete_text_view_post_filter_options_bottom_sheet_fragment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/delete" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="32dp" + android:paddingEnd="32dp" + app:drawableStartCompat="@drawable/ic_delete_24dp" + android:drawablePadding="48dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground" /> + + </LinearLayout> + +</androidx.core.widget.NestedScrollView>
\ No newline at end of file diff --git a/app/src/main/res/layout/fragment_post_filter_usage_options_bottom_sheet.xml b/app/src/main/res/layout/fragment_post_filter_usage_options_bottom_sheet.xml new file mode 100644 index 00000000..e4a68585 --- /dev/null +++ b/app/src/main/res/layout/fragment_post_filter_usage_options_bottom_sheet.xml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="wrap_content" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:paddingBottom="8dp" + android:overScrollMode="never"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + + <TextView + android:id="@+id/edit_text_view_post_filter_usage_options_bottom_sheet_fragment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/edit" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="32dp" + android:paddingEnd="32dp" + app:drawableStartCompat="@drawable/ic_edit_24dp" + android:drawablePadding="48dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground" /> + + <TextView + android:id="@+id/delete_text_view_post_filter_usage_options_bottom_sheet_fragment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/delete" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="32dp" + android:paddingEnd="32dp" + app:drawableStartCompat="@drawable/ic_delete_24dp" + android:drawablePadding="48dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground" /> + + </LinearLayout> + +</androidx.core.widget.NestedScrollView>
\ No newline at end of file diff --git a/app/src/main/res/layout/fragment_post_history.xml b/app/src/main/res/layout/fragment_post_history.xml new file mode 100644 index 00000000..325d74e1 --- /dev/null +++ b/app/src/main/res/layout/fragment_post_history.xml @@ -0,0 +1,128 @@ +<?xml version="1.0" encoding="utf-8"?> +<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + xmlns:app="http://schemas.android.com/apk/res-auto" + tools:context=".settings.PostHistoryFragment"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + + <TextView + android:id="@+id/info_text_view_post_history_fragment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:padding="16dp" + android:drawablePadding="32dp" + android:text="@string/restart_app_see_changes" + android:textColor="@color/settingsSubtitleColor" + android:gravity="center_vertical" + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" + app:drawableStartCompat="@drawable/ic_info_preference_24dp" /> + + <View + android:layout_width="match_parent" + android:layout_height="1dp" + android:background="@color/dividerColor" /> + + <LinearLayout + android:id="@+id/mark_posts_as_read_linear_layout_post_history_fragment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="4dp" + android:paddingBottom="4dp" + android:paddingStart="72dp" + android:paddingEnd="16dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground"> + + <TextView + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:layout_marginEnd="16dp" + android:layout_gravity="center_vertical" + android:drawablePadding="32dp" + android:text="@string/settings_mark_posts_as_read_title" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_16" + android:fontFamily="?attr/font_family" /> + + <com.google.android.material.switchmaterial.SwitchMaterial + android:id="@+id/mark_posts_as_read_switch_post_history_fragment" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" /> + + </LinearLayout> + + <LinearLayout + android:id="@+id/mark_posts_as_read_after_voting_linear_layout_post_history_fragment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="4dp" + android:paddingBottom="4dp" + android:paddingStart="72dp" + android:paddingEnd="16dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground"> + + <TextView + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:layout_marginEnd="16dp" + android:layout_gravity="center_vertical" + android:text="@string/settings_mark_posts_as_read_after_voting_title" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_16" + android:fontFamily="?attr/font_family" /> + + <com.google.android.material.switchmaterial.SwitchMaterial + android:id="@+id/mark_posts_as_read_after_voting_switch_post_history_fragment" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" /> + + </LinearLayout> + + <LinearLayout + android:id="@+id/hide_read_posts_automatically_linear_layout_post_history_fragment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="4dp" + android:paddingBottom="4dp" + android:paddingStart="72dp" + android:paddingEnd="16dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground"> + + <TextView + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:layout_marginEnd="16dp" + android:layout_gravity="center_vertical" + android:text="@string/settings_hide_read_posts_automatically_title" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_16" + android:fontFamily="?attr/font_family" /> + + <com.google.android.material.switchmaterial.SwitchMaterial + android:id="@+id/hide_read_posts_automatically_switch_post_history_fragment" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" /> + + </LinearLayout> + + </LinearLayout> + +</androidx.core.widget.NestedScrollView>
\ No newline at end of file diff --git a/app/src/main/res/layout/item_filter_fragment_header.xml b/app/src/main/res/layout/item_filter_fragment_header.xml new file mode 100644 index 00000000..af3b2b00 --- /dev/null +++ b/app/src/main/res/layout/item_filter_fragment_header.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="wrap_content" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:orientation="vertical"> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:padding="16dp" + android:drawablePadding="32dp" + android:text="@string/restart_app_see_changes" + android:textColor="@color/settingsSubtitleColor" + android:gravity="center_vertical" + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" + app:drawableStartCompat="@drawable/ic_info_preference_24dp" /> + + <View + android:layout_width="match_parent" + android:layout_height="1dp" + android:background="@color/dividerColor" /> + +</LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/item_post_filter.xml b/app/src/main/res/layout/item_post_filter.xml new file mode 100644 index 00000000..62a5e886 --- /dev/null +++ b/app/src/main/res/layout/item_post_filter.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<TextView + xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="72dp" + android:paddingEnd="16dp" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_16" + android:fontFamily="?attr/font_family" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground" />
\ No newline at end of file diff --git a/app/src/main/res/layout/item_post_filter_usage.xml b/app/src/main/res/layout/item_post_filter_usage.xml new file mode 100644 index 00000000..62a5e886 --- /dev/null +++ b/app/src/main/res/layout/item_post_filter_usage.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<TextView + xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="72dp" + android:paddingEnd="16dp" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_16" + android:fontFamily="?attr/font_family" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground" />
\ No newline at end of file diff --git a/app/src/main/res/menu/customize_post_filter_activity.xml b/app/src/main/res/menu/customize_post_filter_activity.xml new file mode 100644 index 00000000..01690700 --- /dev/null +++ b/app/src/main/res/menu/customize_post_filter_activity.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> + <item + android:id="@+id/action_save_customize_post_filter_activity" + android:orderInCategory="1" + android:title="@string/action_save" + android:icon="@drawable/ic_check_circle_toolbar_24dp" + app:showAsAction="ifRoom" /> + + <item + android:id="@+id/action_save_to_database_customize_post_filter_activity" + android:orderInCategory="2" + android:title="@string/action_save_to_database" + android:icon="@drawable/ic_save_to_database_24dp" + app:showAsAction="ifRoom" /> +</menu>
\ No newline at end of file diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 159ec61d..d4068354 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -4,8 +4,11 @@ <string name="search_activity_label">"Suchen"</string> <string name="comment_activity_label">"Kommentar senden"</string> <string name="comment_activity_label_is_replying">"Antworten"</string> + + <!-- Ja wür ich auch sagen --> + <!-- Fuzzy --> <string name="post_text_activity_label">"Text-Beitrag"</string> - <string name="subreddit_selection_activity_label">"Wähle ein Subreddit"</string> + <string name="subreddit_selection_activity_label">"Wähle einen Subreddit"</string> <string name="post_link_activity_label">"Beitrag verlinken"</string> <string name="post_image_activity_label">"Bild-Beitrag"</string> <string name="post_video_activity_label">"Video-Beitrag"</string> @@ -35,14 +38,14 @@ <string name="navigation_drawer_close">"Navigationsleiste schließen"</string> <string name="action_download">"Herunterladen"</string> <string name="action_refresh">"Aktualisieren"</string> - <string name="action_add_comment">"Einen Kommentar hinzufügen"</string> + <string name="action_add_comment">"Kommentar hinzufügen"</string> <string name="action_save_post">"Beitrag speichern"</string> <!-- Fuzzy --> <string name="action_view_crosspost_parent">"Originalbeitrag crossposten"</string> <string name="action_search">"Suchen"</string> - <string name="action_start_lazy_mode">"Faulen Modus starten"</string> - <string name="action_stop_lazy_mode">"Faulen Modus stoppen"</string> + <string name="action_start_lazy_mode">"Faulheitsmodus starten"</string> + <string name="action_stop_lazy_mode">"Faulheitsmodus stoppen"</string> <string name="action_send">"Senden"</string> <string name="action_sort">"Sortieren"</string> <string name="action_hide_post">"Beitrag verstecksn"</string> @@ -62,7 +65,7 @@ <string name="action_preview">"Vorschau"</string> <string name="action_report">"Melden"</string> <string name="action_see_removed">"Entfernten Beitrag ansehen"</string> - <string name="action_set_wallpaper">"Als Hinweis Hintergrundbild einstellen"</string> + <string name="action_set_wallpaper">"Als Hintergrundbild einstellen"</string> <string name="action_send_private_message">"Private Nachricht senden"</string> <string name="action_block_user">"Benutzer blockieren"</string> <string name="parse_json_response_error">"Ein Fehler trat beim Abruf der JSON-Antwort auf"</string> @@ -71,12 +74,12 @@ <string name="access_denied">"Zugriff verweigert"</string> <string name="parse_user_info_error">"Ein Fehler trat beim Abruf der Benutzerinformationen auf"</string> <string name="no_system_webview_error">"Fehler beim Öffnen des System-WebView"</string> - <string name="error_loading_image_tap_to_retry">"Fehler beim Laden des Bildes. Berühren, um es erneut zu versuchen."</string> - <string name="load_posts_error">"Fehler beim Laden der Beiträge. Berühren, um es erneut zu versuchen."</string> + <string name="error_loading_image_tap_to_retry">"Fehler beim Laden des Bildes. Tippen für Neuversuch."</string> + <string name="load_posts_error">"Fehler beim Laden der Beiträge. Tippen für Neuversuch."</string> <string name="load_more_posts_error">"Fehler beim Laden der Beiträge."</string> - <string name="load_post_error">"Fehler beim Laden des Beitrags. Berühren, um es erneut zu versuchen."</string> - <string name="search_subreddits_error">"Fehler beim Suchen von Subreddits. Berühren, um es erneut zu versuchen."</string> - <string name="search_users_error">"Fehler beim Suchen nach Benutzern. Berühren, um es erneut zu versuchen."</string> + <string name="load_post_error">"Fehler beim Laden des Beitrags. Tippen für Neuversuch."</string> + <string name="search_subreddits_error">"Fehler beim Suchen von Subreddits. Tippen für Neuversuch."</string> + <string name="search_users_error">"Fehler beim Suchen nach Benutzern. Tippen für Neuversuch."</string> <string name="no_posts">"Keine Beiträge gefunden"</string> <string name="no_comments">"Keine Kommentare gefunden"</string> <string name="no_subreddits">"Keine Subreddits gefunden"</string> @@ -128,8 +131,8 @@ <string name="app_label">"Infinity"</string> <string name="search_hint">"Alles durchsuchen"</string> <string name="no_posts_no_lazy_mode">"Keine Beiträge verfügbar"</string> - <string name="lazy_mode_start">"Fauler Modus startet in %1$.1fs"</string> - <string name="lazy_mode_stop">"Fauler Modus gestoppt"</string> + <string name="lazy_mode_start">"Faulheitsmodus startet in %1$.1fs"</string> + <string name="lazy_mode_stop">"Faulheitsmodus gestoppt"</string> <string name="write_comment_hint">"Deine interessanten Gedanken hier"</string> <string name="comment_content_required">"Wo bleibt dein interessanter Gedanke?"</string> <string name="sending_comment">"Sende"</string> @@ -145,7 +148,7 @@ <string name="message_content_required">"Du musst dem Empfänger auch was schreiben"</string> <string name="sending_message">"Sende"</string> <string name="send_message_success">"Nachricht gesendet"</string> - <string name="send_message_failed">"Konnte diese Nachricht nicht senden"</string> + <string name="send_message_failed">"Nachricht konnte nicht gesendet werden."</string> <string name="select_a_subreddit">"Bitte wähle zuerst ein Subreddit aus"</string> <string name="title_required">"Der Beitrag braucht einen guten Titel"</string> <string name="link_required">"Hey, wo ist der Link?"</string> @@ -156,7 +159,7 @@ <string name="error_processing_video">"Fehler beim Bearbeiten des Videos"</string> <string name="download_started">"Herunterladen gestartet. Prüfe die Benachrichtigung bzgl. des Fortschritts."</string> <string name="comment_load_more_comments">"Lade mehr Kommentare"</string> - <string name="comment_load_more_comments_failed">"Laden fehlgeschlagen. Berühren, um es erneut zu versuchen."</string> + <string name="comment_load_more_comments_failed">"Laden fehlgeschlagen. Tippen für Neuversuch."</string> <string name="loading">"Lade"</string> <string name="post_title_hint">"Titel"</string> <string name="post_text_content_hint">"Inhalt"</string> @@ -642,8 +645,6 @@ Funktioniert vielleicht nicht auf Android 11"</string> <string name="theme_item_unread_message_background_color_detail">"Angewandt auf: Hintergrundfarbe für ungelesene Nachrichten"</string> <string name="theme_item_divider_color">"Farbe für Trennleiste"</string> <string name="theme_item_divider_color_detail">"Angewandt auf: Trennleisten in Kommentaren, auf Seiten zum Einreichen von Beiträgen, usw."</string> - <string name="theme_item_no_preview_post_type_background_color">"Hintergrundfarbe für Links ohne Vorschau"</string> - <string name="theme_item_no_preview_post_type_background_color_detail">"Angewandt auf: Platzhalter für Links ohne Vorschau"</string> <string name="theme_item_vote_and_reply_unavailable_button_color">"Farbe für deaktivierte Abstimmungs- und Antwort-Knöpfe"</string> <string name="theme_item_vote_and_reply_unavailable_button_color_detail">"Angewandt auf: Abstimmungs- und Antwort-Knöpfe (nicht verfügbar)"</string> <string name="theme_item_comment_vertical_bar_color_1">"Farbe 1 für vertikale Leiste in Kommenatren"</string> @@ -791,4 +792,119 @@ Beispiel: DeinPasswort:123456"</string> <string name="block_user">"Benutzer blockieren"</string> <string name="block_user_success">"Blockiert"</string> <string name="block_user_failed">"Blockieren des Benutzers fehlgeschlagen"</string> + <string name="submit_crosspost_activity_label">"Crossposten"</string> + <string name="give_award_activity_label">"Auszeichnung verleihen"</string> + <string name="action_crosspost">"Crossposten"</string> + <string name="action_select_user_flair">"Benutzerflair auswählen"</string> + <string name="action_give_award">"Auszeichnung verleihen"</string> + <string name="posts">"Beiträge"</string> + <string name="sidebar">"Seitenleiste"</string> + <string name="only_for_logged_in_user">"Nur für angemeldete Benutzer"</string> + <string name="settings_number_of_columns_in_post_feed_title">"Anzahl an Spalten im Beitragsfeed"</string> + <string name="settings_number_of_columns_in_post_feed_portrait_title">"Hochformat"</string> + <string name="settings_number_of_columns_in_post_feed_landscape_title">"Querformat"</string> + <string name="settings_nsfw_and_spoiler_title">"NSFW & Spoiler"</string> + <string name="settings_delete_all_legacy_settings_title">"Alle Legacy-Einstellungen löschen"</string> + <string name="restart_app_see_changes">"Starte die App neu, um die Änderungen zu sehen"</string> + <string name="settings_tab_count">"Anzahl an Reitern"</string> + <string name="settings_show_tab_names">"Namen der Reiter anzeigen"</string> + <string name="settings_more_tabs_summary">"Mehr Reiter"</string> + <string name="settings_more_tabs_info_summary">"Die folgenden Optionen zu aktivieren, kann zu ungewollten Verhalten führen: +Reiter könnten den Inhalt verlieren, wenn zu anderen gewechselt wird. Selbes Verhalten wie beim Neuladen der Seite."</string> + <string name="settings_more_tabs_show_favorite_subscribed_subreddits_title">"Favoriten der abonnierten Subreddits anzeigen"</string> + <string name="settings_more_tabs_show_subscribed_subreddits_title">"Abonnierte Subreddits anzeigen"</string> + <string name="settings_download_location_title">"Downloadpfad"</string> + <string name="settings_image_download_location_title">"Downloadpfad für Bilder"</string> + <string name="settings_gif_download_location_title">"Downloadpfad für GIFs"</string> + <string name="settings_video_download_location_title">"Downloadpfad für Videos"</string> + <string name="settings_separate_folder_for_each_subreddit">"Separater Ordner pro Subreddit"</string> + <string name="settings_swipe_action_title">"Aktion beim Wischen"</string> + <string name="settings_disable_swiping_between_tabs_title">"Wischen zwischen den Reitern deaktivieren"</string> + <string name="settings_enable_swipe_action_title">"Wisch-Aktion aktivieren"</string> + <string name="settings_swipe_action_threshold">"Begrenzung"</string> + <string name="settings_pull_to_refresh_title">"Ziehen zum Aktualisieren"</string> + <string name="settings_security_title">"Sicherheit"</string> + <string name="settings_require_authentication_to_go_to_account_section_in_navigation_drawer_title">"Authentifizierung für die Kontosektion in der Seitenleiste erfordern"</string> + <string name="settings_long_press_to_hide_toolbar_in_compact_layout_title">"Langes Drücken, um die Werkzeugleiste in der Kompaktansicht zu verstecken"</string> + <string name="settings_post_compact_layout_toolbar_hidden_by_default_title">"Werkzeugleiste in der Kompaktansicht standardmäßig verstecken"</string> + <string name="settings_customize_bottom_app_bar_title">"Untere Werkzeugleiste anpassen"</string> + <string name="settings_main_activity_bottom_app_bar_group_summary">"Hauptseite"</string> + <string name="settings_other_activities_bottom_app_bar_group_summary">"Andere Seiten"</string> + <string name="settings_bottom_app_bar_option_count">"Anzahl an Optionen"</string> + <string name="settings_bottom_app_bar_option_1">"Option 1"</string> + <string name="settings_bottom_app_bar_option_2">"Option 2"</string> + <string name="settings_bottom_app_bar_option_3">"Option 3"</string> + <string name="settings_bottom_app_bar_option_4">"Option 4"</string> + <string name="settings_bottom_app_bar_fab">"Schwebender Aktionsknopf"</string> + <string name="settings_data_saving_mode">"Datensparmodus"</string> + + <!-- Fuzzy --> + <string name="settings_data_saving_mode_info_summary">"Im Datensparmodus werden Vorschaubilder mit geringerer Auflösung geladen."</string> + <string name="settings_translation_title">"Übersetzung"</string> + <string name="settings_translation_summary">"Übersetze diese App auf POEditor. Danke an alle Beitragenden."</string> + <string name="settings_credits_national_flags">"Nationalflaggen"</string> + <string name="settings_credits_national_flags_summary">"Symbol erstellt von Freepik von www.freepik.com"</string> + <string name="copy_failed">"Kopieren fehlgeschlagen"</string> + <string name="delete_all_legacy_settings_success">"Alle Legacy-Einstellungen wurden erfolgreich gelöscht"</string> + <string name="downloading_media_finished">"Heruntergeladen"</string> + <string name="downloading_image_or_gif_failed_cannot_get_destination_directory">"Herunterladen fehlgeschlagen: Kann nicht auf Downloadpfad zugreifen"</string> + <string name="downloading_media_failed_cannot_download_media">"Herunterladen fehlgeschlagen"</string> + <string name="downloading_media_failed_cannot_save_to_destination_directory">"Herunterladen fehlgeschlagen: Kann die Datei nicht im Zielverzeichnis speichern"</string> + <string name="view_full_comment_markdown">"Vollständiges Markdown anzeigen"</string> + <string name="select_user_flair_success">"Benutzerflair ausgewählt"</string> + <string name="select_this_user_flair">"Dieses Benutzerflair auswählen?"</string> + <string name="select_header_size">"Größe für den Header auswählen"</string> + <string name="large">"Groß"</string> + <string name="small">"Klein"</string> + <string name="insert_link">"Link einfügen"</string> + <string name="text_hint">"Text"</string> + <string name="link_hint">"Link"</string> + <string name="unlock_account_section">"Kontosektion entsperren"</string> + <string name="unlock">"Entsperren"</string> + <string name="submit_post">"Beitrag einreichen"</string> + <string name="refresh">"Aktualisieren"</string> + <string name="change_sort_type">"Sortiertyp ändern"</string> + <string name="change_post_layout">"Beitragslayout ändern"</string> + <string name="give_award_dialog_title">"Auszeichnung verleihen?"</string> + <string name="anonymous">"Anonym"</string> + <string name="give_award_error_message">"Code: %1$d/ Nachricht: %2$s"</string> + <string name="give_award_success">"Auszeichnung verliehen"</string> + <string name="give_award_failed">"Fehlgeschlagen"</string> + <string name="recent_searches">"Kürzliche Suchanfragen"</string> + <string name="warning">"Warnung"</string> + <string name="this_is_a_nsfw_subreddit">"Dieses ist ein NSFW-Subreddit"</string> + <string name="this_user_has_nsfw_content">"Dieser Nutzer hat NSFW-Inhalte"</string> + <string name="dismiss">"Verwerfen"</string> + <string name="leave">"Verlassen"</string> + <string name="go_to_subreddit">"Zum Subreddit gehen"</string> + <string name="go_to_user">"Zum Benutzer gehen"</string> + <string name="go_to_thing_hint">"Name"</string> + <string name="random">"Zufällig"</string> + <string name="random_subreddit">"Zufälliges Subreddit"</string> + <string name="random_nsfw_subreddit">"Zufälliger NSFW-Subreddit"</string> + <string name="random_post">"Zufälliger Beitrag"</string> + <string name="random_nsfw_post">"Zufälliger NSFW-Beitrag"</string> + <string name="fetch_random_thing_failed">"Versuche es später erneut"</string> + <string name="downloading">"Am Herunterladen"</string> + <string name="subreddit_filter_popular_and_all_activity_label">"r/all und r/popular"</string> + + <!-- Verschiedenes oder Sonstiges bin mir net sicher :^( --> + <string name="settings_miscellaneous_title">"Sonstiges"</string> + <string name="settings_respect_subreddit_recommended_comment_sort_type_title">"Vom Subreddit vorgeschlagenen Kommentar Sortier-Typ respektieren"</string> + <string name="settings_respect_subreddit_recommended_comment_sort_type_summary">"Kommentar Sortier-Typ wird nicht gespeichert"</string> + <string name="settings_post_filter_title">"Filter"</string> + <string name="settings_subreddit_filter_category">"Verstecke Subreddits"</string> + <string name="settings_subreddit_filter_popular_and_all">"In r/popular und r/all"</string> + <string name="settings_credits_ufo_capturing_animation_title">"UFO-Aufnahmeanimation"</string> + <string name="select_video_quality">"Videoqualität auswählen"</string> + <string name="settings_swipe_action_haptic_feedback_title">"haptisches Feedback"</string> + <string name="settings_hide_subreddit_description_title">"Verstecke Subredditbeschreibung"</string> + <string name="settings_disable_image_preview_title">"Bildvorschau im Datensparmodus deaktivieren"</string> + <string name="settings_swipe_action_swipe_left_title">"Wische nach links"</string> + <string name="settings_swipe_action_swipe_right_title">"Wische nach rechts"</string> + <string name="settings_swipe_action_info_summary">"Gilt nicht für Post-Feeds mit mehr als 1 Spalte oder Post-Detail."</string> + <string name="theme_item_no_preview_post_type_icon_tint">"Keine Post-Typ Icon-Farbe"</string> + <string name="theme_item_no_preview_post_type_icon_tint_detail">"Angewandt auf: Icon, welches den Tyo des Posts angibt, wenn keine Vorschau verfügbar ist"</string> + <string name="theme_item_no_preview_post_type_background_color">"Keine Post-Typ Hintergrundfarbe"</string> + <string name="theme_item_no_preview_post_type_background_color_detail">"Angewandt auf: Platzhalter, der die Art des Beitrags angibt, wenn keine Vorschau verfügbar ist"</string> </resources>
\ No newline at end of file diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 8b9dae63..6419c67e 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -7,12 +7,14 @@ <string name="post_text_activity_label">"Texto"</string> <string name="subreddit_selection_activity_label">"Elige un Subreddit"</string> <string name="post_link_activity_label">"Enlace"</string> - <string name="post_image_activity_label">"Imagen"</string> + <string name="post_image_activity_label">"Imagén"</string> <string name="post_video_activity_label">"Vídeo"</string> <string name="rules_activity_label">"Reglas"</string> <string name="search_subreddits_activity_label">"Subreddits"</string> <string name="edit_post_activity_label">"Editar publicación"</string> <string name="edit_comment_activity_label">"Editar comentario"</string> + + <!-- Bandeja de Entrada --> <string name="view_message_activity_label">"Inbox"</string> <string name="settings_activity_label">"Configuración"</string> <string name="account_saved_thing_activity_label">"Guardado"</string> @@ -37,9 +39,7 @@ <string name="action_refresh">"Actualizar"</string> <string name="action_add_comment">"Añadir un comentario"</string> <string name="action_save_post">"Guardar publicación"</string> - - <!-- Fuzzy --> - <string name="action_view_crosspost_parent">"Origen de Publicación Cruzada"</string> + <string name="action_view_crosspost_parent">"Ver Origen de Publicación Cruzada"</string> <string name="action_search">"Buscar"</string> <string name="action_start_lazy_mode">"Iniciar modo automático"</string> <string name="action_stop_lazy_mode">"Detener modo automático"</string> @@ -61,21 +61,22 @@ <string name="action_share">"Compartir"</string> <string name="action_preview">"Previsualizar"</string> <string name="action_report">"Reportar"</string> - <string name="action_see_removed">"Ver los Removidos"</string> - <string name="action_set_wallpaper">"Añadir como fondo de pantalla"</string> + <string name="action_see_removed">"Ver eliminados"</string> + <string name="action_set_wallpaper">"Fijar como fondo de pantalla"</string> <string name="action_send_private_message">"Enviar mensaje privado"</string> <string name="action_block_user">"Bloquear usuario"</string> - <string name="parse_json_response_error">"Ocurrió un error al comprobar la respuesta: JSON"</string> + <string name="parse_json_response_error">"Ocurrió un error al comprobar la respuesta JSON"</string> <string name="retrieve_token_error">"Ocurrió un error al recuperar el token"</string> <string name="something_went_wrong">"Ocurrió un error. Inténtalo más tarde."</string> <string name="access_denied">"Acceso denegado"</string> <string name="parse_user_info_error">"Ocurrió un error al comprobar la información del usuario"</string> - <string name="no_system_webview_error">"Ocurrió un error. System WebView no se inició."</string> + <string name="no_system_webview_error">"Ocurrió un error iniciando System WebView."</string> <string name="error_loading_image_tap_to_retry">"Ocurrió un error cargando la imagen. Toca para reintentar."</string> <string name="load_posts_error">"Ocurrió un error al cargar las publicaciones. Toca para reintentar."</string> <string name="load_more_posts_error">"Ocurrió un error al cargar más publicaciones."</string> <string name="load_post_error">"Ocurrió un error al cargar la publicación. Toca para reintentar."</string> - <string name="search_subreddits_error">"Ocurrió un error al iniciar la búsqueda. Toca para reintentar."</string> + <string name="search_subreddits_error">"Error al buscar subreddits. +Toca para reintentar."</string> <string name="search_users_error">"Ocurrió un error al iniciar la búsqueda. Toca para reintentar."</string> <string name="no_posts">"No se encontraron publicaciones"</string> <string name="no_comments">"No se encontraron comentarios"</string> @@ -88,6 +89,8 @@ <string name="comments">"Comentarios"</string> <string name="no_comments_yet">"No hay comentarios. ¿Escribimos uno?"</string> <string name="vote_failed">"Error al votar"</string> + + <!-- Ocurrió un error al actualizar la publicación --> <string name="refresh_post_failed">"Ocurrió un error al recargar la publicación"</string> <string name="load_messages_failed">"Ocurrió un error al cargar los comentarios. Toca para reintentar."</string> <string name="no_messages">"Vacío"</string> @@ -101,7 +104,9 @@ <string name="profile">"Perfil de usuario"</string> <string name="subscriptions">"Subscripciones"</string> <string name="multi_reddit">"Multireddit"</string> - <string name="inbox">"Inbox"</string> + + <!-- Bandeja de Entrada --> + <string name="inbox">"Bandeja de Entrada"</string> <string name="upvoted">"Votado a favor"</string> <string name="downvoted">"Votado en contra"</string> <string name="hidden">"Oculto"</string> @@ -117,14 +122,14 @@ <string name="subscribe">"Subscribirse"</string> <string name="unsubscribe">"Desuscribirse"</string> <string name="subscribed">"Suscrito"</string> - <string name="subscribe_failed">"Falló la subscripción"</string> + <string name="subscribe_failed">"Suscripción fallida"</string> <string name="unsubscribed">"Anulado"</string> <string name="unsubscribe_failed">"Falló la cancelación"</string> <string name="follow">"Seguir"</string> <string name="unfollow">"Dejar de seguir"</string> <string name="followed">"Siguiendo"</string> <string name="follow_failed">"Ocurrió un error al seguir"</string> - <string name="unfollowed">"Anulado"</string> + <string name="unfollowed">"Dejado de Seguir"</string> <string name="unfollow_failed">"Ocurrió un error anulando el seguimiento"</string> <string name="content_description_banner_imageview">"Imagen de portada del Subreddit"</string> <string name="app_label">"Infinity"</string> @@ -142,13 +147,13 @@ <string name="send_message_content_hint">"Mensaje"</string> <string name="reply_message_failed">"Ocurrió un error al responder"</string> <string name="error_getting_message">"Ocurrió un error obteniendo el mensaje"</string> - <string name="message_username_required">"Tu mensaje requiere un destinatario"</string> + <string name="message_username_required">"¿A quien quieres enviar este mensaje?"</string> <string name="message_subject_required">"Tu mensaje requiere un asunto"</string> <string name="message_content_required">"Tu mensaje requiere contenido"</string> <string name="sending_message">"Enviando"</string> <string name="send_message_success">"Mensaje enviado"</string> - <string name="send_message_failed">"Ocurrió un error. Mensaje no enviado"</string> - <string name="select_a_subreddit">"Selecciona un subreddit"</string> + <string name="send_message_failed">"No se pudo enviar el mensaje"</string> + <string name="select_a_subreddit">"Selecciona un subreddit primero"</string> <string name="title_required">"Se requiere un título"</string> <string name="link_required">"Se requiere un enlace"</string> <string name="select_an_image">"Selecciona una imagen"</string> @@ -203,17 +208,17 @@ <string name="sort_confidence">"Confianza"</string> <string name="sort_old">"Viejo"</string> <string name="sort_qa">"QA"</string> - <string name="sort_live">"En vivo"</string> + <string name="sort_live">"En directo"</string> <string name="sort_time_hour">"Hora"</string> <string name="sort_time_day">"Día"</string> <string name="sort_time_week">"Semana"</string> <string name="sort_time_month">"Mes"</string> <string name="sort_time_year">"Año"</string> <string name="sort_time_all_time">"Todo el tiempo"</string> - <string name="no_browser_found">"No se encontró un navegador..."</string> - <string name="no_activity_found_for_share">"No se encontró ninguna aplicación para compartir..."</string> - <string name="archived_post_vote_unavailable">"Publicación archivada. Votar no disponible."</string> - <string name="archived_post_comment_unavailable">"Publicación archivada. Comentar no disponible."</string> + <string name="no_browser_found">"No se encontró un navegador"</string> + <string name="no_activity_found_for_share">"No se encontró ninguna aplicación para compartir"</string> + <string name="archived_post_vote_unavailable">"Publicación archivada. Votar no está disponible"</string> + <string name="archived_post_comment_unavailable">"Publicación archivada. Comentar no está disponible "</string> <string name="archived_post_reply_unavailable">"Publicación archivada. Responder no disponible."</string> <string name="locked_post_comment_unavailable">"Publicación bloqueada. Comentar no disponible."</string> <string name="locked_post_reply_unavailable">"Publicación bloqueada. Responder no disponible."</string> @@ -235,42 +240,44 @@ <string name="login_first">"Primero inicia sesión"</string> <string name="post_saved_success">"Publicación guardada"</string> <string name="post_saved_failed">"Ocurrió un error al guardar la publicación"</string> - <string name="post_unsaved_success">"Publicación liberada"</string> + <string name="post_unsaved_success">"Publicación eliminada de guardados"</string> <string name="post_unsaved_failed">"Ocurrió un error al liberar la publicación"</string> <string name="post_hide_success">"Publicación ocultada"</string> <string name="post_hide_failed">"Ocurrió un error al ocultar la publicación"</string> - <string name="post_unhide_success">"Publicación ahora perceptible"</string> - <string name="thing_favorite_failed">"Ocurrió un error al intentar el favorito"</string> - <string name="thing_unfavorite_failed">"Ocurrió un error al remover el favorito"</string> - <string name="post_unhide_failed">"Ocurrió un error al remover \"oculto\" de la publicación"</string> + <string name="post_unhide_success">"Publicación ahora visible"</string> + <string name="thing_favorite_failed">"Ocurrió un error al intentar marcar como favorito"</string> + <string name="thing_unfavorite_failed">"Ocurrió un error al eliminar el favorito"</string> + <string name="post_unhide_failed">"Ocurrió un error al revelar la publicación"</string> <string name="delete_this_post">"Borrar esta publicación"</string> <string name="delete_this_comment">"Borrar este comentario"</string> <string name="are_you_sure">"¿Seguro?"</string> <string name="edit">"Editar"</string> <string name="delete">"Borrar"</string> - <string name="see_removed_comment">"Ver comentario removido"</string> + <string name="see_removed_comment">"Ver comentario eliminado"</string> <string name="fetching_removed_comment">"Obteniendo el comentario"</string> - <string name="show_removed_comment_failed">"No se ha encontrado el comentario"</string> - <string name="fetching_removed_post">"Obteniendo la publicación removida"</string> - <string name="show_removed_post_failed">"No se ha encontrado la publicación"</string> + <string name="show_removed_comment_failed">"No se ha encontrado el comentario eliminado"</string> + <string name="fetching_removed_post">"Obteniendo la publicación eliminada"</string> + <string name="show_removed_post_failed">"No se ha encontrado la publicación eliminada"</string> <string name="cancel">"Cancelar"</string> <string name="ok">"OK"</string> <!-- Fuzzy --> - <string name="edit_success">"Edición exitosa"</string> - <string name="delete_post_success">"Borrado exitoso"</string> - <string name="delete_post_failed">"Falló el borrado"</string> + <string name="edit_success">"Editado correctamente"</string> + <string name="delete_post_success">"Borrado correctamente"</string> + <string name="delete_post_failed">"Borrado fallido"</string> <!-- Fuzzy --> - <string name="mark_nsfw_success">"Marcar como NSFW exitoso"</string> - <string name="mark_nsfw_failed">"Falló el marcar como NSFW"</string> + <string name="mark_nsfw_success">"Marcado como NSFW correctamente"</string> + + <!-- Correcting the Sentence, from imperative to enunciated sentence --> + <string name="mark_nsfw_failed">"Fallo al marcar como NSFW"</string> <!-- Fuzzy --> <string name="unmark_nsfw_success">"Desmarcar como NSFW exitoso"</string> <string name="unmark_nsfw_failed">"Falló el desmarcar como NSFW"</string> <!-- Fuzzy --> - <string name="mark_spoiler_success">"Marcar como spoiler exitoso"</string> + <string name="mark_spoiler_success">"Marcar como spoiler e"</string> <string name="mark_spoiler_failed">"Falló el marcar como spoiler"</string> <!-- Fuzzy --> @@ -286,17 +293,20 @@ <string name="notification_summary_account">"Cuenta"</string> <string name="notification_summary_message">"Nuevo mensaje"</string> <string name="notification_summary_subreddit">"Subreddit"</string> - <string name="notification_summary_award">"Premio"</string> + + <!-- Galardón means award +Premio means prize, so it's better suited the first word instead of the second one --> + <string name="notification_summary_award">"Galardón"</string> <string name="notification_new_messages">"%1$d nuevos mensajes"</string> <string name="label_account">"Cuenta"</string> <string name="label_post">"Publicación"</string> <string name="label_preferences">"Preferencias"</string> - <string name="account_switched">"Cuenta cambiada."</string> + <string name="account_switched">"Cuenta cambiada. Las demás páginas han desaparecido."</string> <string name="settings_notification_master_title">"Notificación"</string> <string name="settings_notification_enable_notification_title">"Activar notificaciones"</string> <string name="settings_notification_interval_title">"Intervalo de Verificación de Notificaciones"</string> <string name="settings_theme_title">"Tema"</string> - <string name="settings_amoled_dark_title">"Oscuro OLED"</string> + <string name="settings_amoled_dark_title">"AMOLED Oscuro"</string> <string name="settings_interface_title">"Interfaz"</string> <string name="settings_gestures_and_buttons_title">"Gestos y Botones"</string> <string name="settings_save_front_page_scrolled_position_title">"Guardar Posición en INICIO"</string> @@ -304,8 +314,8 @@ <string name="settings_open_link_in_app_title">"Abrir enlaces dentro de la App"</string> <string name="settigns_video_title">"Vídeo"</string> <string name="settings_video_autoplay_title">"Reproducción automática de Vídeo"</string> - <string name="settings_mute_autoplaying_videos_title">"Silenciar Videos Automáticos"</string> - <string name="settings_autoplay_nsfw_videos_title">"Reproducir vídeos automáticamente que sean NSFW"</string> + <string name="settings_mute_autoplaying_videos_title">"Silenciar Videos reproducidos automáticamente"</string> + <string name="settings_autoplay_nsfw_videos_title">"Reproducir vídeos NSFW automáticamente"</string> <string name="settings_start_autoplay_visible_area_offset_portrait_title">"Reproducción Automática de Vídeo en Área Visible (Vertical)"</string> <string name="settings_start_autoplay_visible_area_offset_portrait_summary">"Comenzar la reproducción automática cuando %1$d%% del vídeo sea visible"</string> <string name="settings_start_autoplay_visible_area_offset_landscape_title">"Reproducción Automática de Vídeo en Área Visible (Horizontal)"</string> @@ -313,7 +323,7 @@ <string name="settings_immersive_interface_title">"Interfaz Inmersiva"</string> <!-- Fuzzy --> - <string name="settings_immersive_interface_summary">"No Aplica a Todas las Páginas Podría No Funcionar con Android 11"</string> + <string name="settings_immersive_interface_summary">"No Aplica a Todas las Páginas (Podría No Funcionar con Android 11)"</string> <string name="settings_immersive_interface_ignore_nav_bar_title">"Ignorar la Barra de Navegación en la Interfaz Inmersiva"</string> <string name="settings_immersive_interface_ignore_nav_bar_summary">"Bloquear la Barra de Navegación de Tener Margen Extra"</string> <string name="settings_customize_tabs_in_main_page_title">"Personalizar las Pestañas de la Página Principal"</string> @@ -324,7 +334,7 @@ <string name="settings_volume_keys_navigate_comments_title">"Usar las Teclas de Volumen para Navegar Comentarios en Publicaciones"</string> <string name="settings_volume_keys_navigate_posts_title">"Usar las Teclas de Volumen para Navegar Publicaciones"</string> <string name="settings_mute_video_title">"Silenciar Vídeos"</string> - <string name="settings_mute_nsfw_video_title">"Silenciar Vídeos que sean NSFW"</string> + <string name="settings_mute_nsfw_video_title">"Silenciar Vídeos NSFW"</string> <string name="settings_automatically_try_redgifs_title">"Abrir Vídeos en Redgifs Automáticamente Si No Están Disponibles en Gfycat."</string> <string name="settings_video_player_ignore_nav_bar_title">"Ignorar la Barra de Navegación en el Reproductor de Vídeo"</string> <string name="settings_video_player_ignore_nav_bar_summary">"Bloquear al Controlador de Vídeo Para que No Tenga Extra Margen"</string> @@ -355,20 +365,20 @@ <string name="settings_title_font_summary">"Título"</string> <string name="settings_content_font_summary">"Contenido"</string> <string name="settings_font_family_title">"Familia Fuente"</string> - <string name="settings_title_font_family_title">"Título de la Familia Fuente"</string> - <string name="settings_content_font_family_title">"Contenido de la Familia Fuente"</string> + <string name="settings_title_font_family_title">"Fuente del Titulo"</string> + <string name="settings_content_font_family_title">"Fuente del Contenido"</string> <string name="settings_font_size_title">"Tamaño de la Fuente"</string> - <string name="settings_title_font_size_title">"Tamaño del Título Fuente"</string> - <string name="settings_content_font_size_title">"Tamaño del Contenido Fuente"</string> + <string name="settings_title_font_size_title">"Tamaño del Título"</string> + <string name="settings_content_font_size_title">"Tamaño del Contenido"</string> <string name="settings_enable_nsfw_title">"Permitir NSFW"</string> <string name="settings_blur_nsfw_title">"Difuminar Imágenes con NSFW"</string> <string name="settings_blur_spoiler_title">"Difuminar Imágenes con Spoiler"</string> - <string name="settings_about_master_title">"Creditos"</string> + <string name="settings_about_master_title">"Sobre Infinity for Reddit"</string> <string name="settings_acknowledgement_master_title">"Reconocimientos"</string> <string name="settings_credits_master_title">"Creditos"</string> <string name="settings_credits_icon_foreground_title">"Ícono de Primer Plano"</string> <string name="settings_credits_icon_foreground_summary">"Tecnología de vector creada por freepik - www.freepik.com"</string> - <string name="settings_credits_icon_background_title">"Ícono de Segundo Plano"</string> + <string name="settings_credits_icon_background_title">"Icono de Fondo"</string> <string name="settings_credits_icon_background_summary">"Vector de fondo creado por Freepik - www.freepik.com"</string> <string name="settings_credits_error_image_title">"Imagen de Error"</string> <string name="settings_credits_error_image_summary">"Tecnología de vector creada por freepik - www.freepik.com"</string> @@ -400,7 +410,7 @@ <string name="settings_category_customization_title">"Personalización"</string> <string name="settings_customize_light_theme_title">"Tema Claro"</string> <string name="settings_customize_dark_theme_title">"Tema Oscuro"</string> - <string name="settings_customize_amoled_theme_title">"Tema OLED"</string> + <string name="settings_customize_amoled_theme_title">"Tema AMOLED"</string> <string name="settings_manage_themes_title">"Manejar Temas"</string> <string name="settings_custom_theme_cannot_apply_to_settings_page_summary">"Los temas no pueden ser aplicados a la página de configuración (a excepción de la barra de herramientas, la barra de estado y la barra de navegación)."</string> <string name="settings_advanced_master_title">"Avanzado"</string> @@ -423,8 +433,10 @@ <string name="no_developer_easter_egg">"No hay opciones de desarrollador aquí"</string> <string name="no_link_available">"Ocurrió un error al obtener el enlace"</string> <string name="exit_when_submit">"¿Salir?"</string> - <string name="exit_when_submit_post_detail">"La publicación aún será subida, incluso si sales ahora."</string> - <string name="exit_when_edit_post_detail">"La publicación podría llegar a ser subida, incluso si sales ahora."</string> + <string name="exit_when_submit_post_detail">"La publicación será subida, incluso si sales ahora."</string> + + <!-- The translation is repetitive, removed a word for clarifying, it is a literal translation from English --> + <string name="exit_when_edit_post_detail">"La publicación será subida, incluso si sales ahora."</string> <string name="exit_when_edit_comment_detail">"El comentario podría llegar a ser subido, incluso si sales ahora."</string> <string name="discard">"¿Descartar?"</string> <string name="discard_detail">"El borrador NO será guardado."</string> @@ -439,13 +451,15 @@ <string name="no_app">"No hay aplicación disponible"</string> <string name="comment_saved_success">"Comentario guardado"</string> <string name="comment_saved_failed">"Ocurrió un error al guardar el comentario"</string> - <string name="comment_unsaved_success">"Comentario liberado"</string> - <string name="comment_unsaved_failed">"Ocurrió un error al liberar el comentario"</string> + <string name="comment_unsaved_success">"Comentario eliminado de guardados"</string> + <string name="comment_unsaved_failed">"Ocurrió un error al eliminar el comentario de guardados"</string> <string name="favorites">"Favoritos"</string> <string name="all">"Todos"</string> <string name="post_layout_card">"Diseño de Tarjeta"</string> <string name="post_layout_compact">"Diseño Compacto"</string> - <string name="elapsed_time_just_now">"Justo Ahora"</string> + + <!-- It is a literal translation from English, translating for clarity --> + <string name="elapsed_time_just_now">"Ahora mismo"</string> <string name="elapsed_time_a_minute_ago">"Hace 1 Minuto"</string> <string name="elapsed_time_minutes_ago">"Hace %1$d minutos"</string> <string name="elapsed_time_an_hour_ago">"Hace 1 hora"</string> @@ -479,7 +493,9 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="copy_markdown">"Copiar usando Markdown"</string> <string name="copy_raw_text">"Copiar Texto Fuente"</string> <string name="copy_all_markdown">"Copiar Todo usando Markdown"</string> - <string name="copy_all_raw_text">"Copiar Todo Texto Fuente"</string> + + <!-- Raw text is without format, so since in Spanish there is no translation aplicable for Raw (Except for food) it is redone --> + <string name="copy_all_raw_text">"Copiar todo el texto sin formato"</string> <string name="exit_app">"¿Salir?"</string> <string name="light_theme">"Tema Claro"</string> <string name="dark_theme">"Tema Oscuro"</string> @@ -492,8 +508,8 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="duplicate_multi_reddit">"Este multireddit ya existe"</string> <string name="edit_multi_reddit_failed">"Ocurrió un error al editar el multireddit"</string> <string name="logged_out">"Sesión cerrada"</string> - <string name="delete_multi_reddit_success">"Borrado exitoso"</string> - <string name="delete_multi_reddit_failed">"Falló el borrado"</string> + <string name="delete_multi_reddit_success">"Borrado satisfactoriamente"</string> + <string name="delete_multi_reddit_failed">"Borrado fallido"</string> <string name="delete_multi_reddit_dialog_message">"¿Seguro?"</string> <string name="enable_nsfw">"Activar NSFW"</string> <string name="disable_nsfw">"Desactivar NSFW"</string> @@ -505,7 +521,7 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="theme_name_description">"Toca para cambiar el nombre del tema"</string> <string name="theme_item_is_light_theme">"Establecer como Tema Claro"</string> <string name="theme_item_is_dark_theme">"Establecer como Tema Oscuro"</string> - <string name="theme_item_is_amoled_theme">"Establecer como Tema OLED"</string> + <string name="theme_item_is_amoled_theme">"Establecer como Tema AMOLED"</string> <string name="theme_item_color_primary">"Color Primario"</string> <string name="theme_item_color_primary_detail">"Aplicado a: Barra de Herramientas"</string> <string name="theme_item_color_primary_dark">"Color Oscuro Primario"</string> @@ -634,8 +650,6 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="theme_item_unread_message_background_color_detail">"Aplicado a: Fondo de Mensaje No Leído"</string> <string name="theme_item_divider_color">"Color de Barra Divisora"</string> <string name="theme_item_divider_color_detail">"Aplicado a: Divisor de comentarios, divisor en páginas para publicar, etc."</string> - <string name="theme_item_no_preview_post_type_background_color">"Color de Enlace Sin Vista Previa"</string> - <string name="theme_item_no_preview_post_type_background_color_detail">"Aplicado a: Lugar de Enlace Sin Vista Previa"</string> <string name="theme_item_vote_and_reply_unavailable_button_color">"Color de Voto No Disponible"</string> <string name="theme_item_vote_and_reply_unavailable_button_color_detail">"Aplicado a: Botones de voto y respuesta (No Disponible)"</string> <string name="theme_item_comment_vertical_bar_color_1">"Color 1 de la Barra Vertical de Comentario"</string> @@ -782,4 +796,82 @@ Ejemplo: contraseña:123456"</string> <string name="block_user">"Bloquear usuario"</string> <string name="block_user_success">"Bloqueado"</string> <string name="block_user_failed">"Ocurrió un error al bloquear al usuario"</string> + <string name="give_award_activity_label">"Dar premio"</string> + <string name="action_select_user_flair">"Seleccione categoría de usuario"</string> + <string name="action_give_award">"Dar premio"</string> + <string name="posts">"Publicaciones"</string> + <string name="sidebar">"Barra lateral"</string> + <string name="only_for_logged_in_user">"Solo para usuarios registrados"</string> + <string name="settings_number_of_columns_in_post_feed_title">"El número de columnas en el feed de publicaciones"</string> + <string name="settings_number_of_columns_in_post_feed_portrait_title">"Vertical"</string> + <string name="settings_number_of_columns_in_post_feed_landscape_title">"Horizontal"</string> + <string name="settings_nsfw_and_spoiler_title">"NSFW y revelaciones"</string> + <string name="settings_delete_all_legacy_settings_title">"Borrar todos los ajustes de legado"</string> + <string name="restart_app_see_changes">"Reinicie la app para ver cambios"</string> + <string name="settings_tab_count">"Número de tabs"</string> + <string name="settings_show_tab_names">"Mostrar nombres de las categorías"</string> + <string name="settings_more_tabs_summary">"Más categorías"</string> + <string name="settings_more_tabs_show_favorite_subscribed_subreddits_title">"Mostrar Subreddits favoritos, suscritos"</string> + <string name="settings_more_tabs_show_subscribed_subreddits_title">"Mostrar Subreddits suscritos"</string> + <string name="settings_download_location_title">"Ubicación de descarga"</string> + <string name="settings_image_download_location_title">"Ubicación de descarga de imágenes"</string> + <string name="settings_gif_download_location_title">"Ubicación de descarga de Gifs"</string> + <string name="settings_video_download_location_title">"Ubicación de descarga de vídeos"</string> + <string name="settings_separate_folder_for_each_subreddit">"Carpetas distintas para cada Subreddit"</string> + <string name="settings_swipe_action_title">"Acción de deslizó"</string> + <string name="settings_disable_swiping_between_tabs_title">"Desabilitar el deslizar entre categorías"</string> + <string name="settings_enable_swipe_action_title">"Activar opción para deslizar"</string> + <string name="settings_pull_to_refresh_title">"Jale para refrescar"</string> + <string name="settings_security_title">"Seguridad"</string> + <string name="settings_main_activity_bottom_app_bar_group_summary">"Página principal"</string> + <string name="settings_other_activities_bottom_app_bar_group_summary">"Otras páginas"</string> + <string name="settings_bottom_app_bar_option_1">"Opción 1"</string> + <string name="settings_bottom_app_bar_option_2">"Opción 2"</string> + <string name="settings_bottom_app_bar_option_3">"Opción 3"</string> + <string name="settings_bottom_app_bar_option_4">"Opción 4"</string> + <string name="settings_bottom_app_bar_fab">"Botón de acción, flotante"</string> + <string name="settings_data_saving_mode">"Modo de ahorro de datos"</string> + + <!-- Fuzzy --> + <string name="settings_data_saving_mode_info_summary">"En modo de ahorro de datos: +Imágenes previsualizadas están en menor resolución +Videos de Reddit están en menor resolución"</string> + <string name="settings_translation_title">"Traducción"</string> + <string name="settings_translation_summary">"Traduzca esta app en POEditor. Grácias a todos los contribuyentes."</string> + <string name="select_header_size">"Seleccionar tamaño de encabezado"</string> + <string name="large">"Grande"</string> + <string name="small">"Pequeño"</string> + <string name="insert_link">"Inserte el enlace"</string> + <string name="text_hint">"Texto"</string> + <string name="link_hint">"Enlace"</string> + <string name="unlock_account_section">"Desbloquear sección de cuenta"</string> + <string name="unlock">"Desbloquear"</string> + <string name="submit_post">"Enviar publicación"</string> + <string name="refresh">"Refrescar"</string> + <string name="change_sort_type">"Cambiar modo de organización"</string> + <string name="change_post_layout">"Cambiar organización de las publicaciones"</string> + <string name="give_award_dialog_title">"Dar premio?"</string> + <string name="anonymous">"Anónimo"</string> + <string name="give_award_success">"Premio entregado"</string> + <string name="give_award_failed">"Falló"</string> + <string name="recent_searches">"Búsquedas recientes"</string> + <string name="warning">"Precaución"</string> + <string name="this_is_a_nsfw_subreddit">"Este es un Subreddit NSFW"</string> + <string name="this_user_has_nsfw_content">"Este usuario tiene contenido NSFW"</string> + <string name="dismiss">"Descartar"</string> + <string name="leave">"Salir"</string> + <string name="go_to_subreddit">"Ir al Subreddit"</string> + <string name="go_to_user">"Ir al usuario"</string> + <string name="go_to_thing_hint">"Nombre"</string> + <string name="random">"Aleatorio"</string> + <string name="random_subreddit">"Subreddit aleatorio"</string> + <string name="random_nsfw_subreddit">"Subreddit NSFW aleatorio"</string> + <string name="random_post">"Publicación aleatoria"</string> + <string name="random_nsfw_post">"Publicación NSFW aleatoria"</string> + <string name="fetch_random_thing_failed">"Intente de nuevo luego"</string> + <string name="downloading">"Descargando"</string> + <string name="subreddit_filter_popular_and_all_activity_label">"r/all y r/popular"</string> + <string name="settings_miscellaneous_title">"Misceláneo"</string> + <string name="settings_post_filter_title">"Filtrar"</string> + <string name="select_video_quality">"Seleccione calidad del video"</string> </resources>
\ No newline at end of file diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 554cbb1c..24a5fbcf 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -2,34 +2,34 @@ <resources> <string name="login_activity_label">"Se Connecter"</string> <string name="search_activity_label">"Rechercher"</string> - <string name="comment_activity_label">"Envoyer le Commentaire"</string> + <string name="comment_activity_label">"Envoyer le commentaire"</string> <string name="comment_activity_label_is_replying">"Répondre"</string> - <string name="post_text_activity_label">"Poster du Texte"</string> - <string name="subreddit_selection_activity_label">"Selectionner un Subreddit"</string> - <string name="post_link_activity_label">"Poster un Lien"</string> - <string name="post_image_activity_label">"Poster une Image"</string> - <string name="post_video_activity_label">"Poster une Vidéo"</string> + <string name="post_text_activity_label">"Poster du texte"</string> + <string name="subreddit_selection_activity_label">"Sélectionner un subreddit"</string> + <string name="post_link_activity_label">"Poster un lien"</string> + <string name="post_image_activity_label">"Poster une image"</string> + <string name="post_video_activity_label">"Poster une vidéo"</string> <string name="rules_activity_label">"Règles"</string> <!-- Everyone in france uses the english word for subreddits --> <string name="search_subreddits_activity_label">"Subreddits"</string> - <string name="edit_post_activity_label">"Éditer le Poste"</string> - <string name="edit_comment_activity_label">"Éditer le Commentaire"</string> - <string name="view_message_activity_label">"Boîte de Réception"</string> + <string name="edit_post_activity_label">"Éditer le post"</string> + <string name="edit_comment_activity_label">"Éditer le commentaire"</string> + <string name="view_message_activity_label">"Boîte de réception"</string> <string name="settings_activity_label">"Paramètres"</string> - <string name="account_saved_thing_activity_label">"Sauvgardé"</string> - <string name="create_multi_reddit_activity_label">"Créer un Multireddit"</string> - <string name="subreddit_multiselection_activity_label">"Sélectionner des Sous-reddits"</string> - <string name="custom_theme_listing_activity_label">"Thèmes Personnalisés"</string> - <string name="customize_theme_activity_label">"Personnaliser le Thème"</string> + <string name="account_saved_thing_activity_label">"Sauvegardé"</string> + <string name="create_multi_reddit_activity_label">"Créer un multireddit"</string> + <string name="subreddit_multiselection_activity_label">"Sélectionner les subreddits"</string> + <string name="custom_theme_listing_activity_label">"Thèmes personnalisés"</string> + <string name="customize_theme_activity_label">"Personnaliser le thème"</string> <string name="customize_theme_activity_create_theme_label">"Créer un Thème"</string> <string name="theme_preview_activity_label">"Prévisualiser le Thème"</string> <string name="edit_multi_reddit_activity_label">"Éditer le Multireddit"</string> <string name="selected_subeddits_activity_label">"Subreddits Sélectionnés"</string> - <string name="report_activity_label">"Reporter"</string> + <string name="report_activity_label">"Signaler"</string> <string name="view_imgur_media_activity_image_label">"Image %1$d/%2$d"</string> <string name="view_imgur_media_activity_video_label">"Vidéo %1$d/%2$d"</string> - <string name="send_private_message_activity_label">"Envoyer un Message Privé"</string> + <string name="send_private_message_activity_label">"Envoyer un message privé"</string> <string name="view_reddit_gallery_activity_image_label">"Image %1$d/%2$d"</string> <string name="view_reddit_gallery_activity_gif_label">"Gif %1$d/%2$d"</string> <string name="view_reddit_gallery_activity_video_label">"Vidéo %1$d/%2$d"</string> @@ -46,14 +46,14 @@ <string name="action_search">"Rechercher"</string> <!-- Fuzzy --> - <string name="action_start_lazy_mode">"Commencer le Mode Paresseux"</string> + <string name="action_start_lazy_mode">"Lancer le mode automatique "</string> <!-- Fuzzy --> - <string name="action_stop_lazy_mode">"Arrêter le Mode Paresseux"</string> + <string name="action_stop_lazy_mode">"Arrêter le mode automatique"</string> <string name="action_send">"Envoyer"</string> <string name="action_sort">"Trier"</string> - <string name="action_hide_post">"Masquer la Publication"</string> - <string name="action_unhide_post">"Afficher la Publication"</string> + <string name="action_hide_post">"Masquer la publication"</string> + <string name="action_unhide_post">"Afficher la publication"</string> <string name="action_edit_post">"Éditer la Publication"</string> <string name="action_delete_post">"Supprimer la Publication"</string> <string name="action_mark_nsfw">"Marquer comme NSFW"</string> @@ -66,7 +66,7 @@ <string name="action_unmark_spoiler">"Annuler la Marque Spoiler"</string> <string name="action_edit_flair">"Éditer le Flair"</string> <string name="action_change_post_layout">"Modifier la Mise en Page des Publications"</string> - <string name="action_save">"Sauvgarder"</string> + <string name="action_save">"Sauvegarder"</string> <string name="action_edit_multi_reddit">"Éditer le Multireddit"</string> <string name="action_delete_multi_reddit">"Supprimer le Multireddit"</string> <string name="action_share">"Partager"</string> @@ -106,14 +106,14 @@ <string name="karma_info">"Karma: %1$d"</string> <string name="karma_info_user_detail">"Karma: %1$d (%2$d + %3$d)"</string> - <string name="cakeday_info">"Jour du gâteau: %1$s"</string> + <string name="cakeday_info">"Jour de création du compte: %1$s"</string> <string name="since">"Depuis"</string> <string name="profile">"Profil"</string> <string name="subscriptions">"Abonnements"</string> <string name="multi_reddit">"Multireddit"</string> <string name="inbox">"Boîte de Réception"</string> - <string name="upvoted">"Votée pour"</string> - <string name="downvoted">"Votée contre"</string> + <string name="upvoted">"Voté pour"</string> + <string name="downvoted">"Voté contre"</string> <string name="hidden">"Masquée"</string> <string name="saved">"Enregistrée"</string> <string name="gilded">"Dorée"</string> @@ -683,8 +683,6 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="theme_item_unread_message_background_color_detail">"S'applique à: Couleur d'arrière-plan des messages non lus"</string> <string name="theme_item_divider_color">"Couleur du séparateur"</string> <string name="theme_item_divider_color_detail">"S'applique à: Séparateur de commentaires, séparateurs dans les pages pour la soumission de publications, etc."</string> - <string name="theme_item_no_preview_post_type_background_color">"Couleur d'arrière-plan du lien sans aperçu"</string> - <string name="theme_item_no_preview_post_type_background_color_detail">"S'applique à: espace réservé du lien sans aperçu"</string> <string name="theme_item_vote_and_reply_unavailable_button_color">"Couleur des boutons Voter et Répondre indisponibles"</string> <string name="theme_item_vote_and_reply_unavailable_button_color_detail">"S'applique à: Boutons Voter et Répondre (indisponibles)"</string> <string name="theme_item_comment_vertical_bar_color_1">"Couleur 1 de la barre verticale de commentaire"</string> @@ -708,11 +706,11 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="theme_item_light_status_bar">"Couleur de l'icône de la barre d'état sombre"</string> <string name="theme_item_light_nav_bar">"Couleur de l'icône de la barre de navigation sombre"</string> <string name="theme_item_change_status_bar_icon_color_after_toolbar_collapsed_in_immersive_interface">"Modifier la couleur de l'icône de la barre d'état après la réduction de la barre d'outils dans l'interface immersive"</string> - <string name="theme_item_available_on_android_8">"Seulement disponible pour Android 8.0 ou supérieur"</string> - <string name="theme_item_available_on_android_6">"Seulement disponible pour Android 6.0 ou supérieur"</string> + <string name="theme_item_available_on_android_8">"Seulement disponible pour Android 8.0 ou versions ultérieures"</string> + <string name="theme_item_available_on_android_6">"Seulement disponible pour Android 6.0 ou versions ultérieures"</string> <string name="predefined_themes">"Thèmes prédéfinis"</string> <string name="user_themes">"Vos thèmes"</string> - <string name="no_theme_name">"Quels est le noms de ce thème ?"</string> + <string name="no_theme_name">"Quel est le nom de ce thème ?"</string> <string name="theme_name_hint">"Nom du thème"</string> <string name="theme_name_indigo">"Indigo"</string> <string name="theme_name_indigo_dark">"Indigo sombre"</string> @@ -724,7 +722,7 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="theme_name_red_dark">"Rouge sombre"</string> <string name="theme_name_red_amoled">"Amoled rouge"</string> <string name="theme_name_dracula">"Dracula"</string> - <string name="theme_name_calm_pastel">"Pastelle calme"</string> + <string name="theme_name_calm_pastel">"Pastel calme"</string> <string name="create_light_theme">"Créer un thème clair Basé sur le thème Indigo"</string> <string name="create_dark_theme">"Créer un thème sombre @@ -736,15 +734,15 @@ Basé sur le thème sombre Indigo"</string> <string name="delete_theme">"Supprimer le thème"</string> <string name="delete_theme_dialog_message">"Êtes-vous sûr de vouloir supprimer %1$s?"</string> <string name="share_theme">"Partager le thème"</string> - <string name="change_theme_name">"Changer le nom"</string> - <string name="theme_copied">"Copié ! Collé et partagez le à d'autres personnes"</string> - <string name="copy_theme_faied">"Ne peut pas copier la configuration du thème"</string> - <string name="cannot_find_theme">"Ne peut pas trouver ce thème"</string> + <string name="change_theme_name">"Changer le nom du thème"</string> + <string name="theme_copied">"Copié ! Collez et partagez le à d'autres personnes"</string> + <string name="copy_theme_faied">"Impossible de copier la configuration du thème"</string> + <string name="cannot_find_theme">"Impossible de trouver ce thème"</string> <string name="import_theme">"Importer un thème"</string> - <string name="no_data_in_clipboard">"Ne peut pas trouver les données dans le presse-papiers"</string> + <string name="no_data_in_clipboard">"Il n'y-a pas de données dans le presse-papiers"</string> <!-- Fuzzy --> - <string name="import_theme_success">"Thème importé réussi"</string> + <string name="import_theme_success">"Réussite de l'import du thème"</string> <string name="parse_theme_failed">"Erreur de syntaxe du thème"</string> <string name="duplicate_theme_name_dialog_title">"Thème dupliqué trouvé"</string> <string name="duplicate_theme_name_dialog_message">"Un thème dans la base de données est également appelé %1$s. Voulez-vous changer le nom du thème importé?"</string> @@ -752,11 +750,7 @@ Basé sur le thème sombre Indigo"</string> <string name="override">"Remplacer"</string> <string name="color_picker">"Sélecteur de couleurs"</string> <string name="invalid_color">"Couleur invalide"</string> - - <!-- Fuzzy --> <string name="delete_all_subreddits_success">"Suppression de tous les subreddits réussie"</string> - - <!-- Fuzzy --> <string name="delete_all_users_success">"Suppression de tous les utilisateurs réussie"</string> <!-- Fuzzy --> @@ -778,7 +772,7 @@ Basé sur le thème sombre Indigo"</string> <string name="primary_text_preview">"Texte principal"</string> <string name="secondary_text_preview">"Texte secondaire"</string> <string name="post_title_preview">"C'est une publication"</string> - <string name="post_content_preview">"C'est blague sur la gravité devient vieille, mais je craque à chaque fois"</string> + <string name="post_content_preview">"Cette blague sur la gravité est vieille, mais elle attire les rires. "</string> <!-- "Publication" is probably the most accurate translation but it seems it's too long... --> <string name="post_type_preview">"POST"</string> @@ -788,20 +782,20 @@ Basé sur le thème sombre Indigo"</string> <!-- A completely different joke --> <string name="comment_content_preview">"C’est l’histoire de deux pommes de terre. Une d’elles se fait écraser et l’autre s’écrie “Oh purée !”"</string> - <string name="edit_multi_reddit">"Éditer multireddit"</string> - <string name="delete_multi_reddit">"Supprimer multireddit"</string> - <string name="n_awards">"%1$d Awards"</string> + <string name="edit_multi_reddit">"Éditer le multireddit"</string> + <string name="delete_multi_reddit">"Supprimer le multireddit"</string> + <string name="n_awards">"%1$d récompenses"</string> <string name="one_award">"Une récompense"</string> <string name="report">"Signaler"</string> <!-- Not sure about the tense.. --> - <string name="reporting">"Signalé"</string> + <string name="reporting">"Signalement en cours"</string> <string name="report_successful">"Signalé"</string> <string name="report_failed">"Signalement échoué"</string> - <string name="report_reason_not_selected">"Vous n'avez pas sélectionné de raison"</string> + <string name="report_reason_not_selected">"Vous n'avez pas sélectionné de motif"</string> <string name="report_reason_general_spam">"C'est du spam"</string> <string name="report_reason_general_copyright_issue">"Ça contient des problèmes de droits d'auteur"</string> - <string name="report_reason_general_child_pornography">"Ça contient de la pedopornographie"</string> + <string name="report_reason_general_child_pornography">"Ça contient de la pédopornographie"</string> <string name="report_reason_general_abusive_content">"Ça contient du contenu abusif"</string> <string name="home">"Accueil"</string> <string name="popular">"Populaire"</string> @@ -810,12 +804,12 @@ Basé sur le thème sombre Indigo"</string> <string name="message">"Message"</string> <string name="fetch_gfycat_video_failed">"Échec de la récupération de la vidéo Gfycat"</string> <string name="fetch_redgifs_video_failed">"Échec de la récupération de la vidéo Redgifs"</string> - <string name="fetching_video_info_please_wait">"Récupération des informations vidéo. Patientez."</string> - <string name="error_fetching_imgur_media">"Ne peut pas charger les images"</string> + <string name="fetching_video_info_please_wait">"Récupération des informations vidéo. Veuillez patienter. "</string> + <string name="error_fetching_imgur_media">"Impossible de charger les images"</string> <string name="downloading_reddit_video">"Téléchargement de la piste vidéo"</string> <string name="downloading_reddit_video_audio_track">"Téléchargement de la piste audio"</string> - <string name="downloading_reddit_video_muxing">"Muxage vidéo et audio"</string> - <string name="downloading_reddit_video_save_file_to_public_dir">"Téléchargement de la vidéo"</string> + <string name="downloading_reddit_video_muxing">"Multiplexage vidéo et audio"</string> + <string name="downloading_reddit_video_save_file_to_public_dir">"Enregistrement de la vidéo"</string> <string name="downloading_reddit_video_finished">"Téléchargé"</string> <!-- Fuzzy --> @@ -823,12 +817,12 @@ Basé sur le thème sombre Indigo"</string> <string name="downloading_reddit_video_failed_cannot_download_video">"Échec du téléchargement: impossible de télécharger la vidéo"</string> <string name="downloading_reddit_video_failed_cannot_save_video">"Échec du téléchargement: impossible d'enregistrer la vidéo dans le répertoire de cache"</string> <string name="downloading_reddit_video_failed_cannot_save_audio">"Échec du téléchargement: impossible d'enregistrer l'audio dans le répertoire de cache"</string> - <string name="downloading_reddit_video_failed_cannot_mux">"Échec du téléchargement: impossible de muxer la vidéo et l'audio"</string> + <string name="downloading_reddit_video_failed_cannot_mux">"Échec du téléchargement: impossible de multiplexer la vidéo et l'audio"</string> <string name="downloading_reddit_video_failed_cannot_save_mux_video">"Échec du téléchargement: impossible d'enregistrer la vidéo dans le répertoire public"</string> <string name="wallpaper_set">"Fond d'écran défini"</string> - <string name="error_set_wallpaper">"Ne peut pas définir le fond d'écran"</string> - <string name="set_to_home_screen">"Définir en écran d'accueil"</string> - <string name="set_to_lock_screen">"Définir en écran de verrouillage"</string> + <string name="error_set_wallpaper">"Impossible de définir le fond d'écran"</string> + <string name="set_to_home_screen">"Ajouter à l'écran d'accueil"</string> + <string name="set_to_lock_screen">"Ajouter à l'écran de verrouillage"</string> <string name="set_to_both">"Définir pour les deux"</string> <string name="default_font_font_preview">"Par défaut"</string> <string name="load_video_in_redgifs">"Essayez de charger la vidéo sur Redgifs"</string> @@ -837,5 +831,108 @@ Basé sur le thème sombre Indigo"</string> Exemple: motdepasse: 123456"</string> <string name="block_user">"Bloquer l'utilisateur"</string> <string name="block_user_success">"Bloqué"</string> - <string name="block_user_failed">"Échoué à bloquer l'utilisateur"</string> + <string name="block_user_failed">"Impossible de bloquer l'utilisateur"</string> + <string name="submit_crosspost_activity_label">"Crosspost"</string> + <string name="give_award_activity_label">"Récompenser"</string> + <string name="action_crosspost">"Crosspost"</string> + <string name="action_select_user_flair">"Sélectionner un flair d'utilisateur"</string> + <string name="action_give_award">"Récompenser"</string> + <string name="posts">"Posts"</string> + <string name="sidebar">"Barre latérale"</string> + <string name="only_for_logged_in_user">"Seulement pour Les utilisateurs connectés"</string> + <string name="settings_number_of_columns_in_post_feed_title">"Nombre de colonnes dans le flux"</string> + <string name="settings_number_of_columns_in_post_feed_portrait_title">"Portrait"</string> + <string name="settings_number_of_columns_in_post_feed_landscape_title">"Paysage"</string> + <string name="settings_nsfw_and_spoiler_title">"PSPT & Divulgacher"</string> + <string name="settings_delete_all_legacy_settings_title">"Supprimer tout les anciens réglages"</string> + <string name="restart_app_see_changes">"Redémarrer l'application pour voir les changements"</string> + <string name="settings_tab_count">"Nombre d'onglets"</string> + <string name="settings_show_tab_names">"Montrer le nom des onglets"</string> + <string name="settings_more_tabs_summary">"Plus d'onglets"</string> + <string name="settings_more_tabs_info_summary">"Activer les options suivantes va causer un comportement inattendu: +Les onglets pourraient perdre tout leur contenu quand vous passez d'un onglet à l'autre, de même quand vous rafraîchissez les onglets"</string> + <string name="settings_more_tabs_show_favorite_subscribed_subreddits_title">"Montrer les Subreddits favoris suivis"</string> + <string name="settings_more_tabs_show_subscribed_subreddits_title">"Montrer les Subreddits suivis"</string> + <string name="settings_download_location_title">"Chemin du téléchargement"</string> + <string name="settings_image_download_location_title">"Chemin du téléchargement d'image"</string> + <string name="settings_gif_download_location_title">"Chemin du téléchargement de Gif"</string> + <string name="settings_video_download_location_title">"Chemin du téléchargement de vidéos"</string> + <string name="settings_separate_folder_for_each_subreddit">"Dossier séparé pour chaque Subreddit"</string> + <string name="settings_swipe_action_title">"Action de swipe"</string> + <string name="settings_disable_swiping_between_tabs_title">"Désactiver le swiping entre les onglets"</string> + <string name="settings_enable_swipe_action_title">"Activer l'action de swipe"</string> + <string name="settings_swipe_action_threshold">"Seuil"</string> + <string name="settings_pull_to_refresh_title">"Tirer pour rafraîchir"</string> + <string name="settings_security_title">"Sécurité"</string> + <string name="settings_require_authentication_to_go_to_account_section_in_navigation_drawer_title">"Requérir une authentification pour accéder à la section \"compte\" dans le tiroir de navigation "</string> + <string name="settings_long_press_to_hide_toolbar_in_compact_layout_title">"Appuyer longuement pour cacher la barre d'outils dans la disposition \"compacte\""</string> + <string name="settings_post_compact_layout_toolbar_hidden_by_default_title">"Cacher la barre d'outil par défaut dans la disposition \"compacte\" "</string> + <string name="settings_customize_bottom_app_bar_title">"Personnaliser la barre de navigation inférieure"</string> + <string name="settings_main_activity_bottom_app_bar_group_summary">"Page Principale"</string> + <string name="settings_other_activities_bottom_app_bar_group_summary">"Autres pages"</string> + <string name="settings_bottom_app_bar_option_count">"Nombre d'options"</string> + <string name="settings_bottom_app_bar_option_1">"Option 1"</string> + <string name="settings_bottom_app_bar_option_2">"Option 2"</string> + <string name="settings_bottom_app_bar_option_3">"Option 3"</string> + <string name="settings_bottom_app_bar_option_4">"Option 4"</string> + <string name="settings_bottom_app_bar_fab">"Action du bouton flottant"</string> + <string name="settings_data_saving_mode">"Mode économie de données"</string> + + <!-- Fuzzy --> + <string name="settings_data_saving_mode_info_summary">"Dans le mode économie de données, les aperçus d'image et les vidéos sont en plus petite résolution "</string> + <string name="settings_translation_title">"Traduction"</string> + <string name="settings_translation_summary">"Traduire cette application dans POEditor. Merci à tous-tes les contributeurs-euses."</string> + <string name="settings_credits_national_flags">"Drapeaux nationaux"</string> + <string name="settings_credits_national_flags_summary">"Icône réalisée par Freepik de www.flaticon.com"</string> + <string name="copy_failed">"Échec de la copie"</string> + <string name="delete_all_legacy_settings_success">"Suppression des anciens paramètres avec succès"</string> + <string name="downloading_media_finished">"Téléchargé"</string> + <string name="downloading_image_or_gif_failed_cannot_get_destination_directory">"Échec du téléchargement: ne peut pas accéder au répertoire de la destination"</string> + <string name="downloading_media_failed_cannot_download_media">"Échec du téléchargement"</string> + <string name="downloading_media_failed_cannot_save_to_destination_directory">"Échec du téléchargement: ne peut pas sauvegarder le fichier dans le répertoire de destination"</string> + <string name="view_full_comment_markdown">"Voir le formatage complet"</string> + <string name="select_user_flair_success">"Flair sélectionné"</string> + <string name="select_this_user_flair">"Sélectionner ce flair ? "</string> + <string name="select_header_size">"Sélectionner la taille de l'en-tête"</string> + <string name="large">"Grand"</string> + <string name="small">"Petit"</string> + <string name="insert_link">"Insérer un lien"</string> + <string name="text_hint">"Texte"</string> + <string name="link_hint">"Lien"</string> + <string name="unlock_account_section">"Débloquer la section du compte"</string> + <string name="unlock">"Débloquer"</string> + <string name="submit_post">"Soumettre le post"</string> + <string name="refresh">"Rafraîchir"</string> + <string name="change_sort_type">"Changer l'ordre de tri"</string> + <string name="change_post_layout">"Changer la disposition des posts"</string> + <string name="give_award_dialog_title">"Êtes-vous sûr de vouloir récompenser ce post ? "</string> + <string name="anonymous">"Anonyme"</string> + <string name="give_award_error_message">"Erreur: %2$s, code: %1$d/"</string> + <string name="give_award_success">"Succès ! "</string> + <string name="give_award_failed">"Échec de la récompense. "</string> + <string name="recent_searches">"Recherches récentes"</string> + <string name="warning">"Avertissement "</string> + <string name="this_is_a_nsfw_subreddit">"Cette Subreddit est PSPT (Pas Sécurisé Pour le Travail) "</string> + <string name="this_user_has_nsfw_content">"Cet utilisateur poste du contenu NSFW"</string> + <string name="dismiss">"Annuler"</string> + <string name="leave">"Quitter"</string> + <string name="go_to_subreddit">"Aller au subreddit"</string> + <string name="go_to_user">"Aller à l'utilisateur"</string> + <string name="go_to_thing_hint">"Nom"</string> + <string name="random">"Aléatoire"</string> + <string name="random_subreddit">"Subreddit aléatoire"</string> + <string name="random_nsfw_subreddit">"Subreddit NSFW aléatoire"</string> + <string name="random_post">"Post aléatoire"</string> + <string name="random_nsfw_post">"Post NSFW aléatoire"</string> + <string name="fetch_random_thing_failed">"Réessayer plus-tard"</string> + <string name="downloading">"Téléchargement"</string> + <string name="subreddit_filter_popular_and_all_activity_label">"r/all et r/popular"</string> + <string name="settings_miscellaneous_title">"Divers"</string> + <string name="settings_respect_subreddit_recommended_comment_sort_type_title">"Respecter l'ordre de tri recommandé par le subreddit pour les commentaires "</string> + <string name="settings_respect_subreddit_recommended_comment_sort_type_summary">"L'ordre de tri des commentaires ne sera pas sauvegardé "</string> + <string name="settings_post_filter_title">"Filtre"</string> + <string name="settings_subreddit_filter_category">"Cacher des Subreddits"</string> + <string name="settings_subreddit_filter_popular_and_all">"Dans r/popular et r/all"</string> + <string name="settings_credits_ufo_capturing_animation_title">"Animation de capture de l'OVNI"</string> + <string name="select_video_quality">"Sélectionner la qualité vidéo"</string> </resources>
\ No newline at end of file diff --git a/app/src/main/res/values-hi/strings.xml b/app/src/main/res/values-hi/strings.xml index de24898c..158888e1 100644 --- a/app/src/main/res/values-hi/strings.xml +++ b/app/src/main/res/values-hi/strings.xml @@ -2,9 +2,9 @@ <resources> <string name="login_activity_label">"लाॅग इन करें"</string> <string name="search_activity_label">"खोजें"</string> - <string name="comment_activity_label">"टिप्पणी भेजें"</string> + <string name="comment_activity_label">"टिप्पणी करें "</string> <string name="comment_activity_label_is_replying">"उत्तर दें"</string> - <string name="post_text_activity_label">"लिखित पोस्ट"</string> + <string name="post_text_activity_label">"टैक्स्ट पोस्ट"</string> <string name="subreddit_selection_activity_label">"एक सबरैडिट चुनें"</string> <string name="post_link_activity_label">"लिंक पोस्ट"</string> <string name="post_image_activity_label">"चित्र पोस्ट"</string> @@ -23,13 +23,13 @@ <string name="customize_theme_activity_create_theme_label">"थीम बनाएँ"</string> <string name="theme_preview_activity_label">"थीम पूर्वदर्शन करें"</string> <string name="edit_multi_reddit_activity_label">"मल्टीरैडिट सम्पादित करें"</string> - <string name="selected_subeddits_activity_label">"चुने हुई सबरैडिट्स"</string> + <string name="selected_subeddits_activity_label">"चुनी हुई सबरैडिट्स"</string> <string name="report_activity_label">"शिकायत करें"</string> <string name="view_imgur_media_activity_image_label">"चित्र %1$d/%2$d"</string> <string name="view_imgur_media_activity_video_label">"वीडियो %1$/%2$d"</string> <!-- Or one can use as is form in Devnagari script ' पी एम भेजें' --> - <string name="send_private_message_activity_label">"प्राइवेट मैसेज भेजें"</string> + <string name="send_private_message_activity_label">"व्यक्तिगत संदेश भेजें"</string> <string name="view_reddit_gallery_activity_image_label">"चित्र %1$d/%2$d"</string> <string name="view_reddit_gallery_activity_gif_label">"गिफ %1$d/%2$d"</string> <string name="view_reddit_gallery_activity_video_label">"वीडियो %1$d/%2$d"</string> @@ -37,7 +37,7 @@ <string name="navigation_drawer_close">"नेवीगेशन दराज बंद करें"</string> <string name="action_download">"डाउनलोड"</string> <string name="action_refresh">"ताजा करें"</string> - <string name="action_add_comment">"मतामत जोडें"</string> + <string name="action_add_comment">"टिप्पणी जोडें"</string> <string name="action_save_post">"पोस्ट जमा करे"</string> <!-- Fuzzy --> @@ -48,7 +48,7 @@ <string name="action_send">"भेजें"</string> <!-- क्रमबन्धन? --> - <string name="action_sort">"क्र्म्बर्धण"</string> + <string name="action_sort">"क्रमबन्धन "</string> <string name="action_hide_post">"पोस्ट छुपाएं"</string> <string name="action_unhide_post">"पोस्ट दिखाएं"</string> <string name="action_edit_post">"पोस्ट संपादित करें"</string> @@ -66,61 +66,69 @@ <string name="action_preview">"पूर्वदर्शन"</string> <string name="action_report">"शिकायत करें"</string> <string name="action_see_removed">"हटाए हुए पोस्ट देखें"</string> - <string name="action_set_wallpaper">"अलपेपर सेट करे"</string> - <string name="action_send_private_message">"प्राइबेट बातें भेजें"</string> - <string name="action_block_user">"ब्लव्क करे"</string> + <string name="action_set_wallpaper">"वालपेपर लगाएं "</string> + <string name="action_send_private_message">"व्यक्तिगत संदेश भेजें"</string> + <string name="action_block_user">"प्रतिबंधित करें "</string> <string name="parse_json_response_error">"JSON प्रतिक्रिया को समझने में त्रुटि"</string> <string name="retrieve_token_error">"टोकन प्राप्ति में त्रुटि"</string> - <string name="something_went_wrong">"कुछ गलत हे। पुनः प्रयास करें।"</string> - <string name="access_denied">"ब्लव्क है"</string> + <string name="something_went_wrong">"कुछ गलत हो गया है। बाद में पुनः प्रयास करें।"</string> + <string name="access_denied">"प्रवेश अस्वीकृत "</string> <string name="parse_user_info_error">"यूजर की जानकारी प्राप्ति में त्रुटि"</string> - <string name="no_system_webview_error">"सिस्टम ओएब वियू मे त्रुटि"</string> - <string name="error_loading_image_tap_to_retry">"चित्र खुलने में त्रुटि। यहा दबाए।"</string> - <string name="load_posts_error">"पोस्ट खुलने में त्रुटि। यहां दबाएं"</string> + <string name="no_system_webview_error">"सिस्टम वेब-व्यू खोलने में त्रुटि +"</string> + <string name="error_loading_image_tap_to_retry">"चित्र खुलने में त्रुटि। पुनः प्रयास के लिए यहां दबाएं।"</string> + <string name="load_posts_error">"पोस्ट खुलने में त्रुटि। +पुनः प्रयास के लिए यहां दबाएं। +"</string> <string name="load_more_posts_error">"पोस्ट खुलने में त्रुटि"</string> - <string name="load_post_error">"इस पोस्ट के खुलने में त्रुटि -यहा दबाएं"</string> + <string name="load_post_error">"इस पोस्ट के खुलने में त्रुटि। +पुनः प्रयास के लिए यहां दबाएं। +"</string> <string name="search_subreddits_error">"सबरैडिट खोजने में त्रुटि। -यहां दबाएं"</string> +पुनः प्रयास के लिए यहां दबाएं। +"</string> <string name="search_users_error">"यूजर को खोजने में त्रुटि। -यहां दबाएं"</string> +पुनः प्रयास के लिए यहां दबाएं। +"</string> <string name="no_posts">"कोई पोस्ट नहीं मिली"</string> - <string name="no_comments">"कोई मतामत नहीं मिली"</string> + <string name="no_comments">"कोई टिप्पणी नहीं मिली"</string> <string name="no_subreddits">"कोई सबरैडिट नहीं मिली"</string> <string name="no_users">"कोई यूजर नहीं मिला"</string> <string name="no_multi_reddits">"कोई मल्टीरैडिट नहीं मिली"</string> - <string name="no_storage_permission">"फाइल सेव करने के लिए स्टोरेज की अनुमति नहीं मिली "</string> - <string name="load_comments_failed">"मतामत खुलने में त्रुटि। + <string name="no_storage_permission">"फाइल सहेजने के लिए स्टोरेज की अनुमति नहीं मिली "</string> + <string name="load_comments_failed">"टिप्पणी खुलने में त्रुटि। यहा दबाएं"</string> <string name="retry">"पुनः प्रयास"</string> - <string name="comments">"मतामत"</string> - <string name="no_comments_yet">"अभी तक कोई मतमत नहीं। आप मतामत लिखें?"</string> - <string name="vote_failed">"वोट असफल रहा"</string> + <string name="comments">"टिप्पणियां "</string> + <string name="no_comments_yet">"अभी तक कोई टिप्पणी नहीं। आप एक टिप्पणी लिखें?"</string> + <string name="vote_failed">"मत असफल रहा"</string> <string name="refresh_post_failed">"पोस्ट को ताजा करने में त्रुटि"</string> <string name="load_messages_failed">"संदेश दिखाने में त्रुटि। -यहां दबाएं"</string> - <string name="no_messages">"खाली "</string> +पुनः प्रयास के लिए यहां दबाएं।"</string> + <string name="no_messages">"रिक्त "</string> <string name="nsfw">"NSFW"</string> <string name="karma_info">"कर्म: %1$d"</string> <string name="karma_info_user_detail">"कर्म: %1$d(%2$d + %3$d)"</string> <string name="cakeday_info">"केक दिवस: %1$s"</string> - <string name="since">"उस समय से:"</string> + <string name="since">"से (समय): +"</string> <string name="profile">"प्रोफाइल"</string> - <string name="subscriptions">"सब्सक्रिप्शन"</string> + <string name="subscriptions">"सब्सक्रिप्शन्स"</string> <string name="multi_reddit">"मल्टीरैडिट"</string> <string name="inbox">"इनबाॅक्स"</string> - <string name="upvoted">"ऊचा"</string> - <string name="downvoted">"नीचा"</string> + <string name="upvoted">"उत्थापित"</string> + <string name="downvoted">"पतित"</string> <string name="hidden">"छिपी हुई"</string> - <string name="saved">"सेव हुआ"</string> + <string name="saved">"सहेजी हुई +"</string> <string name="gilded">"पदक प्राप्त"</string> <string name="settings">"सैटिंग्स"</string> <string name="subscribers_number_detail">"सब्सक्राइबर्स: %1$d"</string> <string name="online_subscribers_number_detail">"ऑनलाइन: %1$d"</string> - <string name="cannot_fetch_subreddit_info">"सबरैडिट की जानकारी प्राप्त नहीं करा गया"</string> - <string name="cannot_fetch_user_info">"यूजर की जानकारी प्राप्त नहीं कर सका"</string> - <string name="cannot_fetch_sidebar">"साइड बार प्राप्त नहीं कर सका"</string> - <string name="cannot_fetch_multireddit">"मल्टीरैडिट की जानकारी प्राप्त नहीं कर सका"</string> + <string name="cannot_fetch_subreddit_info">"सबरैडिट की जानकारी प्राप्त नहीं हो सकी"</string> + <string name="cannot_fetch_user_info">"यूजर की जानकारी प्राप्त नहीं हो सकी"</string> + <string name="cannot_fetch_sidebar">"साइड बार प्राप्त नहीं हो सका "</string> + <string name="cannot_fetch_multireddit">"मल्टीरैडिट की जानकारी प्राप्त नहीं हो सकी"</string> <string name="subscribe">"सब्सक्राइब"</string> <string name="unsubscribe">"अनसब्सक्राइब"</string> <string name="subscribed">"सब्सक्राइब्ड"</string> @@ -129,7 +137,7 @@ <string name="unsubscribe_failed">"अनसब्सक्राइब असफल"</string> <string name="follow">"अनुसरण"</string> <string name="unfollow">"अ-अनुसरण"</string> - <string name="followed">"फोलोड"</string> + <string name="followed">"अनुसरित"</string> <string name="follow_failed">"अनुसरण असफल"</string> <string name="unfollowed">"अनफॉलोड"</string> <string name="unfollow_failed">"अ-अनुसरण असफल"</string> @@ -142,40 +150,42 @@ <string name="write_comment_hint">"यहां आपके रुचिकर विचार"</string> <string name="comment_content_required">"आपका रूचिकर विचार कहाँ है?"</string> <string name="sending_comment">"जा रहा है"</string> - <string name="send_comment_success">"मतामत भेज दी गई"</string> - <string name="send_comment_failed">"मतामत भेजा नहि गया"</string> - <string name="send_message_username_hint">"यूजर"</string> + <string name="send_comment_success">"टिप्पणी भेज दी गई"</string> + <string name="send_comment_failed">"टिप्पणी भेजी नहीं जा सकी +"</string> + <string name="send_message_username_hint">"उपयोगकर्ता "</string> <string name="send_message_subject_hint">"बिषय (अधिकतम १०० अक्षर)"</string> <string name="send_message_content_hint">"संदेश"</string> - <string name="reply_message_failed">"इस संदेश का उत्तर नहीं दिया गया"</string> + <string name="reply_message_failed">"इस संदेश का उत्तर नहीं दिया जा सका "</string> <string name="error_getting_message">"संदेश प्राप्ति में त्रुटि"</string> <string name="message_username_required">"नमस्ते, आप यह संदेश किसे भेजना चाहते हैं?"</string> <string name="message_subject_required">"आपके संदेश का एक बिषय होना चाहिए"</string> <string name="message_content_required">"आपको प्राप्तकर्ता को कुछ तो बताना चाहिए"</string> - <string name="sending_message">"जा रहा हे"</string> + <string name="sending_message">"जा रहा है "</string> <string name="send_message_success">"संदेश भेज दिया"</string> - <string name="send_message_failed">"संदेश नहीं भेज सका"</string> + <string name="send_message_failed">"संदेश नहीं भेज जा सका "</string> <string name="select_a_subreddit">"कृपया पहले एक सबरैडिट चुनिए"</string> - <string name="title_required">"पोस्ट कि अछि शीर्षक दिजीये"</string> - <string name="link_required">"जी, लिंक दिजीये?"</string> + <string name="title_required">"पोस्ट कि अच्छा शीर्षक चाहिए "</string> + <string name="link_required">"जी, लिंक दीजिए?"</string> <string name="select_an_image">"कृपया पहले एक चित्र चुनिए"</string> - <string name="posting">"हो रहा"</string> + <string name="posting">"पोस्ट किया जा रहा है "</string> <string name="post_failed">"पोस्ट नहीं कर सका"</string> - <string name="error_processing_image">"प्रसंस्करण में त्रुटि"</string> + <string name="error_processing_image">"प्रसंस्करण में त्रुटि "</string> <string name="error_processing_video">"प्रसंस्करण में त्रुटि"</string> - <string name="download_started">"डाउनलोड चालू है। प्रसंस्करण के लिए नोटिफिकेशन देखें।"</string> - <string name="comment_load_more_comments">"और मतामत देखें"</string> - <string name="comment_load_more_comments_failed">"लोड असफल। यहा दबाएं"</string> + <string name="download_started">"डाउनलोड शुरू हो गया है। प्रगति देखने के लिए नोटिफिकेशन देखें। +"</string> + <string name="comment_load_more_comments">"और टिप्पणियां देखें"</string> + <string name="comment_load_more_comments_failed">"लोड असफल। पुनः प्रयास के लिए यहां दबाएं।"</string> <string name="loading">"लोड हो रहा है"</string> <string name="post_title_hint">"शीर्षक"</string> - <string name="post_text_content_hint">"प्रकरण"</string> + <string name="post_text_content_hint">"अंतःवस्तु"</string> <string name="choose_a_subreddit">"एक सबरैडिट चुनें"</string> <string name="rules">"नियम"</string> <string name="post_link_hint">"URL"</string> <string name="subreddits">"सबरैडिट्स"</string> - <string name="users">"यूजर्स"</string> + <string name="users">"उपयोगकर्ता "</string> <string name="multi_reddits">"मल्टीरैडिट्स"</string> - <string name="bottom_sheet_post_text">"लेख"</string> + <string name="bottom_sheet_post_text">"टैक्स्ट "</string> <string name="bottom_sheet_post_link">"लिंक"</string> <string name="bottom_sheet_post_image">"चित्र"</string> <string name="bottom_sheet_post_video">"वीडियो"</string> @@ -185,14 +195,14 @@ <string name="error_getting_video">"वीडियो प्राप्ति में त्रुटि"</string> <string name="no_camera_available">"कोई भी कैमरा एप्प उपलब्ध नहीं"</string> <string name="error_creating_temp_file">"अस्थाई फाइल बनाने में त्रुटि"</string> - <string name="video_is_processing">"वीडियो प्रसंस्करण है रजा हे। कृपया प्रतीक्षा करें।"</string> - <string name="image_is_processing">"चित्र प्रसंस्करण हो रहा है। कृपया प्रतीक्षा करें।"</string> - <string name="gif_is_processing">"जिफ प्रसंस्करण हो रही है। कृपया प्रतीक्षा करें। "</string> + <string name="video_is_processing">"वीडियो प्रसंस्कृत हो रही है। कृपया प्रतीक्षा करें।"</string> + <string name="image_is_processing">"चित्र प्रसंस्कृत हो रहा है। कृपया प्रतीक्षा करें।"</string> + <string name="gif_is_processing">"जिफ प्रसंस्कृत हो रही है। कृपया प्रतीक्षा करें। "</string> <!-- Using For?? Actually It Means स्वभाव In Hindi Behavior --> - <string name="flair">"स्वभाव"</string> + <string name="flair">"फ्लेयर"</string> <string name="spoiler">"स्पॉइलर"</string> <string name="no_flair">"कोई फ्लेयर नहीं"</string> <string name="error_loading_flairs">"फ्लेयर लोड होने में त्रुटि। @@ -203,20 +213,20 @@ Behavior --> <string name="error_loading_rules_without_retry">"नियम लोड होने में त्रुटि"</string> <string name="search_in">"खोजें"</string> <string name="all_subreddits">"सभी सबरैडिट्स"</string> - <string name="sort_best">"आछा"</string> - <string name="sort_hot">"तीखा"</string> - <string name="sort_new">"नया"</string> + <string name="sort_best">"श्रेष्ठ"</string> + <string name="sort_hot">"उत्तेजक"</string> + <string name="sort_new">"नवीन "</string> <string name="sort_random">"अव्यवस्थित"</string> <string name="sort_rising">"आरोही"</string> - <string name="sort_top">"शीर्ष"</string> + <string name="sort_top">"सर्वोच्च"</string> <string name="sort_controversial">"विवादास्पद"</string> <string name="sort_relevance">"प्रासंगिक"</string> - <string name="sort_comments">"मतामत"</string> + <string name="sort_comments">"टिप्पणियां "</string> <string name="sort_activity">"गतिविधि"</string> - <string name="sort_confidence">"आत्मविश्वास"</string> + <string name="sort_confidence">"विश्वसनीय"</string> <string name="sort_old">"पुरानी"</string> <string name="sort_qa">"प्रश्नोत्तर"</string> - <string name="sort_live">"लाइब"</string> + <string name="sort_live">"जीवंत"</string> <string name="sort_time_hour">"घंटा"</string> <string name="sort_time_day">"दिन"</string> <string name="sort_time_week">"सप्ताह"</string> @@ -322,7 +332,7 @@ Behavior --> <string name="settings_save_front_page_scrolled_position_summary">"होम में ताजा करने पर नई पोस्ट्स देखें (मुख पृष्ट, क्रम: श्रेष्ठ)"</string> <string name="settings_open_link_in_app_title">"लिंक एप में खोलें "</string> <string name="settigns_video_title">"वीडियो "</string> - <string name="settings_video_autoplay_title">"वीडियो स्वचालित "</string> + <string name="settings_video_autoplay_title">"वीडियो स्वचालन"</string> <string name="settings_mute_autoplaying_videos_title">"स्वचालित वीडियोज को मौन करें "</string> <string name="settings_autoplay_nsfw_videos_title">"स्वचालित NSFW वीडियोड"</string> <string name="settings_start_autoplay_visible_area_offset_portrait_title">"स्वचालित वीडियो के दृश्य क्षेत्र का संतुलन (खड़े में)"</string> @@ -357,8 +367,8 @@ Behavior --> <string name="settings_comment_toolbar_hide_on_click">"टिप्पणी टूलबार को दिखाने/छुपाने के लिए क्लिक "</string> <!-- डहाना can be good alt. --> - <string name="settings_fully_collapse_comment_title">"मतमात सन्खीप्त करे"</string> - <string name="settings_comment_toolbar_hidden">"पूर्वनिर्धारित रूप से छिपा हुआ टिप्पणी टूलबार "</string> + <string name="settings_fully_collapse_comment_title">"टिप्पणियों को संक्षिप्त करें"</string> + <string name="settings_comment_toolbar_hidden">"पूर्वनिर्धारित रूप से टिप्पणी टूलबार अदृश्य "</string> <string name="settings_show_absolute_number_of_votes_title">"वोट्स की पूरी संख्या दिखाएं "</string> <string name="settings_show_elapsed_time">"पोस्ट्स एवं टिप्पणियों में बीता हुआ समय दिखाएं"</string> <string name="settings_time_format_title">"समय प्रारूप "</string> @@ -397,7 +407,7 @@ Behavior --> <string name="settings_credits_error_image_title">"त्रुटि चित्र "</string> <string name="settings_credits_error_image_summary">"प्रौद्योगिकी डिज़ाइन बनाया हे फ्रीपिक - www.freepik.com"</string> <string name="settings_credits_gilded_icon_title">"पदक आइकॉन "</string> - <string name="settings_credits_gilded_icon_summary">"आइकन को डिज़ाइन किया हे फ्रीपिक - www.flaticon.com"</string> + <string name="settings_credits_gilded_icon_summary">"फ्रीपिक द्वारा आइकॉन डिजाइन www.flaticon.com"</string> <string name="settings_credits_crosspost_icon_title">"क्रॉसपोस्ट आइकॉन "</string> <string name="settings_credits_crosspost_icon_summary">"आइकन बनाया है फ्रीपिक ने - www.flaticon.com"</string> <string name="settings_credits_thumbtack_icon_title">"थम्बटेक आइकॉन "</string> @@ -491,7 +501,7 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="share_gif_link">"जिफ का लिंक साझा करें "</string> <string name="share_video_link">"वीडियो का लिंक साझा करें "</string> <string name="share_link">"लिंक साझा करें "</string> - <string name="copy_post_link">"पोस्ट "</string> + <string name="copy_post_link">"पोस्ट लिंक कॉपी करें "</string> <string name="copy_image_link">"इमेज लिंक कॉपी करें "</string> <string name="copy_gif_link">"जिफ लिंक कॉपी करें "</string> <string name="copy_video_link">"वीडियो लिंक कॉपी करें "</string> @@ -525,7 +535,7 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="disable_nsfw">"NSFW बंद करें "</string> <string name="cannot_save_image">"चित्र सुरक्षित करने में असफल "</string> <string name="cannot_save_gif">"जिफ सुरक्षित करने में असफल "</string> - <string name="cannot_get_storage">"एप्प स्टोरेज तक पहुंच नहीं सकता "</string> + <string name="cannot_get_storage">"एप्प स्टोरेज तक पहुंच नहीं सका "</string> <string name="save_image_first">"चित्र सहेजा जा रहा है। कृपया प्रतीक्षा करें। "</string> <string name="save_gif_first">"जिफ सहेजा जा रहा है। कृपया प्रतीक्षा करें। "</string> <string name="theme_name_description">"इस थीम का नाम बदलने के लिए यहां दबाएं।"</string> @@ -658,8 +668,6 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="theme_item_unread_message_background_color_detail">"पर लागू होगा: अपठित संदेश पृष्टभूमि रंग "</string> <string name="theme_item_divider_color">"विभाजक रंग "</string> <string name="theme_item_divider_color_detail">"पर लागू होगा: टिप्पणी विभाजक, पोस्ट जमा करने के लिए पृष्ठों में विभाजक, इत्यादि "</string> - <string name="theme_item_no_preview_post_type_background_color">"कोई पूर्वदर्शन लिंक नहीं पृष्टभूमि रंग "</string> - <string name="theme_item_no_preview_post_type_background_color_detail">"पर लागू होगा: कोई पूर्वदर्शन लिंक नहीं"</string> <string name="theme_item_vote_and_reply_unavailable_button_color">"वोट एवं उत्तर अनुपलब्ध बटन का रंग "</string> <string name="theme_item_vote_and_reply_unavailable_button_color_detail">"पर लागू होगा: वोट एवं उत्तर बटन्स (अनुपलब्ध)"</string> <string name="theme_item_comment_vertical_bar_color_1">"टिप्पणी ऊर्ध्वाधर बार रंग 1"</string> @@ -757,7 +765,7 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="flair_preview">"फ्लेयर "</string> <string name="awards_preview">"4 पदक "</string> <string name="author_flair_preview">"रचयिता फ्लेयर "</string> - <string name="comment_content_preview">"मैंने अपनी गर्लफ्रेंड को एक 'जल्दी से अच्छी हो जाओ' कार्ड दिया। + <string name="comment_content_preview">"मैंने अपनी प्रेमिका को एक 'जल्दी से अच्छी हो जाओ' कार्ड दिया। वह बीमार नहीं है, लेकिन वह निश्चित रूप से अच्छी हो जाएगी।"</string> <string name="edit_multi_reddit">"मल्टीरैडिट्स संपादित करें "</string> <string name="delete_multi_reddit">"मल्टीरैडिट्स मिटा दें "</string> @@ -799,7 +807,7 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="set_to_home_screen">"होम स्क्रीन पे सेट करे"</string> <string name="set_to_lock_screen">"लक स्क्रीन पे सेट करे"</string> <string name="set_to_both">"दोनो पे ही सेट करे"</string> - <string name="default_font_font_preview">"अ बदलाभ"</string> + <string name="default_font_font_preview">"पूर्वनिर्धारित "</string> <string name="load_video_in_redgifs">"वीडियो रेडगिफ्स पर लोड करने कि कोशिश करे"</string> <string name="top_score">"%1$s अंक"</string> <string name="login_activity_2fa_prompt">"अगार आपका 2-कदाम प्रमाणीकरण चालू है, तो कृपिया आपना पासबर्ड(चाबी) निम्ना लिखित तरीके से दिजीये: <पासबर्ड>:<2FA code> @@ -807,4 +815,118 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="block_user">"एकाउंट ब्लक करे"</string> <string name="block_user_success">"एकाउंट ब्लक"</string> <string name="block_user_failed">"ब्लक करना असफल रहा"</string> + <string name="submit_crosspost_activity_label">"क्रॉसपोस्ट "</string> + <string name="give_award_activity_label">"पुरस्कार दें "</string> + <string name="action_crosspost">"क्रॉसपोस्ट"</string> + <string name="action_select_user_flair">"उपयोगकर्ता का फ्लेयर चुनें "</string> + <string name="action_give_award">"पुरस्कार दें␣"</string> + <string name="posts">"पोस्ट्स"</string> + <string name="sidebar">"साइडबार "</string> + <string name="only_for_logged_in_user">"केवल लाॅग्ड-इन उपयोगकर्ता के लिए "</string> + <string name="settings_number_of_columns_in_post_feed_title">"पोस्ट फीड में स्तम्भों की संख्या "</string> + <string name="settings_number_of_columns_in_post_feed_portrait_title">"ऊर्ध्वाधर"</string> + <string name="settings_number_of_columns_in_post_feed_landscape_title">" क्षैतिज "</string> + <string name="settings_nsfw_and_spoiler_title">"समाचारपत्र एवं स्प्वाॅइलर"</string> + <string name="settings_delete_all_legacy_settings_title">"सभी पुरानी सैटिंग्स को मिटाएं"</string> + <string name="restart_app_see_changes">"परिवर्तन देखने के लिए एप्प को पुनः शुरू करें "</string> + <string name="settings_tab_count">"टैब संख्या "</string> + <string name="settings_show_tab_names">"टैब के नाम दिखाएं"</string> + <string name="settings_more_tabs_summary">"अतिरिक्त टैब्स"</string> + <string name="settings_more_tabs_info_summary">"निम्नलिखित विकल्प को शुरू करना अनपेक्षित व्यवहार का कारण बन जाएगा: +दूसरी टैब में जाने पर टैब्स अपनी अंत:वस्तु खो सकती हैं। + यह पृष्ट को ताजा करने जैसा ही है। + +"</string> + <string name="settings_more_tabs_show_favorite_subscribed_subreddits_title">"पसंदीदा सब्सक्राइब्ड सबरैडिट्स दिखाएं "</string> + <string name="settings_more_tabs_show_subscribed_subreddits_title">"सब्सक्राइब्ड सबरैडिट्स दिखाएं"</string> + <string name="settings_download_location_title">"डाउनलोड अवस्थिति "</string> + <string name="settings_image_download_location_title">"चित्र डाउनलोड अवस्थिति"</string> + <string name="settings_gif_download_location_title">"जिफ डाउनलोड अवस्थिति"</string> + <string name="settings_video_download_location_title">"वीडियो डाउनलोड अवस्थिति"</string> + <string name="settings_separate_folder_for_each_subreddit">"प्रत्येक सबरैडिट के लिए पृथक फोल्डर "</string> + <string name="settings_swipe_action_title">"स्वाइप प्रतिक्रिया "</string> + <string name="settings_disable_swiping_between_tabs_title">"टैब्स के बीच स्वाइपिंग बंद करें "</string> + <string name="settings_enable_swipe_action_title">"स्वाइप प्रतिक्रियाओं को शुरु करें "</string> + <string name="settings_swipe_action_threshold">"दहलीज "</string> + <string name="settings_pull_to_refresh_title">"ताजा करने के लिए खींचें"</string> + <string name="settings_security_title">"सुरक्षा "</string> + <string name="settings_require_authentication_to_go_to_account_section_in_navigation_drawer_title">"नेवीगेशन दराज में खाता अनुभाग पर जाने के लिए सत्यापन आवश्यक "</string> + <string name="settings_long_press_to_hide_toolbar_in_compact_layout_title">"संक्षिप्त विन्यास में टूलबार को छुपाने के लिए लॉंग प्रैस "</string> + <string name="settings_post_compact_layout_toolbar_hidden_by_default_title">"संक्षिप्त विन्यास में टूलबार पूर्वनिर्धारित रूप से अदृश्य "</string> + <string name="settings_customize_bottom_app_bar_title">"निचले नेवीगेशन बार को अनुकूलित करें "</string> + <string name="settings_main_activity_bottom_app_bar_group_summary">"मुख्य पृष्ट "</string> + <string name="settings_other_activities_bottom_app_bar_group_summary">"अन्य पृष्ट "</string> + <string name="settings_bottom_app_bar_option_count">"विकल्प संख्या "</string> + <string name="settings_bottom_app_bar_option_1">"विकल्प 1"</string> + <string name="settings_bottom_app_bar_option_2">"विकल्प 2"</string> + <string name="settings_bottom_app_bar_option_3">"विकल्प 3"</string> + <string name="settings_bottom_app_bar_option_4">"विकल्प 4"</string> + <string name="settings_bottom_app_bar_fab">"तैरता क्रिया बटन "</string> + <string name="settings_data_saving_mode">"डेटा संरक्षण प्रणाली"</string> + <string name="settings_data_saving_mode_info_summary">"डेटा संरक्षण प्रणाली: +पूर्वावलोकित चित्र की कमतर स्पष्टता। +रैडिट वीडियोज की कमतर स्पष्टता। +वीडियो स्वचालन बंद।"</string> + <string name="settings_translation_title">"अनुवाद "</string> + <string name="settings_translation_summary">"इस एप को POEditor पर अनुवाद कीजिए। सभी योगदानों के लिए धन्यवाद। "</string> + <string name="settings_credits_national_flags">"राष्ट्रीय ध्वज "</string> + <string name="settings_credits_national_flags_summary">"आइकन www.flaticon.con से Freepik द्वारा बनाया गया है। "</string> + <string name="copy_failed">"कॉपी असफल "</string> + <string name="delete_all_legacy_settings_success">"सभी पुरानी सैटिंग्स को मिटाना सफल "</string> + <string name="downloading_media_finished">"डाउनलोडेड"</string> + <string name="downloading_image_or_gif_failed_cannot_get_destination_directory">"डाउनलोड असफल: गंतव्य डायरेक्टरी तक अभिगम असफल "</string> + <string name="downloading_media_failed_cannot_download_media">"डाउनलोड असफल"</string> + <string name="downloading_media_failed_cannot_save_to_destination_directory">"डाउनलोड असफल: गंतव्य डायरेक्टरी में फाइल का संरक्षण असफल"</string> + <string name="view_full_comment_markdown">"संपूर्ण मार्कडाउन देखें "</string> + <string name="select_user_flair_success">"यूजर फ्लेयर चुन लिया गया "</string> + <string name="select_this_user_flair">"इस यूजर फ्लेयर का चुनाव करना है? "</string> + <string name="select_header_size">"हेडर माप चुनें "</string> + <string name="large">"बड़ा "</string> + <string name="small">"छोटा "</string> + <string name="insert_link">"लिंक जोड़ें"</string> + <string name="text_hint">"टेक्स्ट "</string> + <string name="link_hint">"लिंक "</string> + <string name="unlock_account_section">"खाता अनुभाग खोलें "</string> + <string name="unlock">"खोलें "</string> + <string name="submit_post">"पोस्ट जमा करें "</string> + <string name="refresh">"ताजा करें "</string> + <string name="change_sort_type">"क्रम प्रकार बदलें"</string> + <string name="change_post_layout">"पोस्ट विन्यास बदलें "</string> + <string name="give_award_dialog_title">"पुरस्कार दें? "</string> + <string name="anonymous">"अज्ञात"</string> + <string name="give_award_error_message">"कूट: %1$d +संदेश: %2$s"</string> + <string name="give_award_success">"पुरस्कार दे दिया गया "</string> + <string name="give_award_failed">"असफल "</string> + <string name="recent_searches">"हाल ही की खोजें "</string> + <string name="warning">"चेतावनी "</string> + <string name="this_is_a_nsfw_subreddit">"यह एक NSFW सबरैडिट है "</string> + <string name="this_user_has_nsfw_content">"इस यूजर के पास NSFW सामग्री है। "</string> + <string name="dismiss">"रद्द करें "</string> + <string name="leave">"निकासी "</string> + <string name="go_to_subreddit">"सबरैडिट पर जाएं "</string> + <string name="go_to_user">"यूजर पर जाएं "</string> + <string name="go_to_thing_hint">"नाम "</string> + <string name="random">"यादृच्छिक "</string> + <string name="random_subreddit">"यादृच्छिक सबरैडिट "</string> + <string name="random_nsfw_subreddit">"यादृच्छिक NSFW सबरैडिट"</string> + <string name="random_post">"यादृच्छिक पोस्ट "</string> + <string name="random_nsfw_post">"यादृच्छिक NSFW पोस्ट "</string> + <string name="fetch_random_thing_failed">"बाद में पुनः प्रयास करें"</string> + <string name="downloading">"डाउनलोड हो रहा है "</string> + <string name="subreddit_filter_popular_and_all_activity_label">"r/all एवं r/popular"</string> + <string name="settings_miscellaneous_title">"विविध "</string> + <string name="settings_respect_subreddit_recommended_comment_sort_type_title">"सबरैडिट द्वारा संस्तुतित टिप्पणी क्रम प्रकार बनाए रखें "</string> + <string name="settings_respect_subreddit_recommended_comment_sort_type_summary">"टिप्पणी क्रम प्रकार सरंक्षित नहीं किया जाएगा "</string> + <string name="settings_post_filter_title">"छंटनी "</string> + <string name="settings_subreddit_filter_category">"सबरैडिट छुपाएं "</string> + <string name="settings_subreddit_filter_popular_and_all">"r/popular एवं r/all में "</string> + <string name="settings_credits_ufo_capturing_animation_title">"UFO बंदी बनाते हुए एनिमेशन "</string> + <string name="select_video_quality">"वीडियो गुणवत्ता चुनें"</string> + <string name="settings_swipe_action_haptic_feedback_title">"स्पर्श प्रतिपुष्टि "</string> + <string name="settings_hide_subreddit_description_title">"सबरैडिट विवरण छुपाएं "</string> + <string name="settings_disable_image_preview_title">"डेटा संरक्षण प्रणाली में चित्र पूर्वावलोकन बंद करें"</string> + <string name="settings_swipe_action_swipe_left_title">"बायां स्वाइप"</string> + <string name="settings_swipe_action_swipe_right_title">"दायां स्वाइप"</string> + <string name="settings_swipe_action_info_summary">"एक स्तंभ या पोस्ट विवरण से अधिक वाली पोस्ट फीड पर लागू नहीं "</string> </resources>
\ No newline at end of file diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml index 16710cbc..5ee49cff 100644 --- a/app/src/main/res/values-hr/strings.xml +++ b/app/src/main/res/values-hr/strings.xml @@ -635,8 +635,6 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="theme_item_unread_message_background_color_detail">"Primijenjeno na: Boju pozadine nepročitane poruke"</string> <string name="theme_item_divider_color">"Boja razdjelnika"</string> <string name="theme_item_divider_color_detail">"Primijenjeno na: Razdjelnik komentara, razdjelnike na stranicama za objavljivanje, itd."</string> - <string name="theme_item_no_preview_post_type_background_color">"Boja pozadine poveznice bez prethodnog pregleda"</string> - <string name="theme_item_no_preview_post_type_background_color_detail">"Primijenjeno na: Placeholder za poveznicu bez prethodnog pregleda"</string> <string name="theme_item_vote_and_reply_unavailable_button_color">"Boja gumbiju za glasanje i odgovaranje kada su nedostupni"</string> <string name="theme_item_vote_and_reply_unavailable_button_color_detail">"Primijenjeno na: Gumbe za glasanje i odgovaranje (nedostupni)"</string> <string name="theme_item_comment_vertical_bar_color_1">"Boja vertikalne trake komentara 1"</string> @@ -782,4 +780,109 @@ Baziraj na Indigo Amoled temi"</string> <string name="block_user">"Blokiraj korisnika"</string> <string name="block_user_success">"Blokiran"</string> <string name="block_user_failed">"Blokiranje nije uspjelo"</string> + <string name="submit_crosspost_activity_label">"Crosspost"</string> + <string name="give_award_activity_label">"Nagradi"</string> + <string name="action_crosspost">"Crosspost"</string> + <string name="action_select_user_flair">"Odaberi Flair"</string> + <string name="action_give_award">"Nagradi"</string> + <string name="posts">"Objave"</string> + <string name="sidebar">"Sidebar"</string> + <string name="only_for_logged_in_user">"Samo za prijavljene korisnike"</string> + <string name="settings_number_of_columns_in_post_feed_title">"Broj stupaca u feed-u objava"</string> + <string name="settings_number_of_columns_in_post_feed_portrait_title">"Portret"</string> + <string name="settings_number_of_columns_in_post_feed_landscape_title">"Pejzaž"</string> + <string name="settings_nsfw_and_spoiler_title">"NSWF i Spojler"</string> + <string name="settings_delete_all_legacy_settings_title">"Izbriši sve nasljeđene postavke"</string> + <string name="restart_app_see_changes">"Ponovno pokrenite aplikaciju kako biste vidjeli promjene"</string> + <string name="settings_tab_count">"Broj kartica"</string> + <string name="settings_show_tab_names">"Prikaži imena kartica"</string> + <string name="settings_more_tabs_summary">"Više kartica"</string> + <string name="settings_more_tabs_info_summary">"Omogučivanje sljedećih postavki će uzrokovati neželjene posljedice: Kartice bi mogle izgubiti sav sadržaj nakon promjene. To je jednako kao i osvježivanje stranice."</string> + <string name="settings_more_tabs_show_favorite_subscribed_subreddits_title">"Prikaži omiljene pretplaćene podreddite "</string> + <string name="settings_more_tabs_show_subscribed_subreddits_title">"Prikaži pretpkaćene podreddite"</string> + <string name="settings_download_location_title">"Mjesto preuzimanja"</string> + <string name="settings_image_download_location_title">"Mjesto preuzimanja slike"</string> + <string name="settings_gif_download_location_title">"Mjesto preuzimanja GIF-a"</string> + <string name="settings_video_download_location_title">"Mjesto preuzimanja videa"</string> + <string name="settings_separate_folder_for_each_subreddit">"Razdijeli mapu za svaki podreddit"</string> + <string name="settings_swipe_action_title">"Akcija prevlačenja"</string> + <string name="settings_disable_swiping_between_tabs_title">"Onemogući prijelaz između kartica"</string> + <string name="settings_enable_swipe_action_title">"Omogući akciju prevlačenja"</string> + <string name="settings_swipe_action_threshold">"Prag"</string> + <string name="settings_pull_to_refresh_title">"Povuci za ovježavanje"</string> + <string name="settings_security_title">"Sigurnost"</string> + <string name="settings_require_authentication_to_go_to_account_section_in_navigation_drawer_title">"Zatraži autentikaciju pri ulasku u Račun u navigacijskoj ladici"</string> + <string name="settings_long_press_to_hide_toolbar_in_compact_layout_title">"Dugo pritisni za skrivanje alatne trake u Kompaktnom rasporedu"</string> + <string name="settings_post_compact_layout_toolbar_hidden_by_default_title">"Alatna traka u Kompaktnom rasporedu je zadano skrivena"</string> + <string name="settings_customize_bottom_app_bar_title">"Uredi donju navigacijsku traku"</string> + <string name="settings_main_activity_bottom_app_bar_group_summary">"Glavna stranica"</string> + <string name="settings_other_activities_bottom_app_bar_group_summary">"Druge stranice"</string> + <string name="settings_bottom_app_bar_option_count">"Broj opcija"</string> + <string name="settings_bottom_app_bar_option_1">"Opcija 1"</string> + <string name="settings_bottom_app_bar_option_2">"Opcija 2"</string> + <string name="settings_bottom_app_bar_option_3">"Opcija 3"</string> + <string name="settings_bottom_app_bar_option_4">"Opcija 4"</string> + <string name="settings_bottom_app_bar_fab">"Plutajući akcijski gumb"</string> + <string name="settings_data_saving_mode">"Način uštede podataka"</string> + + <!-- Fuzzy --> + <string name="settings_data_saving_mode_info_summary">"U načinu uštede podataka: +Slike predpregleda su niže rezolucije. +Reddit videi su niže rezolucije."</string> + <string name="settings_translation_title">"Prijevod"</string> + <string name="settings_translation_summary">"Prevedi ovu aplikaciju na POEditor-u. Hvala svim prinosnicima."</string> + <string name="settings_credits_national_flags">"Zastave država"</string> + <string name="settings_credits_national_flags_summary">"Ikonu napravio Freepik na www.flaticon.com"</string> + <string name="copy_failed">"Koprianje nije uspjelo"</string> + <string name="delete_all_legacy_settings_success">"Brisanje svih nasljeđenih postavki uspješno"</string> + <string name="downloading_media_finished">"Preuzeto"</string> + <string name="downloading_image_or_gif_failed_cannot_get_destination_directory">"Preuzimanje neuspješno:nije moguće pristupiti odredišnom direktoriju"</string> + <string name="downloading_media_failed_cannot_download_media">"Preuzimanje neuspješno"</string> + <string name="downloading_media_failed_cannot_save_to_destination_directory">"Preuzimanje neuspješno: nije moguće spremiti datoteku u odredišni direktorij"</string> + <string name="view_full_comment_markdown">"Pogledaj cijeli Markdown"</string> + <string name="select_user_flair_success">"Korisnički flair odabran"</string> + <string name="select_this_user_flair">"Odabrati ovaj korisnički flair?"</string> + <string name="select_header_size">"Odaberi veličinu zaglavlja"</string> + <string name="large">"Veliko"</string> + <string name="small">"Malo"</string> + <string name="insert_link">"Umetni poveznicu"</string> + <string name="text_hint">"Tekst"</string> + <string name="link_hint">"Poveznica"</string> + <string name="unlock_account_section">"Otključaj Račun"</string> + <string name="unlock">"Otključaj"</string> + <string name="submit_post">"Predaj objavu"</string> + <string name="refresh">"Osvježi"</string> + <string name="change_sort_type">"Promijeni tip redosljeda"</string> + <string name="change_post_layout">"Promjeni raspored objava"</string> + <string name="give_award_dialog_title">"Nagraditi?"</string> + <string name="anonymous">"Anonimno"</string> + <string name="give_award_error_message">"Kod: %1$d/ +Poruka: %2$s"</string> + <string name="give_award_success">"Nagrađeno"</string> + <string name="give_award_failed">"Nagrađivanje nije uspjelo"</string> + <string name="recent_searches">"Nedavne pretrage"</string> + <string name="warning">"Upozorenje"</string> + <string name="this_is_a_nsfw_subreddit">"Ovo je NSFW podreddit."</string> + <string name="this_user_has_nsfw_content">"Ovaj korisnik ima NSFW sadržaj"</string> + <string name="dismiss">"Odbaci"</string> + <string name="leave">"Napusti"</string> + <string name="go_to_subreddit">"Idi na podreddit"</string> + <string name="go_to_user">"Idi na profil korisnika"</string> + <string name="go_to_thing_hint">"Ime"</string> + <string name="random">"Nasumično"</string> + <string name="random_subreddit">"Nasumični podreddit"</string> + <string name="random_nsfw_subreddit">"Nasumični NSFW podreddit"</string> + <string name="random_post">"Nasumična objava"</string> + <string name="random_nsfw_post">"Nasumična NSFW objava"</string> + <string name="fetch_random_thing_failed">"Pokušajte ponovno kasnije"</string> + <string name="downloading">"Preuzimanje"</string> + <string name="subreddit_filter_popular_and_all_activity_label">"r/all i r/popular"</string> + <string name="settings_miscellaneous_title">"Razno"</string> + <string name="settings_respect_subreddit_recommended_comment_sort_type_title">"Poštuj tip sortiranja komentara preporučen na podredditu"</string> + <string name="settings_respect_subreddit_recommended_comment_sort_type_summary">"Tip sortiranja komentara neće biti spremljen"</string> + <string name="settings_post_filter_title">"Filter"</string> + <string name="settings_subreddit_filter_category">"Sakrij podreddite"</string> + <string name="settings_subreddit_filter_popular_and_all">"U r/popular i r/all"</string> + <string name="settings_credits_ufo_capturing_animation_title">"UFO Capturing Animation"</string> + <string name="select_video_quality">"Odaberi kvalitetu videa"</string> </resources>
\ No newline at end of file diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 06a71151..d404728c 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -41,9 +41,7 @@ <string name="action_refresh">"Ricarica"</string> <string name="action_add_comment">"Aggiungi un commento"</string> <string name="action_save_post">"Salva post"</string> - - <!-- Fuzzy --> - <string name="action_view_crosspost_parent">"Esegui crosspost del genitore"</string> + <string name="action_view_crosspost_parent">"Mostra origine del crosspost"</string> <string name="action_search">"Cerca"</string> <string name="action_start_lazy_mode">"Inizia Modalità pigra"</string> <string name="action_stop_lazy_mode">"Ferma Modalità pigra"</string> @@ -213,8 +211,6 @@ Clicca per riprovare."</string> <string name="sort_activity">"Attività"</string> <string name="sort_confidence">"Migliore"</string> <string name="sort_old">"Vecchi"</string> - - <!-- Fuzzy --> <string name="sort_qa">"D&R"</string> <string name="sort_live">"Live"</string> <string name="sort_time_hour">"Ora"</string> @@ -305,12 +301,10 @@ Clicca per riprovare."</string> <string name="label_post">"Post"</string> <string name="label_preferences">"Preferenze"</string> <string name="account_switched">"Account cambiato. Tutte le altre pagine non sono più disponibili."</string> - <string name="settings_notification_master_title">"Notifica"</string> + <string name="settings_notification_master_title">"Notifiche"</string> <string name="settings_notification_enable_notification_title">"Abilita Notifiche"</string> <string name="settings_notification_interval_title">"Controlla Intervallo Notifiche"</string> <string name="settings_theme_title">"Tema"</string> - - <!-- Fuzzy --> <string name="settings_amoled_dark_title">"Amoled (Scuro)"</string> <string name="settings_interface_title">"Interfaccia"</string> <string name="settings_gestures_and_buttons_title">"Gesti e pulsanti"</string> @@ -338,7 +332,7 @@ Potrebbe non funzionare su Android 11"</string> <string name="settings_immersive_interface_ignore_nav_bar_summary">"Impedisci che la barra di navigazione inferiore abbia un padding extra"</string> <string name="settings_customize_tabs_in_main_page_title">"Personalizza le schede nella pagina principale"</string> <string name="settings_enable_bottom_app_bar_title">"Abilita navigazione dal basso"</string> - <string name="settings_enable_bottom_app_bar_summary">"Non Ha Effetti in Modalità Anonima"</string> + <string name="settings_enable_bottom_app_bar_summary">"Non ha effetti in Modalità anonima"</string> <string name="settings_category_post_and_comment_title">"Post e Commenti"</string> <string name="settings_vote_buttons_on_the_right_title">"Bottoni di voto sulla destra"</string> <string name="settings_volume_keys_navigate_comments_title">"Utilizza i tasti volume per scorrere i commenti dei post"</string> @@ -387,11 +381,11 @@ Potrebbe non funzionare su Android 11"</string> <string name="settings_acknowledgement_master_title">"Riconoscimenti"</string> <string name="settings_credits_master_title">"Crediti"</string> <string name="settings_credits_icon_foreground_title">"Primo Piano Icona"</string> - <string name="settings_credits_icon_foreground_summary">"Technology vector creato da freepik - su www.flaticon.com"</string> + <string name="settings_credits_icon_foreground_summary">"Technology vector creato da freepik - www.freepik.com"</string> <string name="settings_credits_icon_background_title">"Sfondo dell'Icona"</string> - <string name="settings_credits_icon_background_summary">"Background vector creato da freepik su www.flaticon.com"</string> + <string name="settings_credits_icon_background_summary">"Sfondo vettoriale creato da freepik - www.freepik.com"</string> <string name="settings_credits_error_image_title">"Immagine di Errore"</string> - <string name="settings_credits_error_image_summary">"Technology vector creato da freepik - su www.flaticon.com"</string> + <string name="settings_credits_error_image_summary">"Technology vector creato da freepik - www.freepik.com"</string> <string name="settings_credits_gilded_icon_title">"Icona \"Premiato\""</string> <string name="settings_credits_gilded_icon_summary">"Icona creata da Freepik su www.flaticon.com"</string> <string name="settings_credits_crosspost_icon_title">"Icona \"Cross Post\""</string> @@ -533,7 +527,7 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="theme_item_color_accent">"Colore d'accento"</string> <string name="theme_item_color_accent_detail">"Applicato a: Barra di progresso, ecc"</string> <string name="theme_item_color_primary_light_theme">"Colore primario del tema chiaro"</string> - <string name="theme_item_color_primary_light_theme_detail">"Applicato a: Sfondo del bottone fluttuante e del bottone"</string> + <string name="theme_item_color_primary_light_theme_detail">"Applicato a: Sfondo del bottone flottante e del bottone"</string> <string name="theme_item_primary_text_color">"Colore del testo principale"</string> <string name="theme_item_primary_text_color_detail">"Applicato a: Testo principale"</string> <string name="theme_item_secondary_text_color">"Colore del testo secondario"</string> @@ -592,13 +586,15 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_tab_background_detail">"Applicato a: Sfondo layout scheda (barra degli strumenti espansa)"</string> <string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_text_color">"Colore del testo del layout delle schede nella barra degli strumenti espansa"</string> <string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_text_color_detail">"Applicato a: Colore del testo del layout delle schede (barra degli strumenti espansa)"</string> - <string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_tab_indicator">"Colore Indicatore Tab del Layout Tab nella barra degli strumenti espansa"</string> - <string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_tab_indicator_detail">"Applicato a: Colore indicatore tab nel layout tab (barra degli strumenti espansa)"</string> + <string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_tab_indicator">"Colore Indicatore schede del Layout schede nella barra degli strumenti espansa"</string> + + <!-- Fuzzy --> + <string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_tab_indicator_detail">"Applicato a: Colore indicatore schede nel layout a schede (barra degli strumenti espansa)"</string> <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_tab_background">"Colore di sfondo del layout della scheda nella barra degli strumenti compressa"</string> <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_tab_background_detail">"Applicato a: Sfondo layout scheda (barra degli strumenti compressa)"</string> <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_text_color">"Colore del testo del layout delle schede nella barra degli strumenti compressa"</string> <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_text_color_detail">"Applicato a: Colore testo layout scheda (barra degli strumenti compressa)"</string> - <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_tab_indicator">"Colore Indicatore di Scheda del layout Tab nella Barra degli Strumenti Compressa"</string> + <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_tab_indicator">"Colore Indicatore di Scheda del layout schede nella Barra degli Strumenti Compressa"</string> <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_tab_indicator_detail">"Applicato a: Colore dell'indicatore della scheda nel layout della scheda (barra degli strumenti compressa)"</string> <string name="theme_item_upvoted_color">"Colore Voto Positivo"</string> <string name="theme_item_upvoted_color_detail">"Applicato a: Pulsanti di voto e punteggi (voto positivo)"</string> @@ -660,8 +656,6 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="theme_item_unread_message_background_color_detail">"Applicato a: Colore di sfondo del messaggio non letto"</string> <string name="theme_item_divider_color">"Colore Divisore"</string> <string name="theme_item_divider_color_detail">"Applicato a: Divisore di commento, divisori in pagine per l'invio di post, ecc."</string> - <string name="theme_item_no_preview_post_type_background_color">"Colore di sfondo del link senza anteprima"</string> - <string name="theme_item_no_preview_post_type_background_color_detail">"Applicato a: Segnaposto per link senza anteprima"</string> <string name="theme_item_vote_and_reply_unavailable_button_color">"Colore Pulsante Vota e Rispondi Non Disponibile"</string> <string name="theme_item_vote_and_reply_unavailable_button_color_detail">"Applicato a: Bottoni vota e rispondi (Non disponibili)"</string> <string name="theme_item_comment_vertical_bar_color_1">"Commento Colore Barra Verticale 1"</string> @@ -690,25 +684,17 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="no_theme_name">"Qual è il nome di questo tema?"</string> <string name="theme_name_hint">"Nome Tema"</string> <string name="theme_name_indigo">"Indaco"</string> - - <!-- Fuzzy --> <string name="theme_name_indigo_dark">"Indaco (Scuro)"</string> <string name="theme_name_indigo_amoled">"Indaco Amoled"</string> <string name="theme_name_white">"Bianco"</string> - - <!-- Fuzzy --> <string name="theme_name_white_dark">"Bianco (Scuro)"</string> <string name="theme_name_white_amoled">"Bianco Amoled"</string> <string name="theme_name_red">"Rosso"</string> - - <!-- Fuzzy --> <string name="theme_name_red_dark">"Rosso (Scuro)"</string> <string name="theme_name_red_amoled">"Rosso Amoled"</string> <string name="theme_name_dracula">"Dracula"</string> <string name="theme_name_calm_pastel">"Calmo pastello"</string> <string name="create_light_theme">"Crea un tema chiaro basato sul tema Indaco"</string> - - <!-- Fuzzy --> <string name="create_dark_theme">"Crea un tema scuro basato sul tema Indaco (Scuro)"</string> <string name="create_amoled_theme">"Crea un tema Amoled basato sul tema Indaco Amoled"</string> <string name="create_theme_info">"Se vuoi creare un tema basato su un altro tema, clicca il pulsante \"+\" su un tema."</string> @@ -731,6 +717,8 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="duplicate_theme_name_dialog_message">"Un tema nel database è già chiamato %1$s. Vuoi cambiare il nome del tema importato?"</string> <string name="rename">"Rinomina"</string> <string name="override">"Annullare"</string> + + <!-- Fuzzy --> <string name="color_picker">"Color Picker"</string> <string name="invalid_color">"Colore Non Valido"</string> @@ -764,6 +752,8 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="flair_preview">"Flair"</string> <string name="awards_preview">"4 Premi"</string> <string name="author_flair_preview">"Flair dell'autore"</string> + + <!-- Fuzzy --> <string name="comment_content_preview">"Ho dato una cartolina alla mia ragazza con scritto \"Rimettiti presto\". Non è malata o altro, ma potrebbe sicuramente stare meglio."</string> <string name="edit_multi_reddit">"Modifica multireddit"</string> @@ -780,7 +770,7 @@ Non è malata o altro, ma potrebbe sicuramente stare meglio."</string> <string name="report_reason_general_child_pornography">"Contiene pedopornografia"</string> <string name="report_reason_general_abusive_content">"Contiene contenuto offensivo"</string> <string name="home">"Home"</string> - <string name="popular">"Popolare"</string> + <string name="popular">"Popolari"</string> <string name="notifications">"Notifiche"</string> <string name="messages">"Messaggi"</string> <string name="message">"Messaggio"</string> @@ -816,4 +806,154 @@ Esempio: latuapassword:123456"</string> <string name="block_user">"Blocca Utente"</string> <string name="block_user_success">"Bloccato"</string> <string name="block_user_failed">"Blocco utente fallito"</string> + <string name="submit_crosspost_activity_label">"Crosspost"</string> + <string name="give_award_activity_label">"Assegna Premio"</string> + <string name="action_crosspost">"Crosspost"</string> + <string name="action_select_user_flair">"Seleziona flair utente"</string> + <string name="action_give_award">"Assegna Premio"</string> + <string name="posts">"Post"</string> + + <!-- Fuzzy --> + <string name="sidebar">"Informazioni"</string> + <string name="only_for_logged_in_user">"Solo per utenti connessi"</string> + <string name="settings_number_of_columns_in_post_feed_title">"Il numero di colonne nel Feed dei post"</string> + + <!-- Fuzzy --> + <string name="settings_number_of_columns_in_post_feed_portrait_title">"Vista verticale"</string> + + <!-- Fuzzy --> + <string name="settings_number_of_columns_in_post_feed_landscape_title">"Vista orizzontale"</string> + <string name="settings_nsfw_and_spoiler_title">"NSFW & Spoiler"</string> + <string name="settings_delete_all_legacy_settings_title">"Elimina tutte le impostazioni precedenti"</string> + <string name="restart_app_see_changes">"Riavvia la app per vedere i cambiamenti"</string> + <string name="settings_tab_count">"Numero di schede"</string> + <string name="settings_show_tab_names">"Mostra il nome delle schede"</string> + <string name="settings_more_tabs_summary">"Più schede"</string> + <string name="settings_more_tabs_info_summary">"L'attivazione delle seguenti opzioni provoca un comportamento indesiderato: +Le schede possono perdere tutto il contenuto dopo il passaggio ad altre. Questo equivale a rinfrescare la pagina."</string> + + <!-- Fuzzy --> + <string name="settings_more_tabs_show_favorite_subscribed_subreddits_title">"Mostra i subreddit sottoscritti preferiti"</string> + + <!-- Fuzzy --> + <string name="settings_more_tabs_show_subscribed_subreddits_title">"Mostra i subreddit sottoscritti"</string> + <string name="settings_download_location_title">"Posizione dei download"</string> + <string name="settings_image_download_location_title">"Posizione di download delle immagini"</string> + <string name="settings_gif_download_location_title">"Posizione di download delle gif"</string> + <string name="settings_video_download_location_title">"Posizione di download di video"</string> + <string name="settings_separate_folder_for_each_subreddit">"Cartelle differenti per ogni subreddit"</string> + <string name="settings_swipe_action_title">"Azione di scorrimento"</string> + <string name="settings_disable_swiping_between_tabs_title">"Disabilita lo scorrimento tra le schede"</string> + <string name="settings_enable_swipe_action_title">"Abilita azione di scorrimento"</string> + <string name="settings_swipe_action_threshold">"Soglia"</string> + <string name="settings_pull_to_refresh_title">"Trascina per aggiornare"</string> + <string name="settings_security_title">"Sicurezza"</string> + <string name="settings_require_authentication_to_go_to_account_section_in_navigation_drawer_title">"Richiedi autenticazione per andare nella sezione account nella barra di navigazione"</string> + <string name="settings_long_press_to_hide_toolbar_in_compact_layout_title">"Premere a lungo per nascondere la barra degli strumenti nel layout compatto"</string> + <string name="settings_post_compact_layout_toolbar_hidden_by_default_title">"Barra degli strumenti nel layout compatto nascosta per impostazione predefinita"</string> + <string name="settings_customize_bottom_app_bar_title">"Personalizza la barra di navigazione inferiore"</string> + <string name="settings_main_activity_bottom_app_bar_group_summary">"Pagina principale"</string> + <string name="settings_other_activities_bottom_app_bar_group_summary">"Altre pagine"</string> + <string name="settings_bottom_app_bar_option_count">"Conteggio delle opzioni"</string> + <string name="settings_bottom_app_bar_option_1">"Opzione 1"</string> + <string name="settings_bottom_app_bar_option_2">"Opzione 2"</string> + <string name="settings_bottom_app_bar_option_3">"Opzione 3"</string> + <string name="settings_bottom_app_bar_option_4">"Opzione 4"</string> + + <!-- Fuzzy --> + <string name="settings_bottom_app_bar_fab">"Pulsante d'azione flottante"</string> + <string name="settings_data_saving_mode">"Modalità risparmio dati"</string> + + <!-- Fuzzy --> + <string name="settings_data_saving_mode_info_summary">"In modalità di risparmio dati: +Le immagini di anteprima sono in minore risoluzione. +I video di Reddit sono in minore risoluzione."</string> + <string name="settings_translation_title">"Traduzione"</string> + <string name="settings_translation_summary">"Traduci questa app in POEditor. Grazie a tutti i contributori"</string> + <string name="settings_credits_national_flags">"Bandiere nazionali"</string> + <string name="settings_credits_national_flags_summary">"Icone create da Freepik su www.flaticon.com"</string> + + <!-- Fuzzy --> + <string name="copy_failed">"\"Copia\" fallito"</string> + + <!-- Fuzzy --> + <string name="delete_all_legacy_settings_success">"Elimina correttamente tutte le impostazioni precedenti"</string> + <string name="downloading_media_finished">"Scaricato"</string> + <string name="downloading_image_or_gif_failed_cannot_get_destination_directory">"Download fallito: impossibile accedere alla destinazione"</string> + <string name="downloading_media_failed_cannot_download_media">"Download fallito"</string> + <string name="downloading_media_failed_cannot_save_to_destination_directory">"Download fallito: impossibile salvare il file nella destinazione"</string> + <string name="view_full_comment_markdown">"Visualizza Markdown completo"</string> + <string name="select_user_flair_success">"Flair utente selezionato"</string> + <string name="select_this_user_flair">"Seleziona questa flair utente?"</string> + <string name="select_header_size">"Seleziona dimensione intestazione"</string> + <string name="large">"Grande"</string> + <string name="small">"Piccolo"</string> + <string name="insert_link">"Inserisci link"</string> + <string name="text_hint">"Testo"</string> + <string name="link_hint">"Link"</string> + <string name="unlock_account_section">"Sblocca sezione account"</string> + <string name="unlock">"Sblocca"</string> + <string name="submit_post">"Invia post"</string> + <string name="refresh">"Ricarica"</string> + <string name="change_sort_type">"Cambia il tipo di ordinamento"</string> + <string name="change_post_layout">"Cambia il layout dei post"</string> + + <!-- Fuzzy --> + <string name="give_award_dialog_title">"Vuoi dare premio?"</string> + <string name="anonymous">"Anonimo"</string> + <string name="give_award_error_message">"Codice: %1$d/ + Messaggio: %2$s"</string> + <string name="give_award_success">"Premio conferito"</string> + <string name="give_award_failed">"Fallito"</string> + <string name="recent_searches">"Ricerche recenti"</string> + <string name="warning">"Avvertimento"</string> + <string name="this_is_a_nsfw_subreddit">"Questo è un subreddit marcato NSFW"</string> + <string name="this_user_has_nsfw_content">"Questo utente è marcato NSFW"</string> + + <!-- Fuzzy --> + <string name="dismiss">"Ignora"</string> + + <!-- Fuzzy --> + <string name="leave">"Lascia"</string> + <string name="go_to_subreddit">"Vai al subreddit"</string> + <string name="go_to_user">"Vai all'utente"</string> + <string name="go_to_thing_hint">"Nome"</string> + <string name="random">"Casuale"</string> + <string name="random_subreddit">"Subreddit casuale"</string> + <string name="random_nsfw_subreddit">"Subreddit NSFW casuale"</string> + <string name="random_post">"Post casuale"</string> + <string name="random_nsfw_post">"Post NSFW casuale"</string> + <string name="fetch_random_thing_failed">"Riprova più tardi"</string> + <string name="downloading">"Download in corso"</string> + <string name="subreddit_filter_popular_and_all_activity_label">"r/all e r/popular"</string> + + <!-- Fuzzy --> + <string name="settings_miscellaneous_title">"Varie"</string> + + <!-- Fuzzy --> + <string name="settings_respect_subreddit_recommended_comment_sort_type_title">"Rispetta ordinamento dei commenti consigliato dal sub"</string> + + <!-- Fuzzy --> + <string name="settings_respect_subreddit_recommended_comment_sort_type_summary">"Il tipo di ordinamento dei commenti non verrà salvato"</string> + <string name="settings_post_filter_title">"Filtro"</string> + + <!-- Fuzzy --> + <string name="settings_subreddit_filter_category">"Nascondi i Subreddit"</string> + <string name="settings_subreddit_filter_popular_and_all">"In r/popular e r/all"</string> + + <!-- Fuzzy --> + <string name="settings_credits_ufo_capturing_animation_title">"Animazione di cattura dell'UFO"</string> + <string name="select_video_quality">"Scegli qualità video"</string> + <string name="settings_swipe_action_haptic_feedback_title">"Feedback aptico"</string> + <string name="settings_hide_subreddit_description_title">"Nascondi descrizione dei subreddit"</string> + <string name="settings_disable_image_preview_title">"Disabilita le anteprime delle immagini in modalità risparmio dati"</string> + <string name="settings_swipe_action_swipe_left_title">"Scorri a sinistra"</string> + <string name="settings_swipe_action_swipe_right_title">"Scorri a destra"</string> + + <!-- Fuzzy --> + <string name="settings_swipe_action_info_summary">"Non applicabile ai feed con più di una colonna o ai post aperti."</string> + <string name="theme_item_no_preview_post_type_icon_tint">"Colore icona dei post \"Senza anteprima\""</string> + <string name="theme_item_no_preview_post_type_icon_tint_detail">"Applicato a: Icona che indica il tipo di post quando nessuna anteprima è disponibile"</string> + <string name="theme_item_no_preview_post_type_background_color">"Colore sfondo dei post \"Senza anteprima\""</string> + <string name="theme_item_no_preview_post_type_background_color_detail">"Applicato a: Segnaposto che indica il tipo di post quando nessuna anteprima è disponibile"</string> </resources>
\ No newline at end of file diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 4da4cef0..01c478b6 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -15,14 +15,14 @@ <string name="edit_comment_activity_label">"コメントを編集"</string> <string name="view_message_activity_label">"受信トレイ"</string> <string name="settings_activity_label">"設定"</string> - <string name="account_saved_thing_activity_label">"保存"</string> - <string name="create_multi_reddit_activity_label">"マルチRedditを作成"</string> - <string name="subreddit_multiselection_activity_label">"Subredditを選択"</string> + <string name="account_saved_thing_activity_label">"保存しました"</string> + <string name="create_multi_reddit_activity_label">"カスタムフィードを作成"</string> + <string name="subreddit_multiselection_activity_label">"カスタムフィードを選択"</string> <string name="custom_theme_listing_activity_label">"カスタムテーマ"</string> <string name="customize_theme_activity_label">"テーマを編集"</string> <string name="customize_theme_activity_create_theme_label">"テーマを作成"</string> <string name="theme_preview_activity_label">"テーマをプレビュー"</string> - <string name="edit_multi_reddit_activity_label">"マルチRedditを編集"</string> + <string name="edit_multi_reddit_activity_label">"カスタムフィードを編集"</string> <string name="selected_subeddits_activity_label">"選択したSubreddit"</string> <string name="report_activity_label">"通報"</string> <string name="view_imgur_media_activity_image_label">"画像 %1$d/%2$d"</string> @@ -58,8 +58,8 @@ <string name="action_edit_flair">"フレアーを編集"</string> <string name="action_change_post_layout">"表示レイアウトを変更"</string> <string name="action_save">"保存"</string> - <string name="action_edit_multi_reddit">"マルチRedditを編集"</string> - <string name="action_delete_multi_reddit">"マルチRedditを削除"</string> + <string name="action_edit_multi_reddit">"カスタムフィードを編集"</string> + <string name="action_delete_multi_reddit">"カスタムフィードを削除"</string> <string name="action_share">"共有"</string> <string name="action_preview">"プレビュー"</string> <string name="action_report">"通報"</string> @@ -87,12 +87,12 @@ <string name="no_comments">"コメントが見つかりませんでした"</string> <string name="no_subreddits">"Subredditが見つかりませんでした"</string> <string name="no_users">"ユーザーが見つかりませんでした"</string> - <string name="no_multi_reddits">"マルチRedditが見つかりませんでした"</string> + <string name="no_multi_reddits">"カスタムフィードが見つかりませんでした"</string> <string name="no_storage_permission">"ファイルを保存するためのストレージアクセス許可がありません"</string> <string name="load_comments_failed">"コメントをロード中にエラーが発生しました。タップでリトライします。"</string> <string name="retry">"リトライ"</string> <string name="comments">"コメント"</string> - <string name="no_comments_yet">"まだコメントがありません。コメントを書きますか?"</string> + <string name="no_comments_yet">"まだコメントがありません。コメントを書いてみませんか?"</string> <string name="vote_failed">"評価に失敗しました"</string> <string name="refresh_post_failed">"投稿を更新中にエラーが発生しました"</string> <string name="load_messages_failed">"メッセージをロード中にエラーが発生しました。タップでリトライします。"</string> @@ -108,24 +108,28 @@ <string name="since">"作成日:"</string> <string name="profile">"プロフィール"</string> <string name="subscriptions">"登録済み"</string> - <string name="multi_reddit">"マルチReddit"</string> + <string name="multi_reddit">"カスタムフィード"</string> <string name="inbox">"受信トレイ"</string> <!-- Fuzzy --> - <string name="upvoted">"上評価"</string> + <string name="upvoted">"プラス評価がある投稿"</string> <!-- Fuzzy --> - <string name="downvoted">"下評価"</string> - <string name="hidden">"非表示済み"</string> - <string name="saved">"保存済み"</string> - <string name="gilded">"金ピカ"</string> + <string name="downvoted">"マイナス評価がある投稿"</string> + <string name="hidden">"非表示にした投稿"</string> + <string name="saved">"保存した投稿"</string> + + <!-- What posts the app shows when I select this? +(1) My posts that someone gave (gold or better only?) rewards for me. +(2) Someone's posts that I gave (gold or better only?) rewards for them. --> + <string name="gilded">"アワードが贈られている投稿"</string> <string name="settings">"設定"</string> <string name="subscribers_number_detail">"登録者数: %1$d"</string> <string name="online_subscribers_number_detail">"オンライン: %1$d"</string> <string name="cannot_fetch_subreddit_info">"Subredditの情報が取得できませんでした"</string> <string name="cannot_fetch_user_info">"ユーザー情報が取得できませんでした"</string> <string name="cannot_fetch_sidebar">"サイドバーが取得できませんでした"</string> - <string name="cannot_fetch_multireddit">"マルチReddit情報が取得できませんでした"</string> + <string name="cannot_fetch_multireddit">"カスタムフィードの情報が取得できませんでした"</string> <string name="subscribe">"登録する"</string> <string name="unsubscribe">"登録を解除する"</string> <string name="subscribed">"登録済み"</string> @@ -139,12 +143,12 @@ <string name="unfollowed">"フォローを解除しました"</string> <string name="unfollow_failed">"フォローの解除に失敗しました"</string> <string name="content_description_banner_imageview">"Subredditのバナー画像"</string> - <string name="app_label">"Infinity"</string> + <string name="app_label">"ホーム - Infinity"</string> <string name="search_hint">"何でも検索してみてください"</string> <string name="no_posts_no_lazy_mode">"投稿がありません"</string> <string name="lazy_mode_start">"%1$.1f秒後に自動スクロールが始まります"</string> <string name="lazy_mode_stop">"自動スクロールを停止しました"</string> - <string name="write_comment_hint">"面白いコメントをここに"</string> + <string name="write_comment_hint">"面白いコメントを書いてみましょう"</string> <string name="comment_content_required">"コメント内容が必要です"</string> <string name="sending_comment">"送信中"</string> <string name="send_comment_success">"送信しました"</string> @@ -179,7 +183,7 @@ <string name="post_link_hint">"URL"</string> <string name="subreddits">"Subreddit"</string> <string name="users">"ユーザー"</string> - <string name="multi_reddits">"マルチReddit"</string> + <string name="multi_reddits">"カスタムフィード"</string> <string name="bottom_sheet_post_text">"テキスト"</string> <string name="bottom_sheet_post_link">"リンク"</string> <string name="bottom_sheet_post_image">"画像"</string> @@ -214,7 +218,7 @@ <!-- There's no proper word for "controversial" in Japanese, so I've made it the phonetic translation. --> <!-- Fuzzy --> <string name="sort_controversial">"論争中"</string> - <string name="sort_relevance">"関連性"</string> + <string name="sort_relevance">"関連度"</string> <string name="sort_comments">"コメント"</string> <string name="sort_activity">"アクティビィティ"</string> @@ -304,7 +308,7 @@ <string name="update_flair_success">"フレアーを更新しました"</string> <string name="update_flair_failed">"フレアーを更新できませんでした"</string> <string name="edit_flair">"フレアーを編集"</string> - <string name="only_allow_64_chars">"64文字未満までが許可されます"</string> + <string name="only_allow_64_chars">"63文字まで入力可能です"</string> <string name="view_all_comments">"タップして全てのコメントを表示"</string> <string name="notification_summary_account">"アカウント"</string> <string name="notification_summary_message">"新しいメッセージ"</string> @@ -329,16 +333,14 @@ <string name="settings_video_autoplay_title">"動画を自動再生"</string> <string name="settings_mute_autoplaying_videos_title">"自動再生の動画をミュート"</string> <string name="settings_autoplay_nsfw_videos_title">"NSFW動画を自動再生"</string> - <string name="settings_start_autoplay_visible_area_offset_portrait_title">"自動再生開始の表示オフセット(縦画面)"</string> + <string name="settings_start_autoplay_visible_area_offset_portrait_title">"自動再生開始の表示オフセット(縦画面時)"</string> <string name="settings_start_autoplay_visible_area_offset_portrait_summary">"%1$d%%の動画エリアが画面内に収まっている場合に自動再生を開始します"</string> - <string name="settings_start_autoplay_visible_area_offset_landscape_title">"自動再生開始の表示オフセット(横画面)"</string> + <string name="settings_start_autoplay_visible_area_offset_landscape_title">"自動再生開始の表示オフセット(横画面時)"</string> <string name="settings_start_autoplay_visible_area_offset_landscape_summary">"%1$d%%の動画エリアが画面内に収まっている場合に自動再生を開始します"</string> <!-- Fuzzy --> <string name="settings_immersive_interface_title">"没入型インターフェース"</string> - - <!-- Fuzzy --> - <string name="settings_immersive_interface_summary">"全てのページには適用されません"</string> + <string name="settings_immersive_interface_summary">"一部のページでは動作しません"</string> <!-- Fuzzy --> <string name="settings_immersive_interface_ignore_nav_bar_title">"没入型インターフェースでナビゲーションバーを無視"</string> @@ -361,7 +363,7 @@ <string name="settings_show_comment_divider_title">"コメントの分割線を表示"</string> <string name="settings_comment_toolbar_hide_on_click">"タップでコメントツールバーを表示/非表示"</string> <string name="settings_fully_collapse_comment_title">"コメントを完全に折りたたむ"</string> - <string name="settings_comment_toolbar_hidden">"標準でコメントツールバーを非表示"</string> + <string name="settings_comment_toolbar_hidden">"コメントツールバーを標準で非表示"</string> <string name="settings_show_absolute_number_of_votes_title">"評価の絶対数を表示"</string> <string name="settings_show_elapsed_time">"投稿とコメントの日時を経過時間で表示"</string> <string name="settings_time_format_title">"日時の表示書式"</string> @@ -371,10 +373,10 @@ <string name="settings_show_thumbnail_on_the_left_in_compact_layout">"コンパクトレイアウトでサムネイルを左側に表示"</string> <string name="settings_swap_tap_and_long_title">"コメントでタップと長押しの操作を入れ替え"</string> <string name="settings_swipe_to_go_back_title">"右スワイプで前の画面に戻る"</string> - <string name="settings_swipe_to_go_back_summary">"全てのページには適用されません"</string> + <string name="settings_swipe_to_go_back_summary">"一部のページでは動作しません"</string> <string name="settings_lock_jump_to_next_top_level_comment_button_title">"次の最上位コメントへ移動ボタンを常に表示"</string> <string name="settings_lock_bottom_app_bar_title">"下部ナビゲーションバーを常に表示"</string> - <string name="settings_swipe_up_to_hide_jump_to_next_top_level_comment_button_title">"次の最上位コメントへ移動ボタンを上スクロールで隠す(OFF=下スクロールで隠す)"</string> + <string name="settings_swipe_up_to_hide_jump_to_next_top_level_comment_button_title">"次の最上位コメントへ移動ボタンを上スクロールで非表示(OFF=下スクロールで非表示)"</string> <string name="settings_lazy_mode_interval_title">"自動スクロール間隔"</string> <string name="settings_font_title">"フォント"</string> <string name="settings_preview_font_title">"フォントのプレビュー"</string> @@ -389,7 +391,7 @@ <string name="settings_font_size_title">"フォントサイズ"</string> <string name="settings_title_font_size_title">"フォントサイズ"</string> <string name="settings_content_font_size_title">"フォントサイズ"</string> - <string name="settings_enable_nsfw_title">"NSFW(職場閲覧注意)を有効化"</string> + <string name="settings_enable_nsfw_title">"NSFWを有効化"</string> <string name="settings_blur_nsfw_title">"NSFW画像をぼかして表示"</string> <string name="settings_blur_spoiler_title">"ネタバレ画像をぼかして表示"</string> @@ -405,7 +407,7 @@ <string name="settings_credits_icon_background_summary">"freepikにより作成されたBackground vectorを使用しています - www.freepik.com"</string> <string name="settings_credits_error_image_title">"エラー時の画像"</string> <string name="settings_credits_error_image_summary">"freepikにより作成されたTechnology vectorを使用しています - www.freepik.com"</string> - <string name="settings_credits_gilded_icon_title">"金ピカアイコン"</string> + <string name="settings_credits_gilded_icon_title">"アワードアイコン"</string> <string name="settings_credits_gilded_icon_summary">"Freepikにより作成されたアイコンを使用しています - www.flaticon.com"</string> <string name="settings_credits_crosspost_icon_title">"クロスポストアイコン"</string> <string name="settings_credits_crosspost_icon_summary">"Freepikにより作成されたアイコンを使用しています - www.flaticon.com"</string> @@ -448,10 +450,10 @@ <string name="settings_tab_1_summary">"タブ1"</string> <string name="settings_tab_2_summary">"タブ2"</string> <string name="settings_tab_3_summary">"タブ3"</string> - <string name="settings_tab_title">"タイトル"</string> - <string name="settings_tab_post_type">"種類"</string> + <string name="settings_tab_title">"タブ名"</string> + <string name="settings_tab_post_type">"表示内容"</string> <string name="settings_tab_subreddit_name">"Subreddit名 (「r/」は不要)"</string> - <string name="settings_tab_multi_reddit_name">"マルチReddit名 (/user/あなたのユーザー名/m/あなたのマルチReddit名)"</string> + <string name="settings_tab_multi_reddit_name">"カスタムフィード名 (/user/あなたのユーザー名/m/あなたのカスタムフィード名)"</string> <string name="settings_tab_username">"ユーザー名 (「u/」は不要)"</string> <string name="no_developer_easter_egg">"開発者オプションはありません"</string> <string name="no_link_available">"リンクを取得できませんでした"</string> @@ -491,8 +493,8 @@ <string name="elapsed_time_months_ago">"%1$dヶ月"</string> <string name="elapsed_time_a_year_ago">"1年"</string> <string name="elapsed_time_years_ago">"%1$d年"</string> - <string name="error_getting_multi_reddit_data">"マルチRedditデータを取得中にエラーが発生しました"</string> - <string name="error_loading_multi_reddit_list">"マルチRedditの同期ができませんでした"</string> + <string name="error_getting_multi_reddit_data">"カスタムフィードのデータを取得中にエラーが発生しました"</string> + <string name="error_loading_multi_reddit_list">"カスタムフィードの同期ができませんでした"</string> <string name="error_loading_subscriptions">"登録済み情報を同期できませんでした"</string> <string name="share_this_app">"便利なRedditアプリを見つけました。Infinity for Redditを試してみて! https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforreddit"</string> @@ -523,9 +525,9 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="private_multi_reddit">"プライベート"</string> <string name="select_subreddits">"Subredditを選択"</string> <string name="no_multi_reddit_name">"名前が必要です。"</string> - <string name="create_multi_reddit_failed">"このマルチRedditを作成できませんでした"</string> - <string name="duplicate_multi_reddit">"このマルチRedditは既に存在しています"</string> - <string name="edit_multi_reddit_failed">"このマルチRedditを編集できませんでした"</string> + <string name="create_multi_reddit_failed">"このカスタムフィードを作成できませんでした"</string> + <string name="duplicate_multi_reddit">"このカスタムフィードは既に存在しています"</string> + <string name="edit_multi_reddit_failed">"このカスタムフィードを編集できませんでした"</string> <string name="logged_out">"ログアウト状態です"</string> <string name="delete_multi_reddit_success">"削除が完了しました"</string> <string name="delete_multi_reddit_failed">"削除できませんでした"</string> @@ -547,7 +549,7 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="theme_item_color_primary_dark_detail">"適用先: ステータスバー"</string> <string name="theme_item_color_accent">"アクセント"</string> <string name="theme_item_color_accent_detail">"適用先: プログレスバー、その他"</string> - <string name="theme_item_color_primary_light_theme">"プライマリー ライトテーマ"</string> + <string name="theme_item_color_primary_light_theme">"プライマリー ライト"</string> <string name="theme_item_color_primary_light_theme_detail">"適用先: アクションボタンとボタンの背景"</string> <string name="theme_item_primary_text_color">"プライマリー テキスト"</string> <string name="theme_item_primary_text_color_detail">"適用先: プライマリーテキスト"</string> @@ -562,7 +564,7 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="theme_item_button_text_color">"ボタン テキスト"</string> <string name="theme_item_button_text_color_detail">"適用先: ボタンのテキスト"</string> <string name="theme_item_chip_text_color">"チップ テキスト"</string> - <string name="theme_item_chip_text_color_detail">"適用先: 登録ボタン"</string> + <string name="theme_item_chip_text_color_detail">"適用先: 未登録の際に表示される登録ボタン"</string> <string name="theme_item_link_color">"リンク"</string> <string name="theme_item_link_color_detail">"適用先: URL"</string> <string name="theme_item_received_message_text_color">"受信メッセージ テキスト"</string> @@ -617,30 +619,30 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_text_color_detail">"適用先: タブレイアウトの折りたたまれたツールバーのテキスト"</string> <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_tab_indicator">"タブレイアウトの折りたたまれたツールバー タブインジケーター"</string> <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_tab_indicator_detail">"適用先: タブレイアウトの折りたたまれたツールバーのタブインジケーター"</string> - <string name="theme_item_upvoted_color">"上評価"</string> - <string name="theme_item_upvoted_color_detail">"適用先: 上評価されている評価ボタン、スコア"</string> - <string name="theme_item_downvoted_color">"下評価"</string> - <string name="theme_item_downvoted_color_detail">"適用先: 下評価されている評価ボタン、スコア"</string> + <string name="theme_item_upvoted_color">"プラス評価"</string> + <string name="theme_item_upvoted_color_detail">"適用先: プラス評価した評価ボタン、スコア"</string> + <string name="theme_item_downvoted_color">"マイナス評価"</string> + <string name="theme_item_downvoted_color_detail">"適用先: マイナス評価した評価ボタン、スコア"</string> <string name="theme_item_post_type_background_color">"投稿種類 背景"</string> <string name="theme_item_post_type_background_color_detail">"適用先: 投稿種類の背景(画像、テキスト、動画、GIF、リンク)"</string> <string name="theme_item_post_type_text_color">"投稿種類 テキスト"</string> <string name="theme_item_post_type_text_color_detail">"適用先: 投稿種類のテキスト(画像、テキスト、動画、GIF、リンク)"</string> <string name="theme_item_spoiler_background_color">"ネタバレ 背景"</string> - <string name="theme_item_spoiler_background_color_detail">"適用先: ネタバレタグの背景"</string> + <string name="theme_item_spoiler_background_color_detail">"適用先: ネタバレ フレアーの背景"</string> <string name="theme_item_spoiler_text_color">"ネタバレ テキスト"</string> - <string name="theme_item_spoiler_text_color_detail">"適用先: ネタバレタグのテキスト"</string> + <string name="theme_item_spoiler_text_color_detail">"適用先: ネタバレ フレアーのテキスト"</string> <string name="theme_item_nsfw_background_color">"NSFW 背景"</string> - <string name="theme_item_nsfw_background_color_detail">"適用先: NSFWタグの背景"</string> + <string name="theme_item_nsfw_background_color_detail">"適用先: NSFWフレアーの背景"</string> <string name="theme_item_nsfw_text_color">"NSFW テキスト"</string> - <string name="theme_item_nsfw_text_color_detail">"適用先: NSFWタグのテキスト"</string> + <string name="theme_item_nsfw_text_color_detail">"適用先: NSFWフレアーのテキスト"</string> <string name="theme_item_flair_background_color">"フレアー 背景"</string> <string name="theme_item_flair_background_color_detail">"適用先: フレアーの背景"</string> <string name="theme_item_flair_text_color">"フレアー テキスト"</string> <string name="theme_item_flair_text_color_detail">"適用先: フレアーのテキスト"</string> <string name="theme_item_awards_background_color">"アワード 背景"</string> - <string name="theme_item_awards_background_color_detail">"適用先: アワードタグの背景"</string> + <string name="theme_item_awards_background_color_detail">"適用先: アワード フレアーの背景"</string> <string name="theme_item_awards_text_color">"アワード テキスト"</string> - <string name="theme_item_awards_text_color_detail">"適用先: アワードタグのテキスト"</string> + <string name="theme_item_awards_text_color_detail">"適用先: アワード フレアーのテキスト"</string> <string name="theme_item_archived_tint">"アーカイブ アイコン"</string> <string name="theme_item_archived_tint_detail">"適用先: アーカイブのアイコン"</string> <string name="theme_item_locked_icon_tint">"ロック アイコン"</string> @@ -652,7 +654,7 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="theme_item_stickied_post_icon_tint">"ピン留めされた投稿 アイコン"</string> <string name="theme_item_stickied_post_icon_tint_detail">"適用先: ピン留めされた投稿のアイコン"</string> <string name="theme_item_subscribed_color">"登録済み"</string> - <string name="theme_item_subscribed_color_detail">"適用先: 登録解除ボタン"</string> + <string name="theme_item_subscribed_color_detail">"適用先: 登録済みの際に表示される登録解除ボタン"</string> <string name="theme_item_unsubscribed_color">"未登録"</string> <string name="theme_item_unsubscribed_color_detail">"適用先: 登録ボタン"</string> <string name="theme_item_username_color">"ユーザー名"</string> @@ -671,10 +673,8 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="theme_item_unread_message_background_color_detail">"適用先: 未読メッセージの背景"</string> <string name="theme_item_divider_color">"分割線"</string> <string name="theme_item_divider_color_detail">"適用先: コメントの分割線、投稿時のページ分割線、等"</string> - <string name="theme_item_no_preview_post_type_background_color">"プレビューのないリンク 背景"</string> - <string name="theme_item_no_preview_post_type_background_color_detail">"適用先: プレビューのないリンクの背景"</string> <string name="theme_item_vote_and_reply_unavailable_button_color">"評価と返信ボタン 無効状態"</string> - <string name="theme_item_vote_and_reply_unavailable_button_color_detail">"適用先: 無効となっている評価と返信ボタン"</string> + <string name="theme_item_vote_and_reply_unavailable_button_color_detail">"適用先: 無効になっている評価と返信ボタン"</string> <string name="theme_item_comment_vertical_bar_color_1">"コメント 縦線1"</string> <string name="theme_item_comment_vertical_bar_color_1_detail">"適用先: コメントの縦線 レベル1"</string> <string name="theme_item_comment_vertical_bar_color_2">"コメント 縦線2"</string> @@ -721,7 +721,7 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="edit_theme_name">"テーマ名を編集"</string> <string name="edit_theme">"テーマを編集"</string> <string name="delete_theme">"テーマを削除"</string> - <string name="delete_theme_dialog_message">"%1$s を削除してよろしいですか?"</string> + <string name="delete_theme_dialog_message">"「%1$s」を削除してよろしいですか?"</string> <string name="share_theme">"テーマを共有"</string> <string name="change_theme_name">"名前を変更"</string> <string name="theme_copied">"コピーしました。貼り付けて共有することができます。"</string> @@ -738,7 +738,7 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <!-- Fuzzy --> <string name="duplicate_theme_name_dialog_title">"同じテーマが登録済みです"</string> - <string name="duplicate_theme_name_dialog_message">"%1$s と名付けられているテーマが既に存在します。インポートするテーマの名前を変更しますか?"</string> + <string name="duplicate_theme_name_dialog_message">"「%1$s」と名付けられているテーマが既に存在します。インポートするテーマの名前を変更しますか?"</string> <string name="rename">"名前を変更"</string> <string name="override">"上書き"</string> <string name="color_picker">"色を選択してください"</string> @@ -777,8 +777,8 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="awards_preview">"4個のアワード"</string> <string name="author_flair_preview">"投稿主フレアー"</string> <string name="comment_content_preview">"オチがないのがオチなんですね。"</string> - <string name="edit_multi_reddit">"マルチRedditを編集"</string> - <string name="delete_multi_reddit">"マルチRedditを削除"</string> + <string name="edit_multi_reddit">"カスタムフィードを編集"</string> + <string name="delete_multi_reddit">"カスタムフィードを削除"</string> <string name="n_awards">"%1$d個のアワード"</string> <string name="one_award">"1個のアワード"</string> <string name="report">"通報"</string> @@ -802,7 +802,7 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="downloading_reddit_video">"動画トラックをダウンロード中です"</string> <string name="downloading_reddit_video_audio_track">"音声トラックをダウンロード中です"</string> - <!-- Shouldn't the english translation be + <!-- Shouldn't the english translation be "Mixing Video and Audio"? --> <string name="downloading_reddit_video_muxing">"動画と音声をミックス中です"</string> <string name="downloading_reddit_video_save_file_to_public_dir">"動画を保存中です"</string> @@ -818,7 +818,7 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="set_to_home_screen">"ホーム画面に設定"</string> <string name="set_to_lock_screen">"ロック画面に設定"</string> <string name="set_to_both">"両方に設定"</string> - <string name="default_font_font_preview">"標準"</string> + <string name="default_font_font_preview">"Default"</string> <string name="load_video_in_redgifs">"Redgifsから動画のロードを試行"</string> <string name="top_score">"%1$s点"</string> <string name="login_activity_2fa_prompt">"2段階認証を有効にしている場合、パスワードは次のように入力してください 「<パスワード>:<2段階認証コード>」。 @@ -835,9 +835,9 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="sidebar">"サイドバー"</string> <string name="only_for_logged_in_user">"ログイン済みユーザー用"</string> <string name="settings_number_of_columns_in_post_feed_title">"投稿フィードの表示列数"</string> - <string name="settings_number_of_columns_in_post_feed_portrait_title">"縦画面"</string> - <string name="settings_number_of_columns_in_post_feed_landscape_title">"横画面"</string> - <string name="settings_nsfw_and_spoiler_title">"NSFWとネタバレ"</string> + <string name="settings_number_of_columns_in_post_feed_portrait_title">"縦画面時"</string> + <string name="settings_number_of_columns_in_post_feed_landscape_title">"横画面時"</string> + <string name="settings_nsfw_and_spoiler_title">"NSFW(職場閲覧注意)とネタバレ"</string> <string name="settings_delete_all_legacy_settings_title">"古い設定データを削除"</string> <string name="restart_app_see_changes">"変更を適用するにはアプリを再起動してください"</string> <string name="settings_tab_count">"タブ数"</string> @@ -854,15 +854,14 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="settings_video_download_location_title">"動画ダウンロード先のフォルダー"</string> <string name="settings_separate_folder_for_each_subreddit">"Subreddit毎にフォルダーを分ける"</string> <string name="settings_swipe_action_title">"スワイプアクション"</string> - <string name="settings_swipe_action_haptic_feedback_title">"アクションが実行される際にデバイスをバイブ"</string> <string name="settings_disable_swiping_between_tabs_title">"スワイプによるタブ切り替えを無効化"</string> <string name="settings_enable_swipe_action_title">"スワイプアクションを有効化"</string> <string name="settings_swipe_action_threshold">"しきい値"</string> <string name="settings_pull_to_refresh_title">"引き下げて更新"</string> <string name="settings_security_title">"セキュリティ"</string> <string name="settings_require_authentication_to_go_to_account_section_in_navigation_drawer_title">"ナビゲーションドロワーからアカウントに移動する際に認証を要求"</string> - <string name="settings_long_press_to_hide_toolbar_in_compact_layout_title">"コンパクトレイアウトのツールバーを長押しで隠す"</string> - <string name="settings_post_compact_layout_toolbar_hidden_by_default_title">"コンパクトレイアウトのツールバーを標準で隠す"</string> + <string name="settings_long_press_to_hide_toolbar_in_compact_layout_title">"コンパクトレイアウトのツールバーを長押しで非表示"</string> + <string name="settings_post_compact_layout_toolbar_hidden_by_default_title">"コンパクトレイアウトのツールバーを標準で非表示"</string> <string name="settings_customize_bottom_app_bar_title">"下部ナビゲーションバーをカスタマイズ"</string> <string name="settings_main_activity_bottom_app_bar_group_summary">"メインページ"</string> <string name="settings_other_activities_bottom_app_bar_group_summary">"他のページ"</string> @@ -873,10 +872,12 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="settings_bottom_app_bar_option_4">"ボタン4"</string> <string name="settings_bottom_app_bar_fab">"アクションボタン"</string> <string name="settings_data_saving_mode">"データ節約モード"</string> + + <!-- Fuzzy --> <string name="settings_data_saving_mode_info_summary">"データ節約モードではプレビュー画像の解像度が下がります。"</string> <string name="settings_translation_title">"翻訳"</string> - <string name="settings_translation_summary">"このアプリの翻訳はPOEditorで行うことができます。貢献いただきありがとうございます。"</string> - <string name="settings_credits_national_flags">"国旗"</string> + <string name="settings_translation_summary">"このアプリの翻訳はPOEditorで行うことができます。ご協力いただきありがとうございます。"</string> + <string name="settings_credits_national_flags">"国旗アイコン"</string> <string name="settings_credits_national_flags_summary">"Freepikにより作成されたアイコンを使用しています - www.flaticon.com"</string> <string name="copy_failed">"コピーできませんでした"</string> <string name="delete_all_legacy_settings_success">"古い設定データを削除しました"</string> @@ -895,7 +896,7 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="link_hint">"リンク"</string> <string name="unlock_account_section">"アカウント設定をアンロック"</string> <string name="unlock">"アンロック"</string> - <string name="submit_post">"投稿を送信"</string> + <string name="submit_post">"投稿を作成"</string> <string name="refresh">"更新"</string> <string name="change_sort_type">"並べ替えを変更"</string> <string name="change_post_layout">"表示レイアウトを変更"</string> @@ -915,10 +916,29 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="go_to_user">"ユーザーに移動"</string> <string name="go_to_thing_hint">"名前"</string> <string name="random">"ランダム"</string> - <string name="random_subreddit">"ランダムなSubreddit"</string> - <string name="random_nsfw_subreddit">"ランダムなNSFW Subreddit"</string> - <string name="random_post">"ランダムな投稿"</string> - <string name="random_nsfw_post">"ランダムなNSFW投稿"</string> + <string name="random_subreddit">"ランダムなSubredditに移動"</string> + <string name="random_nsfw_subreddit">"ランダムなNSFW Subredditに移動"</string> + <string name="random_post">"ランダムな投稿に移動"</string> + <string name="random_nsfw_post">"ランダムなNSFW投稿に移動"</string> <string name="fetch_random_thing_failed">"後ほど再度お試しください"</string> <string name="downloading">"ダウンロード中"</string> + <string name="subreddit_filter_popular_and_all_activity_label">"r/all と r/popular"</string> + <string name="settings_miscellaneous_title">"その他の設定"</string> + <string name="settings_respect_subreddit_recommended_comment_sort_type_title">"Subredditで推奨されているコメントの並び順を使用"</string> + <string name="settings_respect_subreddit_recommended_comment_sort_type_summary">"コメントの並び順は保存されません"</string> + <string name="settings_post_filter_title">"フィルター"</string> + <string name="settings_subreddit_filter_category">"Subredditを非表示"</string> + <string name="settings_subreddit_filter_popular_and_all">"r/all と r/popular 内"</string> + <string name="settings_credits_ufo_capturing_animation_title">"UFO捕獲アニメーション"</string> + <string name="select_video_quality">"動画の品質を選択"</string> + <string name="settings_swipe_action_haptic_feedback_title">"触覚フィードバック"</string> + <string name="settings_hide_subreddit_description_title">"Subredditの説明文を隠す"</string> + <string name="settings_disable_image_preview_title">"データ節約モードでは画像プレビューを無効化"</string> + <string name="settings_swipe_action_swipe_left_title">"左にスワイプ"</string> + <string name="settings_swipe_action_swipe_right_title">"右にスワイプ"</string> + <string name="settings_swipe_action_info_summary">"複数列表示されている投稿フィードと投稿詳細画面では適用されません"</string> + <string name="theme_item_no_preview_post_type_icon_tint">"プレビューのない投稿 種類アイコン"</string> + <string name="theme_item_no_preview_post_type_icon_tint_detail">"適用先: プレビューのない投稿種類アイコン"</string> + <string name="theme_item_no_preview_post_type_background_color">"プレビューのない投稿 アイコンの背景"</string> + <string name="theme_item_no_preview_post_type_background_color_detail">"適用先: プレビューのない投稿種類表示用プレースホルダー"</string> </resources>
\ No newline at end of file diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index c7dbc5a3..81f4493a 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -4,11 +4,11 @@ <string name="search_activity_label">"Buscar"</string> <string name="comment_activity_label">"Comentar"</string> <string name="comment_activity_label_is_replying">"Responder"</string> - <string name="post_text_activity_label">"Post em Texto"</string> + <string name="post_text_activity_label">"Postar Texto"</string> <string name="subreddit_selection_activity_label">"Selecionar um Subreddit"</string> - <string name="post_link_activity_label">"Post em Link"</string> - <string name="post_image_activity_label">"Post em Imagem"</string> - <string name="post_video_activity_label">"Post em Vídeo"</string> + <string name="post_link_activity_label">"Postar Link"</string> + <string name="post_image_activity_label">"Postar Imagem"</string> + <string name="post_video_activity_label">"Postar Vídeo"</string> <string name="rules_activity_label">"Regras"</string> <string name="search_subreddits_activity_label">"Subreddits"</string> <string name="edit_post_activity_label">"Editar Post"</string> @@ -21,7 +21,7 @@ <string name="custom_theme_listing_activity_label">"Temas Personalizados"</string> <string name="customize_theme_activity_label">"Editar Tema"</string> <string name="customize_theme_activity_create_theme_label">"Criar Tema"</string> - <string name="theme_preview_activity_label">"Visualizar Tema"</string> + <string name="theme_preview_activity_label">"Pré-visualizar Tema"</string> <string name="edit_multi_reddit_activity_label">"Editar Multireddit"</string> <string name="selected_subeddits_activity_label">"Subreddits Selecionados"</string> <string name="report_activity_label">"Reportar"</string> @@ -31,69 +31,73 @@ <string name="view_reddit_gallery_activity_image_label">"Imagem %1$d/%2$d"</string> <string name="view_reddit_gallery_activity_gif_label">"Gif %1$d/%2$d"</string> <string name="view_reddit_gallery_activity_video_label">"Vídeo %1$d/%2$d"</string> - <string name="navigation_drawer_open">"Abrir Menu de Navegação"</string> - <string name="navigation_drawer_close">"Fechar Menu de Navegação"</string> - <string name="action_download">"Download"</string> + <string name="navigation_drawer_open">"Abrir menu de navegação"</string> + <string name="navigation_drawer_close">"Fechar menu de navegação"</string> + <string name="action_download">"Baixar"</string> <string name="action_refresh">"Atualizar"</string> <string name="action_add_comment">"Adicionar um comentário"</string> <string name="action_save_post">"Salvar post"</string> - - <!-- Fuzzy --> - <string name="action_view_crosspost_parent">"Post original"</string> + <string name="action_view_crosspost_parent">"Ver origem do crosspost"</string> <string name="action_search">"Buscar"</string> - <string name="action_start_lazy_mode">"Iniciar modo lento"</string> - <string name="action_stop_lazy_mode">"Parar modo lento"</string> + <string name="action_start_lazy_mode">"Iniciar Modo Preguiçoso"</string> + <string name="action_stop_lazy_mode">"Parar Modo Preguiçoso"</string> <string name="action_send">"Enviar"</string> - <string name="action_sort">"Exibir"</string> + <string name="action_sort">"Classificar"</string> <string name="action_hide_post">"Ocultar Post"</string> <string name="action_unhide_post">"Exibir Post"</string> <string name="action_edit_post">"Editar Post"</string> <string name="action_delete_post">"Deletar Post"</string> - <string name="action_mark_nsfw">"Marcar NSFW"</string> - <string name="action_unmark_nsfw">"Desmarcar NSFW"</string> - <string name="action_mark_spoiler">"Marcar Spoiler"</string> - <string name="action_unmark_spoiler">"Desmarcar Spoiler"</string> - <string name="action_edit_flair">"Editar Flair"</string> - <string name="action_change_post_layout">"Alterar Layout do Post"</string> + <string name="action_mark_nsfw">"Marcar como NSFW"</string> + <string name="action_unmark_nsfw">"Desmarcar como NSFW"</string> + <string name="action_mark_spoiler">"Marcar como Spoiler"</string> + <string name="action_unmark_spoiler">"Desmarcar como Spoiler"</string> + <string name="action_edit_flair">"Editar Etiqueta"</string> + <string name="action_change_post_layout">"Alterar Aparência do Post"</string> <string name="action_save">"Salvar"</string> <string name="action_edit_multi_reddit">"Editar MultiReddit"</string> - <string name="action_delete_multi_reddit">"Deletar MultiReddit"</string> + <string name="action_delete_multi_reddit">"Excluir MultiReddit"</string> <string name="action_share">"Compartilhar"</string> - <string name="action_preview">"Pré-visualização"</string> + <string name="action_preview">"Pré-visualizar"</string> <string name="action_report">"Reportar"</string> <string name="action_see_removed">"Ver Removido"</string> - <string name="action_set_wallpaper">"Configurar como Plano de Fundo"</string> + <string name="action_set_wallpaper">"Definir como Papel de Parede"</string> <string name="action_send_private_message">"Enviar Mensagem Privada"</string> <string name="action_block_user">"Bloquear Usuário"</string> - <string name="parse_json_response_error">"Um erro ocorreu durante a análise de resposta do JSON"</string> - <string name="retrieve_token_error">"Erro recuperando o token"</string> - <string name="something_went_wrong">"Algo ocorreu errado. Tente novamente."</string> - <string name="access_denied">"Acesso Negado"</string> - <string name="parse_user_info_error">"Um erro ocorreu na análise de informação do usuário"</string> - <string name="no_system_webview_error">"Erro ao abrir WebView do sistema"</string> - <string name="error_loading_image_tap_to_retry">"Erro ao carregar a imagem. Toque para recarregar."</string> - <string name="load_posts_error">"Erro ao carregar posts. Toque para recarregar."</string> - <string name="load_more_posts_error">"Erro ao carregar posts."</string> - <string name="load_post_error">"Erro ao carregar este post. Toque para recarregar."</string> - <string name="search_subreddits_error">"Erro ao buscar subreddits. Toque para recarregar."</string> - <string name="search_users_error">"Erro ao buscar usuários. Toque para recarregar."</string> + <string name="parse_json_response_error">"Ocorreu uma falha ao analisar a resposta do JSON"</string> + <string name="retrieve_token_error">"Falha ao recuperar token"</string> + <string name="something_went_wrong">"Algo deu errado. Tente novamente mais tarde."</string> + <string name="access_denied">"Acesso negado"</string> + <string name="parse_user_info_error">"Ocorreu uma falha ao analisar a informação do usuário"</string> + <string name="no_system_webview_error">"Falha ao abrir o WebView do Sistema"</string> + <string name="error_loading_image_tap_to_retry">"Falha ao carregar a imagem. Toque para tentar novamente."</string> + <string name="load_posts_error">"Falha ao carregar posts. +Toque para tentar novamente."</string> + <string name="load_more_posts_error">"Falha ao carregar posts."</string> + <string name="load_post_error">"Falha ao carregar este post. +Toque para tentar novamente."</string> + <string name="search_subreddits_error">"Falha ao buscar subreddits. +Toque para tentar novamente."</string> + <string name="search_users_error">"Falha ao buscar usuários. +Toque para tentar novamente."</string> <string name="no_posts">"Nenhum post encontrado"</string> <string name="no_comments">"Nenhum comentário encontrado"</string> <string name="no_subreddits">"Nenhum subreddit encontrado"</string> <string name="no_users">"Nenhum usuário encontrado"</string> <string name="no_multi_reddits">"Nenhum MultiReddit encontrado"</string> - <string name="no_storage_permission">"Sem permissões de armazenamento para salvar este arquivo."</string> - <string name="load_comments_failed">"Erro ao carregar comentários. Toque para recarregar."</string> - <string name="retry">"Recarregar"</string> + <string name="no_storage_permission">"Nenhuma permissão de armazenamento para salvar este arquivo"</string> + <string name="load_comments_failed">"Falha ao carregar comentários. +Toque para tentar novamente."</string> + <string name="retry">"Tentar novamente"</string> <string name="comments">"Comentários"</string> <string name="no_comments_yet">"Nenhum comentário ainda. Escrever um comentário?"</string> - <string name="vote_failed">"Erro ao votar"</string> - <string name="refresh_post_failed">"Erro ao atualizar o post"</string> - <string name="load_messages_failed">"Erro ao carregar as mensagens. Toque para recarregar."</string> + <string name="vote_failed">"Falha ao votar"</string> + <string name="refresh_post_failed">"Falha ao atualizar o post"</string> + <string name="load_messages_failed">"Falha ao carregar as mensagens. +Toque para tentar novamente."</string> <string name="no_messages">"Vazio"</string> <string name="nsfw">"NSFW"</string> - <string name="karma_info">"Carma: %1$d"</string> - <string name="karma_info_user_detail">"Carma: %1$d (%2$d + %3$d)"</string> + <string name="karma_info">"Karma: %1$d"</string> + <string name="karma_info_user_detail">"Karma: %1$d (%2$d + %3$d)"</string> <string name="cakeday_info">"Dia do bolo: %1$s"</string> <string name="since">"Desde:"</string> <string name="profile">"Perfil"</string> @@ -108,53 +112,53 @@ <string name="settings">"Configurações"</string> <string name="subscribers_number_detail">"Inscritos: %1$d"</string> <string name="online_subscribers_number_detail">"Online: %1$d"</string> - <string name="cannot_fetch_subreddit_info">"Não foi possível buscar informações do subreddit"</string> - <string name="cannot_fetch_user_info">"Não foi possível buscar informações do usuário"</string> - <string name="cannot_fetch_sidebar">"Não foi possível buscar informações da Barra Lateral"</string> - <string name="cannot_fetch_multireddit">"Não foi possível buscar informações do MultiReddit"</string> - <string name="subscribe">"Inscrever"</string> + <string name="cannot_fetch_subreddit_info">"Não foi possível obter informações do subreddit"</string> + <string name="cannot_fetch_user_info">"Não foi possível obter informações do usuário"</string> + <string name="cannot_fetch_sidebar">"Não foi possível obter a descrição"</string> + <string name="cannot_fetch_multireddit">"Não foi possível obter informações do MultiReddit"</string> + <string name="subscribe">"Inscrever-se"</string> <string name="unsubscribe">"Cancelar Inscrição"</string> <string name="subscribed">"Inscrito"</string> - <string name="subscribe_failed">"Falha ao inscrever-se"</string> - <string name="unsubscribed">"Inscrição cancelada"</string> - <string name="unsubscribe_failed">"Falha no cancelamento de inscrição"</string> + <string name="subscribe_failed">"Falha ao Inscrever-se"</string> + <string name="unsubscribed">"Inscrição Cancelada"</string> + <string name="unsubscribe_failed">"Falha ao Cancelar Inscrição"</string> <string name="follow">"Seguir"</string> <string name="unfollow">"Parar de Seguir"</string> - <string name="followed">"Seguindo por"</string> + <string name="followed">"Seguindo"</string> <string name="follow_failed">"Falha ao Seguir"</string> - <string name="unfollowed">"Não mais seguidos"</string> - <string name="unfollow_failed">"Falha ao parar de seguir"</string> - <string name="content_description_banner_imageview">"Imagem de baner do subreddit"</string> + <string name="unfollowed">"Parou de Seguir"</string> + <string name="unfollow_failed">"Falha ao Parar de Seguir"</string> + <string name="content_description_banner_imageview">"Imagem do Banner do Subreddit"</string> <string name="app_label">"Infinity"</string> - <string name="search_hint">"Pesquise qualquer coisa"</string> + <string name="search_hint">"Busque qualquer coisa"</string> <string name="no_posts_no_lazy_mode">"Nenhum post disponível"</string> - <string name="lazy_mode_start">"Modo Lento inicia em %1$.1fs"</string> - <string name="lazy_mode_stop">"Modo Lento parou"</string> - <string name="write_comment_hint">"Escreva algo de interessante"</string> + <string name="lazy_mode_start">"Modo Preguiçoso inicia em %1$.1fs"</string> + <string name="lazy_mode_stop">"Modo Preguiçoso parou"</string> + <string name="write_comment_hint">"Escreva algo interessante"</string> <string name="comment_content_required">"Onde está seu comentário?"</string> <string name="sending_comment">"Enviando"</string> - <string name="send_comment_success">"Comentário Enviado"</string> - <string name="send_comment_failed">"Não foi possível enviar seu comentário"</string> + <string name="send_comment_success">"Comentário enviado"</string> + <string name="send_comment_failed">"Não foi possível enviar este comentário"</string> <string name="send_message_username_hint">"Usuário"</string> - <string name="send_message_subject_hint">"Título (Máximo de 100 caracteres)"</string> + <string name="send_message_subject_hint">"Assunto (Máximo de 100 caracteres)"</string> <string name="send_message_content_hint">"Mensagem"</string> <string name="reply_message_failed">"Não foi possível responder esta mensagem"</string> - <string name="error_getting_message">"Erro ao recuperar esta mensagem"</string> + <string name="error_getting_message">"Falha ao receber esta mensagem"</string> <string name="message_username_required">"Ei, para quem você quer enviar esta mensagem?"</string> - <string name="message_subject_required">"Sua mensagem deve ter um título"</string> + <string name="message_subject_required">"Sua mensagem deve ter um assunto"</string> <string name="message_content_required">"Você precisa escrever o conteúdo da mensagem"</string> <string name="sending_message">"Enviando"</string> - <string name="send_message_success">"Mensagem Enviada"</string> - <string name="send_message_failed">"Não foi possível enviar esta mensagem."</string> + <string name="send_message_success">"Mensagem enviada"</string> + <string name="send_message_failed">"Não foi possível enviar esta mensagem"</string> <string name="select_a_subreddit">"Por favor, selecione um subreddit primeiro"</string> <string name="title_required">"O post precisa de um bom título"</string> <string name="link_required">"Ei, onde está o link?"</string> <string name="select_an_image">"Por favor, selecione uma imagem primeiro"</string> <string name="posting">"Postando"</string> <string name="post_failed">"Não foi possível postar"</string> - <string name="error_processing_image">"Erro ao processar a imagem"</string> - <string name="error_processing_video">"Erro ao processar o vídeo"</string> - <string name="download_started">"Download iniciado. Verifique a notificação para o progresso."</string> + <string name="error_processing_image">"Falha ao processar a imagem"</string> + <string name="error_processing_video">"Falha ao processar o vídeo"</string> + <string name="download_started">"Download iniciado. Verifique a notificação para ver o progresso."</string> <string name="comment_load_more_comments">"Carregar mais comentários"</string> <string name="comment_load_more_comments_failed">"Falha no carregamento. Toque para tentar novamente."</string> <string name="loading">"Carregando"</string> @@ -172,36 +176,38 @@ <string name="bottom_sheet_post_video">"Vídeo"</string> <string name="select_from_gallery">"Selecione uma imagem"</string> <string name="select_again">"Selecione novamente"</string> - <string name="error_getting_image">"Erro para encontrar a imagem"</string> - <string name="error_getting_video">"Erro para encontrar o vídeo"</string> + <string name="error_getting_image">"Falha ao obter imagem"</string> + <string name="error_getting_video">"Falha ao obter vídeo"</string> <string name="no_camera_available">"Nenhum aplicativo de câmera disponível"</string> - <string name="error_creating_temp_file">"Erro ao criar arquivo temporário"</string> + <string name="error_creating_temp_file">"Falha ao criar arquivo temporário"</string> <string name="video_is_processing">"O vídeo está processando. Por favor aguarde."</string> <string name="image_is_processing">"A imagem está processando. Por favor aguarde."</string> <string name="gif_is_processing">"O Gif está processando. Por favor aguarde."</string> - <string name="flair">"Flair"</string> + <string name="flair">"Etiqueta"</string> <string name="spoiler">"Spoiler"</string> - <string name="no_flair">"Sem Flair"</string> - <string name="error_loading_flairs">"Erro carregando os Flairs. Toque para carregar novamente."</string> + <string name="no_flair">"Nenhuma etiqueta"</string> + <string name="error_loading_flairs">"Falha ao carregar etiquetas. +Toque para tentar novamente."</string> <string name="no_rule">"Nenhuma regra."</string> - <string name="error_loading_rules">"Erro carregando as regras. Toque para carregar novamente."</string> - <string name="error_loading_rules_without_retry">"Erro carregando as regras."</string> - <string name="search_in">"Pesquisar"</string> + <string name="error_loading_rules">"Falha ao carregar regras. +Toque para tentar novamente."</string> + <string name="error_loading_rules_without_retry">"Falha ao Carregar Regras"</string> + <string name="search_in">"Buscar em"</string> <string name="all_subreddits">"Todos os Subreddits"</string> - <string name="sort_best">"Melhores"</string> - <string name="sort_hot">"Mais quentes"</string> - <string name="sort_new">"Novos"</string> + <string name="sort_best">"Melhor"</string> + <string name="sort_hot">"Em Alta"</string> + <string name="sort_new">"Novo"</string> <string name="sort_random">"Aleatório"</string> - <string name="sort_rising">"Entrando em tendência"</string> - <string name="sort_top">"No topo"</string> + <string name="sort_rising">"Em Ascensão"</string> + <string name="sort_top">"Mais Votado"</string> <string name="sort_controversial">"Controverso"</string> <string name="sort_relevance">"Relevância"</string> <string name="sort_comments">"Comentários"</string> <string name="sort_activity">"Atividade"</string> - <string name="sort_confidence">"Razão upvote/downvote"</string> - <string name="sort_old">"Mais antigos"</string> + <string name="sort_confidence">"Razão Upvote/Downvote"</string> + <string name="sort_old">"Mais Antigos"</string> <string name="sort_qa">"Interações"</string> - <string name="sort_live">"Ao vivo"</string> + <string name="sort_live">"Ao Vivo"</string> <string name="sort_time_hour">"Hora"</string> <string name="sort_time_day">"Dia"</string> <string name="sort_time_week">"Semana"</string> @@ -209,12 +215,12 @@ <string name="sort_time_year">"Ano"</string> <string name="sort_time_all_time">"Desde o começo"</string> <string name="no_browser_found">"Nenhum navegador encontrado"</string> - <string name="no_activity_found_for_share">"Não existe um App para realizar a tarefa"</string> + <string name="no_activity_found_for_share">"Não há nenhum app que possa realizar a ação compartilhada"</string> <string name="archived_post_vote_unavailable">"Post arquivado. Não é possível votar."</string> <string name="archived_post_comment_unavailable">"Post arquivado. Não é possível comentar."</string> <string name="archived_post_reply_unavailable">"Post arquivado. Não é possível responder."</string> - <string name="locked_post_comment_unavailable">"Post travado. Não é possível comentar."</string> - <string name="locked_post_reply_unavailable">"Post travado. Não é possível responder."</string> + <string name="locked_post_comment_unavailable">"Post bloqueado. Não é possível comentar."</string> + <string name="locked_post_reply_unavailable">"Post bloqueado. Não é possível responder."</string> <string name="text">"TEXTO"</string> <string name="link">"LINK"</string> <string name="image">"IMAGEM"</string> @@ -222,203 +228,189 @@ <string name="gif">"GIF"</string> <string name="gallery">"GALERIA"</string> <string name="best">"Melhores"</string> - <string name="search">"Procurar"</string> - <string name="posting_video">"Publicando Vídeo"</string> - <string name="posting_image">"Publicando Imagem"</string> + <string name="search">"Buscar"</string> + <string name="posting_video">"Postando Vídeo"</string> + <string name="posting_image">"Postando Imagem"</string> <string name="please_wait">"Por favor aguarde."</string> - <string name="add_account">"Adicionar conta."</string> - <string name="anonymous_account">"Anonymous"</string> + <string name="add_account">"Adicionar conta"</string> + <string name="anonymous_account">"Anônimo"</string> <string name="log_out">"Desconectar"</string> - <string name="press_here_to_login">"Clique aqui para fazer login"</string> - <string name="login_first">"Primeiro login"</string> + <string name="press_here_to_login">"Clique aqui para fazer o login"</string> + <string name="login_first">"Primeiro faça o login"</string> <string name="post_saved_success">"Post salvo"</string> <string name="post_saved_failed">"Não foi possível salvar o post"</string> - <string name="post_unsaved_success">"Post removido dos \"salvos\""</string> - <string name="post_unsaved_failed">"Não foi possível remover post dos \"salvos\""</string> + <string name="post_unsaved_success">"Removido dos posts salvos"</string> + <string name="post_unsaved_failed">"Não foi possível remover dos posts salvos"</string> <string name="post_hide_success">"Post oculto"</string> <string name="post_hide_failed">"Não foi possível ocultar o post"</string> <string name="post_unhide_success">"Post visível"</string> - <string name="thing_favorite_failed">"Falha ao favoritar."</string> + <string name="thing_favorite_failed">"Falha ao adicionar aos favoritos"</string> <string name="thing_unfavorite_failed">"Falha ao remover dos favoritos"</string> - <string name="post_unhide_failed">"Não foi possível tornar visível o post"</string> - <string name="delete_this_post">"Deletar este post"</string> - <string name="delete_this_comment">"Deletar este comentário"</string> - <string name="are_you_sure">"Você está certo disso?"</string> + <string name="post_unhide_failed">"Não foi possível tornar o post visível"</string> + <string name="delete_this_post">"Excluir este Post"</string> + <string name="delete_this_comment">"Excluir este Comentário"</string> + <string name="are_you_sure">"Tem certeza?"</string> <string name="edit">"Editar"</string> - <string name="delete">"Deletar"</string> - <string name="see_removed_comment">"Ver comentário removido"</string> - <string name="fetching_removed_comment">"Atualizando comentário removido"</string> - <string name="show_removed_comment_failed">"Não foi possível encontrar comentário removido"</string> - <string name="fetching_removed_post">"Atualizando post removido"</string> + <string name="delete">"Excluir"</string> + <string name="see_removed_comment">"Ver Comentário Removido"</string> + <string name="fetching_removed_comment">"Buscando comentário removido"</string> + <string name="show_removed_comment_failed">"Não foi possível encontrar o comentário removido"</string> + <string name="fetching_removed_post">"Buscando post removido"</string> <string name="show_removed_post_failed">"Não foi possível encontrar o post removido"</string> <string name="cancel">"Cancelar"</string> <string name="ok">"OK"</string> - - <!-- Fuzzy --> <string name="edit_success">"Editado com sucesso"</string> - <string name="delete_post_success">"Sucesso ao deletar"</string> - <string name="delete_post_failed">"Falha ao deletar"</string> - - <!-- Fuzzy --> - <string name="mark_nsfw_success">"Sucesso ao marcar NSFW"</string> - <string name="mark_nsfw_failed">"Falha ao marcar NSFW"</string> - - <!-- Fuzzy --> - <string name="unmark_nsfw_success">"Sucesso ao desmarcar NSFW"</string> - <string name="unmark_nsfw_failed">"Falha ao desmarcar NSFW"</string> - - <!-- Fuzzy --> - <string name="mark_spoiler_success">"Sucesso ao marcar Spoiler"</string> - <string name="mark_spoiler_failed">"Falha ao marcar Spoiler"</string> - - <!-- Fuzzy --> - <string name="unmark_spoiler_success">"Sucesso ao desmarcar Spoiler"</string> - <string name="unmark_spoiler_failed">"Falha ao desmarcar Spoiler"</string> - - <!-- Fuzzy --> - <string name="update_flair_success">"Sucesso ao atualizar Flair"</string> - <string name="update_flair_failed">"Falha ao atualizar Flair"</string> - <string name="edit_flair">"Editar Flair"</string> + <string name="delete_post_success">"Excluído com sucesso"</string> + <string name="delete_post_failed">"Falha ao excluir"</string> + <string name="mark_nsfw_success">"Marcado como NSFW com sucesso"</string> + <string name="mark_nsfw_failed">"Falha ao marcar como NSFW"</string> + <string name="unmark_nsfw_success">"Desmarcado como NSFW com sucesso"</string> + <string name="unmark_nsfw_failed">"Falha ao desmarcar como NSFW"</string> + <string name="mark_spoiler_success">"Marcado como Spoiler com sucesso"</string> + <string name="mark_spoiler_failed">"Falha ao marcar como Spoiler"</string> + <string name="unmark_spoiler_success">"Desmarcado como Spoiler com sucesso"</string> + <string name="unmark_spoiler_failed">"Falha ao desmarcar como Spoiler"</string> + <string name="update_flair_success">"Etiqueta atualizada com sucesso"</string> + <string name="update_flair_failed">"Falha ao atualizar etiqueta"</string> + <string name="edit_flair">"Editar Etiqueta"</string> <string name="only_allow_64_chars">"Permitido apenas 64 caracteres ou menos"</string> - <string name="view_all_comments">"Clique aqui para pesquisar todos os comentários"</string> + <string name="view_all_comments">"Clique aqui para navegar por todos os comentários"</string> <string name="notification_summary_account">"Conta"</string> - <string name="notification_summary_message">"Nova mensagem"</string> + <string name="notification_summary_message">"Nova Mensagem"</string> <string name="notification_summary_subreddit">"Subreddit"</string> <string name="notification_summary_award">"Prêmio"</string> - <string name="notification_new_messages">"%1$d Novas mensagens"</string> + <string name="notification_new_messages">"%1$d Novas Mensagens"</string> <string name="label_account">"Conta"</string> <string name="label_post">"Post"</string> <string name="label_preferences">"Preferências"</string> <string name="account_switched">"Conta alterada, por isso todas as páginas sumiram."</string> <string name="settings_notification_master_title">"Notificação"</string> - <string name="settings_notification_enable_notification_title">"Habilitar Notificações"</string> - <string name="settings_notification_interval_title">"Intervalo de verificação de notificações"</string> + <string name="settings_notification_enable_notification_title">"Ativar Notificações"</string> + <string name="settings_notification_interval_title">"Intervalo de Verificação de Notificações"</string> <string name="settings_theme_title">"Tema"</string> - <string name="settings_amoled_dark_title">"Tema escuro (Amoled)"</string> + <string name="settings_amoled_dark_title">"Tema Escuro (Amoled)"</string> <string name="settings_interface_title">"Interface"</string> - <string name="settings_gestures_and_buttons_title">"Gestos e botões"</string> - <string name="settings_save_front_page_scrolled_position_title">"Posição da barra de rolagem salva na tela inicial"</string> - <string name="settings_save_front_page_scrolled_position_summary">"Navegue por posts novos depois de atualizar a tela inicial ( Primeira Página, Exibir por Tipo: Melhores)"</string> - <string name="settings_open_link_in_app_title">"Abrir link dentro do App"</string> + <string name="settings_gestures_and_buttons_title">"Gestos e Botões"</string> + <string name="settings_save_front_page_scrolled_position_title">"Posição de rolagem salva na tela inicial"</string> + <string name="settings_save_front_page_scrolled_position_summary">"Navegue por posts novos depois de atualizar a tela inicial ( Primeira Página, modo de classificação: Melhores)"</string> + <string name="settings_open_link_in_app_title">"Abrir Link no App"</string> <string name="settigns_video_title">"Vídeo"</string> - <string name="settings_video_autoplay_title">"Reprodução automática de vídeo"</string> - <string name="settings_mute_autoplaying_videos_title">"Reproduzir automaticamente vídeos em som mudo."</string> - <string name="settings_autoplay_nsfw_videos_title">"Reprodução automática de vídeos NSFW"</string> - <string name="settings_start_autoplay_visible_area_offset_portrait_title">"Deslocar área visível da reprodução automática de vídeos (Vertical)"</string> + <string name="settings_video_autoplay_title">"Reprodução Automática de Vídeo"</string> + <string name="settings_mute_autoplaying_videos_title">"Silenciar Vídeos Reproduzidos Automaticamente"</string> + <string name="settings_autoplay_nsfw_videos_title">"Reprodução Automática de Vídeos NSFW"</string> + <string name="settings_start_autoplay_visible_area_offset_portrait_title">"Deslocar Área Visível para Começar a Reprodução Automática de Vídeos (Retrato)"</string> <string name="settings_start_autoplay_visible_area_offset_portrait_summary">"Iniciar reprodução automática dos vídeos quando %1$d%% deles estiverem visíveis"</string> - <string name="settings_start_autoplay_visible_area_offset_landscape_title">"Deslocar área visível da reprodução automática de vídeos (Paisagem)"</string> + <string name="settings_start_autoplay_visible_area_offset_landscape_title">"Deslocar Área Visível para Começar a Reprodução Automática de Vídeos (Paisagem)"</string> <string name="settings_start_autoplay_visible_area_offset_landscape_summary">"Iniciar reprodução automática dos vídeos quando %1$d%% deles estiverem visíveis"</string> - <string name="settings_immersive_interface_title">"Interface imersiva"</string> - - <!-- Fuzzy --> - <string name="settings_immersive_interface_summary">"Não se aplica à todas as páginas. Pode não funcionar no Android 11"</string> - <string name="settings_immersive_interface_ignore_nav_bar_title">"Ignorar Barra de navegação na interface imersiva"</string> - <string name="settings_immersive_interface_ignore_nav_bar_summary">"Evitar a barra de navegação aumentando o espaçamento"</string> - <string name="settings_customize_tabs_in_main_page_title">"Personalizar as abas da páina inicial"</string> - <string name="settings_enable_bottom_app_bar_title">"Habilitar barra de navegação inferior"</string> - <string name="settings_enable_bottom_app_bar_summary">"Não tem efeito no modo anônimo"</string> - <string name="settings_category_post_and_comment_title">"Posts e comentários"</string> - <string name="settings_vote_buttons_on_the_right_title">"Botões de voto no lado direito"</string> - <string name="settings_volume_keys_navigate_comments_title">"Usar as teclas de volume para navegar entre comentários em posts"</string> - <string name="settings_volume_keys_navigate_posts_title">"Usar as teclas de volume para navegar entre posts"</string> - <string name="settings_mute_video_title">"Silenciar vídeos"</string> - <string name="settings_mute_nsfw_video_title">"Silenciar vídeos NSFW"</string> - <string name="settings_automatically_try_redgifs_title">"Tentar, automaticamente, acessar Redgifs se vídeos do Gfycat estão como removidos"</string> - <string name="settings_video_player_ignore_nav_bar_title">"Ignorar barra de navegação no Video Player"</string> - <string name="settings_video_player_ignore_nav_bar_summary">"Evitar que o controle de vídeo tenha margens largas"</string> - <string name="settings_confirm_to_exit">"Confirmar para sair"</string> + <string name="settings_immersive_interface_title">"Interface Imersiva"</string> + <string name="settings_immersive_interface_summary">"Não se Aplica a Todas as Páginas"</string> + <string name="settings_immersive_interface_ignore_nav_bar_title">"Ignorar Barra de Navegação na Interface Imersiva"</string> + <string name="settings_immersive_interface_ignore_nav_bar_summary">"Evite que a barra de navegação inferior tenha preenchimento extra"</string> + <string name="settings_customize_tabs_in_main_page_title">"Personalizar Abas da Página Inicial"</string> + <string name="settings_enable_bottom_app_bar_title">"Ativar Barra de Navegação Inferior"</string> + <string name="settings_enable_bottom_app_bar_summary">"Não tem Efeito no Modo Anônimo"</string> + <string name="settings_category_post_and_comment_title">"Post e Comentário"</string> + <string name="settings_vote_buttons_on_the_right_title">"Botões de Voto na Direita"</string> + <string name="settings_volume_keys_navigate_comments_title">"Usar as Teclas de Volume para Navegar Entre Comentários em Posts"</string> + <string name="settings_volume_keys_navigate_posts_title">"Usar as Teclas de Volume para Navegar Entre Posts"</string> + <string name="settings_mute_video_title">"Silenciar Vídeos"</string> + <string name="settings_mute_nsfw_video_title">"Silenciar Vídeos NSFW"</string> + <string name="settings_automatically_try_redgifs_title">"Tentar Acessar Automaticamente o Redgifs se os Vídeos do Gfycat Forem Removidos."</string> + <string name="settings_video_player_ignore_nav_bar_title">"Ignorar Barra de Navegação no Reprodutor de Vídeos"</string> + <string name="settings_video_player_ignore_nav_bar_summary">"Evitar que o Controle de Vídeo Tenha Margens Largas"</string> + <string name="settings_confirm_to_exit">"Confirmar para Sair"</string> <string name="settings_category_comment_title">"Comentar"</string> - <string name="settings_show_top_level_comments_first_title">"Exibir Comentários mais votados primeiro"</string> - <string name="settings_show_comment_divider_title">"Exibir divisão de comentários"</string> - <string name="settings_comment_toolbar_hide_on_click">"Clicar para Exibir/Ocultar barra de comentários"</string> - <string name="settings_fully_collapse_comment_title">"Suprimir completamente os comentários"</string> - <string name="settings_comment_toolbar_hidden">"Barra de comentários oculta por padrão"</string> - <string name="settings_show_absolute_number_of_votes_title">"Exibir números absolutos de votos"</string> - <string name="settings_show_elapsed_time">"Exibir tempo da publicação dos posts e dos comentários"</string> - <string name="settings_time_format_title">"Formato de hora"</string> + <string name="settings_show_top_level_comments_first_title">"Exibir Comentários Mais Votados Primeiro"</string> + <string name="settings_show_comment_divider_title">"Exibir Divisão de Comentários"</string> + <string name="settings_comment_toolbar_hide_on_click">"Clicar para Exibir/Ocultar Barra de Comentários"</string> + <string name="settings_fully_collapse_comment_title">"Retrair Completamente os Comentários"</string> + <string name="settings_comment_toolbar_hidden">"Barra de Comentários Oculta por Padrão"</string> + <string name="settings_show_absolute_number_of_votes_title">"Exibir Número Absoluto de Votos"</string> + <string name="settings_show_elapsed_time">"Exibir Tempo de Publicação dos Posts e Comentários"</string> + <string name="settings_time_format_title">"Formato de Hora"</string> <string name="settings_category_post_title">"Post"</string> - <string name="settings_default_post_layout">"Layout padrão de post"</string> - <string name="settings_show_divider_in_compact_layout">"Exibir divisão no Layout Compacto"</string> - <string name="settings_show_thumbnail_on_the_left_in_compact_layout">"Exibir Thumbnail no lado esquerdo no Layout Compacto"</string> - <string name="settings_swap_tap_and_long_title">"Toque curto e toque longo nos comentários"</string> - <string name="settings_swipe_to_go_back_title">"Deslizar para direita para retornar"</string> - <string name="settings_swipe_to_go_back_summary">"Não se aplica a todas as páginas"</string> - <string name="settings_lock_jump_to_next_top_level_comment_button_title">"Travar o avanço do botão para o próximo comentário Mais Votado"</string> - <string name="settings_lock_bottom_app_bar_title">"Travar barra de navegação inferior"</string> - <string name="settings_swipe_up_to_hide_jump_to_next_top_level_comment_button_title">"Deslizar para cima para ocultar Travar o avanço do botão para o próximo comentário Mais Votado"</string> - <string name="settings_lazy_mode_interval_title">"Intervalo de modo lento"</string> + <string name="settings_default_post_layout">"Aparência de Post Padrão"</string> + <string name="settings_show_divider_in_compact_layout">"Exibir Divisão no Modo Compacto"</string> + <string name="settings_show_thumbnail_on_the_left_in_compact_layout">"Exibir Miniatura à Esquerda no Modo Compacto"</string> + <string name="settings_swap_tap_and_long_title">"Toque Deslizante e Toque Longo nos Comentários"</string> + <string name="settings_swipe_to_go_back_title">"Deslizar para Direita para Retornar"</string> + <string name="settings_swipe_to_go_back_summary">"Não se Aplica a Todas as Páginas"</string> + <string name="settings_lock_jump_to_next_top_level_comment_button_title">"Bloquear Botão de Avanço para Próximo Comentário Mais Votado"</string> + <string name="settings_lock_bottom_app_bar_title">"Bloquear Barra de Navegação Inferior"</string> + <string name="settings_swipe_up_to_hide_jump_to_next_top_level_comment_button_title">"Deslizar para Cima para Ocultar Botão de Avanço para Próximo Comentário Mais Votado"</string> + <string name="settings_lazy_mode_interval_title">"Intervalo do Modo Preguiçoso"</string> <string name="settings_font_title">"Fonte"</string> - <string name="settings_preview_font_title">"Pré-visualizar a fonte"</string> + <string name="settings_preview_font_title">"Pré-visualizar Fonte"</string> <string name="settings_font_summary">"Fonte"</string> <string name="settings_title_font_summary">"Título"</string> <string name="settings_content_font_summary">"Conteúdo"</string> <string name="settings_font_family_title">"Fonte Geral"</string> - <string name="settings_title_font_family_title">"Fonte Geral de títulos"</string> - <string name="settings_content_font_family_title">"Fonte Geral de conteúdo"</string> - <string name="settings_font_size_title">"Tamanho da fonte"</string> - <string name="settings_title_font_size_title">"Tamanho da fonte de Título"</string> - <string name="settings_content_font_size_title">"Tamanho da fonte de conteúdo"</string> - <string name="settings_enable_nsfw_title">"Habilitar NSFW"</string> - <string name="settings_blur_nsfw_title">"Borrar imagens marcadas com NSFW"</string> - <string name="settings_blur_spoiler_title">"Borrar imagens marcardas com Spoiler"</string> + <string name="settings_title_font_family_title">"Fonte Geral de Título"</string> + <string name="settings_content_font_family_title">"Fonte Geral de Conteúdo"</string> + <string name="settings_font_size_title">"Tamanho da Fonte"</string> + <string name="settings_title_font_size_title">"Tamanho da Fonte de Título"</string> + <string name="settings_content_font_size_title">"Tamanho da Fonte de Conteúdo"</string> + <string name="settings_enable_nsfw_title">"Ativar NSFW"</string> + <string name="settings_blur_nsfw_title">"Borrar Imagens Marcadas como NSFW"</string> + <string name="settings_blur_spoiler_title">"Borrar Imagens Marcardas como Spoiler"</string> <string name="settings_about_master_title">"Sobre"</string> <string name="settings_acknowledgement_master_title">"Crédito"</string> - <string name="settings_credits_master_title">"Crédito"</string> - <string name="settings_credits_icon_foreground_title">"Ícone da frente"</string> + <string name="settings_credits_master_title">"Créditos"</string> + <string name="settings_credits_icon_foreground_title">"Ícone da Frente"</string> <string name="settings_credits_icon_foreground_summary">"Vetor de Tecnologia criado por Freepik em www.flaticon.com"</string> - <string name="settings_credits_icon_background_title">"Ícone de fundo"</string> - <string name="settings_credits_icon_background_summary">"Vetor de imagem de fundo criado por por Freepik em www.flaticon.com"</string> - <string name="settings_credits_error_image_title">"Erro na imagem"</string> - <string name="settings_credits_error_image_summary">"Vetor de tecnologia criado por Freepik em www.flaticon.com"</string> - <string name="settings_credits_gilded_icon_title">"ícone de prêmio"</string> - <string name="settings_credits_gilded_icon_summary">"Pacote de ícones feitos por Freepik em www.flaticon.com"</string> - <string name="settings_credits_crosspost_icon_title">"Ícone de crosspost"</string> - <string name="settings_credits_crosspost_icon_summary">"Pacote de ícones feitos por Freepik em www.flaticon.com"</string> - <string name="settings_credits_thumbtack_icon_title">"Thumbtack Icon"</string> - <string name="settings_credits_thumbtack_icon_summary">"Pacote de ícones feitos por Freepik em www.flaticon.com"</string> - <string name="settings_credits_best_rocket_icon_title">"Rocket Icon"</string> - <string name="settings_credits_best_rocket_icon_summary">"Pacote de ícones feitos por Freepik em www.flaticon.com"</string> + <string name="settings_credits_icon_background_title">"Ícone de Fundo"</string> + <string name="settings_credits_icon_background_summary">"Vetor de fundo criado por por Freepik em www.freepik.com"</string> + <string name="settings_credits_error_image_title">"Falha na imagem"</string> + <string name="settings_credits_error_image_summary">"Vetor de tecnologia criado por Freepik em www.freepik.com"</string> + <string name="settings_credits_gilded_icon_title">"Ícone de Prêmio"</string> + <string name="settings_credits_gilded_icon_summary">"Ícone feito por Freepik em www.flaticon.com"</string> + <string name="settings_credits_crosspost_icon_title">"Ícone do Crosspost"</string> + <string name="settings_credits_crosspost_icon_summary">"Ícone feito por Freepik em www.flaticon.com"</string> + <string name="settings_credits_thumbtack_icon_title">"Ícone do Thumbtack"</string> + <string name="settings_credits_thumbtack_icon_summary">"Ícone feito por Freepik em www.flaticon.com"</string> + <string name="settings_credits_best_rocket_icon_title">"Ícone do Foguete"</string> + <string name="settings_credits_best_rocket_icon_summary">"Ícone feito por Freepik em www.flaticon.com"</string> <string name="settings_credits_material_icons_title">"Material Icons"</string> <string name="settings_open_source_title">"Open Source"</string> <string name="settings_open_source_summary">"Favorite ele no Github se você está gostando do App"</string> <string name="settings_rate_title">"Avalie no Google Play"</string> - <string name="settings_rate_summary">"Avalie com 5 Estrelas para a minha felicidade"</string> + <string name="settings_rate_summary">"Me dê uma classificação de 5 estrelas e eu vou ficar muito feliz"</string> <string name="settings_f_droid_title">"F-Droid"</string> - <string name="settings_f_droid_summary">"Disponível para download também em: IzzyOnDroid e F-Droid"</string> + <string name="settings_f_droid_summary">"Disponível para download também em: IzzyOnDroid, um Repositório F-Droid"</string> <string name="settings_email_title">"Email"</string> <string name="settings_email_summary">"docilealligator.app@gmail.com"</string> - <string name="settings_reddit_account_title">"Conta no Reddit"</string> + <string name="settings_reddit_account_title">"Conta Reddit"</string> <string name="settings_reddit_account_summary">"u/Hostilenemy"</string> <string name="settings_subreddit_title">"Subreddit"</string> <string name="settings_subreddit_summary">"r/Infinity_For_Reddit"</string> <string name="settings_share_title">"Compartilhar"</string> <string name="settings_share_summary">"Compartilhe esse App com outros se você está gostando dele"</string> - <string name="settings_version_title">"Infinity para Reddit"</string> + <string name="settings_version_title">"Infinity For Reddit"</string> <string name="settings_version_summary">"Versão %s"</string> <string name="settings_category_customization_title">"Personalização"</string> <string name="settings_customize_light_theme_title">"Tema Claro"</string> <string name="settings_customize_dark_theme_title">"Tema Escuro"</string> <string name="settings_customize_amoled_theme_title">"Tema Amoled"</string> - <string name="settings_manage_themes_title">"Gerenciar temas"</string> - <string name="settings_custom_theme_cannot_apply_to_settings_page_summary">"Temas personalizados não podem ser aplicados à página de configurações (exceto ferramentas, barra de status e barra de navegação)."</string> + <string name="settings_manage_themes_title">"Gerenciar Temas"</string> + <string name="settings_custom_theme_cannot_apply_to_settings_page_summary">"Temas personalizados não podem ser aplicados à página de configurações (exceto barra de ferramentas, barra de status e barra de navegação)."</string> <string name="settings_advanced_master_title">"Avançado"</string> - <string name="settings_delete_all_subreddits_data_in_database_title">"Excluir todos os subreddits na base de dados"</string> - <string name="settings_delete_all_users_data_in_database_title">"Excluir todos os usuários na base de dados"</string> - <string name="settings_delete_all_sort_type_data_in_database_title">"Excluir todos os tipos de exibição na base de dados"</string> - <string name="settings_delete_all_post_layout_data_in_database_title">"Excluir todos os Layouts de posts na base de dados"</string> - <string name="settings_delete_all_themes_in_database_title">"Excluir todos os temas na base de dados"</string> - <string name="settings_delete_front_page_scrolled_positions_in_database_title">"Excluir todas as posições da barra de rolagem da primeira página na base de dados"</string> - <string name="settings_reset_all_settings_title">"Restaurar todas as configurações"</string> - <string name="settings_advanced_settings_summary">"Restaurar a base de dados e as preferências de compartilhamento"</string> + <string name="settings_delete_all_subreddits_data_in_database_title">"Excluir Todos os Subreddits no Banco de Dados"</string> + <string name="settings_delete_all_users_data_in_database_title">"Excluir Todos os Usuários no Banco de Dados"</string> + <string name="settings_delete_all_sort_type_data_in_database_title">"Excluir Todos os Modos de Classificação no Banco de Dados"</string> + <string name="settings_delete_all_post_layout_data_in_database_title">"Excluir Todos os Modos de Aparência de Posts no Banco de Dados"</string> + <string name="settings_delete_all_themes_in_database_title">"Excluir Todos os Temas no Banco de Dados"</string> + <string name="settings_delete_front_page_scrolled_positions_in_database_title">"Excluir Todas as Posições de Rolagem da Primeira Página no Banco de Dados"</string> + <string name="settings_reset_all_settings_title">"Redefinir Todas as Configurações"</string> + <string name="settings_advanced_settings_summary">"Limpar o Banco de Dados e as Preferências Compartilhadas"</string> <string name="settings_tab_1_summary">"Aba 1"</string> <string name="settings_tab_2_summary">"Aba 2"</string> <string name="settings_tab_3_summary">"Aba 3"</string> <string name="settings_tab_title">"Título"</string> <string name="settings_tab_post_type">"Tipo"</string> - <string name="settings_tab_subreddit_name">"Nome do subreddit (Sem o prefixo \"r/\")"</string> + <string name="settings_tab_subreddit_name">"Nome do Subreddit (Sem o Prefixo \"r/\")"</string> <string name="settings_tab_multi_reddit_name">"Nome do MultiReddit (/usuário/nomedoseuusuário/m/nomedoseumultireddit)"</string> - <string name="settings_tab_username">"Usuário (Sem o prefixo \"u/\")"</string> - <string name="no_developer_easter_egg">"Não existem opções de desenvolvedor aqui."</string> + <string name="settings_tab_username">"Usuário (Sem o Prefixo \"u/\")"</string> + <string name="no_developer_easter_egg">"Não existem opções de desenvolvedor aqui"</string> <string name="no_link_available">"Link não disponível"</string> <string name="exit_when_submit">"Sair?"</string> <string name="exit_when_submit_post_detail">"O post será publicado mesmo se você sair desta página."</string> @@ -429,20 +421,20 @@ <string name="yes">"Sim"</string> <string name="no">"Não"</string> <string name="no_data_received">"Nenhum dado recebido"</string> - <string name="no_image_path_received">"Nenhuma imagem recebida"</string> - <string name="no_video_path_received">"Nenhum vídeo recebido"</string> + <string name="no_image_path_received">"Nenhum caminho de imagem recebido"</string> + <string name="no_video_path_received">"Nenhum caminho de vídeo recebido"</string> <string name="cannot_handle_intent">"Não foi possível realizar a solicitação de compartilhamento"</string> <string name="share">"Compartilhar"</string> - <string name="no_email_client">"Nenhum Email encontrado"</string> - <string name="no_app">"Nenhum App encontrado"</string> + <string name="no_email_client">"Nenhum cliente de Email encontrado"</string> + <string name="no_app">"Nenhum App disponível"</string> <string name="comment_saved_success">"Comentário salvo"</string> <string name="comment_saved_failed">"Não foi possível salvar o comentário"</string> - <string name="comment_unsaved_success">"Comentário removido da aba de salvos"</string> - <string name="comment_unsaved_failed">"Não foi possível remover o comentário da aba de salvos"</string> + <string name="comment_unsaved_success">"Removido dos comentários salvos"</string> + <string name="comment_unsaved_failed">"Não foi possível remover dos comentários salvos"</string> <string name="favorites">"Favoritos"</string> <string name="all">"Todos"</string> - <string name="post_layout_card">"Layout do Card"</string> - <string name="post_layout_compact">"Layout Compacto"</string> + <string name="post_layout_card">"Modo Cartão"</string> + <string name="post_layout_compact">"Modo Compacto"</string> <string name="elapsed_time_just_now">"Agora"</string> <string name="elapsed_time_a_minute_ago">"1 Minuto"</string> <string name="elapsed_time_minutes_ago">"%1$d Minutos"</string> @@ -454,10 +446,10 @@ <string name="elapsed_time_months_ago">"%1$d Meses"</string> <string name="elapsed_time_a_year_ago">"1 Ano"</string> <string name="elapsed_time_years_ago">"%1$d Anos"</string> - <string name="error_getting_multi_reddit_data">"Erro ao obter os dados de MultiReddit"</string> - <string name="error_loading_multi_reddit_list">"Não foi possível sincronizar os MultiReddits"</string> + <string name="error_getting_multi_reddit_data">"Falha ao obter os dados do multiReddit"</string> + <string name="error_loading_multi_reddit_list">"Não foi possível sincronizar os multiReddits"</string> <string name="error_loading_subscriptions">"Não foi possível sincronizar as inscrições"</string> - <string name="share_this_app">"Conheça o Infinity para Reddit, um feed incrível para o Reddit! + <string name="share_this_app">"Conheça o Infinity for Reddit, um cliente incrível para o Reddit! https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforreddit"</string> <string name="error_getting_subreddit_name">"Erro ao obter o nome do subreddit"</string> <string name="share_post_link">"Compartilhar Link do Post"</string> @@ -471,194 +463,192 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="copy_video_link">"Copiar Link do Vídeo"</string> <string name="copy_link">"Copiar Link"</string> <string name="copy_success">"Copiado"</string> - <string name="copy_link_failed">"Não foi possível Copiar o Link"</string> + <string name="copy_link_failed">"Não foi possível copiar o link"</string> <string name="copy_text">"Copiar"</string> - <string name="copy_all">"Copiar tudo"</string> - <string name="copy_markdown">"Copiar Marcador"</string> - <string name="copy_raw_text">"Copiar texto bruto"</string> - <string name="copy_all_markdown">"Copiar Todos os Marcadores"</string> - <string name="copy_all_raw_text">"Copiar todos os textos brutos"</string> + <string name="copy_all">"Copiar Tudo"</string> + <string name="copy_markdown">"Copiar Markdown"</string> + <string name="copy_raw_text">"Copiar Texto Base"</string> + <string name="copy_all_markdown">"Copiar Todos os Markdown"</string> + <string name="copy_all_raw_text">"Copiar Todos os Textos Base"</string> <string name="exit_app">"Sair?"</string> <string name="light_theme">"Tema Claro"</string> - <string name="dark_theme">"Tema Escuto"</string> + <string name="dark_theme">"Tema Escuro"</string> <string name="multi_reddit_name_hint">"Nome (Limite de 50 caracteres)"</string> <string name="multi_reddit_description_hint">"Descrição"</string> <string name="private_multi_reddit">"Privado"</string> <string name="select_subreddits">"Selecionar Subreddits"</string> <string name="no_multi_reddit_name">"Onde está o nome?"</string> - <string name="create_multi_reddit_failed">"Não foi possível criar este MultiReddit"</string> - <string name="duplicate_multi_reddit">"Este MultiReddit já existe"</string> - <string name="edit_multi_reddit_failed">"Não foi possível editar este MultiReddit"</string> - <string name="logged_out">"Você não fez loggin"</string> - <string name="delete_multi_reddit_success">"Sucesso ao remover"</string> - <string name="delete_multi_reddit_failed">"Falha ao remover"</string> - <string name="delete_multi_reddit_dialog_message">"Você está certo disso?"</string> - <string name="enable_nsfw">"Habilitar NSFW"</string> - <string name="disable_nsfw">"Desabilitar NSFW"</string> + <string name="create_multi_reddit_failed">"Não foi possível criar este multiReddit"</string> + <string name="duplicate_multi_reddit">"Este multiReddit já existe"</string> + <string name="edit_multi_reddit_failed">"Não foi possível editar este multiReddit"</string> + <string name="logged_out">"Você está deslogado"</string> + <string name="delete_multi_reddit_success">"Excluído com sucesso"</string> + <string name="delete_multi_reddit_failed">"Falha ao excluir"</string> + <string name="delete_multi_reddit_dialog_message">"Tem certeza?"</string> + <string name="enable_nsfw">"Ativar NSFW"</string> + <string name="disable_nsfw">"Desativar NSFW"</string> <string name="cannot_save_image">"Não foi possível salvar a imagem"</string> - <string name="cannot_save_gif">"Não foi possível salvar o Gif"</string> + <string name="cannot_save_gif">"Não foi possível salvar o gif"</string> <string name="cannot_get_storage">"Não foi possível acessar os dados de armazenamento do App"</string> <string name="save_image_first">"Salvando a imagem. Por favor aguarde."</string> - <string name="save_gif_first">"Salvando o Gif. Por favor aguarde."</string> + <string name="save_gif_first">"Salvando o gif. Por favor aguarde."</string> <string name="theme_name_description">"Toque para alterar o nome deste tema."</string> - <string name="theme_item_is_light_theme">"Configurar como Tema Claro"</string> - <string name="theme_item_is_dark_theme">"Configurar como Tema Escuro"</string> - <string name="theme_item_is_amoled_theme">"Configurar como Tema Amoled"</string> - <string name="theme_item_color_primary">"Cor primária"</string> - <string name="theme_item_color_primary_detail">"Aplicado para: Barra de ferramentas"</string> - <string name="theme_item_color_primary_dark">"Cor primária Escura"</string> - <string name="theme_item_color_primary_dark_detail">"Aplicado para: Barra de status"</string> - <string name="theme_item_color_accent">"Tom de cor"</string> - <string name="theme_item_color_accent_detail">"Aplicado para: Barra de progresso, etc"</string> - <string name="theme_item_color_primary_light_theme">"Cor primária Tema Claro"</string> - <string name="theme_item_color_primary_light_theme_detail">"Aplicado para: cor de fundo do botão suspenso de ação"</string> - <string name="theme_item_primary_text_color">"Cor primária do Texto"</string> - <string name="theme_item_primary_text_color_detail">"Aplicado para: Cor primária do Texto"</string> - <string name="theme_item_secondary_text_color">"Cor secundária do Texto"</string> - <string name="theme_item_secondary_text_color_detail">"Aplicado para: Cor secundária do Texto"</string> - <string name="theme_item_post_title_color">"Cor de título do post"</string> - <string name="theme_item_post_title_color_detail">"Aplicado para: Título do post"</string> - <string name="theme_item_post_content_color">"Cor de conteúdo do post"</string> - <string name="theme_item_post_content_color_detail">"Aplicado para: Cor de conteúdo do post"</string> - <string name="theme_item_comment_color">"Cor de comentário"</string> - <string name="theme_item_comment_color_detail">"Aplicado para: Comentário"</string> - <string name="theme_item_button_text_color">"Cor de texto do botão"</string> - <string name="theme_item_button_text_color_detail">"Aplicado para: Texto do botão"</string> - <string name="theme_item_chip_text_color">"Cor de texto da inscrição"</string> - <string name="theme_item_chip_text_color_detail">"Aplicado para: botão de inscrição"</string> - <string name="theme_item_link_color">"Cor de link"</string> - <string name="theme_item_link_color_detail">"Aplicado para: URL"</string> - <string name="theme_item_received_message_text_color">"Cor de texto de mensagem recebida"</string> - <string name="theme_item_received_message_text_color_detail">"Aplicado para: Mensagens privadas recebidas"</string> - <string name="theme_item_sent_message_text_color">"Cor de texto de mensagem enviada"</string> - <string name="theme_item_sent_message_text_color_detail">"Aplicado para: mensagem privada enviada"</string> - <string name="theme_item_background_color">"Cor de fundo"</string> - <string name="theme_item_background_color_detail">"Aplicado para: Cor de fundo de todas as páginas e do menu de navegação"</string> - <string name="theme_item_card_view_background_color">"Cor de fundo da visualização de card"</string> - <string name="theme_item_card_view_background_color_detail">"Aplicado para: cor de fundo de post e de mensagens"</string> - <string name="theme_item_comment_background_color">"Cor de fundo de comentário"</string> - <string name="theme_item_comment_background_color_detail">"Aplicado para: Cor de fundo de comentário"</string> - <string name="theme_item_fully_collapsed_comment_background_color">"Cor de fundo de comentário totalmente suprimido"</string> - <string name="theme_item_fully_collapsed_comment_background_color_detail">"Aplicado para: comentário totalmente suprimido"</string> - <string name="theme_item_awarded_comment_background_color">"Cor de fundo de comentário premiado"</string> - <string name="theme_item_awarded_comment_background_color_detail">"Aplicado para: comentário premiado"</string> - <string name="theme_item_received_message_background_color">"Cor de fundo de mensagem recebida"</string> - <string name="theme_item_received_message_background_color_detail">"Aplicado para: mensagem recebida"</string> - <string name="theme_item_sent_message_background_color">"Cor de fundo de mensagem enviada"</string> - <string name="theme_item_sent_message_background_color_detail">"Aplicado para: mensagem enviada"</string> - <string name="theme_item_bottom_app_bar_background_color">"Cor da barra de navegação inferior"</string> - <string name="theme_item_bottom_app_bar_background_color_detail">"Aplicado para: barra de navegação inferior"</string> - <string name="theme_item_primary_icon_color">"Cor primária de ícone"</string> - <string name="theme_item_primary_icon_color_detail">"Aplicado para: ícones no menu de navegação"</string> - <string name="theme_item_bottom_app_bar_icon_color">"Cor de ícone da barra de navegação inferior"</string> - <string name="theme_item_bottom_app_bar_icon_color_detail">"Aplicado para: ícone da barra de navegação inferior"</string> - <string name="theme_item_post_icon_and_info_color">"Cor de ícone de post e informações"</string> - <string name="theme_item_post_icon_and_info_color_detail">"Aplicado para: ícones, números de comentários e pontuação de posts"</string> - <string name="theme_item_comment_icon_and_info_color">"Cor de ícone de comentário e informações"</string> - <string name="theme_item_comment_icon_and_info_color_detail">"Aplicado para: ícone de comentário e informações"</string> - <string name="theme_item_fab_icon_color">"Cor de ícone do botão suspenso"</string> - <string name="theme_item_fab_icon_color_detail">"Aplicado para: botão suspenso"</string> - <string name="theme_item_send_message_icon_color">"Cor de ícone de envio de mensagem"</string> - <string name="theme_item_send_message_icon_color_detail">"Aplicado para: ícone de envio de mensagem"</string> - <string name="theme_item_toolbar_primary_text_and_icon_color">"Cor de ícone e de texto principal da barra de ferramentas"</string> - <string name="theme_item_toolbar_primary_text_and_icon_color_detail">"Aplicado para: texto principal da barra de ferramentas e ícones"</string> - <string name="theme_item_toolbar_secondary_text_color">"Cor de texto secundário na barra de ferramentas"</string> - <string name="theme_item_toolbar_secondary_text_color_detail">"Aplicado para: texto secundário na barra de ferramentas"</string> - <string name="theme_item_circular_progress_bar_background_color">"Cor de fundo do menu suspenso"</string> - <string name="theme_item_circular_progress_bar_background_color_detail">"Aplicado para: cor de fundo do menu suspenso"</string> - <string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_tab_background">"Cor de fundo de Layout de aba em Barra de ferramentas expandida"</string> - <string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_tab_background_detail">"Aplicado para: Cor de fundo de Layout de aba"</string> - <string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_text_color">"Cor de texto de Layout de aba com barra de ferramenta expandida"</string> - <string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_text_color_detail">"Aplicado para: cor de texto de Layout de aba com barra de ferramenta expandida"</string> - <string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_tab_indicator">"Cor de indicador de aba do Layout de aba em barra de ferramenta expandida"</string> - <string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_tab_indicator_detail">"Aplicado para: Cor de indicador de página no Layout de página (para barra de ferramentas expandida)"</string> - <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_tab_background">"Cor de fundo para aba de Layout em barra suprimida"</string> - <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_tab_background_detail">"Aplicado para: Cor de fundo de Layout de aba (Barra de ferramentas suprimida)"</string> - <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_text_color">"Cor de texto de Layout de aba com a barra de ferramentas suprimida"</string> - <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_text_color_detail">"Aplicado para: Cor de texto de Layout de aba com a barra de ferramentas suprimida"</string> - <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_tab_indicator">"Cor de indicador de aba em Layout de aba em barra de ferramentas suprimida"</string> - <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_tab_indicator_detail">"Aplicado para: cor de indicador aba em Layout de aba (Barra de ferramentas suprimida)"</string> - <string name="theme_item_upvoted_color">"Cor de Upvoted"</string> - <string name="theme_item_upvoted_color_detail">"Aplicado para: Botões de voto e pontuações (Positivas)"</string> - <string name="theme_item_downvoted_color">"Cor de Downvoted"</string> - <string name="theme_item_downvoted_color_detail">"Aplicado para: Botões de voto e pontuações (Negativas)"</string> - <string name="theme_item_post_type_background_color">"Cor de fundo de tipo de post"</string> - <string name="theme_item_post_type_background_color_detail">"Aplicado para: tipo de post (IMAGEM, TEXTO, VÍDEO, GIF, LINK)"</string> - <string name="theme_item_post_type_text_color">"Cor de texto de tipo de post"</string> - <string name="theme_item_post_type_text_color_detail">"Aplicado para: cor de texto de tipo de post (IMAGEM, TEXTO, VÍDEO, GIF, LINK)"</string> - <string name="theme_item_spoiler_background_color">"Cor de fundo de item Spoiler"</string> - <string name="theme_item_spoiler_background_color_detail">"Aplicado para: item Spoiler"</string> - <string name="theme_item_spoiler_text_color">"Cor de texto de item Spoiler"</string> - <string name="theme_item_spoiler_text_color_detail">"Aplicado para: Texto de item Spoiler"</string> - <string name="theme_item_nsfw_background_color">"Cor de fundo de item NSFW"</string> - <string name="theme_item_nsfw_background_color_detail">"Aplicado para: Plano de fundo de marcação NSFW"</string> - <string name="theme_item_nsfw_text_color">"Cor de texto marcado com NSFW"</string> - <string name="theme_item_nsfw_text_color_detail">"Aplicado para: Cor de texto marcado com NSFW"</string> - <string name="theme_item_flair_background_color">"Cor de fundo de Flair"</string> - <string name="theme_item_flair_background_color_detail">"Aplicado para: Cor de fundo de Flair"</string> - <string name="theme_item_flair_text_color">"Cor do texto de Flair"</string> - <string name="theme_item_flair_text_color_detail">"Aplicado para: Cor de texto de marcação Flair"</string> + <string name="theme_item_is_light_theme">"Definido como Tema Claro"</string> + <string name="theme_item_is_dark_theme">"Definido como Tema Escuro"</string> + <string name="theme_item_is_amoled_theme">"Definido como Tema Amoled"</string> + <string name="theme_item_color_primary">"Cor Primária"</string> + <string name="theme_item_color_primary_detail">"Aplicado a: Barra de Ferramentas"</string> + <string name="theme_item_color_primary_dark">"Cor Primária Escura"</string> + <string name="theme_item_color_primary_dark_detail">"Aplicado a: Barra de Status"</string> + <string name="theme_item_color_accent">"Tom de Cor"</string> + <string name="theme_item_color_accent_detail">"Aplicado a: Barra de Progresso, etc"</string> + <string name="theme_item_color_primary_light_theme">"Cor Primária do Tema Claro"</string> + <string name="theme_item_color_primary_light_theme_detail">"Aplicado a: Fundo do Botão de Ação Flutuante e Botão"</string> + <string name="theme_item_primary_text_color">"Cor do Texto Primário"</string> + <string name="theme_item_primary_text_color_detail">"Aplicado a: Texto primário"</string> + <string name="theme_item_secondary_text_color">"Cor do Texto Secundário"</string> + <string name="theme_item_secondary_text_color_detail">"Aplicado a: Texto secundário"</string> + <string name="theme_item_post_title_color">"Cor do Título do Post"</string> + <string name="theme_item_post_title_color_detail">"Aplicado a: Título do post"</string> + <string name="theme_item_post_content_color">"Cor do Conteúdo do Post"</string> + <string name="theme_item_post_content_color_detail">"Aplicado a: Conteúdo do post"</string> + <string name="theme_item_comment_color">"Cor do Comentário"</string> + <string name="theme_item_comment_color_detail">"Aplicado a: Comentário"</string> + <string name="theme_item_button_text_color">"Cor do Texto do Botão"</string> + <string name="theme_item_button_text_color_detail">"Aplicado a: Texto no botão"</string> + <string name="theme_item_chip_text_color">"Cor do Texto de Inscrição"</string> + <string name="theme_item_chip_text_color_detail">"Aplicado a: Botão de inscrição"</string> + <string name="theme_item_link_color">"Cor do Link"</string> + <string name="theme_item_link_color_detail">"Aplicado a: URL"</string> + <string name="theme_item_received_message_text_color">"Cor do Texto da Mensagem Recebida"</string> + <string name="theme_item_received_message_text_color_detail">"Aplicado a: Mensagens Privadas Recebidas"</string> + <string name="theme_item_sent_message_text_color">"Cor do Texto da Mensagem Enviada"</string> + <string name="theme_item_sent_message_text_color_detail">"Aplicado a: Mensagens Privadas Enviadas"</string> + <string name="theme_item_background_color">"Cor de Fundo"</string> + <string name="theme_item_background_color_detail">"Aplicado a: Fundo de todas as páginas e do menu de navegação"</string> + <string name="theme_item_card_view_background_color">"Cor de Fundo do Cartão de Visualização"</string> + <string name="theme_item_card_view_background_color_detail">"Aplicado a: Fundo de posts e de mensagens"</string> + <string name="theme_item_comment_background_color">"Cor de Fundo dos Comentários"</string> + <string name="theme_item_comment_background_color_detail">"Aplicado a: Fundo dos comentários"</string> + <string name="theme_item_fully_collapsed_comment_background_color">"Cor de Fundo dos Comentários Totalmente Retraídos"</string> + <string name="theme_item_fully_collapsed_comment_background_color_detail">"Aplicado a: Fundo dos comentários totalmente retraídos"</string> + <string name="theme_item_awarded_comment_background_color">"Cor de Fundo dos Comentários Premiados"</string> + <string name="theme_item_awarded_comment_background_color_detail">"Aplicado a: Fundo dos comentários premiados"</string> + <string name="theme_item_received_message_background_color">"Cor de Fundo da Mensagem Recebida"</string> + <string name="theme_item_received_message_background_color_detail">"Aplicado a: Fundo das mensagens privadas recebidas"</string> + <string name="theme_item_sent_message_background_color">"Cor de Fundo da Mensagem enviada"</string> + <string name="theme_item_sent_message_background_color_detail">"Aplicado a: Fundo das mensagens privadas enviadas"</string> + <string name="theme_item_bottom_app_bar_background_color">"Cor da Barra de Navegação Inferior"</string> + <string name="theme_item_bottom_app_bar_background_color_detail">"Aplicado a: Barra de navegação inferior"</string> + <string name="theme_item_primary_icon_color">"Cor do Ícone Primário"</string> + <string name="theme_item_primary_icon_color_detail">"Aplicado a: Ícones no menu de navegação"</string> + <string name="theme_item_bottom_app_bar_icon_color">"Cor do Ícone da Barra de Navegação Inferior"</string> + <string name="theme_item_bottom_app_bar_icon_color_detail">"Aplicado a: Ícones na barra de navegação inferior"</string> + <string name="theme_item_post_icon_and_info_color">"Cor do Ícone de Post e Informações"</string> + <string name="theme_item_post_icon_and_info_color_detail">"Aplicado a: Ícones, números de comentários e pontuação nos posts"</string> + <string name="theme_item_comment_icon_and_info_color">"Cor do Ícone de Comentário e Informações"</string> + <string name="theme_item_comment_icon_and_info_color_detail">"Aplicado a: Ícone e pontuação nos comentários"</string> + <string name="theme_item_fab_icon_color">"Cor do Ícone do Botão de Ação Flutuante"</string> + <string name="theme_item_fab_icon_color_detail">"Aplicado a: Ícone do botão de ação flutuante"</string> + <string name="theme_item_send_message_icon_color">"Cor do Ícone de Envio de Mensagem"</string> + <string name="theme_item_send_message_icon_color_detail">"Aplicado a: Ícone de envio de mensagem privada"</string> + <string name="theme_item_toolbar_primary_text_and_icon_color">"Cor do Ícone e do Texto Primário da Barra de Ferramentas"</string> + <string name="theme_item_toolbar_primary_text_and_icon_color_detail">"Aplicado a: Texto primário e ícones nas barras de ferramentas"</string> + <string name="theme_item_toolbar_secondary_text_color">"Cor do Texto Secundário da Barra de Ferramentas"</string> + <string name="theme_item_toolbar_secondary_text_color_detail">"Aplicado a: Texto secundário nas barras de ferramentas"</string> + <string name="theme_item_circular_progress_bar_background_color">"Cor de fundo da Barra de Progresso Circular"</string> + <string name="theme_item_circular_progress_bar_background_color_detail">"Aplicado a: Fundo da barra de progresso circular"</string> + <string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_tab_background">"Cor de Fundo do Layout de Aba com a Barra de Ferramentas Expandida"</string> + <string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_tab_background_detail">"Aplicado a: Cor de fundo do Layout de aba (barra de ferramentas expandida)"</string> + <string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_text_color">"Cor do Texto do Layout de Aba com a Barra de Ferramenta Expandida"</string> + <string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_text_color_detail">"Aplicado a: Cor do texto do layout de aba (barra de ferramenta expandida)"</string> + <string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_tab_indicator">"Cor do Indicador de Aba do Layout de Aba na Barra de Ferramenta Expandida"</string> + <string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_tab_indicator_detail">"Aplicado a: Cor do indicador de aba no layout de aba (barra de ferramentas expandida)"</string> + <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_tab_background">"Cor de Fundo do Layout de Aba na Barra de Ferramentas Retraída"</string> + <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_tab_background_detail">"Aplicado a: Fundo do layout de aba (barra de ferramentas retraída)"</string> + <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_text_color">"Cor do texto do Layout de Aba na Barra de Ferramentas Retraída"</string> + <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_text_color_detail">"Aplicado a: Cor do texto do layout de aba (barra de ferramentas retraída)"</string> + <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_tab_indicator">"Cor do Indicador de Aba do Layout de Aba na Barra de Ferramentas Retraída"</string> + <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_tab_indicator_detail">"Aplicado a: Cor do indicador de aba no layout de aba (barra de ferramentas retraída)"</string> + <string name="theme_item_upvoted_color">"Cor do Upvoted"</string> + <string name="theme_item_upvoted_color_detail">"Aplicado a: Botões de voto e pontuações (upvoted)"</string> + <string name="theme_item_downvoted_color">"Cor do Downvoted"</string> + <string name="theme_item_downvoted_color_detail">"Aplicado a: Botões de voto e pontuações (downvoted)"</string> + <string name="theme_item_post_type_background_color">"Cor de Fundo do Tipo de Post"</string> + <string name="theme_item_post_type_background_color_detail">"Aplicado a: Fundo do tipo de post (IMAGEM, TEXTO, VÍDEO, GIF, LINK)"</string> + <string name="theme_item_post_type_text_color">"Cor do Texto do Tipo de Post"</string> + <string name="theme_item_post_type_text_color_detail">"Aplicado a: Cor do texto do tipo de post (IMAGEM, TEXTO, VÍDEO, GIF, LINK)"</string> + <string name="theme_item_spoiler_background_color">"Cor de Fundo do Spoiler"</string> + <string name="theme_item_spoiler_background_color_detail">"Aplicado a: Fundo da marcação de spoiler"</string> + <string name="theme_item_spoiler_text_color">"Cor do Texto do Spoiler"</string> + <string name="theme_item_spoiler_text_color_detail">"Aplicado a: Cor do texto na marcação de Spoiler"</string> + <string name="theme_item_nsfw_background_color">"Cor de Fundo do NSFW"</string> + <string name="theme_item_nsfw_background_color_detail">"Aplicado a: Fundo da marcação de NSFW"</string> + <string name="theme_item_nsfw_text_color">"Cor do Texto do NSFW"</string> + <string name="theme_item_nsfw_text_color_detail">"Aplicado a: Cor do texto da marcação de NSFW"</string> + <string name="theme_item_flair_background_color">"Cor de Fundo da Etiqueta"</string> + <string name="theme_item_flair_background_color_detail">"Aplicado a: Fundo da marcação da etiqueta"</string> + <string name="theme_item_flair_text_color">"Cor do Texto da Etiqueta"</string> + <string name="theme_item_flair_text_color_detail">"Aplicado a: Cor do texto da marcação da etiqueta"</string> <string name="theme_item_awards_background_color">"Cor de Fundo dos Prêmios"</string> - <string name="theme_item_awards_background_color_detail">"Aplicado para: plano de fundo com marcação de prêmios"</string> + <string name="theme_item_awards_background_color_detail">"Aplicado a: Fundo da marcação de prêmios"</string> <string name="theme_item_awards_text_color">"Cor do Texto dos Prêmios"</string> - <string name="theme_item_awards_text_color_detail">"Aplicado para: cor de texto de marcação de prêmios"</string> - <string name="theme_item_archived_tint">"Cor de ícone de arquivado"</string> - <string name="theme_item_archived_tint_detail">"Aplicado para: Ícone de Arquivado"</string> - <string name="theme_item_locked_icon_tint">"Cor de ícone trancado"</string> - <string name="theme_item_locked_icon_tint_detail">"Aplicado para: ícone de trancado"</string> - <string name="theme_item_crosspost_icon_tint">"Cor de ícone de Crosspost"</string> - <string name="theme_item_crosspost_icon_tint_detail">"Aplicado para: ícone Crosspost"</string> - <string name="theme_item_stickied_post_icon_tint">"Cor de ícone de Post fixado"</string> - <string name="theme_item_stickied_post_icon_tint_detail">"Aplicado para: ícone de Post fixado"</string> + <string name="theme_item_awards_text_color_detail">"Aplicado a: Cor do texto da marcação de prêmios"</string> + <string name="theme_item_archived_tint">"Cor do Ícone de Arquivado"</string> + <string name="theme_item_archived_tint_detail">"Aplicado a: Ícone de arquivado"</string> + <string name="theme_item_locked_icon_tint">"Cor do Ícone de Bloqueio"</string> + <string name="theme_item_locked_icon_tint_detail">"Aplicado a: Ícone de bloqueio"</string> + <string name="theme_item_crosspost_icon_tint">"Cor do Ícone de Crosspost"</string> + <string name="theme_item_crosspost_icon_tint_detail">"Aplicado a: Ícone de Crosspost"</string> + <string name="theme_item_stickied_post_icon_tint">"Cor do Ícone de Post Fixado"</string> + <string name="theme_item_stickied_post_icon_tint_detail">"Aplicado a: Ícone de Post fixado"</string> <string name="theme_item_subscribed_color">"Inscrito"</string> - <string name="theme_item_subscribed_color_detail">"Aplicado para: Botão de cancelamento de inscrição"</string> - <string name="theme_item_unsubscribed_color">"Inscrição cancelada"</string> - <string name="theme_item_unsubscribed_color_detail">"Aplicado para: Botão de inscrição"</string> + <string name="theme_item_subscribed_color_detail">"Aplicado a: Botão de cancelar inscrição"</string> + <string name="theme_item_unsubscribed_color">"Inscrição Cancelada"</string> + <string name="theme_item_unsubscribed_color_detail">"Aplicado a: Botão de inscrição"</string> <string name="theme_item_username_color">"Cor do Nome de Usuário"</string> - <string name="theme_item_username_color_detail">"Aplicado a: Nome do Usuário"</string> + <string name="theme_item_username_color_detail">"Aplicado a: Nome de usuário"</string> <string name="theme_item_subreddit_color">"Cor do Subreddit"</string> - <string name="theme_item_subreddit_color_detail">"Aplicado a: Nome do subreddit"</string> - <string name="theme_item_author_flair_text_color">"Cor de Flair do autor"</string> - <string name="theme_item_author_flair_text_color_detail">"Aplicado para: Flair do autor em comentários"</string> - <string name="theme_item_submitter_color">"Envio"</string> - <string name="theme_item_submitter_color_detail">"Aplicado para: Envio em comentários"</string> + <string name="theme_item_subreddit_color_detail">"Aplicado a: nome do subreddit"</string> + <string name="theme_item_author_flair_text_color">"Cor da etiqueta de autor"</string> + <string name="theme_item_author_flair_text_color_detail">"Aplicado a: etiqueta de autor nos comentários"</string> + <string name="theme_item_submitter_color">"Remetente"</string> + <string name="theme_item_submitter_color_detail">"Aplicado a: remetente nos comentários"</string> <string name="theme_item_moderator_color">"Moderador"</string> - <string name="theme_item_moderator_color_detail">"Aplicado para: Moderadores nos comentários"</string> - <string name="theme_item_single_comment_thread_background_color">"Cor de fundo de um comentário sem respostas"</string> - <string name="theme_item_single_comment_thread_background_color_detail">"Aplicado para: comentário sem respostas"</string> - <string name="theme_item_unread_message_background_color">"Cor de fundo de mensagem não lida"</string> - <string name="theme_item_unread_message_background_color_detail">"Aplicado para: cor de fundo de mensagem não lida"</string> - <string name="theme_item_divider_color">"Cor de divisor"</string> - <string name="theme_item_divider_color_detail">"Aplicado para: divisor de comentários, páginas, etc."</string> - <string name="theme_item_no_preview_post_type_background_color">"Cor de fundo de link sem pré-visualização"</string> - <string name="theme_item_no_preview_post_type_background_color_detail">"Aplicado para: link sem pré-visualização"</string> - <string name="theme_item_vote_and_reply_unavailable_button_color">"Cor de botão de votação e respostas"</string> - <string name="theme_item_vote_and_reply_unavailable_button_color_detail">"Aplicado para: botões de votação e respostas (indisponíveis)"</string> - <string name="theme_item_comment_vertical_bar_color_1">"Cor 1 de barra vertical de comentário"</string> - <string name="theme_item_comment_vertical_bar_color_1_detail">"Aplicado para: barra de comentário vertical (Nível 1)"</string> - <string name="theme_item_comment_vertical_bar_color_2">"Cor 2 de barra vertical de comentário"</string> - <string name="theme_item_comment_vertical_bar_color_2_detail">"Aplicado para: barra de comentário vertical (Nível 2)"</string> - <string name="theme_item_comment_vertical_bar_color_3">"Cor 3 de barra vertical de comentário"</string> - <string name="theme_item_comment_vertical_bar_color_3_detail">"Aplicado para: barra de comentário vertical (Nível 3)"</string> - <string name="theme_item_comment_vertical_bar_color_4">"Cor 4 de barra vertical de comentário"</string> - <string name="theme_item_comment_vertical_bar_color_4_detail">"Aplicado para: barra de comentário vertical (Nível 4)"</string> - <string name="theme_item_comment_vertical_bar_color_5">"Cor 5 de barra vertical de comentário"</string> - <string name="theme_item_comment_vertical_bar_color_5_detail">"Aplicado para: barra de comentário vertical (Nível 5)"</string> - <string name="theme_item_comment_vertical_bar_color_6">"Cor 6 de barra vertical de comentário"</string> - <string name="theme_item_comment_vertical_bar_color_6_detail">"Aplicado para: barra de comentário vertical (Nível 6)"</string> - <string name="theme_item_comment_vertical_bar_color_7">"Cor 7 de barra vertical de comentário"</string> - <string name="theme_item_comment_vertical_bar_color_7_detail">"Aplicado para: barra de comentário vertical (Nível 7)"</string> - <string name="theme_item_nav_bar_color">"Cor da Barra de Navegação"</string> - <string name="theme_item_nav_bar_color_detail">"Aplicado a: Barra de Navegação"</string> - <string name="theme_item_light_status_bar">"Cor de ícone de barra de status escura"</string> - <string name="theme_item_light_nav_bar">"Cor de ícone de barra de navegação escura"</string> - <string name="theme_item_change_status_bar_icon_color_after_toolbar_collapsed_in_immersive_interface">"Alterar cor de ícone da barra de status após a barra de ferramentas ser suprimida na interface imersiva"</string> - <string name="theme_item_available_on_android_8">"Acessível apenas para Android 8.0 e acima"</string> - <string name="theme_item_available_on_android_6">"Acessível apenas para Android 6.0 e acima"</string> - <string name="predefined_themes">"Temas Predefinidos"</string> - <string name="user_themes">"Seus Temas"</string> + <string name="theme_item_moderator_color_detail">"Aplicado a: moderador nos comentários"</string> + <string name="theme_item_single_comment_thread_background_color">"Cor de fundo de tópico de comentário único"</string> + <string name="theme_item_single_comment_thread_background_color_detail">"Aplicado a: comentário único"</string> + <string name="theme_item_unread_message_background_color">"Cor de fundo de mensagens não lidas"</string> + <string name="theme_item_unread_message_background_color_detail">"Aplicado a: cor de fundo de mensagens não lidas"</string> + <string name="theme_item_divider_color">"Cor do divisor"</string> + <string name="theme_item_divider_color_detail">"Aplicado a: divisor de comentários, páginas, etc."</string> + <string name="theme_item_vote_and_reply_unavailable_button_color">"Cor do botão de votação e resposta indisponível"</string> + <string name="theme_item_vote_and_reply_unavailable_button_color_detail">"Aplicado a: botões de votação e resposta (Indisponível)"</string> + <string name="theme_item_comment_vertical_bar_color_1">"Cor 1 da barra de comentário vertical"</string> + <string name="theme_item_comment_vertical_bar_color_1_detail">"Aplicado a: barra de comentário vertical (Nível 1)"</string> + <string name="theme_item_comment_vertical_bar_color_2">"Cor 2 da barra de comentário vertical"</string> + <string name="theme_item_comment_vertical_bar_color_2_detail">"Aplicado a: barra de comentário vertical (Nível 2)"</string> + <string name="theme_item_comment_vertical_bar_color_3">"Cor 3 da barra de comentário vertical"</string> + <string name="theme_item_comment_vertical_bar_color_3_detail">"Aplicado a: barra de comentário vertical (Nível 3)"</string> + <string name="theme_item_comment_vertical_bar_color_4">"Cor 4 da barra de comentário vertical"</string> + <string name="theme_item_comment_vertical_bar_color_4_detail">"Aplicado a: barra de comentário vertical (Nível 4)"</string> + <string name="theme_item_comment_vertical_bar_color_5">"Cor 5 da barra de comentário vertical"</string> + <string name="theme_item_comment_vertical_bar_color_5_detail">"Aplicado a: barra de comentário vertical (Nível 5)"</string> + <string name="theme_item_comment_vertical_bar_color_6">"Cor 6 da barra de comentário vertical"</string> + <string name="theme_item_comment_vertical_bar_color_6_detail">"Aplicado a: barra de comentário vertical (Nível 6)"</string> + <string name="theme_item_comment_vertical_bar_color_7">"Cor 7 da barra de comentário vertical"</string> + <string name="theme_item_comment_vertical_bar_color_7_detail">"Aplicado a: barra de comentário vertical (Nível 7)"</string> + <string name="theme_item_nav_bar_color">"Cor da barra de navegação"</string> + <string name="theme_item_nav_bar_color_detail">"Aplicado a: Barra de navegação"</string> + <string name="theme_item_light_status_bar">"Cor do ícone da barra de status escura"</string> + <string name="theme_item_light_nav_bar">"Cor do ícone da barra de navegação escura"</string> + <string name="theme_item_change_status_bar_icon_color_after_toolbar_collapsed_in_immersive_interface">"Alterar cor do ícone da barra de status após a barra de ferramentas ser retraída na interface imersiva"</string> + <string name="theme_item_available_on_android_8">"Disponível apenas para Android 8.0 ou superior."</string> + <string name="theme_item_available_on_android_6">"Disponível apenas para Android 6.0 ou superior."</string> + <string name="predefined_themes">"Temas predefinidos"</string> + <string name="user_themes">"Seus temas"</string> <string name="no_theme_name">"Qual é o nome deste tema?"</string> - <string name="theme_name_hint">"Nome do Tema"</string> + <string name="theme_name_hint">"Nome do tema"</string> <string name="theme_name_indigo">"Índigo"</string> <string name="theme_name_indigo_dark">"Índigo Escuro"</string> <string name="theme_name_indigo_amoled">"Índigo Amoled"</string> @@ -670,112 +660,208 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="theme_name_red_amoled">"Vermelho Amoled"</string> <string name="theme_name_dracula">"Dracula"</string> <string name="theme_name_calm_pastel">"Tom Pastel Calmo"</string> - <string name="create_light_theme">"Criar um tema claro -Baseado no Tema Indigo"</string> - <string name="create_dark_theme">"Criar um tema escuro -Baseado no Tema Indigo Escuro"</string> - <string name="create_amoled_theme">"Criar um tema Amoled -Baseado no Tema Indigo Amoled"</string> + <string name="create_light_theme">"Criar um Tema Claro +Baseado no tema Índigo"</string> + <string name="create_dark_theme">"Criar um Tema Escuro +Baseado no tema Índigo Escuro"</string> + <string name="create_amoled_theme">"Criar um Tema Amoled +Baseado no tema Índigo Amoled"</string> <string name="create_theme_info">"Se você deseja criar um tema baseado em outro tema, clique no botão \"+\" localizado no tema"</string> - <string name="edit_theme_name">"Editar Nome do Tema"</string> - <string name="edit_theme">"Editar Tema"</string> - <string name="delete_theme">"Apagar Tema"</string> - <string name="delete_theme_dialog_message">"Você tem certeza que deseja excluir %1$s?"</string> - <string name="share_theme">"Compartilhar Tema"</string> - <string name="change_theme_name">"Mudar Nome"</string> - <string name="theme_copied">"Copiado! Cole e compartilhe com outras pessoas"</string> - <string name="copy_theme_faied">"Não foi possível copiar a configuração de tema."</string> + <string name="edit_theme_name">"Editar nome do tema"</string> + <string name="edit_theme">"Editar tema"</string> + <string name="delete_theme">"Excluir tema"</string> + <string name="delete_theme_dialog_message">"Tem certeza que deseja excluir %1$s?"</string> + <string name="share_theme">"Compartilhar tema"</string> + <string name="change_theme_name">"Alterar nome"</string> + <string name="theme_copied">"Copiado! Cole e compartilhe com outras pessoas."</string> + <string name="copy_theme_faied">"Não foi possível copiar a configuração de tema"</string> <string name="cannot_find_theme">"Não foi possível encontrar este tema"</string> - <string name="import_theme">"Importar Tema"</string> - <string name="no_data_in_clipboard">"Não foi possível encontrar dados na área de cópia"</string> - - <!-- Fuzzy --> + <string name="import_theme">"Importar tema"</string> + <string name="no_data_in_clipboard">"Não foi possível encontrar dados na área de transferência"</string> <string name="import_theme_success">"Tema importado com sucesso"</string> - <string name="parse_theme_failed">"Falha na análise de tema"</string> - <string name="duplicate_theme_name_dialog_title">"Tema Duplicado Encontrado"</string> - <string name="duplicate_theme_name_dialog_message">"Um tema na base de dados também tem o nome de %1$s. Você deseja mudar o nome deste tema importado?"</string> - <string name="rename">"Mudar nome"</string> - <string name="override">"Sobrepassar"</string> - <string name="color_picker">"Seletor de cor"</string> + <string name="parse_theme_failed">"Falha ao analisar tema"</string> + <string name="duplicate_theme_name_dialog_title">"Tema duplicado encontrado"</string> + <string name="duplicate_theme_name_dialog_message">"Um tema no banco de dados também tem o nome de %1$s. Você deseja alterar o nome deste tema importado?"</string> + <string name="rename">"Renomear"</string> + <string name="override">"Substituir"</string> + <string name="color_picker">"Seletor de cores"</string> <string name="invalid_color">"Cor inválida"</string> - - <!-- Fuzzy --> - <string name="delete_all_subreddits_success">"Sucesso ao excluir todos os subreddits"</string> - - <!-- Fuzzy --> - <string name="delete_all_users_success">"Sucesso ao excluir todos os usuários"</string> - - <!-- Fuzzy --> - <string name="delete_all_sort_types_success">"Sucesso ao excluir todos os tipos de exibição"</string> - - <!-- Fuzzy --> - <string name="delete_all_post_layouts_success">"Sucesso ao excluir todos os Layouts de posts"</string> - - <!-- Fuzzy --> - <string name="delete_all_themes_success">"Sucesso ao excluir todos os temas"</string> - - <!-- Fuzzy --> - <string name="delete_all_front_page_scrolled_positions_success">"Sucesso ao excluir todas as opções de barra de rolamento na primeira página"</string> - - <!-- Fuzzy --> - <string name="reset_all_settings_success">"Sucesso ao reiniciar as configurações"</string> + <string name="delete_all_subreddits_success">"Todos os subreddits excluídos com sucesso"</string> + <string name="delete_all_users_success">"Todos os usuários excluídos com sucesso"</string> + <string name="delete_all_sort_types_success">"Todos os modos de classificação excluídos com sucesso"</string> + <string name="delete_all_post_layouts_success">"Todos os modos de aparência de posts excluídos com sucesso"</string> + <string name="delete_all_themes_success">"Todos os temas excluídos com sucesso"</string> + <string name="delete_all_front_page_scrolled_positions_success">"Todas as posições de rolagem na primeira página excluídas com sucesso"</string> + <string name="reset_all_settings_success">"Configurações redefinidas com sucesso"</string> <string name="username_preview">"u/Hostilenemy"</string> <string name="subreddit_preview">"r/Infinity_For_Reddit"</string> - <string name="primary_text_preview">"Texto Primário"</string> - <string name="secondary_text_preview">"Texto Secundário"</string> + <string name="primary_text_preview">"Texto primário"</string> + <string name="secondary_text_preview">"Texto secundário"</string> <string name="post_title_preview">"Este é um post"</string> <string name="post_content_preview">"Prévia de conteúdo a ser publicado"</string> - <string name="post_type_preview">"Post"</string> - <string name="flair_preview">"Flair"</string> - <string name="awards_preview">"4 prêmios"</string> - <string name="author_flair_preview">"Flair do autor"</string> + <string name="post_type_preview">"POST"</string> + <string name="flair_preview">"Etiqueta"</string> + <string name="awards_preview">"4 Prêmios"</string> + <string name="author_flair_preview">"Etiqueta de autor"</string> <string name="comment_content_preview">"Prévia do comentário"</string> - <string name="edit_multi_reddit">"Editar Multireddit"</string> - <string name="delete_multi_reddit">"Excluir Multireddit"</string> + <string name="edit_multi_reddit">"Editar multireddit"</string> + <string name="delete_multi_reddit">"Excluir multireddit"</string> <string name="n_awards">"%1$d Prêmios"</string> <string name="one_award">"1 Prêmio"</string> <string name="report">"Reportar"</string> <string name="reporting">"Reportando"</string> <string name="report_successful">"Reportado"</string> - <string name="report_failed">"Falha ao Reportar"</string> + <string name="report_failed">"Falha ao reportar"</string> <string name="report_reason_not_selected">"Você não selecionou um motivo"</string> <string name="report_reason_general_spam">"Isso é SPAM"</string> - <string name="report_reason_general_copyright_issue">"Contém problemas com direito autoral"</string> - <string name="report_reason_general_child_pornography">"Contém Pornografia Infantil"</string> + <string name="report_reason_general_copyright_issue">"Contém problemas com direitos autorais"</string> + <string name="report_reason_general_child_pornography">"Contém pornografia infantil"</string> <string name="report_reason_general_abusive_content">"Contém conteúdo abusivo"</string> <string name="home">"Tela inicial"</string> <string name="popular">"Popular"</string> <string name="notifications">"Notificações"</string> <string name="messages">"Mensagens"</string> <string name="message">"Mensagem"</string> - <string name="fetch_gfycat_video_failed">"Falha ao atualizar dados do vídeo do Gfycat"</string> - <string name="fetch_redgifs_video_failed">"Falha ao atualizar dados do vídeo do Redgifs"</string> - <string name="fetching_video_info_please_wait">"Atualizando dados de informação do vídeo. Por favor espere."</string> + <string name="fetch_gfycat_video_failed">"Falha ao buscar vídeos do Gfycat"</string> + <string name="fetch_redgifs_video_failed">"Falha ao buscar vídeos do Redgifs"</string> + <string name="fetching_video_info_please_wait">"Obtendo informações do vídeo. Por favor aguarde."</string> <string name="error_fetching_imgur_media">"Não foi possível carregar as imagens"</string> - <string name="downloading_reddit_video">"Executando download do vídeo"</string> - <string name="downloading_reddit_video_audio_track">"Executando download do áudio"</string> - <string name="downloading_reddit_video_muxing">"Sincronizando áudio e vídeo"</string> + <string name="downloading_reddit_video">"Baixando faixa de vídeo"</string> + <string name="downloading_reddit_video_audio_track">"Baixando faixa de áudio"</string> + <string name="downloading_reddit_video_muxing">"Sincronizando vídeo e áudio"</string> <string name="downloading_reddit_video_save_file_to_public_dir">"Salvando vídeo"</string> <string name="downloading_reddit_video_finished">"Baixado"</string> - - <!-- Fuzzy --> - <string name="downloading_reddit_video_failed_cannot_get_cache_directory">"Falha ao baixar: espaço não necessário no final"</string> + <string name="downloading_reddit_video_failed_cannot_get_cache_directory">"Falha ao baixar: não foi possível acessar o diretório de cache"</string> <string name="downloading_reddit_video_failed_cannot_download_video">"Falha ao baixar: não foi possível baixar o vídeo"</string> - <string name="downloading_reddit_video_failed_cannot_save_video">"Falha ao baixar: não foi possível baixar o vídeo"</string> - <string name="downloading_reddit_video_failed_cannot_save_audio">"Falha ao baixar: não foi possível baixar o áudio"</string> + <string name="downloading_reddit_video_failed_cannot_save_video">"Falha ao baixar: não foi possível salvar o vídeo no diretório de cache"</string> + <string name="downloading_reddit_video_failed_cannot_save_audio">"Falha ao baixar: não foi possível salvar o áudio no diretório de cache"</string> <string name="downloading_reddit_video_failed_cannot_mux">"Falha ao baixar: não foi possível sincronizar o vídeo e o áudio"</string> - <string name="downloading_reddit_video_failed_cannot_save_mux_video">"Falha ao baixar: não foi possível salvar no diretório"</string> - <string name="wallpaper_set">"Papel de parede configurado"</string> - <string name="error_set_wallpaper">"Não foi possível configurar o papel de parede"</string> - <string name="set_to_home_screen">"Configurar para página inicial"</string> - <string name="set_to_lock_screen">"Configurar para tela de bloqueio"</string> - <string name="set_to_both">"Configurar para ambos"</string> + <string name="downloading_reddit_video_failed_cannot_save_mux_video">"Falha ao baixar: não foi possível salvar o vídeo no diretório público"</string> + <string name="wallpaper_set">"Papel de parede aplicado"</string> + <string name="error_set_wallpaper">"Não foi possível aplicar o papel de parede"</string> + <string name="set_to_home_screen">"Aplicar na tela inicial"</string> + <string name="set_to_lock_screen">"Aplicar na tela de bloqueio"</string> + <string name="set_to_both">"Aplicar em ambos"</string> <string name="default_font_font_preview">"Padrão"</string> - <string name="load_video_in_redgifs">"Experimente subir o vídeo no Redgifs"</string> + <string name="load_video_in_redgifs">"Tente carregar o vídeo no Redgifs"</string> <string name="top_score">"%1$s pontos"</string> - <string name="login_activity_2fa_prompt">"Se você tem a Autenticação em 2 Etapas habilitada, digite a senha da seguinte forma: <senha>:<códigodeautenticação>. + <string name="login_activity_2fa_prompt">"Se você tem a Autenticação em 2 Etapas ativada, digite a senha da seguinte forma: <senha>:<códigodeautenticação>. Exemplo: suasenha:123456"</string> - <string name="block_user">"Bloquear Usuário"</string> + <string name="block_user">"Bloquear usuário"</string> <string name="block_user_success">"Bloqueado"</string> <string name="block_user_failed">"Falha ao bloquear usuário"</string> + <string name="submit_crosspost_activity_label">"Crosspost"</string> + <string name="give_award_activity_label">"Dar prêmio"</string> + <string name="action_crosspost">"Crosspost"</string> + <string name="action_select_user_flair">"Selecionar etiqueta de usuário"</string> + <string name="action_give_award">"Dar prêmio"</string> + <string name="posts">"Posts"</string> + <string name="sidebar">"Descrição"</string> + <string name="only_for_logged_in_user">"Apenas para usuários logados"</string> + <string name="settings_number_of_columns_in_post_feed_title">"O número de colunas no feed de posts"</string> + <string name="settings_number_of_columns_in_post_feed_portrait_title">"Retrato"</string> + <string name="settings_number_of_columns_in_post_feed_landscape_title">"Paisagem"</string> + <string name="settings_nsfw_and_spoiler_title">"NSFW & Spoiler"</string> + <string name="settings_delete_all_legacy_settings_title">"Excluir todas as configurações intigas"</string> + <string name="restart_app_see_changes">"Reinicie o app para ver as alterações"</string> + <string name="settings_tab_count">"Contador de abas"</string> + <string name="settings_show_tab_names">"Mostrar nome de abas"</string> + <string name="settings_more_tabs_summary">"Mais abas"</string> + <string name="settings_more_tabs_info_summary">"Ativar as seguintes opções causará um comportamento indesejado: +As abas podem perder todo o conteúdo após alternar para outras. Isso é o mesmo que atualizar a página."</string> + <string name="settings_more_tabs_show_favorite_subscribed_subreddits_title">"Mostrar subreddits favoritos que estou inscrito"</string> + <string name="settings_more_tabs_show_subscribed_subreddits_title">"Mostrar subreddits que estou inscrito"</string> + <string name="settings_download_location_title">"Local de download"</string> + <string name="settings_image_download_location_title">"Local de download de imagem"</string> + <string name="settings_gif_download_location_title">"Local de download de gif"</string> + <string name="settings_video_download_location_title">"Local de download de vídeo"</string> + <string name="settings_separate_folder_for_each_subreddit">"Pasta separada para cada subreddit"</string> + <string name="settings_swipe_action_title">"Ação de deslizar"</string> + <string name="settings_disable_swiping_between_tabs_title">"Desativar o deslizar entre abas"</string> + <string name="settings_enable_swipe_action_title">"Ativar ação de deslizar"</string> + <string name="settings_swipe_action_threshold">"Limite"</string> + <string name="settings_pull_to_refresh_title">"Puxar para atualizar"</string> + <string name="settings_security_title">"Segurança"</string> + <string name="settings_require_authentication_to_go_to_account_section_in_navigation_drawer_title">"Requer autenticação para ir a sessão de conta no menu de navegação"</string> + <string name="settings_long_press_to_hide_toolbar_in_compact_layout_title">"Aperte e segure para esconder a barra de ferramentas no modo compacto"</string> + <string name="settings_post_compact_layout_toolbar_hidden_by_default_title">"Barra de ferramentas no modo compacto oculta por padrão"</string> + <string name="settings_customize_bottom_app_bar_title">"Personalizar barra de navegação inferior"</string> + <string name="settings_main_activity_bottom_app_bar_group_summary">"Página inicial"</string> + <string name="settings_other_activities_bottom_app_bar_group_summary">"Outras páginas"</string> + <string name="settings_bottom_app_bar_option_count">"Opção de contador"</string> + <string name="settings_bottom_app_bar_option_1">"Opção 1"</string> + <string name="settings_bottom_app_bar_option_2">"Opção 2"</string> + <string name="settings_bottom_app_bar_option_3">"Opção 3"</string> + <string name="settings_bottom_app_bar_option_4">"Opção 4"</string> + <string name="settings_bottom_app_bar_fab">"Botão de ação flutuante"</string> + <string name="settings_data_saving_mode">"Modo economia de dados"</string> + <string name="settings_data_saving_mode_info_summary">"No modo de economia de dados: +A pré-visualização de imagens fica em menor resolução. +Os vídeos do Reddit ficam em menor resolução."</string> + <string name="settings_translation_title">"Tradução"</string> + <string name="settings_translation_summary">"Traduza o app em POEditor. Obrigado a todos os contribuíntes."</string> + <string name="settings_credits_national_flags">"Bandeiras nacionais"</string> + <string name="settings_credits_national_flags_summary">"Ícone feito por Freepik em www.flaticon.com"</string> + <string name="copy_failed">"Falha ao copiar"</string> + <string name="delete_all_legacy_settings_success">"Configurações antigas excluídas com sucesso"</string> + <string name="downloading_media_finished">"Baixado"</string> + <string name="downloading_image_or_gif_failed_cannot_get_destination_directory">"Falha ao baixar: não é possível acessar o diretório de destino"</string> + <string name="downloading_media_failed_cannot_download_media">"Falha ao baixar"</string> + <string name="downloading_media_failed_cannot_save_to_destination_directory">"Falha ao baixar: não é possível salvar o arquivo no diretório de destino"</string> + <string name="view_full_comment_markdown">"Ver markdown completo"</string> + <string name="select_user_flair_success">"Etiqueta de usuário selecionada"</string> + <string name="select_this_user_flair">"Selecionar essa etiqueta de usuário?"</string> + <string name="select_header_size">"Selecionar o tamanho do cabeçalho"</string> + <string name="large">"Grande"</string> + <string name="small">"Pequeno"</string> + <string name="insert_link">"Inserir link"</string> + <string name="text_hint">"Texto"</string> + <string name="link_hint">"Link"</string> + <string name="unlock_account_section">"Desbloquear sessão de conta"</string> + <string name="unlock">"Desbloquear"</string> + <string name="submit_post">"Enviar post"</string> + <string name="refresh">"Atualizar"</string> + <string name="change_sort_type">"Alterar modo de classificação"</string> + <string name="change_post_layout">"Alterar aparência do post"</string> + <string name="give_award_dialog_title">"Dar prêmio?"</string> + <string name="anonymous">"Anônimo"</string> + <string name="give_award_error_message">"Código: %1$d/ + Mensagem: %2$s"</string> + <string name="give_award_success">"Prêmio concedido"</string> + <string name="give_award_failed">"Falhou"</string> + <string name="recent_searches">"Buscas recentes"</string> + <string name="warning">"Aviso"</string> + <string name="this_is_a_nsfw_subreddit">"Este é um subreddit NSFW."</string> + <string name="this_user_has_nsfw_content">"Este usuário tem conteúdo NSFW."</string> + <string name="dismiss">"Dispensar"</string> + <string name="leave">"Sair"</string> + <string name="go_to_subreddit">"Ir para subreddit"</string> + <string name="go_to_user">"Ir para usuário"</string> + <string name="go_to_thing_hint">"Nome"</string> + <string name="random">"Aleatório"</string> + <string name="random_subreddit">"Subreddit aleatório"</string> + <string name="random_nsfw_subreddit">"Subreddit NSFW aleatório"</string> + <string name="random_post">"Post aleatório"</string> + <string name="random_nsfw_post">"Post NSFW aleatório"</string> + <string name="fetch_random_thing_failed">"Tente novamente mais tarde"</string> + <string name="downloading">"Baixando"</string> + <string name="subreddit_filter_popular_and_all_activity_label">"r/all e r/popular"</string> + <string name="settings_miscellaneous_title">"Miscelãnea"</string> + <string name="settings_respect_subreddit_recommended_comment_sort_type_title">"Respeitar modo de classificação de comentário recomendado pelo subreddit"</string> + <string name="settings_respect_subreddit_recommended_comment_sort_type_summary">"Modo de classificação de comentário não será salvo"</string> + <string name="settings_post_filter_title">"Filtrar"</string> + <string name="settings_subreddit_filter_category">"Ocultar subreddits"</string> + <string name="settings_subreddit_filter_popular_and_all">"Em r/popular e r/all"</string> + <string name="settings_credits_ufo_capturing_animation_title">"Animação de captura de OVNIs"</string> + <string name="select_video_quality">"Selecionar qualidade do vídeo"</string> + <string name="settings_swipe_action_haptic_feedback_title">"Resposta tátil"</string> + <string name="settings_hide_subreddit_description_title">"Ocultar descrição do subreddit"</string> + <string name="settings_disable_image_preview_title">"Desativar pré-visualização de imagem no modo de economia de dados"</string> + <string name="settings_swipe_action_swipe_left_title">"Deslizar para a esquerda"</string> + <string name="settings_swipe_action_swipe_right_title">"Deslizar para a direita"</string> + <string name="settings_swipe_action_info_summary">"Não é aplicável ao feed de post com mais de 1 coluna ou detalhes de post."</string> + <string name="theme_item_no_preview_post_type_icon_tint">"Cor do ícone do tipo de post sem pré-visualização"</string> + <string name="theme_item_no_preview_post_type_icon_tint_detail">"Aplicado a: Ícone indicando o tipo de post quando não há pré-visualização disponível"</string> + <string name="theme_item_no_preview_post_type_background_color">"Cor de fundo do tipo de post sem pré-visualização"</string> + <string name="theme_item_no_preview_post_type_background_color_detail">"Aplicado a: Espaço reservado indicando o tipo de post quando não há pré-visualização disponível"</string> </resources>
\ No newline at end of file diff --git a/app/src/main/res/values-tr-rTR/strings.xml b/app/src/main/res/values-tr-rTR/strings.xml index e4139539..37f7aff0 100644 --- a/app/src/main/res/values-tr-rTR/strings.xml +++ b/app/src/main/res/values-tr-rTR/strings.xml @@ -21,7 +21,7 @@ <string name="custom_theme_listing_activity_label">"Özel Temalar"</string> <string name="customize_theme_activity_label">"Temayı Özelleştir"</string> <string name="customize_theme_activity_create_theme_label">"Tema Oluştur"</string> - <string name="theme_preview_activity_label">"Tema Önizleme"</string> + <string name="theme_preview_activity_label">"Tema Önizlemesi"</string> <string name="edit_multi_reddit_activity_label">"Multireddit'i Düzenle"</string> <string name="selected_subeddits_activity_label">"Seçili Subredditler"</string> <string name="report_activity_label">"Bildir"</string> @@ -33,14 +33,14 @@ <string name="view_reddit_gallery_activity_video_label">"Video %1$d/%2$d"</string> <string name="navigation_drawer_open">"Gezinme çekmecesini aç"</string> <string name="navigation_drawer_close">"Gezinme çekmecesini kapat"</string> - <string name="action_download">"İndirilenler"</string> + <string name="action_download">"İndir"</string> <string name="action_refresh">"Yenile"</string> <string name="action_add_comment">"Yorum yap"</string> <string name="action_save_post">"Gönderiyi Kaydet"</string> <string name="action_view_crosspost_parent">"Çapraz Gönderi kaynağı"</string> <string name="action_search">"Arama"</string> - <string name="action_start_lazy_mode">"Uyuşuk Modu'nu Başlat"</string> - <string name="action_stop_lazy_mode">"Uyuşuk Modu'nu Durdur"</string> + <string name="action_start_lazy_mode">"Uyuşuk Modu Başlat"</string> + <string name="action_stop_lazy_mode">"Uyuşuk Modu Durdur"</string> <string name="action_send">"Gönder"</string> <string name="action_sort">"Sırala"</string> <string name="action_hide_post">"Gönderiyi Gizle"</string> @@ -89,7 +89,7 @@ Tekrar denemek için tıklayın."</string> Tekrar denemek için tıklayın."</string> <string name="retry">"Tekrar dene"</string> <string name="comments">"Yorumlar"</string> - <string name="no_comments_yet">"Henüz yorum yapılmamış, ilk yorumu yapan siz olun."</string> + <string name="no_comments_yet">"Henüz yorum yok, ilk yorumu yapan siz olun."</string> <string name="vote_failed">"Oylama başarısız oldu"</string> <string name="refresh_post_failed">"Gönderi yenilenirken hata oluştu"</string> <string name="load_messages_failed">"Mesajlar yüklenirken hata oluştu. @@ -144,7 +144,7 @@ This translation does it work well in this kinda format. People use "since" in s <string name="write_comment_hint">"Buradaki ilginç düşünceleriniz"</string> <string name="comment_content_required">"İlginç düşünceniz nerede?"</string> <string name="sending_comment">"Gönderiliyor"</string> - <string name="send_comment_success">"Yorum gönder"</string> + <string name="send_comment_success">"Yorum gönderildi"</string> <string name="send_comment_failed">"Bu yorum gönderilemedi"</string> <string name="send_message_username_hint">"Kullanıcı"</string> <string name="send_message_subject_hint">"Konu (maks 100 karakter)"</string> @@ -176,10 +176,10 @@ This translation does it work well in this kinda format. People use "since" in s <string name="post_link_hint">"Bağlantı Adresi"</string> <string name="subreddits">"Subredditler"</string> <string name="users">"Kullanıcılar"</string> - <string name="multi_reddits">"MultiRedditler"</string> + <string name="multi_reddits">"MultiRedditlr"</string> <string name="bottom_sheet_post_text">"Metin"</string> <string name="bottom_sheet_post_link">"Bağlantı"</string> - <string name="bottom_sheet_post_image">"Görüntü"</string> + <string name="bottom_sheet_post_image">"Fotoğraf"</string> <string name="bottom_sheet_post_video">"Video"</string> <string name="select_from_gallery">"Bir resim seçin"</string> <string name="select_again">"Tekrar seçin"</string> @@ -201,7 +201,7 @@ Tekrar denemek için tıklayın."</string> <string name="error_loading_rules_without_retry">"Kuralllar Yüklenirken Hata Oluştu"</string> <string name="search_in">"Arama"</string> <string name="all_subreddits">"Tüm subredditler"</string> - <string name="sort_best">"En iyileri"</string> + <string name="sort_best">"Enler"</string> <string name="sort_hot">"Sıcak"</string> <string name="sort_new">"Yeni"</string> <string name="sort_random">"Rastgele"</string> @@ -234,19 +234,19 @@ Tekrar denemek için tıklayın."</string> <string name="video">"VİDEO"</string> <string name="gif">"GIF"</string> <string name="gallery">"GALERİ"</string> - <string name="best">"En iyileri"</string> + <string name="best">"Enler"</string> <string name="search">"Arama"</string> <string name="posting_video">"Video Paylaşılıyor"</string> - <string name="posting_image">"Görüntü Paylaşılıyor"</string> + <string name="posting_image">"Fotoğraf Paylaşılıyor"</string> <string name="please_wait">"Lütfen bekleyin."</string> <string name="add_account">"Hesap ekle"</string> <string name="anonymous_account">"Anonim"</string> <string name="log_out">"Çıkış yap"</string> - <string name="press_here_to_login">"Giriş yapmak için buraya basınız"</string> + <string name="press_here_to_login">"Giriş yapmak için basın"</string> <string name="login_first">"Önce giriş yap"</string> <string name="post_saved_success">"Gönderi kaydedildi"</string> <string name="post_saved_failed">"Gönderi kaydedilemiyor"</string> - <string name="post_unsaved_success">"Gönderiyi kaydetme"</string> + <string name="post_unsaved_success">"Gönderi kaydedilmedi"</string> <string name="post_unsaved_failed">"Gönderinin kaydı kaldırılamıyor"</string> <string name="post_hide_success">"Gönderi gizlendi"</string> <string name="post_hide_failed">"Gönderi gizlenemiyor"</string> @@ -266,8 +266,8 @@ Tekrar denemek için tıklayın."</string> <string name="show_removed_post_failed">"Kaldırılan gönderi bulunamadı"</string> <string name="cancel">"İptal"</string> <string name="ok">"Tamam"</string> - <string name="edit_success">"Düzenleme başarılı"</string> - <string name="delete_post_success">"Silinme Başarılı"</string> + <string name="edit_success">"Başarıyla düzenlendi"</string> + <string name="delete_post_success">"Başarıyla silindi"</string> <string name="delete_post_failed">"Silinemedi"</string> <string name="mark_nsfw_success">"NSFW başarıyla işaretlendi"</string> <string name="mark_nsfw_failed">"NSFW işaretlenemedi"</string> @@ -293,22 +293,22 @@ Tekrar denemek için tıklayın."</string> <string name="account_switched">"Hesap Değiştirildi. Yani tüm diğer sayfalar da gitti."</string> <string name="settings_notification_master_title">"Bildirimler"</string> <string name="settings_notification_enable_notification_title">"Bildirimleri Etkinleştir"</string> - <string name="settings_notification_interval_title">"Bildirim Aralığını Kontrol Edin"</string> + <string name="settings_notification_interval_title">"Bildirim Aralığını Ayarla"</string> <string name="settings_theme_title">"Tema"</string> <string name="settings_amoled_dark_title">"Koyu Amoled"</string> <string name="settings_interface_title">"Arayüz"</string> <string name="settings_gestures_and_buttons_title">"İşaretler ve Düğmeler"</string> <string name="settings_save_front_page_scrolled_position_title">"Ana Sayfada Kaydırma Konumunu Kaydet"</string> - <string name="settings_save_front_page_scrolled_position_summary">"Ana Sayfa yenilendikten sonra yeni gönderilere göz atın (Ön Sayfa, sıralama türü: En İyileri)"</string> - <string name="settings_open_link_in_app_title">"Bağlantıyı Uygulamada Aç"</string> + <string name="settings_save_front_page_scrolled_position_summary">"Ana Sayfa yenilendikten sonra yeni gönderilere göz atın (Ön Sayfa, sıralama türü: Enler)"</string> + <string name="settings_open_link_in_app_title">"Bağlantıları Uygulamada Aç"</string> <string name="settigns_video_title">"Video"</string> <string name="settings_video_autoplay_title">"Otomatik Video Oynatma"</string> - <string name="settings_mute_autoplaying_videos_title">"Otomatik Oynatılan Videoların Sesini Kapat"</string> + <string name="settings_mute_autoplaying_videos_title">"Otomatik Oynatılan Videoları Sessize Al"</string> <string name="settings_autoplay_nsfw_videos_title">"NSFW Videolarını Otomatik Oynat"</string> <string name="settings_start_autoplay_visible_area_offset_portrait_title">"Otomatik Oynatılan Videoların Görünür Alan Uzaklığı (Dikey)"</string> - <string name="settings_start_autoplay_visible_area_offset_portrait_summary">"Videoları %1$d%% göründüğünde otomatik oynatmaya başlayın"</string> + <string name="settings_start_autoplay_visible_area_offset_portrait_summary">"Videoları %1$d%% göründüğünde otomatik oynatmaya başla"</string> <string name="settings_start_autoplay_visible_area_offset_landscape_title">"Otomatik Oynatılan Videoların Görünür Alan Uzaklığı (Yatay)"</string> - <string name="settings_start_autoplay_visible_area_offset_landscape_summary">"Videoları %1$d%% göründüğünde otomatik oynatmaya başlayın"</string> + <string name="settings_start_autoplay_visible_area_offset_landscape_summary">"Videoları %1$d%% göründüğünde otomatik oynatmaya başla"</string> <string name="settings_immersive_interface_title">"Sürükleyici Arayüz"</string> <string name="settings_immersive_interface_summary">"Tüm Sayfalara Uygulanamaz"</string> <string name="settings_immersive_interface_ignore_nav_bar_title">"Sürükleyici Arayüzde Navigasyon Çubuğunu Yoksay"</string> @@ -316,7 +316,7 @@ Tekrar denemek için tıklayın."</string> <string name="settings_customize_tabs_in_main_page_title">"Ana Sayfadaki Sekmeleri Özelleştirin"</string> <string name="settings_enable_bottom_app_bar_title">"Alt Navigasyonu Etkinleştir"</string> <string name="settings_enable_bottom_app_bar_summary">"Anonim Modda Etkisi Yok"</string> - <string name="settings_category_post_and_comment_title">"Yayınla ve Yorum Yap"</string> + <string name="settings_category_post_and_comment_title">"Gönderi ve Yorum"</string> <string name="settings_vote_buttons_on_the_right_title">"Sağdaki Oy Düğmeleri"</string> <string name="settings_volume_keys_navigate_comments_title">"Gönderilerdeki Yorumlarda Gezinmek İçin Ses Tuşlarını Kullanın"</string> <string name="settings_volume_keys_navigate_posts_title">"Gönderilerde Gezinmek İçin Ses Tuşlarını Kullanın"</string> @@ -325,8 +325,8 @@ Tekrar denemek için tıklayın."</string> <string name="settings_automatically_try_redgifs_title">"Gfycat'taki Videolar Kaldırılırsa Redgif'lere Erişmeyi Otomatik Olarak Deneyin."</string> <string name="settings_video_player_ignore_nav_bar_title">"Video Oynatıcısındaki Navigasyon Çubuğunu Yoksay"</string> <string name="settings_video_player_ignore_nav_bar_summary">"Video Denetleyicisinde Fazladan Kenar Olmasını Önleyin"</string> - <string name="settings_confirm_to_exit">"Çıkmayı Onayla"</string> - <string name="settings_category_comment_title">"Yorum yap"</string> + <string name="settings_confirm_to_exit">"Çıkışı Doğrula"</string> + <string name="settings_category_comment_title">"Yorum"</string> <string name="settings_show_top_level_comments_first_title">"Önce En İyi Yorumları Göster"</string> <string name="settings_show_comment_divider_title">"Yorum Bölücüsünü Göster"</string> <string name="settings_comment_toolbar_hide_on_click">"Yorum Araç Çubuğunu Göstermek / Gizlemek İçin Tıklayın"</string> @@ -339,7 +339,7 @@ Tekrar denemek için tıklayın."</string> <string name="settings_default_post_layout">"Varsayılan Gönderi Düzeni"</string> <string name="settings_show_divider_in_compact_layout">"Bölücüyü Kompakt Düzende Göster"</string> <string name="settings_show_thumbnail_on_the_left_in_compact_layout">"Kompakt Düzende Soldaki Küçük Resmi Göster"</string> - <string name="settings_swap_tap_and_long_title">"Yorumlarda Dokunmayı ve Uzunca Basmayı Değiştirme"</string> + <string name="settings_swap_tap_and_long_title">"Yorumlarda Dokunmayı ve Uzun Dokunmayı Değiştirme"</string> <string name="settings_swipe_to_go_back_title">"Geri Dönmek İçin Sağa Kaydırın"</string> <string name="settings_swipe_to_go_back_summary">"Tüm Sayfalara Uygulanamaz"</string> <string name="settings_lock_jump_to_next_top_level_comment_button_title">"Bir Sonraki En İyi Yorumlar Düğmesine Geçmeyi Kilitle"</string> @@ -359,17 +359,17 @@ Tekrar denemek için tıklayın."</string> <string name="settings_content_font_size_title">"İçeriğin Yazı Tipi Boyutu"</string> <string name="settings_enable_nsfw_title">"NSFW'yi Etkinleştir"</string> <string name="settings_blur_nsfw_title">"NSFW Görüntülerini Bulanıklaştır"</string> - <string name="settings_blur_spoiler_title">"Spoiler Görüntüleri Bulanıklaştır"</string> + <string name="settings_blur_spoiler_title">"Spoiler Görüntülerini Bulanıklaştır"</string> <string name="settings_about_master_title">"Hakkında"</string> - <string name="settings_acknowledgement_master_title">"Alındı"</string> + <string name="settings_acknowledgement_master_title">"Özel Teşekkürler"</string> <!-- Neyi kastettiğini anlamadığım için böyle bıraktım. --> - <string name="settings_credits_master_title">"Ön Bilgiler"</string> + <string name="settings_credits_master_title">"Alınanlar"</string> <string name="settings_credits_icon_foreground_title">"Ön Plan Simgesi"</string> <string name="settings_credits_icon_foreground_summary">"Freepik tarafından oluşturulan teknoloji vektörü - www.freepik.com"</string> <string name="settings_credits_icon_background_title">"Arka Plan Simgesi"</string> <string name="settings_credits_icon_background_summary">"Freepik tarafından oluşturulan arka plan vektörü - www.freepik.com"</string> - <string name="settings_credits_error_image_title">"Görüntü Hatası"</string> + <string name="settings_credits_error_image_title">"Hata Görüntüsü"</string> <string name="settings_credits_error_image_summary">"Freepik tarafından oluşturulan teknoloji vektörü - www.freepik.com"</string> <string name="settings_credits_gilded_icon_title">"Yaldızlı Simge"</string> <string name="settings_credits_gilded_icon_summary">"Freepik tarafından www.flaticon.com adresinden yapılan simge"</string> @@ -381,7 +381,7 @@ Tekrar denemek için tıklayın."</string> <string name="settings_credits_best_rocket_icon_summary">"Freepik tarafından www.flaticon.com adresinden yapılan simge"</string> <string name="settings_credits_material_icons_title">"Materyal Simgeleri"</string> <string name="settings_open_source_title">"Açık Kaynak"</string> - <string name="settings_open_source_summary">"Bu uygulamayı beğendiyseniz Github'da yıldız ekleyin"</string> + <string name="settings_open_source_summary">"Bu uygulamayı beğendiyseniz Github'da yıldız verin"</string> <string name="settings_rate_title">"Google Play'de Değerlendirin"</string> <string name="settings_rate_summary">"Bize 5 yıldız verirseniz gerçekten mutlu oluruz."</string> <string name="settings_f_droid_title">"F-Droid"</string> @@ -406,7 +406,7 @@ Tekrar denemek için tıklayın."</string> <string name="settings_delete_all_subreddits_data_in_database_title">"Veritabanındaki Tüm Subredditleri Sil"</string> <string name="settings_delete_all_users_data_in_database_title">"Veritabanındaki Tüm Kullanıcıları Sil"</string> <string name="settings_delete_all_sort_type_data_in_database_title">"Veritabanındaki Tüm Sıralama Türlerini Sil"</string> - <string name="settings_delete_all_post_layout_data_in_database_title">"Veritabanındaki Tüm Gönderi Düzenlemelerini Sil"</string> + <string name="settings_delete_all_post_layout_data_in_database_title">"Veritabanındaki Tüm Gönderi Düzenlerini Sil"</string> <string name="settings_delete_all_themes_in_database_title">"Veritabanındaki Tüm Temaları Sil"</string> <string name="settings_delete_front_page_scrolled_positions_in_database_title">"Veritabanındaki Tüm Ön Sayfa Kaydırma Konumlarını Sil"</string> <string name="settings_reset_all_settings_title">"Tüm Ayarları Sıfırla"</string> @@ -425,8 +425,8 @@ Tekrar denemek için tıklayın."</string> <string name="exit_when_submit_post_detail">"Buradan ayrılsanız bile gönderi gönderilecektir."</string> <string name="exit_when_edit_post_detail">"Buradan ayrılsanız bile gönderi gönderilebilir."</string> <string name="exit_when_edit_comment_detail">"Buradan ayrılsanız bile yorum gönderilebilir."</string> - <string name="discard">"Atılsın mı?"</string> - <string name="discard_detail">"Tüm taslak Kaydedilmeyecektir."</string> + <string name="discard">"Kaldırılsın mı?"</string> + <string name="discard_detail">"Taslağın tümü kaydedilmeyecektir."</string> <string name="yes">"Evet"</string> <string name="no">"Hayır"</string> <string name="no_data_received">"Hiç veri alınmadı"</string> @@ -438,12 +438,12 @@ Tekrar denemek için tıklayın."</string> <string name="no_app">"Hiç kullanılabilir uygulama yok"</string> <string name="comment_saved_success">"Yorum kaydedildi"</string> <string name="comment_saved_failed">"Yorum kaydedilemiyor"</string> - <string name="comment_unsaved_success">"Yorum kaydedilemedi"</string> + <string name="comment_unsaved_success">"Yorum kaydedilmedi"</string> <string name="comment_unsaved_failed">"Yorumun kaydı kaldırılamıyor"</string> <string name="favorites">"Favoriler"</string> <string name="all">"Tümü"</string> <string name="post_layout_card">"Kart Düzeni"</string> - <string name="post_layout_compact">"Kompakt Düzen"</string> + <string name="post_layout_compact">"Kompakt Düzeni"</string> <string name="elapsed_time_just_now">"Şimdi"</string> <string name="elapsed_time_a_minute_ago">"1 Dakika"</string> <string name="elapsed_time_minutes_ago">"%1$d Dakika"</string> @@ -584,9 +584,11 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="theme_item_downvoted_color">"Olumsuz Oylananlar Rengi"</string> <string name="theme_item_downvoted_color_detail">"Uygulanan: Oy düğmeleri ve puanları (olumsuz oylananlar)"</string> <string name="theme_item_post_type_background_color">"Gönderi Türü Arka Plan Rengi"</string> - <string name="theme_item_post_type_background_color_detail">"Uygulanan: Gönderi türü arka planı (GÖRÜNTÜ, METİN, VİDEO, GIF, BAĞLANTI)"</string> + <string name="theme_item_post_type_background_color_detail">"Uygulanan: Gönderi türü arka planı +(FOTOĞRAF, METİN, VİDEO, GIF, BAĞLANTI)"</string> <string name="theme_item_post_type_text_color">"Gönderi Türü Metin Rengi"</string> - <string name="theme_item_post_type_text_color_detail">"Uygulanan: Gönderi türü metin rengi (GÖRÜNTÜ, METİN, VİDEO, GIF, BAĞLANTI)"</string> + <string name="theme_item_post_type_text_color_detail">"Uygulanan: Gönderi türü metin rengi +(FOTOĞRAF, METİN, VİDEO, GIF, BAĞLANTI)"</string> <string name="theme_item_spoiler_background_color">"Spoiler Arka Plan Rengi"</string> <string name="theme_item_spoiler_background_color_detail">"Uygulanan: Spoiler etiketinin arka planı"</string> <string name="theme_item_spoiler_text_color">"Spoiler Metin Rengi"</string> @@ -658,15 +660,15 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd <string name="user_themes">"Temalarınız"</string> <string name="no_theme_name">"Bu temanın adı nedir?"</string> <string name="theme_name_hint">"Tema Adı"</string> - <string name="theme_name_indigo">"Çivit Mavisi"</string> - <string name="theme_name_indigo_dark">"Koyu Çivit Mavisi"</string> - <string name="theme_name_indigo_amoled">"Amoled Çivit Mavisi"</string> - <string name="theme_name_white">"Ak"</string> - <string name="theme_name_white_dark">"Koyu Ak"</string> - <string name="theme_name_white_amoled">"Amoled Ak"</string> - <string name="theme_name_red">"Kızıl"</string> - <string name="theme_name_red_dark">"Koyu Kızıl"</string> - <string name="theme_name_red_amoled">"Amoled Kızıl"</string> + <string name="theme_name_indigo">"Açık Mavi"</string> + <string name="theme_name_indigo_dark">"Koyu Mavi"</string> + <string name="theme_name_indigo_amoled">"Amoled Mavi"</string> + <string name="theme_name_white">"Beyaz"</string> + <string name="theme_name_white_dark">"Koyu Beyaz"</string> + <string name="theme_name_white_amoled">"Amoled Beyaz"</string> + <string name="theme_name_red">"Kırmızı"</string> + <string name="theme_name_red_dark">"Koyu Kırmızı"</string> + <string name="theme_name_red_amoled">"Amoled Kırmızı"</string> <string name="theme_name_dracula">"Drakula"</string> <string name="theme_name_calm_pastel">"Pastel Rengi"</string> <string name="create_light_theme">"Çivit Mavisi Renginde @@ -708,7 +710,7 @@ Amoled Tema Tabanı Oluştur"</string> <string name="secondary_text_preview">"İkincil Metin"</string> <string name="post_title_preview">"Bu bir gönderidir"</string> <string name="post_content_preview">"Bu yerçekimi şakası biraz eskimeye başlasada ona her seferinde düşüyorum."</string> - <string name="post_type_preview">"PAYLAŞ"</string> + <string name="post_type_preview">"GÖNDERİ"</string> <string name="flair_preview">"Etiket"</string> <string name="awards_preview">"4 Ödül"</string> <string name="author_flair_preview">"Yazar Etiketi"</string> @@ -783,7 +785,7 @@ Sekmeler, başkalarına geçtikten sonra tüm içeriği kaybedebilir. Bu, sayfay <string name="settings_more_tabs_show_favorite_subscribed_subreddits_title">"Favori Subreddit Aboneliklerini Göster"</string> <string name="settings_more_tabs_show_subscribed_subreddits_title">"Subreddit Aboneliklerini Göster"</string> <string name="settings_download_location_title">"İndirme Konumu"</string> - <string name="settings_image_download_location_title">"Görüntü İndirme Konumu"</string> + <string name="settings_image_download_location_title">"Fotoğraf İndirme Konumu"</string> <string name="settings_gif_download_location_title">"GIF İndirme Konumu"</string> <string name="settings_video_download_location_title">"Video İndirme Konumu"</string> <string name="settings_separate_folder_for_each_subreddit">"Her Subreddit için Ayrı Klasör"</string> @@ -794,7 +796,7 @@ Sekmeler, başkalarına geçtikten sonra tüm içeriği kaybedebilir. Bu, sayfay <string name="settings_pull_to_refresh_title">"Yenilemek İçin Çektir"</string> <string name="settings_security_title">"Güvenlik"</string> <string name="settings_require_authentication_to_go_to_account_section_in_navigation_drawer_title">"Gezinme Çekmecesinde Hesap Bölümüne Gitmek İçin Kimlik Doğrulaması İste"</string> - <string name="settings_long_press_to_hide_toolbar_in_compact_layout_title">"Araç Çubuğunu Kompakt Düzende Gizlemek İçin Uzunca Basın"</string> + <string name="settings_long_press_to_hide_toolbar_in_compact_layout_title">"Araç Çubuğunu Kompakt Düzende Gizlemek İçin Uzun Dokunun"</string> <string name="settings_post_compact_layout_toolbar_hidden_by_default_title">"Varsayılan Gizli Düzende Araç Çubuğu"</string> <string name="settings_customize_bottom_app_bar_title">"Alt Navigasyon Çubuğunu Özelleştir"</string> <string name="settings_main_activity_bottom_app_bar_group_summary">"Ana Sayfa"</string> @@ -809,8 +811,7 @@ Sekmeler, başkalarına geçtikten sonra tüm içeriği kaybedebilir. Bu, sayfay <!-- Fuzzy --> <string name="settings_data_saving_mode_info_summary">"Veri tasarrufu modunda: -Önizleme görüntüleri daha düşük çözünürlükte olur. -Reddit videoları daha düşük çözünürlükte olur."</string> +Önizleme görüntüleri ve Reddit videoları daha düşük çözünürlükte olur."</string> <string name="settings_translation_title">"Çeviri"</string> <string name="settings_translation_summary">"POEditor'da bu uygulamayı çevirin. Tüm katkıda bulunanlara teşekkürler."</string> <string name="settings_credits_national_flags">"Ulusal Bayraklar"</string> @@ -821,7 +822,7 @@ Reddit videoları daha düşük çözünürlükte olur."</string> <string name="downloading_image_or_gif_failed_cannot_get_destination_directory">"İndirme başarısız: hedef dizine erişilemiyor"</string> <string name="downloading_media_failed_cannot_download_media">"İndirme başarısız"</string> <string name="downloading_media_failed_cannot_save_to_destination_directory">"İndirme başarısız: dosya hedef dizine kaydedilemiyor"</string> - <string name="view_full_comment_markdown">"Tam İndirimi Görüntüle"</string> + <string name="view_full_comment_markdown">"Tüm Markdown'u Görüntüle"</string> <string name="select_user_flair_success">"Kullanıcı etiketi seçildi"</string> <string name="select_this_user_flair">"Bu kullanıcı etiketi seçilsin mi?"</string> <string name="select_header_size">"Başlık Boyutunu Seçin"</string> @@ -832,7 +833,7 @@ Reddit videoları daha düşük çözünürlükte olur."</string> <string name="link_hint">"Bağlantı"</string> <string name="unlock_account_section">"Hesap Bölümünün Kilidini Aç"</string> <string name="unlock">"Kilidini Aç"</string> - <string name="submit_post">"Gönderiyi Paylaş"</string> + <string name="submit_post">"Gönderi Paylaş"</string> <string name="refresh">"Yenile"</string> <string name="change_sort_type">"Sıralama Türünü Değiştir"</string> <string name="change_post_layout">"Gönderi Düzenini Değiştir"</string> @@ -859,12 +860,22 @@ Reddit videoları daha düşük çözünürlükte olur."</string> <string name="fetch_random_thing_failed">"Daha sonra tekrar deneyin"</string> <string name="downloading">"İndiriliyor"</string> <string name="subreddit_filter_popular_and_all_activity_label">"r/all ve r/popular"</string> - <string name="settings_miscellaneous_title">"Karışık"</string> + <string name="settings_miscellaneous_title">"Diğerleri"</string> <string name="settings_respect_subreddit_recommended_comment_sort_type_title">"İlgili Subreddit Önerilen Yorum Sıralaması Türü"</string> <string name="settings_respect_subreddit_recommended_comment_sort_type_summary">"Yorum sıralaması türü kaydedilemedi"</string> - <string name="settings_filter_title">"Filtrele"</string> + <string name="settings_post_filter_title">"Filtrele"</string> <string name="settings_subreddit_filter_category">"Subredditleri Gizle"</string> <string name="settings_subreddit_filter_popular_and_all">"r/popular ve r/all"</string> <string name="settings_credits_ufo_capturing_animation_title">"UFO Yakalama Animasyonu"</string> <string name="select_video_quality">"Video Kalitesini Seçin"</string> + <string name="settings_swipe_action_haptic_feedback_title">"Dokunsal Geribildirim"</string> + <string name="settings_hide_subreddit_description_title">"Subreddit Açıklamasını Gizle"</string> + <string name="settings_disable_image_preview_title">"Veri Tasarrufu Modunda Görüntüleri Önizlemeyi Devre Dışı Bırak"</string> + <string name="settings_swipe_action_swipe_left_title">"Sola Kaydır"</string> + <string name="settings_swipe_action_swipe_right_title">"Sağa Kaydır"</string> + <string name="settings_swipe_action_info_summary">"1'den fazla sütun veya gönderi ayrıntısı içeren yayın feed'i için geçerli değildir."</string> + <string name="theme_item_no_preview_post_type_icon_tint">"Önizlemesiz Gönderi Türü Simge Rengi"</string> + <string name="theme_item_no_preview_post_type_icon_tint_detail">"Uygulanan: Önizleme olmadığında gönderinin türünü belirten simge"</string> + <string name="theme_item_no_preview_post_type_background_color">"Önizlemesiz Gönderi Türü Arka Plan Rengi"</string> + <string name="theme_item_no_preview_post_type_background_color_detail">"Uygulanan: Önizleme olmadığında gönderinin türünü belirten yer tutucu"</string> </resources>
\ No newline at end of file diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml new file mode 100644 index 00000000..1b2cedd4 --- /dev/null +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -0,0 +1,933 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <string name="login_activity_label">"登录"</string> + <string name="search_activity_label">"搜索"</string> + <string name="comment_activity_label">"发送评论"</string> + <string name="comment_activity_label_is_replying">"回复"</string> + <string name="post_text_activity_label">"文字"</string> + <string name="subreddit_selection_activity_label">"选择"</string> + <string name="post_link_activity_label">"链接"</string> + <string name="post_image_activity_label">"图片"</string> + <string name="post_video_activity_label">"视频"</string> + <string name="rules_activity_label">"规则"</string> + <string name="search_subreddits_activity_label">"版块"</string> + <string name="edit_post_activity_label">"编辑"</string> + <string name="edit_comment_activity_label">"编辑评论"</string> + <string name="view_message_activity_label">"收件箱"</string> + <string name="settings_activity_label">"设置"</string> + <string name="account_saved_thing_activity_label">"保存"</string> + <string name="create_multi_reddit_activity_label">"创建版块聚合"</string> + <string name="subreddit_multiselection_activity_label">"选择多个版块"</string> + <string name="custom_theme_listing_activity_label">"自定义主题"</string> + <string name="customize_theme_activity_label">"自定义主题"</string> + <string name="customize_theme_activity_create_theme_label">"创建主题"</string> + <string name="theme_preview_activity_label">"主题预览"</string> + <string name="edit_multi_reddit_activity_label">"编辑版块聚合"</string> + <string name="selected_subeddits_activity_label">"被选中的版块"</string> + <string name="report_activity_label">"报告"</string> + <string name="view_imgur_media_activity_image_label">"图片"</string> + <string name="view_imgur_media_activity_video_label">"视频"</string> + <string name="send_private_message_activity_label">"私信"</string> + <string name="view_reddit_gallery_activity_image_label">"图片 %1$d/%2$d +"</string> + <string name="view_reddit_gallery_activity_gif_label">"动图 %1$d/%2$d +"</string> + <string name="view_reddit_gallery_activity_video_label">"视频 %1$d/%2$d +"</string> + <string name="navigation_drawer_open">"打开导航栏"</string> + <string name="navigation_drawer_close">"关闭导航栏"</string> + <string name="action_download">"下载"</string> + <string name="action_refresh">"刷新"</string> + <string name="action_add_comment">"添加评论"</string> + <string name="action_save_post">"保存"</string> + <string name="action_view_crosspost_parent">"查看跨贴回复的主贴"</string> + <string name="action_search">"搜索"</string> + <string name="action_start_lazy_mode">"开始懒人模式"</string> + <string name="action_stop_lazy_mode">"停止懒人模式"</string> + <string name="action_send">"发送"</string> + <string name="action_sort">"筛选"</string> + <string name="action_hide_post">"隐藏帖子"</string> + <string name="action_unhide_post">"重现帖子"</string> + <string name="action_edit_post">"编辑帖子"</string> + <string name="action_delete_post">"删除帖子"</string> + <string name="action_mark_nsfw">"标记NSFW"</string> + <string name="action_unmark_nsfw">"取消标记NSFW"</string> + <string name="action_mark_spoiler">"标记剧透"</string> + <string name="action_unmark_spoiler">"取消标记剧透"</string> + <string name="action_edit_flair">"编辑个人标签"</string> + <string name="action_change_post_layout">"改变帖子布局"</string> + <string name="action_save">"保存"</string> + <string name="action_edit_multi_reddit">"编辑版块聚合"</string> + <string name="action_delete_multi_reddit">"删除版块聚合"</string> + <string name="action_share">"分享"</string> + <string name="action_preview">"预览"</string> + <string name="action_report">"报告"</string> + <string name="action_see_removed">"查看已删除的回复"</string> + <string name="action_set_wallpaper">"设为壁纸"</string> + <string name="action_send_private_message">"发送私信"</string> + <string name="action_block_user">"拉黑"</string> + <string name="parse_json_response_error">"解析JSON出错"</string> + <string name="retrieve_token_error">"无法获取Token"</string> + <string name="something_went_wrong">"出错了,请重试"</string> + <string name="access_denied">"拒绝访问"</string> + <string name="parse_user_info_error">"加载用户信息错误"</string> + <string name="no_system_webview_error">"WebView错误"</string> + <string name="error_loading_image_tap_to_retry">"图片加载错误,请点击重试"</string> + <string name="load_posts_error">"帖子加载错误,请点击重试"</string> + <string name="load_more_posts_error">"加载错误"</string> + <string name="load_post_error">"加载错误,点击重试"</string> + <string name="search_subreddits_error">"找不到版块,请点击重试"</string> + <string name="search_users_error">"找不到用户"</string> + <string name="no_posts">"找不到帖子"</string> + <string name="no_comments">"未找到评论"</string> + <string name="no_subreddits">"未找到版块"</string> + <string name="no_users">"未找到用户"</string> + <string name="no_multi_reddits">"未找到版块聚合"</string> + <string name="no_storage_permission">"需要存储权限保存文件"</string> + <string name="load_comments_failed">"加载评论出现错误,点击重试"</string> + <string name="retry">"重试"</string> + <string name="comments">"评论"</string> + <string name="no_comments_yet">"现在还没有评论,写一条?"</string> + <string name="vote_failed">"投票失败"</string> + <string name="refresh_post_failed">"刷新失败"</string> + <string name="load_messages_failed">"载入信息失败,点击重试"</string> + <string name="no_messages">"空"</string> + <string name="nsfw">"工作时不宜"</string> + <string name="karma_info">"声望:%1$d"</string> + <string name="karma_info_user_detail">"声望: +%1$d (%2$d + %3$d)"</string> + <string name="cakeday_info">"注册日:%1$s +"</string> + <string name="since">"从"</string> + <string name="profile">"档案"</string> + <string name="subscriptions">"订阅"</string> + <string name="multi_reddit">"版块聚合"</string> + <string name="inbox">"收件箱"</string> + <string name="upvoted">"顶"</string> + <string name="downvoted">"踩"</string> + <string name="hidden">"隐藏"</string> + <string name="saved">"保存"</string> + <string name="gilded">"镀金的帖子"</string> + <string name="settings">"设置"</string> + <string name="subscribers_number_detail">"关注者: %1$d +"</string> + <string name="online_subscribers_number_detail">"在线: %1$d +"</string> + <string name="cannot_fetch_subreddit_info">"无法获取版块信息"</string> + <string name="cannot_fetch_user_info">"无法获取用户信息"</string> + <string name="cannot_fetch_sidebar">"无法加载侧边栏"</string> + <string name="cannot_fetch_multireddit">"无法获取版块聚合信息"</string> + <string name="subscribe">"订阅"</string> + <string name="unsubscribe">"取消订阅"</string> + <string name="subscribed">"已订阅"</string> + <string name="subscribe_failed">"订阅失败"</string> + <string name="unsubscribed">"已取消订阅"</string> + <string name="unsubscribe_failed">"取消订阅失败"</string> + <string name="follow">"关注"</string> + <string name="unfollow">"取消关注"</string> + <string name="followed">"已关注"</string> + <string name="follow_failed">"关注失败"</string> + <string name="unfollowed">"已取消关注"</string> + <string name="unfollow_failed">"取消关注失败"</string> + + <!-- 参考国内一些评论,将“Subreddit”翻译为“社区” --> + <string name="content_description_banner_imageview">"板块横幅图片"</string> + + <!-- 这个感觉不必翻译 --> + <string name="app_label">"Infinity"</string> + <string name="search_hint">"搜索"</string> + <string name="no_posts_no_lazy_mode">"没有发现帖子"</string> + <string name="lazy_mode_start">"懒人模式启动,滑动时间间隔%1$.1f秒"</string> + <string name="lazy_mode_stop">"懒人模式已关闭"</string> + <string name="write_comment_hint">"在此写下你的想法"</string> + <string name="comment_content_required">"在想些什么?"</string> + <string name="sending_comment">"发送中"</string> + <string name="send_comment_success">"评论已发送"</string> + <string name="send_comment_failed">"发送评论失败"</string> + <string name="send_message_username_hint">"用户"</string> + <string name="send_message_subject_hint">"正文"</string> + <string name="send_message_content_hint">"私信"</string> + <string name="reply_message_failed">"无法回复该私信"</string> + <string name="error_getting_message">"获取私信错误"</string> + <string name="message_username_required">"你想发私信给谁?"</string> + <string name="message_subject_required">"你的私信没有正文"</string> + <string name="message_content_required">"正文没有内容"</string> + <string name="sending_message">"发送中"</string> + <string name="send_message_success">"已发送"</string> + <string name="send_message_failed">"发送失败"</string> + <string name="select_a_subreddit">"请先选择一个版块"</string> + <string name="title_required">"帖子需要标题"</string> + <string name="link_required">"嘿!链接呢?"</string> + <string name="select_an_image">"请选择一张图片"</string> + <string name="posting">"发送中"</string> + <string name="post_failed">"无法发帖"</string> + <string name="error_processing_image">"处理图片错误"</string> + <string name="error_processing_video">"处理视频错误"</string> + <string name="download_started">"下载开始,在通知栏查看进度"</string> + <string name="comment_load_more_comments">"加载更多评论"</string> + <string name="comment_load_more_comments_failed">"加载失败,点击重试"</string> + <string name="loading">"加载中"</string> + <string name="post_title_hint">"标题"</string> + <string name="post_text_content_hint">"内容"</string> + <string name="choose_a_subreddit">"选择一个版块"</string> + <string name="rules">"规则"</string> + <string name="post_link_hint">"链接地址"</string> + + <!-- reddit的“板块”和“子板块”是怎么翻译的,我分辨不了,reddit有“子板块”的概念吗?我全都翻译为“板块”了。 --> + <string name="subreddits">"版块"</string> + <string name="users">"用户"</string> + <string name="multi_reddits">"版块聚合"</string> + <string name="bottom_sheet_post_text">"文字"</string> + <string name="bottom_sheet_post_link">"链接"</string> + <string name="bottom_sheet_post_image">"图片"</string> + <string name="bottom_sheet_post_video">"视频"</string> + <string name="select_from_gallery">"选择图片"</string> + <string name="select_again">"再次选择"</string> + <string name="error_getting_image">"无法获取图片"</string> + <string name="error_getting_video">"无法获取视频"</string> + <string name="no_camera_available">"无法获取摄像头权限"</string> + <string name="error_creating_temp_file">"创建临时文件失败"</string> + <string name="video_is_processing">"视频加载中,请稍候"</string> + <string name="image_is_processing">"图片加载中,请稍后"</string> + <string name="gif_is_processing">"动图加载中,请稍后"</string> + <string name="flair">"个人标签"</string> + <string name="spoiler">"剧透"</string> + <string name="no_flair">"无个人标签"</string> + <string name="error_loading_flairs">"加载个人标签失败,请重试"</string> + <string name="no_rule">"无规则"</string> + <string name="error_loading_rules">"加载规则失败,请重试"</string> + <string name="error_loading_rules_without_retry">"加载规则失败"</string> + <string name="search_in">"搜索"</string> + <string name="all_subreddits">"所有版块"</string> + <string name="sort_best">"精选"</string> + <string name="sort_hot">"热门"</string> + <string name="sort_new">"最新"</string> + <string name="sort_random">"随机"</string> + <string name="sort_rising">"趋势"</string> + <string name="sort_top">"最高人气"</string> + <string name="sort_controversial">"正在热议"</string> + <string name="sort_relevance">"相关"</string> + <string name="sort_comments">"评论"</string> + <string name="sort_activity">"活动"</string> + <string name="sort_confidence">"信心"</string> + <string name="sort_old">"旧帖"</string> + <string name="sort_qa">"问与答"</string> + <string name="sort_live">"直播"</string> + <string name="sort_time_hour">"时"</string> + <string name="sort_time_day">"日"</string> + <string name="sort_time_week">"周"</string> + <string name="sort_time_month">"月"</string> + <string name="sort_time_year">"年"</string> + <string name="sort_time_all_time">"所有时间"</string> + <string name="no_browser_found">"未找到浏览器"</string> + <string name="no_activity_found_for_share">"找不到共享的app"</string> + <string name="archived_post_vote_unavailable">"帖子已存档,无法投票"</string> + <string name="archived_post_comment_unavailable">"帖子已存档,无法评论"</string> + <string name="archived_post_reply_unavailable">"帖子已存档,无法回复"</string> + <string name="locked_post_comment_unavailable">"帖子已锁定,无法评论"</string> + <string name="locked_post_reply_unavailable">"帖子已锁定,无法回复"</string> + <string name="text">"文字"</string> + <string name="link">"链接"</string> + <string name="image">"图片"</string> + <string name="video">"视频"</string> + <string name="gif">"动图"</string> + <string name="gallery">"相册"</string> + <string name="best">"精选"</string> + <string name="search">"搜索"</string> + <string name="posting_video">"视频发送中"</string> + <string name="posting_image">"图片发送中"</string> + <string name="please_wait">"请稍后"</string> + <string name="add_account">"添加账户"</string> + <string name="anonymous_account">"匿名"</string> + <string name="log_out">"注销"</string> + <string name="press_here_to_login">"点此登录"</string> + <string name="login_first">"请先登录"</string> + <string name="post_saved_success">"帖子已保存"</string> + <string name="post_saved_failed">"无法保存帖子"</string> + <string name="post_unsaved_success">"帖子未保存"</string> + <string name="post_unsaved_failed">"无法撤销保存帖子"</string> + <string name="post_hide_success">"帖子已隐藏"</string> + <string name="post_hide_failed">"无法隐藏帖子"</string> + <string name="post_unhide_success">"帖子已取消隐藏"</string> + <string name="thing_favorite_failed">"无法收藏帖子"</string> + <string name="thing_unfavorite_failed">"取消收藏帖子失败"</string> + <string name="post_unhide_failed">"无法取消隐藏帖子"</string> + <string name="delete_this_post">"删除这篇帖子"</string> + <string name="delete_this_comment">"删除这条评论"</string> + <string name="are_you_sure">"确定吗?"</string> + <string name="edit">"编辑"</string> + <string name="delete">"删除"</string> + <string name="see_removed_comment">"查看被删除的评论"</string> + <string name="fetching_removed_comment">"获取被删除的评论"</string> + <string name="show_removed_comment_failed">"无法找到被删除的评论"</string> + <string name="fetching_removed_post">"正在获取删除的帖子"</string> + <string name="show_removed_post_failed">"找不到被删除的帖子"</string> + <string name="cancel">"取消"</string> + <string name="ok">"OK"</string> + <string name="edit_success">"编辑成功"</string> + <string name="delete_post_success">"删除成功"</string> + <string name="delete_post_failed">"删除失败"</string> + <string name="mark_nsfw_success">"已标记为NSFW"</string> + <string name="mark_nsfw_failed">"标记为NSFW失败"</string> + <string name="unmark_nsfw_success">"已取消标记为NSFW"</string> + <string name="unmark_nsfw_failed">"取消标记为NSFW失败"</string> + <string name="mark_spoiler_success">"标记剧透成功"</string> + <string name="mark_spoiler_failed">"标记剧透失败"</string> + <string name="unmark_spoiler_success">"取消标记剧透成功"</string> + <string name="unmark_spoiler_failed">"标记剧透失败"</string> + <string name="update_flair_success">"更新个人标签成功"</string> + <string name="update_flair_failed">"更新个人标签失败"</string> + <string name="edit_flair">"编辑个人标签"</string> + <string name="only_allow_64_chars">"只允许少于64个字符长度"</string> + <string name="view_all_comments">"查看所有评论"</string> + <string name="notification_summary_account">"账户"</string> + <string name="notification_summary_message">"新信息"</string> + <string name="notification_summary_subreddit">"版块"</string> + <string name="notification_summary_award">"奖励"</string> + <string name="notification_new_messages">"%1$d 新私信"</string> + <string name="label_account">"账户"</string> + <string name="label_post">"帖子"</string> + <string name="label_preferences">"偏好设置"</string> + <string name="account_switched">"账户已切换,其他页面已重置"</string> + <string name="settings_notification_master_title">"通知"</string> + <string name="settings_notification_enable_notification_title">"开启通知"</string> + <string name="settings_notification_interval_title">"检查通知的时间间隔"</string> + <string name="settings_theme_title">"主题"</string> + <string name="settings_amoled_dark_title">"AMOLED黑"</string> + <string name="settings_interface_title">"界面"</string> + <string name="settings_gestures_and_buttons_title">"手势和按钮"</string> + <string name="settings_save_front_page_scrolled_position_title">"记住上次浏览的位置"</string> + <string name="settings_save_front_page_scrolled_position_summary">"刷新首页浏览新帖"</string> + <string name="settings_open_link_in_app_title">"App内打开网页"</string> + <string name="settigns_video_title">"视频"</string> + <string name="settings_video_autoplay_title">"自动播放视频"</string> + <string name="settings_mute_autoplaying_videos_title">"静音自动播放的视频"</string> + <string name="settings_autoplay_nsfw_videos_title">"自动播放NSFW视频"</string> + <string name="settings_start_autoplay_visible_area_offset_portrait_title">"竖屏自动播放视频"</string> + <string name="settings_start_autoplay_visible_area_offset_portrait_summary">"当 %1$d%% 个视频可见时,开启自动播放"</string> + <string name="settings_start_autoplay_visible_area_offset_landscape_title">"横屏自动播放视频"</string> + <string name="settings_start_autoplay_visible_area_offset_landscape_summary">"当 %1$d%% 个视频可见时,开启自动播放"</string> + <string name="settings_immersive_interface_title">"沉浸式界面"</string> + <string name="settings_immersive_interface_summary">"不全局适用"</string> + <string name="settings_immersive_interface_ignore_nav_bar_title">"沉浸式界面忽略导航栏"</string> + + <!-- 请问这个是怎么回事?“Padding”没有翻译,是有特殊的用词吗? --> + <string name="settings_immersive_interface_ignore_nav_bar_summary">"防止底部导航栏有多余的内边距"</string> + <string name="settings_customize_tabs_in_main_page_title">"自定义主页标签"</string> + <string name="settings_enable_bottom_app_bar_title">"开启底部导航栏"</string> + <string name="settings_enable_bottom_app_bar_summary">"在匿名模式下无效"</string> + <string name="settings_category_post_and_comment_title">"帖子和评论"</string> + <string name="settings_vote_buttons_on_the_right_title">"顶/踩 按钮放置在右侧"</string> + <string name="settings_volume_keys_navigate_comments_title">"在帖子内使用音量键浏览评论"</string> + <string name="settings_volume_keys_navigate_posts_title">"使用音量键浏览帖子"</string> + <string name="settings_mute_video_title">"视频静音"</string> + <string name="settings_mute_nsfw_video_title">"静音NSFW视频"</string> + <string name="settings_automatically_try_redgifs_title">"如果Gfycat上的视频被删除了,则自动尝试访问Redgifs"</string> + <string name="settings_video_player_ignore_nav_bar_title">"视频播放器中忽略导航栏"</string> + + <!-- Fuzzy --> + <string name="settings_video_player_ignore_nav_bar_summary">"防止视频控制器有多余的余量"</string> + <string name="settings_confirm_to_exit">"确认退出"</string> + <string name="settings_category_comment_title">"评论"</string> + + <!-- Fuzzy --> + <string name="settings_show_top_level_comments_first_title">"首先显示顶级评论"</string> + <string name="settings_show_comment_divider_title">"显示评论分隔线"</string> + <string name="settings_comment_toolbar_hide_on_click">"单击以显示/隐藏评论工具栏"</string> + <string name="settings_fully_collapse_comment_title">"完全折叠评论"</string> + <string name="settings_comment_toolbar_hidden">"默认隐藏评论工具栏"</string> + <string name="settings_show_absolute_number_of_votes_title">"显示绝对投票数"</string> + <string name="settings_show_elapsed_time">"在帖子和评论中显示发帖已过的时间"</string> + <string name="settings_time_format_title">"时间格式"</string> + <string name="settings_category_post_title">"帖子"</string> + <string name="settings_default_post_layout">"默认帖子布局"</string> + <string name="settings_show_divider_in_compact_layout">"在紧凑布局中显示分隔线"</string> + <string name="settings_show_thumbnail_on_the_left_in_compact_layout">"紧凑布局中在左侧显示缩略图"</string> + <string name="settings_swap_tap_and_long_title">"在评论中交换点击和长按功能"</string> + <string name="settings_swipe_to_go_back_title">"右划返回"</string> + <string name="settings_swipe_to_go_back_summary">"不全局适用"</string> + <string name="settings_lock_jump_to_next_top_level_comment_button_title">"锁定跳转到下一个顶级评论按钮"</string> + <string name="settings_lock_bottom_app_bar_title">"锁定底部导航栏"</string> + <string name="settings_swipe_up_to_hide_jump_to_next_top_level_comment_button_title">"向上滑动以隐藏跳转到下一个顶级评论按钮"</string> + <string name="settings_lazy_mode_interval_title">"懒人模式间隔时间"</string> + <string name="settings_font_title">"字体"</string> + <string name="settings_preview_font_title">"字体预览"</string> + <string name="settings_font_summary">"字体"</string> + <string name="settings_title_font_summary">"帖子标题"</string> + <string name="settings_content_font_summary">"帖子内容"</string> + <string name="settings_font_family_title">"字体系列"</string> + <string name="settings_title_font_family_title">"帖子标题字体系列"</string> + <string name="settings_content_font_family_title">"帖子内容字体系列"</string> + <string name="settings_font_size_title">"字体大小"</string> + <string name="settings_title_font_size_title">"帖子标题字体大小"</string> + <string name="settings_content_font_size_title">"帖子内容字体大小"</string> + <string name="settings_enable_nsfw_title">"开 冲"</string> + <string name="settings_blur_nsfw_title">"模糊NSFW图像"</string> + <string name="settings_blur_spoiler_title">"模糊剧透图像"</string> + <string name="settings_about_master_title">"关于本应用"</string> + <string name="settings_acknowledgement_master_title">"致谢"</string> + <string name="settings_credits_master_title">"图标来源"</string> + <string name="settings_credits_icon_foreground_title">"图标前景"</string> + <string name="settings_credits_icon_foreground_summary">"矢量图由来自www.freepik.com的freepik绘制"</string> + <string name="settings_credits_icon_background_title">"图标背景"</string> + <string name="settings_credits_icon_background_summary">"背景矢量图来自于freepik - www.freepik.com"</string> + <string name="settings_credits_error_image_title">"错误图片"</string> + <string name="settings_credits_error_image_summary">"矢量图由来自www.freepik.com的freepik绘制"</string> + <string name="settings_credits_gilded_icon_title">"镀金图标"</string> + <string name="settings_credits_gilded_icon_summary">"图标由来自www.flaticon.com的Freepik制作"</string> + <string name="settings_credits_crosspost_icon_title">"转帖图标"</string> + <string name="settings_credits_crosspost_icon_summary">"图标由来自www.flaticon.com的Freepik制作"</string> + <string name="settings_credits_thumbtack_icon_title">"图钉图标"</string> + <string name="settings_credits_thumbtack_icon_summary">"图标由来自www.flaticon.com的Freepik制作"</string> + <string name="settings_credits_best_rocket_icon_title">"火箭图标"</string> + <string name="settings_credits_best_rocket_icon_summary">"图标由来自www.flaticon.com的Freepik制作"</string> + + <!-- Fuzzy --> + <string name="settings_credits_material_icons_title">"材质图标"</string> + <string name="settings_open_source_title">"开源"</string> + <string name="settings_open_source_summary">"如果您喜欢此应用,请在Github上给个star"</string> + <string name="settings_rate_title">"在Google Play上评分"</string> + <string name="settings_rate_summary">"如果给我一个五星好评,我会非常高兴的"</string> + <string name="settings_f_droid_title">"F-Droid应用市场"</string> + <string name="settings_f_droid_summary">"现在已经在F-Droid存储库IzzyOnDroid上架"</string> + <string name="settings_email_title">"作者邮箱"</string> + <string name="settings_email_summary">"docilealligator.app@gmail.com"</string> + <string name="settings_reddit_account_title">"作者Reddit帐户"</string> + <string name="settings_reddit_account_summary">"u/Hostilenemy"</string> + <string name="settings_subreddit_title">"板块"</string> + + <!-- 这个应该不做翻译为好,它是指示infinity社区位置的。在关于界面 --> + <string name="settings_subreddit_summary">"r/Infinity_For_Reddit"</string> + <string name="settings_share_title">"分享这个应用"</string> + <string name="settings_share_summary">"如果你喜欢这个应用,可以与其他人分享"</string> + <string name="settings_version_title">"Infinity For Reddit版本"</string> + <string name="settings_version_summary">"版本号 %s"</string> + <string name="settings_category_customization_title">"定制化"</string> + <string name="settings_customize_light_theme_title">"日间主题"</string> + <string name="settings_customize_dark_theme_title">"夜间主题"</string> + <string name="settings_customize_amoled_theme_title">"A屏主题"</string> + <string name="settings_manage_themes_title">"自定义主题"</string> + <string name="settings_custom_theme_cannot_apply_to_settings_page_summary">"自定义主题无法应用于设置页面(工具栏,状态栏和导航栏除外)"</string> + <string name="settings_advanced_master_title">"高级设置"</string> + <string name="settings_delete_all_subreddits_data_in_database_title">"删除数据库中的所有板块订阅"</string> + <string name="settings_delete_all_users_data_in_database_title">"删除数据库中的所有用户"</string> + <string name="settings_delete_all_sort_type_data_in_database_title">"删除数据库中的所有排序类型"</string> + <string name="settings_delete_all_post_layout_data_in_database_title">"删除数据库中的所有帖子布局"</string> + <string name="settings_delete_all_themes_in_database_title">"删除数据库中的所有主题"</string> + <string name="settings_delete_front_page_scrolled_positions_in_database_title">"删除数据库中所有首页滚动位置"</string> + <string name="settings_reset_all_settings_title">"重置所有设置"</string> + <string name="settings_advanced_settings_summary">"清理数据库和共享首选项"</string> + <string name="settings_tab_1_summary">"标签1"</string> + <string name="settings_tab_2_summary">"标签2"</string> + <string name="settings_tab_3_summary">"标签3"</string> + <string name="settings_tab_title">"标题"</string> + <string name="settings_tab_post_type">"类型"</string> + <string name="settings_tab_subreddit_name">"板块名称(不带“r/”前缀)"</string> + <string name="settings_tab_multi_reddit_name">"复合Reddit名称(/用户/你的用户名/m/你的复合reddit名称)"</string> + <string name="settings_tab_username">"用户名(不带“u/”前缀)"</string> + <string name="no_developer_easter_egg">"这里没有开发者选项"</string> + <string name="no_link_available">"无法获取链接"</string> + <string name="exit_when_submit">"要离开吗?"</string> + <string name="exit_when_submit_post_detail">"即使您取消,该帖子仍将提交"</string> + <string name="exit_when_edit_post_detail">"如果您现在取消,该帖子或许还会提交"</string> + <string name="exit_when_edit_comment_detail">"即使您取消,评论仍可能会提交"</string> + <string name="discard">"放弃编辑吗?"</string> + <string name="discard_detail">"所有草稿将不会保存"</string> + <string name="yes">"是"</string> + <string name="no">"否"</string> + <string name="no_data_received">"未收到数据"</string> + <string name="no_image_path_received">"没有找到图像路径"</string> + <string name="no_video_path_received">"没有找到视频路径"</string> + <string name="cannot_handle_intent">"无法处理分享请求"</string> + <string name="share">"分享"</string> + <string name="no_email_client">"找不到电子邮件客户端"</string> + <string name="no_app">"没有可用的应用"</string> + <string name="comment_saved_success">"评论已保存"</string> + <string name="comment_saved_failed">"评论保存失败"</string> + <string name="comment_unsaved_success">"评论未保存"</string> + <string name="comment_unsaved_failed">"评论保存取消失败"</string> + <string name="favorites">"最爱"</string> + <string name="all">"全站"</string> + <string name="post_layout_card">"卡片布局"</string> + <string name="post_layout_compact">"紧凑布局"</string> + <string name="elapsed_time_just_now">"现在"</string> + <string name="elapsed_time_a_minute_ago">"1分钟前"</string> + <string name="elapsed_time_minutes_ago">"%1$d分钟"</string> + <string name="elapsed_time_an_hour_ago">"1小时前"</string> + <string name="elapsed_time_hours_ago">"%1$d小时"</string> + <string name="elapsed_time_yesterday">"昨天"</string> + <string name="elapsed_time_days_ago">"%1$d天前"</string> + <string name="elapsed_time_a_month_ago">"1个月前"</string> + <string name="elapsed_time_months_ago">"%1$d个月前"</string> + <string name="elapsed_time_a_year_ago">"1年前"</string> + <string name="elapsed_time_years_ago">"%1$d年前"</string> + <string name="error_getting_multi_reddit_data">"获取复合reddit数据时出错"</string> + <string name="error_loading_multi_reddit_list">"无法同步复合reddits"</string> + <string name="error_loading_subscriptions">"无法同步订阅"</string> + <string name="share_this_app">"快来适用Infinity for Reddit,一个很棒的Reddit客户端! +https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforreddit"</string> + <string name="error_getting_subreddit_name">"获取板块名称时出错"</string> + <string name="share_post_link">"分享帖子链接"</string> + <string name="share_image_link">"分享图片链接"</string> + <string name="share_gif_link">"分享动图链接"</string> + <string name="share_video_link">"分享视频链接"</string> + <string name="share_link">"分享链接"</string> + <string name="copy_post_link">"复制帖子链接"</string> + <string name="copy_image_link">"复制图片链接"</string> + <string name="copy_gif_link">"复制动图链接"</string> + <string name="copy_video_link">"复制视频链接"</string> + <string name="copy_link">"复制链接"</string> + <string name="copy_success">"已复制"</string> + <string name="copy_link_failed">"无法复制链接"</string> + <string name="copy_text">"复制"</string> + <string name="copy_all">"全部复制"</string> + <string name="copy_markdown">"复制Markdown"</string> + <string name="copy_raw_text">"复制无格式文字"</string> + <string name="copy_all_markdown">"复制全部Markdown"</string> + <string name="copy_all_raw_text">"复制全部无格式文字"</string> + <string name="exit_app">"要退出吗?"</string> + <string name="light_theme">"日间主题"</string> + <string name="dark_theme">"夜间主题"</string> + <string name="multi_reddit_name_hint">"名称(最多50个字符)"</string> + <string name="multi_reddit_description_hint">"描述"</string> + <string name="private_multi_reddit">"私人的"</string> + <string name="select_subreddits">"选择板块"</string> + <string name="no_multi_reddit_name">"名字在哪里?"</string> + <string name="create_multi_reddit_failed">"不能创建这个复合reddit"</string> + <string name="duplicate_multi_reddit">"这个复合reddit已经存在"</string> + <string name="edit_multi_reddit_failed">"无法编辑此复合reddit"</string> + <string name="logged_out">"您已退出"</string> + <string name="delete_multi_reddit_success">"成功删除"</string> + <string name="delete_multi_reddit_failed">"删除失败"</string> + <string name="delete_multi_reddit_dialog_message">"确定吗?"</string> + <string name="enable_nsfw">"开 冲"</string> + <string name="disable_nsfw">"不 冲 了"</string> + <string name="cannot_save_image">"无法保存图像"</string> + <string name="cannot_save_gif">"无法保存此动图"</string> + <string name="cannot_get_storage">"无法访问应用存储"</string> + <string name="save_image_first">"正在保存图像。请耐心等待"</string> + <string name="save_gif_first">"正在保存动图。请耐心等待"</string> + <string name="theme_name_description">"点击修改改该主题的名称"</string> + <string name="theme_item_is_light_theme">"设置为日间主题"</string> + <string name="theme_item_is_dark_theme">"设置为夜间主题"</string> + <string name="theme_item_is_amoled_theme">"设置为A屏主题"</string> + <string name="theme_item_color_primary">"主色调"</string> + <string name="theme_item_color_primary_detail">"应用于:工具栏"</string> + <string name="theme_item_color_primary_dark">"深主色调"</string> + <string name="theme_item_color_primary_dark_detail">"应用于:状态栏"</string> + <string name="theme_item_color_accent">"强调色"</string> + <string name="theme_item_color_accent_detail">"应用于:进度栏等"</string> + <string name="theme_item_color_primary_light_theme">"日间主题主要颜色"</string> + <string name="theme_item_color_primary_light_theme_detail">"适用于:浮动动作按钮和按钮的背景"</string> + + <!-- Fuzzy --> + <string name="theme_item_primary_text_color">"主要文字颜色"</string> + + <!-- Fuzzy --> + <string name="theme_item_primary_text_color_detail">"应用于:主要文字"</string> + + <!-- Fuzzy --> + <string name="theme_item_secondary_text_color">"辅助文字颜色"</string> + + <!-- Fuzzy --> + <string name="theme_item_secondary_text_color_detail">"应用于:辅助文字"</string> + <string name="theme_item_post_title_color">"帖子标题颜色"</string> + <string name="theme_item_post_title_color_detail">"应用于:帖子标题"</string> + <string name="theme_item_post_content_color">"帖子内容颜色"</string> + <string name="theme_item_post_content_color_detail">"应用于:帖子内容"</string> + <string name="theme_item_comment_color">"评论颜色"</string> + <string name="theme_item_comment_color_detail">"应用于:评论"</string> + <string name="theme_item_button_text_color">"按钮文字颜色"</string> + <string name="theme_item_button_text_color_detail">"应用于:按钮上的文字"</string> + <string name="theme_item_chip_text_color">"订阅按钮文字颜色"</string> + <string name="theme_item_chip_text_color_detail">"应用于:订阅按钮"</string> + <string name="theme_item_link_color">"链接颜色"</string> + <string name="theme_item_link_color_detail">"应用于:链接"</string> + + <!-- 是不是翻译为“已读消息文字颜色”更好一点? --> + <!-- Fuzzy --> + <string name="theme_item_received_message_text_color">"已收消息文字颜色"</string> + + <!-- Fuzzy --> + <string name="theme_item_received_message_text_color_detail">"应用于:已收收私人消息"</string> + <string name="theme_item_sent_message_text_color">"发送的消息文字颜色"</string> + <string name="theme_item_sent_message_text_color_detail">"应用于:已发送私人消息"</string> + <string name="theme_item_background_color">"背景颜色"</string> + + <!-- Fuzzy --> + <string name="theme_item_background_color_detail">"应用于:每页背景和导航抽屉"</string> + <string name="theme_item_card_view_background_color">"卡片视图背景颜色"</string> + <string name="theme_item_card_view_background_color_detail">"应用于:帖子背景和消息背景"</string> + <string name="theme_item_comment_background_color">"评论背景颜色"</string> + <string name="theme_item_comment_background_color_detail">"应用于:评论背景"</string> + + <!-- Fuzzy --> + <string name="theme_item_fully_collapsed_comment_background_color">"完全折叠的评论的背景颜色"</string> + <string name="theme_item_fully_collapsed_comment_background_color_detail">"应用于:完全折叠的评论的背景"</string> + + <!-- “Awarded”暂时翻译为“被赞赏的” --> + <!-- Fuzzy --> + <string name="theme_item_awarded_comment_background_color">"被赞赏评论的背景颜色"</string> + <string name="theme_item_awarded_comment_background_color_detail">"应用于:被赞赏评论的背景"</string> + <string name="theme_item_received_message_background_color">"已收消息的背景颜色"</string> + <string name="theme_item_received_message_background_color_detail">"应用于:已收私人消息的背景"</string> + <string name="theme_item_sent_message_background_color">"已发消息的背景色"</string> + <string name="theme_item_sent_message_background_color_detail">"应用于:已发私人消息的背景"</string> + <string name="theme_item_bottom_app_bar_background_color">"底部导航栏颜色"</string> + <string name="theme_item_bottom_app_bar_background_color_detail">"应用于:底部导航栏"</string> + + <!-- Fuzzy --> + <string name="theme_item_primary_icon_color">"主图标颜色"</string> + <string name="theme_item_primary_icon_color_detail">"应用于:导航抽屉中的图标"</string> + <string name="theme_item_bottom_app_bar_icon_color">"底部导航栏图标颜色"</string> + <string name="theme_item_bottom_app_bar_icon_color_detail">"应用于:底部导航栏中的图标"</string> + <string name="theme_item_post_icon_and_info_color">"发布图标和信息颜色"</string> + <string name="theme_item_post_icon_and_info_color_detail">"应用于:图标,得分和帖子中的评论数"</string> + <string name="theme_item_comment_icon_and_info_color">"评论图标和信息颜色"</string> + <string name="theme_item_comment_icon_and_info_color_detail">"应用于:图标和评论得分"</string> + + <!-- Fuzzy --> + <string name="theme_item_fab_icon_color">"浮动操作按钮图标颜色"</string> + + <!-- Fuzzy --> + <string name="theme_item_fab_icon_color_detail">"应用于:浮动操作按钮图标"</string> + <string name="theme_item_send_message_icon_color">"发送消息图标颜色"</string> + <string name="theme_item_send_message_icon_color_detail">"应用于:发送私人消息图标"</string> + <string name="theme_item_toolbar_primary_text_and_icon_color">"工具栏主要文字和图标颜色"</string> + <string name="theme_item_toolbar_primary_text_and_icon_color_detail">"应用于:工具栏中的主要文字和图标"</string> + <string name="theme_item_toolbar_secondary_text_color">"工具栏辅助文字颜色"</string> + <string name="theme_item_toolbar_secondary_text_color_detail">"应用于:工具栏中的辅助文字"</string> + + <!-- Fuzzy --> + <string name="theme_item_circular_progress_bar_background_color">"圆形进度栏背景色"</string> + + <!-- Fuzzy --> + <string name="theme_item_circular_progress_bar_background_color_detail">"应用于:圆形进度条的背景"</string> + <string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_tab_background">"展开工具栏中的选项卡布局的背景色"</string> + <string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_tab_background_detail">"应用于:选项卡布局背景(扩展的工具栏)"</string> + <string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_text_color">"展开工具栏中选项卡布局文本颜色"</string> + <string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_text_color_detail">"应用于:选项卡布局文字颜色(扩展的工具栏)"</string> + <string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_tab_indicator">"扩展工具栏中选项卡布局的选项卡指示器颜色"</string> + <string name="theme_item_tab_layout_with_expanded_collapsing_toolbar_tab_indicator_detail">"应用于:选项卡布局中的选项卡指示器颜色(扩展的工具栏)"</string> + <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_tab_background">"折叠的工具栏中的选项卡布局的背景色"</string> + <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_tab_background_detail">"应用于:选项卡布局背景(折叠的工具栏)"</string> + <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_text_color">"折叠的工具栏中的选项卡布局的文字颜色"</string> + <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_text_color_detail">"应用于:选项卡布局文本颜色(折叠的工具栏)"</string> + <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_tab_indicator">"折叠的工具栏中的选项卡布局的选项卡指示器颜色"</string> + <string name="theme_item_tab_layout_with_collapsed_collapsing_toolbar_tab_indicator_detail">"应用于:选项卡布局中的选项卡指示器颜色(折叠的工具栏)"</string> + <string name="theme_item_upvoted_color">"已点赞颜色"</string> + <string name="theme_item_upvoted_color_detail">"应用于:投票按钮和得分(已点赞)"</string> + <string name="theme_item_downvoted_color">"已点踩颜色"</string> + <string name="theme_item_downvoted_color_detail">"应用于:投票按钮和分数(已点踩)"</string> + <string name="theme_item_post_type_background_color">"帖子类型背景颜色"</string> + <string name="theme_item_post_type_background_color_detail">"应用于:帖子类型的背景(图像,文本,视频,动图,链接)"</string> + <string name="theme_item_post_type_text_color">"帖子类型文字颜色"</string> + <string name="theme_item_post_type_text_color_detail">"应用于:帖子类型的文字颜色(图像,文本,视频,动图,链接)"</string> + <string name="theme_item_spoiler_background_color">"剧透背景颜色"</string> + <string name="theme_item_spoiler_background_color_detail">"适用于:剧透标签的背景"</string> + <string name="theme_item_spoiler_text_color">"剧透文字颜色"</string> + <string name="theme_item_spoiler_text_color_detail">"应用于:剧透标签中的文字颜色"</string> + <string name="theme_item_nsfw_background_color">"NSFW背景颜色"</string> + <string name="theme_item_nsfw_background_color_detail">"应用于:NSFW标签的背景"</string> + <string name="theme_item_nsfw_text_color">"NSFW文字颜色"</string> + <string name="theme_item_nsfw_text_color_detail">"应用于:NSFW标签的文字颜色"</string> + <string name="theme_item_flair_background_color">"头衔背景颜色"</string> + <string name="theme_item_flair_background_color_detail">"应用于:头衔的背景"</string> + <string name="theme_item_flair_text_color">"头衔文字颜色"</string> + <string name="theme_item_flair_text_color_detail">"应用于:头衔的文字颜色"</string> + <string name="theme_item_awards_background_color">"奖项背景色"</string> + <string name="theme_item_awards_background_color_detail">"应用于:奖项标签的背景"</string> + <string name="theme_item_awards_text_color">"奖项文字颜色"</string> + <string name="theme_item_awards_text_color_detail">"应用于:奖项标签的文字颜色"</string> + <string name="theme_item_archived_tint">"已存档的图标颜色"</string> + <string name="theme_item_archived_tint_detail">"应用于:已存档图标"</string> + <string name="theme_item_locked_icon_tint">"被锁定的图标颜色"</string> + <string name="theme_item_locked_icon_tint_detail">"应用于:被锁定图标"</string> + <string name="theme_item_crosspost_icon_tint">"转发图标颜色"</string> + <string name="theme_item_crosspost_icon_tint_detail">"应用于:转发图标"</string> + <string name="theme_item_stickied_post_icon_tint">"置顶帖子图标颜色"</string> + <string name="theme_item_stickied_post_icon_tint_detail">"适用于:置顶帖子图标"</string> + <string name="theme_item_subscribed_color">"已订阅"</string> + <string name="theme_item_subscribed_color_detail">"应用于:取消订阅按钮"</string> + <string name="theme_item_unsubscribed_color">"取消订阅"</string> + <string name="theme_item_unsubscribed_color_detail">"应用于:订阅按钮"</string> + <string name="theme_item_username_color">"用户名颜色"</string> + <string name="theme_item_username_color_detail">"应用于:用户名"</string> + <string name="theme_item_subreddit_color">"板块颜色"</string> + <string name="theme_item_subreddit_color_detail">"应用于:板块名称"</string> + + <!-- What is “Author Flair”? --> + <string name="theme_item_author_flair_text_color">"作者头衔"</string> + <string name="theme_item_author_flair_text_color_detail">"应用于:评论中的作者标签"</string> + <string name="theme_item_submitter_color">"楼主"</string> + <string name="theme_item_submitter_color_detail">"应用于:评论中的楼主"</string> + <string name="theme_item_moderator_color">"版主"</string> + <string name="theme_item_moderator_color_detail">"应用于:评论中的版主"</string> + + <!-- Fuzzy --> + <string name="theme_item_single_comment_thread_background_color">"评论中每层的背景颜色"</string> + <string name="theme_item_single_comment_thread_background_color_detail">"应用于:每层评论"</string> + <string name="theme_item_unread_message_background_color">"未读消息背景色"</string> + <string name="theme_item_unread_message_background_color_detail">"应用于:未读消息背景色"</string> + <string name="theme_item_divider_color">"分隔线颜色"</string> + <string name="theme_item_divider_color_detail">"适用于:评论分隔线、提交帖子页面的分隔线等"</string> + <string name="theme_item_vote_and_reply_unavailable_button_color">"投票和回复不可用按钮颜色"</string> + <string name="theme_item_vote_and_reply_unavailable_button_color_detail">"应用于:投票和回复按钮(不可用)"</string> + <string name="theme_item_comment_vertical_bar_color_1">"1级楼中楼纵向指示线颜色"</string> + <string name="theme_item_comment_vertical_bar_color_1_detail">"应用于:楼中楼纵向指示线(1级)"</string> + <string name="theme_item_comment_vertical_bar_color_2">"2级楼中楼纵向指示线颜色"</string> + <string name="theme_item_comment_vertical_bar_color_2_detail">"应用于:注释纵向指示线(2级)"</string> + <string name="theme_item_comment_vertical_bar_color_3">"2级楼中楼纵向指示线颜色"</string> + <string name="theme_item_comment_vertical_bar_color_3_detail">"应用于:楼中楼纵向指示线(3级)"</string> + <string name="theme_item_comment_vertical_bar_color_4">"4级楼中楼纵向指示线颜色"</string> + <string name="theme_item_comment_vertical_bar_color_4_detail">"应用于:楼中楼纵向指示线(4级)"</string> + <string name="theme_item_comment_vertical_bar_color_5">"5级楼中楼纵向指示线颜色"</string> + <string name="theme_item_comment_vertical_bar_color_5_detail">"应用于:楼中楼纵向指示线(5级)"</string> + <string name="theme_item_comment_vertical_bar_color_6">"6级楼中楼纵向指示线颜色"</string> + <string name="theme_item_comment_vertical_bar_color_6_detail">"应用于:楼中楼纵向指示线(6级)"</string> + <string name="theme_item_comment_vertical_bar_color_7">"7级楼中楼纵向指示线颜色"</string> + <string name="theme_item_comment_vertical_bar_color_7_detail">"应用于:楼中楼纵向指示线(7级)"</string> + <string name="theme_item_nav_bar_color">"导航栏颜色"</string> + <string name="theme_item_nav_bar_color_detail">"应用于:导航栏"</string> + + <!-- Fuzzy --> + <string name="theme_item_light_status_bar">"深色状态栏图标颜色"</string> + + <!-- Fuzzy --> + <string name="theme_item_light_nav_bar">"深色导航栏图标颜色"</string> + <string name="theme_item_change_status_bar_icon_color_after_toolbar_collapsed_in_immersive_interface">"在沉浸式界面中折叠工具栏后,更改状态栏图标的颜色"</string> + <string name="theme_item_available_on_android_8">"只在Android8.0以上版本可用"</string> + <string name="theme_item_available_on_android_6">"只在Android6.0以上版本可用"</string> + <string name="predefined_themes">"预设主题"</string> + <string name="user_themes">"你的主题"</string> + <string name="no_theme_name">"这个主题叫什么名字?"</string> + <string name="theme_name_hint">"主题名"</string> + <string name="theme_name_indigo">"深蓝"</string> + <string name="theme_name_indigo_dark">"深蓝 黑"</string> + <string name="theme_name_indigo_amoled">"深蓝 Amoled"</string> + <string name="theme_name_white">"白色"</string> + <string name="theme_name_white_dark">"白 黑"</string> + <string name="theme_name_white_amoled">"白 A屏"</string> + <string name="theme_name_red">"红"</string> + <string name="theme_name_red_dark">"红 黑"</string> + <string name="theme_name_red_amoled">"红 A屏"</string> + <string name="theme_name_dracula">"德古拉"</string> + <string name="theme_name_calm_pastel">"淡色"</string> + <string name="create_light_theme">"创建一个基于“深蓝”主题的日间主题"</string> + <string name="create_dark_theme">"创建一个基于“深蓝 黑”主题的一个夜间主题"</string> + <string name="create_amoled_theme">"创建一个基于“A屏”主题的A屏主题"</string> + <string name="create_theme_info">"如果要基于一个主题创建新的主题,请单击那个主题上的“ +”按钮"</string> + <string name="edit_theme_name">"编辑主题名称"</string> + <string name="edit_theme">"编辑主题"</string> + <string name="delete_theme">"删除主题"</string> + <string name="delete_theme_dialog_message">"您确定要删除“%1$s”主题吗?"</string> + <string name="share_theme">"分享主题"</string> + <string name="change_theme_name">"改变名称"</string> + <string name="theme_copied">"复制成功! 您现可以粘贴并将主题分享给他人"</string> + <string name="copy_theme_faied">"无法复制主题配置"</string> + <string name="cannot_find_theme">"找不到这个主题"</string> + <string name="import_theme">"导入主题"</string> + <string name="no_data_in_clipboard">"在剪贴板中找不到数据"</string> + <string name="import_theme_success">"成功导入主题"</string> + <string name="parse_theme_failed">"解析主题失败"</string> + <string name="duplicate_theme_name_dialog_title">"找到重复的主题"</string> + <string name="duplicate_theme_name_dialog_message">"数据库中的一个主题也称为“%1$s”。是否更改此被导入主题的名称?"</string> + <string name="rename">"重命名"</string> + + <!-- Fuzzy --> + <string name="override">"覆写"</string> + <string name="color_picker">"颜色选择器"</string> + <string name="invalid_color">"颜色无效"</string> + <string name="delete_all_subreddits_success">"成功删除所有板块"</string> + <string name="delete_all_users_success">"成功删除所有用户"</string> + <string name="delete_all_sort_types_success">"成功删除所有排序类型"</string> + <string name="delete_all_post_layouts_success">"成功删除所有帖子布局"</string> + <string name="delete_all_themes_success">"成功删除所有主题"</string> + <string name="delete_all_front_page_scrolled_positions_success">"成功删除首页中所有滚动的位置"</string> + <string name="reset_all_settings_success">"成功重置所有设置"</string> + <string name="username_preview">"作者:u/Hostilenemy"</string> + + <!-- 此项也建议不要翻译,它大概是主题界面预览时显示社区位置的 --> + <string name="subreddit_preview">"r/Infinity_For_Reddit板块"</string> + <string name="primary_text_preview">"主要文字"</string> + <string name="secondary_text_preview">"辅助文字"</string> + <string name="post_title_preview">"这是一个帖子"</string> + <string name="post_content_preview">"这个引人入胜的笑话有点老了,但我每次都为之倾倒。"</string> + <string name="post_type_preview">"所有帖子"</string> + <string name="flair_preview">"标签"</string> + <string name="awards_preview">"4个奖励"</string> + <string name="author_flair_preview">"作者标签"</string> + <string name="comment_content_preview">"我给我的女朋友一张“尽快康复”的贺卡。 +她没有生病或其他任何疾病,但是她肯定会好起来的。"</string> + <string name="edit_multi_reddit">"编辑复合reddit"</string> + <string name="delete_multi_reddit">"删除复合reddit"</string> + <string name="n_awards">"%1$d个奖励"</string> + <string name="one_award">"1个奖励"</string> + <string name="report">"举报"</string> + <string name="reporting">"举报中"</string> + <string name="report_successful">"已举报"</string> + <string name="report_failed">"举报失败"</string> + <string name="report_reason_not_selected">"您尚未选择原因"</string> + <string name="report_reason_general_spam">"这是垃圾帖子"</string> + <string name="report_reason_general_copyright_issue">"帖子有版权问题"</string> + <string name="report_reason_general_child_pornography">"它包含儿童色情内容"</string> + <string name="report_reason_general_abusive_content">"它包含侮辱性内容"</string> + <string name="home">"主页"</string> + <string name="popular">"热搜"</string> + <string name="notifications">"通知"</string> + <string name="messages">"消息"</string> + <string name="message">"消息"</string> + <string name="fetch_gfycat_video_failed">"提取Gfycat视频失败"</string> + <string name="fetch_redgifs_video_failed">"提取Redgifs视频失败"</string> + <string name="fetching_video_info_please_wait">"正在获取视频信息。请耐心等待"</string> + <string name="error_fetching_imgur_media">"无法加载图像"</string> + <string name="downloading_reddit_video">"下载视频轨"</string> + <string name="downloading_reddit_video_audio_track">"下载音轨"</string> + <string name="downloading_reddit_video_muxing">"合并视频轨与音轨"</string> + <string name="downloading_reddit_video_save_file_to_public_dir">"保存视频"</string> + <string name="downloading_reddit_video_finished">"已下载"</string> + <string name="downloading_reddit_video_failed_cannot_get_cache_directory">"下载失败:无法访问缓存目录"</string> + <string name="downloading_reddit_video_failed_cannot_download_video">"下载失败:无法下载视频"</string> + <string name="downloading_reddit_video_failed_cannot_save_video">"下载失败:无法将视频保存到缓存目录"</string> + <string name="downloading_reddit_video_failed_cannot_save_audio">"下载失败:无法将音频保存到缓存目录"</string> + <string name="downloading_reddit_video_failed_cannot_mux">"下载失败:无法合并视频和音频"</string> + <string name="downloading_reddit_video_failed_cannot_save_mux_video">"下载失败:无法将视频保存到公共目录"</string> + <string name="wallpaper_set">"壁纸集"</string> + <string name="error_set_wallpaper">"无法设置为壁纸"</string> + <string name="set_to_home_screen">"设置到主屏幕"</string> + <string name="set_to_lock_screen">"设置为锁定屏幕"</string> + <string name="set_to_both">"设置为壁纸和锁定屏幕"</string> + <string name="default_font_font_preview">"默认字体"</string> + <string name="load_video_in_redgifs">"尝试在Redgifs上加载视频"</string> + + <!-- Don't know how to translate it, never seen this before. --> + <string name="top_score">"%1$s分"</string> + <string name="login_activity_2fa_prompt">"如果您启用了两步验证,请按如下所示输入密码(使用英文的冒号):<密码>:<两步验证代码>。 +范例:yourpass:123456"</string> + <string name="block_user">"屏蔽用户"</string> + <string name="block_user_success">"已屏蔽"</string> + <string name="block_user_failed">"未能屏蔽用户"</string> + <string name="submit_crosspost_activity_label">"转帖"</string> + <string name="give_award_activity_label">"给予奖励"</string> + <string name="action_crosspost">"转贴"</string> + <string name="action_select_user_flair">"选择用户标签"</string> + <string name="action_give_award">"给予奖励"</string> + <string name="posts">"帖子"</string> + <string name="sidebar">"侧边栏"</string> + <string name="only_for_logged_in_user">"登录后可用"</string> + <string name="settings_number_of_columns_in_post_feed_title">"浏览帖子流页面的列数"</string> + <string name="settings_number_of_columns_in_post_feed_portrait_title">"头像"</string> + <string name="settings_number_of_columns_in_post_feed_landscape_title">"帖子流中横向数量"</string> + <string name="settings_nsfw_and_spoiler_title">"NSFW和剧透"</string> + <string name="settings_delete_all_legacy_settings_title">"删除所有旧设置"</string> + <string name="restart_app_see_changes">"重新启动应用程序以查看更改"</string> + <string name="settings_tab_count">"标签计数"</string> + <string name="settings_show_tab_names">"显示标签名称"</string> + <string name="settings_more_tabs_summary">"更多标签"</string> + <string name="settings_more_tabs_info_summary">"启用以下选项将导致意外的行为: +标签切换到其他标签后可能会丢失所有内容。 这与刷新页面相同。"</string> + <string name="settings_more_tabs_show_favorite_subscribed_subreddits_title">"显示最爱的订阅板块"</string> + <string name="settings_more_tabs_show_subscribed_subreddits_title">"显示已订阅板块"</string> + <string name="settings_download_location_title">"下载内容保存位置"</string> + <string name="settings_image_download_location_title">"下载图片保存位置"</string> + <string name="settings_gif_download_location_title">"下载Gif保存位置"</string> + <string name="settings_video_download_location_title">"下载视频保存位置"</string> + <string name="settings_separate_folder_for_each_subreddit">"每个板块的设置单独的文件夹"</string> + <string name="settings_swipe_action_title">"滑动动作"</string> + <string name="settings_disable_swiping_between_tabs_title">"禁用在标签之间滑动"</string> + <string name="settings_enable_swipe_action_title">"启用滑动动作"</string> + + <!-- Fuzzy --> + <string name="settings_swipe_action_threshold">"滑动动作判定阀值"</string> + <string name="settings_pull_to_refresh_title">"下拉刷新"</string> + <string name="settings_security_title">"安全"</string> + <string name="settings_require_authentication_to_go_to_account_section_in_navigation_drawer_title">"需要验证才能转到导航抽屉中的“帐户”部分"</string> + <string name="settings_long_press_to_hide_toolbar_in_compact_layout_title">"长按可在紧凑布局中隐藏工具栏"</string> + <string name="settings_post_compact_layout_toolbar_hidden_by_default_title">"默认隐藏紧凑布局中的工具栏"</string> + <string name="settings_customize_bottom_app_bar_title">"自定义底部导航栏"</string> + <string name="settings_main_activity_bottom_app_bar_group_summary">"主页"</string> + <string name="settings_other_activities_bottom_app_bar_group_summary">"其他页面"</string> + + <!-- Fuzzy --> + <string name="settings_bottom_app_bar_option_count">"选项计数"</string> + <string name="settings_bottom_app_bar_option_1">"选项1"</string> + <string name="settings_bottom_app_bar_option_2">"选项2"</string> + <string name="settings_bottom_app_bar_option_3">"选项3"</string> + <string name="settings_bottom_app_bar_option_4">"选项4"</string> + <string name="settings_bottom_app_bar_fab">"浮动动作按钮"</string> + <string name="settings_data_saving_mode">"省流模式"</string> + <string name="settings_data_saving_mode_info_summary">"省流模式: +预览图分辨率较低。 +视频分辨率较低。 +禁用视频自动播放。"</string> + <string name="settings_translation_title">"翻译"</string> + <string name="settings_translation_summary">"在POEditor上翻译此应用。 感谢所有贡献者!"</string> + <string name="settings_credits_national_flags">"国旗"</string> + <string name="settings_credits_national_flags_summary">"图标由来自www.flaticon.com的Freepik制作"</string> + <string name="copy_failed">"复制失败"</string> + <string name="delete_all_legacy_settings_success">"成功删除所有旧设置"</string> + <string name="downloading_media_finished">"下载完成"</string> + <string name="downloading_image_or_gif_failed_cannot_get_destination_directory">"下载失败:无法访问目标目录"</string> + <string name="downloading_media_failed_cannot_download_media">"下载失败"</string> + <string name="downloading_media_failed_cannot_save_to_destination_directory">"下载失败:无法将文件保存至目标目录"</string> + <string name="view_full_comment_markdown">"查看完整Markdown"</string> + <string name="select_user_flair_success">"用户头衔已选中"</string> + <string name="select_this_user_flair">"选择此用户的头衔吗?"</string> + <string name="select_header_size">"选择标题大小"</string> + <string name="large">"大"</string> + <string name="small">"小"</string> + <string name="insert_link">"插入链接"</string> + <string name="text_hint">"文本"</string> + <string name="link_hint">"链接"</string> + + <!-- Fuzzy --> + <string name="unlock_account_section">"解锁帐户部分"</string> + <string name="unlock">"解锁"</string> + <string name="submit_post">"提交帖子"</string> + <string name="refresh">"刷新"</string> + <string name="change_sort_type">"更改排序类型"</string> + <string name="change_post_layout">"更改帖子布局"</string> + <string name="give_award_dialog_title">"给予奖励?"</string> + <string name="anonymous">"匿名"</string> + <string name="give_award_error_message">"错误代号:%1$d/ + 错误信息:%2$s"</string> + <string name="give_award_success">"赠送奖励"</string> + <string name="give_award_failed">"失败"</string> + <string name="recent_searches">"最近搜索"</string> + <string name="warning">"警告"</string> + <string name="this_is_a_nsfw_subreddit">"这是一个NSFW版块"</string> + <string name="this_user_has_nsfw_content">"该用户有NSFW内容"</string> + <string name="dismiss">"忽略"</string> + <string name="leave">"离开"</string> + <string name="go_to_subreddit">"前往板块"</string> + <string name="go_to_user">"转到用户"</string> + <string name="go_to_thing_hint">"名称"</string> + <string name="random">"随机"</string> + <string name="random_subreddit">"随机板块"</string> + <string name="random_nsfw_subreddit">"随机NSFW板块"</string> + <string name="random_post">"随机帖子"</string> + <string name="random_nsfw_post">"随机NSWF帖子"</string> + <string name="fetch_random_thing_failed">"待会重试"</string> + <string name="downloading">"下载中"</string> + <string name="subreddit_filter_popular_and_all_activity_label">"“r/all”和“r/popular”板块"</string> + <string name="settings_miscellaneous_title">"其他"</string> + <string name="settings_respect_subreddit_recommended_comment_sort_type_title">"关于板块推荐评论排序类型"</string> + <string name="settings_respect_subreddit_recommended_comment_sort_type_summary">"评论排序类型将不会保存"</string> + <string name="settings_post_filter_title">"过滤器"</string> + <string name="settings_subreddit_filter_category">"隐藏版块"</string> + <string name="settings_subreddit_filter_popular_and_all">"在“r/all”和“r/popular”板块中"</string> + <string name="settings_credits_ufo_capturing_animation_title">"开屏UFO动画"</string> + <string name="select_video_quality">"选择视频质量"</string> + <string name="settings_swipe_action_haptic_feedback_title">"触觉反馈"</string> + <string name="settings_hide_subreddit_description_title">"隐藏板块描述"</string> + <string name="settings_disable_image_preview_title">"数据网络禁用图像预览"</string> + <string name="settings_swipe_action_swipe_left_title">"向左滑动"</string> + <string name="settings_swipe_action_swipe_right_title">"向右滑动"</string> + <string name="settings_swipe_action_info_summary">"不适用于超过1栏或帖子详细信息的帖子"</string> + <string name="theme_item_no_preview_post_type_icon_tint">"无预览帖子类型图标颜色"</string> + <string name="theme_item_no_preview_post_type_icon_tint_detail">"应用于:没有可用预览时指示帖子类型的图标"</string> + <string name="theme_item_no_preview_post_type_background_color">"无预览文章类型背景颜色"</string> + <string name="theme_item_no_preview_post_type_background_color_detail">"应用于:占位符,指示没有预览可用时的帖子类型"</string> + <string name="settings_language_title">"语言"</string> + <string name="settings_enable_search_history_title">"启用搜索记录"</string> +</resources>
\ No newline at end of file diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index 767e2fb9..a728581c 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -260,6 +260,8 @@ <item>Go to Subreddit</item> <item>Go to User</item> <item>Random</item> + <item>Hide Read Posts</item> + <item>Filter Posts</item> </string-array> <string-array name="settings_swipe_action_threshold"> @@ -295,4 +297,34 @@ <item>1</item> </string-array> + <string-array name="settings_language"> + <item>Auto</item> + <item>Hrvatski</item> + <item>简体中文</item> + <item>English</item> + <item>Française</item> + <item>Deutsche</item> + <item>हिंदी</item> + <item>Italiana</item> + <item>日本語</item> + <item>Português (BR)</item> + <item>Español</item> + <item>Türkçe</item> + </string-array> + + <string-array name="settings_language_values"> + <item>auto</item> + <item>hr</item> + <item>zh-rCN</item> + <item>en</item> + <item>fr</item> + <item>de</item> + <item>hi</item> + <item>it</item> + <item>ja</item> + <item>pt-rBR</item> + <item>es</item> + <item>tr-rTR</item> + </string-array> + </resources>
\ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index fa386470..1c423672 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -34,6 +34,9 @@ <string name="submit_crosspost_activity_label">Crosspost</string> <string name="give_award_activity_label">Give Award</string> <string name="subreddit_filter_popular_and_all_activity_label">r/all and r/popular</string> + <string name="customize_post_filter_activity_label">Customize Post Filter</string> + <string name="filtered_posts_activity_subtitle">Filtered Posts</string> + <string name="post_filter_preference_activity_label">Post Filter</string> <string name="navigation_drawer_open">Open navigation drawer</string> <string name="navigation_drawer_close">Close navigation drawer</string> @@ -71,6 +74,7 @@ <string name="action_block_user">Block User</string> <string name="action_select_user_flair">Select User Flair</string> <string name="action_give_award">Give Award</string> + <string name="action_save_to_database">Save to Database</string> <string name="parse_json_response_error">Error occurred when parsing the JSON response</string> <string name="retrieve_token_error">Error Retrieving the token</string> @@ -198,6 +202,8 @@ <string name="bottom_sheet_post_link">Link</string> <string name="bottom_sheet_post_image">Image</string> <string name="bottom_sheet_post_video">Video</string> + <string name="post_type_gif">Gif</string> + <string name="post_type_gallery">Gallery</string> <string name="select_from_gallery">Select a picture</string> <string name="select_again">Select again</string> @@ -446,6 +452,7 @@ <string name="settings_delete_all_post_layout_data_in_database_title">Delete All Post Layouts in Database</string> <string name="settings_delete_all_themes_in_database_title">Delete All Themes in Database</string> <string name="settings_delete_front_page_scrolled_positions_in_database_title">Delete All Front Page Scrolled Positions in Database</string> + <string name="settings_delete_read_posts_in_database_title">Delete All Read Posts in Database</string> <string name="settings_delete_all_legacy_settings_title">Delete All Legacy Settings</string> <string name="settings_reset_all_settings_title">Reset All Settings</string> <string name="settings_advanced_settings_summary">Clean the database and shared preferences</string> @@ -498,7 +505,7 @@ <string name="settings_miscellaneous_title">Miscellaneous</string> <string name="settings_respect_subreddit_recommended_comment_sort_type_title">Respect Subreddit Recommended Comment Sort Type</string> <string name="settings_respect_subreddit_recommended_comment_sort_type_summary">Comment sort type will not be saved</string> - <string name="settings_filter_title">Filter</string> + <string name="settings_post_filter_title">Post Filter</string> <string name="settings_subreddit_filter_category">Hide Subreddits</string> <string name="settings_subreddit_filter_popular_and_all">In r/popular and r/all</string> <string name="settings_credits_ufo_capturing_animation_title">UFO Capturing Animation</string> @@ -507,6 +514,12 @@ <string name="settings_swipe_action_swipe_left_title">Swipe Left</string> <string name="settings_swipe_action_swipe_right_title">Swipe Right</string> <string name="settings_swipe_action_info_summary">Not applicable to post feed with more than 1 column or post detail.</string> + <string name="settings_language_title">Language</string> + <string name="settings_enable_search_history_title">Enable Search History</string> + <string name="settings_post_history_title">Post History</string> + <string name="settings_mark_posts_as_read_title">Mark Posts As Read</string> + <string name="settings_mark_posts_as_read_after_voting_title">Mark Posts As Read After Voting</string> + <string name="settings_hide_read_posts_automatically_title">Hide Read Posts Automatically</string> <string name="no_link_available">Cannot get the link</string> @@ -628,6 +641,10 @@ <string name="theme_item_post_title_color_detail">Applied to: Post title</string> <string name="theme_item_post_content_color">Post Content Color</string> <string name="theme_item_post_content_color_detail">Applied to: Post content</string> + <string name="theme_item_read_post_title_color">Read Post Title Color</string> + <string name="theme_item_read_post_title_color_detail">Applied to: Read Post Title</string> + <string name="theme_item_read_post_content_color">Read Post Content Color</string> + <string name="theme_item_read_post_content_color_detail">Applied to: Read Post Content</string> <string name="theme_item_comment_color">Comment Color</string> <string name="theme_item_comment_color_detail">Applied to: Comment</string> <string name="theme_item_button_text_color">Button Text Color</string> @@ -644,6 +661,8 @@ <string name="theme_item_background_color_detail">Applied to: Background of every page and navigation drawer</string> <string name="theme_item_card_view_background_color">Card View Background Color</string> <string name="theme_item_card_view_background_color_detail">Applied to: Post background and message background</string> + <string name="theme_item_read_post_card_view_background_color">Read Post Card View Background Color</string> + <string name="theme_item_read_post_card_view_background_color_detail">Applied to: Read Post background</string> <string name="theme_item_comment_background_color">Comment Background Color</string> <string name="theme_item_comment_background_color_detail">Applied to: Comment background</string> <string name="theme_item_fully_collapsed_comment_background_color">Fully-Collapsed Comment Background Color</string> @@ -812,6 +831,7 @@ <string name="delete_all_post_layouts_success">Delete all post layouts successfully</string> <string name="delete_all_themes_success">Delete all themes successfully</string> <string name="delete_all_front_page_scrolled_positions_success">Delete all scrolled positions in front page successfully</string> + <string name="delete_all_read_posts_success">Delete all read posts successfully</string> <string name="delete_all_legacy_settings_success">Delete all legacy settings successfully</string> <string name="reset_all_settings_success">Reset all settings successfully</string> @@ -927,8 +947,8 @@ <string name="dismiss">Dismiss</string> <string name="leave">Leave</string> - <string name="go_to_subreddit">Go to subreddit</string> - <string name="go_to_user">Go to user</string> + <string name="go_to_subreddit">Go to Subreddit</string> + <string name="go_to_user">Go to User</string> <string name="go_to_thing_hint">Name</string> <string name="random">Random</string> <string name="random_subreddit">Random Subreddit</string> @@ -939,4 +959,36 @@ <string name="select_video_quality">Select Video Quality</string> + <string name="hide_read_posts">Hide Read Posts</string> + <string name="filter_posts">Filter Posts</string> + + <string name="only_nsfw">Only NSFW</string> + <string name="only_spoiler">Only Spoiler</string> + <string name="title_excludes_strings_hint">Title: excludes keywords (key1,key2)</string> + <string name="title_excludes_regex_hint">Title: excludes regex</string> + <string name="exclude_subreddits_hint">Exclude subreddits (e.g. funny,AskReddit)</string> + <string name="exclude_users_hint">Exclude users (e.g. Hostilenemy,random)</string> + <string name="exclude_flairs_hint">Exclude flairs (e.g. flair1,flair2)</string> + <string name="contain_flairs_hint">Contain flairs (e.g. flair1,flair2)</string> + <string name="min_vote_hint">Min vote (-1: no restriction)</string> + <string name="max_vote_hint">Max vote (-1: no restriction)</string> + <string name="min_comments_hint">Min comments (-1: no restriction)</string> + <string name="max_comments_hint">Max comments (-1: no restriction)</string> + <string name="min_awards_hint">Min awards (-1: no restriction)</string> + <string name="max_awards_hint">Max awards (-1: no restriction)</string> + <string name="post_filter_name_hint">Post Filter Name</string> + <string name="post_filter_requires_a_name">What is the name of this post filter?</string> + <string name="apply_post_filter_to">Apply to</string> + <string name="post_filter_usage_home">Home</string> + <string name="post_filter_usage_subreddit">Subreddit: %1$s</string> + <string name="post_filter_usage_subreddit_all">Subreddit</string> + <string name="post_filter_usage_user">User: %1$s</string> + <string name="post_filter_usage_user_all">User</string> + <string name="post_filter_usage_multireddit">MultiReddit: %1$s</string> + <string name="post_filter_usage_multireddit_all">MultiReddit</string> + <string name="post_filter_usage_search">Search</string> + <string name="subreddit">Subreddit</string> + <string name="user">User</string> + <string name="edit_post_filter_name_of_usage_info">Leave it blank to apply this post filter to all the subreddits / users / multireddits</string> + </resources> diff --git a/app/src/main/res/xml/advanced_preferences.xml b/app/src/main/res/xml/advanced_preferences.xml index 0d6c02e5..6992530d 100644 --- a/app/src/main/res/xml/advanced_preferences.xml +++ b/app/src/main/res/xml/advanced_preferences.xml @@ -27,6 +27,10 @@ app:title="@string/settings_delete_front_page_scrolled_positions_in_database_title" /> <Preference + app:key="delete_read_posts_in_database" + app:title="@string/settings_delete_read_posts_in_database_title" /> + + <Preference app:key="delete_all_legacy_settings" app:title="@string/settings_delete_all_legacy_settings_title" /> diff --git a/app/src/main/res/xml/filter_preferences.xml b/app/src/main/res/xml/filter_preferences.xml deleted file mode 100644 index f0e4fa62..00000000 --- a/app/src/main/res/xml/filter_preferences.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto"> - - <Preference - app:icon="@drawable/ic_info_preference_24dp" - app:summary="@string/restart_app_see_changes" - app:enabled="false" /> - - <PreferenceCategory - app:title="@string/settings_subreddit_filter_category" /> - - <Preference - app:key="subreddit_filter_popular_and_all" - app:title="@string/settings_subreddit_filter_popular_and_all" /> - -</PreferenceScreen>
\ No newline at end of file diff --git a/app/src/main/res/xml/main_preferences.xml b/app/src/main/res/xml/main_preferences.xml index 9c964d01..e2dac88d 100644 --- a/app/src/main/res/xml/main_preferences.xml +++ b/app/src/main/res/xml/main_preferences.xml @@ -44,11 +44,10 @@ <Preference app:key="security" app:title="@string/settings_security_title" - android:icon="@drawable/ic_security_24dp" + app:icon="@drawable/ic_security_24dp" app:fragment="ml.docilealligator.infinityforreddit.settings.SecurityPreferenceFragment" /> <Preference - app:key="security" app:title="@string/settings_data_saving_mode" app:icon="@drawable/ic_data_saving_mode_24dp" app:fragment="ml.docilealligator.infinityforreddit.settings.DataSavingModePreferenceFragment" /> @@ -59,9 +58,14 @@ app:fragment="ml.docilealligator.infinityforreddit.settings.NsfwAndBlurringFragment"/> <Preference + app:icon="@drawable/ic_history_24dp" + android:title="@string/settings_post_history_title" + app:fragment="ml.docilealligator.infinityforreddit.settings.PostHistoryFragment" /> + + <Preference + app:key="post_filter" app:icon="@drawable/ic_filter_24dp" - app:title="@string/settings_filter_title" - app:fragment="ml.docilealligator.infinityforreddit.settings.FilterPreferenceFragment"/> + app:title="@string/settings_post_filter_title" /> <Preference app:icon="@drawable/ic_miscellaneous_24dp" diff --git a/app/src/main/res/xml/miscellaneous_preferences.xml b/app/src/main/res/xml/miscellaneous_preferences.xml index f4274a5a..6fb763f6 100644 --- a/app/src/main/res/xml/miscellaneous_preferences.xml +++ b/app/src/main/res/xml/miscellaneous_preferences.xml @@ -25,4 +25,19 @@ app:title="@string/settings_respect_subreddit_recommended_comment_sort_type_title" app:summary="@string/settings_respect_subreddit_recommended_comment_sort_type_summary" /> + <SwitchPreference + app:defaultValue="true" + app:key="enable_search_history" + app:title="@string/settings_enable_search_history_title" + app:summary="@string/only_for_logged_in_user" /> + + <ListPreference + app:defaultValue="auto" + app:entries="@array/settings_language" + app:entryValues="@array/settings_language_values" + app:key="language" + app:icon="@drawable/ic_language_24dp" + app:title="@string/settings_language_title" + app:useSimpleSummaryProvider="true" /> + </PreferenceScreen>
\ No newline at end of file diff --git a/build.gradle b/build.gradle index ea77b473..2c7d3efd 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.0' + classpath 'com.android.tools.build:gradle:4.1.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar Binary files differindex 490fda85..e708b1c0 100644 --- a/gradle/wrapper/gradle-wrapper.jar +++ b/gradle/wrapper/gradle-wrapper.jar diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f000a330..1f3fdbc5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Wed Oct 14 22:46:37 CST 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip @@ -82,6 +82,7 @@ esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then @@ -129,6 +130,7 @@ fi if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath diff --git a/gradlew.bat b/gradlew.bat index 9109989e..ac1b06f9 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
+if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -54,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-if exist "%JAVA_EXE%" goto init
+if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -64,28 +64,14 @@ echo location of your Java installation. goto fail
-:init
-@rem Get command-line arguments, handling Windows variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
|