Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/master' into prep-r…
Browse files Browse the repository at this point in the history
…elease-0.5.0
  • Loading branch information
forrestguice committed Nov 19, 2017
2 parents 857f5b9 + 0d662ab commit ad68ed9
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void setChoice( SolarEvents choice )
* @param savedInstanceState a Bundle containing dialog state
* @return an AlarmDialog ready to be shown
*/
@SuppressWarnings("deprecation")
@SuppressWarnings({"deprecation","RestrictedApi"})
@NonNull @Override
public Dialog onCreateDialog(Bundle savedInstanceState)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public void onResume()
* @param savedInstanceState a Bundle containing previously saved dialog state
* @return an AlertDialog ready for display
*/
@SuppressWarnings("deprecation")
@SuppressWarnings({"deprecation","RestrictedApi"})
@NonNull @Override
public Dialog onCreateDialog(Bundle savedInstanceState)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,7 @@ public boolean onCreateOptionsMenu(Menu menu)
return true;
}

@SuppressWarnings("RestrictedApi")
@Override
protected boolean onPrepareOptionsPanel(View view, Menu menu)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,18 @@ private void initViews(Context context, View dialogContent)
* @param savedInstanceState a bundle containing previously saved dialog state
* @return a dialog instance ready to be shown
*/
@SuppressWarnings("deprecation")
@SuppressWarnings({"deprecation","RestrictedApi"})
@NonNull @Override
public Dialog onCreateDialog(Bundle savedInstanceState)
{
super.onCreateDialog(savedInstanceState);
final FragmentActivity myParent = getActivity();
Resources r = getResources();

LayoutInflater inflater = myParent.getLayoutInflater();
@SuppressLint("InflateParams")
View dialogContent = inflater.inflate(R.layout.layout_dialog_date, null);

Resources r = getResources();
int padding = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16, r.getDisplayMetrics());

AlertDialog.Builder builder = new AlertDialog.Builder(myParent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public class TimeZoneDialog extends DialogFragment
private WidgetTimezones.TimeZoneItemAdapter spinner_timezone_adapter;
private boolean loading = false;

@SuppressWarnings("deprecation")
@SuppressWarnings({"deprecation","RestrictedApi"})
@NonNull @Override
public Dialog onCreateDialog(final Bundle savedInstanceState)
{
Expand All @@ -90,7 +90,6 @@ public Dialog onCreateDialog(final Bundle savedInstanceState)

AlertDialog.Builder builder = new AlertDialog.Builder(myParent);
builder.setView(dialogContent, 0, padding, 0, 0);

builder.setTitle(myParent.getString(R.string.timezone_dialog_title));

AlertDialog dialog = builder.create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,9 +489,9 @@ public void onRestoreInstanceState(@NonNull Bundle savedState)
super.onRestoreInstanceState(savedState);
if (mode == UIMode.ADD_THEME)
{
chooseName.setThemeName(savedState.getString(SuntimesTheme.THEME_NAME, chooseName.getThemeName()));
chooseName.setThemeName(getString(savedState, SuntimesTheme.THEME_NAME, chooseName.getThemeName()));
}
editDisplay.setText(savedState.getString(SuntimesTheme.THEME_DISPLAYSTRING, editDisplay.getText().toString()));
editDisplay.setText(getString(savedState, SuntimesTheme.THEME_DISPLAYSTRING, editDisplay.getText().toString()));

ThemeBackground background = (ThemeBackground)spinBackground.getSelectedItem();
setSelectedBackground(savedState.getInt(SuntimesTheme.THEME_BACKGROUND, (background != null ? background.getResID() : DarkTheme.THEMEDEF_BACKGROUND_ID)));
Expand All @@ -510,6 +510,14 @@ public void onRestoreInstanceState(@NonNull Bundle savedState)
choosePadding.setPadding(savedState.getIntArray(SuntimesTheme.THEME_PADDING));
}

private String getString(Bundle bundle, String key, String defaultValue)
{
String value = bundle.getString(key);
if (value != null)
return value;
else return defaultValue;
}

@Override
public boolean onCreateOptionsMenu(Menu menu)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ public void onSaveInstanceState( Bundle outState )
public void onRestoreInstanceState(@NonNull Bundle savedState)
{
super.onRestoreInstanceState(savedState);
String themeName = savedState.getString(SuntimesTheme.THEME_NAME, null);
String themeName = savedState.getString(SuntimesTheme.THEME_NAME);
if (themeName != null)
{
SuntimesTheme.ThemeDescriptor theme = (SuntimesTheme.ThemeDescriptor) adapter.getItem(adapter.ordinal(themeName));
Expand All @@ -531,11 +531,11 @@ public void onResume()
}
}

@SuppressWarnings("RestrictedApi")
@Override
protected boolean onPrepareOptionsPanel(View view, Menu menu)
{
SuntimesUtils.forceActionBarIcons(menu);
return super.onPrepareOptionsPanel(view, menu);
}

}

0 comments on commit ad68ed9

Please sign in to comment.