aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2019-06-21 02:20:09 +0000
committerAlex Ning <chineseperson5@gmail.com>2019-06-21 02:20:09 +0000
commit89e934f5a7d6d87562b1b2ad175fc43dfabc9b71 (patch)
tree90827d4d1d2d54f73070fae7e1547daa67310715 /app/src/main/java/ml
parenta4b93699d8f5649ada3a3c1e20ac7a3a18735875 (diff)
downloadinfinity-for-reddit-89e934f5a7d6d87562b1b2ad175fc43dfabc9b71.tar
infinity-for-reddit-89e934f5a7d6d87562b1b2ad175fc43dfabc9b71.tar.gz
infinity-for-reddit-89e934f5a7d6d87562b1b2ad175fc43dfabc9b71.tar.bz2
infinity-for-reddit-89e934f5a7d6d87562b1b2ad175fc43dfabc9b71.tar.lz
infinity-for-reddit-89e934f5a7d6d87562b1b2ad175fc43dfabc9b71.tar.xz
infinity-for-reddit-89e934f5a7d6d87562b1b2ad175fc43dfabc9b71.tar.zst
infinity-for-reddit-89e934f5a7d6d87562b1b2ad175fc43dfabc9b71.zip
Zoom up to 10x in ViewImageActivity. Minor bugs fixed.
Diffstat (limited to 'app/src/main/java/ml')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ViewImageActivity.java10
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ViewUserDetailActivity.java3
3 files changed, 11 insertions, 5 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewImageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewImageActivity.java
index 69ed511a..08dc356c 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewImageActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewImageActivity.java
@@ -113,7 +113,7 @@ public class ViewImageActivity extends AppCompatActivity {
}
});
- final float pxHeight = getResources().getDisplayMetrics().heightPixels;
+ float pxHeight = getResources().getDisplayMetrics().heightPixels;
int activityColorFrom = getResources().getColor(android.R.color.black);
int actionBarColorFrom = getResources().getColor(R.color.transparentActionBarColor);
@@ -303,7 +303,7 @@ public class ViewImageActivity extends AppCompatActivity {
}
});
- mImageView.getController().getSettings().setPanEnabled(true);
+ mImageView.getController().getSettings().setMaxZoom(10f).setDoubleTapZoom(2f).setPanEnabled(true);
mImageView.setOnClickListener(view -> {
if (isActionBarHidden) {
@@ -398,7 +398,7 @@ public class ViewImageActivity extends AppCompatActivity {
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if(requestCode == PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE && grantResults.length > 0) {
if(grantResults[0] == PackageManager.PERMISSION_DENIED) {
- Toast.makeText(this, "No storage permission to save this file", Toast.LENGTH_SHORT).show();
+ Toast.makeText(this, R.string.no_storage_permission, Toast.LENGTH_SHORT).show();
} else if(grantResults[0] == PackageManager.PERMISSION_GRANTED && isDownloading) {
saveImage();
}
@@ -422,9 +422,9 @@ public class ViewImageActivity extends AppCompatActivity {
super.onPostExecute(aVoid);
isDownloading = false;
if(saveSuccess) {
- Toast.makeText(ViewImageActivity.this, "Download completed", Toast.LENGTH_SHORT).show();
+ Toast.makeText(ViewImageActivity.this, R.string.download_completed, Toast.LENGTH_SHORT).show();
} else {
- Toast.makeText(ViewImageActivity.this, "Download failed", Toast.LENGTH_SHORT).show();
+ Toast.makeText(ViewImageActivity.this, R.string.download_failed, Toast.LENGTH_SHORT).show();
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java
index ccc9b6de..58f01eaf 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewSubredditDetailActivity.java
@@ -154,6 +154,9 @@ public class ViewSubredditDetailActivity extends AppCompatActivity {
}
String subredditFullName = "r/" + subredditData.getName();
+ if(!title.equals(subredditFullName)) {
+ getSupportActionBar().setTitle(subredditFullName);
+ }
subredditNameTextView.setText(subredditFullName);
String nSubscribers = getString(R.string.subscribers_number_detail, subredditData.getNSubscribers());
nSubscribersTextView.setText(nSubscribers);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewUserDetailActivity.java
index fc3be116..e9ab3123 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ViewUserDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ViewUserDetailActivity.java
@@ -216,6 +216,9 @@ public class ViewUserDetailActivity extends AppCompatActivity {
String userFullName = "u/" + userData.getName();
userNameTextView.setText(userFullName);
+ if(!title.equals(userFullName)) {
+ getSupportActionBar().setTitle(userFullName);
+ }
String karma = getString(R.string.karma_info, userData.getKarma());
karmaTextView.setText(karma);
}