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) {
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;
.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();
}
<!-- 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 -->