Class MainActivity
- java.lang.Object
-
- Activity
-
- de.kaffeemitkoffein.tinyweatherforecastgermany.MainActivity
-
public class MainActivity extends Activity
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MainActivity.SpinnerListener
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DUMMY_ACCOUNT_NAME
static java.lang.String
DUMMY_ACCOUNT_PASS
static java.lang.String
EXTRA_AREADB_PROGRESS_TEXT
static java.lang.String
EXTRA_AREADB_PROGRESS_VALUE
static java.lang.String
EXTRA_ISFIRSTAPPLAUNCH
static java.lang.String
LOCATION_DENIED
static java.lang.String
MAINAPP_AREADB_PROGRESS
static java.lang.String
MAINAPP_AREADB_READY
static java.lang.String
MAINAPP_CUSTOM_REFRESH_ACTION
static java.lang.String
MAINAPP_HIDE_PROGRESS
static java.lang.String
MAINAPP_SHOW_PROGRESS
static java.lang.String
MAINAPP_SSL_ERROR
static int
PERMISSION_CALLBACK_ALL
static int
PERMISSION_CALLBACK_BACKGROUND_LOCATION
static int
PERMISSION_CALLBACK_LOCATION
static int
PERMISSION_CALLBACK_LOCATION_BEFORE_BACKGROUND
static int
PERMISSION_CALLBACK_POST_NOTIFICATIONS
-
Constructor Summary
Constructors Constructor Description MainActivity()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
askDialog(Context context, java.lang.Integer icon, java.lang.String title, java.lang.String[] text, DialogInterface.OnClickListener positiveListener)
boolean
checkForBatteryOptimizationForLocation(Context context)
static void
deleteAreaDatabase(Context context)
void
displayUpdateTime(CurrentWeatherInfo currentWeatherInfo)
void
displayWeatherForecast()
void
forcedOverallUpdate()
static int
getColorFromResource(Context context, int id)
static long
getEstimatedAdapterLayoutTimeInMillis(Context context)
static SyncRequest
getManualSyncRequest(Context context, int updateFlags)
static Account
getWeatherAccount(Context context)
void
hideMainappProgress()
static boolean
isDataSaverActive(Context context)
static boolean
isIgnoringBatteryOptimizations(Context context)
Checks if battery optimizations are ignored.static boolean
isSyncAccountEnabled(Context context)
void
loadStationsData()
protected void
onCreate(Bundle savedInstanceState)
boolean
onCreateOptionsMenu(Menu menu)
protected void
onDestroy()
boolean
onMenuOpened(int featureID, Menu menu)
boolean
onOptionsItemSelected(MenuItem mi)
void
onOptionsMenuClosed(Menu menu)
protected void
onPause()
void
onRequestPermissionsResult(int permRequestCode, java.lang.String[] perms, int[] grantRes)
void
onRestoreInstanceState(Bundle restoreInstanceState)
protected void
onResume()
void
onSaveInstanceState(Bundle savedInstanceState)
protected void
onStart()
protected void
onStop()
void
onTrimMemory(int level)
void
popupHint()
static boolean
prepareAreaDatabase(Context context)
static void
registerSyncAdapter(Context context)
void
requestPermissionsAndShowHints()
static void
setOverflowMenuItemColor(Context context, Menu menu, int id, int string_id)
static void
setSyncAccountEnabled(Context context, Account account, boolean enable)
void
showAboutDialog()
void
showMainappProgress()
void
showWhatsNewDialog()
java.lang.String
standardizeGeo(java.lang.String s)
static void
updateAppViews(Context context, CurrentWeatherInfo weatherCard)
void
updateAppViews(CurrentWeatherInfo weatherCard)
-
-
-
Field Detail
-
MAINAPP_CUSTOM_REFRESH_ACTION
public static final java.lang.String MAINAPP_CUSTOM_REFRESH_ACTION
- See Also:
- Constant Field Values
-
MAINAPP_SSL_ERROR
public static final java.lang.String MAINAPP_SSL_ERROR
- See Also:
- Constant Field Values
-
MAINAPP_SHOW_PROGRESS
public static final java.lang.String MAINAPP_SHOW_PROGRESS
- See Also:
- Constant Field Values
-
MAINAPP_HIDE_PROGRESS
public static final java.lang.String MAINAPP_HIDE_PROGRESS
- See Also:
- Constant Field Values
-
MAINAPP_AREADB_PROGRESS
public static final java.lang.String MAINAPP_AREADB_PROGRESS
- See Also:
- Constant Field Values
-
MAINAPP_AREADB_READY
public static final java.lang.String MAINAPP_AREADB_READY
- See Also:
- Constant Field Values
-
EXTRA_AREADB_PROGRESS_VALUE
public static final java.lang.String EXTRA_AREADB_PROGRESS_VALUE
- See Also:
- Constant Field Values
-
EXTRA_AREADB_PROGRESS_TEXT
public static final java.lang.String EXTRA_AREADB_PROGRESS_TEXT
- See Also:
- Constant Field Values
-
EXTRA_ISFIRSTAPPLAUNCH
public static final java.lang.String EXTRA_ISFIRSTAPPLAUNCH
- See Also:
- Constant Field Values
-
PERMISSION_CALLBACK_ALL
public static final int PERMISSION_CALLBACK_ALL
- See Also:
- Constant Field Values
-
PERMISSION_CALLBACK_LOCATION
public static final int PERMISSION_CALLBACK_LOCATION
- See Also:
- Constant Field Values
-
PERMISSION_CALLBACK_LOCATION_BEFORE_BACKGROUND
public static final int PERMISSION_CALLBACK_LOCATION_BEFORE_BACKGROUND
- See Also:
- Constant Field Values
-
PERMISSION_CALLBACK_BACKGROUND_LOCATION
public static final int PERMISSION_CALLBACK_BACKGROUND_LOCATION
- See Also:
- Constant Field Values
-
PERMISSION_CALLBACK_POST_NOTIFICATIONS
public static final int PERMISSION_CALLBACK_POST_NOTIFICATIONS
- See Also:
- Constant Field Values
-
LOCATION_DENIED
public static final java.lang.String LOCATION_DENIED
- See Also:
- Constant Field Values
-
DUMMY_ACCOUNT_NAME
public static final java.lang.String DUMMY_ACCOUNT_NAME
- See Also:
- Constant Field Values
-
DUMMY_ACCOUNT_PASS
public static final java.lang.String DUMMY_ACCOUNT_PASS
- See Also:
- Constant Field Values
-
-
Method Detail
-
onPause
protected void onPause()
-
onSaveInstanceState
public void onSaveInstanceState(Bundle savedInstanceState)
-
onRestoreInstanceState
public void onRestoreInstanceState(Bundle restoreInstanceState)
-
onStart
protected void onStart()
-
onResume
protected void onResume()
-
onStop
protected void onStop()
-
onDestroy
protected void onDestroy()
-
onCreate
protected void onCreate(Bundle savedInstanceState)
-
getEstimatedAdapterLayoutTimeInMillis
public static long getEstimatedAdapterLayoutTimeInMillis(Context context)
-
loadStationsData
public void loadStationsData()
-
displayUpdateTime
public void displayUpdateTime(CurrentWeatherInfo currentWeatherInfo)
-
displayWeatherForecast
public void displayWeatherForecast()
-
forcedOverallUpdate
public void forcedOverallUpdate()
-
getColorFromResource
public static int getColorFromResource(Context context, int id)
-
setOverflowMenuItemColor
public static void setOverflowMenuItemColor(Context context, Menu menu, int id, int string_id)
-
onCreateOptionsMenu
public boolean onCreateOptionsMenu(Menu menu)
-
onMenuOpened
public boolean onMenuOpened(int featureID, Menu menu)
-
onOptionsMenuClosed
public void onOptionsMenuClosed(Menu menu)
-
onOptionsItemSelected
public boolean onOptionsItemSelected(MenuItem mi)
-
showAboutDialog
public void showAboutDialog()
-
showWhatsNewDialog
public void showWhatsNewDialog()
-
deleteAreaDatabase
public static void deleteAreaDatabase(Context context)
-
prepareAreaDatabase
public static boolean prepareAreaDatabase(Context context)
-
askDialog
public static void askDialog(Context context, java.lang.Integer icon, java.lang.String title, java.lang.String[] text, DialogInterface.OnClickListener positiveListener)
-
popupHint
public void popupHint()
-
requestPermissionsAndShowHints
public void requestPermissionsAndShowHints()
-
onRequestPermissionsResult
public void onRequestPermissionsResult(int permRequestCode, java.lang.String[] perms, int[] grantRes)
-
onTrimMemory
public void onTrimMemory(int level)
-
standardizeGeo
public java.lang.String standardizeGeo(java.lang.String s)
-
isIgnoringBatteryOptimizations
public static boolean isIgnoringBatteryOptimizations(Context context)
Checks if battery optimizations are ignored. Returns true if ignored or not in place (api below 23), returns false if in place or powerManager not accessible.- Parameters:
context
-- Returns:
-
isDataSaverActive
public static boolean isDataSaverActive(Context context)
-
checkForBatteryOptimizationForLocation
public boolean checkForBatteryOptimizationForLocation(Context context)
-
updateAppViews
public static void updateAppViews(Context context, CurrentWeatherInfo weatherCard)
-
updateAppViews
public void updateAppViews(CurrentWeatherInfo weatherCard)
-
getWeatherAccount
public static Account getWeatherAccount(Context context)
-
isSyncAccountEnabled
public static boolean isSyncAccountEnabled(Context context)
-
setSyncAccountEnabled
public static void setSyncAccountEnabled(Context context, Account account, boolean enable)
-
registerSyncAdapter
public static void registerSyncAdapter(Context context)
-
getManualSyncRequest
public static SyncRequest getManualSyncRequest(Context context, int updateFlags)
-
showMainappProgress
public void showMainappProgress()
-
hideMainappProgress
public void hideMainappProgress()
-
-