mirror of
https://github.com/moparisthebest/k-9
synced 2025-01-14 07:08:00 -05:00
Use the framework to manage the color picker dialog in account settings
This way the dialog will survive orientation changes.
This commit is contained in:
parent
2f7f7ad908
commit
9b77aad8b7
@ -10,6 +10,7 @@
|
|||||||
package com.fsck.k9.activity;
|
package com.fsck.k9.activity;
|
||||||
import com.fsck.k9.R;
|
import com.fsck.k9.R;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
import android.app.Dialog;
|
||||||
import android.content.*;
|
import android.content.*;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@ -177,4 +178,8 @@ public class ColorPickerDialog {
|
|||||||
public void show() {
|
public void show() {
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Dialog create() {
|
||||||
|
return dialog;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
package com.fsck.k9.activity.setup;
|
package com.fsck.k9.activity.setup;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
@ -39,6 +40,9 @@ import com.fsck.k9.mail.store.LocalStore.LocalFolder;
|
|||||||
public class AccountSettings extends K9PreferenceActivity {
|
public class AccountSettings extends K9PreferenceActivity {
|
||||||
private static final String EXTRA_ACCOUNT = "account";
|
private static final String EXTRA_ACCOUNT = "account";
|
||||||
|
|
||||||
|
private static final int DIALOG_COLOR_PICKER_ACCOUNT = 1;
|
||||||
|
private static final int DIALOG_COLOR_PICKER_LED = 2;
|
||||||
|
|
||||||
private static final int SELECT_AUTO_EXPAND_FOLDER = 1;
|
private static final int SELECT_AUTO_EXPAND_FOLDER = 1;
|
||||||
|
|
||||||
private static final int ACTIVITY_MANAGE_IDENTITIES = 2;
|
private static final int ACTIVITY_MANAGE_IDENTITIES = 2;
|
||||||
@ -809,21 +813,44 @@ public class AccountSettings extends K9PreferenceActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onChooseChipColor() {
|
public void onChooseChipColor() {
|
||||||
new ColorPickerDialog(this, new ColorPickerDialog.OnColorChangedListener() {
|
showDialog(DIALOG_COLOR_PICKER_ACCOUNT);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onChooseLedColor() {
|
||||||
|
showDialog(DIALOG_COLOR_PICKER_LED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(int id) {
|
||||||
|
Dialog dialog = null;
|
||||||
|
|
||||||
|
switch (id) {
|
||||||
|
case DIALOG_COLOR_PICKER_ACCOUNT: {
|
||||||
|
dialog = new ColorPickerDialog(this,
|
||||||
|
new ColorPickerDialog.OnColorChangedListener() {
|
||||||
public void colorChanged(int color) {
|
public void colorChanged(int color) {
|
||||||
mAccount.setChipColor(color);
|
mAccount.setChipColor(color);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mAccount.getChipColor()).show();
|
mAccount.getChipColor()).create();
|
||||||
}
|
|
||||||
|
|
||||||
public void onChooseLedColor() {
|
break;
|
||||||
new ColorPickerDialog(this, new ColorPickerDialog.OnColorChangedListener() {
|
}
|
||||||
|
case DIALOG_COLOR_PICKER_LED: {
|
||||||
|
dialog = new ColorPickerDialog(this,
|
||||||
|
new ColorPickerDialog.OnColorChangedListener() {
|
||||||
public void colorChanged(int color) {
|
public void colorChanged(int color) {
|
||||||
mAccount.getNotificationSetting().setLedColor(color);
|
mAccount.getNotificationSetting().setLedColor(color);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mAccount.getNotificationSetting().getLedColor()).show();
|
mAccount.getNotificationSetting().getLedColor()).create();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onChooseAutoExpandFolder() {
|
public void onChooseAutoExpandFolder() {
|
||||||
|
Loading…
Reference in New Issue
Block a user