Methods Summary |
---|
private android.content.SharedPreferences | getSharedPrefs()
return mContext.getSharedPreferences(mContext.getPackageName(), 0);
|
public boolean | isRecentlyUsed()
long lastUsed = getSharedPrefs().getLong(mPrefKey, 0);
return (System.currentTimeMillis() - lastUsed) < mTimeToShowTile;
|
public void | reset()
getSharedPrefs().edit().remove(mPrefKey).commit();
|
public void | setListening(boolean listen)
if (listen && !mRegistered) {
mContext.registerReceiver(mReceiver, new IntentFilter(mResetAction));
mRegistered = true;
} else if (!listen && mRegistered) {
mContext.unregisterReceiver(mReceiver);
mRegistered = false;
}
|
public void | showResetConfirmation(java.lang.String title, java.lang.Runnable onConfirmed)
final SystemUIDialog d = new SystemUIDialog(mContext);
d.setTitle(title);
d.setMessage(mContext.getString(R.string.quick_settings_reset_confirmation_message));
d.setNegativeButton(android.R.string.cancel, null);
d.setPositiveButton(R.string.quick_settings_reset_confirmation_button,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
reset();
if (onConfirmed != null) {
onConfirmed.run();
}
}
});
d.setCanceledOnTouchOutside(true);
d.show();
|
public void | trackUsage()
getSharedPrefs().edit().putLong(mPrefKey, System.currentTimeMillis()).commit();
|