Fixed weird selection behavior when multiple rows are long-clicked. Fixed rendering artifact issue on 2.x devices when Your Train card is dismissed.
This commit is contained in:
parent
ce71cb6e09
commit
c310a00a55
@ -346,6 +346,9 @@ public class ViewDeparturesActivity extends SActivity implements
|
||||
@Override
|
||||
public boolean onItemLongClick(AdapterView<?> adapterView, View view,
|
||||
int position, long id) {
|
||||
if (mSelectedRow != null) {
|
||||
((Checkable) mSelectedRow).setChecked(false);
|
||||
}
|
||||
mWasLongClick = true;
|
||||
mSelectedDeparture = (Departure) getListAdapter().getItem(position);
|
||||
mSelectedRow = view;
|
||||
@ -760,36 +763,11 @@ public class ViewDeparturesActivity extends SActivity implements
|
||||
refreshBoardedDeparture(true);
|
||||
|
||||
getListAdapter().notifyDataSetChanged();
|
||||
|
||||
refreshListSelection();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void refreshListSelection() {
|
||||
getListView().clearChoices();
|
||||
final Departure targetDeparture;
|
||||
if (isDepartureActionModeActive() && mSelectedDeparture != null) {
|
||||
targetDeparture = mSelectedDeparture;
|
||||
} else {
|
||||
targetDeparture = getBoardedDeparture();
|
||||
}
|
||||
for (int i = getListAdapter().getCount() - 1; i >= 0; i--) {
|
||||
if (getListAdapter().getItem(i).equals(targetDeparture)) {
|
||||
final int selectedIndex = i;
|
||||
getListView().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getListView().setSelection(selectedIndex);
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
getListView().requestLayout();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(final String errorMessage) {
|
||||
runOnUiThread(new Runnable() {
|
||||
|
@ -247,7 +247,13 @@ public class SwipeHelper implements View.OnTouchListener {
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
mCallback.onDismiss(mView, mToken);
|
||||
// Reset view presentation
|
||||
setAlpha(mView, 1f);
|
||||
|
||||
/*
|
||||
* Alpha stays at 0, otherwise Android 2.x leaves weird
|
||||
* artifacts
|
||||
*/
|
||||
// setAlpha(mView, 1f);
|
||||
|
||||
setTranslationX(mView, 0);
|
||||
lp.height = originalHeight;
|
||||
mView.setLayoutParams(lp);
|
||||
|
Loading…
Reference in New Issue
Block a user