Removed unnecessary animation of the "Your train" card under certain

scenarios
This commit is contained in:
Doug Keen 2012-10-09 14:22:21 -07:00
parent 8955bd209b
commit 13d4ed51c2

View File

@ -135,7 +135,7 @@ public class ViewDeparturesActivity extends SActivity implements
if (mBound && mEtdService != null) if (mBound && mEtdService != null)
mEtdService.registerListener( mEtdService.registerListener(
ViewDeparturesActivity.this, false); ViewDeparturesActivity.this, false);
refreshBoardedDeparture(); refreshBoardedDeparture(false);
getSupportLoaderManager().destroyLoader(LOADER_ID); getSupportLoaderManager().destroyLoader(LOADER_ID);
} }
@ -201,7 +201,7 @@ public class ViewDeparturesActivity extends SActivity implements
}); });
mYourTrainSection.setOnTouchListener(mSwipeHelper); mYourTrainSection.setOnTouchListener(mSwipeHelper);
refreshBoardedDeparture(); refreshBoardedDeparture(false);
getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
@ -423,7 +423,7 @@ public class ViewDeparturesActivity extends SActivity implements
getWindow() getWindow()
.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); .addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
Ticker.getInstance().startTicking(this); Ticker.getInstance().startTicking(this);
refreshBoardedDeparture(); refreshBoardedDeparture(false);
} }
} }
@ -462,7 +462,7 @@ public class ViewDeparturesActivity extends SActivity implements
} }
} }
private void refreshBoardedDeparture() { private void refreshBoardedDeparture(boolean animate) {
final Departure boardedDeparture = ((BartRunnerApplication) getApplication()) final Departure boardedDeparture = ((BartRunnerApplication) getApplication())
.getBoardedDeparture(); .getBoardedDeparture();
int currentVisibility = mYourTrainSection.getVisibility(); int currentVisibility = mYourTrainSection.getVisibility();
@ -481,7 +481,7 @@ public class ViewDeparturesActivity extends SActivity implements
mYourTrainSection.updateFromDeparture(boardedDeparture); mYourTrainSection.updateFromDeparture(boardedDeparture);
if (currentVisibility != View.VISIBLE) { if (currentVisibility != View.VISIBLE) {
showYourTrainSection(); showYourTrainSection(animate);
} }
} }
@ -489,7 +489,7 @@ public class ViewDeparturesActivity extends SActivity implements
final BartRunnerApplication application = (BartRunnerApplication) getApplication(); final BartRunnerApplication application = (BartRunnerApplication) getApplication();
selectedDeparture.setPassengerDestination(mDestination); selectedDeparture.setPassengerDestination(mDestination);
application.setBoardedDeparture(selectedDeparture); application.setBoardedDeparture(selectedDeparture);
refreshBoardedDeparture(); refreshBoardedDeparture(true);
// Start the notification service // Start the notification service
startService(new Intent(ViewDeparturesActivity.this, startService(new Intent(ViewDeparturesActivity.this,
@ -576,7 +576,7 @@ public class ViewDeparturesActivity extends SActivity implements
if (boardedDeparture == null) { if (boardedDeparture == null) {
mode.finish(); mode.finish();
refreshBoardedDeparture(); refreshBoardedDeparture(true);
return true; return true;
} }
@ -746,7 +746,7 @@ public class ViewDeparturesActivity extends SActivity implements
} }
} }
refreshBoardedDeparture(); refreshBoardedDeparture(true);
getListAdapter().notifyDataSetChanged(); getListAdapter().notifyDataSetChanged();
@ -824,10 +824,12 @@ public class ViewDeparturesActivity extends SActivity implements
mYourTrainSection.setVisibility(View.GONE); mYourTrainSection.setVisibility(View.GONE);
} }
private void showYourTrainSection() { private void showYourTrainSection(boolean animate) {
mYourTrainSection.setVisibility(View.VISIBLE); mYourTrainSection.setVisibility(View.VISIBLE);
if (animate) {
mSwipeHelper.showWithAnimation(); mSwipeHelper.showWithAnimation();
} }
}
private boolean isYourTrainActionModeActive() { private boolean isYourTrainActionModeActive() {
return mActionMode != null return mActionMode != null