From: Gustavo Martin Morcuende Date: Mon, 29 Aug 2016 17:09:58 +0000 (+0200) Subject: OpenWeatherMap requires (mandatory) API key X-Git-Tag: weatherinformation-1.2~9 X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=1a2b4d4664b359812fd2e5e71c290ca166800f6e;p=AndroidWeatherInformation OpenWeatherMap requires (mandatory) API key --- diff --git a/app/src/main/java/name/gumartinm/weather/information/activity/MainTabsActivity.java b/app/src/main/java/name/gumartinm/weather/information/activity/MainTabsActivity.java index 1cd242c..05a81a3 100644 --- a/app/src/main/java/name/gumartinm/weather/information/activity/MainTabsActivity.java +++ b/app/src/main/java/name/gumartinm/weather/information/activity/MainTabsActivity.java @@ -149,10 +149,7 @@ public class MainTabsActivity extends FragmentActivity { final String APPID = sharedPreferences.getString(this.getString(R.string.weather_preferences_app_id_key), ""); - final String noticeKeyPreference = this.getString(R.string.api_id_key_notice_preference_key); - final boolean notice = sharedPreferences.getBoolean(noticeKeyPreference, true); - - if (notice && APPID.isEmpty()) { + if (APPID.isEmpty()) { final FragmentManager fm = this.getSupportFragmentManager(); final Fragment buttonsFragment = fm.findFragmentByTag("noticeDialog"); if (buttonsFragment == null) { diff --git a/app/src/main/java/name/gumartinm/weather/information/fragment/APIKeyNoticeDialogFragment.java b/app/src/main/java/name/gumartinm/weather/information/fragment/APIKeyNoticeDialogFragment.java index b177841..741e32d 100644 --- a/app/src/main/java/name/gumartinm/weather/information/fragment/APIKeyNoticeDialogFragment.java +++ b/app/src/main/java/name/gumartinm/weather/information/fragment/APIKeyNoticeDialogFragment.java @@ -17,10 +17,7 @@ package name.gumartinm.weather.information.fragment; import android.app.AlertDialog; import android.app.Dialog; -import android.content.DialogInterface; -import android.content.SharedPreferences; import android.os.Bundle; -import android.preference.PreferenceManager; import android.support.v4.app.DialogFragment; import name.gumartinm.weather.information.R; @@ -45,18 +42,7 @@ public class APIKeyNoticeDialogFragment extends DialogFragment { .setIcon(android.R.drawable.ic_dialog_alert) .setTitle(title) .setMessage(this.getString(R.string.api_id_key_notice_message)) - .setNegativeButton(this.getString(R.string.api_id_key_notice_cancel_button), null) - .setPositiveButton(this.getString(R.string.api_id_key_notice_ok_button), - new DialogInterface.OnClickListener() { - @Override - public void onClick(final DialogInterface dialog, final int whichButton) { - // Save response to permanent storage - final SharedPreferences.Editor prefs = PreferenceManager - .getDefaultSharedPreferences(getActivity().getApplicationContext()).edit(); - prefs.putBoolean(getActivity().getString(R.string.api_id_key_notice_preference_key), false); - prefs.commit(); - } - }) + .setPositiveButton(this.getString(R.string.api_id_key_notice_ok_button), null) .create(); } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c258d86..2d3081d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -108,11 +108,8 @@ OpenWeatherMap API Key - OpenWeatherMap works better with an application ID.\n\nThis key can be added in the preferences window.\n\nTo obtain an API Key for OpenWeatherMap register on the OpenWeatherMap website.\n\nPress OK button if you don\'t want to see this message again. + OpenWeatherMap requires an application ID.\n\nThis key can be added in the preferences window.\n\nTo obtain an API Key for OpenWeatherMap register on the OpenWeatherMap website. OK - Cancel - - api_key_notice_preference_key