Add delay for splash screen

This commit is contained in:
PavelRatushny 2017-07-07 11:21:22 +03:00
parent cf608db4b3
commit e62b6b02ab
5 changed files with 41 additions and 9 deletions

View file

@ -7,7 +7,7 @@
android:label="@string/app_name_free" android:label="@string/app_name_free"
tools:replace="android:icon, android:label"> tools:replace="android:icon, android:label">
<activity <activity
android:name="net.osmand.plus.activities.MapActivity" android:name="net.osmand.plus.activities.SplashActivity"
android:theme="@style/SplashScreenFree" android:theme="@style/SplashScreenFree"
tools:replace="android:theme"/> tools:replace="android:theme"/>
<service <service

View file

@ -6,7 +6,7 @@
android:icon="@mipmap/icon_nightly" android:icon="@mipmap/icon_nightly"
tools:replace="android:icon"> tools:replace="android:icon">
<activity <activity
android:name="net.osmand.plus.activities.MapActivity" android:name="net.osmand.plus.activities.SplashActivity"
android:theme="@style/SplashScreenFreeDev" android:theme="@style/SplashScreenFreeDev"
tools:replace="android:theme"/> tools:replace="android:theme"/>
<service <service

View file

@ -73,8 +73,13 @@
android:resource="@xml/paths" /> android:resource="@xml/paths" />
</provider> </provider>
<activity android:name="net.osmand.plus.activities.MapActivity" android:label="@string/app_name" android:theme="@style/SplashScreenPlus" <activity
android:screenOrientation="unspecified" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize"> android:name="net.osmand.plus.activities.SplashActivity"
android:theme="@style/SplashScreenPlus"
android:screenOrientation="unspecified"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.SEND" /> <action android:name="android.intent.action.SEND" />
@ -101,7 +106,7 @@
<category android:name="android.intent.category.CAR_DOCK" /> <category android:name="android.intent.category.CAR_DOCK" />
<category android:name="android.intent.category.DESK_DOCK" /> <category android:name="android.intent.category.DESK_DOCK" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<data android:scheme="https" /> <data android:scheme="https" />
<data android:host="osmand.net" /> <data android:host="osmand.net" />
@ -114,7 +119,7 @@
<category android:name="android.intent.category.CAR_DOCK" /> <category android:name="android.intent.category.CAR_DOCK" />
<category android:name="android.intent.category.DESK_DOCK" /> <category android:name="android.intent.category.DESK_DOCK" />
</intent-filter> </intent-filter>
<!-- android matches non-greedy : http://stackoverflow.com/questions/3400072/pathpattern-to-match-file-extension-does-not-work-if-a-period-exists-elsewhere-i--> <!-- android matches non-greedy : http://stackoverflow.com/questions/3400072/pathpattern-to-match-file-extension-does-not-work-if-a-period-exists-elsewhere-i-->
<!-- mimeType&host are both needed or you will either have unwanted matching or no match when needed --> <!-- mimeType&host are both needed or you will either have unwanted matching or no match when needed -->
@ -154,7 +159,10 @@
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
</activity>
<activity android:name="net.osmand.plus.activities.MapActivity" android:label="@string/app_name"
android:screenOrientation="unspecified" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize">
</activity> </activity>
<receiver android:name="net.osmand.plus.audionotes.MediaRemoteControlReceiver"> <receiver android:name="net.osmand.plus.audionotes.MediaRemoteControlReceiver">

View file

@ -74,15 +74,15 @@
<item name="android:background">?attr/selectableItemBackground</item> <item name="android:background">?attr/selectableItemBackground</item>
</style> </style>
<style name="SplashScreenPlus" parent="OsmandLightTheme"> <style name="SplashScreenPlus" parent="OsmandLightTheme.NoActionbar">
<item name="android:windowBackground">@drawable/splash_screen_plus</item> <item name="android:windowBackground">@drawable/splash_screen_plus</item>
</style> </style>
<style name="SplashScreenFree" parent="OsmandLightTheme"> <style name="SplashScreenFree" parent="OsmandLightTheme.NoActionbar">
<item name="android:windowBackground">@drawable/splash_screen_free</item> <item name="android:windowBackground">@drawable/splash_screen_free</item>
</style> </style>
<style name="SplashScreenFreeDev" parent="OsmandLightTheme"> <style name="SplashScreenFreeDev" parent="OsmandLightTheme.NoActionbar">
<item name="android:windowBackground">@drawable/splash_screen_free_dev</item> <item name="android:windowBackground">@drawable/splash_screen_free_dev</item>
</style> </style>

View file

@ -0,0 +1,24 @@
package net.osmand.plus.activities;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
public class SplashActivity extends OsmandActionBarActivity {
private final static int SPLASH_DISPLAY_LENGTH = 3000;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent i = new Intent(SplashActivity.this, MapActivity.class);
startActivity(i);
finish();
}
}, SPLASH_DISPLAY_LENGTH);
}
}