Skip to content
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.

Automatically hide read posts on Reddit #3146

Open
wants to merge 132 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
132 commits
Select commit Hold shift + click to select a range
e494d12
Fixes #3187 by hiding option to rename multireddit
Ullas-Aithal Jul 18, 2020
855587c
Cleanup
Mar 23, 2020
2bed537
Add PoC for automatically hiding read posts.
Jul 21, 2020
1378664
Add UI for configuring post-hiding
Jul 21, 2020
8e0ac0b
Use correct round icon
TacoTheDank Aug 3, 2020
c553834
Update ic_launcher in drawable
TacoTheDank Aug 3, 2020
120bf85
#2951 Collapse removed comments by default
Barrett97 Aug 7, 2020
2a0abf5
Update strings.xml
Barrett97 Aug 7, 2020
d98b58f
Update CommentAdapter.java with [deleted] comments
Barrett97 Aug 7, 2020
8f28c2c
Update activity_settings_comments_child.xml
Barrett97 Aug 7, 2020
7daebbe
Optimize PNGs
TacoTheDank Aug 9, 2020
a949a31
Replace deprecated Html#fromHtml with HtmlCompat#fromHtml
TacoTheDank Aug 11, 2020
de5474a
Update AndroidX AppCompat and Material libraries
TacoTheDank Aug 11, 2020
42a876e
Replace custom views with appcompat versions
TacoTheDank Aug 11, 2020
101324c
AlertDialog added to CreateMulti when exiting
Barrett97 Aug 11, 2020
1042d2e
overrideSwipeFromAnywhere() added to CreateMulti
Barrett97 Aug 11, 2020
5e94e1e
Use app:tint instead of android:tint for ImageView
TacoTheDank Aug 11, 2020
5f6bdec
Merge pull request #3247 from ccrama/appicons-optimizing
TacoTheDank Aug 13, 2020
467166d
Merge pull request #3248 from ccrama/more-deprecation-fixes
TacoTheDank Aug 13, 2020
76b1dfc
Merge pull request #3250 from ccrama/fix-app-tint
TacoTheDank Aug 13, 2020
cfbd65a
Merge pull request #3232 from Ullas-Aithal/hideMultiRedditRenameOption
ccrama Aug 21, 2020
ad9cb1c
Merge pull request #3246 from Barrett97/master
ccrama Aug 21, 2020
3b494d6
Merge pull request #3251 from Barrett97/multireddit
ccrama Aug 21, 2020
91aa32c
Support sound on more video sites
ccrama Aug 22, 2020
154a4c2
Initial Reddit Gallery implementation
ccrama Aug 22, 2020
6f02ebb
Revert "Use app:tint instead of android:tint for ImageView"
TacoTheDank Aug 26, 2020
aa78dd1
Add .editorconfig
TacoTheDank Aug 26, 2020
ba67943
Update Apache Commons libraries
TacoTheDank Aug 26, 2020
3b54b48
Delete redundant type casts and string operations
TacoTheDank Aug 26, 2020
afa0a3a
Fix accessing static member via instance reference
TacoTheDank Aug 26, 2020
84a0acb
Use SubsamplingScaleImageView's AndroidX version
TacoTheDank Aug 26, 2020
837494e
Fix integer division in floating-point contexts
TacoTheDank Aug 26, 2020
857fde3
Convert some fields to local variables
TacoTheDank Aug 26, 2020
9e85a44
Clean up and update vector icons
TacoTheDank Aug 28, 2020
4a0f358
Revert AboutLibraries to earlier version to prevent style crash
TacoTheDank Aug 28, 2020
469d5e1
Correct some xml SlidingUpPanel stuff
TacoTheDank Aug 28, 2020
ebe6ad1
Update ExoPlayer to 2.11.8
TacoTheDank Aug 28, 2020
884cfa1
Separate some classes
TacoTheDank Aug 28, 2020
6062cc5
Clean up some unnecessary classes
TacoTheDank Aug 28, 2020
d80b052
Clean up imports
TacoTheDank Aug 28, 2020
515e562
Remove unnecessary version checks
TacoTheDank Aug 28, 2020
ea93736
Update CanvasView with upstream source
TacoTheDank Aug 28, 2020
4252665
Move billing-related classes into their own package
TacoTheDank Aug 28, 2020
6aee536
Merge pull request #3256 from ccrama/cleanup-galore
TacoTheDank Aug 28, 2020
4b58bb6
Update gradle wrapper to 6.6.1
TacoTheDank Aug 28, 2020
160123e
Fix a deprecation regarding ActivityManager.TaskDescription
TacoTheDank Aug 31, 2020
e7409b5
Merge pull request #2 from ccrama/master
Barrett97 Sep 4, 2020
51a2b7f
Added feature to remove thumbnails
Barrett97 Sep 7, 2020
29a6f4c
Add Total Karma count to profile view
Barrett97 Sep 8, 2020
0c2d62b
Drawable renaming (#3264)
TacoTheDank Sep 11, 2020
9949fff
Some library updates (#3266)
TacoTheDank Sep 11, 2020
5f59831
Merge branch 'master' into CombinedKarma
TacoTheDank Sep 11, 2020
aaa62c6
Migrate mp4parser to 2.x (#3268)
TacoTheDank Sep 12, 2020
0d038cb
Update some libraries
TacoTheDank Sep 12, 2020
7694992
Implement colorpicker into project
TacoTheDank Sep 12, 2020
361890c
Reformat code in colorpicker
TacoTheDank Sep 12, 2020
8fd7478
Redundant code cleanup in colorpicker-related stuff
TacoTheDank Sep 12, 2020
766770d
Code cleanup in colorpicker
TacoTheDank Sep 12, 2020
a2c97dd
Added sponsor information to README
ccrama Sep 12, 2020
bd6740b
Fix InflateException in colorpicker
TacoTheDank Sep 17, 2020
d4d95ab
Preliminary fix for F-Droid build
TacoTheDank Sep 17, 2020
c7c4a12
Merge pull request #3269 from ccrama/ever-more-library-updates
TacoTheDank Sep 17, 2020
551f1f0
Update ExoPlayer to 2.12.0 (#3270)
TacoTheDank Sep 19, 2020
915ef82
Copy all text fix
Barrett97 Oct 1, 2020
52ef94e
Join assignments with declarations
TacoTheDank Oct 1, 2020
2133c1e
Call to 'String.concat()' can be replaced with '+'
TacoTheDank Oct 1, 2020
bf2869f
Simplify some annotations
TacoTheDank Oct 1, 2020
f3b58d9
'size() == 0' replaceable with 'isEmpty()'
TacoTheDank Oct 1, 2020
72916c8
Boolean expression could be replaced with conditional expression
TacoTheDank Oct 1, 2020
ab25c1a
Conditional could be pushed inside branch expression
TacoTheDank Oct 1, 2020
cdc9309
Clean up unused imports
TacoTheDank Oct 1, 2020
625a04d
Fix obsolete junit method in SpoilerTextTest
TacoTheDank Oct 1, 2020
5381673
Anonymous type can be replaced with method reference (Java 8)
TacoTheDank Oct 1, 2020
6419a8a
'equals()' call can be replaced with '=='
TacoTheDank Oct 1, 2020
67b07e3
Iteration over 'keySet()' may be optimized
TacoTheDank Oct 1, 2020
774e4b8
Replace 'String.equals("")' with 'isEmpty()'
TacoTheDank Oct 1, 2020
55ff2c3
Call to simple getters and setters from within classes
TacoTheDank Oct 1, 2020
4af9336
Fix some API 29 deprecations
TacoTheDank Oct 1, 2020
8df5541
Merge pull request #3265 from Barrett97/master
ccrama Oct 1, 2020
e8f4bea
Merge pull request #3267 from Barrett97/CombinedKarma
ccrama Oct 1, 2020
d1d24d1
Merge pull request #3273 from Barrett97/CopyAllText
ccrama Oct 1, 2020
fc1beb8
Merge pull request #3274 from ccrama/some-more-cleanup-wowies
TacoTheDank Oct 2, 2020
e91ec88
Use AlarmManagerCompat In NotificationJobScheduler
TacoTheDank Oct 5, 2020
0b4c47f
Use ContextCompat.getSystemService
TacoTheDank Oct 5, 2020
6604db2
Use HtmlCompat.fromHtml where appropriate
TacoTheDank Oct 5, 2020
75d3d68
Remove unnecessary version checks for MarginLayoutParamsCompat
TacoTheDank Oct 5, 2020
d7cabd3
Merge pull request #3275 from ccrama/compat-classes
TacoTheDank Oct 5, 2020
742b961
Update Android Studio
TacoTheDank Oct 8, 2020
f921026
Update Android Studio again
TacoTheDank Oct 19, 2020
d053bf1
Use LayoutInflater.from instead of getSystemService where possible
TacoTheDank Oct 19, 2020
22dff6d
Collapse identical catches
TacoTheDank Oct 20, 2020
c44d244
Remove unused libraries
TacoTheDank Oct 20, 2020
ed26b0a
Clean a bit of duplicate code
TacoTheDank Oct 20, 2020
e7a8986
Actually fix deprecation regarding ActivityManager.TaskDescription
TacoTheDank Oct 20, 2020
0cc144a
Remove unused XML resources
TacoTheDank Oct 20, 2020
c6dacd7
Merge pull request #3279 from ccrama/cleanup-misc
TacoTheDank Oct 20, 2020
92e1671
fix gifdelivernetwork redirection
1fexd Oct 23, 2020
e4c0ae4
Add setting to hide awards on posts
Admicos Oct 27, 2020
83bf402
Add setting to hide awards on comments
Admicos Oct 27, 2020
087346a
Update Exoplayer, guava, junit
TacoTheDank Nov 8, 2020
21f435e
Fixed video muxing/download
ccrama Nov 8, 2020
9953c50
Full Reddit Gallery support, new RedditGalleryPager Activity
ccrama Nov 8, 2020
27c6c24
Fixed empty thumbnails on Reddit Gallery submissions
ccrama Nov 8, 2020
a39a3c4
Fixed clicking on TypeImage in Shadowbox mode
ccrama Nov 8, 2020
f583012
Added an option for high colorspace images
ccrama Nov 8, 2020
1464b7b
Merge branch 'master' into hide-awards
ccrama Nov 8, 2020
3fdce9d
Merge pull request #3285 from Admicos/hide-awards
ccrama Nov 8, 2020
b31e865
Merge pull request #3281 from gringofe/fix-gfycat-redgifs-migration
ccrama Nov 8, 2020
1c6d435
fixes notification getting stuck on 'downloading' after sucessfully d…
Nov 14, 2020
3efad39
Use the submission title as the title for the saved image.
Nov 20, 2020
0f5e3c7
Merge pull request #3290 from budde25/fix-download-getting-stuck
ccrama Nov 25, 2020
72f28cc
Update build number
ccrama Nov 9, 2020
311c8d0
Fixed image flairs crashing app, Improved image loading code when opt…
ccrama Nov 25, 2020
8925f2d
Fixed Reddit Gallery data from Crossposts
ccrama Nov 25, 2020
bfc5593
Merge branch '3035-saved-image-name' of https://github.com/ZianeA/Sli…
ccrama Nov 25, 2020
1ff0d98
Ensure valid filename
ccrama Nov 25, 2020
f8e0e1d
Merge branch 'ZianeA-3035-saved-image-name'
ccrama Nov 25, 2020
af56312
Ensure file names don't conflict while downloading images/videos
ccrama Nov 25, 2020
2fe1af0
Update build number
ccrama Nov 25, 2020
bf558ea
Bump target SDK
ccrama Nov 25, 2020
444ad50
Fixed translucency issues on Android 10+
ccrama Nov 28, 2020
b836c6a
Fix crash when toolbox config doesn't have values
timawesomeness Nov 28, 2020
4bb91d4
Merge pull request #3300 from timawesomeness/fix/toolbox-no-logsub-crash
ccrama Nov 29, 2020
4ac2636
Bump version code
ccrama Nov 29, 2020
bf2886d
Fixed other occurrences of visual glitching when swiping out of Comme…
ccrama Dec 3, 2020
9718ae1
Bump version code
ccrama Dec 4, 2020
31956ee
Cleanup
Mar 23, 2020
dac081d
Add PoC for automatically hiding read posts.
Jul 21, 2020
564e435
Add UI for configuring post-hiding
Jul 21, 2020
987e29f
Merge
Dec 6, 2020
b00ca61
Merge branch 'hideonreddit' of github.com:bobobo1618/Slide into hideo…
Dec 6, 2020
2f18baa
Update XML to use new switch
Dec 6, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# editorconfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ There is an active community for Slide on the
[/r/slideforreddit](https://www.reddit.com/r/slideforreddit/) subreddit,
which anybody is welcome to join.

## Sponsors

Thank you to our awesome Github Sponsors, who help keep the Slide project going

| | GitHub profile |
| --------- | ------------- |
| **KevinNThomas** | https://github.com/KevinNThomas |
| **andrewkdinh** | https://github.com/andrewkdinh |

If you're interested in sponsoring our work, check out the sponsor slots for Slide contributors on the right-hand **Sponsorship** menu

## Contributing

### Issues
Expand Down
Binary file modified adaptive.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
75 changes: 41 additions & 34 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
plugins {
id 'com.gladed.androidgitversion' version '0.4.13'
id 'com.github.ben-manes.versions' version '0.28.0'
id 'com.github.ben-manes.versions' version '0.33.0'
id 'com.android.application'
}

android {
compileSdkVersion 28
compileSdkVersion 29
buildToolsVersion '29.0.3'

defaultConfig {
applicationId "me.ccrama.redditslide"
applicationId "bobobo.redditslide"
minSdkVersion 16
targetSdkVersion 28
versionCode 326
//Change to 28 for F-Droid, need to add this to the scheme
targetSdkVersion 29
versionCode 334
versionName androidGitVersion.name()

multiDexEnabled true
Expand Down Expand Up @@ -78,65 +79,71 @@ dependencies {
/** Custom **/
implementation 'com.github.ccrama:JRAW:9a2494892d'
implementation 'com.github.ccrama:TedBottomPicker:496623c9b6'
implementation 'com.github.ccrama:commonmark-java:07b304b575'
implementation 'com.github.ccrama:PeekAndPop:09adee29f1'
implementation 'com.github.ccrama.commonmark-java:commonmark:07b304b575'
implementation 'com.github.ccrama.commonmark-java:commonmark-ext-gfm-strikethrough:07b304b575'
implementation 'com.github.ccrama.commonmark-java:commonmark-ext-gfm-tables:07b304b575'
implementation 'com.github.ccrama:JReadability:bb291880a5'
implementation 'com.github.Alexendoo:Android-RobotoTextView:f6d0eb5ac7'
implementation 'com.github.Alexendoo.Android-RobotoTextView:robototextview:f6d0eb5ac7'

/** AndroidX **/
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.browser:browser:1.2.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.interpolator:interpolator:1.0.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.google.android.material:material:1.2.1'

/** Third-party (Other) **/
def exoPlayerVersion = '2.11.7'
implementation "com.google.android.exoplayer:exoplayer-core:${exoPlayerVersion}"
implementation "com.google.android.exoplayer:exoplayer-dash:${exoPlayerVersion}"
implementation "com.google.android.exoplayer:extension-okhttp:${exoPlayerVersion}"
implementation "com.google.android.exoplayer:exoplayer-ui:${exoPlayerVersion}"
def exoPlayerVersion = '2.12.1'
implementation "com.google.android.exoplayer:exoplayer-core:$exoPlayerVersion"
implementation "com.google.android.exoplayer:exoplayer-dash:$exoPlayerVersion"
implementation "com.google.android.exoplayer:exoplayer-ui:$exoPlayerVersion"
implementation "com.google.android.exoplayer:extension-okhttp:$exoPlayerVersion"

implementation 'com.google.guava:guava:29.0-android'
implementation 'com.google.guava:guava:30.0-android'
//Updating material-dialogs to any newer version will break all AlertDialogWrapper
//noinspection GradleDependency
implementation 'com.afollestad.material-dialogs:commons:0.8.6.2' //0.9.6.0
implementation 'com.jakewharton:process-phoenix:2.0.0'
implementation 'com.github.ligi.snackengage:snackengage-core:0.25'
implementation 'com.github.ligi.snackengage:snackengage-playrate:0.25'
implementation 'com.github.rey5137:material:1.3.0'
implementation 'com.github.ligi.snackengage:snackengage-core:0.26'
implementation 'com.github.ligi.snackengage:snackengage-playrate:0.26'
implementation 'com.github.rey5137:material:1.3.1'
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.10.0'
implementation 'com.github.davemorrissey:subsampling-scale-image-view:ebce8e0'
implementation 'com.cocosw:bottomsheet:1.5.0@aar'
implementation 'com.lusfold.androidkeyvaluestore:library:0.1.0@aar'
implementation 'org.apache.commons:commons-lang3:3.10'
implementation 'org.apache.commons:commons-text:1.8'
implementation 'commons-io:commons-io:2.7'
implementation 'org.apache.commons:commons-lang3:3.11'
implementation 'org.apache.commons:commons-text:1.9'
implementation 'commons-io:commons-io:2.8.0'
implementation 'jp.wasabeef:blurry:3.0.0'
implementation 'com.makeramen:roundedimageview:2.3.0'
implementation 'com.getbase:floatingactionbutton:1.10.1'
implementation 'com.sothree.slidinguppanel:library:3.4.0'
implementation 'com.github.suckgamony.RapidDecoder:library:7cdfca47fa'
implementation 'com.github.dasar:shiftcolorpicker:v0.5'
implementation 'com.squareup.okhttp3:okhttp:3.12.12'
implementation 'com.google.code.gson:gson:2.8.6'

implementation 'com.github.ozodrukh:CircularReveal:2.1.0'
compileOnly 'org.jetbrains:annotations:19.0.0'
implementation 'com.github.ozodrukh.CircularReveal:circualreveal:2.1.0'
compileOnly 'org.jetbrains:annotations:20.1.0'
implementation 'com.mikepenz:itemanimators:1.1.0@aar'
implementation 'com.neovisionaries:nv-websocket-client:2.9'
implementation 'com.neovisionaries:nv-websocket-client:2.10'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
implementation 'me.everything:overscroll-decor-android:1.1.0'
implementation('com.mikepenz:aboutlibraries:8.3.0', {
exclude group: 'org.jetbrains', module: 'annotations'
})
implementation 'com.googlecode.mp4parser:isoparser:1.1.22'
implementation 'com.mikepenz:aboutlibraries:6.2.3'
implementation 'org.mp4parser:isoparser:1.9.41'
implementation 'org.mp4parser:muxer:1.9.41'

/** Testing **/
testImplementation 'junit:junit:4.13'
testImplementation 'junit:junit:4.13.1'
testImplementation 'org.hamcrest:hamcrest:2.2'
testImplementation 'org.robolectric:robolectric:4.3.1'
testImplementation 'org.robolectric:robolectric:4.4'
testImplementation 'org.powermock:powermock-module-junit4:2.0.7'
}

/*testImplementation 'junit:junit:4.12'
testImplementation 'org.hamcrest:hamcrest-all:1.3'
testImplementation 'org.mockito:mockito-core:2.23.0'
testImplementation "org.robolectric:robolectric:${robolectricVersion}"
testImplementation "org.robolectric:shadows-multidex:${robolectricVersion}"
testImplementation "org.powermock:powermock-api-mockito2:${powerMockitoVersion}"
testImplementation "org.powermock:powermock-module-junit4:${powerMockitoVersion}" */
Binary file modified app/src/debug/res/drawable/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/debug/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/debug/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/debug/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/debug/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 10 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
android:installLocation="auto"
android:label="@string/app_name"
android:resizeableActivity="true"
android:roundIcon="@mipmap/icon_round"
android:roundIcon="@mipmap/ic_launcher_round"
android:usesCleartextTraffic="true"
android:theme="@style/yellow_dark">
<provider
Expand All @@ -37,7 +37,7 @@
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|smallestScreenSize|screenLayout|uiMode"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/icon_round">
android:roundIcon="@mipmap/ic_launcher_round">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

Expand Down Expand Up @@ -322,6 +322,14 @@
android:name=".Activities.Album"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|smallestScreenSize|screenLayout|uiMode"
android:theme="@style/swipeable"/>
<activity
android:name=".Activities.RedditGallery"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|smallestScreenSize|screenLayout|uiMode"
android:theme="@style/swipeable"/>
<activity
android:name=".Activities.RedditGalleryPager"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|smallestScreenSize|screenLayout|uiMode"
android:theme="@style/swipeable"/>
<activity
android:name=".Activities.Tumblr"
android:colorMode="wideColorGamut"
Expand Down
Binary file modified app/src/main/ic_launcher-web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 26 additions & 13 deletions app/src/main/java/me/ccrama/redditslide/Activities/Album.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
import me.ccrama.redditslide.Views.ToolbarColorizeHelper;
import me.ccrama.redditslide.util.LinkUtil;

import static me.ccrama.redditslide.Notifications.ImageDownloadNotificationService.*;

/**
* Created by ccrama on 3/5/2015. <p/> This class is responsible for accessing the Imgur api to get
* the album json data from a URL or Imgur hash. It extends FullScreenActivity and supports swipe
Expand All @@ -58,7 +60,7 @@ public class Album extends FullScreenActivity implements FolderChooserDialogCrea
public static final String EXTRA_URL = "url";
public static final String SUBREDDIT = "subreddit";
private List<Image> images;
private int adapterPosition;
private int adapterPosition;

@Override
public void onFolderSelection(FolderChooserDialogCreate dialog, File folder, boolean isSaveToLocation) {
Expand Down Expand Up @@ -87,6 +89,9 @@ public boolean onOptionsItemSelected(MenuItem item) {
i.putExtra(MediaView.SUBMISSION_URL,
getIntent().getStringExtra(MediaView.SUBMISSION_URL));
}
if (submissionTitle != null) {
i.putExtra(EXTRA_SUBMISSION_TITLE, submissionTitle);
}
i.putExtra("url", url);
startActivity(i);
finish();
Expand Down Expand Up @@ -120,6 +125,9 @@ public void doImageSave(boolean isGif, String contentUrl) {
Intent i = new Intent(this, ImageDownloadNotificationService.class);
i.putExtra("actuallyLoaded", contentUrl);
if (subreddit != null && !subreddit.isEmpty()) i.putExtra("subreddit", subreddit);
if (submissionTitle != null) {
i.putExtra(EXTRA_SUBMISSION_TITLE, submissionTitle);
}
startService(i);
}
} else {
Expand Down Expand Up @@ -201,6 +209,7 @@ private void saveImageGallery(final Bitmap bitmap, String URL) {

public String url;
public String subreddit;
public String submissionTitle;

@Override
public boolean onCreateOptionsMenu(Menu menu) {
Expand All @@ -226,9 +235,12 @@ public void onCreate(Bundle savedInstanceState) {
//Keep the screen on
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

if(getIntent().hasExtra(SUBREDDIT)){
if (getIntent().hasExtra(SUBREDDIT)) {
this.subreddit = getIntent().getExtras().getString(SUBREDDIT);
}
if (getIntent().hasExtra(EXTRA_SUBMISSION_TITLE)) {
this.submissionTitle = getIntent().getExtras().getString(EXTRA_SUBMISSION_TITLE);
}

final ViewPager pager = (ViewPager) findViewById(R.id.images);

Expand All @@ -238,7 +250,7 @@ public void onCreate(Bundle savedInstanceState) {
pager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset,
int positionOffsetPixels) {
int positionOffsetPixels) {
if (position == 0 && positionOffsetPixels == 0) {
finish();
}
Expand Down Expand Up @@ -282,7 +294,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {

public static class OverviewPagerAdapter extends FragmentStatePagerAdapter {
public BlankFragment blankPage;
public AlbumFrag album;
public AlbumFrag album;

public OverviewPagerAdapter(FragmentManager fm) {
super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
Expand Down Expand Up @@ -322,11 +334,10 @@ public static class AlbumFrag extends Fragment {

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Bundle savedInstanceState) {
rootView = inflater.inflate(R.layout.fragment_verticalalbum, container, false);

final PreCachingLayoutManager mLayoutManager;
mLayoutManager = new PreCachingLayoutManager(getActivity());
final PreCachingLayoutManager mLayoutManager = new PreCachingLayoutManager(getActivity());
recyclerView = rootView.findViewById(R.id.images);
recyclerView.setLayoutManager(mLayoutManager);
((Album) getActivity()).url =
Expand Down Expand Up @@ -372,7 +383,7 @@ public void run() {
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int which) {
int which) {
getActivity().finish();
}
})
Expand All @@ -381,7 +392,7 @@ public void onClick(DialogInterface dialog,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int which) {
int which) {
Intent i = new Intent(getActivity(),
Website.class);
i.putExtra(LinkUtil.EXTRA_URL, url);
Expand All @@ -404,13 +415,15 @@ public void doWithData(final List<Image> jsonElements) {
super.doWithData(jsonElements);
if (getActivity() != null) {
getActivity().findViewById(R.id.progress).setVisibility(View.GONE);
((Album) getActivity()).images = new ArrayList<>(jsonElements);
AlbumView adapter = new AlbumView(baseActivity, ((Album) getActivity()).images,
getActivity().findViewById(R.id.toolbar).getHeight(), ((Album) getActivity()).subreddit);
Album albumActivity = (Album) getActivity();
albumActivity.images = new ArrayList<>(jsonElements);
AlbumView adapter = new AlbumView(baseActivity, albumActivity.images,
getActivity().findViewById(R.id.toolbar).getHeight(),
albumActivity.subreddit, albumActivity.submissionTitle);
recyclerView.setAdapter(adapter);
}
}
}
}

}
}
Loading