diff options
author | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2024-04-29 03:38:03 +0000 |
---|---|---|
committer | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2024-04-29 03:38:03 +0000 |
commit | 1754c630ae30861d9199b9e7704b9097a1967128 (patch) | |
tree | a1f6e92597272a3250eab9883119625c929b051e /app | |
parent | 1b78b8ced8adc7be2f11e107f29c54b41a4c4f7a (diff) | |
download | infinity-for-reddit-1754c630ae30861d9199b9e7704b9097a1967128.tar infinity-for-reddit-1754c630ae30861d9199b9e7704b9097a1967128.tar.gz infinity-for-reddit-1754c630ae30861d9199b9e7704b9097a1967128.tar.bz2 infinity-for-reddit-1754c630ae30861d9199b9e7704b9097a1967128.tar.lz infinity-for-reddit-1754c630ae30861d9199b9e7704b9097a1967128.tar.xz infinity-for-reddit-1754c630ae30861d9199b9e7704b9097a1967128.tar.zst infinity-for-reddit-1754c630ae30861d9199b9e7704b9097a1967128.zip |
Migrate to ViewBinding in some activities. Remove TrendingActivity.
Diffstat (limited to 'app')
57 files changed, 564 insertions, 1216 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 8a67b013..8264c208 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -76,11 +76,6 @@ android:parentActivityName=".activities.MainActivity" android:theme="@style/AppTheme.Slidable" /> <activity - android:name=".activities.TrendingActivity" - android:label="@string/trending_activity_label" - android:parentActivityName=".activities.MainActivity" - android:theme="@style/AppTheme.Slidable" /> - <activity android:name=".activities.PostGalleryActivity" android:label="@string/post_gallery_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 28a266cb..e7dbd276 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java @@ -54,7 +54,6 @@ import ml.docilealligator.infinityforreddit.activities.SubredditMultiselectionAc import ml.docilealligator.infinityforreddit.activities.SubredditSelectionActivity; import ml.docilealligator.infinityforreddit.activities.SubscribedThingListingActivity; import ml.docilealligator.infinityforreddit.activities.SuicidePreventionActivity; -import ml.docilealligator.infinityforreddit.activities.TrendingActivity; import ml.docilealligator.infinityforreddit.activities.ViewImageOrGifActivity; import ml.docilealligator.infinityforreddit.activities.ViewImgurMediaActivity; import ml.docilealligator.infinityforreddit.activities.ViewMultiRedditDetailActivity; @@ -282,8 +281,6 @@ public interface AppComponent { void inject(PostGalleryActivity postGalleryActivity); - void inject(TrendingActivity trendingActivity); - void inject(WikiActivity wikiActivity); void inject(Infinity infinity); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java index 41db3cf0..db3a3213 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java @@ -768,8 +768,6 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb intent.putExtra(SubscribedThingListingActivity.EXTRA_SHOW_MULTIREDDITS, true); } else if (stringId == R.string.history) { intent = new Intent(MainActivity.this, HistoryActivity.class); - } else if (stringId == R.string.trending) { - intent = new Intent(MainActivity.this, TrendingActivity.class); } else if (stringId == R.string.upvoted) { intent = new Intent(MainActivity.this, AccountPostsActivity.class); intent.putExtra(AccountPostsActivity.EXTRA_USER_WHERE, PostPagingSource.USER_WHERE_UPVOTED); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/TrendingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/TrendingActivity.java deleted file mode 100644 index 5ca5f0d6..00000000 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/TrendingActivity.java +++ /dev/null @@ -1,345 +0,0 @@ -package ml.docilealligator.infinityforreddit.activities; - -import android.content.Intent; -import android.content.SharedPreferences; -import android.os.Build; -import android.os.Bundle; -import android.os.Handler; -import android.util.DisplayMetrics; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; -import android.view.Window; -import android.view.WindowManager; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.appcompat.widget.Toolbar; -import androidx.coordinatorlayout.widget.CoordinatorLayout; -import androidx.recyclerview.widget.RecyclerView; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; - -import com.bumptech.glide.Glide; -import com.bumptech.glide.RequestManager; -import com.google.android.material.appbar.AppBarLayout; -import com.google.android.material.appbar.CollapsingToolbarLayout; - -import org.greenrobot.eventbus.EventBus; -import org.greenrobot.eventbus.Subscribe; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; - -import java.util.ArrayList; -import java.util.concurrent.Executor; - -import javax.inject.Inject; -import javax.inject.Named; - -import butterknife.BindView; -import butterknife.ButterKnife; -import ml.docilealligator.infinityforreddit.Infinity; -import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.TrendingSearch; -import ml.docilealligator.infinityforreddit.account.Account; -import ml.docilealligator.infinityforreddit.adapters.TrendingSearchRecyclerViewAdapter; -import ml.docilealligator.infinityforreddit.apis.RedditAPI; -import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; -import ml.docilealligator.infinityforreddit.customviews.slidr.Slidr; -import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent; -import ml.docilealligator.infinityforreddit.post.ParsePost; -import ml.docilealligator.infinityforreddit.post.Post; -import ml.docilealligator.infinityforreddit.utils.APIUtils; -import ml.docilealligator.infinityforreddit.utils.JSONUtils; -import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; -import ml.docilealligator.infinityforreddit.utils.Utils; -import retrofit2.Call; -import retrofit2.Callback; -import retrofit2.Response; -import retrofit2.Retrofit; - -public class TrendingActivity extends BaseActivity { - - private static final String TRENDING_SEARCHES_STATE = "TSS"; - - @BindView(R.id.coordinator_layout_trending_activity) - CoordinatorLayout coordinatorLayout; - @BindView(R.id.appbar_layout_trending_activity) - AppBarLayout appBarLayout; - @BindView(R.id.collapsing_toolbar_layout_trending_activity) - CollapsingToolbarLayout collapsingToolbarLayout; - @BindView(R.id.toolbar_trending_activity) - Toolbar toolbar; - @BindView(R.id.swipe_refresh_layout_trending_activity) - SwipeRefreshLayout swipeRefreshLayout; - @BindView(R.id.recycler_view_trending_activity) - RecyclerView recyclerView; - @BindView(R.id.fetch_trending_search_linear_layout_trending_activity) - LinearLayout errorLinearLayout; - @BindView(R.id.fetch_trending_search_image_view_trending_activity) - ImageView errorImageView; - @BindView(R.id.fetch_trending_search_text_view_trending_activity) - TextView errorTextView; - @Inject - @Named("no_oauth") - Retrofit mRetrofit; - @Inject - @Named("oauth") - Retrofit mOauthRetrofit; - @Inject - @Named("default") - SharedPreferences mSharedPreferences; - @Inject - @Named("post_layout") - SharedPreferences mPostLayoutSharedPreferences; - @Inject - @Named("current_account") - SharedPreferences mCurrentAccountSharedPreferences; - @Inject - CustomThemeWrapper mCustomThemeWrapper; - @Inject - Executor mExecutor; - private boolean isRefreshing = false; - private ArrayList<TrendingSearch> trendingSearches; - private TrendingSearchRecyclerViewAdapter adapter; - private RequestManager mGlide; - - @Override - protected void onCreate(Bundle savedInstanceState) { - ((Infinity) getApplication()).getAppComponent().inject(this); - - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_trending); - - ButterKnife.bind(this); - - 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(appBarLayout); - } - - 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(toolbar); - - int navBarResourceId = getResources().getIdentifier("navigation_bar_height", "dimen", "android"); - if (navBarResourceId > 0) { - recyclerView.setPadding(0, 0, 0, recyclerView.getPaddingBottom() + getResources().getDimensionPixelSize(navBarResourceId)); - } - } - } - - setSupportActionBar(toolbar); - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - setToolbarGoToTop(toolbar); - - mGlide = Glide.with(this); - - DisplayMetrics displayMetrics = new DisplayMetrics(); - getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); - int windowWidth = displayMetrics.widthPixels; - - String dataSavingModeString = mSharedPreferences.getString(SharedPreferencesUtils.DATA_SAVING_MODE, SharedPreferencesUtils.DATA_SAVING_MODE_OFF); - boolean dataSavingMode = false; - if (dataSavingModeString.equals(SharedPreferencesUtils.DATA_SAVING_MODE_ALWAYS)) { - dataSavingMode = true; - } else if (dataSavingModeString.equals(SharedPreferencesUtils.DATA_SAVING_MODE_ONLY_ON_CELLULAR_DATA)) { - int networkType = Utils.getConnectedNetwork(this); - dataSavingMode = networkType == Utils.NETWORK_TYPE_CELLULAR; - } - boolean disableImagePreview = mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_IMAGE_PREVIEW, false); - adapter = new TrendingSearchRecyclerViewAdapter(this, mCustomThemeWrapper, windowWidth, - dataSavingMode, disableImagePreview, new TrendingSearchRecyclerViewAdapter.ItemClickListener() { - @Override - public void onClick(TrendingSearch trendingSearch) { - Intent intent = new Intent(TrendingActivity.this, SearchResultActivity.class); - intent.putExtra(SearchResultActivity.EXTRA_QUERY, trendingSearch.queryString); - intent.putExtra(SearchResultActivity.EXTRA_TRENDING_SOURCE, "trending"); - startActivity(intent); - } - }); - recyclerView.setAdapter(adapter); - - swipeRefreshLayout.setEnabled(mSharedPreferences.getBoolean(SharedPreferencesUtils.PULL_TO_REFRESH, true)); - swipeRefreshLayout.setOnRefreshListener(this::fetchTrendingSearches); - - errorLinearLayout.setOnClickListener(view -> fetchTrendingSearches()); - - if (savedInstanceState != null) { - trendingSearches = savedInstanceState.getParcelableArrayList(TRENDING_SEARCHES_STATE); - } - if (trendingSearches != null) { - adapter.setTrendingSearches(trendingSearches); - } else { - fetchTrendingSearches(); - } - } - - private void fetchTrendingSearches() { - if (isRefreshing) { - return; - } - isRefreshing = true; - - errorLinearLayout.setVisibility(View.GONE); - Glide.with(this).clear(errorImageView); - swipeRefreshLayout.setRefreshing(true); - trendingSearches = null; - adapter.setTrendingSearches(null); - Handler handler = new Handler(); - Call<String> trendingCall; - if (accountName.equals(Account.ANONYMOUS_ACCOUNT)) { - trendingCall = mRetrofit.create(RedditAPI.class).getTrendingSearches(); - } else { - trendingCall = mOauthRetrofit.create(RedditAPI.class).getTrendingSearchesOauth(APIUtils.getOAuthHeader(accessToken)); - } - trendingCall.enqueue(new Callback<>() { - @Override - public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) { - if (response.isSuccessful()) { - mExecutor.execute(() -> { - try { - JSONArray trendingSearchesArray = new JSONObject(response.body()).getJSONArray(JSONUtils.TRENDING_SEARCHES_KEY); - ArrayList<TrendingSearch> trendingSearchList = new ArrayList<>(); - for (int i = 0; i < trendingSearchesArray.length(); i++) { - try { - JSONObject trendingSearchObject = trendingSearchesArray.getJSONObject(i); - String queryString = trendingSearchObject.getString(JSONUtils.QUERY_STRING_KEY); - String displayString = trendingSearchObject.getString(JSONUtils.DISPLAY_STRING_KEY); - JSONArray childrenWithOnlyOneChild = trendingSearchObject - .getJSONObject(JSONUtils.RESULTS_KEY) - .getJSONObject(JSONUtils.DATA_KEY) - .getJSONArray(JSONUtils.CHILDREN_KEY); - if (childrenWithOnlyOneChild.length() > 0) { - Post post = ParsePost.parseBasicData(childrenWithOnlyOneChild.getJSONObject(0) - .getJSONObject(JSONUtils.DATA_KEY)); - - trendingSearchList.add(new TrendingSearch(queryString, displayString, - post.getTitle(), post.getPreviews())); - } - } catch (JSONException e) { - e.printStackTrace(); - } - } - - handler.post(() -> { - trendingSearches = trendingSearchList; - swipeRefreshLayout.setRefreshing(false); - adapter.setTrendingSearches(trendingSearches); - isRefreshing = false; - }); - } catch (JSONException e) { - e.printStackTrace(); - handler.post(() -> { - swipeRefreshLayout.setRefreshing(false); - showErrorView(R.string.error_parse_trending_search); - isRefreshing = false; - }); - } - }); - } else { - handler.post(() -> { - swipeRefreshLayout.setRefreshing(false); - showErrorView(R.string.error_fetch_trending_search); - isRefreshing = false; - }); - } - } - - @Override - public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) { - handler.post(() -> { - swipeRefreshLayout.setRefreshing(false); - showErrorView(R.string.error_fetch_trending_search); - isRefreshing = false; - }); - } - }); - } - - private void showErrorView(int stringId) { - errorLinearLayout.setVisibility(View.VISIBLE); - mGlide.load(R.drawable.error_image).into(errorImageView); - errorTextView.setText(stringId); - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - getMenuInflater().inflate(R.menu.trending_activity, menu); - applyMenuItemTheme(menu); - return true; - } - - @Override - public boolean onOptionsItemSelected(@NonNull MenuItem item) { - if (item.getItemId() == android.R.id.home) { - finish(); - return true; - } else if (item.getItemId() == R.id.action_refresh_trending_activity) { - fetchTrendingSearches(); - return true; - } - - return false; - } - - @Override - protected void onSaveInstanceState(@NonNull Bundle outState) { - super.onSaveInstanceState(outState); - outState.putParcelableArrayList(TRENDING_SEARCHES_STATE, trendingSearches); - } - - @Override - protected void onDestroy() { - super.onDestroy(); - EventBus.getDefault().unregister(this); - } - - @Override - public SharedPreferences getDefaultSharedPreferences() { - return mSharedPreferences; - } - - @Override - public SharedPreferences getCurrentAccountSharedPreferences() { - return mCurrentAccountSharedPreferences; - } - - @Override - public CustomThemeWrapper getCustomThemeWrapper() { - return mCustomThemeWrapper; - } - - @Override - protected void applyCustomTheme() { - coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); - applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar); - swipeRefreshLayout.setProgressBackgroundColorSchemeColor(mCustomThemeWrapper.getCircularProgressBarBackground()); - swipeRefreshLayout.setColorSchemeColors(mCustomThemeWrapper.getColorAccent()); - errorTextView.setTextColor(mCustomThemeWrapper.getSecondaryTextColor()); - if (typeface != null) { - errorTextView.setTypeface(typeface); - } - } - - @Subscribe - public void onAccountSwitchEvent(SwitchAccountEvent event) { - finish(); - } -}
\ No newline at end of file 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 8a144d10..895d0b77 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java @@ -18,10 +18,6 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.FrameLayout; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.ProgressBar; -import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; @@ -45,9 +41,7 @@ import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; import com.github.piasy.biv.BigImageViewer; import com.github.piasy.biv.loader.ImageLoader; import com.github.piasy.biv.loader.glide.GlideImageLoader; -import com.github.piasy.biv.view.BigImageView; import com.github.piasy.biv.view.GlideImageViewFactory; -import com.google.android.material.bottomappbar.BottomAppBar; import java.io.File; import java.util.concurrent.Executor; @@ -55,8 +49,6 @@ import java.util.concurrent.Executor; import javax.inject.Inject; import javax.inject.Named; -import butterknife.BindView; -import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.BuildConfig; import ml.docilealligator.infinityforreddit.CustomFontReceiver; import ml.docilealligator.infinityforreddit.Infinity; @@ -69,6 +61,7 @@ import ml.docilealligator.infinityforreddit.bottomsheetfragments.SetAsWallpaperB import ml.docilealligator.infinityforreddit.customviews.slidr.Slidr; import ml.docilealligator.infinityforreddit.customviews.slidr.model.SlidrConfig; import ml.docilealligator.infinityforreddit.customviews.slidr.model.SlidrPosition; +import ml.docilealligator.infinityforreddit.databinding.ActivityViewImageOrGifBinding; import ml.docilealligator.infinityforreddit.font.ContentFontFamily; import ml.docilealligator.infinityforreddit.font.ContentFontStyle; import ml.docilealligator.infinityforreddit.font.FontFamily; @@ -88,22 +81,7 @@ public class ViewImageOrGifActivity extends AppCompatActivity implements SetAsWa public static final String EXTRA_POST_TITLE_KEY = "EPTK"; public static final String EXTRA_IS_NSFW = "EIN"; private static final int PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE = 0; - @BindView(R.id.progress_bar_view_image_or_gif_activity) - ProgressBar mProgressBar; - @BindView(R.id.image_view_view_image_or_gif_activity) - BigImageView mImageView; - @BindView(R.id.load_image_error_linear_layout_view_image_or_gif_activity) - LinearLayout mLoadErrorLinearLayout; - @BindView(R.id.bottom_navigation_view_image_or_gif_activity) - BottomAppBar bottomAppBar; - @BindView(R.id.title_text_view_view_image_or_gif_activity) - TextView titleTextView; - @BindView(R.id.download_image_view_view_image_or_gif_activity) - ImageView downloadImageView; - @BindView(R.id.share_image_view_view_image_or_gif_activity) - ImageView shareImageView; - @BindView(R.id.wallpaper_image_view_view_image_or_gif_activity) - ImageView wallpaperImageView; + @Inject @Named("default") SharedPreferences mSharedPreferences; @@ -119,6 +97,7 @@ public class ViewImageOrGifActivity extends AppCompatActivity implements SetAsWa private boolean isNsfw; private Typeface typeface; private Handler handler; + private ActivityViewImageOrGifBinding binding; @Override protected void onCreate(Bundle savedInstanceState) { @@ -148,9 +127,8 @@ public class ViewImageOrGifActivity extends AppCompatActivity implements SetAsWa BigImageViewer.initialize(GlideImageLoader.with(this.getApplicationContext())); - setContentView(R.layout.activity_view_image_or_gif); - - ButterKnife.bind(this); + binding = ActivityViewImageOrGifBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE @@ -180,7 +158,7 @@ public class ViewImageOrGifActivity extends AppCompatActivity implements SetAsWa if (postTitle != null) { Spanned title = Html.fromHtml(String.format("<font color=\"#FFFFFF\"><small>%s</small></font>", postTitle)); if (useBottomAppBar) { - titleTextView.setText(title); + binding.titleTextViewViewImageOrGifActivity.setText(title); } else { setTitle(Utils.getTabTextWithCustomFont(typeface, title)); } @@ -192,21 +170,21 @@ public class ViewImageOrGifActivity extends AppCompatActivity implements SetAsWa if (useBottomAppBar) { getSupportActionBar().hide(); - bottomAppBar.setVisibility(View.VISIBLE); - downloadImageView.setOnClickListener(view -> { + binding.bottomNavigationViewImageOrGifActivity.setVisibility(View.VISIBLE); + binding.downloadImageViewViewImageOrGifActivity.setOnClickListener(view -> { if (isDownloading) { return; } isDownloading = true; requestPermissionAndDownload(); }); - shareImageView.setOnClickListener(view -> { + binding.shareImageViewViewImageOrGifActivity.setOnClickListener(view -> { if (isGif) shareGif(); else shareImage(); }); - wallpaperImageView.setOnClickListener(view -> { + binding.wallpaperImageViewViewImageOrGifActivity.setOnClickListener(view -> { setWallpaper(); }); } else { @@ -216,13 +194,13 @@ public class ViewImageOrGifActivity extends AppCompatActivity implements SetAsWa actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.transparentActionBarAndExoPlayerControllerColor))); } - mLoadErrorLinearLayout.setOnClickListener(view -> { - mProgressBar.setVisibility(View.VISIBLE); - mLoadErrorLinearLayout.setVisibility(View.GONE); + binding.loadImageErrorLinearLayoutViewImageOrGifActivity.setOnClickListener(view -> { + binding.progressBarViewImageOrGifActivity.setVisibility(View.VISIBLE); + binding.loadImageErrorLinearLayoutViewImageOrGifActivity.setVisibility(View.GONE); loadImage(); }); - mImageView.setOnClickListener(view -> { + binding.imageViewViewImageOrGifActivity.setOnClickListener(view -> { if (isActionBarHidden) { getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE @@ -230,7 +208,7 @@ public class ViewImageOrGifActivity extends AppCompatActivity implements SetAsWa | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); isActionBarHidden = false; if (useBottomAppBar) { - bottomAppBar.setVisibility(View.VISIBLE); + binding.bottomNavigationViewImageOrGifActivity.setVisibility(View.VISIBLE); } } else { getWindow().getDecorView().setSystemUiVisibility( @@ -242,14 +220,14 @@ public class ViewImageOrGifActivity extends AppCompatActivity implements SetAsWa | View.SYSTEM_UI_FLAG_IMMERSIVE); isActionBarHidden = true; if (useBottomAppBar) { - bottomAppBar.setVisibility(View.GONE); + binding.bottomNavigationViewImageOrGifActivity.setVisibility(View.GONE); } } }); - mImageView.setImageViewFactory(new GlideImageViewFactory()); + binding.imageViewViewImageOrGifActivity.setImageViewFactory(new GlideImageViewFactory()); - mImageView.setImageLoaderCallback(new ImageLoader.Callback() { + binding.imageViewViewImageOrGifActivity.setImageLoaderCallback(new ImageLoader.Callback() { @Override public void onCacheHit(int imageType, File image) { @@ -277,9 +255,9 @@ public class ViewImageOrGifActivity extends AppCompatActivity implements SetAsWa @Override public void onSuccess(File image) { - mProgressBar.setVisibility(View.GONE); + binding.progressBarViewImageOrGifActivity.setVisibility(View.GONE); - final SubsamplingScaleImageView view = mImageView.getSSIV(); + final SubsamplingScaleImageView view = binding.imageViewViewImageOrGifActivity.getSSIV(); if (view != null) { view.setOnImageEventListener(new SubsamplingScaleImageView.DefaultOnImageEventListener() { @@ -297,8 +275,8 @@ public class ViewImageOrGifActivity extends AppCompatActivity implements SetAsWa @Override public void onFail(Exception error) { - mProgressBar.setVisibility(View.GONE); - mLoadErrorLinearLayout.setVisibility(View.VISIBLE); + binding.progressBarViewImageOrGifActivity.setVisibility(View.GONE); + binding.loadImageErrorLinearLayoutViewImageOrGifActivity.setVisibility(View.VISIBLE); } }); @@ -313,7 +291,7 @@ public class ViewImageOrGifActivity extends AppCompatActivity implements SetAsWa } private void loadImage() { - mImageView.showImage(Uri.parse(mImageUrl)); + binding.imageViewViewImageOrGifActivity.showImage(Uri.parse(mImageUrl)); } @Override 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 bf2b0673..5981115e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImgurMediaActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImgurMediaActivity.java @@ -11,8 +11,6 @@ import android.text.Html; import android.view.Menu; import android.view.MenuItem; import android.view.View; -import android.widget.LinearLayout; -import android.widget.ProgressBar; import android.widget.Toast; import androidx.annotation.NonNull; @@ -34,9 +32,6 @@ import javax.inject.Inject; import javax.inject.Named; import app.futured.hauler.DragDirection; -import app.futured.hauler.HaulerView; -import butterknife.BindView; -import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.CustomFontReceiver; import ml.docilealligator.infinityforreddit.ImgurMedia; import ml.docilealligator.infinityforreddit.Infinity; @@ -44,7 +39,7 @@ import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.SetAsWallpaperCallback; import ml.docilealligator.infinityforreddit.WallpaperSetter; import ml.docilealligator.infinityforreddit.apis.ImgurAPI; -import ml.docilealligator.infinityforreddit.customviews.ViewPagerBugFixed; +import ml.docilealligator.infinityforreddit.databinding.ActivityViewImgurMediaBinding; import ml.docilealligator.infinityforreddit.font.ContentFontFamily; import ml.docilealligator.infinityforreddit.font.ContentFontStyle; import ml.docilealligator.infinityforreddit.font.FontFamily; @@ -71,14 +66,6 @@ public class ViewImgurMediaActivity extends AppCompatActivity implements SetAsWa public static final int IMGUR_TYPE_IMAGE = 2; private static final String IMGUR_IMAGES_STATE = "IIS"; - @BindView(R.id.hauler_view_view_imgur_media_activity) - HaulerView haulerView; - @BindView(R.id.progress_bar_view_imgur_media_activity) - ProgressBar progressBar; - @BindView(R.id.view_pager_view_imgur_media_activity) - ViewPagerBugFixed viewPager; - @BindView(R.id.load_image_error_linear_layout_view_imgur_media_activity) - LinearLayout errorLinearLayout; public Typeface typeface; private SectionsPagerAdapter sectionsPagerAdapter; private ArrayList<ImgurMedia> images; @@ -91,6 +78,7 @@ public class ViewImgurMediaActivity extends AppCompatActivity implements SetAsWa SharedPreferences sharedPreferences; @Inject Executor executor; + private ActivityViewImgurMediaBinding binding; @Override protected void onCreate(Bundle savedInstanceState) { @@ -118,9 +106,8 @@ public class ViewImgurMediaActivity extends AppCompatActivity implements SetAsWa getTheme().applyStyle(ContentFontFamily.valueOf(sharedPreferences .getString(SharedPreferencesUtils.CONTENT_FONT_FAMILY_KEY, ContentFontFamily.Default.name())).getResId(), true); - setContentView(R.layout.activity_view_imgur_media); - - ButterKnife.bind(this); + binding = ActivityViewImgurMediaBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE @@ -150,23 +137,23 @@ public class ViewImgurMediaActivity extends AppCompatActivity implements SetAsWa } if (sharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_VERTICALLY_TO_GO_BACK_FROM_MEDIA, true)) { - haulerView.setOnDragDismissedListener(dragDirection -> { + binding.getRoot().setOnDragDismissedListener(dragDirection -> { int slide = dragDirection == DragDirection.UP ? R.anim.slide_out_up : R.anim.slide_out_down; finish(); overridePendingTransition(0, slide); }); } else { - haulerView.setDragEnabled(false); + binding.getRoot().setDragEnabled(false); } if (images == null) { fetchImgurMedia(imgurId); } else { - progressBar.setVisibility(View.GONE); + binding.progressBarViewImgurMediaActivity.setVisibility(View.GONE); setupViewPager(); } - errorLinearLayout.setOnClickListener(view -> fetchImgurMedia(imgurId)); + binding.loadImageErrorLinearLayoutViewImgurMediaActivity.setOnClickListener(view -> fetchImgurMedia(imgurId)); } public boolean isUseBottomAppBar() { @@ -174,8 +161,8 @@ public class ViewImgurMediaActivity extends AppCompatActivity implements SetAsWa } private void fetchImgurMedia(String imgurId) { - errorLinearLayout.setVisibility(View.GONE); - progressBar.setVisibility(View.VISIBLE); + binding.loadImageErrorLinearLayoutViewImgurMediaActivity.setVisibility(View.GONE); + binding.progressBarViewImgurMediaActivity.setVisibility(View.VISIBLE); switch (getIntent().getIntExtra(EXTRA_IMGUR_TYPE, IMGUR_TYPE_IMAGE)) { case IMGUR_TYPE_GALLERY: imgurRetrofit.create(ImgurAPI.class).getGalleryImages(APIUtils.IMGUR_CLIENT_ID, imgurId) @@ -187,27 +174,27 @@ public class ViewImgurMediaActivity extends AppCompatActivity implements SetAsWa @Override public void success(ArrayList<ImgurMedia> images) { ViewImgurMediaActivity.this.images = images; - progressBar.setVisibility(View.GONE); - errorLinearLayout.setVisibility(View.GONE); + binding.progressBarViewImgurMediaActivity.setVisibility(View.GONE); + binding.loadImageErrorLinearLayoutViewImgurMediaActivity.setVisibility(View.GONE); setupViewPager(); } @Override public void failed() { - progressBar.setVisibility(View.GONE); - errorLinearLayout.setVisibility(View.VISIBLE); + binding.progressBarViewImgurMediaActivity.setVisibility(View.GONE); + binding.loadImageErrorLinearLayoutViewImgurMediaActivity.setVisibility(View.VISIBLE); } }).execute(); } else { - progressBar.setVisibility(View.GONE); - errorLinearLayout.setVisibility(View.VISIBLE); + binding.progressBarViewImgurMediaActivity.setVisibility(View.GONE); + binding.loadImageErrorLinearLayoutViewImgurMediaActivity.setVisibility(View.VISIBLE); } } @Override public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) { - progressBar.setVisibility(View.GONE); - errorLinearLayout.setVisibility(View.VISIBLE); + binding.progressBarViewImgurMediaActivity.setVisibility(View.GONE); + binding.loadImageErrorLinearLayoutViewImgurMediaActivity.setVisibility(View.VISIBLE); } }); break; @@ -221,27 +208,27 @@ public class ViewImgurMediaActivity extends AppCompatActivity implements SetAsWa @Override public void success(ArrayList<ImgurMedia> images) { ViewImgurMediaActivity.this.images = images; - progressBar.setVisibility(View.GONE); - errorLinearLayout.setVisibility(View.GONE); + binding.progressBarViewImgurMediaActivity.setVisibility(View.GONE); + binding.loadImageErrorLinearLayoutViewImgurMediaActivity.setVisibility(View.GONE); setupViewPager(); } @Override public void failed() { - progressBar.setVisibility(View.GONE); - errorLinearLayout.setVisibility(View.VISIBLE); + binding.progressBarViewImgurMediaActivity.setVisibility(View.GONE); + binding.loadImageErrorLinearLayoutViewImgurMediaActivity.setVisibility(View.VISIBLE); } }).execute(); } else { - progressBar.setVisibility(View.GONE); - errorLinearLayout.setVisibility(View.VISIBLE); + binding.progressBarViewImgurMediaActivity.setVisibility(View.GONE); + binding.loadImageErrorLinearLayoutViewImgurMediaActivity.setVisibility(View.VISIBLE); } } @Override public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) { - progressBar.setVisibility(View.GONE); - errorLinearLayout.setVisibility(View.VISIBLE); + binding.progressBarViewImgurMediaActivity.setVisibility(View.GONE); + binding.loadImageErrorLinearLayoutViewImgurMediaActivity.setVisibility(View.VISIBLE); } }); break; @@ -256,27 +243,27 @@ public class ViewImgurMediaActivity extends AppCompatActivity implements SetAsWa public void success(ImgurMedia image) { ViewImgurMediaActivity.this.images = new ArrayList<>(); ViewImgurMediaActivity.this.images.add(image); - progressBar.setVisibility(View.GONE); - errorLinearLayout.setVisibility(View.GONE); + binding.progressBarViewImgurMediaActivity.setVisibility(View.GONE); + binding.loadImageErrorLinearLayoutViewImgurMediaActivity.setVisibility(View.GONE); setupViewPager(); } @Override public void failed() { - progressBar.setVisibility(View.GONE); - errorLinearLayout.setVisibility(View.VISIBLE); + binding.progressBarViewImgurMediaActivity.setVisibility(View.GONE); + binding.loadImageErrorLinearLayoutViewImgurMediaActivity.setVisibility(View.VISIBLE); } }).execute(); } else { - progressBar.setVisibility(View.GONE); - errorLinearLayout.setVisibility(View.VISIBLE); + binding.progressBarViewImgurMediaActivity.setVisibility(View.GONE); + binding.loadImageErrorLinearLayoutViewImgurMediaActivity.setVisibility(View.VISIBLE); } } @Override public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) { - progressBar.setVisibility(View.GONE); - errorLinearLayout.setVisibility(View.VISIBLE); + binding.progressBarViewImgurMediaActivity.setVisibility(View.GONE); + binding.loadImageErrorLinearLayoutViewImgurMediaActivity.setVisibility(View.VISIBLE); } }); break; @@ -286,7 +273,7 @@ public class ViewImgurMediaActivity extends AppCompatActivity implements SetAsWa private void setupViewPager() { if (!useBottomAppBar) { setToolbarTitle(0); - viewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { + binding.viewPagerViewImgurMediaActivity.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { setToolbarTitle(position); @@ -294,8 +281,8 @@ public class ViewImgurMediaActivity extends AppCompatActivity implements SetAsWa }); } sectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); - viewPager.setAdapter(sectionsPagerAdapter); - viewPager.setOffscreenPageLimit(3); + binding.viewPagerViewImgurMediaActivity.setAdapter(sectionsPagerAdapter); + binding.viewPagerViewImgurMediaActivity.setOffscreenPageLimit(3); } private void setToolbarTitle(int position) { @@ -384,7 +371,7 @@ public class ViewImgurMediaActivity extends AppCompatActivity implements SetAsWa } public int getCurrentPagePosition() { - return viewPager.getCurrentItem(); + return binding.viewPagerViewImgurMediaActivity.getCurrentItem(); } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewMultiRedditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewMultiRedditDetailActivity.java index a8c900be..82346029 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewMultiRedditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewMultiRedditDetailActivity.java @@ -18,13 +18,10 @@ import android.view.inputmethod.EditorInfo; import android.widget.Toast; import androidx.annotation.NonNull; -import androidx.appcompat.widget.Toolbar; import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.RecyclerView; -import com.google.android.material.appbar.AppBarLayout; -import com.google.android.material.appbar.CollapsingToolbarLayout; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.textfield.TextInputEditText; @@ -37,8 +34,6 @@ import java.util.concurrent.Executor; import javax.inject.Inject; import javax.inject.Named; -import butterknife.BindView; -import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.ActivityToolbarInterface; import ml.docilealligator.infinityforreddit.FragmentCommunicator; import ml.docilealligator.infinityforreddit.Infinity; @@ -61,6 +56,7 @@ import ml.docilealligator.infinityforreddit.bottomsheetfragments.SortTypeBottomS import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customviews.NavigationWrapper; import ml.docilealligator.infinityforreddit.customviews.slidr.Slidr; +import ml.docilealligator.infinityforreddit.databinding.ActivityViewMultiRedditDetailBinding; import ml.docilealligator.infinityforreddit.events.GoBackToMainPageEvent; import ml.docilealligator.infinityforreddit.events.RefreshMultiRedditsEvent; import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent; @@ -90,14 +86,6 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT private static final String FRAGMENT_OUT_STATE_KEY = "FOSK"; - @BindView(R.id.coordinator_layout_view_multi_reddit_detail_activity) - CoordinatorLayout coordinatorLayout; - @BindView(R.id.appbar_layout_view_multi_reddit_detail_activity) - AppBarLayout appBarLayout; - @BindView(R.id.collapsing_toolbar_layout_view_multi_reddit_detail_activity) - CollapsingToolbarLayout collapsingToolbarLayout; - @BindView(R.id.toolbar_view_multi_reddit_detail_activity) - Toolbar toolbar; @Inject @Named("oauth") Retrofit mOauthRetrofit; @@ -136,6 +124,7 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT private boolean lockBottomAppBar; private Call<String> subredditAutocompleteCall; private NavigationWrapper navigationWrapper; + private ActivityViewMultiRedditDetailBinding binding; @Override public boolean onKeyDown(int keyCode, KeyEvent event) { @@ -148,9 +137,9 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT protected void onCreate(Bundle savedInstanceState) { ((Infinity) getApplication()).getAppComponent().inject(this); super.onCreate(savedInstanceState); - setContentView(R.layout.activity_view_multi_reddit_detail); - ButterKnife.bind(this); + binding = ActivityViewMultiRedditDetailBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); EventBus.getDefault().register(this); @@ -173,7 +162,7 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT Window window = getWindow(); if (isChangeStatusBarIconColor()) { - addOnOffsetChangedListener(appBarLayout); + addOnOffsetChangedListener(binding.appbarLayoutViewMultiRedditDetailActivity); } if (isImmersiveInterface()) { @@ -182,7 +171,7 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT } else { window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); } - adjustToolbar(toolbar); + adjustToolbar(binding.toolbarViewMultiRedditDetailActivity); int navBarHeight = getNavBarHeight(); if (navBarHeight > 0) { @@ -199,7 +188,7 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT if (multiReddit == null) { multiPath = getIntent().getStringExtra(EXTRA_MULTIREDDIT_PATH); if (multiPath != null) { - toolbar.setTitle(multiPath.substring(multiPath.lastIndexOf("/", multiPath.length() - 2) + 1)); + binding.toolbarViewMultiRedditDetailActivity.setTitle(multiPath.substring(multiPath.lastIndexOf("/", multiPath.length() - 2) + 1)); } else { Toast.makeText(this, R.string.error_getting_multi_reddit_data, Toast.LENGTH_SHORT).show(); finish(); @@ -207,12 +196,12 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT } } else { multiPath = multiReddit.getPath(); - toolbar.setTitle(multiReddit.getDisplayName()); + binding.toolbarViewMultiRedditDetailActivity.setTitle(multiReddit.getDisplayName()); } - setSupportActionBar(toolbar); + setSupportActionBar(binding.toolbarViewMultiRedditDetailActivity); getSupportActionBar().setDisplayHomeAsUpEnabled(true); - setToolbarGoToTop(toolbar); + setToolbarGoToTop(binding.toolbarViewMultiRedditDetailActivity); lockBottomAppBar = mSharedPreferences.getBoolean(SharedPreferencesUtils.LOCK_BOTTOM_APP_BAR, false); @@ -581,7 +570,7 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT } private void goToSubreddit() { - View rootView = getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, coordinatorLayout, false); + View rootView = getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, binding.getRoot(), false); TextInputEditText thingEditText = rootView.findViewById(R.id.text_input_edit_text_go_to_thing_edit_text); RecyclerView recyclerView = rootView.findViewById(R.id.recycler_view_go_to_thing_edit_text); thingEditText.requestFocus(); @@ -669,7 +658,7 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT } private void goToUser() { - View rootView = getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, coordinatorLayout, false); + View rootView = getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, binding.getRoot(), false); TextInputEditText thingEditText = rootView.findViewById(R.id.text_input_edit_text_go_to_thing_edit_text); thingEditText.requestFocus(); Utils.showKeyboard(this, new Handler(), thingEditText); @@ -833,8 +822,9 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT @Override protected void applyCustomTheme() { - coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); - applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar); + binding.getRoot().setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(binding.appbarLayoutViewMultiRedditDetailActivity, + binding.collapsingToolbarLayoutViewMultiRedditDetailActivity, binding.toolbarViewMultiRedditDetailActivity); navigationWrapper.applyCustomTheme(mCustomThemeWrapper.getBottomAppBarIconColor(), mCustomThemeWrapper.getBottomAppBarBackgroundColor()); applyFABTheme(navigationWrapper.floatingActionButton); } @@ -850,7 +840,7 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT public void displaySortType() { if (mFragment != null) { SortType sortType = ((PostFragment) mFragment).getSortType(); - Utils.displaySortTypeInToolbar(sortType, toolbar); + Utils.displaySortTypeInToolbar(sortType, binding.toolbarViewMultiRedditDetailActivity); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java index 59cab228..6676cca8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java @@ -15,12 +15,10 @@ import android.view.MenuItem; import android.view.View; import android.view.Window; import android.view.WindowManager; -import android.widget.ImageView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.appcompat.widget.Toolbar; import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.core.view.inputmethod.EditorInfoCompat; import androidx.fragment.app.Fragment; @@ -32,13 +30,7 @@ import androidx.viewpager2.widget.ViewPager2; import com.evernote.android.state.State; import com.github.piasy.biv.BigImageViewer; import com.github.piasy.biv.loader.glide.GlideImageLoader; -import com.google.android.material.appbar.AppBarLayout; -import com.google.android.material.appbar.CollapsingToolbarLayout; -import com.google.android.material.card.MaterialCardView; -import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.snackbar.Snackbar; -import com.google.android.material.textfield.TextInputEditText; -import com.google.android.material.textfield.TextInputLayout; import com.livefront.bridge.Bridge; import org.greenrobot.eventbus.EventBus; @@ -55,8 +47,6 @@ import java.util.concurrent.Executor; import javax.inject.Inject; import javax.inject.Named; -import butterknife.BindView; -import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.ActivityToolbarInterface; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.LoadingMorePostsStatus; @@ -71,6 +61,7 @@ import ml.docilealligator.infinityforreddit.asynctasks.SwitchAccount; import ml.docilealligator.infinityforreddit.comment.Comment; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customviews.slidr.Slidr; +import ml.docilealligator.infinityforreddit.databinding.ActivityViewPostDetailBinding; import ml.docilealligator.infinityforreddit.events.NeedForPostListFromPostFragmentEvent; import ml.docilealligator.infinityforreddit.events.ProvidePostListToViewPostDetailActivityEvent; import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent; @@ -102,30 +93,6 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele public static final int EDIT_COMMENT_REQUEST_CODE = 3; @State String mNewAccountName; - @BindView(R.id.coordinator_layout_view_post_detail) - CoordinatorLayout mCoordinatorLayout; - @BindView(R.id.appbar_layout_view_post_detail_activity) - AppBarLayout mAppBarLayout; - @BindView(R.id.collapsing_toolbar_layout_view_post_detail_activity) - CollapsingToolbarLayout mCollapsingToolbarLayout; - @BindView(R.id.toolbar_view_post_detail_activity) - Toolbar mToolbar; - @BindView(R.id.view_pager_2_view_post_detail_activity) - ViewPager2 viewPager2; - @BindView(R.id.fab_view_post_detail_activity) - FloatingActionButton fab; - @BindView(R.id.search_panel_material_card_view_view_post_detail_activity) - MaterialCardView searchPanelMaterialCardView; - @BindView(R.id.search_text_input_layout_view_post_detail_activity) - TextInputLayout searchTextInputLayout; - @BindView(R.id.search_text_input_edit_text_view_post_detail_activity) - TextInputEditText searchTextInputEditText; - @BindView(R.id.previous_result_image_view_view_post_detail_activity) - ImageView previousResultImageView; - @BindView(R.id.next_result_image_view_view_post_detail_activity) - ImageView nextResultImageView; - @BindView(R.id.close_search_panel_image_view_view_post_detail_activity) - ImageView closeSearchPanelImageView; @Inject @Named("no_oauth") Retrofit mRetrofit; @@ -183,6 +150,7 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele private int orientation; private boolean mVolumeKeysNavigateComments; private boolean isNsfwSubreddit; + private ActivityViewPostDetailBinding binding; @Override protected void onCreate(Bundle savedInstanceState) { @@ -192,12 +160,11 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele BigImageViewer.initialize(GlideImageLoader.with(this.getApplicationContext())); - setContentView(R.layout.activity_view_post_detail); + binding = ActivityViewPostDetailBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); Bridge.restoreInstanceState(this, savedInstanceState); - ButterKnife.bind(this); - EventBus.getDefault().register(this); applyCustomTheme(); @@ -206,7 +173,7 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele Window window = getWindow(); if (isChangeStatusBarIconColor()) { - addOnOffsetChangedListener(mAppBarLayout); + addOnOffsetChangedListener(binding.appbarLayoutViewPostDetailActivity); } if (isImmersiveInterface()) { @@ -215,18 +182,18 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele } else { window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); } - adjustToolbar(mToolbar); + adjustToolbar(binding.toolbarViewPostDetailActivity); int navBarHeight = getNavBarHeight(); if (navBarHeight > 0) { - CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) fab.getLayoutParams(); + CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) binding.fabViewPostDetailActivity.getLayoutParams(); params.bottomMargin += navBarHeight; - fab.setLayoutParams(params); + binding.fabViewPostDetailActivity.setLayoutParams(params); - searchPanelMaterialCardView.setContentPadding(searchPanelMaterialCardView.getPaddingStart(), - searchPanelMaterialCardView.getPaddingTop(), - searchPanelMaterialCardView.getPaddingEnd(), - searchPanelMaterialCardView.getPaddingBottom() + navBarHeight); + binding.searchPanelMaterialCardViewViewPostDetailActivity.setContentPadding(binding.searchPanelMaterialCardViewViewPostDetailActivity.getPaddingStart(), + binding.searchPanelMaterialCardViewViewPostDetailActivity.getPaddingTop(), + binding.searchPanelMaterialCardViewViewPostDetailActivity.getPaddingEnd(), + binding.searchPanelMaterialCardViewViewPostDetailActivity.getPaddingBottom() + navBarHeight); } } } @@ -236,9 +203,9 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK, true)) { mSliderPanel = Slidr.attach(this); } - viewPager2.setUserInputEnabled(false); + binding.viewPager2ViewPostDetailActivity.setUserInputEnabled(false); } else { - super.mViewPager2 = viewPager2; + mViewPager2 = binding.viewPager2ViewPostDetailActivity; } postFragmentId = getIntent().getLongExtra(EXTRA_POST_FRAGMENT_ID, -1); if (swipeBetweenPosts && posts == null && postFragmentId > 0) { @@ -256,9 +223,9 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele orientation = getResources().getConfiguration().orientation; - mToolbar.setTitle(""); - setSupportActionBar(mToolbar); - setToolbarGoToTop(mToolbar); + binding.toolbarViewPostDetailActivity.setTitle(""); + setSupportActionBar(binding.toolbarViewPostDetailActivity); + setToolbarGoToTop(binding.toolbarViewPostDetailActivity); if (savedInstanceState == null) { mNewAccountName = getIntent().getStringExtra(EXTRA_NEW_ACCOUNT_NAME); @@ -266,7 +233,7 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele mVolumeKeysNavigateComments = mSharedPreferences.getBoolean(SharedPreferencesUtils.VOLUME_KEYS_NAVIGATE_COMMENTS, false); - fab.setOnClickListener(view -> { + binding.fabViewPostDetailActivity.setOnClickListener(view -> { if (sectionsPagerAdapter != null) { ViewPostDetailFragment fragment = sectionsPagerAdapter.getCurrentFragment(); if (fragment != null) { @@ -275,7 +242,7 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele } }); - fab.setOnLongClickListener(view -> { + binding.fabViewPostDetailActivity.setOnLongClickListener(view -> { if (sectionsPagerAdapter != null) { ViewPostDetailFragment fragment = sectionsPagerAdapter.getCurrentFragment(); if (fragment != null) { @@ -287,7 +254,7 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele }); if (accountName.equals(Account.ANONYMOUS_ACCOUNT) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - searchTextInputEditText.setImeOptions(searchTextInputEditText.getImeOptions() | EditorInfoCompat.IME_FLAG_NO_PERSONALIZED_LEARNING); + binding.searchTextInputEditTextViewPostDetailActivity.setImeOptions(binding.searchTextInputEditTextViewPostDetailActivity.getImeOptions() | EditorInfoCompat.IME_FLAG_NO_PERSONALIZED_LEARNING); } if (loadingMorePostsStatus == LoadingMorePostsStatus.LOADING) { @@ -299,21 +266,21 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele } public void setTitle(String title) { - if (mToolbar != null) { - mToolbar.setTitle(title); + if (binding.toolbarViewPostDetailActivity != null) { + binding.toolbarViewPostDetailActivity.setTitle(title); } } public void showFab() { - fab.show(); + binding.fabViewPostDetailActivity.show(); } public void hideFab() { - fab.hide(); + binding.fabViewPostDetailActivity.hide(); } public void showSnackBar(int resId) { - Snackbar.make(mCoordinatorLayout, resId, Snackbar.LENGTH_SHORT).show(); + Snackbar.make(binding.getRoot(), resId, Snackbar.LENGTH_SHORT).show(); } @Override @@ -333,20 +300,21 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele @Override protected void applyCustomTheme() { - mCoordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); - applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(mAppBarLayout, mCollapsingToolbarLayout, mToolbar); - applyFABTheme(fab); - searchPanelMaterialCardView.setBackgroundTintList(ColorStateList.valueOf(mCustomThemeWrapper.getColorPrimary())); + binding.getRoot().setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(binding.appbarLayoutViewPostDetailActivity, + binding.collapsingToolbarLayoutViewPostDetailActivity, binding.toolbarViewPostDetailActivity); + applyFABTheme(binding.fabViewPostDetailActivity); + binding.searchPanelMaterialCardViewViewPostDetailActivity.setBackgroundTintList(ColorStateList.valueOf(mCustomThemeWrapper.getColorPrimary())); int searchPanelTextAndIconColor = mCustomThemeWrapper.getToolbarPrimaryTextAndIconColor(); - searchTextInputLayout.setBoxStrokeColor(searchPanelTextAndIconColor); - searchTextInputLayout.setDefaultHintTextColor(ColorStateList.valueOf(searchPanelTextAndIconColor)); - searchTextInputEditText.setTextColor(searchPanelTextAndIconColor); - previousResultImageView.setColorFilter(searchPanelTextAndIconColor, android.graphics.PorterDuff.Mode.SRC_IN); - nextResultImageView.setColorFilter(searchPanelTextAndIconColor, android.graphics.PorterDuff.Mode.SRC_IN); - closeSearchPanelImageView.setColorFilter(searchPanelTextAndIconColor, android.graphics.PorterDuff.Mode.SRC_IN); + binding.searchTextInputLayoutViewPostDetailActivity.setBoxStrokeColor(searchPanelTextAndIconColor); + binding.searchTextInputLayoutViewPostDetailActivity.setDefaultHintTextColor(ColorStateList.valueOf(searchPanelTextAndIconColor)); + binding.searchTextInputEditTextViewPostDetailActivity.setTextColor(searchPanelTextAndIconColor); + binding.previousResultImageViewViewPostDetailActivity.setColorFilter(searchPanelTextAndIconColor, android.graphics.PorterDuff.Mode.SRC_IN); + binding.nextResultImageViewViewPostDetailActivity.setColorFilter(searchPanelTextAndIconColor, android.graphics.PorterDuff.Mode.SRC_IN); + binding.closeSearchPanelImageViewViewPostDetailActivity.setColorFilter(searchPanelTextAndIconColor, android.graphics.PorterDuff.Mode.SRC_IN); if (typeface != null) { - searchTextInputLayout.setTypeface(typeface); - searchTextInputEditText.setTypeface(typeface); + binding.searchTextInputLayoutViewPostDetailActivity.setTypeface(typeface); + binding.searchTextInputEditTextViewPostDetailActivity.setTypeface(typeface); } } @@ -372,11 +340,11 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele private void bindView(Bundle savedInstanceState) { sectionsPagerAdapter = new SectionsPagerAdapter(this); - viewPager2.setAdapter(sectionsPagerAdapter); + binding.viewPager2ViewPostDetailActivity.setAdapter(sectionsPagerAdapter); if (savedInstanceState == null) { - viewPager2.setCurrentItem(getIntent().getIntExtra(EXTRA_POST_LIST_POSITION, 0), false); + binding.viewPager2ViewPostDetailActivity.setCurrentItem(getIntent().getIntExtra(EXTRA_POST_LIST_POSITION, 0), false); } - viewPager2.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { + binding.viewPager2ViewPostDetailActivity.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { @Override public void onPageSelected(int position) { if (posts != null && position > posts.size() - 5) { @@ -385,29 +353,29 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele } }); - searchPanelMaterialCardView.setOnClickListener(null); + binding.searchPanelMaterialCardViewViewPostDetailActivity.setOnClickListener(null); - nextResultImageView.setOnClickListener(view -> { + binding.nextResultImageViewViewPostDetailActivity.setOnClickListener(view -> { ViewPostDetailFragment fragment = sectionsPagerAdapter.getCurrentFragment(); if (fragment != null) { searchComment(fragment, true); } }); - previousResultImageView.setOnClickListener(view -> { + binding.previousResultImageViewViewPostDetailActivity.setOnClickListener(view -> { ViewPostDetailFragment fragment = sectionsPagerAdapter.getCurrentFragment(); if (fragment != null) { searchComment(fragment, false); } }); - closeSearchPanelImageView.setOnClickListener(view -> { + binding.closeSearchPanelImageViewViewPostDetailActivity.setOnClickListener(view -> { ViewPostDetailFragment fragment = sectionsPagerAdapter.getCurrentFragment(); if (fragment != null) { fragment.resetSearchCommentIndex(); } - searchPanelMaterialCardView.setVisibility(View.GONE); + binding.searchPanelMaterialCardViewViewPostDetailActivity.setVisibility(View.GONE); }); } @@ -480,19 +448,19 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele } public boolean toggleSearchPanelVisibility() { - if (searchPanelMaterialCardView.getVisibility() == View.GONE) { - searchPanelMaterialCardView.setVisibility(View.VISIBLE); + if (binding.searchPanelMaterialCardViewViewPostDetailActivity.getVisibility() == View.GONE) { + binding.searchPanelMaterialCardViewViewPostDetailActivity.setVisibility(View.VISIBLE); return false; } else { - searchPanelMaterialCardView.setVisibility(View.GONE); - searchTextInputEditText.setText(""); + binding.searchPanelMaterialCardViewViewPostDetailActivity.setVisibility(View.GONE); + binding.searchTextInputEditTextViewPostDetailActivity.setText(""); return true; } } public void searchComment(ViewPostDetailFragment fragment, boolean searchNextComment) { - if (!searchTextInputEditText.getText().toString().isEmpty()) { - fragment.searchComment(searchTextInputEditText.getText().toString(), searchNextComment); + if (!binding.searchTextInputEditTextViewPostDetailActivity.getText().toString().isEmpty()) { + fragment.searchComment(binding.searchTextInputEditTextViewPostDetailActivity.getText().toString(), searchNextComment); } } @@ -598,7 +566,7 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele posts = new ArrayList<>(postLinkedHashSet); handler.post(() -> { if (changePage) { - viewPager2.setCurrentItem(currentPostsSize - 1, false); + binding.viewPager2ViewPostDetailActivity.setCurrentItem(currentPostsSize - 1, false); } sectionsPagerAdapter.notifyItemRangeInserted(currentPostsSize, postLinkedHashSet.size() - currentPostsSize); loadingMorePostsStatus = LoadingMorePostsStatus.NOT_LOADING; @@ -680,7 +648,7 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele posts = new ArrayList<>(postLinkedHashSet); handler.post(() -> { if (changePage) { - viewPager2.setCurrentItem(currentPostsSize - 1, false); + binding.viewPager2ViewPostDetailActivity.setCurrentItem(currentPostsSize - 1, false); } sectionsPagerAdapter.notifyItemRangeInserted(currentPostsSize, postLinkedHashSet.size() - currentPostsSize); loadingMorePostsStatus = LoadingMorePostsStatus.NOT_LOADING; @@ -832,7 +800,7 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele ViewPostDetailFragment fragment = sectionsPagerAdapter.getCurrentFragment(); if (fragment != null) { fragment.changeSortType(sortType); - mToolbar.setTitle(sortType.getType().fullName); + binding.toolbarViewPostDetailActivity.setTitle(sortType.getType().fullName); } } @@ -895,10 +863,10 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele @Nullable ViewPostDetailFragment getCurrentFragment() { - if (viewPager2 == null || fragmentManager == null) { + if (fragmentManager == null) { return null; } - Fragment fragment = fragmentManager.findFragmentByTag("f" + viewPager2.getCurrentItem()); + Fragment fragment = fragmentManager.findFragmentByTag("f" + binding.viewPager2ViewPostDetailActivity.getCurrentItem()); if (fragment instanceof ViewPostDetailFragment) { return (ViewPostDetailFragment) fragment; } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPrivateMessagesActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPrivateMessagesActivity.java index 4bacdc30..98bda50b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPrivateMessagesActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPrivateMessagesActivity.java @@ -6,20 +6,12 @@ import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.view.MenuItem; -import android.view.View; -import android.widget.EditText; -import android.widget.ImageView; -import android.widget.LinearLayout; import androidx.annotation.NonNull; -import androidx.appcompat.widget.Toolbar; -import androidx.coordinatorlayout.widget.CoordinatorLayout; -import androidx.recyclerview.widget.RecyclerView; import androidx.transition.AutoTransition; import androidx.transition.TransitionManager; import com.evernote.android.state.State; -import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.snackbar.Snackbar; import com.livefront.bridge.Bridge; @@ -32,8 +24,6 @@ import java.util.concurrent.Executor; import javax.inject.Inject; import javax.inject.Named; -import butterknife.BindView; -import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.ActivityToolbarInterface; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; @@ -42,6 +32,7 @@ import ml.docilealligator.infinityforreddit.adapters.PrivateMessagesDetailRecycl import ml.docilealligator.infinityforreddit.asynctasks.LoadUserData; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customviews.LinearLayoutManagerBugFixed; +import ml.docilealligator.infinityforreddit.databinding.ActivityViewPrivateMessagesBinding; import ml.docilealligator.infinityforreddit.events.PassPrivateMessageEvent; import ml.docilealligator.infinityforreddit.events.PassPrivateMessageIndexEvent; import ml.docilealligator.infinityforreddit.events.RepliedToPrivateMessageEvent; @@ -55,22 +46,7 @@ public class ViewPrivateMessagesActivity extends BaseActivity implements Activit public static final String EXTRA_PRIVATE_MESSAGE_INDEX = "EPM"; public static final String EXTRA_MESSAGE_POSITION = "EMP"; private static final String USER_AVATAR_STATE = "UAS"; - @BindView(R.id.coordinator_layout_view_private_messages_activity) - CoordinatorLayout mCoordinatorLayout; - @BindView(R.id.appbar_layout_view_private_messages_activity) - AppBarLayout mAppBarLayout; - @BindView(R.id.toolbar_view_private_messages_activity) - Toolbar mToolbar; - @BindView(R.id.recycler_view_view_private_messages) - RecyclerView mRecyclerView; - @BindView(R.id.edit_text_divider_view_private_messages_activity) - View mDivider; - @BindView(R.id.edit_text_view_private_messages_activity) - EditText mEditText; - @BindView(R.id.send_image_view_view_private_messages_activity) - ImageView mSendImageView; - @BindView(R.id.edit_text_wrapper_linear_layout_view_private_messages_activity) - LinearLayout mEditTextLinearLayout; + @Inject @Named("no_oauth") Retrofit mRetrofit; @@ -101,6 +77,7 @@ public class ViewPrivateMessagesActivity extends BaseActivity implements Activit private boolean isSendingMessage = false; private int mSecondaryTextColor; private int mSendMessageIconColor; + private ActivityViewPrivateMessagesBinding binding; @Override protected void onCreate(Bundle savedInstanceState) { @@ -110,22 +87,21 @@ public class ViewPrivateMessagesActivity extends BaseActivity implements Activit super.onCreate(savedInstanceState); - setContentView(R.layout.activity_view_private_messages); + binding = ActivityViewPrivateMessagesBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); Bridge.restoreInstanceState(this, savedInstanceState); - ButterKnife.bind(this); - EventBus.getDefault().register(this); applyCustomTheme(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isChangeStatusBarIconColor()) { - addOnOffsetChangedListener(mAppBarLayout); + addOnOffsetChangedListener(binding.appbarLayoutViewPrivateMessagesActivity); } - setSupportActionBar(mToolbar); - setToolbarGoToTop(mToolbar); + setSupportActionBar(binding.toolbarViewPrivateMessagesActivity); + setToolbarGoToTop(binding.toolbarViewPrivateMessagesActivity); mProvideUserAvatarCallbacks = new ArrayList<>(); @@ -145,7 +121,7 @@ public class ViewPrivateMessagesActivity extends BaseActivity implements Activit if (privateMessage != null) { if (privateMessage.getAuthor().equals(accountName)) { setTitle(privateMessage.getDestination()); - mToolbar.setOnClickListener(view -> { + binding.toolbarViewPrivateMessagesActivity.setOnClickListener(view -> { if (privateMessage.isDestinationDeleted()) { return; } @@ -155,7 +131,7 @@ public class ViewPrivateMessagesActivity extends BaseActivity implements Activit }); } else { setTitle(privateMessage.getAuthor()); - mToolbar.setOnClickListener(view -> { + binding.toolbarViewPrivateMessagesActivity.setOnClickListener(view -> { if (privateMessage.isAuthorDeleted()) { return; } @@ -169,12 +145,12 @@ public class ViewPrivateMessagesActivity extends BaseActivity implements Activit getResources().getConfiguration().locale, privateMessage, accountName, mCustomThemeWrapper); mLinearLayoutManager = new LinearLayoutManagerBugFixed(this); mLinearLayoutManager.setStackFromEnd(true); - mRecyclerView.setLayoutManager(mLinearLayoutManager); - mRecyclerView.setAdapter(mAdapter); + binding.recyclerViewViewPrivateMessages.setLayoutManager(mLinearLayoutManager); + binding.recyclerViewViewPrivateMessages.setAdapter(mAdapter); goToBottom(); - mSendImageView.setOnClickListener(view -> { + binding.sendImageViewViewPrivateMessagesActivity.setOnClickListener(view -> { if (!isSendingMessage) { - if (!mEditText.getText().toString().equals("")) { + if (!binding.editTextViewPrivateMessagesActivity.getText().toString().equals("")) { //Send Message if (privateMessage != null) { ArrayList<Message> replies = privateMessage.getReplies(); @@ -182,8 +158,8 @@ public class ViewPrivateMessagesActivity extends BaseActivity implements Activit replyTo = privateMessage; } isSendingMessage = true; - mSendImageView.setColorFilter(mSecondaryTextColor, android.graphics.PorterDuff.Mode.SRC_IN); - ReplyMessage.replyMessage(mEditText.getText().toString(), replyTo.getFullname(), + binding.sendImageViewViewPrivateMessagesActivity.setColorFilter(mSecondaryTextColor, android.graphics.PorterDuff.Mode.SRC_IN); + ReplyMessage.replyMessage(binding.editTextViewPrivateMessagesActivity.getText().toString(), replyTo.getFullname(), getResources().getConfiguration().locale, mOauthRetrofit, accessToken, new ReplyMessage.ReplyMessageListener() { @Override @@ -192,8 +168,8 @@ public class ViewPrivateMessagesActivity extends BaseActivity implements Activit mAdapter.addReply(message); } goToBottom(); - mEditText.setText(""); - mSendImageView.setColorFilter(mSendMessageIconColor, android.graphics.PorterDuff.Mode.SRC_IN); + binding.editTextViewPrivateMessagesActivity.setText(""); + binding.sendImageViewViewPrivateMessagesActivity.setColorFilter(mSendMessageIconColor, android.graphics.PorterDuff.Mode.SRC_IN); isSendingMessage = false; EventBus.getDefault().post(new RepliedToPrivateMessageEvent(message, getIntent().getIntExtra(EXTRA_MESSAGE_POSITION, -1))); } @@ -201,11 +177,11 @@ public class ViewPrivateMessagesActivity extends BaseActivity implements Activit @Override public void replyMessageFailed(String errorMessage) { if (errorMessage != null && !errorMessage.equals("")) { - Snackbar.make(mCoordinatorLayout, errorMessage, Snackbar.LENGTH_LONG).show(); + Snackbar.make(binding.getRoot(), errorMessage, Snackbar.LENGTH_LONG).show(); } else { - Snackbar.make(mCoordinatorLayout, R.string.reply_message_failed, Snackbar.LENGTH_LONG).show(); + Snackbar.make(binding.getRoot(), R.string.reply_message_failed, Snackbar.LENGTH_LONG).show(); } - mSendImageView.setColorFilter(mSendMessageIconColor, android.graphics.PorterDuff.Mode.SRC_IN); + binding.sendImageViewViewPrivateMessagesActivity.setColorFilter(mSendMessageIconColor, android.graphics.PorterDuff.Mode.SRC_IN); isSendingMessage = false; } }); @@ -257,7 +233,7 @@ public class ViewPrivateMessagesActivity extends BaseActivity implements Activit } public void delayTransition() { - TransitionManager.beginDelayedTransition(mRecyclerView, new AutoTransition()); + TransitionManager.beginDelayedTransition(binding.recyclerViewViewPrivateMessages, new AutoTransition()); } private void goToBottom() { @@ -307,17 +283,18 @@ public class ViewPrivateMessagesActivity extends BaseActivity implements Activit @Override protected void applyCustomTheme() { - mCoordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); - applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(mAppBarLayout, null, mToolbar); - mDivider.setBackgroundColor(mCustomThemeWrapper.getDividerColor()); - mEditText.setTextColor(mCustomThemeWrapper.getPrimaryTextColor()); + binding.getRoot().setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(binding.appbarLayoutViewPrivateMessagesActivity, + null, binding.toolbarViewPrivateMessagesActivity); + binding.editTextDividerViewPrivateMessagesActivity.setBackgroundColor(mCustomThemeWrapper.getDividerColor()); + binding.editTextViewPrivateMessagesActivity.setTextColor(mCustomThemeWrapper.getPrimaryTextColor()); mSecondaryTextColor = mCustomThemeWrapper.getSecondaryTextColor(); - mEditText.setHintTextColor(mSecondaryTextColor); - mEditTextLinearLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + binding.editTextViewPrivateMessagesActivity.setHintTextColor(mSecondaryTextColor); + binding.editTextWrapperLinearLayoutViewPrivateMessagesActivity.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); mSendMessageIconColor = mCustomThemeWrapper.getSendMessageIconColor(); - mSendImageView.setColorFilter(mSendMessageIconColor, android.graphics.PorterDuff.Mode.SRC_IN); + binding.sendImageViewViewPrivateMessagesActivity.setColorFilter(mSendMessageIconColor, android.graphics.PorterDuff.Mode.SRC_IN); if (typeface != null) { - mEditText.setTypeface(typeface); + binding.editTextViewPrivateMessagesActivity.setTypeface(typeface); } } 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 1c4b8c04..14005615 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java @@ -34,15 +34,12 @@ import javax.inject.Inject; import javax.inject.Named; import app.futured.hauler.DragDirection; -import app.futured.hauler.HaulerView; -import butterknife.BindView; -import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.CustomFontReceiver; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.SetAsWallpaperCallback; import ml.docilealligator.infinityforreddit.WallpaperSetter; -import ml.docilealligator.infinityforreddit.customviews.ViewPagerBugFixed; +import ml.docilealligator.infinityforreddit.databinding.ActivityViewRedditGalleryBinding; import ml.docilealligator.infinityforreddit.font.ContentFontFamily; import ml.docilealligator.infinityforreddit.font.ContentFontStyle; import ml.docilealligator.infinityforreddit.font.FontFamily; @@ -62,10 +59,6 @@ public class ViewRedditGalleryActivity extends AppCompatActivity implements SetA public static final String EXTRA_IS_NSFW = "EIN"; public static final String EXTRA_GALLERY_ITEM_INDEX = "EGII"; - @BindView(R.id.hauler_view_view_reddit_gallery_activity) - HaulerView haulerView; - @BindView(R.id.view_pager_view_reddit_gallery_activity) - ViewPagerBugFixed viewPager; @Inject @Named("default") SharedPreferences sharedPreferences; @@ -78,6 +71,7 @@ public class ViewRedditGalleryActivity extends AppCompatActivity implements SetA private boolean isNsfw; private boolean useBottomAppBar; private boolean isActionBarHidden = false; + private ActivityViewRedditGalleryBinding binding; @Override protected void onCreate(Bundle savedInstanceState) { @@ -135,9 +129,8 @@ public class ViewRedditGalleryActivity extends AppCompatActivity implements SetA getTheme().applyStyle(ContentFontFamily.valueOf(sharedPreferences .getString(SharedPreferencesUtils.CONTENT_FONT_FAMILY_KEY, ContentFontFamily.Default.name())).getResId(), true); - setContentView(R.layout.activity_view_reddit_gallery); - - ButterKnife.bind(this); + binding = ActivityViewRedditGalleryBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); useBottomAppBar = sharedPreferences.getBoolean(SharedPreferencesUtils.USE_BOTTOM_TOOLBAR_IN_MEDIA_VIEWER, false); @@ -160,13 +153,13 @@ public class ViewRedditGalleryActivity extends AppCompatActivity implements SetA isNsfw = getIntent().getBooleanExtra(EXTRA_IS_NSFW, false); if (sharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_VERTICALLY_TO_GO_BACK_FROM_MEDIA, true)) { - haulerView.setOnDragDismissedListener(dragDirection -> { + binding.getRoot().setOnDragDismissedListener(dragDirection -> { int slide = dragDirection == DragDirection.UP ? R.anim.slide_out_up : R.anim.slide_out_down; finish(); overridePendingTransition(0, slide); }); } else { - haulerView.setDragEnabled(false); + binding.getRoot().setDragEnabled(false); } setupViewPager(savedInstanceState); @@ -179,7 +172,7 @@ public class ViewRedditGalleryActivity extends AppCompatActivity implements SetA private void setupViewPager(Bundle savedInstanceState) { if (!useBottomAppBar) { setToolbarTitle(0); - viewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { + binding.viewPagerViewRedditGalleryActivity.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { setToolbarTitle(position); @@ -187,10 +180,10 @@ public class ViewRedditGalleryActivity extends AppCompatActivity implements SetA }); } sectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); - viewPager.setAdapter(sectionsPagerAdapter); - viewPager.setOffscreenPageLimit(3); + binding.viewPagerViewRedditGalleryActivity.setAdapter(sectionsPagerAdapter); + binding.viewPagerViewRedditGalleryActivity.setOffscreenPageLimit(3); if (savedInstanceState == null) { - viewPager.setCurrentItem(getIntent().getIntExtra(EXTRA_GALLERY_ITEM_INDEX, 0), false); + binding.viewPagerViewRedditGalleryActivity.setCurrentItem(getIntent().getIntExtra(EXTRA_GALLERY_ITEM_INDEX, 0), false); } } @@ -276,7 +269,7 @@ public class ViewRedditGalleryActivity extends AppCompatActivity implements SetA } public int getCurrentPagePosition() { - return viewPager.getCurrentItem(); + return binding.viewPagerViewRedditGalleryActivity.getCurrentItem(); } @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java index 2dbb5440..ccabbcfe 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java @@ -98,6 +98,7 @@ import ml.docilealligator.infinityforreddit.bottomsheetfragments.UrlMenuBottomSh import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customviews.NavigationWrapper; import ml.docilealligator.infinityforreddit.customviews.slidr.Slidr; +import ml.docilealligator.infinityforreddit.databinding.ActivityViewSubredditDetailBinding; import ml.docilealligator.infinityforreddit.events.ChangeNSFWEvent; import ml.docilealligator.infinityforreddit.events.GoBackToMainPageEvent; import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent; @@ -141,38 +142,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp private static final String NEW_ACCOUNT_NAME_STATE = "NANS"; private static final int ADD_TO_MULTIREDDIT_REQUEST_CODE = 1; public SubredditViewModel mSubredditViewModel; - @BindView(R.id.coordinator_layout_view_subreddit_detail_activity) - CoordinatorLayout coordinatorLayout; - @BindView(R.id.view_pager_view_subreddit_detail_activity) - ViewPager2 viewPager2; - @BindView(R.id.appbar_layout_view_subreddit_detail_activity) - AppBarLayout appBarLayout; - @BindView(R.id.collapsing_toolbar_layout_view_subreddit_detail_activity) - CollapsingToolbarLayout collapsingToolbarLayout; - @BindView(R.id.toolbar_linear_layout_view_subreddit_detail_activity) - LinearLayout linearLayout; - @BindView(R.id.toolbar) - MaterialToolbar toolbar; - @BindView(R.id.tab_layout_view_subreddit_detail_activity) - TabLayout tabLayout; - @BindView(R.id.banner_image_view_view_subreddit_detail_activity) - GifImageView bannerImageView; - @BindView(R.id.icon_gif_image_view_view_subreddit_detail_activity) - GifImageView iconGifImageView; - @BindView(R.id.subscribe_subreddit_chip_view_subreddit_detail_activity) - Chip subscribeSubredditChip; - @BindView(R.id.subreddit_name_text_view_view_subreddit_detail_activity) - TextView subredditNameTextView; - @BindView(R.id.subscriber_count_text_view_view_subreddit_detail_activity) - TextView nSubscribersTextView; - @BindView(R.id.online_subscriber_count_text_view_view_subreddit_detail_activity) - TextView nOnlineSubscribersTextView; - @BindView(R.id.since_text_view_view_subreddit_detail_activity) - TextView sinceTextView; - @BindView(R.id.creation_time_text_view_view_subreddit_detail_activity) - TextView creationTimeTextView; - @BindView(R.id.description_text_view_view_subreddit_detail_activity) - TextView descriptionTextView; + @Inject @Named("no_oauth") Retrofit mRetrofit; @@ -231,6 +201,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp private int fabOption; private MaterialAlertDialogBuilder nsfwWarningBuilder; private Bitmap subredditIconBitmap; + private ActivityViewSubredditDetailBinding binding; @Override protected void onCreate(Bundle savedInstanceState) { @@ -238,9 +209,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp super.onCreate(savedInstanceState); - setContentView(R.layout.activity_view_subreddit_detail); - - ButterKnife.bind(this); + binding = ActivityViewSubredditDetailBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); hideFab = mSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_FAB_IN_POST_FEED, false); showBottomAppBar = mSharedPreferences.getBoolean(SharedPreferencesUtils.BOTTOM_APP_BAR_KEY, false); @@ -258,7 +228,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp mSliderPanel = Slidr.attach(this); } - mViewPager2 = viewPager2; + mViewPager2 = binding.viewPagerViewSubredditDetailActivity; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { Window window = getWindow(); @@ -269,7 +239,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp } else { window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); } - adjustToolbar(toolbar); + adjustToolbar(binding.toolbar); int navBarHeight = getNavBarHeight(); if (navBarHeight > 0) { @@ -285,50 +255,50 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp View decorView = window.getDecorView(); if (isChangeStatusBarIconColor()) { - appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() { + binding.appbarLayoutViewSubredditDetailActivity.addOnOffsetChangedListener(new AppBarStateChangeListener() { @Override public void onStateChanged(AppBarLayout appBarLayout, AppBarStateChangeListener.State state) { if (state == State.COLLAPSED) { decorView.setSystemUiVisibility(getSystemVisibilityToolbarCollapsed()); - tabLayout.setTabTextColors(collapsedTabTextColor, collapsedTabTextColor); - tabLayout.setSelectedTabIndicatorColor(collapsedTabIndicatorColor); - tabLayout.setBackgroundColor(collapsedTabBackgroundColor); + binding.tabLayoutViewSubredditDetailActivity.setTabTextColors(collapsedTabTextColor, collapsedTabTextColor); + binding.tabLayoutViewSubredditDetailActivity.setSelectedTabIndicatorColor(collapsedTabIndicatorColor); + binding.tabLayoutViewSubredditDetailActivity.setBackgroundColor(collapsedTabBackgroundColor); } else if (state == State.EXPANDED) { decorView.setSystemUiVisibility(getSystemVisibilityToolbarExpanded()); - tabLayout.setTabTextColors(expandedTabTextColor, expandedTabTextColor); - tabLayout.setSelectedTabIndicatorColor(expandedTabIndicatorColor); - tabLayout.setBackgroundColor(expandedTabBackgroundColor); + binding.tabLayoutViewSubredditDetailActivity.setTabTextColors(expandedTabTextColor, expandedTabTextColor); + binding.tabLayoutViewSubredditDetailActivity.setSelectedTabIndicatorColor(expandedTabIndicatorColor); + binding.tabLayoutViewSubredditDetailActivity.setBackgroundColor(expandedTabBackgroundColor); } } }); } else { - appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() { + binding.appbarLayoutViewSubredditDetailActivity.addOnOffsetChangedListener(new AppBarStateChangeListener() { @Override public void onStateChanged(AppBarLayout appBarLayout, State state) { if (state == State.COLLAPSED) { - tabLayout.setTabTextColors(collapsedTabTextColor, collapsedTabTextColor); - tabLayout.setSelectedTabIndicatorColor(collapsedTabIndicatorColor); - tabLayout.setBackgroundColor(collapsedTabBackgroundColor); + binding.tabLayoutViewSubredditDetailActivity.setTabTextColors(collapsedTabTextColor, collapsedTabTextColor); + binding.tabLayoutViewSubredditDetailActivity.setSelectedTabIndicatorColor(collapsedTabIndicatorColor); + binding.tabLayoutViewSubredditDetailActivity.setBackgroundColor(collapsedTabBackgroundColor); } else if (state == State.EXPANDED) { - tabLayout.setTabTextColors(expandedTabTextColor, expandedTabTextColor); - tabLayout.setSelectedTabIndicatorColor(expandedTabIndicatorColor); - tabLayout.setBackgroundColor(expandedTabBackgroundColor); + binding.tabLayoutViewSubredditDetailActivity.setTabTextColors(expandedTabTextColor, expandedTabTextColor); + binding.tabLayoutViewSubredditDetailActivity.setSelectedTabIndicatorColor(expandedTabIndicatorColor); + binding.tabLayoutViewSubredditDetailActivity.setBackgroundColor(expandedTabBackgroundColor); } } }); } } else { - appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() { + binding.appbarLayoutViewSubredditDetailActivity.addOnOffsetChangedListener(new AppBarStateChangeListener() { @Override public void onStateChanged(AppBarLayout appBarLayout, State state) { if (state == State.EXPANDED) { - tabLayout.setTabTextColors(expandedTabTextColor, expandedTabTextColor); - tabLayout.setSelectedTabIndicatorColor(expandedTabIndicatorColor); - tabLayout.setBackgroundColor(expandedTabBackgroundColor); + binding.tabLayoutViewSubredditDetailActivity.setTabTextColors(expandedTabTextColor, expandedTabTextColor); + binding.tabLayoutViewSubredditDetailActivity.setSelectedTabIndicatorColor(expandedTabIndicatorColor); + binding.tabLayoutViewSubredditDetailActivity.setBackgroundColor(expandedTabBackgroundColor); } else if (state == State.COLLAPSED) { - tabLayout.setTabTextColors(collapsedTabTextColor, collapsedTabTextColor); - tabLayout.setSelectedTabIndicatorColor(collapsedTabIndicatorColor); - tabLayout.setBackgroundColor(collapsedTabBackgroundColor); + binding.tabLayoutViewSubredditDetailActivity.setTabTextColors(collapsedTabTextColor, collapsedTabTextColor); + binding.tabLayoutViewSubredditDetailActivity.setSelectedTabIndicatorColor(collapsedTabIndicatorColor); + binding.tabLayoutViewSubredditDetailActivity.setBackgroundColor(collapsedTabBackgroundColor); } } }); @@ -351,7 +321,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp mNewAccountName = savedInstanceState.getString(NEW_ACCOUNT_NAME_STATE); if (mFetchSubredditInfoSuccess) { - nOnlineSubscribersTextView.setText(getString(R.string.online_subscribers_number_detail, mNCurrentOnlineSubscribers)); + binding.onlineSubscriberCountTextViewViewSubredditDetailActivity.setText(getString(R.string.online_subscribers_number_detail, mNCurrentOnlineSubscribers)); } } @@ -360,11 +330,11 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp fetchSubredditData(); String title = "r/" + subredditName; - subredditNameTextView.setText(title); + binding.subredditNameTextViewViewSubredditDetailActivity.setText(title); - toolbar.setTitle(title); - setSupportActionBar(toolbar); - setToolbarGoToTop(toolbar); + binding.toolbar.setTitle(title); + setSupportActionBar(binding.toolbar); + setToolbarGoToTop(binding.toolbar); glide = Glide.with(this); Locale locale = getResources().getConfiguration().locale; @@ -393,8 +363,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp Markwon markwon = MarkdownUtils.createDescriptionMarkwon(this, miscPlugin, onLinkLongClickListener); - descriptionTextView.setOnLongClickListener(view -> { - if (description != null && !description.equals("") && descriptionTextView.getSelectionStart() == -1 && descriptionTextView.getSelectionEnd() == -1) { + binding.descriptionTextViewViewSubredditDetailActivity.setOnLongClickListener(view -> { + if (description != null && !description.equals("") && binding.descriptionTextViewViewSubredditDetailActivity.getSelectionStart() == -1 && binding.descriptionTextViewViewSubredditDetailActivity.getSelectionEnd() == -1) { CopyTextBottomSheetFragment.show(getSupportFragmentManager(), description, null); return true; } @@ -409,12 +379,12 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp isNsfwSubreddit = subredditData.isNSFW(); if (subredditData.getBannerUrl().equals("")) { - iconGifImageView.setOnClickListener(view -> { + binding.iconGifImageViewViewSubredditDetailActivity.setOnClickListener(view -> { //Do nothing as it has no image }); } else { - glide.load(subredditData.getBannerUrl()).into(bannerImageView); - bannerImageView.setOnClickListener(view -> { + glide.load(subredditData.getBannerUrl()).into(binding.bannerImageViewViewSubredditDetailActivity); + binding.bannerImageViewViewSubredditDetailActivity.setOnClickListener(view -> { Intent intent = new Intent(ViewSubredditDetailActivity.this, ViewImageOrGifActivity.class); intent.putExtra(ViewImageOrGifActivity.EXTRA_IMAGE_URL_KEY, subredditData.getBannerUrl()); intent.putExtra(ViewImageOrGifActivity.EXTRA_FILE_NAME_KEY, subredditName + "-banner.jpg"); @@ -426,8 +396,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp if (subredditData.getIconUrl().equals("")) { glide.load(getDrawable(R.drawable.subreddit_default_icon)) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(216, 0))) - .into(iconGifImageView); - iconGifImageView.setOnClickListener(null); + .into(binding.iconGifImageViewViewSubredditDetailActivity); + binding.iconGifImageViewViewSubredditDetailActivity.setOnClickListener(null); } else { glide.asBitmap() .load(subredditData.getIconUrl()) @@ -438,7 +408,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp @Override public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) { subredditIconBitmap = resource; - iconGifImageView.setImageBitmap(resource); + binding.iconGifImageViewViewSubredditDetailActivity.setImageBitmap(resource); } @Override @@ -446,7 +416,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp subredditIconBitmap = null; } }); - iconGifImageView.setOnClickListener(view -> { + binding.iconGifImageViewViewSubredditDetailActivity.setOnClickListener(view -> { Intent intent = new Intent(ViewSubredditDetailActivity.this, ViewImageOrGifActivity.class); intent.putExtra(ViewImageOrGifActivity.EXTRA_IMAGE_URL_KEY, subredditData.getIconUrl()); intent.putExtra(ViewImageOrGifActivity.EXTRA_FILE_NAME_KEY, subredditName + "-icon.jpg"); @@ -459,17 +429,17 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp if (!title.equals(subredditFullName)) { getSupportActionBar().setTitle(subredditFullName); } - subredditNameTextView.setText(subredditFullName); + binding.subredditNameTextViewViewSubredditDetailActivity.setText(subredditFullName); String nSubscribers = getString(R.string.subscribers_number_detail, subredditData.getNSubscribers()); - nSubscribersTextView.setText(nSubscribers); - creationTimeTextView.setText(new SimpleDateFormat("MMM d, yyyy", + binding.subscriberCountTextViewViewSubredditDetailActivity.setText(nSubscribers); + binding.creationTimeTextViewViewSubredditDetailActivity.setText(new SimpleDateFormat("MMM d, yyyy", locale).format(subredditData.getCreatedUTC())); description = subredditData.getDescription(); if (hideSubredditDescription || description.equals("")) { - descriptionTextView.setVisibility(View.GONE); + binding.descriptionTextViewViewSubredditDetailActivity.setVisibility(View.GONE); } else { - descriptionTextView.setVisibility(View.VISIBLE); - markwon.setMarkdown(descriptionTextView, description); + binding.descriptionTextViewViewSubredditDetailActivity.setVisibility(View.VISIBLE); + markwon.setMarkdown(binding.descriptionTextViewViewSubredditDetailActivity, description); } if (subredditData.isNSFW()) { @@ -516,41 +486,42 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp @Override protected void applyCustomTheme() { - coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); - appBarLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { + binding.getRoot().setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + binding.appbarLayoutViewSubredditDetailActivity.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { - appBarLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this); - collapsingToolbarLayout.setScrimVisibleHeightTrigger(toolbar.getHeight() + tabLayout.getHeight() + getStatusBarHeight() * 2); + binding.appbarLayoutViewSubredditDetailActivity.getViewTreeObserver().removeOnGlobalLayoutListener(this); + binding.collapsingToolbarLayoutViewSubredditDetailActivity.setScrimVisibleHeightTrigger(binding.toolbar.getHeight() + binding.tabLayoutViewSubredditDetailActivity.getHeight() + getStatusBarHeight() * 2); } }); - applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar, false); + applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(binding.appbarLayoutViewSubredditDetailActivity, + binding.collapsingToolbarLayoutViewSubredditDetailActivity, binding.toolbar, false); expandedTabTextColor = mCustomThemeWrapper.getTabLayoutWithExpandedCollapsingToolbarTextColor(); expandedTabIndicatorColor = mCustomThemeWrapper.getTabLayoutWithExpandedCollapsingToolbarTabIndicator(); expandedTabBackgroundColor = mCustomThemeWrapper.getTabLayoutWithExpandedCollapsingToolbarTabBackground(); collapsedTabTextColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTextColor(); collapsedTabIndicatorColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTabIndicator(); collapsedTabBackgroundColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTabBackground(); - linearLayout.setBackgroundColor(expandedTabBackgroundColor); - subredditNameTextView.setTextColor(mCustomThemeWrapper.getSubreddit()); - subscribeSubredditChip.setTextColor(mCustomThemeWrapper.getChipTextColor()); + binding.toolbarLinearLayoutViewSubredditDetailActivity.setBackgroundColor(expandedTabBackgroundColor); + binding.subredditNameTextViewViewSubredditDetailActivity.setTextColor(mCustomThemeWrapper.getSubreddit()); + binding.subscribeSubredditChipViewSubredditDetailActivity.setTextColor(mCustomThemeWrapper.getChipTextColor()); int primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor(); - nSubscribersTextView.setTextColor(primaryTextColor); - nOnlineSubscribersTextView.setTextColor(primaryTextColor); - sinceTextView.setTextColor(primaryTextColor); - creationTimeTextView.setTextColor(primaryTextColor); - descriptionTextView.setTextColor(primaryTextColor); + binding.subscriberCountTextViewViewSubredditDetailActivity.setTextColor(primaryTextColor); + binding.onlineSubscriberCountTextViewViewSubredditDetailActivity.setTextColor(primaryTextColor); + binding.sinceTextViewViewSubredditDetailActivity.setTextColor(primaryTextColor); + binding.creationTimeTextViewViewSubredditDetailActivity.setTextColor(primaryTextColor); + binding.descriptionTextViewViewSubredditDetailActivity.setTextColor(primaryTextColor); navigationWrapper.applyCustomTheme(mCustomThemeWrapper.getBottomAppBarIconColor(), mCustomThemeWrapper.getBottomAppBarBackgroundColor()); - applyTabLayoutTheme(tabLayout); + applyTabLayoutTheme(binding.tabLayoutViewSubredditDetailActivity); applyFABTheme(navigationWrapper.floatingActionButton); if (typeface != null) { - subredditNameTextView.setTypeface(typeface); - subscribeSubredditChip.setTypeface(typeface); - nSubscribersTextView.setTypeface(typeface); - nOnlineSubscribersTextView.setTypeface(typeface); - sinceTextView.setTypeface(typeface); - creationTimeTextView.setTypeface(typeface); - descriptionTextView.setTypeface(typeface); + binding.subredditNameTextViewViewSubredditDetailActivity.setTypeface(typeface); + binding.subscribeSubredditChipViewSubredditDetailActivity.setTypeface(typeface); + binding.subscriberCountTextViewViewSubredditDetailActivity.setTypeface(typeface); + binding.onlineSubscriberCountTextViewViewSubredditDetailActivity.setTypeface(typeface); + binding.sinceTextViewViewSubredditDetailActivity.setTypeface(typeface); + binding.creationTimeTextViewViewSubredditDetailActivity.setTypeface(typeface); + binding.descriptionTextViewViewSubredditDetailActivity.setTypeface(typeface); } unsubscribedColor = mCustomThemeWrapper.getUnsubscribed(); subscribedColor = mCustomThemeWrapper.getSubscribed(); @@ -586,7 +557,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp @Override public void onFetchSubredditDataSuccess(SubredditData subredditData, int nCurrentOnlineSubscribers) { mNCurrentOnlineSubscribers = nCurrentOnlineSubscribers; - nOnlineSubscribersTextView.setText(getString(R.string.online_subscribers_number_detail, nCurrentOnlineSubscribers)); + binding.onlineSubscriberCountTextViewViewSubredditDetailActivity.setText(getString(R.string.online_subscribers_number_detail, nCurrentOnlineSubscribers)); InsertSubredditData.insertSubredditData(mExecutor, new Handler(), mRedditDataRoomDatabase, subredditData, () -> mFetchSubredditInfoSuccess = true); } @@ -953,18 +924,18 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp }); navigationWrapper.floatingActionButton.setVisibility(hideFab ? View.GONE : View.VISIBLE); - subscribeSubredditChip.setOnClickListener(view -> { + binding.subscribeSubredditChipViewSubredditDetailActivity.setOnClickListener(view -> { if (accountName.equals(Account.ANONYMOUS_ACCOUNT)) { if (subscriptionReady) { subscriptionReady = false; - if (getResources().getString(R.string.subscribe).contentEquals(subscribeSubredditChip.getText())) { + if (getResources().getString(R.string.subscribe).contentEquals(binding.subscribeSubredditChipViewSubredditDetailActivity.getText())) { SubredditSubscription.anonymousSubscribeToSubreddit(mExecutor, new Handler(), mRetrofit, mRedditDataRoomDatabase, subredditName, new SubredditSubscription.SubredditSubscriptionListener() { @Override public void onSubredditSubscriptionSuccess() { - subscribeSubredditChip.setText(R.string.unsubscribe); - subscribeSubredditChip.setChipBackgroundColor(ColorStateList.valueOf(subscribedColor)); + binding.subscribeSubredditChipViewSubredditDetailActivity.setText(R.string.unsubscribe); + binding.subscribeSubredditChipViewSubredditDetailActivity.setChipBackgroundColor(ColorStateList.valueOf(subscribedColor)); makeSnackbar(R.string.subscribed, false); subscriptionReady = true; } @@ -981,8 +952,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp new SubredditSubscription.SubredditSubscriptionListener() { @Override public void onSubredditSubscriptionSuccess() { - subscribeSubredditChip.setText(R.string.subscribe); - subscribeSubredditChip.setChipBackgroundColor(ColorStateList.valueOf(unsubscribedColor)); + binding.subscribeSubredditChipViewSubredditDetailActivity.setText(R.string.subscribe); + binding.subscribeSubredditChipViewSubredditDetailActivity.setChipBackgroundColor(ColorStateList.valueOf(unsubscribedColor)); makeSnackbar(R.string.unsubscribed, false); subscriptionReady = true; } @@ -998,14 +969,14 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp } else { if (subscriptionReady) { subscriptionReady = false; - if (getResources().getString(R.string.subscribe).contentEquals(subscribeSubredditChip.getText())) { + if (getResources().getString(R.string.subscribe).contentEquals(binding.subscribeSubredditChipViewSubredditDetailActivity.getText())) { SubredditSubscription.subscribeToSubreddit(mExecutor, new Handler(), mOauthRetrofit, mRetrofit, accessToken, subredditName, accountName, mRedditDataRoomDatabase, new SubredditSubscription.SubredditSubscriptionListener() { @Override public void onSubredditSubscriptionSuccess() { - subscribeSubredditChip.setText(R.string.unsubscribe); - subscribeSubredditChip.setChipBackgroundColor(ColorStateList.valueOf(subscribedColor)); + binding.subscribeSubredditChipViewSubredditDetailActivity.setText(R.string.unsubscribe); + binding.subscribeSubredditChipViewSubredditDetailActivity.setChipBackgroundColor(ColorStateList.valueOf(subscribedColor)); makeSnackbar(R.string.subscribed, false); subscriptionReady = true; } @@ -1022,8 +993,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp new SubredditSubscription.SubredditSubscriptionListener() { @Override public void onSubredditSubscriptionSuccess() { - subscribeSubredditChip.setText(R.string.subscribe); - subscribeSubredditChip.setChipBackgroundColor(ColorStateList.valueOf(unsubscribedColor)); + binding.subscribeSubredditChipViewSubredditDetailActivity.setText(R.string.subscribe); + binding.subscribeSubredditChipViewSubredditDetailActivity.setChipBackgroundColor(ColorStateList.valueOf(unsubscribedColor)); makeSnackbar(R.string.unsubscribed, false); subscriptionReady = true; } @@ -1044,21 +1015,21 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp new CheckIsSubscribedToSubreddit.CheckIsSubscribedToSubredditListener() { @Override public void isSubscribed() { - subscribeSubredditChip.setText(R.string.unsubscribe); - subscribeSubredditChip.setChipBackgroundColor(ColorStateList.valueOf(subscribedColor)); + binding.subscribeSubredditChipViewSubredditDetailActivity.setText(R.string.unsubscribe); + binding.subscribeSubredditChipViewSubredditDetailActivity.setChipBackgroundColor(ColorStateList.valueOf(subscribedColor)); subscriptionReady = true; } @Override public void isNotSubscribed() { - subscribeSubredditChip.setText(R.string.subscribe); - subscribeSubredditChip.setChipBackgroundColor(ColorStateList.valueOf(unsubscribedColor)); + binding.subscribeSubredditChipViewSubredditDetailActivity.setText(R.string.subscribe); + binding.subscribeSubredditChipViewSubredditDetailActivity.setChipBackgroundColor(ColorStateList.valueOf(unsubscribedColor)); subscriptionReady = true; } }); sectionsPagerAdapter = new SectionsPagerAdapter(this); - viewPager2.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { + binding.viewPagerViewSubredditDetailActivity.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { @Override public void onPageSelected(int position) { if (position == 0) { @@ -1076,10 +1047,10 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp sectionsPagerAdapter.displaySortTypeInToolbar(); } }); - viewPager2.setAdapter(sectionsPagerAdapter); - viewPager2.setOffscreenPageLimit(ViewPager2.OFFSCREEN_PAGE_LIMIT_DEFAULT); - viewPager2.setUserInputEnabled(!mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_SWIPING_BETWEEN_TABS, false)); - new TabLayoutMediator(tabLayout, viewPager2, (tab, position) -> { + binding.viewPagerViewSubredditDetailActivity.setAdapter(sectionsPagerAdapter); + binding.viewPagerViewSubredditDetailActivity.setOffscreenPageLimit(ViewPager2.OFFSCREEN_PAGE_LIMIT_DEFAULT); + binding.viewPagerViewSubredditDetailActivity.setUserInputEnabled(!mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_SWIPING_BETWEEN_TABS, false)); + new TabLayoutMediator(binding.tabLayoutViewSubredditDetailActivity, binding.viewPagerViewSubredditDetailActivity, (tab, position) -> { switch (position) { case 0: tab.setText(R.string.posts); @@ -1088,11 +1059,11 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp tab.setText(R.string.about); } }).attach(); - fixViewPager2Sensitivity(viewPager2); + fixViewPager2Sensitivity(binding.viewPagerViewSubredditDetailActivity); boolean viewSidebar = getIntent().getBooleanExtra(EXTRA_VIEW_SIDEBAR, false); if (viewSidebar) { - viewPager2.setCurrentItem(1, false); + binding.viewPagerViewSubredditDetailActivity.setCurrentItem(1, false); } } @@ -1235,10 +1206,10 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp Toast.makeText(this, resId, Toast.LENGTH_SHORT).show(); } else { if (retry) { - Snackbar.make(coordinatorLayout, resId, Snackbar.LENGTH_SHORT).setAction(R.string.retry, + Snackbar.make(binding.getRoot(), resId, Snackbar.LENGTH_SHORT).setAction(R.string.retry, view -> fetchSubredditData()).show(); } else { - Snackbar.make(coordinatorLayout, resId, Snackbar.LENGTH_SHORT).show(); + Snackbar.make(binding.getRoot(), resId, Snackbar.LENGTH_SHORT).show(); } } } @@ -1410,7 +1381,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp } private void goToSubreddit() { - View rootView = getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, coordinatorLayout, false); + View rootView = getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, binding.getRoot(), false); TextInputEditText thingEditText = rootView.findViewById(R.id.text_input_edit_text_go_to_thing_edit_text); RecyclerView recyclerView = rootView.findViewById(R.id.recycler_view_go_to_thing_edit_text); thingEditText.requestFocus(); @@ -1498,7 +1469,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp } private void goToUser() { - View rootView = getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, coordinatorLayout, false); + View rootView = getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, binding.getRoot(), false); TextInputEditText thingEditText = rootView.findViewById(R.id.text_input_edit_text_go_to_thing_edit_text); thingEditText.requestFocus(); Utils.showKeyboard(this, new Handler(), thingEditText); @@ -1594,11 +1565,11 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp if (fragmentManager == null) { return null; } - return fragmentManager.findFragmentByTag("f" + viewPager2.getCurrentItem()); + return fragmentManager.findFragmentByTag("f" + binding.viewPagerViewSubredditDetailActivity.getCurrentItem()); } public boolean handleKeyDown(int keyCode) { - if (viewPager2.getCurrentItem() == 0) { + if (binding.viewPagerViewSubredditDetailActivity.getCurrentItem() == 0) { Fragment fragment = getCurrentFragment(); if (fragment instanceof PostFragment) { return ((PostFragment) fragment).handleKeyDown(keyCode); @@ -1626,7 +1597,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp Fragment fragment = getCurrentFragment(); if (fragment instanceof PostFragment) { ((PostFragment) fragment).changeSortType(sortType); - Utils.displaySortTypeInToolbar(sortType, toolbar); + Utils.displaySortTypeInToolbar(sortType, binding.toolbar); } } @@ -1655,10 +1626,10 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp void displaySortTypeInToolbar() { if (fragmentManager != null) { - Fragment fragment = fragmentManager.findFragmentByTag("f" + viewPager2.getCurrentItem()); + Fragment fragment = fragmentManager.findFragmentByTag("f" + binding.viewPagerViewSubredditDetailActivity.getCurrentItem()); if (fragment instanceof PostFragment) { SortType sortType = ((PostFragment) fragment).getSortType(); - Utils.displaySortTypeInToolbar(sortType, toolbar); + Utils.displaySortTypeInToolbar(sortType, binding.toolbar); } } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java index 9ab1e2d6..fe0a49c6 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java @@ -20,8 +20,6 @@ import android.view.ViewTreeObserver; import android.view.Window; import android.view.WindowManager; import android.view.inputmethod.EditorInfo; -import android.widget.LinearLayout; -import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; @@ -39,12 +37,8 @@ import com.bumptech.glide.Glide; import com.bumptech.glide.RequestManager; import com.bumptech.glide.request.RequestOptions; import com.google.android.material.appbar.AppBarLayout; -import com.google.android.material.appbar.CollapsingToolbarLayout; -import com.google.android.material.appbar.MaterialToolbar; -import com.google.android.material.chip.Chip; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.snackbar.Snackbar; -import com.google.android.material.tabs.TabLayout; import com.google.android.material.tabs.TabLayoutMediator; import com.google.android.material.textfield.TextInputEditText; @@ -59,8 +53,6 @@ import java.util.concurrent.Executor; import javax.inject.Inject; import javax.inject.Named; -import butterknife.BindView; -import butterknife.ButterKnife; import io.noties.markwon.AbstractMarkwonPlugin; import io.noties.markwon.Markwon; import io.noties.markwon.MarkwonConfiguration; @@ -95,6 +87,7 @@ import ml.docilealligator.infinityforreddit.bottomsheetfragments.UserThingSortTy import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customviews.NavigationWrapper; import ml.docilealligator.infinityforreddit.customviews.slidr.Slidr; +import ml.docilealligator.infinityforreddit.databinding.ActivityViewUserDetailBinding; import ml.docilealligator.infinityforreddit.events.ChangeNSFWEvent; import ml.docilealligator.infinityforreddit.events.GoBackToMainPageEvent; import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent; @@ -118,7 +111,6 @@ import ml.docilealligator.infinityforreddit.user.UserViewModel; import ml.docilealligator.infinityforreddit.utils.APIUtils; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; import ml.docilealligator.infinityforreddit.utils.Utils; -import pl.droidsonroids.gif.GifImageView; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; @@ -139,34 +131,6 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele private static final String MESSAGE_FULLNAME_STATE = "MFS"; private static final String NEW_ACCOUNT_NAME_STATE = "NANS"; - @BindView(R.id.coordinator_layout_view_user_detail_activity) - CoordinatorLayout coordinatorLayout; - @BindView(R.id.view_pager_view_user_detail_activity) - ViewPager2 viewPager2; - @BindView(R.id.appbar_layout_view_user_detail) - AppBarLayout appBarLayout; - @BindView(R.id.toolbar_view_user_detail_activity) - MaterialToolbar toolbar; - @BindView(R.id.toolbar_linear_layout_view_user_detail_activity) - LinearLayout linearLayout; - @BindView(R.id.tab_layout_view_user_detail_activity) - TabLayout tabLayout; - @BindView(R.id.collapsing_toolbar_layout_view_user_detail_activity) - CollapsingToolbarLayout collapsingToolbarLayout; - @BindView(R.id.banner_image_view_view_user_detail_activity) - GifImageView bannerImageView; - @BindView(R.id.icon_gif_image_view_view_user_detail_activity) - GifImageView iconGifImageView; - @BindView(R.id.user_name_text_view_view_user_detail_activity) - TextView userNameTextView; - @BindView(R.id.subscribe_user_chip_view_user_detail_activity) - Chip subscribeUserChip; - @BindView(R.id.karma_text_view_view_user_detail_activity) - TextView karmaTextView; - @BindView(R.id.cakeday_text_view_view_user_detail_activity) - TextView cakedayTextView; - @BindView(R.id.description_text_view_view_user_detail_activity) - TextView descriptionTextView; @Inject @Named("no_oauth") Retrofit mRetrofit; @@ -223,6 +187,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele private String mMessageFullname; private String mNewAccountName; //private MaterialAlertDialogBuilder nsfwWarningBuilder; + private ActivityViewUserDetailBinding binding; @Override protected void onCreate(Bundle savedInstanceState) { @@ -231,9 +196,8 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele super.onCreate(savedInstanceState); - setContentView(R.layout.activity_view_user_detail); - - ButterKnife.bind(this); + binding = ActivityViewUserDetailBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); hideFab = mSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_FAB_IN_POST_FEED, false); showBottomAppBar = mSharedPreferences.getBoolean(SharedPreferencesUtils.BOTTOM_APP_BAR_KEY, false); @@ -252,7 +216,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele mSliderPanel = Slidr.attach(this); } - mViewPager2 = viewPager2; + mViewPager2 = binding.viewPagerViewUserDetailActivity; username = getIntent().getStringExtra(EXTRA_USER_NAME_KEY); @@ -280,11 +244,11 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele Resources resources = getResources(); String title = "u/" + username; - userNameTextView.setText(title); - toolbar.setTitle(title); + binding.userNameTextViewViewUserDetailActivity.setText(title); + binding.toolbarViewUserDetailActivity.setTitle(title); - setSupportActionBar(toolbar); - setToolbarGoToTop(toolbar); + setSupportActionBar(binding.toolbarViewUserDetailActivity); + setToolbarGoToTop(binding.toolbarViewUserDetailActivity); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { Window window = getWindow(); @@ -295,7 +259,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele } else { window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); } - adjustToolbar(toolbar); + adjustToolbar(binding.toolbarViewUserDetailActivity); int navBarHeight = getNavBarHeight(); if (navBarHeight > 0) { @@ -310,50 +274,50 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele View decorView = window.getDecorView(); if (isChangeStatusBarIconColor()) { - appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() { + binding.appbarLayoutViewUserDetail.addOnOffsetChangedListener(new AppBarStateChangeListener() { @Override public void onStateChanged(AppBarLayout appBarLayout, State state) { if (state == State.COLLAPSED) { decorView.setSystemUiVisibility(getSystemVisibilityToolbarCollapsed()); - tabLayout.setTabTextColors(collapsedTabTextColor, collapsedTabTextColor); - tabLayout.setSelectedTabIndicatorColor(collapsedTabIndicatorColor); - tabLayout.setBackgroundColor(collapsedTabBackgroundColor); + binding.tabLayoutViewUserDetailActivity.setTabTextColors(collapsedTabTextColor, collapsedTabTextColor); + binding.tabLayoutViewUserDetailActivity.setSelectedTabIndicatorColor(collapsedTabIndicatorColor); + binding.tabLayoutViewUserDetailActivity.setBackgroundColor(collapsedTabBackgroundColor); } else if (state == State.EXPANDED) { decorView.setSystemUiVisibility(getSystemVisibilityToolbarExpanded()); - tabLayout.setTabTextColors(expandedTabTextColor, expandedTabTextColor); - tabLayout.setSelectedTabIndicatorColor(expandedTabIndicatorColor); - tabLayout.setBackgroundColor(expandedTabBackgroundColor); + binding.tabLayoutViewUserDetailActivity.setTabTextColors(expandedTabTextColor, expandedTabTextColor); + binding.tabLayoutViewUserDetailActivity.setSelectedTabIndicatorColor(expandedTabIndicatorColor); + binding.tabLayoutViewUserDetailActivity.setBackgroundColor(expandedTabBackgroundColor); } } }); } else { - appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() { + binding.appbarLayoutViewUserDetail.addOnOffsetChangedListener(new AppBarStateChangeListener() { @Override public void onStateChanged(AppBarLayout appBarLayout, State state) { if (state == State.COLLAPSED) { - tabLayout.setTabTextColors(collapsedTabTextColor, collapsedTabTextColor); - tabLayout.setSelectedTabIndicatorColor(collapsedTabIndicatorColor); - tabLayout.setBackgroundColor(collapsedTabBackgroundColor); + binding.tabLayoutViewUserDetailActivity.setTabTextColors(collapsedTabTextColor, collapsedTabTextColor); + binding.tabLayoutViewUserDetailActivity.setSelectedTabIndicatorColor(collapsedTabIndicatorColor); + binding.tabLayoutViewUserDetailActivity.setBackgroundColor(collapsedTabBackgroundColor); } else if (state == State.EXPANDED) { - tabLayout.setTabTextColors(expandedTabTextColor, expandedTabTextColor); - tabLayout.setSelectedTabIndicatorColor(expandedTabIndicatorColor); - tabLayout.setBackgroundColor(expandedTabBackgroundColor); + binding.tabLayoutViewUserDetailActivity.setTabTextColors(expandedTabTextColor, expandedTabTextColor); + binding.tabLayoutViewUserDetailActivity.setSelectedTabIndicatorColor(expandedTabIndicatorColor); + binding.tabLayoutViewUserDetailActivity.setBackgroundColor(expandedTabBackgroundColor); } } }); } } else { - appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() { + binding.appbarLayoutViewUserDetail.addOnOffsetChangedListener(new AppBarStateChangeListener() { @Override public void onStateChanged(AppBarLayout appBarLayout, State state) { if (state == State.EXPANDED) { - tabLayout.setTabTextColors(expandedTabTextColor, expandedTabTextColor); - tabLayout.setSelectedTabIndicatorColor(expandedTabIndicatorColor); - tabLayout.setBackgroundColor(expandedTabBackgroundColor); + binding.tabLayoutViewUserDetailActivity.setTabTextColors(expandedTabTextColor, expandedTabTextColor); + binding.tabLayoutViewUserDetailActivity.setSelectedTabIndicatorColor(expandedTabIndicatorColor); + binding.tabLayoutViewUserDetailActivity.setBackgroundColor(expandedTabBackgroundColor); } else if (state == State.COLLAPSED) { - tabLayout.setTabTextColors(collapsedTabTextColor, collapsedTabTextColor); - tabLayout.setSelectedTabIndicatorColor(collapsedTabIndicatorColor); - tabLayout.setBackgroundColor(collapsedTabBackgroundColor); + binding.tabLayoutViewUserDetailActivity.setTabTextColors(collapsedTabTextColor, collapsedTabTextColor); + binding.tabLayoutViewUserDetailActivity.setSelectedTabIndicatorColor(collapsedTabIndicatorColor); + binding.tabLayoutViewUserDetailActivity.setBackgroundColor(collapsedTabBackgroundColor); } } }); @@ -385,8 +349,8 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele }; Markwon markwon = MarkdownUtils.createDescriptionMarkwon(this, miscPlugin, onLinkLongClickListener); - descriptionTextView.setOnLongClickListener(view -> { - if (description != null && !description.equals("") && descriptionTextView.getSelectionStart() == -1 && descriptionTextView.getSelectionEnd() == -1) { + binding.descriptionTextViewViewUserDetailActivity.setOnLongClickListener(view -> { + if (description != null && !description.equals("") && binding.descriptionTextViewViewUserDetailActivity.getSelectionStart() == -1 && binding.descriptionTextViewViewUserDetailActivity.getSelectionEnd() == -1) { CopyTextBottomSheetFragment.show(getSupportFragmentManager(), description, null); return true; } @@ -398,10 +362,10 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele userViewModel.getUserLiveData().observe(this, userData -> { if (userData != null) { if (userData.getBanner().equals("")) { - bannerImageView.setOnClickListener(null); + binding.bannerImageViewViewUserDetailActivity.setOnClickListener(null); } else { - glide.load(userData.getBanner()).into(bannerImageView); - bannerImageView.setOnClickListener(view -> { + glide.load(userData.getBanner()).into(binding.bannerImageViewViewUserDetailActivity); + binding.bannerImageViewViewUserDetailActivity.setOnClickListener(view -> { Intent intent = new Intent(this, ViewImageOrGifActivity.class); intent.putExtra(ViewImageOrGifActivity.EXTRA_IMAGE_URL_KEY, userData.getBanner()); intent.putExtra(ViewImageOrGifActivity.EXTRA_FILE_NAME_KEY, username + "-banner.jpg"); @@ -413,16 +377,16 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele if (userData.getIconUrl().equals("")) { glide.load(getDrawable(R.drawable.subreddit_default_icon)) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(216, 0))) - .into(iconGifImageView); - iconGifImageView.setOnClickListener(null); + .into(binding.iconGifImageViewViewUserDetailActivity); + binding.iconGifImageViewViewUserDetailActivity.setOnClickListener(null); } else { glide.load(userData.getIconUrl()) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(216, 0))) .error(glide.load(R.drawable.subreddit_default_icon) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(216, 0)))) - .into(iconGifImageView); + .into(binding.iconGifImageViewViewUserDetailActivity); - iconGifImageView.setOnClickListener(view -> { + binding.iconGifImageViewViewUserDetailActivity.setOnClickListener(view -> { Intent intent = new Intent(this, ViewImageOrGifActivity.class); intent.putExtra(ViewImageOrGifActivity.EXTRA_IMAGE_URL_KEY, userData.getIconUrl()); intent.putExtra(ViewImageOrGifActivity.EXTRA_FILE_NAME_KEY, username + "-icon.jpg"); @@ -432,18 +396,18 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele } if (userData.isCanBeFollowed()) { - subscribeUserChip.setVisibility(View.VISIBLE); - subscribeUserChip.setOnClickListener(view -> { + binding.subscribeUserChipViewUserDetailActivity.setVisibility(View.VISIBLE); + binding.subscribeUserChipViewUserDetailActivity.setOnClickListener(view -> { if (subscriptionReady) { subscriptionReady = false; - if (resources.getString(R.string.follow).contentEquals(subscribeUserChip.getText())) { + if (resources.getString(R.string.follow).contentEquals(binding.subscribeUserChipViewUserDetailActivity.getText())) { if (accountName.equals(Account.ANONYMOUS_ACCOUNT)) { UserFollowing.anonymousFollowUser(mExecutor, new Handler(), mRetrofit, username, mRedditDataRoomDatabase, new UserFollowing.UserFollowingListener() { @Override public void onUserFollowingSuccess() { - subscribeUserChip.setText(R.string.unfollow); - subscribeUserChip.setChipBackgroundColor(ColorStateList.valueOf(subscribedColor)); + binding.subscribeUserChipViewUserDetailActivity.setText(R.string.unfollow); + binding.subscribeUserChipViewUserDetailActivity.setChipBackgroundColor(ColorStateList.valueOf(subscribedColor)); showMessage(R.string.followed, false); subscriptionReady = true; } @@ -459,8 +423,8 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele username, accountName, mRedditDataRoomDatabase, new UserFollowing.UserFollowingListener() { @Override public void onUserFollowingSuccess() { - subscribeUserChip.setText(R.string.unfollow); - subscribeUserChip.setChipBackgroundColor(ColorStateList.valueOf(subscribedColor)); + binding.subscribeUserChipViewUserDetailActivity.setText(R.string.unfollow); + binding.subscribeUserChipViewUserDetailActivity.setChipBackgroundColor(ColorStateList.valueOf(subscribedColor)); showMessage(R.string.followed, false); subscriptionReady = true; } @@ -478,8 +442,8 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele mRedditDataRoomDatabase, new UserFollowing.UserFollowingListener() { @Override public void onUserFollowingSuccess() { - subscribeUserChip.setText(R.string.follow); - subscribeUserChip.setChipBackgroundColor(ColorStateList.valueOf(unsubscribedColor)); + binding.subscribeUserChipViewUserDetailActivity.setText(R.string.follow); + binding.subscribeUserChipViewUserDetailActivity.setChipBackgroundColor(ColorStateList.valueOf(unsubscribedColor)); showMessage(R.string.unfollowed, false); subscriptionReady = true; } @@ -494,8 +458,8 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele username, accountName, mRedditDataRoomDatabase, new UserFollowing.UserFollowingListener() { @Override public void onUserFollowingSuccess() { - subscribeUserChip.setText(R.string.follow); - subscribeUserChip.setChipBackgroundColor(ColorStateList.valueOf(unsubscribedColor)); + binding.subscribeUserChipViewUserDetailActivity.setText(R.string.follow); + binding.subscribeUserChipViewUserDetailActivity.setChipBackgroundColor(ColorStateList.valueOf(unsubscribedColor)); showMessage(R.string.unfollowed, false); subscriptionReady = true; } @@ -515,38 +479,38 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele username, accountName, new CheckIsFollowingUser.CheckIsFollowingUserListener() { @Override public void isSubscribed() { - subscribeUserChip.setText(R.string.unfollow); - subscribeUserChip.setChipBackgroundColor(ColorStateList.valueOf(subscribedColor)); + binding.subscribeUserChipViewUserDetailActivity.setText(R.string.unfollow); + binding.subscribeUserChipViewUserDetailActivity.setChipBackgroundColor(ColorStateList.valueOf(subscribedColor)); subscriptionReady = true; } @Override public void isNotSubscribed() { - subscribeUserChip.setText(R.string.follow); - subscribeUserChip.setChipBackgroundColor(ColorStateList.valueOf(unsubscribedColor)); + binding.subscribeUserChipViewUserDetailActivity.setText(R.string.follow); + binding.subscribeUserChipViewUserDetailActivity.setChipBackgroundColor(ColorStateList.valueOf(unsubscribedColor)); subscriptionReady = true; } }); } else { - subscribeUserChip.setVisibility(View.GONE); + binding.subscribeUserChipViewUserDetailActivity.setVisibility(View.GONE); } String userFullName = "u/" + userData.getName(); - userNameTextView.setText(userFullName); + binding.userNameTextViewViewUserDetailActivity.setText(userFullName); if (!title.equals(userFullName)) { getSupportActionBar().setTitle(userFullName); } String karma = getString(R.string.karma_info_user_detail, userData.getTotalKarma(), userData.getLinkKarma(), userData.getCommentKarma()); - karmaTextView.setText(karma); - cakedayTextView.setText(getString(R.string.cakeday_info, new SimpleDateFormat("MMM d, yyyy", + binding.karmaTextViewViewUserDetailActivity.setText(karma); + binding.cakedayTextViewViewUserDetailActivity.setText(getString(R.string.cakeday_info, new SimpleDateFormat("MMM d, yyyy", locale).format(userData.getCakeday()))); if (userData.getDescription() == null || userData.getDescription().equals("")) { - descriptionTextView.setVisibility(View.GONE); + binding.descriptionTextViewViewUserDetailActivity.setVisibility(View.GONE); } else { - descriptionTextView.setVisibility(View.VISIBLE); + binding.descriptionTextViewViewUserDetailActivity.setVisibility(View.VISIBLE); description = userData.getDescription(); - markwon.setMarkdown(descriptionTextView, description); + markwon.setMarkdown(binding.descriptionTextViewViewUserDetailActivity, description); } /*if (userData.isNSFW()) { @@ -566,7 +530,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele } }); - karmaTextView.setOnClickListener(view -> { + binding.karmaTextViewViewUserDetailActivity.setOnClickListener(view -> { UserData userData = userViewModel.getUserLiveData().getValue(); if (userData != null) { KarmaInfoBottomSheetFragment karmaInfoBottomSheetFragment = KarmaInfoBottomSheetFragment.newInstance( @@ -603,38 +567,39 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele @Override protected void applyCustomTheme() { - coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); - appBarLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { + binding.getRoot().setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + binding.appbarLayoutViewUserDetail.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { - appBarLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this); - collapsingToolbarLayout.setScrimVisibleHeightTrigger(toolbar.getHeight() + tabLayout.getHeight() + getStatusBarHeight() * 2); + binding.appbarLayoutViewUserDetail.getViewTreeObserver().removeOnGlobalLayoutListener(this); + binding.collapsingToolbarLayoutViewUserDetailActivity.setScrimVisibleHeightTrigger(binding.toolbarViewUserDetailActivity.getHeight() + binding.tabLayoutViewUserDetailActivity.getHeight() + getStatusBarHeight() * 2); } }); - applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar, false); + applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(binding.appbarLayoutViewUserDetail, + binding.collapsingToolbarLayoutViewUserDetailActivity, binding.toolbarViewUserDetailActivity, false); expandedTabTextColor = mCustomThemeWrapper.getTabLayoutWithExpandedCollapsingToolbarTextColor(); expandedTabIndicatorColor = mCustomThemeWrapper.getTabLayoutWithExpandedCollapsingToolbarTabIndicator(); expandedTabBackgroundColor = mCustomThemeWrapper.getTabLayoutWithExpandedCollapsingToolbarTabBackground(); collapsedTabTextColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTextColor(); collapsedTabIndicatorColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTabIndicator(); collapsedTabBackgroundColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTabBackground(); - linearLayout.setBackgroundColor(expandedTabBackgroundColor); + binding.toolbarLinearLayoutViewUserDetailActivity.setBackgroundColor(expandedTabBackgroundColor); unsubscribedColor = mCustomThemeWrapper.getUnsubscribed(); subscribedColor = mCustomThemeWrapper.getSubscribed(); - userNameTextView.setTextColor(mCustomThemeWrapper.getUsername()); - karmaTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor()); - cakedayTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor()); + binding.userNameTextViewViewUserDetailActivity.setTextColor(mCustomThemeWrapper.getUsername()); + binding.karmaTextViewViewUserDetailActivity.setTextColor(mCustomThemeWrapper.getPrimaryTextColor()); + binding.cakedayTextViewViewUserDetailActivity.setTextColor(mCustomThemeWrapper.getPrimaryTextColor()); navigationWrapper.applyCustomTheme(mCustomThemeWrapper.getBottomAppBarIconColor(), mCustomThemeWrapper.getBottomAppBarBackgroundColor()); applyFABTheme(navigationWrapper.floatingActionButton); - descriptionTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor()); - subscribeUserChip.setTextColor(mCustomThemeWrapper.getChipTextColor()); - applyTabLayoutTheme(tabLayout); + binding.descriptionTextViewViewUserDetailActivity.setTextColor(mCustomThemeWrapper.getPrimaryTextColor()); + binding.subscribeUserChipViewUserDetailActivity.setTextColor(mCustomThemeWrapper.getChipTextColor()); + applyTabLayoutTheme(binding.tabLayoutViewUserDetailActivity); if (typeface != null) { - userNameTextView.setTypeface(typeface); - karmaTextView.setTypeface(typeface); - cakedayTextView.setTypeface(typeface); - subscribeUserChip.setTypeface(typeface); - descriptionTextView.setTypeface(typeface); + binding.userNameTextViewViewUserDetailActivity.setTypeface(typeface); + binding.karmaTextViewViewUserDetailActivity.setTypeface(typeface); + binding.cakedayTextViewViewUserDetailActivity.setTypeface(typeface); + binding.subscribeUserChipViewUserDetailActivity.setTypeface(typeface); + binding.descriptionTextViewViewUserDetailActivity.setTypeface(typeface); } } @@ -664,10 +629,10 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele private void initializeViewPager() { sectionsPagerAdapter = new SectionsPagerAdapter(this); - viewPager2.setAdapter(sectionsPagerAdapter); - viewPager2.setOffscreenPageLimit(ViewPager2.OFFSCREEN_PAGE_LIMIT_DEFAULT); - viewPager2.setUserInputEnabled(!mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_SWIPING_BETWEEN_TABS, false)); - new TabLayoutMediator(tabLayout, viewPager2, (tab, position) -> { + binding.viewPagerViewUserDetailActivity.setAdapter(sectionsPagerAdapter); + binding.viewPagerViewUserDetailActivity.setOffscreenPageLimit(ViewPager2.OFFSCREEN_PAGE_LIMIT_DEFAULT); + binding.viewPagerViewUserDetailActivity.setUserInputEnabled(!mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_SWIPING_BETWEEN_TABS, false)); + new TabLayoutMediator(binding.tabLayoutViewUserDetailActivity, binding.viewPagerViewUserDetailActivity, (tab, position) -> { switch (position) { case 0: tab.setText(R.string.posts); @@ -678,7 +643,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele } }).attach(); - viewPager2.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { + binding.viewPagerViewUserDetailActivity.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { @Override public void onPageSelected(int position) { if (position == 0) { @@ -698,7 +663,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele } }); - fixViewPager2Sensitivity(viewPager2); + fixViewPager2Sensitivity(binding.viewPagerViewUserDetailActivity); if (mMessageFullname != null) { ReadMessage.readMessage(mOauthRetrofit, accessToken, mMessageFullname, new ReadMessage.ReadMessageListener() { @@ -1264,10 +1229,10 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele Toast.makeText(this, resId, Toast.LENGTH_SHORT).show(); } else { if (retry) { - Snackbar.make(coordinatorLayout, resId, Snackbar.LENGTH_SHORT).setAction(R.string.retry, + Snackbar.make(binding.getRoot(), resId, Snackbar.LENGTH_SHORT).setAction(R.string.retry, view -> fetchUserInfo()).show(); } else { - Snackbar.make(coordinatorLayout, resId, Snackbar.LENGTH_SHORT).show(); + Snackbar.make(binding.getRoot(), resId, Snackbar.LENGTH_SHORT).show(); } } } @@ -1348,7 +1313,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele } private void goToSubreddit() { - View rootView = getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, coordinatorLayout, false); + View rootView = getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, binding.getRoot(), false); TextInputEditText thingEditText = rootView.findViewById(R.id.text_input_edit_text_go_to_thing_edit_text); RecyclerView recyclerView = rootView.findViewById(R.id.recycler_view_go_to_thing_edit_text); thingEditText.requestFocus(); @@ -1436,7 +1401,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele } private void goToUser() { - View rootView = getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, coordinatorLayout, false); + View rootView = getLayoutInflater().inflate(R.layout.dialog_go_to_thing_edit_text, binding.getRoot(), false); TextInputEditText thingEditText = rootView.findViewById(R.id.text_input_edit_text_go_to_thing_edit_text); thingEditText.requestFocus(); Utils.showKeyboard(this, new Handler(), thingEditText); @@ -1631,14 +1596,14 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele @Nullable private Fragment getCurrentFragment() { - if (viewPager2 == null || fragmentManager == null) { + if (fragmentManager == null) { return null; } - return fragmentManager.findFragmentByTag("f" + viewPager2.getCurrentItem()); + return fragmentManager.findFragmentByTag("f" + binding.viewPagerViewUserDetailActivity.getCurrentItem()); } public boolean handleKeyDown(int keyCode) { - if (viewPager2.getCurrentItem() == 0) { + if (binding.viewPagerViewUserDetailActivity.getCurrentItem() == 0) { Fragment fragment = getCurrentFragment(); if (fragment instanceof PostFragment) { return ((PostFragment) fragment).handleKeyDown(keyCode); @@ -1660,14 +1625,14 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele Fragment fragment = getCurrentFragment(); if (fragment instanceof PostFragment) { ((PostFragment) fragment).changeSortType(sortType); - Utils.displaySortTypeInToolbar(sortType, toolbar); + Utils.displaySortTypeInToolbar(sortType, binding.toolbarViewUserDetailActivity); } else if (fragment instanceof CommentsListingFragment) { mSortTypeSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TYPE_USER_COMMENT, sortType.getType().name()).apply(); if(sortType.getTime() != null) { mSortTypeSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TIME_USER_COMMENT, sortType.getTime().name()).apply(); } ((CommentsListingFragment) fragment).changeSortType(sortType); - Utils.displaySortTypeInToolbar(sortType, toolbar); + Utils.displaySortTypeInToolbar(sortType, binding.toolbarViewUserDetailActivity); } } @@ -1696,13 +1661,13 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele void displaySortTypeInToolbar() { if (fragmentManager != null) { - Fragment fragment = fragmentManager.findFragmentByTag("f" + viewPager2.getCurrentItem()); + Fragment fragment = fragmentManager.findFragmentByTag("f" + binding.viewPagerViewUserDetailActivity.getCurrentItem()); if (fragment instanceof PostFragment) { SortType sortType = ((PostFragment) fragment).getSortType(); - Utils.displaySortTypeInToolbar(sortType, toolbar); + Utils.displaySortTypeInToolbar(sortType, binding.toolbarViewUserDetailActivity); } else if (fragment instanceof CommentsListingFragment) { SortType sortType = ((CommentsListingFragment) fragment).getSortType(); - Utils.displaySortTypeInToolbar(sortType, toolbar); + Utils.displaySortTypeInToolbar(sortType, binding.toolbarViewUserDetailActivity); } } } 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 27d9e6cf..d20f57f8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java @@ -29,8 +29,6 @@ import android.view.OrientationEventListener; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; -import android.widget.ProgressBar; -import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; @@ -38,7 +36,6 @@ import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; -import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; import androidx.core.graphics.Insets; @@ -67,8 +64,6 @@ import com.google.android.exoplayer2.upstream.cache.CacheDataSource; import com.google.android.exoplayer2.upstream.cache.SimpleCache; import com.google.android.exoplayer2.util.MimeTypes; import com.google.android.exoplayer2.video.VideoSize; -import com.google.android.material.bottomappbar.BottomAppBar; -import com.google.android.material.button.MaterialButton; import com.google.common.collect.ImmutableList; import com.otaliastudios.zoom.ZoomEngine; import com.otaliastudios.zoom.ZoomSurfaceView; @@ -83,10 +78,6 @@ import javax.inject.Named; import javax.inject.Provider; import app.futured.hauler.DragDirection; -import app.futured.hauler.HaulerView; -import app.futured.hauler.LockableNestedScrollView; -import butterknife.BindView; -import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.CustomFontReceiver; import ml.docilealligator.infinityforreddit.FetchRedgifsVideoLinks; import ml.docilealligator.infinityforreddit.FetchStreamableVideo; @@ -98,6 +89,8 @@ import ml.docilealligator.infinityforreddit.apis.StreamableAPI; import ml.docilealligator.infinityforreddit.apis.VReddIt; import ml.docilealligator.infinityforreddit.bottomsheetfragments.PlaybackSpeedBottomSheetFragment; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; +import ml.docilealligator.infinityforreddit.databinding.ActivityViewVideoBinding; +import ml.docilealligator.infinityforreddit.databinding.ActivityViewVideoZoomableBinding; import ml.docilealligator.infinityforreddit.font.ContentFontFamily; import ml.docilealligator.infinityforreddit.font.ContentFontStyle; import ml.docilealligator.infinityforreddit.font.FontFamily; @@ -152,29 +145,6 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe private static final String ID_STATE= "IS"; private static final String PLAYBACK_SPEED_STATE = "PSS"; - @BindView(R.id.hauler_view_view_video_activity) - HaulerView haulerView; - @BindView(R.id.coordinator_layout_view_video_activity) - CoordinatorLayout coordinatorLayout; - @BindView(R.id.progress_bar_view_video_activity) - ProgressBar progressBar; - @BindView(R.id.mute_exo_playback_control_view) - MaterialButton muteButton; - @BindView(R.id.hd_exo_playback_control_view) - MaterialButton hdButton; - @BindView(R.id.bottom_navigation_exo_playback_control_view) - BottomAppBar bottomAppBar; - @BindView(R.id.title_text_view_exo_playback_control_view) - TextView titleTextView; - @BindView(R.id.back_button_exo_playback_control_view) - MaterialButton backButton; - @BindView(R.id.download_image_view_exo_playback_control_view) - MaterialButton downloadButton; - @BindView(R.id.playback_speed_image_view_exo_playback_control_view) - MaterialButton playbackSpeedButton; - @BindView(R.id.lockable_nested_scroll_view_view_video_activity) - LockableNestedScrollView nestedScrollView; - public Typeface typeface; private Uri mVideoUri; @@ -198,6 +168,7 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe private Integer originalOrientation; private int playbackSpeed = 100; private boolean useBottomAppBar; + private ViewVideoActivityBindingAdapter binding; @Inject @Named("no_oauth") @@ -289,18 +260,19 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe boolean zoomable = mSharedPreferences.getBoolean(SharedPreferencesUtils.PINCH_TO_ZOOM_VIDEO, false); if (zoomable) { + binding = new ViewVideoActivityBindingAdapter(ActivityViewVideoZoomableBinding.inflate(getLayoutInflater())); setContentView(R.layout.activity_view_video_zoomable); } else { + binding = new ViewVideoActivityBindingAdapter(ActivityViewVideoBinding.inflate(getLayoutInflater())); setContentView(R.layout.activity_view_video); } - ButterKnife.bind(this); setVolumeControlStream(AudioManager.STREAM_MUSIC); setTitle(" "); if (typeface != null) { - titleTextView.setTypeface(typeface); + binding.getTitleTextView().setTypeface(typeface); } Resources resources = getResources(); @@ -313,12 +285,12 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe useBottomAppBar = mSharedPreferences.getBoolean(SharedPreferencesUtils.USE_BOTTOM_TOOLBAR_IN_MEDIA_VIEWER, false); if (useBottomAppBar) { getSupportActionBar().hide(); - bottomAppBar.setVisibility(View.VISIBLE); - backButton.setOnClickListener(view -> { + binding.getBottomAppBar().setVisibility(View.VISIBLE); + binding.getBackButton().setOnClickListener(view -> { finish(); }); - downloadButton.setOnClickListener(view -> { + binding.getDownloadButton().setOnClickListener(view -> { if (isDownloading) { return; } @@ -332,7 +304,7 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe requestPermissionAndDownload(); }); - playbackSpeedButton.setOnClickListener(view -> { + binding.getPlaybackSpeedButton().setOnClickListener(view -> { changePlaybackSpeed(); }); } else { @@ -366,7 +338,7 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe }); } - haulerView.setOnDragDismissedListener(dragDirection -> { + binding.getRoot().setOnDragDismissedListener(dragDirection -> { int slide = dragDirection == DragDirection.UP ? R.anim.slide_out_up : R.anim.slide_out_down; finish(); overridePendingTransition(0, slide); @@ -410,7 +382,7 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe Post post = intent.getParcelableExtra(EXTRA_POST); if (post != null) { - titleTextView.setText(post.getTitle()); + binding.getTitleTextView().setText(post.getTitle()); videoFallbackDirectUrl = post.getVideoFallBackDirectUrl(); } @@ -466,11 +438,11 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe @Override public void onUpdate(@NonNull ZoomEngine zoomEngine, @NonNull Matrix matrix) { if (zoomEngine.getZoom() < 1.00001) { - haulerView.setDragEnabled(true); - nestedScrollView.setScrollEnabled(true); + binding.getRoot().setDragEnabled(true); + binding.getNestedScrollView().setScrollEnabled(true); } else { - haulerView.setDragEnabled(false); - nestedScrollView.setScrollEnabled(false); + binding.getRoot().setDragEnabled(false); + binding.getNestedScrollView().setScrollEnabled(false); } } @@ -515,8 +487,8 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe ImmutableList<Tracks.Group> trackGroups = tracks.getGroups(); if (!trackGroups.isEmpty()) { if (videoType == VIDEO_TYPE_NORMAL) { - hdButton.setVisibility(View.VISIBLE); - hdButton.setOnClickListener(view -> { + binding.getHdButton().setVisibility(View.VISIBLE); + binding.getHdButton().setOnClickListener(view -> { TrackSelectionDialogBuilder builder = new TrackSelectionDialogBuilder(ViewVideoActivity.this, getString(R.string.select_video_quality), player, C.TRACK_TYPE_VIDEO); builder.setShowDisableOption(true); builder.setAllowAdaptiveSelections(false); @@ -544,24 +516,24 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe ) ); } - if (muteButton.getVisibility() != View.VISIBLE) { - muteButton.setVisibility(View.VISIBLE); - muteButton.setOnClickListener(view -> { + if (binding.getMuteButton().getVisibility() != View.VISIBLE) { + binding.getMuteButton().setVisibility(View.VISIBLE); + binding.getMuteButton().setOnClickListener(view -> { if (isMute) { isMute = false; player.setVolume(1f); - muteButton.setIconResource(R.drawable.ic_unmute_24dp); + binding.getMuteButton().setIconResource(R.drawable.ic_unmute_24dp); } else { isMute = true; player.setVolume(0f); - muteButton.setIconResource(R.drawable.ic_mute_24dp); + binding.getMuteButton().setIconResource(R.drawable.ic_mute_24dp); } }); } } } } else { - muteButton.setVisibility(View.GONE); + binding.getMuteButton().setVisibility(View.GONE); } } @@ -669,17 +641,17 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe isMute = savedInstanceState.getBoolean(IS_MUTE_STATE); if (isMute) { player.setVolume(0f); - muteButton.setIconResource(R.drawable.ic_mute_24dp); + binding.getMuteButton().setIconResource(R.drawable.ic_mute_24dp); } else { player.setVolume(1f); - muteButton.setIconResource(R.drawable.ic_unmute_24dp); + binding.getMuteButton().setIconResource(R.drawable.ic_unmute_24dp); } } else if (muteVideo) { isMute = true; player.setVolume(0f); - muteButton.setIconResource(R.drawable.ic_mute_24dp); + binding.getMuteButton().setIconResource(R.drawable.ic_mute_24dp); } else { - muteButton.setIconResource(R.drawable.ic_unmute_24dp); + binding.getMuteButton().setIconResource(R.drawable.ic_unmute_24dp); } } @@ -712,12 +684,12 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe } private void loadRedgifsVideo(String redgifsId, Bundle savedInstanceState) { - progressBar.setVisibility(View.VISIBLE); + binding.getProgressBar().setVisibility(View.VISIBLE); FetchRedgifsVideoLinks.fetchRedgifsVideoLinks(mExecutor, new Handler(), mRedgifsRetrofit, mCurrentAccountSharedPreferences, redgifsId, new FetchRedgifsVideoLinks.FetchRedgifsVideoLinksListener() { @Override public void success(String webm, String mp4) { - progressBar.setVisibility(View.GONE); + binding.getProgressBar().setVisibility(View.GONE); mVideoUri = Uri.parse(webm); videoDownloadUrl = mp4; preparePlayer(savedInstanceState); @@ -727,7 +699,7 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe @Override public void failed(int errorCode) { - progressBar.setVisibility(View.GONE); + binding.getProgressBar().setVisibility(View.GONE); loadFallbackVideo(savedInstanceState); //Toast.makeText(ViewVideoActivity.this, R.string.fetch_redgifs_video_failed, Toast.LENGTH_SHORT).show(); } @@ -735,7 +707,7 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe } private void loadVReddItVideo(Bundle savedInstanceState) { - progressBar.setVisibility(View.VISIBLE); + binding.getProgressBar().setVisibility(View.VISIBLE); mVReddItRetrofit.create(VReddIt.class).getRedirectUrl(getIntent().getStringExtra(EXTRA_V_REDD_IT_URL)).enqueue(new Callback<>() { @Override public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) { @@ -773,7 +745,7 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe player.setMediaSource(new ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(MediaItem.fromUri(mVideoUri))); preparePlayer(savedInstanceState); } else { - progressBar.setVisibility(View.GONE); + binding.getProgressBar().setVisibility(View.GONE); if (post.getVideoUrl() != null) { mVideoUri = Uri.parse(post.getVideoUrl()); subredditName = post.getSubredditName(); @@ -809,7 +781,7 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe } private void loadStreamableVideo(String shortCode, Bundle savedInstanceState) { - progressBar.setVisibility(View.VISIBLE); + binding.getProgressBar().setVisibility(View.VISIBLE); FetchStreamableVideo.fetchStreamableVideo(mExecutor, new Handler(), mStreamableApiProvider, shortCode, new FetchStreamableVideo.FetchStreamableVideoListener() { @Override @@ -818,8 +790,8 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe Toast.makeText(ViewVideoActivity.this, R.string.fetch_streamable_video_failed, Toast.LENGTH_SHORT).show(); return; } - titleTextView.setText(streamableVideo.title); - progressBar.setVisibility(View.GONE); + binding.getTitleTextView().setText(streamableVideo.title); + binding.getProgressBar().setVisibility(View.GONE); videoDownloadUrl = streamableVideo.mp4 == null ? streamableVideo.mp4Mobile.url : streamableVideo.mp4.url; mVideoUri = Uri.parse(videoDownloadUrl); preparePlayer(savedInstanceState); @@ -829,7 +801,7 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe @Override public void failed() { - progressBar.setVisibility(View.GONE); + binding.getProgressBar().setVisibility(View.GONE); loadFallbackVideo(savedInstanceState); //Toast.makeText(ViewVideoActivity.this, R.string.fetch_streamable_video_failed, Toast.LENGTH_SHORT).show(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivityBindingAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivityBindingAdapter.java new file mode 100644 index 00000000..f37fcb7b --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivityBindingAdapter.java @@ -0,0 +1,97 @@ +package ml.docilealligator.infinityforreddit.activities; + +import android.widget.ProgressBar; +import android.widget.TextView; + +import androidx.annotation.Nullable; +import androidx.coordinatorlayout.widget.CoordinatorLayout; + +import com.google.android.material.bottomappbar.BottomAppBar; +import com.google.android.material.button.MaterialButton; + +import app.futured.hauler.HaulerView; +import app.futured.hauler.LockableNestedScrollView; +import ml.docilealligator.infinityforreddit.R; +import ml.docilealligator.infinityforreddit.databinding.ActivityViewVideoBinding; +import ml.docilealligator.infinityforreddit.databinding.ActivityViewVideoZoomableBinding; + +public class ViewVideoActivityBindingAdapter { + @Nullable + private ActivityViewVideoBinding binding; + @Nullable + private ActivityViewVideoZoomableBinding zoomableBinding; + + private MaterialButton muteButton; + private MaterialButton hdButton; + private BottomAppBar bottomAppBar; + private TextView titleTextView; + private MaterialButton backButton; + private MaterialButton downloadButton; + private MaterialButton playbackSpeedButton; + + public ViewVideoActivityBindingAdapter(ActivityViewVideoBinding binding) { + this.binding = binding; + muteButton = binding.getRoot().findViewById(R.id.mute_exo_playback_control_view); + hdButton = binding.getRoot().findViewById(R.id.hd_exo_playback_control_view); + bottomAppBar = binding.getRoot().findViewById(R.id.bottom_navigation_exo_playback_control_view); + titleTextView = binding.getRoot().findViewById(R.id.title_text_view_exo_playback_control_view); + backButton = binding.getRoot().findViewById(R.id.back_button_exo_playback_control_view); + downloadButton = binding.getRoot().findViewById(R.id.download_image_view_exo_playback_control_view); + playbackSpeedButton = binding.getRoot().findViewById(R.id.playback_speed_image_view_exo_playback_control_view); + } + + public ViewVideoActivityBindingAdapter(ActivityViewVideoZoomableBinding binding) { + zoomableBinding = binding; + muteButton = binding.getRoot().findViewById(R.id.mute_exo_playback_control_view); + hdButton = binding.getRoot().findViewById(R.id.hd_exo_playback_control_view); + bottomAppBar = binding.getRoot().findViewById(R.id.bottom_navigation_exo_playback_control_view); + titleTextView = binding.getRoot().findViewById(R.id.title_text_view_exo_playback_control_view); + backButton = binding.getRoot().findViewById(R.id.back_button_exo_playback_control_view); + downloadButton = binding.getRoot().findViewById(R.id.download_image_view_exo_playback_control_view); + playbackSpeedButton = binding.getRoot().findViewById(R.id.playback_speed_image_view_exo_playback_control_view); + } + + public HaulerView getRoot() { + return binding == null ? zoomableBinding.getRoot() : binding.getRoot(); + } + + public CoordinatorLayout getCoordinatorLayout() { + return binding == null ? zoomableBinding.coordinatorLayoutViewVideoActivity : binding.coordinatorLayoutViewVideoActivity; + } + + public ProgressBar getProgressBar() { + return binding == null ? zoomableBinding.progressBarViewVideoActivity : binding.progressBarViewVideoActivity; + } + + public MaterialButton getMuteButton() { + return binding.getRoot().findViewById(R.id.mute_exo_playback_control_view); + } + + public MaterialButton getHdButton() { + return hdButton; + } + + public BottomAppBar getBottomAppBar() { + return bottomAppBar; + } + + public TextView getTitleTextView() { + return titleTextView; + } + + public MaterialButton getBackButton() { + return backButton; + } + + public MaterialButton getDownloadButton() { + return downloadButton; + } + + public MaterialButton getPlaybackSpeedButton() { + return playbackSpeedButton; + } + + public LockableNestedScrollView getNestedScrollView() { + return binding == null ? zoomableBinding.lockableNestedScrollViewViewVideoActivity : binding.lockableNestedScrollViewViewVideoActivity; + } +} diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WebViewActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WebViewActivity.java index a7dd857f..106586f8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WebViewActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WebViewActivity.java @@ -21,33 +21,19 @@ import android.webkit.WebViewClient; import android.widget.Toast; import androidx.annotation.NonNull; -import androidx.appcompat.widget.Toolbar; -import androidx.coordinatorlayout.widget.CoordinatorLayout; - -import com.google.android.material.appbar.AppBarLayout; import javax.inject.Inject; import javax.inject.Named; -import butterknife.BindView; -import butterknife.ButterKnife; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; -import ml.docilealligator.infinityforreddit.customviews.LollipopBugFixedWebView; +import ml.docilealligator.infinityforreddit.databinding.ActivityWebViewBinding; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; import ml.docilealligator.infinityforreddit.utils.Utils; public class WebViewActivity extends BaseActivity { - @BindView(R.id.coordinator_layout_web_view_activity) - CoordinatorLayout coordinatorLayout; - @BindView(R.id.appbar_layout_web_view_activity) - AppBarLayout appBarLayout; - @BindView(R.id.toolbar_web_view_activity) - Toolbar toolbar; - @BindView(R.id.web_view_web_view_activity) - LollipopBugFixedWebView webView; @Inject @Named("default") SharedPreferences mSharedPreferences; @@ -57,6 +43,7 @@ public class WebViewActivity extends BaseActivity { @Inject CustomThemeWrapper mCustomThemeWrapper; private String url; + private ActivityWebViewBinding binding; @Override protected void onCreate(Bundle savedInstanceState) { @@ -67,7 +54,8 @@ public class WebViewActivity extends BaseActivity { super.onCreate(savedInstanceState); try { - setContentView(R.layout.activity_web_view); + binding = ActivityWebViewBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); } catch (InflateException ie) { Log.e("LoginActivity", "Failed to inflate LoginActivity: " + ie.getMessage()); Toast.makeText(WebViewActivity.this, R.string.no_system_webview_error, Toast.LENGTH_SHORT).show(); @@ -75,38 +63,36 @@ public class WebViewActivity extends BaseActivity { return; } - ButterKnife.bind(this); - applyCustomTheme(); - setSupportActionBar(toolbar); + setSupportActionBar(binding.toolbarWebViewActivity); if (mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null) == null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - webView.setAnonymous(true); + binding.webViewWebViewActivity.setAnonymous(true); } - webView.getSettings().setJavaScriptEnabled(true); - webView.getSettings().setDomStorageEnabled(true); + binding.webViewWebViewActivity.getSettings().setJavaScriptEnabled(true); + binding.webViewWebViewActivity.getSettings().setDomStorageEnabled(true); url = getIntent().getDataString(); if (savedInstanceState == null) { - toolbar.setTitle(url); - webView.loadUrl(url); + binding.toolbarWebViewActivity.setTitle(url); + binding.webViewWebViewActivity.loadUrl(url); } WebViewClient client = new WebViewClient() { @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { WebViewActivity.this.url = url; - toolbar.setTitle(url); + binding.toolbarWebViewActivity.setTitle(url); } @Override public void onPageFinished(WebView view, String url) { - toolbar.setTitle(view.getTitle()); + binding.toolbarWebViewActivity.setTitle(view.getTitle()); } }; - webView.setWebViewClient(client); + binding.webViewWebViewActivity.setWebViewClient(client); } @Override @@ -126,10 +112,11 @@ public class WebViewActivity extends BaseActivity { @Override protected void applyCustomTheme() { - coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); - applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, null, toolbar); + binding.getRoot().setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(binding.appbarLayoutWebViewActivity, + null, binding.toolbarWebViewActivity); Drawable closeIcon = Utils.getTintedDrawable(this, R.drawable.ic_close_24dp, mCustomThemeWrapper.getToolbarPrimaryTextAndIconColor()); - toolbar.setNavigationIcon(closeIcon); + binding.toolbarWebViewActivity.setNavigationIcon(closeIcon); } @Override @@ -145,7 +132,7 @@ public class WebViewActivity extends BaseActivity { finish(); return true; } else if (item.getItemId() == R.id.action_refresh_web_view_activity) { - webView.reload(); + binding.webViewWebViewActivity.reload(); return true; } else if (item.getItemId() == R.id.action_share_link_web_view_activity) { try { @@ -185,8 +172,8 @@ public class WebViewActivity extends BaseActivity { public boolean onKeyDown(int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_DOWN) { if (keyCode == KeyEvent.KEYCODE_BACK) { - if (webView.canGoBack()) { - webView.goBack(); + if (binding.webViewWebViewActivity.canGoBack()) { + binding.webViewWebViewActivity.goBack(); } else { finish(); } @@ -200,12 +187,12 @@ public class WebViewActivity extends BaseActivity { @Override protected void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); - webView.saveState(outState); + binding.webViewWebViewActivity.saveState(outState); } @Override protected void onRestoreInstanceState(@NonNull Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); - webView.restoreState(savedInstanceState); + binding.webViewWebViewActivity.restoreState(savedInstanceState); } }
\ No newline at end of file diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java index ecc37d68..3b14e50a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java @@ -10,20 +10,12 @@ import android.view.MenuItem; import android.view.View; import android.view.Window; import android.view.WindowManager; -import android.widget.ImageView; -import android.widget.LinearLayout; import android.widget.TextView; import androidx.annotation.NonNull; -import androidx.appcompat.widget.Toolbar; -import androidx.coordinatorlayout.widget.CoordinatorLayout; -import androidx.recyclerview.widget.RecyclerView; -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import com.bumptech.glide.Glide; import com.bumptech.glide.RequestManager; -import com.google.android.material.appbar.AppBarLayout; -import com.google.android.material.appbar.CollapsingToolbarLayout; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -33,8 +25,6 @@ import org.json.JSONObject; import javax.inject.Inject; import javax.inject.Named; -import butterknife.BindView; -import butterknife.ButterKnife; import io.noties.markwon.AbstractMarkwonPlugin; import io.noties.markwon.Markwon; import io.noties.markwon.MarkwonConfiguration; @@ -50,11 +40,12 @@ import ml.docilealligator.infinityforreddit.customviews.LinearLayoutManagerBugFi import ml.docilealligator.infinityforreddit.customviews.SwipeLockInterface; import ml.docilealligator.infinityforreddit.customviews.SwipeLockLinearLayoutManager; import ml.docilealligator.infinityforreddit.customviews.slidr.Slidr; +import ml.docilealligator.infinityforreddit.databinding.ActivityWikiBinding; import ml.docilealligator.infinityforreddit.events.ChangeNetworkStatusEvent; import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent; -import ml.docilealligator.infinityforreddit.markdown.EvenBetterLinkMovementMethod; import ml.docilealligator.infinityforreddit.markdown.EmoteCloseBracketInlineProcessor; import ml.docilealligator.infinityforreddit.markdown.EmotePlugin; +import ml.docilealligator.infinityforreddit.markdown.EvenBetterLinkMovementMethod; import ml.docilealligator.infinityforreddit.markdown.ImageAndGifEntry; import ml.docilealligator.infinityforreddit.markdown.ImageAndGifPlugin; import ml.docilealligator.infinityforreddit.markdown.MarkdownUtils; @@ -72,25 +63,6 @@ public class WikiActivity extends BaseActivity { public static final String EXTRA_WIKI_PATH = "EWP"; private static final String WIKI_MARKDOWN_STATE = "WMS"; - @BindView(R.id.coordinator_layout_comment_wiki_activity) - CoordinatorLayout coordinatorLayout; - @BindView(R.id.appbar_layout_comment_wiki_activity) - AppBarLayout appBarLayout; - @BindView(R.id.collapsing_toolbar_layout_wiki_activity) - CollapsingToolbarLayout collapsingToolbarLayout; - @BindView(R.id.toolbar_comment_wiki_activity) - Toolbar toolbar; - @BindView(R.id.swipe_refresh_layout_wiki_activity) - SwipeRefreshLayout swipeRefreshLayout; - @BindView(R.id.content_markdown_view_comment_wiki_activity) - RecyclerView markdownRecyclerView; - @BindView(R.id.fetch_wiki_linear_layout_wiki_activity) - LinearLayout mFetchWikiInfoLinearLayout; - @BindView(R.id.fetch_wiki_image_view_wiki_activity) - ImageView mFetchWikiInfoImageView; - @BindView(R.id.fetch_wiki_text_view_wiki_activity) - TextView mFetchWikiInfoTextView; - @Inject @Named("no_oauth") Retrofit mRetrofit; @@ -112,21 +84,22 @@ public class WikiActivity extends BaseActivity { private MarkwonAdapter markwonAdapter; private boolean isRefreshing = false; private RequestManager mGlide; + private ActivityWikiBinding binding; @Override protected void onCreate(Bundle savedInstanceState) { ((Infinity) getApplication()).getAppComponent().inject(this); super.onCreate(savedInstanceState); - setContentView(R.layout.activity_wiki); - ButterKnife.bind(this); + binding = ActivityWikiBinding.inflate(getLayoutInflater()); + setContentView(binding.getRoot()); EventBus.getDefault().register(this); applyCustomTheme(); - setSupportActionBar(toolbar); + setSupportActionBar(binding.toolbarCommentWikiActivity); getSupportActionBar().setDisplayHomeAsUpEnabled(true); if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK, true)) { @@ -137,7 +110,7 @@ public class WikiActivity extends BaseActivity { Window window = getWindow(); if (isChangeStatusBarIconColor()) { - addOnOffsetChangedListener(appBarLayout); + addOnOffsetChangedListener(binding.appbarLayoutCommentWikiActivity); } if (isImmersiveInterface()) { @@ -146,8 +119,8 @@ public class WikiActivity extends BaseActivity { } else { window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); } - adjustToolbar(toolbar); - markdownRecyclerView.setPadding(markdownRecyclerView.getPaddingLeft(), 0, markdownRecyclerView.getPaddingRight(), getNavBarHeight()); + adjustToolbar(binding.toolbarCommentWikiActivity); + binding.contentMarkdownViewCommentWikiActivity.setPadding(binding.contentMarkdownViewCommentWikiActivity.getPaddingLeft(), 0, binding.contentMarkdownViewCommentWikiActivity.getPaddingRight(), getNavBarHeight()); } } @@ -155,8 +128,8 @@ public class WikiActivity extends BaseActivity { mSubredditName = getIntent().getStringExtra(EXTRA_SUBREDDIT_NAME); - swipeRefreshLayout.setEnabled(mSharedPreferences.getBoolean(SharedPreferencesUtils.PULL_TO_REFRESH, true)); - swipeRefreshLayout.setOnRefreshListener(this::loadWiki); + binding.swipeRefreshLayoutWikiActivity.setEnabled(mSharedPreferences.getBoolean(SharedPreferencesUtils.PULL_TO_REFRESH, true)); + binding.swipeRefreshLayoutWikiActivity.setOnRefreshListener(this::loadWiki); int markdownColor = mCustomThemeWrapper.getPrimaryTextColor(); int spoilerBackgroundColor = markdownColor | 0xFF000000; @@ -232,8 +205,8 @@ public class WikiActivity extends BaseActivity { } } }); - markdownRecyclerView.setLayoutManager(linearLayoutManager); - markdownRecyclerView.setAdapter(markwonAdapter); + binding.contentMarkdownViewCommentWikiActivity.setLayoutManager(linearLayoutManager); + binding.contentMarkdownViewCommentWikiActivity.setAdapter(markwonAdapter); if (savedInstanceState != null) { wikiMarkdown = savedInstanceState.getString(WIKI_MARKDOWN_STATE); @@ -254,10 +227,10 @@ public class WikiActivity extends BaseActivity { } isRefreshing = true; - swipeRefreshLayout.setRefreshing(true); + binding.swipeRefreshLayoutWikiActivity.setRefreshing(true); - Glide.with(this).clear(mFetchWikiInfoImageView); - mFetchWikiInfoLinearLayout.setVisibility(View.GONE); + Glide.with(this).clear(binding.fetchWikiImageViewWikiActivity); + binding.fetchWikiLinearLayoutWikiActivity.setVisibility(View.GONE); mRetrofit.create(RedditAPI.class).getWikiPage(mSubredditName, getIntent().getStringExtra(EXTRA_WIKI_PATH)).enqueue(new Callback<>() { @Override @@ -281,23 +254,23 @@ public class WikiActivity extends BaseActivity { } } isRefreshing = false; - swipeRefreshLayout.setRefreshing(false); + binding.swipeRefreshLayoutWikiActivity.setRefreshing(false); } @Override public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) { showErrorView(R.string.error_loading_wiki); isRefreshing = false; - swipeRefreshLayout.setRefreshing(false); + binding.swipeRefreshLayoutWikiActivity.setRefreshing(false); } }); } private void showErrorView(int stringResId) { - swipeRefreshLayout.setRefreshing(false); - mFetchWikiInfoLinearLayout.setVisibility(View.VISIBLE); - mFetchWikiInfoTextView.setText(stringResId); - mGlide.load(R.drawable.error_image).into(mFetchWikiInfoImageView); + binding.swipeRefreshLayoutWikiActivity.setRefreshing(false); + binding.fetchWikiLinearLayoutWikiActivity.setVisibility(View.VISIBLE); + binding.fetchWikiTextViewWikiActivity.setText(stringResId); + mGlide.load(R.drawable.error_image).into(binding.fetchWikiImageViewWikiActivity); } @Override @@ -339,13 +312,14 @@ public class WikiActivity extends BaseActivity { @Override protected void applyCustomTheme() { - coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); - applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar); - swipeRefreshLayout.setProgressBackgroundColorSchemeColor(mCustomThemeWrapper.getCircularProgressBarBackground()); - swipeRefreshLayout.setColorSchemeColors(mCustomThemeWrapper.getColorAccent()); - mFetchWikiInfoTextView.setTextColor(mCustomThemeWrapper.getSecondaryTextColor()); + binding.getRoot().setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(binding.appbarLayoutCommentWikiActivity, + binding.collapsingToolbarLayoutWikiActivity, binding.toolbarCommentWikiActivity); + binding.swipeRefreshLayoutWikiActivity.setProgressBackgroundColorSchemeColor(mCustomThemeWrapper.getCircularProgressBarBackground()); + binding.swipeRefreshLayoutWikiActivity.setColorSchemeColors(mCustomThemeWrapper.getColorAccent()); + binding.fetchWikiTextViewWikiActivity.setTextColor(mCustomThemeWrapper.getSecondaryTextColor()); if (typeface != null) { - mFetchWikiInfoTextView.setTypeface(typeface); + binding.fetchWikiTextViewWikiActivity.setTypeface(typeface); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/RedditSectionRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/RedditSectionRecyclerViewAdapter.java index 4555dcbd..f61e600d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/RedditSectionRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/RedditSectionRecyclerViewAdapter.java @@ -8,7 +8,6 @@ import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; -import androidx.core.content.ContextCompat; import androidx.recyclerview.widget.RecyclerView; import butterknife.BindView; @@ -80,24 +79,18 @@ public class RedditSectionRecyclerViewAdapter extends RecyclerView.Adapter<Recyc notifyItemChanged(holder.getBindingAdapterPosition()); }); } else if (holder instanceof MenuItemViewHolder) { - int stringId = 0; + /*int stringId = 0; int drawableId = 0; - if (position == 1) { - stringId = R.string.trending; - drawableId = R.drawable.ic_trending_24dp; - } - ((MenuItemViewHolder) holder).menuTextView.setText(stringId); ((MenuItemViewHolder) holder).imageView.setImageDrawable(ContextCompat.getDrawable(baseActivity, drawableId)); int finalStringId = stringId; - holder.itemView.setOnClickListener(view -> itemClickListener.onMenuClick(finalStringId)); + holder.itemView.setOnClickListener(view -> itemClickListener.onMenuClick(finalStringId));*/ } } @Override public int getItemCount() { - //return collapseRedditSection ? 1 : REDDIT_SECTION_ITEMS + 1; return 0; } diff --git a/app/src/main/res/drawable-night/ic_trending_24dp.xml b/app/src/main/res/drawable-night/ic_trending_24dp.xml deleted file mode 100644 index d441a7f7..00000000 --- a/app/src/main/res/drawable-night/ic_trending_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="@android:color/white" - android:pathData="M16,6l2.29,2.29 -4.88,4.88 -4,-4L2,16.59 3.41,18l6,-6 4,4 6.3,-6.29L22,12V6z"/> -</vector> diff --git a/app/src/main/res/drawable/ic_trending_24dp.xml b/app/src/main/res/drawable/ic_trending_24dp.xml deleted file mode 100644 index b237138b..00000000 --- a/app/src/main/res/drawable/ic_trending_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="@android:color/black" - android:pathData="M16,6l2.29,2.29 -4.88,4.88 -4,-4L2,16.59 3.41,18l6,-6 4,4 6.3,-6.29L22,12V6z"/> -</vector> diff --git a/app/src/main/res/layout-land/activity_view_multi_reddit_detail.xml b/app/src/main/res/layout-land/activity_view_multi_reddit_detail.xml index ef0aecbb..42a34b16 100644 --- a/app/src/main/res/layout-land/activity_view_multi_reddit_detail.xml +++ b/app/src/main/res/layout-land/activity_view_multi_reddit_detail.xml @@ -4,7 +4,6 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:id="@+id/coordinator_layout_view_multi_reddit_detail_activity" tools:context=".activities.ViewMultiRedditDetailActivity"> <com.google.android.material.appbar.AppBarLayout diff --git a/app/src/main/res/layout-land/activity_view_subreddit_detail.xml b/app/src/main/res/layout-land/activity_view_subreddit_detail.xml index 580f628c..1dee78ae 100644 --- a/app/src/main/res/layout-land/activity_view_subreddit_detail.xml +++ b/app/src/main/res/layout-land/activity_view_subreddit_detail.xml @@ -4,7 +4,6 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:id="@+id/coordinator_layout_view_subreddit_detail_activity" tools:application=".Activity.ViewSubredditDetailActivity"> <com.google.android.material.appbar.AppBarLayout diff --git a/app/src/main/res/layout-land/activity_view_user_detail.xml b/app/src/main/res/layout-land/activity_view_user_detail.xml index ab2e41b2..cc675f55 100644 --- a/app/src/main/res/layout-land/activity_view_user_detail.xml +++ b/app/src/main/res/layout-land/activity_view_user_detail.xml @@ -4,7 +4,6 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:id="@+id/coordinator_layout_view_user_detail_activity" tools:application="ml.docilealligator.infinityforreddit.activities.ViewUserDetailActivity"> <com.google.android.material.appbar.AppBarLayout diff --git a/app/src/main/res/layout-sw600dp/activity_view_multi_reddit_detail.xml b/app/src/main/res/layout-sw600dp/activity_view_multi_reddit_detail.xml index ef0aecbb..42a34b16 100644 --- a/app/src/main/res/layout-sw600dp/activity_view_multi_reddit_detail.xml +++ b/app/src/main/res/layout-sw600dp/activity_view_multi_reddit_detail.xml @@ -4,7 +4,6 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:id="@+id/coordinator_layout_view_multi_reddit_detail_activity" tools:context=".activities.ViewMultiRedditDetailActivity"> <com.google.android.material.appbar.AppBarLayout diff --git a/app/src/main/res/layout-sw600dp/activity_view_subreddit_detail.xml b/app/src/main/res/layout-sw600dp/activity_view_subreddit_detail.xml index 580f628c..1dee78ae 100644 --- a/app/src/main/res/layout-sw600dp/activity_view_subreddit_detail.xml +++ b/app/src/main/res/layout-sw600dp/activity_view_subreddit_detail.xml @@ -4,7 +4,6 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:id="@+id/coordinator_layout_view_subreddit_detail_activity" tools:application=".Activity.ViewSubredditDetailActivity"> <com.google.android.material.appbar.AppBarLayout diff --git a/app/src/main/res/layout-sw600dp/activity_view_user_detail.xml b/app/src/main/res/layout-sw600dp/activity_view_user_detail.xml index 0de2645a..cce4d78f 100644 --- a/app/src/main/res/layout-sw600dp/activity_view_user_detail.xml +++ b/app/src/main/res/layout-sw600dp/activity_view_user_detail.xml @@ -4,7 +4,6 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:id="@+id/coordinator_layout_view_user_detail_activity" tools:application="ml.docilealligator.infinityforreddit.activities.ViewUserDetailActivity"> <com.google.android.material.appbar.AppBarLayout diff --git a/app/src/main/res/layout/activity_trending.xml b/app/src/main/res/layout/activity_trending.xml deleted file mode 100644 index 9d96d864..00000000 --- a/app/src/main/res/layout/activity_trending.xml +++ /dev/null @@ -1,76 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:id="@+id/coordinator_layout_trending_activity" - tools:context=".activities.TrendingActivity"> - - <com.google.android.material.appbar.AppBarLayout - android:id="@+id/appbar_layout_trending_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_trending_activity" - android:layout_width="match_parent" - android:layout_height="match_parent" - app:layout_scrollFlags="scroll|enterAlways" - app:titleEnabled="false" - app:toolbarId="@+id/toolbar_trending_activity"> - - <androidx.appcompat.widget.Toolbar - android:id="@+id/toolbar_trending_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.swiperefreshlayout.widget.SwipeRefreshLayout - android:id="@+id/swipe_refresh_layout_trending_activity" - android:layout_width="match_parent" - android:layout_height="match_parent" - app:layout_behavior="@string/appbar_scrolling_view_behavior"> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/recycler_view_trending_activity" - android:layout_width="match_parent" - android:layout_height="match_parent" - app:layoutManager="ml.docilealligator.infinityforreddit.customviews.LinearLayoutManagerBugFixed" /> - - </androidx.swiperefreshlayout.widget.SwipeRefreshLayout> - - <LinearLayout - android:id="@+id/fetch_trending_search_linear_layout_trending_activity" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_marginTop="48dp" - android:layout_marginBottom="48dp" - android:gravity="center" - android:orientation="vertical" - android:visibility="gone"> - - <ImageView - android:id="@+id/fetch_trending_search_image_view_trending_activity" - android:layout_width="150dp" - android:layout_height="wrap_content" /> - - <TextView - android:id="@+id/fetch_trending_search_text_view_trending_activity" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginTop="16dp" - android:gravity="center" - android:textSize="?attr/font_default" - android:fontFamily="?attr/font_family" /> - - </LinearLayout> - -</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/activity_view_image_or_gif.xml b/app/src/main/res/layout/activity_view_image_or_gif.xml index fa0a5aa8..c7791c9f 100644 --- a/app/src/main/res/layout/activity_view_image_or_gif.xml +++ b/app/src/main/res/layout/activity_view_image_or_gif.xml @@ -2,7 +2,6 @@ <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:id="@+id/hauler_view_view_image_or_gif_activity" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/black" 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 b9eaf6a2..dbf08180 100644 --- a/app/src/main/res/layout/activity_view_imgur_media.xml +++ b/app/src/main/res/layout/activity_view_imgur_media.xml @@ -2,7 +2,6 @@ <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" android:layout_width="match_parent" android:layout_height="match_parent" app:dragUpEnabled="true" 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 21521bb0..57966184 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 @@ -4,7 +4,6 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:id="@+id/coordinator_layout_view_multi_reddit_detail_activity" tools:context=".activities.ViewMultiRedditDetailActivity"> <com.google.android.material.appbar.AppBarLayout diff --git a/app/src/main/res/layout/activity_view_post_detail.xml b/app/src/main/res/layout/activity_view_post_detail.xml index f2236a95..d16d83b3 100644 --- a/app/src/main/res/layout/activity_view_post_detail.xml +++ b/app/src/main/res/layout/activity_view_post_detail.xml @@ -2,7 +2,6 @@ <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:id="@+id/coordinator_layout_view_post_detail" android:layout_width="match_parent" android:layout_height="match_parent" tools:application=".ViewPostDetailActivity"> diff --git a/app/src/main/res/layout/activity_view_private_messages.xml b/app/src/main/res/layout/activity_view_private_messages.xml index 01c42f70..bbffb234 100644 --- a/app/src/main/res/layout/activity_view_private_messages.xml +++ b/app/src/main/res/layout/activity_view_private_messages.xml @@ -2,7 +2,6 @@ <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:id="@+id/coordinator_layout_view_private_messages_activity" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" 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 495a2cc1..24db28ba 100644 --- a/app/src/main/res/layout/activity_view_reddit_gallery.xml +++ b/app/src/main/res/layout/activity_view_reddit_gallery.xml @@ -2,7 +2,6 @@ <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" android:layout_width="match_parent" android:layout_height="match_parent" app:dragUpEnabled="true" diff --git a/app/src/main/res/layout/activity_view_subreddit_detail.xml b/app/src/main/res/layout/activity_view_subreddit_detail.xml index e0167ed6..f8c13dde 100644 --- a/app/src/main/res/layout/activity_view_subreddit_detail.xml +++ b/app/src/main/res/layout/activity_view_subreddit_detail.xml @@ -4,7 +4,6 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:id="@+id/coordinator_layout_view_subreddit_detail_activity" tools:application=".Activity.ViewSubredditDetailActivity"> <com.google.android.material.appbar.AppBarLayout diff --git a/app/src/main/res/layout/activity_view_user_detail.xml b/app/src/main/res/layout/activity_view_user_detail.xml index 186c7023..dd0bf212 100644 --- a/app/src/main/res/layout/activity_view_user_detail.xml +++ b/app/src/main/res/layout/activity_view_user_detail.xml @@ -4,7 +4,6 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:id="@+id/coordinator_layout_view_user_detail_activity" tools:application="ml.docilealligator.infinityforreddit.activities.ViewUserDetailActivity"> <com.google.android.material.appbar.AppBarLayout diff --git a/app/src/main/res/layout/activity_view_video.xml b/app/src/main/res/layout/activity_view_video.xml index ff60ca5f..632ffe06 100644 --- a/app/src/main/res/layout/activity_view_video.xml +++ b/app/src/main/res/layout/activity_view_video.xml @@ -3,7 +3,6 @@ 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_video_activity" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#000000" diff --git a/app/src/main/res/layout/activity_view_video_zoomable.xml b/app/src/main/res/layout/activity_view_video_zoomable.xml index cd98291d..ea2ff8eb 100644 --- a/app/src/main/res/layout/activity_view_video_zoomable.xml +++ b/app/src/main/res/layout/activity_view_video_zoomable.xml @@ -3,7 +3,6 @@ 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_video_activity" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#000000" diff --git a/app/src/main/res/layout/activity_web_view.xml b/app/src/main/res/layout/activity_web_view.xml index 36fd3f06..b8bbf2fe 100644 --- a/app/src/main/res/layout/activity_web_view.xml +++ b/app/src/main/res/layout/activity_web_view.xml @@ -4,7 +4,6 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:id="@+id/coordinator_layout_web_view_activity" tools:context=".activities.WebViewActivity"> <com.google.android.material.appbar.AppBarLayout diff --git a/app/src/main/res/layout/activity_wiki.xml b/app/src/main/res/layout/activity_wiki.xml index ead5eedd..6c47ba76 100644 --- a/app/src/main/res/layout/activity_wiki.xml +++ b/app/src/main/res/layout/activity_wiki.xml @@ -4,7 +4,6 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:id="@+id/coordinator_layout_comment_wiki_activity" tools:context=".activities.WikiActivity"> <com.google.android.material.appbar.AppBarLayout diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 1f8c3217..9895cebd 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -1054,9 +1054,7 @@ Automatické přehrávání videí je zakázáno."</string> Stále chcete tuto možnost povolit?"</string> <string name="reply">"Odpovědět"</string> <string name="post_gallery_activity_label">"Příspěvek galerie"</string> - <string name="trending_activity_label">"Trendy"</string> <string name="action_share_post_link">"Sdílet odkaz příspěvku"</string> - <string name="trending">"Trendy"</string> <string name="receive_post_reply_notifications">"Získávat oznámení o odpovědích na příspěvek"</string> <string name="bottom_sheet_post_gallery">"Galerie"</string> <string name="posting_gallery">"Galerie příspěvků"</string> diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index dc8905cd..d710cc16 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -1093,9 +1093,7 @@ Automatisches Abspielen von Videos ist deaktiviert."</string> Möchtest du trotzdem fortfahren?"</string> <string name="reply">"Antworten"</string> <string name="post_gallery_activity_label">"Galeriebeitrag"</string> - <string name="trending_activity_label">"Trending"</string> <string name="action_share_post_link">"Teile Beitragslink"</string> - <string name="trending">"Trending"</string> <string name="receive_post_reply_notifications">"Benachrichtigungen für Antworten auf Beiträge empfangen"</string> <string name="bottom_sheet_post_gallery">"Galerie"</string> <string name="posting_gallery">"Posts Galerie"</string> diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 2e9a811d..5839136e 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -990,9 +990,7 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd Θέλετε σίγουρα να το ενεργοποιήσετε;"</string> <string name="reply">"Απάντηση"</string> <string name="post_gallery_activity_label">"Ανάρτηση Εικόνας"</string> - <string name="trending_activity_label">"Σε τάση"</string> <string name="action_share_post_link">"Κοινοποίηση Συνδέσμου Ανάρτησης"</string> - <string name="trending">"Σε τάση"</string> <string name="receive_post_reply_notifications">"Λήψη μόνο ειδοποιήσεων απαντήσεων σε αναρτήσεις"</string> <string name="bottom_sheet_post_gallery">"Γκαλερί"</string> <string name="posting_gallery">"Συλλογή Αναρτάται"</string> diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index e019710e..0da16465 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -1104,9 +1104,7 @@ https://s3.eu-west-1.amazonaws.com/po-pub/i/hJAe7sMhrfJzqjhp9VkDQOVC.PNG --> ¿Seguro que quieres activarlo?"</string> <string name="reply">"Responder"</string> <string name="post_gallery_activity_label">"Publicación de galería"</string> - <string name="trending_activity_label">"Tendencias"</string> <string name="action_share_post_link">"Compartir enlace de publicación"</string> - <string name="trending">"Tendencias"</string> <string name="receive_post_reply_notifications">"Recibir notificaciones de respuesta a publicaciones"</string> <string name="bottom_sheet_post_gallery">"Galería"</string> <string name="posting_gallery">"Publicación de galería"</string> diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 9219d343..32d22e6b 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -1170,9 +1170,7 @@ Vous voulez toujours l'activer ?"</string> <!-- Fuzzy --> <string name="post_gallery_activity_label">"Publier une galerie"</string> - <string name="trending_activity_label">"Tendance"</string> <string name="action_share_post_link">"Partager le lien du Post"</string> - <string name="trending">"Tendance"</string> <string name="receive_post_reply_notifications">"Recevoir des notifications de réponse de publication"</string> <string name="bottom_sheet_post_gallery">"Gallerie"</string> <string name="posting_gallery">"Publication de la galerie"</string> diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index f639c35d..f86167ed 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -994,9 +994,7 @@ La riproduzione automatica video è disabilitata."</string> Vuoi comunque abilitare l'opzione?"</string> <string name="reply">"Rispondi"</string> <string name="post_gallery_activity_label">"Galleria post"</string> - <string name="trending_activity_label">"Popolari"</string> <string name="action_share_post_link">"Condividi post link"</string> - <string name="trending">"Popolari"</string> <string name="receive_post_reply_notifications">"Ricevi notifiche per le risposte"</string> <string name="bottom_sheet_post_gallery">"Galleria"</string> <string name="posting_gallery">"Galleria dei post"</string> diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 64106cf2..174f80b1 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -1104,7 +1104,6 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd それでも有効にしますか?"</string> <string name="reply">"返信"</string> <string name="post_gallery_activity_label">"ギャラリー投稿"</string> - <string name="trending_activity_label">"トレンド"</string> <string name="action_share_post_link">"投稿リンクを共有"</string> <string name="bottom_sheet_post_gallery">"ギャラリー"</string> <string name="posting_gallery">"ギャラリーを投稿"</string> diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index a8de9df4..13017488 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -1042,9 +1042,7 @@ Automatisch afspelen van video is uitgeschakeld."</string> Wil je het nog steeds activeren?"</string> <string name="reply">"Antwoord"</string> <string name="post_gallery_activity_label">"Gallerijpost"</string> - <string name="trending_activity_label">"Trending"</string> <string name="action_share_post_link">"Deel Post Link"</string> - <string name="trending">"Trending"</string> <string name="receive_post_reply_notifications">"Ontvang Post Reactie Notificaties"</string> <string name="bottom_sheet_post_gallery">"Gallerij"</string> <string name="posting_gallery">"Post gallerij"</string> diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 97da0690..5283be3f 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -1044,9 +1044,7 @@ użytkownika / multireddita"</string> Nadal chcesz ją włączyć?"</string> <string name="reply">"Odpowiedz"</string> <string name="post_gallery_activity_label">"Post z galerią zdjęć"</string> - <string name="trending_activity_label">"Popularne"</string> <string name="action_share_post_link">"Udostępnij link do postu"</string> - <string name="trending">"Popularne"</string> <string name="receive_post_reply_notifications">"Otrzymuj powiadomienia o odpowiedziach na post"</string> <string name="bottom_sheet_post_gallery">"Galeria"</string> <string name="label_reddit">"Reddit"</string> diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index af71be19..ab85b277 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -1032,9 +1032,7 @@ A reprodução automática de vídeos fica desativada."</string> Ainda quer a ativar?"</string> <string name="reply">"Responder"</string> <string name="post_gallery_activity_label">"Postar galeria"</string> - <string name="trending_activity_label">"Tendências"</string> <string name="action_share_post_link">"Compartilhar link da postagem"</string> - <string name="trending">"Em alta"</string> <string name="receive_post_reply_notifications">"Receber notificações de respostas às postagens"</string> <string name="bottom_sheet_post_gallery">"Galeria"</string> <string name="posting_gallery">"Postando galeria"</string> diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 21eb51aa..80c031a3 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -1053,9 +1053,7 @@ Reprodução automática de vídeos desativada."</string> Ainda deseja ativar esta opção?"</string> <string name="reply">"Responder"</string> <string name="post_gallery_activity_label">"Publicação de Galeria"</string> - <string name="trending_activity_label">"Tendências"</string> <string name="action_share_post_link">"Partilhar Endereço da Publicação"</string> - <string name="trending">"Tendências"</string> <string name="receive_post_reply_notifications">"Receber notificações de respostas de publicações"</string> <string name="bottom_sheet_post_gallery">"Galeria"</string> <string name="posting_gallery">"A Publicar Galeria"</string> diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index 876cd319..db8a0aa7 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -1044,9 +1044,7 @@ Redarea automată a videoclipurilor este dezactivată."</string> Încă dorești să-l activezi?"</string> <string name="reply">"Răspunde"</string> <string name="post_gallery_activity_label">"Postare Galerie"</string> - <string name="trending_activity_label">"În Tendințe"</string> <string name="action_share_post_link">"Partajează link postare"</string> - <string name="trending">"În Tendințe"</string> <string name="receive_post_reply_notifications">"Primește notificări de răspuns la postări"</string> <string name="bottom_sheet_post_gallery">"Galerie"</string> <string name="posting_gallery">"Galeria de Postări"</string> diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 94908ce3..e3a7fe43 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -1064,9 +1064,7 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd Всё ещё хотите включить его?"</string> <string name="reply">"Ответ"</string> <string name="post_gallery_activity_label">"Пост в галерее"</string> - <string name="trending_activity_label">"Популярное"</string> <string name="action_share_post_link">"Поделиться ссылкой на пост"</string> - <string name="trending">"Популярное"</string> <string name="receive_post_reply_notifications">"Получать уведомления об ответах на пост"</string> <string name="bottom_sheet_post_gallery">"Галерея"</string> <string name="posting_gallery">"Галерея постов"</string> diff --git a/app/src/main/res/values-ta/strings.xml b/app/src/main/res/values-ta/strings.xml index 1c2ff6ab..6fdc6705 100644 --- a/app/src/main/res/values-ta/strings.xml +++ b/app/src/main/res/values-ta/strings.xml @@ -688,9 +688,7 @@ <!-- Fuzzy --> <string name="crash_reports_deleted">"சிதைவறிக்கைகள் அழிக்கப்பட்டன"</string> <string name="reply">"பதிலளி"</string> - <string name="trending_activity_label">"பிரபலமாகும்"</string> <string name="action_share_post_link">"இடுகை தொடுப்பைப் பகிர்"</string> - <string name="trending">"பிரபலமாகும்"</string> <string name="bottom_sheet_post_gallery">"காட்சியகம்"</string> <string name="label_reddit">"ரெட்டிட்"</string> <string name="settings_more_tabs_show_multireddits_title">"பல்ரெட்டிட்டைக் காட்டு"</string> diff --git a/app/src/main/res/values-tr-rTR/strings.xml b/app/src/main/res/values-tr-rTR/strings.xml index 62751dcc..fae043f3 100644 --- a/app/src/main/res/values-tr-rTR/strings.xml +++ b/app/src/main/res/values-tr-rTR/strings.xml @@ -1074,9 +1074,7 @@ Otomatik video oynatma kapatılır."</string> Yine de etkinleştirmek istiyor musunuz?"</string> <string name="reply">"Yanıtla"</string> <string name="post_gallery_activity_label">"Galeri Gönderisi"</string> - <string name="trending_activity_label">"Trendler"</string> <string name="action_share_post_link">"Gönderi Bağlantısını Paylaş"</string> - <string name="trending">"Trendler"</string> <string name="receive_post_reply_notifications">"Gönderi yanıtlanınca bildirimlerini al"</string> <string name="bottom_sheet_post_gallery">"Galeri"</string> <string name="posting_gallery">"Galeri Paylaşma"</string> diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index aaff92f8..e83c4fa4 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -1048,9 +1048,7 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd Усе ще бажаєте ввімкнути це?"</string> <string name="reply">"Відповісти"</string> <string name="post_gallery_activity_label">"Допис галереї"</string> - <string name="trending_activity_label">"Тенденції"</string> <string name="action_share_post_link">"Поширити ланку допису"</string> - <string name="trending">"Тенденції"</string> <string name="receive_post_reply_notifications">"Отримувати сповіщення про відповіді на дописи"</string> <string name="bottom_sheet_post_gallery">"Галерея"</string> <string name="posting_gallery">"Публікування галереї"</string> diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index 8b8bd8d4..54d4d75c 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -1067,9 +1067,7 @@ Tự động phát video bị tắt."</string> Bạn có vẫn muốn bật tuỳ chọn này không?"</string> <string name="reply">"Trả lời"</string> <string name="post_gallery_activity_label">"Bài đăng bộ sưu tập"</string> - <string name="trending_activity_label">"Trending"</string> <string name="action_share_post_link">"Chia sẻ đường link bài đăng"</string> - <string name="trending">"Trending"</string> <string name="receive_post_reply_notifications">"Nhận thông báo trả lời trong bài đăng"</string> <string name="bottom_sheet_post_gallery">"Bộ sưu tập"</string> <string name="posting_gallery">"Đăng bộ sưu tập"</string> diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 5260a84e..44bb0d19 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -1069,9 +1069,7 @@ Reddit 视频分辨率较低。 仍然要继续吗?"</string> <string name="reply">"回复"</string> <string name="post_gallery_activity_label">"相册帖"</string> - <string name="trending_activity_label">"热门"</string> <string name="action_share_post_link">"分享帖子链接"</string> - <string name="trending">"热门"</string> <string name="receive_post_reply_notifications">"接收帖子回复提醒"</string> <string name="bottom_sheet_post_gallery">"相册"</string> <string name="posting_gallery">"相册发布中"</string> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 86dafe41..8049801c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -40,7 +40,6 @@ <string name="search_users_result_activity_label">Users</string> <string name="multireddit_selection_activity_label">Select a Multireddit</string> <string name="post_gallery_activity_label">Gallery Post</string> - <string name="trending_activity_label">Trending</string> <string name="wiki_activity_label">Wiki</string> <string name="edit_profile_activity_label">Edit Profile</string> <string name="post_poll_activity_label">Poll Post</string> @@ -141,7 +140,6 @@ <string name="history">History</string> <string name="inbox">Inbox</string> <string name="inbox_with_count">Inbox (%1$,d)</string> - <string name="trending">Trending</string> <string name="upvoted">Upvoted</string> <string name="downvoted">Downvoted</string> <string name="hidden">Hidden</string> |