mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 23:28:42 +03:00
Added 3 dot menu to filter Media data.
This commit is contained in:
parent
fc4788e796
commit
eb864fb22b
15 changed files with 227 additions and 194 deletions
|
@ -3,7 +3,7 @@ import org.gradle.internal.jvm.Jvm
|
|||
|
||||
buildscript {
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:7.1.3'
|
||||
classpath 'com.android.tools.build:gradle:7.0.4'
|
||||
classpath 'com.hiya:jacoco-android:0.2'
|
||||
classpath 'com.github.spotbugs.snom:spotbugs-gradle-plugin:5.0.9'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
|
|
|
@ -377,4 +377,16 @@ public interface AppPreferences {
|
|||
boolean isStoragePermissionRequested();
|
||||
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -99,6 +99,9 @@ public final class AppPreferencesImpl implements AppPreferences {
|
|||
|
||||
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 SharedPreferences preferences;
|
||||
private final CurrentAccountProvider currentAccountProvider;
|
||||
|
@ -712,4 +715,24 @@ public final class AppPreferencesImpl implements AppPreferences {
|
|||
public int computeBruteForceDelay(int count) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,10 +3,8 @@
|
|||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Tobias Kaminsky
|
||||
* @author TSI-mc
|
||||
* Copyright (C) 2022 Tobias Kaminsky
|
||||
* Copyright (C) 2022 Nextcloud GmbH
|
||||
* Copyright (C) 2022 TSI-mc
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -48,24 +46,19 @@ import com.owncloud.android.utils.DisplayUtils
|
|||
import com.owncloud.android.utils.FileSortOrder
|
||||
import com.owncloud.android.utils.FileStorageUtils
|
||||
import com.owncloud.android.utils.MimeTypeUtil
|
||||
import com.owncloud.android.utils.theme.ThemeColorUtils
|
||||
import com.owncloud.android.utils.theme.ThemeDrawableUtils
|
||||
import com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView.SectionedAdapter
|
||||
import java.util.Calendar
|
||||
import java.util.Date
|
||||
|
||||
@Suppress("LongParameterList")
|
||||
class GalleryAdapter(
|
||||
val context: Context,
|
||||
user: User,
|
||||
ocFileListFragmentInterface: OCFileListFragmentInterface,
|
||||
preferences: AppPreferences,
|
||||
transferServiceGetter: ComponentsGetter,
|
||||
themeColorUtils: ThemeColorUtils,
|
||||
themeDrawableUtils: ThemeDrawableUtils
|
||||
transferServiceGetter: ComponentsGetter
|
||||
) : SectionedRecyclerViewAdapter<SectionedViewHolder>(), CommonOCFileListAdapterInterface, SectionedAdapter {
|
||||
private var files: List<GalleryItems> = mutableListOf()
|
||||
private val ocFileListDelegate: OCFileListDelegate
|
||||
private var ocFileListDelegate: OCFileListDelegate
|
||||
private var storageManager: FileDataStorageManager
|
||||
|
||||
init {
|
||||
|
@ -81,9 +74,7 @@ class GalleryAdapter(
|
|||
true,
|
||||
transferServiceGetter,
|
||||
showMetadata = false,
|
||||
showShareAvatar = false,
|
||||
themeColorUtils,
|
||||
themeDrawableUtils
|
||||
showShareAvatar = false
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -162,7 +153,7 @@ class GalleryAdapter(
|
|||
mediaObject: MutableList<OCFile>,
|
||||
isVideoHideClicked: Boolean, isImageHideClicked: Boolean,
|
||||
imageList: MutableList<OCFile>, videoList: MutableList<OCFile>, photoFragment: GalleryFragment) {
|
||||
|
||||
|
||||
val items = storageManager.allGalleryItems
|
||||
mediaObject.clear()
|
||||
|
||||
|
@ -177,9 +168,9 @@ class GalleryAdapter(
|
|||
setAdapterWithHideShowImage(
|
||||
mediaObject, isVideoHideClicked, isImageHideClicked, imageList, videoList,
|
||||
photoFragment
|
||||
)
|
||||
|
||||
|
||||
)
|
||||
|
||||
|
||||
}
|
||||
|
||||
//Set Image/Video List According to Selection of Hide/Show Image/Video
|
||||
|
|
|
@ -2,10 +2,8 @@
|
|||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Tobias Kaminsky
|
||||
* @author TSI-mc
|
||||
* Copyright (C) 2019 Tobias Kaminsky
|
||||
* Copyright (C) 2019 Nextcloud GmbH
|
||||
* Copyright (C) 2022 TSI-mc
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -40,7 +38,6 @@ import com.owncloud.android.lib.common.utils.Log_OC;
|
|||
import com.owncloud.android.ui.activity.FileActivity;
|
||||
import com.owncloud.android.ui.activity.FileDisplayActivity;
|
||||
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.GalleryAdapter;
|
||||
import com.owncloud.android.ui.asynctasks.GallerySearchTask;
|
||||
|
@ -81,8 +78,6 @@ public class GalleryFragment extends OCFileListFragment implements GalleryFragme
|
|||
private List<OCFile> videoList;
|
||||
|
||||
@Inject AppPreferences appPreferences;
|
||||
@Inject ThemeColorUtils themeColorUtils;
|
||||
@Inject ThemeMenuUtils themeMenuUtils;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -95,7 +90,8 @@ public class GalleryFragment extends OCFileListFragment implements GalleryFragme
|
|||
FileActivity activity = (FileActivity) getActivity();
|
||||
|
||||
galleryFragmentBottomSheetDialog = new GalleryFragmentBottomSheetDialog(activity,
|
||||
this);
|
||||
this,
|
||||
appPreferences);
|
||||
}
|
||||
imageList = new ArrayList<>();
|
||||
videoList = new ArrayList<>();
|
||||
|
@ -143,8 +139,6 @@ public class GalleryFragment extends OCFileListFragment implements GalleryFragme
|
|||
menuItemAddRemoveValue = MenuItemAddRemove.REMOVE_GRID_AND_SORT;
|
||||
requireActivity().invalidateOptionsMenu();
|
||||
|
||||
updateSubtitle(galleryFragmentBottomSheetDialog.isHideVideos(), galleryFragmentBottomSheetDialog.isHideImages());
|
||||
|
||||
handleSearchEvent();
|
||||
}
|
||||
|
||||
|
@ -154,9 +148,7 @@ public class GalleryFragment extends OCFileListFragment implements GalleryFragme
|
|||
accountManager.getUser(),
|
||||
this,
|
||||
preferences,
|
||||
mContainerActivity,
|
||||
themeColorUtils,
|
||||
themeDrawableUtils);
|
||||
mContainerActivity);
|
||||
|
||||
// val spacing = resources.getDimensionPixelSize(R.dimen.media_grid_spacing)
|
||||
// binding.list.addItemDecoration(MediaGridItemDecoration(spacing))
|
||||
|
@ -301,8 +293,8 @@ public class GalleryFragment extends OCFileListFragment implements GalleryFragme
|
|||
MenuItem menuItem = menu.findItem(R.id.action_three_dot_icon);
|
||||
|
||||
if (menuItem != null) {
|
||||
themeMenuUtils.tintMenuIcon(menuItem,
|
||||
themeColorUtils.appBarPrimaryFontColor(requireContext()));
|
||||
ThemeMenuUtils.tintMenuIcon(requireContext(), menuItem,
|
||||
ThemeColorUtils.appBarPrimaryFontColor(requireContext()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -385,20 +377,33 @@ public class GalleryFragment extends OCFileListFragment implements GalleryFragme
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//Actions implementation of Bottom Sheet Dialog
|
||||
@Override
|
||||
public void updateMediaContent(boolean isHideVideos, boolean isHidePhotos) {
|
||||
public void hideVideos(boolean isHideVideosClicked) {
|
||||
|
||||
if (!mediaObject.isEmpty()) {
|
||||
mAdapter.setAdapterWithHideShowImage(mediaObject,
|
||||
isHideVideos,
|
||||
isHidePhotos, imageList, videoList,
|
||||
preferences.getHideVideoClicked(),
|
||||
preferences.getHideImageClicked(), imageList, videoList,
|
||||
this);
|
||||
|
||||
} else {
|
||||
setEmptyListMessage(SearchType.GALLERY_SEARCH);
|
||||
}
|
||||
}
|
||||
|
||||
updateSubtitle(isHideVideos, isHidePhotos);
|
||||
@Override
|
||||
public void hideImages(boolean isHideImagesClicked) {
|
||||
if (!mediaObject.isEmpty()) {
|
||||
mAdapter.setAdapterWithHideShowImage(mediaObject,
|
||||
preferences.getHideVideoClicked(),
|
||||
preferences.getHideImageClicked(), imageList, videoList,
|
||||
this);
|
||||
|
||||
} else {
|
||||
setEmptyListMessage(SearchType.GALLERY_SEARCH);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -410,24 +415,7 @@ public class GalleryFragment extends OCFileListFragment implements GalleryFragme
|
|||
|
||||
public void showAllGalleryItems() {
|
||||
mAdapter.showAllGalleryItems(mContainerActivity.getStorageManager(), remoteFilePath.getRemotePath(),
|
||||
mediaObject, galleryFragmentBottomSheetDialog.isHideVideos(),
|
||||
galleryFragmentBottomSheetDialog.isHideImages(),
|
||||
mediaObject, preferences.getHideVideoClicked(), preferences.getHideImageClicked(),
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,32 +1,16 @@
|
|||
/*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author TSI-mc
|
||||
* Copyright (C) 2022 TSI-mc
|
||||
* Copyright (C) 2022 Nextcloud GmbH
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.owncloud.android.ui.fragment;
|
||||
|
||||
public interface GalleryFragmentBottomSheetActions {
|
||||
|
||||
/**
|
||||
* show/hide all the images & videos in particular Folder.
|
||||
* hide all the images in particular Folder.
|
||||
*/
|
||||
void updateMediaContent(boolean isHideVideos, boolean isHidePhotos);
|
||||
void hideImages(boolean isHideImagesClicked);
|
||||
|
||||
/**
|
||||
* hide all the videos in particular folder.
|
||||
*/
|
||||
void hideVideos(boolean isHideVideosClicked);
|
||||
|
||||
/**
|
||||
* load all media of a particular folder.
|
||||
|
|
|
@ -1,24 +1,3 @@
|
|||
/*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author TSI-mc
|
||||
* Copyright (C) 2022 TSI-mc
|
||||
* Copyright (C) 2022 Nextcloud GmbH
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.owncloud.android.ui.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
@ -36,20 +15,19 @@ import androidx.core.content.ContextCompat;
|
|||
|
||||
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 final GalleryFragmentBottomSheetActions actions;
|
||||
private final AppPreferences preferences;
|
||||
private boolean isHideImageClicked;
|
||||
private boolean isHideVideoClicked;
|
||||
private BottomSheetBehavior mBottomBehavior;
|
||||
private int currentMediaState = MEDIA_STATE_DEFAULT;
|
||||
|
||||
public GalleryFragmentBottomSheetDialog(FileActivity fileActivity,
|
||||
GalleryFragmentBottomSheetActions actions) {
|
||||
GalleryFragmentBottomSheetActions actions,
|
||||
AppPreferences preferences) {
|
||||
super(fileActivity);
|
||||
this.actions = actions;
|
||||
this.preferences = preferences;
|
||||
}
|
||||
|
||||
|
||||
|
@ -74,15 +52,24 @@ public class GalleryFragmentBottomSheetDialog extends BottomSheetDialog {
|
|||
}
|
||||
|
||||
private void setupLayout() {
|
||||
if (currentMediaState == MEDIA_STATE_PHOTOS_ONLY) {
|
||||
binding.tickMarkShowImages.setVisibility(View.VISIBLE);
|
||||
binding.tickMarkShowVideo.setVisibility(View.GONE);
|
||||
} else if (currentMediaState == MEDIA_STATE_VIDEOS_ONLY) {
|
||||
binding.tickMarkShowImages.setVisibility(View.GONE);
|
||||
binding.tickMarkShowVideo.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
binding.tickMarkShowImages.setVisibility(View.VISIBLE);
|
||||
binding.tickMarkShowVideo.setVisibility(View.VISIBLE);
|
||||
|
||||
if (!preferences.getHideImageClicked()) {
|
||||
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);
|
||||
} else if (preferences.getHideImageClicked()) {
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,23 +77,63 @@ public class GalleryFragmentBottomSheetDialog extends BottomSheetDialog {
|
|||
|
||||
binding.hideImages.setOnClickListener(v -> {
|
||||
|
||||
if (currentMediaState == MEDIA_STATE_VIDEOS_ONLY) {
|
||||
currentMediaState = MEDIA_STATE_DEFAULT;
|
||||
} else {
|
||||
currentMediaState = MEDIA_STATE_VIDEOS_ONLY;
|
||||
if (!preferences.getHideImageClicked() && preferences.getHideVideoClicked()) {
|
||||
isHideImageClicked = true;
|
||||
isHideVideoClicked = false;
|
||||
binding.hideImagesImageview.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_no_camera));
|
||||
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();
|
||||
});
|
||||
|
||||
binding.hideVideo.setOnClickListener(v -> {
|
||||
|
||||
if (currentMediaState == MEDIA_STATE_PHOTOS_ONLY) {
|
||||
currentMediaState = MEDIA_STATE_DEFAULT;
|
||||
} else {
|
||||
currentMediaState = MEDIA_STATE_PHOTOS_ONLY;
|
||||
if (!preferences.getHideVideoClicked() && !preferences.getHideImageClicked()) {
|
||||
isHideVideoClicked = true;
|
||||
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);
|
||||
} 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();
|
||||
});
|
||||
|
||||
|
@ -117,18 +144,4 @@ 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,11 +3,9 @@
|
|||
*
|
||||
* @author Tobias Kaminsky
|
||||
* @author Andy Scherzinger
|
||||
* @author TSI-mc
|
||||
* Copyright (C) 2017 Tobias Kaminsky
|
||||
* Copyright (C) 2017 Nextcloud GmbH
|
||||
* Copyright (C) 2018 Andy Scherzinger
|
||||
* Copyright (C) 2022 TSI-mc
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -24,6 +22,7 @@
|
|||
*/
|
||||
package com.owncloud.android.utils.theme;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
|
@ -43,7 +42,7 @@ public final class ThemeMenuUtils {
|
|||
* @param item the menu item object
|
||||
* @param color the wanted color (as resource or color)
|
||||
*/
|
||||
public void tintMenuItemText(MenuItem item, int color) {
|
||||
public static void tintMenuItemText(MenuItem item, int color) {
|
||||
SpannableString newItemTitle = new SpannableString(item.getTitle());
|
||||
newItemTitle.setSpan(new ForegroundColorSpan(color), 0, newItemTitle.length(),
|
||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
|
@ -53,10 +52,11 @@ public final class ThemeMenuUtils {
|
|||
/**
|
||||
* tinting menu item color
|
||||
*
|
||||
* @param context
|
||||
* @param item the menu item object
|
||||
* @param color the color wanted as a color resource
|
||||
*/
|
||||
public void tintMenuIcon(@NonNull MenuItem item, int color) {
|
||||
public static void tintMenuIcon(@NonNull Context context, @NonNull MenuItem item, int color) {
|
||||
Drawable normalDrawable = item.getIcon();
|
||||
Drawable wrapDrawable = DrawableCompat.wrap(normalDrawable);
|
||||
DrawableCompat.setTint(wrapDrawable, color);
|
||||
|
|
50
app/src/main/res/drawable/ic_no_camera.xml
Normal file
50
app/src/main/res/drawable/ic_no_camera.xml
Normal file
|
@ -0,0 +1,50 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M12,17.237C12.677,17.237 13.321,17.099 13.91,16.855L12.717,15.663C12.485,15.711 12.246,15.737 12,15.737C10.067,15.737 8.5,14.171 8.5,12.237C8.5,12.212 8.5,12.186 8.5,12.161C8.502,11.94 8.53,11.726 8.572,11.517L7.382,10.327C7.138,10.916 7,11.56 7,12.237C7.003,14.997 9.24,17.234 12,17.237"
|
||||
android:strokeWidth="1"
|
||||
android:fillColor="#262626"
|
||||
android:fillType="evenOdd"
|
||||
android:strokeColor="#00000000"/>
|
||||
<path
|
||||
android:pathData="M15.792,18.737L4,18.737C3.977,18.738 3.954,18.738 3.931,18.737C3.122,18.718 2.481,18.047 2.5,17.237L2.5,8.737C2.5,8.715 2.5,8.693 2.5,8.671C2.519,7.86 3.19,7.218 4,7.237L4.292,7.237L2.981,5.926C1.829,6.345 1,7.44 1,8.737L1,17.237C1,18.894 2.343,20.237 4,20.237L17.292,20.237L15.792,18.737Z"
|
||||
android:strokeWidth="1"
|
||||
android:fillColor="#262626"
|
||||
android:fillType="evenOdd"
|
||||
android:strokeColor="#00000000"/>
|
||||
<path
|
||||
android:pathData="M20,9.737C20,9.185 19.553,8.737 19,8.737C18.447,8.737 18,9.185 18,9.737C18,10.29 18.447,10.737 19,10.737C19.553,10.737 20,10.29 20,9.737"
|
||||
android:strokeWidth="1"
|
||||
android:fillColor="#262626"
|
||||
android:fillType="evenOdd"
|
||||
android:strokeColor="#00000000"/>
|
||||
<group>
|
||||
<clip-path
|
||||
android:pathData="M7.1211,3.237l15.8789,0l0,15.692l-15.8789,0z"/>
|
||||
<path
|
||||
android:pathData="M8.2441,4.737L15.8001,4.737L17.3001,7.237L20.0001,7.237L20.0641,7.237C20.8751,7.255 21.5171,7.926 21.5001,8.737L21.5001,17.237C21.5011,17.259 21.5011,17.282 21.5001,17.303C21.4961,17.494 21.4521,17.675 21.3831,17.84L22.4751,18.929C22.8061,18.447 23.0001,17.865 23.0001,17.237L23.0001,8.737C23.0001,7.081 21.6571,5.737 20.0001,5.737L18.2001,5.737L16.7001,3.237L7.3501,3.237L7.1211,3.618L8.2441,4.737Z"
|
||||
android:strokeWidth="1"
|
||||
android:fillColor="#262626"
|
||||
android:fillType="evenOdd"
|
||||
android:strokeColor="#00000000"/>
|
||||
</group>
|
||||
<group>
|
||||
<clip-path
|
||||
android:pathData="M2.2825,2.0003l19.5504,0l0,19.474l-19.5504,0z"/>
|
||||
<path
|
||||
android:pathData="M20.5068,21.2741L2.5068,3.2741C2.2168,2.9981 2.2068,2.5381 2.4838,2.2481C2.4908,2.2401 2.4988,2.2321 2.5068,2.2241C2.7838,1.9341 3.2438,1.9241 3.5338,2.2011L3.5568,2.2241L21.6078,20.2241C21.8978,20.5001 21.9088,20.9581 21.6338,21.2481C21.6248,21.2571 21.6158,21.2661 21.6078,21.2741C21.2888,21.5411 20.8248,21.5411 20.5068,21.2741"
|
||||
android:strokeWidth="1"
|
||||
android:fillColor="#262626"
|
||||
android:fillType="evenOdd"
|
||||
android:strokeColor="#00000000"/>
|
||||
</group>
|
||||
<path
|
||||
android:pathData="M12.2842,8.7653C13.9832,8.9053 15.3272,10.2453 15.4712,11.9433L16.8742,13.3433C16.9562,12.9883 17.0002,12.6183 17.0002,12.2373C17.0002,9.4753 14.7622,7.2373 12.0002,7.2373C11.6142,7.2373 11.2402,7.2823 10.8812,7.3663L12.2842,8.7653Z"
|
||||
android:strokeWidth="1"
|
||||
android:fillColor="#262626"
|
||||
android:fillType="evenOdd"
|
||||
android:strokeColor="#00000000"/>
|
||||
</vector>
|
12
app/src/main/res/drawable/ic_no_video_camera.xml
Normal file
12
app/src/main/res/drawable/ic_no_video_camera.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M4.1,2.45C4.4,2.15 4.85,2.15 5.15,2.45L5.15,2.45L23.2,20.45C23.5,20.75 23.5,21.2 23.2,21.5C23.05,21.65 22.85,21.7 22.65,21.7C22.45,21.7 22.25,21.65 22.1,21.5L22.1,21.5L4.1,3.5C3.8,3.2 3.8,2.75 4.1,2.45ZM3.4,5L4.9,6.5L3.5,6.5L3.5,17C3.5,17.85 4.15,18.5 5,18.5L5,18.5L16.9,18.5L18.2,19.75C17.8,19.9 17.4,20 17,20L17,20L5,20C3.35,20 2,18.65 2,17L2,17L2,10.5L0.5,10.5L0.5,6.5L2,6.5L2,5L3.4,5ZM20,5L20,8.8L21.8,7L23.5,7L23.5,17L21.8,17L18.5,13.7L18.5,6.5L11.3,6.5L9.8,5L20,5ZM22,8.9L20,10.9L20,13.1L22,15.1L22,8.9Z"
|
||||
android:strokeWidth="1"
|
||||
android:fillColor="#262626"
|
||||
android:fillType="evenOdd"
|
||||
android:strokeColor="#00000000"/>
|
||||
</vector>
|
|
@ -1,24 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Nextcloud Android client application
|
||||
|
||||
@author TSI-mc
|
||||
Copyright (C) 2022 TSI-mc
|
||||
Copyright (C) 2022 Nextcloud GmbH
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<LinearLayout 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"
|
||||
|
@ -55,12 +35,12 @@
|
|||
android:layout_marginStart="@dimen/standard_margin"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:layout_toRightOf="@id/hideImagesImageview"
|
||||
android:text="@string/show_images"
|
||||
android:text="@string/hide_images"
|
||||
android:textColor="@color/text_color"
|
||||
android:textSize="@dimen/bottom_sheet_text_size" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/tickMarkShowImages"
|
||||
android:id="@+id/tickMarkHideImages"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
|
@ -100,12 +80,12 @@
|
|||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="@dimen/standard_margin"
|
||||
android:layout_toRightOf="@id/hideVideoImageView"
|
||||
android:text="@string/show_video"
|
||||
android:text="@string/hide_video"
|
||||
android:textColor="@color/text_color"
|
||||
android:textSize="@dimen/bottom_sheet_text_size" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/tickMarkShowVideo"
|
||||
android:id="@+id/tickMarkHideVideo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
|
|
|
@ -1,24 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Nextcloud Android client application
|
||||
|
||||
@author TSI-mc
|
||||
Copyright (C) 2022 TSI-mc
|
||||
Copyright (C) 2022 Nextcloud GmbH
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
|
|
|
@ -904,12 +904,11 @@
|
|||
<item quantity="one">%d ausgewählt</item>
|
||||
<item quantity="other">%d ausgewählt</item>
|
||||
</plurals>
|
||||
<string name="subtitle_photos_videos">Fotos & videos</string>
|
||||
<string name="hide_images">Bilder ausblenden</string>
|
||||
<string name="show_images">Bilder anzeigen</string>
|
||||
<string name="subtitle_photos_only">Nur Fotos</string>
|
||||
<string name="hide_video">Videos ausblenden</string>
|
||||
<string name="show_video">Videos anzeigen</string>
|
||||
<string name="subtitle_videos_only">Nur Videos</string>
|
||||
<string name="select_media_folder">Medienordner festlegen</string>
|
||||
<string name="select_media_folder">Den Ordner \"Medien\" auswählen</string>
|
||||
<string name="choose_location">Speicherort wählen</string>
|
||||
<string name="common_select">Auswählen</string>
|
||||
</resources>
|
||||
|
|
|
@ -1008,12 +1008,11 @@
|
|||
<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_media_read_only">Media read-only</string>
|
||||
<string name="subtitle_photos_videos">Photos & videos</string>
|
||||
<string name="show_images">Show photos</string>
|
||||
<string name="subtitle_photos_only">Photos only</string>
|
||||
<string name="show_video">Show videos</string>
|
||||
<string name="subtitle_videos_only">Videos only</string>
|
||||
<string name="select_media_folder">Set media folder</string>
|
||||
<string name="hide_images">Hide images</string>
|
||||
<string name="show_images">Show images</string>
|
||||
<string name="hide_video">Hide video</string>
|
||||
<string name="show_video">Show video</string>
|
||||
<string name="select_media_folder">Select the \"Media\" folder</string>
|
||||
<string name="choose_location">Choose location</string>
|
||||
<string name="common_select">Select</string>
|
||||
</resources>
|
||||
|
|
|
@ -5,3 +5,5 @@ NC_TEST_SERVER_PASSWORD=test
|
|||
android.enableJetifier=true
|
||||
android.useAndroidX=true
|
||||
#android.debug.obsoleteApi=true
|
||||
#Fix for --> Out of memory: Java heap space.
|
||||
org.gradle.jvmargs=-Xmx2048m
|
||||
|
|
Loading…
Reference in a new issue