From 4b85e365cdf9500a806d252e94539a0c888cac75 Mon Sep 17 00:00:00 2001 From: A117870935 Date: Sun, 14 May 2023 23:50:45 +0530 Subject: [PATCH] Customized Spinner. --- .../ui/activity/UploadFilesActivity.java | 7 +- app/src/main/res/drawable/bg_spinner.xml | 9 ++ .../main/res/layout/simple_spinner_item.xml | 10 +++ .../main/res/layout/upload_files_layout.xml | 2 + app/src/main/res/values-night/colors.xml | 64 +++++++++++++ app/src/main/res/values/colors.xml | 89 +++++++++++++++++++ app/src/main/res/values/styles.xml | 4 + 7 files changed, 184 insertions(+), 1 deletion(-) create mode 100644 app/src/main/res/drawable/bg_spinner.xml create mode 100644 app/src/main/res/layout/simple_spinner_item.xml diff --git a/app/src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java index 44942b1b3a63..70675a75f6fa 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/UploadFilesActivity.java @@ -25,6 +25,8 @@ import android.app.Activity; import android.content.Intent; import android.content.pm.PackageManager; +import android.graphics.Color; +import android.graphics.PorterDuff; import android.os.Bundle; import android.os.Environment; import android.view.Menu; @@ -206,10 +208,12 @@ public void onCreate(Bundle savedInstanceState) { behaviours.add(getString(R.string.uploader_upload_files_behaviour_only_upload)); behaviours.add(getString(R.string.uploader_upload_files_behaviour_upload_and_delete_from_source)); - ArrayAdapter behaviourAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, + //custom spinner item layout for NMC + ArrayAdapter behaviourAdapter = new ArrayAdapter<>(this, R.layout.simple_spinner_item, behaviours); behaviourAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); binding.uploadFilesSpinnerBehaviour.setAdapter(behaviourAdapter); + binding.uploadFilesSpinnerBehaviour.getBackground().setColorFilter(getResources().getColor(R.color.primary, null), PorterDuff.Mode.SRC_IN); binding.uploadFilesSpinnerBehaviour.setSelection(localBehaviour); // setup the toolbar @@ -230,6 +234,7 @@ public void onCreate(Bundle savedInstanceState) { showToolbarSpinner(); mToolbarSpinner.setAdapter(mDirectories); + mToolbarSpinner.getBackground().setColorFilter(Color.TRANSPARENT, PorterDuff.Mode.SRC_IN); mToolbarSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView parent, View view, int position, long id) { diff --git a/app/src/main/res/drawable/bg_spinner.xml b/app/src/main/res/drawable/bg_spinner.xml new file mode 100644 index 000000000000..d48644569a5c --- /dev/null +++ b/app/src/main/res/drawable/bg_spinner.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/simple_spinner_item.xml b/app/src/main/res/layout/simple_spinner_item.xml new file mode 100644 index 000000000000..d4e0efd9c107 --- /dev/null +++ b/app/src/main/res/layout/simple_spinner_item.xml @@ -0,0 +1,10 @@ + + \ No newline at end of file diff --git a/app/src/main/res/layout/upload_files_layout.xml b/app/src/main/res/layout/upload_files_layout.xml index ee799542bc77..d105e4fd8b25 100644 --- a/app/src/main/res/layout/upload_files_layout.xml +++ b/app/src/main/res/layout/upload_files_layout.xml @@ -69,7 +69,9 @@ diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml index 08bf64d552ad..e926fdcc432f 100644 --- a/app/src/main/res/values-night/colors.xml +++ b/app/src/main/res/values-night/colors.xml @@ -48,4 +48,68 @@ #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/colors.xml b/app/src/main/res/values/colors.xml index 58fcdecf1fc2..b05b582157a7 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -82,4 +82,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 c1ef3a3c3f36..791797fe9604 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -464,6 +464,10 @@ @null +