Rebasing with master

This commit is contained in:
A117870935 2022-07-05 18:12:44 +05:30
parent de4eeb5004
commit 0c5b2309bc
6 changed files with 43 additions and 29 deletions

View file

@ -108,6 +108,12 @@ open class FolderPickerActivity :
mSearchOnlyFolders = true
isDoNotEnterEncryptedFolder = true
}
CHOOSE_LOCATION -> {
caption = resources.getText(R.string.choose_location).toString()
mSearchOnlyFolders = true
isDoNotEnterEncryptedFolder = true
mChooseBtn!!.text = resources.getString(R.string.common_select)
}
else -> caption = themeUtils.getDefaultDisplayNameForRootFolder(this)
}
} else {
@ -550,6 +556,7 @@ open class FolderPickerActivity :
const val MOVE = "MOVE"
const val COPY = "COPY"
const val CHOOSE_LOCATION = "CHOOSE_LOCATION"
private val TAG = FolderPickerActivity::class.java.simpleName
protected const val TAG_LIST_OF_FOLDERS = "LIST_OF_FOLDERS"
}

View file

@ -48,10 +48,10 @@ import com.owncloud.android.ui.interfaces.OCFileListFragmentInterface
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 com.owncloud.android.utils.MimeTypeUtil
import me.zhanghai.android.fastscroll.PopupTextProvider
import java.util.Calendar
import java.util.Date
@ -64,8 +64,8 @@ class GalleryAdapter(
transferServiceGetter: ComponentsGetter,
themeColorUtils: ThemeColorUtils,
themeDrawableUtils: ThemeDrawableUtils
) : SectionedRecyclerViewAdapter<SectionedViewHolder>(), CommonOCFileListAdapterInterface, SectionedAdapter {
private var files: List<GalleryItems> = mutableListOf()
) : SectionedRecyclerViewAdapter<SectionedViewHolder>(), CommonOCFileListAdapterInterface, PopupTextProvider {
var files: List<GalleryItems> = mutableListOf()
private val ocFileListDelegate: OCFileListDelegate
private var storageManager: FileDataStorageManager
@ -116,7 +116,11 @@ class GalleryAdapter(
val itemViewHolder = holder as GalleryItemViewHolder
val ocFile = files[section].files[relativePosition]
ocFileListDelegate.bindGridViewHolder(itemViewHolder, ocFile)
ocFileListDelegate.bindGridViewHolder(
itemViewHolder,
ocFile,
SearchType.GALLERY_SEARCH
)
}
}
@ -128,7 +132,7 @@ class GalleryAdapter(
return files.size
}
override fun getSectionName(position: Int): String {
override fun getPopupText(position: Int): String {
return DisplayUtils.getDateByPattern(
files[getRelativePosition(position).section()].date,
context,
@ -159,7 +163,6 @@ class GalleryAdapter(
@SuppressLint("NotifyDataSetChanged")
fun showAllGalleryItems(
storageManager: FileDataStorageManager,
remotePath: String,
mediaState: GalleryFragmentBottomSheetDialog.MediaState,
photoFragment: GalleryFragment
@ -226,10 +229,11 @@ class GalleryAdapter(
return files.isEmpty()
}
fun getItem(position: Int): OCFile {
fun getItem(position: Int): OCFile? {
val itemCoord = getRelativePosition(position)
return files[itemCoord.section()].files[itemCoord.relativePos()]
return files
.getOrNull(itemCoord.section())?.files
?.getOrNull(itemCoord.relativePos())
}
override fun isMultiSelect(): Boolean {

View file

@ -33,6 +33,7 @@ import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import com.nextcloud.utils.view.FastScroll;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
@ -140,26 +141,18 @@ public class GalleryFragment extends OCFileListFragment implements GalleryFragme
themeColorUtils,
themeDrawableUtils);
// val spacing = resources.getDimensionPixelSize(R.dimen.media_grid_spacing)
// binding.list.addItemDecoration(MediaGridItemDecoration(spacing))
setRecyclerViewAdapter(mAdapter);
GridLayoutManager layoutManager = new GridLayoutManager(getContext(), getColumnsCount());
// ((GridLayoutManager) layoutManager).setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
// @Override
// public int getSpanSize(int position) {
// if (position == getAdapter().getItemCount() - 1 ||
// position == 0 && getAdapter().shouldShowHeader()) {
// return ((GridLayoutManager) layoutManager).getSpanCount();
// } else {
// return 1;
// }
// }
// });
mAdapter.setLayoutManager(layoutManager);
getRecyclerView().setLayoutManager(layoutManager);
FastScroll.applyFastScroll(requireContext(),
themeColorUtils,
themeDrawableUtils,
getRecyclerView(),
new GalleryFastScrollViewHelper(getRecyclerView(), mAdapter));
}
@Override
@ -350,7 +343,7 @@ public class GalleryFragment extends OCFileListFragment implements GalleryFragme
}
public void showAllGalleryItems() {
mAdapter.showAllGalleryItems(mContainerActivity.getStorageManager(), remoteFile.getRemotePath(),
mAdapter.showAllGalleryItems(remoteFile.getRemotePath(),
galleryFragmentBottomSheetDialog.getCurrMediaState(),
this);

View file

@ -24,7 +24,6 @@
*/
package com.owncloud.android.utils.theme;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.text.Spannable;
import android.text.SpannableString;
@ -44,7 +43,7 @@ public final class ThemeMenuUtils {
* @param item the menu item object
* @param color the wanted color (as resource or color)
*/
public static void tintMenuItemText(MenuItem item, int color) {
public void tintMenuItemText(MenuItem item, int color) {
SpannableString newItemTitle = new SpannableString(item.getTitle());
newItemTitle.setSpan(new ForegroundColorSpan(color), 0, newItemTitle.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
@ -54,11 +53,10 @@ 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 static void tintMenuIcon(@NonNull Context context, @NonNull MenuItem item, int color) {
public void tintMenuIcon(@NonNull MenuItem item, int color) {
Drawable normalDrawable = item.getIcon();
Drawable wrapDrawable = DrawableCompat.wrap(normalDrawable);
DrawableCompat.setTint(wrapDrawable, color);

View file

@ -255,6 +255,7 @@
<string name="error_comment_file">Fehler beim Kommentieren der Datei</string>
<string name="error_crash_title">%1$s abgestürzt</string>
<string name="error_creating_file_from_template">Fehler beim Erzeugen einer Datei aus der Vorlage</string>
<string name="error_file_lock">Fehler beim Ändern des Sperr-Status</string>
<string name="error_report_issue_action">Melden</string>
<string name="error_report_issue_text">Problem melden? (benötigt ein GitHub-Konto)</string>
<string name="error_retrieving_file">Fehler beim Abruf der Datei</string>
@ -401,6 +402,10 @@
<string name="local_file_not_found_message">Die Datei wurde im lokalen Dateisystem nicht gefunden</string>
<string name="local_folder_friendly_path">%1$s/%2$s</string>
<string name="local_folder_list_empty">Hier gibt es keine weiteren Ordner.</string>
<string name="lock_expiration_info">Läuft ab: %1$s</string>
<string name="lock_file">Datei sperren</string>
<string name="locked_by">Gesperrt von %1$s</string>
<string name="locked_by_app">Gesperrt von der App %1$s</string>
<string name="log_send_mail_subject">%1$s Android-App Meldungen</string>
<string name="log_send_no_mail_app">Keine App zum Senden von Protokolldateien gefunden. Bitte installieren Sie einen E-Mail-Client.</string>
<string name="login">Anmelden</string>
@ -757,6 +762,7 @@
<string name="trashbin_file_not_restored">Datei %1$s konnte nicht wiederhergestellt werden!</string>
<string name="trashbin_loading_failed">Laden des Papierkorbs fehlgeschlagen!</string>
<string name="trashbin_not_emptied">Dateien konnten nicht endgültig gelöscht werden!</string>
<string name="unlock_file">Datei entsperren</string>
<string name="unread_comments">Es gibt ungelesene Kommentare</string>
<string name="unset_encrypted">Verschlüsselung aufheben</string>
<string name="unset_favorite">Aus den Favoriten entfernen</string>

View file

@ -1016,4 +1016,10 @@
<string name="select_media_folder">Set media folder</string>
<string name="choose_location">Choose location</string>
<string name="common_select">Select</string>
<string name="lock_file">Lock file</string>
<string name="unlock_file">Unlock file</string>
<string name="error_file_lock">Error changing file lock status</string>
<string name="locked_by">Locked by %1$s</string>
<string name="locked_by_app">Locked by %1$s app</string>
<string name="lock_expiration_info">Expires: %1$s</string>
</resources>