Refactoring ProfileAppearanceFragment
(cherry picked from commit e9fb6fc939
)
This commit is contained in:
parent
0fcf07aba2
commit
4eec8bbbca
1 changed files with 6 additions and 2 deletions
|
@ -112,7 +112,7 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
|
|||
if (baseModeForNewProfile != null) {
|
||||
setupAppProfileObjectFromAppMode(baseModeForNewProfile);
|
||||
profile.parent = baseModeForNewProfile;
|
||||
profile.stringKey = baseModeForNewProfile.getStringKey() + "_" + System.currentTimeMillis();
|
||||
profile.stringKey = getUniqueStringKey(baseModeForNewProfile);
|
||||
} else {
|
||||
setupAppProfileObjectFromAppMode(getSelectedAppMode());
|
||||
}
|
||||
|
@ -661,7 +661,7 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
|
|||
return false;
|
||||
}
|
||||
if (isNewProfile) {
|
||||
changedProfile.stringKey = changedProfile.parent.getStringKey() + "_" + System.currentTimeMillis();
|
||||
changedProfile.stringKey = getUniqueStringKey(changedProfile.parent);
|
||||
ApplicationMode.ApplicationModeBuilder builder = ApplicationMode
|
||||
.createCustomMode(changedProfile.parent, changedProfile.stringKey, app)
|
||||
.setIconResName(ProfileIcons.getResStringByResId(changedProfile.iconRes))
|
||||
|
@ -691,6 +691,10 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
|
|||
return true;
|
||||
}
|
||||
|
||||
private String getUniqueStringKey(ApplicationMode mode) {
|
||||
return mode.getStringKey() + "_" + System.currentTimeMillis();
|
||||
}
|
||||
|
||||
private boolean hasNameDuplicate() {
|
||||
for (ApplicationMode m : ApplicationMode.allPossibleValues()) {
|
||||
if (m.toHumanString().trim().equals(changedProfile.name.trim()) &&
|
||||
|
|
Loading…
Reference in a new issue