--- a/mobile/android/app/checkstyle.xml
+++ b/mobile/android/app/checkstyle.xml
@@ -33,16 +33,20 @@
<module name="Checker">
<property name="charset" value="UTF-8"/>
<!-- TODO: <property name="fileExtensions" value="java, properties, xml"/> -->
<module name="FileTabCharacter"> <!-- No tabs! -->
<property name="eachLine" value="true"/>
</module>
+ <module name="RegexpSingleline"> <!-- excess whitespace -->
+ <property name="format" value="\s+$"/>
+ <property name="message" value="Excess whitespace at end of line"/>
+ </module>
<module name="TreeWalker">
<module name="GenericWhitespace"/> <!-- whitespace for generics -->
<module name="NoLineWrap">
<property name="tokens" value="IMPORT,PACKAGE_DEF"/>
</module>
<module name="OuterTypeFilename"/> <!-- `class Lol` only in Lol.java -->
</module>
--- a/mobile/android/base/java/org/mozilla/gecko/CrashReporter.java
+++ b/mobile/android/base/java/org/mozilla/gecko/CrashReporter.java
@@ -229,27 +229,27 @@ public class CrashReporter extends AppCo
public void run() {
sendReport(mPendingMinidumpFile, mExtrasStringMap, mPendingExtrasFile);
}
}, "CrashReporter Thread").start();
}
private void savePrefs() {
SharedPreferences.Editor editor = GeckoSharedPrefs.forApp(this).edit();
-
+
final boolean allowContact = ((CheckBox) findViewById(R.id.allow_contact)).isChecked();
final boolean includeUrl = ((CheckBox) findViewById(R.id.include_url)).isChecked();
final boolean sendReport = ((CheckBox) findViewById(R.id.send_report)).isChecked();
final String contactEmail = ((EditText) findViewById(R.id.email)).getText().toString();
-
+
editor.putBoolean(PREFS_ALLOW_CONTACT, allowContact);
editor.putBoolean(PREFS_INCLUDE_URL, includeUrl);
editor.putBoolean(PREFS_SEND_REPORT, sendReport);
editor.putString(PREFS_CONTACT_EMAIL, contactEmail);
-
+
// A slight performance improvement via async apply() vs. blocking on commit().
editor.apply();
}
public void onCloseClick(View v) { // bound via crash_reporter.xml
backgroundSendReport();
}
--- a/mobile/android/base/java/org/mozilla/gecko/FormAssistPopup.java
+++ b/mobile/android/base/java/org/mozilla/gecko/FormAssistPopup.java
@@ -193,17 +193,17 @@ public class FormAssistPopup extends Rel
// we don't look for swipes.
mAutoCompleteList.setOnScrollListener(touchListener.makeScrollListener());
// Setting this recycler listener is required to make sure animated views are reset.
mAutoCompleteList.setRecyclerListener(touchListener.makeRecyclerListener());
addView(mAutoCompleteList);
}
-
+
AutoCompleteListAdapter adapter = new AutoCompleteListAdapter(mContext, R.layout.autocomplete_list_item);
adapter.populateSuggestionsList(suggestions);
mAutoCompleteList.setAdapter(adapter);
if (setGeckoPositionData(rect, true)) {
positionAndShowPopup();
}
}
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoAppShell.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoAppShell.java
@@ -1278,17 +1278,17 @@ public class GeckoAppShell
GeckoProcessesVisitor visitor = new GeckoProcessesVisitor() {
@Override
public boolean callback(int pid) {
if (pid != android.os.Process.myPid())
android.os.Process.killProcess(pid);
return true;
}
};
-
+
EnumerateGeckoProcesses(visitor);
}
interface GeckoProcessesVisitor{
boolean callback(int pid);
}
private static void EnumerateGeckoProcesses(GeckoProcessesVisitor visiter) {
@@ -1300,17 +1300,17 @@ public class GeckoAppShell
java.lang.Process ps = Runtime.getRuntime().exec("ps");
BufferedReader in = new BufferedReader(new InputStreamReader(ps.getInputStream()),
2048);
String headerOutput = in.readLine();
// figure out the column offsets. We only care about the pid and user fields
StringTokenizer st = new StringTokenizer(headerOutput);
-
+
int tokenSoFar = 0;
while (st.hasMoreTokens()) {
String next = st.nextToken();
if (next.equalsIgnoreCase("PID"))
pidColumn = tokenSoFar;
else if (next.equalsIgnoreCase("USER"))
userColumn = tokenSoFar;
tokenSoFar++;
@@ -1433,17 +1433,17 @@ public class GeckoAppShell
return null;
}
}
public static String getMimeTypeFromExtension(String ext) {
final MimeTypeMap mtm = MimeTypeMap.getSingleton();
return mtm.getMimeTypeFromExtension(ext);
}
-
+
private static Drawable getDrawableForExtension(PackageManager pm, String aExt) {
Intent intent = new Intent(Intent.ACTION_VIEW);
final String mimeType = getMimeTypeFromExtension(aExt);
if (mimeType != null && mimeType.length() > 0)
intent.setType(mimeType);
else
return null;
@@ -2205,17 +2205,17 @@ public class GeckoAppShell
@WrapForJNI(stubName = "GetProxyForURIWrapper")
public static String getProxyForURI(String spec, String scheme, String host, int port) {
final ProxySelector ps = new ProxySelector();
Proxy proxy = ps.select(scheme, host);
if (Proxy.NO_PROXY.equals(proxy)) {
return "DIRECT";
}
-
+
switch (proxy.type()) {
case HTTP:
return "PROXY " + proxy.address().toString();
case SOCKS:
return "SOCKS " + proxy.address().toString();
}
return "DIRECT";
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApplication.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApplication.java
@@ -23,17 +23,17 @@ import org.mozilla.gecko.lwt.Lightweight
import org.mozilla.gecko.mdns.MulticastDNSManager;
import org.mozilla.gecko.util.Clipboard;
import org.mozilla.gecko.util.HardwareUtils;
import org.mozilla.gecko.util.ThreadUtils;
import java.io.File;
import java.lang.reflect.Method;
-public class GeckoApplication extends Application
+public class GeckoApplication extends Application
implements ContextGetter {
private static final String LOG_TAG = "GeckoApplication";
private static volatile GeckoApplication instance;
private boolean mInBackground;
private boolean mPausedGecko;
@@ -105,17 +105,17 @@ public class GeckoApplication extends Ap
mInBackground = true;
if ((activity.isFinishing() == false) &&
(activity.isGeckoActivityOpened() == false)) {
// Notify Gecko that we are pausing; the cache service will be
// shutdown, closing the disk cache cleanly. If the android
// low memory killer subsequently kills us, the disk cache will
// be left in a consistent state, avoiding costly cleanup and
- // re-creation.
+ // re-creation.
GeckoAppShell.sendEventToGecko(GeckoEvent.createAppBackgroundingEvent());
mPausedGecko = true;
final BrowserDB db = GeckoProfile.get(this).getDB();
ThreadUtils.postToBackgroundThread(new Runnable() {
@Override
public void run() {
db.expireHistory(getContentResolver(), BrowserContract.ExpirePriority.NORMAL);
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoProfile.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoProfile.java
@@ -86,17 +86,17 @@ public final class GeckoProfile {
private final Context mApplicationContext;
private final BrowserDB mDB;
/**
* Access to this member should be synchronized to avoid
* races during creation -- particularly between getDir and GeckoView#init.
*
- * Not final because this is lazily computed.
+ * Not final because this is lazily computed.
*/
private File mProfileDir;
// Caches whether or not a profile is "locked".
// Only used by the guest profile to determine if it should be reused or
// deleted on startup.
// These are volatile for an incremental improvement in thread safety,
// but this is not a complete solution for concurrency.
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoScreenOrientation.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoScreenOrientation.java
@@ -35,17 +35,17 @@ public class GeckoScreenOrientation {
DEFAULT(1 << 4);
public final short value;
private ScreenOrientation(int value) {
this.value = (short)value;
}
- private final static ScreenOrientation[] sValues = ScreenOrientation.values();
+ private final static ScreenOrientation[] sValues = ScreenOrientation.values();
public static ScreenOrientation get(int value) {
for (ScreenOrientation orient: sValues) {
if (orient.value == value) {
return orient;
}
}
return NONE;
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoSmsManager.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoSmsManager.java
@@ -934,17 +934,17 @@ public class GeckoSmsManager
}
if (mNumbersCount > 0) {
formatter.format("address IN ('%s'", mNumbers[0]);
for (int i = 1; i < mNumbersCount; ++i) {
formatter.format(", '%s'", mNumbers[i]);
}
-
+
formatter.format(") AND ");
}
if (mDelivery == null || mDelivery.isEmpty()) {
formatter.format("type IN ('%d', '%d') AND ", kSmsTypeSentbox, kSmsTypeInbox);
} else if (mDelivery.equals("sent")) {
formatter.format("type = '%d' AND ", kSmsTypeSentbox);
} else if (mDelivery.equals("received")) {
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoView.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoView.java
@@ -632,38 +632,38 @@ public class GeckoView extends LayerView
* Tell the host application to display an alert dialog.
* @param view The GeckoView that initiated the callback.
* @param browser The Browser that is loading the content.
* @param message The string to display in the dialog.
* @param result A PromptResult used to send back the result without blocking.
* Defaults to cancel requests.
*/
public void onAlert(GeckoView view, GeckoView.Browser browser, String message, GeckoView.PromptResult result);
-
+
/**
* Tell the host application to display a confirmation dialog.
* @param view The GeckoView that initiated the callback.
* @param browser The Browser that is loading the content.
* @param message The string to display in the dialog.
* @param result A PromptResult used to send back the result without blocking.
* Defaults to cancel requests.
*/
public void onConfirm(GeckoView view, GeckoView.Browser browser, String message, GeckoView.PromptResult result);
-
+
/**
* Tell the host application to display an input prompt dialog.
* @param view The GeckoView that initiated the callback.
* @param browser The Browser that is loading the content.
* @param message The string to display in the dialog.
* @param defaultValue The string to use as default input.
* @param result A PromptResult used to send back the result without blocking.
* Defaults to cancel requests.
*/
public void onPrompt(GeckoView view, GeckoView.Browser browser, String message, String defaultValue, GeckoView.PromptResult result);
-
+
/**
* Tell the host application to display a remote debugging request dialog.
* @param view The GeckoView that initiated the callback.
* @param result A PromptResult used to send back the result without blocking.
* Defaults to cancel requests.
*/
public void onDebugRequest(GeckoView view, GeckoView.PromptResult result);
@@ -680,17 +680,17 @@ public class GeckoView extends LayerView
public interface ContentDelegate {
/**
* A Browser has started loading content from the network.
* @param view The GeckoView that initiated the callback.
* @param browser The Browser that is loading the content.
* @param url The resource being loaded.
*/
public void onPageStart(GeckoView view, GeckoView.Browser browser, String url);
-
+
/**
* A Browser has finished loading content from the network.
* @param view The GeckoView that initiated the callback.
* @param browser The Browser that was loading the content.
* @param success Whether the page loaded successfully or an error occurred.
*/
public void onPageStop(GeckoView view, GeckoView.Browser browser, boolean success);
--- a/mobile/android/base/java/org/mozilla/gecko/TextSelection.java
+++ b/mobile/android/base/java/org/mozilla/gecko/TextSelection.java
@@ -298,17 +298,17 @@ class TextSelection extends Layer implem
@Override
public void onMetricsChanged(ImmutableViewportMetrics viewport) {
mForceReposition = true;
}
private class TextSelectionActionModeCallback implements Callback {
private JSONArray mItems;
private ActionModeCompat mActionMode;
-
+
public TextSelectionActionModeCallback(JSONArray items) {
mItems = items;
}
public void updateItems(JSONArray items) {
mItems = items;
if (mActionMode != null) {
mActionMode.invalidate();
--- a/mobile/android/base/java/org/mozilla/gecko/TextSelectionHandle.java
+++ b/mobile/android/base/java/org/mozilla/gecko/TextSelectionHandle.java
@@ -48,17 +48,17 @@ class TextSelectionHandle extends ImageV
private final HandleType mHandleType;
private final int mWidth;
private final int mHeight;
private final int mShadow;
private float mLeft;
private float mTop;
- private boolean mIsRTL;
+ private boolean mIsRTL;
private PointF mGeckoPoint;
private PointF mTouchStart;
private RelativeLayout.LayoutParams mLayoutParams;
private static final int IMAGE_LEVEL_LTR = 0;
private static final int IMAGE_LEVEL_RTL = 1;
--- a/mobile/android/base/java/org/mozilla/gecko/animation/PropertyAnimator.java
+++ b/mobile/android/base/java/org/mozilla/gecko/animation/PropertyAnimator.java
@@ -105,17 +105,17 @@ public class PropertyAnimator implements
int timePassed = (int) (AnimationUtils.currentAnimationTimeMillis() - mStartTime);
if (timePassed >= mDuration) {
stop();
return;
}
float interpolation = mInterpolator.getInterpolation(timePassed * mDurationReciprocal);
- for (ElementHolder element : mElementsList) {
+ for (ElementHolder element : mElementsList) {
float delta = element.from + ((element.to - element.from) * interpolation);
invalidate(element, delta);
}
mFramePoster.postNextAnimationFrame();
}
public void start() {
--- a/mobile/android/base/java/org/mozilla/gecko/db/SQLiteBridgeContentProvider.java
+++ b/mobile/android/base/java/org/mozilla/gecko/db/SQLiteBridgeContentProvider.java
@@ -152,17 +152,17 @@ public abstract class SQLiteBridgeConten
// call to Gecko. Gecko will handle building the database file correctly, as well as any
// migrations that are necessary
if (dbNeedsSetup) {
bridge = null;
initGecko();
}
return bridge;
}
-
+
/**
* Returns the absolute path of a database file depending on the specified profile and dbName.
* @param profile
* the profile whose dbPath must be returned
* @param dbName
* the name of the db file whose absolute path must be returned
* @return the absolute path of the db file or <code>null</code> if it was not possible to retrieve a valid path
*
@@ -178,17 +178,17 @@ public abstract class SQLiteBridgeConten
return databasePath;
}
/**
* Returns a SQLiteBridge object according to the specified profile id and to the name of db related to the
* current provider instance.
* @param profile
* the id of the profile to be used to retrieve the related SQLiteBridge
- * @return the <code>SQLiteBridge</code> related to the specified profile id or <code>null</code> if it was
+ * @return the <code>SQLiteBridge</code> related to the specified profile id or <code>null</code> if it was
* not possible to retrieve a valid SQLiteBridge
*/
private SQLiteBridge getDatabaseForProfile(String profile) {
if (TextUtils.isEmpty(profile)) {
profile = GeckoProfile.get(mContext).getName();
Log.d(mLogTag, "No profile provided, using '" + profile + "'");
}
@@ -197,17 +197,17 @@ public abstract class SQLiteBridgeConten
SQLiteBridge db = null;
synchronized (this) {
db = mDatabasePerProfile.get(mapKey);
if (db != null) {
return db;
}
final String dbPath = getDatabasePathForProfile(profile, dbName);
- if (dbPath == null) {
+ if (dbPath == null) {
Log.e(mLogTag, "Failed to get a valid db path for profile '" + profile + "'' dbName '" + dbName + "'");
return null;
}
db = getDB(mContext, dbPath);
if (db != null) {
mDatabasePerProfile.put(mapKey, db);
}
}
@@ -227,17 +227,17 @@ public abstract class SQLiteBridgeConten
final String dbPath = profileDir.getPath();
return getDatabaseForDBPath(dbPath);
}
/**
* Returns a SQLiteBridge object according to the specified file path.
* @param dbPath
* the path of the file to be used to retrieve the related SQLiteBridge
- * @return the <code>SQLiteBridge</code> related to the specified file path or <code>null</code> if it was
+ * @return the <code>SQLiteBridge</code> related to the specified file path or <code>null</code> if it was
* not possible to retrieve a valid <code>SQLiteBridge</code>
*
*/
private SQLiteBridge getDatabaseForDBPath(String dbPath) {
SQLiteBridge db = null;
synchronized (this) {
db = mDatabasePerProfile.get(dbPath);
if (db != null) {
@@ -250,17 +250,17 @@ public abstract class SQLiteBridgeConten
}
return db;
}
/**
* Returns a SQLiteBridge object to be used to perform operations on the given <code>Uri</code>.
* @param uri
* the <code>Uri</code> to be used to retrieve the related SQLiteBridge
- * @return a <code>SQLiteBridge</code> object to be used on the given uri or <code>null</code> if it was
+ * @return a <code>SQLiteBridge</code> object to be used on the given uri or <code>null</code> if it was
* not possible to retrieve a valid <code>SQLiteBridge</code>
*
*/
private SQLiteBridge getDatabase(Uri uri) {
String profile = null;
String profilePath = null;
profile = uri.getQueryParameter(BrowserContract.PARAM_PROFILE);
--- a/mobile/android/base/java/org/mozilla/gecko/distribution/Distribution.java
+++ b/mobile/android/base/java/org/mozilla/gecko/distribution/Distribution.java
@@ -562,17 +562,17 @@ public class Distribution {
// We record HTTP statuses as 2xx, 3xx, 4xx, 5xx => 2, 3, 4, 5.
final int value;
if (status > 599 || status < 100) {
Log.wtf(LOGTAG, "Unexpected HTTP status code: " + status);
value = CODE_CATEGORY_STATUS_OUT_OF_RANGE;
} else {
value = status / 100;
}
-
+
Telemetry.addToHistogram(HISTOGRAM_CODE_CATEGORY, value);
if (status != 200) {
Log.w(LOGTAG, "Got status " + status + " fetching distribution.");
Telemetry.addToHistogram(HISTOGRAM_CODE_CATEGORY, CODE_CATEGORY_FETCH_NON_SUCCESS_RESPONSE);
return null;
}
--- a/mobile/android/base/java/org/mozilla/gecko/gfx/DisplayPortCalculator.java
+++ b/mobile/android/base/java/org/mozilla/gecko/gfx/DisplayPortCalculator.java
@@ -375,17 +375,17 @@ final class DisplayPortCalculator {
if (velocity.x > VELOCITY_THRESHOLD) {
margins.left = xAmount * REVERSE_BUFFER;
} else if (velocity.x < -VELOCITY_THRESHOLD) {
margins.left = xAmount * (1.0f - REVERSE_BUFFER);
} else {
margins.left = xAmount / 2.0f;
}
margins.right = xAmount - margins.left;
-
+
if (velocity.y > VELOCITY_THRESHOLD) {
margins.top = yAmount * REVERSE_BUFFER;
} else if (velocity.y < -VELOCITY_THRESHOLD) {
margins.top = yAmount * (1.0f - REVERSE_BUFFER);
} else {
margins.top = yAmount / 2.0f;
}
margins.bottom = yAmount - margins.top;
--- a/mobile/android/base/java/org/mozilla/gecko/gfx/TextureGenerator.java
+++ b/mobile/android/base/java/org/mozilla/gecko/gfx/TextureGenerator.java
@@ -62,16 +62,16 @@ public class TextureGenerator {
int[] textures = new int[numNeeded];
GLES20.glGenTextures(numNeeded, textures, 0);
error = GLES20.glGetError();
if (error != GLES20.GL_NO_ERROR) {
Log.e(LOGTAG, String.format("Failed to generate textures: %#x", error), new Exception());
return;
}
-
+
for (int i = 0; i < numNeeded; i++) {
mTextureIds.offer(textures[i]);
}
}
}
--- a/mobile/android/base/java/org/mozilla/gecko/lwt/LightweightTheme.java
+++ b/mobile/android/base/java/org/mozilla/gecko/lwt/LightweightTheme.java
@@ -47,17 +47,17 @@ public class LightweightTheme implements
private final Application mApplication;
private Bitmap mBitmap;
private int mColor;
private boolean mIsLight;
public static interface OnChangeListener {
- // The View should change its background/text color.
+ // The View should change its background/text color.
public void onLightweightThemeChanged();
// The View should reset to its default background/text color.
public void onLightweightThemeReset();
}
private final List<OnChangeListener> mListeners;
--- a/mobile/android/base/java/org/mozilla/gecko/menu/GeckoMenu.java
+++ b/mobile/android/base/java/org/mozilla/gecko/menu/GeckoMenu.java
@@ -29,17 +29,17 @@ import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.ListView;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-public class GeckoMenu extends ListView
+public class GeckoMenu extends ListView
implements Menu,
AdapterView.OnItemClickListener,
GeckoMenuItem.OnShowAsActionChangedListener {
private static final String LOGTAG = "GeckoMenu";
/**
* Controls whether off-UI-thread method calls in this class cause an
* exception or just logging.
@@ -71,17 +71,17 @@ public class GeckoMenu extends ListView
// Close the menu.
public void closeMenu();
}
/*
* An interface for a presenter of action-items.
* Either an Activity or a View can be a presenter, that can watch for events
- * and add/remove action-items. If not ActionItemBarPresenter, the menu uses a
+ * and add/remove action-items. If not ActionItemBarPresenter, the menu uses a
* DefaultActionItemBar, that shows the action-items as a header over list-view.
*/
public static interface ActionItemBarPresenter {
// Add an action-item.
public boolean addActionItem(View actionItem);
// Remove an action-item.
public void removeActionItem(View actionItem);
@@ -504,17 +504,17 @@ public class GeckoMenu extends ListView
// Remove it from own menu.
if (mPrimaryActionItems.containsKey(item)) {
if (mPrimaryActionItemBar != null)
mPrimaryActionItemBar.removeActionItem(mPrimaryActionItems.get(item));
mPrimaryActionItems.remove(item);
mItems.remove(item);
- if (mPrimaryActionItems.size() == 0 &&
+ if (mPrimaryActionItems.size() == 0 &&
mPrimaryActionItemBar instanceof DefaultActionItemBar) {
removePrimaryActionBarView();
}
return;
}
if (mSecondaryActionItems.containsKey(item)) {
@@ -835,17 +835,17 @@ public class GeckoMenu extends ListView
listView.performItemClick(actionView, pos + listView.getHeaderViewsCount(), id);
}
});
}
// Initialize the view.
view.setShowIcon(mShowIcons);
view.initialize(item);
- return (View) view;
+ return (View) view;
}
@Override
public int getItemViewType(int position) {
return getItem(position).getGeckoActionProvider() == null ? VIEW_TYPE_DEFAULT : VIEW_TYPE_ACTION_MODE;
}
@Override
--- a/mobile/android/base/java/org/mozilla/gecko/menu/GeckoSubMenu.java
+++ b/mobile/android/base/java/org/mozilla/gecko/menu/GeckoSubMenu.java
@@ -6,17 +6,17 @@ package org.mozilla.gecko.menu;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.MenuItem;
import android.view.SubMenu;
import android.view.View;
-public class GeckoSubMenu extends GeckoMenu
+public class GeckoSubMenu extends GeckoMenu
implements SubMenu {
private static final String LOGTAG = "GeckoSubMenu";
// MenuItem associated with this submenu.
private MenuItem mMenuItem;
public GeckoSubMenu(Context context) {
super(context);
@@ -60,17 +60,17 @@ public class GeckoSubMenu extends GeckoM
}
@Override
public SubMenu setHeaderTitle(int titleRes) {
return this;
}
@Override
- public SubMenu setHeaderView(View view) {
+ public SubMenu setHeaderView(View view) {
return this;
}
@Override
public SubMenu setIcon(Drawable icon) {
return this;
}
--- a/mobile/android/base/java/org/mozilla/gecko/menu/MenuItemDefault.java
+++ b/mobile/android/base/java/org/mozilla/gecko/menu/MenuItemDefault.java
@@ -73,17 +73,17 @@ public class MenuItemDefault extends Tex
return drawableState;
}
@Override
public void initialize(GeckoMenuItem item) {
if (item == null)
return;
- setTitle(item.getTitle());
+ setTitle(item.getTitle());
setIcon(item.getIcon());
setEnabled(item.isEnabled());
setCheckable(item.isCheckable());
setChecked(item.isChecked());
setSubMenuIndicator(item.hasSubMenu());
}
private void refreshIcon() {
--- a/mobile/android/base/java/org/mozilla/gecko/menu/MenuPanel.java
+++ b/mobile/android/base/java/org/mozilla/gecko/menu/MenuPanel.java
@@ -11,17 +11,17 @@ import org.mozilla.gecko.R;
import android.content.Context;
import android.util.AttributeSet;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import android.widget.LinearLayout;
/**
* The outer container for the custom menu. On phones with h/w menu button,
- * this is given to Android which inflates it to the right panel. On phones
+ * this is given to Android which inflates it to the right panel. On phones
* with s/w menu button, this is added to a MenuPopup.
*/
public class MenuPanel extends LinearLayout {
public MenuPanel(Context context, AttributeSet attrs) {
super(context, attrs);
int width = (int) context.getResources().getDimension(R.dimen.menu_item_row_width);
setLayoutParams(new ViewGroup.LayoutParams(width, ViewGroup.LayoutParams.WRAP_CONTENT));
--- a/mobile/android/base/java/org/mozilla/gecko/preferences/MultiChoicePreference.java
+++ b/mobile/android/base/java/org/mozilla/gecko/preferences/MultiChoicePreference.java
@@ -54,17 +54,17 @@ class MultiChoicePreference extends Dial
* {@link #setEntryValues(CharSequence[])} and
* {@link #setInitialValues(CharSequence[])}.
*
* @param entries The entries.
*/
public void setEntries(CharSequence[] entries) {
mEntries = entries.clone();
}
-
+
/**
* @param entriesResId The entries array as a resource.
*/
public void setEntries(int entriesResId) {
setEntries(getContext().getResources().getTextArray(entriesResId));
}
/**
@@ -103,51 +103,51 @@ class MultiChoicePreference extends Dial
* @param initialValuesResId The initialValues array as a resource.
*/
public void setInitialValues(int initialValuesResId) {
setInitialValues(getContext().getResources().getTextArray(initialValuesResId));
}
/**
* The list of translated strings corresponding to each preference.
- *
+ *
* @return The array of entries.
*/
public CharSequence[] getEntries() {
return mEntries.clone();
}
/**
* The list of values corresponding to each preference.
- *
+ *
* @return The array of values.
*/
public CharSequence[] getEntryValues() {
return mEntryValues.clone();
}
/**
* The list of initial values for each preference. Each string in this list
* should be either "true" or "false".
- *
+ *
* @return The array of initial values.
*/
public CharSequence[] getInitialValues() {
return mInitialValues.clone();
}
public void setValue(final int i, final boolean value) {
mValues[i] = value;
mPrevValues = mValues.clone();
}
/**
* The list of values for each preference. These values are updated after
* the dialog has been displayed.
- *
+ *
* @return The array of values.
*/
public Set<String> getValues() {
final Set<String> values = new HashSet<String>();
if (mValues == null) {
return values;
}
--- a/mobile/android/base/java/org/mozilla/gecko/prompts/IconGridInput.java
+++ b/mobile/android/base/java/org/mozilla/gecko/prompts/IconGridInput.java
@@ -140,17 +140,17 @@ public class IconGridInput extends Promp
}
final ImageView icon = (ImageView) v.findViewById(R.id.icon);
icon.setImageDrawable(item.icon);
ViewGroup.LayoutParams lp = icon.getLayoutParams();
lp.width = lp.height = mIconSize;
}
}
-
+
private class IconGridItem {
final String label;
final String description;
final boolean selected;
Drawable icon;
public IconGridItem(final Context context, final JSONObject obj) {
label = obj.optString("name");
--- a/mobile/android/base/java/org/mozilla/gecko/prompts/Prompt.java
+++ b/mobile/android/base/java/org/mozilla/gecko/prompts/Prompt.java
@@ -275,17 +275,17 @@ public class Prompt implements OnClickLi
/* Adds a set of list items to the prompt. This can be used for either context menu type dialogs, checked lists,
* or multiple selection lists.
*
* @param builder
* The alert builder currently building this dialog.
* @param listItems
* The items to add.
* @param choiceMode
- * One of the ListView.CHOICE_MODE constants to designate whether this list shows checkmarks, radios buttons, or nothing.
+ * One of the ListView.CHOICE_MODE constants to designate whether this list shows checkmarks, radios buttons, or nothing.
*/
private void addListItems(AlertDialog.Builder builder, PromptListItem[] listItems, int choiceMode) {
switch(choiceMode) {
case ListView.CHOICE_MODE_MULTIPLE_MODAL:
case ListView.CHOICE_MODE_MULTIPLE:
addMultiSelectList(builder, listItems);
break;
case ListView.CHOICE_MODE_SINGLE:
--- a/mobile/android/base/java/org/mozilla/gecko/prompts/PromptInput.java
+++ b/mobile/android/base/java/org/mozilla/gecko/prompts/PromptInput.java
@@ -213,17 +213,17 @@ public class PromptInput {
calendar.setTime(new SimpleDateFormat("HH:mm").parse(mValue));
} catch (Exception e) { }
}
input.setCurrentHour(calendar.get(GregorianCalendar.HOUR_OF_DAY));
input.setCurrentMinute(calendar.get(GregorianCalendar.MINUTE));
mView = (View)input;
} else if (mType.equals("datetime-local") || mType.equals("datetime")) {
DateTimePicker input = new DateTimePicker(context, "yyyy-MM-dd HH:mm", mValue.replace("T"," ").replace("Z", ""),
- DateTimePicker.PickersState.DATETIME,
+ DateTimePicker.PickersState.DATETIME,
mMinValue.replace("T"," ").replace("Z",""), mMaxValue.replace("T"," ").replace("Z", ""));
input.toggleCalendar(true);
mView = (View)input;
} else if (mType.equals("month")) {
DateTimePicker input = new DateTimePicker(context, "yyyy-MM", mValue,
DateTimePicker.PickersState.MONTH, mMinValue, mMaxValue);
mView = (View)input;
}
--- a/mobile/android/base/java/org/mozilla/gecko/util/HardwareCodecCapabilityUtils.java
+++ b/mobile/android/base/java/org/mozilla/gecko/util/HardwareCodecCapabilityUtils.java
@@ -101,17 +101,17 @@ public final class HardwareCodecCapabili
}
}
}
// No HW encoder.
return false;
}
public static boolean getHWDecoderCapability() {
- if (Versions.feature20Plus) {
+ if (Versions.feature20Plus) {
for (int i = 0; i < MediaCodecList.getCodecCount(); ++i) {
MediaCodecInfo info = MediaCodecList.getCodecInfoAt(i);
if (info.isEncoder()) {
continue;
}
String name = null;
for (String mimeType : info.getSupportedTypes()) {
if (mimeType.equals(VP8_MIME_TYPE)) {
--- a/mobile/android/base/java/org/mozilla/gecko/util/INIParser.java
+++ b/mobile/android/base/java/org/mozilla/gecko/util/INIParser.java
@@ -32,24 +32,24 @@ public final class INIParser extends INI
public void write() {
writeTo(mFile);
}
// write to the specified file. Will overwrite anything current inside
public void writeTo(File f) {
if (f == null)
return;
-
+
FileWriter outputStream = null;
try {
outputStream = new FileWriter(f);
} catch (IOException e1) {
e1.printStackTrace();
}
-
+
BufferedWriter writer = new BufferedWriter(outputStream);
try {
write(writer);
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
@@ -80,56 +80,56 @@ public final class INIParser extends INI
}
// parse the default file
@Override
protected void parse() throws IOException {
super.parse();
parse(mFile);
}
-
+
// parse a passed in file
private void parse(File f) throws IOException {
// Set up internal data members
mSections = new Hashtable<String, INISection>();
-
+
if (f == null || !f.exists())
return;
-
+
FileReader inputStream = null;
try {
inputStream = new FileReader(f);
} catch (FileNotFoundException e1) {
// If the file doesn't exist. Just return;
return;
}
-
+
BufferedReader buf = new BufferedReader(inputStream);
String line = null; // current line of text we are parsing
INISection currentSection = null; // section we are currently parsing
-
+
while ((line = buf.readLine()) != null) {
-
+
if (line != null)
line = line.trim();
-
+
// blank line or a comment. ignore it
if (line == null || line.length() == 0 || line.charAt(0) == ';') {
debug("Ignore line: " + line);
} else if (line.charAt(0) == '[') {
debug("Parse as section: " + line);
currentSection = new INISection(line.substring(1, line.length()-1));
mSections.put(currentSection.getName(), currentSection);
} else {
debug("Parse as property: " + line);
-
+
String[] pieces = line.split("=");
if (pieces.length != 2)
continue;
-
+
String key = pieces[0].trim();
String value = pieces[1].trim();
if (currentSection != null) {
currentSection.setProperty(key, value);
} else {
mProperties.put(key, value);
}
}
@@ -145,17 +145,17 @@ public final class INIParser extends INI
}
// get a section from the file. will return null if the section doesn't exist
public INISection getSection(String key) {
// ensure that we have parsed the file
getSections();
return mSections.get(key);
}
-
+
// remove an entire section from the file
public void removeSection(String name) {
// ensure that we have parsed the file
getSections();
mSections.remove(name);
}
// rename a section; nuking any previous section with the new
--- a/mobile/android/base/java/org/mozilla/gecko/util/INISection.java
+++ b/mobile/android/base/java/org/mozilla/gecko/util/INISection.java
@@ -33,17 +33,17 @@ public class INISection {
}
// log a debug string to the console
protected void debug(String msg) {
if (mDebug) {
Log.i(LOGTAG, msg);
}
}
-
+
// get a global property out of the hash table. will return null if the property doesn't exist
public Object getProperty(String key) {
getProperties(); // ensure that we have parsed the file
return mProperties.get(key);
}
// get a global property out of the hash table. will return null if the property doesn't exist
public int getIntProperty(String key) {
@@ -81,19 +81,19 @@ public class INISection {
}
// set a property. Will erase the property if value = null
public void setProperty(String key, Object value) {
getProperties(); // ensure that we have parsed the file
if (value == null)
removeProperty(key);
else
- mProperties.put(key.trim(), value);
- }
-
+ mProperties.put(key.trim(), value);
+ }
+
// remove a property
public void removeProperty(String name) {
// ensure that we have parsed the file
getProperties();
mProperties.remove(name);
}
public void write(BufferedWriter writer) throws IOException {
--- a/mobile/android/base/java/org/mozilla/gecko/util/UIAsyncTask.java
+++ b/mobile/android/base/java/org/mozilla/gecko/util/UIAsyncTask.java
@@ -14,17 +14,17 @@ import android.os.Looper;
* The standard {@link android.os.AsyncTask} only runs onPostExecute on the
* thread it is constructed on, so this is a convenience class for creating
* tasks off the UI thread.
*
* We use generics differently to Android's AsyncTask.
* Android uses a "Params" type parameter to represent the type of all the parameters to this task.
* It then uses arguments of type Params... to permit arbitrarily-many of these to be passed
* fluently.
- *
+ *
* Unfortunately, since Java does not support generic array types (and since varargs desugars to a
* single array parameter) that behaviour exposes a hole in the type system. See:
* http://docs.oracle.com/javase/tutorial/java/generics/nonReifiableVarargsType.html#vulnerabilities
*
* Instead, we equivalently have a single type parameter "Param". A UiAsyncTask may take exactly one
* parameter of type Param. Since Param can be an array type, this no more restrictive than the
* other approach, it just provides additional type safety.
*/
--- a/mobile/android/base/java/org/mozilla/gecko/widget/DateTimePicker.java
+++ b/mobile/android/base/java/org/mozilla/gecko/widget/DateTimePicker.java
@@ -382,17 +382,17 @@ public class DateTimePicker extends Fram
mYearSpinnerInput = (EditText) mYearSpinner.getChildAt(1);
mAMPMSpinner = setupSpinner(R.id.ampm, 0, 1);
mAMPMSpinner.setFormatter(TWO_DIGIT_FORMATTER);
if (mIs12HourMode) {
mHourSpinner = setupSpinner(R.id.hour, 1, 12);
mAMPMSpinnerInput = (EditText) mAMPMSpinner.getChildAt(1);
- mAMPMSpinner.setDisplayedValues(mShortAMPMs);
+ mAMPMSpinner.setDisplayedValues(mShortAMPMs);
} else {
mHourSpinner = setupSpinner(R.id.hour, 0, 23);
mAMPMSpinnerInput = null;
}
mHourSpinner.setFormatter(TWO_DIGIT_FORMATTER);
mHourSpinnerInput = (EditText) mHourSpinner.getChildAt(1);
--- a/mobile/android/base/java/org/mozilla/gecko/widget/GeckoActionProvider.java
+++ b/mobile/android/base/java/org/mozilla/gecko/widget/GeckoActionProvider.java
@@ -144,17 +144,17 @@ public class GeckoActionProvider {
// Activity count is determined by the number of activities that can handle
// the particular intent. When no intent is set, the activity count is 0,
// while the history count can be a valid number.
if (historySize > dataModel.getActivityCount()) {
return view;
}
for (int i = 0; i < historySize; i++) {
- view.addActionButton(dataModel.getActivity(i).loadIcon(packageManager),
+ view.addActionButton(dataModel.getActivity(i).loadIcon(packageManager),
dataModel.getActivity(i).loadLabel(packageManager));
}
return view;
}
public boolean hasSubMenu() {
return true;
--- a/mobile/android/base/java/org/mozilla/gecko/widget/TwoWayView.java
+++ b/mobile/android/base/java/org/mozilla/gecko/widget/TwoWayView.java
@@ -1433,17 +1433,17 @@ public class TwoWayView extends AdapterV
final float diff = pos - mLastTouchPos + mTouchRemainderPos;
final int delta = (int) diff;
mTouchRemainderPos = diff - delta;
if (maybeStartScrolling(delta)) {
return true;
}
-
+
break;
}
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
mActivePointerId = INVALID_POINTER;
mTouchMode = TOUCH_MODE_REST;
recycleVelocityTracker();