Documentation for LightningViewTitle.
This commit is contained in:
parent
25ff01ed79
commit
0185b5c1ba
@ -10,8 +10,9 @@ import acr.browser.lightning.utils.ThemeUtils;
|
|||||||
import acr.browser.lightning.utils.Utils;
|
import acr.browser.lightning.utils.Utils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Stefano Pacifici base on Anthony C. Restaino's code
|
* {@link LightningViewTitle} acts as a container class
|
||||||
* @date 2015/09/21
|
* for the favicon and page title, the information used
|
||||||
|
* by the tab adapters to show the tabs to the user.
|
||||||
*/
|
*/
|
||||||
class LightningViewTitle {
|
class LightningViewTitle {
|
||||||
|
|
||||||
@ -30,6 +31,12 @@ class LightningViewTitle {
|
|||||||
mTitle = context.getString(R.string.action_new_tab);
|
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) {
|
public void setFavicon(@Nullable Bitmap favicon) {
|
||||||
if (favicon == null) {
|
if (favicon == null) {
|
||||||
mFavicon = DEFAULT_ICON;
|
mFavicon = DEFAULT_ICON;
|
||||||
@ -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) {
|
public void setTitle(@Nullable String title) {
|
||||||
if (title == null) {
|
if (title == null) {
|
||||||
mTitle = "";
|
mTitle = "";
|
||||||
@ -46,22 +59,26 @@ class LightningViewTitle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTitleAndFavicon(@Nullable String title, @Nullable Bitmap favicon) {
|
/**
|
||||||
setTitle(title);
|
* Gets the current title, which is not null.
|
||||||
setFavicon(favicon);
|
* Can be an empty string.
|
||||||
}
|
*
|
||||||
|
* @return the non-null title.
|
||||||
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return mTitle;
|
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
|
@NonNull
|
||||||
public Bitmap getFavicon() {
|
public Bitmap getFavicon() {
|
||||||
return mFavicon;
|
return mFavicon;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Bitmap getDefaultIcon() {
|
|
||||||
return DEFAULT_ICON;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user