Small improvement

pull/72/head
M66B 6 years ago
parent c3f5298fcd
commit 9ff3718561

@ -43,6 +43,17 @@ public class FragmentFolder extends FragmentEx {
private ProgressBar pbSave; private ProgressBar pbSave;
private ProgressBar pbWait; private ProgressBar pbWait;
private long id = -1;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Get arguments
Bundle args = getArguments();
id = (args == null ? -1 : args.getLong("id"));
}
@Override @Override
@Nullable @Nullable
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
@ -50,10 +61,6 @@ public class FragmentFolder extends FragmentEx {
view = (ViewGroup) inflater.inflate(R.layout.fragment_folder, container, false); view = (ViewGroup) inflater.inflate(R.layout.fragment_folder, container, false);
// Get arguments
Bundle args = getArguments();
final long id = (args == null ? -1 : args.getLong("id"));
// Get controls // Get controls
cbSynchronize = view.findViewById(R.id.cbSynchronize); cbSynchronize = view.findViewById(R.id.cbSynchronize);
etAfter = view.findViewById(R.id.etAfter); etAfter = view.findViewById(R.id.etAfter);
@ -133,10 +140,6 @@ public class FragmentFolder extends FragmentEx {
public void onActivityCreated(@Nullable final Bundle savedInstanceState) { public void onActivityCreated(@Nullable final Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
// Get arguments
Bundle args = getArguments();
long id = (args == null ? -1 : args.getLong("id"));
// Observe // Observe
DB.getInstance(getContext()).folder().liveFolder(id).observe(getViewLifecycleOwner(), new Observer<EntityFolder>() { DB.getInstance(getContext()).folder().liveFolder(id).observe(getViewLifecycleOwner(), new Observer<EntityFolder>() {
boolean once = false; boolean once = false;

Loading…
Cancel
Save