diff options
Diffstat (limited to 'app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayFiltersFragment.java')
-rw-r--r-- | app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayFiltersFragment.java | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayFiltersFragment.java b/app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayFiltersFragment.java index 99d8e34a8..db7bd0318 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayFiltersFragment.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/fragments/DisplayFiltersFragment.java @@ -42,6 +42,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; +import es.dmoral.toasty.Toasty; import fr.gouv.etalab.mastodon.R; import fr.gouv.etalab.mastodon.activities.MainActivity; import fr.gouv.etalab.mastodon.asynctasks.ManageFiltersAsyncTask; @@ -94,7 +95,17 @@ public class DisplayFiltersFragment extends Fragment implements OnFilterActionIn add_new.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context); + final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); + int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); + int style; + if (theme == Helper.THEME_DARK) { + style = R.style.DialogDark; + } else if (theme == Helper.THEME_BLACK){ + style = R.style.DialogBlack; + }else { + style = R.style.Dialog; + } + AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context, style); LayoutInflater inflater = getLayoutInflater(); @SuppressLint("InflateParams") View dialogView = inflater.inflate(R.layout.add_filter, null); dialogBuilder.setView(dialogView); @@ -221,7 +232,7 @@ public class DisplayFiltersFragment extends Fragment implements OnFilterActionIn mainLoader.setVisibility(View.GONE); add_new.setEnabled(true); if( apiResponse.getError() != null){ - Toast.makeText(context, apiResponse.getError().getError(),Toast.LENGTH_LONG).show(); + Toasty.error(context, apiResponse.getError().getError(),Toast.LENGTH_LONG).show(); return; } if( actionType == ManageFiltersAsyncTask.action.GET_ALL_FILTER) { @@ -241,9 +252,11 @@ public class DisplayFiltersFragment extends Fragment implements OnFilterActionIn textviewNoAction.setVisibility(View.GONE); lv_filters.setVisibility(View.VISIBLE); }else{ - Toast.makeText(context, R.string.toast_error,Toast.LENGTH_LONG).show(); + Toasty.error(context, context.getString(R.string.toast_error),Toast.LENGTH_LONG).show(); } } + MainActivity.filters = apiResponse.getFilters(); + ((MainActivity)context).refreshFilters(); } } |