[Android] Small UI improvements on Onboarding.

Nicolas Pomepuy git at videolan.org
Tue Feb 26 09:51:36 CET 2019


vlc-android | branch: master | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Fri Feb 22 14:02:34 2019 +0100| [c9b6be7c7d1aa46db8ce6ce36d142990f3275550] | committer: Geoffrey Métais

Small UI improvements on Onboarding.

> https://code.videolan.org/videolan/vlc-android/commit/c9b6be7c7d1aa46db8ce6ce36d142990f3275550
---

 vlc-android/res/layout/onboarding_folders.xml      | 18 ++++++++++++++++-
 vlc-android/res/layout/onboarding_theme.xml        | 23 +++++++---------------
 vlc-android/res/values/strings.xml                 |  1 +
 .../gui/onboarding/OnboardingFoldersFragment.kt    | 12 +++++++++++
 .../vlc/gui/onboarding/OnboardingThemeFragment.kt  | 13 +++++-------
 5 files changed, 42 insertions(+), 25 deletions(-)

diff --git a/vlc-android/res/layout/onboarding_folders.xml b/vlc-android/res/layout/onboarding_folders.xml
index 9178ee944..9f1b46d7e 100644
--- a/vlc-android/res/layout/onboarding_folders.xml
+++ b/vlc-android/res/layout/onboarding_folders.xml
@@ -7,14 +7,30 @@
     android:background="@color/onboarding_grey"
     android:orientation="vertical">
 
+    <TextView
+        android:id="@+id/onboardingFolderTitle"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="16dp"
+        android:layout_marginTop="8dp"
+        android:layout_marginEnd="16dp"
+        android:layout_marginBottom="8dp"
+        android:text="@string/directories_summary"
+        android:textColor="@color/white"
+        android:textSize="18sp"
+        app:layout_constraintBottom_toTopOf="@+id/fragment_placeholder"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
     <androidx.recyclerview.widget.RecyclerView
         android:id="@+id/ariane"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
         android:layout_marginStart="8dp"
-        android:layout_marginTop="8dp"
         android:layout_marginEnd="8dp"
         android:visibility="gone"
+        app:layout_constraintBottom_toTopOf="@+id/fragment_placeholder"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toTopOf="parent"
diff --git a/vlc-android/res/layout/onboarding_theme.xml b/vlc-android/res/layout/onboarding_theme.xml
index 13e9cbbb7..b43e7cb6b 100644
--- a/vlc-android/res/layout/onboarding_theme.xml
+++ b/vlc-android/res/layout/onboarding_theme.xml
@@ -31,19 +31,6 @@
         app:layout_constraintTop_toTopOf="parent"
         app:srcCompat="@drawable/ic_theme" />
 
-    <TextView
-        android:id="@+id/textView6"
-        android:layout_width="0dp"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="16dp"
-        android:layout_marginTop="24dp"
-        android:layout_marginEnd="16dp"
-        android:text="@string/onboarding_theme_explanation"
-        android:textSize="18sp"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/imageView3" />
-
     <androidx.constraintlayout.widget.Guideline
         android:id="@+id/guideline2"
         android:layout_width="wrap_content"
@@ -71,6 +58,7 @@
         android:layout_height="wrap_content"
         android:background="@drawable/theme_selection_rounded"
         android:padding="16dp"
+        app:layout_constraintBottom_toTopOf="@+id/guideline3"
         app:layout_constraintEnd_toStartOf="@+id/guideline2"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toTopOf="@+id/guideline3">
@@ -89,6 +77,7 @@
         android:layout_height="wrap_content"
         android:layout_marginEnd="8dp"
         android:padding="16dp"
+        app:layout_constraintBottom_toTopOf="@+id/guideline3"
         app:layout_constraintEnd_toStartOf="@+id/guideline5"
         app:layout_constraintStart_toStartOf="@+id/guideline2"
         app:layout_constraintTop_toTopOf="@+id/guideline3">
@@ -106,6 +95,7 @@
         android:layout_height="wrap_content"
         android:layout_marginStart="8dp"
         android:padding="16dp"
+        app:layout_constraintBottom_toTopOf="@+id/guideline3"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="@+id/guideline5"
         app:layout_constraintTop_toTopOf="@+id/guideline3">
@@ -118,15 +108,16 @@
     </FrameLayout>
 
     <TextView
-        android:id="@+id/themeDayNightDescription"
-        android:layout_width="0dp"
+        android:id="@+id/themeDescription"
+        android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_marginStart="24dp"
         android:layout_marginTop="16dp"
         android:layout_marginEnd="24dp"
+        android:maxWidth="250dp"
         android:background="@drawable/theme_selection_rounded"
         android:padding="8dp"
-        android:text="@string/daynight_explanation"
+        android:text="@string/light_theme"
         android:textAlignment="center"
         android:textColor="@color/white"
         app:layout_constraintEnd_toEndOf="parent"
diff --git a/vlc-android/res/values/strings.xml b/vlc-android/res/values/strings.xml
index 193288ba9..f1860c0a2 100644
--- a/vlc-android/res/values/strings.xml
+++ b/vlc-android/res/values/strings.xml
@@ -686,4 +686,5 @@
     <string name="onboarding_scan_whole">VLC will scan my whole SDCard</string>
     <string name="onboarding_scan_customize">Let me choose which folders VLC will scan</string>
     <string name="button_medialibrary_preferences">Go to Medialibrary preferences</string>
+    <string name="light_theme">Light theme</string>
 </resources>
diff --git a/vlc-android/src/org/videolan/vlc/gui/onboarding/OnboardingFoldersFragment.kt b/vlc-android/src/org/videolan/vlc/gui/onboarding/OnboardingFoldersFragment.kt
index cdd8807dd..def346c3c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/onboarding/OnboardingFoldersFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/onboarding/OnboardingFoldersFragment.kt
@@ -4,6 +4,7 @@ import android.os.Bundle
 import android.view.LayoutInflater
 import android.view.View
 import android.view.ViewGroup
+import android.widget.TextView
 import androidx.fragment.app.Fragment
 import org.videolan.vlc.R
 import org.videolan.vlc.gui.browser.StorageBrowserFragment
@@ -25,6 +26,17 @@ class OnboardingFoldersFragment : Fragment() {
     override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
         super.onViewCreated(view, savedInstanceState)
 
+        val title: TextView = view.findViewById(R.id.onboardingFolderTitle)
+        val ariane: View = view.findViewById(R.id.ariane)
+        ariane.viewTreeObserver.addOnGlobalLayoutListener {
+            when (ariane.visibility) {
+                View.VISIBLE -> title.visibility = View.GONE
+                else -> title.visibility = View.VISIBLE
+            }
+        }
+
+
+
         requireActivity().supportFragmentManager.beginTransaction()
                 .add(R.id.fragment_placeholder, storageBrowserFragment)
                 .commit()
diff --git a/vlc-android/src/org/videolan/vlc/gui/onboarding/OnboardingThemeFragment.kt b/vlc-android/src/org/videolan/vlc/gui/onboarding/OnboardingThemeFragment.kt
index 862b93ae9..491dc700e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/onboarding/OnboardingThemeFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/onboarding/OnboardingThemeFragment.kt
@@ -11,7 +11,7 @@ import androidx.fragment.app.Fragment
 import org.videolan.vlc.R
 
 class OnboardingThemeFragment : Fragment() {
-    private lateinit var themeDayNightDescription: TextView
+    private lateinit var themeDescription: TextView
     private lateinit var lightThemeSelector: View
     private lateinit var darkThemeSelector: View
     private lateinit var dayNightTheme: View
@@ -27,16 +27,13 @@ class OnboardingThemeFragment : Fragment() {
         lightThemeSelector = view.findViewById(R.id.lightTheme)
         darkThemeSelector = view.findViewById(R.id.darkTheme)
         dayNightTheme = view.findViewById(R.id.dayNightTheme)
-        themeDayNightDescription = view.findViewById(R.id.themeDayNightDescription)
+        themeDescription = view.findViewById(R.id.themeDescription)
 
     }
 
     override fun onActivityCreated(savedInstanceState: Bundle?) {
         super.onActivityCreated(savedInstanceState)
 
-        themeDayNightDescription.scaleX = 0f
-        themeDayNightDescription.scaleY = 0f
-        themeDayNightDescription.alpha = 0f
 
         val themeSelectorListener = View.OnClickListener {
             it.background = ContextCompat.getDrawable(requireActivity(), R.drawable.theme_selection_rounded)
@@ -45,7 +42,7 @@ class OnboardingThemeFragment : Fragment() {
                     darkThemeSelector.background = null
                     dayNightTheme.background = null
                     currentThemeIsLight = true
-                    themeDayNightDescription.animate().scaleY(0f).scaleX(0f).alpha(0f)
+                    themeDescription.setText(R.string.light_theme)
                     PreferenceManager.getDefaultSharedPreferences(requireActivity())
                             .edit()
                             .putBoolean("enable_black_theme", false)
@@ -53,10 +50,10 @@ class OnboardingThemeFragment : Fragment() {
                             .apply()
                 }
                 darkThemeSelector -> {
+                    themeDescription.setText(R.string.enable_black_theme)
                     lightThemeSelector.background = null
                     dayNightTheme.background = null
                     currentThemeIsLight = false
-                    themeDayNightDescription.animate().scaleY(0f).scaleX(0f).alpha(0f)
                     PreferenceManager.getDefaultSharedPreferences(requireActivity())
                             .edit()
                             .putBoolean("enable_black_theme", true)
@@ -64,9 +61,9 @@ class OnboardingThemeFragment : Fragment() {
                             .apply()
                 }
                 dayNightTheme -> {
+                    themeDescription.setText(R.string.daynight_explanation)
                     lightThemeSelector.background = null
                     darkThemeSelector.background = null
-                    themeDayNightDescription.animate().scaleY(1f).scaleX(1f).alpha(1f)
                     PreferenceManager.getDefaultSharedPreferences(requireActivity())
                             .edit()
                             .putBoolean("enable_black_theme", false)



More information about the Android mailing list