Zoom up to 10x in ViewImageActivity. Minor bugs fixed.

This commit is contained in:
Alex Ning 2019-06-21 10:20:09 +08:00
parent a4b93699d8
commit 89e934f5a7
4 changed files with 14 additions and 5 deletions

View File

@ -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 activityColorFrom = getResources().getColor(android.R.color.black);
int actionBarColorFrom = getResources().getColor(R.color.transparentActionBarColor); 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 -> { mImageView.setOnClickListener(view -> {
if (isActionBarHidden) { if (isActionBarHidden) {
@ -398,7 +398,7 @@ public class ViewImageActivity extends AppCompatActivity {
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if(requestCode == PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE && grantResults.length > 0) { if(requestCode == PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE && grantResults.length > 0) {
if(grantResults[0] == PackageManager.PERMISSION_DENIED) { 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) { } else if(grantResults[0] == PackageManager.PERMISSION_GRANTED && isDownloading) {
saveImage(); saveImage();
} }
@ -422,9 +422,9 @@ public class ViewImageActivity extends AppCompatActivity {
super.onPostExecute(aVoid); super.onPostExecute(aVoid);
isDownloading = false; isDownloading = false;
if(saveSuccess) { 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 { } else {
Toast.makeText(ViewImageActivity.this, "Download failed", Toast.LENGTH_SHORT).show(); Toast.makeText(ViewImageActivity.this, R.string.download_failed, Toast.LENGTH_SHORT).show();
} }
} }

View File

@ -154,6 +154,9 @@ public class ViewSubredditDetailActivity extends AppCompatActivity {
} }
String subredditFullName = "r/" + subredditData.getName(); String subredditFullName = "r/" + subredditData.getName();
if(!title.equals(subredditFullName)) {
getSupportActionBar().setTitle(subredditFullName);
}
subredditNameTextView.setText(subredditFullName); subredditNameTextView.setText(subredditFullName);
String nSubscribers = getString(R.string.subscribers_number_detail, subredditData.getNSubscribers()); String nSubscribers = getString(R.string.subscribers_number_detail, subredditData.getNSubscribers());
nSubscribersTextView.setText(nSubscribers); nSubscribersTextView.setText(nSubscribers);

View File

@ -216,6 +216,9 @@ public class ViewUserDetailActivity extends AppCompatActivity {
String userFullName = "u/" + userData.getName(); String userFullName = "u/" + userData.getName();
userNameTextView.setText(userFullName); userNameTextView.setText(userFullName);
if(!title.equals(userFullName)) {
getSupportActionBar().setTitle(userFullName);
}
String karma = getString(R.string.karma_info, userData.getKarma()); String karma = getString(R.string.karma_info, userData.getKarma());
karmaTextView.setText(karma); karmaTextView.setText(karma);
} }

View File

@ -24,6 +24,7 @@
<string name="no_posts">No posts found.</string> <string name="no_posts">No posts found.</string>
<string name="no_subreddits">No subreddits found.</string> <string name="no_subreddits">No subreddits found.</string>
<string name="no_users">No users found.</string> <string name="no_users">No users found.</string>
<string name="no_storage_permission">No storage permission to save this file</string>
<string name="load_posts_failed">Error loading posts</string> <string name="load_posts_failed">Error loading posts</string>
<string name="load_comment_failed">Error loading comments</string> <string name="load_comment_failed">Error loading comments</string>
@ -77,4 +78,6 @@
<string name="send_comment_failed">Could not send this comment</string> <string name="send_comment_failed">Could not send this comment</string>
<string name="parse_sent_comment_failed">The comment is sent but unable to get the sent comment</string> <string name="parse_sent_comment_failed">The comment is sent but unable to get the sent comment</string>
<string name="download_completed">Download completed</string>
<string name="download_failed">Download Failed</string>
</resources> </resources>