mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-24 02:12:15 -05:00
Let users pick LED Notification colors different from their account chip colors
This commit is contained in:
parent
384803076d
commit
ea6bb0000e
@ -477,6 +477,9 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
|
|||||||
<string name="account_settings_color_label">Account color</string>
|
<string name="account_settings_color_label">Account color</string>
|
||||||
<string name="account_settings_color_summary">Choose the color of the account used in folder and account list</string>
|
<string name="account_settings_color_summary">Choose the color of the account used in folder and account list</string>
|
||||||
|
|
||||||
|
<string name="account_settings_led_color_label">Notification LED color</string>
|
||||||
|
<string name="account_settings_led_color_summary">Choose the color your your phone LED should blink for this account</string>
|
||||||
|
|
||||||
<string name="account_settings_mail_display_count_label">Number of messages to display</string>
|
<string name="account_settings_mail_display_count_label">Number of messages to display</string>
|
||||||
|
|
||||||
<string name="account_settings_folder_display_mode_label">Folders to display</string>
|
<string name="account_settings_folder_display_mode_label">Folders to display</string>
|
||||||
|
@ -46,6 +46,12 @@
|
|||||||
android:title="@string/account_settings_color_label"
|
android:title="@string/account_settings_color_label"
|
||||||
android:summary="@string/account_settings_color_summary"
|
android:summary="@string/account_settings_color_summary"
|
||||||
/>
|
/>
|
||||||
|
<Preference
|
||||||
|
android:key="led_color"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:title="@string/account_settings_led_color_label"
|
||||||
|
android:summary="@string/account_settings_led_color_summary"
|
||||||
|
/>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory android:title="@string/account_settings_message_view">
|
<PreferenceCategory android:title="@string/account_settings_message_view">
|
||||||
|
@ -61,6 +61,7 @@ public class Account implements BaseAccount
|
|||||||
private int mAutomaticCheckIntervalMinutes;
|
private int mAutomaticCheckIntervalMinutes;
|
||||||
private int mDisplayCount;
|
private int mDisplayCount;
|
||||||
private int mChipColor;
|
private int mChipColor;
|
||||||
|
private int mLedColor;
|
||||||
private long mLastAutomaticCheckTime;
|
private long mLastAutomaticCheckTime;
|
||||||
private boolean mNotifyNewMail;
|
private boolean mNotifyNewMail;
|
||||||
private boolean mNotifySelfNewMail;
|
private boolean mNotifySelfNewMail;
|
||||||
@ -134,6 +135,7 @@ public class Account implements BaseAccount
|
|||||||
mAutoExpandFolderName = "INBOX";
|
mAutoExpandFolderName = "INBOX";
|
||||||
mMaxPushFolders = 10;
|
mMaxPushFolders = 10;
|
||||||
mChipColor = (new Random()).nextInt(0xffffff) + 0xff000000;
|
mChipColor = (new Random()).nextInt(0xffffff) + 0xff000000;
|
||||||
|
mLedColor = mChipColor;
|
||||||
goToUnreadMessageSearch = false;
|
goToUnreadMessageSearch = false;
|
||||||
|
|
||||||
searchableFolders = Searchable.ALL;
|
searchableFolders = Searchable.ALL;
|
||||||
@ -235,6 +237,8 @@ public class Account implements BaseAccount
|
|||||||
(random.nextInt(0x70) * 0xffff) +
|
(random.nextInt(0x70) * 0xffff) +
|
||||||
0xff000000);
|
0xff000000);
|
||||||
|
|
||||||
|
mLedColor = preferences.getPreferences().getInt(mUuid+".chipColor", mChipColor);
|
||||||
|
|
||||||
mVibrate = preferences.getPreferences().getBoolean(mUuid + ".vibrate", false);
|
mVibrate = preferences.getPreferences().getBoolean(mUuid + ".vibrate", false);
|
||||||
mRing = preferences.getPreferences().getBoolean(mUuid + ".ring", true);
|
mRing = preferences.getPreferences().getBoolean(mUuid + ".ring", true);
|
||||||
|
|
||||||
@ -438,6 +442,7 @@ public class Account implements BaseAccount
|
|||||||
editor.putInt(mUuid + ".maxPushFolders", mMaxPushFolders);
|
editor.putInt(mUuid + ".maxPushFolders", mMaxPushFolders);
|
||||||
editor.putString(mUuid + ".searchableFolders", searchableFolders.name());
|
editor.putString(mUuid + ".searchableFolders", searchableFolders.name());
|
||||||
editor.putInt(mUuid + ".chipColor", mChipColor);
|
editor.putInt(mUuid + ".chipColor", mChipColor);
|
||||||
|
editor.putInt(mUuid + ".ledColor", mLedColor);
|
||||||
editor.putBoolean(mUuid + ".goToUnreadMessageSearch", goToUnreadMessageSearch);
|
editor.putBoolean(mUuid + ".goToUnreadMessageSearch", goToUnreadMessageSearch);
|
||||||
|
|
||||||
for (String type : networkTypes)
|
for (String type : networkTypes)
|
||||||
@ -532,6 +537,17 @@ public class Account implements BaseAccount
|
|||||||
return mChipColor;
|
return mChipColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setLedColor(int color)
|
||||||
|
{
|
||||||
|
mLedColor = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLedColor()
|
||||||
|
{
|
||||||
|
return mLedColor;
|
||||||
|
}
|
||||||
|
|
||||||
public String getUuid()
|
public String getUuid()
|
||||||
{
|
{
|
||||||
return mUuid;
|
return mUuid;
|
||||||
|
@ -4148,7 +4148,7 @@ public class MessagingController implements Runnable
|
|||||||
if (K9.NOTIFICATION_LED_WHILE_SYNCING)
|
if (K9.NOTIFICATION_LED_WHILE_SYNCING)
|
||||||
{
|
{
|
||||||
notif.flags |= Notification.FLAG_SHOW_LIGHTS;
|
notif.flags |= Notification.FLAG_SHOW_LIGHTS;
|
||||||
notif.ledARGB = account.getChipColor();
|
notif.ledARGB = account.getLedColor();
|
||||||
notif.ledOnMS = K9.NOTIFICATION_LED_FAST_ON_TIME;
|
notif.ledOnMS = K9.NOTIFICATION_LED_FAST_ON_TIME;
|
||||||
notif.ledOffMS = K9.NOTIFICATION_LED_FAST_OFF_TIME;
|
notif.ledOffMS = K9.NOTIFICATION_LED_FAST_OFF_TIME;
|
||||||
}
|
}
|
||||||
@ -4254,7 +4254,7 @@ public class MessagingController implements Runnable
|
|||||||
if (K9.NOTIFICATION_LED_WHILE_SYNCING)
|
if (K9.NOTIFICATION_LED_WHILE_SYNCING)
|
||||||
{
|
{
|
||||||
notif.flags |= Notification.FLAG_SHOW_LIGHTS;
|
notif.flags |= Notification.FLAG_SHOW_LIGHTS;
|
||||||
notif.ledARGB = account.getChipColor();
|
notif.ledARGB = account.getLedColor();
|
||||||
notif.ledOnMS = K9.NOTIFICATION_LED_FAST_ON_TIME;
|
notif.ledOnMS = K9.NOTIFICATION_LED_FAST_ON_TIME;
|
||||||
notif.ledOffMS = K9.NOTIFICATION_LED_FAST_OFF_TIME;
|
notif.ledOffMS = K9.NOTIFICATION_LED_FAST_OFF_TIME;
|
||||||
}
|
}
|
||||||
@ -4577,7 +4577,7 @@ public class MessagingController implements Runnable
|
|||||||
}
|
}
|
||||||
|
|
||||||
notif.flags |= Notification.FLAG_SHOW_LIGHTS;
|
notif.flags |= Notification.FLAG_SHOW_LIGHTS;
|
||||||
notif.ledARGB = account.getChipColor();
|
notif.ledARGB = account.getLedColor();
|
||||||
notif.ledOnMS = K9.NOTIFICATION_LED_ON_TIME;
|
notif.ledOnMS = K9.NOTIFICATION_LED_ON_TIME;
|
||||||
notif.ledOffMS = K9.NOTIFICATION_LED_OFF_TIME;
|
notif.ledOffMS = K9.NOTIFICATION_LED_OFF_TIME;
|
||||||
notif.audioStreamType = AudioManager.STREAM_NOTIFICATION;
|
notif.audioStreamType = AudioManager.STREAM_NOTIFICATION;
|
||||||
|
@ -49,6 +49,7 @@ public class AccountSettings extends K9PreferenceActivity
|
|||||||
private static final String PREFERENCE_AUTO_EXPAND_FOLDER = "account_setup_auto_expand_folder";
|
private static final String PREFERENCE_AUTO_EXPAND_FOLDER = "account_setup_auto_expand_folder";
|
||||||
private static final String PREFERENCE_SEARCHABLE_FOLDERS = "searchable_folders";
|
private static final String PREFERENCE_SEARCHABLE_FOLDERS = "searchable_folders";
|
||||||
private static final String PREFERENCE_CHIP_COLOR = "chip_color";
|
private static final String PREFERENCE_CHIP_COLOR = "chip_color";
|
||||||
|
private static final String PREFERENCE_LED_COLOR = "led_color";
|
||||||
private static final String PREFERENCE_NOTIFICATION_OPENS_UNREAD = "notification_opens_unread";
|
private static final String PREFERENCE_NOTIFICATION_OPENS_UNREAD = "notification_opens_unread";
|
||||||
|
|
||||||
|
|
||||||
@ -74,6 +75,7 @@ public class AccountSettings extends K9PreferenceActivity
|
|||||||
private ListPreference mSearchableFolders;
|
private ListPreference mSearchableFolders;
|
||||||
private Preference mAutoExpandFolder;
|
private Preference mAutoExpandFolder;
|
||||||
private Preference mChipColor;
|
private Preference mChipColor;
|
||||||
|
private Preference mLedColor;
|
||||||
private boolean mIncomingChanged = false;
|
private boolean mIncomingChanged = false;
|
||||||
private CheckBoxPreference mNotificationOpensUnread;
|
private CheckBoxPreference mNotificationOpensUnread;
|
||||||
|
|
||||||
@ -338,6 +340,19 @@ public class AccountSettings extends K9PreferenceActivity
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
mLedColor = (Preference)findPreference(PREFERENCE_LED_COLOR);
|
||||||
|
|
||||||
|
mLedColor.setOnPreferenceClickListener(
|
||||||
|
new Preference.OnPreferenceClickListener()
|
||||||
|
{
|
||||||
|
public boolean onPreferenceClick(Preference preference)
|
||||||
|
{
|
||||||
|
onChooseLedColor();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
findPreference(PREFERENCE_COMPOSITION).setOnPreferenceClickListener(
|
findPreference(PREFERENCE_COMPOSITION).setOnPreferenceClickListener(
|
||||||
@ -510,6 +525,18 @@ public class AccountSettings extends K9PreferenceActivity
|
|||||||
mAccount.getChipColor()).show();
|
mAccount.getChipColor()).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onChooseLedColor()
|
||||||
|
{
|
||||||
|
new ColorPickerDialog(this, new ColorPickerDialog.OnColorChangedListener()
|
||||||
|
{
|
||||||
|
public void colorChanged(int color)
|
||||||
|
{
|
||||||
|
mAccount.setLedColor(color);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mAccount.getLedColor()).show();
|
||||||
|
}
|
||||||
|
|
||||||
public void onChooseAutoExpandFolder()
|
public void onChooseAutoExpandFolder()
|
||||||
{
|
{
|
||||||
Intent selectIntent = new Intent(this, ChooseFolder.class);
|
Intent selectIntent = new Intent(this, ChooseFolder.class);
|
||||||
|
Loading…
Reference in New Issue
Block a user