|
|
|
@ -10,8 +10,9 @@ import acr.browser.lightning.utils.ThemeUtils;
@@ -10,8 +10,9 @@ import acr.browser.lightning.utils.ThemeUtils;
|
|
|
|
|
import acr.browser.lightning.utils.Utils; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @author Stefano Pacifici base on Anthony C. Restaino's code |
|
|
|
|
* @date 2015/09/21 |
|
|
|
|
* {@link LightningViewTitle} acts as a container class |
|
|
|
|
* for the favicon and page title, the information used |
|
|
|
|
* by the tab adapters to show the tabs to the user. |
|
|
|
|
*/ |
|
|
|
|
class LightningViewTitle { |
|
|
|
|
|
|
|
|
@ -30,6 +31,12 @@ class LightningViewTitle {
@@ -30,6 +31,12 @@ class LightningViewTitle {
|
|
|
|
|
mTitle = context.getString(R.string.action_new_tab); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Set the current favicon to a new Bitmap. |
|
|
|
|
* May be null, if null, the default will be used. |
|
|
|
|
* |
|
|
|
|
* @param favicon the potentially null favicon to set. |
|
|
|
|
*/ |
|
|
|
|
public void setFavicon(@Nullable Bitmap favicon) { |
|
|
|
|
if (favicon == null) { |
|
|
|
|
mFavicon = DEFAULT_ICON; |
|
|
|
@ -38,6 +45,12 @@ class LightningViewTitle {
@@ -38,6 +45,12 @@ class LightningViewTitle {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Set the current title to a new title. |
|
|
|
|
* Must not be null. |
|
|
|
|
* |
|
|
|
|
* @param title the non-null title to set. |
|
|
|
|
*/ |
|
|
|
|
public void setTitle(@Nullable String title) { |
|
|
|
|
if (title == null) { |
|
|
|
|
mTitle = ""; |
|
|
|
@ -46,22 +59,26 @@ class LightningViewTitle {
@@ -46,22 +59,26 @@ class LightningViewTitle {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setTitleAndFavicon(@Nullable String title, @Nullable Bitmap favicon) { |
|
|
|
|
setTitle(title); |
|
|
|
|
setFavicon(favicon); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Gets the current title, which is not null. |
|
|
|
|
* Can be an empty string. |
|
|
|
|
* |
|
|
|
|
* @return the non-null title. |
|
|
|
|
*/ |
|
|
|
|
@NonNull |
|
|
|
|
public String getTitle() { |
|
|
|
|
return mTitle; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Gets the favicon of the page, which is not null. |
|
|
|
|
* Either the favicon, or a default icon. |
|
|
|
|
* |
|
|
|
|
* @return the favicon or a default if that is null. |
|
|
|
|
*/ |
|
|
|
|
@NonNull |
|
|
|
|
public Bitmap getFavicon() { |
|
|
|
|
return mFavicon; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static Bitmap getDefaultIcon() { |
|
|
|
|
return DEFAULT_ICON; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|