Update custom content hint after custom content is invalidated (Bug 11067230)
Change-Id: I5f98e2a0e4bc3439ff36688555990798c59efa58
This commit is contained in:
@@ -4182,6 +4182,57 @@ public class Launcher extends Activity
|
||||
return false;
|
||||
}
|
||||
|
||||
public void updateCustomContentHintVisibility() {
|
||||
Cling cling = (Cling) findViewById(R.id.first_run_cling);
|
||||
String ccHintStr = getFirstRunCustomContentHint();
|
||||
|
||||
if (mWorkspace.hasCustomContent()) {
|
||||
// Show the custom content hint if ccHintStr is not empty
|
||||
if (cling != null) {
|
||||
setCustomContentHintVisibility(cling, ccHintStr, true, true);
|
||||
}
|
||||
} else {
|
||||
// Hide the custom content hint
|
||||
if (cling != null) {
|
||||
setCustomContentHintVisibility(cling, ccHintStr, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setCustomContentHintVisibility(Cling cling, String ccHintStr, boolean visible,
|
||||
boolean animate) {
|
||||
final TextView ccHint = (TextView) cling.findViewById(R.id.custom_content_hint);
|
||||
if (ccHint != null) {
|
||||
if (visible && !ccHintStr.isEmpty()) {
|
||||
ccHint.setText(ccHintStr);
|
||||
ccHint.setVisibility(View.VISIBLE);
|
||||
if (animate) {
|
||||
ccHint.setAlpha(0f);
|
||||
ccHint.animate().alpha(1f)
|
||||
.setDuration(SHOW_CLING_DURATION)
|
||||
.start();
|
||||
} else {
|
||||
ccHint.setAlpha(1f);
|
||||
}
|
||||
} else {
|
||||
if (animate) {
|
||||
ccHint.animate().alpha(0f)
|
||||
.setDuration(SHOW_CLING_DURATION)
|
||||
.setListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
ccHint.setVisibility(View.GONE);
|
||||
}
|
||||
})
|
||||
.start();
|
||||
} else {
|
||||
ccHint.setAlpha(0f);
|
||||
ccHint.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void showFirstRunCling() {
|
||||
if (isClingsEnabled() &&
|
||||
!mSharedPrefs.getBoolean(Cling.FIRST_RUN_CLING_DISMISSED_KEY, false) &&
|
||||
@@ -4211,11 +4262,7 @@ public class Launcher extends Activity
|
||||
sbHint.setText(sbHintStr);
|
||||
sbHint.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (!ccHintStr.isEmpty()) {
|
||||
TextView ccHint = (TextView) cling.findViewById(R.id.custom_content_hint);
|
||||
ccHint.setText(ccHintStr);
|
||||
ccHint.setVisibility(View.VISIBLE);
|
||||
}
|
||||
setCustomContentHintVisibility(cling, ccHintStr, true, false);
|
||||
}
|
||||
initCling(R.id.first_run_cling, 0, false, true);
|
||||
} else {
|
||||
|
||||
@@ -539,6 +539,9 @@ public class Workspace extends SmoothPagedView
|
||||
// Ensure that the current page and default page are maintained.
|
||||
mDefaultPage = mOriginalDefaultPage + 1;
|
||||
setCurrentPage(getCurrentPage() + 1);
|
||||
|
||||
// Update the custom content hint
|
||||
mLauncher.updateCustomContentHintVisibility();
|
||||
}
|
||||
|
||||
public void removeCustomContentPage() {
|
||||
@@ -555,6 +558,9 @@ public class Workspace extends SmoothPagedView
|
||||
// Ensure that the current page and default page are maintained.
|
||||
mDefaultPage = mOriginalDefaultPage - 1;
|
||||
setCurrentPage(getCurrentPage() - 1);
|
||||
|
||||
// Update the custom content hint
|
||||
mLauncher.updateCustomContentHintVisibility();
|
||||
}
|
||||
|
||||
public void addToCustomContentPage(View customContent, CustomContentCallbacks callbacks,
|
||||
|
||||
Reference in New Issue
Block a user