Skip to content

Commit 719004e

Browse files
committed
Added dedicated GIF post view with controls
1 parent a87704b commit 719004e

36 files changed

+1054
-473
lines changed

app/build.gradle

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
}
44

55
android {
6-
compileSdk 32
6+
compileSdk 31
77
defaultConfig {
88
applicationId "ml.docilealligator.infinityforreddit"
99
minSdk 21
@@ -29,10 +29,6 @@ android {
2929
shrinkResources true
3030
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
3131
}
32-
debug {
33-
applicationIdSuffix '.debug'
34-
versionNameSuffix ' (DEBUG)'
35-
}
3632
}
3733
compileOptions {
3834
sourceCompatibility JavaVersion.VERSION_11
@@ -48,10 +44,6 @@ android {
4844
enableSplit = false
4945
}
5046
}
51-
52-
buildFeatures {
53-
viewBinding true
54-
}
5547
}
5648

5749
dependencies {
@@ -110,7 +102,6 @@ dependencies {
110102
def butterknifeVersion = "10.2.3"
111103
implementation "com.jakewharton:butterknife:$butterknifeVersion"
112104
annotationProcessor "com.jakewharton:butterknife-compiler:$butterknifeVersion"
113-
compileOnly 'com.android.databinding:viewbinding:7.3.0'
114105

115106
// Events
116107
def eventbusVersion = "3.3.1"
@@ -148,7 +139,7 @@ dependencies {
148139
annotationProcessor "com.github.bumptech.glide:compiler:$glideVersion"
149140
implementation 'jp.wasabeef:glide-transformations:4.3.0'
150141
implementation 'com.github.santalu:aspect-ratio-imageview:1.0.9'
151-
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.23'
142+
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.25'
152143
def bivVersion = "1.8.1"
153144
implementation "com.github.piasy:BigImageViewer:$bivVersion"
154145
implementation "com.github.piasy:GlideImageLoader:$bivVersion"

app/src/debug/res/values/strings.xml

Lines changed: 0 additions & 3 deletions
This file was deleted.

app/src/main/AndroidManifest.xml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@
3434
android:theme="@style/AppTheme"
3535
android:usesCleartextTraffic="true"
3636
tools:replace="android:label">
37+
<activity
38+
android:name=".ViewGifActivity"
39+
android:exported="false">
40+
<meta-data
41+
android:name="android.app.lib_name"
42+
android:value="" />
43+
</activity>
3744
<activity
3845
android:name=".activities.HistoryActivity"
3946
android:exported="false"
@@ -395,7 +402,11 @@
395402
android:parentActivityName=".activities.MainActivity"
396403
android:theme="@style/AppTheme.Slidable" />
397404
<activity
398-
android:name=".activities.ViewImageOrGifActivity"
405+
android:name=".activities.ViewImageActivity"
406+
android:parentActivityName=".activities.MainActivity"
407+
android:theme="@style/AppTheme.SlidableWithActionBar" />
408+
<activity
409+
android:name=".activities.ViewGifActivity"
399410
android:parentActivityName=".activities.MainActivity"
400411
android:theme="@style/AppTheme.SlidableWithActionBar" />
401412
<activity
@@ -419,7 +430,7 @@
419430

420431
<provider
421432
android:name="androidx.core.content.FileProvider"
422-
android:authorities="${applicationId}.provider"
433+
android:authorities="ml.docilealligator.infinityforreddit.provider"
423434
android:exported="false"
424435
android:grantUriPermissions="true">
425436
<meta-data

app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
import ml.docilealligator.infinityforreddit.activities.SubscribedThingListingActivity;
5252
import ml.docilealligator.infinityforreddit.activities.SuicidePreventionActivity;
5353
import ml.docilealligator.infinityforreddit.activities.TrendingActivity;
54-
import ml.docilealligator.infinityforreddit.activities.ViewImageOrGifActivity;
54+
import ml.docilealligator.infinityforreddit.activities.ViewGifActivity;
55+
import ml.docilealligator.infinityforreddit.activities.ViewImageActivity;
5556
import ml.docilealligator.infinityforreddit.activities.ViewImgurMediaActivity;
5657
import ml.docilealligator.infinityforreddit.activities.ViewMultiRedditDetailActivity;
5758
import ml.docilealligator.infinityforreddit.activities.ViewPostDetailActivity;
@@ -175,7 +176,9 @@ public interface AppComponent {
175176

176177
void inject(AccountSavedThingActivity accountSavedThingActivity);
177178

178-
void inject(ViewImageOrGifActivity viewGIFActivity);
179+
void inject(ViewImageActivity viewGIFActivity);
180+
181+
void inject(ViewGifActivity viewGIFActivity);
179182

180183
void inject(ViewMultiRedditDetailActivity viewMultiRedditDetailActivity);
181184

app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountPostsActivity.java

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,17 @@
66
import android.view.KeyEvent;
77
import android.view.Menu;
88
import android.view.MenuItem;
9+
import android.view.View;
910
import android.view.Window;
1011
import android.view.WindowManager;
1112

1213
import androidx.annotation.NonNull;
14+
import androidx.appcompat.widget.Toolbar;
15+
import androidx.coordinatorlayout.widget.CoordinatorLayout;
1316
import androidx.fragment.app.Fragment;
1417

18+
import com.google.android.material.appbar.AppBarLayout;
19+
import com.google.android.material.appbar.CollapsingToolbarLayout;
1520
import com.r0adkll.slidr.Slidr;
1621

1722
import org.greenrobot.eventbus.EventBus;
@@ -20,6 +25,8 @@
2025
import javax.inject.Inject;
2126
import javax.inject.Named;
2227

28+
import butterknife.BindView;
29+
import butterknife.ButterKnife;
2330
import ml.docilealligator.infinityforreddit.ActivityToolbarInterface;
2431
import ml.docilealligator.infinityforreddit.FragmentCommunicator;
2532
import ml.docilealligator.infinityforreddit.Infinity;
@@ -28,7 +35,6 @@
2835
import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback;
2936
import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostLayoutBottomSheetFragment;
3037
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
31-
import ml.docilealligator.infinityforreddit.databinding.ActivityAccountPostsBinding;
3238
import ml.docilealligator.infinityforreddit.events.ChangeNSFWEvent;
3339
import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent;
3440
import ml.docilealligator.infinityforreddit.fragments.PostFragment;
@@ -42,6 +48,14 @@ public class AccountPostsActivity extends BaseActivity implements SortTypeSelect
4248

4349
private static final String FRAGMENT_OUT_STATE = "FOS";
4450

51+
@BindView(R.id.coordinator_layout_account_posts_activity)
52+
CoordinatorLayout coordinatorLayout;
53+
@BindView(R.id.appbar_layout_account_posts_activity)
54+
AppBarLayout appBarLayout;
55+
@BindView(R.id.collapsing_toolbar_layout_account_posts_activity)
56+
CollapsingToolbarLayout collapsingToolbarLayout;
57+
@BindView(R.id.toolbar_account_posts_activity)
58+
Toolbar toolbar;
4559
@Inject
4660
@Named("default")
4761
SharedPreferences mSharedPreferences;
@@ -58,16 +72,16 @@ public class AccountPostsActivity extends BaseActivity implements SortTypeSelect
5872
private String mUserWhere;
5973
private Fragment mFragment;
6074
private PostLayoutBottomSheetFragment postLayoutBottomSheetFragment;
61-
private ActivityAccountPostsBinding binding;
6275

6376
@Override
6477
protected void onCreate(Bundle savedInstanceState) {
6578
((Infinity) getApplication()).getAppComponent().inject(this);
6679

6780
super.onCreate(savedInstanceState);
6881

69-
binding = ActivityAccountPostsBinding.inflate(getLayoutInflater());
70-
setContentView(binding.getRoot());
82+
setContentView(R.layout.activity_account_posts);
83+
84+
ButterKnife.bind(this);
7185

7286
EventBus.getDefault().register(this);
7387

@@ -81,7 +95,7 @@ protected void onCreate(Bundle savedInstanceState) {
8195
Window window = getWindow();
8296

8397
if (isChangeStatusBarIconColor()) {
84-
addOnOffsetChangedListener(binding.accountPostsAppbarLayout);
98+
addOnOffsetChangedListener(appBarLayout);
8599
}
86100

87101
if (isImmersiveInterface()) {
@@ -90,24 +104,24 @@ protected void onCreate(Bundle savedInstanceState) {
90104
} else {
91105
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
92106
}
93-
adjustToolbar(binding.accountPostsToolbar);
107+
adjustToolbar(toolbar);
94108
}
95109
}
96110

97111
mUserWhere = getIntent().getExtras().getString(EXTRA_USER_WHERE);
98112
if (mUserWhere.equals(PostPagingSource.USER_WHERE_UPVOTED)) {
99-
binding.accountPostsToolbar.setTitle(R.string.upvoted);
113+
toolbar.setTitle(R.string.upvoted);
100114
} else if (mUserWhere.equals(PostPagingSource.USER_WHERE_DOWNVOTED)) {
101-
binding.accountPostsToolbar.setTitle(R.string.downvoted);
115+
toolbar.setTitle(R.string.downvoted);
102116
} else if (mUserWhere.equals(PostPagingSource.USER_WHERE_HIDDEN)) {
103-
binding.accountPostsToolbar.setTitle(R.string.hidden);
117+
toolbar.setTitle(R.string.hidden);
104118
} else if (mUserWhere.equals(PostPagingSource.USER_WHERE_GILDED)) {
105-
binding.accountPostsToolbar.setTitle(R.string.gilded);
119+
toolbar.setTitle(R.string.gilded);
106120
}
107121

108-
setSupportActionBar(binding.accountPostsToolbar);
122+
setSupportActionBar(toolbar);
109123
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
110-
setToolbarGoToTop(binding.accountPostsToolbar);
124+
setToolbarGoToTop(toolbar);
111125

112126
postLayoutBottomSheetFragment = new PostLayoutBottomSheetFragment();
113127

@@ -116,9 +130,7 @@ protected void onCreate(Bundle savedInstanceState) {
116130

117131
if (savedInstanceState != null) {
118132
mFragment = getSupportFragmentManager().getFragment(savedInstanceState, FRAGMENT_OUT_STATE);
119-
getSupportFragmentManager().beginTransaction()
120-
.replace(binding.accountPostsFrameLayout.getId(), mFragment)
121-
.commit();
133+
getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_account_posts_activity, mFragment).commit();
122134
} else {
123135
initializeFragment();
124136
}
@@ -145,10 +157,8 @@ protected CustomThemeWrapper getCustomThemeWrapper() {
145157

146158
@Override
147159
protected void applyCustomTheme() {
148-
binding.accountPostsCoordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
149-
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(
150-
binding.accountPostsAppbarLayout, binding.accountPostsCollapsingToolbarLayout,
151-
binding.accountPostsToolbar);
160+
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
161+
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar);
152162
}
153163

154164
private void initializeFragment() {
@@ -161,9 +171,7 @@ private void initializeFragment() {
161171
bundle.putString(PostFragment.EXTRA_ACCOUNT_NAME, mAccountName);
162172
bundle.putBoolean(PostFragment.EXTRA_DISABLE_READ_POSTS, true);
163173
mFragment.setArguments(bundle);
164-
getSupportFragmentManager().beginTransaction()
165-
.replace(binding.accountPostsFrameLayout.getId(), mFragment)
166-
.commit();
174+
getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_account_posts_activity, mFragment).commit();
167175
}
168176

169177
@Override

0 commit comments

Comments
 (0)