| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser.widget; | 5 package org.chromium.chrome.browser.widget; |
| 6 | 6 |
| 7 import android.app.Dialog; | 7 import android.app.Dialog; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.content.DialogInterface; | 9 import android.content.DialogInterface; |
| 10 import android.os.Bundle; | 10 import android.os.Bundle; |
| 11 import android.view.LayoutInflater; | 11 import android.view.LayoutInflater; |
| 12 import android.view.View; | 12 import android.view.View; |
| 13 import android.view.ViewGroup.LayoutParams; | 13 import android.view.ViewGroup.LayoutParams; |
| 14 import android.widget.FrameLayout; | 14 import android.widget.FrameLayout; |
| 15 | 15 |
| 16 import org.chromium.base.ApiCompatibilityUtils; | 16 import org.chromium.base.ApiCompatibilityUtils; |
| 17 import org.chromium.chrome.R; | 17 import org.chromium.chrome.R; |
| 18 | 18 |
| 19 /** | 19 /** |
| 20 * Generic builder for promo dialogs. | 20 * Generic builder for promo dialogs. |
| 21 */ | 21 */ |
| 22 public abstract class PromoDialog | 22 public abstract class PromoDialog |
| 23 extends Dialog implements View.OnClickListener, DialogInterface.OnDismis
sListener { | 23 extends Dialog implements View.OnClickListener, DialogInterface.OnDismis
sListener { |
| 24 /** Parameters that can be used to create a new PromoDialog. */ | 24 /** Parameters that can be used to create a new PromoDialog. */ |
| 25 public static class DialogParams { | 25 public static class DialogParams { |
| 26 /** Optional: Resource ID of the Drawable to use for the promo illustrat
ion. */ | 26 /** |
| 27 * Optional: Resource ID of the Drawable to use for the promo illustrati
on. |
| 28 * This parameter and {@link #vectorDrawableResource} are mutually exclu
sive. |
| 29 */ |
| 27 public int drawableResource; | 30 public int drawableResource; |
| 28 | 31 |
| 32 /** |
| 33 * Optional: Resource ID of the VectorDrawable to use for the promo illu
stration. |
| 34 * This parameter and {@link #drawableResource} are mutually exclusive. |
| 35 */ |
| 36 public int vectorDrawableResource; |
| 37 |
| 29 /** Resource ID of the String to show as the promo title. */ | 38 /** Resource ID of the String to show as the promo title. */ |
| 30 public int headerStringResource; | 39 public int headerStringResource; |
| 31 | 40 |
| 32 /** Optional: Resource ID of the String to show as descriptive text. */ | 41 /** Optional: Resource ID of the String to show as descriptive text. */ |
| 33 public int subheaderStringResource; | 42 public int subheaderStringResource; |
| 34 | 43 |
| 35 /** Optional: Resource ID of the String to show as footer text. */ | 44 /** Optional: Resource ID of the String to show as footer text. */ |
| 36 public int footerStringResource; | 45 public int footerStringResource; |
| 37 | 46 |
| 38 /** Optional: Resource ID of the String to show on the primary/ok button
. */ | 47 /** Optional: Resource ID of the String to show on the primary/ok button
. */ |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 if (view != null) view.setOnClickListener(this); | 90 if (view != null) view.setOnClickListener(this); |
| 82 } | 91 } |
| 83 } | 92 } |
| 84 | 93 |
| 85 @Override | 94 @Override |
| 86 public void onClick(View view) {} | 95 public void onClick(View view) {} |
| 87 | 96 |
| 88 /** Returns a set of {@link DialogParams} that define what is shown in the p
romo dialog. */ | 97 /** Returns a set of {@link DialogParams} that define what is shown in the p
romo dialog. */ |
| 89 protected abstract DialogParams getDialogParams(); | 98 protected abstract DialogParams getDialogParams(); |
| 90 } | 99 } |
| OLD | NEW |