Commit 3adc7ca2 authored by d8ahazard's avatar d8ahazard Committed by topjohnwu

Fix snackbar position

parent 441e603b
...@@ -40,11 +40,12 @@ public class ModulesFragment extends Fragment { ...@@ -40,11 +40,12 @@ public class ModulesFragment extends Fragment {
private SharedPreferences prefs; private SharedPreferences prefs;
public static List<Module> listModules = new ArrayList<>(); public static List<Module> listModules = new ArrayList<>();
private View viewMain;
@Nullable @Nullable
@Override @Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View viewMain = inflater.inflate(R.layout.modules_fragment, container, false); viewMain = inflater.inflate(R.layout.modules_fragment, container, false);
ButterKnife.bind(this, viewMain); ButterKnife.bind(this, viewMain);
mSwipeRefreshLayout.setRefreshing(true); mSwipeRefreshLayout.setRefreshing(true);
...@@ -96,6 +97,7 @@ public class ModulesFragment extends Fragment { ...@@ -96,6 +97,7 @@ public class ModulesFragment extends Fragment {
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
viewMain = this.getView();
getActivity().setTitle("Modules"); getActivity().setTitle("Modules");
} }
...@@ -123,19 +125,19 @@ public class ModulesFragment extends Fragment { ...@@ -123,19 +125,19 @@ public class ModulesFragment extends Fragment {
if (!chbox.isChecked()) { if (!chbox.isChecked()) {
listModules.get(position).createDisableFile(); listModules.get(position).createDisableFile();
Snackbar.make(chk, R.string.disable_file_created, Snackbar.LENGTH_SHORT).show(); Snackbar.make(viewMain, R.string.disable_file_created, Snackbar.LENGTH_SHORT).show();
} else { } else {
listModules.get(position).removeDisableFile(); listModules.get(position).removeDisableFile();
Snackbar.make(chk, R.string.disable_file_removed, Snackbar.LENGTH_SHORT).show(); Snackbar.make(viewMain, R.string.disable_file_removed, Snackbar.LENGTH_SHORT).show();
} }
}, (deleteBtn, position) -> { }, (deleteBtn, position) -> {
// On delete button click listener // On delete button click listener
listModules.get(position).createRemoveFile(); listModules.get(position).createRemoveFile();
Snackbar.make(deleteBtn, R.string.remove_file_created, Snackbar.LENGTH_SHORT).show(); Snackbar.make(viewMain, R.string.remove_file_created, Snackbar.LENGTH_SHORT).show();
}, (undeleteBtn, position) -> { }, (undeleteBtn, position) -> {
// On undelete button click listener // On undelete button click listener
listModules.get(position).deleteRemoveFile(); listModules.get(position).deleteRemoveFile();
Snackbar.make(undeleteBtn, R.string.remove_file_deleted, Snackbar.LENGTH_SHORT).show(); Snackbar.make(viewMain, R.string.remove_file_deleted, Snackbar.LENGTH_SHORT).show();
})); }));
mSwipeRefreshLayout.setRefreshing(false); mSwipeRefreshLayout.setRefreshing(false);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment