Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Java code refactor (#623)
Browse files Browse the repository at this point in the history
* Java code refactoring

* Removed unused resources

Removed unused resources
  • Loading branch information
keianhzo authored and MortimerGoro committed Oct 16, 2018
1 parent bff223d commit 81cbd41
Show file tree
Hide file tree
Showing 122 changed files with 155 additions and 80,275 deletions.
24 changes: 16 additions & 8 deletions app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,25 @@
import org.mozilla.geckoview.GeckoSession;
import org.mozilla.vrbrowser.audio.AudioEngine;
import org.mozilla.vrbrowser.audio.VRAudioTheme;
import org.mozilla.vrbrowser.browser.PermissionDelegate;
import org.mozilla.vrbrowser.browser.SessionStore;
import org.mozilla.vrbrowser.browser.SettingsStore;
import org.mozilla.vrbrowser.crashreporting.CrashReporterService;
import org.mozilla.vrbrowser.crashreporting.GlobalExceptionHandler;
import org.mozilla.vrbrowser.input.MotionEventGenerator;
import org.mozilla.vrbrowser.search.SearchEngine;
import org.mozilla.vrbrowser.telemetry.TelemetryWrapper;
import org.mozilla.vrbrowser.ui.BrowserWidget;
import org.mozilla.vrbrowser.ui.CrashDialogWidget;
import org.mozilla.vrbrowser.ui.KeyboardWidget;
import org.mozilla.vrbrowser.ui.NavigationBarWidget;
import org.mozilla.vrbrowser.ui.widgets.BrowserWidget;
import org.mozilla.vrbrowser.ui.widgets.CrashDialogWidget;
import org.mozilla.vrbrowser.ui.widgets.KeyboardWidget;
import org.mozilla.vrbrowser.ui.widgets.NavigationBarWidget;
import org.mozilla.vrbrowser.ui.OffscreenDisplay;
import org.mozilla.vrbrowser.ui.RootWidget;
import org.mozilla.vrbrowser.ui.TopBarWidget;
import org.mozilla.vrbrowser.ui.TrayWidget;
import org.mozilla.vrbrowser.ui.UIWidget;
import org.mozilla.vrbrowser.ui.widgets.RootWidget;
import org.mozilla.vrbrowser.ui.widgets.TopBarWidget;
import org.mozilla.vrbrowser.ui.widgets.TrayWidget;
import org.mozilla.vrbrowser.ui.widgets.Widget;
import org.mozilla.vrbrowser.ui.widgets.WidgetManagerDelegate;
import org.mozilla.vrbrowser.ui.widgets.WidgetPlacement;

import java.io.IOException;
import java.net.URISyntaxException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.mozilla.vrbrowser;
package org.mozilla.vrbrowser.browser;

import android.Manifest;
import android.app.Activity;
Expand All @@ -8,7 +8,11 @@
import android.util.Log;

import org.mozilla.geckoview.GeckoSession;
import org.mozilla.vrbrowser.ui.PermissionWidget;
import org.mozilla.vrbrowser.PlatformActivity;
import org.mozilla.vrbrowser.R;
import org.mozilla.vrbrowser.browser.SessionStore;
import org.mozilla.vrbrowser.ui.widgets.PermissionWidget;
import org.mozilla.vrbrowser.ui.widgets.WidgetManagerDelegate;

import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -24,7 +28,7 @@ public class PermissionDelegate implements GeckoSession.PermissionDelegate, Widg
private GeckoSession.PermissionDelegate.Callback mCallback;
private PermissionWidget mPermissionWidget;

PermissionDelegate(Context aContext, WidgetManagerDelegate aWidgetManager) {
public PermissionDelegate(Context aContext, WidgetManagerDelegate aWidgetManager) {
mContext = aContext;
mWidgetManager = aWidgetManager;
mWidgetManager.addPermissionListener(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,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/. */

package org.mozilla.vrbrowser;
package org.mozilla.vrbrowser.browser;

import android.content.Context;
import android.graphics.Rect;
Expand All @@ -22,7 +22,11 @@
import org.mozilla.geckoview.GeckoRuntimeSettings;
import org.mozilla.geckoview.GeckoSession;
import org.mozilla.geckoview.GeckoSessionSettings;
import org.mozilla.vrbrowser.BuildConfig;
import org.mozilla.vrbrowser.R;
import org.mozilla.vrbrowser.crashreporting.CrashReporterService;
import org.mozilla.vrbrowser.telemetry.TelemetryWrapper;
import org.mozilla.vrbrowser.utils.InternalPages;
import org.mozilla.vrbrowser.utils.ValueHolder;

import java.io.File;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.mozilla.vrbrowser;
package org.mozilla.vrbrowser.browser;

import android.content.Context;
import android.content.SharedPreferences;
Expand All @@ -8,6 +8,7 @@
import android.support.annotation.NonNull;

import org.mozilla.telemetry.TelemetryHolder;
import org.mozilla.vrbrowser.R;
import org.mozilla.vrbrowser.telemetry.TelemetryWrapper;


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.mozilla.vrbrowser;
package org.mozilla.vrbrowser.crashreporting;

import android.app.ActivityManager;
import android.content.Context;
Expand All @@ -10,6 +10,8 @@
import android.util.Log;

import org.mozilla.geckoview.GeckoRuntime;
import org.mozilla.vrbrowser.R;
import org.mozilla.vrbrowser.VRBrowserActivity;

public class CrashReporterService extends JobIntentService {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.mozilla.vrbrowser;
package org.mozilla.vrbrowser.crashreporting;

import android.support.annotation.NonNull;
import android.util.Log;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,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/. */

package org.mozilla.vrbrowser.ui;
package org.mozilla.vrbrowser.input;

import android.content.Context;
import android.content.res.Resources;
Expand Down Expand Up @@ -193,7 +193,7 @@ public int[] getNearestKeys(int x, int y) {
return new int[0];
}

void setImeOptions(int options) {
public void setImeOptions(int options) {
if (mEnterKey == null) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
* 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.vrbrowser;
package org.mozilla.vrbrowser.input;

import android.os.SystemClock;
import android.util.Log;
import android.view.MotionEvent;
import android.view.InputDevice;
import android.util.SparseArray;

class MotionEventGenerator {
import org.mozilla.vrbrowser.ui.widgets.Widget;

public class MotionEventGenerator {
static final String LOGTAG = "VRB";
static class Device {
int mDevice;
Expand Down Expand Up @@ -63,7 +65,7 @@ private static void generateEvent(Widget aWidget, Device aDevice, int aAction, b
event.recycle();
}

static void dispatch(Widget aWidget, int aDevice, boolean aPressed, float aX, float aY) {
public static void dispatch(Widget aWidget, int aDevice, boolean aPressed, float aX, float aY) {
Device device = devices.get(aDevice);
if (device == null) {
device = new Device(aDevice);
Expand Down Expand Up @@ -115,7 +117,7 @@ static void dispatch(Widget aWidget, int aDevice, boolean aPressed, float aX, fl
device.mPreviousWidget = aWidget;
}

static void dispatchScroll(Widget aWidget, int aDevice, float aX, float aY) {
public static void dispatchScroll(Widget aWidget, int aDevice, float aX, float aY) {
Device device = devices.get(aDevice);
if (device == null) {
device = new Device(aDevice);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import android.support.annotation.NonNull;
import android.util.Log;
import org.mozilla.vrbrowser.R;
import org.mozilla.vrbrowser.SessionStore;
import org.mozilla.vrbrowser.SettingsStore;
import org.mozilla.vrbrowser.browser.SessionStore;
import org.mozilla.vrbrowser.browser.SettingsStore;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.mozilla.telemetry.storage.FileTelemetryStorage;
import org.mozilla.vrbrowser.BuildConfig;
import org.mozilla.vrbrowser.R;
import org.mozilla.vrbrowser.SettingsStore;
import org.mozilla.vrbrowser.browser.SettingsStore;
import org.mozilla.vrbrowser.search.SearchEngine;
import org.mozilla.vrbrowser.utils.UrlUtils;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@

import org.mozilla.geckoview.GeckoSession.PromptDelegate.Choice;
import org.mozilla.vrbrowser.R;
import org.mozilla.vrbrowser.WidgetManagerDelegate;
import org.mozilla.vrbrowser.WidgetPlacement;
import org.mozilla.vrbrowser.ui.widgets.WidgetManagerDelegate;
import org.mozilla.vrbrowser.ui.widgets.WidgetPlacement;
import org.mozilla.vrbrowser.audio.AudioEngine;
import org.mozilla.vrbrowser.ui.UIWidget;
import org.mozilla.vrbrowser.ui.widgets.UIWidget;

import java.util.ArrayList;
import java.util.Arrays;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* the License.
*/

package org.mozilla.vrbrowser.ui;
package org.mozilla.vrbrowser.ui.views;

import android.content.Context;
import android.graphics.Bitmap;
Expand Down Expand Up @@ -45,6 +45,7 @@
import android.widget.TextView;

import org.mozilla.vrbrowser.R;
import org.mozilla.vrbrowser.input.CustomKeyboard;

import java.lang.reflect.Method;
import java.util.Arrays;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.mozilla.vrbrowser.ui;
package org.mozilla.vrbrowser.ui.views;

import android.graphics.drawable.Drawable;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.mozilla.vrbrowser.ui;
package org.mozilla.vrbrowser.ui.views;

import android.content.Context;
import android.text.Editable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,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/. */

package org.mozilla.vrbrowser.ui;
package org.mozilla.vrbrowser.ui.views;

import android.content.Context;
import android.content.res.Resources;
Expand All @@ -22,7 +22,7 @@
import android.view.inputmethod.EditorInfo;
import android.widget.*;
import org.mozilla.vrbrowser.R;
import org.mozilla.vrbrowser.SessionStore;
import org.mozilla.vrbrowser.browser.SessionStore;
import org.mozilla.vrbrowser.search.SearchEngine;
import org.mozilla.vrbrowser.telemetry.TelemetryWrapper;

Expand Down Expand Up @@ -206,7 +206,7 @@ private void syncViews() {
mURL.setPadding(leftPadding, mURL.getPaddingTop(), mURL.getPaddingRight(), mURL.getPaddingBottom());
}

protected void handleURLEdit(String text) {
public void handleURLEdit(String text) {
text = text.trim();
URI uri = null;
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.mozilla.vrbrowser.ui;
package org.mozilla.vrbrowser.ui.views;

import android.content.Context;
import android.content.res.TypedArray;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,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/. */

package org.mozilla.vrbrowser.ui;
package org.mozilla.vrbrowser.ui.views;

import android.content.Context;
import android.content.res.ColorStateList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,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/. */

package org.mozilla.vrbrowser.ui;
package org.mozilla.vrbrowser.ui.views;

import android.content.Context;
import android.content.res.ColorStateList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,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/. */

package org.mozilla.vrbrowser.ui;
package org.mozilla.vrbrowser.ui.widgets;

import android.content.Context;
import android.graphics.Rect;
Expand All @@ -20,6 +20,8 @@
import org.mozilla.geckoview.GeckoSession;
import org.mozilla.geckoview.GeckoSessionSettings;
import org.mozilla.vrbrowser.*;
import org.mozilla.vrbrowser.browser.SessionStore;
import org.mozilla.vrbrowser.browser.SettingsStore;
import org.mozilla.vrbrowser.ui.prompts.ChoicePromptWidget;


Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package org.mozilla.vrbrowser.ui;
package org.mozilla.vrbrowser.ui.widgets;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import org.mozilla.vrbrowser.R;
import org.mozilla.vrbrowser.WidgetPlacement;
import org.mozilla.vrbrowser.audio.AudioEngine;
import org.mozilla.vrbrowser.ui.views.UIButton;

public class CloseButtonWidget extends UIWidget {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,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/. */

package org.mozilla.vrbrowser.ui;
package org.mozilla.vrbrowser.ui.widgets;

import android.content.Context;
import android.util.AttributeSet;
Expand All @@ -13,10 +13,8 @@
import android.widget.CompoundButton;
import org.mozilla.geckoview.GeckoSession;
import org.mozilla.vrbrowser.R;
import org.mozilla.vrbrowser.SessionStore;
import org.mozilla.vrbrowser.SettingsStore;
import org.mozilla.vrbrowser.WidgetManagerDelegate;
import org.mozilla.vrbrowser.WidgetPlacement;
import org.mozilla.vrbrowser.browser.SessionStore;
import org.mozilla.vrbrowser.browser.SettingsStore;
import org.mozilla.vrbrowser.audio.AudioEngine;

public class CrashDialogWidget extends UIWidget implements WidgetManagerDelegate.FocusChangeListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,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/. */

package org.mozilla.vrbrowser.ui;
package org.mozilla.vrbrowser.ui.widgets;

import android.content.Context;
import android.util.AttributeSet;
Expand All @@ -12,10 +12,10 @@
import android.widget.RadioGroup;

import org.mozilla.vrbrowser.R;
import org.mozilla.vrbrowser.SessionStore;
import org.mozilla.vrbrowser.SettingsStore;
import org.mozilla.vrbrowser.WidgetPlacement;
import org.mozilla.vrbrowser.browser.SessionStore;
import org.mozilla.vrbrowser.browser.SettingsStore;
import org.mozilla.vrbrowser.audio.AudioEngine;
import org.mozilla.vrbrowser.ui.views.UIButton;
import org.mozilla.vrbrowser.ui.settings.ButtonSetting;
import org.mozilla.vrbrowser.ui.settings.DoubleEditSetting;
import org.mozilla.vrbrowser.ui.settings.SingleEditSetting;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,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/. */

package org.mozilla.vrbrowser.ui;
package org.mozilla.vrbrowser.ui.widgets;

import android.content.Context;
import android.graphics.drawable.Drawable;
Expand All @@ -26,10 +26,11 @@
import android.widget.RelativeLayout;
import org.mozilla.geckoview.GeckoSession;
import org.mozilla.vrbrowser.R;
import org.mozilla.vrbrowser.SessionStore;
import org.mozilla.vrbrowser.WidgetManagerDelegate;
import org.mozilla.vrbrowser.WidgetPlacement;
import org.mozilla.vrbrowser.browser.SessionStore;
import org.mozilla.vrbrowser.telemetry.TelemetryWrapper;
import org.mozilla.vrbrowser.input.CustomKeyboard;
import org.mozilla.vrbrowser.ui.views.CustomKeyboardView;
import org.mozilla.vrbrowser.ui.views.UIButton;


public class KeyboardWidget extends UIWidget implements CustomKeyboardView.OnKeyboardActionListener,
Expand Down
Loading

0 comments on commit 81cbd41

Please sign in to comment.