Skip to content

fix reset color bug #179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -677,15 +677,21 @@ private void showPopup(String activityName, AppTextView view) {
popupMenu.show();
}

//reset the app color to default color;
//reset the app color to default color; modified for issue 154
private void resetAppColor(String activityName) {
DbUtils.removeColor(activityName);
boolean sortNeeded = (DbUtils.getSortsTypes() == SORT_BY_COLOR);
addAppAfterReset(activityName, sortNeeded);
//boolean sortNeeded = (DbUtils.getSortsTypes() == SORT_BY_COLOR);
addAppAfterReset(activityName, false);
}

// add a new app: generally called after reset
private void addAppAfterReset(String activityName, boolean sortNeeded) {
/**
* modified for issue 154
* function: add a new app: generally called after reset
* @param activityName same as defined in Apps constructor
* @param resetSize whether to reset the text size (new added)
* (@param sortNeeded is deleted)
*/
private void addAppAfterReset(String activityName, boolean resetSize) {
for (ListIterator<Apps> iterator = mAppsList.listIterator(); iterator.hasNext(); ) {
Apps app = iterator.next();
if (app.getActivityName().equalsIgnoreCase(activityName)) {
Expand All @@ -703,12 +709,18 @@ private void addAppAfterReset(String activityName, boolean sortNeeded) {
boolean hide = app.isHidden();
boolean freezeSize = app.isSizeFrozen();
int appUpdateTime = app.getUpdateTime();
Apps newApp = new Apps(app.isShortcut(), activityName, appName, getCustomView(), color, DEFAULT_TEXT_SIZE_NORMAL_APPS, hide, freezeSize, openingCounts, appUpdateTime);
int size;
if(resetSize) {
size = DEFAULT_TEXT_SIZE_NORMAL_APPS;
}else {
size = DbUtils.getAppSize(activityName);
}
Apps newApp = new Apps(app.isShortcut(), activityName, appName, getCustomView(), color, size, hide, freezeSize, openingCounts, appUpdateTime);

//mAppsList.add(newApp);
iterator.add(newApp);
if (sortNeeded)
sortApps(DbUtils.getSortsTypes());
//if (sortNeeded)
sortApps(DbUtils.getSortsTypes());
break;
}
}
Expand Down