diff --git a/app/src/main/java/com/keylesspalace/tusky/BaseActivity.java b/app/src/main/java/com/keylesspalace/tusky/BaseActivity.java
index 28e523a2f..bb3a4fb57 100644
--- a/app/src/main/java/com/keylesspalace/tusky/BaseActivity.java
+++ b/app/src/main/java/com/keylesspalace/tusky/BaseActivity.java
@@ -15,6 +15,7 @@
package com.keylesspalace.tusky;
+import android.content.Intent;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
@@ -38,6 +39,26 @@ public class BaseActivity extends AppCompatActivity {
}
}
+ @Override
+ public void finish() {
+ super.finish();
+ overridePendingTransitionExit();
+ }
+
+ @Override
+ public void startActivity(Intent intent) {
+ super.startActivity(intent);
+ overridePendingTransitionEnter();
+ }
+
+ private void overridePendingTransitionEnter() {
+ overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left);
+ }
+
+ private void overridePendingTransitionExit() {
+ overridePendingTransition(R.anim.slide_from_left, R.anim.slide_to_right);
+ }
+
@Override
public boolean onCreateOptionsMenu(Menu menu) {
TypedValue value = new TypedValue();
diff --git a/app/src/main/java/com/keylesspalace/tusky/MainActivity.java b/app/src/main/java/com/keylesspalace/tusky/MainActivity.java
index acaf77da5..3fb5b3382 100644
--- a/app/src/main/java/com/keylesspalace/tusky/MainActivity.java
+++ b/app/src/main/java/com/keylesspalace/tusky/MainActivity.java
@@ -21,13 +21,17 @@ import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.drawable.Drawable;
+import android.os.Build;
import android.os.SystemClock;
import android.preference.PreferenceManager;
+import android.support.annotation.RequiresApi;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
+import android.transition.Slide;
+import android.transition.TransitionInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
diff --git a/app/src/main/java/com/keylesspalace/tusky/SFragment.java b/app/src/main/java/com/keylesspalace/tusky/SFragment.java
index 112fdae1e..ba1fea6ec 100644
--- a/app/src/main/java/com/keylesspalace/tusky/SFragment.java
+++ b/app/src/main/java/com/keylesspalace/tusky/SFragment.java
@@ -280,8 +280,14 @@ public class SFragment extends Fragment {
startActivity(intent);
}
+ @Override
+ public void startActivity(Intent intent) {
+ super.startActivity(intent);
+ getActivity().overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left);
+ }
+
protected void openReportPage(String accountId, String accountUsername, String statusId,
- Spanned statusContent) {
+ Spanned statusContent) {
Intent intent = new Intent(getContext(), ReportActivity.class);
intent.putExtra("account_id", accountId);
intent.putExtra("account_username", accountUsername);
diff --git a/app/src/main/java/com/keylesspalace/tusky/ViewThreadActivity.java b/app/src/main/java/com/keylesspalace/tusky/ViewThreadActivity.java
index 3250d50e0..e9e0485ee 100644
--- a/app/src/main/java/com/keylesspalace/tusky/ViewThreadActivity.java
+++ b/app/src/main/java/com/keylesspalace/tusky/ViewThreadActivity.java
@@ -35,7 +35,9 @@ public class ViewThreadActivity extends BaseActivity {
setSupportActionBar(toolbar);
ActionBar bar = getSupportActionBar();
if (bar != null) {
- bar.setTitle(R.string.title_thread);
+ bar.setTitle(null);
+ bar.setDisplayHomeAsUpEnabled(true);
+ bar.setDisplayShowHomeEnabled(true);
}
String id = getIntent().getStringExtra("id");
@@ -54,10 +56,8 @@ public class ViewThreadActivity extends BaseActivity {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
- case R.id.action_back: {
- Intent intent = new Intent(this, MainActivity.class);
- intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
- startActivity(intent);
+ case android.R.id.home: {
+ onBackPressed();
return true;
}
}
diff --git a/app/src/main/res/anim/slide_from_left.xml b/app/src/main/res/anim/slide_from_left.xml
new file mode 100644
index 000000000..5c7fe5227
--- /dev/null
+++ b/app/src/main/res/anim/slide_from_left.xml
@@ -0,0 +1,6 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/anim/slide_from_right.xml b/app/src/main/res/anim/slide_from_right.xml
new file mode 100644
index 000000000..3c595d04b
--- /dev/null
+++ b/app/src/main/res/anim/slide_from_right.xml
@@ -0,0 +1,6 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/anim/slide_to_left.xml b/app/src/main/res/anim/slide_to_left.xml
new file mode 100644
index 000000000..21688e2ca
--- /dev/null
+++ b/app/src/main/res/anim/slide_to_left.xml
@@ -0,0 +1,6 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/anim/slide_to_right.xml b/app/src/main/res/anim/slide_to_right.xml
new file mode 100644
index 000000000..8ded764f7
--- /dev/null
+++ b/app/src/main/res/anim/slide_to_right.xml
@@ -0,0 +1,6 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/view_thread_toolbar.xml b/app/src/main/res/menu/view_thread_toolbar.xml
index 0f352f241..cd09d76f0 100644
--- a/app/src/main/res/menu/view_thread_toolbar.xml
+++ b/app/src/main/res/menu/view_thread_toolbar.xml
@@ -3,9 +3,4 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
-
-
\ No newline at end of file
diff --git a/app/src/main/res/transition/activity_slide.xml b/app/src/main/res/transition/activity_slide.xml
new file mode 100644
index 000000000..cd343707d
--- /dev/null
+++ b/app/src/main/res/transition/activity_slide.xml
@@ -0,0 +1,3 @@
+
+
\ No newline at end of file