Skip to content

Commit

Permalink
Preserve report type accross rotation
Browse files Browse the repository at this point in the history
* fixes #633
  • Loading branch information
GianpaMX authored and codinguser committed Jan 23, 2017
1 parent a003d51 commit 83808b6
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public class ReportsActivity extends BaseDrawerActivity implements AdapterView.O
Color.parseColor("#ba037c"), Color.parseColor("#708809"), Color.parseColor("#32072c"),
Color.parseColor("#fddef8"), Color.parseColor("#fa0e6e"), Color.parseColor("#d9e7b5")
};
private static final String STATE_REPORT_TYPE = "STATE_REPORT_TYPE";

@Bind(R.id.time_range_spinner) Spinner mTimeRangeSpinner;
@Bind(R.id.report_account_type_spinner) Spinner mAccountTypeSpinner;
Expand Down Expand Up @@ -123,8 +124,11 @@ public int getTitleRes() {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState != null) {
mReportType = (ReportType) savedInstanceState.getSerializable(STATE_REPORT_TYPE);
}

super.onCreate(savedInstanceState);
mTransactionsDbAdapter = TransactionsDbAdapter.getInstance();

ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.report_time_range,
Expand Down Expand Up @@ -414,4 +418,11 @@ public void refresh() {
public void refresh(String uid) {
refresh();
}

@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);

outState.putSerializable(STATE_REPORT_TYPE, mReportType);
}
}

0 comments on commit 83808b6

Please sign in to comment.