forked from upstream-mirrors/OpenTracks
SplashScreen: use Androidx library.
Improvement for Android 12+. Fixes #1365.
This commit is contained in:
@@ -129,6 +129,7 @@ dependencies {
|
|||||||
implementation 'androidx.documentfile:documentfile:1.0.1'
|
implementation 'androidx.documentfile:documentfile:1.0.1'
|
||||||
implementation 'com.google.android.material:material:1.6.1'
|
implementation 'com.google.android.material:material:1.6.1'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||||
|
implementation 'androidx.core:core-splashscreen:1.0.0'
|
||||||
|
|
||||||
androidTestImplementation 'androidx.test:core:1.4.0'
|
androidTestImplementation 'androidx.test:core:1.4.0'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.widget.SearchView;
|
import androidx.appcompat.widget.SearchView;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.core.splashscreen.SplashScreen;
|
||||||
import androidx.cursoradapter.widget.ResourceCursorAdapter;
|
import androidx.cursoradapter.widget.ResourceCursorAdapter;
|
||||||
import androidx.loader.app.LoaderManager;
|
import androidx.loader.app.LoaderManager;
|
||||||
import androidx.loader.content.CursorLoader;
|
import androidx.loader.content.CursorLoader;
|
||||||
@@ -158,8 +159,7 @@ public class TrackListActivity extends AbstractTrackDeleteActivity implements Co
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
// Reset theme after splash
|
SplashScreen.installSplashScreen(this);
|
||||||
setTheme(R.style.ThemeCustom);
|
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
|
setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.core.splashscreen.SplashScreen;
|
||||||
|
|
||||||
import de.dennisguse.opentracks.R;
|
import de.dennisguse.opentracks.R;
|
||||||
import de.dennisguse.opentracks.services.TrackRecordingService;
|
import de.dennisguse.opentracks.services.TrackRecordingService;
|
||||||
@@ -30,7 +31,10 @@ public abstract class AbstractAPIActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
SplashScreen splashScreen = SplashScreen.installSplashScreen(this);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
splashScreen.setKeepOnScreenCondition(() -> true );
|
||||||
|
|
||||||
if (PreferencesUtils.isPublicAPIenabled()) {
|
if (PreferencesUtils.isPublicAPIenabled()) {
|
||||||
Log.i(TAG, "Received and trying to execute requested action.");
|
Log.i(TAG, "Received and trying to execute requested action.");
|
||||||
new TrackRecordingServiceConnection(serviceConnectedCallback)
|
new TrackRecordingServiceConnection(serviceConnectedCallback)
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:aapt="http://schemas.android.com/aapt"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="100"
|
||||||
|
android:viewportHeight="100">
|
||||||
|
|
||||||
|
<group
|
||||||
|
android:name="rotationGroup"
|
||||||
|
android:pivotX="50"
|
||||||
|
android:pivotY="50"
|
||||||
|
android:scaleX="0.6"
|
||||||
|
android:scaleY="0.6"
|
||||||
|
>
|
||||||
|
<path android:pathData="M82.489,12.834C83.196,10.418 82.043,9.556 79.926,10.917L10.087,55.828c-2.117,1.361 -1.795,2.628 0.714,2.815L39.806,60.807c2.51,0.188 5.291,2.267 6.18,4.621l10.282,27.208c0.89,2.354 2.195,2.304 2.902,-0.111z">
|
||||||
|
<aapt:attr name="android:fillColor">
|
||||||
|
<gradient
|
||||||
|
android:endX="70.0"
|
||||||
|
android:endY="30.0"
|
||||||
|
android:startX="7.0"
|
||||||
|
android:startY="83.0"
|
||||||
|
android:type="linear">
|
||||||
|
<item
|
||||||
|
android:color="#FFFBB22F"
|
||||||
|
android:offset="0" />
|
||||||
|
<item
|
||||||
|
android:color="#FFFF6D00"
|
||||||
|
android:offset="1" />
|
||||||
|
</gradient>
|
||||||
|
</aapt:attr>
|
||||||
|
</path>
|
||||||
|
</group>
|
||||||
|
</vector>
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:opacity="opaque">
|
|
||||||
|
|
||||||
<item android:drawable="@color/splashscreen_background" />
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:width="300dp"
|
|
||||||
android:height="300dp"
|
|
||||||
android:gravity="center"
|
|
||||||
tools:targetApi="m">
|
|
||||||
<inset
|
|
||||||
android:drawable="@drawable/ic_logo_color_24dp"
|
|
||||||
android:inset="20dp" />
|
|
||||||
</item>
|
|
||||||
|
|
||||||
</layer-list>
|
|
||||||
@@ -59,10 +59,11 @@ limitations under the License.
|
|||||||
<item name="indicatorColor">?attr/colorSecondary</item>
|
<item name="indicatorColor">?attr/colorSecondary</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="SplashTheme" parent="ThemeCustom">
|
<style name="SplashTheme" parent="Theme.SplashScreen">
|
||||||
<item name="android:statusBarColor">@color/splashscreen_background</item>
|
<item name="windowSplashScreenBackground">@color/splashscreen_background</item>
|
||||||
<item name="android:navigationBarColor">@color/splashscreen_background</item>
|
|
||||||
<item name="android:windowBackground">@drawable/splashscreen</item>
|
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_logo_color_splashscreen</item>
|
||||||
|
<item name="postSplashScreenTheme">@style/ThemeCustom</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Widget.OpenTracks.FloatingActionButton" parent="Widget.MaterialComponents.FloatingActionButton">
|
<style name="Widget.OpenTracks.FloatingActionButton" parent="Widget.MaterialComponents.FloatingActionButton">
|
||||||
|
|||||||
Reference in New Issue
Block a user