mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-28 11:58:23 +01:00
Fix gif too small in ViewImageOrGifActivity. Hide immersive interface entry if the device has Android version lower than 8.0.
This commit is contained in:
parent
c97120528b
commit
a9ba807cf4
@ -77,8 +77,6 @@ public class ViewImageOrGifActivity extends AppCompatActivity implements SetAsWa
|
||||
public static final String FILE_NAME_KEY = "FNK";
|
||||
public static final String POST_TITLE_KEY = "PTK";
|
||||
private static final int PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE = 0;
|
||||
/*@BindView(R.id.hauler_view_view_image_or_gif_activity)
|
||||
HaulerView mHaulerView;*/
|
||||
@BindView(R.id.progress_bar_view_image_or_gif_activity)
|
||||
ProgressBar mProgressBar;
|
||||
@BindView(R.id.image_view_view_image_or_gif_activity)
|
||||
@ -259,61 +257,11 @@ public class ViewImageOrGifActivity extends AppCompatActivity implements SetAsWa
|
||||
}
|
||||
});
|
||||
|
||||
/*if (isGif) {
|
||||
gestureLayout.setVisibility(View.VISIBLE);
|
||||
gestureLayout.getController().getSettings().setMaxZoom(10f).setDoubleTapZoom(2f).setPanEnabled(true);
|
||||
mGifView.setOnClickListener(imageViewOnClickListener);
|
||||
} else {
|
||||
mImageView.setVisibility(View.VISIBLE);
|
||||
mImageView.setOnClickListener(imageViewOnClickListener);
|
||||
}*/
|
||||
|
||||
loadImage();
|
||||
}
|
||||
|
||||
private void loadImage() {
|
||||
mImageView.showImage(Uri.parse(mImageUrl));
|
||||
/*if (isGif) {
|
||||
glide.load(mImageUrl).listener(new RequestListener<Drawable>() {
|
||||
@Override
|
||||
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
mLoadErrorLinearLayout.setVisibility(View.VISIBLE);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
return false;
|
||||
}
|
||||
}).override(Target.SIZE_ORIGINAL).into(mGifView);
|
||||
} else {
|
||||
glide.asBitmap().load(mImageUrl).listener(new RequestListener<Bitmap>() {
|
||||
@Override
|
||||
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Bitmap> target, boolean isFirstResource) {
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
mLoadErrorLinearLayout.setVisibility(View.VISIBLE);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onResourceReady(Bitmap resource, Object model, Target<Bitmap> target, DataSource dataSource, boolean isFirstResource) {
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
return false;
|
||||
}
|
||||
}).override(Target.SIZE_ORIGINAL).into(new CustomTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||
mImageView.setImage(ImageSource.bitmap(resource));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
|
||||
}
|
||||
});
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1248,7 +1248,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
||||
if ((mPost.isNSFW() && mNeedBlurNsfw && !(mPost.getPostType() == Post.GIF_TYPE && mAutoplayNsfwVideos)) || (mPost.isSpoiler() && mNeedBlurSpoiler)) {
|
||||
imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10))).into(((PostDetailImageAndGifAutoplayViewHolder) holder).mImageView);
|
||||
} else {
|
||||
if (mImageViewWidth > mPost.getPreviewWidth() && mPost.getPostType() == Post.IMAGE_TYPE) {
|
||||
if (mImageViewWidth > mPost.getPreviewWidth()) {
|
||||
imageRequestBuilder.override(Target.SIZE_ORIGINAL).into(((PostDetailImageAndGifAutoplayViewHolder) holder).mImageView);
|
||||
} else {
|
||||
imageRequestBuilder.into(((PostDetailImageAndGifAutoplayViewHolder) holder).mImageView);
|
||||
|
@ -875,7 +875,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
||||
imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10)))
|
||||
.into(((PostImageAndGifAutoplayViewHolder) holder).imageView);
|
||||
} else {
|
||||
if (mImageViewWidth > post.getPreviewWidth() && post.getPostType() == Post.IMAGE_TYPE) {
|
||||
if (mImageViewWidth > post.getPreviewWidth()) {
|
||||
imageRequestBuilder.override(Target.SIZE_ORIGINAL).into(((PostImageAndGifAutoplayViewHolder) holder).imageView);
|
||||
} else {
|
||||
imageRequestBuilder.into(((PostImageAndGifAutoplayViewHolder) holder).imageView);
|
||||
|
@ -1,6 +1,5 @@
|
||||
package ml.docilealligator.infinityforreddit.Settings;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
@ -22,32 +21,26 @@ public class ImmersiveInterfacePreferenceFragment extends PreferenceFragmentComp
|
||||
SwitchPreference immersiveInterfaceIgnoreNavBarSwitch = findPreference(SharedPreferencesUtils.IMMERSIVE_INTERFACE_IGNORE_NAV_BAR_KEY);
|
||||
|
||||
if (immersiveInterfaceSwitch != null && immersiveInterfaceIgnoreNavBarSwitch != null) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
immersiveInterfaceSwitch.setVisible(true);
|
||||
immersiveInterfaceSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
if ((Boolean) newValue) {
|
||||
immersiveInterfaceIgnoreNavBarSwitch.setVisible(true);
|
||||
} else {
|
||||
immersiveInterfaceIgnoreNavBarSwitch.setVisible(false);
|
||||
}
|
||||
EventBus.getDefault().post(new RecreateActivityEvent());
|
||||
return true;
|
||||
});
|
||||
|
||||
if (immersiveInterfaceSwitch.isChecked()) {
|
||||
immersiveInterfaceSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
if ((Boolean) newValue) {
|
||||
immersiveInterfaceIgnoreNavBarSwitch.setVisible(true);
|
||||
} else {
|
||||
immersiveInterfaceIgnoreNavBarSwitch.setVisible(false);
|
||||
}
|
||||
EventBus.getDefault().post(new RecreateActivityEvent());
|
||||
return true;
|
||||
});
|
||||
|
||||
immersiveInterfaceIgnoreNavBarSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
EventBus.getDefault().post(new RecreateActivityEvent());
|
||||
return true;
|
||||
});
|
||||
if (immersiveInterfaceSwitch.isChecked()) {
|
||||
immersiveInterfaceIgnoreNavBarSwitch.setVisible(true);
|
||||
} else {
|
||||
immersiveInterfaceSwitch.setVisible(false);
|
||||
immersiveInterfaceIgnoreNavBarSwitch.setVisible(false);
|
||||
}
|
||||
|
||||
immersiveInterfaceIgnoreNavBarSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
EventBus.getDefault().post(new RecreateActivityEvent());
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,11 @@
|
||||
package ml.docilealligator.infinityforreddit.Settings;
|
||||
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.preference.ListPreference;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
@ -24,6 +26,7 @@ public class InterfacePreferenceFragment extends PreferenceFragmentCompat {
|
||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||
setPreferencesFromResource(R.xml.interface_preference, rootKey);
|
||||
|
||||
Preference immersiveInterfaceEntryPreference = findPreference(SharedPreferencesUtils.IMMERSIVE_INTERFACE_ENTRY_KEY);
|
||||
SwitchPreference bottomAppBarSwitch = findPreference(SharedPreferencesUtils.BOTTOM_APP_BAR_KEY);
|
||||
SwitchPreference voteButtonsOnTheRightSwitch = findPreference(SharedPreferencesUtils.VOTE_BUTTONS_ON_THE_RIGHT_KEY);
|
||||
ListPreference defaultPostLayoutSwitch = findPreference(SharedPreferencesUtils.DEFAULT_POST_LAYOUT_KEY);
|
||||
@ -31,6 +34,10 @@ public class InterfacePreferenceFragment extends PreferenceFragmentCompat {
|
||||
SwitchPreference showThumbnailOnTheRightInCompactLayout = findPreference(SharedPreferencesUtils.SHOW_THUMBNAIL_ON_THE_LEFT_IN_COMPACT_LAYOUT);
|
||||
SwitchPreference showAbsoluteNumberOfVotes = findPreference(SharedPreferencesUtils.SHOW_ABSOLUTE_NUMBER_OF_VOTES);
|
||||
|
||||
if (immersiveInterfaceEntryPreference != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
immersiveInterfaceEntryPreference.setVisible(true);
|
||||
}
|
||||
|
||||
if (bottomAppBarSwitch != null) {
|
||||
bottomAppBarSwitch.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
EventBus.getDefault().post(new RecreateActivityEvent());
|
||||
|
@ -35,6 +35,7 @@ public class SharedPreferencesUtils {
|
||||
public static final String TITLE_FONT_FAMILY_KEY = "title_font_family";
|
||||
public static final String CONTENT_FONT_FAMILY_KEY = "content_font_family";
|
||||
public static final String AMOLED_DARK_KEY = "amoled_dark";
|
||||
public static final String IMMERSIVE_INTERFACE_ENTRY_KEY = "immersive_interface_entry";
|
||||
public static final String IMMERSIVE_INTERFACE_KEY = "immersive_interface";
|
||||
public static final String IMMERSIVE_INTERFACE_IGNORE_NAV_BAR_KEY = "immersive_interface_ignore_nav_bar";
|
||||
public static final String BOTTOM_APP_BAR_KEY = "bottom_app_bar";
|
||||
|
@ -19,8 +19,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:optimizeDisplay="true"
|
||||
app:tapToRetry="false"
|
||||
app:initScaleType="centerInside" />
|
||||
app:tapToRetry="false"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/load_image_error_linear_layout_view_image_or_gif_activity"
|
||||
|
@ -352,6 +352,7 @@
|
||||
<string name="settings_start_autoplay_visible_area_offset_landscape_title">Autoplay Videos Visible Area Offset (Landscape)</string>
|
||||
<string name="settings_start_autoplay_visible_area_offset_landscape_summary">Start autoplaying videos when %1$d%% of them are visible</string>
|
||||
<string name="settings_immersive_interface_title">Immersive Interface</string>
|
||||
<string name="settings_immersive_interface_summary">Does Not Apply to All Pages</string>
|
||||
<string name="settings_immersive_interface_ignore_nav_bar_title">Ignore Navigation Bar in Immersive Interface</string>
|
||||
<string name="settings_immersive_interface_ignore_nav_bar_summary">Prevent the Bottom Navigation Bar Having Extra Padding</string>
|
||||
<string name="settings_customize_tabs_in_main_page_title">Customize Tabs in Main Page</string>
|
||||
@ -378,7 +379,7 @@
|
||||
<string name="settings_show_thumbnail_on_the_left_in_compact_layout">Show Thumbnail on the Left in Compact Layout</string>
|
||||
<string name="settings_swap_tap_and_long_title">Swap Tap and Long Press in Comments</string>
|
||||
<string name="settings_swipe_to_go_back_title">Swipe Right to Go Back</string>
|
||||
<string name="settings_swipe_to_go_back_summary">Does not apply to all pages</string>
|
||||
<string name="settings_swipe_to_go_back_summary">Does Not Apply to All Pages</string>
|
||||
<string name="settings_lock_jump_to_next_top_level_comment_button_title">Lock Jump to Next Top-level Comment Button</string>
|
||||
<string name="settings_lock_bottom_app_bar_title">Lock Bottom Navigation Bar</string>
|
||||
<string name="settings_swipe_up_to_hide_jump_to_next_top_level_comment_button_title">Swipe Up to Hide Jump to Next Top-level Comment Button</string>
|
||||
|
@ -5,13 +5,12 @@
|
||||
app:defaultValue="true"
|
||||
app:key="immersive_interface"
|
||||
app:title="@string/settings_immersive_interface_title"
|
||||
app:isPreferenceVisible="false" />
|
||||
app:summary="@string/settings_immersive_interface_summary" />
|
||||
|
||||
<SwitchPreference
|
||||
app:defaultValue="false"
|
||||
app:key="immersive_interface_ignore_nav_bar"
|
||||
app:title="@string/settings_immersive_interface_ignore_nav_bar_title"
|
||||
app:summary="@string/settings_immersive_interface_ignore_nav_bar_summary"
|
||||
app:isPreferenceVisible="false" />
|
||||
app:summary="@string/settings_immersive_interface_ignore_nav_bar_summary" />
|
||||
|
||||
</PreferenceScreen>
|
@ -8,8 +8,10 @@
|
||||
app:fragment="ml.docilealligator.infinityforreddit.Settings.FontPreferenceFragment" />
|
||||
|
||||
<Preference
|
||||
app:key="immersive_interface_entry"
|
||||
app:title="@string/settings_immersive_interface_title"
|
||||
app:fragment="ml.docilealligator.infinityforreddit.Settings.ImmersiveInterfacePreferenceFragment" />
|
||||
app:fragment="ml.docilealligator.infinityforreddit.Settings.ImmersiveInterfacePreferenceFragment"
|
||||
app:isPreferenceVisible="false" />
|
||||
|
||||
<Preference
|
||||
app:title="@string/settings_customize_tabs_in_main_page_title"
|
||||
|
Loading…
Reference in New Issue
Block a user