Refactoring ProfileAppearanceFragment
This commit is contained in:
parent
aae885d0dd
commit
e9fb6fc939
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());
|
||||
}
|
||||
|
@ -657,7 +657,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))
|
||||
|
@ -687,6 +687,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