Added splash screen.

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
A117870935 2023-04-04 17:18:40 +05:30 committed by Andy Scherzinger
parent ef4d638138
commit 1565e68be0
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
9 changed files with 187 additions and 6 deletions

View file

@ -102,11 +102,6 @@
android:exported="true" android:exported="true"
android:launchMode="singleTop" android:launchMode="singleTop"
android:theme="@style/Theme.ownCloud.Launcher"> android:theme="@style/Theme.ownCloud.Launcher">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.SEARCH" /> <action android:name="android.intent.action.SEARCH" />
</intent-filter> </intent-filter>
@ -492,6 +487,18 @@
android:name="com.nextcloud.client.documentscan.DocumentScanActivity" android:name="com.nextcloud.client.documentscan.DocumentScanActivity"
android:exported="false" android:exported="false"
android:theme="@style/Theme.ownCloud.Toolbar" /> android:theme="@style/Theme.ownCloud.Toolbar" />
<activity
android:name="com.nmc.android.ui.SplashActivity"
android:theme="@style/Theme.ownCloud.Launcher"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application> </application>
<queries> <queries>

View file

@ -36,6 +36,7 @@ import com.nextcloud.client.widget.DashboardWidgetService;
import com.nextcloud.ui.ChooseAccountDialogFragment; import com.nextcloud.ui.ChooseAccountDialogFragment;
import com.nextcloud.ui.SetStatusDialogFragment; import com.nextcloud.ui.SetStatusDialogFragment;
import com.nextcloud.ui.fileactions.FileActionsBottomSheet; import com.nextcloud.ui.fileactions.FileActionsBottomSheet;
import com.nmc.android.ui.SplashActivity;
import com.owncloud.android.MainApp; import com.owncloud.android.MainApp;
import com.owncloud.android.authentication.AuthenticatorActivity; import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.authentication.DeepLinkLoginActivity; import com.owncloud.android.authentication.DeepLinkLoginActivity;
@ -466,4 +467,8 @@ abstract class ComponentsModule {
@ContributesAndroidInjector @ContributesAndroidInjector
abstract GroupfolderListFragment groupfolderListFragment(); abstract GroupfolderListFragment groupfolderListFragment();
@ContributesAndroidInjector
abstract SplashActivity splashActivity();
} }

View file

@ -0,0 +1,60 @@
package com.nmc.android.ui
import android.content.Intent
import android.os.Bundle
import android.os.Handler
import com.nextcloud.client.preferences.AppPreferences
import com.owncloud.android.R
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 SplashActivity : BaseActivity() {
companion object {
const val SPLASH_DURATION = 1500L
}
private lateinit var binding : ActivitySplashBinding
@Inject
lateinit var appPreferences: AppPreferences
override fun onCreate(savedInstanceState: Bundle?) {
//flag to avoid redirection to AuthenticatorActivity
//as we need this activity to be shown
//Note: Should be kept before super() method
enableAccountHandling = false
super.onCreate(savedInstanceState)
binding = ActivitySplashBinding.inflate(layoutInflater)
setContentView(binding.root)
setSplashTitle()
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 scheduleSplashScreen() {
Handler().postDelayed(
{
//if user is null then go to authenticator activity
if (!user.isPresent) {
startActivity(Intent(this, AuthenticatorActivity::class.java))
} else {
startActivity(Intent(this, FileDisplayActivity::class.java))
}
finish()
},
SPLASH_DURATION
)
}
}

View file

@ -21,6 +21,11 @@
package com.owncloud.android.utils; 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.Locale;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -77,4 +82,19 @@ public final class StringUtils {
} }
return s; 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;
}
} }

View file

@ -0,0 +1,16 @@
<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>

View file

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/primary">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/ivSplash"
android:layout_width="@dimen/splash_image_size"
android:layout_height="@dimen/splash_image_size"
app:layout_constraintBottom_toTopOf="@+id/guideline"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="@drawable/ic_magentacloud_splash_logo" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tvSplash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="-10dp"
android:text="@string/app_name"
android:textColor="@color/white"
android:textSize="@dimen/txt_size_20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/guideline" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.45" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="splash_image_size">116dp</dimen>
<dimen name="grid_recyclerview_padding">4dp</dimen>
<dimen name="list_item_icons_size">16dp</dimen>
<dimen name="grid_item_icons_size">24dp</dimen>
<dimen name="media_grid_item_rv_spacing">6dp</dimen>
<dimen name="txt_size_14sp">14sp</dimen>
<dimen name="txt_size_16sp">16sp</dimen>
<dimen name="txt_size_18sp">18sp</dimen>
<dimen name="txt_size_15sp">15sp</dimen>
<dimen name="crop_corner_size">15dp</dimen>
<dimen name="edit_scan_bottom_bar_height">56dp</dimen>
<dimen name="standard_folders_grid_item_size">86dp</dimen>
<dimen name="standard_files_grid_item_size">80dp</dimen>
<dimen name="txt_size_11sp">11sp</dimen>
<dimen name="share_row_icon_size">30dp</dimen>
<dimen name="create_link_button_height">55dp</dimen>
<dimen name="note_et_height">258dp</dimen>
<dimen name="txt_size_17sp">17sp</dimen>
<dimen name="share_exp_date_divider_margin">20dp</dimen>
<dimen name="privacy_btn_width">160dp</dimen>
<dimen name="privacy_icon_size">50dp</dimen>
<dimen name="login_btn_width">150dp</dimen>
<dimen name="login_btn_height">55dp</dimen>
<dimen name="login_btn_bottom_margin">48dp</dimen>
<dimen name="login_btn_bottom_margin_land">48dp</dimen>
<dimen name="login_btn_bottom_margin_small_screen">24dp</dimen>
<dimen name="shared_with_me_icon_size">26dp</dimen>
<dimen name="txt_size_20sp">20sp</dimen>
<dimen name="notification_row_item_height">145dp</dimen>
<dimen name="button_stroke_width">1dp</dimen>
<dimen name="txt_size_13sp">13sp</dimen>
</resources>

View file

@ -6,6 +6,8 @@
<!-- App name and other strings--> <!-- App name and other strings-->
<string name="app_name">Nextcloud</string> <string name="app_name">Nextcloud</string>
<!-- required for NMC and will change to Magenta once branding changes applied -->
<string name="project_name">Next</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 --> <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 -->
<string name="authority">org.nextcloud</string> <!-- better if was the app package with ".provider" appended ; it identifies the provider --> <string name="authority">org.nextcloud</string> <!-- better if was the app package with ".provider" appended ; it identifies the provider -->
<string name="users_and_groups_search_authority">com.nextcloud.android.providers.UsersAndGroupsSearchProvider</string> <string name="users_and_groups_search_authority">com.nextcloud.android.providers.UsersAndGroupsSearchProvider</string>

View file

@ -284,7 +284,7 @@
<style name="Theme.ownCloud.Launcher"> <style name="Theme.ownCloud.Launcher">
<item name="android:statusBarColor">@color/primary</item> <item name="android:statusBarColor">@color/primary</item>
<item name="android:navigationBarColor">@color/primary</item> <item name="android:navigationBarColor">@color/primary</item>
<item name="android:windowBackground">@drawable/launch_screen</item> <item name="android:windowBackground">@color/primary</item>
<item name="android:textColorHint">@color/secondary_text_color</item> <item name="android:textColorHint">@color/secondary_text_color</item>
</style> </style>