fix the activity transitions (again 🙄)

main
Conny Duck 6 years ago
parent 162453af6d
commit 3e08d439e9
  1. 9
      app/src/main/java/com/keylesspalace/tusky/BaseActivity.java
  2. 6
      app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java
  3. 4
      app/src/main/java/com/keylesspalace/tusky/EditProfileActivity.kt
  4. 1
      app/src/main/java/com/keylesspalace/tusky/LoginActivity.kt
  5. 6
      app/src/main/java/com/keylesspalace/tusky/MainActivity.java
  6. 2
      app/src/main/java/com/keylesspalace/tusky/PreferencesActivity.java
  7. 2
      app/src/main/java/com/keylesspalace/tusky/ReportActivity.java

@ -107,11 +107,16 @@ public abstract class BaseActivity extends AppCompatActivity implements Injectab
overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left); overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left);
} }
public void finishWithSlideOutAnimation() { @Override
public void finish() {
super.finish(); super.finish();
overridePendingTransition(R.anim.slide_from_left, R.anim.slide_to_right); overridePendingTransition(R.anim.slide_from_left, R.anim.slide_to_right);
} }
public void finishWithoutSlideOutAnimation() {
super.finish();
}
protected SharedPreferences getPrivatePreferences() { protected SharedPreferences getPrivatePreferences() {
return getSharedPreferences(getString(R.string.preferences_file_key), Context.MODE_PRIVATE); 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 intent = new Intent(this, LoginActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivityWithSlideInAnimation(intent); startActivityWithSlideInAnimation(intent);
finishWithSlideOutAnimation(); finish();
} }
} }

@ -885,7 +885,7 @@ public final class ComposeActivity
startService(sendIntent); startService(sendIntent);
finish(); finishWithoutSlideOutAnimation();
} }
@ -1424,10 +1424,10 @@ public final class ComposeActivity
new AlertDialog.Builder(this) new AlertDialog.Builder(this)
.setMessage(R.string.compose_save_draft) .setMessage(R.string.compose_save_draft)
.setPositiveButton(R.string.action_save, (d, w) -> saveDraftAndFinish()) .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(); .show();
} else { } else {
finish(); finishWithoutSlideOutAnimation();
} }
} }

@ -290,7 +290,7 @@ class EditProfileActivity : BaseActivity(), Injectable {
if (displayName == null && note == null && locked == null && avatar == null && header == null) { if (displayName == null && note == null && locked == null && avatar == null && header == null) {
/** if nothing has changed, there is no need to make a network request */ /** if nothing has changed, there is no need to make a network request */
setResult(Activity.RESULT_OK) setResult(Activity.RESULT_OK)
finishWithSlideOutAnimation() finish()
return return
} }
@ -304,7 +304,7 @@ class EditProfileActivity : BaseActivity(), Injectable {
.putBoolean("refreshProfileHeader", true) .putBoolean("refreshProfileHeader", true)
.apply() .apply()
setResult(Activity.RESULT_OK) setResult(Activity.RESULT_OK)
finishWithSlideOutAnimation() finish()
} }
override fun onFailure(call: Call<Account>, t: Throwable) { override fun onFailure(call: Call<Account>, t: Throwable) {

@ -297,6 +297,7 @@ class LoginActivity : AppCompatActivity(), Injectable {
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
startActivity(intent) startActivity(intent)
finish() finish()
overridePendingTransition(R.anim.explode, R.anim.explode)
} }
companion object { companion object {

@ -409,7 +409,7 @@ public final class MainActivity extends BottomSheetActivity implements ActionBut
Intent intent = new Intent(this, MainActivity.class); Intent intent = new Intent(this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivityWithSlideInAnimation(intent); startActivityWithSlideInAnimation(intent);
finishWithSlideOutAnimation(); finishWithoutSlideOutAnimation();
overridePendingTransition(R.anim.explode, R.anim.explode); overridePendingTransition(R.anim.explode, R.anim.explode);
} }
@ -438,8 +438,8 @@ public final class MainActivity extends BottomSheetActivity implements ActionBut
} else { } else {
intent = new Intent(MainActivity.this, MainActivity.class); intent = new Intent(MainActivity.this, MainActivity.class);
} }
startActivityWithSlideInAnimation(intent); startActivity(intent);
finishWithSlideOutAnimation(); finishWithoutSlideOutAnimation();
}) })
.setNegativeButton(android.R.string.no, null) .setNegativeButton(android.R.string.no, null)
.show(); .show();

@ -117,7 +117,7 @@ public class PreferencesActivity extends BaseActivity
saveInstanceState(savedInstanceState); saveInstanceState(savedInstanceState);
intent.putExtras(savedInstanceState); intent.putExtras(savedInstanceState);
startActivityWithSlideInAnimation(intent); startActivityWithSlideInAnimation(intent);
finishWithSlideOutAnimation(); finish();
overridePendingTransition(R.anim.fade_in, R.anim.fade_out); overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
} }
case "statusTextSize": { case "statusTextSize": {

@ -148,7 +148,7 @@ public class ReportActivity extends BaseActivity implements Injectable {
private void onSendSuccess() { private void onSendSuccess() {
Snackbar bar = Snackbar.make(anyView, getString(R.string.confirmation_reported), Snackbar.LENGTH_SHORT); Snackbar bar = Snackbar.make(anyView, getString(R.string.confirmation_reported), Snackbar.LENGTH_SHORT);
bar.show(); bar.show();
finishWithSlideOutAnimation(); finish();
} }
private void onSendFailure(final String accountId, final String[] statusIds, private void onSendFailure(final String accountId, final String[] statusIds,

Loading…
Cancel
Save