diff options
4 files changed, 0 insertions, 256 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 18f9a9d5..544c0907 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -115,11 +115,6 @@ android:parentActivityName=".activities.MainActivity" android:theme="@style/AppTheme.NoActionBar" /> <activity - android:name=".activities.MultiredditSelectionActivity" - android:label="@string/multireddit_selection_activity_label" - android:parentActivityName=".activities.MainActivity" - android:theme="@style/AppTheme.NoActionBar" /> - <activity android:name=".activities.SearchUsersResultActivity" android:label="@string/search_users_result_activity_label" android:parentActivityName=".activities.MainActivity" diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java index 7731ae1f..fcacd2b8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java @@ -31,7 +31,6 @@ import ml.docilealligator.infinityforreddit.activities.LockScreenActivity; import ml.docilealligator.infinityforreddit.activities.LoginActivity; import ml.docilealligator.infinityforreddit.activities.LoginChromeCustomTabActivity; import ml.docilealligator.infinityforreddit.activities.MainActivity; -import ml.docilealligator.infinityforreddit.activities.MultiredditSelectionActivity; import ml.docilealligator.infinityforreddit.activities.PostFilterPreferenceActivity; import ml.docilealligator.infinityforreddit.activities.PostFilterUsageListingActivity; import ml.docilealligator.infinityforreddit.activities.PostGalleryActivity; @@ -261,8 +260,6 @@ public interface AppComponent { void inject(SearchUsersResultActivity searchUsersResultActivity); - void inject(MultiredditSelectionActivity multiredditSelectionActivity); - void inject(ViewImgurImageFragment viewImgurImageFragment); void inject(ViewRedditGalleryImageOrGifFragment viewRedditGalleryImageOrGifFragment); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java deleted file mode 100644 index 5f9dace8..00000000 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java +++ /dev/null @@ -1,207 +0,0 @@ -package ml.docilealligator.infinityforreddit.activities; - -import android.content.SharedPreferences; -import android.os.Build; -import android.os.Bundle; -import android.os.Handler; -import android.view.MenuItem; -import android.view.Window; -import android.view.WindowManager; -import android.widget.Toast; - -import androidx.annotation.NonNull; -import androidx.fragment.app.Fragment; - -import org.greenrobot.eventbus.EventBus; -import org.greenrobot.eventbus.Subscribe; - -import java.util.ArrayList; -import java.util.concurrent.Executor; - -import javax.inject.Inject; -import javax.inject.Named; - -import ml.docilealligator.infinityforreddit.ActivityToolbarInterface; -import ml.docilealligator.infinityforreddit.Infinity; -import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; -import ml.docilealligator.infinityforreddit.account.Account; -import ml.docilealligator.infinityforreddit.asynctasks.InsertMultireddit; -import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; -import ml.docilealligator.infinityforreddit.customviews.slidr.Slidr; -import ml.docilealligator.infinityforreddit.databinding.ActivityMultiredditSelectionBinding; -import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent; -import ml.docilealligator.infinityforreddit.fragments.MultiRedditListingFragment; -import ml.docilealligator.infinityforreddit.multireddit.FetchMyMultiReddits; -import ml.docilealligator.infinityforreddit.multireddit.MultiReddit; -import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; -import retrofit2.Retrofit; - -public class MultiredditSelectionActivity extends BaseActivity implements ActivityToolbarInterface { - - private static final String INSERT_SUBSCRIBED_MULTIREDDIT_STATE = "ISSS"; - private static final String FRAGMENT_OUT_STATE = "FOS"; - - @Inject - @Named("oauth") - Retrofit mOauthRetrofit; - @Inject - RedditDataRoomDatabase mRedditDataRoomDatabase; - @Inject - @Named("default") - SharedPreferences mSharedPreferences; - @Inject - @Named("current_account") - SharedPreferences mCurrentAccountSharedPreferences; - @Inject - CustomThemeWrapper mCustomThemeWrapper; - @Inject - Executor mExecutor; - private boolean mInsertSuccess = false; - private Fragment mFragment; - private ActivityMultiredditSelectionBinding binding; - - @Override - protected void onCreate(Bundle savedInstanceState) { - ((Infinity) getApplication()).getAppComponent().inject(this); - - super.onCreate(savedInstanceState); - - binding = ActivityMultiredditSelectionBinding.inflate(getLayoutInflater()); - setContentView(binding.getRoot()); - - EventBus.getDefault().register(this); - - applyCustomTheme(); - - if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK, true)) { - Slidr.attach(this); - } - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - Window window = getWindow(); - - if (isChangeStatusBarIconColor()) { - addOnOffsetChangedListener(binding.appbarLayoutMultiredditSelectionActivity); - } - - if (isImmersiveInterface()) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { - window.setDecorFitsSystemWindows(false); - } else { - window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); - } - adjustToolbar(binding.toolbarMultiredditSelectionActivity); - } - } - - setSupportActionBar(binding.toolbarMultiredditSelectionActivity); - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - - if (savedInstanceState == null) { - bindView(true); - } else { - mInsertSuccess = savedInstanceState.getBoolean(INSERT_SUBSCRIBED_MULTIREDDIT_STATE); - mFragment = getSupportFragmentManager().getFragment(savedInstanceState, FRAGMENT_OUT_STATE); - getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_multireddit_selection_activity, mFragment).commit(); - bindView(false); - } - } - - @Override - public SharedPreferences getDefaultSharedPreferences() { - return mSharedPreferences; - } - - @Override - public SharedPreferences getCurrentAccountSharedPreferences() { - return mCurrentAccountSharedPreferences; - } - - @Override - public CustomThemeWrapper getCustomThemeWrapper() { - return mCustomThemeWrapper; - } - - @Override - protected void applyCustomTheme() { - binding.getRoot().setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); - applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(binding.appbarLayoutMultiredditSelectionActivity, - binding.collapsingToolbarLayoutMultiredditSelectionActivity, binding.toolbarMultiredditSelectionActivity); - } - - private void bindView(boolean initializeFragment) { - if (isFinishing() || isDestroyed()) { - return; - } - - if (!accountName.equals(Account.ANONYMOUS_ACCOUNT)) { - loadMultiReddits(); - } - - if (initializeFragment) { - mFragment = new MultiRedditListingFragment(); - Bundle bundle = new Bundle(); - bundle.putBoolean(MultiRedditListingFragment.EXTRA_IS_MULTIREDDIT_SELECTION, true); - mFragment.setArguments(bundle); - getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_multireddit_selection_activity, mFragment).commit(); - } - } - - private void loadMultiReddits() { - if (!mInsertSuccess) { - FetchMyMultiReddits.fetchMyMultiReddits(mOauthRetrofit, accessToken, new FetchMyMultiReddits.FetchMyMultiRedditsListener() { - @Override - public void success(ArrayList<MultiReddit> multiReddits) { - InsertMultireddit.insertMultireddits(mExecutor, new Handler(), mRedditDataRoomDatabase, - multiReddits, accountName, () -> { - mInsertSuccess = true; - ((MultiRedditListingFragment) mFragment).stopRefreshProgressbar(); - }); - } - - @Override - public void failed() { - mInsertSuccess = false; - ((MultiRedditListingFragment) mFragment).stopRefreshProgressbar(); - Toast.makeText(MultiredditSelectionActivity.this, R.string.error_loading_multi_reddit_list, Toast.LENGTH_SHORT).show(); - } - }); - } - } - - @Override - public boolean onOptionsItemSelected(@NonNull MenuItem item) { - if (item.getItemId() == android.R.id.home) { - finish(); - return true; - } - - return false; - } - - @Override - protected void onSaveInstanceState(@NonNull Bundle outState) { - super.onSaveInstanceState(outState); - getSupportFragmentManager().putFragment(outState, FRAGMENT_OUT_STATE, mFragment); - outState.putBoolean(INSERT_SUBSCRIBED_MULTIREDDIT_STATE, mInsertSuccess); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - EventBus.getDefault().unregister(this); - } - - @Subscribe - public void onAccountSwitchEvent(SwitchAccountEvent event) { - finish(); - } - - @Override - public void onLongPress() { - if (mFragment != null) { - ((MultiRedditListingFragment) mFragment).goBackToTop(); - } - } -}
\ No newline at end of file diff --git a/app/src/main/res/layout/activity_multireddit_selection.xml b/app/src/main/res/layout/activity_multireddit_selection.xml deleted file mode 100644 index af97f0c8..00000000 --- a/app/src/main/res/layout/activity_multireddit_selection.xml +++ /dev/null @@ -1,41 +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" - tools:application=".MultiredditSelectionActivity"> - - <com.google.android.material.appbar.AppBarLayout - android:id="@+id/appbar_layout_multireddit_selection_activity" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:theme="@style/AppTheme.AppBarOverlay"> - - <com.google.android.material.appbar.CollapsingToolbarLayout - android:id="@+id/collapsing_toolbar_layout_multireddit_selection_activity" - android:layout_width="match_parent" - android:layout_height="match_parent" - app:layout_scrollFlags="scroll|enterAlways" - app:titleEnabled="false" - app:toolbarId="@+id/toolbar_multireddit_selection_activity"> - - <androidx.appcompat.widget.Toolbar - android:id="@+id/toolbar_multireddit_selection_activity" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="?attr/actionBarSize" - app:popupTheme="@style/AppTheme.PopupOverlay" - app:navigationIcon="?attr/homeAsUpIndicator" /> - - </com.google.android.material.appbar.CollapsingToolbarLayout> - - </com.google.android.material.appbar.AppBarLayout> - - <androidx.fragment.app.FragmentContainerView - android:id="@+id/frame_layout_multireddit_selection_activity" - android:layout_width="match_parent" - android:layout_height="match_parent" - app:layout_behavior="@string/appbar_scrolling_view_behavior" /> - -</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file |