diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 8b1b9cc71c6c..a315a856dc09 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -259,11 +259,10 @@ + android:theme="@style/Theme.ownCloud" /> + android:exported="false" /> (R.id.general_description) descriptionTextView.text = getString(R.string.manage_space_description, getString(R.string.app_name)) diff --git a/app/src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java index bb6793eb7867..04296ea37713 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java @@ -21,6 +21,7 @@ import android.content.pm.PackageInfo; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Configuration; +import android.graphics.drawable.ColorDrawable; import android.net.Uri; import android.os.Bundle; import android.preference.ListPreference; @@ -861,12 +862,10 @@ private void setupActionBar() { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowTitleEnabled(true); if (this.getResources() != null) { - viewThemeUtils.androidx.themeActionBar(this, - actionBar, - getString(R.string.actionbar_settings), - ResourcesCompat.getDrawable(this.getResources(), - R.drawable.ic_arrow_back, - null)); + //custom color for back arrow for NMC + viewThemeUtils.files.themeActionBar(this, actionBar, getResources().getString(R.string.actionbar_settings)); + //required for NMC + actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.bg_default, null))); } } } diff --git a/app/src/main/java/com/owncloud/android/ui/activity/ShareActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/ShareActivity.java index b415d94f4455..7c6488fae4b7 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/ShareActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/ShareActivity.java @@ -92,8 +92,6 @@ protected void onCreate(Bundle savedInstanceState) { // Name binding.shareFileName.setText(getResources().getString(R.string.share_file, file.getFileName())); - viewThemeUtils.platform.colorViewBackground(binding.shareHeaderDivider); - // Size binding.shareFileSize.setText(DisplayUtils.bytesToHumanReadable(file.getFileLength())); 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 b018647ed0e2..0df6a695ca37 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 @@ -17,6 +17,7 @@ import android.annotation.SuppressLint; import android.graphics.Bitmap; import android.graphics.Color; +import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.view.View; import android.widget.FrameLayout; @@ -31,9 +32,11 @@ import com.google.android.material.card.MaterialCardView; import com.google.android.material.textview.MaterialTextView; import com.nextcloud.client.di.Injectable; +import com.nmc.android.utils.ToolbarThemeUtils; import com.owncloud.android.R; import com.owncloud.android.datamodel.FileDataStorageManager; import com.owncloud.android.datamodel.OCFile; +import com.owncloud.android.utils.StringUtils; import com.owncloud.android.utils.theme.ThemeColorUtils; import com.owncloud.android.utils.theme.ThemeUtils; import com.owncloud.android.utils.theme.ViewThemeUtils; @@ -62,6 +65,7 @@ public abstract class ToolbarActivity extends BaseActivity implements Injectable private LinearLayout mInfoBox; private TextView mInfoBoxMessage; protected AppCompatSpinner mToolbarSpinner; + private View mDefaultToolbarDivider; private boolean isHomeSearchToolbarShow = false; @Inject public ThemeColorUtils themeColorUtils; @@ -82,6 +86,7 @@ private void setupToolbar(boolean isHomeSearchToolbarShow, boolean showSortListB mMenuButton = findViewById(R.id.menu_button); mSearchText = findViewById(R.id.search_text); mSwitchAccountButton = findViewById(R.id.switch_account_button); + mDefaultToolbarDivider = findViewById(R.id.default_toolbar_divider); if (showSortListButtonGroup) { findViewById(R.id.sort_list_button_group).setVisibility(View.VISIBLE); @@ -98,8 +103,10 @@ private void setupToolbar(boolean isHomeSearchToolbarShow, boolean showSortListB mToolbarSpinner = findViewById(R.id.toolbar_spinner); - viewThemeUtils.material.themeToolbar(mToolbar); - viewThemeUtils.material.colorToolbarOverflowIcon(mToolbar); + // custom color for overflow icon required for NMC + if (mToolbar.getOverflowIcon() != null) { + mToolbar.getOverflowIcon().setColorFilter(getResources().getColor(R.color.fontAppbar, null), PorterDuff.Mode.SRC_ATOP); + } viewThemeUtils.platform.themeStatusBar(this); viewThemeUtils.material.colorMaterialTextButton(mSwitchAccountButton); } @@ -162,22 +169,11 @@ private void showHomeSearchToolbar(String title, boolean isRoot) { @SuppressLint("PrivateResource") private void showHomeSearchToolbar(boolean isShow) { - viewThemeUtils.material.themeToolbar(mToolbar); - if (isShow) { - viewThemeUtils.platform.resetStatusBar(this); - mAppBar.setStateListAnimator(AnimatorInflater.loadStateListAnimator(mAppBar.getContext(), - R.animator.appbar_elevation_off)); - mDefaultToolbar.setVisibility(View.GONE); - mHomeSearchToolbar.setVisibility(View.VISIBLE); - viewThemeUtils.material.themeCardView(mHomeSearchToolbar); - viewThemeUtils.material.themeSearchBarText(mSearchText); - } else { - mAppBar.setStateListAnimator(AnimatorInflater.loadStateListAnimator(mAppBar.getContext(), - R.animator.appbar_elevation_on)); - viewThemeUtils.platform.themeStatusBar(this); - mDefaultToolbar.setVisibility(View.VISIBLE); - mHomeSearchToolbar.setVisibility(View.GONE); - } + mAppBar.setStateListAnimator(AnimatorInflater.loadStateListAnimator(mAppBar.getContext(), + R.animator.appbar_elevation_on)); + viewThemeUtils.platform.themeStatusBar(this); + mDefaultToolbar.setVisibility(View.VISIBLE); + mHomeSearchToolbar.setVisibility(View.GONE); } /** @@ -190,7 +186,8 @@ public void updateActionBarTitleAndHomeButtonByString(String title) { // set home button properties if (actionBar != null) { if (title != null) { - actionBar.setTitle(title); + //custom styling for action bar title required for NMC + ToolbarThemeUtils.setColoredTitle(this, actionBar, title); actionBar.setDisplayShowTitleEnabled(true); } else { actionBar.setDisplayShowTitleEnabled(false); @@ -287,8 +284,8 @@ public FrameLayout getPreviewImageContainer() { public void updateToolbarSubtitle(@NonNull String subtitle) { ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { - actionBar.setSubtitle(subtitle); - viewThemeUtils.androidx.themeActionBarSubtitle(this, actionBar); + //required for NMC + actionBar.setSubtitle(StringUtils.getColorSpan(subtitle, getResources().getColor(R.color.fontAppbar, null))); } } diff --git a/app/src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.java b/app/src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.java index af6647c4e2d3..58888488342a 100644 --- a/app/src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/preview/PreviewImageActivity.java @@ -85,7 +85,6 @@ public class PreviewImageActivity extends FileActivity implements private boolean requestWaitingForBinder; private DownloadFinishReceiver downloadFinishReceiver; private UploadFinishReceiver uploadFinishReceiver; - private View fullScreenAnchorView; private boolean isDownloadWorkStarted = false; @Inject AppPreferences preferences; @@ -112,6 +111,7 @@ protected void onCreate(Bundle savedInstanceState) { } setContentView(R.layout.preview_image_activity); + setupToolbar(); livePhotoFile = IntentExtensionsKt.getParcelableArgument(getIntent(), EXTRA_LIVE_PHOTO_FILE, OCFile.class); @@ -126,7 +126,6 @@ protected void onCreate(Bundle savedInstanceState) { actionBar.setDisplayHomeAsUpEnabled(true); } - fullScreenAnchorView = getWindow().getDecorView(); // to keep our UI controls visibility in line with system bars visibility setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); @@ -246,7 +245,7 @@ public void onStart() { if (file != null) { /// Refresh the activity according to the Account and OCFile set setFile(file); // reset after getting it fresh from storageManager - getSupportActionBar().setTitle(getFile().getFileName()); + updateActionBarTitleAndHomeButton(getFile()); //if (!stateWasRecovered) { initViewPager(optionalUser.get()); //} @@ -393,9 +392,7 @@ public void onPageSelected(int position) { OCFile currentFile = previewImagePagerAdapter.getFileAt(position); if (currentFile != null) { - if (getSupportActionBar() != null) { - getSupportActionBar().setTitle(currentFile.getFileName()); - } + updateActionBarTitleAndHomeButton(currentFile); setDrawerIndicatorEnabled(false); if (currentFile.isEncrypted() && !currentFile.isDown() && @@ -493,22 +490,7 @@ public boolean isSystemUIVisible() { } public void toggleFullScreen() { - boolean visible = (fullScreenAnchorView.getSystemUiVisibility() - & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0; - - if (visible) { - hideSystemUI(fullScreenAnchorView); - // actionBar.hide(); // propagated through - // OnSystemUiVisibilityChangeListener() - } else { - showSystemUI(fullScreenAnchorView); - // actionBar.show(); // propagated through - // OnSystemUiVisibilityChangeListener() - } - } - - public void switchToFullScreen() { - hideSystemUI(fullScreenAnchorView); + // do nothing for NMC } public void startImageEditor(OCFile file) { @@ -532,26 +514,4 @@ public void onTransferStateChanged(OCFile file, boolean downloading, boolean upl // TODO Auto-generated method stub } - - - @SuppressLint("InlinedApi") - private void hideSystemUI(View anchorView) { - anchorView.setSystemUiVisibility( - View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hides NAVIGATION BAR; Android >= 4.0 - | View.SYSTEM_UI_FLAG_FULLSCREEN // hides STATUS BAR; Android >= 4.1 - | View.SYSTEM_UI_FLAG_IMMERSIVE // stays interactive; Android >= 4.4 - | View.SYSTEM_UI_FLAG_LAYOUT_STABLE // draw full window; Android >= 4.1 - | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN // draw full window; Android >= 4.1 - | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION // draw full window; Android >= 4.1 - ); - } - - @SuppressLint("InlinedApi") - private void showSystemUI(View anchorView) { - anchorView.setSystemUiVisibility( - View.SYSTEM_UI_FLAG_LAYOUT_STABLE // draw full window; Android >= 4.1 - | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN // draw full window; Android >= 4.1 - | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION // draw full window; Android >= 4. - ); - } } diff --git a/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaActivity.kt b/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaActivity.kt index 0da228a12ca4..0d0117ac584e 100644 --- a/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaActivity.kt +++ b/app/src/main/java/com/owncloud/android/ui/preview/PreviewMediaActivity.kt @@ -33,6 +33,7 @@ import android.widget.FrameLayout import androidx.annotation.OptIn import androidx.annotation.StringRes import androidx.appcompat.content.res.AppCompatResources +import androidx.core.content.ContextCompat import androidx.core.graphics.drawable.DrawableCompat import androidx.core.view.ViewCompat import androidx.core.view.WindowCompat @@ -138,7 +139,8 @@ class PreviewMediaActivity : binding = ActivityPreviewMediaBinding.inflate(layoutInflater) setContentView(binding.root) - setSupportActionBar(binding.materialToolbar) + // NMC Customization: Customize toolbar + setupToolbar() WindowCompat.setDecorFitsSystemWindows(window, false) applyWindowInsets() initArguments(savedInstanceState) @@ -200,10 +202,6 @@ class PreviewMediaActivity : it.setDisplayHomeAsUpEnabled(true) viewThemeUtils.files.themeActionBar(this, it) } - - viewThemeUtils.platform.themeStatusBar( - this - ) } private fun setLoadingView() { @@ -395,7 +393,7 @@ class PreviewMediaActivity : .displayCutout() ) - binding.materialToolbar.updateLayoutParams { + binding.mediaToolbar.appbar.updateLayoutParams { topMargin = insets.top } exoControls.updateLayoutParams { @@ -406,7 +404,7 @@ class PreviewMediaActivity : } exoControls.updatePadding(left = insets.left, right = insets.right) exoProgress.updatePadding(left = insets.left, right = insets.right) - binding.materialToolbar.updatePadding(left = insets.left, right = insets.right) + binding.mediaToolbar.appbar.updatePadding(left = insets.left, right = insets.right) WindowInsetsCompat.CONSUMED } } @@ -439,6 +437,15 @@ class PreviewMediaActivity : override fun onCreateOptionsMenu(menu: Menu?): Boolean { menuInflater.inflate(R.menu.custom_menu_placeholder, menu) + // NMC customization + menu?.findItem(R.id.custom_menu_placeholder_item)?.apply { + icon = icon?.let { + viewThemeUtils.platform.colorDrawable( + it, + ContextCompat.getColor(this@PreviewMediaActivity, R.color.fontAppbar) + ) + } + } return true } diff --git a/app/src/main/java/com/owncloud/android/utils/StringUtils.java b/app/src/main/java/com/owncloud/android/utils/StringUtils.java index 1186619a871e..bb204c73f580 100644 --- a/app/src/main/java/com/owncloud/android/utils/StringUtils.java +++ b/app/src/main/java/com/owncloud/android/utils/StringUtils.java @@ -7,6 +7,11 @@ */ package com.owncloud.android.utils; + +import android.text.Spannable; +import android.text.SpannableString; +import android.text.style.ForegroundColorSpan; + import java.util.Locale; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -55,6 +60,15 @@ String searchAndColor(@Nullable String text, @Nullable String searchText, } } + public static Spannable getColorSpan(@NonNull String title, @ColorInt int color) { + Spannable text = new SpannableString(title); + text.setSpan(new ForegroundColorSpan(color), + 0, + text.length(), + Spannable.SPAN_INCLUSIVE_INCLUSIVE); + return text; + } + public static @NonNull String removePrefix(@NonNull String s, @NonNull String prefix) { diff --git a/app/src/main/java/com/owncloud/android/utils/theme/FilesSpecificViewThemeUtils.kt b/app/src/main/java/com/owncloud/android/utils/theme/FilesSpecificViewThemeUtils.kt index 4135df898793..6ffc14d45645 100644 --- a/app/src/main/java/com/owncloud/android/utils/theme/FilesSpecificViewThemeUtils.kt +++ b/app/src/main/java/com/owncloud/android/utils/theme/FilesSpecificViewThemeUtils.kt @@ -28,7 +28,9 @@ import com.nextcloud.android.common.ui.theme.MaterialSchemes import com.nextcloud.android.common.ui.theme.ViewThemeUtilsBase import com.nextcloud.android.common.ui.theme.utils.AndroidViewThemeUtils import com.nextcloud.android.common.ui.theme.utils.AndroidXViewThemeUtils +import com.nmc.android.utils.ToolbarThemeUtils import com.nextcloud.utils.view.FastScrollPopupBackground +import com.nmc.android.utils.DrawableThemeUtils import com.owncloud.android.R import com.owncloud.android.lib.common.utils.Log_OC import com.owncloud.android.lib.resources.shares.ShareType @@ -135,18 +137,11 @@ class FilesSpecificViewThemeUtils @Inject constructor( // TODO move back arrow resource to lib and use lib method directly? @JvmOverloads fun themeActionBar(context: Context, actionBar: ActionBar, title: String, isMenu: Boolean = false) { - val icon = getHomeAsUpIcon(isMenu) - val backArrow = ResourcesCompat.getDrawable( - context.resources, - icon, - null - )!! - androidXViewThemeUtils.themeActionBar( - context, - actionBar, - title, - backArrow - ) + //custom styling for action bar title required for NMC + ToolbarThemeUtils.setColoredTitle(context, actionBar, title) + + //custom color for back arrow for NMC + themeActionBar(context, actionBar, isMenu) } /** @@ -173,7 +168,13 @@ class FilesSpecificViewThemeUtils @Inject constructor( getHomeAsUpIcon(isMenu), null )!! - androidXViewThemeUtils.themeActionBar(context, actionBar, backArrow) + //custom color for back arrow for NMC + actionBar.setHomeAsUpIndicator( + DrawableThemeUtils.tintDrawable( + backArrow, + context.resources.getColor(R.color.fontAppbar, null) + ) + ) } fun themeTemplateCardView(cardView: MaterialCardView) { diff --git a/app/src/main/res/layout/action_mode_close_layout.xml b/app/src/main/res/layout/action_mode_close_layout.xml new file mode 100644 index 000000000000..36e355cb18c3 --- /dev/null +++ b/app/src/main/res/layout/action_mode_close_layout.xml @@ -0,0 +1,14 @@ + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_preview_media.xml b/app/src/main/res/layout/activity_preview_media.xml index 361ae1e56599..8829649134cf 100644 --- a/app/src/main/res/layout/activity_preview_media.xml +++ b/app/src/main/res/layout/activity_preview_media.xml @@ -15,15 +15,6 @@ android:gravity="center" tools:context=".ui.preview.PreviewMediaActivity"> - - + + + + + android:background="@color/divider_color" /> - + + + + + + + android:layout_height="1dp" + android:background="@color/divider_color" /> + + + + @@ -86,6 +102,7 @@ android:id="@+id/preview_image" android:layout_width="match_parent" android:layout_height="@dimen/nav_drawer_header_height" + android:background="@color/bg_default" android:contentDescription="@string/preview_image_description" android:scaleType="centerCrop" /> @@ -99,7 +116,7 @@ android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" - android:background="@color/appbar" + android:background="@color/bg_default" android:theme="@style/Theme.ToolbarTheme" tools:visibility="gone"> @@ -112,6 +129,14 @@ app:popupTheme="@style/Theme.AppCompat.DayNight.NoActionBar" /> + + #1E1E1E @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 e8e9719ea7a9..a439e6d2e622 100644 --- a/app/src/main/res/values-night/themes.xml +++ b/app/src/main/res/values-night/themes.xml @@ -22,6 +22,11 @@ @style/Widget.App.TextInputLayout @style/Nextcloud.Widget.PopupMenu @style/ThemeOverlay.App.BottomSheetDialog + + @color/primary + + @drawable/ic_arrow_back + @drawable/ic_arrow_back @style/App.ActionMode diff --git a/app/src/main/res/values-v27/styles.xml b/app/src/main/res/values-v27/styles.xml index 5f4c5fc782fe..4ba5043ce4a7 100644 --- a/app/src/main/res/values-v27/styles.xml +++ b/app/src/main/res/values-v27/styles.xml @@ -35,7 +35,7 @@ false - diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 9a721eb3e385..248aa18d524c 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -76,4 +76,93 @@ @android:color/white #666666 #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/styles.xml b/app/src/main/res/values/styles.xml index 1a8b501ee4b7..216f7bb7f202 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -31,6 +31,11 @@ @style/FallbackDatePickerDialogTheme @color/bg_default @style/Widget.App.TextInputLayout + + @color/primary + + @drawable/ic_arrow_back + @drawable/ic_arrow_back @dimen/dialogBorderRadius @@ -49,6 +54,11 @@ @style/FallbackDatePickerDialogTheme @color/bg_default @style/Widget.App.TextInputLayout + + @color/primary + + @drawable/ic_arrow_back + @drawable/ic_arrow_back @dimen/dialogBorderRadius @@ -449,10 +459,11 @@ diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index ce28e6de31bd..914dd24bbda5 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -23,6 +23,11 @@ @style/Widget.App.TextInputLayout @style/Nextcloud.Widget.PopupMenu @style/ThemeOverlay.App.BottomSheetDialog + + @color/primary + + @drawable/ic_arrow_back + @drawable/ic_arrow_back @style/App.ActionMode