Bug 1145858 - Rename FirstrunPane to be less confusing. r=liuche

This commit is contained in:
Andrzej Hunt 2015-12-14 16:01:17 -08:00
parent 2807054132
commit b1de7a9060
8 changed files with 37 additions and 22 deletions

View File

@ -24,7 +24,7 @@ import org.mozilla.gecko.favicons.Favicons;
import org.mozilla.gecko.favicons.LoadFaviconTask;
import org.mozilla.gecko.favicons.OnFaviconLoadedListener;
import org.mozilla.gecko.favicons.decoders.IconDirectoryEntry;
import org.mozilla.gecko.firstrun.FirstrunPane;
import org.mozilla.gecko.firstrun.FirstrunAnimationContainer;
import org.mozilla.gecko.gfx.DynamicToolbarAnimator;
import org.mozilla.gecko.gfx.ImmutableViewportMetrics;
import org.mozilla.gecko.gfx.LayerView;
@ -197,7 +197,7 @@ public class BrowserApp extends GeckoApp
// We can't name the TabStrip class because it's not included on API 9.
private Refreshable mTabStrip;
private ToolbarProgressView mProgressView;
private FirstrunPane mFirstrunPane;
private FirstrunAnimationContainer mFirstrunAnimationContainer;
private HomePager mHomePager;
private TabsPanel mTabsPanel;
private ViewGroup mHomePagerContainer;
@ -790,12 +790,12 @@ public class BrowserApp extends GeckoApp
try {
final SharedPreferences prefs = GeckoSharedPrefs.forProfile(this);
if (prefs.getBoolean(FirstrunPane.PREF_FIRSTRUN_ENABLED, false)) {
if (prefs.getBoolean(FirstrunAnimationContainer.PREF_FIRSTRUN_ENABLED, false)) {
if (!Intent.ACTION_VIEW.equals(intent.getAction())) {
showFirstrunPager();
}
// Don't bother trying again to show the v1 minimal first run.
prefs.edit().putBoolean(FirstrunPane.PREF_FIRSTRUN_ENABLED, false).apply();
prefs.edit().putBoolean(FirstrunAnimationContainer.PREF_FIRSTRUN_ENABLED, false).apply();
}
} finally {
StrictMode.setThreadPolicy(savedPolicy);
@ -2130,7 +2130,7 @@ public class BrowserApp extends GeckoApp
}
private boolean isFirstrunVisible() {
return (mFirstrunPane != null && mFirstrunPane.isVisible()
return (mFirstrunAnimationContainer != null && mFirstrunAnimationContainer.isVisible()
&& mHomePagerContainer != null && mHomePagerContainer.getVisibility() == View.VISIBLE);
}
@ -2444,14 +2444,14 @@ public class BrowserApp extends GeckoApp
}
private void showFirstrunPager() {
if (mFirstrunPane == null) {
if (mFirstrunAnimationContainer == null) {
final ViewStub firstrunPagerStub = (ViewStub) findViewById(R.id.firstrun_pager_stub);
mFirstrunPane = (FirstrunPane) firstrunPagerStub.inflate();
mFirstrunPane.load(getApplicationContext(), getSupportFragmentManager());
mFirstrunPane.registerOnFinishListener(new FirstrunPane.OnFinishListener() {
mFirstrunAnimationContainer = (FirstrunAnimationContainer) firstrunPagerStub.inflate();
mFirstrunAnimationContainer.load(getApplicationContext(), getSupportFragmentManager());
mFirstrunAnimationContainer.registerOnFinishListener(new FirstrunAnimationContainer.OnFinishListener() {
@Override
public void onFinish() {
if (mFirstrunPane.showBrowserHint()) {
if (mFirstrunAnimationContainer.showBrowserHint()) {
enterEditingMode();
}
}
@ -2559,7 +2559,7 @@ public class BrowserApp extends GeckoApp
return false;
}
mFirstrunPane.hide();
mFirstrunAnimationContainer.hide();
return true;
}

View File

@ -29,7 +29,7 @@ import org.mozilla.gecko.db.LocalBrowserDB;
import org.mozilla.gecko.db.StubBrowserDB;
import org.mozilla.gecko.distribution.Distribution;
import org.mozilla.gecko.mozglue.ContextUtils;
import org.mozilla.gecko.firstrun.FirstrunPane;
import org.mozilla.gecko.firstrun.FirstrunAnimationContainer;
import org.mozilla.gecko.preferences.DistroSharedPrefsImport;
import org.mozilla.gecko.util.INIParser;
import org.mozilla.gecko.util.INISection;
@ -871,7 +871,7 @@ public final class GeckoProfile {
// Initialize pref flag for displaying the start pane for a new non-webapp profile.
if (!mIsWebAppProfile) {
final SharedPreferences prefs = GeckoSharedPrefs.forProfile(mApplicationContext);
prefs.edit().putBoolean(FirstrunPane.PREF_FIRSTRUN_ENABLED, true).apply();
prefs.edit().putBoolean(FirstrunAnimationContainer.PREF_FIRSTRUN_ENABLED, true).apply();
}
return profileDir;

View File

@ -19,7 +19,11 @@ import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.TelemetryContract;
import org.mozilla.gecko.animation.TransitionsTracker;
public class FirstrunPane extends LinearLayout {
/**
* A container for the pager and the entire first run experience.
* This is used for animation purposes.
*/
public class FirstrunAnimationContainer extends LinearLayout {
public static final String PREF_FIRSTRUN_ENABLED = "startpane_enabled";
public static interface OnFinishListener {
@ -30,10 +34,10 @@ public class FirstrunPane extends LinearLayout {
private boolean visible;
private OnFinishListener onFinishListener;
public FirstrunPane(Context context) {
public FirstrunAnimationContainer(Context context) {
this(context, null);
}
public FirstrunPane(Context context, AttributeSet attrs) {
public FirstrunAnimationContainer(Context context, AttributeSet attrs) {
super(context, attrs);
}
@ -70,7 +74,7 @@ public class FirstrunPane extends LinearLayout {
alphaAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
FirstrunPane.this.setVisibility(View.GONE);
FirstrunAnimationContainer.this.setVisibility(View.GONE);
}
});

View File

@ -27,6 +27,11 @@ import org.mozilla.gecko.home.TabMenuStrip;
import java.util.List;
/**
* ViewPager containing for our first run pages.
*
* @see FirstrunPanel for the first run pages that are used in this pager.
*/
public class FirstrunPager extends ViewPager {
private Context context;
@ -61,7 +66,7 @@ public class FirstrunPager extends ViewPager {
super.addView(child, index, params);
}
public void load(Context appContext, FragmentManager fm, final FirstrunPane.OnFinishListener onFinishListener) {
public void load(Context appContext, FragmentManager fm, final FirstrunAnimationContainer.OnFinishListener onFinishListener) {
final List<FirstrunPagerConfig.FirstrunPanelConfig> panels;
if (Restrictions.isUserRestricted(context)) {

View File

@ -7,6 +7,12 @@ package org.mozilla.gecko.firstrun;
import android.support.v4.app.Fragment;
/**
* Base class for our first run pages. We call these FirstrunPanel for consistency
* with HomePager/HomePanel.
*
* @see FirstrunPager for the containing pager.
*/
public class FirstrunPanel extends Fragment {
public static final int TITLE_RES = -1;

View File

@ -270,9 +270,9 @@ gbjar.sources += ['java/org/mozilla/gecko/' + x for x in [
'FilePicker.java',
'FilePickerResultHandler.java',
'FindInPageBar.java',
'firstrun/FirstrunAnimationContainer.java',
'firstrun/FirstrunPager.java',
'firstrun/FirstrunPagerConfig.java',
'firstrun/FirstrunPane.java',
'firstrun/FirstrunPanel.java',
'firstrun/ImportPanel.java',
'firstrun/RestrictedWelcomePanel.java',

View File

@ -4,7 +4,7 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<org.mozilla.gecko.firstrun.FirstrunPane xmlns:android="http://schemas.android.com/apk/res/android"
<org.mozilla.gecko.firstrun.FirstrunAnimationContainer xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:gecko="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent"
@ -27,4 +27,4 @@
gecko:inactiveTextColor="@color/divider_light" />
</org.mozilla.gecko.firstrun.FirstrunPager>
</org.mozilla.gecko.firstrun.FirstrunPane>
</org.mozilla.gecko.firstrun.FirstrunAnimationContainer>

View File

@ -50,7 +50,7 @@
android:layout_gravity="bottom"/>
<ViewStub android:id="@+id/firstrun_pager_stub"
android:layout="@layout/firstrun_pane"
android:layout="@layout/firstrun_animation_container"
android:layout_width="match_parent"
android:layout_height="match_parent"/>