Skip to content

fixed add button disappearing after rotation #812

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Mar 1, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.app.ListFragment;
import android.support.v4.app.LoaderManager;
Expand Down Expand Up @@ -78,6 +79,7 @@ public class ScheduledActionsListFragment extends ListFragment implements
* Logging tag
*/
protected static final String TAG = "ScheduledActionFragment";
private static final String FRAGMENT_ACTION_KEY = "action_key";

private TransactionsDbAdapter mTransactionsDbAdapter;
private SimpleCursorAdapter mCursorAdapter;
Expand Down Expand Up @@ -175,6 +177,10 @@ public static Fragment getInstance(ScheduledAction.ActionType actionType){
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

if(savedInstanceState != null && savedInstanceState.containsKey(FRAGMENT_ACTION_KEY)) {
mActionType = (ScheduledAction.ActionType) savedInstanceState.getSerializable(FRAGMENT_ACTION_KEY);
}

mTransactionsDbAdapter = TransactionsDbAdapter.getInstance();
switch (mActionType){
case TRANSACTION:
Expand Down Expand Up @@ -641,5 +647,10 @@ public Cursor loadInBackground() {
}
}

@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
outState.putSerializable(FRAGMENT_ACTION_KEY, mActionType);
super.onSaveInstanceState(outState);
}
}