Removed launcher activity, replaced by SplashScreen API
This commit is contained in:
parent
7ff3d7abfe
commit
64a54a0bfb
9 changed files with 42 additions and 167 deletions
|
@ -230,6 +230,7 @@ dependencies {
|
|||
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.2.1'
|
||||
implementation "androidx.security:security-crypto-ktx:1.1.0-alpha03"
|
||||
implementation 'androidx.core:core-splashscreen:1.0.0-alpha02'
|
||||
|
||||
implementation 'com.google.android.material:material:1.4.0'
|
||||
implementation 'com.google.android.flexbox:flexbox:3.0.0'
|
||||
|
|
|
@ -39,29 +39,24 @@
|
|||
android:label="${appLabel}"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:extractNativeLibs="${extractNativeLibs}"
|
||||
android:theme="@style/AppTheme"
|
||||
android:theme="@style/AppSplashScreenTheme"
|
||||
android:allowNativeHeapPointerTagging="false">
|
||||
|
||||
<activity
|
||||
android:name=".activities.launcher.LauncherActivity"
|
||||
android:exported="true"
|
||||
android:noHistory="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
<meta-data
|
||||
android:name="android.app.shortcuts"
|
||||
android:resource="@xml/shortcuts" />
|
||||
</activity>
|
||||
|
||||
<activity android:name=".activities.main.MainActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTask"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<nav-graph android:value="@navigation/main_nav_graph" />
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
|
||||
<meta-data
|
||||
android:name="android.app.shortcuts"
|
||||
android:resource="@xml/shortcuts" />
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW_LOCUS" />
|
||||
</intent-filter>
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2020 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-android
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.linphone.activities.launcher
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||
import org.linphone.LinphoneApplication.Companion.corePreferences
|
||||
import org.linphone.R
|
||||
import org.linphone.activities.GenericActivity
|
||||
import org.linphone.activities.main.MainActivity
|
||||
import org.linphone.core.tools.Log
|
||||
|
||||
class LauncherActivity : GenericActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
setContentView(R.layout.launcher_activity)
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
coreContext.handler.postDelayed({ onReady() }, 500)
|
||||
}
|
||||
|
||||
private fun onReady() {
|
||||
Log.i("[Launcher] Core is ready")
|
||||
|
||||
if (corePreferences.preventInterfaceFromShowingUp) {
|
||||
Log.w("[Context] We were asked to not show the user interface")
|
||||
finish()
|
||||
return
|
||||
}
|
||||
|
||||
val intent = Intent()
|
||||
intent.setClass(this, MainActivity::class.java)
|
||||
|
||||
// Propagate current intent action, type and data
|
||||
if (getIntent() != null) {
|
||||
val extras = getIntent().extras
|
||||
if (extras != null) intent.putExtras(extras)
|
||||
}
|
||||
intent.action = getIntent().action
|
||||
intent.type = getIntent().type
|
||||
intent.data = getIntent().data
|
||||
|
||||
startActivity(intent)
|
||||
if (corePreferences.enableAnimations) {
|
||||
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -30,6 +30,7 @@ import android.view.Gravity
|
|||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.databinding.DataBindingUtil
|
||||
|
@ -112,6 +113,8 @@ class MainActivity : GenericActivity(), SnackBarActivity, NavController.OnDestin
|
|||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
val splashScreen = installSplashScreen()
|
||||
|
||||
binding = DataBindingUtil.setContentView(this, R.layout.main_activity)
|
||||
binding.lifecycleOwner = this
|
||||
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@color/dark_grey_color" />
|
||||
<item>
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@drawable/linphone_logo"
|
||||
android:tint="@color/primary_color"/>
|
||||
</item>
|
||||
<item android:top="300dp">
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@drawable/linphone_app_name_logo" />
|
||||
</item>
|
||||
</layer-list>
|
20
app/src/main/res/drawable/vector_linphone_logo.xml
Normal file
20
app/src/main/res/drawable/vector_linphone_logo.xml
Normal file
|
@ -0,0 +1,20 @@
|
|||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:name="vector"
|
||||
android:width="60dp"
|
||||
android:height="60dp"
|
||||
android:viewportWidth="60"
|
||||
android:viewportHeight="60">
|
||||
<group
|
||||
android:name="group"
|
||||
android:translateX="15"
|
||||
android:translateY="15"
|
||||
android:scaleX="0.5"
|
||||
android:scaleY="0.5">
|
||||
<path
|
||||
android:name="path"
|
||||
android:pathData="M 53.893 48.839 C 56.543 45.357 58.459 41.276 59.39 36.828 C 51.515 43.716 41.339 47.882 30.236 47.882 C 19.111 47.882 9.047 43.873 1.173 36.976 C 4.074 50.479 15.993 60.599 30.266 60.599 C 36.279 60.598 41.87 58.797 46.551 55.708 C 49.343 57.294 56.667 61.285 57.624 60.051 C 58.282 59.201 56.671 55.692 56.671 55.692 L 53.893 48.839 Z M 59.301 21.99 C 59.189 21.455 58.702 20.063 58.702 20.063 C 54.383 8.89 42.981 0.963 30.318 0.963 L 30.245 0.963 C 24.273 0.963 18.582 2.728 13.782 5.763 C 11.591 4.504 3.17 -0.209 2.138 1.115 C 1.48 1.962 3.092 5.461 3.092 5.461 L 6.052 12.731 C 4.31 14.952 2.884 17.415 1.86 20.063 C 1.86 20.063 1.373 21.455 1.261 21.99 C 1.101 22.752 0.883 24.274 0.883 24.274 L 4.937 20.151 C 4.937 20.151 7.942 21.927 10.81 22.819 C 11.936 23.168 13.046 23.566 14.185 23.852 C 15.909 24.285 16.698 25.828 16.693 27.244 C 16.688 28.443 16.696 29.639 16.689 30.838 C 16.688 31.38 16.879 31.784 17.365 32.067 C 18.49 32.72 19.705 33.117 20.955 33.44 C 24.199 34.277 26.923 34.736 30.245 34.701 L 30.318 34.701 C 33.64 34.736 36.364 34.277 39.608 33.44 C 40.858 33.117 42.072 32.72 43.198 32.067 C 43.684 31.784 43.874 31.38 43.873 30.838 C 43.866 29.639 43.874 28.443 43.869 27.244 C 43.864 25.828 44.653 24.285 46.377 23.852 C 47.516 23.566 48.628 23.168 49.752 22.819 C 52.62 21.927 55.626 20.151 55.626 20.151 L 59.68 24.274 C 59.68 24.274 59.462 22.752 59.301 21.99"
|
||||
android:fillColor="@color/primary_color"
|
||||
android:strokeWidth="1"/>
|
||||
</group>
|
||||
</vector>
|
|
@ -1,65 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/dark_grey_color">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="75dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/linphone_logo_tinted"/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:layout_marginBottom="50dp"
|
||||
android:layout_gravity="center"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/linphone_app_name_logo" />
|
||||
|
||||
<TextView
|
||||
android:textColor="?attr/secondaryTextColor"
|
||||
android:textAllCaps="true"
|
||||
android:textSize="50sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/app_name"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:textColor="?attr/accentColor"
|
||||
android:textSize="28sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/app_description" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:indeterminateTint="@color/primary_color"
|
||||
android:layout_marginBottom="20dp" />
|
||||
|
||||
<View
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="10dp"
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:background="@color/primary_color" />
|
||||
|
||||
</FrameLayout>
|
|
@ -4,7 +4,7 @@
|
|||
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||
<!-- Disable animations between activities -->
|
||||
<item name="android:windowAnimationStyle">@null</item>
|
||||
<item name="android:windowBackground">@color/dark_grey_color</item>
|
||||
<item name="android:windowBackground">@color/transparent_color</item>
|
||||
|
||||
<!-- Android theme override -->
|
||||
<item name="colorAccent">@color/primary_color</item>
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<resources>
|
||||
<style name="AppSplashScreenTheme" parent="Theme.SplashScreen">
|
||||
<item name="windowSplashScreenBackground">@color/dark_grey_color</item>
|
||||
<item name="windowSplashScreenAnimatedIcon">@drawable/vector_linphone_logo</item>
|
||||
<item name="postSplashScreenTheme">@style/AppTheme</item>
|
||||
</style>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
|
||||
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||
<!-- Disable animations between activities -->
|
||||
<item name="android:windowAnimationStyle">@null</item>
|
||||
<item name="android:windowBackground">@drawable/launch_screen</item>
|
||||
<item name="android:windowBackground">@color/transparent_color</item>
|
||||
|
||||
<!-- Android theme override -->
|
||||
<item name="colorAccent">@color/primary_color</item>
|
||||
|
|
Loading…
Reference in a new issue