fix the activity transitions (again 🙄)

This commit is contained in:
Conny Duck 2018-08-07 23:08:53 +02:00
parent eee48e48d1
commit ce7270cdb2
7 changed files with 18 additions and 12 deletions

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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<Account>, t: Throwable) {

View File

@ -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 {

View File

@ -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();

View File

@ -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": {

View File

@ -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,