зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1236431 - (Pre) ToolbarDisplayLayout: Address lint warnings and clean up code. r=mcomella
MozReview-Commit-ID: JkD7uqRMQhQ --HG-- extra : rebase_source : 87e2044c27e7693b9c356e32f4f6d5e70de9d5ed
This commit is contained in:
Родитель
2b6503e6a2
Коммит
d74a299d2d
|
@ -27,8 +27,8 @@ import org.mozilla.gecko.widget.themed.ThemedLinearLayout;
|
||||||
import org.mozilla.gecko.widget.themed.ThemedTextView;
|
import org.mozilla.gecko.widget.themed.ThemedTextView;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
import android.text.Spannable;
|
import android.text.Spannable;
|
||||||
import android.text.SpannableStringBuilder;
|
import android.text.SpannableStringBuilder;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
@ -37,9 +37,6 @@ import android.util.AttributeSet;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.animation.AlphaAnimation;
|
|
||||||
import android.view.animation.Animation;
|
|
||||||
import android.view.animation.TranslateAnimation;
|
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
|
|
||||||
|
@ -84,11 +81,11 @@ public class ToolbarDisplayLayout extends ThemedLinearLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OnStopListener {
|
interface OnStopListener {
|
||||||
public Tab onStop();
|
Tab onStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OnTitleChangeListener {
|
interface OnTitleChangeListener {
|
||||||
public void onTitleChange(CharSequence title);
|
void onTitleChange(CharSequence title);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final BrowserApp mActivity;
|
private final BrowserApp mActivity;
|
||||||
|
@ -115,13 +112,13 @@ public class ToolbarDisplayLayout extends ThemedLinearLayout {
|
||||||
// Security level constants, which map to the icons / levels defined in:
|
// Security level constants, which map to the icons / levels defined in:
|
||||||
// http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/java/org/mozilla/gecko/resources/drawable/site_security_level.xml
|
// http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/java/org/mozilla/gecko/resources/drawable/site_security_level.xml
|
||||||
// Default level (unverified pages) - globe icon:
|
// Default level (unverified pages) - globe icon:
|
||||||
private final int LEVEL_DEFAULT_GLOBE = 0;
|
private static final int LEVEL_DEFAULT_GLOBE = 0;
|
||||||
// Levels for displaying Mixed Content state icons.
|
// Levels for displaying Mixed Content state icons.
|
||||||
private final int LEVEL_WARNING_MINOR = 3;
|
private static final int LEVEL_WARNING_MINOR = 3;
|
||||||
private final int LEVEL_LOCK_DISABLED = 4;
|
private static final int LEVEL_LOCK_DISABLED = 4;
|
||||||
// Levels for displaying Tracking Protection state icons.
|
// Levels for displaying Tracking Protection state icons.
|
||||||
private final int LEVEL_SHIELD_ENABLED = 5;
|
private static final int LEVEL_SHIELD_ENABLED = 5;
|
||||||
private final int LEVEL_SHIELD_DISABLED = 6;
|
private static final int LEVEL_SHIELD_DISABLED = 6;
|
||||||
|
|
||||||
private final ForegroundColorSpan mUrlColor;
|
private final ForegroundColorSpan mUrlColor;
|
||||||
private final ForegroundColorSpan mBlockedColor;
|
private final ForegroundColorSpan mBlockedColor;
|
||||||
|
@ -158,6 +155,8 @@ public class ToolbarDisplayLayout extends ThemedLinearLayout {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttachedToWindow() {
|
public void onAttachedToWindow() {
|
||||||
|
super.onAttachedToWindow();
|
||||||
|
|
||||||
mIsAttached = true;
|
mIsAttached = true;
|
||||||
|
|
||||||
mSiteSecurity.setOnClickListener(new Button.OnClickListener() {
|
mSiteSecurity.setOnClickListener(new Button.OnClickListener() {
|
||||||
|
@ -354,13 +353,13 @@ public class ToolbarDisplayLayout extends ThemedLinearLayout {
|
||||||
mTrackingProtectionEnabled = trackingMode == TrackingMode.TRACKING_CONTENT_BLOCKED;
|
mTrackingProtectionEnabled = trackingMode == TrackingMode.TRACKING_CONTENT_BLOCKED;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateProgress(Tab tab) {
|
private void updateProgress(@Nullable Tab tab) {
|
||||||
final boolean shouldShowThrobber = (tab != null &&
|
final boolean shouldShowThrobber = (tab != null &&
|
||||||
tab.getState() == Tab.STATE_LOADING);
|
tab.getState() == Tab.STATE_LOADING);
|
||||||
|
|
||||||
updateUiMode(shouldShowThrobber ? UIMode.PROGRESS : UIMode.DISPLAY);
|
updateUiMode(shouldShowThrobber ? UIMode.PROGRESS : UIMode.DISPLAY);
|
||||||
|
|
||||||
if (Tab.STATE_SUCCESS == tab.getState() && mTrackingProtectionEnabled) {
|
if (tab != null && Tab.STATE_SUCCESS == tab.getState() && mTrackingProtectionEnabled) {
|
||||||
mActivity.showTrackingProtectionPromptIfApplicable();
|
mActivity.showTrackingProtectionPromptIfApplicable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче