use of me.zeeroooo.materialfb.Misc.BlacklistAdapter in project MaterialFBook by ZeeRooo.
the class NotificationsSettingsFragment method onPreferenceClick.
@Override
public boolean onPreferenceClick(Preference preference) {
String key = preference.getKey();
switch(key) {
case "BlackList":
AlertDialog.Builder BlacklistDialog = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = LayoutInflater.from(getActivity());
View view = inflater.inflate(R.layout.blacklist, null);
final EditText blword = view.findViewById(R.id.blword_new);
BlacklistDialog.setView(view);
BlacklistDialog.setTitle(R.string.blacklist_title);
adapter = new BlacklistAdapter(getActivity(), blacklist, DBHelper);
ListView BlackListView = view.findViewById(R.id.BlackListView);
BlackListView.setAdapter(adapter);
BlacklistDialog.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
String word = blword.getText().toString();
if (!word.equals("")) {
blh = new BlackListH(word);
DBHelper.addData(null, null, blh.getWord());
blacklist.add(blh);
adapter.notifyDataSetChanged();
}
}
});
BlacklistDialog.setCancelable(false);
BlacklistDialog.show();
return true;
}
return false;
}
Aggregations