Skip to content

Commit

Permalink
Fixes #45.
Browse files Browse the repository at this point in the history
Services fixes.
  • Loading branch information
SpartanJ committed Oct 22, 2022
1 parent 5cfed3a commit 21f62db
Show file tree
Hide file tree
Showing 15 changed files with 75 additions and 54 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ build
imgurviewer.jks
app/release/output.json
/app/release/output-metadata.json
java_pid*
7 changes: 4 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.application'

def versionMajor = 2
def versionMinor = 3
def versionPatch = 1
def versionPatch = 4
// We need to use a static versionCode and versionName to support automatic updates in F-Droid
def versionCodeNum = versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100

Expand All @@ -14,8 +14,8 @@ android {
applicationId "com.ensoft.imgurviewer"
minSdkVersion 21
targetSdkVersion 32
versionCode 23300
versionName "2.3.3"
versionCode 23400
versionName "2.3.4"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand All @@ -28,6 +28,7 @@ android {
targetCompatibility 1.8
sourceCompatibility 1.8
}
namespace 'com.imgurviewer'
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,17 @@ public void loadFailed( Uri uri, String error )
});

String[] testUris = new String[] {
"https://prnt.sc/10jpuxg",
"https://prnt.sc/10jpuxg/direct",
"https://prntscr.com/10jpuxg",
"https://prntscr.com/10jpuxg/direct",
"https://www.reddit.com/gallery/pc1m7t",
"https://v.redd.it/zv89llsvexdz",
"https://v.redd.it/ulz7g757bb581",
"https://www.reddit.com/gallery/huxc4s",
"https://www.redgifs.com/watch/terrificaridbrownbutterfly",
"https://redgifs.com/watch/jaggedunselfishgannet",
"https://gfycat.com/whoppingcostlyairedale",
"https://clips.twitch.tv/SmoggySmallHummingbirdOSkomodo-KeUalcW_KTZl_XRH?tt_medium=redt",
"https://clips.twitch.tv/FaintLightGullWholeWheat",
"http://imgur.com/gallery/fADjkcW",
"https://imgur.com/A61SaA1",
Expand All @@ -131,10 +134,6 @@ public void loadFailed( Uri uri, String error )
"https://ibb.co/f2D3BNg",
"https://gyazo.com/1eae60fbb44ba44cdcd89064ffbaacef",
"https://imgflip.com/i/3dhvnl",
"https://prnt.sc/10jpuxg",
"https://prnt.sc/10jpuxg/direct",
"https://prntscr.com/10jpuxg",
"https://prntscr.com/10jpuxg/direct",
"http://gfycat.com/DeadlyDecisiveGermanpinscher",
"http://gfycat.com/ifr/JauntyTimelyAmazontreeboa",
"https://streamable.com/dnd1",
Expand All @@ -144,9 +143,9 @@ public void loadFailed( Uri uri, String error )
"http://www.flickr.com/photos/forestwander-nature-pictures/5645318632/in/photostream/",
"https://www.flickr.com/photos/10795027@N08/37124872560/in/photostream/lightbox/",
"https://www.flickr.com/photos/wernerkrause/albums/72157649599416957",
"https://media.giphy.com/media/9r1gg8vm3lbTcQI1Gw/giphy.gif",
"https://media.giphy.com/media/l4EoMdmBWzc69MSm4/giphy.gif",
"https://streamja.com/ggz",
"https://giphy.com/gifs/warnerbrosde-R6gvnAxj2ISzJdbA63",
"https://giphy.com/gifs/love-i-you-that-70s-show-2dQ3FMaMFccpi",
"https://streamja.com/6BGLa",
"https://vimeo.com/247872788",
"https://vimeo.com/311794663",
"https://www.clippituser.tv/c/dnbaba",
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.imgurviewer"
android:installLocation="auto">
android:installLocation="auto">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.ensoft.imgurviewer.model;

public class FlickAlbumImageData
{
public FlickrAlbumImage data;
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,49 +12,49 @@ public class FlickrAlbumImage

public String description;

public FlickrAlbumImageSizes sizes;
public FlickrAlbumImageSizesData sizes;

public String getImage()
{
String url = null;

ThumbnailSize thumbnailSize = App.getInstance().getPreferencesService().thumbnailSizeOnGallery();

if ( thumbnailSize == ThumbnailSize.SMALL_SQUARE && null != sizes.sq )
url = sizes.sq.displayUrl;
else if ( thumbnailSize == ThumbnailSize.BIG_SQUARE && null != sizes.q )
url = sizes.q.displayUrl;
else if ( thumbnailSize == ThumbnailSize.SMALL_THUMBNAIL && null != sizes.s )
url = sizes.s.displayUrl;
else if ( thumbnailSize == ThumbnailSize.MEDIUM_THUMBNAIL && null != sizes.m )
url = sizes.m.displayUrl;
else if ( thumbnailSize == ThumbnailSize.LARGE_THUMBNAIL && null != sizes.l )
url = sizes.l.displayUrl;
else if ( thumbnailSize == ThumbnailSize.HUGE_THUMBNAIL && null != sizes.h )
url = sizes.h.displayUrl;
else if ( thumbnailSize == ThumbnailSize.FULL_IMAGE && null != sizes.k )
url = sizes.k.displayUrl;
if ( thumbnailSize == ThumbnailSize.SMALL_SQUARE && null != sizes.data.sq )
url = sizes.data.sq.data.displayUrl;
else if ( thumbnailSize == ThumbnailSize.BIG_SQUARE && null != sizes.data.q )
url = sizes.data.q.data.displayUrl;
else if ( thumbnailSize == ThumbnailSize.SMALL_THUMBNAIL && null != sizes.data.s )
url = sizes.data.s.data.displayUrl;
else if ( thumbnailSize == ThumbnailSize.MEDIUM_THUMBNAIL && null != sizes.data.m )
url = sizes.data.m.data.displayUrl;
else if ( thumbnailSize == ThumbnailSize.LARGE_THUMBNAIL && null != sizes.data.l )
url = sizes.data.l.data.displayUrl;
else if ( thumbnailSize == ThumbnailSize.HUGE_THUMBNAIL && null != sizes.data.h )
url = sizes.data.h.data.displayUrl;
else if ( thumbnailSize == ThumbnailSize.FULL_IMAGE && null != sizes.data.k )
url = sizes.data.k.data.displayUrl;

return ( url != null ) ? "https:" + url : null;
}

public String getFullSizeImage()
{
return null != sizes.k ? "https:" + sizes.k.displayUrl : null;
return null != sizes.data.k ? "https:" + sizes.data.k.data.displayUrl : null;
}

public Uri getThumbnail()
{
String url = null;

if ( sizes.t != null )
url = sizes.t.displayUrl;
if ( sizes.data.t != null )
url = sizes.data.t.data.displayUrl;

if ( null == url && sizes.s != null )
url = sizes.s.displayUrl;
if ( null == url && sizes.data.s != null )
url = sizes.data.s.data.displayUrl;

if ( null == url && null != sizes.sq )
url = sizes.sq.displayUrl;
if ( null == url && null != sizes.data.sq )
url = sizes.data.sq.data.displayUrl;

return null != url ? Uri.parse( "https:" + url ) : null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,4 @@ public class FlickrAlbumImageSize
public String displayUrl;

public String url;

public String key;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.ensoft.imgurviewer.model;

public class FlickrAlbumImageSizeData
{
public FlickrAlbumImageSize data;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@

public class FlickrAlbumImageSizes
{
FlickrAlbumImageSize c;
FlickrAlbumImageSizeData c;

FlickrAlbumImageSize h;
FlickrAlbumImageSizeData h;

FlickrAlbumImageSize k;
FlickrAlbumImageSizeData k;

FlickrAlbumImageSize l;
FlickrAlbumImageSizeData l;

FlickrAlbumImageSize m;
FlickrAlbumImageSizeData m;

FlickrAlbumImageSize n;
FlickrAlbumImageSizeData n;

FlickrAlbumImageSize q;
FlickrAlbumImageSizeData q;

FlickrAlbumImageSize s;
FlickrAlbumImageSizeData s;

FlickrAlbumImageSize t;
FlickrAlbumImageSizeData t;

FlickrAlbumImageSize z;
FlickrAlbumImageSizeData z;

FlickrAlbumImageSize sq;
FlickrAlbumImageSizeData sq;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.ensoft.imgurviewer.model;

public class FlickrAlbumImageSizesData
{
public FlickrAlbumImageSizes data;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.ensoft.imgurviewer.App;
import com.ensoft.imgurviewer.model.FlickAlbumImageData;
import com.ensoft.imgurviewer.model.FlickrAlbumImage;
import com.ensoft.imgurviewer.model.FlickrImage;
import com.ensoft.imgurviewer.model.ImgurImage;
Expand Down Expand Up @@ -202,18 +203,20 @@ public void onRequestSuccess( Context context, String response )
{
try
{
String imagesList = StringUtils.getLastStringMatch( response, "\"photoPageList\":{\"_data\":", ",\"fetchedStart\":" );
String imagesList = StringUtils.getLastStringMatch( response, "\"photoPageList\":{\"data\":{\"_data\":", ",\"fetchedStart\":" );

FlickrAlbumImage[] images = new Gson().fromJson( imagesList, FlickrAlbumImage[].class );
FlickAlbumImageData[] images = new Gson().fromJson( imagesList, FlickAlbumImageData[].class );

if ( null != images && images.length > 0 )
{
ImgurImage[] imgurImages = new ImgurImage[ images.length ];

int i = 0;

for ( FlickrAlbumImage img : images )
for ( FlickAlbumImageData data : images )
{
FlickrAlbumImage img = data.data;

imgurImages[i] = new ImgurImage( img.getImage(), img.getThumbnail(), img.getTitle(), img.getDescription() );

imgurImages[i].setFullSizeLink( img.getFullSizeImage() );
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<string name="app_name">ImgurViewer</string>
<string name="imgur_client_id">912617e18339d56</string>
<string name="flickr_key">2ba8fd93b3d6443c8c8b8f277770bf6e</string>
<string name="giphy_api_key">dc6zaTOxFJmzC</string>
<string name="giphy_api_key">IRU70b00U8JXpmJ9DJBrdpSrz07JzdMN</string>
<string name="version">Version</string>
<string name="settings">Settings</string>
<string name="general">General</string>
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
classpath 'com.android.tools.build:gradle:7.3.1'
}
}

Expand Down
2 changes: 2 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/23400.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
2.3.4:
Services fixes.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip

0 comments on commit 21f62db

Please sign in to comment.