use of de.danoeh.antennapod.view.ItemOffsetDecoration in project AntennaPod by AntennaPod.
the class TagSettingsDialog method onCreateDialog.
@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
ArrayList<FeedPreferences> feedPreferencesList = (ArrayList<FeedPreferences>) getArguments().getSerializable(ARG_FEED_PREFERENCES);
Set<String> commonTags = new HashSet<>(feedPreferencesList.get(0).getTags());
for (FeedPreferences preference : feedPreferencesList) {
commonTags.retainAll(preference.getTags());
}
displayedTags = new ArrayList<>(commonTags);
displayedTags.remove(FeedPreferences.TAG_ROOT);
viewBinding = EditTagsDialogBinding.inflate(getLayoutInflater());
viewBinding.tagsRecycler.setLayoutManager(new GridLayoutManager(getContext(), 2));
viewBinding.tagsRecycler.addItemDecoration(new ItemOffsetDecoration(getContext(), 4));
adapter = new TagSelectionAdapter();
adapter.setHasStableIds(true);
viewBinding.tagsRecycler.setAdapter(adapter);
viewBinding.rootFolderCheckbox.setChecked(commonTags.contains(FeedPreferences.TAG_ROOT));
viewBinding.newTagButton.setOnClickListener(v -> addTag(viewBinding.newTagEditText.getText().toString().trim()));
loadTags();
viewBinding.newTagEditText.setThreshold(1);
viewBinding.newTagEditText.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
viewBinding.newTagEditText.showDropDown();
viewBinding.newTagEditText.requestFocus();
return false;
}
});
if (feedPreferencesList.size() > 1) {
viewBinding.commonTagsInfo.setVisibility(View.VISIBLE);
}
AlertDialog.Builder dialog = new AlertDialog.Builder(getContext());
dialog.setView(viewBinding.getRoot());
dialog.setTitle(R.string.feed_tags_label);
dialog.setPositiveButton(android.R.string.ok, (d, input) -> {
addTag(viewBinding.newTagEditText.getText().toString().trim());
updatePreferencesTags(feedPreferencesList, commonTags);
});
dialog.setNegativeButton(R.string.cancel_label, null);
return dialog.create();
}
use of de.danoeh.antennapod.view.ItemOffsetDecoration in project AntennaPod by AntennaPod.
the class VariableSpeedDialog method onCreateView.
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View root = View.inflate(getContext(), R.layout.speed_select_dialog, null);
speedSeekBar = root.findViewById(R.id.speed_seek_bar);
speedSeekBar.setProgressChangedListener(multiplier -> {
if (controller != null) {
controller.setPlaybackSpeed(multiplier);
}
});
RecyclerView selectedSpeedsGrid = root.findViewById(R.id.selected_speeds_grid);
selectedSpeedsGrid.setLayoutManager(new GridLayoutManager(getContext(), 3));
selectedSpeedsGrid.addItemDecoration(new ItemOffsetDecoration(getContext(), 4));
adapter = new SpeedSelectionAdapter();
adapter.setHasStableIds(true);
selectedSpeedsGrid.setAdapter(adapter);
addCurrentSpeedChip = root.findViewById(R.id.add_current_speed_chip);
addCurrentSpeedChip.setCloseIconVisible(true);
addCurrentSpeedChip.setCloseIconResource(R.drawable.ic_add);
addCurrentSpeedChip.setOnCloseIconClickListener(v -> addCurrentSpeed());
addCurrentSpeedChip.setOnClickListener(v -> addCurrentSpeed());
return root;
}
Aggregations