diff --git a/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java index 71638eb9a3..c0aa92fa59 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java @@ -5,10 +5,12 @@ * @author David A. Velasco * @author Andy Scherzinger * @author Chris Narkiewicz + * @author TSI-mc * Copyright (C) 2011 Bartek Przybylski * Copyright (C) 2016 ownCloud Inc. * Copyright (C) 2018 Andy Scherzinger * Copyright (C) 2019 Chris Narkiewicz + * 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 version 2, @@ -531,6 +533,10 @@ public class FileDisplayActivity extends FileActivity searchView.post(() -> searchView.setQuery(searchQuery, true)); } setDrawerIndicatorEnabled(false); + + //clear the subtitle while going from + updateToolbarSubtitle(""); + FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.addToBackStack(null); transaction.replace(R.id.left_fragment_container, fragment, TAG_LIST_OF_FILES); diff --git a/app/src/main/java/com/owncloud/android/ui/activity/ToolbarActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/ToolbarActivity.java index 09705355a4..2d629db2e9 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/ToolbarActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/ToolbarActivity.java @@ -29,7 +29,6 @@ import android.annotation.SuppressLint; import android.graphics.Bitmap; import android.graphics.Color; import android.graphics.drawable.Drawable; -import android.text.TextUtils; import android.view.View; import android.widget.FrameLayout; import android.widget.ImageView; @@ -52,9 +51,9 @@ import com.owncloud.android.utils.theme.ThemeLayoutUtils; import com.owncloud.android.utils.theme.ThemeToolbarUtils; import com.owncloud.android.utils.theme.ThemeUtils; -import androidx.annotation.NonNull; import javax.inject.Inject; +import androidx.annotation.NonNull; import androidx.annotation.StringRes; import androidx.annotation.VisibleForTesting; import androidx.appcompat.app.ActionBar; @@ -291,10 +290,6 @@ public abstract class ToolbarActivity extends BaseActivity implements Injectable } public void updateToolbarSubtitle(@NonNull String subtitle) { - if (TextUtils.isEmpty(subtitle)) { - return; - } - ActionBar actionBar = getSupportActionBar(); themeToolbarUtils.setColoredSubtitle(actionBar, subtitle, this); } diff --git a/app/src/main/java/com/owncloud/android/ui/adapter/GalleryAdapter.kt b/app/src/main/java/com/owncloud/android/ui/adapter/GalleryAdapter.kt index 3d1504a324..e5fd1cf332 100644 --- a/app/src/main/java/com/owncloud/android/ui/adapter/GalleryAdapter.kt +++ b/app/src/main/java/com/owncloud/android/ui/adapter/GalleryAdapter.kt @@ -42,6 +42,7 @@ import com.owncloud.android.datamodel.GalleryItems import com.owncloud.android.datamodel.OCFile import com.owncloud.android.ui.activity.ComponentsGetter import com.owncloud.android.ui.fragment.GalleryFragment +import com.owncloud.android.ui.fragment.GalleryFragmentBottomSheetDialog import com.owncloud.android.ui.fragment.SearchType import com.owncloud.android.ui.interfaces.OCFileListFragmentInterface import com.owncloud.android.utils.DisplayUtils @@ -161,66 +162,47 @@ class GalleryAdapter( } @SuppressLint("NotifyDataSetChanged") - fun showAllGalleryItems(storageManager: FileDataStorageManager, + fun showAllGalleryItems( + storageManager: FileDataStorageManager, remotePath: String, mediaObject: MutableList, - isVideoHideClicked: Boolean, isImageHideClicked: Boolean, - imageList: MutableList, videoList: MutableList, photoFragment: GalleryFragment) { + mediaState: GalleryFragmentBottomSheetDialog.MediaState, + photoFragment: GalleryFragment + ) { val items = storageManager.allGalleryItems mediaObject.clear() - for (c in items) { - if (c is OCFile) { - if (c.remotePath.contains(remotePath)) { - mediaObject.add(c) - } - } - } - - setAdapterWithHideShowImage( - mediaObject, isVideoHideClicked, isImageHideClicked, imageList, videoList, - photoFragment + mediaObject.addAll( + items.filter { it != null && it.remotePath.startsWith(remotePath) } ) - + setMediaFilter( + mediaObject, mediaState, + photoFragment + ) } //Set Image/Video List According to Selection of Hide/Show Image/Video @SuppressLint("NotifyDataSetChanged") - fun setAdapterWithHideShowImage( + fun setMediaFilter( mediaObject: List, - isVideoHideClicked: Boolean, isImageHideClicked: Boolean, - imageList: MutableList, videoList: MutableList, + mediaState: GalleryFragmentBottomSheetDialog.MediaState, photoFragment: GalleryFragment ) { - val finalSortedList: List + val finalSortedList: List = when (mediaState) { + GalleryFragmentBottomSheetDialog.MediaState.MEDIA_STATE_PHOTOS_ONLY -> { + mediaObject.filter { MimeTypeUtil.isImage(it.mimeType) }.distinct() + } + GalleryFragmentBottomSheetDialog.MediaState.MEDIA_STATE_VIDEOS_ONLY -> { + mediaObject.filter { MimeTypeUtil.isVideo(it.mimeType) }.distinct() + } + else -> mediaObject + } - if (isVideoHideClicked) { - imageList.clear() - for (ocFile in mediaObject) { - if (MimeTypeUtil.isImage(ocFile.mimeType) && !imageList.contains(ocFile)) { - imageList.add(ocFile) - } - } - finalSortedList = imageList - if (imageList.isEmpty()) { - photoFragment.setEmptyListMessage(SearchType.GALLERY_SEARCH) - } - } else if (isImageHideClicked) { - videoList.clear() - for (ocFile in mediaObject) { - if (MimeTypeUtil.isVideo(ocFile.mimeType) && !videoList.contains(ocFile)) { - videoList.add(ocFile) - } - } - finalSortedList = videoList - if (videoList.isEmpty()) { - photoFragment.setEmptyListMessage(SearchType.GALLERY_SEARCH) - } - } else { - finalSortedList = mediaObject + if (finalSortedList.isEmpty()) { + photoFragment.setEmptyListMessage(SearchType.GALLERY_SEARCH) } files = finalSortedList @@ -232,7 +214,7 @@ class GalleryAdapter( } @SuppressLint("NotifyDataSetChanged") - fun resetAdapter(){ + fun clear() { files = emptyList() Handler(Looper.getMainLooper()).post { notifyDataSetChanged() } } diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/GalleryFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/GalleryFragment.java index 1115026866..77f3bc2fcf 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/GalleryFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/GalleryFragment.java @@ -33,7 +33,6 @@ import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; -import com.nextcloud.client.preferences.AppPreferences; import com.owncloud.android.R; import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.lib.common.utils.Log_OC; @@ -45,7 +44,6 @@ import com.owncloud.android.ui.adapter.CommonOCFileListAdapterInterface; import com.owncloud.android.ui.adapter.GalleryAdapter; import com.owncloud.android.ui.asynctasks.GallerySearchTask; import com.owncloud.android.ui.events.ChangeMenuEvent; -import com.owncloud.android.utils.theme.ThemeColorUtils; import com.owncloud.android.utils.theme.ThemeMenuUtils; import java.util.ArrayList; @@ -76,8 +74,6 @@ public class GalleryFragment extends OCFileListFragment implements GalleryFragme private OCFile remoteFilePath; private GalleryFragmentBottomSheetDialog galleryFragmentBottomSheetDialog; - @Inject AppPreferences appPreferences; - @Inject ThemeColorUtils themeColorUtils; @Inject ThemeMenuUtils themeMenuUtils; @Override @@ -90,8 +86,7 @@ public class GalleryFragment extends OCFileListFragment implements GalleryFragme if (galleryFragmentBottomSheetDialog == null) { FileActivity activity = (FileActivity) getActivity(); - galleryFragmentBottomSheetDialog = new GalleryFragmentBottomSheetDialog(activity, - this); + galleryFragmentBottomSheetDialog = new GalleryFragmentBottomSheetDialog(this); } } @@ -137,7 +132,7 @@ public class GalleryFragment extends OCFileListFragment implements GalleryFragme menuItemAddRemoveValue = MenuItemAddRemove.REMOVE_GRID_AND_SORT; requireActivity().invalidateOptionsMenu(); - updateSubtitle(galleryFragmentBottomSheetDialog.isHideVideos(), galleryFragmentBottomSheetDialog.isHideImages()); + updateSubtitle(galleryFragmentBottomSheetDialog.getCurrMediaState()); handleSearchEvent(); } @@ -216,13 +211,7 @@ public class GalleryFragment extends OCFileListFragment implements GalleryFragme startDate = (System.currentTimeMillis() / 1000) - 30 * 24 * 60 * 60; endDate = System.currentTimeMillis() / 1000; - photoSearchTask = new GallerySearchTask(this, - accountManager.getUser(), - mContainerActivity.getStorageManager(), - startDate, - endDate, - limit) - .execute(); + runGallerySearchTask(); } } @@ -260,24 +249,6 @@ public class GalleryFragment extends OCFileListFragment implements GalleryFragme runGallerySearchTask(); } - @Override - public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - remotePath = setDefaultRemotePath(); - } - - private String setDefaultRemotePath() { - if (remoteFilePath == null) { - setRemoteFilePath(remotePath); - } - return remotePath; - } - - private void setRemoteFilePath(String remotePath) { - remoteFilePath = new OCFile(remotePath); - remoteFilePath.setFolder(); - } - @Override public void onCreateOptionsMenu(Menu menu, @NonNull MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); @@ -297,31 +268,28 @@ public class GalleryFragment extends OCFileListFragment implements GalleryFragme public boolean onOptionsItemSelected(MenuItem item) { // Handle item selection - if (item.getItemId() == R.id.action_three_dot_icon) { - if (!photoSearchQueryRunning) { - galleryFragmentBottomSheetDialog.show(); - return true; - } + if (item.getItemId() == R.id.action_three_dot_icon && !photoSearchQueryRunning + && galleryFragmentBottomSheetDialog != null) { + galleryFragmentBottomSheetDialog.show(getChildFragmentManager(),"data" ); + return true; } return super.onOptionsItemSelected(item); } @Override public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { - if (requestCode == SELECT_LOCATION_REQUEST_CODE) { - if (data != null) { - OCFile chosenFolder = data.getParcelableExtra(FolderPickerActivity.EXTRA_FOLDER); - if (chosenFolder != null) { - remoteFilePath = chosenFolder; - searchAndDisplayAfterChangingFolder(); - } + if (requestCode == SELECT_LOCATION_REQUEST_CODE && data != null) { + OCFile chosenFolder = data.getParcelableExtra(FolderPickerActivity.EXTRA_FOLDER); + if (chosenFolder != null) { + remoteFile = chosenFolder; + searchAndDisplayAfterChangingFolder(); } } super.onActivityResult(requestCode, resultCode, data); } private void searchAndDisplayAfterChangingFolder() { - mAdapter.resetAdapter(); + mAdapter.clear(); mediaObject.clear(); runGallerySearchTask(); } @@ -372,18 +340,17 @@ public class GalleryFragment extends OCFileListFragment implements GalleryFragme } @Override - public void updateMediaContent(boolean isHideVideos, boolean isHidePhotos) { + public void updateMediaContent(GalleryFragmentBottomSheetDialog.MediaState mediaState) { if (!mediaObject.isEmpty()) { - mAdapter.setAdapterWithHideShowImage(mediaObject, - isHideVideos, - isHidePhotos, imageList, videoList, - this); + mAdapter.setMediaFilter(mediaObject, + mediaState, + this); } else { setEmptyListMessage(SearchType.GALLERY_SEARCH); } - updateSubtitle(isHideVideos, isHidePhotos); + updateSubtitle(mediaState); } @@ -395,20 +362,19 @@ public class GalleryFragment extends OCFileListFragment implements GalleryFragme } public void showAllGalleryItems() { - mAdapter.showAllGalleryItems(mContainerActivity.getStorageManager(), remoteFilePath.getRemotePath(), - mediaObject, galleryFragmentBottomSheetDialog.isHideVideos(), - galleryFragmentBottomSheetDialog.isHideImages(), - imageList, videoList, this); + mAdapter.showAllGalleryItems(mContainerActivity.getStorageManager(), remoteFile.getRemotePath(), + mediaObject, galleryFragmentBottomSheetDialog.getCurrMediaState(), + this); - updateSubtitle(galleryFragmentBottomSheetDialog.isHideVideos(), galleryFragmentBottomSheetDialog.isHideImages()); + updateSubtitle(galleryFragmentBottomSheetDialog.getCurrMediaState()); } - private void updateSubtitle(boolean isHideVideos, boolean isHidePhotos) { + private void updateSubtitle(GalleryFragmentBottomSheetDialog.MediaState mediaState) { requireActivity().runOnUiThread(() -> { String subTitle = requireContext().getResources().getString(R.string.subtitle_photos_videos); - if (isHideVideos) { + if (mediaState == GalleryFragmentBottomSheetDialog.MediaState.MEDIA_STATE_PHOTOS_ONLY) { subTitle = requireContext().getResources().getString(R.string.subtitle_photos_only); - } else if (isHidePhotos) { + } else if (mediaState == GalleryFragmentBottomSheetDialog.MediaState.MEDIA_STATE_VIDEOS_ONLY) { subTitle = requireContext().getResources().getString(R.string.subtitle_videos_only); } if (requireActivity() instanceof ToolbarActivity) { diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/GalleryFragmentBottomSheetActions.java b/app/src/main/java/com/owncloud/android/ui/fragment/GalleryFragmentBottomSheetActions.kt similarity index 82% rename from app/src/main/java/com/owncloud/android/ui/fragment/GalleryFragmentBottomSheetActions.java rename to app/src/main/java/com/owncloud/android/ui/fragment/GalleryFragmentBottomSheetActions.kt index 35f79dd477..3efe2c18a9 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/GalleryFragmentBottomSheetActions.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/GalleryFragmentBottomSheetActions.kt @@ -19,18 +19,16 @@ * along with this program. If not, see . */ -package com.owncloud.android.ui.fragment; - -public interface GalleryFragmentBottomSheetActions { +package com.owncloud.android.ui.fragment +interface GalleryFragmentBottomSheetActions { /** * show/hide all the images & videos in particular Folder. */ - void updateMediaContent(boolean isHideVideos, boolean isHidePhotos); + fun updateMediaContent(mediaState: GalleryFragmentBottomSheetDialog.MediaState) /** * load all media of a particular folder. */ - void selectMediaFolder(); - -} + fun selectMediaFolder() +} \ No newline at end of file diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/GalleryFragmentBottomSheetDialog.java b/app/src/main/java/com/owncloud/android/ui/fragment/GalleryFragmentBottomSheetDialog.java deleted file mode 100644 index 15ec3dfcd8..0000000000 --- a/app/src/main/java/com/owncloud/android/ui/fragment/GalleryFragmentBottomSheetDialog.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * 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 . - */ - -package com.owncloud.android.ui.fragment; - -import android.os.Bundle; -import android.view.View; -import android.view.ViewGroup; - -import com.google.android.material.bottomsheet.BottomSheetBehavior; -import com.google.android.material.bottomsheet.BottomSheetDialog; -import com.nextcloud.client.preferences.AppPreferences; -import com.owncloud.android.R; -import com.owncloud.android.databinding.FragmentGalleryBottomSheetBinding; -import com.owncloud.android.ui.activity.FileActivity; - -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 BottomSheetBehavior mBottomBehavior; - private int currentMediaState = MEDIA_STATE_DEFAULT; - - public GalleryFragmentBottomSheetDialog(FileActivity fileActivity, - GalleryFragmentBottomSheetActions actions) { - super(fileActivity); - this.actions = actions; - } - - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - binding = FragmentGalleryBottomSheetBinding.inflate(getLayoutInflater()); - setContentView(binding.getRoot()); - - if (getWindow() != null) { - getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); - } - setupLayout(); - setupClickListener(); - mBottomBehavior = BottomSheetBehavior.from((View) binding.getRoot().getParent()); - } - - @Override - public void onStart() { - super.onStart(); - mBottomBehavior.setState(BottomSheetBehavior.STATE_EXPANDED); - } - - 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); - } - } - - private void setupClickListener() { - - binding.hideImages.setOnClickListener(v -> { - - if (currentMediaState == MEDIA_STATE_VIDEOS_ONLY) { - currentMediaState = MEDIA_STATE_DEFAULT; - } else { - currentMediaState = MEDIA_STATE_VIDEOS_ONLY; - } - notifyStateChange(); - dismiss(); - }); - - binding.hideVideo.setOnClickListener(v -> { - - if (currentMediaState == MEDIA_STATE_PHOTOS_ONLY) { - currentMediaState = MEDIA_STATE_DEFAULT; - } else { - currentMediaState = MEDIA_STATE_PHOTOS_ONLY; - } - notifyStateChange(); - dismiss(); - }); - - binding.selectMediaFolder.setOnClickListener(v -> { - - actions.selectMediaFolder(); - dismiss(); - }); - - } - - 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; - } - -} diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/GalleryFragmentBottomSheetDialog.kt b/app/src/main/java/com/owncloud/android/ui/fragment/GalleryFragmentBottomSheetDialog.kt new file mode 100644 index 0000000000..3c88d1ee8b --- /dev/null +++ b/app/src/main/java/com/owncloud/android/ui/fragment/GalleryFragmentBottomSheetDialog.kt @@ -0,0 +1,110 @@ +/* + * 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 . + */ +package com.owncloud.android.ui.fragment + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import com.google.android.material.bottomsheet.BottomSheetBehavior +import com.google.android.material.bottomsheet.BottomSheetDialogFragment +import com.owncloud.android.databinding.FragmentGalleryBottomSheetBinding + +class GalleryFragmentBottomSheetDialog( + private val actions: GalleryFragmentBottomSheetActions +) : BottomSheetDialogFragment() { + private lateinit var binding: FragmentGalleryBottomSheetBinding + private lateinit var mBottomBehavior: BottomSheetBehavior<*> + private var currentMediaState : MediaState = MediaState.MEDIA_STATE_DEFAULT + + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { + binding = FragmentGalleryBottomSheetBinding.inflate(layoutInflater,container, false) + return binding.root + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + setupLayout() + setupClickListener() + mBottomBehavior = BottomSheetBehavior.from(binding.root.parent as View) + } + + public override fun onStart() { + super.onStart() + mBottomBehavior.state = BottomSheetBehavior.STATE_EXPANDED + } + + private fun setupLayout() { + when (currentMediaState) { + MediaState.MEDIA_STATE_PHOTOS_ONLY -> { + binding.tickMarkShowImages.visibility = View.VISIBLE + binding.tickMarkShowVideo.visibility = View.GONE + } + MediaState.MEDIA_STATE_VIDEOS_ONLY -> { + binding.tickMarkShowImages.visibility = View.GONE + binding.tickMarkShowVideo.visibility = View.VISIBLE + } + else -> { + binding.tickMarkShowImages.visibility = View.VISIBLE + binding.tickMarkShowVideo.visibility = View.VISIBLE + } + } + } + + private fun setupClickListener() { + binding.hideImages.setOnClickListener { v: View? -> + currentMediaState = if (currentMediaState == MediaState.MEDIA_STATE_VIDEOS_ONLY) { + MediaState.MEDIA_STATE_DEFAULT + } else { + MediaState.MEDIA_STATE_VIDEOS_ONLY + } + notifyStateChange() + dismiss() + } + binding.hideVideo.setOnClickListener { v: View? -> + currentMediaState = if (currentMediaState == MediaState.MEDIA_STATE_PHOTOS_ONLY) { + MediaState.MEDIA_STATE_DEFAULT + } else { + MediaState.MEDIA_STATE_PHOTOS_ONLY + } + notifyStateChange() + dismiss() + } + binding.selectMediaFolder.setOnClickListener { v: View? -> + actions.selectMediaFolder() + dismiss() + } + } + + private fun notifyStateChange() { + setupLayout() + actions.updateMediaContent(currentMediaState) + } + + val currMediaState: MediaState + get() = currentMediaState + + enum class MediaState{ + MEDIA_STATE_DEFAULT, + MEDIA_STATE_PHOTOS_ONLY, + MEDIA_STATE_VIDEOS_ONLY + } +} \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_tick.xml b/app/src/main/res/drawable/ic_tick.xml index 269e7ca126..eebf792f3b 100644 --- a/app/src/main/res/drawable/ic_tick.xml +++ b/app/src/main/res/drawable/ic_tick.xml @@ -1,3 +1,23 @@ + . + --> @@ -64,7 +64,6 @@ android:layout_width="24dp" android:layout_height="24dp" android:layout_alignParentEnd="true" - android:layout_alignParentRight="true" android:contentDescription="@null" android:src="@drawable/ic_tick" android:visibility="gone" @@ -99,7 +98,7 @@ android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_marginStart="@dimen/standard_margin" - android:layout_toRightOf="@id/hideVideoImageView" + android:layout_toEndOf="@id/hideVideoImageView" android:text="@string/show_video" android:textColor="@color/text_color" android:textSize="@dimen/bottom_sheet_text_size" /> @@ -108,7 +107,7 @@ android:id="@+id/tickMarkShowVideo" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" android:contentDescription="@null" android:src="@drawable/ic_tick" android:visibility="gone"