Display toast when trying to uncheck the last library category

This commit is contained in:
Karim Abou Zeid 2017-12-30 18:50:45 +01:00
commit 2b6b882a81
2 changed files with 4 additions and 0 deletions

View file

@ -9,6 +9,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.TextView;
import android.widget.Toast;
import com.kabouzeid.gramophone.R;
import com.kabouzeid.gramophone.model.CategoryInfo;
@ -44,6 +45,8 @@ public class CategoryInfoAdapter extends RecyclerView.Adapter<CategoryInfoAdapte
if (!(categoryInfo.visible && isLastCheckedCategory(categoryInfo))) {
categoryInfo.visible = !categoryInfo.visible;
holder.checkBox.setChecked(categoryInfo.visible);
} else {
Toast.makeText(holder.itemView.getContext(), R.string.you_have_to_select_at_least_one_category, Toast.LENGTH_SHORT).show();
}
});

View file

@ -293,4 +293,5 @@
<string name="set_artist_image">Set artist image</string>
<string name="library_categories">Library categories</string>
<string name="pref_summary_library_categories">Configure visibility and order of library categories.</string>
<string name="you_have_to_select_at_least_one_category">You have to select at least one category.</string>
</resources>