mobile/android/base/BaseGeckoInterface.java

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
michael@0 2 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 package org.mozilla.gecko;
michael@0 7
michael@0 8 import org.mozilla.gecko.util.HardwareUtils;
michael@0 9 import org.mozilla.gecko.util.ThreadUtils;
michael@0 10 import org.mozilla.gecko.prompts.PromptService;
michael@0 11
michael@0 12 import android.app.Activity;
michael@0 13 import android.content.Context;
michael@0 14 import android.graphics.RectF;
michael@0 15 import android.hardware.SensorEventListener;
michael@0 16 import android.location.LocationListener;
michael@0 17 import android.os.Build;
michael@0 18 import android.view.View;
michael@0 19 import android.view.Window;
michael@0 20 import android.view.WindowManager;
michael@0 21 import android.widget.AbsoluteLayout;
michael@0 22
michael@0 23 public class BaseGeckoInterface implements GeckoAppShell.GeckoInterface {
michael@0 24 // Bug 908744: Implement GeckoEventListener
michael@0 25 // Bug 908752: Implement SensorEventListener
michael@0 26 // Bug 908755: Implement LocationListener
michael@0 27 // Bug 908756: Implement Tabs.OnTabsChangedListener
michael@0 28 // Bug 908760: Implement GeckoEventResponder
michael@0 29
michael@0 30 private Context mContext;
michael@0 31 private GeckoProfile mProfile;
michael@0 32
michael@0 33 public BaseGeckoInterface(Context context) {
michael@0 34 mContext = context;
michael@0 35 }
michael@0 36
michael@0 37 public GeckoProfile getProfile() {
michael@0 38 // Fall back to default profile if we didn't load a specific one
michael@0 39 if (mProfile == null) {
michael@0 40 mProfile = GeckoProfile.get(mContext);
michael@0 41 }
michael@0 42 return mProfile;
michael@0 43 }
michael@0 44
michael@0 45 // Bug 908770: Implement this
michael@0 46 public PromptService getPromptService() {
michael@0 47 return null;
michael@0 48 }
michael@0 49
michael@0 50 public Activity getActivity() {
michael@0 51 return (Activity)mContext;
michael@0 52 }
michael@0 53
michael@0 54 public String getDefaultUAString() {
michael@0 55 return HardwareUtils.isTablet() ? AppConstants.USER_AGENT_FENNEC_TABLET :
michael@0 56 AppConstants.USER_AGENT_FENNEC_MOBILE;
michael@0 57 }
michael@0 58
michael@0 59 // Bug 908772: Implement this
michael@0 60 public LocationListener getLocationListener() {
michael@0 61 return null;
michael@0 62 }
michael@0 63
michael@0 64 // Bug 908773: Implement this
michael@0 65 public SensorEventListener getSensorEventListener() {
michael@0 66 return null;
michael@0 67 }
michael@0 68
michael@0 69 // Bug 908775: Implement this
michael@0 70 public void doRestart() {}
michael@0 71
michael@0 72 public void setFullScreen(final boolean fullscreen) {
michael@0 73 ThreadUtils.postToUiThread(new Runnable() {
michael@0 74 @Override
michael@0 75 public void run() {
michael@0 76 // Hide/show the system notification bar
michael@0 77 Window window = ((Activity)mContext).getWindow();
michael@0 78 window.setFlags(fullscreen ?
michael@0 79 WindowManager.LayoutParams.FLAG_FULLSCREEN : 0,
michael@0 80 WindowManager.LayoutParams.FLAG_FULLSCREEN);
michael@0 81
michael@0 82 if (Build.VERSION.SDK_INT >= 11)
michael@0 83 window.getDecorView().setSystemUiVisibility(fullscreen ? 1 : 0);
michael@0 84 }
michael@0 85 });
michael@0 86 }
michael@0 87
michael@0 88 // Bug 908779: Implement this
michael@0 89 public void addPluginView(final View view, final RectF rect, final boolean isFullScreen) {}
michael@0 90
michael@0 91 // Bug 908781: Implement this
michael@0 92 public void removePluginView(final View view, final boolean isFullScreen) {}
michael@0 93
michael@0 94 // Bug 908783: Implement this
michael@0 95 public void enableCameraView() {}
michael@0 96
michael@0 97 // Bug 908785: Implement this
michael@0 98 public void disableCameraView() {}
michael@0 99
michael@0 100 // Bug 908786: Implement this
michael@0 101 public void addAppStateListener(GeckoAppShell.AppStateListener listener) {}
michael@0 102
michael@0 103 // Bug 908787: Implement this
michael@0 104 public void removeAppStateListener(GeckoAppShell.AppStateListener listener) {}
michael@0 105
michael@0 106 // Bug 908788: Implement this
michael@0 107 public View getCameraView() {
michael@0 108 return null;
michael@0 109 }
michael@0 110
michael@0 111 // Bug 908789: Implement this
michael@0 112 public void notifyWakeLockChanged(String topic, String state) {}
michael@0 113
michael@0 114 // Bug 908790: Implement this
michael@0 115 public FormAssistPopup getFormAssistPopup() {
michael@0 116 return null;
michael@0 117 }
michael@0 118
michael@0 119 public boolean areTabsShown() {
michael@0 120 return false;
michael@0 121 }
michael@0 122
michael@0 123 // Bug 908791: Implement this
michael@0 124 public AbsoluteLayout getPluginContainer() {
michael@0 125 return null;
michael@0 126 }
michael@0 127
michael@0 128 public void notifyCheckUpdateResult(String result) {
michael@0 129 GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Update:CheckResult", result));
michael@0 130 }
michael@0 131
michael@0 132 public boolean hasTabsSideBar() {
michael@0 133 return false;
michael@0 134 }
michael@0 135
michael@0 136 // Bug 908792: Implement this
michael@0 137 public void invalidateOptionsMenu() {}
michael@0 138 }

mercurial