Эх сурвалжийг харах

Splash text updated, logo removed and test cases updated.

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
A117870935 2 жил өмнө
parent
commit
aa199088df

+ 6 - 1
app/src/androidTest/java/com/nmc/android/ui/LauncherActivityIT.kt

@@ -4,6 +4,7 @@ import androidx.test.espresso.Espresso.onView
 import androidx.test.espresso.assertion.ViewAssertions.matches
 import androidx.test.espresso.matcher.ViewMatchers.isCompletelyDisplayed
 import androidx.test.espresso.matcher.ViewMatchers.withId
+import androidx.test.espresso.matcher.ViewMatchers.withText
 import androidx.test.ext.junit.rules.ActivityScenarioRule
 import androidx.test.ext.junit.runners.AndroidJUnit4
 import com.owncloud.android.AbstractIT
@@ -23,6 +24,10 @@ class LauncherActivityIT : AbstractIT() {
     fun verifyUIElements() {
         waitForIdleSync()
         onView(withId(R.id.ivSplash)).check(matches(isCompletelyDisplayed()))
-        onView(withId(R.id.tvSplash)).check(matches(isCompletelyDisplayed()))
+        onView(withId(R.id.splashScreenBold)).check(matches(isCompletelyDisplayed()))
+        onView(withId(R.id.splashScreenNormal)).check(matches(isCompletelyDisplayed()))
+
+        onView(withId(R.id.splashScreenBold)).check(matches(withText("Magenta")))
+        onView(withId(R.id.splashScreenNormal)).check(matches(withText("CLOUD")))
     }
 }

+ 8 - 6
app/src/main/java/com/nmc/android/ui/LauncherActivity.kt

@@ -3,6 +3,8 @@ package com.nmc.android.ui
 import android.content.Intent
 import android.os.Bundle
 import android.os.Handler
+import android.text.TextUtils
+import android.view.View
 import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
 import com.nextcloud.client.preferences.AppPreferences
 import com.owncloud.android.R
@@ -10,7 +12,6 @@ import com.owncloud.android.authentication.AuthenticatorActivity
 import com.owncloud.android.databinding.ActivitySplashBinding
 import com.owncloud.android.ui.activity.BaseActivity
 import com.owncloud.android.ui.activity.FileDisplayActivity
-import com.owncloud.android.utils.StringUtils
 import javax.inject.Inject
 
 class LauncherActivity : BaseActivity() {
@@ -37,14 +38,15 @@ class LauncherActivity : BaseActivity() {
         binding = ActivitySplashBinding.inflate(layoutInflater)
 
         setContentView(binding.root)
-        setSplashTitle()
+        updateBoldTitleVisibility()
         scheduleSplashScreen()
     }
 
-    private fun setSplashTitle() {
-        val appName = resources.getString(R.string.app_name)
-        val textToBold = resources.getString(R.string.project_name)
-        binding.tvSplash.text = StringUtils.makeTextBold(appName, textToBold)
+    private fun updateBoldTitleVisibility() {
+        //For NC this will be empty so to handle that case we have added this check
+        if (TextUtils.isEmpty(resources.getString(R.string.splashScreenBold))) {
+            binding.splashScreenBold.visibility = View.GONE
+        }
     }
 
     private fun scheduleSplashScreen() {

+ 0 - 20
app/src/main/java/com/owncloud/android/utils/StringUtils.java

@@ -21,11 +21,6 @@
 package com.owncloud.android.utils;
 
 
-import android.graphics.Typeface;
-import android.text.Spannable;
-import android.text.SpannableString;
-import android.text.style.StyleSpan;
-
 import java.util.Locale;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -82,19 +77,4 @@ public final class StringUtils {
         }
         return s;
     }
-
-    /**
-     * make the passed text bold
-     *
-     * @param fullText   actual text
-     * @param textToBold to be bold
-     * @return
-     */
-    public static Spannable makeTextBold(String fullText, String textToBold) {
-        Spannable spannable = new SpannableString(fullText);
-        int indexStart = fullText.indexOf(textToBold);
-        int indexEnd = indexStart + textToBold.length();
-        spannable.setSpan(new StyleSpan(Typeface.BOLD), indexStart, indexEnd, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
-        return spannable;
-    }
 }

+ 0 - 16
app/src/main/res/drawable/ic_magentacloud_splash_logo.xml

@@ -1,16 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-    android:width="200dp"
-    android:height="200dp"
-    android:viewportWidth="300"
-    android:viewportHeight="300">
-    <group>
-        <path
-            android:fillColor="#fff"
-            android:pathData="M132.225,229.086a74.15,74.15 0,0 1,-51.084 -20.293,40.579 40.579,0 0,1 -8.912,0.987 39.97,39.97 0,0 1,-15.658 -3.161,40.09 40.09,0 0,1 -12.787,-8.621 40.115,40.115 0,0 1,-8.621 -12.785,39.961 39.961,0 0,1 -3.162,-15.658 40.1,40.1 0,0 1,2.387 -13.68,40.106 40.106,0 0,1 6.6,-11.664 40.32,40.32 0,0 1,9.977 -8.812,39.926 39.926,0 0,1 12.516,-5.121 39.934,39.934 0,0 1,39.859 -37.62,39.943 39.943,0 0,1 11.367,1.643 67.41,67.41 0,0 1,10.424 -10.856,67.1 67.1,0 0,1 12.627,-8.292 66.608,66.608 0,0 1,14.4 -5.293,67.237 67.237,0 0,1 15.738,-1.861 66.685,66.685 0,0 1,23.594 4.277,66.635 66.635,0 0,1 19.91,11.789 66.96,66.96 0,0 1,14.668 17.739,66.3 66.3,0 0,1 7.859,22.125 42.649,42.649 0,0 1,13.533 5.4,43.075 43.075,0 0,1 10.8,9.421 42.77,42.77 0,0 1,7.15 12.529,42.849 42.849,0 0,1 2.588,14.725 42.727,42.727 0,0 1,-3.381 16.736,42.812 42.812,0 0,1 -9.215,13.667 42.849,42.849 0,0 1,-13.668 9.215,42.725 42.725,0 0,1 -16.736,3.379 43.219,43.219 0,0 1,-4.557 -0.237,39.822 39.822,0 0,1 -13.168,9.656 39.628,39.628 0,0 1,-16.52 3.567,39.58 39.58,0 0,1 -17.539,-4.044v-50.322h33.172l-50.49,-51.667 -50.787,51.667h33.465v61.2C136.477,228.994 134.34,229.086 132.225,229.086Z" />
-        <path
-            android:strokeAlpha="0.2"
-            android:fillColor="#E20074"
-            android:fillAlpha="0.2"
-            android:pathData="M206.388,179.173L173.216,179.173L173.216,167.62L195.098,167.62l11.288,11.551ZM138.577,179.173L104.816,179.173L116.237,167.62h22.34L138.577,179.172Z" />
-    </group>
-</vector>

+ 3 - 3
app/src/main/res/layout/activity_splash.xml

@@ -12,13 +12,13 @@
         app:layout_constraintBottom_toTopOf="@+id/guideline"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
-        app:srcCompat="@drawable/ic_magentacloud_splash_logo" />
+        app:srcCompat="@drawable/nextcloud_logo" />
 
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:orientation="horizontal"
         android:gravity="center_horizontal"
+        android:orientation="horizontal"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/guideline">
@@ -29,6 +29,7 @@
             android:layout_height="wrap_content"
             android:text="@string/splashScreenBold"
             android:textColor="@color/white"
+            android:textStyle="bold"
             android:textSize="@dimen/txt_size_20sp" />
 
         <androidx.appcompat.widget.AppCompatTextView
@@ -40,7 +41,6 @@
             android:textSize="@dimen/txt_size_20sp" />
     </LinearLayout>
 
-
     <androidx.constraintlayout.widget.Guideline
         android:id="@+id/guideline"
         android:layout_width="wrap_content"

+ 1 - 1
app/src/main/res/values/setup.xml

@@ -6,7 +6,7 @@
 
     <!-- App name  and other strings-->
     <string name="app_name">Nextcloud</string>
-    <!-- required for NMC and will change to Magenta once branding changes applied -->
+    <!-- required for NMC -->
     <string name="splashScreenBold">Magenta</string>
     <string name="splashScreenNormal">CLOUD</string>
     <string name="account_type">nextcloud</string>     <!-- better if was a domain name; but changing it now would require migrate accounts when the app is updated -->