From 3e08d439e97c04bb79306801142fffb0c0b6b11a Mon Sep 17 00:00:00 2001 From: Conny Duck Date: Tue, 7 Aug 2018 23:08:53 +0200 Subject: [PATCH] =?UTF-8?q?fix=20the=20activity=20transitions=20(again=20?= =?UTF-8?q?=F0=9F=99=84)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/keylesspalace/tusky/BaseActivity.java | 9 +++++++-- .../java/com/keylesspalace/tusky/ComposeActivity.java | 6 +++--- .../java/com/keylesspalace/tusky/EditProfileActivity.kt | 4 ++-- .../main/java/com/keylesspalace/tusky/LoginActivity.kt | 1 + .../main/java/com/keylesspalace/tusky/MainActivity.java | 6 +++--- .../com/keylesspalace/tusky/PreferencesActivity.java | 2 +- .../java/com/keylesspalace/tusky/ReportActivity.java | 2 +- 7 files changed, 18 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/BaseActivity.java b/app/src/main/java/com/keylesspalace/tusky/BaseActivity.java index 556b60c1..5fbfe0c2 100644 --- a/app/src/main/java/com/keylesspalace/tusky/BaseActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/BaseActivity.java @@ -107,11 +107,16 @@ public abstract class BaseActivity extends AppCompatActivity implements Injectab overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left); } - public void finishWithSlideOutAnimation() { + @Override + public void finish() { super.finish(); overridePendingTransition(R.anim.slide_from_left, R.anim.slide_to_right); } + public void finishWithoutSlideOutAnimation() { + super.finish(); + } + protected SharedPreferences getPrivatePreferences() { return getSharedPreferences(getString(R.string.preferences_file_key), Context.MODE_PRIVATE); } @@ -122,7 +127,7 @@ public abstract class BaseActivity extends AppCompatActivity implements Injectab Intent intent = new Intent(this, LoginActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); startActivityWithSlideInAnimation(intent); - finishWithSlideOutAnimation(); + finish(); } } diff --git a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java index 81b68897..53626477 100644 --- a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java @@ -885,7 +885,7 @@ public final class ComposeActivity startService(sendIntent); - finish(); + finishWithoutSlideOutAnimation(); } @@ -1424,10 +1424,10 @@ public final class ComposeActivity new AlertDialog.Builder(this) .setMessage(R.string.compose_save_draft) .setPositiveButton(R.string.action_save, (d, w) -> saveDraftAndFinish()) - .setNegativeButton(R.string.action_delete, (d, w) -> finish()) + .setNegativeButton(R.string.action_delete, (d, w) -> finishWithoutSlideOutAnimation()) .show(); } else { - finish(); + finishWithoutSlideOutAnimation(); } } diff --git a/app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt b/app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt index 4ddb84e2..0b7068f4 100644 --- a/app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt @@ -290,7 +290,7 @@ class EditProfileActivity : BaseActivity(), Injectable { if (displayName == null && note == null && locked == null && avatar == null && header == null) { /** if nothing has changed, there is no need to make a network request */ setResult(Activity.RESULT_OK) - finishWithSlideOutAnimation() + finish() return } @@ -304,7 +304,7 @@ class EditProfileActivity : BaseActivity(), Injectable { .putBoolean("refreshProfileHeader", true) .apply() setResult(Activity.RESULT_OK) - finishWithSlideOutAnimation() + finish() } override fun onFailure(call: Call, t: Throwable) { diff --git a/app/src/main/java/com/keylesspalace/tusky/LoginActivity.kt b/app/src/main/java/com/keylesspalace/tusky/LoginActivity.kt index cfb0d286..eb3719b2 100644 --- a/app/src/main/java/com/keylesspalace/tusky/LoginActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/LoginActivity.kt @@ -297,6 +297,7 @@ class LoginActivity : AppCompatActivity(), Injectable { intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK startActivity(intent) finish() + overridePendingTransition(R.anim.explode, R.anim.explode) } companion object { diff --git a/app/src/main/java/com/keylesspalace/tusky/MainActivity.java b/app/src/main/java/com/keylesspalace/tusky/MainActivity.java index 58bc287e..df23fc59 100644 --- a/app/src/main/java/com/keylesspalace/tusky/MainActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/MainActivity.java @@ -409,7 +409,7 @@ public final class MainActivity extends BottomSheetActivity implements ActionBut Intent intent = new Intent(this, MainActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivityWithSlideInAnimation(intent); - finishWithSlideOutAnimation(); + finishWithoutSlideOutAnimation(); overridePendingTransition(R.anim.explode, R.anim.explode); } @@ -438,8 +438,8 @@ public final class MainActivity extends BottomSheetActivity implements ActionBut } else { intent = new Intent(MainActivity.this, MainActivity.class); } - startActivityWithSlideInAnimation(intent); - finishWithSlideOutAnimation(); + startActivity(intent); + finishWithoutSlideOutAnimation(); }) .setNegativeButton(android.R.string.no, null) .show(); diff --git a/app/src/main/java/com/keylesspalace/tusky/PreferencesActivity.java b/app/src/main/java/com/keylesspalace/tusky/PreferencesActivity.java index 9022a921..67131089 100644 --- a/app/src/main/java/com/keylesspalace/tusky/PreferencesActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/PreferencesActivity.java @@ -117,7 +117,7 @@ public class PreferencesActivity extends BaseActivity saveInstanceState(savedInstanceState); intent.putExtras(savedInstanceState); startActivityWithSlideInAnimation(intent); - finishWithSlideOutAnimation(); + finish(); overridePendingTransition(R.anim.fade_in, R.anim.fade_out); } case "statusTextSize": { diff --git a/app/src/main/java/com/keylesspalace/tusky/ReportActivity.java b/app/src/main/java/com/keylesspalace/tusky/ReportActivity.java index 84e1eac8..3a2e04eb 100644 --- a/app/src/main/java/com/keylesspalace/tusky/ReportActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/ReportActivity.java @@ -148,7 +148,7 @@ public class ReportActivity extends BaseActivity implements Injectable { private void onSendSuccess() { Snackbar bar = Snackbar.make(anyView, getString(R.string.confirmation_reported), Snackbar.LENGTH_SHORT); bar.show(); - finishWithSlideOutAnimation(); + finish(); } private void onSendFailure(final String accountId, final String[] statusIds,