/** * Determine the changeid to load and send an intent to load the change. By sending an intent, the * main activity is notified (GerritControllerActivity on tablets. This can then tell the change * list adapter that we have selected a change. * * @param direct true: load this change directly, false: send out an intent */ private void loadChange(boolean direct) { if (mStatus == null) { // Without the status we cannot find a changeid to load data for return; } Pair<String, Integer> change = SelectedChange.getSelectedChange(mContext, mStatus); String changeID; int changeNumber; if (change == null || change.first.isEmpty()) { change = Changes.getMostRecentChange(mParent, mStatus); if (change == null || change.first.isEmpty()) { // No changes to load data from AnalyticsHelper.sendAnalyticsEvent( mParent, "PatchSetViewerFragment", "load_change", "null_changeID", null); return; } } changeID = change.first; mChangeNumber = change.second; if (direct) loadChange(changeID); else { mEventBus.post(new NewChangeSelected(changeID, mChangeNumber, mStatus, this)); } }