Skip to content

Commit bc2ac83

Browse files
committed
NMC-1920: Customized theming related changes for grid and list views.
NMC-2121: Theming applied to passcode. NMC-2374: Image edit functionality customized. NMC-1941: Fixed error message coming after camera permission allowed. NMC-2052: Fix back arrow appearing as hamburger icon. NC PR: nextcloud#11769 NMC-2465: Fix local db version to avoid crash during app upgrade. NMC-2576: Disabled switch account SnackBar. NMC-2123: Widget disabled. NMC-2127: System default night mode. NMC-1919: Backup Calendar-Contacts configured with test cases. NMC-2089: Reduce log levels NMC-4633: disable permission check in search screen Media View multi-selection customized NMC-4799: uploads screen icon color fix NMC-4862: deactivate github report snackbar
1 parent 022f9c2 commit bc2ac83

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+631
-218
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@
259259
android:exported="false" />
260260
<activity
261261
android:name="com.nextcloud.client.widget.DashboardWidgetConfigurationActivity"
262+
android:enabled="false"
262263
android:exported="false">
263264
<intent-filter>
264265
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
@@ -289,6 +290,7 @@
289290
android:exported="false" />
290291
<receiver
291292
android:name="com.nextcloud.client.widget.DashboardWidgetProvider"
293+
android:enabled="false"
292294
android:exported="false">
293295
<intent-filter>
294296
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
@@ -400,6 +402,7 @@
400402
<service
401403
android:name="com.nextcloud.client.widget.DashboardWidgetService"
402404
android:exported="true"
405+
android:enabled="false"
403406
android:permission="android.permission.BIND_REMOTEVIEWS" />
404407

405408
<provider

app/src/main/java/com/nextcloud/client/database/NextcloudDatabase.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,10 @@ abstract class NextcloudDatabase : RoomDatabase() {
9898
abstract fun recommendedFileDao(): RecommendedFileDao
9999

100100
companion object {
101-
const val FIRST_ROOM_DB_VERSION = 65
101+
// NMC customization
102+
// NMC play store version 7.21.9 had db version 64 before SqLite to Room migration
103+
// Keeping it 65(as per NC) will lead to crash when user tried to upgrade the app
104+
const val FIRST_ROOM_DB_VERSION = 64
102105
private var instance: NextcloudDatabase? = null
103106

104107
@JvmStatic

app/src/main/java/com/nextcloud/client/editimage/EditImageActivity.kt

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,15 @@
88
package com.nextcloud.client.editimage
99

1010
import android.graphics.Bitmap
11+
import android.graphics.drawable.ColorDrawable
1112
import android.net.Uri
1213
import android.os.Build
1314
import android.os.Bundle
1415
import android.view.Menu
1516
import android.view.MenuItem
1617
import android.view.View
1718
import androidx.appcompat.content.res.AppCompatResources
18-
import androidx.core.graphics.drawable.DrawableCompat
19-
import androidx.core.view.WindowCompat
20-
import androidx.core.view.WindowInsetsCompat
19+
import androidx.core.content.ContextCompat
2120
import com.canhub.cropper.CropImageView
2221
import com.nextcloud.client.di.Injectable
2322
import com.nextcloud.client.jobs.upload.FileUploadHelper
@@ -70,20 +69,25 @@ class EditImageActivity :
7069
file = intent.extras?.getParcelableArgument(EXTRA_FILE, OCFile::class.java)
7170
?: throw IllegalArgumentException("Missing file argument")
7271

73-
setSupportActionBar(binding.toolbar)
74-
supportActionBar?.apply {
75-
title = file.fileName
76-
setDisplayHomeAsUpEnabled(true)
77-
}
78-
79-
val windowInsetsController = WindowCompat.getInsetsController(window, window.decorView)
80-
windowInsetsController.hide(WindowInsetsCompat.Type.statusBars())
81-
82-
window.navigationBarColor = getColor(R.color.black)
72+
// NMC Customization
73+
setupToolbar()
74+
setupActionBar()
8375

8476
setupCropper()
8577
}
8678

79+
//NMC Customization
80+
private fun setupActionBar() {
81+
supportActionBar?.let {
82+
viewThemeUtils.platform.themeStatusBar(this)
83+
it.setDisplayHomeAsUpEnabled(true)
84+
it.setDisplayShowTitleEnabled(true)
85+
//custom color for back arrow for NMC
86+
viewThemeUtils.files.themeActionBar(this, it, file.fileName)
87+
it.setBackgroundDrawable(ColorDrawable(resources.getColor(R.color.bg_default, null)))
88+
}
89+
}
90+
8791
override fun onCropImageComplete(view: CropImageView, result: CropImageView.CropResult) {
8892
if (!result.isSuccessful) {
8993
DisplayUtils.showSnackMessage(this, getString(R.string.image_editor_unable_to_edit_image))
@@ -120,12 +124,18 @@ class EditImageActivity :
120124
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
121125
// add save button to action bar
122126
menuInflater.inflate(R.menu.custom_menu_placeholder, menu)
123-
val saveIcon = AppCompatResources.getDrawable(this, R.drawable.ic_check)?.also {
124-
DrawableCompat.setTint(it, resources.getColor(R.color.white, theme))
125-
}
127+
// NMC: No need to apply NC tint here as we will be doing it later in code
128+
val saveIcon = AppCompatResources.getDrawable(this, R.drawable.ic_tick)
126129
menu?.findItem(R.id.custom_menu_placeholder_item)?.apply {
127130
icon = saveIcon
128131
contentDescription = getString(R.string.common_save)
132+
// NMC customization
133+
icon = icon?.let {
134+
viewThemeUtils.platform.colorDrawable(
135+
it,
136+
ContextCompat.getColor(this@EditImageActivity, R.color.fontAppbar)
137+
)
138+
}
129139
}
130140
return true
131141
}

app/src/main/java/com/nextcloud/client/errorhandling/ShowErrorActivity.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,16 @@ class ShowErrorActivity : AppCompatActivity() {
3636
setSupportActionBar(binding.toolbarInclude.toolbar)
3737
supportActionBar!!.title = createErrorTitle()
3838

39-
val snackbar = DisplayUtils.createSnackbar(
39+
// NMC-4862
40+
// deactivate github report snackbar
41+
/* val snackbar = DisplayUtils.createSnackbar(
4042
binding.errorPageContainer,
4143
R.string.error_report_issue_text,
4244
Snackbar.LENGTH_INDEFINITE
4345
)
4446
.setAction(R.string.error_report_issue_action) { reportIssue() }
4547
46-
snackbar.show()
48+
snackbar.show() */
4749
}
4850

4951
private fun createErrorTitle() = String.format(getString(R.string.error_crash_title), getString(R.string.app_name))

app/src/main/java/com/nextcloud/ui/fileactions/FileActionsBottomSheet.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ class FileActionsBottomSheet :
144144
binding.thumbnailLayout.thumbnailShimmer,
145145
syncedFolderProvider.preferences,
146146
viewThemeUtils,
147-
syncedFolderProvider
147+
syncedFolderProvider,
148+
false
148149
)
149150
}
150151
}

app/src/main/java/com/nextcloud/ui/trashbinFileActions/TrashbinFileActionsBottomSheet.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ class TrashbinFileActionsBottomSheet :
129129
binding.thumbnailLayout.thumbnailShimmer,
130130
syncedFolderProvider.preferences,
131131
viewThemeUtils,
132-
syncedFolderProvider
132+
syncedFolderProvider,
133+
false
133134
)
134135
}
135136
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package com.nmc.android.ui.utils
2+
3+
import com.owncloud.android.BuildConfig
4+
import com.owncloud.android.lib.common.utils.Log_OC
5+
6+
/**
7+
* NMC log interpreter class
8+
* this class will be used whenever we have to reduce the logs writing
9+
* this will avoid printing logs in release builds
10+
* todo: can be extended later for more functions
11+
*/
12+
object Log_NMC {
13+
@JvmStatic
14+
fun v(tag: String?, msg: String?) {
15+
if (BuildConfig.DEBUG) Log_OC.v(tag, msg)
16+
}
17+
18+
@JvmStatic
19+
fun d(tag: String?, msg: String?) {
20+
if (BuildConfig.DEBUG) Log_OC.d(tag, msg)
21+
}
22+
23+
@JvmStatic
24+
fun d(tag: String, msg: String, e: Exception) {
25+
if (BuildConfig.DEBUG) Log_OC.d(tag, msg, e)
26+
}
27+
28+
@JvmStatic
29+
fun i(tag: String?, msg: String?) {
30+
if (BuildConfig.DEBUG) Log_OC.i(tag, msg)
31+
}
32+
33+
@JvmStatic
34+
fun e(tag: String?, msg: String?) {
35+
if (BuildConfig.DEBUG) Log_OC.e(tag, msg)
36+
}
37+
38+
@JvmStatic
39+
fun w(tag: String?, msg: String?) {
40+
if (BuildConfig.DEBUG) Log_OC.w(tag, msg)
41+
}
42+
}

app/src/main/java/com/owncloud/android/MainApp.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,11 +1002,8 @@ public AndroidInjector<Object> androidInjector() {
10021002
}
10031003

10041004
public static void setAppTheme(DarkMode mode) {
1005-
switch (mode) {
1006-
case LIGHT -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
1007-
case DARK -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
1008-
case SYSTEM -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
1009-
}
1005+
// NMC Customization -> Always follow system theme
1006+
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
10101007
}
10111008

10121009
@Override

app/src/main/java/com/owncloud/android/datamodel/MediaProvider.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
import android.net.Uri;
1313
import android.provider.MediaStore;
1414

15+
import com.nmc.android.ui.utils.Log_NMC;
1516
import com.owncloud.android.MainApp;
16-
import com.owncloud.android.lib.common.utils.Log_OC;
1717
import com.owncloud.android.utils.PermissionUtil;
1818
import com.owncloud.android.utils.theme.ViewThemeUtils;
1919

@@ -107,7 +107,7 @@ public static List<MediaFolder> getImageFolders(ContentResolver contentResolver,
107107
MediaStore.Images.Media.DATE_TAKEN,
108108
ContentResolverHelper.SORT_DIRECTION_DESCENDING,
109109
itemLimit);
110-
Log_OC.d(TAG, "Reading images for " + mediaFolder.folderName);
110+
Log_NMC.d(TAG, "Reading images for " + mediaFolder.folderName);
111111

112112
if (cursorImages != null) {
113113
String filePath;
@@ -217,7 +217,7 @@ public static List<MediaFolder> getVideoFolders(ContentResolver contentResolver,
217217
ContentResolverHelper.SORT_DIRECTION_DESCENDING,
218218
itemLimit);
219219

220-
Log_OC.d(TAG, "Reading videos for " + mediaFolder.folderName);
220+
Log_NMC.d(TAG, "Reading videos for " + mediaFolder.folderName);
221221

222222
if (cursorVideos != null) {
223223
String filePath;

app/src/main/java/com/owncloud/android/datamodel/ThumbnailsCacheManager.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import com.nextcloud.client.network.ConnectivityService;
3939
import com.nextcloud.utils.BitmapExtensionsKt;
4040
import com.nextcloud.utils.extensions.ThumbnailsCacheManagerExtensionsKt;
41+
import com.nmc.android.ui.utils.Log_NMC;
4142
import com.owncloud.android.MainApp;
4243
import com.owncloud.android.R;
4344
import com.owncloud.android.lib.common.OwnCloudAccount;
@@ -133,7 +134,7 @@ public static void initDiskCacheAsync() {
133134
}
134135

135136
String cachePath = cacheDir.getPath() + File.separator + CACHE_FOLDER;
136-
Log_OC.d(TAG, "thumbnail cache dir: " + cachePath);
137+
Log_NMC.d(TAG, "thumbnail cache dir: " + cachePath);
137138
File diskCacheDir = new File(cachePath);
138139

139140
// migrate from external cache to internal cache
@@ -150,7 +151,7 @@ public static void initDiskCacheAsync() {
150151
mThumbnailCache = new DiskLruImageCache(diskCacheDir, DISK_CACHE_SIZE, mCompressFormat,
151152
mCompressQuality);
152153
} catch (Exception e) {
153-
Log_OC.d(TAG, "Disk cache init failed", e);
154+
Log_NMC.d(TAG, "Disk cache init failed", e);
154155
mThumbnailCache = null;
155156
}
156157
}
@@ -789,7 +790,7 @@ private Bitmap doThumbnailFromOCFileInBackground() {
789790
file.getLocalId() + "&x=" + pxW + "&y=" + pxH;
790791
}
791792

792-
Log_OC.d(TAG, "generate thumbnail: " + file.getFileName() + " URI: " + uri);
793+
Log_NMC.d(TAG, "generate thumbnail: " + file.getFileName() + " URI: " + uri);
793794
getMethod = new GetMethod(uri);
794795
getMethod.setRequestHeader("Cookie",
795796
"nc_sameSiteCookielax=true;nc_sameSiteCookiestrict=true");
@@ -822,7 +823,7 @@ private Bitmap doThumbnailFromOCFileInBackground() {
822823

823824
// Add thumbnail to cache
824825
if (thumbnail != null) {
825-
Log_OC.d(TAG, "add thumbnail to cache: " + file.getFileName());
826+
Log_NMC.d(TAG, "add thumbnail to cache: " + file.getFileName());
826827
addBitmapToCache(imageKey, thumbnail);
827828
}
828829
}
@@ -980,7 +981,7 @@ private Bitmap doFileInBackground(File file, Type type) {
980981
thumbnail = retriever.getFrameAtTime(-1);
981982
} catch (Exception ex) {
982983
// can't create a bitmap
983-
Log_OC.w(TAG, "Failed to create bitmap from video " + file.getAbsolutePath());
984+
Log_NMC.w(TAG, "Failed to create bitmap from video " + file.getAbsolutePath());
984985
}
985986

986987
if (thumbnail != null) {
@@ -1087,7 +1088,7 @@ Drawable doAvatarInBackground() {
10871088

10881089
int px = mResources.getInteger(R.integer.file_avatar_px);
10891090
String uri = mClient.getBaseUri() + "/index.php/avatar/" + Uri.encode(mUserId) + "/" + px;
1090-
Log_OC.d("Avatar", "URI: " + uri);
1091+
Log_NMC.d("Avatar", "URI: " + uri);
10911092
get = new GetMethod(uri);
10921093

10931094
// only use eTag if available and corresponding avatar is still there
@@ -1361,7 +1362,7 @@ public static void generateThumbnailFromOCFile(OCFile file, User user, Context c
13611362
String uri = client.getBaseUri() + "/index.php/apps/files/api/v1/thumbnail/" +
13621363
pxW + "/" + pxH + Uri.encode(file.getRemotePath(), "/");
13631364

1364-
Log_OC.d(TAG, "generate thumbnail: " + file.getFileName() + " URI: " + uri);
1365+
Log_NMC.d(TAG, "generate thumbnail: " + file.getFileName() + " URI: " + uri);
13651366
getMethod = new GetMethod(uri);
13661367
getMethod.setRequestHeader("Cookie", "nc_sameSiteCookielax=true;nc_sameSiteCookiestrict=true");
13671368

@@ -1384,7 +1385,7 @@ public static void generateThumbnailFromOCFile(OCFile file, User user, Context c
13841385
thumbnail = handlePNG(thumbnail, pxW, pxH);
13851386
}
13861387

1387-
Log_OC.d(TAG, "add thumbnail to cache: " + file.getFileName());
1388+
Log_NMC.d(TAG, "add thumbnail to cache: " + file.getFileName());
13881389
addBitmapToCache(imageKey, thumbnail);
13891390
}
13901391
} catch (Exception e) {
@@ -1438,7 +1439,7 @@ private static Bitmap doResizedImageInBackground(OCFile file, FileDataStorageMan
14381439
String uri = mClient.getBaseUri() + "/index.php/core/preview?fileId="
14391440
+ file.getLocalId()
14401441
+ "&x=" + (pxW / 2) + "&y=" + (pxH / 2) + "&a=1&mode=cover&forceIcon=0";
1441-
Log_OC.d(TAG, "generate resized image: " + file.getFileName() + " URI: " + uri);
1442+
Log_NMC.d(TAG, "generate resized image: " + file.getFileName() + " URI: " + uri);
14421443
getMethod = new GetMethod(uri);
14431444

14441445
int status = mClient.executeMethod(getMethod);
@@ -1456,7 +1457,7 @@ private static Bitmap doResizedImageInBackground(OCFile file, FileDataStorageMan
14561457

14571458
// Add thumbnail to cache
14581459
if (thumbnail != null) {
1459-
Log_OC.d(TAG, "add resized image to cache: " + file.getFileName());
1460+
Log_NMC.d(TAG, "add resized image to cache: " + file.getFileName());
14601461
addBitmapToCache(imageKey, thumbnail);
14611462
}
14621463

0 commit comments

Comments
 (0)