From 63ea778b2e63d800d9f4a458e5cf9fc2711dfa51 Mon Sep 17 00:00:00 2001 From: ratan12 Date: Wed, 8 Jul 2015 19:00:34 +0200 Subject: [PATCH 1/3] Fix empty webview when an user tries to log in to Anilist while being offline --- Atarashii/src/net/somethingdreadful/MAL/FirstTimeInit.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Atarashii/src/net/somethingdreadful/MAL/FirstTimeInit.java b/Atarashii/src/net/somethingdreadful/MAL/FirstTimeInit.java index 029b2d80..af0f3c24 100644 --- a/Atarashii/src/net/somethingdreadful/MAL/FirstTimeInit.java +++ b/Atarashii/src/net/somethingdreadful/MAL/FirstTimeInit.java @@ -152,8 +152,12 @@ public void onClick(View v) { viewFlipper.setDisplayedChild(1); break; case R.id.anilist: - viewFlipper.setDisplayedChild(2); + if (MALApi.isNetworkAvailable(this)) + viewFlipper.setDisplayedChild(2); + else + Theme.Snackbar(this, R.string.toast_error_noConnectivity); break; } } } + From 42755559cebecd0a363a9d0c2c3200f2443ace17 Mon Sep 17 00:00:00 2001 From: ratan12 Date: Wed, 8 Jul 2015 19:01:20 +0200 Subject: [PATCH 2/3] Fix numberpicker not updating the right score --- .../net/somethingdreadful/MAL/PrefManager.java | 2 -- .../MAL/dialog/NumberPickerDialogFragment.java | 17 ++++++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Atarashii/src/net/somethingdreadful/MAL/PrefManager.java b/Atarashii/src/net/somethingdreadful/MAL/PrefManager.java index fa3dbf1d..3e3dad53 100644 --- a/Atarashii/src/net/somethingdreadful/MAL/PrefManager.java +++ b/Atarashii/src/net/somethingdreadful/MAL/PrefManager.java @@ -237,8 +237,6 @@ public static void setAiringOnly(boolean airing) { * 4. :( & :| & :) * 5. 0.0 - 10.0 * - * note: number 4 is currently not supported! - * * @param type The type number */ public static void setScoreType(int type) { diff --git a/Atarashii/src/net/somethingdreadful/MAL/dialog/NumberPickerDialogFragment.java b/Atarashii/src/net/somethingdreadful/MAL/dialog/NumberPickerDialogFragment.java index 908818e9..8f61a2ff 100644 --- a/Atarashii/src/net/somethingdreadful/MAL/dialog/NumberPickerDialogFragment.java +++ b/Atarashii/src/net/somethingdreadful/MAL/dialog/NumberPickerDialogFragment.java @@ -16,6 +16,7 @@ import net.somethingdreadful.MAL.PrefManager; import net.somethingdreadful.MAL.R; import net.somethingdreadful.MAL.Theme; +import net.somethingdreadful.MAL.account.AccountService; public class NumberPickerDialogFragment extends DialogFragment { @@ -35,7 +36,10 @@ private View makeNumberPicker() { if (!inputScore) { numberPicker.setMaxValue(max != 0 ? max : 999); numberPicker.setMinValue(0); - numberPicker.setValue(current); + if (!AccountService.isMAL() && isRating()) + numberPicker.setValue(Integer.parseInt(Theme.getDisplayScore(current))); + else + numberPicker.setValue(current); numberInput.setVisibility(View.GONE); } else { numberInput.setText(Theme.getDisplayScore(current)); @@ -56,8 +60,11 @@ public Dialog onCreateDialog(Bundle savedInstanceState) { public void onClick(DialogInterface dialog, int whichButton) { numberPicker.clearFocus(); numberInput.clearFocus(); - int value = Theme.getRawScore(numberInput.getText().toString()); - callback.onUpdated(PrefManager.getScoreType() != 3 && PrefManager.getScoreType() != 1 ? value : numberPicker.getValue(), getArguments().getInt("id")); + int value = Theme.getRawScore(!inputScore ? Integer.toString(numberPicker.getValue()) : numberInput.getText().toString()); + if (!AccountService.isMAL() && isRating()) + callback.onUpdated(value, getArguments().getInt("id")); + else + callback.onUpdated(numberPicker.getValue(), getArguments().getInt("id")); dismiss(); } }); @@ -71,6 +78,10 @@ public void onClick(DialogInterface dialog, int whichButton) { return builder.create(); } + private boolean isRating() { + return getArguments().getInt("id") == R.id.scorePanel; + } + /** * Get the integer from an argument. * From aeca2700339a392e72e78211d9210af57d6cc871 Mon Sep 17 00:00:00 2001 From: ratan12 Date: Wed, 8 Jul 2015 19:02:27 +0200 Subject: [PATCH 3/3] Upgrade version to 2.1 RC 3 --- Atarashii/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Atarashii/build.gradle b/Atarashii/build.gradle index 955eea0e..e088bf7f 100644 --- a/Atarashii/build.gradle +++ b/Atarashii/build.gradle @@ -49,8 +49,8 @@ android { } Beta { applicationId 'net.somethingdreadful.MAL.beta' - versionCode 50 - versionName '2.1 RC 2' + versionCode 51 + versionName '2.1 RC 3' } } }