Enable quick scale in ViewImageOrGifActivity and ViewRedditGalleryImageOrGifFragment.

This commit is contained in:
Alex Ning 2020-07-31 17:44:43 +08:00
parent 80b4869c6a
commit 60ee299822
5 changed files with 6 additions and 9 deletions

View File

@ -213,7 +213,6 @@ public class ViewImageOrGifActivity extends AppCompatActivity implements SetAsWa
if (view != null) { if (view != null) {
view.setMinimumDpi(80); view.setMinimumDpi(80);
view.setQuickScaleEnabled(true);
view.setOnImageEventListener(new SubsamplingScaleImageView.OnImageEventListener() { view.setOnImageEventListener(new SubsamplingScaleImageView.OnImageEventListener() {
@Override @Override
@ -225,7 +224,7 @@ public class ViewImageOrGifActivity extends AppCompatActivity implements SetAsWa
public void onImageLoaded() { public void onImageLoaded() {
view.setDoubleTapZoomDpi(70); view.setDoubleTapZoomDpi(70);
view.setDoubleTapZoomStyle(SubsamplingScaleImageView.ZOOM_FOCUS_FIXED); view.setDoubleTapZoomStyle(SubsamplingScaleImageView.ZOOM_FOCUS_FIXED);
view.setQuickScaleEnabled(false); view.setQuickScaleEnabled(true);
} }
@Override @Override

View File

@ -131,7 +131,6 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment {
if (view != null) { if (view != null) {
view.setMinimumDpi(80); view.setMinimumDpi(80);
view.setQuickScaleEnabled(true);
view.setOnImageEventListener(new SubsamplingScaleImageView.OnImageEventListener() { view.setOnImageEventListener(new SubsamplingScaleImageView.OnImageEventListener() {
@Override @Override
@ -143,7 +142,7 @@ public class ViewRedditGalleryImageOrGifFragment extends Fragment {
public void onImageLoaded() { public void onImageLoaded() {
view.setDoubleTapZoomDpi(70); view.setDoubleTapZoomDpi(70);
view.setDoubleTapZoomStyle(SubsamplingScaleImageView.ZOOM_FOCUS_FIXED); view.setDoubleTapZoomStyle(SubsamplingScaleImageView.ZOOM_FOCUS_FIXED);
view.setQuickScaleEnabled(false); view.setQuickScaleEnabled(true);
} }
@Override @Override

View File

@ -174,11 +174,10 @@ public class PostDataSource extends PageKeyedDataSource<String, Post> {
@Override @Override
public void loadInitial(@NonNull LoadInitialParams<String> params, @NonNull final LoadInitialCallback<String, Post> callback) { public void loadInitial(@NonNull LoadInitialParams<String> params, @NonNull final LoadInitialCallback<String, Post> callback) {
initialLoadStateLiveData.postValue(NetworkState.LOADING); initialLoadStateLiveData.postValue(NetworkState.LOADING);
boolean savePostFeedScrolledPosition = sharedPreferences.getBoolean(SharedPreferencesUtils.SAVE_FRONT_PAGE_SCROLLED_POSITION, true);
String accountNameForCache = accountName == null ? SharedPreferencesUtils.FRONT_PAGE_SCROLLED_POSITION_ANONYMOUS : accountName;
switch (postType) { switch (postType) {
case TYPE_FRONT_PAGE: case TYPE_FRONT_PAGE:
boolean savePostFeedScrolledPosition = sharedPreferences.getBoolean(SharedPreferencesUtils.SAVE_FRONT_PAGE_SCROLLED_POSITION, true);
String accountNameForCache = accountName == null ? SharedPreferencesUtils.FRONT_PAGE_SCROLLED_POSITION_ANONYMOUS : accountName;
if (savePostFeedScrolledPosition) { if (savePostFeedScrolledPosition) {
loadBestPostsInitial(callback, postFeedScrolledPositionSharedPreferences.getString(accountNameForCache + SharedPreferencesUtils.FRONT_PAGE_SCROLLED_POSITION_FRONT_PAGE_BASE, null)); loadBestPostsInitial(callback, postFeedScrolledPositionSharedPreferences.getString(accountNameForCache + SharedPreferencesUtils.FRONT_PAGE_SCROLLED_POSITION_FRONT_PAGE_BASE, null));
} else { } else {

View File

@ -153,7 +153,7 @@ public class AdvancedPreferenceFragment extends PreferenceFragmentCompat {
.setPositiveButton(R.string.yes, (dialogInterface, i) .setPositiveButton(R.string.yes, (dialogInterface, i)
-> { -> {
postFeedScrolledPositionSharedPreferences.edit().clear().apply(); postFeedScrolledPositionSharedPreferences.edit().clear().apply();
Toast.makeText(activity, R.string.delete_all_post_feed_scrolled_positions_success, Toast.LENGTH_SHORT).show(); Toast.makeText(activity, R.string.delete_all_front_page_scrolled_positions_success, Toast.LENGTH_SHORT).show();
}) })
.setNegativeButton(R.string.no, null) .setNegativeButton(R.string.no, null)
.show(); .show();

View File

@ -779,7 +779,7 @@
<string name="delete_all_sort_types_success">Delete all sort types successful</string> <string name="delete_all_sort_types_success">Delete all sort types successful</string>
<string name="delete_all_post_layouts_success">Delete all post layouts successful</string> <string name="delete_all_post_layouts_success">Delete all post layouts successful</string>
<string name="delete_all_themes_success">Delete all themes successful</string> <string name="delete_all_themes_success">Delete all themes successful</string>
<string name="delete_all_post_feed_scrolled_positions_success">Delete all post feed scrolled positions successful</string> <string name="delete_all_front_page_scrolled_positions_success">Delete all scrolled positions in front page successful</string>
<string name="reset_all_settings_success">Reset all settings successful</string> <string name="reset_all_settings_success">Reset all settings successful</string>
<string name="theme_preview">Theme Preview</string> <string name="theme_preview">Theme Preview</string>