diff options
author | Docile-Alligator <chineseperson5@gmail.com> | 2021-09-26 11:04:06 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-26 11:04:06 +0000 |
commit | a80489b41b68f5b755de1fa9f556069342470a19 (patch) | |
tree | 81e8cd32723f72a208e34f2f694e9938ea5ee1d8 | |
parent | 5d6a56aae00741b3912a05e44b3af6c7b8735e62 (diff) | |
parent | 424b1c27e0c98f4026869459d6be4ea737723a10 (diff) | |
download | infinity-for-reddit-a80489b41b68f5b755de1fa9f556069342470a19.tar infinity-for-reddit-a80489b41b68f5b755de1fa9f556069342470a19.tar.gz infinity-for-reddit-a80489b41b68f5b755de1fa9f556069342470a19.tar.bz2 infinity-for-reddit-a80489b41b68f5b755de1fa9f556069342470a19.tar.lz infinity-for-reddit-a80489b41b68f5b755de1fa9f556069342470a19.tar.xz infinity-for-reddit-a80489b41b68f5b755de1fa9f556069342470a19.tar.zst infinity-for-reddit-a80489b41b68f5b755de1fa9f556069342470a19.zip |
Merge pull request #473 from TacoTheDank/updates
Miscellaneous updates
49 files changed, 349 insertions, 418 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index be209dbe..e2414018 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,11 +13,11 @@ jobs: - name: Checkout Repository uses: actions/checkout@v2 - - name: Set-up JDK 8 + - name: Set-up JDK 11 uses: actions/setup-java@v2 with: - java-version: '8' - distribution: 'adopt' + java-version: '11' + distribution: 'temurin' - name: Grant Execute Permission for gradlew run: chmod +x gradlew diff --git a/app/build.gradle b/app/build.gradle index 4f792b29..4661aea2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -29,8 +29,12 @@ android { } } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 + } + + lintOptions { + disable 'MissingTranslation' } bundle { @@ -42,28 +46,28 @@ android { dependencies { /** AndroidX **/ - implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'androidx.appcompat:appcompat:1.3.1' implementation 'androidx.biometric:biometric:1.2.0-alpha03' implementation 'androidx.browser:browser:1.3.0' implementation 'androidx.cardview:cardview:1.0.0' - implementation 'androidx.constraintlayout:constraintlayout:2.1.0-beta02' - implementation 'androidx.legacy:legacy-support-v4:1.0.0' - def lifecycleVersion = "2.2.0" + implementation 'androidx.constraintlayout:constraintlayout:2.1.0' + def lifecycleVersion = "2.3.1" + implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion" implementation "androidx.lifecycle:lifecycle-livedata:$lifecycleVersion" - implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycleVersion" + implementation "androidx.lifecycle:lifecycle-process:$lifecycleVersion" implementation "androidx.lifecycle:lifecycle-runtime:$lifecycleVersion" - implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycleVersion" - implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycleVersion" - annotationProcessor "androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion" - implementation 'androidx.paging:paging-runtime:3.0.1' - implementation "androidx.paging:paging-guava:3.0.1" + implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycleVersion" + def pagingVersion = "3.0.1" + implementation "androidx.paging:paging-runtime:$pagingVersion" + implementation "androidx.paging:paging-guava:$pagingVersion" implementation 'androidx.preference:preference:1.1.1' + implementation 'androidx.recyclerview:recyclerview:1.2.1' def roomVersion = "2.3.0" implementation "androidx.room:room-runtime:$roomVersion" annotationProcessor "androidx.room:room-compiler:$roomVersion" + implementation 'androidx.viewpager2:viewpager2:1.1.0-beta01' implementation 'androidx.work:work-runtime:2.5.0' - implementation 'com.google.android.material:material:1.3.0-rc01' - implementation "androidx.viewpager2:viewpager2:1.1.0-alpha01" + implementation 'com.google.android.material:material:1.3.0' /** ExoPlayer **/ def exoplayerVersion = "2.10.8" @@ -81,10 +85,6 @@ dependencies { /**** Backend logic ****/ - // Reactive stuff for event and async related - implementation 'io.reactivex.rxjava2:rxandroid:2.1.1' - implementation 'io.reactivex.rxjava2:rxjava:2.2.21' - // HTTP clients def retrofitVersion = "2.9.0" implementation "com.squareup.retrofit2:retrofit:$retrofitVersion" @@ -109,7 +109,7 @@ dependencies { annotationProcessor "org.greenrobot:eventbus-annotation-processor:$eventbusVersion" // TransactionTooLargeException avoidance - implementation 'com.github.livefront:bridge:v1.3.0' + implementation 'com.github.livefront:bridge:v2.0.2' // Bundle-saving without boilerplate // NOTE: Deprecated @@ -119,7 +119,16 @@ dependencies { // Object to JSON // NOTE: Replace with Squareup's Moshi? - implementation 'com.google.code.gson:gson:2.8.6' + implementation 'com.google.code.gson:gson:2.8.8' + + // Java library for zip files and streams + implementation 'net.lingala.zip4j:zip4j:2.9.0' + + // IO functionality + implementation 'commons-io:commons-io:2.5' + + // Crash reporting + implementation 'com.github.FunkyMuse:Crashy:1.2.0' /**** User Interface (frontend) ****/ @@ -130,11 +139,11 @@ dependencies { annotationProcessor "com.github.bumptech.glide:compiler:$glideVersion" implementation 'jp.wasabeef:glide-transformations:4.3.0' implementation 'com.github.santalu:aspect-ratio-imageview:1.0.9' - implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.21' - def bivVersion = "1.7.0" - implementation "com.github.Piasy.BigImageViewer:BigImageViewer:$bivVersion" - implementation "com.github.Piasy.BigImageViewer:GlideImageLoader:$bivVersion" - implementation "com.github.Piasy.BigImageViewer:GlideImageViewFactory:$bivVersion" + implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.23' + def bivVersion = "1.8.1" + implementation "com.github.piasy:BigImageViewer:$bivVersion" + implementation "com.github.piasy:GlideImageLoader:$bivVersion" + implementation "com.github.piasy:GlideImageViewFactory:$bivVersion" // Markdown def markwonVersion = "4.6.2" @@ -148,20 +157,20 @@ dependencies { implementation 'me.saket:better-link-movement-method:2.2.0' // Animations - implementation 'com.airbnb.android:lottie:3.4.4' + implementation 'com.airbnb.android:lottie:4.1.0' // Loading ProgressBar implementation 'com.lsjwzh:materialloadingprogressbar:0.5.8-RELEASE' // SearchView - implementation 'com.github.Ferfalk:SimpleSearchView:0.1.4' + implementation 'com.github.Ferfalk:SimpleSearchView:0.2.0' // Customizable TextView implementation 'com.libRG:customtextview:2.4' // Dismiss gesturing implementation 'com.r0adkll:slidableactivity:2.1.0' - implementation 'com.thefuntasty.hauler:core:3.1.0' + implementation 'app.futured.hauler:hauler:5.0.0' // Bottom sheet with rounded corners implementation 'com.github.Deishelon:RoundedBottomSheet:1.0.1' @@ -170,21 +179,10 @@ dependencies { implementation 'com.nex3z:flow-layout:1.3.3' // RecyclerView fast scrolling - implementation 'me.zhanghai.android.fastscroll:library:1.1.5' - - implementation 'net.lingala.zip4j:zip4j:2.7.0' - implementation 'org.apache.commons:commons-io:1.3.2' - - implementation "androidx.startup:startup-runtime:1.0.0" - implementation 'com.github.FunkyMuse:Crashy:1.1.0' - - implementation "androidx.lifecycle:lifecycle-process:2.3.1" - implementation "androidx.lifecycle:lifecycle-common-java8:2.3.1" - - implementation 'androidx.palette:palette:1.0.0' + implementation 'me.zhanghai.android.fastscroll:library:1.1.7' /**** Builds and flavors ****/ // debugImplementation because LeakCanary should only run in debug builds. - //debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.5' + //debugImplementation 'com.squareup.leakcanary:leakcanary-android:x.y' } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchActivity.java index 66369953..eab43461 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchActivity.java @@ -20,7 +20,9 @@ import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.lifecycle.ViewModelProvider; import androidx.recyclerview.widget.RecyclerView; +import com.ferfalk.simplesearchview.SimpleOnQueryTextListener; import com.ferfalk.simplesearchview.SimpleSearchView; +import com.ferfalk.simplesearchview.SimpleSearchViewListener; import com.google.android.material.appbar.AppBarLayout; import com.r0adkll.slidr.Slidr; @@ -154,26 +156,11 @@ public class SearchActivity extends BaseActivity { simpleSearchView.setHint(getText(R.string.search_only_users_hint)); } - simpleSearchView.setOnSearchViewListener(new SimpleSearchView.SearchViewListener() { - @Override - public void onSearchViewShown() { - - } - + simpleSearchView.setOnSearchViewListener(new SimpleSearchViewListener() { @Override public void onSearchViewClosed() { finish(); } - - @Override - public void onSearchViewShownAnimation() { - - } - - @Override - public void onSearchViewClosedAnimation() { - - } }); mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null); @@ -201,15 +188,15 @@ public class SearchActivity extends BaseActivity { finish(); }); - simpleSearchView.setOnQueryTextListener(new SimpleSearchView.OnQueryTextListener() { + simpleSearchView.setOnQueryTextListener(new SimpleOnQueryTextListener() { @Override - public boolean onQueryTextSubmit(String query) { + public boolean onQueryTextSubmit(@NonNull String query) { search(query); return true; } @Override - public boolean onQueryTextChange(String newText) { + public boolean onQueryTextChange(@NonNull String newText) { if (!newText.isEmpty()) { if (subredditAutocompleteCall != null) { subredditAutocompleteCall.cancel(); @@ -244,11 +231,6 @@ public class SearchActivity extends BaseActivity { } return false; } - - @Override - public boolean onQueryTextCleared() { - return false; - } }); if (savedInstanceState != null) { @@ -384,11 +366,10 @@ public class SearchActivity extends BaseActivity { protected void onStart() { super.onStart(); simpleSearchView.showSearch(false); - simpleSearchView.getSearchEditText().requestFocus(); + simpleSearchView.requestFocus(); if (query != null) { - simpleSearchView.getSearchEditText().setText(query); - simpleSearchView.getSearchEditText().setSelection(query.length()); + simpleSearchView.setQuery(query, false); query = null; } @@ -403,13 +384,13 @@ public class SearchActivity extends BaseActivity { super.onPause(); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null) { - imm.hideSoftInputFromWindow(simpleSearchView.getSearchEditText().getWindowToken(), 0); + imm.hideSoftInputFromWindow(simpleSearchView.getWindowToken(), 0); } } @Override protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { - if (simpleSearchView.onActivityResult(requestCode, resultCode, data)) { + if (data != null && simpleSearchView.onActivityResult(requestCode, resultCode, data)) { return; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchSubredditsResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchSubredditsResultActivity.java index 3b6ead1a..ae115534 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchSubredditsResultActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchSubredditsResultActivity.java @@ -122,11 +122,12 @@ public class SearchSubredditsResultActivity extends BaseActivity implements Acti bundle.putString(SubredditListingFragment.EXTRA_ACCOUNT_NAME, mAccountName); bundle.putBoolean(SubredditListingFragment.EXTRA_IS_MULTI_SELECTION, getIntent().getBooleanExtra(EXTRA_IS_MULTI_SELECTION, false)); mFragment.setArguments(bundle); - getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_search_subreddits_result_activity, mFragment).commit(); } else { mFragment = getSupportFragmentManager().getFragment(savedInstanceState, FRAGMENT_OUT_STATE); - getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_search_subreddits_result_activity, mFragment).commit(); } + getSupportFragmentManager().beginTransaction() + .replace(R.id.frame_layout_search_subreddits_result_activity, mFragment) + .commit(); } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchUsersResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchUsersResultActivity.java index 2fbfc150..58db6bc7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchUsersResultActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchUsersResultActivity.java @@ -119,11 +119,12 @@ public class SearchUsersResultActivity extends BaseActivity implements ActivityT bundle.putString(UserListingFragment.EXTRA_ACCOUNT_NAME, mAccountName); bundle.putBoolean(UserListingFragment.EXTRA_IS_MULTI_SELECTION, getIntent().getBooleanExtra(EXTRA_IS_MULTI_SELECTION, false)); mFragment.setArguments(bundle); - getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_search_users_result_activity, mFragment).commit(); } else { mFragment = getSupportFragmentManager().getFragment(savedInstanceState, FRAGMENT_OUT_STATE); - getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_search_users_result_activity, mFragment).commit(); } + getSupportFragmentManager().beginTransaction() + .replace(R.id.frame_layout_search_users_result_activity, mFragment) + .commit(); } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java index 9602da8b..e2d10e55 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java @@ -266,12 +266,7 @@ public class ViewImageOrGifActivity extends AppCompatActivity implements SetAsWa final SubsamplingScaleImageView view = mImageView.getSSIV(); if (view != null) { - view.setOnImageEventListener(new SubsamplingScaleImageView.OnImageEventListener() { - @Override - public void onReady() { - - } - + view.setOnImageEventListener(new SubsamplingScaleImageView.DefaultOnImageEventListener() { @Override public void onImageLoaded() { view.setMinimumDpi(80); @@ -280,26 +275,6 @@ public class ViewImageOrGifActivity extends AppCompatActivity implements SetAsWa view.setQuickScaleEnabled(true); view.resetScaleAndCenter(); } - - @Override - public void onPreviewLoadError(Exception e) { - - } - - @Override - public void onImageLoadError(Exception e) { - - } - - @Override - public void onTileLoadError(Exception e) { - - } - - @Override - public void onPreviewReleased() { - - } }); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImgurMediaActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImgurMediaActivity.java index 8aab0011..20d3440f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImgurMediaActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImgurMediaActivity.java @@ -21,8 +21,8 @@ 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 app.futured.hauler.DragDirection; +import app.futured.hauler.HaulerView; import org.json.JSONArray; import org.json.JSONException; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java index b5047cc6..61a5066f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java @@ -17,8 +17,8 @@ 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 app.futured.hauler.DragDirection; +import app.futured.hauler.HaulerView; import java.util.ArrayList; import java.util.concurrent.Executor; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java index f82e85b7..3f17763b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java @@ -55,8 +55,8 @@ import com.google.android.exoplayer2.upstream.cache.SimpleCache; import com.google.android.exoplayer2.util.Util; import com.google.android.material.bottomappbar.BottomAppBar; import com.google.android.material.snackbar.Snackbar; -import com.thefuntasty.hauler.DragDirection; -import com.thefuntasty.hauler.HaulerView; +import app.futured.hauler.DragDirection; +import app.futured.hauler.HaulerView; import org.apache.commons.io.FilenameUtils; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AcknowledgementRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AcknowledgementRecyclerViewAdapter.java index c6f7ee56..9d9b0843 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AcknowledgementRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AcknowledgementRecyclerViewAdapter.java @@ -35,7 +35,7 @@ public class AcknowledgementRecyclerViewAdapter extends RecyclerView.Adapter<Ack @Override public void onBindViewHolder(@NonNull AcknowledgementViewHolder holder, int position) { - Acknowledgement acknowledgement = acknowledgements.get(holder.getAdapterPosition()); + Acknowledgement acknowledgement = acknowledgements.get(holder.getBindingAdapterPosition()); if (acknowledgement != null) { holder.nameTextView.setText(acknowledgement.getName()); holder.introductionTextView.setText(acknowledgement.getIntroduction()); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AwardRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AwardRecyclerViewAdapter.java index 5f233a53..cfe0d799 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AwardRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/AwardRecyclerViewAdapter.java @@ -91,7 +91,7 @@ public class AwardRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView. coinTextView.setTextColor(primaryTextColor); itemView.setOnClickListener(view -> { - itemOnClickListener.onClick(awards.get(getAdapterPosition())); + itemOnClickListener.onClick(awards.get(getBindingAdapterPosition())); }); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FlairBottomSheetRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FlairBottomSheetRecyclerViewAdapter.java index 4d738aa3..399726d0 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FlairBottomSheetRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FlairBottomSheetRecyclerViewAdapter.java @@ -44,7 +44,7 @@ public class FlairBottomSheetRecyclerViewAdapter extends RecyclerView.Adapter<Fl @Override public void onBindViewHolder(@NonNull FlairViewHolder holder, int position) { - if (flairs.get(holder.getAdapterPosition()).isEditable()) { + if (flairs.get(holder.getBindingAdapterPosition()).isEditable()) { holder.editFlairImageView.setVisibility(View.VISIBLE); holder.editFlairImageView.setOnClickListener(view -> { View dialogView = ((Activity) context).getLayoutInflater().inflate(R.layout.dialog_edit_flair, null); @@ -59,7 +59,7 @@ public class FlairBottomSheetRecyclerViewAdapter extends RecyclerView.Adapter<Fl .setView(dialogView) .setPositiveButton(R.string.ok, (dialogInterface, i) -> { - Flair flair = flairs.get(holder.getAdapterPosition()); + Flair flair = flairs.get(holder.getBindingAdapterPosition()); flair.setText(flairEditText.getText().toString()); itemClickListener.onClick(flair); }) @@ -68,13 +68,13 @@ public class FlairBottomSheetRecyclerViewAdapter extends RecyclerView.Adapter<Fl }); } - if (flairs.get(holder.getAdapterPosition()).isEditable() && flairs.get(holder.getAdapterPosition()).getText().equals("")) { + if (flairs.get(holder.getBindingAdapterPosition()).isEditable() && flairs.get(holder.getBindingAdapterPosition()).getText().equals("")) { holder.itemView.setOnClickListener(view -> holder.editFlairImageView.performClick()); } else { - holder.itemView.setOnClickListener(view -> itemClickListener.onClick(flairs.get(holder.getAdapterPosition()))); + holder.itemView.setOnClickListener(view -> itemClickListener.onClick(flairs.get(holder.getBindingAdapterPosition()))); } - holder.flairTextView.setText(flairs.get(holder.getAdapterPosition()).getText()); + holder.flairTextView.setText(flairs.get(holder.getBindingAdapterPosition()).getText()); } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FollowedUsersRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FollowedUsersRecyclerViewAdapter.java index a077569e..89bae0c9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FollowedUsersRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/FollowedUsersRecyclerViewAdapter.java @@ -106,8 +106,8 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc int offset = (mFavoriteSubscribedUserData != null && mFavoriteSubscribedUserData.size() > 0) ? mFavoriteSubscribedUserData.size() + 2 : 0; - if (!mSubscribedUserData.get(viewHolder.getAdapterPosition() - offset).getIconUrl().equals("")) { - glide.load(mSubscribedUserData.get(viewHolder.getAdapterPosition() - offset).getIconUrl()) + if (!mSubscribedUserData.get(viewHolder.getBindingAdapterPosition() - offset).getIconUrl().equals("")) { + glide.load(mSubscribedUserData.get(viewHolder.getBindingAdapterPosition() - offset).getIconUrl()) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) .error(glide.load(R.drawable.subreddit_default_icon) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))) @@ -117,16 +117,16 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) .into(((UserViewHolder) viewHolder).iconGifImageView); } - ((UserViewHolder) viewHolder).userNameTextView.setText(mSubscribedUserData.get(viewHolder.getAdapterPosition() - offset).getName()); + ((UserViewHolder) viewHolder).userNameTextView.setText(mSubscribedUserData.get(viewHolder.getBindingAdapterPosition() - offset).getName()); - if(mSubscribedUserData.get(viewHolder.getAdapterPosition() - offset).isFavorite()) { + if(mSubscribedUserData.get(viewHolder.getBindingAdapterPosition() - offset).isFavorite()) { ((UserViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_24dp); } else { ((UserViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_border_24dp); } } else if (viewHolder instanceof FavoriteUserViewHolder) { - if (!mFavoriteSubscribedUserData.get(viewHolder.getAdapterPosition() - 1).getIconUrl().equals("")) { - glide.load(mFavoriteSubscribedUserData.get(viewHolder.getAdapterPosition() - 1).getIconUrl()) + if (!mFavoriteSubscribedUserData.get(viewHolder.getBindingAdapterPosition() - 1).getIconUrl().equals("")) { + glide.load(mFavoriteSubscribedUserData.get(viewHolder.getBindingAdapterPosition() - 1).getIconUrl()) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) .error(glide.load(R.drawable.subreddit_default_icon) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))) @@ -136,9 +136,9 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) .into(((FavoriteUserViewHolder) viewHolder).iconGifImageView); } - ((FavoriteUserViewHolder) viewHolder).userNameTextView.setText(mFavoriteSubscribedUserData.get(viewHolder.getAdapterPosition() - 1).getName()); + ((FavoriteUserViewHolder) viewHolder).userNameTextView.setText(mFavoriteSubscribedUserData.get(viewHolder.getBindingAdapterPosition() - 1).getName()); - if(mFavoriteSubscribedUserData.get(viewHolder.getAdapterPosition() - 1).isFavorite()) { + if(mFavoriteSubscribedUserData.get(viewHolder.getBindingAdapterPosition() - 1).isFavorite()) { ((FavoriteUserViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_24dp); } else { ((FavoriteUserViewHolder) viewHolder).favoriteImageView.setImageResource(R.drawable.ic_favorite_border_24dp); @@ -205,7 +205,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc userNameTextView.setTextColor(mPrimaryTextColor); itemView.setOnClickListener(view -> { - int position = getAdapterPosition() - 1; + int position = getBindingAdapterPosition() - 1; if(position >= 0 && mFavoriteSubscribedUserData.size() > position) { Intent intent = new Intent(mContext, ViewUserDetailActivity.class); intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, mFavoriteSubscribedUserData.get(position).getName()); @@ -214,7 +214,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc }); favoriteImageView.setOnClickListener(view -> { - int position = getAdapterPosition() - 1; + int position = getBindingAdapterPosition() - 1; if(position >= 0 && mFavoriteSubscribedUserData.size() > position) { if(mFavoriteSubscribedUserData.get(position).isFavorite()) { favoriteImageView.setImageResource(R.drawable.ic_favorite_border_24dp); @@ -225,7 +225,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc new FavoriteThing.FavoriteThingListener() { @Override public void success() { - int position = getAdapterPosition() - 1; + int position = getBindingAdapterPosition() - 1; if(position >= 0 && mFavoriteSubscribedUserData.size() > position) { mFavoriteSubscribedUserData.get(position).setFavorite(false); } @@ -235,7 +235,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc @Override public void failed() { Toast.makeText(mContext, R.string.thing_unfavorite_failed, Toast.LENGTH_SHORT).show(); - int position = getAdapterPosition() - 1; + int position = getBindingAdapterPosition() - 1; if(position >= 0 && mFavoriteSubscribedUserData.size() > position) { mFavoriteSubscribedUserData.get(position).setFavorite(true); } @@ -251,7 +251,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc new FavoriteThing.FavoriteThingListener() { @Override public void success() { - int position = getAdapterPosition() - 1; + int position = getBindingAdapterPosition() - 1; if(position >= 0 && mFavoriteSubscribedUserData.size() > position) { mFavoriteSubscribedUserData.get(position).setFavorite(true); } @@ -261,7 +261,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc @Override public void failed() { Toast.makeText(mContext, R.string.thing_favorite_failed, Toast.LENGTH_SHORT).show(); - int position = getAdapterPosition() - 1; + int position = getBindingAdapterPosition() - 1; if(position >= 0 && mFavoriteSubscribedUserData.size() > position) { mFavoriteSubscribedUserData.get(position).setFavorite(false); } @@ -290,7 +290,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc itemView.setOnClickListener(view -> { int offset = (mFavoriteSubscribedUserData != null && mFavoriteSubscribedUserData.size() > 0) ? mFavoriteSubscribedUserData.size() + 2 : 0; - int position = getAdapterPosition() - offset; + int position = getBindingAdapterPosition() - offset; if(position >= 0 && mSubscribedUserData.size() > position) { Intent intent = new Intent(mContext, ViewUserDetailActivity.class); intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, mSubscribedUserData.get(position).getName()); @@ -301,7 +301,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc favoriteImageView.setOnClickListener(view -> { int offset = (mFavoriteSubscribedUserData != null && mFavoriteSubscribedUserData.size() > 0) ? mFavoriteSubscribedUserData.size() + 2 : 0; - int position = getAdapterPosition() - offset; + int position = getBindingAdapterPosition() - offset; if(position >= 0 && mSubscribedUserData.size() > position) { if(mSubscribedUserData.get(position).isFavorite()) { @@ -313,7 +313,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc new FavoriteThing.FavoriteThingListener() { @Override public void success() { - int position = getAdapterPosition() - offset; + int position = getBindingAdapterPosition() - offset; if(position >= 0 && mSubscribedUserData.size() > position) { mSubscribedUserData.get(position).setFavorite(false); } @@ -323,7 +323,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc @Override public void failed() { Toast.makeText(mContext, R.string.thing_unfavorite_failed, Toast.LENGTH_SHORT).show(); - int position = getAdapterPosition() - offset; + int position = getBindingAdapterPosition() - offset; if(position >= 0 && mSubscribedUserData.size() > position) { mSubscribedUserData.get(position).setFavorite(true); } @@ -339,7 +339,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc new FavoriteThing.FavoriteThingListener() { @Override public void success() { - int position = getAdapterPosition() - offset; + int position = getBindingAdapterPosition() - offset; if(position >= 0 && mSubscribedUserData.size() > position) { mSubscribedUserData.get(position).setFavorite(true); } @@ -349,7 +349,7 @@ public class FollowedUsersRecyclerViewAdapter extends RecyclerView.Adapter<Recyc @Override public void failed() { Toast.makeText(mContext, R.string.thing_favorite_failed, Toast.LENGTH_SHORT).show(); - int position = getAdapterPosition() - offset; + int position = getBindingAdapterPosition() - offset; if(position >= 0 && mSubscribedUserData.size() > position) { mSubscribedUserData.get(position).setFavorite(false); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java index 2c283669..3925d59c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java @@ -201,7 +201,7 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { if (holder instanceof DataViewHolder) { - Message message = getItem(holder.getAdapterPosition()); + Message message = getItem(holder.getBindingAdapterPosition()); if (message != null) { ArrayList<Message> replies = message.getReplies(); Message displayedMessage; @@ -240,7 +240,7 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl } else if (mMessageType == FetchMessage.MESSAGE_TYPE_PRIVATE_MESSAGE) { Intent intent = new Intent(mContext, ViewPrivateMessagesActivity.class); intent.putExtra(ViewPrivateMessagesActivity.EXTRA_PRIVATE_MESSAGE, message); - intent.putExtra(ViewPrivateMessagesActivity.EXTRA_MESSAGE_POSITION, holder.getAdapterPosition()); + intent.putExtra(ViewPrivateMessagesActivity.EXTRA_MESSAGE_POSITION, holder.getBindingAdapterPosition()); mContext.startActivity(intent); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MultiRedditListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MultiRedditListingRecyclerViewAdapter.java index 580e7fec..038f1744 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MultiRedditListingRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MultiRedditListingRecyclerViewAdapter.java @@ -116,7 +116,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter< int offset = (mFavoriteMultiReddits != null && mFavoriteMultiReddits.size() > 0) ? mFavoriteMultiReddits.size() + 2 : 0; - MultiReddit multiReddit = mMultiReddits.get(holder.getAdapterPosition() - offset); + MultiReddit multiReddit = mMultiReddits.get(holder.getBindingAdapterPosition() - offset); name = multiReddit.getDisplayName(); iconUrl = multiReddit.getIconUrl(); if(multiReddit.isFavorite()) { @@ -134,7 +134,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter< new FavoriteMultiReddit.FavoriteMultiRedditListener() { @Override public void success() { - int position = holder.getAdapterPosition() - offset; + int position = holder.getBindingAdapterPosition() - offset; if(position >= 0 && mMultiReddits.size() > position) { mMultiReddits.get(position).setFavorite(false); } @@ -144,7 +144,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter< @Override public void failed() { Toast.makeText(mActivity, R.string.thing_unfavorite_failed, Toast.LENGTH_SHORT).show(); - int position = holder.getAdapterPosition() - offset; + int position = holder.getBindingAdapterPosition() - offset; if(position >= 0 && mMultiReddits.size() > position) { mMultiReddits.get(position).setFavorite(true); } @@ -160,7 +160,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter< new FavoriteMultiReddit.FavoriteMultiRedditListener() { @Override public void success() { - int position = holder.getAdapterPosition() - offset; + int position = holder.getBindingAdapterPosition() - offset; if(position >= 0 && mMultiReddits.size() > position) { mMultiReddits.get(position).setFavorite(true); } @@ -170,7 +170,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter< @Override public void failed() { Toast.makeText(mActivity, R.string.thing_favorite_failed, Toast.LENGTH_SHORT).show(); - int position = holder.getAdapterPosition() - offset; + int position = holder.getBindingAdapterPosition() - offset; if(position >= 0 && mMultiReddits.size() > position) { mMultiReddits.get(position).setFavorite(false); } @@ -202,7 +202,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter< } ((MultiRedditViewHolder) holder).multiRedditNameTextView.setText(name); } else if (holder instanceof FavoriteMultiRedditViewHolder) { - MultiReddit multiReddit = mFavoriteMultiReddits.get(holder.getAdapterPosition() - 1); + MultiReddit multiReddit = mFavoriteMultiReddits.get(holder.getBindingAdapterPosition() - 1); String name = multiReddit.getDisplayName(); String iconUrl = multiReddit.getIconUrl(); if(multiReddit.isFavorite()) { @@ -220,7 +220,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter< new FavoriteMultiReddit.FavoriteMultiRedditListener() { @Override public void success() { - int position = holder.getAdapterPosition() - 1; + int position = holder.getBindingAdapterPosition() - 1; if(position >= 0 && mFavoriteMultiReddits.size() > position) { mFavoriteMultiReddits.get(position).setFavorite(false); } @@ -230,7 +230,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter< @Override public void failed() { Toast.makeText(mActivity, R.string.thing_unfavorite_failed, Toast.LENGTH_SHORT).show(); - int position = holder.getAdapterPosition() - 1; + int position = holder.getBindingAdapterPosition() - 1; if(position >= 0 && mFavoriteMultiReddits.size() > position) { mFavoriteMultiReddits.get(position).setFavorite(true); } @@ -246,7 +246,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter< new FavoriteMultiReddit.FavoriteMultiRedditListener() { @Override public void success() { - int position = holder.getAdapterPosition() - 1; + int position = holder.getBindingAdapterPosition() - 1; if(position >= 0 && mFavoriteMultiReddits.size() > position) { mFavoriteMultiReddits.get(position).setFavorite(true); } @@ -256,7 +256,7 @@ public class MultiRedditListingRecyclerViewAdapter extends RecyclerView.Adapter< @Override public void failed() { Toast.makeText(mActivity, R.string.thing_favorite_failed, Toast.LENGTH_SHORT).show(); - int position = holder.getAdapterPosition() - 1; + int position = holder.getBindingAdapterPosition() - 1; if(position >= 0 && mFavoriteMultiReddits.size() > position) { mFavoriteMultiReddits.get(position).setFavorite(false); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java index e7a673cc..4c3ee7e3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java @@ -1727,7 +1727,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler } if (helper == null) { helper = new ExoPlayerViewHelper(this, mediaUri, null, mExoCreator); - helper.addEventListener(new Playable.EventListener() { + helper.addEventListener(new Playable.DefaultEventListener() { @Override public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) { if (!trackGroups.isEmpty()) { @@ -1750,16 +1750,6 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler } @Override - public void onMetadata(Metadata metadata) { - - } - - @Override - public void onCues(List<Cue> cues) { - - } - - @Override public void onRenderedFirstFrame() { mGlide.clear(previewImageView); previewImageView.setVisibility(View.GONE); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterUsageRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterUsageRecyclerViewAdapter.java index d6d4c938..e8c92df3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterUsageRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterUsageRecyclerViewAdapter.java @@ -86,7 +86,7 @@ public class PostFilterUsageRecyclerViewAdapter extends RecyclerView.Adapter<Rec usageTextView = (TextView) itemView; usageTextView.setOnClickListener(view -> { - onItemClickListener.onClick(postFilterUsages.get(getAdapterPosition())); + onItemClickListener.onClick(postFilterUsages.get(getBindingAdapterPosition())); }); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java index 93a4ef30..6bc1ec30 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java @@ -2758,7 +2758,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie } if (helper == null) { helper = new ExoPlayerViewHelper(this, mediaUri, null, mExoCreator); - helper.addEventListener(new Playable.EventListener() { + helper.addEventListener(new Playable.DefaultEventListener() { @Override public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) { if (!trackGroups.isEmpty()) { @@ -2784,16 +2784,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie } @Override - public void onMetadata(Metadata metadata) { - - } - - @Override - public void onCues(List<Cue> cues) { - - } - - @Override public void onRenderedFirstFrame() { mGlide.clear(previewImageView); previewImageView.setVisibility(View.GONE); @@ -3987,7 +3977,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie } if (helper == null) { helper = new ExoPlayerViewHelper(this, mediaUri, null, mExoCreator); - helper.addEventListener(new Playable.EventListener() { + helper.addEventListener(new Playable.DefaultEventListener() { @Override public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) { if (!trackGroups.isEmpty()) { @@ -4013,16 +4003,6 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie } @Override - public void onMetadata(Metadata metadata) { - - } - - @Override - public void onCues(List<Cue> cues) { - - } - - @Override public void onRenderedFirstFrame() { mGlide.clear(previewImageView); previewImageView.setVisibility(View.GONE); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java index 190b8ad5..8fe78d79 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PrivateMessagesDetailRecyclerViewAdapter.java @@ -117,10 +117,10 @@ public class PrivateMessagesDetailRecyclerViewAdapter extends RecyclerView.Adapt @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { Message message; - if (holder.getAdapterPosition() == 0) { + if (holder.getBindingAdapterPosition() == 0) { message = mMessage; } else { - message = mMessage.getReplies().get(holder.getAdapterPosition() - 1); + message = mMessage.getReplies().get(holder.getBindingAdapterPosition() - 1); } if (message != null) { if (holder instanceof MessageViewHolder) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/ReportReasonRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/ReportReasonRecyclerViewAdapter.java index 5e5572ff..80e57a5a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/ReportReasonRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/ReportReasonRecyclerViewAdapter.java @@ -42,9 +42,9 @@ public class ReportReasonRecyclerViewAdapter extends RecyclerView.Adapter<Recycl if (holder instanceof ReasonViewHolder) { ReportReason reportReason; if (position >= generalReasons.size()) { - reportReason = rules.get(holder.getAdapterPosition() - generalReasons.size()); + reportReason = rules.get(holder.getBindingAdapterPosition() - generalReasons.size()); } else { - reportReason = generalReasons.get(holder.getAdapterPosition()); + reportReason = generalReasons.get(holder.getBindingAdapterPosition()); } ((ReasonViewHolder) holder).reasonTextView.setText(reportReason.getReportReason()); ((ReasonViewHolder) holder).checkBox.setChecked(reportReason.isSelected()); @@ -119,10 +119,10 @@ public class ReportReasonRecyclerViewAdapter extends RecyclerView.Adapter<Recycl } } - if (getAdapterPosition() >= generalReasons.size()) { - rules.get(getAdapterPosition() - generalReasons.size()).setSelected(checkBox.isChecked()); + if (getBindingAdapterPosition() >= generalReasons.size()) { + rules.get(getBindingAdapterPosition() - generalReasons.size()).setSelected(checkBox.isChecked()); } else { - generalReasons.get(getAdapterPosition()).setSelected(checkBox.isChecked()); + generalReasons.get(getBindingAdapterPosition()).setSelected(checkBox.isChecked()); } }); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java index 51d55400..454ecdd4 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/RulesRecyclerViewAdapter.java @@ -82,11 +82,11 @@ public class RulesRecyclerViewAdapter extends RecyclerView.Adapter<RulesRecycler @Override public void onBindViewHolder(@NonNull RuleViewHolder holder, int position) { - holder.shortNameTextView.setText(rules.get(holder.getAdapterPosition()).getShortName()); - if (rules.get(holder.getAdapterPosition()).getDescriptionHtml() == null) { + holder.shortNameTextView.setText(rules.get(holder.getBindingAdapterPosition()).getShortName()); + if (rules.get(holder.getBindingAdapterPosition()).getDescriptionHtml() == null) { holder.descriptionMarkwonView.setVisibility(View.GONE); } else { - markwon.setMarkdown(holder.descriptionMarkwonView, rules.get(holder.getAdapterPosition()).getDescriptionHtml()); + markwon.setMarkdown(holder.descriptionMarkwonView, rules.get(holder.getBindingAdapterPosition()).getDescriptionHtml()); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SearchActivityRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SearchActivityRecyclerViewAdapter.java index f4da7bd7..35cf33e7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SearchActivityRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SearchActivityRecyclerViewAdapter.java @@ -82,12 +82,12 @@ public class SearchActivityRecyclerViewAdapter extends RecyclerView.Adapter<Recy itemView.setOnClickListener(view -> { if (recentSearchQueries != null && !recentSearchQueries.isEmpty()) { - itemOnClickListener.onClick(recentSearchQueries.get(getAdapterPosition()).getSearchQuery()); + itemOnClickListener.onClick(recentSearchQueries.get(getBindingAdapterPosition()).getSearchQuery()); } }); deleteImageView.setOnClickListener(view -> { - itemOnClickListener.onDelete(recentSearchQueries.get(getAdapterPosition())); + itemOnClickListener.onDelete(recentSearchQueries.get(getBindingAdapterPosition())); }); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SelectedSubredditsRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SelectedSubredditsRecyclerViewAdapter.java index e6bbe441..ad57d3ba 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SelectedSubredditsRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SelectedSubredditsRecyclerViewAdapter.java @@ -39,10 +39,10 @@ public class SelectedSubredditsRecyclerViewAdapter extends RecyclerView.Adapter< @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { if (holder instanceof SubredditViewHolder) { - ((SubredditViewHolder) holder).subredditNameTextView.setText(subreddits.get(holder.getAdapterPosition())); + ((SubredditViewHolder) holder).subredditNameTextView.setText(subreddits.get(holder.getBindingAdapterPosition())); ((SubredditViewHolder) holder).deleteButton.setOnClickListener(view -> { - subreddits.remove(holder.getAdapterPosition()); - notifyItemRemoved(holder.getAdapterPosition()); + subreddits.remove(holder.getBindingAdapterPosition()); + notifyItemRemoved(holder.getBindingAdapterPosition()); }); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UserFlairRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UserFlairRecyclerViewAdapter.java index 1f05380b..d260bb0d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UserFlairRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UserFlairRecyclerViewAdapter.java @@ -43,7 +43,7 @@ public class UserFlairRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerV @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { if (holder instanceof UserFlairViewHolder) { - UserFlair userFlair = userFlairs.get(holder.getAdapterPosition()); + UserFlair userFlair = userFlairs.get(holder.getBindingAdapterPosition()); if (userFlair.getHtmlText() == null || userFlair.getHtmlText().equals("")) { ((UserFlairViewHolder) holder).userFlairHtmlTextView.setText(userFlair.getText()); } else { @@ -77,11 +77,11 @@ public class UserFlairRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerV editUserFlairImageView.setColorFilter(customThemeWrapper.getPrimaryTextColor(), android.graphics.PorterDuff.Mode.SRC_IN); itemView.setOnClickListener(view -> { - itemClickListener.onClick(userFlairs.get(getAdapterPosition()), false); + itemClickListener.onClick(userFlairs.get(getBindingAdapterPosition()), false); }); editUserFlairImageView.setOnClickListener(view -> { - itemClickListener.onClick(userFlairs.get(getAdapterPosition()), true); + itemClickListener.onClick(userFlairs.get(getBindingAdapterPosition()), true); }); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryImageOrGifFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryImageOrGifFragment.java index cee6d404..05f0ab7a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryImageOrGifFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryImageOrGifFragment.java @@ -153,12 +153,7 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment { final SubsamplingScaleImageView view = imageView.getSSIV(); if (view != null) { - view.setOnImageEventListener(new SubsamplingScaleImageView.OnImageEventListener() { - @Override - public void onReady() { - - } - + view.setOnImageEventListener(new SubsamplingScaleImageView.DefaultOnImageEventListener() { @Override public void onImageLoaded() { view.setMinimumDpi(80); @@ -167,26 +162,6 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment { view.setQuickScaleEnabled(true); view.resetScaleAndCenter(); } - - @Override - public void onPreviewLoadError(Exception e) { - - } - - @Override - public void onImageLoadError(Exception e) { - - } - - @Override - public void onTileLoadError(Exception e) { - - } - - @Override - public void onPreviewReleased() { - - } }); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java b/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java index e5534ef9..f0a551fe 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java @@ -1,8 +1,6 @@ package ml.docilealligator.infinityforreddit.services; import android.app.Notification; -import android.app.NotificationChannel; -import android.app.NotificationManager; import android.app.PendingIntent; import android.app.Service; import android.content.ContentResolver; @@ -22,6 +20,7 @@ import android.os.Message; import android.os.Process; import android.provider.MediaStore; +import androidx.core.app.NotificationChannelCompat; import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationManagerCompat; import androidx.documentfile.provider.DocumentFile; @@ -367,16 +366,13 @@ public class DownloadMediaService extends Service { int mediaType = intent.getIntExtra(EXTRA_MEDIA_TYPE, EXTRA_MEDIA_TYPE_IMAGE); builder = new NotificationCompat.Builder(this, getNotificationChannelId(mediaType)); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - NotificationChannel serviceChannel; - serviceChannel = new NotificationChannel( - getNotificationChannelId(mediaType), - getNotificationChannel(mediaType), - NotificationManager.IMPORTANCE_LOW - ); - - notificationManager.createNotificationChannel(serviceChannel); - } + NotificationChannelCompat serviceChannel = + new NotificationChannelCompat.Builder( + getNotificationChannelId(mediaType), + NotificationManagerCompat.IMPORTANCE_LOW) + .setName(getNotificationChannel(mediaType)) + .build(); + notificationManager.createNotificationChannel(serviceChannel); int randomNotificationIdOffset = new Random().nextInt(10000); switch (intent.getIntExtra(EXTRA_MEDIA_TYPE, EXTRA_MEDIA_TYPE_IMAGE)) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java b/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java index a398871e..2079e024 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java @@ -1,8 +1,6 @@ package ml.docilealligator.infinityforreddit.services; import android.app.Notification; -import android.app.NotificationChannel; -import android.app.NotificationManager; import android.app.PendingIntent; import android.app.Service; import android.content.ContentResolver; @@ -26,6 +24,7 @@ import android.os.Message; import android.os.Process; import android.provider.MediaStore; +import androidx.core.app.NotificationChannelCompat; import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationManagerCompat; import androidx.documentfile.provider.DocumentFile; @@ -501,16 +500,13 @@ public class DownloadRedditVideoService extends Service { String subredditName = intent.getStringExtra(EXTRA_SUBREDDIT); String fileNameWithoutExtension = subredditName + "-" + intent.getStringExtra(EXTRA_POST_ID); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - NotificationChannel serviceChannel; - serviceChannel = new NotificationChannel( - NotificationUtils.CHANNEL_ID_DOWNLOAD_REDDIT_VIDEO, - NotificationUtils.CHANNEL_DOWNLOAD_REDDIT_VIDEO, - NotificationManager.IMPORTANCE_LOW - ); - - notificationManager.createNotificationChannel(serviceChannel); - } + NotificationChannelCompat serviceChannel = + new NotificationChannelCompat.Builder( + NotificationUtils.CHANNEL_ID_DOWNLOAD_REDDIT_VIDEO, + NotificationManagerCompat.IMPORTANCE_LOW) + .setName(NotificationUtils.CHANNEL_DOWNLOAD_REDDIT_VIDEO) + .build(); + notificationManager.createNotificationChannel(serviceChannel); int randomNotificationIdOffset = new Random().nextInt(10000); startForeground( diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/services/MaterialYouService.java b/app/src/main/java/ml/docilealligator/infinityforreddit/services/MaterialYouService.java index 66bd4e0b..40059987 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/services/MaterialYouService.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/services/MaterialYouService.java @@ -1,16 +1,14 @@ package ml.docilealligator.infinityforreddit.services; import android.app.Notification; -import android.app.NotificationChannel; -import android.app.NotificationManager; import android.app.Service; import android.content.Intent; import android.content.SharedPreferences; -import android.os.Build; import android.os.Handler; import android.os.IBinder; import androidx.annotation.Nullable; +import androidx.core.app.NotificationChannelCompat; import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationManagerCompat; @@ -60,16 +58,17 @@ public class MaterialYouService extends Service { @Override public int onStartCommand(Intent intent, int flags, int startId) { ((Infinity) getApplication()).getAppComponent().inject(this); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - NotificationChannel serviceChannel = new NotificationChannel( - NotificationUtils.CHANNEL_ID_MATERIAL_YOU, - NotificationUtils.CHANNEL_MATERIAL_YOU, - NotificationManager.IMPORTANCE_LOW - ); - - NotificationManagerCompat manager = NotificationManagerCompat.from(this); - manager.createNotificationChannel(serviceChannel); - } + + NotificationChannelCompat serviceChannel = + new NotificationChannelCompat.Builder( + NotificationUtils.CHANNEL_ID_MATERIAL_YOU, + NotificationManagerCompat.IMPORTANCE_LOW) + .setName(NotificationUtils.CHANNEL_MATERIAL_YOU) + .build(); + + NotificationManagerCompat manager = NotificationManagerCompat.from(this); + manager.createNotificationChannel(serviceChannel); + Notification notification = new NotificationCompat.Builder(this, NotificationUtils.CHANNEL_ID_MATERIAL_YOU) .setContentTitle(getString(R.string.material_you_notification_title)) .setContentText(getString(R.string.please_wait)) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/services/SubmitPostService.java b/app/src/main/java/ml/docilealligator/infinityforreddit/services/SubmitPostService.java index e22bc541..f1ba75f3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/services/SubmitPostService.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/services/SubmitPostService.java @@ -1,13 +1,10 @@ package ml.docilealligator.infinityforreddit.services; import android.app.Notification; -import android.app.NotificationChannel; -import android.app.NotificationManager; import android.app.Service; import android.content.Intent; import android.graphics.Bitmap; import android.net.Uri; -import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.HandlerThread; @@ -19,6 +16,7 @@ import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.core.app.NotificationChannelCompat; import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationManagerCompat; @@ -164,16 +162,15 @@ public class SubmitPostService extends Service { public int onStartCommand(Intent intent, int flags, int startId) { ((Infinity) getApplication()).getAppComponent().inject(this); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - NotificationChannel serviceChannel = new NotificationChannel( - NotificationUtils.CHANNEL_SUBMIT_POST, - NotificationUtils.CHANNEL_SUBMIT_POST, - NotificationManager.IMPORTANCE_LOW - ); + NotificationChannelCompat serviceChannel = + new NotificationChannelCompat.Builder( + NotificationUtils.CHANNEL_SUBMIT_POST, + NotificationManagerCompat.IMPORTANCE_LOW) + .setName(NotificationUtils.CHANNEL_SUBMIT_POST) + .build(); - NotificationManagerCompat manager = NotificationManagerCompat.from(this); - manager.createNotificationChannel(serviceChannel); - } + NotificationManagerCompat manager = NotificationManagerCompat.from(this); + manager.createNotificationChannel(serviceChannel); int randomNotificationIdOffset = new Random().nextInt(10000); int postType = intent.getIntExtra(EXTRA_POST_TYPE, EXTRA_POST_TEXT_OR_LINK); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/AcknowledgementFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/AcknowledgementFragment.java index 2f2aa91e..c5a3690d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/AcknowledgementFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/AcknowledgementFragment.java @@ -50,12 +50,6 @@ public class AcknowledgementFragment extends Fragment { acknowledgements.add(new Acknowledgement("Glide", "A fast and efficient open source media management and image loading framework for Android", Uri.parse("https://github.com/bumptech/glide"))); - acknowledgements.add(new Acknowledgement("RxAndroid", - "Android specific bindings for RxJava 2", - Uri.parse("https://github.com/ReactiveX/RxAndroid"))); - acknowledgements.add(new Acknowledgement("RxJava", - "Reactive extensions for the JVM", - Uri.parse("https://github.com/ReactiveX/RxJava"))); acknowledgements.add(new Acknowledgement("Retrofit", "Type-safe HTTP client for Android and Java by Square, Inc.", Uri.parse("https://github.com/square/retrofit"))); 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 465a31eb..5078692d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/APIUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/APIUtils.java @@ -120,6 +120,6 @@ public class APIUtils { } public static RequestBody getRequestBody(String s) { - return RequestBody.create(MediaType.parse("text/plain"), s); + return RequestBody.create(s, MediaType.parse("text/plain")); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/NotificationUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/NotificationUtils.java index 5552271f..459a0170 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/NotificationUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/NotificationUtils.java @@ -1,10 +1,8 @@ package ml.docilealligator.infinityforreddit.utils; -import android.app.NotificationChannel; -import android.app.NotificationManager; import android.content.Context; -import android.os.Build; +import androidx.core.app.NotificationChannelCompat; import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationManagerCompat; @@ -40,10 +38,11 @@ public class NotificationUtils { Context context, String title, String content, String summary, String channelId, String channelName, String group, int color) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - NotificationChannel channel = new NotificationChannel(channelId, channelName, NotificationManager.IMPORTANCE_DEFAULT); - notificationManager.createNotificationChannel(channel); - } + NotificationChannelCompat channel = + new NotificationChannelCompat.Builder(channelId, NotificationManagerCompat.IMPORTANCE_DEFAULT) + .setName(channelName) + .build(); + notificationManager.createNotificationChannel(channel); return new NotificationCompat.Builder(context.getApplicationContext(), channelId) .setContentTitle(title) @@ -60,10 +59,11 @@ public class NotificationUtils { public static NotificationCompat.Builder buildSummaryNotification(Context context, NotificationManagerCompat notificationManager, String title, String content, String channelId, String channelName, String group, int color) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - NotificationChannel channel = new NotificationChannel(channelId, channelName, NotificationManager.IMPORTANCE_DEFAULT); - notificationManager.createNotificationChannel(channel); - } + NotificationChannelCompat channel = + new NotificationChannelCompat.Builder(channelId, NotificationManagerCompat.IMPORTANCE_DEFAULT) + .setName(channelName) + .build(); + notificationManager.createNotificationChannel(channel); return new NotificationCompat.Builder(context, channelId) .setContentTitle(title) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/UploadImageUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/UploadImageUtils.java index c7b5f728..e0bf7c25 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/UploadImageUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/UploadImageUtils.java @@ -50,7 +50,7 @@ public class UploadImageUtils { image.compress(Bitmap.CompressFormat.JPEG, 100, stream); byte[] byteArray = stream.toByteArray(); - RequestBody fileBody = RequestBody.create(MediaType.parse("application/octet-stream"), byteArray); + RequestBody fileBody = RequestBody.create(byteArray, MediaType.parse("application/octet-stream")); MultipartBody.Part fileToUpload = MultipartBody.Part.createFormData("file", "post_image.jpg", fileBody); RedditAPI uploadMediaToAWSApi = uploadMediaRetrofit.create(RedditAPI.class); diff --git a/app/src/main/res/layout/activity_account_posts.xml b/app/src/main/res/layout/activity_account_posts.xml index c49cdf72..a15dbc52 100644 --- a/app/src/main/res/layout/activity_account_posts.xml +++ b/app/src/main/res/layout/activity_account_posts.xml @@ -33,7 +33,7 @@ </com.google.android.material.appbar.AppBarLayout> - <FrameLayout + <androidx.fragment.app.FragmentContainerView android:id="@+id/frame_layout_account_posts_activity" android:layout_width="match_parent" android:layout_height="match_parent" diff --git a/app/src/main/res/layout/activity_anonymous_subscriptions.xml b/app/src/main/res/layout/activity_anonymous_subscriptions.xml index 85473583..eb030fd8 100644 --- a/app/src/main/res/layout/activity_anonymous_subscriptions.xml +++ b/app/src/main/res/layout/activity_anonymous_subscriptions.xml @@ -32,7 +32,7 @@ </com.google.android.material.appbar.AppBarLayout> - <FrameLayout + <androidx.fragment.app.FragmentContainerView android:id="@+id/frame_layout_anonymous_subscriptions_activity" android:layout_width="match_parent" android:layout_height="match_parent" diff --git a/app/src/main/res/layout/activity_filtered_thing.xml b/app/src/main/res/layout/activity_filtered_thing.xml index 5aa0207b..bc2160ff 100644 --- a/app/src/main/res/layout/activity_filtered_thing.xml +++ b/app/src/main/res/layout/activity_filtered_thing.xml @@ -34,7 +34,7 @@ </com.google.android.material.appbar.AppBarLayout> - <FrameLayout + <androidx.fragment.app.FragmentContainerView android:id="@+id/frame_layout_filtered_posts_activity" android:layout_width="match_parent" android:layout_height="match_parent" diff --git a/app/src/main/res/layout/activity_multireddit_selection.xml b/app/src/main/res/layout/activity_multireddit_selection.xml index 4c114742..aec94a4f 100644 --- a/app/src/main/res/layout/activity_multireddit_selection.xml +++ b/app/src/main/res/layout/activity_multireddit_selection.xml @@ -32,7 +32,7 @@ </com.google.android.material.appbar.AppBarLayout> - <FrameLayout + <androidx.fragment.app.FragmentContainerView android:id="@+id/frame_layout_multireddit_selection_activity" android:layout_width="match_parent" android:layout_height="match_parent" 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 b3390378..5824e728 100644 --- a/app/src/main/res/layout/activity_search_subreddits_result.xml +++ b/app/src/main/res/layout/activity_search_subreddits_result.xml @@ -23,7 +23,7 @@ </com.google.android.material.appbar.AppBarLayout> - <FrameLayout + <androidx.fragment.app.FragmentContainerView android:id="@+id/frame_layout_search_subreddits_result_activity" android:layout_width="match_parent" android:layout_height="match_parent" diff --git a/app/src/main/res/layout/activity_search_users_result.xml b/app/src/main/res/layout/activity_search_users_result.xml index b594ccb5..cdc6ee54 100644 --- a/app/src/main/res/layout/activity_search_users_result.xml +++ b/app/src/main/res/layout/activity_search_users_result.xml @@ -23,7 +23,7 @@ </com.google.android.material.appbar.AppBarLayout> - <FrameLayout + <androidx.fragment.app.FragmentContainerView android:id="@+id/frame_layout_search_users_result_activity" android:layout_width="match_parent" android:layout_height="match_parent" diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 99b93a7a..339d4685 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -28,7 +28,7 @@ </com.google.android.material.appbar.AppBarLayout> - <FrameLayout + <androidx.fragment.app.FragmentContainerView android:id="@+id/frame_layout_settings_activity" android:layout_width="match_parent" android:layout_height="match_parent" diff --git a/app/src/main/res/layout/activity_subreddit_selection.xml b/app/src/main/res/layout/activity_subreddit_selection.xml index fddc0f8e..8d027137 100644 --- a/app/src/main/res/layout/activity_subreddit_selection.xml +++ b/app/src/main/res/layout/activity_subreddit_selection.xml @@ -32,7 +32,7 @@ </com.google.android.material.appbar.AppBarLayout> - <FrameLayout + <androidx.fragment.app.FragmentContainerView android:id="@+id/frame_layout_subreddit_selection_activity" android:layout_width="match_parent" android:layout_height="match_parent" 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 408ddff4..b9eaf6a2 100644 --- a/app/src/main/res/layout/activity_view_imgur_media.xml +++ b/app/src/main/res/layout/activity_view_imgur_media.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<com.thefuntasty.hauler.HaulerView xmlns:android="http://schemas.android.com/apk/res/android" +<app.futured.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_imgur_media_activity" @@ -51,4 +51,4 @@ </androidx.core.widget.NestedScrollView> -</com.thefuntasty.hauler.HaulerView>
\ No newline at end of file +</app.futured.hauler.HaulerView>
\ No newline at end of file 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 f5efe407..de606f75 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 @@ -33,7 +33,7 @@ </com.google.android.material.appbar.AppBarLayout> - <FrameLayout + <androidx.fragment.app.FragmentContainerView android:id="@+id/frame_layout_view_multi_reddit_detail_activity" android:layout_width="match_parent" android:layout_height="match_parent" diff --git a/app/src/main/res/layout/activity_view_reddit_gallery.xml b/app/src/main/res/layout/activity_view_reddit_gallery.xml index 6027fce2..495a2cc1 100644 --- a/app/src/main/res/layout/activity_view_reddit_gallery.xml +++ b/app/src/main/res/layout/activity_view_reddit_gallery.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<com.thefuntasty.hauler.HaulerView xmlns:android="http://schemas.android.com/apk/res/android" +<app.futured.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_reddit_gallery_activity" @@ -20,4 +20,4 @@ </androidx.core.widget.NestedScrollView> -</com.thefuntasty.hauler.HaulerView>
\ No newline at end of file +</app.futured.hauler.HaulerView>
\ No newline at end of file diff --git a/app/src/main/res/values/attr.xml b/app/src/main/res/values/attr.xml index 0cfd9358..a14ca442 100644 --- a/app/src/main/res/values/attr.xml +++ b/app/src/main/res/values/attr.xml @@ -49,7 +49,4 @@ <attr name="backgroundColor" format="color"/> <attr name="cardViewBackgroundColor" format="color"/> </declare-styleable> - - <attr name="backIconAlpha"/> - <attr name="iconsAlpha"/> </resources>
\ No newline at end of file diff --git a/build.gradle b/build.gradle index 2c7d3efd..2d33656e 100644 --- a/build.gradle +++ b/build.gradle @@ -3,10 +3,12 @@ buildscript { repositories { google() + mavenCentral() + maven { url "https://jitpack.io" } jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.1' + classpath 'com.android.tools.build:gradle:7.0.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -16,9 +18,9 @@ buildscript { allprojects { repositories { google() - jcenter() - maven { url "https://jitpack.io" } mavenCentral() + maven { url "https://jitpack.io" } + jcenter() } } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar Binary files differindex e708b1c0..7454180f 100644 --- a/gradle/wrapper/gradle-wrapper.jar +++ b/gradle/wrapper/gradle-wrapper.jar diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1f3fdbc5..a0f7639f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=`expr $i + 1` + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" |