diff --git a/Android.mk b/Android.mk
index b6a4bd90d..027251f06 100644
--- a/Android.mk
+++ b/Android.mk
@@ -65,8 +65,6 @@ ifeq (eng,$(TARGET_BUILD_VARIANT))
LOCAL_PROGUARD_FLAG_FILES += proguard-test.flags
endif
-LOCAL_SDK_VERSION := current
-
include $(BUILD_PACKAGE)
# only include rules to build other stuff for the original package, not the derived package.
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
index 90ee33fab..19c7df868 100644
--- a/res/values/cm_strings.xml
+++ b/res/values/cm_strings.xml
@@ -28,4 +28,7 @@
Folder notification settings
+
+
+ Lights
diff --git a/res/xml/account_settings_preferences.xml b/res/xml/account_settings_preferences.xml
index 3cdd47486..828c1966d 100755
--- a/res/xml/account_settings_preferences.xml
+++ b/res/xml/account_settings_preferences.xml
@@ -106,6 +106,12 @@
android:defaultValue="false"
android:title="@string/label_notification_vibrate_title" />
+
+
+
+
diff --git a/src/com/android/email/activity/setup/AccountSettingsFragment.java b/src/com/android/email/activity/setup/AccountSettingsFragment.java
index b5c3b5917..97d4f9ea8 100644
--- a/src/com/android/email/activity/setup/AccountSettingsFragment.java
+++ b/src/com/android/email/activity/setup/AccountSettingsFragment.java
@@ -71,6 +71,8 @@ import com.android.emailcommon.provider.Mailbox;
import com.android.emailcommon.provider.Policy;
import com.android.mail.preferences.AccountPreferences;
import com.android.mail.preferences.FolderPreferences;
+import com.android.mail.preferences.FolderPreferences.NotificationLight;
+import com.android.mail.preferences.notifications.FolderNotificationLightPreference;
import com.android.mail.providers.Folder;
import com.android.mail.providers.UIProvider;
import com.android.mail.ui.MailAsyncTaskLoader;
@@ -144,6 +146,7 @@ public class AccountSettingsFragment extends MailAccountPrefsFragment
private Preference mSyncSettings;
private CheckBoxPreference mInboxVibrate;
private Preference mInboxRingtone;
+ private FolderNotificationLightPreference mInboxLights;
private Preference mPerFolderNotification;
private Context mContext;
@@ -429,6 +432,12 @@ public class AccountSettingsFragment extends MailAccountPrefsFragment
mInboxVibrate.setChecked(vibrateSetting);
mInboxFolderPreferences.setNotificationVibrateEnabled(vibrateSetting);
return true;
+ } else if (FolderPreferences.PreferenceKeys.NOTIFICATION_LIGHTS.equals(key)) {
+ final String LightsSettings = (String) newValue;
+ NotificationLight notificationLight = NotificationLight.fromStringPref(LightsSettings);
+ updateNotificationLight(notificationLight);
+ mInboxFolderPreferences.setNotificationLights(notificationLight);
+ return true;
} else if (FolderPreferences.PreferenceKeys.NOTIFICATION_RINGTONE.equals(key)) {
return true;
} else {
@@ -878,6 +887,11 @@ public class AccountSettingsFragment extends MailAccountPrefsFragment
if (mInboxVibrate != null) {
notificationsCategory.removePreference(mInboxVibrate);
}
+ mInboxLights = (FolderNotificationLightPreference) findPreference(
+ FolderPreferences.PreferenceKeys.NOTIFICATION_LIGHTS);
+ if (mInboxLights != null) {
+ notificationsCategory.removePreference(mInboxLights);
+ }
notificationsCategory.setEnabled(true);
@@ -923,6 +937,19 @@ public class AccountSettingsFragment extends MailAccountPrefsFragment
mInboxVibrate = null;
}
}
+
+ boolean isArgbNotifColorSupported = getResources().getBoolean(
+ com.android.internal.R.bool.config_multiColorNotificationLed);
+ mInboxLights = (FolderNotificationLightPreference) findPreference(
+ FolderPreferences.PreferenceKeys.NOTIFICATION_LIGHTS);
+ if (mInboxLights != null) {
+ if (isArgbNotifColorSupported) {
+ updateNotificationLight(mInboxFolderPreferences.getNotificationLight());
+ mInboxLights.setOnPreferenceChangeListener(this);
+ } else {
+ notificationsCategory.removePreference(mInboxLights);
+ }
+ }
}
} else {
notificationsCategory.setEnabled(false);
@@ -1140,4 +1167,19 @@ public class AccountSettingsFragment extends MailAccountPrefsFragment
};
task.execute();
}
+
+ private void updateNotificationLight(NotificationLight notificationLight) {
+ if (notificationLight.mOn) {
+ mInboxLights.setColor(notificationLight.mColor);
+ mInboxLights.setOnOffValue(notificationLight.mTimeOn, notificationLight.mTimeOff);
+ } else {
+ int color = mUiAccount != null && mUiAccount.color != 0
+ ? mUiAccount.color
+ : FolderNotificationLightPreference.DEFAULT_COLOR;
+ mInboxLights.setColor(color);
+ mInboxLights.setOnOffValue(FolderNotificationLightPreference.DEFAULT_TIME,
+ FolderNotificationLightPreference.DEFAULT_TIME);
+ }
+ mInboxLights.setOn(notificationLight.mOn);
+ }
}
diff --git a/src/com/android/email/activity/setup/MailboxSettings.java b/src/com/android/email/activity/setup/MailboxSettings.java
index e3db75930..108dc1b3d 100644
--- a/src/com/android/email/activity/setup/MailboxSettings.java
+++ b/src/com/android/email/activity/setup/MailboxSettings.java
@@ -52,6 +52,7 @@ import android.widget.ImageView;
import android.widget.TextView;
import com.android.email.R;
+import com.android.email.provider.EmailProvider;
import com.android.emailcommon.Logging;
import com.android.emailcommon.provider.Account;
import com.android.emailcommon.provider.EmailContent.AccountColumns;
@@ -61,6 +62,8 @@ import com.android.emailcommon.provider.Policy;
import com.android.emailcommon.utility.EmailAsyncTask;
import com.android.emailcommon.utility.Utility;
import com.android.mail.preferences.FolderPreferences;
+import com.android.mail.preferences.FolderPreferences.NotificationLight;
+import com.android.mail.preferences.notifications.FolderNotificationLightPreference;
import com.android.mail.providers.Folder;
import com.android.mail.providers.UIProvider;
import com.android.mail.ui.MailAsyncTaskLoader;
@@ -400,25 +403,30 @@ public class MailboxSettings extends PreferenceActivity {
private static final String BUNDLE_NOTIF_ENABLED = "MailboxNotifySettings.enabled";
private static final String BUNDLE_NOTIF_RINGTONE = "MailboxSettings.ringtone";
private static final String BUNDLE_NOTIF_VIBRATE = "MailboxSettings.vibrate";
+ private static final String BUNDLE_NOTIF_LIGHTS = "MailboxSettings.lights";
private static final String PREF_NOTIF_ENABLED_KEY = "notifications-enabled";
private static final String PREF_NOTIF_RINGTONE_KEY = "notification-ringtone";
private static final String PREF_NOTIF_VIBRATE_KEY = "notification-vibrate";
+ private static final String PREF_NOTIF_LIGHTS_KEY = "notification-lights";
private static final int RINGTONE_REQUEST_CODE =
MailboxNotificationsFragment.class.hashCode();
private FolderPreferences mPreferences;
+ private com.android.mail.providers.Account mUiAccount;
private Account mAccount;
private Mailbox mMailbox;
private CheckBoxPreference mPrefNotifEnabled;
private Preference mPrefNotifRingtone;
private CheckBoxPreference mPrefNotifVibrate;
+ private FolderNotificationLightPreference mPrefNotifLights;
private boolean mOldMailboxEnabled;
private String mOldMailboxRingtone;
private boolean mOldMailboxVibrate;
+ private String mOldMailboxLights;
private Uri mRingtoneUri;
private Ringtone mRingtone;
@@ -463,6 +471,13 @@ public class MailboxSettings extends PreferenceActivity {
getPreferenceScreen().removePreference(mPrefNotifVibrate);
mPrefNotifVibrate = null;
}
+ mPrefNotifLights = (FolderNotificationLightPreference) findPreference(
+ PREF_NOTIF_LIGHTS_KEY);
+ boolean isArgbNotifColorSupported = getResources().getBoolean(
+ com.android.internal.R.bool.config_multiColorNotificationLed);
+ if (mPrefNotifLights != null && !isArgbNotifColorSupported) {
+ getPreferenceScreen().removePreference(mPrefNotifLights);
+ }
if (savedInstanceState != null) {
mAccount = savedInstanceState.getParcelable(BUNDLE_ACCOUNT);
@@ -476,6 +491,10 @@ public class MailboxSettings extends PreferenceActivity {
mPrefNotifVibrate.setChecked(
savedInstanceState.getBoolean(BUNDLE_NOTIF_VIBRATE));
}
+ NotificationLight notifLight = NotificationLight.fromStringPref(
+ savedInstanceState.getString(BUNDLE_NOTIF_LIGHTS, ""));
+ updateNotificationLight(notifLight);
+
onDataLoaded();
} else {
// Make them disabled until we load data
@@ -521,6 +540,9 @@ public class MailboxSettings extends PreferenceActivity {
if (mPrefNotifVibrate != null) {
mPrefNotifVibrate.setEnabled(enabled);
}
+ if (mPrefNotifLights != null) {
+ mPrefNotifLights.setEnabled(enabled);
+ }
}
@Override
@@ -536,6 +558,7 @@ public class MailboxSettings extends PreferenceActivity {
outState.putString(BUNDLE_NOTIF_RINGTONE, ringtoneUri);
outState.putBoolean(PREF_NOTIF_VIBRATE_KEY, mPrefNotifVibrate != null
? mPrefNotifVibrate.isChecked() : false);
+ outState.putString(BUNDLE_NOTIF_LIGHTS, getNotificationLightPref());
}
/**
@@ -553,6 +576,7 @@ public class MailboxSettings extends PreferenceActivity {
mOldMailboxEnabled = mPreferences.areNotificationsEnabled();
mOldMailboxRingtone = mPreferences.getNotificationRingtoneUri();
mOldMailboxVibrate = mPreferences.isNotificationVibrateEnabled();
+ mOldMailboxLights = mPreferences.getNotificationLight().toStringPref();
}
/**
@@ -594,6 +618,34 @@ public class MailboxSettings extends PreferenceActivity {
}
}
+ private void updateNotificationLight(NotificationLight notificationLight) {
+ if (mPrefNotifLights == null) {
+ return;
+ }
+
+ if (notificationLight.mOn) {
+ mPrefNotifLights.setColor(notificationLight.mColor);
+ mPrefNotifLights.setOnOffValue(notificationLight.mTimeOn,
+ notificationLight.mTimeOff);
+ } else {
+ int color = mUiAccount != null && mUiAccount.color != 0
+ ? mUiAccount.color
+ : FolderNotificationLightPreference.DEFAULT_COLOR;
+ mPrefNotifLights.setColor(color);
+ mPrefNotifLights.setOnOffValue(FolderNotificationLightPreference.DEFAULT_TIME,
+ FolderNotificationLightPreference.DEFAULT_TIME);
+ }
+ mPrefNotifLights.setOn(notificationLight.mOn);
+ }
+
+ private String getNotificationLightPref() {
+ return mPrefNotifLights == null || !mPrefNotifLights.getOn()
+ ? "" : TextUtils.join("|", new Integer[]{
+ mPrefNotifLights.getColor(),
+ mPrefNotifLights.getOnValue(),
+ mPrefNotifLights.getOffValue()});
+ }
+
/**
* Save changes to the preferences folder backend.
*
@@ -611,6 +663,7 @@ public class MailboxSettings extends PreferenceActivity {
}
boolean mailboxVibrate = mPrefNotifVibrate != null
? mPrefNotifVibrate.isChecked() : false;
+ String mailboxLights = getNotificationLightPref();
if (mailboxEnabled != mOldMailboxEnabled) {
mPreferences.setNotificationsEnabled(mailboxEnabled);
mOldMailboxEnabled = mailboxEnabled;
@@ -623,12 +676,17 @@ public class MailboxSettings extends PreferenceActivity {
mPreferences.setNotificationVibrateEnabled(mailboxVibrate);
mOldMailboxVibrate = mailboxVibrate;
}
+ if (!mailboxLights.equals(mOldMailboxLights)) {
+ mPreferences.setNotificationLights(NotificationLight.fromStringPref(mailboxLights));
+ mOldMailboxLights = mailboxLights;
+ }
}
private static class MailboxLoader extends MailAsyncTaskLoader