mirror of
https://github.com/jrpie/Launcher.git
synced 2025-02-23 06:21:31 +01:00
Animate transition for openSettings()
This commit is contained in:
parent
11045cbb0c
commit
442b7b8712
3 changed files with 15 additions and 4 deletions
|
@ -128,10 +128,10 @@ private fun getIntent(packageName: String, context: Context): Intent? {
|
|||
}
|
||||
|
||||
fun launchApp(packageName: String, context: Context) {
|
||||
val intent1 = getIntent(packageName, context)
|
||||
val intent = getIntent(packageName, context)
|
||||
|
||||
if (intent1 != null) {
|
||||
context.startActivity(intent1)
|
||||
if (intent != null) {
|
||||
context.startActivity(intent)
|
||||
|
||||
if (context is Activity) {
|
||||
context.overridePendingTransition(0, 0)
|
||||
|
@ -139,7 +139,7 @@ fun launchApp(packageName: String, context: Context) {
|
|||
} else {
|
||||
if (isInstalled(packageName, context)){
|
||||
|
||||
AlertDialog.Builder(context)
|
||||
AlertDialog.Builder(context, R.style.AlertDialogCustom)
|
||||
.setTitle(context.getString(R.string.alert_cant_open_title))
|
||||
.setMessage(context.getString(R.string.alert_cant_open_message))
|
||||
.setPositiveButton(android.R.string.yes,
|
||||
|
|
|
@ -122,6 +122,7 @@ class MainActivity : AppCompatActivity(),
|
|||
|
||||
private fun openSettings(){
|
||||
startActivity(Intent(this, SettingsActivity::class.java))
|
||||
overridePendingTransition(R.anim.bottom_up, android.R.anim.fade_out)
|
||||
}
|
||||
|
||||
/** Touch- and Key-related functions to start activities */
|
||||
|
|
10
app/src/main/res/anim/bottom_up.xml
Normal file
10
app/src/main/res/anim/bottom_up.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<translate
|
||||
android:fromYDelta="75%p"
|
||||
android:toYDelta="0%p"
|
||||
android:interpolator="@android:anim/decelerate_interpolator"
|
||||
android:duration="150"/>
|
||||
|
||||
</set>
|
Loading…
Add table
Reference in a new issue