OpenWeatherMap requires (mandatory) API key
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Mon, 29 Aug 2016 17:09:58 +0000 (19:09 +0200)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Mon, 29 Aug 2016 17:10:30 +0000 (19:10 +0200)
app/src/main/java/name/gumartinm/weather/information/activity/MainTabsActivity.java
app/src/main/java/name/gumartinm/weather/information/fragment/APIKeyNoticeDialogFragment.java
app/src/main/res/values/strings.xml

index 1cd242c..05a81a3 100644 (file)
@@ -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) {
index b177841..741e32d 100644 (file)
@@ -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();
     }
     
index c258d86..2d3081d 100644 (file)
 
     <!-- API key Notice Dialog -->
     <string name="api_id_key_notice_title">OpenWeatherMap API Key</string>
-    <string name="api_id_key_notice_message">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.</string>
+    <string name="api_id_key_notice_message">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.</string>
     <string name="api_id_key_notice_ok_button">OK</string>
-    <string name="api_id_key_notice_cancel_button">Cancel</string>
-    <!-- DO NOT TRANSLATE -->
-    <string name="api_id_key_notice_preference_key">api_key_notice_preference_key</string>
 
 
     <!-- Widget Preferences Activity -->