aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2018-09-22 02:45:38 +0000
committerAlex Ning <chineseperson5@gmail.com>2018-09-22 02:45:38 +0000
commitfc356c6505d5ee40e719e5b17e3a8a49ac8128c6 (patch)
treefa049a14d54251c44b16d9565340f55b8cd3ec3d /app
parent88e4cf810fa78592c97f6ba7c8c501e75205a76b (diff)
downloadinfinity-for-reddit-fc356c6505d5ee40e719e5b17e3a8a49ac8128c6.tar
infinity-for-reddit-fc356c6505d5ee40e719e5b17e3a8a49ac8128c6.tar.gz
infinity-for-reddit-fc356c6505d5ee40e719e5b17e3a8a49ac8128c6.tar.bz2
infinity-for-reddit-fc356c6505d5ee40e719e5b17e3a8a49ac8128c6.tar.lz
infinity-for-reddit-fc356c6505d5ee40e719e5b17e3a8a49ac8128c6.tar.xz
infinity-for-reddit-fc356c6505d5ee40e719e5b17e3a8a49ac8128c6.tar.zst
infinity-for-reddit-fc356c6505d5ee40e719e5b17e3a8a49ac8128c6.zip
Disable the animation for finishing activity in ViewImageActivity and ViewVideoActivity. Fixed a bug that occurred when parsing posts finishes but the PostFragment is not added in any Activity (e.g. Activity finishes).
Diffstat (limited to 'app')
-rw-r--r--app/build.gradle12
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostFragment.java48
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ViewImageActivity.java6
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ViewVideoActivity.java6
-rw-r--r--app/src/main/res/values/styles.xml1
5 files changed, 44 insertions, 29 deletions
diff --git a/app/build.gradle b/app/build.gradle
index 4e9b7644..6286dcd4 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -29,10 +29,10 @@ repositories {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
- implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
- implementation 'com.android.support:design:28.0.0-rc01'
- implementation 'com.android.support.constraint:constraint-layout:1.1.2'
- implementation 'com.android.support:support-v4:28.0.0-rc01'
+ implementation 'com.android.support:appcompat-v7:28.0.0'
+ implementation 'com.android.support:design:28.0.0'
+ implementation 'com.android.support.constraint:constraint-layout:1.1.3'
+ implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
@@ -40,9 +40,9 @@ dependencies {
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.google.android.exoplayer:exoplayer:2.7.0'
implementation 'com.google.android.exoplayer:exoplayer-dash:2.7.0'
- implementation 'com.android.support:customtabs:28.0.0-rc01'
+ implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.alexvasilkov:gesture-views:2.5.2'
- implementation 'com.android.support:cardview-v7:28.0.0-rc01'
+ implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.github.bumptech.glide:glide:4.7.1'
implementation 'com.github.pwittchen:swipe-rx2:0.3.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostFragment.java
index 7d44eb31..3c67787b 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostFragment.java
@@ -194,17 +194,19 @@ public class PostFragment extends Fragment {
getResources().getConfiguration().locale, new ParsePost.ParsePostListener() {
@Override
public void onParsePostSuccess(ArrayList<PostData> postData, String lastItem) {
- mPostData = postData;
- mLastItem = lastItem;
- mAdapter = new PostRecyclerViewAdapter(getActivity(), postData, mPaginationSynchronizer);
-
- mPostRecyclerView.setAdapter(mAdapter);
- mPostRecyclerView.addOnScrollListener(new PostPaginationScrollListener(
- getActivity(), mLinearLayoutManager, mAdapter, lastItem, postData,
- mPaginationSynchronizer, mSubredditName, mIsBestPost,
- mPaginationSynchronizer.isLoading(), mPaginationSynchronizer.isLoadSuccess(),
- getResources().getConfiguration().locale));
- mProgressBar.setVisibility(View.GONE);
+ if(isAdded() && getActivity() != null) {
+ mPostData = postData;
+ mLastItem = lastItem;
+ mAdapter = new PostRecyclerViewAdapter(getActivity(), postData, mPaginationSynchronizer);
+
+ mPostRecyclerView.setAdapter(mAdapter);
+ mPostRecyclerView.addOnScrollListener(new PostPaginationScrollListener(
+ getActivity(), mLinearLayoutManager, mAdapter, lastItem, postData,
+ mPaginationSynchronizer, mSubredditName, mIsBestPost,
+ mPaginationSynchronizer.isLoading(), mPaginationSynchronizer.isLoadSuccess(),
+ getResources().getConfiguration().locale));
+ mProgressBar.setVisibility(View.GONE);
+ }
}
@Override
@@ -264,17 +266,19 @@ public class PostFragment extends Fragment {
getResources().getConfiguration().locale, new ParsePost.ParsePostListener() {
@Override
public void onParsePostSuccess(ArrayList<PostData> postData, String lastItem) {
- mPostData = postData;
- mLastItem = lastItem;
- mAdapter = new PostRecyclerViewAdapter(getActivity(), postData, mPaginationSynchronizer);
-
- mPostRecyclerView.setAdapter(mAdapter);
- mPostRecyclerView.addOnScrollListener(new PostPaginationScrollListener(
- getActivity(), mLinearLayoutManager, mAdapter, lastItem, postData,
- mPaginationSynchronizer, mSubredditName, mIsBestPost,
- mPaginationSynchronizer.isLoading(), mPaginationSynchronizer.isLoadSuccess(),
- getResources().getConfiguration().locale));
- mProgressBar.setVisibility(View.GONE);
+ if(isAdded() && getActivity() != null) {
+ mPostData = postData;
+ mLastItem = lastItem;
+ mAdapter = new PostRecyclerViewAdapter(getActivity(), postData, mPaginationSynchronizer);
+
+ mPostRecyclerView.setAdapter(mAdapter);
+ mPostRecyclerView.addOnScrollListener(new PostPaginationScrollListener(
+ getActivity(), mLinearLayoutManager, mAdapter, lastItem, postData,
+ mPaginationSynchronizer, mSubredditName, mIsBestPost,
+ mPaginationSynchronizer.isLoading(), mPaginationSynchronizer.isLoadSuccess(),
+ getResources().getConfiguration().locale));
+ mProgressBar.setVisibility(View.GONE);
+ }
}
@Override
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewImageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewImageActivity.java
index 031fc88a..af75b8b2 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewImageActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewImageActivity.java
@@ -434,4 +434,10 @@ public class ViewImageActivity extends AppCompatActivity {
}
});
}
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ overridePendingTransition(0, 0);
+ }
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewVideoActivity.java
index 407f8eff..46423d50 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewVideoActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewVideoActivity.java
@@ -403,4 +403,10 @@ public class ViewVideoActivity extends AppCompatActivity {
DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
manager.enqueue(request);
}
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ overridePendingTransition(0, 0);
+ }
}
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index b22e23e3..38b86b13 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -33,7 +33,6 @@
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowIsTranslucent">true</item>
- <item name="android:windowAnimationStyle">@android:style/Animation</item>
</style>
</resources>