mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 13:45:35 +03:00
Updated design changes
This commit is contained in:
parent
3cd34b4bfb
commit
e4e29d8cdc
9 changed files with 97 additions and 177 deletions
|
@ -380,15 +380,4 @@ public interface AppPreferences {
|
||||||
|
|
||||||
void setStoragePermissionRequested(boolean value);
|
void setStoragePermissionRequested(boolean value);
|
||||||
|
|
||||||
/**
|
|
||||||
* Saves the show/hide Image State
|
|
||||||
*/
|
|
||||||
void setHideImageClicked(boolean isHideImageClicked);
|
|
||||||
boolean getHideImageClicked();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Saves the show/hide Video State
|
|
||||||
*/
|
|
||||||
void setHideVideoClicked(boolean isHideVideoClicked);
|
|
||||||
boolean getHideVideoClicked();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,9 +101,6 @@ public final class AppPreferencesImpl implements AppPreferences {
|
||||||
|
|
||||||
private static final String PREF__STORAGE_PERMISSION_REQUESTED = "storage_permission_requested";
|
private static final String PREF__STORAGE_PERMISSION_REQUESTED = "storage_permission_requested";
|
||||||
|
|
||||||
private static final String PREF__IS_HIDE_IMAGE_CLICKED = "is_hideImage_clicked";
|
|
||||||
private static final String PREF__IS_HIDE_VIDEO_CLICKED = "is_hideVideo_clicked";
|
|
||||||
|
|
||||||
private final Context context;
|
private final Context context;
|
||||||
private final SharedPreferences preferences;
|
private final SharedPreferences preferences;
|
||||||
private final CurrentAccountProvider currentAccountProvider;
|
private final CurrentAccountProvider currentAccountProvider;
|
||||||
|
@ -718,23 +715,4 @@ public final class AppPreferencesImpl implements AppPreferences {
|
||||||
return (int) Math.min(count / 3d, 10);
|
return (int) Math.min(count / 3d, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setHideImageClicked(boolean isHideImageClicked) {
|
|
||||||
preferences.edit().putBoolean(PREF__IS_HIDE_IMAGE_CLICKED, isHideImageClicked).apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean getHideImageClicked() {
|
|
||||||
return preferences.getBoolean(PREF__IS_HIDE_IMAGE_CLICKED,false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setHideVideoClicked(boolean isHideVideoClicked) {
|
|
||||||
preferences.edit().putBoolean(PREF__IS_HIDE_VIDEO_CLICKED, isHideVideoClicked).apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean getHideVideoClicked() {
|
|
||||||
return preferences.getBoolean(PREF__IS_HIDE_VIDEO_CLICKED,false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,9 @@
|
||||||
* Nextcloud Android client application
|
* Nextcloud Android client application
|
||||||
*
|
*
|
||||||
* @author Andy Scherzinger
|
* @author Andy Scherzinger
|
||||||
* @author TSI-mc
|
|
||||||
* Copyright (C) 2016 Andy Scherzinger
|
* Copyright (C) 2016 Andy Scherzinger
|
||||||
* Copyright (C) 2016 Nextcloud
|
* Copyright (C) 2016 Nextcloud
|
||||||
* Copyright (C) 2016 ownCloud Inc.
|
* Copyright (C) 2016 ownCloud Inc.
|
||||||
* Copyright (C) 2022 TSI-mc
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
|
@ -29,6 +27,7 @@ import android.annotation.SuppressLint;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
@ -40,19 +39,14 @@ import com.google.android.material.appbar.AppBarLayout;
|
||||||
import com.google.android.material.button.MaterialButton;
|
import com.google.android.material.button.MaterialButton;
|
||||||
import com.google.android.material.card.MaterialCardView;
|
import com.google.android.material.card.MaterialCardView;
|
||||||
import com.google.android.material.textview.MaterialTextView;
|
import com.google.android.material.textview.MaterialTextView;
|
||||||
import com.nextcloud.client.di.Injectable;
|
|
||||||
import com.owncloud.android.R;
|
import com.owncloud.android.R;
|
||||||
import com.owncloud.android.datamodel.FileDataStorageManager;
|
import com.owncloud.android.datamodel.FileDataStorageManager;
|
||||||
import com.owncloud.android.datamodel.OCFile;
|
import com.owncloud.android.datamodel.OCFile;
|
||||||
import com.owncloud.android.utils.theme.ThemeButtonUtils;
|
|
||||||
import com.owncloud.android.utils.theme.ThemeColorUtils;
|
import com.owncloud.android.utils.theme.ThemeColorUtils;
|
||||||
import com.owncloud.android.utils.theme.ThemeDrawableUtils;
|
import com.owncloud.android.utils.theme.ThemeDrawableUtils;
|
||||||
import com.owncloud.android.utils.theme.ThemeLayoutUtils;
|
|
||||||
import com.owncloud.android.utils.theme.ThemeToolbarUtils;
|
import com.owncloud.android.utils.theme.ThemeToolbarUtils;
|
||||||
import com.owncloud.android.utils.theme.ThemeUtils;
|
import com.owncloud.android.utils.theme.ThemeUtils;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.StringRes;
|
import androidx.annotation.StringRes;
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
|
@ -64,7 +58,7 @@ import androidx.core.content.ContextCompat;
|
||||||
/**
|
/**
|
||||||
* Base class providing toolbar registration functionality, see {@link #setupToolbar(boolean, boolean)}.
|
* Base class providing toolbar registration functionality, see {@link #setupToolbar(boolean, boolean)}.
|
||||||
*/
|
*/
|
||||||
public abstract class ToolbarActivity extends BaseActivity implements Injectable {
|
public abstract class ToolbarActivity extends BaseActivity {
|
||||||
protected MaterialButton mMenuButton;
|
protected MaterialButton mMenuButton;
|
||||||
protected MaterialTextView mSearchText;
|
protected MaterialTextView mSearchText;
|
||||||
protected MaterialButton mSwitchAccountButton;
|
protected MaterialButton mSwitchAccountButton;
|
||||||
|
@ -80,23 +74,16 @@ public abstract class ToolbarActivity extends BaseActivity implements Injectable
|
||||||
protected AppCompatSpinner mToolbarSpinner;
|
protected AppCompatSpinner mToolbarSpinner;
|
||||||
private boolean isHomeSearchToolbarShow = false;
|
private boolean isHomeSearchToolbarShow = false;
|
||||||
|
|
||||||
@Inject public ThemeColorUtils themeColorUtils;
|
|
||||||
@Inject public ThemeLayoutUtils themeLayoutUtils;
|
|
||||||
@Inject public ThemeToolbarUtils themeToolbarUtils;
|
|
||||||
@Inject public ThemeUtils themeUtils;
|
|
||||||
@Inject public ThemeDrawableUtils themeDrawableUtils;
|
|
||||||
@Inject public ThemeButtonUtils themeButtonUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toolbar setup that must be called in implementer's {@link #onCreate} after {@link #setContentView} if they want
|
* Toolbar setup that must be called in implementer's {@link #onCreate} after {@link #setContentView} if they want
|
||||||
* to use the toolbar.
|
* to use the toolbar.
|
||||||
*/
|
*/
|
||||||
private void setupToolbar(boolean isHomeSearchToolbarShow, boolean showSortListButtonGroup) {
|
private void setupToolbar(boolean isHomeSearchToolbarShow, boolean showSortListButtonGroup) {
|
||||||
int fontColor = themeColorUtils.appBarPrimaryFontColor(this);
|
int fontColor = ThemeColorUtils.appBarPrimaryFontColor(this);
|
||||||
|
|
||||||
mToolbar = findViewById(R.id.toolbar);
|
mToolbar = findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(mToolbar);
|
setSupportActionBar(mToolbar);
|
||||||
themeToolbarUtils.colorStatusBar(this);
|
ThemeToolbarUtils.colorStatusBar(this);
|
||||||
|
|
||||||
mAppBar = findViewById(R.id.appbar);
|
mAppBar = findViewById(R.id.appbar);
|
||||||
mDefaultToolbar = findViewById(R.id.default_toolbar);
|
mDefaultToolbar = findViewById(R.id.default_toolbar);
|
||||||
|
@ -121,11 +108,11 @@ public abstract class ToolbarActivity extends BaseActivity implements Injectable
|
||||||
mToolbarSpinner = findViewById(R.id.toolbar_spinner);
|
mToolbarSpinner = findViewById(R.id.toolbar_spinner);
|
||||||
|
|
||||||
if (mToolbar.getOverflowIcon() != null) {
|
if (mToolbar.getOverflowIcon() != null) {
|
||||||
themeDrawableUtils.tintDrawable(mToolbar.getOverflowIcon(), fontColor);
|
ThemeDrawableUtils.tintDrawable(mToolbar.getOverflowIcon(), fontColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mToolbar.getNavigationIcon() != null) {
|
if (mToolbar.getNavigationIcon() != null) {
|
||||||
themeDrawableUtils.tintDrawable(mToolbar.getNavigationIcon(), fontColor);
|
ThemeDrawableUtils.tintDrawable(mToolbar.getNavigationIcon(), fontColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +131,7 @@ public abstract class ToolbarActivity extends BaseActivity implements Injectable
|
||||||
String title;
|
String title;
|
||||||
boolean isRoot = isRoot(chosenFile);
|
boolean isRoot = isRoot(chosenFile);
|
||||||
|
|
||||||
title = isRoot ? themeUtils.getDefaultDisplayNameForRootFolder(this) : chosenFile.getFileName();
|
title = isRoot ? ThemeUtils.getDefaultDisplayNameForRootFolder(this) : chosenFile.getFileName();
|
||||||
updateActionBarTitleAndHomeButtonByString(title);
|
updateActionBarTitleAndHomeButtonByString(title);
|
||||||
|
|
||||||
if (mAppBar != null) {
|
if (mAppBar != null) {
|
||||||
|
@ -176,13 +163,13 @@ public abstract class ToolbarActivity extends BaseActivity implements Injectable
|
||||||
R.animator.appbar_elevation_off));
|
R.animator.appbar_elevation_off));
|
||||||
mDefaultToolbar.setVisibility(View.GONE);
|
mDefaultToolbar.setVisibility(View.GONE);
|
||||||
mHomeSearchToolbar.setVisibility(View.VISIBLE);
|
mHomeSearchToolbar.setVisibility(View.VISIBLE);
|
||||||
themeToolbarUtils.colorStatusBar(this, ContextCompat.getColor(this, R.color.bg_default));
|
ThemeToolbarUtils.colorStatusBar(this, ContextCompat.getColor(this, R.color.bg_default));
|
||||||
} else {
|
} else {
|
||||||
mAppBar.setStateListAnimator(AnimatorInflater.loadStateListAnimator(mAppBar.getContext(),
|
mAppBar.setStateListAnimator(AnimatorInflater.loadStateListAnimator(mAppBar.getContext(),
|
||||||
R.animator.appbar_elevation_on));
|
R.animator.appbar_elevation_on));
|
||||||
mDefaultToolbar.setVisibility(View.VISIBLE);
|
mDefaultToolbar.setVisibility(View.VISIBLE);
|
||||||
mHomeSearchToolbar.setVisibility(View.GONE);
|
mHomeSearchToolbar.setVisibility(View.GONE);
|
||||||
themeToolbarUtils.colorStatusBar(this);
|
ThemeToolbarUtils.colorStatusBar(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,7 +185,7 @@ public abstract class ToolbarActivity extends BaseActivity implements Injectable
|
||||||
|
|
||||||
// set & color the chosen title
|
// set & color the chosen title
|
||||||
ActionBar actionBar = getSupportActionBar();
|
ActionBar actionBar = getSupportActionBar();
|
||||||
themeToolbarUtils.setColoredTitle(actionBar, titleToSet, this);
|
ThemeToolbarUtils.setColoredTitle(actionBar, titleToSet, this);
|
||||||
|
|
||||||
// set home button properties
|
// set home button properties
|
||||||
if (actionBar != null) {
|
if (actionBar != null) {
|
||||||
|
@ -290,14 +277,11 @@ public abstract class ToolbarActivity extends BaseActivity implements Injectable
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateToolbarSubtitle(@NonNull String subtitle) {
|
public void updateToolbarSubtitle(@NonNull String subtitle) {
|
||||||
ActionBar actionBar = getSupportActionBar();
|
if (TextUtils.isEmpty(subtitle)) {
|
||||||
themeToolbarUtils.setColoredSubtitle(actionBar, subtitle, this);
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
public void clearToolbarSubtitle() {
|
|
||||||
ActionBar actionBar = getSupportActionBar();
|
|
||||||
if(actionBar != null){
|
|
||||||
actionBar.setSubtitle(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ActionBar actionBar = getSupportActionBar();
|
||||||
|
ThemeToolbarUtils.setColoredSubtitle(actionBar, subtitle, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ import com.owncloud.android.lib.common.utils.Log_OC;
|
||||||
import com.owncloud.android.ui.activity.FileActivity;
|
import com.owncloud.android.ui.activity.FileActivity;
|
||||||
import com.owncloud.android.ui.activity.FileDisplayActivity;
|
import com.owncloud.android.ui.activity.FileDisplayActivity;
|
||||||
import com.owncloud.android.ui.activity.FolderPickerActivity;
|
import com.owncloud.android.ui.activity.FolderPickerActivity;
|
||||||
|
import com.owncloud.android.ui.activity.ToolbarActivity;
|
||||||
import com.owncloud.android.ui.adapter.CommonOCFileListAdapterInterface;
|
import com.owncloud.android.ui.adapter.CommonOCFileListAdapterInterface;
|
||||||
import com.owncloud.android.ui.adapter.GalleryAdapter;
|
import com.owncloud.android.ui.adapter.GalleryAdapter;
|
||||||
import com.owncloud.android.ui.asynctasks.GallerySearchTask;
|
import com.owncloud.android.ui.asynctasks.GallerySearchTask;
|
||||||
|
@ -92,8 +93,7 @@ public class GalleryFragment extends OCFileListFragment implements GalleryFragme
|
||||||
FileActivity activity = (FileActivity) getActivity();
|
FileActivity activity = (FileActivity) getActivity();
|
||||||
|
|
||||||
galleryFragmentBottomSheetDialog = new GalleryFragmentBottomSheetDialog(activity,
|
galleryFragmentBottomSheetDialog = new GalleryFragmentBottomSheetDialog(activity,
|
||||||
this,
|
this);
|
||||||
appPreferences);
|
|
||||||
}
|
}
|
||||||
imageList = new ArrayList<>();
|
imageList = new ArrayList<>();
|
||||||
videoList = new ArrayList<>();
|
videoList = new ArrayList<>();
|
||||||
|
@ -141,6 +141,8 @@ public class GalleryFragment extends OCFileListFragment implements GalleryFragme
|
||||||
menuItemAddRemoveValue = MenuItemAddRemove.REMOVE_GRID_AND_SORT;
|
menuItemAddRemoveValue = MenuItemAddRemove.REMOVE_GRID_AND_SORT;
|
||||||
requireActivity().invalidateOptionsMenu();
|
requireActivity().invalidateOptionsMenu();
|
||||||
|
|
||||||
|
updateSubtitle(galleryFragmentBottomSheetDialog.isHideVideos(), galleryFragmentBottomSheetDialog.isHideImages());
|
||||||
|
|
||||||
handleSearchEvent();
|
handleSearchEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,33 +381,20 @@ public class GalleryFragment extends OCFileListFragment implements GalleryFragme
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Actions implementation of Bottom Sheet Dialog
|
|
||||||
@Override
|
@Override
|
||||||
public void hideVideos(boolean isHideVideosClicked) {
|
public void updateMediaContent(boolean isHideVideos, boolean isHidePhotos) {
|
||||||
|
|
||||||
if (!mediaObject.isEmpty()) {
|
if (!mediaObject.isEmpty()) {
|
||||||
mAdapter.setAdapterWithHideShowImage(mediaObject,
|
mAdapter.setAdapterWithHideShowImage(mediaObject,
|
||||||
preferences.getHideVideoClicked(),
|
isHideVideos,
|
||||||
preferences.getHideImageClicked(), imageList, videoList,
|
isHidePhotos, imageList, videoList,
|
||||||
this);
|
this);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
setEmptyListMessage(SearchType.GALLERY_SEARCH);
|
setEmptyListMessage(SearchType.GALLERY_SEARCH);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
updateSubtitle(isHideVideos, isHidePhotos);
|
||||||
public void hideImages(boolean isHideImagesClicked) {
|
|
||||||
if (!mediaObject.isEmpty()) {
|
|
||||||
mAdapter.setAdapterWithHideShowImage(mediaObject,
|
|
||||||
preferences.getHideVideoClicked(),
|
|
||||||
preferences.getHideImageClicked(), imageList, videoList,
|
|
||||||
this);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
setEmptyListMessage(SearchType.GALLERY_SEARCH);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -417,7 +406,24 @@ public class GalleryFragment extends OCFileListFragment implements GalleryFragme
|
||||||
|
|
||||||
public void showAllGalleryItems() {
|
public void showAllGalleryItems() {
|
||||||
mAdapter.showAllGalleryItems(mContainerActivity.getStorageManager(), remoteFilePath.getRemotePath(),
|
mAdapter.showAllGalleryItems(mContainerActivity.getStorageManager(), remoteFilePath.getRemotePath(),
|
||||||
mediaObject, preferences.getHideVideoClicked(), preferences.getHideImageClicked(),
|
mediaObject, galleryFragmentBottomSheetDialog.isHideVideos(),
|
||||||
|
galleryFragmentBottomSheetDialog.isHideImages(),
|
||||||
imageList, videoList, this);
|
imageList, videoList, this);
|
||||||
|
|
||||||
|
updateSubtitle(galleryFragmentBottomSheetDialog.isHideVideos(), galleryFragmentBottomSheetDialog.isHideImages());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateSubtitle(boolean isHideVideos, boolean isHidePhotos) {
|
||||||
|
requireActivity().runOnUiThread(() -> {
|
||||||
|
String subTitle = requireContext().getResources().getString(R.string.subtitle_photos_videos);
|
||||||
|
if (isHideVideos) {
|
||||||
|
subTitle = requireContext().getResources().getString(R.string.subtitle_photos_only);
|
||||||
|
} else if (isHidePhotos) {
|
||||||
|
subTitle = requireContext().getResources().getString(R.string.subtitle_videos_only);
|
||||||
|
}
|
||||||
|
if (requireActivity() instanceof ToolbarActivity) {
|
||||||
|
((ToolbarActivity) requireActivity()).updateToolbarSubtitle(subTitle);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,14 +24,9 @@ package com.owncloud.android.ui.fragment;
|
||||||
public interface GalleryFragmentBottomSheetActions {
|
public interface GalleryFragmentBottomSheetActions {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* hide all the images in particular Folder.
|
* show/hide all the images & videos in particular Folder.
|
||||||
*/
|
*/
|
||||||
void hideImages(boolean isHideImagesClicked);
|
void updateMediaContent(boolean isHideVideos, boolean isHidePhotos);
|
||||||
|
|
||||||
/**
|
|
||||||
* hide all the videos in particular folder.
|
|
||||||
*/
|
|
||||||
void hideVideos(boolean isHideVideosClicked);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* load all media of a particular folder.
|
* load all media of a particular folder.
|
||||||
|
|
|
@ -36,19 +36,20 @@ import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
public class GalleryFragmentBottomSheetDialog extends BottomSheetDialog {
|
public class GalleryFragmentBottomSheetDialog extends BottomSheetDialog {
|
||||||
|
|
||||||
|
//media view states
|
||||||
|
private static final int MEDIA_STATE_DEFAULT = 1; //when both photos and videos selected
|
||||||
|
private static final int MEDIA_STATE_PHOTOS_ONLY = 2;
|
||||||
|
private static final int MEDIA_STATE_VIDEOS_ONLY = 3;
|
||||||
|
|
||||||
private FragmentGalleryBottomSheetBinding binding;
|
private FragmentGalleryBottomSheetBinding binding;
|
||||||
private final GalleryFragmentBottomSheetActions actions;
|
private final GalleryFragmentBottomSheetActions actions;
|
||||||
private final AppPreferences preferences;
|
|
||||||
private boolean isHideImageClicked;
|
|
||||||
private boolean isHideVideoClicked;
|
|
||||||
private BottomSheetBehavior mBottomBehavior;
|
private BottomSheetBehavior mBottomBehavior;
|
||||||
|
private int currentMediaState = MEDIA_STATE_DEFAULT;
|
||||||
|
|
||||||
public GalleryFragmentBottomSheetDialog(FileActivity fileActivity,
|
public GalleryFragmentBottomSheetDialog(FileActivity fileActivity,
|
||||||
GalleryFragmentBottomSheetActions actions,
|
GalleryFragmentBottomSheetActions actions) {
|
||||||
AppPreferences preferences) {
|
|
||||||
super(fileActivity);
|
super(fileActivity);
|
||||||
this.actions = actions;
|
this.actions = actions;
|
||||||
this.preferences = preferences;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,24 +74,15 @@ public class GalleryFragmentBottomSheetDialog extends BottomSheetDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupLayout() {
|
private void setupLayout() {
|
||||||
|
if (currentMediaState == MEDIA_STATE_PHOTOS_ONLY) {
|
||||||
if (!preferences.getHideImageClicked()) {
|
binding.tickMarkShowImages.setVisibility(View.VISIBLE);
|
||||||
binding.hideImagesImageview.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_camera));
|
binding.tickMarkShowVideo.setVisibility(View.GONE);
|
||||||
binding.hideImagesTextview.setText(getContext().getResources().getString(R.string.hide_images));
|
} else if (currentMediaState == MEDIA_STATE_VIDEOS_ONLY) {
|
||||||
binding.tickMarkHideImages.setVisibility(View.GONE);
|
binding.tickMarkShowImages.setVisibility(View.GONE);
|
||||||
} else if (preferences.getHideImageClicked()) {
|
binding.tickMarkShowVideo.setVisibility(View.VISIBLE);
|
||||||
binding.hideImagesImageview.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_no_camera));
|
} else {
|
||||||
binding.hideImagesTextview.setText(getContext().getResources().getString(R.string.show_images));
|
binding.tickMarkShowImages.setVisibility(View.VISIBLE);
|
||||||
binding.tickMarkHideImages.setVisibility(View.VISIBLE);
|
binding.tickMarkShowVideo.setVisibility(View.VISIBLE);
|
||||||
}
|
|
||||||
if (!preferences.getHideVideoClicked()) {
|
|
||||||
binding.hideVideoImageView.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_video_camera));
|
|
||||||
binding.hideVideoTextview.setText(getContext().getResources().getString(R.string.hide_video));
|
|
||||||
binding.tickMarkHideVideo.setVisibility(View.GONE);
|
|
||||||
} else if (preferences.getHideVideoClicked()) {
|
|
||||||
binding.hideVideoImageView.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_no_video_camera));
|
|
||||||
binding.hideVideoTextview.setText(getContext().getResources().getString(R.string.show_video));
|
|
||||||
binding.tickMarkHideVideo.setVisibility(View.VISIBLE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,63 +90,23 @@ public class GalleryFragmentBottomSheetDialog extends BottomSheetDialog {
|
||||||
|
|
||||||
binding.hideImages.setOnClickListener(v -> {
|
binding.hideImages.setOnClickListener(v -> {
|
||||||
|
|
||||||
if (!preferences.getHideImageClicked() && preferences.getHideVideoClicked()) {
|
if (currentMediaState == MEDIA_STATE_VIDEOS_ONLY) {
|
||||||
isHideImageClicked = true;
|
currentMediaState = MEDIA_STATE_DEFAULT;
|
||||||
isHideVideoClicked = false;
|
} else {
|
||||||
binding.hideImagesImageview.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_no_camera));
|
currentMediaState = MEDIA_STATE_VIDEOS_ONLY;
|
||||||
binding.hideImagesTextview.setText(getContext().getResources().getString(R.string.show_images));
|
|
||||||
binding.hideVideoImageView.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_video_camera));
|
|
||||||
binding.hideVideoTextview.setText(getContext().getResources().getString(R.string.hide_video));
|
|
||||||
binding.tickMarkHideImages.setVisibility(View.VISIBLE);
|
|
||||||
binding.tickMarkHideVideo.setVisibility(View.GONE);
|
|
||||||
|
|
||||||
} else if (!preferences.getHideImageClicked() && !preferences.getHideVideoClicked()) {
|
|
||||||
isHideImageClicked = true;
|
|
||||||
binding.hideImagesImageview.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_no_camera));
|
|
||||||
binding.hideImagesTextview.setText(getContext().getResources().getString(R.string.show_images));
|
|
||||||
binding.tickMarkHideImages.setVisibility(View.VISIBLE);
|
|
||||||
} else if (preferences.getHideImageClicked() && !preferences.getHideVideoClicked()) {
|
|
||||||
isHideImageClicked = false;
|
|
||||||
binding.hideImagesImageview.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_camera));
|
|
||||||
binding.hideImagesTextview.setText(getContext().getResources().getString(R.string.hide_images));
|
|
||||||
binding.tickMarkHideImages.setVisibility(View.GONE);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
notifyStateChange();
|
||||||
preferences.setHideImageClicked(isHideImageClicked);
|
|
||||||
preferences.setHideVideoClicked(isHideVideoClicked);
|
|
||||||
actions.hideImages(preferences.getHideImageClicked());
|
|
||||||
dismiss();
|
dismiss();
|
||||||
});
|
});
|
||||||
|
|
||||||
binding.hideVideo.setOnClickListener(v -> {
|
binding.hideVideo.setOnClickListener(v -> {
|
||||||
|
|
||||||
if (!preferences.getHideVideoClicked() && !preferences.getHideImageClicked()) {
|
if (currentMediaState == MEDIA_STATE_PHOTOS_ONLY) {
|
||||||
isHideVideoClicked = true;
|
currentMediaState = MEDIA_STATE_DEFAULT;
|
||||||
binding.hideVideoImageView.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_no_video_camera));
|
} else {
|
||||||
binding.hideVideoTextview.setText(getContext().getResources().getString(R.string.show_video));
|
currentMediaState = MEDIA_STATE_PHOTOS_ONLY;
|
||||||
binding.tickMarkHideVideo.setVisibility(View.VISIBLE);
|
|
||||||
} else if (!preferences.getHideVideoClicked() && preferences.getHideImageClicked()) {
|
|
||||||
isHideVideoClicked = true;
|
|
||||||
isHideImageClicked = false;
|
|
||||||
|
|
||||||
binding.hideVideoImageView.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_no_video_camera));
|
|
||||||
binding.hideVideoTextview.setText(getContext().getResources().getString(R.string.show_video));
|
|
||||||
binding.hideImagesImageview.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_camera));
|
|
||||||
binding.hideImagesTextview.setText(getContext().getResources().getString(R.string.hide_images));
|
|
||||||
binding.tickMarkHideImages.setVisibility(View.GONE);
|
|
||||||
binding.tickMarkHideVideo.setVisibility(View.VISIBLE);
|
|
||||||
|
|
||||||
} else if (preferences.getHideVideoClicked() && !preferences.getHideImageClicked()) {
|
|
||||||
isHideVideoClicked = false;
|
|
||||||
binding.hideVideoImageView.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_video_camera));
|
|
||||||
binding.hideVideoTextview.setText(getContext().getResources().getString(R.string.hide_video));
|
|
||||||
binding.tickMarkHideVideo.setVisibility(View.GONE);
|
|
||||||
}
|
}
|
||||||
|
notifyStateChange();
|
||||||
preferences.setHideVideoClicked(isHideVideoClicked);
|
|
||||||
preferences.setHideImageClicked(isHideImageClicked);
|
|
||||||
actions.hideVideos(preferences.getHideVideoClicked());
|
|
||||||
dismiss();
|
dismiss();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -165,4 +117,18 @@ public class GalleryFragmentBottomSheetDialog extends BottomSheetDialog {
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void notifyStateChange() {
|
||||||
|
setupLayout();
|
||||||
|
actions.updateMediaContent(isHideVideos(), isHideImages());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isHideImages() {
|
||||||
|
return currentMediaState == MEDIA_STATE_VIDEOS_ONLY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isHideVideos() {
|
||||||
|
return currentMediaState == MEDIA_STATE_PHOTOS_ONLY;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,12 +55,12 @@
|
||||||
android:layout_marginStart="@dimen/standard_margin"
|
android:layout_marginStart="@dimen/standard_margin"
|
||||||
android:layout_marginEnd="30dp"
|
android:layout_marginEnd="30dp"
|
||||||
android:layout_toRightOf="@id/hideImagesImageview"
|
android:layout_toRightOf="@id/hideImagesImageview"
|
||||||
android:text="@string/hide_images"
|
android:text="@string/show_images"
|
||||||
android:textColor="@color/text_color"
|
android:textColor="@color/text_color"
|
||||||
android:textSize="@dimen/bottom_sheet_text_size" />
|
android:textSize="@dimen/bottom_sheet_text_size" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/tickMarkHideImages"
|
android:id="@+id/tickMarkShowImages"
|
||||||
android:layout_width="24dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="24dp"
|
android:layout_height="24dp"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
|
@ -100,12 +100,12 @@
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_marginStart="@dimen/standard_margin"
|
android:layout_marginStart="@dimen/standard_margin"
|
||||||
android:layout_toRightOf="@id/hideVideoImageView"
|
android:layout_toRightOf="@id/hideVideoImageView"
|
||||||
android:text="@string/hide_video"
|
android:text="@string/show_video"
|
||||||
android:textColor="@color/text_color"
|
android:textColor="@color/text_color"
|
||||||
android:textSize="@dimen/bottom_sheet_text_size" />
|
android:textSize="@dimen/bottom_sheet_text_size" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/tickMarkHideVideo"
|
android:id="@+id/tickMarkShowVideo"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
|
|
|
@ -904,11 +904,12 @@
|
||||||
<item quantity="one">%d ausgewählt</item>
|
<item quantity="one">%d ausgewählt</item>
|
||||||
<item quantity="other">%d ausgewählt</item>
|
<item quantity="other">%d ausgewählt</item>
|
||||||
</plurals>
|
</plurals>
|
||||||
<string name="hide_images">Bilder ausblenden</string>
|
<string name="subtitle_photos_videos">Fotos & videos</string>
|
||||||
<string name="show_images">Bilder anzeigen</string>
|
<string name="show_images">Bilder anzeigen</string>
|
||||||
<string name="hide_video">Videos ausblenden</string>
|
<string name="subtitle_photos_only">Nur Fotos</string>
|
||||||
<string name="show_video">Videos anzeigen</string>
|
<string name="show_video">Videos anzeigen</string>
|
||||||
<string name="select_media_folder">Den Ordner \"Medien\" auswählen</string>
|
<string name="subtitle_videos_only">Nur Videos</string>
|
||||||
|
<string name="select_media_folder">Medienordner festlegen</string>
|
||||||
<string name="choose_location">Speicherort wählen</string>
|
<string name="choose_location">Speicherort wählen</string>
|
||||||
<string name="common_select">Auswählen</string>
|
<string name="common_select">Auswählen</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1008,11 +1008,12 @@
|
||||||
<string name="pdf_zoom_tip">Tap on a page to zoom in</string>
|
<string name="pdf_zoom_tip">Tap on a page to zoom in</string>
|
||||||
<string name="storage_permission_full_access">Full access</string>
|
<string name="storage_permission_full_access">Full access</string>
|
||||||
<string name="storage_permission_media_read_only">Media read-only</string>
|
<string name="storage_permission_media_read_only">Media read-only</string>
|
||||||
<string name="hide_images">Hide images</string>
|
<string name="subtitle_photos_videos">Photos & videos</string>
|
||||||
<string name="show_images">Show images</string>
|
<string name="show_images">Show photos</string>
|
||||||
<string name="hide_video">Hide video</string>
|
<string name="subtitle_photos_only">Photos only</string>
|
||||||
<string name="show_video">Show video</string>
|
<string name="show_video">Show videos</string>
|
||||||
<string name="select_media_folder">Select the \"Media\" folder</string>
|
<string name="subtitle_videos_only">Videos only</string>
|
||||||
|
<string name="select_media_folder">Set media folder</string>
|
||||||
<string name="choose_location">Choose location</string>
|
<string name="choose_location">Choose location</string>
|
||||||
<string name="common_select">Select</string>
|
<string name="common_select">Select</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue