Fix animations

- Until now only the bottom up (swipe action) animation is implemented
This commit is contained in:
Finn M Glas 2020-06-17 09:38:15 +02:00
parent 2ab8bec8c0
commit e1a9e4aa33
No known key found for this signature in database
GPG key ID: 902A30146014DFBF
3 changed files with 9 additions and 9 deletions

View file

@ -80,7 +80,10 @@ class MainActivity : AppCompatActivity(),
showSettingsIcon() showSettingsIcon()
// As older APIs somehow do not recognize the xml defined onClick // As older APIs somehow do not recognize the xml defined onClick
activity_main_settings_icon.setOnClickListener() { openSettings(this) } activity_main_settings_icon.setOnClickListener() {
openSettings(this)
overridePendingTransition(R.anim.bottom_up, android.R.anim.fade_out)
}
// Load apps list first - speed up settings that way // Load apps list first - speed up settings that way
AsyncTask.execute { viewAdapter = AsyncTask.execute { viewAdapter =
@ -166,7 +169,10 @@ class MainActivity : AppCompatActivity(),
// Only open if the swipe was not from the phones top edge // Only open if the swipe was not from the phones top edge
if (diffY < -height / 8 && abs(diffY) > strictness * abs(diffX) && e1.y > 100) launch(downApp, this) if (diffY < -height / 8 && abs(diffY) > strictness * abs(diffX) && e1.y > 100) launch(downApp, this)
else if (diffY > height / 8 && abs(diffY) > strictness * abs(diffX)) launch(upApp, this) else if (diffY > height / 8 && abs(diffY) > strictness * abs(diffX)) {
launch(upApp, this)
overridePendingTransition(R.anim.bottom_up, android.R.anim.fade_out)
}
else if (diffX > width / 4 && abs(diffX) > strictness * abs(diffY)) launch(leftApp, this) else if (diffX > width / 4 && abs(diffX) > strictness * abs(diffY)) launch(leftApp, this)
else if (diffX < -width / 4 && abs(diffX) > strictness * abs(diffY)) launch(rightApp, this) else if (diffX < -width / 4 && abs(diffX) > strictness * abs(diffY)) launch(rightApp, this)

View file

@ -153,10 +153,6 @@ fun launchApp(packageName: String, context: Context) {
if (intent != null) { if (intent != null) {
context.startActivity(intent) context.startActivity(intent)
if (context is Activity) {
context.overridePendingTransition(0, 0)
}
} else { } else {
if (isInstalled(packageName, context)){ if (isInstalled(packageName, context)){
@ -218,7 +214,6 @@ fun openAppSettings(pkg :String, context:Context){
fun openSettings(activity: Activity){ fun openSettings(activity: Activity){
activity.startActivity(Intent(activity, SettingsActivity::class.java)) activity.startActivity(Intent(activity, SettingsActivity::class.java))
activity.overridePendingTransition(R.anim.bottom_up, android.R.anim.fade_out)
} }
fun openAppsList(activity: Activity){ fun openAppsList(activity: Activity){
@ -226,7 +221,6 @@ fun openAppsList(activity: Activity){
intent.putExtra("action", "view") intent.putExtra("action", "view")
intendedSettingsPause = true intendedSettingsPause = true
activity.startActivity(intent) activity.startActivity(intent)
activity.overridePendingTransition(R.anim.bottom_up, android.R.anim.fade_out)
} }
fun loadSettings(sharedPref : SharedPreferences){ fun loadSettings(sharedPref : SharedPreferences){

View file

@ -5,6 +5,6 @@
android:fromYDelta="75%p" android:fromYDelta="75%p"
android:toYDelta="0%p" android:toYDelta="0%p"
android:interpolator="@android:anim/decelerate_interpolator" android:interpolator="@android:anim/decelerate_interpolator"
android:duration="150"/> android:duration="100"/>
</set> </set>