Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import android.accounts.Account
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Intent
import android.graphics.Color
import android.os.Bundle
import android.os.Environment
import android.view.Menu
Expand All @@ -28,6 +29,8 @@ import android.widget.AdapterView
import android.widget.ArrayAdapter
import androidx.activity.OnBackPressedCallback
import androidx.appcompat.widget.SearchView
import androidx.core.graphics.BlendModeColorFilterCompat
import androidx.core.graphics.BlendModeCompat
import androidx.core.view.MenuProvider
import com.nextcloud.android.common.ui.theme.utils.ColorRole
import com.nextcloud.client.account.User
Expand Down Expand Up @@ -245,6 +248,8 @@ class UploadFilesActivity :
private fun setupToolbarSpinner() {
mToolbarSpinner.visibility = View.VISIBLE
mToolbarSpinner.adapter = directories
mToolbarSpinner.background.colorFilter =
BlendModeColorFilterCompat.createBlendModeColorFilterCompat(Color.TRANSPARENT, BlendModeCompat.SRC_IN)
mToolbarSpinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
override fun onItemSelected(parent: AdapterView<*>, view: View, position: Int, id: Long) {
repeat(position) { onBackPressedDispatcher.onBackPressed() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ package com.owncloud.android.ui.activity.uploadfiles

import android.widget.ArrayAdapter
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.core.graphics.drawable.DrawableCompat
import com.nextcloud.client.preferences.AppPreferences
import com.owncloud.android.R
import com.owncloud.android.databinding.UploadFilesLayoutBinding
Expand Down Expand Up @@ -40,9 +42,19 @@ class UploadBehaviourSelector(
activity.getString(R.string.uploader_upload_files_behaviour_upload_and_delete_from_source)
)

spinner.adapter = ArrayAdapter(activity, android.R.layout.simple_spinner_item, behaviours).apply {
// custom spinner item layout for NMC
spinner.adapter = ArrayAdapter(activity, R.layout.simple_spinner_item, behaviours).apply {
setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
}

// NMC Customization for dropdown icon tinting
val background = DrawableCompat.wrap(spinner.background).mutate()
DrawableCompat.setTintList(
background,
ContextCompat.getColorStateList(activity, R.color.spinner_color_state)
)
spinner.background = background

spinner.setSelection(preferences.uploaderBehaviour)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import android.widget.PopupMenu
import androidx.appcompat.view.ContextThemeWrapper
import androidx.annotation.VisibleForTesting
import androidx.core.content.ContextCompat
import androidx.core.view.isVisible
Expand Down Expand Up @@ -374,7 +375,9 @@ class SyncedFolderAdapter(
}

private fun onOverflowIconClicked(section: Int, item: SyncedFolderDisplayItem, view: View) {
val popup = PopupMenu(context, view).apply {
// NMC Customisation
val ctw = ContextThemeWrapper(context, R.style.CustomPopupTheme)
val popup = PopupMenu(ctw, view).apply {
inflate(R.menu.synced_folders_adapter)
setOnMenuItemClickListener { i: MenuItem -> optionsItemSelected(i, section, item) }
menu
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.PopupMenu
import androidx.appcompat.view.ContextThemeWrapper
import androidx.lifecycle.lifecycleScope
import com.afollestad.sectionedrecyclerview.SectionedRecyclerViewAdapter
import com.afollestad.sectionedrecyclerview.SectionedViewHolder
Expand Down Expand Up @@ -174,7 +175,9 @@ class UploadListAdapter(
}

private fun showFailedPopupMenu(holder: HeaderViewHolder) {
PopupMenu(activity, holder.binding.uploadListAction).apply {
// NMC Customisation
val ctw = ContextThemeWrapper(activity, R.style.CustomPopupTheme)
PopupMenu(ctw, holder.binding.uploadListAction).apply {
inflate(R.menu.upload_list_failed_options)
setOnMenuItemClickListener { item ->
when (item.itemId) {
Expand All @@ -199,7 +202,9 @@ class UploadListAdapter(
}

private fun showCancelledPopupMenu(holder: HeaderViewHolder) {
PopupMenu(activity, holder.binding.uploadListAction).apply {
// NMC Customisation
val ctw = ContextThemeWrapper(activity, R.style.CustomPopupTheme)
PopupMenu(ctw, holder.binding.uploadListAction).apply {
inflate(R.menu.upload_list_cancelled_options)
setOnMenuItemClickListener { item ->
when (item.itemId) {
Expand Down Expand Up @@ -519,7 +524,9 @@ class UploadListAdapter(
override fun onBindFooterViewHolder(holder: SectionedViewHolder?, section: Int) = Unit

private fun showItemConflictPopup(item: OCUpload, view: View) {
PopupMenu(activity, view).apply {
// NMC Customisation
val ctw = ContextThemeWrapper(activity, R.style.CustomPopupTheme)
PopupMenu(ctw, view).apply {
inflate(R.menu.upload_list_item_file_conflict)
setOnMenuItemClickListener { menuItem ->
if (menuItem.itemId == R.id.action_upload_list_resolve_conflict) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import android.view.ScaleGestureDetector
import android.view.View
import android.view.ViewGroup
import androidx.activity.result.contract.ActivityResultContracts
import androidx.core.content.ContextCompat
import androidx.core.view.MenuHost
import androidx.core.view.MenuProvider
import androidx.lifecycle.Lifecycle
Expand Down Expand Up @@ -121,7 +122,13 @@ class GalleryFragment :
override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) {
menuInflater.inflate(R.menu.fragment_gallery_three_dots, menu)
val menuItem = menu.findItem(R.id.action_three_dot_icon)
viewThemeUtils.platform.colorMenuItemText(requireContext(), menuItem)
// NMC customization
menuItem.icon = menuItem.icon?.let {
viewThemeUtils.platform.colorDrawable(
it,
ContextCompat.getColor(requireContext(), R.color.fontAppbar)
)
}
}

override fun onMenuItemSelected(menuItem: MenuItem): Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,8 @@ public boolean onCreateActionMode(ActionMode mode, Menu menu) {

final MenuItem item = menu.findItem(R.id.custom_menu_placeholder_item);
if (item.getIcon() != null) {
item.setIcon(viewThemeUtils.platform.colorDrawable(item.getIcon(), ContextCompat.getColor(requireContext(), R.color.white)));
// NMC customization
item.setIcon(viewThemeUtils.platform.colorDrawable(item.getIcon(), ContextCompat.getColor(requireContext(), R.color.fontAppbar)));
}

mActiveActionMode.invalidate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,11 @@ class PreviewMediaFragment :
val item = menu.findItem(R.id.custom_menu_placeholder_item)

item.icon?.let {
// NMC customization
item.setIcon(
viewThemeUtils.platform.colorDrawable(
it,
ContextCompat.getColor(requireContext(), R.color.white)
ContextCompat.getColor(requireContext(), R.color.fontAppbar)
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class PreviewPlaybackFragment :
item.setIcon(
viewThemeUtils.platform.colorDrawable(
it,
ContextCompat.getColor(requireContext(), R.color.white)
ContextCompat.getColor(requireContext(), R.color.fontAppbar)
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import android.widget.TextView
import androidx.annotation.IdRes
import androidx.annotation.VisibleForTesting
import androidx.core.content.ContextCompat
import androidx.appcompat.view.ContextThemeWrapper
import androidx.core.content.res.ResourcesCompat
import androidx.core.view.MenuHost
import androidx.core.view.MenuProvider
Expand Down Expand Up @@ -253,7 +254,9 @@ class TrashbinFragment :
}

override fun onOverflowIconClicked(file: TrashbinFile, view: View) {
PopupMenu(requireContext(), view).apply {
// NMC Customization
val ctw = ContextThemeWrapper(requireContext(), R.style.CustomPopupTheme)
PopupMenu(ctw, view).apply {
inflate(R.menu.item_trashbin)
setOnMenuItemClickListener {
onFileActionChosen(it.itemId, setOf(file))
Expand Down Expand Up @@ -549,10 +552,11 @@ class TrashbinFragment :
val item = menu.findItem(R.id.custom_menu_placeholder_item)
item.icon?.let {
item.setIcon(
// NMC Customization: color of menu
activity?.let { it1 ->
viewThemeUtils.platform.colorDrawable(
it,
ContextCompat.getColor(it1, R.color.white)
ContextCompat.getColor(it1, R.color.fontAppbar)
)
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,19 @@ class FilesSpecificViewThemeUtils @Inject constructor(
.setThumbDrawable(getThumbDrawable(context))
.setPopupStyle {
PopupStyles.MD2.accept(it)
it.background = FastScrollPopupBackground(context, scheme.primary)
//NMC customisation
it.background = FastScrollPopupBackground(context, context.resources.getColor(R.color.primary, null))
}
}

private fun getThumbDrawable(context: Context): Drawable = checkNotNull(
androidViewThemeUtils.tintDrawable(
context,
me.zhanghai.android.fastscroll.R.drawable.afs_md2_thumb,
ColorRole.PRIMARY
androidViewThemeUtils.colorDrawable(
ResourcesCompat.getDrawable(
context.resources,
me.zhanghai.android.fastscroll.R.drawable.afs_md2_thumb,
null
)!!,
context.resources.getColor(R.color.primary, null)
)
) { "Fast scroller thumb drawable not found" }

Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/color/spinner_color_state.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/primary" android:state_enabled="true" />
<item android:color="@color/grey_30" />
</selector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/bg_spinner.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<layer-list>
<item android:drawable="@drawable/ic_keyboard_arrow_down"
android:gravity="center_vertical|right" android:right="5dp" />
</layer-list>
</item>
</selector>
10 changes: 10 additions & 0 deletions app/src/main/res/layout/simple_spinner_item.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
style="?android:attr/spinnerItemStyle"
android:singleLine="true"
android:textColor="@color/spinner_color_state"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:textAlignment="inherit"/>
1 change: 1 addition & 0 deletions app/src/main/res/layout/upload_files_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
<Spinner
android:layout_width="match_parent"
android:layout_height="0dp"
style="@style/SpinnerTheme"
android:id="@+id/upload_files_spinner_behaviour"
android:layout_weight="1"/>
</LinearLayout>
Expand Down
73 changes: 73 additions & 0 deletions app/src/main/res/values-night/nmc_colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Nextcloud - Android Client
~
~ SPDX-FileCopyrightText: 2026 TSI-mc <surinder.kumar@t-systems.com>
~ SPDX-License-Identifier: AGPL-3.0-or-later
-->

<resources>
<!-- NMC Colors -->
<color name="icon_color">#FFFFFF</color>
<color name="sort_text_color">@color/grey_30</color>
<color name="list_icon_color">@color/grey_30</color>
<color name="warning_icon_color">#CCCCCC</color>
<color name="divider_color">@color/grey_70</color>
<color name="spinner_bg_color">@color/grey_80</color>
<color name="refresh_layout_bg_color">#2D2D2D</color>
<color name="primary_button_disabled_color">@color/grey_70</color>
<color name="toolbar_divider_color">@color/grey_70</color>

<!-- Snackbar Colors -->
<color name="snackbar_bg_color">@color/grey_80</color>
<color name="snackbar_txt_color">@color/grey_0</color>

<!-- Alert Dialog Colors -->
<color name="alert_bg_color">@color/grey_80</color>
<color name="alert_txt_color">@color/grey_0</color>

<!-- NavigationView colors -->
<color name="nav_selected_bg_color">@color/grey_60</color>
<color name="nav_txt_unselected_color">@color/grey_0</color>
<color name="nav_txt_selected_color">@color/grey_0</color>
<color name="nav_icon_unselected_color">@color/grey_30</color>
<color name="nav_icon_selected_color">#FFFFFF</color>
<color name="nav_divider_color">@color/grey_30</color>
<color name="nav_bg_color">@color/grey_80</color>
<color name="drawer_quota_txt_color">#FFFFFF</color>

<!-- Bottom Sheet Colors -->
<color name="bottom_sheet_bg_color">@color/grey_80</color>
<color name="bottom_sheet_icon_color">@color/grey_30</color>
<color name="bottom_sheet_txt_color">@color/grey_0</color>

<!-- Popup Menu Colors -->
<color name="popup_menu_bg">@color/grey_80</color>
<color name="popup_menu_txt_color">@color/grey_0</color>
<color name="overflow_bg_color">@color/grey_80</color>

<!-- Switch Compat Colors -->
<color name="switch_thumb_disabled">@color/grey_70</color>
<color name="switch_track_disabled">@color/grey_60</color>

<!-- Checkbox Colors -->
<color name="checkbox_checked_disabled">@color/grey_70</color>
<color name="checkbox_unchecked_disabled">@color/grey_70</color>

<!-- Share Colors -->
<color name="share_title_txt_color">#FFFFFF</color>
<color name="share_subtitle_txt_color">@color/grey_30</color>
<color name="share_info_txt_color">@color/grey_0</color>
<color name="share_search_border_color">@color/grey_0</color>
<color name="share_btn_txt_color">@color/grey_0</color>
<color name="share_list_item_txt_color">@color/grey_0</color>
<color name="share_disabled_txt_color">@color/grey_60</color>
<color name="share_txt_color">@color/grey_0</color>
<color name="share_et_divider">#FFFFFF</color>
<color name="share_blue_color">#7d94f9</color>

<!-- Scan Colors -->
<color name="scan_doc_bg_color">#121212</color>
<color name="scan_text_color">@color/grey_0</color>
<color name="scan_edit_bottom_color">@color/grey_80</color>
<color name="scan_count_bg_color">@color/grey_80</color>
</resources>
Loading
Loading