Bug 1046200 - Introduce NewTabletUI utility API (r=mcomella)

This commit is contained in:
Lucas Rocha 2014-08-13 19:30:07 +01:00
parent ec58463605
commit 81abf87173
2 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,32 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
package org.mozilla.gecko;
import android.content.Context;
import android.content.SharedPreferences;
import org.mozilla.gecko.preferences.GeckoPreferences;
import org.mozilla.gecko.util.HardwareUtils;
public class NewTabletUI {
// XXX: Change default value to false before merging to m-c.
// This value should be in sync with preferences_display.xml.
private static final boolean DEFAULT = true;
private static Boolean sNewTabletUI;
public static synchronized boolean isEnabled(Context context) {
if (!HardwareUtils.isTablet()) {
return false;
}
if (sNewTabletUI == null) {
final SharedPreferences prefs = GeckoSharedPrefs.forApp(context);
sNewTabletUI = prefs.getBoolean(GeckoPreferences.PREFS_NEW_TABLET_UI, DEFAULT);
}
return sNewTabletUI;
}
}

View File

@ -328,6 +328,7 @@ gbjar.sources += [
'menu/MenuPanel.java',
'menu/MenuPopup.java',
'MotionEventInterceptor.java',
'NewTabletUI.java',
'NotificationClient.java',
'NotificationHandler.java',
'NotificationHelper.java',