Make "Want to start battery saver?" dialog better.

- Don't line-break in "Battery" (only in English)
- Add "Learn more" link.

Bug: 78261259

Test: Manual test with:
- adb shell dumpsys battery unplug
- adb shell settings delete secure low_power_warning_acknowledged
- Enable battery saver
- Make sure the link is clickable if a link is set.
- Make sure there's no "learn more" link if the link is not set in strings.xml

Cherry picked I83364f628dd596a4d50bf2aca4db7cbfe7cf4909 and manually resolved conflict.

Change-Id: Icf6d4e62d8cb3556561f992afc45aaea868bce0e
This commit is contained in:
Makoto Onuki
2018-04-20 14:04:50 -07:00
parent 36de63d453
commit e8bbf95cdf
6 changed files with 149 additions and 7 deletions

View File

@@ -16,8 +16,6 @@
package android.app;
import com.android.internal.app.AlertController;
import android.annotation.ArrayRes;
import android.annotation.AttrRes;
import android.annotation.DrawableRes;
@@ -30,17 +28,19 @@ import android.database.Cursor;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Message;
import android.text.Layout;
import android.text.method.MovementMethod;
import android.util.TypedValue;
import android.view.ContextThemeWrapper;
import android.view.KeyEvent;
import android.view.View;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListAdapter;
import android.widget.ListView;
import com.android.internal.R;
import com.android.internal.app.AlertController;
/**
* A subclass of Dialog that can display one, two or three buttons. If you only want to
@@ -54,7 +54,7 @@ import com.android.internal.R;
* </pre>
*
* <p>The AlertDialog class takes care of automatically setting
* {@link WindowManager.LayoutParams#FLAG_ALT_FOCUSABLE_IM
* {@link android.view.WindowManager.LayoutParams#FLAG_ALT_FOCUSABLE_IM
* WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM} for you based on whether
* any views in the dialog return true from {@link View#onCheckIsTextEditor()
* View.onCheckIsTextEditor()}. Generally you want this set for a Dialog
@@ -266,6 +266,17 @@ public class AlertDialog extends Dialog implements DialogInterface {
mAlert.setMessage(message);
}
/** @hide */
public void setMessageMovementMethod(MovementMethod movementMethod) {
mAlert.setMessageMovementMethod(movementMethod);
}
/** @hide */
public void setMessageHyphenationFrequency(
@Layout.HyphenationFrequency int hyphenationFrequency) {
mAlert.setMessageHyphenationFrequency(hyphenationFrequency);
}
/**
* Set the view to display in that dialog.
*/