зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1081597: Refactor some branches. r=rnewman
* * * Bug 1081597: Refactor some branches. r=rnewman
This commit is contained in:
Родитель
ca34eab2f8
Коммит
4340f18e97
|
@ -250,7 +250,8 @@ public final class ANRReporter extends BroadcastReceiver
|
|||
Log.d(LOGTAG, "uptime " + String.valueOf(uptimeMins));
|
||||
}
|
||||
return uptimeMins;
|
||||
} else if (DEBUG) {
|
||||
}
|
||||
if (DEBUG) {
|
||||
Log.d(LOGTAG, "could not get uptime");
|
||||
}
|
||||
return 0L;
|
||||
|
|
|
@ -258,7 +258,9 @@ public class AndroidGamepadManager {
|
|||
// Queue up key events for pending devices.
|
||||
sPendingGamepads.get(deviceId).add(ev);
|
||||
return true;
|
||||
} else if (!sGamepads.containsKey(deviceId)) {
|
||||
}
|
||||
|
||||
if (!sGamepads.containsKey(deviceId)) {
|
||||
InputDevice device = ev.getDevice();
|
||||
if (device != null &&
|
||||
(device.getSources() & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) {
|
||||
|
|
|
@ -402,41 +402,47 @@ public class ContactService implements GeckoEventListener {
|
|||
filterValue = filterValue.toLowerCase();
|
||||
databaseValue = databaseValue.toLowerCase();
|
||||
|
||||
if ("match".equals(filterOp)) {
|
||||
// If substring matching is a positive number, only pay attention to the last X characters
|
||||
// of both the filter and database values
|
||||
if (substringMatching > 0) {
|
||||
databaseValue = substringStartFromEnd(cleanPhoneNumber(databaseValue), substringMatching);
|
||||
filterValue = substringStartFromEnd(cleanPhoneNumber(filterValue), substringMatching);
|
||||
return databaseValue.startsWith(filterValue);
|
||||
}
|
||||
return databaseValue.equals(filterValue);
|
||||
} else if ("equals".equals(filterOp)) {
|
||||
if (isPhone) {
|
||||
return PhoneNumberUtils.compare(filterValue, databaseValue);
|
||||
}
|
||||
return databaseValue.equals(filterValue);
|
||||
} else if ("contains".equals(filterOp)) {
|
||||
if (isPhone) {
|
||||
filterValue = cleanPhoneNumber(filterValue);
|
||||
databaseValue = cleanPhoneNumber(databaseValue);
|
||||
}
|
||||
return databaseValue.contains(filterValue);
|
||||
} else if ("startsWith".equals(filterOp)) {
|
||||
// If a phone number, remove non-dialable characters and then only pay attention to
|
||||
// the last X digits given by the substring matching values (see bug 877302)
|
||||
if (isPhone) {
|
||||
String cleanedDatabasePhone = cleanPhoneNumber(databaseValue);
|
||||
switch (filterOp) {
|
||||
case "match":
|
||||
// If substring matching is a positive number, only pay attention to the last X characters
|
||||
// of both the filter and database values
|
||||
if (substringMatching > 0) {
|
||||
cleanedDatabasePhone = substringStartFromEnd(cleanedDatabasePhone, substringMatching);
|
||||
databaseValue = substringStartFromEnd(cleanPhoneNumber(databaseValue), substringMatching);
|
||||
filterValue = substringStartFromEnd(cleanPhoneNumber(filterValue), substringMatching);
|
||||
return databaseValue.startsWith(filterValue);
|
||||
}
|
||||
|
||||
if (cleanedDatabasePhone.startsWith(filterValue)) {
|
||||
return true;
|
||||
return databaseValue.equals(filterValue);
|
||||
case "equals":
|
||||
if (isPhone) {
|
||||
return PhoneNumberUtils.compare(filterValue, databaseValue);
|
||||
}
|
||||
}
|
||||
return databaseValue.startsWith(filterValue);
|
||||
|
||||
return databaseValue.equals(filterValue);
|
||||
case "contains":
|
||||
if (isPhone) {
|
||||
filterValue = cleanPhoneNumber(filterValue);
|
||||
databaseValue = cleanPhoneNumber(databaseValue);
|
||||
}
|
||||
|
||||
return databaseValue.contains(filterValue);
|
||||
case "startsWith":
|
||||
// If a phone number, remove non-dialable characters and then only pay attention to
|
||||
// the last X digits given by the substring matching values (see bug 877302)
|
||||
if (isPhone) {
|
||||
String cleanedDatabasePhone = cleanPhoneNumber(databaseValue);
|
||||
if (substringMatching > 0) {
|
||||
cleanedDatabasePhone = substringStartFromEnd(cleanedDatabasePhone, substringMatching);
|
||||
}
|
||||
|
||||
if (cleanedDatabasePhone.startsWith(filterValue)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return databaseValue.startsWith(filterValue);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -280,9 +280,12 @@ public class GeckoNetworkManager extends BroadcastReceiver implements NativeEven
|
|||
if (networkOperator == null || networkOperator.length() <= 3) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (type == InfoType.MNC) {
|
||||
return Integer.parseInt(networkOperator.substring(3));
|
||||
} else if (type == InfoType.MCC) {
|
||||
}
|
||||
|
||||
if (type == InfoType.MCC) {
|
||||
return Integer.parseInt(networkOperator.substring(0, 3));
|
||||
}
|
||||
|
||||
|
|
|
@ -298,24 +298,21 @@ public class GeckoScreenOrientation {
|
|||
* otherwise.
|
||||
*/
|
||||
public static ScreenOrientation screenOrientationFromString(String aStr) {
|
||||
if ("portrait".equals(aStr)) {
|
||||
return ScreenOrientation.PORTRAIT_PRIMARY;
|
||||
}
|
||||
else if ("landscape".equals(aStr)) {
|
||||
return ScreenOrientation.LANDSCAPE_PRIMARY;
|
||||
}
|
||||
else if ("portrait-primary".equals(aStr)) {
|
||||
return ScreenOrientation.PORTRAIT_PRIMARY;
|
||||
}
|
||||
else if ("portrait-secondary".equals(aStr)) {
|
||||
return ScreenOrientation.PORTRAIT_SECONDARY;
|
||||
}
|
||||
else if ("landscape-primary".equals(aStr)) {
|
||||
return ScreenOrientation.LANDSCAPE_PRIMARY;
|
||||
}
|
||||
else if ("landscape-secondary".equals(aStr)) {
|
||||
return ScreenOrientation.LANDSCAPE_SECONDARY;
|
||||
switch (aStr) {
|
||||
case "portrait":
|
||||
return ScreenOrientation.PORTRAIT_PRIMARY;
|
||||
case "landscape":
|
||||
return ScreenOrientation.LANDSCAPE_PRIMARY;
|
||||
case "portrait-primary":
|
||||
return ScreenOrientation.PORTRAIT_PRIMARY;
|
||||
case "portrait-secondary":
|
||||
return ScreenOrientation.PORTRAIT_SECONDARY;
|
||||
case "landscape-primary":
|
||||
return ScreenOrientation.LANDSCAPE_PRIMARY;
|
||||
case "landscape-secondary":
|
||||
return ScreenOrientation.LANDSCAPE_SECONDARY;
|
||||
}
|
||||
|
||||
Log.w(LOGTAG, "screenOrientationFromString: unknown orientation string");
|
||||
return DEFAULT_SCREEN_ORIENTATION;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,9 @@ public class FaviconCacheElement implements Comparable<FaviconCacheElement> {
|
|||
final int w2 = another.imageSize;
|
||||
if (w1 > w2) {
|
||||
return 1;
|
||||
} else if (w2 > w1) {
|
||||
}
|
||||
|
||||
if (w2 > w1) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -171,7 +171,9 @@ public class FxAccountStatusActivity extends LocaleAwareFragmentActivity {
|
|||
if (itemId == android.R.id.home) {
|
||||
finish();
|
||||
return true;
|
||||
} else if (itemId == R.id.remove_account) {
|
||||
}
|
||||
|
||||
if (itemId == R.id.remove_account) {
|
||||
maybeDeleteAndroidAccount(FirefoxAccounts.getFirefoxAccount(this));
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -822,7 +822,9 @@ public class BrowserSearch extends HomeFragment
|
|||
|
||||
if (engine == -1) {
|
||||
return ROW_STANDARD;
|
||||
} else if (engine == 0 && mSuggestionsEnabled) {
|
||||
}
|
||||
|
||||
if (engine == 0 && mSuggestionsEnabled) {
|
||||
// Give suggestion views their own type to prevent them from
|
||||
// sharing other recycled search engine views. Using other
|
||||
// recycled views for the suggestion row can break animations
|
||||
|
|
|
@ -168,7 +168,9 @@ public class RemoteTabsExpandableListFragment extends HomeFragment implements Re
|
|||
info.url = tab.url;
|
||||
info.title = tab.title;
|
||||
return info;
|
||||
} else if (type == ExpandableListView.PACKED_POSITION_TYPE_GROUP) {
|
||||
}
|
||||
|
||||
if (type == ExpandableListView.PACKED_POSITION_TYPE_GROUP) {
|
||||
final RemoteClient client = (RemoteClient) adapter.getGroup(groupPosition);
|
||||
final RemoteTabsClientContextMenuInfo info = new RemoteTabsClientContextMenuInfo(view, position, id, client);
|
||||
return info;
|
||||
|
@ -288,11 +290,14 @@ public class RemoteTabsExpandableListFragment extends HomeFragment implements Re
|
|||
sState.setClientHidden(info.client.guid, true);
|
||||
getLoaderManager().restartLoader(LOADER_ID_REMOTE_TABS, null, mCursorLoaderCallbacks);
|
||||
return true;
|
||||
} else if (itemId == R.id.home_remote_tabs_show_client) {
|
||||
}
|
||||
|
||||
if (itemId == R.id.home_remote_tabs_show_client) {
|
||||
sState.setClientHidden(info.client.guid, false);
|
||||
getLoaderManager().restartLoader(LOADER_ID_REMOTE_TABS, null, mCursorLoaderCallbacks);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,9 @@ public final class DirectBufferAllocator {
|
|||
ByteBuffer directBuffer = nativeAllocateDirectBuffer(size);
|
||||
if (directBuffer == null) {
|
||||
throw new OutOfMemoryError("allocateDirectBuffer() returned null");
|
||||
} else if (!directBuffer.isDirect()) {
|
||||
}
|
||||
|
||||
if (!directBuffer.isDirect()) {
|
||||
throw new AssertionError("allocateDirectBuffer() did not return a direct buffer");
|
||||
}
|
||||
|
||||
|
|
|
@ -192,10 +192,10 @@ class MultiChoicePreference extends DialogPreference implements DialogInterface.
|
|||
// user cancelled; reset checkbox values to their previous state
|
||||
mValues = mPrevValues.clone();
|
||||
return;
|
||||
} else {
|
||||
mPrevValues = mValues.clone();
|
||||
}
|
||||
|
||||
mPrevValues = mValues.clone();
|
||||
|
||||
if (!callChangeListener(getValues())) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -347,31 +347,35 @@ public class PromptInput {
|
|||
|
||||
public static PromptInput getInput(JSONObject obj) {
|
||||
String type = obj.optString("type");
|
||||
if (EditInput.INPUT_TYPE.equals(type)) {
|
||||
return new EditInput(obj);
|
||||
} else if (NumberInput.INPUT_TYPE.equals(type)) {
|
||||
return new NumberInput(obj);
|
||||
} else if (PasswordInput.INPUT_TYPE.equals(type)) {
|
||||
return new PasswordInput(obj);
|
||||
} else if (CheckboxInput.INPUT_TYPE.equals(type)) {
|
||||
return new CheckboxInput(obj);
|
||||
} else if (MenulistInput.INPUT_TYPE.equals(type)) {
|
||||
return new MenulistInput(obj);
|
||||
} else if (LabelInput.INPUT_TYPE.equals(type)) {
|
||||
return new LabelInput(obj);
|
||||
} else if (IconGridInput.INPUT_TYPE.equals(type)) {
|
||||
return new IconGridInput(obj);
|
||||
} else if (ColorPickerInput.INPUT_TYPE.equals(type)) {
|
||||
return new ColorPickerInput(obj);
|
||||
} else if (TabInput.INPUT_TYPE.equals(type)) {
|
||||
return new TabInput(obj);
|
||||
} else {
|
||||
for (String dtType : DateTimeInput.INPUT_TYPES) {
|
||||
if (dtType.equals(type)) {
|
||||
return new DateTimeInput(obj);
|
||||
switch (type) {
|
||||
case EditInput.INPUT_TYPE:
|
||||
return new EditInput(obj);
|
||||
case NumberInput.INPUT_TYPE:
|
||||
return new NumberInput(obj);
|
||||
case PasswordInput.INPUT_TYPE:
|
||||
return new PasswordInput(obj);
|
||||
case CheckboxInput.INPUT_TYPE:
|
||||
return new CheckboxInput(obj);
|
||||
case MenulistInput.INPUT_TYPE:
|
||||
return new MenulistInput(obj);
|
||||
case LabelInput.INPUT_TYPE:
|
||||
return new LabelInput(obj);
|
||||
case IconGridInput.INPUT_TYPE:
|
||||
return new IconGridInput(obj);
|
||||
case ColorPickerInput.INPUT_TYPE:
|
||||
return new ColorPickerInput(obj);
|
||||
case TabInput.INPUT_TYPE:
|
||||
return new TabInput(obj);
|
||||
default:
|
||||
for (String dtType : DateTimeInput.INPUT_TYPES) {
|
||||
if (dtType.equals(type)) {
|
||||
return new DateTimeInput(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -1086,10 +1086,10 @@ public class AndroidBrowserBookmarksRepositorySession extends AndroidBrowserRepo
|
|||
if (typeString == null) {
|
||||
Logger.warn(LOG_TAG, "Unsupported type code " + rowType);
|
||||
return null;
|
||||
} else {
|
||||
Logger.trace(LOG_TAG, "Record " + guid + " has type " + typeString);
|
||||
}
|
||||
|
||||
Logger.trace(LOG_TAG, "Record " + guid + " has type " + typeString);
|
||||
|
||||
rec.type = typeString;
|
||||
rec.title = RepoUtils.getStringFromCursor(cur, BrowserContract.Bookmarks.TITLE);
|
||||
rec.bookmarkURI = RepoUtils.getStringFromCursor(cur, BrowserContract.Bookmarks.URL);
|
||||
|
|
|
@ -207,7 +207,8 @@ public class TabStripItemView extends ThemedLinearLayout
|
|||
lastFavicon = null;
|
||||
faviconView.setImageResource(R.drawable.new_tablet_default_favicon);
|
||||
return;
|
||||
} else if (favicon == lastFavicon) {
|
||||
}
|
||||
if (favicon == lastFavicon) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -256,52 +256,55 @@ public final class JavascriptBridge {
|
|||
}
|
||||
type = message.getString("innerType");
|
||||
|
||||
if ("progress".equals(type)) {
|
||||
// Javascript harness message
|
||||
mLogParser.logMessage(message.getString("message"));
|
||||
return MessageStatus.PROCESSED;
|
||||
switch (type) {
|
||||
case "progress":
|
||||
// Javascript harness message
|
||||
mLogParser.logMessage(message.getString("message"));
|
||||
return MessageStatus.PROCESSED;
|
||||
|
||||
} else if ("notify-loaded".equals(type)) {
|
||||
mJavaBridgeLoaded = true;
|
||||
return MessageStatus.PROCESSED;
|
||||
case "notify-loaded":
|
||||
mJavaBridgeLoaded = true;
|
||||
return MessageStatus.PROCESSED;
|
||||
|
||||
} else if ("sync-reply".equals(type)) {
|
||||
// Reply to Java-to-Javascript sync call
|
||||
return MessageStatus.REPLIED;
|
||||
case "sync-reply":
|
||||
// Reply to Java-to-Javascript sync call
|
||||
return MessageStatus.REPLIED;
|
||||
|
||||
} else if ("sync-call".equals(type) || "async-call".equals(type)) {
|
||||
case "sync-call":
|
||||
case "async-call":
|
||||
|
||||
if ("async-call".equals(type)) {
|
||||
// Save this async message until another async message arrives, then we
|
||||
// process the saved message and save the new one. This is done as a
|
||||
// form of tail call optimization, by making sync-replies come before
|
||||
// async-calls. On the other hand, if (message == mSavedAsyncMessage),
|
||||
// it means we're currently processing the saved message and should clear
|
||||
// mSavedAsyncMessage.
|
||||
final JSONObject newSavedMessage =
|
||||
(message != mSavedAsyncMessage ? message : null);
|
||||
message = mSavedAsyncMessage;
|
||||
mSavedAsyncMessage = newSavedMessage;
|
||||
if (message == null) {
|
||||
// Saved current message and there wasn't an already saved one.
|
||||
return MessageStatus.SAVED;
|
||||
if ("async-call".equals(type)) {
|
||||
// Save this async message until another async message arrives, then we
|
||||
// process the saved message and save the new one. This is done as a
|
||||
// form of tail call optimization, by making sync-replies come before
|
||||
// async-calls. On the other hand, if (message == mSavedAsyncMessage),
|
||||
// it means we're currently processing the saved message and should clear
|
||||
// mSavedAsyncMessage.
|
||||
final JSONObject newSavedMessage =
|
||||
(message != mSavedAsyncMessage ? message : null);
|
||||
message = mSavedAsyncMessage;
|
||||
mSavedAsyncMessage = newSavedMessage;
|
||||
if (message == null) {
|
||||
// Saved current message and there wasn't an already saved one.
|
||||
return MessageStatus.SAVED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
methodName = message.getString("method");
|
||||
argsArray = message.getJSONArray("args");
|
||||
args = new Object[argsArray.length()];
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
args[i] = convertFromJSONValue(argsArray.get(i));
|
||||
}
|
||||
invokeMethod(methodName, args);
|
||||
methodName = message.getString("method");
|
||||
argsArray = message.getJSONArray("args");
|
||||
args = new Object[argsArray.length()];
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
args[i] = convertFromJSONValue(argsArray.get(i));
|
||||
}
|
||||
invokeMethod(methodName, args);
|
||||
|
||||
if ("sync-call".equals(type)) {
|
||||
// Reply for sync messages
|
||||
sendMessage("sync-reply", methodName, null);
|
||||
}
|
||||
return MessageStatus.PROCESSED;
|
||||
if ("sync-call".equals(type)) {
|
||||
// Reply for sync messages
|
||||
sendMessage("sync-reply", methodName, null);
|
||||
}
|
||||
return MessageStatus.PROCESSED;
|
||||
}
|
||||
|
||||
throw new IllegalStateException("Message type is unexpected");
|
||||
|
||||
} catch (final JSONException e) {
|
||||
|
|
|
@ -556,7 +556,9 @@ public class ToolbarEditText extends CustomEditText
|
|||
}
|
||||
|
||||
return true;
|
||||
} else if (GamepadUtils.isBackKey(event)) {
|
||||
}
|
||||
|
||||
if (GamepadUtils.isBackKey(event)) {
|
||||
if (mDismissListener != null) {
|
||||
mDismissListener.onDismiss();
|
||||
}
|
||||
|
|
|
@ -61,7 +61,8 @@ public class InstallListener extends BroadcastReceiver {
|
|||
if (TextUtils.isEmpty(manifestUrl)) {
|
||||
Log.i(LOGTAG, "No manifest URL present in metadata");
|
||||
return;
|
||||
} else if (!isCorrectManifest(manifestUrl)) {
|
||||
}
|
||||
if (!isCorrectManifest(manifestUrl)) {
|
||||
// This happens when the updater triggers installation of multiple
|
||||
// APK updates simultaneously. If we're the receiver for another
|
||||
// update, then simply ignore this intent by returning early.
|
||||
|
|
|
@ -149,10 +149,10 @@ public class WebappImpl extends GeckoApp implements InstallCallback {
|
|||
installHelper.registerGeckoListener();
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
launchWebapp(origin);
|
||||
}
|
||||
|
||||
launchWebapp(origin);
|
||||
|
||||
setTitle(mAppName);
|
||||
}
|
||||
|
||||
|
|
|
@ -1276,7 +1276,9 @@ public class TwoWayView extends AdapterView<ListAdapter> implements
|
|||
|
||||
if (mTouchMode == TOUCH_MODE_FLINGING) {
|
||||
return true;
|
||||
} else if (motionPosition >= 0) {
|
||||
}
|
||||
|
||||
if (motionPosition >= 0) {
|
||||
mMotionPosition = motionPosition;
|
||||
mTouchMode = TOUCH_MODE_DOWN;
|
||||
}
|
||||
|
@ -1376,7 +1378,9 @@ public class TwoWayView extends AdapterView<ListAdapter> implements
|
|||
reportScrollStateChange(OnScrollListener.SCROLL_STATE_TOUCH_SCROLL);
|
||||
motionPosition = findMotionRowOrColumn((int) mLastTouchPos);
|
||||
return true;
|
||||
} else if (mMotionPosition >= 0 && mAdapter.isEnabled(mMotionPosition)) {
|
||||
}
|
||||
|
||||
if (mMotionPosition >= 0 && mAdapter.isEnabled(mMotionPosition)) {
|
||||
mTouchMode = TOUCH_MODE_DOWN;
|
||||
triggerCheckForTap();
|
||||
}
|
||||
|
@ -3849,7 +3853,9 @@ public class TwoWayView extends AdapterView<ListAdapter> implements
|
|||
if (mItemCount == 0) {
|
||||
resetState();
|
||||
return;
|
||||
} else if (mItemCount != mAdapter.getCount()) {
|
||||
}
|
||||
|
||||
if (mItemCount != mAdapter.getCount()) {
|
||||
throw new IllegalStateException("The content of the adapter has changed but "
|
||||
+ "TwoWayView did not receive a notification. Make sure the content of "
|
||||
+ "your adapter is not modified from a background thread, but only "
|
||||
|
@ -4274,31 +4280,30 @@ public class TwoWayView extends AdapterView<ListAdapter> implements
|
|||
mSyncPosition = Math.min(Math.max(0, mSyncPosition), itemCount - 1);
|
||||
|
||||
return;
|
||||
} else {
|
||||
// See if we can find a position in the new data with the same
|
||||
// id as the old selection. This will change mSyncPosition.
|
||||
newPos = findSyncPosition();
|
||||
if (newPos >= 0) {
|
||||
// Found it. Now verify that new selection is still selectable
|
||||
selectablePos = lookForSelectablePosition(newPos, true);
|
||||
if (selectablePos == newPos) {
|
||||
// Same row id is selected
|
||||
mSyncPosition = newPos;
|
||||
}
|
||||
// See if we can find a position in the new data with the same
|
||||
// id as the old selection. This will change mSyncPosition.
|
||||
newPos = findSyncPosition();
|
||||
if (newPos >= 0) {
|
||||
// Found it. Now verify that new selection is still selectable
|
||||
selectablePos = lookForSelectablePosition(newPos, true);
|
||||
if (selectablePos == newPos) {
|
||||
// Same row id is selected
|
||||
mSyncPosition = newPos;
|
||||
|
||||
if (mSyncHeight == getHeight()) {
|
||||
// If we are at the same height as when we saved state, try
|
||||
// to restore the scroll position too.
|
||||
mLayoutMode = LAYOUT_SYNC;
|
||||
} else {
|
||||
// We are not the same height as when the selection was saved, so
|
||||
// don't try to restore the exact position
|
||||
mLayoutMode = LAYOUT_SET_SELECTION;
|
||||
}
|
||||
|
||||
// Restore selection
|
||||
setNextSelectedPositionInt(newPos);
|
||||
return;
|
||||
if (mSyncHeight == getHeight()) {
|
||||
// If we are at the same height as when we saved state, try
|
||||
// to restore the scroll position too.
|
||||
mLayoutMode = LAYOUT_SYNC;
|
||||
} else {
|
||||
// We are not the same height as when the selection was saved, so
|
||||
// don't try to restore the exact position
|
||||
mLayoutMode = LAYOUT_SET_SELECTION;
|
||||
}
|
||||
|
||||
// Restore selection
|
||||
setNextSelectedPositionInt(newPos);
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -5787,11 +5792,10 @@ public class TwoWayView extends AdapterView<ListAdapter> implements
|
|||
View getScrapView(int position) {
|
||||
if (mViewTypeCount == 1) {
|
||||
return retrieveFromScrap(mCurrentScrap, position);
|
||||
} else {
|
||||
int whichScrap = mAdapter.getItemViewType(position);
|
||||
if (whichScrap >= 0 && whichScrap < mScrapViews.length) {
|
||||
return retrieveFromScrap(mScrapViews[whichScrap], position);
|
||||
}
|
||||
}
|
||||
int whichScrap = mAdapter.getItemViewType(position);
|
||||
if (whichScrap >= 0 && whichScrap < mScrapViews.length) {
|
||||
return retrieveFromScrap(mScrapViews[whichScrap], position);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -111,16 +111,20 @@ public final class Reporter extends BroadcastReceiver {
|
|||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
|
||||
if (action.equals(ACTION_FLUSH_TO_BUNDLE)) {
|
||||
flush();
|
||||
return;
|
||||
} else if (action.equals(WifiScanner.ACTION_WIFIS_SCANNED)) {
|
||||
receivedWifiMessage(intent);
|
||||
} else if (action.equals(CellScanner.ACTION_CELLS_SCANNED)) {
|
||||
receivedCellMessage(intent);
|
||||
} else if (action.equals(GPSScanner.ACTION_GPS_UPDATED)) {
|
||||
// Calls reportCollectedLocation, this is the ideal case
|
||||
receivedGpsMessage(intent);
|
||||
switch (action) {
|
||||
case ACTION_FLUSH_TO_BUNDLE:
|
||||
flush();
|
||||
return;
|
||||
case WifiScanner.ACTION_WIFIS_SCANNED:
|
||||
receivedWifiMessage(intent);
|
||||
break;
|
||||
case CellScanner.ACTION_CELLS_SCANNED:
|
||||
receivedCellMessage(intent);
|
||||
break;
|
||||
case GPSScanner.ACTION_GPS_UPDATED:
|
||||
// Calls reportCollectedLocation, this is the ideal case
|
||||
receivedGpsMessage(intent);
|
||||
break;
|
||||
}
|
||||
|
||||
if (mBundle != null &&
|
||||
|
|
Загрузка…
Ссылка в новой задаче