diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 64b94dc119d9..f5656bf51bea 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -260,6 +260,7 @@ android:exported="false" /> @@ -280,6 +281,7 @@ android:exported="false" /> @@ -386,6 +388,7 @@ = Build.VERSION_CODES.O) { contentDescription = getString(R.string.common_save) } + // NMC customization + icon = icon?.let { + viewThemeUtils.platform.colorDrawable( + it, + ContextCompat.getColor(this@EditImageActivity, R.color.fontAppbar) + ) + } } return true } diff --git a/app/src/main/java/com/nextcloud/ui/fileactions/FileActionsBottomSheet.kt b/app/src/main/java/com/nextcloud/ui/fileactions/FileActionsBottomSheet.kt index 1269459f2a94..187682fdd11b 100644 --- a/app/src/main/java/com/nextcloud/ui/fileactions/FileActionsBottomSheet.kt +++ b/app/src/main/java/com/nextcloud/ui/fileactions/FileActionsBottomSheet.kt @@ -140,7 +140,8 @@ class FileActionsBottomSheet : BottomSheetDialogFragment(), Injectable { binding.thumbnailLayout.thumbnailShimmer, syncedFolderProvider.preferences, viewThemeUtils, - syncedFolderProvider + syncedFolderProvider, + false ) } } diff --git a/app/src/main/java/com/nmc/android/ui/utils/Log_NMC.kt b/app/src/main/java/com/nmc/android/ui/utils/Log_NMC.kt new file mode 100644 index 000000000000..e111bbd395a7 --- /dev/null +++ b/app/src/main/java/com/nmc/android/ui/utils/Log_NMC.kt @@ -0,0 +1,42 @@ +package com.nmc.android.ui.utils + +import com.owncloud.android.BuildConfig +import com.owncloud.android.lib.common.utils.Log_OC + +/** + * NMC log interpreter class + * this class will be used whenever we have to reduce the logs writing + * this will avoid printing logs in release builds + * todo: can be extended later for more functions + */ +object Log_NMC { + @JvmStatic + fun v(tag: String?, msg: String?) { + if (BuildConfig.DEBUG) Log_OC.v(tag, msg) + } + + @JvmStatic + fun d(tag: String?, msg: String?) { + if (BuildConfig.DEBUG) Log_OC.d(tag, msg) + } + + @JvmStatic + fun d(tag: String, msg: String, e: Exception) { + if (BuildConfig.DEBUG) Log_OC.d(tag, msg, e) + } + + @JvmStatic + fun i(tag: String?, msg: String?) { + if (BuildConfig.DEBUG) Log_OC.i(tag, msg) + } + + @JvmStatic + fun e(tag: String?, msg: String?) { + if (BuildConfig.DEBUG) Log_OC.e(tag, msg) + } + + @JvmStatic + fun w(tag: String?, msg: String?) { + if (BuildConfig.DEBUG) Log_OC.w(tag, msg) + } +} diff --git a/app/src/main/java/com/owncloud/android/MainApp.java b/app/src/main/java/com/owncloud/android/MainApp.java index e38bb9b72548..e1f276547a90 100644 --- a/app/src/main/java/com/owncloud/android/MainApp.java +++ b/app/src/main/java/com/owncloud/android/MainApp.java @@ -950,11 +950,8 @@ public AndroidInjector androidInjector() { } public static void setAppTheme(DarkMode mode) { - switch (mode) { - case LIGHT -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); - case DARK -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); - case SYSTEM -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM); - } + // NMC Customization -> Always follow system theme + AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM); } @Override diff --git a/app/src/main/java/com/owncloud/android/datamodel/MediaProvider.java b/app/src/main/java/com/owncloud/android/datamodel/MediaProvider.java index c3dd31c29290..03e3e025e57f 100644 --- a/app/src/main/java/com/owncloud/android/datamodel/MediaProvider.java +++ b/app/src/main/java/com/owncloud/android/datamodel/MediaProvider.java @@ -12,8 +12,8 @@ import android.net.Uri; import android.provider.MediaStore; +import com.nmc.android.ui.utils.Log_NMC; import com.owncloud.android.MainApp; -import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.utils.PermissionUtil; import com.owncloud.android.utils.theme.ViewThemeUtils; @@ -107,7 +107,7 @@ public static List getImageFolders(ContentResolver contentResolver, MediaStore.Images.Media.DATE_TAKEN, ContentResolverHelper.SORT_DIRECTION_DESCENDING, itemLimit); - Log_OC.d(TAG, "Reading images for " + mediaFolder.folderName); + Log_NMC.d(TAG, "Reading images for " + mediaFolder.folderName); if (cursorImages != null) { String filePath; @@ -217,7 +217,7 @@ public static List getVideoFolders(ContentResolver contentResolver, ContentResolverHelper.SORT_DIRECTION_DESCENDING, itemLimit); - Log_OC.d(TAG, "Reading videos for " + mediaFolder.folderName); + Log_NMC.d(TAG, "Reading videos for " + mediaFolder.folderName); if (cursorVideos != null) { String filePath; diff --git a/app/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java b/app/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java index 0cadc34a19c8..a5f619e9f4aa 100644 --- a/app/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java +++ b/app/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java @@ -36,6 +36,7 @@ import com.nextcloud.client.account.User; import com.nextcloud.client.network.ConnectivityService; +import com.nmc.android.ui.utils.Log_NMC; import com.owncloud.android.MainApp; import com.owncloud.android.R; import com.owncloud.android.lib.common.OwnCloudAccount; @@ -123,7 +124,7 @@ protected Void doInBackground(File... params) { } String cachePath = cacheDir.getPath() + File.separator + CACHE_FOLDER; - Log_OC.d(TAG, "thumbnail cache dir: " + cachePath); + Log_NMC.d(TAG, "thumbnail cache dir: " + cachePath); File diskCacheDir = new File(cachePath); // migrate from external cache to internal cache @@ -140,7 +141,7 @@ protected Void doInBackground(File... params) { mThumbnailCache = new DiskLruImageCache(diskCacheDir, DISK_CACHE_SIZE, mCompressFormat, mCompressQuality); } catch (Exception e) { - Log_OC.d(TAG, "Disk cache init failed", e); + Log_NMC.d(TAG, "Disk cache init failed", e); mThumbnailCache = null; } } @@ -723,7 +724,7 @@ private Bitmap doThumbnailFromOCFileInBackground() { file.getLocalId() + "&x=" + pxW + "&y=" + pxH; } - Log_OC.d(TAG, "generate thumbnail: " + file.getFileName() + " URI: " + uri); + Log_NMC.d(TAG, "generate thumbnail: " + file.getFileName() + " URI: " + uri); getMethod = new GetMethod(uri); getMethod.setRequestHeader("Cookie", "nc_sameSiteCookielax=true;nc_sameSiteCookiestrict=true"); @@ -756,7 +757,7 @@ private Bitmap doThumbnailFromOCFileInBackground() { // Add thumbnail to cache if (thumbnail != null) { - Log_OC.d(TAG, "add thumbnail to cache: " + file.getFileName()); + Log_NMC.d(TAG, "add thumbnail to cache: " + file.getFileName()); addBitmapToCache(imageKey, thumbnail); } } @@ -926,13 +927,13 @@ private Bitmap doFileInBackground(File file, Type type) { thumbnail = retriever.getFrameAtTime(-1); } catch (Exception ex) { // can't create a bitmap - Log_OC.w(TAG, "Failed to create bitmap from video " + file.getAbsolutePath()); + Log_NMC.w(TAG, "Failed to create bitmap from video " + file.getAbsolutePath()); } finally { try { retriever.release(); } catch (RuntimeException | IOException ex) { // Ignore failure at this point. - Log_OC.w(TAG, "Failed release MediaMetadataRetriever for " + file.getAbsolutePath()); + Log_NMC.w(TAG, "Failed release MediaMetadataRetriever for " + file.getAbsolutePath()); } } @@ -1051,7 +1052,7 @@ Drawable doAvatarInBackground() { int px = mResources.getInteger(R.integer.file_avatar_px); String uri = mClient.getBaseUri() + "/index.php/avatar/" + Uri.encode(mUserId) + "/" + px; - Log_OC.d("Avatar", "URI: " + uri); + Log_NMC.d("Avatar", "URI: " + uri); get = new GetMethod(uri); // only use eTag if available and corresponding avatar is still there @@ -1325,7 +1326,7 @@ public static void generateThumbnailFromOCFile(OCFile file, User user, Context c String uri = client.getBaseUri() + "/index.php/apps/files/api/v1/thumbnail/" + pxW + "/" + pxH + Uri.encode(file.getRemotePath(), "/"); - Log_OC.d(TAG, "generate thumbnail: " + file.getFileName() + " URI: " + uri); + Log_NMC.d(TAG, "generate thumbnail: " + file.getFileName() + " URI: " + uri); getMethod = new GetMethod(uri); getMethod.setRequestHeader("Cookie", "nc_sameSiteCookielax=true;nc_sameSiteCookiestrict=true"); @@ -1348,7 +1349,7 @@ public static void generateThumbnailFromOCFile(OCFile file, User user, Context c thumbnail = handlePNG(thumbnail, pxW, pxH); } - Log_OC.d(TAG, "add thumbnail to cache: " + file.getFileName()); + Log_NMC.d(TAG, "add thumbnail to cache: " + file.getFileName()); addBitmapToCache(imageKey, thumbnail); } } catch (Exception e) { @@ -1402,7 +1403,7 @@ private static Bitmap doResizedImageInBackground(OCFile file, FileDataStorageMan String uri = mClient.getBaseUri() + "/index.php/core/preview?fileId=" + file.getRemoteId() + "&x=" + (pxW / 2) + "&y=" + (pxH / 2) + "&a=1&mode=cover&forceIcon=0"; - Log_OC.d(TAG, "generate resized image: " + file.getFileName() + " URI: " + uri); + Log_NMC.d(TAG, "generate resized image: " + file.getFileName() + " URI: " + uri); getMethod = new GetMethod(uri); int status = mClient.executeMethod(getMethod); @@ -1420,7 +1421,7 @@ private static Bitmap doResizedImageInBackground(OCFile file, FileDataStorageMan // Add thumbnail to cache if (thumbnail != null) { - Log_OC.d(TAG, "add resized image to cache: " + file.getFileName()); + Log_NMC.d(TAG, "add resized image to cache: " + file.getFileName()); addBitmapToCache(imageKey, thumbnail); } 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 b7b9b2dc14ac..9c7c86a3bdf3 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 @@ -391,7 +391,8 @@ protected void onPostCreate(Bundle savedInstanceState) { onOpenFileIntent(getIntent()); } else if (RESTART.equals(getIntent().getAction())) { // most likely switched to different account - DisplayUtils.showSnackMessage(this, String.format(getString(R.string.logged_in_as), accountManager.getUser().getAccountName())); + // NMC-2576 --> Disabling switch account snackbar for NMC + /*DisplayUtils.showSnackMessage(this, String.format(getString(R.string.logged_in_as), accountManager.getUser().getAccountName()));*/ } upgradeNotificationForInstantUpload(); @@ -468,6 +469,9 @@ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permis if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { // permission was granted getOCFileListFragmentFromFile().directCameraUpload(); + } else if (!shouldShowRequestPermissionRationale(permissions[0])) { + // user CHECKED "never ask again" + DisplayUtils.showSnackMessage(this, R.string.camera_permission_rationale); } break; default: diff --git a/app/src/main/java/com/owncloud/android/ui/activity/PassCodeActivity.kt b/app/src/main/java/com/owncloud/android/ui/activity/PassCodeActivity.kt index 77088066ea0f..929f9b63e7a3 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/PassCodeActivity.kt +++ b/app/src/main/java/com/owncloud/android/ui/activity/PassCodeActivity.kt @@ -21,7 +21,6 @@ import androidx.annotation.VisibleForTesting import androidx.appcompat.app.AppCompatActivity import androidx.lifecycle.lifecycleScope import com.google.android.material.snackbar.Snackbar -import com.nextcloud.android.common.ui.theme.utils.ColorRole import com.nextcloud.client.di.Injectable import com.nextcloud.client.preferences.AppPreferences import com.owncloud.android.R @@ -80,30 +79,18 @@ class PassCodeActivity : AppCompatActivity(), Injectable { setContentView(binding.root) PassCodeManager.setSecureFlag(this, true) - applyTint() setupPasscodeEditTexts() setSoftInputMode() setupUI(savedInstanceState) setTextListeners() } - private fun applyTint() { - viewThemeUtils.platform.colorViewBackground(binding.cardViewContent, ColorRole.SURFACE_VARIANT) - viewThemeUtils.material.colorMaterialButtonPrimaryBorderless(binding.cancel) - } - private fun setupPasscodeEditTexts() { passCodeEditTexts[0] = binding.txt0 passCodeEditTexts[1] = binding.txt1 passCodeEditTexts[2] = binding.txt2 passCodeEditTexts[3] = binding.txt3 - passCodeEditTexts.forEach { - it?.let { editText -> - viewThemeUtils.platform.colorEditText(editText) - } - } - passCodeEditTexts[0]?.requestFocus() binding.cardViewContent.setOnClickListener { 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 b612c7960b1b..fccc4bea5bb0 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 @@ -74,7 +74,8 @@ class GalleryAdapter( transferServiceGetter, showMetadata = false, showShareAvatar = false, - viewThemeUtils + viewThemeUtils, + true ) } diff --git a/app/src/main/java/com/owncloud/android/ui/adapter/LocalFileListAdapter.java b/app/src/main/java/com/owncloud/android/ui/adapter/LocalFileListAdapter.java index 16c032707a29..3f5a14132553 100644 --- a/app/src/main/java/com/owncloud/android/ui/adapter/LocalFileListAdapter.java +++ b/app/src/main/java/com/owncloud/android/ui/adapter/LocalFileListAdapter.java @@ -179,8 +179,7 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi if (isCheckedFile(file)) { gridViewHolder.itemLayout.setBackgroundColor(ContextCompat.getColor(mContext, R.color.selected_item_background)); - gridViewHolder.checkbox.setImageDrawable( - viewThemeUtils.platform.tintDrawable(mContext, R.drawable.ic_checkbox_marked, ColorRole.PRIMARY)); + gridViewHolder.checkbox.setImageResource(R.drawable.ic_checkbox_marked); } else { gridViewHolder.itemLayout.setBackgroundColor(mContext.getResources().getColor(R.color.bg_default)); gridViewHolder.checkbox.setImageResource(R.drawable.ic_checkbox_blank_outline); diff --git a/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java b/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java index eba470e3697d..676a2e95d4b9 100644 --- a/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java +++ b/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java @@ -189,6 +189,7 @@ public OCFileListAdapter( .getVersion() .isShareesOnDavSupported(), viewThemeUtils, + false, syncedFolderProvider); setHasStableIds(true); @@ -381,6 +382,8 @@ public boolean isEmpty() { @Override public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { switch (viewType) { + // change required for NMC + // default case will be used for VIEW_TYPE_IMAGE & VIEWTYPE_ITEM also default -> { if (gridView) { return new OCFileListGridItemViewHolder( @@ -392,17 +395,6 @@ public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int ); } } - case VIEW_TYPE_IMAGE -> { - if (gridView) { - return new OCFileListViewHolder( - GridImageBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false) - ); - } else { - return new OCFileListItemViewHolder( - ListItemBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false) - ); - } - } case VIEW_TYPE_FOOTER -> { return new OCFileListFooterViewHolder( ListFooterBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false) @@ -426,7 +418,6 @@ public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { if (holder instanceof OCFileListFooterViewHolder footerViewHolder) { footerViewHolder.getFooterText().setText(getFooterText()); - viewThemeUtils.platform.colorCircularProgressBar(footerViewHolder.getLoadingProgressBar(), ColorRole.ON_SURFACE_VARIANT); footerViewHolder.getLoadingProgressBar().setVisibility( ocFileListFragmentInterface.isLoading() ? View.VISIBLE : View.GONE); } else if (holder instanceof OCFileListHeaderViewHolder headerViewHolder) { @@ -520,15 +511,10 @@ private void updateLivePhotoIndicators(ListViewHolder holder, OCFile file) { private void bindListGridItemViewHolder(ListGridItemViewHolder holder, OCFile file) { holder.getFileName().setText(file.getDecryptedFileName()); - boolean gridImage = MimeTypeUtil.isImage(file) || MimeTypeUtil.isVideo(file); - if (gridView && gridImage) { + if (gridView && ocFileListFragmentInterface.getColumnsCount() > showFilenameColumnThreshold) { holder.getFileName().setVisibility(View.GONE); } else { - if (gridView && ocFileListFragmentInterface.getColumnsCount() > showFilenameColumnThreshold) { - holder.getFileName().setVisibility(View.GONE); - } else { - holder.getFileName().setVisibility(View.VISIBLE); - } + holder.getFileName().setVisibility(View.VISIBLE); } ViewExtensionsKt.setVisibleIf(holder.getShared(), !file.isOfflineOperation()); @@ -764,7 +750,7 @@ public boolean shouldShowHeader() { return false; } - if (MainApp.isOnlyOnDevice()) { + if (MainApp.isOnlyOnDevice() || ocFileListFragmentInterface.isSearchFragment()) { return false; } @@ -1203,6 +1189,7 @@ public void cancelAllPendingTasks() { public void setGridView(boolean bool) { gridView = bool; + ocFileListDelegate.setGridView(bool); } public void setShowMetadata(boolean bool) { diff --git a/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListDelegate.kt b/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListDelegate.kt index dff220e2a3bd..a4ed0f771653 100644 --- a/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListDelegate.kt +++ b/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListDelegate.kt @@ -48,11 +48,12 @@ class OCFileListDelegate( private val storageManager: FileDataStorageManager, private val hideItemOptions: Boolean, private val preferences: AppPreferences, - private val gridView: Boolean, + private var gridView: Boolean, private val transferServiceGetter: ComponentsGetter, private val showMetadata: Boolean, private var showShareAvatar: Boolean, private var viewThemeUtils: ViewThemeUtils, + private val isMediaGallery: Boolean, private val syncFolderProvider: SyncedFolderProvider? = null ) { private val checkedFiles: MutableSet = HashSet() @@ -214,7 +215,8 @@ class OCFileListDelegate( gridViewHolder.shimmerThumbnail, preferences, viewThemeUtils, - syncFolderProvider + syncFolderProvider, + isMediaGallery ) // item layout + click listeners @@ -238,7 +240,8 @@ class OCFileListDelegate( // shares val shouldHideShare = ( - hideItemOptions || + gridView || // NMC: don't show share icon in grid mode + hideItemOptions || !file.isFolder && file.isEncrypted || file.isEncrypted && @@ -315,9 +318,8 @@ class OCFileListDelegate( private fun setCheckBoxImage(file: OCFile, gridViewHolder: ListViewHolder) { if (isCheckedFile(file)) { - gridViewHolder.checkbox.setImageDrawable( - viewThemeUtils.platform.tintDrawable(context, R.drawable.ic_checkbox_marked, ColorRole.PRIMARY) - ) + // NMC Customization + gridViewHolder.checkbox.setImageResource(R.drawable.ic_checkbox_marked) } else { gridViewHolder.checkbox.setImageResource(R.drawable.ic_checkbox_blank_outline) } @@ -405,6 +407,10 @@ class OCFileListDelegate( showShareAvatar = bool } + fun setGridView(bool: Boolean){ + gridView = bool + } + companion object { private val TAG = OCFileListDelegate::class.java.simpleName } diff --git a/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListGridItemViewHolder.kt b/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListGridItemViewHolder.kt index 05ee4731e994..013d92ca28ef 100644 --- a/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListGridItemViewHolder.kt +++ b/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListGridItemViewHolder.kt @@ -53,8 +53,8 @@ internal class OCFileListGridItemViewHolder(var binding: GridItemBinding) : get() = null override val livePhotoIndicatorSeparator: TextView? get() = null - override val fileFeaturesLayout: LinearLayout - get() = binding.fileFeaturesLayout + override val fileFeaturesLayout: LinearLayout? + get() = null override val more: ImageButton get() = binding.more diff --git a/app/src/main/java/com/owncloud/android/ui/adapter/UploadListAdapter.java b/app/src/main/java/com/owncloud/android/ui/adapter/UploadListAdapter.java index e4d08e2335d6..0a5f4b2b1b71 100755 --- a/app/src/main/java/com/owncloud/android/ui/adapter/UploadListAdapter.java +++ b/app/src/main/java/com/owncloud/android/ui/adapter/UploadListAdapter.java @@ -100,7 +100,8 @@ public void onBindHeaderViewHolder(SectionedViewHolder holder, int section, bool headerViewHolder.binding.uploadListTitle.setText( String.format(parentActivity.getString(R.string.uploads_view_group_header), group.getGroupName(), group.getGroupItemCount())); - viewThemeUtils.platform.colorPrimaryTextViewElement(headerViewHolder.binding.uploadListTitle); + //NMC Customization + headerViewHolder.binding.uploadListTitle.setTextColor(parentActivity.getResources().getColor(R.color.primary, null)); headerViewHolder.binding.uploadListTitle.setOnClickListener(v -> { toggleSectionExpanded(section); diff --git a/app/src/main/java/com/owncloud/android/ui/dialog/ConflictsResolveDialog.kt b/app/src/main/java/com/owncloud/android/ui/dialog/ConflictsResolveDialog.kt index bda667cd6b08..bd5c5e1ee0fe 100644 --- a/app/src/main/java/com/owncloud/android/ui/dialog/ConflictsResolveDialog.kt +++ b/app/src/main/java/com/owncloud/android/ui/dialog/ConflictsResolveDialog.kt @@ -229,7 +229,8 @@ class ConflictsResolveDialog : DialogFragment(), Injectable { null, syncedFolderProvider.preferences, viewThemeUtils, - syncedFolderProvider + syncedFolderProvider, + false ) } diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java index 812974d98083..d8f54233aeb6 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java @@ -1702,13 +1702,23 @@ protected void setTitle() { setTitle(R.string.drawer_item_shared); break; default: - setTitle(themeUtils.getDefaultDisplayNameForRootFolder(getContext()), false); + setTitle(themeUtils.getDefaultDisplayNameForRootFolder(getContext()), isRoot()); break; } } } + //NMC Customization + //for NMC we are using defaultToolbar instead searchToolbar for which we needed customization + private boolean isRoot() { + Activity activity; + if ((activity = getActivity()) != null && activity instanceof FileDisplayActivity) { + return ((FileDisplayActivity) activity).isRoot(((FileDisplayActivity) activity).getFile()); + } + return false; + } + protected void prepareActionBarItems(SearchEvent event) { if (event != null) { switch (event.getSearchType()) { @@ -1769,7 +1779,7 @@ public void onMessageEvent(ChangeMenuEvent changeMenuEvent) { ((FileDisplayActivity) activity).initSyncBroadcastReceiver(); } - setTitle(themeUtils.getDefaultDisplayNameForRootFolder(getContext()), false); + setTitle(themeUtils.getDefaultDisplayNameForRootFolder(getContext()), isRoot()); activity.getIntent().removeExtra(OCFileListFragment.SEARCH_EVENT); } diff --git a/app/src/main/java/com/owncloud/android/ui/interfaces/OCFileListFragmentInterface.java b/app/src/main/java/com/owncloud/android/ui/interfaces/OCFileListFragmentInterface.java index 2d47d841299e..0b6c577e65cc 100644 --- a/app/src/main/java/com/owncloud/android/ui/interfaces/OCFileListFragmentInterface.java +++ b/app/src/main/java/com/owncloud/android/ui/interfaces/OCFileListFragmentInterface.java @@ -35,4 +35,6 @@ public interface OCFileListFragmentInterface { boolean isLoading(); void onHeaderClicked(); + + boolean isSearchFragment(); } diff --git a/app/src/main/java/com/owncloud/android/utils/DisplayUtils.java b/app/src/main/java/com/owncloud/android/utils/DisplayUtils.java index 106916fb6e93..0be098d6a1d0 100644 --- a/app/src/main/java/com/owncloud/android/utils/DisplayUtils.java +++ b/app/src/main/java/com/owncloud/android/utils/DisplayUtils.java @@ -860,9 +860,13 @@ public static void setThumbnail(OCFile file, LoaderImageView shimmerThumbnail, AppPreferences preferences, ViewThemeUtils viewThemeUtils, - SyncedFolderProvider syncedFolderProvider) { + SyncedFolderProvider syncedFolderProvider, + boolean isMediaGallery) { if (file.isFolder()) { stopShimmer(shimmerThumbnail, thumbnailView); + updateThumbnailViewSize(thumbnailView, gridView, context, isMediaGallery, R.dimen.standard_folders_grid_item_size); + //reset the padding as this will change for files and we don't this for folders + thumbnailView.setPadding(0, 0, 0, 0); boolean isAutoUploadFolder = SyncedFolderProvider.isAutoUploadFolder(syncedFolderProvider, file, user); boolean isDarkModeActive = preferences.isDarkModeEnabled(); @@ -871,26 +875,28 @@ public static void setThumbnail(OCFile file, LayerDrawable fileIcon = MimeTypeUtil.getFileIcon(isDarkModeActive, overlayIconId, context, viewThemeUtils); thumbnailView.setImageDrawable(fileIcon); } else { + updateThumbnailViewSize(thumbnailView, gridView, context, isMediaGallery, R.dimen.standard_files_grid_item_size); if (file.getRemoteId() != null && file.isPreviewAvailable()) { // Thumbnail in cache? Bitmap thumbnail = ThumbnailsCacheManager.getBitmapFromDiskCache( ThumbnailsCacheManager.PREFIX_THUMBNAIL + file.getRemoteId()); if (thumbnail != null && !file.isUpdateThumbnailNeeded()) { + setThumbnailViewPadding(thumbnailView, gridView, context, isMediaGallery, R.dimen.alternate_padding); stopShimmer(shimmerThumbnail, thumbnailView); if (MimeTypeUtil.isVideo(file)) { - Bitmap withOverlay = ThumbnailsCacheManager.addVideoOverlay(thumbnail, context); - thumbnailView.setImageBitmap(withOverlay); + thumbnail = ThumbnailsCacheManager.addVideoOverlay(thumbnail, context); + } + + // NMC: set the corner for both video and image thumbnail + if (gridView) { + BitmapUtils.setRoundedBitmapForGridMode(thumbnail, thumbnailView); } else { - if (gridView) { - BitmapUtils.setRoundedBitmapForGridMode(thumbnail, thumbnailView); - } else { - BitmapUtils.setRoundedBitmap(thumbnail, thumbnailView); - } + BitmapUtils.setRoundedBitmap(thumbnail, thumbnailView); } } else { - generateNewThumbnail(file, thumbnailView, user, storageManager, asyncTasks, gridView, context, shimmerThumbnail, preferences, viewThemeUtils); + generateNewThumbnail(file, thumbnailView, user, storageManager, asyncTasks, gridView, context, shimmerThumbnail, preferences, viewThemeUtils, isMediaGallery); } if ("image/png".equalsIgnoreCase(file.getMimeType())) { @@ -898,9 +904,10 @@ public static void setThumbnail(OCFile file, } } else { if (file.getRemoteId() != null) { - generateNewThumbnail(file, thumbnailView, user, storageManager, asyncTasks, gridView, context, shimmerThumbnail, preferences, viewThemeUtils); + generateNewThumbnail(file, thumbnailView, user, storageManager, asyncTasks, gridView, context, shimmerThumbnail, preferences, viewThemeUtils, isMediaGallery); } else { stopShimmer(shimmerThumbnail, thumbnailView); + setThumbnailViewPadding(thumbnailView, gridView, context, isMediaGallery, R.dimen.standard_quarter_padding); thumbnailView.setImageDrawable(MimeTypeUtil.getFileTypeIcon(file.getMimeType(), file.getFileName(), context, @@ -919,7 +926,8 @@ private static void generateNewThumbnail(OCFile file, Context context, LoaderImageView shimmerThumbnail, AppPreferences preferences, - ViewThemeUtils viewThemeUtils) { + ViewThemeUtils viewThemeUtils, + boolean isMediaGallery) { if (!ThumbnailsCacheManager.cancelPotentialThumbnailWork(file, thumbnailView)) { return; } @@ -964,6 +972,10 @@ private static void generateNewThumbnail(OCFile file, int px = ThumbnailsCacheManager.getThumbnailDimension(); thumbnail = BitmapUtils.drawableToBitmap(drawable, px, px); + + //NMC: set thumbnailView padding for no thumbnail + setThumbnailViewPadding(thumbnailView, gridView, context, isMediaGallery, R.dimen.standard_quarter_padding); + final ThumbnailsCacheManager.AsyncThumbnailDrawable asyncDrawable = new ThumbnailsCacheManager.AsyncThumbnailDrawable(context.getResources(), thumbnail, task); @@ -971,9 +983,6 @@ private static void generateNewThumbnail(OCFile file, if (shimmerThumbnail != null) { shimmerThumbnail.postDelayed(() -> { if (thumbnailView.getDrawable() == null) { - if (gridView) { - configShimmerGridImageSize(shimmerThumbnail, preferences.getGridColumns()); - } startShimmer(shimmerThumbnail, thumbnailView); } }, 100); @@ -1045,4 +1054,41 @@ private static Point getScreenSize(Context context) throws Exception { throw new Exception("WindowManager not found"); } } + + /** + * method to set the padding to thumbnail view this is required for files so that there will be space between file + * and file name + * + * @param thumbnailView + * @param gridView + * @param context + * @param isMediaGallery + * @param dimensPadding + */ + private static void setThumbnailViewPadding(ImageView thumbnailView, boolean gridView, Context context, + boolean isMediaGallery, int dimensPadding) { + if (gridView && !isMediaGallery) { + int padding = context.getResources().getDimensionPixelSize(dimensPadding); + thumbnailView.setPadding(0, 0, 0, padding); + } + } + + /** + * method to set manual thumbnail view height and width for folders and files because we are using different size + * for both files and folders + * + * @param thumbnailView + * @param gridView + * @param context + * @param isMediaGallery + * @param size + */ + private static void updateThumbnailViewSize(ImageView thumbnailView, boolean gridView, Context context, + boolean isMediaGallery, int size) { + if (gridView && !isMediaGallery) { + thumbnailView.getLayoutParams().width = + context.getResources().getDimensionPixelSize(size); + thumbnailView.getLayoutParams().height = context.getResources().getDimensionPixelSize(size); + } + } } diff --git a/app/src/main/res/drawable/cursor_drawable.xml b/app/src/main/res/drawable/cursor_drawable.xml new file mode 100644 index 000000000000..dd35b659e8ae --- /dev/null +++ b/app/src/main/res/drawable/cursor_drawable.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/layout/activity_edit_image.xml b/app/src/main/res/layout/activity_edit_image.xml index 4b11869ee501..257ba56fa732 100644 --- a/app/src/main/res/layout/activity_edit_image.xml +++ b/app/src/main/res/layout/activity_edit_image.xml @@ -12,15 +12,10 @@ android:layout_height="match_parent" android:background="@color/black"> - + + + app:layout_constraintTop_toBottomOf="@+id/appbar" /> @@ -82,7 +81,7 @@ android:layout_height="wrap_content" android:text="@string/daily_backup" android:textColor="@color/text_color" - android:textSize="@dimen/two_line_primary_text_size" /> + android:textSize="14sp" /> diff --git a/app/src/main/res/layout/file_details_fragment.xml b/app/src/main/res/layout/file_details_fragment.xml index 9466d4638d35..1340f98f569a 100644 --- a/app/src/main/res/layout/file_details_fragment.xml +++ b/app/src/main/res/layout/file_details_fragment.xml @@ -49,8 +49,8 @@ + tools:src="@drawable/folder" /> - - - - - + android:layout_height="0.5dp" + android:background="@color/divider_color" /> - + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:gravity="center" + android:orientation="vertical"> - - + android:layout_width="match_parent" + android:layout_height="wrap_content"> - + - + android:layout_gravity="center_horizontal" + app:layout_constraintBottom_toTopOf="@+id/Filename" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent"> + + + android:id="@+id/thumbnail" + android:layout_width="@dimen/standard_folders_grid_item_size" + android:layout_height="@dimen/standard_folders_grid_item_size" + android:layout_gravity="center" + android:contentDescription="@null" + android:src="@drawable/folder" + tools:visibility="visible" /> + app:tint="@color/list_icon_color" /> + android:visibility="gone" /> + android:src="@drawable/ic_synced" /> + + - + + app:layout_constraintBottom_toTopOf="@+id/gridItemGuideline" + app:layout_constraintStart_toStartOf="@+id/frameLayout" /> + app:srcCompat="@drawable/ic_dots_vertical" + app:tint="@color/list_icon_color" + tools:ignore="TouchTargetSizeCheck" /> - + \ No newline at end of file diff --git a/app/src/main/res/layout/list_item.xml b/app/src/main/res/layout/list_item.xml index 536940b0bfde..991dae3b12b3 100644 --- a/app/src/main/res/layout/list_item.xml +++ b/app/src/main/res/layout/list_item.xml @@ -15,19 +15,17 @@ xmlns:tools="http://schemas.android.com/tools" android:id="@+id/ListItemLayout" android:layout_width="match_parent" - android:layout_height="wrap_content" + android:layout_height="@dimen/standard_list_item_size" android:baselineAligned="false" android:descendantFocusability="blocksDescendants" - android:minHeight="@dimen/standard_list_item_size" - android:orientation="horizontal" - android:paddingTop="@dimen/standard_half_padding" - android:paddingBottom="@dimen/standard_half_padding"> + android:orientation="horizontal"> + android:layout_marginEnd="@dimen/standard_quarter_padding" + android:layout_marginBottom="@dimen/standard_padding"> + android:paddingTop="@dimen/standard_padding"> + tools:visibility="visible" + app:tint="@color/list_icon_color" /> @@ -275,15 +270,15 @@ + android:src="@drawable/ic_dots_vertical" + app:tint="@color/list_icon_color" /> diff --git a/app/src/main/res/layout/receive_external_files.xml b/app/src/main/res/layout/receive_external_files.xml index 1f85eae78a32..d25f4afcafb3 100644 --- a/app/src/main/res/layout/receive_external_files.xml +++ b/app/src/main/res/layout/receive_external_files.xml @@ -11,6 +11,7 @@ android:id="@+id/upload_files_layout" android:layout_width="match_parent" android:layout_height="match_parent" + android:background="@color/bg_default" android:orientation="vertical"> @@ -221,6 +222,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:ellipsize="marquee" + android:maxLines="2" android:text="@string/instant_upload_existing" android:textAppearance="?attr/textAppearanceListItem" /> diff --git a/app/src/main/res/layout/trashbin_item.xml b/app/src/main/res/layout/trashbin_item.xml index 3124e49dc442..126537e3eaf1 100644 --- a/app/src/main/res/layout/trashbin_item.xml +++ b/app/src/main/res/layout/trashbin_item.xml @@ -6,6 +6,7 @@ ~ SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only --> + android:src="@drawable/ic_history" + app:tint="@color/list_icon_color"/> + android:src="@drawable/ic_dots_vertical" + app:tint="@color/list_icon_color"/> diff --git a/app/src/main/res/layout/upload_files_layout.xml b/app/src/main/res/layout/upload_files_layout.xml index 4012193eb6a9..b5d4e9e90fec 100644 --- a/app/src/main/res/layout/upload_files_layout.xml +++ b/app/src/main/res/layout/upload_files_layout.xml @@ -26,17 +26,10 @@ android:layout_height="0dp" android:layout_weight="1" /> - - - - - + android:layout_height="0.5dp" + android:background="@color/divider_color" /> Herunterladen Video Überlagerungsicon Bitte warten… + Bitte geben Sie unter Apps & Benachrichtigungen in den Einstellungen manuell die Erlaubnis. Überprüfe gespeicherte Anmeldeinformationen Kopiere Datei von privatem Speicher Bitte aktualisieren Sie die Android System WebView-App für eine Anmeldung diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml index 1ce3f0da4f73..c85a78eb88d3 100644 --- a/app/src/main/res/values-night/colors.xml +++ b/app/src/main/res/values-night/colors.xml @@ -7,6 +7,7 @@ --> + @color/grey_30 #E3E3E3 #000000 #ff6F6F6F @@ -24,7 +25,7 @@ @color/appbar - #373535 + @color/grey_70 #222222 #DADADA @@ -34,6 +35,70 @@ @color/white - #1E1E1E + #121212 @android:color/white + + + #FFFFFF + @color/grey_30 + @color/grey_30 + #CCCCCC + @color/grey_70 + @color/grey_80 + #2D2D2D + @color/grey_70 + @color/grey_70 + + + @color/grey_80 + @color/grey_0 + + + @color/grey_80 + @color/grey_0 + + + @color/grey_60 + @color/grey_0 + @color/grey_0 + @color/grey_30 + #FFFFFF + @color/grey_30 + @color/grey_80 + #FFFFFF + + + @color/grey_80 + @color/grey_30 + @color/grey_0 + + + @color/grey_80 + @color/grey_0 + @color/grey_80 + + + @color/grey_70 + @color/grey_60 + + + @color/grey_70 + @color/grey_70 + + + #FFFFFF + @color/grey_30 + @color/grey_0 + @color/grey_0 + @color/grey_0 + @color/grey_0 + @color/grey_60 + @color/grey_0 + #FFFFFF + + + #121212 + @color/grey_0 + @color/grey_80 + @color/grey_80 diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml index 19b3ce692520..167139478049 100644 --- a/app/src/main/res/values-night/themes.xml +++ b/app/src/main/res/values-night/themes.xml @@ -23,5 +23,8 @@ @style/Nextcloud.Widget.PopupMenu @style/ThemeOverlay.App.BottomSheetDialog @style/App.ActionMode + + @style/AutoCompleteCursorColorStyle + @style/AutoCompleteCursorColorStyle diff --git a/app/src/main/res/values-sw600dp/dims.xml b/app/src/main/res/values-sw600dp/dims.xml index 7436d593a3c5..a32fc3e858d1 100644 --- a/app/src/main/res/values-sw600dp/dims.xml +++ b/app/src/main/res/values-sw600dp/dims.xml @@ -8,5 +8,7 @@ --> 6 + 32dp + 16dp 512dp diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index efefff8f3b98..3007a2f6c95d 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -10,11 +10,11 @@ ~ SPDX-License-Identifier: GPL-2.0-only AND (AGPL-3.0-or-later OR GPL-2.0-only) --> - @color/secondary_text_color + @color/grey_600 #000000 #ffffff #B3FFFFFF - #333333 + #191919 #F5F5F5 #303034 #E9E8EB @@ -26,7 +26,7 @@ #DDDDDD #EEEEEE #00000000 - #666666 + @color/grey_30 #e53935 @@ -65,15 +65,104 @@ #40162233 - @color/fontAppbar - #ECECEC + @color/white + @color/grey_0 #757575 #616161 - #80000000 + #919191 @android:color/white - #666666 + #191919 #A5A5A5 + + + #191919 + @color/primary + #191919 + #191919 + @color/grey_30 + @android:color/white + #FFFFFF + @color/grey_0 + #CCCCCC + #77c4ff + #B3FFFFFF + @color/grey_10 + + + #101010 + #F2F2F2 + #E5E5E5 + #B2B2B2 + #666666 + #4C4C4C + #333333 + + + @color/design_snackbar_background_color + @color/white + + + #FFFFFF + #191919 + + + @color/grey_0 + #191919 + @color/primary + #191919 + @color/primary + @color/grey_30 + @color/white + #191919 + + + #FFFFFF + #191919 + #191919 + + + #FFFFFF + #191919 + #FFFFFF + + + @color/primary + #F399C7 + #FFFFFF + @color/grey_30 + @color/grey_10 + @color/grey_0 + + + @color/primary + @color/grey_30 + @color/grey_30 + #CCCCCC + + + #191919 + @color/grey_30 + #191919 + #191919 + #191919 + #191919 + @color/grey_30 + #191919 + #000000 + #191919 + #F6E5EB + #C16F81 + #0D39DF + #0099ff + + + @color/grey_0 + #191919 + @color/grey_0 + @color/grey_30 + #77b6bb + #5077b6bb diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml new file mode 100644 index 000000000000..cc023ec9c6e1 --- /dev/null +++ b/app/src/main/res/values/dimens.xml @@ -0,0 +1,32 @@ + + + 4dp + 16dp + 24dp + 24dp + 6dp + 18sp + 15sp + 15dp + 56dp + 86dp + 80dp + 11sp + 30dp + 55dp + 258dp + 17sp + 20dp + 160dp + 50dp + 150dp + 55dp + 48dp + 48dp + 24dp + 26dp + 20sp + 145dp + 1dp + 13sp + \ No newline at end of file diff --git a/app/src/main/res/values/dims.xml b/app/src/main/res/values/dims.xml index af90df2b0fd6..b6b65ea3ae9b 100644 --- a/app/src/main/res/values/dims.xml +++ b/app/src/main/res/values/dims.xml @@ -22,7 +22,7 @@ 100dp 128dp 8dp - 3dp + 4dp 128dp 512 28dp @@ -78,7 +78,7 @@ 15dp 40dp 240dp - 16sp + 14sp 200dp 20dp 12sp @@ -119,11 +119,13 @@ 40dp 72dp 72dp + 24dp + 24dp 22sp 14dp 14dp - 12dp - 12dp + 24dp + 24dp 72dp 72dp 26sp diff --git a/app/src/main/res/values/setup.xml b/app/src/main/res/values/setup.xml index 3b6c7532937e..35884ecc7065 100644 --- a/app/src/main/res/values/setup.xml +++ b/app/src/main/res/values/setup.xml @@ -50,7 +50,7 @@ -1 /.Calendar-Backup - true + false true diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index fe4e5083d076..c5770930e2ca 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1110,6 +1110,7 @@ Link Name Delete Link Settings + Please navigate to App info in settings and give permission manually. Confirm Strict mode: no HTTP connection allowed! Destination filename diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 76a8f30eb15d..2c085b5c764e 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -32,6 +32,9 @@ @color/bg_default @style/Widget.App.TextInputLayout @dimen/dialogBorderRadius + + @style/AutoCompleteCursorColorStyle + @style/AutoCompleteCursorColorStyle + +