OmniGears: add toast to show when doze settings have been applied
Change-Id: Iddcc5d6be40061dbc1c2cb569e66d1a80ce6998a
diff --git a/res/values/custom_strings.xml b/res/values/custom_strings.xml
index 95cb64d..d3dade1 100644
--- a/res/values/custom_strings.xml
+++ b/res/values/custom_strings.xml
@@ -529,6 +529,7 @@
<string name="string_seconds">seconds</string>
<string name="string_default">Default</string>
<string name="action_filter">Filter</string>
+ <string name="doze_settings_applied">Settings applied</string>
<string name="DESC_INACTIVE_TIMEOUT">This is the time, after becoming inactive, at which we start looking at the motion sensor to determine if the device is being left alone. We don\'t do this immediately after going inactive just because we don\'t want to be continually running the significant motion sensor whenever the screen is off</string>
<string name="DESC_SENSING_TIMEOUT">If we don\'t receive a callback from AnyMotion in this amount of time + locating_to, we will change from STATE_SENSING to STATE_INACTIVE, and any AnyMotion callbacks while not in STATE_SENSING will be ignored</string>
diff --git a/src/org/omnirom/omnigears/system/DozeSettings.java b/src/org/omnirom/omnigears/system/DozeSettings.java
index 608f24a..8440e42 100644
--- a/src/org/omnirom/omnigears/system/DozeSettings.java
+++ b/src/org/omnirom/omnigears/system/DozeSettings.java
@@ -37,6 +37,7 @@
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
+import android.widget.Toast;
import java.util.ArrayList;
import java.util.Arrays;
@@ -265,18 +266,21 @@
}
Log.d(TAG, "save = " + sb.toString());
Settings.Global.putString(getContentResolver(), DEVICE_IDLE_CONSTANTS, sb.toString());
+ showApplyToast();
}
private void restoreDefaults() {
Log.d(TAG, "restoreDefaults");
Settings.Global.putString(getContentResolver(), DEVICE_IDLE_CONSTANTS, null);
getSettings();
+ showApplyToast();
}
private void applyProfile(String settings) {
Log.d(TAG, "apply = " + settings);
Settings.Global.putString(getContentResolver(), DEVICE_IDLE_CONSTANTS, settings);
getSettings();
+ showApplyToast();
}
private void displayProfiles() {
@@ -425,4 +429,8 @@
}
}
}
+
+ private void showApplyToast() {
+ Toast.makeText(mContext, getResources().getString(R.string.doze_settings_applied), Toast.LENGTH_SHORT).show();
+ }
}