diff options
299 files changed, 4601 insertions, 2572 deletions
diff --git a/app/build.gradle b/app/build.gradle index d44a17d9..76f05962 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,6 +9,11 @@ android { versionCode 35 versionName "3.2.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + javaCompileOptions { + annotationProcessorOptions { + arguments = [ eventBusIndex : 'ml.docilealligator.inifinityforreddit.EventBusIndex' ] + } + } } buildTypes { release { @@ -40,7 +45,7 @@ dependencies { implementation "androidx.room:room-runtime:$roomVersion" annotationProcessor "androidx.room:room-compiler:$roomVersion" implementation 'androidx.work:work-runtime:2.3.4' - implementation 'com.google.android.material:material:1.2.0-alpha05' + implementation 'com.google.android.material:material:1.3.0-alpha01' implementation 'com.google.android.exoplayer:exoplayer-core:2.10.4' implementation 'com.google.android.exoplayer:exoplayer-hls:2.10.4' @@ -67,7 +72,10 @@ dependencies { implementation 'io.noties.markwon:recycler-table:4.3.1' implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.19' implementation 'com.github.Ferfalk:SimpleSearchView:0.1.4' - implementation 'org.greenrobot:eventbus:3.2.0' + + def eventbusVersion = '3.2.0' + implementation "org.greenrobot:eventbus:$eventbusVersion" + annotationProcessor "org.greenrobot:eventbus-annotation-processor:$eventbusVersion" implementation 'com.libRG:customtextview:2.4' implementation 'com.github.Deishelon:RoundedBottomSheet:1.0.1' implementation 'com.github.livefront:bridge:v1.2.1' @@ -82,7 +90,9 @@ dependencies { def toroVersion = '3.7.0.2010003' implementation "im.ene.toro3:toro:$toroVersion" - implementation "im.ene.toro3:toro-ext-exoplayer:$toroVersion" + implementation("im.ene.toro3:toro-ext-exoplayer:$toroVersion") { + exclude module: 'extension-ima' + } testImplementation 'junit:junit:4.13' androidTestImplementation 'androidx.test:runner:1.2.0' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 2a2a74bd..5b4d7d0a 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -4,6 +4,8 @@ package="ml.docilealligator.infinityforreddit"> <uses-permission android:name="android.permission.INTERNET" /> + <uses-permission android:name="android.permission.SET_WALLPAPER" /> + <uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="22" /> @@ -21,10 +23,11 @@ android:theme="@style/AppTheme" android:usesCleartextTraffic="true" tools:replace="android:label"> + <service android:name=".Service.DownloadRedditVideoService" android:enabled="true" - android:exported="false"></service> + android:exported="false" /> <activity android:name=".Activity.ViewImgurMediaActivity" @@ -35,22 +38,22 @@ android:name=".Activity.ReportActivity" android:label="@string/report_activity_label" android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBar" /> + android:theme="@style/AppTheme.Slidable" /> <activity android:name=".Activity.SelectedSubredditsActivity" android:label="@string/selected_subeddits_activity_label" android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBar" /> + android:theme="@style/AppTheme.Slidable" /> <activity android:name=".Activity.EditMultiRedditActivity" android:label="@string/edit_multi_reddit_activity_label" android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBar" /> + android:theme="@style/AppTheme.Slidable" /> <activity android:name=".Activity.ThemePreviewActivity" android:label="@string/theme_preview_activity_label" android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBarWithTranslucentWindow" /> + android:theme="@style/AppTheme.SlidableWithTranslucentWindow" /> <activity android:name=".Activity.CustomThemeListingActivity" android:label="@string/custom_theme_listing_activity_label" @@ -65,35 +68,27 @@ android:name=".Activity.SubredditMultiselectionActivity" android:label="@string/subreddit_multiselection_activity_label" android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBar" /> + android:theme="@style/AppTheme.Slidable" /> <activity android:name=".Activity.CreateMultiRedditActivity" android:label="@string/create_multi_reddit_activity_label" android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBar" + android:theme="@style/AppTheme.Slidable" android:windowSoftInputMode="adjustResize" /> <activity - android:name=".Activity.ViewSidebarActivity" - android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBar" /> - <activity android:name=".Activity.ViewMultiRedditDetailActivity" android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBar" /> + android:theme="@style/AppTheme.Slidable" /> <activity android:name=".Activity.MultiRedditListingActivity" android:label="@string/multi_reddit_listing_activity_label" android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBar" /> - <activity - android:name=".Activity.ViewGIFActivity" - android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.Draggable" /> + android:theme="@style/AppTheme.Slidable" /> <activity android:name=".Activity.AccountSavedThingActivity" android:label="@string/account_saved_thing_activity_label" android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBar" /> + android:theme="@style/AppTheme.Slidable" /> <activity android:name=".Activity.ShareDataResolverActivity"> <intent-filter> <action android:name="android.intent.action.SEND" /> @@ -126,32 +121,32 @@ android:name=".Activity.ViewMessageActivity" android:label="@string/view_message_activity_label" android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBar" /> + android:theme="@style/AppTheme.Slidable" /> <activity android:name=".Activity.AccountPostsActivity" android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBar" /> + android:theme="@style/AppTheme.Slidable" /> <activity android:name=".Activity.EditCommentActivity" android:label="@string/edit_comment_activity_label" android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBar" + android:theme="@style/AppTheme.Slidable" android:windowSoftInputMode="adjustResize" /> <activity android:name=".Activity.EditPostActivity" android:label="@string/edit_post_activity_label" android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBar" + android:theme="@style/AppTheme.Slidable" android:windowSoftInputMode="adjustResize" /> <activity android:name=".Activity.FilteredThingActivity" android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBar" /> + android:theme="@style/AppTheme.Slidable" /> <activity android:name=".Activity.SearchSubredditsResultActivity" android:label="@string/search_subreddits_activity_label" android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBar" /> + android:theme="@style/AppTheme.Slidable" /> <activity android:name=".Activity.LinkResolverActivity"> <intent-filter> <action android:name="android.intent.action.VIEW" /> @@ -225,57 +220,57 @@ android:name=".Activity.SearchActivity" android:label="@string/search_activity_label" android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBar" /> + android:theme="@style/AppTheme.Slidable" /> <activity android:name=".Activity.RulesActivity" android:label="@string/rules_activity_label" android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBar" /> + android:theme="@style/AppTheme.Slidable" /> <activity android:name=".Activity.PostVideoActivity" android:label="@string/post_video_activity_label" android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBar" + android:theme="@style/AppTheme.Slidable" android:windowSoftInputMode="adjustResize" /> <activity android:name=".Activity.PostImageActivity" android:label="@string/post_image_activity_label" android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBar" + android:theme="@style/AppTheme.Slidable" android:windowSoftInputMode="adjustResize" /> <activity android:name=".Activity.PostLinkActivity" android:label="@string/post_link_activity_label" android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBar" + android:theme="@style/AppTheme.Slidable" android:windowSoftInputMode="adjustResize" /> <activity android:name=".Activity.SubscribedThingListingActivity" android:label="@string/subscriptions" android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBar" /> + android:theme="@style/AppTheme.Slidable" /> <activity android:name=".Activity.SubredditSelectionActivity" android:label="@string/subreddit_selection_activity_label" android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBar" /> + android:theme="@style/AppTheme.Slidable" /> <activity android:name=".Activity.PostTextActivity" android:label="@string/post_text_activity_label" android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBar" + android:theme="@style/AppTheme.Slidable" android:windowSoftInputMode="adjustResize" /> <activity android:name=".Activity.CommentActivity" android:label="@string/comment_activity_label" android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBar" + android:theme="@style/AppTheme.Slidable" android:windowSoftInputMode="adjustResize" /> <activity android:name=".Activity.SearchResultActivity" android:label="@string/search_activity_label" android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBar" /> + android:theme="@style/AppTheme.Slidable" /> <activity android:name=".Activity.MainActivity" android:label="@string/application_name" @@ -290,9 +285,9 @@ android:name=".Activity.LoginActivity" android:label="@string/login_activity_label" android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBar" /> + android:theme="@style/AppTheme.Slidable" /> <activity - android:name=".Activity.ViewImageActivity" + android:name=".Activity.ViewImageOrGifActivity" android:parentActivityName=".Activity.MainActivity" android:theme="@style/AppTheme.Draggable" /> <activity @@ -303,15 +298,15 @@ <activity android:name=".Activity.ViewPostDetailActivity" android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBarWithTransparentBackground" /> + android:theme="@style/AppTheme.Slidable" /> <activity android:name=".Activity.ViewSubredditDetailActivity" android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBarWithTranslucentWindow" /> + android:theme="@style/AppTheme.SlidableWithTranslucentWindow" /> <activity android:name=".Activity.ViewUserDetailActivity" android:parentActivityName=".Activity.MainActivity" - android:theme="@style/AppTheme.NoActionBarWithTranslucentWindow" /> + android:theme="@style/AppTheme.SlidableWithTranslucentWindow" /> <provider android:name="androidx.core.content.FileProvider" @@ -329,4 +324,4 @@ android:exported="false" /> </application> -</manifest>
\ No newline at end of file +</manifest> diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/API/PushshiftAPI.java b/app/src/main/java/ml/docilealligator/infinityforreddit/API/PushshiftAPI.java new file mode 100644 index 00000000..1dc7b411 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/API/PushshiftAPI.java @@ -0,0 +1,13 @@ +package ml.docilealligator.infinityforreddit.API; + +import retrofit2.Call; +import retrofit2.http.GET; +import retrofit2.http.Query; + +public interface PushshiftAPI { + @GET("reddit/comment/search/") + Call<String> getRemovedComment(@Query("ids") String commentId); + + @GET("reddit/submission/search/") + Call<String> getRemovedPost(@Query("ids") String postId); +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountPostsActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountPostsActivity.java index 1e6ef259..97cc5967 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountPostsActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountPostsActivity.java @@ -16,6 +16,7 @@ import androidx.fragment.app.Fragment; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.appbar.CollapsingToolbarLayout; +import com.r0adkll.slidr.Slidr; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -94,6 +95,10 @@ public class AccountPostsActivity extends BaseActivity implements SortTypeSelect applyCustomTheme(); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK_FROM_POST_DETAIL, true)) { + Slidr.attach(this); + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { Window window = getWindow(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountSavedThingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountSavedThingActivity.java index d3c3caf9..42e89abc 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountSavedThingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/AccountSavedThingActivity.java @@ -21,6 +21,8 @@ import androidx.viewpager.widget.ViewPager; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.appbar.CollapsingToolbarLayout; import com.google.android.material.tabs.TabLayout; +import com.r0adkll.slidr.Slidr; +import com.r0adkll.slidr.model.SlidrInterface; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -42,6 +44,7 @@ import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.Post.PostDataSource; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import retrofit2.Retrofit; public class AccountSavedThingActivity extends BaseActivity implements ActivityToolbarInterface { @@ -74,6 +77,7 @@ public class AccountSavedThingActivity extends BaseActivity implements ActivityT @Inject CustomThemeWrapper mCustomThemeWrapper; private SectionsPagerAdapter sectionsPagerAdapter; + private SlidrInterface mSlidrInterface; private Menu mMenu; private AppBarLayout.LayoutParams params; private boolean mNullAccessToken = false; @@ -95,6 +99,10 @@ public class AccountSavedThingActivity extends BaseActivity implements ActivityT applyCustomTheme(); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK_FROM_POST_DETAIL, true)) { + mSlidrInterface = Slidr.attach(this); + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { Window window = getWindow(); @@ -173,12 +181,7 @@ public class AccountSavedThingActivity extends BaseActivity implements ActivityT viewPager.setOffscreenPageLimit(2); tabLayout.setupWithViewPager(viewPager); - viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { - @Override - public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { - - } - + viewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { if (isInLazyMode) { @@ -188,11 +191,12 @@ public class AccountSavedThingActivity extends BaseActivity implements ActivityT sectionsPagerAdapter.pauseLazyMode(); } } - } - - @Override - public void onPageScrollStateChanged(int state) { + if (position == 0) { + unlockSwipeRightToGoBack(); + } else { + lockSwipeRightToGoBack(); + } } }); } @@ -284,6 +288,18 @@ public class AccountSavedThingActivity extends BaseActivity implements ActivityT } } + private void lockSwipeRightToGoBack() { + if (mSlidrInterface != null) { + mSlidrInterface.lock(); + } + } + + private void unlockSwipeRightToGoBack() { + if (mSlidrInterface != null) { + mSlidrInterface.unlock(); + } + } + private class SectionsPagerAdapter extends FragmentPagerAdapter { private PostFragment postFragment; private CommentsListingFragment commentsListingFragment; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java index 1eb8aa0a..883d0ce8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java @@ -27,11 +27,14 @@ import com.google.android.material.tabs.TabLayout; import ml.docilealligator.infinityforreddit.ActivityToolbarInterface; import ml.docilealligator.infinityforreddit.AppBarStateChangeListener; -import ml.docilealligator.infinityforreddit.ContentFontStyle; import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper; -import ml.docilealligator.infinityforreddit.FontStyle; +import ml.docilealligator.infinityforreddit.Font.ContentFontFamily; +import ml.docilealligator.infinityforreddit.Font.ContentFontStyle; +import ml.docilealligator.infinityforreddit.Font.FontFamily; +import ml.docilealligator.infinityforreddit.Font.FontStyle; +import ml.docilealligator.infinityforreddit.Font.TitleFontFamily; +import ml.docilealligator.infinityforreddit.Font.TitleFontStyle; import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.TitleFontStyle; import ml.docilealligator.infinityforreddit.Utils.CustomThemeSharedPreferencesUtils; import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; @@ -113,6 +116,15 @@ public abstract class BaseActivity extends AppCompatActivity { getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); + getTheme().applyStyle(FontFamily.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.FONT_FAMILY_KEY, FontFamily.Default.name())).getResId(), true); + + getTheme().applyStyle(TitleFontFamily.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.TITLE_FONT_FAMILY_KEY, TitleFontFamily.Default.name())).getResId(), true); + + getTheme().applyStyle(ContentFontFamily.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.CONTENT_FONT_FAMILY_KEY, ContentFontFamily.Default.name())).getResId(), true); + Window window = getWindow(); View decorView = window.getDecorView(); if (!hasDrawerLayout) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CommentActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CommentActivity.java index d9c07e88..95804f88 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CommentActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CommentActivity.java @@ -27,6 +27,7 @@ import androidx.recyclerview.widget.RecyclerView; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.snackbar.Snackbar; +import com.r0adkll.slidr.Slidr; import org.commonmark.ext.gfm.tables.TableBlock; import org.greenrobot.eventbus.EventBus; @@ -56,6 +57,7 @@ import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; import ml.docilealligator.infinityforreddit.SendComment; +import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import ml.docilealligator.infinityforreddit.Utils.Utils; import retrofit2.Retrofit; @@ -122,6 +124,10 @@ public class CommentActivity extends BaseActivity { applyCustomTheme(); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK_FROM_POST_DETAIL, true)) { + Slidr.attach(this); + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isChangeStatusBarIconColor()) { addOnOffsetChangedListener(appBarLayout); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CreateMultiRedditActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CreateMultiRedditActivity.java index b564a3a3..86669de9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CreateMultiRedditActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CreateMultiRedditActivity.java @@ -20,6 +20,7 @@ import androidx.coordinatorlayout.widget.CoordinatorLayout; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.snackbar.Snackbar; +import com.r0adkll.slidr.Slidr; import java.util.ArrayList; @@ -35,6 +36,7 @@ import ml.docilealligator.infinityforreddit.MultiReddit.CreateMultiReddit; import ml.docilealligator.infinityforreddit.MultiReddit.MultiRedditJSONModel; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import retrofit2.Retrofit; public class CreateMultiRedditActivity extends BaseActivity { @@ -91,6 +93,10 @@ public class CreateMultiRedditActivity extends BaseActivity { applyCustomTheme(); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK_FROM_POST_DETAIL, true)) { + Slidr.attach(this); + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isChangeStatusBarIconColor()) { addOnOffsetChangedListener(appBarLayout); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CustomThemeListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CustomThemeListingActivity.java index 42ee73c0..4e937cf6 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CustomThemeListingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CustomThemeListingActivity.java @@ -38,12 +38,12 @@ import ml.docilealligator.infinityforreddit.AsyncTask.ChangeThemeNameAsyncTask; import ml.docilealligator.infinityforreddit.AsyncTask.DeleteThemeAsyncTask; import ml.docilealligator.infinityforreddit.AsyncTask.GetCustomThemeAsyncTask; import ml.docilealligator.infinityforreddit.AsyncTask.InsertCustomThemeAsyncTask; +import ml.docilealligator.infinityforreddit.BottomSheetFragment.CreateThemeBottomSheetFragment; +import ml.docilealligator.infinityforreddit.BottomSheetFragment.CustomThemeOptionsBottomSheetFragment; import ml.docilealligator.infinityforreddit.CustomTheme.CustomTheme; import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeViewModel; import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.Event.RecreateActivityEvent; -import ml.docilealligator.infinityforreddit.BottomSheetFragment.CreateThemeBottomSheetFragment; -import ml.docilealligator.infinityforreddit.BottomSheetFragment.CustomThemeOptionsBottomSheetFragment; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; @@ -260,7 +260,7 @@ public class CustomThemeListingActivity extends BaseActivity implements !clipboard.getPrimaryClipDescription().hasMimeType(MIMETYPE_TEXT_PLAIN)) { // since the clipboard has data but it is not plain text Snackbar.make(coordinatorLayout, R.string.no_data_in_clipboard, Snackbar.LENGTH_SHORT).show(); - } else if (clipboard.getPrimaryClip() != null){ + } else if (clipboard.getPrimaryClip() != null) { ClipData.Item item = clipboard.getPrimaryClip().getItemAt(0); String json = item.getText().toString(); try { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditCommentActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditCommentActivity.java index 307f5e13..1d807d13 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditCommentActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditCommentActivity.java @@ -18,6 +18,7 @@ import androidx.coordinatorlayout.widget.CoordinatorLayout; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.snackbar.Snackbar; +import com.r0adkll.slidr.Slidr; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -36,6 +37,7 @@ import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.API.RedditAPI; import ml.docilealligator.infinityforreddit.Utils.APIUtils; +import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import ml.docilealligator.infinityforreddit.Utils.Utils; import retrofit2.Call; import retrofit2.Callback; @@ -87,6 +89,10 @@ public class EditCommentActivity extends BaseActivity { applyCustomTheme(); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK_FROM_POST_DETAIL, true)) { + Slidr.attach(this); + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isChangeStatusBarIconColor()) { addOnOffsetChangedListener(appBarLayout); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditMultiRedditActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditMultiRedditActivity.java index de8c71a9..1eb815b6 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditMultiRedditActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditMultiRedditActivity.java @@ -22,6 +22,7 @@ import androidx.coordinatorlayout.widget.CoordinatorLayout; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.snackbar.Snackbar; +import com.r0adkll.slidr.Slidr; import javax.inject.Inject; import javax.inject.Named; @@ -37,6 +38,7 @@ import ml.docilealligator.infinityforreddit.MultiReddit.MultiReddit; import ml.docilealligator.infinityforreddit.MultiReddit.MultiRedditJSONModel; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import retrofit2.Retrofit; public class EditMultiRedditActivity extends BaseActivity { @@ -100,6 +102,10 @@ public class EditMultiRedditActivity extends BaseActivity { applyCustomTheme(); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK_FROM_POST_DETAIL, true)) { + Slidr.attach(this); + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isChangeStatusBarIconColor()) { addOnOffsetChangedListener(appBarLayout); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditPostActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditPostActivity.java index aaf5d2f5..d886f91f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditPostActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/EditPostActivity.java @@ -20,6 +20,7 @@ import androidx.coordinatorlayout.widget.CoordinatorLayout; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.snackbar.Snackbar; +import com.r0adkll.slidr.Slidr; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -38,6 +39,7 @@ import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.API.RedditAPI; import ml.docilealligator.infinityforreddit.Utils.APIUtils; +import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; @@ -89,6 +91,10 @@ public class EditPostActivity extends BaseActivity { applyCustomTheme(); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK_FROM_POST_DETAIL, true)) { + Slidr.attach(this); + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isChangeStatusBarIconColor()) { addOnOffsetChangedListener(appBarLayout); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/FilteredThingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/FilteredThingActivity.java index c850f2d3..1ed02b61 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/FilteredThingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/FilteredThingActivity.java @@ -16,6 +16,7 @@ import androidx.fragment.app.Fragment; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.appbar.CollapsingToolbarLayout; +import com.r0adkll.slidr.Slidr; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -109,6 +110,10 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec applyCustomTheme(); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK_FROM_POST_DETAIL, true)) { + Slidr.attach(this); + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { Window window = getWindow(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java index 0b7cf47f..45c310c0 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LinkResolverActivity.java @@ -79,20 +79,20 @@ public class LinkResolverActivity extends AppCompatActivity { } if (path.endsWith("jpg") || path.endsWith("png")) { - Intent intent = new Intent(this, ViewImageActivity.class); + Intent intent = new Intent(this, ViewImageOrGifActivity.class); String url = uri.toString(); String fileName = url.substring(url.lastIndexOf('/') + 1); - intent.putExtra(ViewImageActivity.IMAGE_URL_KEY, url); - intent.putExtra(ViewImageActivity.FILE_NAME_KEY, fileName); - intent.putExtra(ViewImageActivity.POST_TITLE_KEY, fileName); + intent.putExtra(ViewImageOrGifActivity.IMAGE_URL_KEY, url); + intent.putExtra(ViewImageOrGifActivity.FILE_NAME_KEY, fileName); + intent.putExtra(ViewImageOrGifActivity.POST_TITLE_KEY, fileName); startActivity(intent); } else if (path.endsWith("gif")) { - Intent intent = new Intent(this, ViewGIFActivity.class); + Intent intent = new Intent(this, ViewImageOrGifActivity.class); String url = uri.toString(); String fileName = url.substring(url.lastIndexOf('/') + 1); - intent.putExtra(ViewGIFActivity.GIF_URL_KEY, url); - intent.putExtra(ViewGIFActivity.FILE_NAME_KEY, fileName); - intent.putExtra(ViewGIFActivity.POST_TITLE_KEY, fileName); + intent.putExtra(ViewImageOrGifActivity.GIF_URL_KEY, url); + intent.putExtra(ViewImageOrGifActivity.FILE_NAME_KEY, fileName); + intent.putExtra(ViewImageOrGifActivity.POST_TITLE_KEY, fileName); startActivity(intent); } else if (path.endsWith("mp4")) { Intent intent = new Intent(this, ViewVideoActivity.class); @@ -159,8 +159,9 @@ public class LinkResolverActivity extends AppCompatActivity { intent.putExtra(ViewUserDetailActivity.EXTRA_NEW_ACCOUNT_NAME, newAccountName); startActivity(intent); } else if (path.matches(SIDEBAR_PATTERN)) { - Intent intent = new Intent(this, ViewSidebarActivity.class); - intent.putExtra(ViewSidebarActivity.EXTRA_SUBREDDIT_NAME, path.substring(3, path.length() - 14)); + Intent intent = new Intent(this, ViewSubredditDetailActivity.class); + intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, path.substring(3, path.length() - 14)); + intent.putExtra(ViewSubredditDetailActivity.EXTRA_VIEW_SIDEBAR, true); startActivity(intent); } else if (path.matches(MULTIREDDIT_PATTERN)) { Intent intent = new Intent(this, ViewMultiRedditDetailActivity.class); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LoginActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LoginActivity.java index 7f03f302..0fa06f4f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LoginActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/LoginActivity.java @@ -6,6 +6,8 @@ import android.content.SharedPreferences; import android.graphics.Bitmap; import android.net.Uri; import android.os.Bundle; +import android.util.Log; +import android.view.InflateException; import android.view.MenuItem; import android.webkit.CookieManager; import android.webkit.WebView; @@ -16,6 +18,7 @@ import androidx.annotation.NonNull; import androidx.appcompat.widget.Toolbar; import com.google.android.material.appbar.AppBarLayout; +import com.r0adkll.slidr.Slidr; import org.json.JSONException; import org.json.JSONObject; @@ -37,6 +40,7 @@ import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.API.RedditAPI; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; import ml.docilealligator.infinityforreddit.Utils.APIUtils; +import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; @@ -70,12 +74,23 @@ public class LoginActivity extends BaseActivity { ((Infinity) getApplication()).getAppComponent().inject(this); super.onCreate(savedInstanceState); - setContentView(R.layout.activity_login); + try { + setContentView(R.layout.activity_login); + } catch (InflateException ie) { + Log.e("LoginActivity", "Failed to inflate LoginActivity: " + ie.getMessage()); + Toast.makeText(LoginActivity.this, R.string.no_system_webview_error, Toast.LENGTH_SHORT).show(); + finish(); + return; + } ButterKnife.bind(this); applyCustomTheme(); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK_FROM_POST_DETAIL, true)) { + Slidr.attach(this); + } + setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java index 14c12d2e..d1e9af09 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java @@ -64,6 +64,10 @@ import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask import ml.docilealligator.infinityforreddit.AsyncTask.InsertSubscribedThingsAsyncTask; import ml.docilealligator.infinityforreddit.AsyncTask.SwitchAccountAsyncTask; import ml.docilealligator.infinityforreddit.AsyncTask.SwitchToAnonymousAccountAsyncTask; +import ml.docilealligator.infinityforreddit.BottomSheetFragment.PostLayoutBottomSheetFragment; +import ml.docilealligator.infinityforreddit.BottomSheetFragment.PostTypeBottomSheetFragment; +import ml.docilealligator.infinityforreddit.BottomSheetFragment.SortTimeBottomSheetFragment; +import ml.docilealligator.infinityforreddit.BottomSheetFragment.SortTypeBottomSheetFragment; import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.Event.ChangeConfirmToExitEvent; import ml.docilealligator.infinityforreddit.Event.ChangeLockBottomAppBarEvent; @@ -73,10 +77,6 @@ import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent; import ml.docilealligator.infinityforreddit.FetchMyInfo; import ml.docilealligator.infinityforreddit.FetchSubscribedThing; import ml.docilealligator.infinityforreddit.Fragment.PostFragment; -import ml.docilealligator.infinityforreddit.BottomSheetFragment.PostLayoutBottomSheetFragment; -import ml.docilealligator.infinityforreddit.BottomSheetFragment.PostTypeBottomSheetFragment; -import ml.docilealligator.infinityforreddit.BottomSheetFragment.SortTimeBottomSheetFragment; -import ml.docilealligator.infinityforreddit.BottomSheetFragment.SortTypeBottomSheetFragment; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.ParseAndSaveAccountInfo; import ml.docilealligator.infinityforreddit.Post.PostDataSource; @@ -321,7 +321,8 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb private void getCurrentAccountAndBindView() { new GetCurrentAccountAsyncTask(mRedditDataRoomDatabase.accountDao(), account -> { boolean enableNotification = mSharedPreferences.getBoolean(SharedPreferencesUtils.ENABLE_NOTIFICATION_KEY, true); - String notificationInterval = mSharedPreferences.getString(SharedPreferencesUtils.NOTIFICATION_INTERVAL_KEY, "1"); + long notificationInterval = Long.parseLong(mSharedPreferences.getString(SharedPreferencesUtils.NOTIFICATION_INTERVAL_KEY, "1")); + TimeUnit timeUnit = notificationInterval == 15 || notificationInterval == 30 ? TimeUnit.MINUTES : TimeUnit.HOURS; WorkManager workManager = WorkManager.getInstance(this); @@ -349,7 +350,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb PeriodicWorkRequest pullNotificationRequest = new PeriodicWorkRequest.Builder(PullNotificationWorker.class, - Long.parseLong(notificationInterval), TimeUnit.HOURS) + notificationInterval, timeUnit) .setConstraints(constraints) .build(); @@ -375,7 +376,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb PeriodicWorkRequest pullNotificationRequest = new PeriodicWorkRequest.Builder(PullNotificationWorker.class, - Long.parseLong(notificationInterval), TimeUnit.HOURS) + notificationInterval, timeUnit) .setConstraints(constraints) .build(); @@ -405,7 +406,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb PeriodicWorkRequest pullNotificationRequest = new PeriodicWorkRequest.Builder(PullNotificationWorker.class, - Long.parseLong(notificationInterval), TimeUnit.HOURS) + notificationInterval, timeUnit) .setConstraints(constraints) .build(); @@ -583,11 +584,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb viewPager.setOffscreenPageLimit(3); tabLayout.setupWithViewPager(viewPager); - viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { - @Override - public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { - } - + viewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { if (mAccessToken != null) { @@ -605,10 +602,6 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb } sectionsPagerAdapter.displaySortTypeInToolbar(); } - - @Override - public void onPageScrollStateChanged(int state) { - } }); loadSubscriptions(); @@ -1366,9 +1359,17 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb void goBackToTop() { if (viewPager.getCurrentItem() == 0) { - tab1.goBackToTop(); + if (mAccessToken != null && tab1 != null) { + tab1.goBackToTop(); + } else if (tab2 != null) { + tab2.goBackToTop(); + } } else if (viewPager.getCurrentItem() == 1) { - tab2.goBackToTop(); + if (mAccessToken != null && tab2 != null) { + tab2.goBackToTop(); + } else if (tab3 != null) { + tab3.goBackToTop(); + } } else { tab3.goBackToTop(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MultiRedditListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MultiRedditListingActivity.java index 2ef1d14f..e636572d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MultiRedditListingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MultiRedditListingActivity.java @@ -26,8 +26,7 @@ import com.bumptech.glide.RequestManager; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.floatingactionbutton.FloatingActionButton; - -import org.greenrobot.eventbus.Subscribe; +import com.r0adkll.slidr.Slidr; import java.util.ArrayList; @@ -41,7 +40,6 @@ import ml.docilealligator.infinityforreddit.Adapter.MultiRedditListingRecyclerVi import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask; import ml.docilealligator.infinityforreddit.AsyncTask.InsertMultiRedditAsyncTask; import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper; -import ml.docilealligator.infinityforreddit.Event.RefreshMultiRedditsEvent; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.MultiReddit.DeleteMultiReddit; import ml.docilealligator.infinityforreddit.MultiReddit.FetchMyMultiReddits; @@ -49,6 +47,7 @@ import ml.docilealligator.infinityforreddit.MultiReddit.MultiReddit; import ml.docilealligator.infinityforreddit.MultiReddit.MultiRedditViewModel; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import retrofit2.Retrofit; public class MultiRedditListingActivity extends BaseActivity { @@ -105,6 +104,10 @@ public class MultiRedditListingActivity extends BaseActivity { applyCustomTheme(); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK_FROM_POST_DETAIL, true)) { + Slidr.attach(this); + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { Window window = getWindow(); @@ -292,8 +295,8 @@ public class MultiRedditListingActivity extends BaseActivity { .show(); } - @Subscribe + /*@Subscribe public void onRefreshMultiRedditsEvent(RefreshMultiRedditsEvent event) { loadMultiReddits(); - } + }*/ } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostImageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostImageActivity.java index 0bfbc20e..07952f79 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostImageActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostImageActivity.java @@ -32,6 +32,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.snackbar.Snackbar; import com.libRG.CustomTextView; +import com.r0adkll.slidr.Slidr; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -56,6 +57,7 @@ import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; import ml.docilealligator.infinityforreddit.Service.SubmitPostService; +import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import pl.droidsonroids.gif.GifImageView; import retrofit2.Retrofit; @@ -175,6 +177,10 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF applyCustomTheme(); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK_FROM_POST_DETAIL, true)) { + Slidr.attach(this); + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isChangeStatusBarIconColor()) { addOnOffsetChangedListener(appBarLayout); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostLinkActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostLinkActivity.java index 5edb7c8f..c041f64e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostLinkActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostLinkActivity.java @@ -25,6 +25,7 @@ import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.snackbar.Snackbar; import com.libRG.CustomTextView; +import com.r0adkll.slidr.Slidr; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -47,6 +48,7 @@ import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; import ml.docilealligator.infinityforreddit.Service.SubmitPostService; import ml.docilealligator.infinityforreddit.Utils.APIUtils; +import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import pl.droidsonroids.gif.GifImageView; import retrofit2.Retrofit; @@ -150,6 +152,10 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr applyCustomTheme(); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK_FROM_POST_DETAIL, true)) { + Slidr.attach(this); + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isChangeStatusBarIconColor()) { addOnOffsetChangedListener(appBarLayout); } @@ -541,7 +547,7 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr } else { mMemu.findItem(R.id.action_send_post_link_activity).setEnabled(true); mMemu.findItem(R.id.action_send_post_link_activity).getIcon().setAlpha(255); - if (submitTextOrLinkPostEvent.errorMessage == null) { + if (submitTextOrLinkPostEvent.errorMessage == null || submitTextOrLinkPostEvent.errorMessage.equals("")) { Snackbar.make(coordinatorLayout, R.string.post_failed, Snackbar.LENGTH_SHORT).show(); } else { Snackbar.make(coordinatorLayout, submitTextOrLinkPostEvent.errorMessage.substring(0, 1).toUpperCase() diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostTextActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostTextActivity.java index 29b0256f..a3e3accc 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostTextActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostTextActivity.java @@ -25,6 +25,7 @@ import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.snackbar.Snackbar; import com.libRG.CustomTextView; +import com.r0adkll.slidr.Slidr; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -47,6 +48,7 @@ import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; import ml.docilealligator.infinityforreddit.Service.SubmitPostService; import ml.docilealligator.infinityforreddit.Utils.APIUtils; +import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import pl.droidsonroids.gif.GifImageView; import retrofit2.Retrofit; @@ -150,6 +152,10 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr applyCustomTheme(); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK_FROM_POST_DETAIL, true)) { + Slidr.attach(this); + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isChangeStatusBarIconColor()) { addOnOffsetChangedListener(appBarLayout); } @@ -541,7 +547,7 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr } else { mMemu.findItem(R.id.action_send_post_text_activity).setEnabled(true); mMemu.findItem(R.id.action_send_post_text_activity).getIcon().setAlpha(255); - if (submitTextOrLinkPostEvent.errorMessage == null) { + if (submitTextOrLinkPostEvent.errorMessage == null || submitTextOrLinkPostEvent.errorMessage.equals("")) { Snackbar.make(coordinatorLayout, R.string.post_failed, Snackbar.LENGTH_SHORT).show(); } else { Snackbar.make(coordinatorLayout, submitTextOrLinkPostEvent.errorMessage.substring(0, 1).toUpperCase() diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostVideoActivity.java index 386032a7..68068775 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostVideoActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/PostVideoActivity.java @@ -37,6 +37,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.snackbar.Snackbar; import com.libRG.CustomTextView; +import com.r0adkll.slidr.Slidr; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -58,6 +59,7 @@ import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; import ml.docilealligator.infinityforreddit.Service.SubmitPostService; +import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import pl.droidsonroids.gif.GifImageView; import retrofit2.Retrofit; @@ -183,6 +185,10 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF applyCustomTheme(); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK_FROM_POST_DETAIL, true)) { + Slidr.attach(this); + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isChangeStatusBarIconColor()) { addOnOffsetChangedListener(appBarLayout); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ReportActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ReportActivity.java index 4e3a0738..b816b505 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ReportActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ReportActivity.java @@ -15,6 +15,7 @@ import androidx.recyclerview.widget.RecyclerView; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.snackbar.Snackbar; +import com.r0adkll.slidr.Slidr; import java.util.ArrayList; @@ -33,6 +34,7 @@ import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; import ml.docilealligator.infinityforreddit.ReportReason; import ml.docilealligator.infinityforreddit.ReportThing; import ml.docilealligator.infinityforreddit.Rule; +import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import retrofit2.Retrofit; public class ReportActivity extends BaseActivity { @@ -86,6 +88,10 @@ public class ReportActivity extends BaseActivity { applyCustomTheme(); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK_FROM_POST_DETAIL, true)) { + Slidr.attach(this); + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isChangeStatusBarIconColor()) { addOnOffsetChangedListener(appBarLayout); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/RulesActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/RulesActivity.java index 2c5cb05c..f90dedf3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/RulesActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/RulesActivity.java @@ -18,6 +18,7 @@ import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.google.android.material.appbar.AppBarLayout; +import com.r0adkll.slidr.Slidr; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -36,6 +37,7 @@ import ml.docilealligator.infinityforreddit.FetchRules; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.Rule; +import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import retrofit2.Retrofit; public class RulesActivity extends BaseActivity { @@ -79,6 +81,10 @@ public class RulesActivity extends BaseActivity { applyCustomTheme(); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK_FROM_POST_DETAIL, true)) { + Slidr.attach(this); + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { Window window = getWindow(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchActivity.java index 0160401a..8b603451 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchActivity.java @@ -20,6 +20,7 @@ import androidx.coordinatorlayout.widget.CoordinatorLayout; import com.ferfalk.simplesearchview.SimpleSearchView; import com.google.android.material.appbar.AppBarLayout; +import com.r0adkll.slidr.Slidr; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -33,6 +34,7 @@ import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; public class SearchActivity extends BaseActivity { @@ -86,6 +88,10 @@ public class SearchActivity extends BaseActivity { applyCustomTheme(); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK_FROM_POST_DETAIL, true)) { + Slidr.attach(this); + } + setSupportActionBar(toolbar); boolean searchOnlySubreddits = getIntent().getBooleanExtra(EXTRA_SEARCH_ONLY_SUBREDDITS, false); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchResultActivity.java index 764c065c..5ea80f8f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchResultActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchResultActivity.java @@ -21,6 +21,8 @@ import androidx.viewpager.widget.ViewPager; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.tabs.TabLayout; +import com.r0adkll.slidr.Slidr; +import com.r0adkll.slidr.model.SlidrInterface; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -93,6 +95,7 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect private SortTimeBottomSheetFragment sortTimeBottomSheetFragment; private SearchUserAndSubredditSortTypeBottomSheetFragment searchUserAndSubredditSortTypeBottomSheetFragment; private PostLayoutBottomSheetFragment postLayoutBottomSheetFragment; + private SlidrInterface mSlidrInterface; @Override protected void onCreate(Bundle savedInstanceState) { @@ -108,6 +111,10 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect applyCustomTheme(); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK_FROM_POST_DETAIL, true)) { + mSlidrInterface = Slidr.attach(this); + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { Window window = getWindow(); @@ -201,18 +208,15 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect sectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); viewPager.setAdapter(sectionsPagerAdapter); viewPager.setOffscreenPageLimit(2); - viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { - @Override - public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { - } - + viewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { sectionsPagerAdapter.displaySortTypeInToolbar(); - } - - @Override - public void onPageScrollStateChanged(int state) { + if (position == 0) { + unlockSwipeRightToGoBack(); + } else { + lockSwipeRightToGoBack(); + } } }); tabLayout.setupWithViewPager(viewPager); @@ -497,4 +501,16 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect } } } + + private void lockSwipeRightToGoBack() { + if (mSlidrInterface != null) { + mSlidrInterface.lock(); + } + } + + private void unlockSwipeRightToGoBack() { + if (mSlidrInterface != null) { + mSlidrInterface.unlock(); + } + } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchSubredditsResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchSubredditsResultActivity.java index 092cd5d8..b7b2730d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchSubredditsResultActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SearchSubredditsResultActivity.java @@ -15,6 +15,7 @@ import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.fragment.app.Fragment; import com.google.android.material.appbar.AppBarLayout; +import com.r0adkll.slidr.Slidr; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -32,6 +33,7 @@ import ml.docilealligator.infinityforreddit.Fragment.SubredditListingFragment; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; public class SearchSubredditsResultActivity extends BaseActivity implements ActivityToolbarInterface { @@ -76,6 +78,10 @@ public class SearchSubredditsResultActivity extends BaseActivity implements Acti applyCustomTheme(); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK_FROM_POST_DETAIL, true)) { + Slidr.attach(this); + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { Window window = getWindow(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SelectedSubredditsActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SelectedSubredditsActivity.java index 96bbabdb..3d17ecbf 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SelectedSubredditsActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SelectedSubredditsActivity.java @@ -16,6 +16,7 @@ import androidx.recyclerview.widget.RecyclerView; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.floatingactionbutton.FloatingActionButton; +import com.r0adkll.slidr.Slidr; import java.util.ArrayList; @@ -29,6 +30,7 @@ import ml.docilealligator.infinityforreddit.Adapter.SelectedSubredditsRecyclerVi import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; public class SelectedSubredditsActivity extends BaseActivity implements ActivityToolbarInterface { @@ -63,8 +65,13 @@ public class SelectedSubredditsActivity extends BaseActivity implements Activity setContentView(R.layout.activity_selected_subreddits); ButterKnife.bind(this); + applyCustomTheme(); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK_FROM_POST_DETAIL, true)) { + Slidr.attach(this); + } + setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); setToolbarGoToTop(toolbar); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SettingsActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SettingsActivity.java index ef91f34a..3c50caf8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SettingsActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SettingsActivity.java @@ -26,6 +26,7 @@ import ml.docilealligator.infinityforreddit.Event.RecreateActivityEvent; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.Settings.AboutPreferenceFragment; +import ml.docilealligator.infinityforreddit.Settings.FontPreferenceFragment; import ml.docilealligator.infinityforreddit.Settings.InterfacePreferenceFragment; import ml.docilealligator.infinityforreddit.Settings.MainPreferenceFragment; @@ -83,6 +84,8 @@ public class SettingsActivity extends BaseActivity implements setTitle(R.string.settings_about_master_title); } else if (getSupportFragmentManager().findFragmentById(R.id.frame_layout_settings_activity) instanceof InterfacePreferenceFragment) { setTitle(R.string.settings_interface_title); + } else if (getSupportFragmentManager().findFragmentById(R.id.frame_layout_settings_activity) instanceof FontPreferenceFragment) { + setTitle(R.string.settings_font_title); } }); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditMultiselectionActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditMultiselectionActivity.java index d464ecec..88825dc5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditMultiselectionActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditMultiselectionActivity.java @@ -26,6 +26,7 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import com.bumptech.glide.Glide; import com.bumptech.glide.RequestManager; import com.google.android.material.appbar.AppBarLayout; +import com.r0adkll.slidr.Slidr; import java.util.ArrayList; @@ -42,6 +43,7 @@ import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; import ml.docilealligator.infinityforreddit.SubscribedSubredditDatabase.SubscribedSubredditViewModel; +import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import retrofit2.Retrofit; public class SubredditMultiselectionActivity extends BaseActivity implements ActivityToolbarInterface { @@ -86,6 +88,7 @@ public class SubredditMultiselectionActivity extends BaseActivity implements Act private LinearLayoutManager mLinearLayoutManager; private SubredditMultiselectionRecyclerViewAdapter mAdapter; private RequestManager mGlide; + @Override protected void onCreate(Bundle savedInstanceState) { ((Infinity) getApplication()).getAppComponent().inject(this); @@ -96,6 +99,10 @@ public class SubredditMultiselectionActivity extends BaseActivity implements Act applyCustomTheme(); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK_FROM_POST_DETAIL, true)) { + Slidr.attach(this); + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { Window window = getWindow(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditSelectionActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditSelectionActivity.java index f48cb952..b6aa045d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditSelectionActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubredditSelectionActivity.java @@ -17,6 +17,7 @@ import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.fragment.app.Fragment; import com.google.android.material.appbar.AppBarLayout; +import com.r0adkll.slidr.Slidr; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -41,6 +42,7 @@ import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditData; import ml.docilealligator.infinityforreddit.SubscribedSubredditDatabase.SubscribedSubredditData; import ml.docilealligator.infinityforreddit.SubscribedUserDatabase.SubscribedUserData; +import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import retrofit2.Retrofit; public class SubredditSelectionActivity extends BaseActivity implements ActivityToolbarInterface { @@ -95,6 +97,10 @@ public class SubredditSelectionActivity extends BaseActivity implements Activity applyCustomTheme(); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK_FROM_POST_DETAIL, true)) { + Slidr.attach(this); + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { Window window = getWindow(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubscribedThingListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubscribedThingListingActivity.java index c1919782..994d19e7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubscribedThingListingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/SubscribedThingListingActivity.java @@ -18,7 +18,10 @@ import androidx.fragment.app.FragmentPagerAdapter; import androidx.viewpager.widget.ViewPager; import com.google.android.material.appbar.AppBarLayout; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.tabs.TabLayout; +import com.r0adkll.slidr.Slidr; +import com.r0adkll.slidr.model.SlidrInterface; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -36,6 +39,7 @@ import ml.docilealligator.infinityforreddit.AsyncTask.InsertMultiRedditAsyncTask import ml.docilealligator.infinityforreddit.AsyncTask.InsertSubscribedThingsAsyncTask; import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.Event.GoBackToMainPageEvent; +import ml.docilealligator.infinityforreddit.Event.RefreshMultiRedditsEvent; import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent; import ml.docilealligator.infinityforreddit.FetchSubscribedThing; import ml.docilealligator.infinityforreddit.Fragment.FollowedUsersListingFragment; @@ -43,6 +47,7 @@ import ml.docilealligator.infinityforreddit.Fragment.MultiRedditListingFragment; import ml.docilealligator.infinityforreddit.Fragment.SubscribedSubredditsListingFragment; import ml.docilealligator.infinityforreddit.FragmentCommunicator; import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.MultiReddit.DeleteMultiReddit; import ml.docilealligator.infinityforreddit.MultiReddit.FetchMyMultiReddits; import ml.docilealligator.infinityforreddit.MultiReddit.MultiReddit; import ml.docilealligator.infinityforreddit.R; @@ -50,6 +55,7 @@ import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditData; import ml.docilealligator.infinityforreddit.SubscribedSubredditDatabase.SubscribedSubredditData; import ml.docilealligator.infinityforreddit.SubscribedUserDatabase.SubscribedUserData; +import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import retrofit2.Retrofit; public class SubscribedThingListingActivity extends BaseActivity implements ActivityToolbarInterface { @@ -81,6 +87,7 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti SharedPreferences mSharedPreferences; @Inject CustomThemeWrapper mCustomThemeWrapper; + private SlidrInterface mSlidrInterface; private boolean mNullAccessToken = false; private String mAccessToken; private String mAccountName; @@ -103,6 +110,10 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti applyCustomTheme(); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK_FROM_POST_DETAIL, true)) { + mSlidrInterface = Slidr.attach(this); + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { Window window = getWindow(); @@ -170,6 +181,16 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti sectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); viewPager.setAdapter(sectionsPagerAdapter); viewPager.setOffscreenPageLimit(3); + viewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { + @Override + public void onPageSelected(int position) { + if (position == 0) { + unlockSwipeRightToGoBack(); + } else { + lockSwipeRightToGoBack(); + } + } + }); tabLayout.setupWithViewPager(viewPager); if (showMultiReddits) { @@ -261,6 +282,30 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti }); } + public void deleteMultiReddit(MultiReddit multiReddit) { + new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme) + .setTitle(R.string.delete) + .setMessage(R.string.delete_multi_reddit_dialog_message) + .setPositiveButton(R.string.delete, (dialogInterface, i) + -> DeleteMultiReddit.deleteMultiReddit(mOauthRetrofit, mRedditDataRoomDatabase, + mAccessToken, mAccountName, multiReddit.getPath(), new DeleteMultiReddit.DeleteMultiRedditListener() { + @Override + public void success() { + Toast.makeText(SubscribedThingListingActivity.this, + R.string.delete_multi_reddit_success, Toast.LENGTH_SHORT).show(); + loadMultiReddits(); + } + + @Override + public void failed() { + Toast.makeText(SubscribedThingListingActivity.this, + R.string.delete_multi_reddit_failed, Toast.LENGTH_SHORT).show(); + } + })) + .setNegativeButton(R.string.cancel, null) + .show(); + } + @Subscribe public void onAccountSwitchEvent(SwitchAccountEvent event) { finish(); @@ -271,6 +316,11 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti finish(); } + @Subscribe + public void onRefreshMultiRedditsEvent(RefreshMultiRedditsEvent event) { + loadMultiReddits(); + } + @Override public void onLongPress() { if (sectionsPagerAdapter != null) { @@ -278,6 +328,18 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti } } + private void lockSwipeRightToGoBack() { + if (mSlidrInterface != null) { + mSlidrInterface.lock(); + } + } + + private void unlockSwipeRightToGoBack() { + if (mSlidrInterface != null) { + mSlidrInterface.unlock(); + } + } + private class SectionsPagerAdapter extends FragmentPagerAdapter { private SubscribedSubredditsListingFragment subscribedSubredditsListingFragment; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ThemePreviewActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ThemePreviewActivity.java index c9a08f48..ed20127b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ThemePreviewActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ThemePreviewActivity.java @@ -32,6 +32,7 @@ import com.google.android.material.bottomappbar.BottomAppBar; import com.google.android.material.chip.Chip; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.tabs.TabLayout; +import com.r0adkll.slidr.Slidr; import java.util.ArrayList; @@ -41,15 +42,15 @@ import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.AppBarStateChangeListener; -import ml.docilealligator.infinityforreddit.ContentFontStyle; import ml.docilealligator.infinityforreddit.CustomTheme.CustomTheme; import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeSettingsItem; -import ml.docilealligator.infinityforreddit.FontStyle; +import ml.docilealligator.infinityforreddit.Font.ContentFontStyle; +import ml.docilealligator.infinityforreddit.Font.FontStyle; +import ml.docilealligator.infinityforreddit.Font.TitleFontStyle; import ml.docilealligator.infinityforreddit.Fragment.ThemePreviewCommentsFragment; import ml.docilealligator.infinityforreddit.Fragment.ThemePreviewPostsFragment; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.TitleFontStyle; import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY; @@ -133,7 +134,7 @@ public class ThemePreviewActivity extends AppCompatActivity { break; case 1: AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_YES); - if(mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) { + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) { getTheme().applyStyle(R.style.Theme_Normal_AmoledDark, true); } else { getTheme().applyStyle(R.style.Theme_Normal_NormalDark, true); @@ -145,10 +146,10 @@ public class ThemePreviewActivity extends AppCompatActivity { } else { AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO_BATTERY); } - if((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_NO) { + if ((getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_NO) { getTheme().applyStyle(R.style.Theme_Normal, true); } else { - if(mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) { + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.AMOLED_DARK_KEY, false)) { getTheme().applyStyle(R.style.Theme_Normal_AmoledDark, true); } else { getTheme().applyStyle(R.style.Theme_Normal_NormalDark, true); @@ -215,8 +216,13 @@ public class ThemePreviewActivity extends AppCompatActivity { setContentView(R.layout.activity_theme_preview); ButterKnife.bind(this); + applyCustomTheme(); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK_FROM_POST_DETAIL, true)) { + Slidr.attach(this); + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (immersiveInterface) { window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); @@ -354,10 +360,9 @@ public class ThemePreviewActivity extends AppCompatActivity { params.topMargin = statusBarHeight; toolbar.setLayoutParams(params); TypedValue tv = new TypedValue(); - if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) - { - ((ViewGroup.MarginLayoutParams)linearLayout.getLayoutParams()).setMargins(0, - TypedValue.complexToDimensionPixelSize(tv.data,getResources().getDisplayMetrics()) + statusBarHeight, 0, 0); + if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) { + ((ViewGroup.MarginLayoutParams) linearLayout.getLayoutParams()).setMargins(0, + TypedValue.complexToDimensionPixelSize(tv.data, getResources().getDisplayMetrics()) + statusBarHeight, 0, 0); } } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewGIFActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewGIFActivity.java deleted file mode 100644 index 8bdc82fe..00000000 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewGIFActivity.java +++ /dev/null @@ -1,307 +0,0 @@ -package ml.docilealligator.infinityforreddit.Activity; - -import android.Manifest; -import android.app.DownloadManager; -import android.content.Context; -import android.content.Intent; -import android.content.SharedPreferences; -import android.content.pm.PackageManager; -import android.graphics.drawable.ColorDrawable; -import android.graphics.drawable.Drawable; -import android.net.Uri; -import android.os.Build; -import android.os.Bundle; -import android.os.Environment; -import android.text.Html; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; -import android.widget.LinearLayout; -import android.widget.ProgressBar; -import android.widget.Toast; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.appcompat.app.ActionBar; -import androidx.appcompat.app.AppCompatActivity; -import androidx.core.app.ActivityCompat; -import androidx.core.content.ContextCompat; -import androidx.core.content.FileProvider; - -import com.bumptech.glide.Glide; -import com.bumptech.glide.RequestManager; -import com.bumptech.glide.load.DataSource; -import com.bumptech.glide.load.engine.GlideException; -import com.bumptech.glide.load.resource.gif.GifDrawable; -import com.bumptech.glide.request.RequestListener; -import com.bumptech.glide.request.RequestOptions; -import com.bumptech.glide.request.target.Target; -import com.thefuntasty.hauler.HaulerView; - -import java.io.File; - -import javax.inject.Inject; -import javax.inject.Named; - -import butterknife.BindView; -import butterknife.ButterKnife; -import ml.docilealligator.infinityforreddit.AsyncTask.SaveGIFToFileAsyncTask; -import ml.docilealligator.infinityforreddit.BuildConfig; -import ml.docilealligator.infinityforreddit.ContentFontStyle; -import ml.docilealligator.infinityforreddit.FontStyle; -import ml.docilealligator.infinityforreddit.Infinity; -import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.TitleFontStyle; -import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; -import pl.droidsonroids.gif.GifImageView; - -public class ViewGIFActivity extends AppCompatActivity { - - public static final String GIF_URL_KEY = "GUK"; - public static final String FILE_NAME_KEY = "FNK"; - public static final String POST_TITLE_KEY = "PTK"; - private static final int PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE = 0; - @BindView(R.id.hauler_view_view_gif_activity) - HaulerView mHaulerView; - @BindView(R.id.progress_bar_view_gif_activity) - ProgressBar mProgressBar; - @BindView(R.id.image_view_view_gif_activity) - GifImageView mImageView; - @BindView(R.id.load_image_error_linear_layout_view_gif_activity) - LinearLayout mLoadErrorLinearLayout; - @Inject - @Named("default") - SharedPreferences mSharedPreferences; - private boolean isActionBarHidden = false; - private boolean isDownloading = false; - private RequestManager glide; - private String mImageUrl; - private String mImageFileName; - private boolean isSwiping = false; - private String postTitle; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - ((Infinity) getApplication()).getAppComponent().inject(this); - - getTheme().applyStyle(R.style.Theme_Normal, true); - - getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences - .getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true); - - getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences - .getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true); - - getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences - .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); - - setContentView(R.layout.activity_view_gif); - - ButterKnife.bind(this); - - ActionBar actionBar = getSupportActionBar(); - Drawable upArrow = getResources().getDrawable(R.drawable.ic_arrow_back_white_24dp); - actionBar.setHomeAsUpIndicator(upArrow); - actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.transparentActionBarAndExoPlayerControllerColor))); - - mHaulerView.setOnDragDismissedListener(dragDirection -> finish()); - - glide = Glide.with(this); - - Intent intent = getIntent(); - mImageUrl = intent.getStringExtra(GIF_URL_KEY); - mImageFileName = intent.getStringExtra(FILE_NAME_KEY); - postTitle = intent.getStringExtra(POST_TITLE_KEY); - - if (postTitle != null) { - setTitle(Html.fromHtml(String.format("<small>%s</small>", postTitle))); - } else { - setTitle(""); - } - - mLoadErrorLinearLayout.setOnClickListener(view -> { - if (!isSwiping) { - mProgressBar.setVisibility(View.VISIBLE); - mLoadErrorLinearLayout.setVisibility(View.GONE); - loadImage(); - } - }); - - loadImage(); - - mImageView.setOnClickListener(view -> { - if (isActionBarHidden) { - getWindow().getDecorView().setSystemUiVisibility( - View.SYSTEM_UI_FLAG_LAYOUT_STABLE - | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION - | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); - isActionBarHidden = false; - } else { - getWindow().getDecorView().setSystemUiVisibility( - View.SYSTEM_UI_FLAG_LAYOUT_STABLE - | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION - | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN - | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION - | View.SYSTEM_UI_FLAG_FULLSCREEN - | View.SYSTEM_UI_FLAG_IMMERSIVE); - isActionBarHidden = true; - } - }); - } - - private void loadImage() { - glide.load(mImageUrl).listener(new RequestListener<Drawable>() { - @Override - public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) { - mProgressBar.setVisibility(View.GONE); - mLoadErrorLinearLayout.setVisibility(View.VISIBLE); - return false; - } - - @Override - public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) { - mProgressBar.setVisibility(View.GONE); - return false; - } - }).apply(new RequestOptions().fitCenter()).into(mImageView); - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - getMenuInflater().inflate(R.menu.view_gif_activity, menu); - return true; - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - switch (item.getItemId()) { - case android.R.id.home: - finish(); - return true; - case R.id.action_download_view_gif_activity: - if (isDownloading) { - return false; - } - - isDownloading = true; - - if (Build.VERSION.SDK_INT >= 23) { - if (ContextCompat.checkSelfPermission(this, - Manifest.permission.WRITE_EXTERNAL_STORAGE) - != PackageManager.PERMISSION_GRANTED) { - - // Permission is not granted - // No explanation needed; request the permission - ActivityCompat.requestPermissions(this, - new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, - PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE); - } else { - // Permission has already been granted - download(); - } - } else { - download(); - } - - return true; - case R.id.action_share_view_gif_activity: - Toast.makeText(ViewGIFActivity.this, R.string.save_gif_before_sharing, Toast.LENGTH_SHORT).show(); - glide.asGif().load(mImageUrl).listener(new RequestListener<GifDrawable>() { - @Override - public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<GifDrawable> target, boolean isFirstResource) { - return false; - } - - @Override - public boolean onResourceReady(GifDrawable resource, Object model, Target<GifDrawable> target, DataSource dataSource, boolean isFirstResource) { - if (getExternalCacheDir() != null) { - new SaveGIFToFileAsyncTask(resource, getExternalCacheDir().getPath(), mImageFileName, - new SaveGIFToFileAsyncTask.SaveGIFToFileAsyncTaskListener() { - @Override - public void saveSuccess(File imageFile) { - Uri uri = FileProvider.getUriForFile(ViewGIFActivity.this, - BuildConfig.APPLICATION_ID + ".provider", imageFile); - Intent shareIntent = new Intent(); - shareIntent.setAction(Intent.ACTION_SEND); - shareIntent.putExtra(Intent.EXTRA_STREAM, uri); - shareIntent.setType("image/*"); - shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); - startActivity(Intent.createChooser(shareIntent, getString(R.string.share))); - } - - @Override - public void saveFailed() { - Toast.makeText(ViewGIFActivity.this, - R.string.cannot_save_gif, Toast.LENGTH_SHORT).show(); - } - }).execute(); - } else { - Toast.makeText(ViewGIFActivity.this, - R.string.cannot_get_storage, Toast.LENGTH_SHORT).show(); - } - return false; - } - }).submit(); - return true; - } - - return false; - } - - @Override - public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { - if (requestCode == PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE && grantResults.length > 0) { - if (grantResults[0] == PackageManager.PERMISSION_DENIED) { - Toast.makeText(this, R.string.no_storage_permission, Toast.LENGTH_SHORT).show(); - } else if (grantResults[0] == PackageManager.PERMISSION_GRANTED && isDownloading) { - download(); - } - isDownloading = false; - } - } - - private void download() { - DownloadManager.Request request = new DownloadManager.Request(Uri.parse(mImageUrl)); - request.setTitle(mImageFileName); - - request.allowScanningByMediaScanner(); - request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); - - //Android Q support - if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - request.setDestinationInExternalPublicDir(Environment.DIRECTORY_PICTURES, mImageFileName); - } else { - String path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).toString(); - File directory = new File(path + "/Infinity/"); - boolean saveToInfinityFolder = true; - if (!directory.exists()) { - if (!directory.mkdir()) { - saveToInfinityFolder = false; - } - } else { - if (directory.isFile()) { - if (!(directory.delete() && directory.mkdir())) { - saveToInfinityFolder = false; - } - } - } - - if (saveToInfinityFolder) { - request.setDestinationInExternalPublicDir(Environment.DIRECTORY_PICTURES + "/Infinity/", mImageFileName); - } else { - request.setDestinationInExternalPublicDir(Environment.DIRECTORY_PICTURES, mImageFileName); - } - } - - DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE); - - if (manager == null) { - Toast.makeText(this, R.string.download_failed, Toast.LENGTH_SHORT).show(); - return; - } - - manager.enqueue(request); - Toast.makeText(this, R.string.download_started, Toast.LENGTH_SHORT).show(); - } -} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageActivity.java deleted file mode 100644 index 779d7fe7..00000000 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageActivity.java +++ /dev/null @@ -1,308 +0,0 @@ -package ml.docilealligator.infinityforreddit.Activity; - -import android.Manifest; -import android.app.DownloadManager; -import android.content.Context; -import android.content.Intent; -import android.content.SharedPreferences; -import android.content.pm.PackageManager; -import android.graphics.Bitmap; -import android.graphics.drawable.ColorDrawable; -import android.graphics.drawable.Drawable; -import android.net.Uri; -import android.os.Build; -import android.os.Bundle; -import android.os.Environment; -import android.text.Html; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; -import android.widget.LinearLayout; -import android.widget.ProgressBar; -import android.widget.Toast; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.appcompat.app.ActionBar; -import androidx.appcompat.app.AppCompatActivity; -import androidx.core.app.ActivityCompat; -import androidx.core.content.ContextCompat; -import androidx.core.content.FileProvider; - -import com.alexvasilkov.gestures.views.GestureImageView; -import com.bumptech.glide.Glide; -import com.bumptech.glide.RequestManager; -import com.bumptech.glide.load.DataSource; -import com.bumptech.glide.load.engine.GlideException; -import com.bumptech.glide.request.RequestListener; -import com.bumptech.glide.request.target.CustomTarget; -import com.bumptech.glide.request.target.Target; -import com.bumptech.glide.request.transition.Transition; -import com.thefuntasty.hauler.HaulerView; - -import java.io.File; - -import javax.inject.Inject; -import javax.inject.Named; - -import butterknife.BindView; -import butterknife.ButterKnife; -import ml.docilealligator.infinityforreddit.AsyncTask.SaveImageToFileAsyncTask; -import ml.docilealligator.infinityforreddit.BuildConfig; -import ml.docilealligator.infinityforreddit.ContentFontStyle; -import ml.docilealligator.infinityforreddit.FontStyle; -import ml.docilealligator.infinityforreddit.Infinity; -import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.TitleFontStyle; -import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; - -public class ViewImageActivity extends AppCompatActivity { - - public static final String IMAGE_URL_KEY = "IUK"; - public static final String FILE_NAME_KEY = "FNK"; - public static final String POST_TITLE_KEY = "PTK"; - private static final int PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE = 0; - @BindView(R.id.hauler_view_view_image_activity) - HaulerView mHaulerView; - @BindView(R.id.progress_bar_view_image_activity) - ProgressBar mProgressBar; - @BindView(R.id.image_view_view_image_activity) - GestureImageView mImageView; - @BindView(R.id.load_image_error_linear_layout_view_image_activity) - LinearLayout mLoadErrorLinearLayout; - @Inject - @Named("default") - SharedPreferences mSharedPreferences; - private boolean isActionBarHidden = false; - private boolean isDownloading = false; - private String mImageUrl; - private String mImageFileName; - private RequestManager glide; - private String postTitle; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - ((Infinity) getApplication()).getAppComponent().inject(this); - - getTheme().applyStyle(R.style.Theme_Normal, true); - - getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences - .getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true); - - getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences - .getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true); - - getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences - .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); - - setContentView(R.layout.activity_view_image); - - ButterKnife.bind(this); - - ActionBar actionBar = getSupportActionBar(); - Drawable upArrow = getResources().getDrawable(R.drawable.ic_arrow_back_white_24dp); - actionBar.setHomeAsUpIndicator(upArrow); - actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.transparentActionBarAndExoPlayerControllerColor))); - - glide = Glide.with(this); - - Intent intent = getIntent(); - mImageUrl = intent.getStringExtra(IMAGE_URL_KEY); - mImageFileName = intent.getStringExtra(FILE_NAME_KEY); - postTitle = intent.getStringExtra(POST_TITLE_KEY); - - if (postTitle != null) { - setTitle(Html.fromHtml(String.format("<small>%s</small>", postTitle))); - } else { - setTitle(""); - } - - mHaulerView.setOnDragDismissedListener(dragDirection -> finish()); - - mLoadErrorLinearLayout.setOnClickListener(view -> { - mProgressBar.setVisibility(View.VISIBLE); - mLoadErrorLinearLayout.setVisibility(View.GONE); - loadImage(); - }); - - loadImage(); - - mImageView.getController().getSettings().setMaxZoom(10f).setDoubleTapZoom(2f).setPanEnabled(true); - - mImageView.setOnClickListener(view -> { - if (isActionBarHidden) { - getWindow().getDecorView().setSystemUiVisibility( - View.SYSTEM_UI_FLAG_LAYOUT_STABLE - | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION - | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); - isActionBarHidden = false; - } else { - getWindow().getDecorView().setSystemUiVisibility( - View.SYSTEM_UI_FLAG_LAYOUT_STABLE - | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION - | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN - | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION - | View.SYSTEM_UI_FLAG_FULLSCREEN - | View.SYSTEM_UI_FLAG_IMMERSIVE); - isActionBarHidden = true; - } - }); - } - - private void loadImage() { - glide.load(mImageUrl).listener(new RequestListener<Drawable>() { - @Override - public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) { - mProgressBar.setVisibility(View.GONE); - mLoadErrorLinearLayout.setVisibility(View.VISIBLE); - return false; - } - - @Override - public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) { - mProgressBar.setVisibility(View.GONE); - return false; - } - }).into(mImageView); - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - getMenuInflater().inflate(R.menu.view_image_activity, menu); - return true; - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - switch (item.getItemId()) { - case android.R.id.home: - finish(); - return true; - case R.id.action_download_view_image_activity: - if (isDownloading) { - return false; - } - - isDownloading = true; - - if (Build.VERSION.SDK_INT >= 23) { - if (ContextCompat.checkSelfPermission(this, - Manifest.permission.WRITE_EXTERNAL_STORAGE) - != PackageManager.PERMISSION_GRANTED) { - - // Permission is not granted - // No explanation needed; request the permission - ActivityCompat.requestPermissions(this, - new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, - PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE); - } else { - // Permission has already been granted - download(); - } - } else { - download(); - } - - return true; - case R.id.action_share_view_image_activity: - glide.asBitmap().load(mImageUrl).into(new CustomTarget<Bitmap>() { - - @Override - public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) { - if (getExternalCacheDir() != null) { - Toast.makeText(ViewImageActivity.this, R.string.save_image_before_sharing, Toast.LENGTH_SHORT).show(); - new SaveImageToFileAsyncTask(resource, getExternalCacheDir().getPath(), mImageFileName, - new SaveImageToFileAsyncTask.SaveImageToFileAsyncTaskListener() { - @Override - public void saveSuccess(File imageFile) { - Uri uri = FileProvider.getUriForFile(ViewImageActivity.this, - BuildConfig.APPLICATION_ID + ".provider",imageFile); - Intent shareIntent = new Intent(); - shareIntent.setAction(Intent.ACTION_SEND); - shareIntent.putExtra(Intent.EXTRA_STREAM, uri); - shareIntent.setType("image/*"); - shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); - startActivity(Intent.createChooser(shareIntent, getString(R.string.share))); - } - - @Override - public void saveFailed() { - Toast.makeText(ViewImageActivity.this, - R.string.cannot_save_image, Toast.LENGTH_SHORT).show(); - } - }).execute(); - } else { - Toast.makeText(ViewImageActivity.this, - R.string.cannot_get_storage, Toast.LENGTH_SHORT).show(); - } - } - - @Override - public void onLoadCleared(@Nullable Drawable placeholder) { - - } - }); - return true; - } - - return false; - } - - @Override - public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { - if (requestCode == PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE && grantResults.length > 0) { - if (grantResults[0] == PackageManager.PERMISSION_DENIED) { - Toast.makeText(this, R.string.no_storage_permission, Toast.LENGTH_SHORT).show(); - } else if (grantResults[0] == PackageManager.PERMISSION_GRANTED && isDownloading) { - download(); - } - isDownloading = false; - } - } - - private void download() { - DownloadManager.Request request = new DownloadManager.Request(Uri.parse(mImageUrl)); - request.setTitle(mImageFileName); - - request.allowScanningByMediaScanner(); - request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); - - //Android Q support - if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - request.setDestinationInExternalPublicDir(Environment.DIRECTORY_PICTURES, mImageFileName); - } else { - String path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).toString(); - File directory = new File(path + "/Infinity/"); - boolean saveToInfinityFolder = true; - if (!directory.exists()) { - if (!directory.mkdir()) { - saveToInfinityFolder = false; - } - } else { - if (directory.isFile()) { - if (!(directory.delete() && directory.mkdir())) { - saveToInfinityFolder = false; - } - } - } - - if (saveToInfinityFolder) { - request.setDestinationInExternalPublicDir(Environment.DIRECTORY_PICTURES + "/Infinity/", mImageFileName); - } else { - request.setDestinationInExternalPublicDir(Environment.DIRECTORY_PICTURES, mImageFileName); - } - } - - DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE); - - if (manager == null) { - Toast.makeText(this, R.string.download_failed, Toast.LENGTH_SHORT).show(); - return; - } - - manager.enqueue(request); - Toast.makeText(this, R.string.download_started, Toast.LENGTH_SHORT).show(); - } -} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageOrGifActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageOrGifActivity.java new file mode 100644 index 00000000..68631472 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImageOrGifActivity.java @@ -0,0 +1,416 @@ +package ml.docilealligator.infinityforreddit.Activity; + +import android.Manifest; +import android.content.Intent; +import android.content.SharedPreferences; +import android.content.pm.PackageManager; +import android.graphics.Bitmap; +import android.graphics.drawable.ColorDrawable; +import android.graphics.drawable.Drawable; +import android.net.Uri; +import android.os.Build; +import android.os.Bundle; +import android.text.Html; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.LinearLayout; +import android.widget.ProgressBar; +import android.widget.Toast; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.app.ActivityCompat; +import androidx.core.content.ContextCompat; +import androidx.core.content.FileProvider; + +import com.alexvasilkov.gestures.views.GestureFrameLayout; +import com.bumptech.glide.Glide; +import com.bumptech.glide.RequestManager; +import com.bumptech.glide.load.DataSource; +import com.bumptech.glide.load.engine.GlideException; +import com.bumptech.glide.load.resource.gif.GifDrawable; +import com.bumptech.glide.request.RequestListener; +import com.bumptech.glide.request.target.CustomTarget; +import com.bumptech.glide.request.target.Target; +import com.bumptech.glide.request.transition.Transition; +import com.thefuntasty.hauler.DragDirection; +import com.thefuntasty.hauler.HaulerView; + +import java.io.File; + +import javax.inject.Inject; +import javax.inject.Named; + +import butterknife.BindView; +import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.AsyncTask.SaveGIFToFileAsyncTask; +import ml.docilealligator.infinityforreddit.AsyncTask.SaveImageToFileAsyncTask; +import ml.docilealligator.infinityforreddit.BottomSheetFragment.SetAsWallpaperBottomSheetFragment; +import ml.docilealligator.infinityforreddit.BuildConfig; +import ml.docilealligator.infinityforreddit.Font.ContentFontFamily; +import ml.docilealligator.infinityforreddit.Font.ContentFontStyle; +import ml.docilealligator.infinityforreddit.Font.FontFamily; +import ml.docilealligator.infinityforreddit.Font.FontStyle; +import ml.docilealligator.infinityforreddit.Font.TitleFontFamily; +import ml.docilealligator.infinityforreddit.Font.TitleFontStyle; +import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.MediaDownloader; +import ml.docilealligator.infinityforreddit.MediaDownloaderImpl; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.SetAsWallpaperCallback; +import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; +import ml.docilealligator.infinityforreddit.WallpaperSetter; +import pl.droidsonroids.gif.GifImageView; + +public class ViewImageOrGifActivity extends AppCompatActivity implements SetAsWallpaperCallback { + + public static final String IMAGE_URL_KEY = "IUK"; + public static final String GIF_URL_KEY = "GUK"; + public static final String FILE_NAME_KEY = "FNK"; + public static final String POST_TITLE_KEY = "PTK"; + private static final int PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE = 0; + @BindView(R.id.hauler_view_view_image_or_gif_activity) + HaulerView mHaulerView; + @BindView(R.id.progress_bar_view_image_or_gif_activity) + ProgressBar mProgressBar; + @BindView(R.id.image_view_view_image_or_gif_activity) + GifImageView mImageView; + @BindView(R.id.gesture_layout_view_image_or_gif_activity) + GestureFrameLayout gestureLayout; + @BindView(R.id.load_image_error_linear_layout_view_image_or_gif_activity) + LinearLayout mLoadErrorLinearLayout; + @Inject + @Named("default") + SharedPreferences mSharedPreferences; + private MediaDownloader mediaDownloader; + private boolean isActionBarHidden = false; + private boolean isDownloading = false; + private RequestManager glide; + private String mImageUrl; + private String mImageFileName; + private boolean isGif = true; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + ((Infinity) getApplication()).getAppComponent().inject(this); + + getTheme().applyStyle(R.style.Theme_Normal, true); + + getTheme().applyStyle(FontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.FONT_SIZE_KEY, FontStyle.Normal.name())).getResId(), true); + + getTheme().applyStyle(TitleFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY, TitleFontStyle.Normal.name())).getResId(), true); + + getTheme().applyStyle(ContentFontStyle.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); + + getTheme().applyStyle(FontFamily.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.FONT_FAMILY_KEY, FontFamily.Default.name())).getResId(), true); + + getTheme().applyStyle(TitleFontFamily.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.TITLE_FONT_FAMILY_KEY, TitleFontFamily.Default.name())).getResId(), true); + + getTheme().applyStyle(ContentFontFamily.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.CONTENT_FONT_FAMILY_KEY, ContentFontFamily.Default.name())).getResId(), true); + + setContentView(R.layout.activity_view_image_or_gif); + + ButterKnife.bind(this); + + ActionBar actionBar = getSupportActionBar(); + Drawable upArrow = getResources().getDrawable(R.drawable.ic_arrow_back_white_24dp); + actionBar.setHomeAsUpIndicator(upArrow); + actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.transparentActionBarAndExoPlayerControllerColor))); + + mHaulerView.setOnDragDismissedListener(dragDirection -> finish()); + + mediaDownloader = new MediaDownloaderImpl(); + + glide = Glide.with(this); + + Intent intent = getIntent(); + mImageUrl = intent.getStringExtra(GIF_URL_KEY); + if (mImageUrl == null) { + isGif = false; + mImageUrl = intent.getStringExtra(IMAGE_URL_KEY); + } + mImageFileName = intent.getStringExtra(FILE_NAME_KEY); + String postTitle = intent.getStringExtra(POST_TITLE_KEY); + + if (postTitle != null) { + setTitle(Html.fromHtml(String.format("<small>%s</small>", postTitle))); + } else { + setTitle(""); + } + + mHaulerView.setOnDragDismissedListener(dragDirection -> { + int slide = dragDirection == DragDirection.UP ? R.anim.slide_out_up : R.anim.slide_out_down; + finish(); + overridePendingTransition(0, slide); + }); + + mLoadErrorLinearLayout.setOnClickListener(view -> { + mProgressBar.setVisibility(View.VISIBLE); + mLoadErrorLinearLayout.setVisibility(View.GONE); + loadImage(); + }); + + loadImage(); + + gestureLayout.getController().getSettings().setMaxZoom(10f).setDoubleTapZoom(2f).setPanEnabled(true); + + mImageView.setOnClickListener(view -> { + if (isActionBarHidden) { + getWindow().getDecorView().setSystemUiVisibility( + View.SYSTEM_UI_FLAG_LAYOUT_STABLE + | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION + | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); + isActionBarHidden = false; + } else { + getWindow().getDecorView().setSystemUiVisibility( + View.SYSTEM_UI_FLAG_LAYOUT_STABLE + | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION + | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN + | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION + | View.SYSTEM_UI_FLAG_FULLSCREEN + | View.SYSTEM_UI_FLAG_IMMERSIVE); + isActionBarHidden = true; + } + }); + } + + private void loadImage() { + glide.load(mImageUrl).listener(new RequestListener<Drawable>() { + @Override + public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) { + mProgressBar.setVisibility(View.GONE); + mLoadErrorLinearLayout.setVisibility(View.VISIBLE); + return false; + } + + @Override + public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) { + mProgressBar.setVisibility(View.GONE); + return false; + } + }).override(Target.SIZE_ORIGINAL).into(mImageView); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.view_image_or_gif_activity, menu); + if (!isGif) + menu.findItem(R.id.action_set_wallpaper_view_image_or_gif_activity).setVisible(true); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: + finish(); + return true; + case R.id.action_download_view_image_or_gif_activity: + if (isDownloading) { + return false; + } + + isDownloading = true; + + if (Build.VERSION.SDK_INT >= 23) { + if (ContextCompat.checkSelfPermission(this, + Manifest.permission.WRITE_EXTERNAL_STORAGE) + != PackageManager.PERMISSION_GRANTED) { + + // Permission is not granted + // No explanation needed; request the permission + ActivityCompat.requestPermissions(this, + new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, + PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE); + } else { + // Permission has already been granted + mediaDownloader.download(mImageUrl, mImageFileName, this); + } + } else { + mediaDownloader.download(mImageUrl, mImageFileName, this); + } + + return true; + case R.id.action_share_view_image_or_gif_activity: + if (isGif) + shareGif(); + else + shareImage(); + return true; + case R.id.action_set_wallpaper_view_image_or_gif_activity: + if (!isGif) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + SetAsWallpaperBottomSheetFragment setAsWallpaperBottomSheetFragment = new SetAsWallpaperBottomSheetFragment(); + setAsWallpaperBottomSheetFragment.show(getSupportFragmentManager(), setAsWallpaperBottomSheetFragment.getTag()); + } else { + WallpaperSetter.set(mImageUrl, WallpaperSetter.BOTH_SCREENS, this, + new WallpaperSetter.SetWallpaperListener() { + @Override + public void success() { + Toast.makeText(ViewImageOrGifActivity.this, R.string.wallpaper_set, Toast.LENGTH_SHORT).show(); + } + + @Override + public void failed() { + Toast.makeText(ViewImageOrGifActivity.this, R.string.error_set_wallpaper, Toast.LENGTH_SHORT).show(); + } + }); + } + } + return true; + } + + return false; + } + + private void shareImage() { + glide.asBitmap().load(mImageUrl).into(new CustomTarget<Bitmap>() { + + @Override + public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) { + if (getExternalCacheDir() != null) { + Toast.makeText(ViewImageOrGifActivity.this, R.string.save_image_first, Toast.LENGTH_SHORT).show(); + new SaveImageToFileAsyncTask(resource, getExternalCacheDir().getPath(), mImageFileName, + new SaveImageToFileAsyncTask.SaveImageToFileAsyncTaskListener() { + @Override + public void saveSuccess(File imageFile) { + Uri uri = FileProvider.getUriForFile(ViewImageOrGifActivity.this, + BuildConfig.APPLICATION_ID + ".provider", imageFile); + Intent shareIntent = new Intent(); + shareIntent.setAction(Intent.ACTION_SEND); + shareIntent.putExtra(Intent.EXTRA_STREAM, uri); + shareIntent.setType("image/*"); + shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + startActivity(Intent.createChooser(shareIntent, getString(R.string.share))); + } + + @Override + public void saveFailed() { + Toast.makeText(ViewImageOrGifActivity.this, + R.string.cannot_save_image, Toast.LENGTH_SHORT).show(); + } + }).execute(); + } else { + Toast.makeText(ViewImageOrGifActivity.this, + R.string.cannot_get_storage, Toast.LENGTH_SHORT).show(); + } + } + + @Override + public void onLoadCleared(@Nullable Drawable placeholder) { + + } + }); + } + + private void shareGif() { + Toast.makeText(ViewImageOrGifActivity.this, R.string.save_gif_first, Toast.LENGTH_SHORT).show(); + glide.asGif().load(mImageUrl).listener(new RequestListener<GifDrawable>() { + @Override + public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<GifDrawable> target, boolean isFirstResource) { + return false; + } + + @Override + public boolean onResourceReady(GifDrawable resource, Object model, Target<GifDrawable> target, DataSource dataSource, boolean isFirstResource) { + if (getExternalCacheDir() != null) { + new SaveGIFToFileAsyncTask(resource, getExternalCacheDir().getPath(), mImageFileName, + new SaveGIFToFileAsyncTask.SaveGIFToFileAsyncTaskListener() { + @Override + public void saveSuccess(File imageFile) { + Uri uri = FileProvider.getUriForFile(ViewImageOrGifActivity.this, + BuildConfig.APPLICATION_ID + ".provider", imageFile); + Intent shareIntent = new Intent(); + shareIntent.setAction(Intent.ACTION_SEND); + shareIntent.putExtra(Intent.EXTRA_STREAM, uri); + shareIntent.setType("image/*"); + shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + startActivity(Intent.createChooser(shareIntent, getString(R.string.share))); + } + + @Override + public void saveFailed() { + Toast.makeText(ViewImageOrGifActivity.this, + R.string.cannot_save_gif, Toast.LENGTH_SHORT).show(); + } + }).execute(); + } else { + Toast.makeText(ViewImageOrGifActivity.this, + R.string.cannot_get_storage, Toast.LENGTH_SHORT).show(); + } + return false; + } + }).submit(); + } + + @Override + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { + if (requestCode == PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE && grantResults.length > 0) { + if (grantResults[0] == PackageManager.PERMISSION_DENIED) { + Toast.makeText(this, R.string.no_storage_permission, Toast.LENGTH_SHORT).show(); + } else if (grantResults[0] == PackageManager.PERMISSION_GRANTED && isDownloading) { + mediaDownloader.download(mImageUrl, mImageFileName, this); + } + isDownloading = false; + } + } + + @Override + public void setToHomeScreen(int viewPagerPosition) { + WallpaperSetter.set(mImageUrl, WallpaperSetter.HOME_SCREEN, this, + new WallpaperSetter.SetWallpaperListener() { + @Override + public void success() { + Toast.makeText(ViewImageOrGifActivity.this, R.string.wallpaper_set, Toast.LENGTH_SHORT).show(); + } + + @Override + public void failed() { + Toast.makeText(ViewImageOrGifActivity.this, R.string.error_set_wallpaper, Toast.LENGTH_SHORT).show(); + } + }); + } + + @Override + public void setToLockScreen(int viewPagerPosition) { + WallpaperSetter.set(mImageUrl, WallpaperSetter.LOCK_SCREEN, this, + new WallpaperSetter.SetWallpaperListener() { + @Override + public void success() { + Toast.makeText(ViewImageOrGifActivity.this, R.string.wallpaper_set, Toast.LENGTH_SHORT).show(); + } + + @Override + public void failed() { + Toast.makeText(ViewImageOrGifActivity.this, R.string.error_set_wallpaper, Toast.LENGTH_SHORT).show(); + } + }); + } + + @Override + public void setToBoth(int viewPagerPosition) { + WallpaperSetter.set(mImageUrl, WallpaperSetter.BOTH_SCREENS, this, + new WallpaperSetter.SetWallpaperListener() { + @Override + public void success() { + Toast.makeText(ViewImageOrGifActivity.this, R.string.wallpaper_set, Toast.LENGTH_SHORT).show(); + } + + @Override + public void failed() { + Toast.makeText(ViewImageOrGifActivity.this, R.string.error_set_wallpaper, Toast.LENGTH_SHORT).show(); + } + }); + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImgurMediaActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImgurMediaActivity.java index 9e0b95e7..0e073b70 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImgurMediaActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewImgurMediaActivity.java @@ -10,6 +10,7 @@ import android.view.MenuItem; import android.view.View; import android.widget.LinearLayout; import android.widget.ProgressBar; +import android.widget.Toast; import androidx.annotation.NonNull; import androidx.appcompat.app.ActionBar; @@ -19,6 +20,7 @@ import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentStatePagerAdapter; import androidx.viewpager.widget.ViewPager; +import com.thefuntasty.hauler.DragDirection; import com.thefuntasty.hauler.HaulerView; import org.json.JSONArray; @@ -33,23 +35,28 @@ import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.API.ImgurAPI; -import ml.docilealligator.infinityforreddit.ContentFontStyle; -import ml.docilealligator.infinityforreddit.FontStyle; +import ml.docilealligator.infinityforreddit.Font.ContentFontFamily; +import ml.docilealligator.infinityforreddit.Font.ContentFontStyle; +import ml.docilealligator.infinityforreddit.Font.FontFamily; +import ml.docilealligator.infinityforreddit.Font.FontStyle; +import ml.docilealligator.infinityforreddit.Font.TitleFontFamily; +import ml.docilealligator.infinityforreddit.Font.TitleFontStyle; import ml.docilealligator.infinityforreddit.Fragment.ViewImgurImageFragment; import ml.docilealligator.infinityforreddit.Fragment.ViewImgurVideoFragment; import ml.docilealligator.infinityforreddit.ImgurMedia; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.TitleFontStyle; +import ml.docilealligator.infinityforreddit.SetAsWallpaperCallback; import ml.docilealligator.infinityforreddit.Utils.APIUtils; import ml.docilealligator.infinityforreddit.Utils.JSONUtils; import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; +import ml.docilealligator.infinityforreddit.WallpaperSetter; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; import retrofit2.Retrofit; -public class ViewImgurMediaActivity extends AppCompatActivity { +public class ViewImgurMediaActivity extends AppCompatActivity implements SetAsWallpaperCallback { public static final String EXTRA_IMGUR_TYPE = "EIT"; public static final String EXTRA_IMGUR_ID = "EII"; @@ -74,6 +81,7 @@ public class ViewImgurMediaActivity extends AppCompatActivity { @Inject @Named("default") SharedPreferences sharedPreferences; + private WallpaperSetter wallpaperSetter; @Override protected void onCreate(Bundle savedInstanceState) { @@ -92,6 +100,15 @@ public class ViewImgurMediaActivity extends AppCompatActivity { getTheme().applyStyle(ContentFontStyle.valueOf(sharedPreferences .getString(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY, ContentFontStyle.Normal.name())).getResId(), true); + getTheme().applyStyle(FontFamily.valueOf(sharedPreferences + .getString(SharedPreferencesUtils.FONT_FAMILY_KEY, FontFamily.Default.name())).getResId(), true); + + getTheme().applyStyle(TitleFontFamily.valueOf(sharedPreferences + .getString(SharedPreferencesUtils.TITLE_FONT_FAMILY_KEY, TitleFontFamily.Default.name())).getResId(), true); + + getTheme().applyStyle(ContentFontFamily.valueOf(sharedPreferences + .getString(SharedPreferencesUtils.CONTENT_FONT_FAMILY_KEY, ContentFontFamily.Default.name())).getResId(), true); + setContentView(R.layout.activity_view_imgur_media); ButterKnife.bind(this); @@ -101,6 +118,8 @@ public class ViewImgurMediaActivity extends AppCompatActivity { actionBar.setHomeAsUpIndicator(upArrow); actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.transparentActionBarAndExoPlayerControllerColor))); + wallpaperSetter = new WallpaperSetter(); + setTitle(" "); String imgurId = getIntent().getStringExtra(EXTRA_IMGUR_ID); @@ -113,7 +132,11 @@ public class ViewImgurMediaActivity extends AppCompatActivity { images = savedInstanceState.getParcelableArrayList(IMGUR_IMAGES_STATE); } - haulerView.setOnDragDismissedListener(dragDirection -> finish()); + haulerView.setOnDragDismissedListener(dragDirection -> { + int slide = dragDirection == DragDirection.UP ? R.anim.slide_out_up : R.anim.slide_out_down; + finish(); + overridePendingTransition(0, slide); + }); if (images == null) { fetchImgurMedia(imgurId); @@ -122,9 +145,7 @@ public class ViewImgurMediaActivity extends AppCompatActivity { setupViewPager(); } - errorLinearLayout.setOnClickListener(view -> { - fetchImgurMedia(imgurId); - }); + errorLinearLayout.setOnClickListener(view -> fetchImgurMedia(imgurId)); } private void fetchImgurMedia(String imgurId) { @@ -240,30 +261,22 @@ public class ViewImgurMediaActivity extends AppCompatActivity { private void setupViewPager() { setToolbarTitle(0); sectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); - viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { - @Override - public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { - - } - + viewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { setToolbarTitle(position); } - - @Override - public void onPageScrollStateChanged(int state) { - - } }); viewPager.setAdapter(sectionsPagerAdapter); } private void setToolbarTitle(int position) { - if (images.get(position).getType() == ImgurMedia.TYPE_VIDEO) { - setTitle(getString(R.string.view_imgur_media_activity_video_label, position + 1, images.size())); - } else { - setTitle(getString(R.string.view_imgur_media_activity_image_label, position + 1, images.size())); + if (images != null && position >= 0 && position < images.size()) { + if (images.get(position).getType() == ImgurMedia.TYPE_VIDEO) { + setTitle(getString(R.string.view_imgur_media_activity_video_label, position + 1, images.size())); + } else { + setTitle(getString(R.string.view_imgur_media_activity_image_label, position + 1, images.size())); + } } } @@ -288,6 +301,64 @@ public class ViewImgurMediaActivity extends AppCompatActivity { outState.putParcelableArrayList(IMGUR_IMAGES_STATE, images); } + @Override + public void setToHomeScreen(int viewPagerPosition) { + if (images != null && viewPagerPosition >= 0 && viewPagerPosition < images.size()) { + WallpaperSetter.set(images.get(viewPagerPosition).getLink(), WallpaperSetter.HOME_SCREEN, this, + new WallpaperSetter.SetWallpaperListener() { + @Override + public void success() { + Toast.makeText(ViewImgurMediaActivity.this, R.string.wallpaper_set, Toast.LENGTH_SHORT).show(); + } + + @Override + public void failed() { + Toast.makeText(ViewImgurMediaActivity.this, R.string.error_set_wallpaper, Toast.LENGTH_SHORT).show(); + } + }); + } + } + + @Override + public void setToLockScreen(int viewPagerPosition) { + if (images != null && viewPagerPosition >= 0 && viewPagerPosition < images.size()) { + WallpaperSetter.set(images.get(viewPagerPosition).getLink(), WallpaperSetter.LOCK_SCREEN, this, + new WallpaperSetter.SetWallpaperListener() { + @Override + public void success() { + Toast.makeText(ViewImgurMediaActivity.this, R.string.wallpaper_set, Toast.LENGTH_SHORT).show(); + } + + @Override + public void failed() { + Toast.makeText(ViewImgurMediaActivity.this, R.string.error_set_wallpaper, Toast.LENGTH_SHORT).show(); + } + }); + } + } + + @Override + public void setToBoth(int viewPagerPosition) { + if (images != null && viewPagerPosition >= 0 && viewPagerPosition < images.size()) { + WallpaperSetter.set(images.get(viewPagerPosition).getLink(), WallpaperSetter.BOTH_SCREENS, this, + new WallpaperSetter.SetWallpaperListener() { + @Override + public void success() { + Toast.makeText(ViewImgurMediaActivity.this, R.string.wallpaper_set, Toast.LENGTH_SHORT).show(); + } + + @Override + public void failed() { + Toast.makeText(ViewImgurMediaActivity.this, R.string.error_set_wallpaper, Toast.LENGTH_SHORT).show(); + } + }); + } + } + + public int getCurrentPagePosition() { + return viewPager.getCurrentItem(); + } + private class SectionsPagerAdapter extends FragmentStatePagerAdapter { SectionsPagerAdapter(@NonNull FragmentManager fm) { @@ -328,6 +399,7 @@ public class ViewImgurMediaActivity extends AppCompatActivity { interface ParseImgurImagesAsyncTaskListener { void success(ArrayList<ImgurMedia> images); + void failed(); } @@ -382,6 +454,7 @@ public class ViewImgurMediaActivity extends AppCompatActivity { interface ParseImgurImageAsyncTaskListener { void success(ImgurMedia image); + void failed(); } @@ -422,4 +495,4 @@ public class ViewImgurMediaActivity extends AppCompatActivity { } } } -}
\ No newline at end of file +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMessageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMessageActivity.java index a71cf47b..5e7446bc 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMessageActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMessageActivity.java @@ -26,6 +26,7 @@ import com.bumptech.glide.Glide; import com.bumptech.glide.RequestManager; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.appbar.CollapsingToolbarLayout; +import com.r0adkll.slidr.Slidr; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -47,6 +48,7 @@ import ml.docilealligator.infinityforreddit.MessageViewModel; import ml.docilealligator.infinityforreddit.NetworkState; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; import retrofit2.Retrofit; public class ViewMessageActivity extends BaseActivity implements ActivityToolbarInterface { @@ -107,6 +109,10 @@ public class ViewMessageActivity extends BaseActivity implements ActivityToolbar applyCustomTheme(); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK_FROM_POST_DETAIL, true)) { + Slidr.attach(this); + } + mGlide = Glide.with(this); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMultiRedditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMultiRedditDetailActivity.java index a87a200a..1317e133 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMultiRedditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewMultiRedditDetailActivity.java @@ -18,6 +18,7 @@ import androidx.fragment.app.Fragment; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.appbar.CollapsingToolbarLayout; import com.google.android.material.dialog.MaterialAlertDialogBuilder; +import com.r0adkll.slidr.Slidr; import org.greenrobot.eventbus.EventBus; @@ -28,12 +29,12 @@ import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.ActivityToolbarInterface; import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask; -import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper; -import ml.docilealligator.infinityforreddit.Event.RefreshMultiRedditsEvent; -import ml.docilealligator.infinityforreddit.Fragment.PostFragment; import ml.docilealligator.infinityforreddit.BottomSheetFragment.PostLayoutBottomSheetFragment; import ml.docilealligator.infinityforreddit.BottomSheetFragment.SortTimeBottomSheetFragment; import ml.docilealligator.infinityforreddit.BottomSheetFragment.SortTypeBottomSheetFragment; +import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper; +import ml.docilealligator.infinityforreddit.Event.RefreshMultiRedditsEvent; +import ml.docilealligator.infinityforreddit.Fragment.PostFragment; import ml.docilealligator.infinityforreddit.FragmentCommunicator; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.MultiReddit.DeleteMultiReddit; @@ -108,6 +109,10 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT applyCustomTheme(); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK_FROM_POST_DETAIL, true)) { + Slidr.attach(this); + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { Window window = getWindow(); @@ -301,8 +306,8 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT public void sortTypeSelected(SortType sortType) { mSortTypeSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TYPE_MULTI_REDDIT_POST_BASE + multiPath, sortType.getType().name()).apply(); - if(sortType.getTime() != null) { - mSortTypeSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TIME_MULTI_REDDIT_POST_BASE+ multiPath, + if (sortType.getTime() != null) { + mSortTypeSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TIME_MULTI_REDDIT_POST_BASE + multiPath, sortType.getTime().name()).apply(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java index 51a5beaa..81e1ba8a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java @@ -60,6 +60,8 @@ import ml.docilealligator.infinityforreddit.ActivityToolbarInterface; import ml.docilealligator.infinityforreddit.Adapter.CommentAndPostRecyclerViewAdapter; import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask; import ml.docilealligator.infinityforreddit.AsyncTask.SwitchAccountAsyncTask; +import ml.docilealligator.infinityforreddit.BottomSheetFragment.FlairBottomSheetFragment; +import ml.docilealligator.infinityforreddit.BottomSheetFragment.PostCommentSortTypeBottomSheetFragment; import ml.docilealligator.infinityforreddit.CommentData; import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.CustomView.CustomToroContainer; @@ -71,9 +73,9 @@ import ml.docilealligator.infinityforreddit.Event.PostUpdateEventToDetailActivit import ml.docilealligator.infinityforreddit.Event.PostUpdateEventToPostList; import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent; import ml.docilealligator.infinityforreddit.FetchComment; +import ml.docilealligator.infinityforreddit.FetchRemovedComment; +import ml.docilealligator.infinityforreddit.FetchRemovedPost; import ml.docilealligator.infinityforreddit.Flair; -import ml.docilealligator.infinityforreddit.BottomSheetFragment.FlairBottomSheetFragment; -import ml.docilealligator.infinityforreddit.BottomSheetFragment.PostCommentSortTypeBottomSheetFragment; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.ParseComment; import ml.docilealligator.infinityforreddit.Post.FetchPost; @@ -161,6 +163,9 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS @Named("no_oauth") Retrofit mRetrofit; @Inject + @Named("pushshift") + Retrofit pushshiftRetrofit; + @Inject @Named("oauth") Retrofit mOauthRetrofit; @Inject @@ -449,63 +454,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS if (mPost == null) { fetchPostAndCommentsById(getIntent().getStringExtra(EXTRA_POST_ID)); } else { - if (mMenu != null) { - MenuItem saveItem = mMenu.findItem(R.id.action_save_view_post_detail_activity); - MenuItem hideItem = mMenu.findItem(R.id.action_hide_view_post_detail_activity); - - mMenu.findItem(R.id.action_comment_view_post_detail_activity).setVisible(true); - mMenu.findItem(R.id.action_sort_view_post_detail_activity).setVisible(true); - - if (mAccessToken != null) { - if (mPost.isSaved()) { - saveItem.setVisible(true); - saveItem.setIcon(mSavedIcon); - } else { - saveItem.setVisible(true); - saveItem.setIcon(mUnsavedIcon); - } - - if (mPost.isHidden()) { - hideItem.setVisible(true); - hideItem.setTitle(R.string.action_unhide_post); - } else { - hideItem.setVisible(true); - hideItem.setTitle(R.string.action_hide_post); - } - - mMenu.findItem(R.id.action_report_view_post_detail_activity).setVisible(true); - } else { - saveItem.setVisible(false); - hideItem.setVisible(false); - } - - if (mPost.getAuthor().equals(mAccountName)) { - if (mPost.getPostType() == Post.TEXT_TYPE) { - mMenu.findItem(R.id.action_edit_view_post_detail_activity).setVisible(true); - } - mMenu.findItem(R.id.action_delete_view_post_detail_activity).setVisible(true); - - MenuItem nsfwItem = mMenu.findItem(R.id.action_nsfw_view_post_detail_activity); - nsfwItem.setVisible(true); - if (mPost.isNSFW()) { - nsfwItem.setTitle(R.string.action_unmark_nsfw); - } else { - nsfwItem.setTitle(R.string.action_mark_nsfw); - } - - MenuItem spoilerItem = mMenu.findItem(R.id.action_spoiler_view_post_detail_activity); - spoilerItem.setVisible(true); - if (mPost.isSpoiler()) { - spoilerItem.setTitle(R.string.action_unmark_spoiler); - } else { - spoilerItem.setTitle(R.string.action_mark_spoiler); - } - - mMenu.findItem(R.id.action_edit_flair_view_post_detail_activity).setVisible(true); - } - - mMenu.findItem(R.id.action_view_crosspost_parent_view_post_detail_activity).setVisible(mPost.getCrosspostParentId() != null); - } + setupMenu(); mAdapter = new CommentAndPostRecyclerViewAdapter(ViewPostDetailActivity.this, mCustomThemeWrapper, mRetrofit, mOauthRetrofit, mRedditDataRoomDatabase, mGlide, @@ -559,6 +508,73 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS fab.setOnClickListener(view -> scrollToNextParentComment()); } + private void setupMenu() { + if (mMenu != null) { + MenuItem saveItem = mMenu.findItem(R.id.action_save_view_post_detail_activity); + MenuItem hideItem = mMenu.findItem(R.id.action_hide_view_post_detail_activity); + + mMenu.findItem(R.id.action_comment_view_post_detail_activity).setVisible(true); + mMenu.findItem(R.id.action_sort_view_post_detail_activity).setVisible(true); + + if (mAccessToken != null) { + if (mPost.isSaved()) { + saveItem.setVisible(true); + saveItem.setIcon(mSavedIcon); + } else { + saveItem.setVisible(true); + saveItem.setIcon(mUnsavedIcon); + } + + if (mPost.isHidden()) { + hideItem.setVisible(true); + hideItem.setTitle(R.string.action_unhide_post); + } else { + hideItem.setVisible(true); + hideItem.setTitle(R.string.action_hide_post); + } + + mMenu.findItem(R.id.action_report_view_post_detail_activity).setVisible(true); + } else { + saveItem.setVisible(false); + hideItem.setVisible(false); + } + + if (mPost.getAuthor().equals(mAccountName)) { + if (mPost.getPostType() == Post.TEXT_TYPE) { + mMenu.findItem(R.id.action_edit_view_post_detail_activity).setVisible(true); + } + mMenu.findItem(R.id.action_delete_view_post_detail_activity).setVisible(true); + + MenuItem nsfwItem = mMenu.findItem(R.id.action_nsfw_view_post_detail_activity); + nsfwItem.setVisible(true); + if (mPost.isNSFW()) { + nsfwItem.setTitle(R.string.action_unmark_nsfw); + } else { + nsfwItem.setTitle(R.string.action_mark_nsfw); + } + + MenuItem spoilerItem = mMenu.findItem(R.id.action_spoiler_view_post_detail_activity); + spoilerItem.setVisible(true); + if (mPost.isSpoiler()) { + spoilerItem.setTitle(R.string.action_unmark_spoiler); + } else { + spoilerItem.setTitle(R.string.action_mark_spoiler); + } + + mMenu.findItem(R.id.action_edit_flair_view_post_detail_activity).setVisible(true); + } + + mMenu.findItem(R.id.action_view_crosspost_parent_view_post_detail_activity).setVisible(mPost.getCrosspostParentId() != null); + + if ("[deleted]".equals(mPost.getAuthor()) || + "[deleted]".equals(mPost.getSelfText()) || + "[removed]".equals(mPost.getSelfText()) + ) { + mMenu.findItem(R.id.action_see_removed_view_post_detail_activity).setVisible(true); + } + } + } + private Drawable getMenuItemIcon(int drawableId) { Drawable icon = getDrawable(drawableId); if (icon != null) { @@ -602,45 +618,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS public void onParsePostSuccess(Post post) { mPost = post; - if (mMenu != null) { - MenuItem saveItem = mMenu.findItem(R.id.action_save_view_post_detail_activity); - MenuItem hideItem = mMenu.findItem(R.id.action_hide_view_post_detail_activity); - - mMenu.findItem(R.id.action_comment_view_post_detail_activity).setVisible(true); - mMenu.findItem(R.id.action_sort_view_post_detail_activity).setVisible(true); - - if (mAccessToken != null) { - if (post.isSaved()) { - saveItem.setVisible(true); - saveItem.setIcon(mSavedIcon); - } else { - saveItem.setVisible(true); - saveItem.setIcon(mUnsavedIcon); - } - - if (post.isHidden()) { - hideItem.setVisible(true); - hideItem.setTitle(R.string.action_unhide_post); - } else { - hideItem.setVisible(true); - hideItem.setTitle(R.string.action_hide_post); - } - - mMenu.findItem(R.id.action_report_view_post_detail_activity).setVisible(true); - } else { - saveItem.setVisible(false); - hideItem.setVisible(false); - } - - if (mPost.getAuthor().equals(mAccountName)) { - if (mPost.getPostType() == Post.TEXT_TYPE) { - mMenu.findItem(R.id.action_edit_view_post_detail_activity).setVisible(true); - } - mMenu.findItem(R.id.action_delete_view_post_detail_activity).setVisible(true); - } - - mMenu.findItem(R.id.action_view_crosspost_parent_view_post_detail_activity).setVisible(mPost.getCrosspostParentId() != null); - } + setupMenu(); mAdapter = new CommentAndPostRecyclerViewAdapter(ViewPostDetailActivity.this, mCustomThemeWrapper, mRetrofit, mOauthRetrofit, mRedditDataRoomDatabase, mGlide, @@ -910,38 +888,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS mAdapter.updatePost(mPost); EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition)); isRefreshing = false; - if (mMenu != null) { - MenuItem saveItem = mMenu.findItem(R.id.action_save_view_post_detail_activity); - MenuItem hideItem = mMenu.findItem(R.id.action_hide_view_post_detail_activity); - - mMenu.findItem(R.id.action_comment_view_post_detail_activity).setVisible(true); - mMenu.findItem(R.id.action_sort_view_post_detail_activity).setVisible(true); - - if (mAccessToken != null) { - if (post.isSaved()) { - saveItem.setVisible(true); - saveItem.setIcon(mSavedIcon); - } else { - saveItem.setVisible(true); - saveItem.setIcon(mUnsavedIcon); - } - - if (post.isHidden()) { - hideItem.setVisible(true); - hideItem.setTitle(R.string.action_unhide_post); - } else { - hideItem.setVisible(true); - hideItem.setTitle(R.string.action_hide_post); - } - - mMenu.findItem(R.id.action_report_view_post_detail_activity).setVisible(true); - } else { - saveItem.setVisible(false); - hideItem.setVisible(false); - } - - mMenu.findItem(R.id.action_view_crosspost_parent_view_post_detail_activity).setVisible(mPost.getCrosspostParentId() != null); - } + setupMenu(); mSwipeRefreshLayout.setRefreshing(false); } @@ -1144,6 +1091,24 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS .show(); } + public void showRemovedComment(CommentData comment, int position) { + Toast.makeText(ViewPostDetailActivity.this, R.string.fetching_removed_comment, Toast.LENGTH_SHORT).show(); + FetchRemovedComment.fetchRemovedComment( + pushshiftRetrofit, + comment, + new FetchRemovedComment.FetchRemovedCommentListener() { + @Override + public void fetchSuccess(CommentData comment) { + mAdapter.editComment(comment.getAuthor(), comment.getCommentMarkdown(), position); + } + + @Override + public void fetchFailed() { + Toast.makeText(ViewPostDetailActivity.this, R.string.show_removed_comment_failed, Toast.LENGTH_SHORT).show(); + } + }); + } + public void changeToSingleThreadMode() { isSingleCommentThreadMode = false; mSingleCommentId = null; @@ -1257,65 +1222,30 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS applyMenuItemTheme(menu); mMenu = menu; if (mPost != null) { - MenuItem saveItem = mMenu.findItem(R.id.action_save_view_post_detail_activity); - MenuItem hideItem = mMenu.findItem(R.id.action_hide_view_post_detail_activity); - - mMenu.findItem(R.id.action_comment_view_post_detail_activity).setVisible(true); - mMenu.findItem(R.id.action_sort_view_post_detail_activity).setVisible(true); - - if (mAccessToken != null) { - if (mPost.isSaved()) { - saveItem.setVisible(true); - saveItem.setIcon(mSavedIcon); - } else { - saveItem.setVisible(true); - saveItem.setIcon(mUnsavedIcon); - } - - if (mPost.isHidden()) { - hideItem.setVisible(true); - hideItem.setTitle(R.string.action_unhide_post); - } else { - hideItem.setVisible(true); - hideItem.setTitle(R.string.action_hide_post); - } - - mMenu.findItem(R.id.action_report_view_post_detail_activity).setVisible(true); - } else { - saveItem.setVisible(false); - hideItem.setVisible(false); - } - - if (mPost.getAuthor().equals(mAccountName)) { - if (mPost.getPostType() == Post.TEXT_TYPE) { - menu.findItem(R.id.action_edit_view_post_detail_activity).setVisible(true); - } - menu.findItem(R.id.action_delete_view_post_detail_activity).setVisible(true); - - MenuItem nsfwItem = menu.findItem(R.id.action_nsfw_view_post_detail_activity); - nsfwItem.setVisible(true); - if (mPost.isNSFW()) { - nsfwItem.setTitle(R.string.action_unmark_nsfw); - } else { - nsfwItem.setTitle(R.string.action_mark_nsfw); - } - - MenuItem spoilerItem = menu.findItem(R.id.action_spoiler_view_post_detail_activity); - spoilerItem.setVisible(true); - if (mPost.isSpoiler()) { - spoilerItem.setTitle(R.string.action_unmark_spoiler); - } else { - spoilerItem.setTitle(R.string.action_mark_spoiler); - } - - menu.findItem(R.id.action_edit_flair_view_post_detail_activity).setVisible(true); - } - - menu.findItem(R.id.action_view_crosspost_parent_view_post_detail_activity).setVisible(mPost.getCrosspostParentId() != null); + setupMenu(); } return true; } + public void showRemovedPost() { + Toast.makeText(ViewPostDetailActivity.this, R.string.fetching_removed_post, Toast.LENGTH_SHORT).show(); + FetchRemovedPost.fetchRemovedPost( + pushshiftRetrofit, + mPost, + new FetchRemovedPost.FetchRemovedPostListener() { + @Override + public void fetchSuccess(Post post) { + mPost = post; + mAdapter.updatePost(post); + } + + @Override + public void fetchFailed() { + Toast.makeText(ViewPostDetailActivity.this, R.string.show_removed_post_failed, Toast.LENGTH_SHORT).show(); + } + }); + } + @Override public boolean onOptionsItemSelected(@NonNull MenuItem item) { switch (item.getItemId()) { @@ -1450,12 +1380,12 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS } return true; case R.id.action_edit_view_post_detail_activity: - Intent editPostItent = new Intent(this, EditPostActivity.class); - editPostItent.putExtra(EditPostActivity.EXTRA_ACCESS_TOKEN, mAccessToken); - editPostItent.putExtra(EditPostActivity.EXTRA_FULLNAME, mPost.getFullName()); - editPostItent.putExtra(EditPostActivity.EXTRA_TITLE, mPost.getTitle()); - editPostItent.putExtra(EditPostActivity.EXTRA_CONTENT, mPost.getSelfText()); - startActivityForResult(editPostItent, EDIT_POST_REQUEST_CODE); + Intent editPostIntent = new Intent(this, EditPostActivity.class); + editPostIntent.putExtra(EditPostActivity.EXTRA_ACCESS_TOKEN, mAccessToken); + editPostIntent.putExtra(EditPostActivity.EXTRA_FULLNAME, mPost.getFullName()); + editPostIntent.putExtra(EditPostActivity.EXTRA_TITLE, mPost.getTitle()); + editPostIntent.putExtra(EditPostActivity.EXTRA_CONTENT, mPost.getSelfText()); + startActivityForResult(editPostIntent, EDIT_POST_REQUEST_CODE); return true; case R.id.action_delete_view_post_detail_activity: new MaterialAlertDialogBuilder(this, R.style.MaterialAlertDialogTheme) @@ -1504,6 +1434,10 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS intent.putExtra(ReportActivity.EXTRA_SUBREDDIT_NAME, mPost.getSubredditName()); intent.putExtra(ReportActivity.EXTRA_THING_FULLNAME, mPost.getFullName()); startActivity(intent); + return true; + case R.id.action_see_removed_view_post_detail_activity: + showRemovedPost(); + return true; case android.R.id.home: onBackPressed(); return true; @@ -1537,7 +1471,8 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS } } else if (requestCode == EDIT_COMMENT_REQUEST_CODE) { if (data != null && resultCode == RESULT_OK) { - mAdapter.editComment(data.getStringExtra(EditCommentActivity.EXTRA_EDITED_COMMENT_CONTENT), + mAdapter.editComment(null, + data.getStringExtra(EditCommentActivity.EXTRA_EDITED_COMMENT_CONTENT), data.getExtras().getInt(EditCommentActivity.EXTRA_EDITED_COMMENT_POSITION)); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSidebarActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSidebarActivity.java deleted file mode 100644 index 826ba33d..00000000 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSidebarActivity.java +++ /dev/null @@ -1,251 +0,0 @@ -package ml.docilealligator.infinityforreddit.Activity; - -import android.content.Intent; -import android.content.SharedPreferences; -import android.net.Uri; -import android.os.Build; -import android.os.Bundle; -import android.text.Spanned; -import android.text.style.SuperscriptSpan; -import android.text.util.Linkify; -import android.util.TypedValue; -import android.view.Menu; -import android.view.MenuItem; -import android.view.Window; -import android.view.WindowManager; -import android.widget.TextView; -import android.widget.Toast; - -import androidx.annotation.NonNull; -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 androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.google.android.material.appbar.AppBarLayout; - -import org.commonmark.ext.gfm.tables.TableBlock; - -import javax.inject.Inject; -import javax.inject.Named; - -import butterknife.BindView; -import butterknife.ButterKnife; -import io.noties.markwon.AbstractMarkwonPlugin; -import io.noties.markwon.Markwon; -import io.noties.markwon.MarkwonConfiguration; -import io.noties.markwon.ext.strikethrough.StrikethroughPlugin; -import io.noties.markwon.linkify.LinkifyPlugin; -import io.noties.markwon.recycler.MarkwonAdapter; -import io.noties.markwon.recycler.table.TableEntry; -import io.noties.markwon.recycler.table.TableEntryPlugin; -import io.noties.markwon.simple.ext.SimpleExtPlugin; -import io.noties.markwon.urlprocessor.UrlProcessorRelativeToAbsolute; -import ml.docilealligator.infinityforreddit.ActivityToolbarInterface; -import ml.docilealligator.infinityforreddit.AsyncTask.InsertSubredditDataAsyncTask; -import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper; -import ml.docilealligator.infinityforreddit.FetchSubredditData; -import ml.docilealligator.infinityforreddit.Infinity; -import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; -import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditData; -import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditViewModel; -import retrofit2.Retrofit; - -public class ViewSidebarActivity extends BaseActivity implements ActivityToolbarInterface { - - public static final String EXTRA_SUBREDDIT_NAME = "ESN"; - @BindView(R.id.coordinator_layout_view_sidebar_activity) - CoordinatorLayout coordinatorLayout; - @BindView(R.id.appbar_layout_view_sidebar_activity) - AppBarLayout appBarLayout; - @BindView(R.id.toolbar_view_sidebar_activity) - Toolbar toolbar; - @BindView(R.id.swipe_refresh_layout_view_sidebar_activity) - SwipeRefreshLayout swipeRefreshLayout; - @BindView(R.id.markdown_recycler_view_view_sidebar_activity) - RecyclerView markdownRecyclerView; - @Inject - @Named("no_oauth") - Retrofit mRetrofit; - @Inject - RedditDataRoomDatabase mRedditDataRoomDatabase; - @Inject - @Named("default") - SharedPreferences mSharedPreferences; - @Inject - CustomThemeWrapper mCustomThemeWrapper; - public SubredditViewModel mSubredditViewModel; - private LinearLayoutManager mLinearLayoutManager; - private String subredditName; - private int markdownColor; - - @Override - protected void onCreate(Bundle savedInstanceState) { - ((Infinity) getApplication()).getAppComponent().inject(this); - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_view_sidebar); - - ButterKnife.bind(this); - - applyCustomTheme(); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - Window window = getWindow(); - - if (isChangeStatusBarIconColor()) { - addOnOffsetChangedListener(appBarLayout); - } - - if (isImmersiveInterface()) { - window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); - adjustToolbar(toolbar); - - int navBarHeight = getNavBarHeight(); - if (navBarHeight > 0) { - int px = (int) TypedValue.applyDimension( - TypedValue.COMPLEX_UNIT_DIP, - 16, - getResources().getDisplayMetrics() - ); - markdownRecyclerView.setPadding(px, px, px, navBarHeight); - } - } - } - - subredditName = getIntent().getStringExtra(EXTRA_SUBREDDIT_NAME); - if (subredditName == null) { - Toast.makeText(this, R.string.error_getting_subreddit_name, Toast.LENGTH_SHORT).show(); - finish(); - return; - } - - toolbar.setTitle("r/" + subredditName); - setSupportActionBar(toolbar); - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - setToolbarGoToTop(toolbar); - - Markwon markwon = Markwon.builder(this) - .usePlugin(new AbstractMarkwonPlugin() { - @Override - public void beforeSetText(@NonNull TextView textView, @NonNull Spanned markdown) { - textView.setTextColor(markdownColor); - } - - @Override - public void configureConfiguration(@NonNull MarkwonConfiguration.Builder builder) { - builder.linkResolver((view, link) -> { - Intent intent = new Intent(ViewSidebarActivity.this, LinkResolverActivity.class); - Uri uri = Uri.parse(link); - if (uri.getScheme() == null && uri.getHost() == null) { - intent.setData(LinkResolverActivity.getRedditUriByPath(link)); - } else { - intent.setData(uri); - } - ViewSidebarActivity.this.startActivity(intent); - }).urlProcessor(new UrlProcessorRelativeToAbsolute("https://www.reddit.com")); - } - }) - .usePlugin(StrikethroughPlugin.create()) - .usePlugin(LinkifyPlugin.create(Linkify.WEB_URLS)) - .usePlugin(SimpleExtPlugin.create(plugin -> - plugin.addExtension(1, '^', (configuration, props) -> { - return new SuperscriptSpan(); - }) - ) - ) - .usePlugin(TableEntryPlugin.create(this)) - .build(); - MarkwonAdapter markwonAdapter = MarkwonAdapter.builder(R.layout.adapter_default_entry, R.id.text) - .include(TableBlock.class, TableEntry.create(builder -> builder - .tableLayout(R.layout.adapter_table_block, R.id.table_layout) - .textLayoutIsRoot(R.layout.view_table_entry_cell))) - .build(); - - mLinearLayoutManager = new LinearLayoutManager(this); - markdownRecyclerView.setLayoutManager(mLinearLayoutManager); - markdownRecyclerView.setAdapter(markwonAdapter); - - mSubredditViewModel = new ViewModelProvider(this, - new SubredditViewModel.Factory(getApplication(), mRedditDataRoomDatabase, subredditName)) - .get(SubredditViewModel.class); - mSubredditViewModel.getSubredditLiveData().observe(this, subredditData -> { - if (subredditData != null) { - if (subredditData.getSidebarDescription() != null && !subredditData.getSidebarDescription().equals("")) { - markwonAdapter.setMarkdown(markwon, subredditData.getSidebarDescription()); - markwonAdapter.notifyDataSetChanged(); - } - } else { - fetchSubredditData(); - } - }); - - swipeRefreshLayout.setOnRefreshListener(this::fetchSubredditData); - } - - private void fetchSubredditData() { - swipeRefreshLayout.setRefreshing(true); - FetchSubredditData.fetchSubredditData(mRetrofit, subredditName, new FetchSubredditData.FetchSubredditDataListener() { - @Override - public void onFetchSubredditDataSuccess(SubredditData subredditData, int nCurrentOnlineSubscribers) { - swipeRefreshLayout.setRefreshing(false); - new InsertSubredditDataAsyncTask(mRedditDataRoomDatabase, subredditData, () -> swipeRefreshLayout.setRefreshing(false)).execute(); - } - - @Override - public void onFetchSubredditDataFail() { - swipeRefreshLayout.setRefreshing(false); - Toast.makeText(ViewSidebarActivity.this, R.string.cannot_fetch_sidebar, Toast.LENGTH_SHORT).show(); - } - }); - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - getMenuInflater().inflate(R.menu.view_sidebar_activity, menu); - 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_refresh_view_sidebar_activity) { - if (!swipeRefreshLayout.isRefreshing()) { - fetchSubredditData(); - } - return true; - } - return false; - } - - @Override - public SharedPreferences getSharedPreferences() { - return mSharedPreferences; - } - - @Override - protected CustomThemeWrapper getCustomThemeWrapper() { - return mCustomThemeWrapper; - } - - @Override - protected void applyCustomTheme() { - coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); - applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar); - swipeRefreshLayout.setProgressBackgroundColorSchemeColor(mCustomThemeWrapper.getCircularProgressBarBackground()); - swipeRefreshLayout.setColorSchemeColors(mCustomThemeWrapper.getColorAccent()); - markdownColor = mCustomThemeWrapper.getSecondaryTextColor(); - } - - @Override - public void onLongPress() { - if (mLinearLayoutManager != null) { - mLinearLayoutManager.scrollToPositionWithOffset(0, 0); - } - } -} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java index 0ec10e46..6f122bee 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java @@ -37,6 +37,8 @@ import com.google.android.material.chip.Chip; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.snackbar.Snackbar; import com.google.android.material.tabs.TabLayout; +import com.r0adkll.slidr.Slidr; +import com.r0adkll.slidr.model.SlidrInterface; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -56,17 +58,17 @@ import ml.docilealligator.infinityforreddit.AsyncTask.CheckIsSubscribedToSubredd import ml.docilealligator.infinityforreddit.AsyncTask.GetCurrentAccountAsyncTask; import ml.docilealligator.infinityforreddit.AsyncTask.InsertSubredditDataAsyncTask; import ml.docilealligator.infinityforreddit.AsyncTask.SwitchAccountAsyncTask; +import ml.docilealligator.infinityforreddit.BottomSheetFragment.PostLayoutBottomSheetFragment; +import ml.docilealligator.infinityforreddit.BottomSheetFragment.PostTypeBottomSheetFragment; +import ml.docilealligator.infinityforreddit.BottomSheetFragment.SortTimeBottomSheetFragment; +import ml.docilealligator.infinityforreddit.BottomSheetFragment.SortTypeBottomSheetFragment; import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.Event.ChangeNSFWEvent; import ml.docilealligator.infinityforreddit.Event.GoBackToMainPageEvent; import ml.docilealligator.infinityforreddit.Event.SwitchAccountEvent; import ml.docilealligator.infinityforreddit.FetchSubredditData; import ml.docilealligator.infinityforreddit.Fragment.PostFragment; -import ml.docilealligator.infinityforreddit.BottomSheetFragment.PostLayoutBottomSheetFragment; -import ml.docilealligator.infinityforreddit.BottomSheetFragment.PostTypeBottomSheetFragment; import ml.docilealligator.infinityforreddit.Fragment.SidebarFragment; -import ml.docilealligator.infinityforreddit.BottomSheetFragment.SortTimeBottomSheetFragment; -import ml.docilealligator.infinityforreddit.BottomSheetFragment.SortTypeBottomSheetFragment; import ml.docilealligator.infinityforreddit.FragmentCommunicator; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.Post.PostDataSource; @@ -90,6 +92,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp public static final String EXTRA_SUBREDDIT_NAME_KEY = "ESN"; public static final String EXTRA_MESSAGE_FULLNAME = "ENF"; public static final String EXTRA_NEW_ACCOUNT_NAME = "ENAN"; + public static final String EXTRA_VIEW_SIDEBAR = "EVSB"; private static final String FETCH_SUBREDDIT_INFO_STATE = "FSIS"; private static final String CURRENT_ONLINE_SUBSCRIBERS_STATE = "COSS"; @@ -195,6 +198,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp private int collapsedTabIndicatorColor; private int unsubscribedColor; private int subscribedColor; + private SlidrInterface mSlidrInterface; @Override protected void onCreate(Bundle savedInstanceState) { @@ -211,6 +215,10 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp applyCustomTheme(); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK_FROM_POST_DETAIL, true)) { + mSlidrInterface = Slidr.attach(this); + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { Window window = getWindow(); if (isImmersiveInterface()) { @@ -348,9 +356,9 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp } else { glide.load(subredditData.getBannerUrl()).into(bannerImageView); bannerImageView.setOnClickListener(view -> { - Intent intent = new Intent(ViewSubredditDetailActivity.this, ViewImageActivity.class); - intent.putExtra(ViewImageActivity.IMAGE_URL_KEY, subredditData.getBannerUrl()); - intent.putExtra(ViewImageActivity.FILE_NAME_KEY, subredditName + "-banner.jpg"); + Intent intent = new Intent(ViewSubredditDetailActivity.this, ViewImageOrGifActivity.class); + intent.putExtra(ViewImageOrGifActivity.IMAGE_URL_KEY, subredditData.getBannerUrl()); + intent.putExtra(ViewImageOrGifActivity.FILE_NAME_KEY, subredditName + "-banner.jpg"); startActivity(intent); }); } @@ -369,9 +377,9 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(216, 0)))) .into(iconGifImageView); iconGifImageView.setOnClickListener(view -> { - Intent intent = new Intent(ViewSubredditDetailActivity.this, ViewImageActivity.class); - intent.putExtra(ViewImageActivity.IMAGE_URL_KEY, subredditData.getIconUrl()); - intent.putExtra(ViewImageActivity.FILE_NAME_KEY, subredditName + "-icon.jpg"); + Intent intent = new Intent(ViewSubredditDetailActivity.this, ViewImageOrGifActivity.class); + intent.putExtra(ViewImageOrGifActivity.IMAGE_URL_KEY, subredditData.getIconUrl()); + intent.putExtra(ViewImageOrGifActivity.FILE_NAME_KEY, subredditName + "-icon.jpg"); startActivity(intent); }); } @@ -623,16 +631,27 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp }).execute(); sectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); + viewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { + @Override + public void onPageSelected(int position) { + if (position == 0) { + unlockSwipeRightToGoBack(); + } else { + lockSwipeRightToGoBack(); + } + } + }); viewPager.setAdapter(sectionsPagerAdapter); viewPager.setOffscreenPageLimit(2); tabLayout.setupWithViewPager(viewPager); - viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { - @Override - public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { - } + boolean viewSidebar = getIntent().getBooleanExtra(EXTRA_VIEW_SIDEBAR, false); + if (viewSidebar) { + viewPager.setCurrentItem(1, false); + } + viewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { if (mAccessToken != null) { @@ -651,11 +670,6 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp sectionsPagerAdapter.displaySortTypeInToolbar(); } - - @Override - public void onPageScrollStateChanged(int state) { - - } }); } @@ -701,34 +715,31 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp fetchSubredditData(); return true; case R.id.action_lazy_mode_view_subreddit_detail_activity: - MenuItem lazyModeItem = mMenu.findItem(R.id.action_lazy_mode_view_subreddit_detail_activity); - if (isInLazyMode) { - isInLazyMode = false; - sectionsPagerAdapter.stopLazyMode(); - lazyModeItem.setTitle(R.string.action_start_lazy_mode); - params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS | - AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS_COLLAPSED); - collapsingToolbarLayout.setLayoutParams(params); - } else { - isInLazyMode = true; - if (sectionsPagerAdapter.startLazyMode()) { - lazyModeItem.setTitle(R.string.action_stop_lazy_mode); - appBarLayout.setExpanded(false); - params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_EXIT_UNTIL_COLLAPSED); + if (sectionsPagerAdapter != null) { + MenuItem lazyModeItem = mMenu.findItem(R.id.action_lazy_mode_view_subreddit_detail_activity); + if (isInLazyMode) { + isInLazyMode = false; + sectionsPagerAdapter.stopLazyMode(); + lazyModeItem.setTitle(R.string.action_start_lazy_mode); + params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS | + AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS_COLLAPSED); collapsingToolbarLayout.setLayoutParams(params); } else { - isInLazyMode = false; + isInLazyMode = true; + if (sectionsPagerAdapter.startLazyMode()) { + lazyModeItem.setTitle(R.string.action_stop_lazy_mode); + appBarLayout.setExpanded(false); + params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_EXIT_UNTIL_COLLAPSED); + collapsingToolbarLayout.setLayoutParams(params); + } else { + isInLazyMode = false; + } } } return true; case R.id.action_change_post_layout_view_subreddit_detail_activity: postLayoutBottomSheetFragment.show(getSupportFragmentManager(), postLayoutBottomSheetFragment.getTag()); return true; - case R.id.action_view_side_bar_view_subreddit_detail_activity: - Intent sidebarIntent = new Intent(this, ViewSidebarActivity.class); - sidebarIntent.putExtra(ViewSidebarActivity.EXTRA_SUBREDDIT_NAME, subredditName); - startActivity(sidebarIntent); - return true; case R.id.action_share_view_subreddit_detail_activity: Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("text/plain"); @@ -777,7 +788,9 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp @Override public void sortTypeSelected(SortType sortType) { - sectionsPagerAdapter.changeSortType(sortType); + if (sectionsPagerAdapter != null) { + sectionsPagerAdapter.changeSortType(sortType); + } } @Override @@ -976,7 +989,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp public void changeSortType(SortType sortType) { if (postFragment != null) { mSortTypeSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TYPE_SUBREDDIT_POST_BASE + subredditName, sortType.getType().name()).apply(); - if(sortType.getTime() != null) { + if (sortType.getTime() != null) { mSortTypeSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TIME_SUBREDDIT_POST_BASE + subredditName, sortType.getTime().name()).apply(); } @@ -1019,4 +1032,16 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp } } } + + private void lockSwipeRightToGoBack() { + if (mSlidrInterface != null) { + mSlidrInterface.lock(); + } + } + + private void unlockSwipeRightToGoBack() { + if (mSlidrInterface != null) { + mSlidrInterface.unlock(); + } + } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java index a72c7389..c3d4c345 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java @@ -36,6 +36,8 @@ import com.google.android.material.chip.Chip; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.snackbar.Snackbar; import com.google.android.material.tabs.TabLayout; +import com.r0adkll.slidr.Slidr; +import com.r0adkll.slidr.model.SlidrInterface; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -171,6 +173,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele private boolean showToast = false; private String mMessageFullname; private String mNewAccountName; + private SlidrInterface mSlidrInterface; @Override protected void onCreate(Bundle savedInstanceState) { @@ -187,6 +190,10 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele applyCustomTheme(); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK_FROM_POST_DETAIL, true)) { + mSlidrInterface = Slidr.attach(this); + } + username = getIntent().getStringExtra(EXTRA_USER_NAME_KEY); if (savedInstanceState == null) { @@ -295,9 +302,9 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele } else { glide.load(userData.getBanner()).into(bannerImageView); bannerImageView.setOnClickListener(view -> { - Intent intent = new Intent(this, ViewImageActivity.class); - intent.putExtra(ViewImageActivity.IMAGE_URL_KEY, userData.getBanner()); - intent.putExtra(ViewImageActivity.FILE_NAME_KEY, username + "-banner.jpg"); + Intent intent = new Intent(this, ViewImageOrGifActivity.class); + intent.putExtra(ViewImageOrGifActivity.IMAGE_URL_KEY, userData.getBanner()); + intent.putExtra(ViewImageOrGifActivity.FILE_NAME_KEY, username + "-banner.jpg"); startActivity(intent); }); } @@ -315,9 +322,9 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele .into(iconGifImageView); iconGifImageView.setOnClickListener(view -> { - Intent intent = new Intent(this, ViewImageActivity.class); - intent.putExtra(ViewImageActivity.IMAGE_URL_KEY, userData.getIconUrl()); - intent.putExtra(ViewImageActivity.FILE_NAME_KEY, username + "-icon.jpg"); + Intent intent = new Intent(this, ViewImageOrGifActivity.class); + intent.putExtra(ViewImageOrGifActivity.IMAGE_URL_KEY, userData.getIconUrl()); + intent.putExtra(ViewImageOrGifActivity.FILE_NAME_KEY, username + "-icon.jpg"); startActivity(intent); }); } @@ -496,12 +503,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele viewPager.setOffscreenPageLimit(2); tabLayout.setupWithViewPager(viewPager); - viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { - @Override - public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { - - } - + viewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { if (isInLazyMode) { @@ -511,13 +513,13 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele sectionsPagerAdapter.pauseLazyMode(); } } + if (position == 0) { + unlockSwipeRightToGoBack(); + } else { + lockSwipeRightToGoBack(); + } sectionsPagerAdapter.displaySortTypeInToolbar(); } - - @Override - public void onPageScrollStateChanged(int state) { - - } }); if (mAccessToken != null && mMessageFullname != null) { @@ -926,4 +928,16 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele } } } + + private void lockSwipeRightToGoBack() { + if (mSlidrInterface != null) { + mSlidrInterface.lock(); + } + } + + private void unlockSwipeRightToGoBack() { + if (mSlidrInterface != null) { + mSlidrInterface.unlock(); + } + } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewVideoActivity.java index 0bd5f7fc..3db53108 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewVideoActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewVideoActivity.java @@ -1,8 +1,6 @@ package ml.docilealligator.infinityforreddit.Activity; import android.Manifest; -import android.app.DownloadManager; -import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; @@ -13,7 +11,6 @@ import android.media.AudioManager; import android.net.Uri; import android.os.Build; import android.os.Bundle; -import android.os.Environment; import android.text.Html; import android.view.Menu; import android.view.MenuItem; @@ -27,6 +24,7 @@ import android.widget.Toast; import androidx.annotation.NonNull; import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AppCompatActivity; +import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; @@ -47,17 +45,22 @@ import com.google.android.exoplayer2.upstream.DataSource; import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory; import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory; import com.google.android.exoplayer2.util.Util; +import com.google.android.material.snackbar.Snackbar; +import com.thefuntasty.hauler.DragDirection; import com.thefuntasty.hauler.HaulerView; -import java.io.File; - import javax.inject.Inject; import javax.inject.Named; import butterknife.BindView; import butterknife.ButterKnife; -import ml.docilealligator.infinityforreddit.FetchGfycatVideoLinks; +import ml.docilealligator.infinityforreddit.FetchGfycatOrRedgifsVideoLinks; +import ml.docilealligator.infinityforreddit.Font.ContentFontFamily; +import ml.docilealligator.infinityforreddit.Font.FontFamily; +import ml.docilealligator.infinityforreddit.Font.TitleFontFamily; import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.MediaDownloader; +import ml.docilealligator.infinityforreddit.MediaDownloaderImpl; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.Service.DownloadRedditVideoService; import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; @@ -82,6 +85,8 @@ public class ViewVideoActivity extends AppCompatActivity { private static final String VIDEO_URI_STATE = "VUS"; @BindView(R.id.hauler_view_view_video_activity) HaulerView haulerView; + @BindView(R.id.coordinator_layout_view_video_activity) + CoordinatorLayout coordinatorLayout; @BindView(R.id.progress_bar_view_video_activity) ProgressBar progressBar; @BindView(R.id.player_view_view_video_activity) @@ -92,6 +97,7 @@ public class ViewVideoActivity extends AppCompatActivity { private Uri mVideoUri; private SimpleExoPlayer player; private DataSource.Factory dataSourceFactory; + private MediaDownloader mediaDownloader; private String videoDownloadUrl; private String videoFileName; @@ -119,11 +125,21 @@ public class ViewVideoActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + + ((Infinity) getApplication()).getAppComponent().inject(this); + getTheme().applyStyle(R.style.Theme_Normal, true); - setContentView(R.layout.activity_view_video); + getTheme().applyStyle(FontFamily.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.FONT_FAMILY_KEY, FontFamily.Default.name())).getResId(), true); - ((Infinity) getApplication()).getAppComponent().inject(this); + getTheme().applyStyle(TitleFontFamily.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.TITLE_FONT_FAMILY_KEY, TitleFontFamily.Default.name())).getResId(), true); + + getTheme().applyStyle(ContentFontFamily.valueOf(mSharedPreferences + .getString(SharedPreferencesUtils.CONTENT_FONT_FAMILY_KEY, ContentFontFamily.Default.name())).getResId(), true); + + setContentView(R.layout.activity_view_video); ButterKnife.bind(this); setVolumeControlStream(AudioManager.STREAM_MUSIC); @@ -147,7 +163,13 @@ public class ViewVideoActivity extends AppCompatActivity { params.rightMargin = getResources().getDimensionPixelSize(resourceId); } - haulerView.setOnDragDismissedListener(dragDirection -> finish()); + haulerView.setOnDragDismissedListener(dragDirection -> { + int slide = dragDirection == DragDirection.UP ? R.anim.slide_out_up : R.anim.slide_out_down; + finish(); + overridePendingTransition(0, slide); + }); + + mediaDownloader = new MediaDownloaderImpl(); Intent intent = getIntent(); mVideoUri = intent.getData(); @@ -196,42 +218,17 @@ public class ViewVideoActivity extends AppCompatActivity { } if (mVideoUri == null) { - progressBar.setVisibility(View.VISIBLE); String gfycatId = intent.getStringExtra(EXTRA_GFYCAT_ID); if (gfycatId != null && gfycatId.contains("-")) { gfycatId = gfycatId.substring(0, gfycatId.indexOf('-')); } - Retrofit retrofit; if (videoType == VIDEO_TYPE_GFYCAT) { - retrofit = gfycatRetrofit; videoFileName = "Gfycat-" + gfycatId + ".mp4"; + loadGfycatOrRedgifsVideo(gfycatRetrofit, gfycatId, savedInstanceState, true); } else { - retrofit = redgifsRetrofit; videoFileName = "Redgifs-" + gfycatId + ".mp4"; + loadGfycatOrRedgifsVideo(redgifsRetrofit, gfycatId, savedInstanceState, false); } - FetchGfycatVideoLinks.fetchGfycatVideoLinks(retrofit, gfycatId, - new FetchGfycatVideoLinks.FetchGfycatVideoLinksListener() { - @Override - public void success(String webm, String mp4) { - progressBar.setVisibility(View.GONE); - mVideoUri = Uri.parse(webm); - videoDownloadUrl = mp4; - dataSourceFactory = new DefaultDataSourceFactory(ViewVideoActivity.this, - Util.getUserAgent(ViewVideoActivity.this, "Infinity")); - player.prepare(new ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(mVideoUri)); - preparePlayer(savedInstanceState); - } - - @Override - public void failed() { - progressBar.setVisibility(View.GONE); - if (videoType == VIDEO_TYPE_GFYCAT) { - Toast.makeText(ViewVideoActivity.this, R.string.fetch_gfycat_video_failed, Toast.LENGTH_SHORT).show(); - } else { - Toast.makeText(ViewVideoActivity.this, R.string.fetch_redgifs_video_failed, Toast.LENGTH_SHORT).show(); - } - } - }); } else { dataSourceFactory = new DefaultDataSourceFactory(ViewVideoActivity.this, Util.getUserAgent(ViewVideoActivity.this, "Infinity")); @@ -315,6 +312,42 @@ public class ViewVideoActivity extends AppCompatActivity { }); } + private void loadGfycatOrRedgifsVideo(Retrofit retrofit, String gfycatId, Bundle savedInstanceState, boolean needErrorHandling) { + progressBar.setVisibility(View.VISIBLE); + FetchGfycatOrRedgifsVideoLinks.fetchGfycatOrRedgifsVideoLinks(retrofit, gfycatId, + new FetchGfycatOrRedgifsVideoLinks.FetchGfycatOrRedgifsVideoLinksListener() { + @Override + public void success(String webm, String mp4) { + progressBar.setVisibility(View.GONE); + mVideoUri = Uri.parse(webm); + videoDownloadUrl = mp4; + dataSourceFactory = new DefaultDataSourceFactory(ViewVideoActivity.this, + Util.getUserAgent(ViewVideoActivity.this, "Infinity")); + player.prepare(new ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(mVideoUri)); + preparePlayer(savedInstanceState); + } + + @Override + public void failed(int errorCode) { + progressBar.setVisibility(View.GONE); + if (videoType == VIDEO_TYPE_GFYCAT) { + if (errorCode == 404 && needErrorHandling) { + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.AUTOMATICALLY_TRY_REDGIFS, true)) { + loadGfycatOrRedgifsVideo(redgifsRetrofit, gfycatId, savedInstanceState, false); + } else { + Snackbar.make(coordinatorLayout, R.string.load_video_in_redgifs, Snackbar.LENGTH_INDEFINITE).setAction(R.string.yes, + view -> loadGfycatOrRedgifsVideo(redgifsRetrofit, gfycatId, savedInstanceState, false)).show(); + } + } else { + Toast.makeText(ViewVideoActivity.this, R.string.fetch_gfycat_video_failed, Toast.LENGTH_SHORT).show(); + } + } else { + Toast.makeText(ViewVideoActivity.this, R.string.fetch_redgifs_video_failed, Toast.LENGTH_SHORT).show(); + } + } + }); + } + @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.view_video, menu); @@ -394,46 +427,7 @@ public class ViewVideoActivity extends AppCompatActivity { isDownloading = false; if (videoType != VIDEO_TYPE_NORMAL) { - DownloadManager.Request request = new DownloadManager.Request(Uri.parse(videoDownloadUrl)); - request.setTitle(videoFileName); - - request.allowScanningByMediaScanner(); - request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); - - //Android Q support - if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - request.setDestinationInExternalPublicDir(Environment.DIRECTORY_PICTURES, videoFileName); - } else { - String path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).toString(); - File directory = new File(path + "/Infinity/"); - boolean saveToInfinityFolder = true; - if (!directory.exists()) { - if (!directory.mkdir()) { - saveToInfinityFolder = false; - } - } else { - if (directory.isFile()) { - if (!(directory.delete() && directory.mkdir())) { - saveToInfinityFolder = false; - } - } - } - - if (saveToInfinityFolder) { - request.setDestinationInExternalPublicDir(Environment.DIRECTORY_PICTURES + "/Infinity/", videoFileName); - } else { - request.setDestinationInExternalPublicDir(Environment.DIRECTORY_PICTURES, videoFileName); - } - } - - DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE); - - if (manager == null) { - Toast.makeText(this, R.string.download_failed, Toast.LENGTH_SHORT).show(); - return; - } - - manager.enqueue(request); + mediaDownloader.download(videoDownloadUrl, videoFileName, this); } else { Intent intent = new Intent(this, DownloadRedditVideoService.class); intent.putExtra(DownloadRedditVideoService.EXTRA_VIDEO_URL, videoDownloadUrl); @@ -445,8 +439,8 @@ public class ViewVideoActivity extends AppCompatActivity { } else { startService(intent); } + Toast.makeText(this, R.string.download_started, Toast.LENGTH_SHORT).show(); } - Toast.makeText(this, R.string.download_started, Toast.LENGTH_SHORT).show(); } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java index c4d65766..3689f9a8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java @@ -36,6 +36,7 @@ import androidx.recyclerview.widget.RecyclerView; import com.bumptech.glide.RequestBuilder; import com.bumptech.glide.RequestManager; import com.bumptech.glide.load.DataSource; +import com.bumptech.glide.load.DecodeFormat; import com.bumptech.glide.load.engine.GlideException; import com.bumptech.glide.request.RequestListener; import com.bumptech.glide.request.RequestOptions; @@ -81,8 +82,7 @@ import jp.wasabeef.glide.transformations.RoundedCornersTransformation; import ml.docilealligator.infinityforreddit.Activity.CommentActivity; import ml.docilealligator.infinityforreddit.Activity.FilteredThingActivity; import ml.docilealligator.infinityforreddit.Activity.LinkResolverActivity; -import ml.docilealligator.infinityforreddit.Activity.ViewGIFActivity; -import ml.docilealligator.infinityforreddit.Activity.ViewImageActivity; +import ml.docilealligator.infinityforreddit.Activity.ViewImageOrGifActivity; import ml.docilealligator.infinityforreddit.Activity.ViewPostDetailActivity; import ml.docilealligator.infinityforreddit.Activity.ViewSubredditDetailActivity; import ml.docilealligator.infinityforreddit.Activity.ViewUserDetailActivity; @@ -155,6 +155,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy private boolean mShowAbsoluteNumberOfVotes; private boolean mAutoplay = false; private boolean mAutoplayNsfwVideos; + private boolean mMuteAutoplayingVideos; private CommentRecyclerViewAdapterCallback mCommentRecyclerViewAdapterCallback; private boolean isInitiallyLoading; private boolean isInitiallyLoadingFailed; @@ -307,7 +308,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy mShowElapsedTime = mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_ELAPSED_TIME_KEY, false); mExpandChildren = !mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_TOP_LEVEL_COMMENTS_FIRST, false); mCommentToolbarHidden = mSharedPreferences.getBoolean(SharedPreferencesUtils.COMMENT_TOOLBAR_HIDDEN, false); - mCommentToolbarHideOnClick= mSharedPreferences.getBoolean(SharedPreferencesUtils.COMMENT_TOOLBAR_HIDE_ON_CLICK, true); + mCommentToolbarHideOnClick = mSharedPreferences.getBoolean(SharedPreferencesUtils.COMMENT_TOOLBAR_HIDE_ON_CLICK, true); mSwapTapAndLong = mSharedPreferences.getBoolean(SharedPreferencesUtils.SWAP_TAP_AND_LONG_COMMENTS, false); mShowCommentDivider = mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_COMMENT_DIVIDER, false); mShowAbsoluteNumberOfVotes = mSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_ABSOLUTE_NUMBER_OF_VOTES, true); @@ -319,6 +320,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy mAutoplay = Utils.isConnectedToWifi(activity); } mAutoplayNsfwVideos = mSharedPreferences.getBoolean(SharedPreferencesUtils.AUTOPLAY_NSFW_VIDEOS, true); + mMuteAutoplayingVideos = mSharedPreferences.getBoolean(SharedPreferencesUtils.MUTE_AUTOPLAYING_VIDEOS, true); mCommentRecyclerViewAdapterCallback = commentRecyclerViewAdapterCallback; isInitiallyLoading = true; @@ -934,7 +936,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy ((LoadMoreChildCommentsViewHolder) holder).placeholderTextView.setOnClickListener(view -> { int commentPosition = mIsSingleCommentThreadMode ? holder.getAdapterPosition() - 2 : holder.getAdapterPosition() - 1; int parentPosition = getParentPosition(commentPosition); - if(parentPosition >= 0) { + if (parentPosition >= 0) { CommentData parentComment = mVisibleComments.get(parentPosition); mVisibleComments.get(commentPosition).setLoadingMoreChildren(true); @@ -1117,7 +1119,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy private void loadImage(PostDetailBaseViewHolder holder) { if (holder instanceof PostDetailImageAndGifAutoplayViewHolder) { String url = mAutoplay && mPost.getPostType() == Post.GIF_TYPE ? mPost.getUrl() : mPost.getPreviewUrl(); - RequestBuilder imageRequestBuilder = mGlide.load(url) + RequestBuilder<Drawable> imageRequestBuilder = mGlide.load(url) .listener(new RequestListener<Drawable>() { @Override public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) { @@ -1142,10 +1144,10 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10))) .into(((PostDetailImageAndGifAutoplayViewHolder) holder).mImageView); } else { - imageRequestBuilder.into(((PostDetailImageAndGifAutoplayViewHolder) holder).mImageView); + imageRequestBuilder.apply(RequestOptions.noTransformation()).into(((PostDetailImageAndGifAutoplayViewHolder) holder).mImageView); } } else if (holder instanceof PostDetailVideoAndGifPreviewHolder) { - RequestBuilder imageRequestBuilder = mGlide.load(mPost.getPreviewUrl()) + RequestBuilder<Drawable> imageRequestBuilder = mGlide.load(mPost.getPreviewUrl()) .listener(new RequestListener<Drawable>() { @Override public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) { @@ -1170,10 +1172,10 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10))) .into(((PostDetailVideoAndGifPreviewHolder) holder).mImageView); } else { - imageRequestBuilder.into(((PostDetailVideoAndGifPreviewHolder) holder).mImageView); + imageRequestBuilder.apply(RequestOptions.noTransformation()).into(((PostDetailVideoAndGifPreviewHolder) holder).mImageView); } - } else if(holder instanceof PostDetailLinkViewHolder) { - RequestBuilder imageRequestBuilder = mGlide.load(mPost.getPreviewUrl()) + } else if (holder instanceof PostDetailLinkViewHolder) { + RequestBuilder<Drawable> imageRequestBuilder = mGlide.load(mPost.getPreviewUrl()) .listener(new RequestListener<Drawable>() { @Override public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) { @@ -1198,7 +1200,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10))) .into(((PostDetailLinkViewHolder) holder).mImageView); } else { - imageRequestBuilder.into(((PostDetailLinkViewHolder) holder).mImageView); + imageRequestBuilder.apply(RequestOptions.noTransformation()).into(((PostDetailLinkViewHolder) holder).mImageView); } } } @@ -1385,8 +1387,11 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy } } - public void editComment(String commentContent, int position) { - mVisibleComments.get(position).setCommentMarkdown(commentContent); + public void editComment(String commentAuthor, String commentContentMarkdown, int position) { + if (commentAuthor != null) + mVisibleComments.get(position).setAuthor(commentAuthor); + + mVisibleComments.get(position).setCommentMarkdown(commentContentMarkdown); if (mIsSingleCommentThreadMode) { notifyItemChanged(position + 2); } else { @@ -2016,7 +2021,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy @Nullable ExoPlayerViewHelper helper; private Uri mediaUri; - private float volume = 0f; + private float volume; public PostDetailVideoAutoplayViewHolder(@NonNull View itemView) { super(itemView); @@ -2045,6 +2050,8 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy aspectRatioFrameLayout.setOnClickListener(null); + volume = mMuteAutoplayingVideos ? 0f : 1f; + muteButton.setOnClickListener(view -> { if (helper != null) { if (helper.getVolume() != 0) { @@ -2255,11 +2262,11 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy intent.putExtra(ViewVideoActivity.EXTRA_POST_TITLE, mPost.getTitle()); mActivity.startActivity(intent); } else if (mPost.getPostType() == Post.GIF_TYPE) { - Intent intent = new Intent(mActivity, ViewGIFActivity.class); - intent.putExtra(ViewGIFActivity.FILE_NAME_KEY, mPost.getSubredditName() + Intent intent = new Intent(mActivity, ViewImageOrGifActivity.class); + intent.putExtra(ViewImageOrGifActivity.FILE_NAME_KEY, mPost.getSubredditName() + "-" + mPost.getId() + ".gif"); - intent.putExtra(ViewGIFActivity.GIF_URL_KEY, mPost.getVideoUrl()); - intent.putExtra(ViewImageActivity.POST_TITLE_KEY, mPost.getTitle()); + intent.putExtra(ViewImageOrGifActivity.GIF_URL_KEY, mPost.getVideoUrl()); + intent.putExtra(ViewImageOrGifActivity.POST_TITLE_KEY, mPost.getTitle()); mActivity.startActivity(intent); } }); @@ -2350,18 +2357,18 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy mImageView.setOnClickListener(view -> { if (mPost.getPostType() == Post.IMAGE_TYPE) { - Intent intent = new Intent(mActivity, ViewImageActivity.class); - intent.putExtra(ViewImageActivity.IMAGE_URL_KEY, mPost.getUrl()); - intent.putExtra(ViewImageActivity.FILE_NAME_KEY, mPost.getSubredditNamePrefixed().substring(2) + Intent intent = new Intent(mActivity, ViewImageOrGifActivity.class); + intent.putExtra(ViewImageOrGifActivity.IMAGE_URL_KEY, mPost.getUrl()); + intent.putExtra(ViewImageOrGifActivity.FILE_NAME_KEY, mPost.getSubredditNamePrefixed().substring(2) + "-" + mPost.getId().substring(3) + ".jpg"); - intent.putExtra(ViewImageActivity.POST_TITLE_KEY, mPost.getTitle()); + intent.putExtra(ViewImageOrGifActivity.POST_TITLE_KEY, mPost.getTitle()); mActivity.startActivity(intent); } else if (mPost.getPostType() == Post.GIF_TYPE) { - Intent intent = new Intent(mActivity, ViewGIFActivity.class); - intent.putExtra(ViewGIFActivity.FILE_NAME_KEY, mPost.getSubredditName() + Intent intent = new Intent(mActivity, ViewImageOrGifActivity.class); + intent.putExtra(ViewImageOrGifActivity.FILE_NAME_KEY, mPost.getSubredditName() + "-" + mPost.getId() + ".gif"); - intent.putExtra(ViewGIFActivity.GIF_URL_KEY, mPost.getVideoUrl()); - intent.putExtra(ViewImageActivity.POST_TITLE_KEY, mPost.getTitle()); + intent.putExtra(ViewImageOrGifActivity.GIF_URL_KEY, mPost.getVideoUrl()); + intent.putExtra(ViewImageOrGifActivity.POST_TITLE_KEY, mPost.getTitle()); mActivity.startActivity(intent); } }); @@ -2934,7 +2941,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy expandButton.setOnClickListener(view -> { if (expandButton.getVisibility() == View.VISIBLE) { int commentPosition = mIsSingleCommentThreadMode ? getAdapterPosition() - 2 : getAdapterPosition() - 1; - if(commentPosition >= 0 && commentPosition < mVisibleComments.size()) { + if (commentPosition >= 0 && commentPosition < mVisibleComments.size()) { CommentData comment = getCurrentComment(); if (mVisibleComments.get(commentPosition).isExpanded()) { collapseChildren(commentPosition); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/FollowedUsersRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/FollowedUsersRecyclerViewAdapter.java index a60cf1e1..5e2cf2da 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/FollowedUsersRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/FollowedUsersRecyclerViewAdapter.java @@ -294,7 +294,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc @Override public String getPopupText(int position) { switch (getItemViewType(position)) { - case VIEW_TYPE_USER_DIVIDER: + case VIEW_TYPE_USER: int offset = (mFavoriteSubscribedUserData != null && mFavoriteSubscribedUserData.size() > 0) ? mFavoriteSubscribedUserData.size() + 2 : 0; return mSubscribedUserData.get(position - offset).getName().substring(0, 1).toUpperCase(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/MultiRedditListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/MultiRedditListingRecyclerViewAdapter.java index 4be79e91..51939d7f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/MultiRedditListingRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/MultiRedditListingRecyclerViewAdapter.java @@ -125,7 +125,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter< ((MultiRedditViewHolder) holder).favoriteImageView.setImageResource(R.drawable.ic_favorite_border_24dp); multiReddit.setFavorite(false); FavoriteMultiReddit.favoriteMultiReddit(mOauthRetrofit, mRedditDataRoomDatabase, - mAccessToken, mAccountName, false, multiReddit, + mAccessToken, false, multiReddit, new FavoriteMultiReddit.FavoriteMultiRedditListener() { @Override public void success() { @@ -151,7 +151,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter< ((MultiRedditViewHolder) holder).favoriteImageView.setImageResource(R.drawable.ic_favorite_24dp); multiReddit.setFavorite(true); FavoriteMultiReddit.favoriteMultiReddit(mOauthRetrofit, mRedditDataRoomDatabase, - mAccessToken, mAccountName, true, multiReddit, + mAccessToken, true, multiReddit, new FavoriteMultiReddit.FavoriteMultiRedditListener() { @Override public void success() { @@ -213,7 +213,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter< ((FavoriteMultiRedditViewHolder) holder).favoriteImageView.setImageResource(R.drawable.ic_favorite_border_24dp); multiReddit.setFavorite(false); FavoriteMultiReddit.favoriteMultiReddit(mOauthRetrofit, mRedditDataRoomDatabase, - mAccessToken, mAccountName, false, multiReddit, + mAccessToken, false, multiReddit, new FavoriteMultiReddit.FavoriteMultiRedditListener() { @Override public void success() { @@ -239,7 +239,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter< ((FavoriteMultiRedditViewHolder) holder).favoriteImageView.setImageResource(R.drawable.ic_favorite_24dp); multiReddit.setFavorite(true); FavoriteMultiReddit.favoriteMultiReddit(mOauthRetrofit, mRedditDataRoomDatabase, - mAccessToken, mAccountName, true, multiReddit, + mAccessToken, true, multiReddit, new FavoriteMultiReddit.FavoriteMultiRedditListener() { @Override public void success() { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/NavigationDrawerRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/NavigationDrawerRecyclerViewAdapter.java index 0491c1ed..7d038fa0 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/NavigationDrawerRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/NavigationDrawerRecyclerViewAdapter.java @@ -42,7 +42,7 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re private static final int VIEW_TYPE_DIVIDER = 3; private static final int VIEW_TYPE_SUBSCRIBED_SUBREDDIT = 4; private static final int VIEW_TYPE_ACCOUNT = 5; - private static final int CURRENT_MENU_ITEMS = 16; + private static final int CURRENT_MENU_ITEMS = 17; private Context context; private Resources resources; @@ -90,9 +90,9 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re return VIEW_TYPE_SUBSCRIBED_SUBREDDIT; } else if (position == 0) { return VIEW_TYPE_NAV_HEADER; - } else if (position == 1 || position == 6) { + } else if (position == 1 || position == 6 || position == 12) { return VIEW_TYPE_MENU_GROUP_TITLE; - } else if (position == 12) { + } else if (position == 16) { return VIEW_TYPE_DIVIDER; } else { return VIEW_TYPE_MENU_ITEM; @@ -214,6 +214,8 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re ((MenuGroupTitleViewHolder) holder).titleTextView.setText(R.string.label_account); } else if (position == 6) { ((MenuGroupTitleViewHolder) holder).titleTextView.setText(R.string.label_post); + } else if (position == 12) { + ((MenuGroupTitleViewHolder) holder).titleTextView.setText(R.string.label_preferences); } } else if (holder instanceof MenuItemViewHolder) { int stringId = 0; @@ -401,7 +403,7 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re if (subscribedSubreddits != null) { return CURRENT_MENU_ITEMS + subscribedSubreddits.size(); } - return CURRENT_MENU_ITEMS; + return CURRENT_MENU_ITEMS - 1; } else { return 4; } @@ -448,7 +450,7 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re this.isNSFWEnabled = isNSFWEnabled; if (isInMainPage) { if (isLoggedIn) { - notifyItemChanged(CURRENT_MENU_ITEMS - 2); + notifyItemChanged(CURRENT_MENU_ITEMS - 3); } else { notifyItemChanged(2); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java index 7aaaa391..86101979 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java @@ -22,6 +22,7 @@ import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; +import androidx.constraintlayout.widget.Barrier; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.constraintlayout.widget.ConstraintSet; import androidx.core.graphics.drawable.DrawableCompat; @@ -33,6 +34,7 @@ import com.bumptech.glide.Glide; import com.bumptech.glide.RequestBuilder; import com.bumptech.glide.RequestManager; import com.bumptech.glide.load.DataSource; +import com.bumptech.glide.load.DecodeFormat; import com.bumptech.glide.load.engine.GlideException; import com.bumptech.glide.request.RequestListener; import com.bumptech.glide.request.RequestOptions; @@ -64,18 +66,17 @@ import jp.wasabeef.glide.transformations.BlurTransformation; import jp.wasabeef.glide.transformations.RoundedCornersTransformation; import ml.docilealligator.infinityforreddit.Activity.FilteredThingActivity; import ml.docilealligator.infinityforreddit.Activity.LinkResolverActivity; -import ml.docilealligator.infinityforreddit.Activity.ViewGIFActivity; -import ml.docilealligator.infinityforreddit.Activity.ViewImageActivity; +import ml.docilealligator.infinityforreddit.Activity.ViewImageOrGifActivity; import ml.docilealligator.infinityforreddit.Activity.ViewPostDetailActivity; import ml.docilealligator.infinityforreddit.Activity.ViewSubredditDetailActivity; import ml.docilealligator.infinityforreddit.Activity.ViewUserDetailActivity; import ml.docilealligator.infinityforreddit.Activity.ViewVideoActivity; import ml.docilealligator.infinityforreddit.AsyncTask.LoadSubredditIconAsyncTask; import ml.docilealligator.infinityforreddit.AsyncTask.LoadUserDataAsyncTask; +import ml.docilealligator.infinityforreddit.BottomSheetFragment.ShareLinkBottomSheetFragment; import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView; import ml.docilealligator.infinityforreddit.Event.PostUpdateEventToDetailActivity; -import ml.docilealligator.infinityforreddit.BottomSheetFragment.ShareLinkBottomSheetFragment; import ml.docilealligator.infinityforreddit.NetworkState; import ml.docilealligator.infinityforreddit.Post.Post; import ml.docilealligator.infinityforreddit.Post.PostDataSource; @@ -153,6 +154,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView private int mVoteAndReplyUnavailableVoteButtonColor; private int mButtonTextColor; private int mPostIconAndInfoColor; + private int mDividerColor; private float mScale; private boolean mDisplaySubredditName; private boolean mVoteButtonsOnTheRight; @@ -163,6 +165,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView private boolean mShowAbsoluteNumberOfVotes; private boolean mAutoplay = false; private boolean mAutoplayNsfwVideos; + private boolean mMuteAutoplayingVideos; + private boolean mShowThumbnailOnTheRightInCompactLayout; private Drawable mCommentIcon; private NetworkState networkState; private ExoCreator mExoCreator; @@ -196,6 +200,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView mAutoplay = Utils.isConnectedToWifi(activity); } mAutoplayNsfwVideos = sharedPreferences.getBoolean(SharedPreferencesUtils.AUTOPLAY_NSFW_VIDEOS, true); + mMuteAutoplayingVideos = sharedPreferences.getBoolean(SharedPreferencesUtils.MUTE_AUTOPLAYING_VIDEOS, true); + mShowThumbnailOnTheRightInCompactLayout = sharedPreferences.getBoolean( + SharedPreferencesUtils.SHOW_THUMBNAIL_ON_THE_RIGHT_IN_COMPACT_LAYOUT, false); mPostLayout = postLayout; mColorPrimaryLightTheme = customThemeWrapper.getColorPrimaryLightTheme(); @@ -227,6 +234,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView mVoteAndReplyUnavailableVoteButtonColor = customThemeWrapper.getVoteAndReplyUnavailableButtonColor(); mButtonTextColor = customThemeWrapper.getButtonTextColor(); mPostIconAndInfoColor = customThemeWrapper.getPostIconAndInfoColor(); + mDividerColor = customThemeWrapper.getDividerColor(); mCommentIcon = activity.getDrawable(R.drawable.ic_comment_grey_24dp); if (mCommentIcon != null) { @@ -830,9 +838,9 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView final String imageUrl = post.getUrl(); ((PostCompactViewHolder) holder).imageView.setOnClickListener(view -> { - Intent intent = new Intent(mActivity, ViewImageActivity.class); - intent.putExtra(ViewImageActivity.IMAGE_URL_KEY, imageUrl); - intent.putExtra(ViewImageActivity.FILE_NAME_KEY, subredditName + Intent intent = new Intent(mActivity, ViewImageOrGifActivity.class); + intent.putExtra(ViewImageOrGifActivity.IMAGE_URL_KEY, imageUrl); + intent.putExtra(ViewImageOrGifActivity.FILE_NAME_KEY, subredditName + "-" + id + ".jpg"); mActivity.startActivity(intent); }); @@ -860,11 +868,11 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView final Uri gifVideoUri = Uri.parse(post.getVideoUrl()); ((PostCompactViewHolder) holder).imageView.setOnClickListener(view -> { - Intent intent = new Intent(mActivity, ViewGIFActivity.class); + Intent intent = new Intent(mActivity, ViewImageOrGifActivity.class); intent.setData(gifVideoUri); - intent.putExtra(ViewGIFActivity.FILE_NAME_KEY, subredditName + intent.putExtra(ViewImageOrGifActivity.FILE_NAME_KEY, subredditName + "-" + id + ".gif"); - intent.putExtra(ViewGIFActivity.GIF_URL_KEY, post.getVideoUrl()); + intent.putExtra(ViewImageOrGifActivity.GIF_URL_KEY, post.getVideoUrl()); mActivity.startActivity(intent); }); @@ -892,8 +900,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView ((PostCompactViewHolder) holder).linkTextView.setVisibility(View.VISIBLE); String noPreviewLinkDomain = Uri.parse(noPreviewLinkUrl).getHost(); ((PostCompactViewHolder) holder).linkTextView.setText(noPreviewLinkDomain); - ((PostCompactViewHolder) holder).noPreviewLinkImageView.setVisibility(View.VISIBLE); - ((PostCompactViewHolder) holder).noPreviewLinkImageView.setOnClickListener(view -> { + ((PostCompactViewHolder) holder).noPreviewLinkImageFrameLayout.setVisibility(View.VISIBLE); + ((PostCompactViewHolder) holder).noPreviewLinkImageFrameLayout.setOnClickListener(view -> { Intent intent = new Intent(mActivity, LinkResolverActivity.class); Uri uri = Uri.parse(post.getUrl()); if (uri.getScheme() == null && uri.getHost() == null) { @@ -1141,7 +1149,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10))) .into(((PostImageAndGifAutoplayViewHolder) holder).imageView); } else { - imageRequestBuilder.into(((PostImageAndGifAutoplayViewHolder) holder).imageView); + imageRequestBuilder.apply(RequestOptions.noTransformation()).into(((PostImageAndGifAutoplayViewHolder) holder).imageView); } } else if (holder instanceof PostVideoAndGifPreviewViewHolder) { RequestBuilder<Drawable> imageRequestBuilder = mGlide.load(post.getPreviewUrl()).listener(new RequestListener<Drawable>() { @@ -1169,7 +1177,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10))) .into(((PostVideoAndGifPreviewViewHolder) holder).imageView); } else { - imageRequestBuilder.into(((PostVideoAndGifPreviewViewHolder) holder).imageView); + imageRequestBuilder.apply(RequestOptions.noTransformation()).into(((PostVideoAndGifPreviewViewHolder) holder).imageView); } } else if (holder instanceof PostLinkTypeViewHolder) { RequestBuilder<Drawable> imageRequestBuilder = mGlide.load(post.getPreviewUrl()).listener(new RequestListener<Drawable>() { @@ -1197,28 +1205,27 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10))) .into(((PostLinkTypeViewHolder) holder).imageView); } else { - imageRequestBuilder.into(((PostLinkTypeViewHolder) holder).imageView); + imageRequestBuilder.apply(RequestOptions.noTransformation()).into(((PostLinkTypeViewHolder) holder).imageView); } } else if (holder instanceof PostCompactViewHolder) { String previewUrl = post.getThumbnailPreviewUrl().equals("") ? post.getPreviewUrl() : post.getThumbnailPreviewUrl(); RequestBuilder<Drawable> imageRequestBuilder = mGlide.load(previewUrl) .error(R.drawable.ic_error_outline_black_24dp).listener(new RequestListener<Drawable>() { - @Override - public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) { - ((PostCompactViewHolder) holder).progressBar.setVisibility(View.GONE); - return false; - } + @Override + public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) { + ((PostCompactViewHolder) holder).progressBar.setVisibility(View.GONE); + return false; + } - @Override - public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) { - ((PostCompactViewHolder) holder).progressBar.setVisibility(View.GONE); - return false; - } - }); + @Override + public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) { + ((PostCompactViewHolder) holder).progressBar.setVisibility(View.GONE); + return false; + } + }); if ((post.isNSFW() && mNeedBlurNSFW) || post.isSpoiler() && mNeedBlurSpoiler) { imageRequestBuilder - .transform(new BlurTransformation(50, 2)) - .into(((PostCompactViewHolder) holder).imageView); + .transform(new BlurTransformation(50, 2)).into(((PostCompactViewHolder) holder).imageView); } else { imageRequestBuilder.into(((PostCompactViewHolder) holder).imageView); } @@ -1304,7 +1311,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView public void removeFooter() { if (hasExtraRow()) { - notifyItemRemoved(getItemCount() - 1); + notifyItemRemoved(getItemCount() - 1); } networkState = null; @@ -1322,6 +1329,14 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView mAutoplayNsfwVideos = autoplayNsfwVideos; } + public void setMuteAutoplayingVideos(boolean muteAutoplayingVideos) { + mMuteAutoplayingVideos = muteAutoplayingVideos; + } + + public void setShowThumbnailOnTheRightInCompactLayout(boolean showThumbnailOnTheRightInCompactLayout) { + mShowThumbnailOnTheRightInCompactLayout = showThumbnailOnTheRightInCompactLayout; + } + @Override public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) { super.onViewRecycled(holder); @@ -1375,7 +1390,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView ((PostCompactViewHolder) holder).progressBar.setVisibility(View.GONE); ((PostCompactViewHolder) holder).imageView.setVisibility(View.GONE); ((PostCompactViewHolder) holder).playButtonImageView.setVisibility(View.GONE); - ((PostCompactViewHolder) holder).noPreviewLinkImageView.setVisibility(View.GONE); + ((PostCompactViewHolder) holder).noPreviewLinkImageFrameLayout.setVisibility(View.GONE); ((PostCompactViewHolder) holder).upvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); ((PostCompactViewHolder) holder).scoreTextView.setTextColor(mPostIconAndInfoColor); ((PostCompactViewHolder) holder).downvoteButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); @@ -1886,7 +1901,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView @Nullable ExoPlayerViewHelper helper; private Uri mediaUri; - private float volume = 0f; + private float volume; PostVideoAutoplayViewHolder(View itemView) { super(itemView); @@ -1916,6 +1931,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView aspectRatioFrameLayout.setOnClickListener(null); + volume = mMuteAutoplayingVideos ? 0f : 1f; + muteButton.setOnClickListener(view -> { if (helper != null) { if (helper.getVolume() != 0) { @@ -2134,11 +2151,11 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView intent.putExtra(ViewVideoActivity.EXTRA_POST_TITLE, post.getTitle()); mActivity.startActivity(intent); } else if (post.getPostType() == Post.GIF_TYPE) { - Intent intent = new Intent(mActivity, ViewGIFActivity.class); - intent.putExtra(ViewGIFActivity.FILE_NAME_KEY, post.getSubredditName() + Intent intent = new Intent(mActivity, ViewImageOrGifActivity.class); + intent.putExtra(ViewImageOrGifActivity.FILE_NAME_KEY, post.getSubredditName() + "-" + post.getId() + ".gif"); - intent.putExtra(ViewGIFActivity.GIF_URL_KEY, post.getVideoUrl()); - intent.putExtra(ViewGIFActivity.POST_TITLE_KEY, post.getTitle()); + intent.putExtra(ViewImageOrGifActivity.GIF_URL_KEY, post.getVideoUrl()); + intent.putExtra(ViewImageOrGifActivity.POST_TITLE_KEY, post.getTitle()); mActivity.startActivity(intent); } } @@ -2233,18 +2250,18 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView Post post = getItem(getAdapterPosition()); if (post != null) { if (post.getPostType() == Post.IMAGE_TYPE) { - Intent intent = new Intent(mActivity, ViewImageActivity.class); - intent.putExtra(ViewImageActivity.IMAGE_URL_KEY, post.getUrl()); - intent.putExtra(ViewImageActivity.FILE_NAME_KEY, post.getSubredditName() + Intent intent = new Intent(mActivity, ViewImageOrGifActivity.class); + intent.putExtra(ViewImageOrGifActivity.IMAGE_URL_KEY, post.getUrl()); + intent.putExtra(ViewImageOrGifActivity.FILE_NAME_KEY, post.getSubredditName() + "-" + post.getId() + ".jpg"); - intent.putExtra(ViewImageActivity.POST_TITLE_KEY, post.getTitle()); + intent.putExtra(ViewImageOrGifActivity.POST_TITLE_KEY, post.getTitle()); mActivity.startActivity(intent); } else if (post.getPostType() == Post.GIF_TYPE) { - Intent intent = new Intent(mActivity, ViewGIFActivity.class); - intent.putExtra(ViewGIFActivity.FILE_NAME_KEY, post.getSubredditName() + Intent intent = new Intent(mActivity, ViewImageOrGifActivity.class); + intent.putExtra(ViewImageOrGifActivity.FILE_NAME_KEY, post.getSubredditName() + "-" + post.getId() + ".gif"); - intent.putExtra(ViewGIFActivity.GIF_URL_KEY, post.getVideoUrl()); - intent.putExtra(ViewGIFActivity.POST_TITLE_KEY, post.getTitle()); + intent.putExtra(ViewImageOrGifActivity.GIF_URL_KEY, post.getVideoUrl()); + intent.putExtra(ViewImageOrGifActivity.POST_TITLE_KEY, post.getTitle()); mActivity.startActivity(intent); } } @@ -2497,7 +2514,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView @BindView(R.id.share_button_item_post_text_type) ImageView shareButton; - PostTextTypeViewHolder (View itemView) { + PostTextTypeViewHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); setBaseView(cardView, @@ -2536,6 +2553,8 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView ImageView stickiedPostImageView; @BindView(R.id.post_time_text_view_item_post_compact) TextView postTimeTextView; + @BindView(R.id.title_and_image_constraint_layout) + ConstraintLayout titleAndImageConstraintLayout; @BindView(R.id.title_text_view_item_post_compact) TextView titleTextView; @BindView(R.id.type_text_view_item_post_compact) @@ -2564,8 +2583,12 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView ImageView imageView; @BindView(R.id.play_button_image_view_item_post_compact) ImageView playButtonImageView; + @BindView(R.id.frame_layout_image_view_no_preview_link_item_post_compact) + FrameLayout noPreviewLinkImageFrameLayout; @BindView(R.id.image_view_no_preview_link_item_post_compact) ImageView noPreviewLinkImageView; + @BindView(R.id.barrier2) + Barrier imageBarrier; @BindView(R.id.bottom_constraint_layout_item_post_compact) ConstraintLayout bottomConstraintLayout; @BindView(R.id.plus_button_item_post_compact) @@ -2609,6 +2632,40 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView constraintSet.applyTo(bottomConstraintLayout); } + if (mShowThumbnailOnTheRightInCompactLayout) { + ConstraintSet constraintSet = new ConstraintSet(); + constraintSet.clone(titleAndImageConstraintLayout); + constraintSet.clear(titleTextView.getId(), ConstraintSet.START); + constraintSet.clear(titleTextView.getId(), ConstraintSet.END); + constraintSet.clear(R.id.flow_layout_item_post_compact, ConstraintSet.START); + constraintSet.clear(R.id.flow_layout_item_post_compact, ConstraintSet.END); + constraintSet.clear(linkTextView.getId(), ConstraintSet.START); + constraintSet.clear(linkTextView.getId(), ConstraintSet.END); + constraintSet.clear(relativeLayout.getId(), ConstraintSet.START); + constraintSet.clear(relativeLayout.getId(), ConstraintSet.END); + constraintSet.clear(noPreviewLinkImageFrameLayout.getId(), ConstraintSet.START); + constraintSet.clear(noPreviewLinkImageFrameLayout.getId(), ConstraintSet.END); + int barrierId = 1234; + constraintSet.createBarrier(barrierId, Barrier.END, R.id.image_view_wrapper_item_post_compact, + R.id.frame_layout_image_view_no_preview_link_item_post_compact); + constraintSet.connect(titleTextView.getId(), ConstraintSet.START, barrierId, ConstraintSet.END); + constraintSet.connect(titleTextView.getId(), ConstraintSet.END, ConstraintSet.PARENT_ID, ConstraintSet.END); + constraintSet.connect(R.id.flow_layout_item_post_compact, ConstraintSet.START, barrierId, ConstraintSet.END); + constraintSet.connect(R.id.flow_layout_item_post_compact, ConstraintSet.END, ConstraintSet.PARENT_ID, ConstraintSet.END); + constraintSet.connect(R.id.flow_layout_item_post_compact, ConstraintSet.BOTTOM, linkTextView.getId(), ConstraintSet.TOP); + constraintSet.connect(linkTextView.getId(), ConstraintSet.START, barrierId, ConstraintSet.END); + constraintSet.connect(linkTextView.getId(), ConstraintSet.END, ConstraintSet.PARENT_ID, ConstraintSet.END); + constraintSet.connect(relativeLayout.getId(), ConstraintSet.START, ConstraintSet.PARENT_ID, ConstraintSet.START); + constraintSet.connect(relativeLayout.getId(), ConstraintSet.END, barrierId, ConstraintSet.START); + constraintSet.connect(noPreviewLinkImageFrameLayout.getId(), ConstraintSet.START, ConstraintSet.PARENT_ID, ConstraintSet.START); + constraintSet.connect(noPreviewLinkImageFrameLayout.getId(), ConstraintSet.END, barrierId, ConstraintSet.START); + constraintSet.applyTo(titleAndImageConstraintLayout); + + int leftMargin = (int) Utils.convertDpToPixel(16, mActivity); + ((ConstraintLayout.LayoutParams) relativeLayout.getLayoutParams()).leftMargin = leftMargin; + ((ConstraintLayout.LayoutParams) noPreviewLinkImageFrameLayout.getLayoutParams()).leftMargin = leftMargin; + } + itemView.setBackgroundTintList(ColorStateList.valueOf(mCardViewBackgroundColor)); postTimeTextView.setTextColor(mSecondaryTextColor); titleTextView.setTextColor(mPostTitleColor); @@ -2641,6 +2698,11 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView commentsCountTextView.setCompoundDrawablesWithIntrinsicBounds(mCommentIcon, null, null, null); saveButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); shareButton.setColorFilter(mPostIconAndInfoColor, android.graphics.PorterDuff.Mode.SRC_IN); + divider.setBackgroundColor(mDividerColor); + + imageView.setClipToOutline(true); + noPreviewLinkImageFrameLayout.setClipToOutline(true); + } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java index 651b09b7..9e763433 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java @@ -32,13 +32,11 @@ import ml.docilealligator.infinityforreddit.Activity.SubredditMultiselectionActi import ml.docilealligator.infinityforreddit.Activity.SubredditSelectionActivity; import ml.docilealligator.infinityforreddit.Activity.SubscribedThingListingActivity; import ml.docilealligator.infinityforreddit.Activity.ThemePreviewActivity; -import ml.docilealligator.infinityforreddit.Activity.ViewGIFActivity; -import ml.docilealligator.infinityforreddit.Activity.ViewImageActivity; +import ml.docilealligator.infinityforreddit.Activity.ViewImageOrGifActivity; import ml.docilealligator.infinityforreddit.Activity.ViewImgurMediaActivity; import ml.docilealligator.infinityforreddit.Activity.ViewMessageActivity; import ml.docilealligator.infinityforreddit.Activity.ViewMultiRedditDetailActivity; import ml.docilealligator.infinityforreddit.Activity.ViewPostDetailActivity; -import ml.docilealligator.infinityforreddit.Activity.ViewSidebarActivity; import ml.docilealligator.infinityforreddit.Activity.ViewSubredditDetailActivity; import ml.docilealligator.infinityforreddit.Activity.ViewUserDetailActivity; import ml.docilealligator.infinityforreddit.Activity.ViewVideoActivity; @@ -134,16 +132,12 @@ public interface AppComponent { void inject(AccountSavedThingActivity accountSavedThingActivity); - void inject(ViewImageActivity viewImageActivity); - - void inject(ViewGIFActivity viewGIFActivity); + void inject(ViewImageOrGifActivity viewGIFActivity); void inject(MultiRedditListingActivity multiRedditListingActivity); void inject(ViewMultiRedditDetailActivity viewMultiRedditDetailActivity); - void inject(ViewSidebarActivity viewSidebarActivity); - void inject(ViewVideoActivity viewVideoActivity); void inject(GesturesAndButtonsPreferenceFragment gesturesAndButtonsPreferenceFragment); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AppModule.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AppModule.java index f4f32b20..d70a167d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/AppModule.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AppModule.java @@ -131,6 +131,16 @@ class AppModule { } @Provides + @Named("pushshift") + @Singleton + Retrofit providePushshiftRetrofit() { + return new Retrofit.Builder() + .baseUrl(APIUtils.PUSHSHIFT_API_BASE_URI) + .addConverterFactory(ScalarsConverterFactory.create()) + .build(); + } + + @Provides @Singleton OkHttpClient provideOkHttpClient(@Named("no_oauth") Retrofit retrofit, RedditDataRoomDatabase accountRoomDatabase) { OkHttpClient.Builder okHttpClientBuilder = new OkHttpClient.Builder(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AsyncTask/InsertMultiRedditAsyncTask.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AsyncTask/InsertMultiRedditAsyncTask.java index 2c15fa33..2c49eccb 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/AsyncTask/InsertMultiRedditAsyncTask.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AsyncTask/InsertMultiRedditAsyncTask.java @@ -1,7 +1,6 @@ package ml.docilealligator.infinityforreddit.AsyncTask; import android.os.AsyncTask; -import android.util.Log; import java.util.ArrayList; import java.util.Collections; @@ -14,6 +13,7 @@ import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; public class InsertMultiRedditAsyncTask extends AsyncTask<Void, Void, Void> { private MultiRedditDao multiRedditDao; private ArrayList<MultiReddit> multiReddits; + private MultiReddit multiReddit; private String accountName; private InsertMultiRedditAsyncTaskListener insertMultiRedditAsyncTaskListener; @@ -26,15 +26,27 @@ public class InsertMultiRedditAsyncTask extends AsyncTask<Void, Void, Void> { this.insertMultiRedditAsyncTaskListener = insertMultiRedditAsyncTaskListener; } + public InsertMultiRedditAsyncTask(RedditDataRoomDatabase redditDataRoomDatabase, + MultiReddit multiReddit, + InsertMultiRedditAsyncTaskListener insertMultiRedditAsyncTaskListener) { + multiRedditDao = redditDataRoomDatabase.multiRedditDao(); + this.multiReddit = multiReddit; + this.insertMultiRedditAsyncTaskListener = insertMultiRedditAsyncTaskListener; + } + @Override protected Void doInBackground(Void... voids) { + if (multiReddit != null) { + multiRedditDao.insert(multiReddit); + return null; + } + List<MultiReddit> existingMultiReddits = multiRedditDao.getAllMultiRedditsList(accountName); Collections.sort(multiReddits, (multiReddit, t1) -> multiReddit.getName().compareToIgnoreCase(t1.getName())); List<String> deletedMultiredditNames = new ArrayList<>(); compareTwoMultiRedditList(multiReddits, existingMultiReddits, deletedMultiredditNames); for (String deleted : deletedMultiredditNames) { - Log.i("asdfasdfs", "s " + deleted + accountName); multiRedditDao.deleteMultiReddit(deleted, accountName); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AsyncTask/SetAsWallpaperAsyncTask.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AsyncTask/SetAsWallpaperAsyncTask.java new file mode 100644 index 00000000..b868e5d6 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AsyncTask/SetAsWallpaperAsyncTask.java @@ -0,0 +1,95 @@ +package ml.docilealligator.infinityforreddit.AsyncTask; + +import android.app.WallpaperManager; +import android.graphics.Bitmap; +import android.graphics.Rect; +import android.media.ThumbnailUtils; +import android.os.AsyncTask; +import android.os.Build; +import android.util.DisplayMetrics; +import android.view.WindowManager; + +import java.io.IOException; + +import ml.docilealligator.infinityforreddit.WallpaperSetter; + +public class SetAsWallpaperAsyncTask extends AsyncTask<Void, Void, Void> { + + private Bitmap bitmap; + private int setTo; + private WallpaperManager manager; + private WindowManager windowManager; + private WallpaperSetter.SetWallpaperListener setWallpaperListener; + private boolean success = true; + + public SetAsWallpaperAsyncTask(Bitmap bitmap, int setTo, WallpaperManager manager, WindowManager windowManager, + WallpaperSetter.SetWallpaperListener setWallpaperListener) { + this.bitmap = bitmap; + this.setTo = setTo; + this.manager = manager; + this.windowManager = windowManager; + this.setWallpaperListener = setWallpaperListener; + } + + @Override + protected Void doInBackground(Void... voids) { + DisplayMetrics metrics = new DisplayMetrics(); + Rect rect = null; + + if (windowManager != null) { + windowManager.getDefaultDisplay().getMetrics(metrics); + int height = metrics.heightPixels; + int width = metrics.widthPixels; + + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { + bitmap = ThumbnailUtils.extractThumbnail(bitmap, width, height); + } + + float imageAR = (float) bitmap.getWidth() / (float) bitmap.getHeight(); + float screenAR = (float) width / (float) height; + + if (imageAR > screenAR) { + int desiredWidth = (int) (bitmap.getHeight() * screenAR); + rect = new Rect((bitmap.getWidth() - desiredWidth) / 2, 0, bitmap.getWidth(), bitmap.getHeight()); + } else { + int desiredHeight = (int) (bitmap.getWidth() / screenAR); + rect = new Rect(0, (bitmap.getHeight() - desiredHeight) / 2, bitmap.getWidth(), (bitmap.getHeight() + desiredHeight) / 2); + } + } + try { + switch (setTo) { + case WallpaperSetter.HOME_SCREEN: + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + manager.setBitmap(bitmap, rect, true, WallpaperManager.FLAG_SYSTEM); + } + break; + case WallpaperSetter.LOCK_SCREEN: + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + manager.setBitmap(bitmap, rect, true, WallpaperManager.FLAG_LOCK); + } + break; + case WallpaperSetter.BOTH_SCREENS: + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + manager.setBitmap(bitmap, rect, true, WallpaperManager.FLAG_SYSTEM | WallpaperManager.FLAG_LOCK); + } else { + manager.setBitmap(bitmap); + } + break; + } + } catch (IOException e) { + success = false; + } + + return null; + } + + @Override + protected void onPostExecute(Void aVoid) { + super.onPostExecute(aVoid); + if (success) { + setWallpaperListener.success(); + } else { + setWallpaperListener.failed(); + } + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/CommentMoreBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/CommentMoreBottomSheetFragment.java index 364096e6..de4f5778 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/CommentMoreBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/CommentMoreBottomSheetFragment.java @@ -47,7 +47,10 @@ public class CommentMoreBottomSheetFragment extends RoundedBottomSheetDialogFrag TextView copyTextView; @BindView(R.id.report_view_comment_more_bottom_sheet_fragment) TextView reportTextView; + @BindView(R.id.see_removed_view_comment_more_bottom_sheet_fragment) + TextView seeRemovedTextView; private AppCompatActivity activity; + public CommentMoreBottomSheetFragment() { // Required empty public constructor } @@ -131,6 +134,20 @@ public class CommentMoreBottomSheetFragment extends RoundedBottomSheetDialogFrag dismiss(); }); + if ("[deleted]".equals(commentData.getAuthor()) || + "[deleted]".equals(commentData.getCommentRawText()) || + "[removed]".equals(commentData.getCommentRawText()) + ) { + seeRemovedTextView.setVisibility(View.VISIBLE); + + seeRemovedTextView.setOnClickListener(view -> { + dismiss(); + if (activity instanceof ViewPostDetailActivity) { + ((ViewPostDetailActivity) activity).showRemovedComment(commentData, bundle.getInt(EXTRA_POSITION)); + } + }); + } + return rootView; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/MultiRedditOptionsBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/MultiRedditOptionsBottomSheetFragment.java index 60b065ba..27a9ccdc 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/MultiRedditOptionsBottomSheetFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/MultiRedditOptionsBottomSheetFragment.java @@ -16,7 +16,7 @@ import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.Activity.EditMultiRedditActivity; -import ml.docilealligator.infinityforreddit.Activity.MultiRedditListingActivity; +import ml.docilealligator.infinityforreddit.Activity.SubscribedThingListingActivity; import ml.docilealligator.infinityforreddit.MultiReddit.MultiReddit; import ml.docilealligator.infinityforreddit.R; @@ -31,7 +31,7 @@ public class MultiRedditOptionsBottomSheetFragment extends RoundedBottomSheetDia TextView editMultiRedditTextView; @BindView(R.id.delete_multi_reddit_text_view_multi_reddit_options_bottom_sheet_fragment) TextView deleteMultiRedditTextView; - private MultiRedditListingActivity multiRedditListingActivity; + private SubscribedThingListingActivity subscribedThingListingActivity; public MultiRedditOptionsBottomSheetFragment() { // Required empty public constructor @@ -48,14 +48,14 @@ public class MultiRedditOptionsBottomSheetFragment extends RoundedBottomSheetDia MultiReddit multiReddit = getArguments().getParcelable(EXTRA_MULTI_REDDIT); editMultiRedditTextView.setOnClickListener(view -> { - Intent editIntent = new Intent(multiRedditListingActivity, EditMultiRedditActivity.class); + Intent editIntent = new Intent(subscribedThingListingActivity, EditMultiRedditActivity.class); editIntent.putExtra(EditMultiRedditActivity.EXTRA_MULTI_REDDIT, multiReddit); startActivity(editIntent); dismiss(); }); deleteMultiRedditTextView.setOnClickListener(view -> { - multiRedditListingActivity.deleteMultiReddit(multiReddit); + subscribedThingListingActivity.deleteMultiReddit(multiReddit); dismiss(); }); @@ -65,6 +65,6 @@ public class MultiRedditOptionsBottomSheetFragment extends RoundedBottomSheetDia @Override public void onAttach(@NonNull Context context) { super.onAttach(context); - multiRedditListingActivity = (MultiRedditListingActivity) context; + subscribedThingListingActivity = (SubscribedThingListingActivity) context; } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/SetAsWallpaperBottomSheetFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/SetAsWallpaperBottomSheetFragment.java new file mode 100644 index 00000000..db6e80e9 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/BottomSheetFragment/SetAsWallpaperBottomSheetFragment.java @@ -0,0 +1,79 @@ +package ml.docilealligator.infinityforreddit.BottomSheetFragment; + +import android.app.Activity; +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.SetAsWallpaperCallback; + +public class SetAsWallpaperBottomSheetFragment extends RoundedBottomSheetDialogFragment { + + public static final String EXTRA_VIEW_PAGER_POSITION = "EVPP"; + + @BindView(R.id.home_screen_text_view_set_as_wallpaper_bottom_sheet_fragment) + TextView homeScreenTextvView; + @BindView(R.id.lock_screen_text_view_set_as_wallpaper_bottom_sheet_fragment) + TextView lockScreenTextView; + @BindView(R.id.both_text_view_set_as_wallpaper_bottom_sheet_fragment) + TextView bothTextView; + private Activity mActivity; + + public SetAsWallpaperBottomSheetFragment() { + // Required empty public constructor + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.fragment_set_as_wallpaper_bottom_sheet, container, false); + ButterKnife.bind(this, rootView); + + Bundle bundle = getArguments(); + int viewPagerPosition = bundle == null ? -1 : bundle.getInt(EXTRA_VIEW_PAGER_POSITION); + + bothTextView.setOnClickListener(view -> { + if (mActivity instanceof SetAsWallpaperCallback) { + ((SetAsWallpaperCallback) mActivity).setToBoth(viewPagerPosition); + } + dismiss(); + }); + + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) { + homeScreenTextvView.setVisibility(View.VISIBLE); + lockScreenTextView.setVisibility(View.VISIBLE); + + homeScreenTextvView.setOnClickListener(view -> { + if (mActivity instanceof SetAsWallpaperCallback) { + ((SetAsWallpaperCallback) mActivity).setToHomeScreen(viewPagerPosition); + } + dismiss(); + }); + + lockScreenTextView.setOnClickListener(view -> { + if (mActivity instanceof SetAsWallpaperCallback) { + ((SetAsWallpaperCallback) mActivity).setToLockScreen(viewPagerPosition); + } + dismiss(); + }); + } + + return rootView; + } + + @Override + public void onAttach(@NonNull Context context) { + super.onAttach(context); + this.mActivity = (Activity) context; + } +}
\ No newline at end of file diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentData.java b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentData.java index 5c01f3fe..e38ecd11 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/CommentData.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/CommentData.java @@ -279,7 +279,7 @@ public class CommentData implements Parcelable { if (children == null || children.size() == 0) { setChildren(moreChildren); } else { - if (children.get(children.size() - 1).isPlaceHolder) { + if (children.size() > 1 && children.get(children.size() - 1).isPlaceHolder) { children.addAll(children.size() - 2, moreChildren); } else { children.addAll(moreChildren); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Event/ChangeMuteAutoplayingVideosEvent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Event/ChangeMuteAutoplayingVideosEvent.java new file mode 100644 index 00000000..421be2a1 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Event/ChangeMuteAutoplayingVideosEvent.java @@ -0,0 +1,9 @@ +package ml.docilealligator.infinityforreddit.Event; + +public class ChangeMuteAutoplayingVideosEvent { + public boolean muteAutoplayingVideos; + + public ChangeMuteAutoplayingVideosEvent(boolean muteAutoplayingVideos) { + this.muteAutoplayingVideos = muteAutoplayingVideos; + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Event/ShowThumbnailOnTheRightInCompactLayoutEvent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Event/ShowThumbnailOnTheRightInCompactLayoutEvent.java new file mode 100644 index 00000000..f1010773 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Event/ShowThumbnailOnTheRightInCompactLayoutEvent.java @@ -0,0 +1,9 @@ +package ml.docilealligator.infinityforreddit.Event; + +public class ShowThumbnailOnTheRightInCompactLayoutEvent { + public boolean showThumbnailOnTheRightInCompactLayout; + + public ShowThumbnailOnTheRightInCompactLayoutEvent(boolean showThumbnailOnTheRightInCompactLayout) { + this.showThumbnailOnTheRightInCompactLayout = showThumbnailOnTheRightInCompactLayout; + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchGfycatVideoLinks.java b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchGfycatOrRedgifsVideoLinks.java index b9799484..9d51cb1e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchGfycatVideoLinks.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchGfycatOrRedgifsVideoLinks.java @@ -14,27 +14,27 @@ import retrofit2.Callback; import retrofit2.Response; import retrofit2.Retrofit; -public class FetchGfycatVideoLinks { - public interface FetchGfycatVideoLinksListener { +public class FetchGfycatOrRedgifsVideoLinks { + public interface FetchGfycatOrRedgifsVideoLinksListener { void success(String webm, String mp4); - void failed(); + void failed(int errorCode); } - public static void fetchGfycatVideoLinks(Retrofit gfycatRetrofit, String gfycatId, - FetchGfycatVideoLinksListener fetchGfycatVideoLinksListener) { + public static void fetchGfycatOrRedgifsVideoLinks(Retrofit gfycatRetrofit, String gfycatId, + FetchGfycatOrRedgifsVideoLinksListener fetchGfycatOrRedgifsVideoLinksListener) { gfycatRetrofit.create(GfycatAPI.class).getGfycatData(gfycatId).enqueue(new Callback<String>() { @Override public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) { if (response.isSuccessful()) { - new ParseGfycatVideoLinksAsyncTask(response.body(), fetchGfycatVideoLinksListener).execute(); + new ParseGfycatVideoLinksAsyncTask(response.body(), fetchGfycatOrRedgifsVideoLinksListener).execute(); } else { - fetchGfycatVideoLinksListener.failed(); + fetchGfycatOrRedgifsVideoLinksListener.failed(response.code()); } } @Override public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) { - fetchGfycatVideoLinksListener.failed(); + fetchGfycatOrRedgifsVideoLinksListener.failed(-1); } }); } @@ -45,11 +45,11 @@ public class FetchGfycatVideoLinks { private String webm; private String mp4; private boolean parseFailed = false; - private FetchGfycatVideoLinksListener fetchGfycatVideoLinksListener; + private FetchGfycatOrRedgifsVideoLinksListener fetchGfycatOrRedgifsVideoLinksListener; - ParseGfycatVideoLinksAsyncTask(String response, FetchGfycatVideoLinksListener fetchGfycatVideoLinksListener) { + ParseGfycatVideoLinksAsyncTask(String response, FetchGfycatOrRedgifsVideoLinksListener fetchGfycatOrRedgifsVideoLinksListener) { this.response = response; - this.fetchGfycatVideoLinksListener = fetchGfycatVideoLinksListener; + this.fetchGfycatOrRedgifsVideoLinksListener = fetchGfycatOrRedgifsVideoLinksListener; } @Override @@ -70,9 +70,9 @@ public class FetchGfycatVideoLinks { protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); if (parseFailed) { - fetchGfycatVideoLinksListener.failed(); + fetchGfycatOrRedgifsVideoLinksListener.failed(-1); } else { - fetchGfycatVideoLinksListener.success(webm, mp4); + fetchGfycatOrRedgifsVideoLinksListener.success(webm, mp4); } } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchMessages.java b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchMessages.java index e49e21ec..942d7f7a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchMessages.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchMessages.java @@ -29,15 +29,19 @@ public class FetchMessages { public static final String WHERE_UNREAD = "unread"; public static final String WHERE_SENT = "sent"; public static final String WHERE_COMMENTS = "comments"; + public static final String WHERE_MESSAGES = "messages"; + public static final int MESSAGE_TYPE_NOTIFICATION = 0; + public static final int MESSAGE_TYPE_PRIVATE_MESSAGE = 1; - static void fetchMessagesAsync(Retrofit oauthRetrofit, Locale locale, String accessToken, String where, - String after, FetchMessagesListener fetchMessagesListener) { + static void fetchInbox(Retrofit oauthRetrofit, Locale locale, String accessToken, String where, + String after, int messageType, FetchMessagesListener fetchMessagesListener) { oauthRetrofit.create(RedditAPI.class).getMessages(APIUtils.getOAuthHeader(accessToken), where, after) .enqueue(new Callback<String>() { @Override public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) { if (response.isSuccessful()) { - new ParseMessageAsnycTask(response.body(), locale, fetchMessagesListener::fetchSuccess).execute(); + new ParseMessageAsnycTask(response.body(), locale, messageType, + fetchMessagesListener::fetchSuccess).execute(); } else { fetchMessagesListener.fetchFailed(); } @@ -50,8 +54,7 @@ public class FetchMessages { }); } - @Nullable - static ArrayList<Message> parseMessage(String response, Locale locale) { + static ArrayList<Message> parseMessage(String response, Locale locale, int messageType) { JSONArray messageArray; try { messageArray = new JSONObject(response).getJSONObject(JSONUtils.DATA_KEY).getJSONArray(JSONUtils.CHILDREN_KEY); @@ -65,6 +68,10 @@ public class FetchMessages { try { JSONObject messageJSON = messageArray.getJSONObject(i); String kind = messageJSON.getString(JSONUtils.KIND_KEY); + if ((messageType == MESSAGE_TYPE_NOTIFICATION && kind.equals("t4")) || + (messageType == MESSAGE_TYPE_PRIVATE_MESSAGE && !kind.equals("t4"))) { + continue; + } JSONObject rawMessageJSON = messageJSON.getJSONObject(JSONUtils.DATA_KEY); String subredditName = rawMessageJSON.getString(JSONUtils.SUBREDDIT_KEY); @@ -111,17 +118,20 @@ public class FetchMessages { private Locale locale; private ArrayList<Message> messages; private String after; + private int messageType; private ParseMessageAsyncTaskListener parseMessageAsyncTaskListener; - ParseMessageAsnycTask(String response, Locale locale, ParseMessageAsyncTaskListener parseMessageAsnycTaskListener) { + ParseMessageAsnycTask(String response, Locale locale, int messageType, + ParseMessageAsyncTaskListener parseMessageAsnycTaskListener) { this.response = response; this.locale = locale; + this.messageType = messageType; messages = new ArrayList<>(); this.parseMessageAsyncTaskListener = parseMessageAsnycTaskListener; } @Override protected Void doInBackground(Void... voids) { - messages = parseMessage(response, locale); + messages = parseMessage(response, locale, messageType); try { after = new JSONObject(response).getJSONObject(JSONUtils.DATA_KEY).getString(JSONUtils.AFTER_KEY); } catch (JSONException e) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchRemovedComment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchRemovedComment.java new file mode 100644 index 00000000..d012342e --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchRemovedComment.java @@ -0,0 +1,97 @@ +package ml.docilealligator.infinityforreddit; + +import android.os.AsyncTask; + +import androidx.annotation.NonNull; + +import org.json.JSONException; +import org.json.JSONObject; + +import ml.docilealligator.infinityforreddit.API.PushshiftAPI; +import ml.docilealligator.infinityforreddit.Utils.JSONUtils; +import ml.docilealligator.infinityforreddit.Utils.Utils; +import retrofit2.Call; +import retrofit2.Callback; +import retrofit2.Response; +import retrofit2.Retrofit; + +public class FetchRemovedComment { + + public static void fetchRemovedComment(Retrofit retrofit, CommentData comment, FetchRemovedCommentListener listener) { + retrofit.create(PushshiftAPI.class).getRemovedComment(comment.getId()) + .enqueue(new Callback<String>() { + @Override + public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) { + if (response.isSuccessful()) { + new ParseCommentAsyncTask(response.body(), comment, listener).execute(); + } else { + listener.fetchFailed(); + } + } + + @Override + public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) { + t.printStackTrace(); + listener.fetchFailed(); + } + }); + } + + private static CommentData parseRemovedComment(JSONObject result, CommentData comment) throws JSONException { + String id = result.getString(JSONUtils.ID_KEY); + String author = result.getString(JSONUtils.AUTHOR_KEY); + String body = Utils.modifyMarkdown(result.optString(JSONUtils.BODY_KEY).trim()); + + if ( id.equals(comment.getId()) && + (!author.equals(comment.getAuthor()) || + !body.equals(comment.getCommentRawText())) + ) { + comment.setAuthor(author); + comment.setCommentMarkdown(body); + comment.setCommentRawText(body); + return comment; + } else { + return null; + } + } + + public interface FetchRemovedCommentListener { + void fetchSuccess(CommentData comment); + + void fetchFailed(); + } + + private static class ParseCommentAsyncTask extends AsyncTask<Void, Void, Void> { + + private String responseBody; + private FetchRemovedCommentListener listener; + CommentData comment; + + public ParseCommentAsyncTask(String responseBody, CommentData comment, FetchRemovedCommentListener listener) { + this.responseBody = responseBody; + this.comment = comment; + this.listener = listener; + } + + @Override + protected Void doInBackground(Void... voids) { + try { + JSONObject commentJSON = new JSONObject(responseBody).getJSONArray(JSONUtils.DATA_KEY).getJSONObject(0); + comment = parseRemovedComment(commentJSON, comment); + } catch (JSONException e) { + e.printStackTrace(); + comment = null; + } + return null; + } + + @Override + protected void onPostExecute(Void aVoid) { + super.onPostExecute(aVoid); + if (comment != null) + listener.fetchSuccess(comment); + else + listener.fetchFailed(); + } + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchRemovedPost.java b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchRemovedPost.java new file mode 100644 index 00000000..646dfe19 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchRemovedPost.java @@ -0,0 +1,141 @@ +package ml.docilealligator.infinityforreddit; + +import android.net.Uri; +import android.os.AsyncTask; +import android.text.Html; + +import androidx.annotation.NonNull; + +import org.json.JSONException; +import org.json.JSONObject; + +import ml.docilealligator.infinityforreddit.API.PushshiftAPI; +import ml.docilealligator.infinityforreddit.Post.Post; +import ml.docilealligator.infinityforreddit.Utils.JSONUtils; +import ml.docilealligator.infinityforreddit.Utils.Utils; +import retrofit2.Call; +import retrofit2.Callback; +import retrofit2.Response; +import retrofit2.Retrofit; + +public class FetchRemovedPost { + + public static void fetchRemovedPost(Retrofit retrofit, Post post, FetchRemovedPostListener listener) { + retrofit.create(PushshiftAPI.class).getRemovedPost(post.getId()) + .enqueue(new Callback<String>() { + @Override + public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) { + if (response.isSuccessful()) { + new ParsePostAsyncTask(response.body(), post, listener).execute(); + } else { + listener.fetchFailed(); + } + } + + @Override + public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) { + t.printStackTrace(); + listener.fetchFailed(); + } + }); + } + + private static Post parseRemovedPost(JSONObject result, Post post) throws JSONException { + String id = result.getString(JSONUtils.ID_KEY); + String author = result.getString(JSONUtils.AUTHOR_KEY); + String title = result.getString(JSONUtils.TITLE_KEY); + String body = Utils.modifyMarkdown(result.getString(JSONUtils.SELFTEXT_KEY).trim()); + + if ( id.equals(post.getId()) && + (!author.equals(post.getAuthor()) || + foundSelfText(post.getSelfText(), body)) + ) { + post.setAuthor(author); + post.setTitle(title); + post.setSelfText(body); + post.setSelfTextPlain(""); + post.setSelfTextPlainTrimmed(""); + + String url = result.optString(JSONUtils.URL_KEY); + + if (url.endsWith("gif") || url.endsWith("mp4")) { + post.setVideoUrl(url); + post.setVideoDownloadUrl(url); + } else if (post.getPostType() == Post.VIDEO_TYPE || post.getPostType() == Post.GIF_TYPE) { + JSONObject redditVideoObject = result.getJSONObject("secure_media").getJSONObject(JSONUtils.REDDIT_VIDEO_KEY); + String videoUrl = Html.fromHtml(redditVideoObject.getString(JSONUtils.HLS_URL_KEY)).toString(); + String videoDownloadUrl = redditVideoObject.getString(JSONUtils.FALLBACK_URL_KEY); + + post.setVideoUrl(videoUrl); + post.setVideoDownloadUrl(videoDownloadUrl); + } else if (post.getPostType() == Post.LINK_TYPE) { + post.setUrl(url); + } + + if (post.getPostType() == Post.VIDEO_TYPE) { + try { + Uri uri = Uri.parse(url); + String authority = uri.getAuthority(); + if (authority != null && (authority.contains("gfycat.com") || authority.contains("redgifs.com"))) { + post.setPostType(Post.LINK_TYPE); + post.setUrl(url); + } + } catch (IllegalArgumentException ignore) { + } + } + + if (!result.isNull("thumbnail")) { + post.setThumbnailPreviewUrl(result.getString("thumbnail")); + } + + return post; + } else { + return null; + } + } + + private static boolean foundSelfText(String oldText, String newText) { + return !(newText.equals("[deleted]") || newText.equals("[removed]")) && + !newText.equals(oldText); + } + + public interface FetchRemovedPostListener { + void fetchSuccess(Post post); + + void fetchFailed(); + } + + private static class ParsePostAsyncTask extends AsyncTask<Void, Void, Void> { + + private String responseBody; + private FetchRemovedPostListener listener; + Post post; + + public ParsePostAsyncTask(String responseBody, Post post, FetchRemovedPostListener listener) { + this.responseBody = responseBody; + this.post = post; + this.listener = listener; + } + + @Override + protected Void doInBackground(Void... voids) { + try { + JSONObject postJson = new JSONObject(responseBody).getJSONArray(JSONUtils.DATA_KEY).getJSONObject(0); + post = parseRemovedPost(postJson, post); + } catch (JSONException e) { + e.printStackTrace(); + post = null; + } + return null; + } + + @Override + protected void onPostExecute(Void aVoid) { + super.onPostExecute(aVoid); + if (post != null) + listener.fetchSuccess(post); + else + listener.fetchFailed(); + } + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Font/ContentFontFamily.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/ContentFontFamily.java new file mode 100644 index 00000000..6a00aec9 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/ContentFontFamily.java @@ -0,0 +1,31 @@ +package ml.docilealligator.infinityforreddit.Font; + +import ml.docilealligator.infinityforreddit.R; + +public enum ContentFontFamily { + Default(R.style.ContentFontFamily, "Default"), + BalsamiqSans(R.style.ContentFontFamily_BalsamiqSans, "BalsamiqSans"), + NotoSans(R.style.ContentFontFamily_NotoSans, "NotoSans"), + RobotoCondensed(R.style.ContentFontFamily_RobotoCondensed, "RobotoCondensed"), + HarmoniaSans(R.style.ContentFontFamily_HarmoniaSans, "HarmoniaSans"), + Inter(R.style.ContentFontFamily_Inter, "Inter"), + Manrope(R.style.ContentFontFamily_Manrope, "Manrope"), + BadScript(R.style.ContentFontFamily_BadScript, "BadScript"), + Sriracha(R.style.ContentFontFamily_Sriracha, "Sriracha"); + + private int resId; + private String title; + + ContentFontFamily(int resId, String title) { + this.resId = resId; + this.title = title; + } + + public int getResId() { + return resId; + } + + public String getTitle() { + return title; + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ContentFontStyle.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/ContentFontStyle.java index 4eee6b53..654cff07 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ContentFontStyle.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/ContentFontStyle.java @@ -1,4 +1,6 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Font; + +import ml.docilealligator.infinityforreddit.R; public enum ContentFontStyle { Small(R.style.ContentFontStyle_Small, "Small"), diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Font/FontFamily.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/FontFamily.java new file mode 100644 index 00000000..8a04a50e --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/FontFamily.java @@ -0,0 +1,31 @@ +package ml.docilealligator.infinityforreddit.Font; + +import ml.docilealligator.infinityforreddit.R; + +public enum FontFamily { + Default(R.style.FontFamily, "Default"), + BalsamiqSans(R.style.FontFamily_BalsamiqSans, "BalsamiqSans"), + NotoSans(R.style.FontFamily_NotoSans, "NotoSans"), + RobotoCondensed(R.style.FontFamily_RobotoCondensed, "RobotoCondensed"), + HarmoniaSans(R.style.FontFamily_HarmoniaSans, "HarmoniaSans"), + Inter(R.style.FontFamily_Inter, "Inter"), + Manrope(R.style.FontFamily_Manrope, "Manrope"), + BadScript(R.style.FontFamily_BadScript, "BadScript"), + Sriracha(R.style.FontFamily_Sriracha, "Sriracha"); + + private int resId; + private String title; + + FontFamily(int resId, String title) { + this.resId = resId; + this.title = title; + } + + public int getResId() { + return resId; + } + + public String getTitle() { + return title; + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FontStyle.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/FontStyle.java index 61d4cfb8..101b17b4 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/FontStyle.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/FontStyle.java @@ -1,4 +1,6 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Font; + +import ml.docilealligator.infinityforreddit.R; public enum FontStyle { Small(R.style.FontStyle_Small, "Small"), diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Font/TitleFontFamily.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/TitleFontFamily.java new file mode 100644 index 00000000..ffe319c4 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/TitleFontFamily.java @@ -0,0 +1,31 @@ +package ml.docilealligator.infinityforreddit.Font; + +import ml.docilealligator.infinityforreddit.R; + +public enum TitleFontFamily { + Default(R.style.TitleFontFamily, "Default"), + BalsamiqSans(R.style.TitleFontFamily_BalsamiqSans, "BalsamiqSans"), + NotoSans(R.style.TitleFontFamily_NotoSans, "NotoSans"), + RobotoCondensed(R.style.TitleFontFamily_RobotoCondensed, "RobotoCondensed"), + HarmoniaSans(R.style.TitleFontFamily_HarmoniaSans, "HarmoniaSans"), + Inter(R.style.TitleFontFamily_Inter, "Inter"), + Manrope(R.style.TitleFontFamily_Manrope, "Manrope"), + BadScript(R.style.TitleFontFamily_BadScript, "BadScript"), + Sriracha(R.style.TitleFontFamily_Sriracha, "Sriracha"); + + private int resId; + private String title; + + TitleFontFamily(int resId, String title) { + this.resId = resId; + this.title = title; + } + + public int getResId() { + return resId; + } + + public String getTitle() { + return title; + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/TitleFontStyle.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/TitleFontStyle.java index 5dc32c9d..9ac48525 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/TitleFontStyle.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Font/TitleFontStyle.java @@ -1,4 +1,6 @@ -package ml.docilealligator.infinityforreddit; +package ml.docilealligator.infinityforreddit.Font; + +import ml.docilealligator.infinityforreddit.R; public enum TitleFontStyle { Small(R.style.TitleFontStyle_Small, "Small"), diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/MultiRedditListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/MultiRedditListingFragment.java index 89311f15..1a58e526 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/MultiRedditListingFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/MultiRedditListingFragment.java @@ -49,7 +49,6 @@ public class MultiRedditListingFragment extends Fragment implements FragmentComm public static final String EXTRA_ACCOUNT_NAME = "EAN"; public static final String EXTRA_ACCESS_TOKEN = "EAT"; - private static final String INSERT_MULTI_REDDIT_STATE = "ISSS"; @BindView(R.id.swipe_refresh_layout_multi_reddit_listing_fragment) SwipeRefreshLayout mSwipeRefreshLayout; @@ -78,7 +77,6 @@ public class MultiRedditListingFragment extends Fragment implements FragmentComm private AppCompatActivity mActivity; private RequestManager mGlide; private LinearLayoutManager mLinearLayoutManager; - private boolean mInsertSuccess = false; public MultiRedditListingFragment() { // Required empty public constructor diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java index 37888f9a..3aa0f16c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java @@ -59,6 +59,7 @@ import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.CustomView.CustomToroContainer; import ml.docilealligator.infinityforreddit.Event.ChangeAutoplayNsfwVideosEvent; import ml.docilealligator.infinityforreddit.Event.ChangeDefaultPostLayoutEvent; +import ml.docilealligator.infinityforreddit.Event.ChangeMuteAutoplayingVideosEvent; import ml.docilealligator.infinityforreddit.Event.ChangeNSFWBlurEvent; import ml.docilealligator.infinityforreddit.Event.ChangePostLayoutEvent; import ml.docilealligator.infinityforreddit.Event.ChangeShowAbsoluteNumberOfVotesEvent; @@ -69,6 +70,7 @@ import ml.docilealligator.infinityforreddit.Event.ChangeVoteButtonsPositionEvent import ml.docilealligator.infinityforreddit.Event.ChangeWifiStatusEvent; import ml.docilealligator.infinityforreddit.Event.PostUpdateEventToPostList; import ml.docilealligator.infinityforreddit.Event.ShowDividerInCompactLayoutPreferenceEvent; +import ml.docilealligator.infinityforreddit.Event.ShowThumbnailOnTheRightInCompactLayoutEvent; import ml.docilealligator.infinityforreddit.FragmentCommunicator; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.NetworkState; @@ -890,7 +892,15 @@ public class PostFragment extends Fragment implements FragmentCommunicator { public void onChangeAutoplayNsfwVideosEvent(ChangeAutoplayNsfwVideosEvent changeAutoplayNsfwVideosEvent) { if (mAdapter != null) { mAdapter.setAutoplayNsfwVideos(changeAutoplayNsfwVideosEvent.autoplayNsfwVideos); - refresh(); + refreshAdapter(); + } + } + + @Subscribe + public void onChangeMuteAutoplayingVideosEvent(ChangeMuteAutoplayingVideosEvent changeMuteAutoplayingVideosEvent) { + if (mAdapter != null) { + mAdapter.setMuteAutoplayingVideos(changeMuteAutoplayingVideosEvent.muteAutoplayingVideos); + refreshAdapter(); } } @@ -905,6 +915,14 @@ public class PostFragment extends Fragment implements FragmentCommunicator { } } + @Subscribe + public void onShowThumbnailOnTheRightInCompactLayoutEvent(ShowThumbnailOnTheRightInCompactLayoutEvent showThumbnailOnTheRightInCompactLayoutEvent) { + if (mAdapter != null) { + mAdapter.setShowThumbnailOnTheRightInCompactLayout(showThumbnailOnTheRightInCompactLayoutEvent.showThumbnailOnTheRightInCompactLayout); + refreshAdapter(); + } + } + private void refreshAdapter() { int previousPosition = -1; if (mLinearLayoutManager != null) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SidebarFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SidebarFragment.java index dbafed2d..9d9aa9b7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SidebarFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/SidebarFragment.java @@ -50,9 +50,6 @@ import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditData; import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditViewModel; import retrofit2.Retrofit; -/** - * A simple {@link Fragment} subclass. - */ public class SidebarFragment extends Fragment { public static final String EXTRA_SUBREDDIT_NAME = "ESN"; @@ -152,7 +149,7 @@ public class SidebarFragment extends Fragment { mSubredditViewModel = new ViewModelProvider(this, new SubredditViewModel.Factory(activity.getApplication(), mRedditDataRoomDatabase, subredditName)) .get(SubredditViewModel.class); - mSubredditViewModel.getSubredditLiveData().observe(this, subredditData -> { + mSubredditViewModel.getSubredditLiveData().observe(getViewLifecycleOwner(), subredditData -> { if (subredditData != null) { if (subredditData.getSidebarDescription() != null && !subredditData.getSidebarDescription().equals("")) { markwonAdapter.setMarkdown(markwon, subredditData.getSidebarDescription()); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ThemePreviewPostsFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ThemePreviewPostsFragment.java index e8963f92..eeefeaa0 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ThemePreviewPostsFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ThemePreviewPostsFragment.java @@ -15,7 +15,6 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.cardview.widget.CardView; import androidx.core.graphics.drawable.DrawableCompat; -import androidx.core.widget.NestedScrollView; import androidx.fragment.app.Fragment; import com.bumptech.glide.Glide; @@ -59,6 +58,8 @@ public class ThemePreviewPostsFragment extends Fragment { CustomTextView nsfwTextView; @BindView(R.id.flair_custom_text_view_theme_preview_posts_fragment) CustomTextView flairTextView; + @BindView(R.id.awards_text_view_theme_preview_posts_fragment) + CustomTextView awardsTextView; @BindView(R.id.archived_image_view_theme_preview_posts_fragment) ImageView archivedImageView; @BindView(R.id.locked_image_view_theme_preview_posts_fragment) @@ -120,6 +121,9 @@ public class ThemePreviewPostsFragment extends Fragment { flairTextView.setBackgroundColor(customTheme.flairBackgroundColor); flairTextView.setBorderColor(customTheme.flairBackgroundColor); flairTextView.setTextColor(customTheme.flairTextColor); + awardsTextView.setBackgroundColor(customTheme.awardsBackgroundColor); + awardsTextView.setBorderColor(customTheme.awardsBackgroundColor); + awardsTextView.setTextColor(customTheme.awardsTextColor); archivedImageView.setColorFilter(customTheme.archivedTint, PorterDuff.Mode.SRC_IN); lockedImageView.setColorFilter(customTheme.lockedIconTint, PorterDuff.Mode.SRC_IN); crosspostImageView.setColorFilter(customTheme.crosspostIconTint, PorterDuff.Mode.SRC_IN); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ViewImgurImageFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ViewImgurImageFragment.java index ae047287..8d761757 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ViewImgurImageFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ViewImgurImageFragment.java @@ -1,8 +1,6 @@ package ml.docilealligator.infinityforreddit.Fragment; import android.Manifest; -import android.app.Activity; -import android.app.DownloadManager; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; @@ -11,7 +9,6 @@ import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Build; import android.os.Bundle; -import android.os.Environment; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; @@ -43,10 +40,15 @@ import java.io.File; import butterknife.BindView; import butterknife.ButterKnife; +import ml.docilealligator.infinityforreddit.Activity.ViewImgurMediaActivity; import ml.docilealligator.infinityforreddit.AsyncTask.SaveImageToFileAsyncTask; +import ml.docilealligator.infinityforreddit.BottomSheetFragment.SetAsWallpaperBottomSheetFragment; import ml.docilealligator.infinityforreddit.BuildConfig; import ml.docilealligator.infinityforreddit.ImgurMedia; +import ml.docilealligator.infinityforreddit.MediaDownloader; +import ml.docilealligator.infinityforreddit.MediaDownloaderImpl; import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.SetAsWallpaperCallback; public class ViewImgurImageFragment extends Fragment { @@ -60,8 +62,9 @@ public class ViewImgurImageFragment extends Fragment { @BindView(R.id.load_image_error_linear_layout_view_imgur_image_fragment) LinearLayout errorLinearLayout; - private Activity activity; + private ViewImgurMediaActivity activity; private RequestManager glide; + private MediaDownloader mediaDownloader; private ImgurMedia imgurMedia; private boolean isDownloading = false; @@ -80,6 +83,7 @@ public class ViewImgurImageFragment extends Fragment { imgurMedia = getArguments().getParcelable(EXTRA_IMGUR_IMAGES); glide = Glide.with(activity); + mediaDownloader = new MediaDownloaderImpl(); loadImage(); return rootView; @@ -99,7 +103,7 @@ public class ViewImgurImageFragment extends Fragment { progressBar.setVisibility(View.GONE); return false; } - }).into(imageView); + }).override(Target.SIZE_ORIGINAL).into(imageView); } @Override @@ -130,10 +134,10 @@ public class ViewImgurImageFragment extends Fragment { PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE); } else { // Permission has already been granted - download(); + mediaDownloader.download(imgurMedia.getLink(), imgurMedia.getFileName(), getContext()); } } else { - download(); + mediaDownloader.download(imgurMedia.getLink(), imgurMedia.getFileName(), getContext()); } return true; @@ -143,14 +147,14 @@ public class ViewImgurImageFragment extends Fragment { @Override public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) { if (activity.getExternalCacheDir() != null) { - Toast.makeText(activity, R.string.save_image_before_sharing, Toast.LENGTH_SHORT).show(); + Toast.makeText(activity, R.string.save_image_first, Toast.LENGTH_SHORT).show(); new SaveImageToFileAsyncTask(resource, activity.getExternalCacheDir().getPath(), imgurMedia.getFileName(), new SaveImageToFileAsyncTask.SaveImageToFileAsyncTaskListener() { @Override public void saveSuccess(File imageFile) { Uri uri = FileProvider.getUriForFile(activity, - BuildConfig.APPLICATION_ID + ".provider",imageFile); + BuildConfig.APPLICATION_ID + ".provider", imageFile); Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.putExtra(Intent.EXTRA_STREAM, uri); @@ -177,6 +181,17 @@ public class ViewImgurImageFragment extends Fragment { } }); return true; + case R.id.action_set_wallpaper_view_imgur_image_fragments: + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + SetAsWallpaperBottomSheetFragment setAsWallpaperBottomSheetFragment = new SetAsWallpaperBottomSheetFragment(); + Bundle bundle = new Bundle(); + bundle.putInt(SetAsWallpaperBottomSheetFragment.EXTRA_VIEW_PAGER_POSITION, activity.getCurrentPagePosition()); + setAsWallpaperBottomSheetFragment.setArguments(bundle); + setAsWallpaperBottomSheetFragment.show(activity.getSupportFragmentManager(), setAsWallpaperBottomSheetFragment.getTag()); + } else { + ((SetAsWallpaperCallback) activity).setToBoth(activity.getCurrentPagePosition()); + } + return true; } return false; @@ -188,59 +203,15 @@ public class ViewImgurImageFragment extends Fragment { if (grantResults[0] == PackageManager.PERMISSION_DENIED) { Toast.makeText(activity, R.string.no_storage_permission, Toast.LENGTH_SHORT).show(); } else if (grantResults[0] == PackageManager.PERMISSION_GRANTED && isDownloading) { - download(); + mediaDownloader.download(imgurMedia.getLink(), imgurMedia.getFileName(), getContext()); } isDownloading = false; } } - private void download() { - DownloadManager.Request request = new DownloadManager.Request(Uri.parse(imgurMedia.getLink())); - request.setTitle(imgurMedia.getFileName()); - - request.allowScanningByMediaScanner(); - request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); - - //Android Q support - if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - request.setDestinationInExternalPublicDir(Environment.DIRECTORY_PICTURES, imgurMedia.getFileName()); - } else { - String path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).toString(); - File directory = new File(path + "/Infinity/"); - boolean saveToInfinityFolder = true; - if (!directory.exists()) { - if (!directory.mkdir()) { - saveToInfinityFolder = false; - } - } else { - if (directory.isFile()) { - if (!(directory.delete() && directory.mkdir())) { - saveToInfinityFolder = false; - } - } - } - - if (saveToInfinityFolder) { - request.setDestinationInExternalPublicDir(Environment.DIRECTORY_PICTURES + "/Infinity/", imgurMedia.getFileName()); - } else { - request.setDestinationInExternalPublicDir(Environment.DIRECTORY_PICTURES, imgurMedia.getFileName()); - } - } - - DownloadManager manager = (DownloadManager) activity.getSystemService(Context.DOWNLOAD_SERVICE); - - if (manager == null) { - Toast.makeText(activity, R.string.download_failed, Toast.LENGTH_SHORT).show(); - return; - } - - manager.enqueue(request); - Toast.makeText(activity, R.string.download_started, Toast.LENGTH_SHORT).show(); - } - @Override public void onAttach(@NonNull Context context) { super.onAttach(context); - activity = (Activity) context; + activity = (ViewImgurMediaActivity) context; } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ViewImgurVideoFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ViewImgurVideoFragment.java index 3ec6eb39..dd3853d0 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ViewImgurVideoFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ViewImgurVideoFragment.java @@ -2,7 +2,6 @@ package ml.docilealligator.infinityforreddit.Fragment; import android.Manifest; import android.app.Activity; -import android.app.DownloadManager; import android.content.Context; import android.content.SharedPreferences; import android.content.pm.PackageManager; @@ -11,7 +10,6 @@ import android.media.AudioManager; import android.net.Uri; import android.os.Build; import android.os.Bundle; -import android.os.Environment; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; @@ -42,8 +40,6 @@ import com.google.android.exoplayer2.upstream.DataSource; import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory; import com.google.android.exoplayer2.util.Util; -import java.io.File; - import javax.inject.Inject; import javax.inject.Named; @@ -51,6 +47,8 @@ import butterknife.BindView; import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.ImgurMedia; import ml.docilealligator.infinityforreddit.Infinity; +import ml.docilealligator.infinityforreddit.MediaDownloader; +import ml.docilealligator.infinityforreddit.MediaDownloaderImpl; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; @@ -71,6 +69,7 @@ public class ViewImgurVideoFragment extends Fragment { private ImgurMedia imgurMedia; private SimpleExoPlayer player; private DataSource.Factory dataSourceFactory; + private MediaDownloader mediaDownloader; private boolean wasPlaying = false; private boolean isMute = false; private boolean isDownloading = false; @@ -131,6 +130,8 @@ public class ViewImgurVideoFragment extends Fragment { } }); + mediaDownloader = new MediaDownloaderImpl(); + TrackSelection.Factory videoTrackSelectionFactory = new AdaptiveTrackSelection.Factory(); TrackSelector trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory); player = ExoPlayerFactory.newSimpleInstance(activity, trackSelector); @@ -190,47 +191,7 @@ public class ViewImgurVideoFragment extends Fragment { private void download() { isDownloading = false; - DownloadManager.Request request = new DownloadManager.Request(Uri.parse(imgurMedia.getLink())); - request.setTitle(imgurMedia.getFileName()); - - request.allowScanningByMediaScanner(); - request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); - - //Android Q support - if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - request.setDestinationInExternalPublicDir(Environment.DIRECTORY_PICTURES, imgurMedia.getFileName()); - } else { - String path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).toString(); - File directory = new File(path + "/Infinity/"); - boolean saveToInfinityFolder = true; - if (!directory.exists()) { - if (!directory.mkdir()) { - saveToInfinityFolder = false; - } - } else { - if (directory.isFile()) { - if (!(directory.delete() && directory.mkdir())) { - saveToInfinityFolder = false; - } - } - } - - if (saveToInfinityFolder) { - request.setDestinationInExternalPublicDir(Environment.DIRECTORY_PICTURES + "/Infinity/", imgurMedia.getFileName()); - } else { - request.setDestinationInExternalPublicDir(Environment.DIRECTORY_PICTURES, imgurMedia.getFileName()); - } - } - - DownloadManager manager = (DownloadManager) activity.getSystemService(Context.DOWNLOAD_SERVICE); - - if (manager == null) { - Toast.makeText(activity, R.string.download_failed, Toast.LENGTH_SHORT).show(); - return; - } - - manager.enqueue(request); - Toast.makeText(activity, R.string.download_started, Toast.LENGTH_SHORT).show(); + mediaDownloader.download(imgurMedia.getLink(), imgurMedia.getFileName(), getContext()); } private void preparePlayer(Bundle savedInstanceState) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ViewMessagesFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ViewMessagesFragment.java new file mode 100644 index 00000000..6d2d7061 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/ViewMessagesFragment.java @@ -0,0 +1,128 @@ +package ml.docilealligator.infinityforreddit.Fragment; + +import android.content.SharedPreferences; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; + +import androidx.fragment.app.Fragment; +import androidx.lifecycle.ViewModelProvider; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; + +import com.bumptech.glide.RequestManager; + +import javax.inject.Inject; +import javax.inject.Named; + +import butterknife.BindView; +import ml.docilealligator.infinityforreddit.Adapter.MessageRecyclerViewAdapter; +import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper; +import ml.docilealligator.infinityforreddit.FetchMessages; +import ml.docilealligator.infinityforreddit.FragmentCommunicator; +import ml.docilealligator.infinityforreddit.MessageViewModel; +import ml.docilealligator.infinityforreddit.NetworkState; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; +import retrofit2.Retrofit; + +public class ViewMessagesFragment extends Fragment implements FragmentCommunicator { + + @BindView(R.id.swipe_refresh_layout_view_messages_fragment) + SwipeRefreshLayout mSwipeRefreshLayout; + @BindView(R.id.recycler_view_view_messages_fragment) + RecyclerView mRecyclerView; + @BindView(R.id.fetch_messages_info_linear_layout_view_messages_fragment) + LinearLayout mFetchMessageInfoLinearLayout; + @BindView(R.id.fetch_messages_info_image_view_view_messages_fragment) + ImageView mFetchMessageInfoImageView; + @BindView(R.id.fetch_messages_info_text_view_view_messages_fragment) + TextView mFetchMessageInfoTextView; + MessageViewModel mMessageViewModel; + @Inject + @Named("oauth") + Retrofit mOauthRetrofit; + @Inject + RedditDataRoomDatabase mRedditDataRoomDatabase; + @Inject + @Named("default") + SharedPreferences mSharedPreferences; + @Inject + CustomThemeWrapper mCustomThemeWrapper; + private String mAccessToken; + private MessageRecyclerViewAdapter mAdapter; + private RequestManager mGlide; + private LinearLayoutManager mLinearLayoutManager; + + public ViewMessagesFragment() { + // Required empty public constructor + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.fragment_view_messages, container, false); + + MessageViewModel.Factory factory = new MessageViewModel.Factory(mOauthRetrofit, + getResources().getConfiguration().locale, mAccessToken, FetchMessages.WHERE_INBOX); + mMessageViewModel = new ViewModelProvider(this, factory).get(MessageViewModel.class); + mMessageViewModel.getMessages().observe(getViewLifecycleOwner(), messages -> mAdapter.submitList(messages)); + + mMessageViewModel.hasMessage().observe(getViewLifecycleOwner(), hasMessage -> { + mSwipeRefreshLayout.setRefreshing(false); + if (hasMessage) { + mFetchMessageInfoLinearLayout.setVisibility(View.GONE); + } else { + mFetchMessageInfoLinearLayout.setOnClickListener(view -> { + //Do nothing + }); + showErrorView(R.string.no_messages); + } + }); + + mMessageViewModel.getInitialLoadingState().observe(getViewLifecycleOwner(), networkState -> { + if (networkState.getStatus().equals(NetworkState.Status.SUCCESS)) { + mSwipeRefreshLayout.setRefreshing(false); + } else if (networkState.getStatus().equals(NetworkState.Status.FAILED)) { + mSwipeRefreshLayout.setRefreshing(false); + mFetchMessageInfoLinearLayout.setOnClickListener(view -> { + mFetchMessageInfoLinearLayout.setVisibility(View.GONE); + mMessageViewModel.refresh(); + mAdapter.setNetworkState(null); + }); + showErrorView(R.string.load_messages_failed); + } else { + mSwipeRefreshLayout.setRefreshing(true); + } + }); + + mMessageViewModel.getPaginationNetworkState().observe(getViewLifecycleOwner(), networkState -> { + mAdapter.setNetworkState(networkState); + }); + + mSwipeRefreshLayout.setOnRefreshListener(this::onRefresh); + + return rootView; + } + + private void showErrorView(int stringResId) { + mSwipeRefreshLayout.setRefreshing(false); + mFetchMessageInfoLinearLayout.setVisibility(View.VISIBLE); + mFetchMessageInfoTextView.setText(stringResId); + mGlide.load(R.drawable.error_image).into(mFetchMessageInfoImageView); + } + + @Override + public void applyTheme() { + + } + + private void onRefresh() { + mMessageViewModel.refresh(); + } +}
\ No newline at end of file diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Infinity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Infinity.java index 90478a08..04edd825 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Infinity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Infinity.java @@ -17,6 +17,7 @@ import org.greenrobot.eventbus.EventBus; import ml.docilealligator.infinityforreddit.BroadcastReceiver.NetworkWifiStatusReceiver; import ml.docilealligator.infinityforreddit.Event.ChangeWifiStatusEvent; import ml.docilealligator.infinityforreddit.Utils.Utils; +import ml.docilealligator.inifinityforreddit.EventBusIndex; public class Infinity extends Application { private AppComponent mAppComponent; @@ -42,6 +43,8 @@ public class Infinity extends Application { } }); + EventBus.builder().addIndex(new EventBusIndex()).installDefaultEventBus(); + mNetworkWifiStatusReceiver = new NetworkWifiStatusReceiver(() -> EventBus.getDefault().post(new ChangeWifiStatusEvent(Utils.isConnectedToWifi(getApplicationContext())))); registerReceiver(mNetworkWifiStatusReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION)); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/MediaDownloader.java b/app/src/main/java/ml/docilealligator/infinityforreddit/MediaDownloader.java new file mode 100644 index 00000000..9967a6a4 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/MediaDownloader.java @@ -0,0 +1,7 @@ +package ml.docilealligator.infinityforreddit; + +import android.content.Context; + +public interface MediaDownloader { + void download(String url, String fileName, Context ctx); +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/MediaDownloaderImpl.java b/app/src/main/java/ml/docilealligator/infinityforreddit/MediaDownloaderImpl.java new file mode 100644 index 00000000..638bdf93 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/MediaDownloaderImpl.java @@ -0,0 +1,58 @@ +package ml.docilealligator.infinityforreddit; + +import android.app.DownloadManager; +import android.content.Context; +import android.net.Uri; +import android.os.Build; +import android.os.Environment; +import android.widget.Toast; + +import java.io.File; + +public class MediaDownloaderImpl implements MediaDownloader { + + @Override + public void download(String url, String fileName, Context ctx) { + DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url)); + request.setTitle(fileName); + + request.allowScanningByMediaScanner(); + request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); + + //Android Q support + if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + request.setDestinationInExternalPublicDir(Environment.DIRECTORY_PICTURES, fileName); + } else { + String path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).toString(); + File directory = new File(path + "/Infinity/"); + boolean saveToInfinityFolder = true; + if (!directory.exists()) { + if (!directory.mkdir()) { + saveToInfinityFolder = false; + } + } else { + if (directory.isFile()) { + if (!(directory.delete() && directory.mkdir())) { + saveToInfinityFolder = false; + } + } + } + + if (saveToInfinityFolder) { + request.setDestinationInExternalPublicDir(Environment.DIRECTORY_PICTURES + "/Infinity/", fileName); + } else { + request.setDestinationInExternalPublicDir(Environment.DIRECTORY_PICTURES, fileName); + } + } + + DownloadManager manager = (DownloadManager) ctx.getSystemService(Context.DOWNLOAD_SERVICE); + + if (manager == null) { + Toast.makeText(ctx, R.string.download_failed, Toast.LENGTH_SHORT).show(); + return; + } + + manager.enqueue(request); + Toast.makeText(ctx, R.string.download_started, Toast.LENGTH_SHORT).show(); + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/MessageDataSource.java b/app/src/main/java/ml/docilealligator/infinityforreddit/MessageDataSource.java index 7d74afce..66fd7647 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/MessageDataSource.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/MessageDataSource.java @@ -15,6 +15,7 @@ class MessageDataSource extends PageKeyedDataSource<String, Message> { private Locale locale; private String accessToken; private String where; + private int messageType; private MutableLiveData<NetworkState> paginationNetworkStateLiveData; private MutableLiveData<NetworkState> initialLoadStateLiveData; @@ -28,6 +29,11 @@ class MessageDataSource extends PageKeyedDataSource<String, Message> { this.locale = locale; this.accessToken = accessToken; this.where = where; + if (where.equals(FetchMessages.WHERE_MESSAGES)) { + messageType = FetchMessages.MESSAGE_TYPE_PRIVATE_MESSAGE; + } else { + messageType = FetchMessages.MESSAGE_TYPE_NOTIFICATION; + } paginationNetworkStateLiveData = new MutableLiveData<>(); initialLoadStateLiveData = new MutableLiveData<>(); hasPostLiveData = new MutableLiveData<>(); @@ -53,7 +59,8 @@ class MessageDataSource extends PageKeyedDataSource<String, Message> { public void loadInitial(@NonNull LoadInitialParams<String> params, @NonNull LoadInitialCallback<String, Message> callback) { initialLoadStateLiveData.postValue(NetworkState.LOADING); - FetchMessages.fetchMessagesAsync(oauthRetrofit, locale, accessToken, where, null, new FetchMessages.FetchMessagesListener() { + FetchMessages.fetchInbox(oauthRetrofit, locale, accessToken, where, null, messageType, + new FetchMessages.FetchMessagesListener() { @Override public void fetchSuccess(ArrayList<Message> messages, @Nullable String after) { if (messages.size() == 0) { @@ -89,7 +96,8 @@ class MessageDataSource extends PageKeyedDataSource<String, Message> { paginationNetworkStateLiveData.postValue(NetworkState.LOADING); - FetchMessages.fetchMessagesAsync(oauthRetrofit, locale, accessToken, where, params.key, new FetchMessages.FetchMessagesListener() { + FetchMessages.fetchInbox(oauthRetrofit, locale, accessToken, where, params.key, messageType, + new FetchMessages.FetchMessagesListener() { @Override public void fetchSuccess(ArrayList<Message> messages, @Nullable String after) { if (after == null || after.equals("") || after.equals("null")) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/MultiReddit/FavoriteMultiReddit.java b/app/src/main/java/ml/docilealligator/infinityforreddit/MultiReddit/FavoriteMultiReddit.java index 54142d08..8c976245 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/MultiReddit/FavoriteMultiReddit.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/MultiReddit/FavoriteMultiReddit.java @@ -2,12 +2,11 @@ package ml.docilealligator.infinityforreddit.MultiReddit; import androidx.annotation.NonNull; -import java.util.ArrayList; import java.util.HashMap; import java.util.Map; -import ml.docilealligator.infinityforreddit.AsyncTask.InsertMultiRedditAsyncTask; import ml.docilealligator.infinityforreddit.API.RedditAPI; +import ml.docilealligator.infinityforreddit.AsyncTask.InsertMultiRedditAsyncTask; import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; import ml.docilealligator.infinityforreddit.Utils.APIUtils; import retrofit2.Call; @@ -22,7 +21,7 @@ public class FavoriteMultiReddit { } public static void favoriteMultiReddit(Retrofit oauthRetrofit, RedditDataRoomDatabase redditDataRoomDatabase, - String accessToken, String accountName, boolean makeFavorite, + String accessToken, boolean makeFavorite, MultiReddit multiReddit, FavoriteMultiRedditListener favoriteMultiRedditListener) { Map<String, String> params = new HashMap<>(); params.put(APIUtils.MULTIPATH_KEY, multiReddit.getPath()); @@ -33,10 +32,8 @@ public class FavoriteMultiReddit { @Override public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) { if (response.isSuccessful()) { - multiReddit.setFavorite(true); - ArrayList<MultiReddit> singleMultiRedditList = new ArrayList<>(); - singleMultiRedditList.add(multiReddit); - new InsertMultiRedditAsyncTask(redditDataRoomDatabase, singleMultiRedditList, accountName, + multiReddit.setFavorite(makeFavorite); + new InsertMultiRedditAsyncTask(redditDataRoomDatabase, multiReddit, favoriteMultiRedditListener::success).execute(); } else { favoriteMultiRedditListener.failed(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseSubredditData.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ParseSubredditData.java index 73854808..23bd9910 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseSubredditData.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ParseSubredditData.java @@ -10,6 +10,7 @@ import java.util.ArrayList; import ml.docilealligator.infinityforreddit.SubredditDatabase.SubredditData; import ml.docilealligator.infinityforreddit.Utils.JSONUtils; +import ml.docilealligator.infinityforreddit.Utils.Utils; class ParseSubredditData { static void parseSubredditData(String response, ParseSubredditDataListener parseSubredditDataListener) { @@ -24,7 +25,7 @@ class ParseSubredditData { String id = subredditDataJsonObject.getString(JSONUtils.NAME_KEY); String subredditFullName = subredditDataJsonObject.getString(JSONUtils.DISPLAY_NAME_KEY); String description = subredditDataJsonObject.getString(JSONUtils.PUBLIC_DESCRIPTION_KEY).trim(); - String sidebarDescription = subredditDataJsonObject.getString(JSONUtils.DESCRIPTION_KEY).trim(); + String sidebarDescription = Utils.modifyMarkdown(subredditDataJsonObject.getString(JSONUtils.DESCRIPTION_KEY).trim()); long createdUTC = subredditDataJsonObject.getLong(JSONUtils.CREATED_UTC_KEY) * 1000; String bannerImageUrl; 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 a05a97f2..3a345572 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Post/Post.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Post/Post.java @@ -252,6 +252,11 @@ public class Post implements Parcelable { return author; } + public void setAuthor(String author) { + this.author = author; + this.authorNamePrefixed = "u/" + author; + } + public String getAuthorNamePrefixed() { return authorNamePrefixed; } @@ -320,6 +325,10 @@ public class Post implements Parcelable { return thumbnailPreviewUrl; } + public void setThumbnailPreviewUrl(String thumbnailPreviewUrl) { + this.thumbnailPreviewUrl = thumbnailPreviewUrl; + } + public String getUrl() { return url; } @@ -524,4 +533,9 @@ public class Post implements Parcelable { } return ((Post) obj).id.equals(id); } -}
\ No newline at end of file + + @Override + public int hashCode() { + return id.hashCode(); + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Post/SubmitPost.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Post/SubmitPost.java index 9e27bce1..7b4762a6 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Post/SubmitPost.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Post/SubmitPost.java @@ -21,6 +21,7 @@ import java.util.Locale; import java.util.Map; import ml.docilealligator.infinityforreddit.API.RedditAPI; +import ml.docilealligator.infinityforreddit.Flair; import ml.docilealligator.infinityforreddit.Utils.JSONUtils; import ml.docilealligator.infinityforreddit.Utils.APIUtils; import okhttp3.MediaType; @@ -34,7 +35,7 @@ import retrofit2.Retrofit; public class SubmitPost { public static void submitTextOrLinkPost(Retrofit oauthRetrofit, String accessToken, Locale locale, String subredditName, String title, String content, - String flair, boolean isSpoiler, boolean isNSFW, String kind, + Flair flair, boolean isSpoiler, boolean isNSFW, String kind, SubmitPostListener submitPostListener) { submitPost(oauthRetrofit, accessToken, locale, subredditName, title, content, flair, isSpoiler, isNSFW, kind, null, submitPostListener); @@ -42,7 +43,7 @@ public class SubmitPost { public static void submitImagePost(Retrofit oauthRetrofit, Retrofit uploadMediaRetrofit, String accessToken, Locale locale, - String subredditName, String title, Bitmap image, String flair, + String subredditName, String title, Bitmap image, Flair flair, boolean isSpoiler, boolean isNSFW, SubmitPostListener submitPostListener) { uploadImage(oauthRetrofit, uploadMediaRetrofit, accessToken, image, new UploadImageListener() { @@ -63,7 +64,7 @@ public class SubmitPost { public static void submitVideoPost(Retrofit oauthRetrofit, Retrofit uploadMediaRetrofit, Retrofit uploadVideoRetrofit, String accessToken, Locale locale, String subredditName, String title, byte[] buffer, String mimeType, - Bitmap posterBitmap, String flair, boolean isSpoiler, boolean isNSFW, + Bitmap posterBitmap, Flair flair, boolean isSpoiler, boolean isNSFW, SubmitPostListener submitPostListener) { RedditAPI api = oauthRetrofit.create(RedditAPI.class); @@ -157,7 +158,7 @@ public class SubmitPost { private static void submitPost(Retrofit oauthRetrofit, String accessToken, Locale locale, String subredditName, String title, String content, - String flair, boolean isSpoiler, boolean isNSFW, String kind, + Flair flair, boolean isSpoiler, boolean isNSFW, String kind, @Nullable String posterUrl, SubmitPostListener submitPostListener) { RedditAPI api = oauthRetrofit.create(RedditAPI.class); @@ -186,7 +187,8 @@ public class SubmitPost { } if (flair != null) { - params.put(APIUtils.FLAIR_TEXT_KEY, flair); + params.put(APIUtils.FLAIR_TEXT_KEY, flair.getText()); + params.put(APIUtils.FLAIR_ID_KEY, flair.getId()); } params.put(APIUtils.SPOILER_KEY, Boolean.toString(isSpoiler)); params.put(APIUtils.NSFW_KEY, Boolean.toString(isNSFW)); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java index 214a9736..2473d074 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PullNotificationWorker.java @@ -74,7 +74,8 @@ public class PullNotificationWorker extends Worker { if (response != null && response.isSuccessful()) { String responseBody = response.body(); - ArrayList<Message> messages = FetchMessages.parseMessage(responseBody, context.getResources().getConfiguration().locale); + ArrayList<Message> messages = FetchMessages.parseMessage(responseBody, + context.getResources().getConfiguration().locale, FetchMessages.MESSAGE_TYPE_NOTIFICATION); if (messages != null && !messages.isEmpty()) { NotificationManagerCompat notificationManager = NotificationUtils.getNotificationManager(context); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Service/DownloadRedditVideoService.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Service/DownloadRedditVideoService.java index 3da24433..b958eba2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Service/DownloadRedditVideoService.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Service/DownloadRedditVideoService.java @@ -397,7 +397,7 @@ public class DownloadRedditVideoService extends Service { int audioTrack = muxer.addTrack(audioFormat); boolean sawEOS = false; int offset = 100; - int sampleSize = 256 * 1024; + int sampleSize = 2048 * 1024; ByteBuffer videoBuf = ByteBuffer.allocate(sampleSize); ByteBuffer audioBuf = ByteBuffer.allocate(sampleSize); MediaCodec.BufferInfo videoBufferInfo = new MediaCodec.BufferInfo(); @@ -412,7 +412,6 @@ public class DownloadRedditVideoService extends Service { videoBufferInfo.offset = offset; videoBufferInfo.size = videoExtractor.readSampleData(videoBuf, offset); - if (videoBufferInfo.size < 0 || audioBufferInfo.size < 0) { sawEOS = true; videoBufferInfo.size = 0; @@ -441,8 +440,10 @@ public class DownloadRedditVideoService extends Service { } } - muxer.stop(); - muxer.release(); + try { + muxer.stop(); + muxer.release(); + } catch (IllegalStateException ignore) {} } catch (IOException e) { e.printStackTrace(); return false; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Service/SubmitPostService.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Service/SubmitPostService.java index 5177e415..eb8ffd3c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Service/SubmitPostService.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Service/SubmitPostService.java @@ -34,11 +34,12 @@ import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.Event.SubmitImagePostEvent; import ml.docilealligator.infinityforreddit.Event.SubmitTextOrLinkPostEvent; import ml.docilealligator.infinityforreddit.Event.SubmitVideoPostEvent; +import ml.docilealligator.infinityforreddit.Flair; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.NotificationUtils; import ml.docilealligator.infinityforreddit.Post.Post; -import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.Post.SubmitPost; +import ml.docilealligator.infinityforreddit.R; import retrofit2.Retrofit; public class SubmitPostService extends Service { @@ -68,7 +69,7 @@ public class SubmitPostService extends Service { private String mAccessToken; private String subredditName; private String title; - private String flair; + private Flair flair; private boolean isSpoiler; private boolean isNSFW; private String content; @@ -90,7 +91,7 @@ public class SubmitPostService extends Service { mAccessToken = intent.getStringExtra(EXTRA_ACCESS_TOKEN); subredditName = intent.getStringExtra(EXTRA_SUBREDDIT_NAME); title = intent.getStringExtra(EXTRA_TITLE); - flair = intent.getStringExtra(EXTRA_FLAIR); + flair = intent.getParcelableExtra(EXTRA_FLAIR); isSpoiler = intent.getBooleanExtra(EXTRA_IS_SPOILER, false); isNSFW = intent.getBooleanExtra(EXTRA_IS_NSFW, false); int postType = intent.getIntExtra(EXTRA_POST_TYPE, EXTRA_POST_TEXT_OR_LINK); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SetAsWallpaperCallback.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SetAsWallpaperCallback.java new file mode 100644 index 00000000..7fb6e324 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SetAsWallpaperCallback.java @@ -0,0 +1,7 @@ +package ml.docilealligator.infinityforreddit; + +public interface SetAsWallpaperCallback { + void setToHomeScreen(int viewPagerPosition); + void setToLockScreen(int viewPagerPosition); + void setToBoth(int viewPagerPosition); +}
\ No newline at end of file diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AboutPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AboutPreferenceFragment.java index 3d81bb30..71e9dbc6 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AboutPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AboutPreferenceFragment.java @@ -13,6 +13,7 @@ import androidx.preference.Preference; import androidx.preference.PreferenceFragmentCompat; import ml.docilealligator.infinityforreddit.Activity.LinkResolverActivity; +import ml.docilealligator.infinityforreddit.BuildConfig; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; @@ -34,6 +35,7 @@ public class AboutPreferenceFragment extends PreferenceFragmentCompat { Preference redditAccountPreference = findPreference(SharedPreferencesUtils.REDDIT_ACCOUNT_KEY); Preference subredditPreference = findPreference(SharedPreferencesUtils.SUBREDDIT_KEY); Preference sharePreference = findPreference(SharedPreferencesUtils.SHARE_KEY); + Preference versionPreference = findPreference(SharedPreferencesUtils.VERSION_KEY); if (openSourcePreference != null) { openSourcePreference.setOnPreferenceClickListener(preference -> { @@ -112,6 +114,24 @@ public class AboutPreferenceFragment extends PreferenceFragmentCompat { return true; }); } + + if (versionPreference != null) { + versionPreference.setSummary(getString(R.string.settings_version_summary, BuildConfig.VERSION_NAME)); + + versionPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { + int clickedTimes = 0; + + @Override + public boolean onPreferenceClick(Preference preference) { + clickedTimes++; + if (clickedTimes > 6) { + Toast.makeText(activity, R.string.no_developer_easter_egg, Toast.LENGTH_SHORT).show(); + clickedTimes = 0; + } + return true; + } + }); + } } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CreditsPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CreditsPreferenceFragment.java index 8607b486..3bb14843 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CreditsPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CreditsPreferenceFragment.java @@ -32,6 +32,7 @@ public class CreditsPreferenceFragment extends PreferenceFragmentCompat { Preference gildedIconPreference = findPreference(SharedPreferencesUtils.GILDED_ICON_KEY); Preference crosspostIconPreference = findPreference(SharedPreferencesUtils.CROSSPOST_ICON_KEY); Preference thumbtackIconPreference = findPreference(SharedPreferencesUtils.THUMBTACK_ICON_KEY); + Preference bestRocketIconPreference = findPreference(SharedPreferencesUtils.BEST_ROCKET_ICON_KEY); Preference materialIconsPreference = findPreference(SharedPreferencesUtils.MATERIAL_ICONS_KEY); if (iconForegroundPreference != null) { @@ -88,6 +89,15 @@ public class CreditsPreferenceFragment extends PreferenceFragmentCompat { }); } + if (bestRocketIconPreference != null) { + bestRocketIconPreference.setOnPreferenceClickListener(preference -> { + Intent intent = new Intent(activity, LinkResolverActivity.class); + intent.setData(Uri.parse("https://www.flaticon.com/free-icon/spring-swing-rocket_2929322?term=space%20ship&page=1&position=18")); + startActivity(intent); + return true; + }); + } + if (materialIconsPreference != null) { materialIconsPreference.setOnPreferenceClickListener(preference -> { Intent intent = new Intent(activity, LinkResolverActivity.class); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CustomizeMainPageTabsFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CustomizeMainPageTabsFragment.java index 01e2c28e..33ad2ea9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CustomizeMainPageTabsFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CustomizeMainPageTabsFragment.java @@ -5,7 +5,6 @@ import android.content.SharedPreferences; import android.os.Bundle; import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.preference.EditTextPreference; import androidx.preference.ListPreference; @@ -33,12 +32,6 @@ public class CustomizeMainPageTabsFragment extends PreferenceFragmentCompat { private SettingsActivity activity; @Override - public void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - } - - @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { setPreferencesFromResource(R.xml.customize_main_page_tabs_preferences, rootKey); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/FontSizePreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/FontPreferenceFragment.java index 5d4a0a5a..78ae7d82 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/FontSizePreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/FontPreferenceFragment.java @@ -14,16 +14,41 @@ import ml.docilealligator.infinityforreddit.Event.RecreateActivityEvent; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; -public class FontSizePreferenceFragment extends PreferenceFragmentCompat { +public class FontPreferenceFragment extends PreferenceFragmentCompat { private Activity activity; @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { - setPreferencesFromResource(R.xml.font_size_preferences, rootKey); + setPreferencesFromResource(R.xml.font_preferences, rootKey); + ListPreference fontFamilyPreference = findPreference(SharedPreferencesUtils.FONT_FAMILY_KEY); + ListPreference titleFontFamilyPreference = findPreference(SharedPreferencesUtils.TITLE_FONT_FAMILY_KEY); + ListPreference contentFontFamilyPreference = findPreference(SharedPreferencesUtils.CONTENT_FONT_FAMILY_KEY); ListPreference fontSizePreference = findPreference(SharedPreferencesUtils.FONT_SIZE_KEY); ListPreference titleFontSizePreference = findPreference(SharedPreferencesUtils.TITLE_FONT_SIZE_KEY); ListPreference contentFontSizePreference = findPreference(SharedPreferencesUtils.CONTENT_FONT_SIZE_KEY); + if (fontFamilyPreference != null) { + fontFamilyPreference.setOnPreferenceChangeListener((preference, newValue) -> { + EventBus.getDefault().post(new RecreateActivityEvent()); + activity.recreate(); + return true; + }); + } + + if (titleFontFamilyPreference != null) { + titleFontFamilyPreference.setOnPreferenceChangeListener((preference, newValue) -> { + EventBus.getDefault().post(new RecreateActivityEvent()); + return true; + }); + } + + if (contentFontFamilyPreference != null) { + contentFontFamilyPreference.setOnPreferenceChangeListener((preference, newValue) -> { + EventBus.getDefault().post(new RecreateActivityEvent()); + return true; + }); + } + if (fontSizePreference != null) { fontSizePreference.setOnPreferenceChangeListener((preference, newValue) -> { EventBus.getDefault().post(new RecreateActivityEvent()); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/FontPreviewFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/FontPreviewFragment.java new file mode 100644 index 00000000..9cd93e01 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/FontPreviewFragment.java @@ -0,0 +1,29 @@ +package ml.docilealligator.infinityforreddit.Settings; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.fragment.app.Fragment; + +import ml.docilealligator.infinityforreddit.R; + +/** + * A simple {@link Fragment} subclass. + * Use the {@link FontPreviewFragment#newInstance} factory method to + * create an instance of this fragment. + */ +public class FontPreviewFragment extends Fragment { + + public FontPreviewFragment() { + // Required empty public constructor + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.fragment_font_preview, container, false); + return rootView; + } +}
\ No newline at end of file diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/ImmersiveInterfacePreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/ImmersiveInterfacePreferenceFragment.java new file mode 100644 index 00000000..c9f95e98 --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/ImmersiveInterfacePreferenceFragment.java @@ -0,0 +1,53 @@ +package ml.docilealligator.infinityforreddit.Settings; + +import android.os.Build; +import android.os.Bundle; + +import androidx.preference.PreferenceFragmentCompat; +import androidx.preference.SwitchPreference; + +import org.greenrobot.eventbus.EventBus; + +import ml.docilealligator.infinityforreddit.Event.RecreateActivityEvent; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; + +public class ImmersiveInterfacePreferenceFragment extends PreferenceFragmentCompat { + + @Override + public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { + setPreferencesFromResource(R.xml.immersive_interface_preferences, rootKey); + + SwitchPreference immersiveInterfaceSwitch = findPreference(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY); + SwitchPreference immersiveInterfaceIgnoreNavBarSwitch = findPreference(SharedPreferencesUtils.IMMERSIVE_INTERFACE_IGNORE_NAV_BAR_KEY); + + if (immersiveInterfaceSwitch != null && immersiveInterfaceIgnoreNavBarSwitch != null) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + immersiveInterfaceSwitch.setVisible(true); + immersiveInterfaceSwitch.setOnPreferenceChangeListener((preference, newValue) -> { + if ((Boolean) newValue) { + immersiveInterfaceIgnoreNavBarSwitch.setVisible(true); + } else { + immersiveInterfaceIgnoreNavBarSwitch.setVisible(false); + } + EventBus.getDefault().post(new RecreateActivityEvent()); + return true; + }); + + if (immersiveInterfaceSwitch.isChecked()) { + immersiveInterfaceIgnoreNavBarSwitch.setVisible(true); + } else { + immersiveInterfaceIgnoreNavBarSwitch.setVisible(false); + } + + immersiveInterfaceIgnoreNavBarSwitch.setOnPreferenceChangeListener((preference, newValue) -> { + EventBus.getDefault().post(new RecreateActivityEvent()); + return true; + }); + } else { + immersiveInterfaceSwitch.setVisible(false); + immersiveInterfaceIgnoreNavBarSwitch.setVisible(false); + } + } + } +}
\ No newline at end of file diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/InterfacePreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/InterfacePreferenceFragment.java index c3c21c1c..85ba2a5e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/InterfacePreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/InterfacePreferenceFragment.java @@ -1,10 +1,8 @@ package ml.docilealligator.infinityforreddit.Settings; -import android.os.Build; import android.os.Bundle; -import androidx.fragment.app.Fragment; import androidx.preference.ListPreference; import androidx.preference.PreferenceFragmentCompat; import androidx.preference.SwitchPreference; @@ -17,56 +15,24 @@ import ml.docilealligator.infinityforreddit.Event.ChangeShowElapsedTimeEvent; import ml.docilealligator.infinityforreddit.Event.ChangeVoteButtonsPositionEvent; import ml.docilealligator.infinityforreddit.Event.RecreateActivityEvent; import ml.docilealligator.infinityforreddit.Event.ShowDividerInCompactLayoutPreferenceEvent; +import ml.docilealligator.infinityforreddit.Event.ShowThumbnailOnTheRightInCompactLayoutEvent; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; -/** - * A simple {@link Fragment} subclass. - */ public class InterfacePreferenceFragment extends PreferenceFragmentCompat { @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { setPreferencesFromResource(R.xml.interface_preference, rootKey); - SwitchPreference immersiveInterfaceSwitch = findPreference(SharedPreferencesUtils.IMMERSIVE_INTERFACE_KEY); - SwitchPreference immersiveInterfaceIgnoreNavBarSwitch = findPreference(SharedPreferencesUtils.IMMERSIVE_INTERFACE_IGNORE_NAV_BAR_KEY); SwitchPreference bottomAppBarSwitch = findPreference(SharedPreferencesUtils.BOTTOM_APP_BAR_KEY); SwitchPreference voteButtonsOnTheRightSwitch = findPreference(SharedPreferencesUtils.VOTE_BUTTONS_ON_THE_RIGHT_KEY); SwitchPreference showElapsedTimeSwitch = findPreference(SharedPreferencesUtils.SHOW_ELAPSED_TIME_KEY); ListPreference defaultPostLayoutSwitch = findPreference(SharedPreferencesUtils.DEFAULT_POST_LAYOUT_KEY); SwitchPreference showDividerInCompactLayout = findPreference(SharedPreferencesUtils.SHOW_DIVIDER_IN_COMPACT_LAYOUT); + SwitchPreference showThumbnailOnTheRightInCompactLayout = findPreference(SharedPreferencesUtils.SHOW_THUMBNAIL_ON_THE_RIGHT_IN_COMPACT_LAYOUT); SwitchPreference showAbsoluteNumberOfVotes = findPreference(SharedPreferencesUtils.SHOW_ABSOLUTE_NUMBER_OF_VOTES); - if (immersiveInterfaceSwitch != null && immersiveInterfaceIgnoreNavBarSwitch != null) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - immersiveInterfaceSwitch.setVisible(true); - immersiveInterfaceSwitch.setOnPreferenceChangeListener((preference, newValue) -> { - if ((Boolean) newValue) { - immersiveInterfaceIgnoreNavBarSwitch.setVisible(true); - } else { - immersiveInterfaceIgnoreNavBarSwitch.setVisible(false); - } - EventBus.getDefault().post(new RecreateActivityEvent()); - return true; - }); - - if (immersiveInterfaceSwitch.isChecked()) { - immersiveInterfaceIgnoreNavBarSwitch.setVisible(true); - } else { - immersiveInterfaceIgnoreNavBarSwitch.setVisible(false); - } - - immersiveInterfaceIgnoreNavBarSwitch.setOnPreferenceChangeListener((preference, newValue) -> { - EventBus.getDefault().post(new RecreateActivityEvent()); - return true; - }); - } else { - immersiveInterfaceSwitch.setVisible(false); - immersiveInterfaceIgnoreNavBarSwitch.setVisible(false); - } - } - if (bottomAppBarSwitch != null) { bottomAppBarSwitch.setOnPreferenceChangeListener((preference, newValue) -> { EventBus.getDefault().post(new RecreateActivityEvent()); @@ -102,6 +68,13 @@ public class InterfacePreferenceFragment extends PreferenceFragmentCompat { }); } + if (showThumbnailOnTheRightInCompactLayout != null) { + showThumbnailOnTheRightInCompactLayout.setOnPreferenceChangeListener((preference, newValue) -> { + EventBus.getDefault().post(new ShowThumbnailOnTheRightInCompactLayoutEvent((Boolean) newValue)); + return true; + }); + } + if (showAbsoluteNumberOfVotes != null) { showAbsoluteNumberOfVotes.setOnPreferenceChangeListener((preference, newValue) -> { EventBus.getDefault().post(new ChangeShowAbsoluteNumberOfVotesEvent((Boolean) newValue)); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AutoplayPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/VideoPreferenceFragment.java index 91bd52d7..e7cd2432 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AutoplayPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/VideoPreferenceFragment.java @@ -9,17 +9,19 @@ import androidx.preference.SwitchPreference; import org.greenrobot.eventbus.EventBus; import ml.docilealligator.infinityforreddit.Event.ChangeAutoplayNsfwVideosEvent; +import ml.docilealligator.infinityforreddit.Event.ChangeMuteAutoplayingVideosEvent; import ml.docilealligator.infinityforreddit.Event.ChangeVideoAutoplayEvent; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.Utils.SharedPreferencesUtils; -public class AutoplayPreferenceFragment extends PreferenceFragmentCompat { +public class VideoPreferenceFragment extends PreferenceFragmentCompat { @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { - setPreferencesFromResource(R.xml.autoplay_preferences, rootKey); + setPreferencesFromResource(R.xml.video_preferences, rootKey); ListPreference videoAutoplayListPreference = findPreference(SharedPreferencesUtils.VIDEO_AUTOPLAY); + SwitchPreference muteAutoplayingVideosSwitchPreference = findPreference(SharedPreferencesUtils.MUTE_AUTOPLAYING_VIDEOS); SwitchPreference autoplayNsfwVideosSwitchPreference = findPreference(SharedPreferencesUtils.AUTOPLAY_NSFW_VIDEOS); if (videoAutoplayListPreference != null && autoplayNsfwVideosSwitchPreference != null) { @@ -33,5 +35,12 @@ public class AutoplayPreferenceFragment extends PreferenceFragmentCompat { return true; }); } + + if (muteAutoplayingVideosSwitchPreference != null) { + muteAutoplayingVideosSwitchPreference.setOnPreferenceChangeListener((preference, newValue) -> { + EventBus.getDefault().post(new ChangeMuteAutoplayingVideosEvent((Boolean) newValue)); + return true; + }); + } } }
\ No newline at end of file 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 a42c1660..89b85bbe 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/APIUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/APIUtils.java @@ -21,6 +21,7 @@ public class APIUtils { public static final String GFYCAT_API_BASE_URI = "https://api.gfycat.com/v1/gfycats/"; public static final String REDGIFS_API_BASE_URI = "https://api.redgifs.com/v1/gfycats/"; public static final String IMGUR_API_BASE_URI = "https://api.imgur.com/3/"; + public static final String PUSHSHIFT_API_BASE_URI = "https://api.pushshift.io/"; public static final String CLIENT_ID_KEY = "client_id"; public static final String CLIENT_ID = "NOe2iKrPPzwscA"; @@ -82,6 +83,7 @@ public class APIUtils { public static final String LINK_KEY = "link"; public static final String FLAIR_TEMPLATE_ID_KEY = "flair_template_id"; + public static final String FLAIR_ID_KEY = "flair_id"; public static final String MAKE_FAVORITE_KEY = "make_favorite"; 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 04c16284..fc8cfcf9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/GlideImageGetter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/GlideImageGetter.java @@ -56,7 +56,7 @@ public class GlideImageGetter implements Html.ImageGetter { BitmapDrawablePlaceholder drawable = new BitmapDrawablePlaceholder(textSize); Context context = container.get().getContext(); - if (!(context instanceof Activity && ((Activity) context).isFinishing())) { + if (!(context instanceof Activity && ((Activity) context).isDestroyed())) { container.get().post(() -> Glide.with(context) .asBitmap() .load(source) @@ -118,7 +118,9 @@ public class GlideImageGetter implements Html.ImageGetter { @Override public void onResourceReady(@NonNull Bitmap bitmap, @Nullable Transition<? super Bitmap> transition) { - setDrawable(new BitmapDrawable(container.get().getResources(), bitmap)); + if (container != null) { + setDrawable(new BitmapDrawable(container.get().getResources(), bitmap)); + } } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java index a51c9e0b..ee25195d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java @@ -18,6 +18,7 @@ public class SharedPreferencesUtils { public static final String GILDED_ICON_KEY = "gilded_icon"; public static final String CROSSPOST_ICON_KEY = "crosspost_icon"; public static final String THUMBTACK_ICON_KEY = "thumbtack_icon"; + public static final String BEST_ROCKET_ICON_KEY = "best_rocket_icon"; public static final String MATERIAL_ICONS_KEY = "material_icons"; public static final String OPEN_SOURCE_KEY = "open_source"; public static final String RATE_KEY = "rate"; @@ -26,9 +27,13 @@ public class SharedPreferencesUtils { public static final String REDDIT_ACCOUNT_KEY = "reddit_account"; public static final String SUBREDDIT_KEY = "subreddit"; public static final String SHARE_KEY = "share"; + public static final String VERSION_KEY = "version"; public static final String FONT_SIZE_KEY = "font_size"; public static final String TITLE_FONT_SIZE_KEY = "title_font_size"; public static final String CONTENT_FONT_SIZE_KEY = "content_font_size"; + public static final String FONT_FAMILY_KEY = "font_family"; + public static final String TITLE_FONT_FAMILY_KEY = "title_font_family"; + public static final String CONTENT_FONT_FAMILY_KEY = "content_font_family"; public static final String AMOLED_DARK_KEY = "amoled_dark"; public static final String IMMERSIVE_INTERFACE_KEY = "immersive_interface"; public static final String IMMERSIVE_INTERFACE_IGNORE_NAV_BAR_KEY = "immersive_interface_ignore_nav_bar"; @@ -71,6 +76,7 @@ public class SharedPreferencesUtils { public static final String SHOW_ELAPSED_TIME_KEY = "show_elapsed_time"; public static final String DEFAULT_POST_LAYOUT_KEY = "default_post_layout"; public static final String SHOW_DIVIDER_IN_COMPACT_LAYOUT = "show_divider_in_compact_layout"; + public static final String SHOW_THUMBNAIL_ON_THE_RIGHT_IN_COMPACT_LAYOUT = "show_thumbnail_on_the_right_in_compact_layout"; public static final String SWIPE_RIGHT_TO_GO_BACK_FROM_POST_DETAIL = "swipe_to_go_back_from_post_detail"; public static final String VOLUME_KEYS_NAVIGATE_COMMENTS = "volume_keys_navigate_comments"; public static final String VOLUME_KEYS_NAVIGATE_POSTS = "volume_keys_navigate_posts"; @@ -80,7 +86,9 @@ public class SharedPreferencesUtils { public static final String VIDEO_AUTOPLAY_VALUE_ALWAYS_ON = "2"; public static final String VIDEO_AUTOPLAY_VALUE_ON_WIFI = "1"; public static final String VIDEO_AUTOPLAY_VALUE_NEVER = "0"; + public static final String MUTE_AUTOPLAYING_VIDEOS = "mute_autoplaying_videos"; public static final String AUTOPLAY_NSFW_VIDEOS = "autoplay_nsfw_videos"; + public static final String AUTOMATICALLY_TRY_REDGIFS = "automatically_try_redgifs"; public static final String LOCK_JUMP_TO_NEXT_TOP_LEVEL_COMMENT_BUTTON = "lock_jump_to_next_top_level_comment_button"; public static final String SWAP_TAP_AND_LONG_COMMENTS = "swap_tap_and_long_in_comments"; public static final String SWIPE_UP_TO_HIDE_JUMP_TO_NEXT_TOP_LEVEL_COMMENT_BUTTON = "swipe_up_to_hide_jump_to_next_top_level_comments_button"; 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 329371dc..52a1972a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/Utils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/Utils.java @@ -7,6 +7,7 @@ import android.net.Network; import android.net.NetworkInfo; import android.text.Html; import android.text.Spannable; +import android.util.DisplayMetrics; import android.view.inputmethod.InputMethodManager; import android.widget.TextView; @@ -126,4 +127,8 @@ public class Utils { inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), 0); } } + + public static float convertDpToPixel(float dp, Context context){ + return dp * ((float) context.getResources().getDisplayMetrics().densityDpi / DisplayMetrics.DENSITY_DEFAULT); + } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/WallpaperSetter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/WallpaperSetter.java new file mode 100644 index 00000000..f1407bab --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/WallpaperSetter.java @@ -0,0 +1,46 @@ +package ml.docilealligator.infinityforreddit; + +import android.app.WallpaperManager; +import android.content.Context; +import android.graphics.Bitmap; +import android.graphics.drawable.Drawable; +import android.view.WindowManager; +import android.widget.Toast; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import com.bumptech.glide.Glide; +import com.bumptech.glide.request.target.CustomTarget; +import com.bumptech.glide.request.transition.Transition; + +import ml.docilealligator.infinityforreddit.AsyncTask.SetAsWallpaperAsyncTask; + +public class WallpaperSetter { + public static final int HOME_SCREEN = 0; + public static final int LOCK_SCREEN = 1; + public static final int BOTH_SCREENS = 2; + + public static void set(String url, int setTo, Context context, SetWallpaperListener setWallpaperListener) { + Toast.makeText(context, R.string.save_image_first, Toast.LENGTH_SHORT).show(); + WallpaperManager wallpaperManager = WallpaperManager.getInstance(context); + WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); + + Glide.with(context).asBitmap().load(url).into(new CustomTarget<Bitmap>() { + @Override + public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) { + new SetAsWallpaperAsyncTask(resource, setTo, wallpaperManager, windowManager, setWallpaperListener).execute(); + } + + @Override + public void onLoadCleared(@Nullable Drawable placeholder) { + + } + }); + } + + public interface SetWallpaperListener { + void success(); + void failed(); + } +} diff --git a/app/src/main/res/anim/slide_out_down.xml b/app/src/main/res/anim/slide_out_down.xml new file mode 100644 index 00000000..4c64d6c4 --- /dev/null +++ b/app/src/main/res/anim/slide_out_down.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> + +<set xmlns:android="http://schemas.android.com/apk/res/android"> + <translate + android:duration="@android:integer/config_shortAnimTime" + android:fromYDelta="0" + android:toYDelta="+50%p" /> + <alpha + android:duration="@android:integer/config_shortAnimTime" + android:fromAlpha="1.0" + android:toAlpha="0.0" /> +</set> diff --git a/app/src/main/res/anim/slide_out_up.xml b/app/src/main/res/anim/slide_out_up.xml new file mode 100644 index 00000000..945e2b7e --- /dev/null +++ b/app/src/main/res/anim/slide_out_up.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> + +<set xmlns:android="http://schemas.android.com/apk/res/android"> + <translate + android:duration="@android:integer/config_shortAnimTime" + android:fromYDelta="0" + android:toYDelta="-50%p" /> + <alpha + android:duration="@android:integer/config_shortAnimTime" + android:fromAlpha="1.0" + android:toAlpha="0.0" /> +</set> diff --git a/app/src/main/res/drawable-night/ic_home_black_24dp.xml b/app/src/main/res/drawable-night/ic_home_black_24dp.xml new file mode 100644 index 00000000..a35f1eff --- /dev/null +++ b/app/src/main/res/drawable-night/ic_home_black_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="M12,5.69l5,4.5V18h-2v-6H9v6H7v-7.81l5,-4.5M12,3L2,12h3v8h6v-6h2v6h6v-8h3L12,3z" + android:fillColor="#000000"/> +</vector> diff --git a/app/src/main/res/drawable-night/ic_preview_24dp.xml b/app/src/main/res/drawable-night/ic_preview_24dp.xml new file mode 100644 index 00000000..e54e3a9f --- /dev/null +++ b/app/src/main/res/drawable-night/ic_preview_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="M12,6.5c3.79,0 7.17,2.13 8.82,5.5 -1.65,3.37 -5.02,5.5 -8.82,5.5S4.83,15.37 3.18,12C4.83,8.63 8.21,6.5 12,6.5m0,-2C7,4.5 2.73,7.61 1,12c1.73,4.39 6,7.5 11,7.5s9.27,-3.11 11,-7.5c-1.73,-4.39 -6,-7.5 -11,-7.5zM12,9.5c1.38,0 2.5,1.12 2.5,2.5s-1.12,2.5 -2.5,2.5 -2.5,-1.12 -2.5,-2.5 1.12,-2.5 2.5,-2.5m0,-2c-2.48,0 -4.5,2.02 -4.5,4.5s2.02,4.5 4.5,4.5 4.5,-2.02 4.5,-4.5 -2.02,-4.5 -4.5,-4.5z" + android:fillColor="#FFFFFF"/> +</vector> diff --git a/app/src/main/res/drawable-night/ic_wallpaper_both_black_24dp.xml b/app/src/main/res/drawable-night/ic_wallpaper_both_black_24dp.xml new file mode 100644 index 00000000..d41e02ac --- /dev/null +++ b/app/src/main/res/drawable-night/ic_wallpaper_both_black_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,1.01L7,1c-1.1,0 -2,0.9 -2,2v18c0,1.1 0.9,2 2,2h10c1.1,0 2,-0.9 2,-2V3c0,-1.1 -0.9,-1.99 -2,-1.99zM17,19H7V5h10v14z" + android:fillColor="#FFFFFF"/> +</vector> diff --git a/app/src/main/res/drawable-night/ic_wallpaper_home_screen_black_24dp.xml b/app/src/main/res/drawable-night/ic_wallpaper_home_screen_black_24dp.xml new file mode 100644 index 00000000..c112c91b --- /dev/null +++ b/app/src/main/res/drawable-night/ic_wallpaper_home_screen_black_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="M12,5.69l5,4.5V18h-2v-6H9v6H7v-7.81l5,-4.5M12,3L2,12h3v8h6v-6h2v6h6v-8h3L12,3z" + android:fillColor="#FFFFFF"/> +</vector> diff --git a/app/src/main/res/drawable-night/ic_wallpaper_lock_screen_black_24dp.xml b/app/src/main/res/drawable-night/ic_wallpaper_lock_screen_black_24dp.xml new file mode 100644 index 00000000..c771c895 --- /dev/null +++ b/app/src/main/res/drawable-night/ic_wallpaper_lock_screen_black_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="M18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM9,6c0,-1.66 1.34,-3 3,-3s3,1.34 3,3v2L9,8L9,6zM18,20L6,20L6,10h12v10zM12,17c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2z" + android:fillColor="#FFFFFF"/> +</vector> diff --git a/app/src/main/res/drawable/ic_best_24.xml b/app/src/main/res/drawable/ic_best_24.xml new file mode 100644 index 00000000..6a592ecc --- /dev/null +++ b/app/src/main/res/drawable/ic_best_24.xml @@ -0,0 +1,17 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <group + android:pivotX="12" + android:pivotY="12" + android:rotation="30"> + <path + android:fillColor="@android:color/white" + android:pathData="M11.3,22.66h1.4L12.7,24h-1.4zM11.3,22.66M12.07,0.06L12,0l-0.07,0.06a15.15,15.15 0,0 0,-3.47 4.89h7.08A15.1,15.1 0,0 0,12.07 0.06zM12.07,0.06M4.04,13.69v6.2l3.67,-1.15a16.43,16.43 0,0 1,-1.85 -6.21zM4.04,13.69M13.28,10.8a1.28,1.28 0,1 0,-2.56 0,1.28 1.28,0 0,0 2.56,0zM13.28,10.8" /> + <path + android:fillColor="@android:color/white" + android:pathData="M14.44,19.13a15,15 0,0 0,1.64 -12.77L7.92,6.36a15,15 0,0 0,1.64 12.77h1.74v2.06h1.4v-2.07zM9.32,10.8a2.68,2.68 0,1 1,5.37 0,2.68 2.68,0 0,1 -5.37,0zM9.32,10.8M8.83,20.53h1.4v1.9h-1.4zM8.83,20.53M18.14,12.53c-0.2,2.17 -0.83,4.28 -1.85,6.2l3.67,1.16v-6.2zM18.14,12.53M13.77,20.53h1.4v1.9h-1.4zM13.77,20.53" /> + </group> +</vector> diff --git a/app/src/main/res/drawable/ic_controversial_24.xml b/app/src/main/res/drawable/ic_controversial_24.xml new file mode 100644 index 00000000..8084cc1d --- /dev/null +++ b/app/src/main/res/drawable/ic_controversial_24.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="@android:color/white" + android:pathData="M9,3L5,6.99h3L8,14h2L10,6.99h3L9,3zM16,17.01L16,10h-2v7.01h-3L15,21l4,-3.99h-3z" /> +</vector> diff --git a/app/src/main/res/drawable/ic_hot_24.xml b/app/src/main/res/drawable/ic_hot_24.xml new file mode 100644 index 00000000..c163a23d --- /dev/null +++ b/app/src/main/res/drawable/ic_hot_24.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="@android:color/white" + android:pathData="M13.5,0.67s0.74,2.65 0.74,4.8c0,2.06 -1.35,3.73 -3.41,3.73 -2.07,0 -3.63,-1.67 -3.63,-3.73l0.03,-0.36C5.21,7.51 4,10.62 4,14c0,4.42 3.58,8 8,8s8,-3.58 8,-8C20,8.61 17.41,3.8 13.5,0.67zM11.71,19c-1.78,0 -3.22,-1.4 -3.22,-3.14 0,-1.62 1.05,-2.76 2.81,-3.12 1.77,-0.36 3.6,-1.21 4.62,-2.58 0.39,1.29 0.59,2.65 0.59,4.04 0,2.65 -2.15,4.8 -4.8,4.8z" /> +</vector> diff --git a/app/src/main/res/drawable/ic_new_24.xml b/app/src/main/res/drawable/ic_new_24.xml new file mode 100644 index 00000000..5ed64d37 --- /dev/null +++ b/app/src/main/res/drawable/ic_new_24.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="@android:color/white" + android:pathData="M23,12l-2.44,-2.78 0.34,-3.68 -3.61,-0.82 -1.89,-3.18L12,3 8.6,1.54 6.71,4.72l-3.61,0.81 0.34,3.68L1,12l2.44,2.78 -0.34,3.69 3.61,0.82 1.89,3.18L12,21l3.4,1.46 1.89,-3.18 3.61,-0.82 -0.34,-3.68L23,12z" /> +</vector> diff --git a/app/src/main/res/drawable/ic_random_24.xml b/app/src/main/res/drawable/ic_random_24.xml new file mode 100644 index 00000000..002ff2d7 --- /dev/null +++ b/app/src/main/res/drawable/ic_random_24.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="@android:color/white" + android:pathData="M19,3L5,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM7.5,18c-0.83,0 -1.5,-0.67 -1.5,-1.5S6.67,15 7.5,15s1.5,0.67 1.5,1.5S8.33,18 7.5,18zM7.5,9C6.67,9 6,8.33 6,7.5S6.67,6 7.5,6 9,6.67 9,7.5 8.33,9 7.5,9zM12,13.5c-0.83,0 -1.5,-0.67 -1.5,-1.5s0.67,-1.5 1.5,-1.5 1.5,0.67 1.5,1.5 -0.67,1.5 -1.5,1.5zM16.5,18c-0.83,0 -1.5,-0.67 -1.5,-1.5s0.67,-1.5 1.5,-1.5 1.5,0.67 1.5,1.5 -0.67,1.5 -1.5,1.5zM16.5,9c-0.83,0 -1.5,-0.67 -1.5,-1.5S15.67,6 16.5,6s1.5,0.67 1.5,1.5S17.33,9 16.5,9z" /> +</vector> diff --git a/app/src/main/res/drawable/ic_rising_24.xml b/app/src/main/res/drawable/ic_rising_24.xml new file mode 100644 index 00000000..75754f74 --- /dev/null +++ b/app/src/main/res/drawable/ic_rising_24.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="@android:color/white" + android:pathData="M16,6l2.29,2.29 -4.88,4.88 -4,-4L2,16.59 3.41,18l6,-6 4,4 6.3,-6.29L22,12V6z" /> +</vector> diff --git a/app/src/main/res/drawable/ic_top_24.xml b/app/src/main/res/drawable/ic_top_24.xml new file mode 100644 index 00000000..ed64f733 --- /dev/null +++ b/app/src/main/res/drawable/ic_top_24.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="@android:color/white" + android:pathData="M10,20h4L14,6h-4v16zM4,20h4v-8L4,12v8zM16,9v11h4L20,9h-4zM7,6l5,-5 5,5z" /> +</vector> diff --git a/app/src/main/res/drawable/ic_wallpaper_both_black_24dp.xml b/app/src/main/res/drawable/ic_wallpaper_both_black_24dp.xml new file mode 100644 index 00000000..98044749 --- /dev/null +++ b/app/src/main/res/drawable/ic_wallpaper_both_black_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,1.01L7,1c-1.1,0 -2,0.9 -2,2v18c0,1.1 0.9,2 2,2h10c1.1,0 2,-0.9 2,-2V3c0,-1.1 -0.9,-1.99 -2,-1.99zM17,19H7V5h10v14z" + android:fillColor="#000000"/> +</vector> diff --git a/app/src/main/res/drawable/ic_wallpaper_home_screen_black_24dp.xml b/app/src/main/res/drawable/ic_wallpaper_home_screen_black_24dp.xml new file mode 100644 index 00000000..a35f1eff --- /dev/null +++ b/app/src/main/res/drawable/ic_wallpaper_home_screen_black_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="M12,5.69l5,4.5V18h-2v-6H9v6H7v-7.81l5,-4.5M12,3L2,12h3v8h6v-6h2v6h6v-8h3L12,3z" + android:fillColor="#000000"/> +</vector> diff --git a/app/src/main/res/drawable/ic_wallpaper_lock_screen_black_24dp.xml b/app/src/main/res/drawable/ic_wallpaper_lock_screen_black_24dp.xml new file mode 100644 index 00000000..fb71425e --- /dev/null +++ b/app/src/main/res/drawable/ic_wallpaper_lock_screen_black_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="M18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM9,6c0,-1.66 1.34,-3 3,-3s3,1.34 3,3v2L9,8L9,6zM18,20L6,20L6,10h12v10zM12,17c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2z" + android:fillColor="#000000"/> +</vector> diff --git a/app/src/main/res/drawable/thumbnail_compact_layout_rounded_edge.xml b/app/src/main/res/drawable/thumbnail_compact_layout_rounded_edge.xml new file mode 100644 index 00000000..6543b1e7 --- /dev/null +++ b/app/src/main/res/drawable/thumbnail_compact_layout_rounded_edge.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <corners android:radius="8dp"/> + <padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" /> +</shape>
\ No newline at end of file diff --git a/app/src/main/res/font/bad_script_regular.ttf b/app/src/main/res/font/bad_script_regular.ttf Binary files differnew file mode 100644 index 00000000..7dc02d4a --- /dev/null +++ b/app/src/main/res/font/bad_script_regular.ttf diff --git a/app/src/main/res/font/balsamiq_sans.xml b/app/src/main/res/font/balsamiq_sans.xml new file mode 100644 index 00000000..01faaeb6 --- /dev/null +++ b/app/src/main/res/font/balsamiq_sans.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<font-family xmlns:app="http://schemas.android.com/apk/res-auto"> + <font + app:fontStyle="normal" + app:fontWeight="400" + app:font="@font/balsamiq_sans_regular" /> + + <font + app:fontStyle="normal" + app:fontWeight="700" + app:font="@font/balsamiq_sans_bold" /> + + <font + app:fontStyle="italic" + app:fontWeight="400" + app:font="@font/balsamiq_sans_italic" /> + + <font + app:fontStyle="italic" + app:fontWeight="700" + app:font="@font/balsamiq_sans_bold_italic" /> +</font-family>
\ No newline at end of file diff --git a/app/src/main/res/font/balsamiq_sans_bold.ttf b/app/src/main/res/font/balsamiq_sans_bold.ttf Binary files differnew file mode 100644 index 00000000..840ff319 --- /dev/null +++ b/app/src/main/res/font/balsamiq_sans_bold.ttf diff --git a/app/src/main/res/font/balsamiq_sans_bold_italic.ttf b/app/src/main/res/font/balsamiq_sans_bold_italic.ttf Binary files differnew file mode 100644 index 00000000..9a8d7567 --- /dev/null +++ b/app/src/main/res/font/balsamiq_sans_bold_italic.ttf diff --git a/app/src/main/res/font/balsamiq_sans_italic.ttf b/app/src/main/res/font/balsamiq_sans_italic.ttf Binary files differnew file mode 100644 index 00000000..6c749d45 --- /dev/null +++ b/app/src/main/res/font/balsamiq_sans_italic.ttf diff --git a/app/src/main/res/font/balsamiq_sans_regular.ttf b/app/src/main/res/font/balsamiq_sans_regular.ttf Binary files differnew file mode 100644 index 00000000..5f3febff --- /dev/null +++ b/app/src/main/res/font/balsamiq_sans_regular.ttf diff --git a/app/src/main/res/font/harmonia_sans.xml b/app/src/main/res/font/harmonia_sans.xml new file mode 100644 index 00000000..4dff085f --- /dev/null +++ b/app/src/main/res/font/harmonia_sans.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<font-family xmlns:app="http://schemas.android.com/apk/res-auto"> + <font + app:fontStyle="normal" + app:fontWeight="400" + app:font="@font/harmonia_sans_regular" /> + + <font + app:fontStyle="normal" + app:fontWeight="700" + app:font="@font/harmonia_sans_bold" /> + + <font + app:fontStyle="italic" + app:fontWeight="400" + app:font="@font/harmonia_sans_italic" /> +</font-family>
\ No newline at end of file diff --git a/app/src/main/res/font/harmonia_sans_bold.ttf b/app/src/main/res/font/harmonia_sans_bold.ttf Binary files differnew file mode 100644 index 00000000..c5668b6c --- /dev/null +++ b/app/src/main/res/font/harmonia_sans_bold.ttf diff --git a/app/src/main/res/font/harmonia_sans_italic.ttf b/app/src/main/res/font/harmonia_sans_italic.ttf Binary files differnew file mode 100644 index 00000000..bc9f13a4 --- /dev/null +++ b/app/src/main/res/font/harmonia_sans_italic.ttf diff --git a/app/src/main/res/font/harmonia_sans_regular.ttf b/app/src/main/res/font/harmonia_sans_regular.ttf Binary files differnew file mode 100644 index 00000000..dbaed744 --- /dev/null +++ b/app/src/main/res/font/harmonia_sans_regular.ttf diff --git a/app/src/main/res/font/inter.xml b/app/src/main/res/font/inter.xml new file mode 100644 index 00000000..6b7e74f3 --- /dev/null +++ b/app/src/main/res/font/inter.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<font-family xmlns:app="http://schemas.android.com/apk/res-auto"> + <font + app:fontStyle="normal" + app:fontWeight="400" + app:font="@font/inter_regular" /> + + <font + app:fontStyle="normal" + app:fontWeight="700" + app:font="@font/inter_bold" /> +</font-family>
\ No newline at end of file diff --git a/app/src/main/res/font/inter_bold.ttf b/app/src/main/res/font/inter_bold.ttf Binary files differnew file mode 100644 index 00000000..5b3865c8 --- /dev/null +++ b/app/src/main/res/font/inter_bold.ttf diff --git a/app/src/main/res/font/inter_regular.ttf b/app/src/main/res/font/inter_regular.ttf Binary files differnew file mode 100644 index 00000000..b1965d40 --- /dev/null +++ b/app/src/main/res/font/inter_regular.ttf diff --git a/app/src/main/res/font/manrope.xml b/app/src/main/res/font/manrope.xml new file mode 100644 index 00000000..d9db58d6 --- /dev/null +++ b/app/src/main/res/font/manrope.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<font-family xmlns:app="http://schemas.android.com/apk/res-auto"> + <font + app:fontStyle="normal" + app:fontWeight="500" + app:font="@font/manrope_medium" /> + + <font + app:fontStyle="normal" + app:fontWeight="700" + app:font="@font/manrope_bold" /> +</font-family>
\ No newline at end of file diff --git a/app/src/main/res/font/manrope_bold.ttf b/app/src/main/res/font/manrope_bold.ttf Binary files differnew file mode 100644 index 00000000..0b2be328 --- /dev/null +++ b/app/src/main/res/font/manrope_bold.ttf diff --git a/app/src/main/res/font/manrope_medium.ttf b/app/src/main/res/font/manrope_medium.ttf Binary files differnew file mode 100644 index 00000000..e704d983 --- /dev/null +++ b/app/src/main/res/font/manrope_medium.ttf diff --git a/app/src/main/res/font/manrope_regular.ttf b/app/src/main/res/font/manrope_regular.ttf Binary files differnew file mode 100644 index 00000000..8f414180 --- /dev/null +++ b/app/src/main/res/font/manrope_regular.ttf diff --git a/app/src/main/res/font/noto_sans.xml b/app/src/main/res/font/noto_sans.xml new file mode 100644 index 00000000..5fe68106 --- /dev/null +++ b/app/src/main/res/font/noto_sans.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<font-family xmlns:app="http://schemas.android.com/apk/res-auto"> + <font + app:fontStyle="normal" + app:fontWeight="400" + app:font="@font/noto_sans_regular" /> + + <font + app:fontStyle="normal" + app:fontWeight="700" + app:font="@font/noto_sans_bold" /> + + <font + app:fontStyle="italic" + app:fontWeight="400" + app:font="@font/noto_sans_italic" /> + + <font + app:fontStyle="italic" + app:fontWeight="700" + app:font="@font/noto_sans_bold_italic" /> +</font-family>
\ No newline at end of file diff --git a/app/src/main/res/font/noto_sans_bold.ttf b/app/src/main/res/font/noto_sans_bold.ttf Binary files differnew file mode 100644 index 00000000..54ad879b --- /dev/null +++ b/app/src/main/res/font/noto_sans_bold.ttf diff --git a/app/src/main/res/font/noto_sans_bold_italic.ttf b/app/src/main/res/font/noto_sans_bold_italic.ttf Binary files differnew file mode 100644 index 00000000..530a8283 --- /dev/null +++ b/app/src/main/res/font/noto_sans_bold_italic.ttf diff --git a/app/src/main/res/font/noto_sans_italic.ttf b/app/src/main/res/font/noto_sans_italic.ttf Binary files differnew file mode 100644 index 00000000..27ff1ed6 --- /dev/null +++ b/app/src/main/res/font/noto_sans_italic.ttf diff --git a/app/src/main/res/font/noto_sans_regular.ttf b/app/src/main/res/font/noto_sans_regular.ttf Binary files differnew file mode 100644 index 00000000..10589e27 --- /dev/null +++ b/app/src/main/res/font/noto_sans_regular.ttf diff --git a/app/src/main/res/font/roboto_condensed.xml b/app/src/main/res/font/roboto_condensed.xml new file mode 100644 index 00000000..64811d6e --- /dev/null +++ b/app/src/main/res/font/roboto_condensed.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<font-family xmlns:app="http://schemas.android.com/apk/res-auto"> + <font + app:fontStyle="normal" + app:fontWeight="400" + app:font="@font/roboto_condensed_regular" /> + + <font + app:fontStyle="normal" + app:fontWeight="700" + app:font="@font/roboto_condensed_bold" /> + + <font + app:fontStyle="italic" + app:fontWeight="400" + app:font="@font/roboto_condensed_italic" /> + + <font + app:fontStyle="italic" + app:fontWeight="700" + app:font="@font/roboto_condensed_bold_italic" /> +</font-family>
\ No newline at end of file diff --git a/app/src/main/res/font/roboto_condensed_bold.ttf b/app/src/main/res/font/roboto_condensed_bold.ttf Binary files differnew file mode 100644 index 00000000..7fe31289 --- /dev/null +++ b/app/src/main/res/font/roboto_condensed_bold.ttf diff --git a/app/src/main/res/font/roboto_condensed_bold_italic.ttf b/app/src/main/res/font/roboto_condensed_bold_italic.ttf Binary files differnew file mode 100644 index 00000000..52ef6f37 --- /dev/null +++ b/app/src/main/res/font/roboto_condensed_bold_italic.ttf diff --git a/app/src/main/res/font/roboto_condensed_italic.ttf b/app/src/main/res/font/roboto_condensed_italic.ttf Binary files differnew file mode 100644 index 00000000..12216d67 --- /dev/null +++ b/app/src/main/res/font/roboto_condensed_italic.ttf diff --git a/app/src/main/res/font/roboto_condensed_regular.ttf b/app/src/main/res/font/roboto_condensed_regular.ttf Binary files differnew file mode 100644 index 00000000..62dd61e5 --- /dev/null +++ b/app/src/main/res/font/roboto_condensed_regular.ttf diff --git a/app/src/main/res/font/sriracha_regular.ttf b/app/src/main/res/font/sriracha_regular.ttf Binary files differnew file mode 100644 index 00000000..cbc699a3 --- /dev/null +++ b/app/src/main/res/font/sriracha_regular.ttf diff --git a/app/src/main/res/layout/activity_account_posts.xml b/app/src/main/res/layout/activity_account_posts.xml index 0cf8d0ef..396a6ab3 100644 --- a/app/src/main/res/layout/activity_account_posts.xml +++ b/app/src/main/res/layout/activity_account_posts.xml @@ -24,7 +24,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar_account_posts_activity" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:popupTheme="@style/AppTheme.PopupOverlay" app:navigationIcon="?attr/homeAsUpIndicator" /> diff --git a/app/src/main/res/layout/activity_account_saved_thing.xml b/app/src/main/res/layout/activity_account_saved_thing.xml index 9f54be21..57f61d2c 100644 --- a/app/src/main/res/layout/activity_account_saved_thing.xml +++ b/app/src/main/res/layout/activity_account_saved_thing.xml @@ -24,7 +24,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar_account_saved_thing_activity" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:layout_collapseMode="pin" app:layout_scrollFlags="scroll|enterAlways" app:popupTheme="@style/AppTheme.PopupOverlay" diff --git a/app/src/main/res/layout/activity_comment.xml b/app/src/main/res/layout/activity_comment.xml index 33b9cfc3..1fe93f50 100644 --- a/app/src/main/res/layout/activity_comment.xml +++ b/app/src/main/res/layout/activity_comment.xml @@ -16,7 +16,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar_comment_activity" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:navigationIcon="?attr/homeAsUpIndicator" app:popupTheme="@style/AppTheme.PopupOverlay" /> @@ -37,15 +38,16 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="16dp" - android:textSize="?attr/title_font_16" /> + android:textSize="?attr/title_font_16" + android:fontFamily="?attr/content_font_family" /> <androidx.recyclerview.widget.RecyclerView android:id="@+id/content_markdown_view_comment_activity" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginStart="16dp" - android:layout_marginEnd="16dp" - android:layout_marginBottom="16dp" + android:layout_marginStart="8dp" + android:layout_marginEnd="8dp" + android:layout_marginBottom="8dp" android:visibility="gone" /> <View @@ -66,7 +68,8 @@ android:paddingEnd="16dp" android:paddingBottom="16dp" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/content_font_18" /> + android:textSize="?attr/content_font_18" + android:fontFamily="?attr/content_font_family" /> </LinearLayout> diff --git a/app/src/main/res/layout/activity_create_multi_reddit.xml b/app/src/main/res/layout/activity_create_multi_reddit.xml index a3a6f916..20adb1d1 100644 --- a/app/src/main/res/layout/activity_create_multi_reddit.xml +++ b/app/src/main/res/layout/activity_create_multi_reddit.xml @@ -23,7 +23,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar_create_multi_reddit_activity" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:popupTheme="@style/AppTheme.PopupOverlay" app:navigationIcon="?attr/homeAsUpIndicator" /> @@ -51,6 +52,7 @@ android:textSize="?attr/font_default" android:background="#00000000" android:textColor="?attr/primaryTextColor" + android:fontFamily="?attr/font_family" android:maxLength="50" /> <View @@ -67,7 +69,8 @@ android:inputType="textMultiLine" android:textSize="?attr/font_default" android:background="#00000000" - android:textColor="?attr/primaryTextColor" /> + android:textColor="?attr/primaryTextColor" + android:fontFamily="?attr/font_family" /> <View android:id="@+id/divider_2_create_multi_reddit_activity" @@ -90,7 +93,8 @@ android:layout_weight="1" android:text="@string/private_multi_reddit" android:textSize="?attr/font_default" - android:textColor="?attr/primaryTextColor" /> + android:textColor="?attr/primaryTextColor" + android:fontFamily="?attr/font_family" /> <Switch android:id="@+id/visibility_switch_create_multi_reddit_activity" @@ -108,6 +112,7 @@ android:text="@string/select_subreddits" android:textSize="?attr/font_default" android:textColor="?attr/primaryTextColor" + android:fontFamily="?attr/font_family" android:clickable="true" android:focusable="true" android:background="?attr/selectableItemBackground" /> diff --git a/app/src/main/res/layout/activity_custom_theme_listing.xml b/app/src/main/res/layout/activity_custom_theme_listing.xml index 7a16e736..a569f594 100644 --- a/app/src/main/res/layout/activity_custom_theme_listing.xml +++ b/app/src/main/res/layout/activity_custom_theme_listing.xml @@ -24,7 +24,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar_customize_theme_listing_activity" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:popupTheme="@style/AppTheme.PopupOverlay" app:navigationIcon="?attr/homeAsUpIndicator" /> diff --git a/app/src/main/res/layout/activity_customize_theme.xml b/app/src/main/res/layout/activity_customize_theme.xml index 40358952..9df359c6 100644 --- a/app/src/main/res/layout/activity_customize_theme.xml +++ b/app/src/main/res/layout/activity_customize_theme.xml @@ -25,7 +25,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar_customize_theme_activity" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:popupTheme="@style/AppTheme.PopupOverlay" app:navigationIcon="?attr/homeAsUpIndicator" /> diff --git a/app/src/main/res/layout/activity_edit_comment.xml b/app/src/main/res/layout/activity_edit_comment.xml index 305c9578..ba239230 100644 --- a/app/src/main/res/layout/activity_edit_comment.xml +++ b/app/src/main/res/layout/activity_edit_comment.xml @@ -16,7 +16,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar_edit_comment_activity" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:navigationIcon="?attr/homeAsUpIndicator" app:popupTheme="@style/AppTheme.PopupOverlay" /> @@ -33,6 +34,7 @@ android:padding="16dp" android:textColor="?attr/primaryTextColor" android:textSize="?attr/content_font_18" + android:fontFamily="?attr/content_font_family" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> </androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/activity_edit_multi_reddit.xml b/app/src/main/res/layout/activity_edit_multi_reddit.xml index c95ea6d1..bd6b9a12 100644 --- a/app/src/main/res/layout/activity_edit_multi_reddit.xml +++ b/app/src/main/res/layout/activity_edit_multi_reddit.xml @@ -23,7 +23,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar_edit_multi_reddit_activity" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:popupTheme="@style/AppTheme.PopupOverlay" app:navigationIcon="?attr/homeAsUpIndicator" /> @@ -59,6 +60,7 @@ android:textSize="?attr/font_default" android:background="#00000000" android:textColor="?attr/primaryTextColor" + android:fontFamily="?attr/font_family" android:maxLength="50" /> <View diff --git a/app/src/main/res/layout/activity_edit_post.xml b/app/src/main/res/layout/activity_edit_post.xml index bc3e377b..5d124696 100644 --- a/app/src/main/res/layout/activity_edit_post.xml +++ b/app/src/main/res/layout/activity_edit_post.xml @@ -23,7 +23,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar_edit_post_activity" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:popupTheme="@style/AppTheme.PopupOverlay" app:navigationIcon="?attr/homeAsUpIndicator" /> @@ -48,7 +49,8 @@ android:gravity="top" android:padding="16dp" android:textSize="?attr/title_font_18" - android:textColor="?attr/primaryTextColor" /> + android:textColor="?attr/primaryTextColor" + android:fontFamily="?attr/title_font_family" /> <View android:id="@+id/divider_edit_post_activity" @@ -65,7 +67,8 @@ android:inputType="textCapSentences|textMultiLine" android:textSize="?attr/content_font_18" android:background="#00000000" - android:textColor="?attr/primaryTextColor" /> + android:textColor="?attr/primaryTextColor" + android:fontFamily="?attr/content_font_family" /> </LinearLayout> diff --git a/app/src/main/res/layout/activity_filtered_thing.xml b/app/src/main/res/layout/activity_filtered_thing.xml index dd8e8cb9..a84e5140 100644 --- a/app/src/main/res/layout/activity_filtered_thing.xml +++ b/app/src/main/res/layout/activity_filtered_thing.xml @@ -24,7 +24,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar_filtered_posts_activity" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:popupTheme="@style/AppTheme.PopupOverlay" app:navigationIcon="?attr/homeAsUpIndicator" /> diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml index bceaf7a0..04c07f43 100644 --- a/app/src/main/res/layout/activity_login.xml +++ b/app/src/main/res/layout/activity_login.xml @@ -15,7 +15,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar_login_activity" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:popupTheme="@style/AppTheme.PopupOverlay" app:navigationIcon="?attr/homeAsUpIndicator" /> diff --git a/app/src/main/res/layout/activity_multi_reddit_listing.xml b/app/src/main/res/layout/activity_multi_reddit_listing.xml index 6fdd794a..a7c69f72 100644 --- a/app/src/main/res/layout/activity_multi_reddit_listing.xml +++ b/app/src/main/res/layout/activity_multi_reddit_listing.xml @@ -23,7 +23,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar_multi_reddit_listing_activity" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:popupTheme="@style/AppTheme.PopupOverlay" app:navigationIcon="?attr/homeAsUpIndicator" /> @@ -66,7 +67,8 @@ android:layout_marginTop="16dp" android:gravity="center" android:text="@string/no_multi_reddits" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </LinearLayout> diff --git a/app/src/main/res/layout/activity_post_image.xml b/app/src/main/res/layout/activity_post_image.xml index 8360f4b9..cacfd04c 100644 --- a/app/src/main/res/layout/activity_post_image.xml +++ b/app/src/main/res/layout/activity_post_image.xml @@ -16,7 +16,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar_post_image_activity" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:navigationIcon="?attr/homeAsUpIndicator" app:popupTheme="@style/AppTheme.PopupOverlay" /> @@ -57,7 +58,8 @@ android:layout_toStartOf="@id/rules_button_post_image_activity" android:layout_toEndOf="@id/subreddit_icon_gif_image_view_post_image_activity" android:text="@string/choose_a_subreddit" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> <Button android:id="@+id/rules_button_post_image_activity" @@ -66,8 +68,8 @@ android:layout_alignParentEnd="true" android:layout_centerVertical="true" android:text="@string/rules" - android:textColor="@android:color/white" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </RelativeLayout> @@ -89,6 +91,7 @@ android:text="@string/flair" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:visibility="gone" app:lib_setRadius="3dp" app:lib_setRoundedView="true" @@ -103,6 +106,7 @@ android:text="@string/spoiler" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:lib_setRadius="3dp" app:lib_setRoundedView="true" app:lib_setShape="rectangle" /> @@ -116,6 +120,7 @@ android:text="@string/nsfw" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:lib_setRadius="3dp" app:lib_setRoundedView="true" app:lib_setShape="rectangle" /> @@ -137,7 +142,8 @@ android:inputType="textCapSentences|textMultiLine" android:padding="16dp" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/title_font_18" /> + android:textSize="?attr/title_font_18" + android:fontFamily="?attr/title_font_family" /> <View android:id="@+id/divider_3_post_image_activity" @@ -184,6 +190,7 @@ android:text="@string/select_again" android:textColor="?attr/colorAccent" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:visibility="gone" /> <ImageView diff --git a/app/src/main/res/layout/activity_post_link.xml b/app/src/main/res/layout/activity_post_link.xml index 0187eb5a..076764a2 100644 --- a/app/src/main/res/layout/activity_post_link.xml +++ b/app/src/main/res/layout/activity_post_link.xml @@ -16,7 +16,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar_post_link_activity" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:navigationIcon="?attr/homeAsUpIndicator" app:popupTheme="@style/AppTheme.PopupOverlay" /> @@ -57,7 +58,8 @@ android:layout_toStartOf="@id/rules_button_post_link_activity" android:layout_toEndOf="@id/subreddit_icon_gif_image_view_post_link_activity" android:text="@string/choose_a_subreddit" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> <Button android:id="@+id/rules_button_post_link_activity" @@ -66,8 +68,8 @@ android:layout_alignParentEnd="true" android:layout_centerVertical="true" android:text="@string/rules" - android:textColor="@android:color/white" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </RelativeLayout> @@ -89,6 +91,7 @@ android:text="@string/flair" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:visibility="gone" app:lib_setRadius="3dp" app:lib_setRoundedView="true" @@ -103,6 +106,7 @@ android:text="@string/spoiler" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:lib_setRadius="3dp" app:lib_setRoundedView="true" app:lib_setShape="rectangle" /> @@ -116,6 +120,7 @@ android:text="@string/nsfw" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:lib_setRadius="3dp" app:lib_setRoundedView="true" app:lib_setShape="rectangle" /> @@ -137,7 +142,8 @@ android:inputType="textCapSentences|textMultiLine" android:padding="16dp" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/title_font_18" /> + android:textSize="?attr/title_font_18" + android:fontFamily="?attr/title_font_family" /> <View android:id="@+id/divider_3_post_link_activity" @@ -154,7 +160,8 @@ android:inputType="textMultiLine" android:padding="16dp" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/content_font_18" /> + android:textSize="?attr/content_font_18" + android:fontFamily="?attr/content_font_family" /> </LinearLayout> diff --git a/app/src/main/res/layout/activity_post_text.xml b/app/src/main/res/layout/activity_post_text.xml index c28d08f5..67ba4234 100644 --- a/app/src/main/res/layout/activity_post_text.xml +++ b/app/src/main/res/layout/activity_post_text.xml @@ -16,7 +16,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar_post_text_activity" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:navigationIcon="?attr/homeAsUpIndicator" app:popupTheme="@style/AppTheme.PopupOverlay" /> @@ -57,7 +58,8 @@ android:layout_toStartOf="@id/rules_button_post_text_activity" android:layout_toEndOf="@id/subreddit_icon_gif_image_view_search_activity" android:text="@string/choose_a_subreddit" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> <Button android:id="@+id/rules_button_post_text_activity" @@ -66,8 +68,8 @@ android:layout_alignParentEnd="true" android:layout_centerVertical="true" android:text="@string/rules" - android:textColor="@android:color/white" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </RelativeLayout> @@ -89,6 +91,7 @@ android:text="@string/flair" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:visibility="gone" app:lib_setRadius="3dp" app:lib_setRoundedView="true" @@ -103,6 +106,7 @@ android:text="@string/spoiler" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:lib_setRadius="3dp" app:lib_setRoundedView="true" app:lib_setShape="rectangle" /> @@ -116,6 +120,7 @@ android:text="@string/nsfw" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:lib_setRadius="3dp" app:lib_setRoundedView="true" app:lib_setShape="rectangle" /> @@ -137,7 +142,8 @@ android:inputType="textCapSentences|textMultiLine" android:padding="16dp" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/title_font_18" /> + android:textSize="?attr/title_font_18" + android:fontFamily="?attr/title_font_family" /> <View android:id="@+id/divider_3_post_text_activity" @@ -154,7 +160,8 @@ android:inputType="textCapSentences|textMultiLine" android:padding="16dp" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/content_font_18" /> + android:textSize="?attr/content_font_18" + android:fontFamily="?attr/content_font_family" /> </LinearLayout> diff --git a/app/src/main/res/layout/activity_post_video.xml b/app/src/main/res/layout/activity_post_video.xml index 7eea9601..c50c8be1 100644 --- a/app/src/main/res/layout/activity_post_video.xml +++ b/app/src/main/res/layout/activity_post_video.xml @@ -16,7 +16,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar_post_video_activity" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:navigationIcon="?attr/homeAsUpIndicator" app:popupTheme="@style/AppTheme.PopupOverlay" /> @@ -57,7 +58,8 @@ android:layout_toStartOf="@id/rules_button_post_video_activity" android:layout_toEndOf="@id/subreddit_icon_gif_image_view_post_video_activity" android:text="@string/choose_a_subreddit" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> <Button android:id="@+id/rules_button_post_video_activity" @@ -66,8 +68,8 @@ android:layout_alignParentEnd="true" android:layout_centerVertical="true" android:text="@string/rules" - android:textColor="@android:color/white" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </RelativeLayout> @@ -89,6 +91,7 @@ android:text="@string/flair" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:visibility="gone" app:lib_setRadius="3dp" app:lib_setRoundedView="true" @@ -103,6 +106,7 @@ android:text="@string/spoiler" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:lib_setRadius="3dp" app:lib_setRoundedView="true" app:lib_setShape="rectangle" /> @@ -116,6 +120,7 @@ android:text="@string/nsfw" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:lib_setRadius="3dp" app:lib_setRoundedView="true" app:lib_setShape="rectangle" /> @@ -137,7 +142,8 @@ android:inputType="textCapSentences|textMultiLine" android:padding="16dp" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/title_font_18" /> + android:textSize="?attr/title_font_18" + android:fontFamily="?attr/title_font_family" /> <View android:id="@+id/divider_3_post_video_activity" @@ -184,6 +190,7 @@ android:text="@string/select_again" android:textColor="?attr/colorAccent" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:visibility="gone" /> <com.google.android.exoplayer2.ui.PlayerView diff --git a/app/src/main/res/layout/activity_report.xml b/app/src/main/res/layout/activity_report.xml index 845c9ecc..ff8ecb4b 100644 --- a/app/src/main/res/layout/activity_report.xml +++ b/app/src/main/res/layout/activity_report.xml @@ -16,7 +16,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar_report_activity" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:navigationIcon="?attr/homeAsUpIndicator" app:popupTheme="@style/AppTheme.PopupOverlay" /> diff --git a/app/src/main/res/layout/activity_rules.xml b/app/src/main/res/layout/activity_rules.xml index 3d39420a..377c4fe1 100644 --- a/app/src/main/res/layout/activity_rules.xml +++ b/app/src/main/res/layout/activity_rules.xml @@ -23,7 +23,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar_rules_activity" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:popupTheme="@style/AppTheme.PopupOverlay" app:navigationIcon="?attr/homeAsUpIndicator" /> @@ -52,6 +53,8 @@ android:gravity="center" android:visibility="gone" android:textSize="?attr/font_default" + android:textColor="?attr/primaryTextColor" + android:fontFamily="?attr/font_family" app:layout_behavior="@string/appbar_scrolling_view_behavior" /> </androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/activity_search.xml b/app/src/main/res/layout/activity_search.xml index bcda1172..0048e1fc 100644 --- a/app/src/main/res/layout/activity_search.xml +++ b/app/src/main/res/layout/activity_search.xml @@ -21,7 +21,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:navigationIcon="?attr/homeAsUpIndicator" app:popupTheme="@style/AppTheme.PopupOverlay" /> @@ -29,7 +30,6 @@ android:id="@+id/search_view_search_activity" android:layout_width="match_parent" android:layout_height="match_parent" - android:textColor="@android:color/white" app:backIconAlpha="1" app:backIconTint="@android:color/white" app:cursorColor="@android:color/white" @@ -63,7 +63,8 @@ android:layout_height="wrap_content" android:text="@string/search_in" android:textColor="?attr/colorAccent" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> <TextView android:id="@+id/subreddit_name_text_view_search_activity" @@ -75,7 +76,8 @@ android:layout_toEndOf="@id/search_in_text_view_search_activity" android:text="@string/all_subreddits" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </RelativeLayout> diff --git a/app/src/main/res/layout/activity_search_result.xml b/app/src/main/res/layout/activity_search_result.xml index 79859872..cf798b26 100644 --- a/app/src/main/res/layout/activity_search_result.xml +++ b/app/src/main/res/layout/activity_search_result.xml @@ -22,7 +22,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar_search_result_activity" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:popupTheme="@style/AppTheme.PopupOverlay" app:navigationIcon="?attr/homeAsUpIndicator" /> diff --git a/app/src/main/res/layout/activity_search_subreddits_result.xml b/app/src/main/res/layout/activity_search_subreddits_result.xml index eaa560e7..b3390378 100644 --- a/app/src/main/res/layout/activity_search_subreddits_result.xml +++ b/app/src/main/res/layout/activity_search_subreddits_result.xml @@ -16,7 +16,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar_search_subreddits_result_activity" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:popupTheme="@style/AppTheme.PopupOverlay" app:navigationIcon="?attr/homeAsUpIndicator" /> diff --git a/app/src/main/res/layout/activity_selected_subreddits.xml b/app/src/main/res/layout/activity_selected_subreddits.xml index dc33a69c..4e7a3364 100644 --- a/app/src/main/res/layout/activity_selected_subreddits.xml +++ b/app/src/main/res/layout/activity_selected_subreddits.xml @@ -23,7 +23,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar_selected_subreddits_activity" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:popupTheme="@style/AppTheme.PopupOverlay" app:navigationIcon="?attr/homeAsUpIndicator" /> diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 1bd20c09..99b93a7a 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -19,7 +19,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar_settings_activity" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:navigationIcon="?attr/homeAsUpIndicator" app:popupTheme="@style/AppTheme.PopupOverlay" /> diff --git a/app/src/main/res/layout/activity_subreddit_selection.xml b/app/src/main/res/layout/activity_subreddit_selection.xml index 630f2af4..fddc0f8e 100644 --- a/app/src/main/res/layout/activity_subreddit_selection.xml +++ b/app/src/main/res/layout/activity_subreddit_selection.xml @@ -23,7 +23,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar_subreddit_selection_activity" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:popupTheme="@style/AppTheme.PopupOverlay" app:navigationIcon="?attr/homeAsUpIndicator" /> diff --git a/app/src/main/res/layout/activity_subscribed_subreddits_multiselection.xml b/app/src/main/res/layout/activity_subscribed_subreddits_multiselection.xml index 9585922d..506375e7 100644 --- a/app/src/main/res/layout/activity_subscribed_subreddits_multiselection.xml +++ b/app/src/main/res/layout/activity_subscribed_subreddits_multiselection.xml @@ -23,7 +23,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar_subscribed_subreddits_multiselection_activity" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:layout_collapseMode="pin" app:layout_scrollFlags="scroll|enterAlways" app:popupTheme="@style/AppTheme.PopupOverlay" @@ -69,7 +70,9 @@ android:layout_marginTop="16dp" android:gravity="center" android:text="@string/no_subreddits" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:textColor="?attr/primaryTextColor" + android:fontFamily="?attr/font_family" /> </LinearLayout> diff --git a/app/src/main/res/layout/activity_subscribed_thing_listing.xml b/app/src/main/res/layout/activity_subscribed_thing_listing.xml index db10bdc8..bad81ce5 100644 --- a/app/src/main/res/layout/activity_subscribed_thing_listing.xml +++ b/app/src/main/res/layout/activity_subscribed_thing_listing.xml @@ -23,7 +23,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar_subscribed_thing_listing_activity" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:layout_collapseMode="pin" app:layout_scrollFlags="scroll|enterAlways" app:popupTheme="@style/AppTheme.PopupOverlay" diff --git a/app/src/main/res/layout/activity_theme_preview.xml b/app/src/main/res/layout/activity_theme_preview.xml index fb6172b7..853c8b0d 100644 --- a/app/src/main/res/layout/activity_theme_preview.xml +++ b/app/src/main/res/layout/activity_theme_preview.xml @@ -52,14 +52,16 @@ android:layout_height="wrap_content" android:layout_marginBottom="16dp" android:text="@string/subreddit_preview" - android:textSize="?attr/font_18"/> + android:textSize="?attr/font_18" + android:fontFamily="?attr/font_family" /> <TextView android:id="@+id/user_name_text_view_theme_preview_activity" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/username_preview" - android:textSize="?attr/font_18"/> + android:textSize="?attr/font_18" + android:fontFamily="?attr/font_family"/> </LinearLayout> @@ -68,7 +70,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/subscribe" - android:textColor="@android:color/white" android:layout_gravity="center_horizontal"/> </LinearLayout> @@ -85,7 +86,8 @@ android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/primary_text_preview" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> <TextView android:id="@+id/secondary_text_text_view_theme_preview_activity" @@ -94,7 +96,8 @@ android:layout_weight="1" android:gravity="end" android:text="@string/secondary_text_preview" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </LinearLayout> @@ -103,7 +106,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:layout_collapseMode="pin" app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed" app:popupTheme="@style/AppTheme.PopupOverlay" @@ -164,7 +168,7 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" - android:background="@android:color/transparent"/> + android:background="@android:color/transparent" /> <ImageView android:id="@+id/message_bottom_app_bar_theme_preview_activity" diff --git a/app/src/main/res/layout/activity_view_gif.xml b/app/src/main/res/layout/activity_view_gif.xml deleted file mode 100644 index 695ebc95..00000000 --- a/app/src/main/res/layout/activity_view_gif.xml +++ /dev/null @@ -1,56 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<com.thefuntasty.hauler.HaulerView - 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:id="@+id/hauler_view_view_gif_activity" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:keepScreenOn="true" - app:dragUpEnabled="true" - tools:application="ml.docilealligator.infinityforreddit.Activity.ViewGIFActivity"> - - <androidx.core.widget.NestedScrollView - android:layout_width="match_parent" - android:layout_height="match_parent" - android:fillViewport="true"> - - <RelativeLayout - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <ProgressBar - android:id="@+id/progress_bar_view_gif_activity" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_centerInParent="true" /> - - <pl.droidsonroids.gif.GifImageView - android:id="@+id/image_view_view_gif_activity" - android:layout_width="match_parent" - android:layout_height="match_parent" - app:gest_fillViewport="true" /> - - <LinearLayout - android:id="@+id/load_image_error_linear_layout_view_gif_activity" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:visibility="gone"> - - <TextView - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:drawableTop="@drawable/ic_error_outline_white_24dp" - android:layout_gravity="center" - android:gravity="center" - android:textColor="@android:color/white" - android:text="@string/error_loading_gif_tap_to_retry" - android:textSize="?attr/font_default" /> - - </LinearLayout> - - </RelativeLayout> - - </androidx.core.widget.NestedScrollView> - -</com.thefuntasty.hauler.HaulerView>
\ No newline at end of file diff --git a/app/src/main/res/layout/activity_view_image.xml b/app/src/main/res/layout/activity_view_image_or_gif.xml index 3b1b2e8c..019bbc7b 100644 --- a/app/src/main/res/layout/activity_view_image.xml +++ b/app/src/main/res/layout/activity_view_image_or_gif.xml @@ -1,9 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> -<com.thefuntasty.hauler.HaulerView - xmlns:android="http://schemas.android.com/apk/res/android" +<com.thefuntasty.hauler.HaulerView 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:id="@+id/hauler_view_view_image_activity" + android:id="@+id/hauler_view_view_image_or_gif_activity" android:layout_width="match_parent" android:layout_height="match_parent" app:dragUpEnabled="true" @@ -19,19 +18,27 @@ android:layout_height="match_parent"> <ProgressBar - android:id="@+id/progress_bar_view_image_activity" + android:id="@+id/progress_bar_view_image_or_gif_activity" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" /> - <com.alexvasilkov.gestures.views.GestureImageView - android:id="@+id/image_view_view_image_activity" + <com.alexvasilkov.gestures.views.GestureFrameLayout + android:id="@+id/gesture_layout_view_image_or_gif_activity" android:layout_width="match_parent" - android:layout_height="match_parent" - app:gest_fillViewport="true" /> + android:layout_height="match_parent"> + + <pl.droidsonroids.gif.GifImageView + android:id="@+id/image_view_view_image_or_gif_activity" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:adjustViewBounds="true" + android:scaleType="fitCenter" + app:gest_fillViewport="true" /> + </com.alexvasilkov.gestures.views.GestureFrameLayout> <LinearLayout - android:id="@+id/load_image_error_linear_layout_view_image_activity" + android:id="@+id/load_image_error_linear_layout_view_image_or_gif_activity" android:layout_width="match_parent" android:layout_height="match_parent" android:visibility="gone"> @@ -39,11 +46,12 @@ <TextView android:layout_width="match_parent" android:layout_height="wrap_content" - android:drawableTop="@drawable/ic_error_outline_white_24dp" android:layout_gravity="center" + android:drawableTop="@drawable/ic_error_outline_white_24dp" + android:fontFamily="?attr/font_family" android:gravity="center" - android:textColor="@android:color/white" android:text="@string/error_loading_image_tap_to_retry" + android:textColor="@android:color/white" android:textSize="?attr/font_default" /> </LinearLayout> @@ -52,4 +60,4 @@ </androidx.core.widget.NestedScrollView> -</com.thefuntasty.hauler.HaulerView>
\ No newline at end of file +</com.thefuntasty.hauler.HaulerView> diff --git a/app/src/main/res/layout/activity_view_imgur_media.xml b/app/src/main/res/layout/activity_view_imgur_media.xml index e6d6e67c..8e17ae8b 100644 --- a/app/src/main/res/layout/activity_view_imgur_media.xml +++ b/app/src/main/res/layout/activity_view_imgur_media.xml @@ -42,7 +42,8 @@ android:gravity="center" android:textColor="@android:color/white" android:text="@string/error_loading_image_tap_to_retry" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </LinearLayout> diff --git a/app/src/main/res/layout/activity_view_message.xml b/app/src/main/res/layout/activity_view_message.xml index f5f1c4e5..1ce1e9db 100644 --- a/app/src/main/res/layout/activity_view_message.xml +++ b/app/src/main/res/layout/activity_view_message.xml @@ -24,7 +24,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar_view_message_activity" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:popupTheme="@style/AppTheme.PopupOverlay" app:navigationIcon="?attr/homeAsUpIndicator" /> @@ -71,7 +72,8 @@ android:layout_height="wrap_content" android:layout_marginTop="16dp" android:gravity="center" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </LinearLayout> diff --git a/app/src/main/res/layout/activity_view_multi_reddit_detail.xml b/app/src/main/res/layout/activity_view_multi_reddit_detail.xml index dbe8875b..28577883 100644 --- a/app/src/main/res/layout/activity_view_multi_reddit_detail.xml +++ b/app/src/main/res/layout/activity_view_multi_reddit_detail.xml @@ -24,7 +24,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar_view_multi_reddit_detail_activity" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:popupTheme="@style/AppTheme.PopupOverlay" app:navigationIcon="?attr/homeAsUpIndicator" /> diff --git a/app/src/main/res/layout/activity_view_post_detail.xml b/app/src/main/res/layout/activity_view_post_detail.xml index d867c596..621903a8 100644 --- a/app/src/main/res/layout/activity_view_post_detail.xml +++ b/app/src/main/res/layout/activity_view_post_detail.xml @@ -23,7 +23,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar_view_post_detail_activity" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:popupTheme="@style/AppTheme.PopupOverlay" app:navigationIcon="?attr/homeAsUpIndicator" /> @@ -64,7 +65,8 @@ android:layout_height="wrap_content" android:layout_marginTop="16dp" android:gravity="center" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </LinearLayout> diff --git a/app/src/main/res/layout/activity_view_sidebar.xml b/app/src/main/res/layout/activity_view_sidebar.xml deleted file mode 100644 index 301b04cc..00000000 --- a/app/src/main/res/layout/activity_view_sidebar.xml +++ /dev/null @@ -1,49 +0,0 @@ -<?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_view_sidebar_activity" - tools:context=".Activity.ViewSidebarActivity"> - - <com.google.android.material.appbar.AppBarLayout - android:id="@+id/appbar_layout_view_sidebar_activity" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:theme="@style/AppTheme.AppBarOverlay"> - - <com.google.android.material.appbar.CollapsingToolbarLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - app:layout_scrollFlags="scroll|enterAlways" - app:titleEnabled="false" - app:toolbarId="@+id/toolbar_view_sidebar_activity"> - - <androidx.appcompat.widget.Toolbar - android:id="@+id/toolbar_view_sidebar_activity" - android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" - app:popupTheme="@style/AppTheme.PopupOverlay" - app:navigationIcon="?attr/homeAsUpIndicator" /> - - </com.google.android.material.appbar.CollapsingToolbarLayout> - - </com.google.android.material.appbar.AppBarLayout> - - <androidx.swiperefreshlayout.widget.SwipeRefreshLayout - android:id="@+id/swipe_refresh_layout_view_sidebar_activity" - android:layout_width="match_parent" - android:layout_height="match_parent" - app:layout_behavior="@string/appbar_scrolling_view_behavior"> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/markdown_recycler_view_view_sidebar_activity" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:padding="16dp" - android:clipToPadding="false" /> - - </androidx.swiperefreshlayout.widget.SwipeRefreshLayout> - -</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 bbe2e94a..69680dbe 100644 --- a/app/src/main/res/layout/activity_view_subreddit_detail.xml +++ b/app/src/main/res/layout/activity_view_subreddit_detail.xml @@ -65,13 +65,13 @@ android:layout_marginTop="16dp" android:layout_marginBottom="16dp" android:textSize="?attr/font_18" - android:layout_gravity="center_horizontal"/> + android:layout_gravity="center_horizontal" + android:fontFamily="?attr/font_family" /> <com.google.android.material.chip.Chip android:id="@+id/subscribe_subreddit_chip_view_subreddit_detail_activity" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textColor="@android:color/white" android:layout_gravity="center_horizontal"/> <androidx.constraintlayout.widget.ConstraintLayout @@ -85,6 +85,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:layout_constraintBottom_toTopOf="@id/online_subscriber_count_text_view_view_subreddit_detail_activity" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toStartOf="@id/barrier" @@ -96,6 +97,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toStartOf="@id/barrier" @@ -107,6 +109,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/since" + android:fontFamily="?attr/font_family" app:layout_constraintBottom_toTopOf="@id/creation_time_text_view_view_subreddit_detail_activity" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -117,6 +120,7 @@ android:layout_height="wrap_content" android:gravity="end" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toBottomOf="@id/since_text_view_view_subreddit_detail_activity" /> @@ -135,8 +139,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="16dp" - android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:visibility="gone"/> </LinearLayout> @@ -146,7 +150,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:layout_collapseMode="pin" app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed" app:popupTheme="@style/AppTheme.PopupOverlay" 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 3499823e..1835e0c1 100644 --- a/app/src/main/res/layout/activity_view_user_detail.xml +++ b/app/src/main/res/layout/activity_view_user_detail.xml @@ -64,6 +64,7 @@ android:layout_marginTop="16dp" android:layout_marginBottom="16dp" android:textSize="?attr/font_18" + android:fontFamily="?attr/font_family" android:layout_gravity="center_horizontal"/> <com.google.android.material.chip.Chip @@ -85,7 +86,8 @@ android:layout_height="wrap_content" android:layout_alignParentStart="true" android:layout_toStartOf="@id/cakeday_text_view_view_user_detail_activity" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> <TextView android:id="@+id/cakeday_text_view_view_user_detail_activity" @@ -93,7 +95,8 @@ android:layout_height="wrap_content" android:gravity="end" android:layout_alignParentEnd="true" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </RelativeLayout> @@ -103,6 +106,7 @@ android:layout_height="wrap_content" android:layout_marginBottom="16dp" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:visibility="gone" /> </LinearLayout> @@ -112,7 +116,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar_view_user_detail_activity" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:layout_collapseMode="pin" app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed" app:popupTheme="@style/AppTheme.PopupOverlay" diff --git a/app/src/main/res/layout/activity_view_video.xml b/app/src/main/res/layout/activity_view_video.xml index 2907fd4d..1d18f2ab 100644 --- a/app/src/main/res/layout/activity_view_video.xml +++ b/app/src/main/res/layout/activity_view_video.xml @@ -15,7 +15,8 @@ android:layout_height="match_parent" android:fillViewport="true"> - <RelativeLayout + <androidx.coordinatorlayout.widget.CoordinatorLayout + android:id="@+id/coordinator_layout_view_video_activity" android:layout_width="match_parent" android:layout_height="match_parent"> @@ -29,10 +30,10 @@ android:id="@+id/progress_bar_view_video_activity" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_centerInParent="true" + android:layout_gravity="center" android:visibility="gone" /> - </RelativeLayout> + </androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.core.widget.NestedScrollView> diff --git a/app/src/main/res/layout/adapter_default_entry.xml b/app/src/main/res/layout/adapter_default_entry.xml index acc53340..a02d03f0 100644 --- a/app/src/main/res/layout/adapter_default_entry.xml +++ b/app/src/main/res/layout/adapter_default_entry.xml @@ -3,4 +3,6 @@ android:id="@+id/text" android:layout_width="match_parent" android:layout_height="wrap_content" - android:textSize="?attr/content_font_default" />
\ No newline at end of file + android:padding="8dp" + android:textSize="?attr/content_font_default" + android:fontFamily="?attr/content_font_family" />
\ 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 bcc7afb8..981e788a 100644 --- a/app/src/main/res/layout/app_bar_main.xml +++ b/app/src/main/res/layout/app_bar_main.xml @@ -24,7 +24,8 @@ <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" app:layout_collapseMode="pin" app:layout_scrollFlags="scroll|enterAlways" app:popupTheme="@style/AppTheme.PopupOverlay" /> diff --git a/app/src/main/res/layout/color_picker.xml b/app/src/main/res/layout/color_picker.xml index 3e8b25cd..b8769926 100644 --- a/app/src/main/res/layout/color_picker.xml +++ b/app/src/main/res/layout/color_picker.xml @@ -12,6 +12,7 @@ android:paddingStart="24dp" android:paddingEnd="24dp" android:text="@string/color_picker" + android:fontFamily="?attr/font_family" style="@style/MaterialAlertDialogTitleTextStyle" /> <View @@ -28,7 +29,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="#" - android:textColor="?attr/primaryTextColor"/> + android:textColor="?attr/primaryTextColor" + android:fontFamily="?attr/font_family" /> <EditText android:id="@+id/color_edit_text_color_picker" @@ -37,7 +39,8 @@ android:gravity="center" android:maxLength="8" android:inputType="textCapCharacters|textNoSuggestions" - android:textColor="?attr/primaryTextColor" /> + android:textColor="?attr/primaryTextColor" + android:fontFamily="?attr/font_family" /> </LinearLayout> @@ -53,7 +56,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="A" - android:textColor="?attr/primaryTextColor" /> + android:textColor="?attr/primaryTextColor" + android:fontFamily="?attr/font_family" /> <SeekBar android:id="@+id/a_seek_bar_color_picker" @@ -75,7 +79,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="R" - android:textColor="?attr/primaryTextColor" /> + android:textColor="?attr/primaryTextColor" + android:fontFamily="?attr/font_family" /> <SeekBar android:id="@+id/r_seek_bar_color_picker" @@ -97,7 +102,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="G" - android:textColor="?attr/primaryTextColor" /> + android:textColor="?attr/primaryTextColor" + android:fontFamily="?attr/font_family" /> <SeekBar android:id="@+id/g_seek_bar_color_picker" @@ -119,7 +125,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="B" - android:textColor="?attr/primaryTextColor" /> + android:textColor="?attr/primaryTextColor" + android:fontFamily="?attr/font_family" /> <SeekBar android:id="@+id/b_seek_bar_color_picker" @@ -142,6 +149,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/cancel" + android:fontFamily="?attr/font_family" style="@style/MaterialAlertDialogNegativeButtonStyle" /> <Button @@ -149,6 +157,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/ok" + android:fontFamily="?attr/font_family" style="@style/MaterialAlertDialogPositiveButtonStyle" /> </LinearLayout> diff --git a/app/src/main/res/layout/copy_text_material_dialog.xml b/app/src/main/res/layout/copy_text_material_dialog.xml index a8dfb7a5..88fa9f97 100644 --- a/app/src/main/res/layout/copy_text_material_dialog.xml +++ b/app/src/main/res/layout/copy_text_material_dialog.xml @@ -12,6 +12,7 @@ android:paddingStart="24dp" android:paddingEnd="24dp" android:textIsSelectable="true" + android:fontFamily="?attr/font_family" android:enabled="true" android:focusable="true" android:longClickable="true" /> diff --git a/app/src/main/res/layout/dialog_edit_flair.xml b/app/src/main/res/layout/dialog_edit_flair.xml index cb1f51d1..226bbb1e 100644 --- a/app/src/main/res/layout/dialog_edit_flair.xml +++ b/app/src/main/res/layout/dialog_edit_flair.xml @@ -11,6 +11,7 @@ android:background="#00000000" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:hint="@string/flair" android:maxLength="64" /> @@ -21,6 +22,7 @@ android:layout_marginEnd="24dp" android:text="@string/only_allow_64_chars" android:textColor="?attr/colorAccent" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </LinearLayout>
\ 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_theme_name.xml index 9a63f486..9e126bc5 100644 --- a/app/src/main/res/layout/dialog_edit_theme_name.xml +++ b/app/src/main/res/layout/dialog_edit_theme_name.xml @@ -7,4 +7,5 @@ android:background="#00000000" android:hint="@string/theme_name_hint" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_default" />
\ No newline at end of file + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" />
\ No newline at end of file diff --git a/app/src/main/res/layout/exo_autoplay_playback_control_view.xml b/app/src/main/res/layout/exo_autoplay_playback_control_view.xml index 7280717b..76cc3b86 100644 --- a/app/src/main/res/layout/exo_autoplay_playback_control_view.xml +++ b/app/src/main/res/layout/exo_autoplay_playback_control_view.xml @@ -15,7 +15,8 @@ android:includeFontPadding="false" android:textColor="#FFFFFF" android:textSize="12sp" - android:textStyle="bold" /> + android:textStyle="bold" + android:fontFamily="?attr/font_family" /> <TextView android:id="@+id/slash" @@ -26,7 +27,8 @@ android:text="/" android:textColor="#FFFFFF" android:textSize="12sp" - android:textStyle="bold" /> + android:textStyle="bold" + android:fontFamily="?attr/font_family" /> <TextView android:id="@id/exo_duration" android:layout_width="wrap_content" @@ -36,7 +38,8 @@ android:includeFontPadding="false" android:textColor="#FFFFFF" android:textSize="12sp" - android:textStyle="bold" /> + android:textStyle="bold" + android:fontFamily="?attr/font_family" /> <ImageView android:id="@id/exo_play" android:layout_width="wrap_content" diff --git a/app/src/main/res/layout/exo_playback_control_view.xml b/app/src/main/res/layout/exo_playback_control_view.xml index d76c46fc..89749c08 100644 --- a/app/src/main/res/layout/exo_playback_control_view.xml +++ b/app/src/main/res/layout/exo_playback_control_view.xml @@ -51,7 +51,8 @@ android:paddingLeft="4dp" android:paddingRight="4dp" android:includeFontPadding="false" - android:textColor="#FFBEBEBE"/> + android:textColor="#FFBEBEBE" + android:fontFamily="?attr/font_family" /> <com.google.android.exoplayer2.ui.DefaultTimeBar android:id="@id/exo_progress" @@ -67,7 +68,8 @@ android:paddingLeft="4dp" android:paddingRight="4dp" android:includeFontPadding="false" - android:textColor="#FFBEBEBE"/> + android:textColor="#FFBEBEBE" + android:fontFamily="?attr/font_family" /> </LinearLayout> diff --git a/app/src/main/res/layout/fragment_comment_more_bottom_sheet.xml b/app/src/main/res/layout/fragment_comment_more_bottom_sheet.xml index d0d57e55..c1126a2d 100644 --- a/app/src/main/res/layout/fragment_comment_more_bottom_sheet.xml +++ b/app/src/main/res/layout/fragment_comment_more_bottom_sheet.xml @@ -25,6 +25,7 @@ android:text="@string/edit" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:visibility="gone" /> <TextView @@ -43,6 +44,7 @@ android:text="@string/delete" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:visibility="gone" /> <TextView @@ -61,7 +63,8 @@ android:paddingBottom="16dp" android:text="@string/share" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> <TextView android:id="@+id/copy_text_view_comment_more_bottom_sheet_fragment" @@ -79,7 +82,8 @@ android:paddingBottom="16dp" android:text="@string/copy_text" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> <TextView android:id="@+id/report_view_comment_more_bottom_sheet_fragment" @@ -97,8 +101,28 @@ android:paddingBottom="16dp" android:text="@string/report" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> + + <TextView + android:id="@+id/see_removed_view_comment_more_bottom_sheet_fragment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" + android:clickable="true" + android:drawableStart="@drawable/ic_preview_24dp" + android:drawablePadding="48dp" + android:focusable="true" + android:gravity="center_vertical" + android:paddingStart="32dp" + android:paddingTop="16dp" + android:paddingEnd="32dp" + android:paddingBottom="16dp" + android:text="@string/see_removed_comment" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" + android:visibility="gone" /> </LinearLayout> -</androidx.core.widget.NestedScrollView>
\ No newline at end of file +</androidx.core.widget.NestedScrollView> diff --git a/app/src/main/res/layout/fragment_comments_listing.xml b/app/src/main/res/layout/fragment_comments_listing.xml index e6096cb2..9ac463ab 100644 --- a/app/src/main/res/layout/fragment_comments_listing.xml +++ b/app/src/main/res/layout/fragment_comments_listing.xml @@ -1,7 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" - xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/coordinator_layout_comments_listing_fragment" @@ -41,7 +40,8 @@ android:layout_height="wrap_content" android:layout_marginTop="16dp" android:gravity="center" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </LinearLayout> diff --git a/app/src/main/res/layout/fragment_copy_text_bottom_sheet.xml b/app/src/main/res/layout/fragment_copy_text_bottom_sheet.xml index 1e1e5394..9256d044 100644 --- a/app/src/main/res/layout/fragment_copy_text_bottom_sheet.xml +++ b/app/src/main/res/layout/fragment_copy_text_bottom_sheet.xml @@ -19,6 +19,7 @@ android:text="@string/copy_raw_text" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:paddingTop="16dp" android:paddingBottom="16dp" android:paddingStart="32dp" @@ -34,6 +35,7 @@ android:text="@string/copy_markdown" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:paddingTop="16dp" android:paddingBottom="16dp" android:paddingStart="32dp" @@ -49,6 +51,7 @@ android:text="@string/copy_all_raw_text" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:paddingTop="16dp" android:paddingBottom="16dp" android:paddingStart="32dp" @@ -64,6 +67,7 @@ android:text="@string/copy_all_markdown" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:paddingTop="16dp" android:paddingBottom="16dp" android:paddingStart="32dp" diff --git a/app/src/main/res/layout/fragment_create_theme_bottom_sheet.xml b/app/src/main/res/layout/fragment_create_theme_bottom_sheet.xml index c5ac6fda..81b4a46b 100644 --- a/app/src/main/res/layout/fragment_create_theme_bottom_sheet.xml +++ b/app/src/main/res/layout/fragment_create_theme_bottom_sheet.xml @@ -22,6 +22,7 @@ android:text="@string/import_theme" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:drawableStart="@drawable/ic_import_day_night_24dp" android:drawablePadding="48dp" android:clickable="true" @@ -40,6 +41,7 @@ android:text="@string/create_light_theme" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:drawableStart="@drawable/ic_light_theme_preference_24dp" android:drawablePadding="48dp" android:clickable="true" @@ -58,6 +60,7 @@ android:text="@string/create_dark_theme" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:drawableStart="@drawable/ic_dark_theme_preference_24dp" android:drawablePadding="48dp" android:clickable="true" @@ -76,6 +79,7 @@ android:text="@string/create_amoled_theme" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:drawableStart="@drawable/ic_amoled_theme_preference_24dp" android:drawablePadding="48dp" android:clickable="true" @@ -92,7 +96,8 @@ android:paddingEnd="32dp" android:text="@string/create_theme_info" android:textColor="?attr/secondaryTextColor" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </LinearLayout> diff --git a/app/src/main/res/layout/fragment_custom_theme_options_bottom_sheet.xml b/app/src/main/res/layout/fragment_custom_theme_options_bottom_sheet.xml index 82962293..b44d9001 100644 --- a/app/src/main/res/layout/fragment_custom_theme_options_bottom_sheet.xml +++ b/app/src/main/res/layout/fragment_custom_theme_options_bottom_sheet.xml @@ -18,7 +18,8 @@ android:paddingBottom="16dp" android:paddingStart="32dp" android:paddingEnd="32dp" - android:textColor="?attr/primaryTextColor" /> + android:textColor="?attr/primaryTextColor" + android:fontFamily="?attr/font_family" /> <TextView android:id="@+id/edit_theme_text_view_custom_theme_options_bottom_sheet_fragment" @@ -32,6 +33,7 @@ android:text="@string/edit_theme" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:drawableStart="@drawable/ic_edit_24dp" android:drawablePadding="48dp" android:clickable="true" @@ -50,6 +52,7 @@ android:text="@string/change_theme_name" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:drawableStart="@drawable/ic_edit_24dp" android:drawablePadding="48dp" android:clickable="true" @@ -68,6 +71,7 @@ android:text="@string/share_theme" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:drawableStart="@drawable/ic_share_24dp" android:drawablePadding="48dp" android:clickable="true" @@ -86,6 +90,7 @@ android:text="@string/delete_theme" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:drawableStart="@drawable/ic_delete_24dp" android:drawablePadding="48dp" android:clickable="true" diff --git a/app/src/main/res/layout/fragment_flair_bottom_sheet.xml b/app/src/main/res/layout/fragment_flair_bottom_sheet.xml index edd8ad20..41a12ab8 100644 --- a/app/src/main/res/layout/fragment_flair_bottom_sheet.xml +++ b/app/src/main/res/layout/fragment_flair_bottom_sheet.xml @@ -11,7 +11,8 @@ android:layout_height="wrap_content" android:padding="16dp" android:text="@string/flair" - android:textSize="?attr/font_18" /> + android:textSize="?attr/font_18" + android:fontFamily="?attr/font_family" /> <ProgressBar android:id="@+id/progress_bar_flair_bottom_sheet_fragment" @@ -28,7 +29,8 @@ android:gravity="center" android:padding="48dp" android:visibility="gone" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> <androidx.recyclerview.widget.RecyclerView android:id="@+id/recycler_view_bottom_sheet_fragment" diff --git a/app/src/main/res/layout/fragment_followed_users_listing.xml b/app/src/main/res/layout/fragment_followed_users_listing.xml index 5b94e075..f0a6b6e9 100644 --- a/app/src/main/res/layout/fragment_followed_users_listing.xml +++ b/app/src/main/res/layout/fragment_followed_users_listing.xml @@ -39,7 +39,8 @@ android:layout_marginTop="16dp" android:gravity="center" android:text="@string/no_users" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </LinearLayout> diff --git a/app/src/main/res/layout/fragment_font_preview.xml b/app/src/main/res/layout/fragment_font_preview.xml new file mode 100644 index 00000000..8cc543c8 --- /dev/null +++ b/app/src/main/res/layout/fragment_font_preview.xml @@ -0,0 +1,116 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout 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" + android:orientation="vertical" + tools:context=".Settings.FontPreviewFragment"> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="72dp" + android:paddingEnd="16dp" + android:text="@string/default_font_font_preview" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" /> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="72dp" + android:paddingEnd="16dp" + android:text="Balsamiq Sans" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="@font/balsamiq_sans" /> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="72dp" + android:paddingEnd="16dp" + android:text="Noto Sans" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="@font/noto_sans" /> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="72dp" + android:paddingEnd="16dp" + android:text="Roboto Condensed" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="@font/roboto_condensed" /> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="72dp" + android:paddingEnd="16dp" + android:text="Harmonia Sans" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="@font/harmonia_sans" /> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="72dp" + android:paddingEnd="16dp" + android:text="Inter" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="@font/inter" /> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="72dp" + android:paddingEnd="16dp" + android:text="Manrope" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="@font/manrope" /> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="72dp" + android:paddingEnd="16dp" + android:text="Bad Script" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="@font/bad_script_regular" /> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="72dp" + android:paddingEnd="16dp" + android:text="Sriracha" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="@font/sriracha_regular" /> + +</LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/fragment_multi_reddit_listing.xml b/app/src/main/res/layout/fragment_multi_reddit_listing.xml index 87f6bf6a..f9c3ec74 100644 --- a/app/src/main/res/layout/fragment_multi_reddit_listing.xml +++ b/app/src/main/res/layout/fragment_multi_reddit_listing.xml @@ -39,7 +39,8 @@ android:layout_marginTop="16dp" android:gravity="center" android:text="@string/no_multi_reddits" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </LinearLayout> diff --git a/app/src/main/res/layout/fragment_multi_reddit_options_bottom_sheet.xml b/app/src/main/res/layout/fragment_multi_reddit_options_bottom_sheet.xml index 466e90a0..7a0409b9 100644 --- a/app/src/main/res/layout/fragment_multi_reddit_options_bottom_sheet.xml +++ b/app/src/main/res/layout/fragment_multi_reddit_options_bottom_sheet.xml @@ -22,6 +22,7 @@ android:text="@string/edit_multi_reddit" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:drawableStart="@drawable/ic_edit_24dp" android:drawablePadding="48dp" android:clickable="true" @@ -40,6 +41,7 @@ android:text="@string/delete_multi_reddit" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:drawableStart="@drawable/ic_delete_24dp" android:drawablePadding="48dp" android:clickable="true" diff --git a/app/src/main/res/layout/fragment_post.xml b/app/src/main/res/layout/fragment_post.xml index 94d2f551..e8b3ac0f 100644 --- a/app/src/main/res/layout/fragment_post.xml +++ b/app/src/main/res/layout/fragment_post.xml @@ -39,7 +39,8 @@ android:layout_height="wrap_content" android:layout_marginTop="16dp" android:gravity="center" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </LinearLayout> diff --git a/app/src/main/res/layout/fragment_post_comment_sort_type_bottom_sheet.xml b/app/src/main/res/layout/fragment_post_comment_sort_type_bottom_sheet.xml index 1bbf20a0..b33ab495 100644 --- a/app/src/main/res/layout/fragment_post_comment_sort_type_bottom_sheet.xml +++ b/app/src/main/res/layout/fragment_post_comment_sort_type_bottom_sheet.xml @@ -24,7 +24,8 @@ android:paddingBottom="16dp" android:text="@string/sort_best" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> <TextView android:id="@+id/confidence_type_text_view_post_comment_sort_type_bottom_sheet_fragment" @@ -39,7 +40,8 @@ android:paddingBottom="16dp" android:text="@string/sort_confidence" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> <TextView android:id="@+id/top_type_text_view_post_comment_sort_type_bottom_sheet_fragment" @@ -54,7 +56,8 @@ android:paddingBottom="16dp" android:text="@string/sort_top" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> <TextView android:id="@+id/new_type_text_view_post_comment_sort_type_bottom_sheet_fragment" @@ -69,7 +72,8 @@ android:paddingBottom="16dp" android:text="@string/sort_new" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> <TextView android:id="@+id/controversial_type_text_view_post_comment_sort_type_bottom_sheet_fragment" @@ -84,7 +88,8 @@ android:paddingBottom="16dp" android:text="@string/sort_controversial" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> <TextView android:id="@+id/old_type_text_view_post_comment_sort_type_bottom_sheet_fragment" @@ -99,7 +104,8 @@ android:paddingBottom="16dp" android:text="@string/sort_old" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> <TextView android:id="@+id/random_type_text_view_post_comment_sort_type_bottom_sheet_fragment" @@ -114,7 +120,8 @@ android:paddingBottom="16dp" android:text="@string/sort_random" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> <TextView android:id="@+id/qa_type_text_view_post_comment_sort_type_bottom_sheet_fragment" @@ -129,7 +136,8 @@ android:paddingBottom="16dp" android:text="@string/sort_qa" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> <TextView android:id="@+id/live_type_text_view_post_comment_sort_type_bottom_sheet_fragment" @@ -144,7 +152,8 @@ android:paddingBottom="16dp" android:text="@string/sort_live" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </LinearLayout> diff --git a/app/src/main/res/layout/fragment_post_layot_bottom_sheet.xml b/app/src/main/res/layout/fragment_post_layot_bottom_sheet.xml index d5844678..939d6a43 100644 --- a/app/src/main/res/layout/fragment_post_layot_bottom_sheet.xml +++ b/app/src/main/res/layout/fragment_post_layot_bottom_sheet.xml @@ -25,7 +25,8 @@ android:paddingBottom="16dp" android:text="@string/post_layout_card" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> <TextView android:id="@+id/compact_layout_text_view_post_layout_bottom_sheet_fragment" @@ -40,7 +41,8 @@ android:paddingBottom="16dp" android:text="@string/post_layout_compact" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </LinearLayout> diff --git a/app/src/main/res/layout/fragment_post_type_bottom_sheet.xml b/app/src/main/res/layout/fragment_post_type_bottom_sheet.xml index 2497dcb0..5dc07eb0 100644 --- a/app/src/main/res/layout/fragment_post_type_bottom_sheet.xml +++ b/app/src/main/res/layout/fragment_post_type_bottom_sheet.xml @@ -22,6 +22,7 @@ android:text="@string/bottom_sheet_post_text" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:drawableStart="@drawable/ic_outline_text_24px" android:drawablePadding="48dp" android:clickable="true" @@ -40,6 +41,7 @@ android:text="@string/bottom_sheet_post_link" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:drawableStart="@drawable/ic_link" android:drawablePadding="48dp" android:clickable="true" @@ -58,6 +60,7 @@ android:text="@string/bottom_sheet_post_video" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:drawableStart="@drawable/ic_outline_video_24dp" android:drawablePadding="48dp" android:clickable="true" @@ -76,6 +79,7 @@ android:text="@string/bottom_sheet_post_image" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:drawableStart="@drawable/ic_image_24dp" android:drawablePadding="48dp" android:clickable="true" diff --git a/app/src/main/res/layout/fragment_search_post_sort_type_bottom_sheet.xml b/app/src/main/res/layout/fragment_search_post_sort_type_bottom_sheet.xml index e1c0f8ea..8b1c86b6 100644 --- a/app/src/main/res/layout/fragment_search_post_sort_type_bottom_sheet.xml +++ b/app/src/main/res/layout/fragment_search_post_sort_type_bottom_sheet.xml @@ -1,90 +1,111 @@ <?xml version="1.0" encoding="utf-8"?> <androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingBottom="8dp" - android:overScrollMode="never"> + android:overScrollMode="never" + android:paddingBottom="8dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> - <TextView + <androidx.appcompat.widget.AppCompatTextView android:id="@+id/relevance_type_text_view_search_sort_type_bottom_sheet_fragment" android:layout_width="match_parent" android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" + android:clickable="true" + android:drawableStart="@drawable/ic_best_24" + android:drawablePadding="48dp" + android:focusable="true" + android:fontFamily="?attr/font_family" + android:paddingStart="32dp" + android:paddingTop="16dp" + android:paddingEnd="32dp" + android:paddingBottom="16dp" android:text="@string/sort_relevance" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" - android:paddingTop="16dp" - android:paddingBottom="16dp" - android:paddingStart="32dp" - android:paddingEnd="32dp" - android:clickable="true" - android:focusable="true" - android:background="?attr/selectableItemBackground" /> + app:drawableTint="?attr/primaryTextColor" /> - <TextView + <androidx.appcompat.widget.AppCompatTextView android:id="@+id/hot_type_text_view_search_sort_type_bottom_sheet_fragment" android:layout_width="match_parent" android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" + android:clickable="true" + android:drawableStart="@drawable/ic_hot_24" + android:drawablePadding="48dp" + android:focusable="true" + android:fontFamily="?attr/font_family" + android:paddingStart="32dp" + android:paddingTop="16dp" + android:paddingEnd="32dp" + android:paddingBottom="16dp" android:text="@string/sort_hot" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" - android:paddingTop="16dp" - android:paddingBottom="16dp" - android:paddingStart="32dp" - android:paddingEnd="32dp" - android:clickable="true" - android:focusable="true" - android:background="?attr/selectableItemBackground" /> + app:drawableTint="?attr/primaryTextColor" /> - <TextView + <androidx.appcompat.widget.AppCompatTextView android:id="@+id/top_type_text_view_search_sort_type_bottom_sheet_fragment" android:layout_width="match_parent" android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" + android:clickable="true" + android:drawableStart="@drawable/ic_top_24" + android:drawablePadding="48dp" + android:focusable="true" + android:fontFamily="?attr/font_family" + android:paddingStart="32dp" + android:paddingTop="16dp" + android:paddingEnd="32dp" + android:paddingBottom="16dp" android:text="@string/sort_top" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" - android:paddingTop="16dp" - android:paddingBottom="16dp" - android:paddingStart="32dp" - android:paddingEnd="32dp" - android:clickable="true" - android:focusable="true" - android:background="?attr/selectableItemBackground" /> + app:drawableTint="?attr/primaryTextColor" /> - <TextView + <androidx.appcompat.widget.AppCompatTextView android:id="@+id/new_type_text_view_search_sort_type_bottom_sheet_fragment" android:layout_width="match_parent" android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" + android:clickable="true" + android:drawableStart="@drawable/ic_new_24" + android:drawablePadding="48dp" + android:focusable="true" + android:fontFamily="?attr/font_family" + android:paddingStart="32dp" + android:paddingTop="16dp" + android:paddingEnd="32dp" + android:paddingBottom="16dp" android:text="@string/sort_new" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" - android:paddingTop="16dp" - android:paddingBottom="16dp" - android:paddingStart="32dp" - android:paddingEnd="32dp" - android:clickable="true" - android:focusable="true" - android:background="?attr/selectableItemBackground" /> + app:drawableTint="?attr/primaryTextColor" /> - <TextView + <androidx.appcompat.widget.AppCompatTextView android:id="@+id/comments_type_text_view_search_sort_type_bottom_sheet_fragment" android:layout_width="match_parent" android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" + android:clickable="true" + android:drawableStart="@drawable/ic_comment_toolbar_24dp" + android:drawablePadding="48dp" + android:focusable="true" + android:fontFamily="?attr/font_family" + android:paddingStart="32dp" + android:paddingTop="16dp" + android:paddingEnd="32dp" + android:paddingBottom="16dp" android:text="@string/sort_comments" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" - android:paddingTop="16dp" - android:paddingBottom="16dp" - android:paddingStart="32dp" - android:paddingEnd="32dp" - android:clickable="true" - android:focusable="true" - android:background="?attr/selectableItemBackground" /> + app:drawableTint="?attr/primaryTextColor" /> </LinearLayout> -</androidx.core.widget.NestedScrollView>
\ No newline at end of file +</androidx.core.widget.NestedScrollView> diff --git a/app/src/main/res/layout/fragment_search_user_and_subreddit_sort_type_bottom_sheet.xml b/app/src/main/res/layout/fragment_search_user_and_subreddit_sort_type_bottom_sheet.xml index be3e8030..3d3515ae 100644 --- a/app/src/main/res/layout/fragment_search_user_and_subreddit_sort_type_bottom_sheet.xml +++ b/app/src/main/res/layout/fragment_search_user_and_subreddit_sort_type_bottom_sheet.xml @@ -17,6 +17,7 @@ android:text="@string/sort_relevance" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:paddingTop="16dp" android:paddingBottom="16dp" android:paddingStart="32dp" @@ -32,6 +33,7 @@ android:text="@string/sort_activity" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:paddingTop="16dp" android:paddingBottom="16dp" android:paddingStart="32dp" diff --git a/app/src/main/res/layout/fragment_set_as_wallpaper_bottom_sheet.xml b/app/src/main/res/layout/fragment_set_as_wallpaper_bottom_sheet.xml new file mode 100644 index 00000000..f2fcd3ea --- /dev/null +++ b/app/src/main/res/layout/fragment_set_as_wallpaper_bottom_sheet.xml @@ -0,0 +1,74 @@ +<?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" + 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_screen_text_view_set_as_wallpaper_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/set_to_home_screen" + android:textColor="@color/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" + android:drawableStart="@drawable/ic_wallpaper_home_screen_black_24dp" + android:drawablePadding="48dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground" + android:visibility="gone" /> + + <TextView + android:id="@+id/lock_screen_text_view_set_as_wallpaper_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/set_to_lock_screen" + android:textColor="@color/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" + android:drawableStart="@drawable/ic_wallpaper_lock_screen_black_24dp" + android:drawablePadding="48dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground" + android:visibility="gone" /> + + <TextView + android:id="@+id/both_text_view_set_as_wallpaper_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/set_to_both" + android:textColor="@color/primaryTextColor" + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" + android:drawableStart="@drawable/ic_wallpaper_both_black_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_share_link_bottom_sheet.xml b/app/src/main/res/layout/fragment_share_link_bottom_sheet.xml index b842f077..3f7c0a93 100644 --- a/app/src/main/res/layout/fragment_share_link_bottom_sheet.xml +++ b/app/src/main/res/layout/fragment_share_link_bottom_sheet.xml @@ -22,6 +22,7 @@ android:text="@string/share_post_link" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:drawableStart="@drawable/ic_link" android:drawablePadding="48dp" android:clickable="true" @@ -40,6 +41,7 @@ android:text="@string/copy_post_link" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:drawableStart="@drawable/ic_copy_24dp" android:drawablePadding="48dp" android:clickable="true" @@ -57,6 +59,7 @@ android:paddingEnd="32dp" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:drawableStart="@drawable/ic_link" android:drawablePadding="48dp" android:clickable="true" @@ -75,6 +78,7 @@ android:paddingEnd="32dp" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:drawableStart="@drawable/ic_copy_24dp" android:drawablePadding="48dp" android:clickable="true" diff --git a/app/src/main/res/layout/fragment_sidebar.xml b/app/src/main/res/layout/fragment_sidebar.xml index 118bbd0e..1dc53a1b 100644 --- a/app/src/main/res/layout/fragment_sidebar.xml +++ b/app/src/main/res/layout/fragment_sidebar.xml @@ -16,7 +16,7 @@ android:id="@+id/markdown_recycler_view_sidebar_fragment" android:layout_width="match_parent" android:layout_height="match_parent" - android:padding="16dp" + android:padding="8dp" android:clipToPadding="false" /> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout> diff --git a/app/src/main/res/layout/fragment_sort_time_bottom_sheet.xml b/app/src/main/res/layout/fragment_sort_time_bottom_sheet.xml index 23650b68..ac998161 100644 --- a/app/src/main/res/layout/fragment_sort_time_bottom_sheet.xml +++ b/app/src/main/res/layout/fragment_sort_time_bottom_sheet.xml @@ -19,6 +19,7 @@ android:text="@string/sort_time_hour" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:paddingTop="16dp" android:paddingBottom="16dp" android:paddingStart="32dp" @@ -34,6 +35,7 @@ android:text="@string/sort_time_day" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:paddingTop="16dp" android:paddingBottom="16dp" android:paddingStart="32dp" @@ -49,6 +51,7 @@ android:text="@string/sort_time_week" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:paddingTop="16dp" android:paddingBottom="16dp" android:paddingStart="32dp" @@ -64,6 +67,7 @@ android:text="@string/sort_time_month" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:paddingTop="16dp" android:paddingBottom="16dp" android:paddingStart="32dp" @@ -79,6 +83,7 @@ android:text="@string/sort_time_year" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:paddingTop="16dp" android:paddingBottom="16dp" android:paddingStart="32dp" @@ -94,6 +99,7 @@ android:text="@string/sort_time_all_time" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:paddingTop="16dp" android:paddingBottom="16dp" android:paddingStart="32dp" diff --git a/app/src/main/res/layout/fragment_sort_type_bottom_sheet.xml b/app/src/main/res/layout/fragment_sort_type_bottom_sheet.xml index f60fe0bb..d5c9e34d 100644 --- a/app/src/main/res/layout/fragment_sort_type_bottom_sheet.xml +++ b/app/src/main/res/layout/fragment_sort_type_bottom_sheet.xml @@ -1,120 +1,149 @@ <?xml version="1.0" encoding="utf-8"?> <androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingBottom="8dp" - android:overScrollMode="never"> + android:overScrollMode="never" + android:paddingBottom="8dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> - <TextView + <androidx.appcompat.widget.AppCompatTextView android:id="@+id/best_type_text_view_sort_type_bottom_sheet_fragment" android:layout_width="match_parent" android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" + android:clickable="true" + android:drawableStart="@drawable/ic_best_24" + android:drawablePadding="48dp" + android:focusable="true" + android:fontFamily="?attr/font_family" + android:paddingStart="32dp" + android:paddingTop="16dp" + android:paddingEnd="32dp" + android:paddingBottom="16dp" android:text="@string/sort_best" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" - android:paddingTop="16dp" - android:paddingBottom="16dp" - android:paddingStart="32dp" - android:paddingEnd="32dp" - android:clickable="true" - android:focusable="true" - android:background="?attr/selectableItemBackground" /> + app:drawableTint="?attr/primaryTextColor" /> - <TextView + <androidx.appcompat.widget.AppCompatTextView android:id="@+id/hot_type_text_view_sort_type_bottom_sheet_fragment" android:layout_width="match_parent" android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" + android:clickable="true" + android:drawableStart="@drawable/ic_hot_24" + android:drawablePadding="48dp" + android:focusable="true" + android:fontFamily="?attr/font_family" + android:paddingStart="32dp" + android:paddingTop="16dp" + android:paddingEnd="32dp" + android:paddingBottom="16dp" android:text="@string/sort_hot" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" - android:paddingTop="16dp" - android:paddingBottom="16dp" - android:paddingStart="32dp" - android:paddingEnd="32dp" - android:clickable="true" - android:focusable="true" - android:background="?attr/selectableItemBackground" /> + app:drawableTint="?attr/primaryTextColor" /> - <TextView + <androidx.appcompat.widget.AppCompatTextView android:id="@+id/new_type_text_view_sort_type_bottom_sheet_fragment" android:layout_width="match_parent" android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" + android:clickable="true" + android:drawableStart="@drawable/ic_new_24" + android:drawablePadding="48dp" + android:focusable="true" + android:fontFamily="?attr/font_family" + android:paddingStart="32dp" + android:paddingTop="16dp" + android:paddingEnd="32dp" + android:paddingBottom="16dp" android:text="@string/sort_new" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" - android:paddingTop="16dp" - android:paddingBottom="16dp" - android:paddingStart="32dp" - android:paddingEnd="32dp" - android:clickable="true" - android:focusable="true" - android:background="?attr/selectableItemBackground" /> + app:drawableTint="?attr/primaryTextColor" /> - <TextView + <androidx.appcompat.widget.AppCompatTextView android:id="@+id/random_type_text_view_sort_type_bottom_sheet_fragment" android:layout_width="match_parent" android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" + android:clickable="true" + android:drawableStart="@drawable/ic_random_24" + android:drawablePadding="48dp" + android:focusable="true" + android:fontFamily="?attr/font_family" + android:paddingStart="32dp" + android:paddingTop="16dp" + android:paddingEnd="32dp" + android:paddingBottom="16dp" android:text="@string/sort_random" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" - android:paddingTop="16dp" - android:paddingBottom="16dp" - android:paddingStart="32dp" - android:paddingEnd="32dp" - android:clickable="true" - android:focusable="true" - android:background="?attr/selectableItemBackground" /> + app:drawableTint="?attr/primaryTextColor" /> - <TextView + <androidx.appcompat.widget.AppCompatTextView android:id="@+id/rising_type_text_view_sort_type_bottom_sheet_fragment" android:layout_width="match_parent" android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" + android:clickable="true" + android:drawableStart="@drawable/ic_rising_24" + android:drawablePadding="48dp" + android:focusable="true" + android:fontFamily="?attr/font_family" + android:paddingStart="32dp" + android:paddingTop="16dp" + android:paddingEnd="32dp" + android:paddingBottom="16dp" android:text="@string/sort_rising" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" - android:paddingTop="16dp" - android:paddingBottom="16dp" - android:paddingStart="32dp" - android:paddingEnd="32dp" - android:clickable="true" - android:focusable="true" - android:background="?attr/selectableItemBackground" /> + app:drawableTint="?attr/primaryTextColor" /> - <TextView + <androidx.appcompat.widget.AppCompatTextView android:id="@+id/top_type_text_view_sort_type_bottom_sheet_fragment" android:layout_width="match_parent" android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" + android:clickable="true" + android:drawableStart="@drawable/ic_top_24" + android:drawablePadding="48dp" + android:focusable="true" + android:fontFamily="?attr/font_family" + android:paddingStart="32dp" + android:paddingTop="16dp" + android:paddingEnd="32dp" + android:paddingBottom="16dp" android:text="@string/sort_top" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" - android:paddingTop="16dp" - android:paddingBottom="16dp" - android:paddingStart="32dp" - android:paddingEnd="32dp" - android:clickable="true" - android:focusable="true" - android:background="?attr/selectableItemBackground" /> + app:drawableTint="?attr/primaryTextColor" /> - <TextView + <androidx.appcompat.widget.AppCompatTextView android:id="@+id/controversial_type_text_view_sort_type_bottom_sheet_fragment" android:layout_width="match_parent" android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" + android:clickable="true" + android:drawableStart="@drawable/ic_controversial_24" + android:drawablePadding="48dp" + android:focusable="true" + android:fontFamily="?attr/font_family" + android:paddingStart="32dp" + android:paddingTop="16dp" + android:paddingEnd="32dp" + android:paddingBottom="16dp" android:text="@string/sort_controversial" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" - android:paddingTop="16dp" - android:paddingBottom="16dp" - android:paddingStart="32dp" - android:paddingEnd="32dp" - android:clickable="true" - android:focusable="true" - android:background="?attr/selectableItemBackground" /> + app:drawableTint="?attr/primaryTextColor" /> </LinearLayout> -</androidx.core.widget.NestedScrollView>
\ No newline at end of file +</androidx.core.widget.NestedScrollView> diff --git a/app/src/main/res/layout/fragment_subreddit_listing.xml b/app/src/main/res/layout/fragment_subreddit_listing.xml index 8c81235d..16122bd6 100644 --- a/app/src/main/res/layout/fragment_subreddit_listing.xml +++ b/app/src/main/res/layout/fragment_subreddit_listing.xml @@ -39,7 +39,8 @@ android:layout_height="wrap_content" android:layout_marginTop="16dp" android:gravity="center" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </LinearLayout> diff --git a/app/src/main/res/layout/fragment_subscribed_subreddits_listing.xml b/app/src/main/res/layout/fragment_subscribed_subreddits_listing.xml index 5675e124..c8c74361 100644 --- a/app/src/main/res/layout/fragment_subscribed_subreddits_listing.xml +++ b/app/src/main/res/layout/fragment_subscribed_subreddits_listing.xml @@ -39,7 +39,8 @@ android:layout_marginTop="16dp" android:gravity="center" android:text="@string/no_subreddits" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </LinearLayout> diff --git a/app/src/main/res/layout/fragment_theme_preview_comments.xml b/app/src/main/res/layout/fragment_theme_preview_comments.xml index 89447a51..5fd566e7 100644 --- a/app/src/main/res/layout/fragment_theme_preview_comments.xml +++ b/app/src/main/res/layout/fragment_theme_preview_comments.xml @@ -53,6 +53,7 @@ android:maxLines="2" android:text="@string/username_preview" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:layout_constraintBottom_toTopOf="@id/author_flair_text_view_theme_preview_comments_fragment" app:layout_constraintEnd_toStartOf="@+id/comment_time_text_view_theme_preview_comments_fragment" app:layout_constraintStart_toEndOf="@id/author_type_image_view_theme_preview_comments_fragment" @@ -67,6 +68,7 @@ android:maxLines="2" android:text="@string/author_flair_preview" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@+id/comment_time_text_view_theme_preview_comments_fragment" app:layout_constraintStart_toStartOf="parent" @@ -79,6 +81,7 @@ android:gravity="end" android:text="2 Hours" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -94,7 +97,8 @@ android:layout_marginEnd="16dp" android:layout_marginBottom="8dp" android:text="@string/comment_content_preview" - android:textSize="?attr/content_font_default" /> + android:textSize="?attr/content_font_default" + android:fontFamily="?attr/content_font_family" /> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/bottom_constraint_layout_theme_preview_comments_fragment" @@ -126,6 +130,7 @@ android:text="1234" android:textSize="?attr/font_12" android:textStyle="bold" + android:fontFamily="?attr/font_family" app:layout_constraintStart_toEndOf="@+id/up_vote_button_theme_preview_comments_fragment" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent"/> diff --git a/app/src/main/res/layout/fragment_theme_preview_posts.xml b/app/src/main/res/layout/fragment_theme_preview_posts.xml index c486f8b0..7e384540 100644 --- a/app/src/main/res/layout/fragment_theme_preview_posts.xml +++ b/app/src/main/res/layout/fragment_theme_preview_posts.xml @@ -41,6 +41,7 @@ android:layout_marginEnd="8dp" android:text="@string/subreddit_preview" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:layout_constraintBottom_toTopOf="@id/user_text_view_theme_preview_posts_fragment" app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_theme_preview_posts_fragment" app:layout_constraintStart_toEndOf="@id/icon_gif_image_view_theme_preview_posts_fragment" @@ -56,6 +57,7 @@ android:maxLines="2" android:text="@string/username_preview" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_theme_preview_posts_fragment" app:layout_constraintHorizontal_bias="0" @@ -79,6 +81,7 @@ android:gravity="end" android:text="2 Hours" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@id/guideline2" @@ -100,7 +103,8 @@ android:paddingStart="16dp" android:paddingEnd="16dp" android:text="@string/post_title_preview" - android:textSize="?attr/title_font_18" /> + android:textSize="?attr/title_font_18" + android:fontFamily="?attr/title_font_family" /> <TextView android:id="@+id/content_text_view_theme_preview_posts_fragment" @@ -112,6 +116,7 @@ android:maxLines="4" android:text="@string/post_content_preview" android:textSize="?attr/content_font_default" + android:fontFamily="?attr/content_font_family" android:ellipsize="end" /> <com.nex3z.flowlayout.FlowLayout @@ -128,8 +133,8 @@ android:layout_height="wrap_content" android:padding="4dp" android:text="@string/post_type_preview" - android:textColor="@android:color/white" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" app:lib_setRadius="3dp" app:lib_setRoundedView="true" app:lib_setShape="rectangle" /> @@ -141,8 +146,8 @@ android:layout_gravity="center" android:padding="4dp" android:text="@string/spoiler" - android:textColor="@android:color/white" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" app:lib_setRadius="3dp" app:lib_setRoundedView="true" app:lib_setShape="rectangle" /> @@ -153,8 +158,8 @@ android:layout_height="wrap_content" android:padding="4dp" android:text="@string/nsfw" - android:textColor="@android:color/white" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" app:lib_setRadius="3dp" app:lib_setRoundedView="true" app:lib_setShape="rectangle" /> @@ -166,20 +171,23 @@ android:layout_gravity="center" android:padding="4dp" android:text="@string/flair_preview" - android:textColor="@android:color/white" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" app:lib_setRadius="3dp" app:lib_setRoundedView="true" app:lib_setShape="rectangle" /> - <TextView + <com.libRG.CustomTextView + android:id="@+id/awards_text_view_theme_preview_posts_fragment" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:drawableStart="@drawable/gold" - android:drawablePadding="4dp" - android:text="@string/gilded_preview" - android:textColor="@color/gold" - android:textSize="?attr/font_default" /> + android:padding="4dp" + android:text="@string/awards_preview" + android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" + app:lib_setRadius="3dp" + app:lib_setRoundedView="true" + app:lib_setShape="rectangle" /> <ImageView android:id="@+id/archived_image_view_theme_preview_posts_fragment" @@ -209,7 +217,8 @@ android:paddingStart="16dp" android:paddingEnd="16dp" android:text="abcd.efg" - android:textSize="?attr/font_12" /> + android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" /> <ProgressBar android:id="@+id/progress_bar_theme_preview_posts_fragment" @@ -251,6 +260,7 @@ android:text="1234" android:textSize="?attr/font_12" android:textStyle="bold" + android:fontFamily="?attr/font_family" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/plus_button_theme_preview_posts_fragment" app:layout_constraintTop_toTopOf="parent" /> @@ -279,6 +289,7 @@ android:text="567" android:textSize="?attr/font_12" android:textStyle="bold" + android:fontFamily="?attr/font_family" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/minus_button_theme_preview_posts_fragment" app:layout_constraintTop_toTopOf="parent" /> diff --git a/app/src/main/res/layout/fragment_url_menu_bottom_sheet.xml b/app/src/main/res/layout/fragment_url_menu_bottom_sheet.xml index 05ea66c9..2aa8e144 100644 --- a/app/src/main/res/layout/fragment_url_menu_bottom_sheet.xml +++ b/app/src/main/res/layout/fragment_url_menu_bottom_sheet.xml @@ -19,6 +19,7 @@ android:text="@string/copy_raw_text" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:paddingTop="16dp" android:paddingBottom="16dp" android:paddingStart="32dp" @@ -36,6 +37,7 @@ android:text="@string/copy_markdown" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:paddingTop="16dp" android:paddingBottom="16dp" android:paddingStart="32dp" @@ -53,6 +55,7 @@ android:text="@string/copy_all_raw_text" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:paddingTop="16dp" android:paddingBottom="16dp" android:paddingStart="32dp" diff --git a/app/src/main/res/layout/fragment_user_listing.xml b/app/src/main/res/layout/fragment_user_listing.xml index 321c789b..8e5aeb23 100644 --- a/app/src/main/res/layout/fragment_user_listing.xml +++ b/app/src/main/res/layout/fragment_user_listing.xml @@ -4,7 +4,6 @@ android:id="@+id/coordinator_layout_user_listing_fragment" android:layout_width="match_parent" android:layout_height="match_parent" - xmlns:app="http://schemas.android.com/apk/res-auto" tools:application=".UserListingFragment"> <androidx.swiperefreshlayout.widget.SwipeRefreshLayout @@ -40,7 +39,8 @@ android:layout_height="wrap_content" android:layout_marginTop="16dp" android:gravity="center" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </LinearLayout> diff --git a/app/src/main/res/layout/fragment_user_thing_sort_type_bottom_sheet.xml b/app/src/main/res/layout/fragment_user_thing_sort_type_bottom_sheet.xml index dbf56287..17056053 100644 --- a/app/src/main/res/layout/fragment_user_thing_sort_type_bottom_sheet.xml +++ b/app/src/main/res/layout/fragment_user_thing_sort_type_bottom_sheet.xml @@ -1,67 +1,85 @@ <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" android:layout_width="match_parent" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" android:layout_height="match_parent" + android:orientation="vertical" android:paddingBottom="8dp"> - <TextView + <androidx.appcompat.widget.AppCompatTextView android:id="@+id/new_type_text_view_user_thing_sort_type_bottom_sheet_fragment" android:layout_width="match_parent" android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" + android:clickable="true" + android:drawableStart="@drawable/ic_new_24" + android:drawablePadding="48dp" + android:focusable="true" + android:fontFamily="?attr/font_family" + android:paddingStart="32dp" + android:paddingTop="16dp" + android:paddingEnd="32dp" + android:paddingBottom="16dp" android:text="@string/sort_new" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" - android:paddingTop="16dp" - android:paddingBottom="16dp" - android:paddingStart="32dp" - android:paddingEnd="32dp" - android:clickable="true" - android:focusable="true" - android:background="?attr/selectableItemBackground" /> + app:drawableTint="?attr/primaryTextColor" /> - <TextView + <androidx.appcompat.widget.AppCompatTextView android:id="@+id/hot_type_text_view_user_thing_sort_type_bottom_sheet_fragment" android:layout_width="match_parent" android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" + android:clickable="true" + android:drawableStart="@drawable/ic_hot_24" + android:drawablePadding="48dp" + android:focusable="true" + android:fontFamily="?attr/font_family" + android:paddingStart="32dp" + android:paddingTop="16dp" + android:paddingEnd="32dp" + android:paddingBottom="16dp" android:text="@string/sort_hot" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" - android:paddingTop="16dp" - android:paddingBottom="16dp" - android:paddingStart="32dp" - android:paddingEnd="32dp" - android:clickable="true" - android:focusable="true" - android:background="?attr/selectableItemBackground" /> + app:drawableTint="?attr/primaryTextColor" /> - <TextView + <androidx.appcompat.widget.AppCompatTextView android:id="@+id/top_type_text_view_user_thing_sort_type_bottom_sheet_fragment" android:layout_width="match_parent" android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" + android:clickable="true" + android:drawableStart="@drawable/ic_top_24" + android:drawablePadding="48dp" + android:focusable="true" + android:fontFamily="?attr/font_family" + android:paddingStart="32dp" + android:paddingTop="16dp" + android:paddingEnd="32dp" + android:paddingBottom="16dp" android:text="@string/sort_top" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" - android:paddingTop="16dp" - android:paddingBottom="16dp" - android:paddingStart="32dp" - android:paddingEnd="32dp" - android:clickable="true" - android:focusable="true" - android:background="?attr/selectableItemBackground" /> + app:drawableTint="?attr/primaryTextColor" /> - <TextView + <androidx.appcompat.widget.AppCompatTextView android:id="@+id/controversial_type_text_view_user_thing_sort_type_bottom_sheet_fragment" android:layout_width="match_parent" android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" + android:clickable="true" + android:drawableStart="@drawable/ic_controversial_24" + android:drawablePadding="48dp" + android:focusable="true" + android:fontFamily="?attr/font_family" + android:paddingStart="32dp" + android:paddingTop="16dp" + android:paddingEnd="32dp" + android:paddingBottom="16dp" android:text="@string/sort_controversial" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" - android:paddingTop="16dp" - android:paddingBottom="16dp" - android:paddingStart="32dp" - android:paddingEnd="32dp" - android:clickable="true" - android:focusable="true" - android:background="?attr/selectableItemBackground" /> + app:drawableTint="?attr/primaryTextColor" /> -</LinearLayout>
\ No newline at end of file +</LinearLayout> diff --git a/app/src/main/res/layout/fragment_view_imgur_images.xml b/app/src/main/res/layout/fragment_view_imgur_images.xml index 9d2ae408..63620c08 100644 --- a/app/src/main/res/layout/fragment_view_imgur_images.xml +++ b/app/src/main/res/layout/fragment_view_imgur_images.xml @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" + xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/constraintLayout" android:layout_width="match_parent" android:layout_height="match_parent" @@ -15,7 +16,10 @@ <com.alexvasilkov.gestures.views.GestureImageView android:id="@+id/image_view_view_imgur_image_fragment" android:layout_width="match_parent" - android:layout_height="match_parent" /> + android:layout_height="match_parent" + android:adjustViewBounds="true" + android:scaleType="fitCenter" + app:gest_fillViewport="true" /> <LinearLayout android:id="@+id/load_image_error_linear_layout_view_imgur_image_fragment" @@ -31,7 +35,8 @@ android:gravity="center" android:textColor="@android:color/white" android:text="@string/error_loading_image_tap_to_retry" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </LinearLayout> diff --git a/app/src/main/res/layout/fragment_view_messages.xml b/app/src/main/res/layout/fragment_view_messages.xml new file mode 100644 index 00000000..a8f8439d --- /dev/null +++ b/app/src/main/res/layout/fragment_view_messages.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout 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" + tools:context=".Fragment.ViewMessagesFragment"> + + <androidx.swiperefreshlayout.widget.SwipeRefreshLayout + android:id="@+id/swipe_refresh_layout_view_messages_fragment" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/recycler_view_view_messages_fragment" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:clipToPadding="false" /> + + </androidx.swiperefreshlayout.widget.SwipeRefreshLayout> + + <LinearLayout + android:id="@+id/fetch_messages_info_linear_layout_view_messages_fragment" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:gravity="center" + android:orientation="vertical" + android:visibility="gone"> + + <ImageView + android:id="@+id/fetch_messages_info_image_view_view_messages_fragment" + android:layout_width="150dp" + android:layout_height="wrap_content" /> + + <TextView + android:id="@+id/fetch_messages_info_text_view_view_messages_fragment" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="16dp" + android:fontFamily="?attr/font_family" + android:gravity="center" + android:textSize="?attr/font_default" /> + + </LinearLayout> + +</RelativeLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/item_acknowledgement.xml b/app/src/main/res/layout/item_acknowledgement.xml index b1d37f97..fba5dbde 100644 --- a/app/src/main/res/layout/item_acknowledgement.xml +++ b/app/src/main/res/layout/item_acknowledgement.xml @@ -15,13 +15,15 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_16" /> + android:textSize="?attr/font_16" + android:fontFamily="?attr/font_family" /> <TextView android:id="@+id/introduction_text_view_item_acknowledgement" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="8dp" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/item_comment.xml b/app/src/main/res/layout/item_comment.xml index ab0ebbe4..6129a269 100644 --- a/app/src/main/res/layout/item_comment.xml +++ b/app/src/main/res/layout/item_comment.xml @@ -48,6 +48,7 @@ android:ellipsize="end" android:maxLines="2" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:layout_constraintBottom_toTopOf="@id/author_flair_text_view_item_post_comment" app:layout_constraintEnd_toStartOf="@+id/barrier" app:layout_constraintStart_toEndOf="@id/author_type_image_view_item_comment" @@ -61,6 +62,7 @@ android:ellipsize="end" android:maxLines="2" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:visibility="gone" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@+id/barrier" @@ -74,6 +76,7 @@ android:layout_marginEnd="8dp" android:gravity="end" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@id/comment_time_text_view_item_post_comment" app:layout_constraintTop_toTopOf="parent" /> @@ -84,6 +87,7 @@ android:layout_height="wrap_content" android:gravity="end" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -104,7 +108,9 @@ android:layout_marginTop="8dp" android:paddingStart="16dp" android:paddingEnd="16dp" - android:visibility="gone" /> + android:visibility="gone" + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> <TextView android:id="@+id/comment_markdown_view_item_post_comment" @@ -115,7 +121,8 @@ android:layout_marginEnd="16dp" android:layout_marginBottom="8dp" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/content_font_default" /> + android:textSize="?attr/content_font_default" + android:fontFamily="?attr/content_font_family" /> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/bottom_constraint_layout_item_post_comment" @@ -146,6 +153,7 @@ android:gravity="center" android:textSize="?attr/font_12" android:textStyle="bold" + android:fontFamily="?attr/font_family" app:layout_constraintStart_toEndOf="@+id/up_vote_button_item_post_comment" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent"/> diff --git a/app/src/main/res/layout/item_comment_footer_error.xml b/app/src/main/res/layout/item_comment_footer_error.xml index ab0bc98f..1eb5e084 100644 --- a/app/src/main/res/layout/item_comment_footer_error.xml +++ b/app/src/main/res/layout/item_comment_footer_error.xml @@ -12,7 +12,8 @@ android:layout_alignParentStart="true" android:layout_centerVertical="true" android:layout_toStartOf="@id/retry_button_item_comment_footer_error" - android:textSize="?attr/font_18" /> + android:textSize="?attr/font_18" + android:fontFamily="?attr/font_family" /> <Button android:id="@+id/retry_button_item_comment_footer_error" @@ -21,6 +22,7 @@ android:layout_alignParentEnd="true" android:layout_centerVertical="true" android:text="@string/retry" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </RelativeLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/item_custom_theme_color_item.xml b/app/src/main/res/layout/item_custom_theme_color_item.xml index 9a56b98b..9e52f44b 100644 --- a/app/src/main/res/layout/item_custom_theme_color_item.xml +++ b/app/src/main/res/layout/item_custom_theme_color_item.xml @@ -25,7 +25,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_16" /> + android:textSize="?attr/font_16" + android:fontFamily="?attr/font_family" /> <TextView android:id="@+id/theme_item_info_text_view_item_custom_theme_color_item" @@ -33,7 +34,8 @@ android:layout_height="wrap_content" android:layout_marginTop="4dp" android:textColor="?attr/secondaryTextColor" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </LinearLayout> diff --git a/app/src/main/res/layout/item_custom_theme_switch_item.xml b/app/src/main/res/layout/item_custom_theme_switch_item.xml index 18e3aed2..9b6ef0ef 100644 --- a/app/src/main/res/layout/item_custom_theme_switch_item.xml +++ b/app/src/main/res/layout/item_custom_theme_switch_item.xml @@ -20,7 +20,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_16" /> + android:textSize="?attr/font_16" + android:fontFamily="?attr/font_family" /> <TextView android:id="@+id/theme_item_info_text_view_item_custom_theme_switch_item" @@ -28,7 +29,8 @@ android:layout_height="wrap_content" android:layout_marginTop="4dp" android:textColor="?attr/secondaryTextColor" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </LinearLayout> diff --git a/app/src/main/res/layout/item_favorite_thing_divider.xml b/app/src/main/res/layout/item_favorite_thing_divider.xml index 657d5bbf..13d99e4a 100644 --- a/app/src/main/res/layout/item_favorite_thing_divider.xml +++ b/app/src/main/res/layout/item_favorite_thing_divider.xml @@ -8,6 +8,7 @@ android:id="@+id/divider_text_view_item_favorite_thing_divider" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/item_flair.xml b/app/src/main/res/layout/item_flair.xml index abd5c477..9d6f1c33 100644 --- a/app/src/main/res/layout/item_flair.xml +++ b/app/src/main/res/layout/item_flair.xml @@ -12,7 +12,8 @@ android:layout_height="wrap_content" android:padding="16dp" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> <ImageView android:id="@+id/edit_flair_image_view_item_flair" diff --git a/app/src/main/res/layout/item_footer_error.xml b/app/src/main/res/layout/item_footer_error.xml index c0278ca9..71eef915 100644 --- a/app/src/main/res/layout/item_footer_error.xml +++ b/app/src/main/res/layout/item_footer_error.xml @@ -14,7 +14,8 @@ android:layout_alignParentStart="true" android:layout_centerVertical="true" android:layout_toStartOf="@id/retry_button_item_footer_error" - android:textSize="?attr/font_18" /> + android:textSize="?attr/font_18" + android:fontFamily="?attr/font_family" /> <Button android:id="@+id/retry_button_item_footer_error" @@ -22,8 +23,8 @@ android:layout_height="wrap_content" android:layout_alignParentEnd="true" android:layout_centerVertical="true" - android:textColor="@android:color/white" android:text="@string/retry" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </RelativeLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/item_load_comments_failed_placeholder.xml b/app/src/main/res/layout/item_load_comments_failed_placeholder.xml index 6d49a1e6..b5dd0d92 100644 --- a/app/src/main/res/layout/item_load_comments_failed_placeholder.xml +++ b/app/src/main/res/layout/item_load_comments_failed_placeholder.xml @@ -18,6 +18,7 @@ android:layout_gravity="center_horizontal" android:gravity="center" android:text="@string/load_comments_failed" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/item_load_more_comments_placeholder.xml b/app/src/main/res/layout/item_load_more_comments_placeholder.xml index d801a867..f045676d 100644 --- a/app/src/main/res/layout/item_load_more_comments_placeholder.xml +++ b/app/src/main/res/layout/item_load_more_comments_placeholder.xml @@ -22,7 +22,8 @@ android:padding="8dp" android:text="@string/comment_load_more_comments" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </LinearLayout> diff --git a/app/src/main/res/layout/item_message.xml b/app/src/main/res/layout/item_message.xml index 1ac3b4ed..792be94f 100644 --- a/app/src/main/res/layout/item_message.xml +++ b/app/src/main/res/layout/item_message.xml @@ -11,7 +11,8 @@ android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> <TextView android:id="@+id/subject_text_view_item_message" @@ -19,7 +20,8 @@ android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:textSize="?attr/font_16" - android:textColor="?attr/primaryTextColor" /> + android:textColor="?attr/primaryTextColor" + android:fontFamily="?attr/font_family" /> <TextView android:id="@+id/title_text_view_item_message" @@ -27,12 +29,14 @@ android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/title_font_family" /> <TextView android:id="@+id/content_custom_markwon_view_item_message" android:layout_width="match_parent" android:layout_height="wrap_content" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/content_font_family" /> </LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/item_multi_reddit.xml b/app/src/main/res/layout/item_multi_reddit.xml index b522251b..5d8d36e5 100644 --- a/app/src/main/res/layout/item_multi_reddit.xml +++ b/app/src/main/res/layout/item_multi_reddit.xml @@ -21,6 +21,7 @@ android:layout_weight="1" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:layout_gravity="center_vertical" /> <ImageView diff --git a/app/src/main/res/layout/item_nav_drawer_account.xml b/app/src/main/res/layout/item_nav_drawer_account.xml index 7cf71e6a..1aebf8db 100644 --- a/app/src/main/res/layout/item_nav_drawer_account.xml +++ b/app/src/main/res/layout/item_nav_drawer_account.xml @@ -21,6 +21,7 @@ android:layout_marginEnd="16dp" android:layout_gravity="center_vertical" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/item_nav_drawer_menu_group_title.xml b/app/src/main/res/layout/item_nav_drawer_menu_group_title.xml index 5db89c04..01901b25 100644 --- a/app/src/main/res/layout/item_nav_drawer_menu_group_title.xml +++ b/app/src/main/res/layout/item_nav_drawer_menu_group_title.xml @@ -4,4 +4,5 @@ android:layout_height="wrap_content" android:padding="16dp" android:text="@string/label_post" - android:textSize="?attr/font_default" />
\ No newline at end of file + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" />
\ No newline at end of file diff --git a/app/src/main/res/layout/item_nav_drawer_menu_item.xml b/app/src/main/res/layout/item_nav_drawer_menu_item.xml index 6fcd0b35..6a75d908 100644 --- a/app/src/main/res/layout/item_nav_drawer_menu_item.xml +++ b/app/src/main/res/layout/item_nav_drawer_menu_item.xml @@ -19,6 +19,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_vertical" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/item_nav_drawer_subscribed_thing.xml b/app/src/main/res/layout/item_nav_drawer_subscribed_thing.xml index 9c96ea4f..04751a6a 100644 --- a/app/src/main/res/layout/item_nav_drawer_subscribed_thing.xml +++ b/app/src/main/res/layout/item_nav_drawer_subscribed_thing.xml @@ -22,6 +22,7 @@ android:layout_weight="1" android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:layout_gravity="center_vertical" /> </LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/item_no_comment_placeholder.xml b/app/src/main/res/layout/item_no_comment_placeholder.xml index 2e0dc99d..17193549 100644 --- a/app/src/main/res/layout/item_no_comment_placeholder.xml +++ b/app/src/main/res/layout/item_no_comment_placeholder.xml @@ -17,6 +17,7 @@ android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:text="@string/no_comments_yet" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/item_post_compact.xml b/app/src/main/res/layout/item_post_compact.xml index d81a2bdc..1cee1578 100644 --- a/app/src/main/res/layout/item_post_compact.xml +++ b/app/src/main/res/layout/item_post_compact.xml @@ -1,379 +1,388 @@ <?xml version="1.0" encoding="utf-8"?> -<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android" +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" - app:cardBackgroundColor="?attr/cardViewBackgroundColor" - xmlns:tools="http://schemas.android.com/tools"> + android:orientation="vertical"> - <LinearLayout + <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="vertical"> + android:paddingStart="16dp" + android:paddingTop="8dp" + android:paddingEnd="16dp" + android:paddingBottom="8dp"> + + <ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView + android:id="@+id/icon_gif_image_view_item_post_compact" + android:layout_width="24dp" + android:layout_height="24dp" + android:layout_gravity="center" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/name_text_view_item_post_compact" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:layout_marginStart="16dp" + android:layout_marginEnd="8dp" + android:fontFamily="?attr/font_family" + android:textColor="#E91E63" + android:textSize="?attr/font_default" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_compact" + app:layout_constraintStart_toEndOf="@id/icon_gif_image_view_item_post_compact" + app:layout_constraintTop_toTopOf="parent" /> + + <ImageView + android:id="@+id/stickied_post_image_view_item_post_compact" + android:layout_width="24dp" + android:layout_height="24dp" + android:layout_marginEnd="8dp" + android:visibility="gone" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toStartOf="@+id/guideline2" + app:layout_constraintStart_toEndOf="@id/name_text_view_item_post_compact" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/post_time_text_view_item_post_compact" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:fontFamily="?attr/font_family" + android:gravity="end" + android:textSize="?attr/font_default" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toEndOf="@id/guideline2" + app:layout_constraintTop_toTopOf="parent" /> + + <androidx.constraintlayout.widget.Guideline + android:id="@+id/guideline2" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:orientation="vertical" + app:layout_constraintGuide_percent="0.6" /> + + </androidx.constraintlayout.widget.ConstraintLayout> - <androidx.constraintlayout.widget.ConstraintLayout - android:layout_width="match_parent" + <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/title_and_image_constraint_layout" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <TextView + android:id="@+id/title_text_view_item_post_compact" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:fontFamily="?attr/title_font_family" + android:paddingStart="16dp" + android:paddingEnd="16dp" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/title_font_18" + app:layout_constraintBottom_toTopOf="@id/flow_layout_item_post_compact" + app:layout_constraintEnd_toStartOf="@id/barrier2" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <com.nex3z.flowlayout.FlowLayout + android:id="@+id/flow_layout_item_post_compact" + android:layout_width="0dp" android:layout_height="wrap_content" + android:paddingStart="16dp" android:paddingTop="8dp" + android:paddingEnd="16dp" android:paddingBottom="8dp" - android:paddingStart="16dp" - android:paddingEnd="16dp"> - - <ml.docilealligator.infinityforreddit.CustomView.AspectRatioGifImageView - android:id="@+id/icon_gif_image_view_item_post_compact" - android:layout_width="24dp" - android:layout_height="24dp" + app:flChildSpacing="8dp" + app:flChildSpacingForLastRow="align" + app:flRowSpacing="8dp" + app:layout_constraintBottom_toTopOf="@id/link_text_view_item_post_compact" + app:layout_constraintEnd_toStartOf="@id/barrier2" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/title_text_view_item_post_compact"> + + <com.libRG.CustomTextView + android:id="@+id/type_text_view_item_post_compact" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:fontFamily="?attr/font_family" + android:padding="4dp" + android:textSize="?attr/font_10" + app:lib_setRadius="3dp" + app:lib_setRoundedView="true" + app:lib_setShape="rectangle" /> + + <com.libRG.CustomTextView + android:id="@+id/spoiler_custom_text_view_item_post_compact" + android:layout_width="wrap_content" + android:layout_height="wrap_content" android:layout_gravity="center" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" /> + android:fontFamily="?attr/font_family" + android:padding="4dp" + android:text="@string/spoiler" + android:textSize="?attr/font_10" + android:visibility="gone" + app:lib_setRadius="3dp" + app:lib_setRoundedView="true" + app:lib_setShape="rectangle" /> - <TextView - android:id="@+id/name_text_view_item_post_compact" - android:layout_width="0dp" + <com.libRG.CustomTextView + android:id="@+id/nsfw_text_view_item_post_compact" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:fontFamily="?attr/font_family" + android:padding="4dp" + android:text="@string/nsfw" + android:textSize="?attr/font_10" + android:visibility="gone" + app:lib_setRadius="3dp" + app:lib_setRoundedView="true" + app:lib_setShape="rectangle" /> + + <com.libRG.CustomTextView + android:id="@+id/flair_custom_text_view_item_post_compact" + android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" - android:layout_marginStart="16dp" - android:layout_marginEnd="8dp" - android:textColor="#E91E63" - android:textSize="?attr/font_default" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_compact" - app:layout_constraintStart_toEndOf="@id/icon_gif_image_view_item_post_compact" - app:layout_constraintTop_toTopOf="parent" /> + android:fontFamily="?attr/font_family" + android:padding="4dp" + android:textSize="?attr/font_10" + android:visibility="gone" + app:lib_setRadius="3dp" + app:lib_setRoundedView="true" + app:lib_setShape="rectangle" /> + + <com.libRG.CustomTextView + android:id="@+id/awards_text_view_item_post_compact" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:fontFamily="?attr/font_family" + android:padding="4dp" + android:textSize="?attr/font_10" + android:visibility="gone" + app:lib_setRadius="3dp" + app:lib_setRoundedView="true" + app:lib_setShape="rectangle" /> <ImageView - android:id="@+id/stickied_post_image_view_item_post_compact" + android:id="@+id/archived_image_view_item_post_compact" android:layout_width="24dp" android:layout_height="24dp" - android:layout_marginEnd="8dp" - android:visibility="gone" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toStartOf="@+id/guideline2" - app:layout_constraintStart_toEndOf="@id/name_text_view_item_post_compact" - app:layout_constraintTop_toTopOf="parent" /> - - <TextView - android:id="@+id/post_time_text_view_item_post_compact" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:gravity="end" - android:textSize="?attr/font_default" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toEndOf="@id/guideline2" - app:layout_constraintTop_toTopOf="parent" /> - - <androidx.constraintlayout.widget.Guideline - android:id="@+id/guideline2" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" - app:layout_constraintGuide_percent="0.6" /> + android:src="@drawable/ic_archive_outline" + android:visibility="gone" /> - </androidx.constraintlayout.widget.ConstraintLayout> + <ImageView + android:id="@+id/locked_image_view_item_post_compact" + android:layout_width="24dp" + android:layout_height="24dp" + android:src="@drawable/ic_outline_lock_24dp" + android:visibility="gone" /> - <androidx.constraintlayout.widget.ConstraintLayout - android:layout_width="match_parent" - android:layout_height="wrap_content"> + <ImageView + android:id="@+id/crosspost_image_view_item_post_compact" + android:layout_width="24dp" + android:layout_height="24dp" + android:src="@drawable/crosspost" + android:visibility="gone" /> - <TextView - android:id="@+id/title_text_view_item_post_compact" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:paddingStart="16dp" - android:paddingEnd="16dp" - android:textColor="?attr/primaryTextColor" - android:textSize="?attr/title_font_18" - app:layout_constraintBottom_toTopOf="@id/flow_layout_item_post_compact" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintEnd_toStartOf="@id/barrier2" - app:layout_constraintTop_toTopOf="parent" /> - - <com.nex3z.flowlayout.FlowLayout - android:id="@+id/flow_layout_item_post_compact" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:paddingTop="8dp" - android:paddingBottom="8dp" - android:paddingStart="16dp" - android:paddingEnd="16dp" - app:layout_constraintTop_toBottomOf="@id/title_text_view_item_post_compact" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintEnd_toStartOf="@id/barrier2" - app:layout_constraintBottom_toTopOf="@id/link_text_view_item_post_compact" - app:flChildSpacing="8dp" - app:flChildSpacingForLastRow="align" - app:flRowSpacing="8dp"> - - <com.libRG.CustomTextView - android:id="@+id/type_text_view_item_post_compact" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:padding="4dp" - android:textColor="@android:color/white" - android:textSize="?attr/font_10" - app:lib_setRadius="3dp" - app:lib_setRoundedView="true" - app:lib_setShape="rectangle" /> - - <com.libRG.CustomTextView - android:id="@+id/spoiler_custom_text_view_item_post_compact" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:padding="4dp" - android:text="@string/spoiler" - android:textColor="@android:color/white" - android:textSize="?attr/font_10" - android:visibility="gone" - app:lib_setRadius="3dp" - app:lib_setRoundedView="true" - app:lib_setShape="rectangle" /> - - <com.libRG.CustomTextView - android:id="@+id/nsfw_text_view_item_post_compact" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:padding="4dp" - android:text="@string/nsfw" - android:textColor="@android:color/white" - android:textSize="?attr/font_10" - android:visibility="gone" - app:lib_setRadius="3dp" - app:lib_setRoundedView="true" - app:lib_setShape="rectangle" /> - - <com.libRG.CustomTextView - android:id="@+id/flair_custom_text_view_item_post_compact" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:padding="4dp" - android:textColor="@android:color/white" - android:textSize="?attr/font_10" - android:visibility="gone" - app:lib_setRadius="3dp" - app:lib_setRoundedView="true" - app:lib_setShape="rectangle" /> - - <com.libRG.CustomTextView - android:id="@+id/awards_text_view_item_post_compact" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:padding="4dp" - android:textSize="?attr/font_10" - android:visibility="gone" - app:lib_setRadius="3dp" - app:lib_setRoundedView="true" - app:lib_setShape="rectangle" /> + </com.nex3z.flowlayout.FlowLayout> - <ImageView - android:id="@+id/archived_image_view_item_post_compact" - android:layout_width="24dp" - android:layout_height="24dp" - android:src="@drawable/ic_archive_outline" - android:visibility="gone" /> + <TextView + android:id="@+id/link_text_view_item_post_compact" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:fontFamily="?attr/font_family" + android:paddingStart="16dp" + android:paddingEnd="16dp" + android:textSize="?attr/font_12" + android:visibility="gone" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toStartOf="@id/barrier2" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/flow_layout_item_post_compact" /> + + <RelativeLayout + android:id="@+id/image_view_wrapper_item_post_compact" + android:layout_width="72dp" + android:layout_height="72dp" + android:layout_marginEnd="16dp" + android:visibility="gone" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toEndOf="@id/barrier2" + app:layout_constraintTop_toTopOf="parent"> + + <FrameLayout + android:layout_width="match_parent" + android:layout_height="match_parent"> <ImageView - android:id="@+id/locked_image_view_item_post_compact" - android:layout_width="24dp" - android:layout_height="24dp" - android:src="@drawable/ic_outline_lock_24dp" - android:visibility="gone" /> + android:id="@+id/image_view_item_post_compact" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@drawable/thumbnail_compact_layout_rounded_edge" + android:scaleType="center" /> <ImageView - android:id="@+id/crosspost_image_view_item_post_compact" - android:layout_width="24dp" - android:layout_height="24dp" - android:src="@drawable/crosspost" + android:id="@+id/play_button_image_view_item_post_compact" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:layout_margin="0dp" + android:background="@drawable/play_button_round_background" + android:src="@drawable/ic_play_circle_36dp" android:visibility="gone" /> - </com.nex3z.flowlayout.FlowLayout> + </FrameLayout> - <TextView - android:id="@+id/link_text_view_item_post_compact" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:paddingStart="16dp" - android:paddingEnd="16dp" - android:textSize="?attr/font_12" - android:visibility="gone" - app:layout_constraintTop_toBottomOf="@id/flow_layout_item_post_compact" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintEnd_toStartOf="@id/barrier2" - app:layout_constraintBottom_toBottomOf="parent" /> + <ProgressBar + android:id="@+id/progress_bar_item_post_compact" + android:layout_width="36dp" + android:layout_height="36dp" + android:layout_centerInParent="true" + android:visibility="gone" /> - <RelativeLayout - android:id="@+id/image_view_wrapper_item_post_compact" - android:layout_width="72dp" - android:layout_height="72dp" - android:layout_marginEnd="16dp" - android:visibility="gone" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toEndOf="@id/barrier2" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toTopOf="parent"> + </RelativeLayout> - <FrameLayout - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <ImageView - android:id="@+id/image_view_item_post_compact" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scaleType="center" /> - - <ImageView - android:id="@+id/play_button_image_view_item_post_compact" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_margin="0dp" - android:layout_gravity="center" - android:background="@drawable/play_button_round_background" - android:src="@drawable/ic_play_circle_36dp" - android:visibility="gone" /> - - </FrameLayout> - - <ProgressBar - android:id="@+id/progress_bar_item_post_compact" - android:layout_width="36dp" - android:layout_height="36dp" - android:layout_centerInParent="true" - android:visibility="gone" /> - - </RelativeLayout> + <FrameLayout + android:id="@+id/frame_layout_image_view_no_preview_link_item_post_compact" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginEnd="16dp" + android:visibility="gone" + android:background="@drawable/thumbnail_compact_layout_rounded_edge" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toEndOf="@id/barrier2" + app:layout_constraintTop_toTopOf="parent"> <ImageView android:id="@+id/image_view_no_preview_link_item_post_compact" android:layout_width="72dp" android:layout_height="72dp" - android:layout_marginEnd="16dp" android:scaleType="center" android:src="@drawable/ic_link" - android:tint="@android:color/tab_indicator_text" - android:visibility="gone" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toEndOf="@id/barrier2" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toTopOf="parent" /> + android:tint="@android:color/tab_indicator_text" /> - <androidx.constraintlayout.widget.Barrier - android:id="@+id/barrier2" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - app:barrierDirection="start" - app:constraint_referenced_ids="image_view_wrapper_item_post_compact,image_view_no_preview_link_item_post_compact" /> + </FrameLayout> - </androidx.constraintlayout.widget.ConstraintLayout> + <androidx.constraintlayout.widget.Barrier + android:id="@+id/barrier2" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + app:barrierDirection="start" + app:constraint_referenced_ids="image_view_wrapper_item_post_compact,frame_layout_image_view_no_preview_link_item_post_compact" /> - <androidx.constraintlayout.widget.ConstraintLayout - android:id="@+id/bottom_constraint_layout_item_post_compact" - android:layout_width="match_parent" - android:layout_height="wrap_content"> + </androidx.constraintlayout.widget.ConstraintLayout> - <ImageView - android:id="@+id/plus_button_item_post_compact" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" - android:paddingTop="8dp" - android:paddingBottom="8dp" - android:paddingStart="12dp" - android:paddingEnd="12dp" - android:src="@drawable/ic_arrow_upward_grey_24dp" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" /> - - <TextView - android:id="@+id/score_text_view_item_post_compact" - android:layout_width="64dp" - android:layout_height="wrap_content" - android:gravity="center" - android:textSize="?attr/font_12" - android:textStyle="bold" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toEndOf="@id/plus_button_item_post_compact" - app:layout_constraintTop_toTopOf="parent" /> + <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/bottom_constraint_layout_item_post_compact" + android:layout_width="match_parent" + android:layout_height="wrap_content"> - <ImageView - android:id="@+id/minus_button_item_post_compact" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" - android:paddingTop="8dp" - android:paddingBottom="8dp" - android:paddingStart="12dp" - android:paddingEnd="12dp" - android:src="@drawable/ic_arrow_downward_grey_24dp" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_compact" - app:layout_constraintTop_toTopOf="parent" /> - - <TextView - android:id="@+id/comments_count_item_post_compact" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:drawableStart="@drawable/ic_comment_grey_24dp" - android:drawablePadding="12dp" - android:gravity="center_vertical" - android:paddingTop="8dp" - android:paddingBottom="8dp" - android:paddingStart="12dp" - android:paddingEnd="12dp" - android:textSize="?attr/font_12" - android:textStyle="bold" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toEndOf="@id/minus_button_item_post_compact" - app:layout_constraintTop_toTopOf="parent" /> + <ImageView + android:id="@+id/plus_button_item_post_compact" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:background="?actionBarItemBackground" + android:clickable="true" + android:focusable="true" + android:paddingStart="12dp" + android:paddingTop="8dp" + android:paddingEnd="12dp" + android:paddingBottom="8dp" + android:src="@drawable/ic_arrow_upward_grey_24dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/score_text_view_item_post_compact" + android:layout_width="64dp" + android:layout_height="wrap_content" + android:fontFamily="?attr/font_family" + android:gravity="center" + android:textSize="?attr/font_12" + android:textStyle="bold" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toEndOf="@id/plus_button_item_post_compact" + app:layout_constraintTop_toTopOf="parent" /> + + <ImageView + android:id="@+id/minus_button_item_post_compact" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:background="?actionBarItemBackground" + android:clickable="true" + android:focusable="true" + android:paddingStart="12dp" + android:paddingTop="8dp" + android:paddingEnd="12dp" + android:paddingBottom="8dp" + android:src="@drawable/ic_arrow_downward_grey_24dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toEndOf="@id/score_text_view_item_post_compact" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/comments_count_item_post_compact" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:drawableStart="@drawable/ic_comment_grey_24dp" + android:drawablePadding="12dp" + android:fontFamily="?attr/font_family" + android:gravity="center_vertical" + android:paddingStart="12dp" + android:paddingTop="8dp" + android:paddingEnd="12dp" + android:paddingBottom="8dp" + android:textSize="?attr/font_12" + android:textStyle="bold" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toEndOf="@id/minus_button_item_post_compact" + app:layout_constraintTop_toTopOf="parent" /> + + <ImageView + android:id="@+id/save_button_item_post_compact" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:background="?actionBarItemBackground" + android:clickable="true" + android:focusable="true" + android:paddingStart="12dp" + android:paddingTop="8dp" + android:paddingEnd="12dp" + android:paddingBottom="8dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toStartOf="@id/share_button_item_post_compact" + app:layout_constraintHorizontal_bias="1" + app:layout_constraintStart_toEndOf="@id/comments_count_item_post_compact" + app:layout_constraintTop_toTopOf="parent" /> + + <ImageView + android:id="@+id/share_button_item_post_compact" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:background="?actionBarItemBackground" + android:clickable="true" + android:focusable="true" + android:paddingStart="12dp" + android:paddingTop="8dp" + android:paddingEnd="12dp" + android:paddingBottom="8dp" + android:src="@drawable/ic_share_grey_24dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - <ImageView - android:id="@+id/save_button_item_post_compact" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" - android:paddingTop="8dp" - android:paddingBottom="8dp" - android:paddingStart="12dp" - android:paddingEnd="12dp" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toStartOf="@id/share_button_item_post_compact" - app:layout_constraintHorizontal_bias="1" - app:layout_constraintStart_toEndOf="@id/comments_count_item_post_compact" - app:layout_constraintTop_toTopOf="parent" /> + </androidx.constraintlayout.widget.ConstraintLayout> - <ImageView - android:id="@+id/share_button_item_post_compact" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:background="?actionBarItemBackground" - android:clickable="true" - android:focusable="true" - android:paddingTop="8dp" - android:paddingBottom="8dp" - android:paddingStart="12dp" - android:paddingEnd="12dp" - android:src="@drawable/ic_share_grey_24dp" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toTopOf="parent" /> - - </androidx.constraintlayout.widget.ConstraintLayout> - - <View - android:id="@+id/divider_item_post_compact" - android:layout_width="match_parent" - android:layout_height="1dp" /> - - </LinearLayout> - -</com.google.android.material.card.MaterialCardView>
\ No newline at end of file + <View + android:id="@+id/divider_item_post_compact" + android:layout_width="match_parent" + android:layout_height="1dp" /> + +</LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/item_post_detail_image_and_gif_autoplay.xml b/app/src/main/res/layout/item_post_detail_image_and_gif_autoplay.xml index 3667d7b5..f4f88d5a 100644 --- a/app/src/main/res/layout/item_post_detail_image_and_gif_autoplay.xml +++ b/app/src/main/res/layout/item_post_detail_image_and_gif_autoplay.xml @@ -27,6 +27,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:maxLines="2" android:ellipsize="end" app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_image_and_gif_autoplay" @@ -41,6 +42,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:maxLines="2" android:ellipsize="end" app:layout_constraintBottom_toTopOf="@+id/author_flair_text_view_item_post_detail_image_and_gif_autoplay" @@ -56,6 +58,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:maxLines="2" android:ellipsize="end" android:visibility="gone" @@ -71,6 +74,7 @@ android:layout_height="wrap_content" android:gravity="end" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:layout_constraintHorizontal_bias="1" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/guideline" @@ -94,6 +98,7 @@ android:paddingEnd="16dp" android:textColor="?attr/primaryTextColor" android:textSize="?attr/title_font_18" + android:fontFamily="?attr/title_font_family" android:textIsSelectable="true" android:enabled="true" android:focusable="true" @@ -113,7 +118,7 @@ android:layout_height="wrap_content" android:padding="4dp" android:textSize="?attr/font_12" - android:textColor="@android:color/white" + android:fontFamily="?attr/font_family" app:lib_setRadius="3dp" app:lib_setRoundedView="true" app:lib_setShape="rectangle" /> @@ -125,7 +130,7 @@ android:layout_gravity="center" android:text="@string/spoiler" android:textSize="?attr/font_12" - android:textColor="@android:color/white" + android:fontFamily="?attr/font_family" android:padding="4dp" android:visibility="gone" app:lib_setRadius="3dp" @@ -139,7 +144,7 @@ android:padding="4dp" android:text="@string/nsfw" android:textSize="?attr/font_12" - android:textColor="@android:color/white" + android:fontFamily="?attr/font_family" android:visibility="gone" app:lib_setRadius="3dp" app:lib_setRoundedView="true" @@ -152,7 +157,7 @@ android:layout_gravity="center" android:padding="4dp" android:textSize="?attr/font_12" - android:textColor="@android:color/white" + android:fontFamily="?attr/font_family" android:visibility="gone" app:lib_setRadius="3dp" app:lib_setRoundedView="true" @@ -183,6 +188,8 @@ android:id="@+id/awards_text_view_item_post_detail_image_and_gif_autoplay" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:visibility="gone" /> </com.nex3z.flowlayout.FlowLayout> @@ -220,6 +227,7 @@ android:gravity="center" android:text="@string/error_loading_image_tap_to_retry" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:visibility="gone" /> </RelativeLayout> @@ -252,6 +260,7 @@ android:gravity="center" android:textSize="?attr/font_12" android:textStyle="bold" + android:fontFamily="?attr/font_family" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/plus_button_item_post_detail_image_and_gif_autoplay" /> @@ -278,6 +287,7 @@ android:gravity="center_vertical" android:textSize="?attr/font_12" android:textStyle="bold" + android:fontFamily="?attr/font_family" android:drawableStart="@drawable/ic_comment_grey_24dp" android:drawablePadding="12dp" app:layout_constraintTop_toTopOf="parent" diff --git a/app/src/main/res/layout/item_post_detail_link.xml b/app/src/main/res/layout/item_post_detail_link.xml index 1b8570da..c9e7bd2c 100644 --- a/app/src/main/res/layout/item_post_detail_link.xml +++ b/app/src/main/res/layout/item_post_detail_link.xml @@ -27,6 +27,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:maxLines="2" android:ellipsize="end" app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_link" @@ -41,6 +42,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:maxLines="2" android:ellipsize="end" app:layout_constraintBottom_toTopOf="@+id/author_flair_text_view_item_post_detail_link" @@ -56,6 +58,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:maxLines="2" android:ellipsize="end" android:visibility="gone" @@ -71,6 +74,7 @@ android:layout_height="wrap_content" android:gravity="end" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:layout_constraintHorizontal_bias="1" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/guideline" @@ -94,6 +98,7 @@ android:paddingEnd="16dp" android:textColor="?attr/primaryTextColor" android:textSize="?attr/title_font_18" + android:fontFamily="?attr/title_font_family" android:textIsSelectable="true" android:enabled="true" android:focusable="true" @@ -114,7 +119,7 @@ android:padding="4dp" android:text="@string/link" android:textSize="?attr/font_12" - android:textColor="@android:color/white" + android:fontFamily="?attr/font_family" app:lib_setRadius="3dp" app:lib_setRoundedView="true" app:lib_setShape="rectangle" /> @@ -126,7 +131,7 @@ android:layout_gravity="center" android:text="@string/spoiler" android:textSize="?attr/font_12" - android:textColor="@android:color/white" + android:fontFamily="?attr/font_family" android:padding="4dp" android:visibility="gone" app:lib_setRadius="3dp" @@ -140,7 +145,7 @@ android:padding="4dp" android:text="@string/nsfw" android:textSize="?attr/font_12" - android:textColor="@android:color/white" + android:fontFamily="?attr/font_family" android:visibility="gone" app:lib_setRadius="3dp" app:lib_setRoundedView="true" @@ -153,7 +158,7 @@ android:layout_gravity="center" android:padding="4dp" android:textSize="?attr/font_12" - android:textColor="@android:color/white" + android:fontFamily="?attr/font_family" android:visibility="gone" app:lib_setRadius="3dp" app:lib_setRoundedView="true" @@ -184,6 +189,8 @@ android:id="@+id/awards_text_view_item_post_detail_link" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:visibility="gone" /> </com.nex3z.flowlayout.FlowLayout> @@ -195,7 +202,8 @@ android:layout_marginBottom="16dp" android:paddingStart="16dp" android:paddingEnd="16dp" - android:textSize="?attr/font_12" /> + android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" /> <RelativeLayout android:id="@+id/image_view_wrapper_item_post_detail_link" @@ -230,6 +238,7 @@ android:gravity="center" android:text="@string/error_loading_image_tap_to_retry" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:visibility="gone" /> </RelativeLayout> @@ -262,6 +271,7 @@ android:gravity="center" android:textSize="?attr/font_12" android:textStyle="bold" + android:fontFamily="?attr/font_family" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/plus_button_item_post_detail_link" /> @@ -288,6 +298,7 @@ android:gravity="center_vertical" android:textSize="?attr/font_12" android:textStyle="bold" + android:fontFamily="?attr/font_family" android:drawableStart="@drawable/ic_comment_grey_24dp" android:drawablePadding="12dp" app:layout_constraintTop_toTopOf="parent" diff --git a/app/src/main/res/layout/item_post_detail_no_preview_link.xml b/app/src/main/res/layout/item_post_detail_no_preview_link.xml index 01e887fb..f294801a 100644 --- a/app/src/main/res/layout/item_post_detail_no_preview_link.xml +++ b/app/src/main/res/layout/item_post_detail_no_preview_link.xml @@ -27,6 +27,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:maxLines="2" android:ellipsize="end" app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_no_preview_link" @@ -41,6 +42,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:maxLines="2" android:ellipsize="end" app:layout_constraintBottom_toTopOf="@+id/author_flair_text_view_item_post_detail_no_preview_link" @@ -56,6 +58,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:maxLines="2" android:ellipsize="end" android:visibility="gone" @@ -71,6 +74,7 @@ android:layout_height="wrap_content" android:gravity="end" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:layout_constraintHorizontal_bias="1" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/guideline" @@ -94,6 +98,7 @@ android:paddingEnd="16dp" android:textColor="?attr/primaryTextColor" android:textSize="?attr/title_font_18" + android:fontFamily="?attr/title_font_family" android:textIsSelectable="true" android:enabled="true" android:focusable="true" @@ -103,9 +108,9 @@ android:id="@+id/content_markdown_view_item_post_detail_no_preview_link" android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_marginTop="16dp" - android:layout_marginStart="16dp" - android:layout_marginEnd="16dp" + android:layout_marginTop="8dp" + android:layout_marginStart="8dp" + android:layout_marginEnd="8dp" android:visibility="gone" /> <com.nex3z.flowlayout.FlowLayout @@ -123,7 +128,7 @@ android:padding="4dp" android:text="@string/link" android:textSize="?attr/font_12" - android:textColor="@android:color/white" + android:fontFamily="?attr/font_family" app:lib_setRadius="3dp" app:lib_setRoundedView="true" app:lib_setShape="rectangle" /> @@ -135,7 +140,7 @@ android:layout_gravity="center" android:text="@string/spoiler" android:textSize="?attr/font_12" - android:textColor="@android:color/white" + android:fontFamily="?attr/font_family" android:padding="4dp" android:visibility="gone" app:lib_setRadius="3dp" @@ -149,7 +154,7 @@ android:padding="4dp" android:text="@string/nsfw" android:textSize="?attr/font_12" - android:textColor="@android:color/white" + android:fontFamily="?attr/font_family" android:visibility="gone" app:lib_setRadius="3dp" app:lib_setRoundedView="true" @@ -162,7 +167,7 @@ android:layout_gravity="center" android:padding="4dp" android:textSize="?attr/font_12" - android:textColor="@android:color/white" + android:fontFamily="?attr/font_family" android:visibility="gone" app:lib_setRadius="3dp" app:lib_setRoundedView="true" @@ -193,6 +198,8 @@ android:id="@+id/awards_text_view_item_post_detail_no_preview_link" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:visibility="gone" /> </com.nex3z.flowlayout.FlowLayout> @@ -204,7 +211,8 @@ android:layout_marginBottom="16dp" android:paddingStart="16dp" android:paddingEnd="16dp" - android:textSize="?attr/font_12" /> + android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" /> <ImageView android:id="@+id/image_view_no_preview_link_item_post_detail_no_preview_link" @@ -240,6 +248,7 @@ android:gravity="center" android:textSize="?attr/font_12" android:textStyle="bold" + android:fontFamily="?attr/font_family" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/plus_button_item_post_detail_no_preview_link" /> @@ -266,6 +275,7 @@ android:gravity="center_vertical" android:textSize="?attr/font_12" android:textStyle="bold" + android:fontFamily="?attr/font_family" android:drawableStart="@drawable/ic_comment_grey_24dp" android:drawablePadding="12dp" app:layout_constraintTop_toTopOf="parent" diff --git a/app/src/main/res/layout/item_post_detail_text.xml b/app/src/main/res/layout/item_post_detail_text.xml index 00b81547..7828687d 100644 --- a/app/src/main/res/layout/item_post_detail_text.xml +++ b/app/src/main/res/layout/item_post_detail_text.xml @@ -27,6 +27,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:maxLines="2" android:ellipsize="end" app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_text" @@ -41,6 +42,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:maxLines="2" android:ellipsize="end" app:layout_constraintBottom_toTopOf="@+id/author_flair_text_view_item_post_detail_text" @@ -56,6 +58,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:maxLines="2" android:ellipsize="end" android:visibility="gone" @@ -71,6 +74,7 @@ android:layout_height="wrap_content" android:gravity="end" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:layout_constraintHorizontal_bias="1" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/guideline" @@ -94,6 +98,7 @@ android:paddingEnd="16dp" android:textColor="?attr/primaryTextColor" android:textSize="?attr/title_font_18" + android:fontFamily="?attr/title_font_family" android:textIsSelectable="true" android:enabled="true" android:focusable="true" @@ -103,9 +108,9 @@ android:id="@+id/content_markdown_view_item_post_detail_text" android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_marginTop="16dp" - android:layout_marginStart="16dp" - android:layout_marginEnd="16dp" + android:layout_marginTop="8dp" + android:layout_marginStart="8dp" + android:layout_marginEnd="8dp" android:visibility="gone" /> <com.nex3z.flowlayout.FlowLayout @@ -123,7 +128,7 @@ android:padding="4dp" android:text="@string/text" android:textSize="?attr/font_12" - android:textColor="@android:color/white" + android:fontFamily="?attr/font_family" app:lib_setRadius="3dp" app:lib_setRoundedView="true" app:lib_setShape="rectangle" /> @@ -135,7 +140,7 @@ android:layout_gravity="center" android:text="@string/spoiler" android:textSize="?attr/font_12" - android:textColor="@android:color/white" + android:fontFamily="?attr/font_family" android:padding="4dp" android:visibility="gone" app:lib_setRadius="3dp" @@ -149,7 +154,7 @@ android:padding="4dp" android:text="@string/nsfw" android:textSize="?attr/font_12" - android:textColor="@android:color/white" + android:fontFamily="?attr/font_family" android:visibility="gone" app:lib_setRadius="3dp" app:lib_setRoundedView="true" @@ -162,7 +167,7 @@ android:layout_gravity="center" android:padding="4dp" android:textSize="?attr/font_12" - android:textColor="@android:color/white" + android:fontFamily="?attr/font_family" android:visibility="gone" app:lib_setRadius="3dp" app:lib_setRoundedView="true" @@ -193,6 +198,8 @@ android:id="@+id/awards_text_view_item_post_detail_text" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:visibility="gone" /> </com.nex3z.flowlayout.FlowLayout> @@ -223,6 +230,7 @@ android:gravity="center" android:textSize="?attr/font_12" android:textStyle="bold" + android:fontFamily="?attr/font_family" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/plus_button_item_post_detail_text" /> @@ -249,6 +257,7 @@ android:gravity="center_vertical" android:textSize="?attr/font_12" android:textStyle="bold" + android:fontFamily="?attr/font_family" android:drawableStart="@drawable/ic_comment_grey_24dp" android:drawablePadding="12dp" app:layout_constraintTop_toTopOf="parent" diff --git a/app/src/main/res/layout/item_post_detail_video_and_gif_preview.xml b/app/src/main/res/layout/item_post_detail_video_and_gif_preview.xml index 5de14a3e..c4b36198 100644 --- a/app/src/main/res/layout/item_post_detail_video_and_gif_preview.xml +++ b/app/src/main/res/layout/item_post_detail_video_and_gif_preview.xml @@ -27,6 +27,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:maxLines="2" android:ellipsize="end" app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_video_and_gif_preview" @@ -41,6 +42,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:maxLines="2" android:ellipsize="end" app:layout_constraintBottom_toTopOf="@+id/author_flair_text_view_item_post_detail_video_and_gif_preview" @@ -56,6 +58,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:maxLines="2" android:ellipsize="end" android:visibility="gone" @@ -71,6 +74,7 @@ android:layout_height="wrap_content" android:gravity="end" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:layout_constraintHorizontal_bias="1" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/guideline" @@ -94,6 +98,7 @@ android:paddingEnd="16dp" android:textColor="?attr/primaryTextColor" android:textSize="?attr/title_font_18" + android:fontFamily="?attr/title_font_family" android:textIsSelectable="true" android:enabled="true" android:focusable="true" @@ -113,7 +118,7 @@ android:layout_height="wrap_content" android:padding="4dp" android:textSize="?attr/font_12" - android:textColor="@android:color/white" + android:fontFamily="?attr/font_family" app:lib_setRadius="3dp" app:lib_setRoundedView="true" app:lib_setShape="rectangle" /> @@ -125,7 +130,7 @@ android:layout_gravity="center" android:text="@string/spoiler" android:textSize="?attr/font_12" - android:textColor="@android:color/white" + android:fontFamily="?attr/font_family" android:padding="4dp" android:visibility="gone" app:lib_setRadius="3dp" @@ -139,7 +144,7 @@ android:padding="4dp" android:text="@string/nsfw" android:textSize="?attr/font_12" - android:textColor="@android:color/white" + android:fontFamily="?attr/font_family" android:visibility="gone" app:lib_setRadius="3dp" app:lib_setRoundedView="true" @@ -152,7 +157,7 @@ android:layout_gravity="center" android:padding="4dp" android:textSize="?attr/font_12" - android:textColor="@android:color/white" + android:fontFamily="?attr/font_family" android:visibility="gone" app:lib_setRadius="3dp" app:lib_setRoundedView="true" @@ -183,6 +188,8 @@ android:id="@+id/awards_text_view_item_post_detail_video_and_gif_preview" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:visibility="gone" /> </com.nex3z.flowlayout.FlowLayout> @@ -233,6 +240,7 @@ android:gravity="center" android:text="@string/error_loading_image_tap_to_retry" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:visibility="gone" /> </RelativeLayout> @@ -265,6 +273,7 @@ android:gravity="center" android:textSize="?attr/font_12" android:textStyle="bold" + android:fontFamily="?attr/font_family" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/plus_button_item_post_detail_video_and_gif_preview" /> @@ -291,6 +300,7 @@ android:gravity="center_vertical" android:textSize="?attr/font_12" android:textStyle="bold" + android:fontFamily="?attr/font_family" android:drawableStart="@drawable/ic_comment_grey_24dp" android:drawablePadding="12dp" app:layout_constraintTop_toTopOf="parent" diff --git a/app/src/main/res/layout/item_post_detail_video_autoplay.xml b/app/src/main/res/layout/item_post_detail_video_autoplay.xml index b73fae27..6ee5736a 100644 --- a/app/src/main/res/layout/item_post_detail_video_autoplay.xml +++ b/app/src/main/res/layout/item_post_detail_video_autoplay.xml @@ -27,6 +27,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:maxLines="2" android:ellipsize="end" app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail_video_autoplay" @@ -41,6 +42,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:maxLines="2" android:ellipsize="end" app:layout_constraintBottom_toTopOf="@+id/author_flair_text_view_item_post_detail_video_autoplay" @@ -56,6 +58,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:maxLines="2" android:ellipsize="end" android:visibility="gone" @@ -71,6 +74,7 @@ android:layout_height="wrap_content" android:gravity="end" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:layout_constraintHorizontal_bias="1" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/guideline" @@ -94,6 +98,7 @@ android:paddingEnd="16dp" android:textColor="?attr/primaryTextColor" android:textSize="?attr/title_font_18" + android:fontFamily="?attr/title_font_family" android:textIsSelectable="true" android:enabled="true" android:focusable="true" @@ -114,7 +119,7 @@ android:padding="4dp" android:text="@string/video" android:textSize="?attr/font_12" - android:textColor="@android:color/white" + android:fontFamily="?attr/font_family" app:lib_setRadius="3dp" app:lib_setRoundedView="true" app:lib_setShape="rectangle" /> @@ -126,7 +131,7 @@ android:layout_gravity="center" android:text="@string/spoiler" android:textSize="?attr/font_12" - android:textColor="@android:color/white" + android:fontFamily="?attr/font_family" android:padding="4dp" android:visibility="gone" app:lib_setRadius="3dp" @@ -140,7 +145,7 @@ android:padding="4dp" android:text="@string/nsfw" android:textSize="?attr/font_12" - android:textColor="@android:color/white" + android:fontFamily="?attr/font_family" android:visibility="gone" app:lib_setRadius="3dp" app:lib_setRoundedView="true" @@ -153,7 +158,7 @@ android:layout_gravity="center" android:padding="4dp" android:textSize="?attr/font_12" - android:textColor="@android:color/white" + android:fontFamily="?attr/font_family" android:visibility="gone" app:lib_setRadius="3dp" app:lib_setRoundedView="true" @@ -184,6 +189,8 @@ android:id="@+id/awards_text_view_item_post_detail_video_autoplay" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:visibility="gone" /> </com.nex3z.flowlayout.FlowLayout> @@ -229,6 +236,7 @@ android:gravity="center" android:textSize="?attr/font_12" android:textStyle="bold" + android:fontFamily="?attr/font_family" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/plus_button_item_post_detail_video_autoplay" /> @@ -255,6 +263,7 @@ android:gravity="center_vertical" android:textSize="?attr/font_12" android:textStyle="bold" + android:fontFamily="?attr/font_family" android:drawableStart="@drawable/ic_comment_grey_24dp" android:drawablePadding="12dp" app:layout_constraintTop_toTopOf="parent" diff --git a/app/src/main/res/layout/item_post_image_and_gif_autoplay.xml b/app/src/main/res/layout/item_post_image_and_gif_autoplay.xml index e29f4287..39bf4933 100644 --- a/app/src/main/res/layout/item_post_image_and_gif_autoplay.xml +++ b/app/src/main/res/layout/item_post_image_and_gif_autoplay.xml @@ -37,6 +37,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:layout_constraintBottom_toTopOf="@id/user_text_view_item_post_image_and_gif_autoplay" app:layout_constraintStart_toEndOf="@id/icon_gif_image_view_item_post_image_and_gif_autoplay" app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_image_and_gif_autoplay" @@ -49,6 +50,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:maxLines="2" android:ellipsize="end" app:layout_constraintBottom_toBottomOf="parent" @@ -74,6 +76,7 @@ android:layout_height="wrap_content" android:gravity="end" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@id/guideline2" @@ -94,7 +97,8 @@ android:layout_height="wrap_content" android:paddingStart="16dp" android:paddingEnd="16dp" - android:textSize="?attr/title_font_18" /> + android:textSize="?attr/title_font_18" + android:fontFamily="?attr/title_font_family" /> <com.nex3z.flowlayout.FlowLayout android:layout_width="match_parent" @@ -110,6 +114,7 @@ android:layout_height="wrap_content" android:padding="4dp" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" app:lib_setRadius="3dp" app:lib_setRoundedView="true" app:lib_setShape="rectangle" /> @@ -121,6 +126,7 @@ android:layout_gravity="center" android:text="@string/spoiler" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:padding="4dp" android:visibility="gone" app:lib_setRadius="3dp" @@ -134,6 +140,7 @@ android:padding="4dp" android:text="@string/nsfw" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:visibility="gone" app:lib_setRadius="3dp" app:lib_setRoundedView="true" @@ -145,6 +152,7 @@ android:layout_height="wrap_content" android:layout_gravity="center" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:padding="4dp" android:visibility="gone" app:lib_setRadius="3dp" @@ -157,6 +165,7 @@ android:layout_height="wrap_content" android:padding="4dp" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:visibility="gone" app:lib_setRadius="3dp" app:lib_setRoundedView="true" @@ -217,7 +226,8 @@ android:layout_gravity="center" android:gravity="center" android:text="@string/error_loading_image_tap_to_retry" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </RelativeLayout> @@ -248,6 +258,7 @@ android:gravity="center" android:textSize="?attr/font_12" android:textStyle="bold" + android:fontFamily="?attr/font_family" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/plus_button_item_post_image_and_gif_autoplay" /> @@ -273,6 +284,7 @@ android:gravity="center_vertical" android:textSize="?attr/font_12" android:textStyle="bold" + android:fontFamily="?attr/font_family" android:drawableStart="@drawable/ic_comment_grey_24dp" android:drawablePadding="12dp" app:layout_constraintTop_toTopOf="parent" diff --git a/app/src/main/res/layout/item_post_link.xml b/app/src/main/res/layout/item_post_link.xml index 66c55908..d6965fca 100644 --- a/app/src/main/res/layout/item_post_link.xml +++ b/app/src/main/res/layout/item_post_link.xml @@ -37,6 +37,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:layout_constraintBottom_toTopOf="@id/user_text_view_item_post_link" app:layout_constraintStart_toEndOf="@id/icon_gif_image_view_item_post_link" app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_link" @@ -49,6 +50,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:maxLines="2" android:ellipsize="end" app:layout_constraintBottom_toBottomOf="parent" @@ -74,6 +76,7 @@ android:layout_height="wrap_content" android:gravity="end" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@id/guideline2" @@ -94,7 +97,8 @@ android:layout_height="wrap_content" android:paddingStart="16dp" android:paddingEnd="16dp" - android:textSize="?attr/title_font_18" /> + android:textSize="?attr/title_font_18" + android:fontFamily="?attr/title_font_family" /> <com.nex3z.flowlayout.FlowLayout android:layout_width="match_parent" @@ -111,6 +115,7 @@ android:padding="4dp" android:text="@string/link" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" app:lib_setRadius="3dp" app:lib_setRoundedView="true" app:lib_setShape="rectangle" /> @@ -122,6 +127,7 @@ android:layout_gravity="center" android:text="@string/spoiler" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:padding="4dp" android:visibility="gone" app:lib_setRadius="3dp" @@ -135,6 +141,7 @@ android:padding="4dp" android:text="@string/nsfw" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:visibility="gone" app:lib_setRadius="3dp" app:lib_setRoundedView="true" @@ -146,6 +153,7 @@ android:layout_height="wrap_content" android:layout_gravity="center" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:padding="4dp" android:visibility="gone" app:lib_setRadius="3dp" @@ -158,6 +166,7 @@ android:layout_height="wrap_content" android:padding="4dp" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:visibility="gone" app:lib_setRadius="3dp" app:lib_setRoundedView="true" @@ -194,6 +203,7 @@ android:paddingStart="16dp" android:paddingEnd="16dp" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:visibility="gone" /> <RelativeLayout @@ -228,7 +238,8 @@ android:layout_gravity="center" android:gravity="center" android:text="@string/error_loading_image_tap_to_retry" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </RelativeLayout> @@ -259,6 +270,7 @@ android:gravity="center" android:textSize="?attr/font_12" android:textStyle="bold" + android:fontFamily="?attr/font_family" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/plus_button_item_post_link" /> @@ -284,6 +296,7 @@ android:gravity="center_vertical" android:textSize="?attr/font_12" android:textStyle="bold" + android:fontFamily="?attr/font_family" android:drawableStart="@drawable/ic_comment_grey_24dp" android:drawablePadding="12dp" app:layout_constraintTop_toTopOf="parent" diff --git a/app/src/main/res/layout/item_post_no_preview_link.xml b/app/src/main/res/layout/item_post_no_preview_link.xml index bf1ba331..39396df9 100644 --- a/app/src/main/res/layout/item_post_no_preview_link.xml +++ b/app/src/main/res/layout/item_post_no_preview_link.xml @@ -37,6 +37,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:layout_constraintBottom_toTopOf="@id/user_text_view_item_post_no_preview_link_type" app:layout_constraintStart_toEndOf="@id/icon_gif_image_view_item_post_no_preview_link_type" app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_no_preview_link_type" @@ -49,6 +50,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:maxLines="2" android:ellipsize="end" app:layout_constraintBottom_toBottomOf="parent" @@ -74,6 +76,7 @@ android:layout_height="wrap_content" android:gravity="end" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@id/guideline2" @@ -94,7 +97,8 @@ android:layout_height="wrap_content" android:paddingStart="16dp" android:paddingEnd="16dp" - android:textSize="?attr/title_font_18" /> + android:textSize="?attr/title_font_18" + android:fontFamily="?attr/title_font_family" /> <com.nex3z.flowlayout.FlowLayout android:layout_width="match_parent" @@ -111,6 +115,7 @@ android:padding="4dp" android:text="@string/link" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" app:lib_setRadius="3dp" app:lib_setRoundedView="true" app:lib_setShape="rectangle" /> @@ -122,6 +127,7 @@ android:layout_gravity="center" android:text="@string/spoiler" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:padding="4dp" android:visibility="gone" app:lib_setRadius="3dp" @@ -135,6 +141,7 @@ android:padding="4dp" android:text="@string/nsfw" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:visibility="gone" app:lib_setRadius="3dp" app:lib_setRoundedView="true" @@ -146,6 +153,7 @@ android:layout_height="wrap_content" android:layout_gravity="center" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:padding="4dp" android:visibility="gone" app:lib_setRadius="3dp" @@ -158,6 +166,7 @@ android:layout_height="wrap_content" android:padding="4dp" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:visibility="gone" app:lib_setRadius="3dp" app:lib_setRoundedView="true" @@ -193,7 +202,8 @@ android:layout_marginBottom="16dp" android:paddingStart="16dp" android:paddingEnd="16dp" - android:textSize="?attr/font_12" /> + android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" /> <ImageView android:id="@+id/image_view_no_preview_link_item_post_no_preview_link_type" @@ -228,6 +238,7 @@ android:gravity="center" android:textSize="?attr/font_12" android:textStyle="bold" + android:fontFamily="?attr/font_family" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/plus_button_item_post_no_preview_link_type" /> @@ -253,6 +264,7 @@ android:gravity="center_vertical" android:textSize="?attr/font_12" android:textStyle="bold" + android:fontFamily="?attr/font_family" android:drawableStart="@drawable/ic_comment_grey_24dp" android:drawablePadding="12dp" app:layout_constraintTop_toTopOf="parent" diff --git a/app/src/main/res/layout/item_post_text.xml b/app/src/main/res/layout/item_post_text.xml index 39ea56f4..c79fd6fc 100644 --- a/app/src/main/res/layout/item_post_text.xml +++ b/app/src/main/res/layout/item_post_text.xml @@ -37,6 +37,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:layout_constraintBottom_toTopOf="@id/user_text_view_item_post_text_type" app:layout_constraintStart_toEndOf="@id/icon_gif_image_view_item_post_text_type" app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_text_type" @@ -49,6 +50,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:maxLines="2" android:ellipsize="end" app:layout_constraintBottom_toBottomOf="parent" @@ -74,6 +76,7 @@ android:layout_height="wrap_content" android:gravity="end" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@id/guideline2" @@ -94,7 +97,8 @@ android:layout_height="wrap_content" android:paddingStart="16dp" android:paddingEnd="16dp" - android:textSize="?attr/title_font_18" /> + android:textSize="?attr/title_font_18" + android:fontFamily="?attr/title_font_family" /> <TextView android:id="@+id/content_text_view_item_post_text_type" @@ -106,6 +110,7 @@ android:maxLines="4" android:visibility="gone" android:textSize="?attr/content_font_default" + android:fontFamily="?attr/content_font_family" android:ellipsize="end" /> <com.nex3z.flowlayout.FlowLayout @@ -123,6 +128,7 @@ android:padding="4dp" android:text="@string/text" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" app:lib_setRadius="3dp" app:lib_setRoundedView="true" app:lib_setShape="rectangle" /> @@ -134,6 +140,7 @@ android:layout_gravity="center" android:text="@string/spoiler" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:padding="4dp" android:visibility="gone" app:lib_setRadius="3dp" @@ -147,6 +154,7 @@ android:padding="4dp" android:text="@string/nsfw" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:visibility="gone" app:lib_setRadius="3dp" app:lib_setRoundedView="true" @@ -158,6 +166,7 @@ android:layout_height="wrap_content" android:layout_gravity="center" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:padding="4dp" android:visibility="gone" app:lib_setRadius="3dp" @@ -170,6 +179,7 @@ android:layout_height="wrap_content" android:padding="4dp" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:visibility="gone" app:lib_setRadius="3dp" app:lib_setRoundedView="true" @@ -222,6 +232,7 @@ android:layout_height="wrap_content" android:gravity="center" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:textStyle="bold" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" @@ -247,6 +258,7 @@ android:padding="12dp" android:gravity="center_vertical" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:textStyle="bold" android:drawableStart="@drawable/ic_comment_grey_24dp" android:drawablePadding="12dp" diff --git a/app/src/main/res/layout/item_post_video_and_gif_preview.xml b/app/src/main/res/layout/item_post_video_and_gif_preview.xml index ad2e3b9d..738f1edf 100644 --- a/app/src/main/res/layout/item_post_video_and_gif_preview.xml +++ b/app/src/main/res/layout/item_post_video_and_gif_preview.xml @@ -37,6 +37,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:layout_constraintBottom_toTopOf="@id/user_text_view_item_post_video_and_gif_preview" app:layout_constraintStart_toEndOf="@id/icon_gif_image_view_item_post_video_and_gif_preview" app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_video_and_gif_preview" @@ -49,6 +50,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:maxLines="2" android:ellipsize="end" app:layout_constraintBottom_toBottomOf="parent" @@ -74,6 +76,7 @@ android:layout_height="wrap_content" android:gravity="end" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@id/guideline2" @@ -94,7 +97,8 @@ android:layout_height="wrap_content" android:paddingStart="16dp" android:paddingEnd="16dp" - android:textSize="?attr/title_font_18" /> + android:textSize="?attr/title_font_18" + android:fontFamily="?attr/title_font_family" /> <com.nex3z.flowlayout.FlowLayout android:layout_width="match_parent" @@ -111,6 +115,7 @@ android:padding="4dp" android:text="@string/gif" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" app:lib_setRadius="3dp" app:lib_setRoundedView="true" app:lib_setShape="rectangle" /> @@ -122,6 +127,7 @@ android:layout_gravity="center" android:text="@string/spoiler" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:padding="4dp" android:visibility="gone" app:lib_setRadius="3dp" @@ -135,6 +141,7 @@ android:padding="4dp" android:text="@string/nsfw" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:visibility="gone" app:lib_setRadius="3dp" app:lib_setRoundedView="true" @@ -146,6 +153,7 @@ android:layout_height="wrap_content" android:layout_gravity="center" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:padding="4dp" android:visibility="gone" app:lib_setRadius="3dp" @@ -158,6 +166,7 @@ android:layout_height="wrap_content" android:padding="4dp" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:visibility="gone" app:lib_setRadius="3dp" app:lib_setRoundedView="true" @@ -232,7 +241,8 @@ android:layout_gravity="center" android:gravity="center" android:text="@string/error_loading_image_tap_to_retry" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </RelativeLayout> @@ -263,6 +273,7 @@ android:gravity="center" android:textSize="?attr/font_12" android:textStyle="bold" + android:fontFamily="?attr/font_family" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/plus_button_item_post_video_and_gif_preview" /> @@ -288,6 +299,7 @@ android:gravity="center_vertical" android:textSize="?attr/font_12" android:textStyle="bold" + android:fontFamily="?attr/font_family" android:drawableStart="@drawable/ic_comment_grey_24dp" android:drawablePadding="12dp" app:layout_constraintTop_toTopOf="parent" diff --git a/app/src/main/res/layout/item_post_video_type_autoplay.xml b/app/src/main/res/layout/item_post_video_type_autoplay.xml index bfbc7456..5db83d38 100644 --- a/app/src/main/res/layout/item_post_video_type_autoplay.xml +++ b/app/src/main/res/layout/item_post_video_type_autoplay.xml @@ -37,6 +37,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:layout_constraintBottom_toTopOf="@id/user_text_view_item_post_video_type_autoplay" app:layout_constraintStart_toEndOf="@id/icon_gif_image_view_item_post_video_type_autoplay" app:layout_constraintEnd_toStartOf="@id/stickied_post_image_view_item_post_video_type_autoplay" @@ -49,6 +50,7 @@ android:layout_marginStart="16dp" android:layout_marginEnd="8dp" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:maxLines="2" android:ellipsize="end" app:layout_constraintBottom_toBottomOf="parent" @@ -74,6 +76,7 @@ android:layout_height="wrap_content" android:gravity="end" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@id/guideline2" @@ -94,7 +97,8 @@ android:layout_height="wrap_content" android:paddingStart="16dp" android:paddingEnd="16dp" - android:textSize="?attr/title_font_18" /> + android:textSize="?attr/title_font_18" + android:fontFamily="?attr/title_font_family" /> <com.nex3z.flowlayout.FlowLayout android:layout_width="match_parent" @@ -111,6 +115,7 @@ android:padding="4dp" android:text="@string/video" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" app:lib_setRadius="3dp" app:lib_setRoundedView="true" app:lib_setShape="rectangle" /> @@ -122,6 +127,7 @@ android:layout_gravity="center" android:text="@string/spoiler" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:padding="4dp" android:visibility="gone" app:lib_setRadius="3dp" @@ -135,6 +141,7 @@ android:padding="4dp" android:text="@string/nsfw" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:visibility="gone" app:lib_setRadius="3dp" app:lib_setRoundedView="true" @@ -146,6 +153,7 @@ android:layout_height="wrap_content" android:layout_gravity="center" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:padding="4dp" android:visibility="gone" app:lib_setRadius="3dp" @@ -158,6 +166,7 @@ android:layout_height="wrap_content" android:padding="4dp" android:textSize="?attr/font_12" + android:fontFamily="?attr/font_family" android:visibility="gone" app:lib_setRadius="3dp" app:lib_setRoundedView="true" @@ -226,6 +235,7 @@ android:gravity="center" android:textSize="?attr/font_12" android:textStyle="bold" + android:fontFamily="?attr/font_family" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/plus_button_item_post_video_type_autoplay" /> @@ -251,6 +261,7 @@ android:gravity="center_vertical" android:textSize="?attr/font_12" android:textStyle="bold" + android:fontFamily="?attr/font_family" android:drawableStart="@drawable/ic_comment_grey_24dp" android:drawablePadding="12dp" app:layout_constraintTop_toTopOf="parent" diff --git a/app/src/main/res/layout/item_predefined_custom_theme.xml b/app/src/main/res/layout/item_predefined_custom_theme.xml index 56b97f88..6c7ebf82 100644 --- a/app/src/main/res/layout/item_predefined_custom_theme.xml +++ b/app/src/main/res/layout/item_predefined_custom_theme.xml @@ -22,7 +22,8 @@ android:layout_marginStart="32dp" android:layout_gravity="center_vertical" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> <ImageView android:id="@+id/add_image_view_item_predefined_custom_theme" diff --git a/app/src/main/res/layout/item_report_reason.xml b/app/src/main/res/layout/item_report_reason.xml index 08d6900b..df95e799 100644 --- a/app/src/main/res/layout/item_report_reason.xml +++ b/app/src/main/res/layout/item_report_reason.xml @@ -17,8 +17,8 @@ android:layout_weight="1" android:layout_gravity="center_vertical" android:layout_marginEnd="32dp" - android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> <CheckBox android:id="@+id/check_box_item_report_reason" diff --git a/app/src/main/res/layout/item_rule.xml b/app/src/main/res/layout/item_rule.xml index 8b003197..1003f6c5 100644 --- a/app/src/main/res/layout/item_rule.xml +++ b/app/src/main/res/layout/item_rule.xml @@ -8,8 +8,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="16dp" - android:textColor="?attr/primaryTextColor" - android:textSize="?attr/title_font_16" /> + android:textSize="?attr/title_font_16" + android:fontFamily="?attr/font_family" /> <TextView android:id="@+id/description_markwon_view_item_rule" @@ -18,6 +18,7 @@ android:paddingBottom="16dp" android:paddingStart="16dp" android:paddingEnd="16dp" - android:textSize="?attr/content_font_default" /> + android:textSize="?attr/content_font_default" + android:fontFamily="?attr/font_family" /> </LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/item_selected_subreddit.xml b/app/src/main/res/layout/item_selected_subreddit.xml index 9653e179..6e1a570a 100644 --- a/app/src/main/res/layout/item_selected_subreddit.xml +++ b/app/src/main/res/layout/item_selected_subreddit.xml @@ -13,7 +13,9 @@ android:layout_height="wrap_content" android:layout_weight="1" android:layout_gravity="center_vertical" - android:layout_marginEnd="16dp" /> + android:layout_marginEnd="16dp" + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> <ImageView android:id="@+id/delete_image_view_item_selected_subreddit" diff --git a/app/src/main/res/layout/item_subreddit_listing.xml b/app/src/main/res/layout/item_subreddit_listing.xml index 30a6fe90..da9c0044 100644 --- a/app/src/main/res/layout/item_subreddit_listing.xml +++ b/app/src/main/res/layout/item_subreddit_listing.xml @@ -24,8 +24,8 @@ android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_marginStart="32dp" - android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@+id/subreddit_icon_gif_image_view_item_subreddit_listing" app:layout_constraintTop_toTopOf="parent" /> diff --git a/app/src/main/res/layout/item_subscribed_subreddit_multi_selection.xml b/app/src/main/res/layout/item_subscribed_subreddit_multi_selection.xml index 1f62ae81..a67dbaf2 100644 --- a/app/src/main/res/layout/item_subscribed_subreddit_multi_selection.xml +++ b/app/src/main/res/layout/item_subscribed_subreddit_multi_selection.xml @@ -25,8 +25,8 @@ android:layout_weight="1" android:layout_gravity="center_vertical" android:layout_marginEnd="32dp" - android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> <CheckBox android:id="@+id/checkbox_item_subscribed_subreddit_multiselection" diff --git a/app/src/main/res/layout/item_subscribed_thing.xml b/app/src/main/res/layout/item_subscribed_thing.xml index 0507fac4..83a12a8a 100644 --- a/app/src/main/res/layout/item_subscribed_thing.xml +++ b/app/src/main/res/layout/item_subscribed_thing.xml @@ -20,8 +20,8 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" - android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:layout_gravity="center_vertical" /> <ImageView diff --git a/app/src/main/res/layout/item_theme_name.xml b/app/src/main/res/layout/item_theme_name.xml index c08f517d..4daded11 100644 --- a/app/src/main/res/layout/item_theme_name.xml +++ b/app/src/main/res/layout/item_theme_name.xml @@ -12,7 +12,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_16" /> + android:textSize="?attr/font_16" + android:fontFamily="?attr/font_family" /> <TextView android:id="@+id/description_text_view_item_theme_name" @@ -21,6 +22,7 @@ android:layout_marginTop="4dp" android:text="@string/theme_name_description" android:textColor="?attr/secondaryTextColor" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> </LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/item_theme_type_divider.xml b/app/src/main/res/layout/item_theme_type_divider.xml index ebeeefd9..7338064c 100644 --- a/app/src/main/res/layout/item_theme_type_divider.xml +++ b/app/src/main/res/layout/item_theme_type_divider.xml @@ -3,4 +3,5 @@ android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="16dp" - android:textSize="?attr/font_default" />
\ No newline at end of file + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" />
\ No newline at end of file diff --git a/app/src/main/res/layout/item_user_custom_theme.xml b/app/src/main/res/layout/item_user_custom_theme.xml index 6f088b8f..03bfed78 100644 --- a/app/src/main/res/layout/item_user_custom_theme.xml +++ b/app/src/main/res/layout/item_user_custom_theme.xml @@ -22,7 +22,8 @@ android:layout_marginStart="32dp" android:layout_gravity="center_vertical" android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> <ImageView android:id="@+id/share_image_view_item_user_custom_theme" diff --git a/app/src/main/res/layout/item_user_listing.xml b/app/src/main/res/layout/item_user_listing.xml index 522b2e42..5178c5be 100644 --- a/app/src/main/res/layout/item_user_listing.xml +++ b/app/src/main/res/layout/item_user_listing.xml @@ -24,8 +24,8 @@ android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_marginStart="32dp" - android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@+id/user_icon_gif_image_view_item_user_listing" app:layout_constraintTop_toTopOf="parent" /> diff --git a/app/src/main/res/layout/item_view_all_comments.xml b/app/src/main/res/layout/item_view_all_comments.xml index 28816da4..713d8ace 100644 --- a/app/src/main/res/layout/item_view_all_comments.xml +++ b/app/src/main/res/layout/item_view_all_comments.xml @@ -8,5 +8,5 @@ android:clickable="true" android:focusable="true" android:text="@string/view_all_comments" - android:textColor="?attr/colorAccent" - android:textSize="?attr/font_default" />
\ No newline at end of file + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" />
\ No newline at end of file diff --git a/app/src/main/res/layout/nav_header_main.xml b/app/src/main/res/layout/nav_header_main.xml index bd578e0d..8ccdbe04 100644 --- a/app/src/main/res/layout/nav_header_main.xml +++ b/app/src/main/res/layout/nav_header_main.xml @@ -32,6 +32,7 @@ android:layout_alignParentStart="true" android:textAppearance="@style/TextAppearance.AppCompat.Body1" android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" android:layout_below="@id/profile_image_view_nav_header_main" android:layout_toStartOf="@id/account_switcher_image_view_nav_header_main" /> @@ -44,7 +45,8 @@ android:layout_alignParentStart="true" android:layout_below="@id/name_text_view_nav_header_main" android:layout_toStartOf="@id/account_switcher_image_view_nav_header_main" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> <ImageView android:id="@+id/account_switcher_image_view_nav_header_main" diff --git a/app/src/main/res/layout/view_table_entry_cell.xml b/app/src/main/res/layout/view_table_entry_cell.xml index 6d544918..0430660c 100644 --- a/app/src/main/res/layout/view_table_entry_cell.xml +++ b/app/src/main/res/layout/view_table_entry_cell.xml @@ -6,4 +6,5 @@ android:textAppearance="?android:attr/textAppearanceMedium" android:textColor="#000" android:textSize="16sp" + android:fontFamily="?attr/font_family" tools:text="Table content" />
\ No newline at end of file diff --git a/app/src/main/res/menu/view_gif_activity.xml b/app/src/main/res/menu/view_gif_activity.xml deleted file mode 100644 index 0dc5aba5..00000000 --- a/app/src/main/res/menu/view_gif_activity.xml +++ /dev/null @@ -1,17 +0,0 @@ -<?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_download_view_gif_activity" - android:orderInCategory="1" - android:title="@string/action_download" - android:icon="@drawable/ic_file_download_toolbar_white_24dp" - app:showAsAction="ifRoom" /> - - <item - android:id="@+id/action_share_view_gif_activity" - android:orderInCategory="2" - android:title="@string/action_share" - android:icon="@drawable/ic_share_toolbar_white_24dp" - app:showAsAction="ifRoom" /> -</menu>
\ No newline at end of file diff --git a/app/src/main/res/menu/view_image_activity.xml b/app/src/main/res/menu/view_image_or_gif_activity.xml index 1f86092b..682516a4 100644 --- a/app/src/main/res/menu/view_image_activity.xml +++ b/app/src/main/res/menu/view_image_or_gif_activity.xml @@ -2,16 +2,23 @@ <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item - android:id="@+id/action_download_view_image_activity" + android:id="@+id/action_download_view_image_or_gif_activity" + android:icon="@drawable/ic_file_download_toolbar_white_24dp" android:orderInCategory="1" android:title="@string/action_download" - android:icon="@drawable/ic_file_download_toolbar_white_24dp" app:showAsAction="ifRoom" /> <item - android:id="@+id/action_share_view_image_activity" + android:id="@+id/action_share_view_image_or_gif_activity" + android:icon="@drawable/ic_share_toolbar_white_24dp" android:orderInCategory="2" android:title="@string/action_share" - android:icon="@drawable/ic_share_toolbar_white_24dp" app:showAsAction="ifRoom" /> -</menu>
\ No newline at end of file + + <item + android:id="@+id/action_set_wallpaper_view_image_or_gif_activity" + android:orderInCategory="3" + android:title="@string/action_set_wallpaper" + android:visible="false" + app:showAsAction="never" /> +</menu> diff --git a/app/src/main/res/menu/view_imgur_image_fragments.xml b/app/src/main/res/menu/view_imgur_image_fragments.xml index 806e91f5..bba34621 100644 --- a/app/src/main/res/menu/view_imgur_image_fragments.xml +++ b/app/src/main/res/menu/view_imgur_image_fragments.xml @@ -14,4 +14,10 @@ android:title="@string/action_share" android:icon="@drawable/ic_share_toolbar_white_24dp" app:showAsAction="ifRoom" /> + + <item + android:id="@+id/action_set_wallpaper_view_imgur_image_fragments" + android:orderInCategory="3" + android:title="@string/action_set_wallpaper" + app:showAsAction="never" /> </menu>
\ No newline at end of file diff --git a/app/src/main/res/menu/view_post_detail_activity.xml b/app/src/main/res/menu/view_post_detail_activity.xml index 32f83c41..29c49e1f 100644 --- a/app/src/main/res/menu/view_post_detail_activity.xml +++ b/app/src/main/res/menu/view_post_detail_activity.xml @@ -80,5 +80,12 @@ android:orderInCategory="12" android:title="@string/action_report" app:showAsAction="never" + android:visible="false"/> + + <item + android:id="@+id/action_see_removed_view_post_detail_activity" + android:orderInCategory="13" + android:title="@string/action_see_removed" + app:showAsAction="never" android:visible="false" /> -</menu>
\ No newline at end of file +</menu> diff --git a/app/src/main/res/menu/view_sidebar_activity.xml b/app/src/main/res/menu/view_sidebar_activity.xml deleted file mode 100644 index fa5d9123..00000000 --- a/app/src/main/res/menu/view_sidebar_activity.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?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_refresh_view_sidebar_activity" - android:orderInCategory="1" - android:title="@string/action_refresh" - android:icon="@drawable/ic_refresh_toolbar_24dp" - app:showAsAction="ifRoom" /> -</menu>
\ No newline at end of file diff --git a/app/src/main/res/menu/view_subreddit_detail_activity.xml b/app/src/main/res/menu/view_subreddit_detail_activity.xml index 9365ed2e..daea0d09 100644 --- a/app/src/main/res/menu/view_subreddit_detail_activity.xml +++ b/app/src/main/res/menu/view_subreddit_detail_activity.xml @@ -35,14 +35,8 @@ app:showAsAction="never" /> <item - android:id="@+id/action_view_side_bar_view_subreddit_detail_activity" - android:orderInCategory="6" - android:title="@string/action_view_side_bar" - app:showAsAction="never" /> - - <item android:id="@+id/action_share_view_subreddit_detail_activity" android:orderInCategory="7" android:title="@string/action_share" app:showAsAction="never" /> -</menu>
\ No newline at end of file +</menu> diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml index 65ac8596..4ab1f8bd 100644 --- a/app/src/main/res/values-night/colors.xml +++ b/app/src/main/res/values-night/colors.xml @@ -8,4 +8,5 @@ <color name="backgroundColor">#121212</color> <color name="playButtonBackgroundColor">#FFFFFF</color> <color name="roundedBottomSheetPrimaryBackground">#242424</color> + <color name="primaryTextColor">#FFFFFF</color> </resources> diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index 5fce9e21..3efd7c75 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -1,5 +1,7 @@ <resources> <string-array name="settings_notification_interval"> + <item>15 minutes</item> + <item>30 minutes</item> <item>1 hour</item> <item>2 hours</item> <item>3 hours</item> @@ -10,6 +12,8 @@ </string-array> <string-array name="settings_notification_interval_values"> + <item>15</item> + <item>30</item> <item>1</item> <item>2</item> <item>3</item> @@ -122,6 +126,30 @@ <item>XLarge</item> <item>XXLarge</item> </string-array> + + <string-array name="settings_font_family"> + <item>Default</item> + <item>Balsamiq Sans</item> + <item>Noto Sans</item> + <item>Roboto Condensed</item> + <item>Harmonia Sans</item> + <item>Inter</item> + <item>Manrope</item> + <item>Bad Script</item> + <item>Sriracha</item> + </string-array> + + <string-array name="settings_font_family_values"> + <item>Default</item> + <item>BalsamiqSans</item> + <item>NotoSans</item> + <item>RobotoCondensed</item> + <item>HarmoniaSans</item> + <item>Inter</item> + <item>Manrope</item> + <item>BadScript</item> + <item>Sriracha</item> + </string-array> <string-array name="settings_tab_post_type"> <item>Home</item> diff --git a/app/src/main/res/values/attr.xml b/app/src/main/res/values/attr.xml index f9b5058b..0cfd9358 100644 --- a/app/src/main/res/values/attr.xml +++ b/app/src/main/res/values/attr.xml @@ -27,6 +27,18 @@ <attr name="content_font_20" format="dimension"/> </declare-styleable> + <declare-styleable name="FontFamily"> + <attr name="font_family" format="reference"/> + </declare-styleable> + + <declare-styleable name="TitleFontFamily"> + <attr name="title_font_family" format="reference"/> + </declare-styleable> + + <declare-styleable name="ContentFontFamily"> + <attr name="content_font_family" format="reference"/> + </declare-styleable> + <declare-styleable name="Theme"> <attr name="colorPrimary" format="color"/> <attr name="colorPrimaryDark" format="color"/> diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 59bbdad0..c940e5fa 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -9,4 +9,5 @@ <color name="playButtonBackgroundColor">#000000</color> <color name="roundedBottomSheetPrimaryBackground">#FFFFFF</color> <color name="roundedBottomSheetPrimaryNavigationBarColor">#000000</color> + <color name="primaryTextColor">#000000</color> </resources> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index bdd8df76..1eecbe16 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -61,12 +61,15 @@ <string name="action_share">Share</string> <string name="action_preview">Preview</string> <string name="action_report">Report</string> + <string name="action_see_removed">See Removed</string> + <string name="action_set_wallpaper">Set as Wallpaper</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> <string name="something_went_wrong">Something went wrong. Try again later.</string> <string name="access_denied">Access denied</string> <string name="parse_user_info_error">Error occurred when parsing the user info</string> + <string name="no_system_webview_error">Error opening System\'s WebView</string> <string name="error_loading_image_tap_to_retry">Error loading the image. Tap to retry.</string> <string name="error_loading_gif_tap_to_retry">Error loading the gif. Tap to retry.</string> @@ -274,6 +277,11 @@ <string name="are_you_sure">Are you sure?</string> <string name="edit">Edit</string> <string name="delete">Delete</string> + <string name="see_removed_comment">See Removed Comment</string> + <string name="fetching_removed_comment">Fetching removed comment</string> + <string name="show_removed_comment_failed">Could not find the removed comment</string> + <string name="fetching_removed_post">Fetching removed post</string> + <string name="show_removed_post_failed">Could not find the removed post</string> <string name="cancel">Cancel</string> <string name="ok">OK</string> <string name="edit_success">Edit successful</string> @@ -305,6 +313,7 @@ <string name="label_account">Account</string> <string name="label_post">Post</string> + <string name="label_preferences">Preferences</string> <string name="account_switched">Account Switched. So all other pages are gone.</string> @@ -320,7 +329,9 @@ <string name="settings_interface_title">Interface</string> <string name="settings_gestures_and_buttons_title">Gestures & Buttons</string> <string name="settings_open_link_in_app_title">Open Link In App</string> + <string name="settigns_video_title">Video</string> <string name="settings_video_autoplay_title">Video Autoplay</string> + <string name="settings_mute_autoplaying_videos_title">Mute Autoplaying Videos</string> <string name="settings_autoplay_nsfw_videos_title">Autoplay NSFW Videos</string> <string name="settings_immersive_interface_title">Immersive Interface</string> <string name="settings_immersive_interface_ignore_nav_bar_title">Ignore Navigation Bar in Immersive Interface</string> @@ -333,6 +344,7 @@ <string name="settings_volume_keys_navigate_comments_title">Use Volume Keys to Navigate Comments in Posts</string> <string name="settings_volume_keys_navigate_posts_title">Use Volume Keys to Navigate Posts</string> <string name="settings_mute_video_title">Mute Video</string> + <string name="settings_automatically_try_redgifs_title">Automatically Try Accessing Redgifs if Videos on Gfycat are Removed.</string> <string name="settings_confirm_to_exit">Confirm to Exit</string> <string name="settings_show_top_level_comments_first_title">Show Top-level Comments First</string> <string name="settings_show_comment_divider_title">Show Comment Divider</string> @@ -342,12 +354,21 @@ <string name="settings_show_elapsed_time">Show Elapsed Time in Posts and Comments</string> <string name="settings_default_post_layout">Default Post Layout</string> <string name="settings_show_divider_in_compact_layout">Show Divider in Compact Layout</string> + <string name="settings_show_thumbnail_on_the_right_in_compact_layout">Show Thumbnail on the Right in Compact Layout</string> <string name="settings_swap_tap_and_long_title">Swap Tap and Long Press in Comments</string> <string name="settings_swipe_to_go_back_from_post_detail_title">Swipe Right to Go Back From Comments</string> <string name="settings_lock_jump_to_next_top_level_comment_button_title">Lock Jump to Next Top-level Comment Button</string> <string name="settings_lock_bottom_app_bar_title">Lock Bottom Navigation Bar</string> <string name="settings_swipe_up_to_hide_jump_to_next_top_level_comment_button_title">Swipe Up to Hide Jump to Next Top-level Comment Button</string> <string name="settings_lazy_mode_interval_title">Lazy Mode Interval</string> + <string name="settings_font_title">Font</string> + <string name="settings_preview_font_title">Font Preview</string> + <string name="settings_font_summary">Font</string> + <string name="settings_title_font_summary">Title</string> + <string name="settings_content_font_summary">Content</string> + <string name="settings_font_family_title">Font Family</string> + <string name="settings_title_font_family_title">Title Font Family</string> + <string name="settings_content_font_family_title">Content Font Family</string> <string name="settings_font_size_title">Font Size</string> <string name="settings_title_font_size_title">Title Font Size</string> <string name="settings_content_font_size_title">Content Font Size</string> @@ -370,10 +391,12 @@ <string name="settings_credits_crosspost_icon_summary">Icon made by Freepik from www.flaticon.com</string> <string name="settings_credits_thumbtack_icon_title">Thumbtack Icon</string> <string name="settings_credits_thumbtack_icon_summary">Icon made by Freepik from www.flaticon.com</string> + <string name="settings_credits_best_rocket_icon_title">Rocket Icon</string> + <string name="settings_credits_best_rocket_icon_summary">Icon made by Freepik from 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">Star it on Github if you like this app</string> - <string name="settings_rate_title">Rate in Google Play</string> + <string name="settings_rate_title">Rate on Google Play</string> <string name="settings_rate_summary">Give me a 5-star rating and I will be really happy</string> <string name="settings_f_droid_title">F-Droid</string> <string name="settings_f_droid_summary">It\'s available in IzzyOnDroid, an F-Droid Repository</string> @@ -385,6 +408,8 @@ <string name="settings_subreddit_summary">r/Infinity_For_Reddit</string> <string name="settings_share_title">Share</string> <string name="settings_share_summary">Share this app to other people if you enjoy it</string> + <string name="settings_version_title">Infinity For Reddit</string> + <string name="settings_version_summary">Version %s</string> <string name="settings_category_customization_title">Customization</string> <string name="settings_customize_light_theme_title">Light Theme</string> <string name="settings_customize_dark_theme_title">Dark Theme</string> @@ -408,6 +433,7 @@ <string name="settings_tab_subreddit_name">Subreddit Name (Without r/ prefix)</string> <string name="settings_tab_multi_reddit_name">MultiReddit Name (/user/yourusername/m/yourmultiredditname)</string> <string name="settings_tab_username">Username (Without u/ prefix)</string> + <string name="no_developer_easter_egg">There\'s no developer options here</string> <string name="no_link_available">Cannot get the link</string> @@ -509,8 +535,8 @@ <string name="cannot_save_image">Cannot save the image</string> <string name="cannot_save_gif">Cannot save the gif</string> <string name="cannot_get_storage">Cannot access the app storage</string> - <string name="save_image_before_sharing">Saving the image. Please wait.</string> - <string name="save_gif_before_sharing">Saving the gif. Please wait.</string> + <string name="save_image_first">Saving the image. Please wait.</string> + <string name="save_gif_first">Saving the gif. Please wait.</string> <string name="theme_name_description">Tap to change the name of this theme.</string> <string name="theme_item_is_light_theme">Set as Light Theme</string> @@ -711,7 +737,7 @@ <string name="post_content_preview">This gravity joke is getting a bit old, but I fall for it every time.</string> <string name="post_type_preview">POST</string> <string name="flair_preview">Flair</string> - <string name="gilded_preview">x4</string> + <string name="awards_preview">4 Awards</string> <string name="author_flair_preview">Author Flair</string> <string name="comment_content_preview">I got my girlfriend a “Get better soon” card.\nShe\'s not ill or anything, but she could definitely get better.</string> @@ -754,7 +780,16 @@ <string name="downloading_reddit_video_failed_cannot_save_audio">Download failed: cannot save audio to cache directory</string> <string name="downloading_reddit_video_failed_cannot_mux">Download failed: cannot mux video and audio</string> <string name="downloading_reddit_video_failed_cannot_save_mux_video">Download failed: cannot save the video to public directory</string> - <!-- TODO: Remove or change this placeholder text --> - <string name="hello_blank_fragment">Hello blank fragment</string> + + <string name="wallpaper_set">Wallpaper set</string> + <string name="error_set_wallpaper">Cannot set wallpaper</string> + + <string name="set_to_home_screen">Set to Home Screen</string> + <string name="set_to_lock_screen">Set to Lock Screen</string> + <string name="set_to_both">Set to Both</string> + + <string name="default_font_font_preview">Default</string> + + <string name="load_video_in_redgifs">Try loading the video on Redgifs</string> </resources> diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index a7e31f71..de788275 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -27,11 +27,19 @@ <item name="android:windowTranslucentStatus">true</item> </style> - <style name="AppTheme.NoActionBarWithTransparentBackground" parent="AppTheme.NoActionBar"> + <style name="AppTheme.Slidable" parent="AppTheme.NoActionBar"> <item name="android:windowIsTranslucent">true</item> <item name="android:windowBackground">@android:color/transparent</item> </style> + <style name="AppTheme.SlidableWithTranslucentWindow" parent="AppTheme.Slidable"> + <item name="android:windowTranslucentStatus">true</item> + </style> + + <style name="AppTheme.SlidableWithTransparentStatusBar" parent="AppTheme.Slidable"> + <item name="android:statusBarColor">@android:color/transparent</item> + </style> + <style name="AppTheme.Draggable" parent="AppTheme"> <item name="android:colorBackgroundCacheHint">@null</item> <item name="android:windowContentOverlay">@null</item> @@ -39,14 +47,15 @@ <item name="android:windowIsTranslucent">true</item> <item name="android:windowTranslucentStatus">true</item> <item name="android:windowBackground">@android:color/black</item> + <item name="android:fontFamily">?attr/font_family</item> </style> - <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.DayNight.ActionBar" /> + <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.DayNight.ActionBar"> + <item name="android:fontFamily">?attr/font_family</item> + </style> <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.DayNight" /> - <style name="ToolbarTheme" parent="ThemeOverlay.AppCompat.Dark.ActionBar" /> - <style name="CustomTabLayout" parent="Widget.Design.TabLayout"> <item name="tabIndicatorColor">@android:color/white</item> <item name="tabIndicatorHeight">3dp</item> @@ -105,10 +114,12 @@ <style name="PreferenceTitleTextStyle"> <item name="android:textSize">?attr/font_16</item> <item name="android:textColor">?attr/primaryTextColor</item> + <item name="android:fontFamily">?attr/font_family</item> </style> <style name="PreferenceSubtitleTextStyle"> <item name="android:textSize">?attr/font_default</item> + <item name="android:fontFamily">?attr/font_family</item> </style> <style name="ListPreferenceStyle" parent="ThemeOverlay.AppCompat.Dialog.Alert"> @@ -229,6 +240,120 @@ <item name="content_font_20">26sp</item> </style> + <style name="FontFamily" /> + + <style name="FontFamily.Default"> + <item name="font_family">@null</item> + </style> + + <style name="FontFamily.BalsamiqSans"> + <item name="font_family">@font/balsamiq_sans</item> + </style> + + <style name="FontFamily.NotoSans"> + <item name="font_family">@font/noto_sans</item> + </style> + + <style name="FontFamily.RobotoCondensed"> + <item name="font_family">@font/roboto_condensed</item> + </style> + + <style name="FontFamily.HarmoniaSans"> + <item name="font_family">@font/harmonia_sans</item> + </style> + + <style name="FontFamily.Inter"> + <item name="font_family">@font/inter</item> + </style> + + <style name="FontFamily.Manrope"> + <item name="font_family">@font/manrope</item> + </style> + + <style name="FontFamily.BadScript"> + <item name="font_family">@font/bad_script_regular</item> + </style> + + <style name="FontFamily.Sriracha"> + <item name="font_family">@font/sriracha_regular</item> + </style> + + <style name="TitleFontFamily" /> + + <style name="TitleFontFamily.Default"> + <item name="title_font_family">@null</item> + </style> + + <style name="TitleFontFamily.BalsamiqSans"> + <item name="title_font_family">@font/balsamiq_sans</item> + </style> + + <style name="TitleFontFamily.NotoSans"> + <item name="title_font_family">@font/noto_sans</item> + </style> + + <style name="TitleFontFamily.RobotoCondensed"> + <item name="title_font_family">@font/roboto_condensed</item> + </style> + + <style name="TitleFontFamily.HarmoniaSans"> + <item name="title_font_family">@font/harmonia_sans</item> + </style> + + <style name="TitleFontFamily.Inter"> + <item name="title_font_family">@font/inter</item> + </style> + + <style name="TitleFontFamily.Manrope"> + <item name="title_font_family">@font/manrope</item> + </style> + + <style name="TitleFontFamily.BadScript"> + <item name="title_font_family">@font/bad_script_regular</item> + </style> + + <style name="TitleFontFamily.Sriracha"> + <item name="title_font_family">@font/sriracha_regular</item> + </style> + + <style name="ContentFontFamily" /> + + <style name="ContentFontFamily.Default"> + <item name="content_font_family">@null</item> + </style> + + <style name="ContentFontFamily.BalsamiqSans"> + <item name="content_font_family">@font/balsamiq_sans</item> + </style> + + <style name="ContentFontFamily.NotoSans"> + <item name="content_font_family">@font/noto_sans</item> + </style> + + <style name="ContentFontFamily.RobotoCondensed"> + <item name="content_font_family">@font/roboto_condensed</item> + </style> + + <style name="ContentFontFamily.HarmoniaSans"> + <item name="content_font_family">@font/harmonia_sans</item> + </style> + + <style name="ContentFontFamily.Inter"> + <item name="content_font_family">@font/inter</item> + </style> + + <style name="ContentFontFamily.Manrope"> + <item name="content_font_family">@font/manrope</item> + </style> + + <style name="ContentFontFamily.BadScript"> + <item name="content_font_family">@font/bad_script_regular</item> + </style> + + <style name="ContentFontFamily.Sriracha"> + <item name="content_font_family">@font/sriracha_regular</item> + </style> + <style name="Theme" /> <style name="Theme.Normal"> diff --git a/app/src/main/res/xml/about_preferences.xml b/app/src/main/res/xml/about_preferences.xml index 2772f2ed..a73f9aaa 100644 --- a/app/src/main/res/xml/about_preferences.xml +++ b/app/src/main/res/xml/about_preferences.xml @@ -45,4 +45,9 @@ app:title="@string/settings_share_title" app:summary="@string/settings_share_summary" /> -</PreferenceScreen>
\ No newline at end of file + <Preference + android:key="version" + app:title="@string/settings_version_title" + app:summary="@string/settings_version_summary" /> + +</PreferenceScreen> diff --git a/app/src/main/res/xml/autoplay_preferences.xml b/app/src/main/res/xml/autoplay_preferences.xml deleted file mode 100644 index 6cb07dd9..00000000 --- a/app/src/main/res/xml/autoplay_preferences.xml +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto"> - - <ListPreference - app:defaultValue="0" - android:entries="@array/settings_video_autoplay" - app:entryValues="@array/settings_video_autoplay_values" - app:key="video_autoplay" - app:title="@string/settings_video_autoplay_title" - app:useSimpleSummaryProvider="true" /> - - <SwitchPreference - app:defaultValue="true" - app:key="autoplay_nsfw_videos" - app:title="@string/settings_autoplay_nsfw_videos_title" /> - -</PreferenceScreen>
\ No newline at end of file diff --git a/app/src/main/res/xml/credits_preferences.xml b/app/src/main/res/xml/credits_preferences.xml index e630422b..8e622332 100644 --- a/app/src/main/res/xml/credits_preferences.xml +++ b/app/src/main/res/xml/credits_preferences.xml @@ -33,7 +33,12 @@ android:summary="@string/settings_credits_thumbtack_icon_summary" /> <Preference + android:key="best_rocket_icon" + app:title="@string/settings_credits_best_rocket_icon_title" + android:summary="@string/settings_credits_best_rocket_icon_summary" /> + + <Preference android:key="material_icons" app:title="@string/settings_credits_material_icons_title"/> -</PreferenceScreen>
\ No newline at end of file +</PreferenceScreen> diff --git a/app/src/main/res/xml/font_preferences.xml b/app/src/main/res/xml/font_preferences.xml new file mode 100644 index 00000000..83264ea0 --- /dev/null +++ b/app/src/main/res/xml/font_preferences.xml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="utf-8"?> +<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> + + <Preference + app:title="@string/settings_preview_font_title" + app:fragment="ml.docilealligator.infinityforreddit.Settings.FontPreviewFragment" /> + + <PreferenceCategory + app:title="@string/settings_font_summary" /> + + <ListPreference + app:defaultValue="Default" + android:entries="@array/settings_font_family" + app:entryValues="@array/settings_font_family_values" + app:key="font_family" + app:title="@string/settings_font_family_title" + app:useSimpleSummaryProvider="true" /> + + <ListPreference + app:defaultValue="Normal" + android:entries="@array/settings_font_size" + app:entryValues="@array/settings_font_size_values" + app:key="font_size" + app:title="@string/settings_font_size_title" + app:useSimpleSummaryProvider="true" /> + + <PreferenceCategory + app:title="@string/settings_title_font_summary" /> + + <ListPreference + app:defaultValue="Default" + android:entries="@array/settings_font_family" + app:entryValues="@array/settings_font_family_values" + app:key="title_font_family" + app:title="@string/settings_title_font_family_title" + app:useSimpleSummaryProvider="true" /> + + <ListPreference + app:defaultValue="Normal" + android:entries="@array/settings_title_font_size" + app:entryValues="@array/settings_title_font_size_values" + app:key="title_font_size" + app:title="@string/settings_title_font_size_title" + app:useSimpleSummaryProvider="true" /> + + <PreferenceCategory + app:title="@string/settings_content_font_summary" /> + + <ListPreference + app:defaultValue="Default" + android:entries="@array/settings_font_family" + app:entryValues="@array/settings_font_family_values" + app:key="content_font_family" + app:title="@string/settings_content_font_family_title" + app:useSimpleSummaryProvider="true" /> + + <ListPreference + app:defaultValue="Normal" + android:entries="@array/settings_content_font_size" + app:entryValues="@array/settings_content_font_size_values" + app:key="content_font_size" + app:title="@string/settings_content_font_size_title" + app:useSimpleSummaryProvider="true" /> + +</PreferenceScreen>
\ No newline at end of file diff --git a/app/src/main/res/xml/font_size_preferences.xml b/app/src/main/res/xml/font_size_preferences.xml deleted file mode 100644 index 40695b92..00000000 --- a/app/src/main/res/xml/font_size_preferences.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto"> - - <ListPreference - app:defaultValue="Normal" - android:entries="@array/settings_font_size" - app:entryValues="@array/settings_font_size_values" - app:key="font_size" - app:title="@string/settings_font_size_title" - app:useSimpleSummaryProvider="true" /> - - <ListPreference - app:defaultValue="Normal" - android:entries="@array/settings_title_font_size" - app:entryValues="@array/settings_title_font_size_values" - app:key="title_font_size" - app:title="@string/settings_title_font_size_title" - app:useSimpleSummaryProvider="true" /> - - <ListPreference - app:defaultValue="Normal" - android:entries="@array/settings_content_font_size" - app:entryValues="@array/settings_content_font_size_values" - app:key="content_font_size" - app:title="@string/settings_content_font_size_title" - app:useSimpleSummaryProvider="true" /> - -</PreferenceScreen>
\ No newline at end of file diff --git a/app/src/main/res/xml/immersive_interface_preferences.xml b/app/src/main/res/xml/immersive_interface_preferences.xml new file mode 100644 index 00000000..962faa10 --- /dev/null +++ b/app/src/main/res/xml/immersive_interface_preferences.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto"> + + <SwitchPreference + app:defaultValue="true" + app:key="immersive_interface" + app:title="@string/settings_immersive_interface_title" + app:isPreferenceVisible="false" /> + + <SwitchPreference + app:defaultValue="false" + app:key="immersive_interface_ignore_nav_bar" + app:title="@string/settings_immersive_interface_ignore_nav_bar_title" + app:summary="@string/settings_immersive_interface_ignore_nav_bar_summary" + app:isPreferenceVisible="false" /> + +</PreferenceScreen>
\ No newline at end of file diff --git a/app/src/main/res/xml/interface_preference.xml b/app/src/main/res/xml/interface_preference.xml index 58de9ef4..d2525eb6 100644 --- a/app/src/main/res/xml/interface_preference.xml +++ b/app/src/main/res/xml/interface_preference.xml @@ -3,22 +3,13 @@ xmlns:app="http://schemas.android.com/apk/res-auto"> <Preference - app:title="@string/settings_font_size_title" + app:title="@string/settings_font_title" app:icon="@drawable/ic_font_size_24dp" - app:fragment="ml.docilealligator.infinityforreddit.Settings.FontSizePreferenceFragment" /> + app:fragment="ml.docilealligator.infinityforreddit.Settings.FontPreferenceFragment" /> - <SwitchPreference - app:defaultValue="true" - app:key="immersive_interface" + <Preference app:title="@string/settings_immersive_interface_title" - app:isPreferenceVisible="false" /> - - <SwitchPreference - app:defaultValue="false" - app:key="immersive_interface_ignore_nav_bar" - app:title="@string/settings_immersive_interface_ignore_nav_bar_title" - app:summary="@string/settings_immersive_interface_ignore_nav_bar_summary" - app:isPreferenceVisible="false" /> + app:fragment="ml.docilealligator.infinityforreddit.Settings.ImmersiveInterfacePreferenceFragment" /> <Preference app:title="@string/settings_customize_tabs_in_main_page_title" @@ -56,6 +47,11 @@ <SwitchPreference app:defaultValue="false" + app:key="show_thumbnail_on_the_right_in_compact_layout" + app:title="@string/settings_show_thumbnail_on_the_right_in_compact_layout" /> + + <SwitchPreference + app:defaultValue="false" app:key="show_top_level_comments_first" app:title="@string/settings_show_top_level_comments_first_title" /> diff --git a/app/src/main/res/xml/main_preferences.xml b/app/src/main/res/xml/main_preferences.xml index f332a49c..c15bfee4 100644 --- a/app/src/main/res/xml/main_preferences.xml +++ b/app/src/main/res/xml/main_preferences.xml @@ -29,14 +29,9 @@ app:title="@string/settings_open_link_in_app_title" /> <Preference - app:title="@string/settings_video_autoplay_title" - app:fragment="ml.docilealligator.infinityforreddit.Settings.AutoplayPreferenceFragment" /> - - <SwitchPreference - app:defaultValue="false" - app:key="mute_video" - app:icon="@drawable/ic_mute_preferences_24dp" - app:title="@string/settings_mute_video_title" /> + app:title="@string/settigns_video_title" + android:icon="@drawable/ic_outline_video_24dp" + app:fragment="ml.docilealligator.infinityforreddit.Settings.VideoPreferenceFragment" /> <SwitchPreference app:defaultValue="false" diff --git a/app/src/main/res/xml/video_preferences.xml b/app/src/main/res/xml/video_preferences.xml new file mode 100644 index 00000000..bb690347 --- /dev/null +++ b/app/src/main/res/xml/video_preferences.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> + + <SwitchPreference + app:defaultValue="false" + app:key="mute_video" + app:icon="@drawable/ic_mute_preferences_24dp" + app:title="@string/settings_mute_video_title" /> + + <SwitchPreference + app:defaultValue="true" + app:key="automatically_try_redgifs" + app:title="@string/settings_automatically_try_redgifs_title" /> + + <PreferenceCategory + app:title="@string/settings_video_autoplay_title" /> + + <ListPreference + app:defaultValue="0" + android:entries="@array/settings_video_autoplay" + app:entryValues="@array/settings_video_autoplay_values" + app:key="video_autoplay" + app:title="@string/settings_video_autoplay_title" + app:useSimpleSummaryProvider="true" /> + + <SwitchPreference + app:defaultValue="true" + app:key="mute_autoplaying_videos" + app:icon="@drawable/ic_mute_preferences_24dp" + app:title="@string/settings_mute_autoplaying_videos_title" /> + + <SwitchPreference + app:defaultValue="true" + app:key="autoplay_nsfw_videos" + app:title="@string/settings_autoplay_nsfw_videos_title" /> + +</PreferenceScreen>
\ No newline at end of file diff --git a/build.gradle b/build.gradle index 88a1e4a2..4ee976c2 100644 --- a/build.gradle +++ b/build.gradle @@ -18,9 +18,6 @@ allprojects { google() jcenter() maven { url "https://jitpack.io" } - maven { url "https://dl.bintray.com/sysdata/maven" } - maven { url "https://dl.bintray.com/rilixtech/maven/" } - maven { url "http://repo.pageturner-reader.org" } mavenCentral() } } diff --git a/fastlane/metadata/android/en-US/full_description.txt b/fastlane/metadata/android/en-US/full_description.txt new file mode 100644 index 00000000..40360e50 --- /dev/null +++ b/fastlane/metadata/android/en-US/full_description.txt @@ -0,0 +1,35 @@ +<p>Infinity is a beautiful, feature-rich app that offers a smooth Reddit browsing experience. It is completely free and ad-less; you can browse Reddit without interruptions or distractions. Built by a passionate university student, Infinity is open source. Please check out, support or contribute to the project at https://github.com/Docile-Alligator/Infinity-For-Reddit!</p> + +<p>A subreddit for this app is available: https://www.reddit.com/r/Infinity_For_Reddit/</p> + +<p><b>Highlighted features:</b></p> + +<p><b>Lazy mode</b></p> +<p>Automatic scrolling of posts enables you to enjoy amazing content without moving your thumb.</p> + +<p><b>Multi-account support</b></p> +<p>Switch to different accounts instantaneously.</p> + +<p><b>Night theme</b></p> +<p>Beautifully designed night theme</p> + +<p><b>Highlighted feature</b></p> + +<p>Lazy mode: Automatic scrolling of posts enables you to enjoy amazing posts without moving your thumb.</p> + +<p><b>Features:</b></p> +<ul> +<li>Browsing posts</li> +<li>View comments</li> +<li>Expand and collapse comments section</li> +<li>Vote posts and comments</li> +<li>Save posts</li> +<li>Write comments</li> +<li>Edit comments and delete comments</li> +<li>Submit posts (text, link, image and video)</li> +<li>Edit posts (mark and unmark NSFW and spoiler and edit flair) and delete posts</li> +<li>See all the subscribed subreddits and followed users</li> +<li>View the messages</li> +<li>Get notifications of unread messages</li> +<li>And much more!</li> +</ul> diff --git a/fastlane/metadata/android/en-US/images/icon.png b/fastlane/metadata/android/en-US/images/icon.png Binary files differnew file mode 100644 index 00000000..172f7d9a --- /dev/null +++ b/fastlane/metadata/android/en-US/images/icon.png diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/1.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/1.png Binary files differnew file mode 100644 index 00000000..a84b92cd --- /dev/null +++ b/fastlane/metadata/android/en-US/images/phoneScreenshots/1.png diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/2.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/2.png Binary files differnew file mode 100644 index 00000000..29e95471 --- /dev/null +++ b/fastlane/metadata/android/en-US/images/phoneScreenshots/2.png diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/3.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/3.png Binary files differnew file mode 100644 index 00000000..bbe5c866 --- /dev/null +++ b/fastlane/metadata/android/en-US/images/phoneScreenshots/3.png diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/4.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/4.png Binary files differnew file mode 100644 index 00000000..9a0f945c --- /dev/null +++ b/fastlane/metadata/android/en-US/images/phoneScreenshots/4.png diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/5.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/5.png Binary files differnew file mode 100644 index 00000000..2da7485f --- /dev/null +++ b/fastlane/metadata/android/en-US/images/phoneScreenshots/5.png diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/6.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/6.png Binary files differnew file mode 100644 index 00000000..532ebbc2 --- /dev/null +++ b/fastlane/metadata/android/en-US/images/phoneScreenshots/6.png diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/7.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/7.png Binary files differnew file mode 100644 index 00000000..50738798 --- /dev/null +++ b/fastlane/metadata/android/en-US/images/phoneScreenshots/7.png diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/8.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/8.png Binary files differnew file mode 100644 index 00000000..59011f81 --- /dev/null +++ b/fastlane/metadata/android/en-US/images/phoneScreenshots/8.png diff --git a/fastlane/metadata/android/en-US/short_description.txt b/fastlane/metadata/android/en-US/short_description.txt new file mode 100644 index 00000000..837f16e3 --- /dev/null +++ b/fastlane/metadata/android/en-US/short_description.txt @@ -0,0 +1 @@ +A beautiful, feature-rich Reddit client. diff --git a/fastlane/metadata/android/en-US/title.txt b/fastlane/metadata/android/en-US/title.txt new file mode 100644 index 00000000..bcc0ce00 --- /dev/null +++ b/fastlane/metadata/android/en-US/title.txt @@ -0,0 +1 @@ +Infinity for Reddit |