The alert message for downloading starred tracks made more explicit

This commit is contained in:
antonio 2023-03-13 21:09:11 +01:00
parent 56701463e4
commit 1aba732ab9
2 changed files with 24 additions and 3 deletions

View file

@ -12,10 +12,11 @@ import androidx.fragment.app.DialogFragment;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import com.cappielloantonio.play.R; import com.cappielloantonio.play.R;
import com.cappielloantonio.play.databinding.DialogConnectionAlertBinding; import com.cappielloantonio.play.databinding.DialogStarredSyncBinding;
import com.cappielloantonio.play.model.Download; import com.cappielloantonio.play.model.Download;
import com.cappielloantonio.play.util.DownloadUtil; import com.cappielloantonio.play.util.DownloadUtil;
import com.cappielloantonio.play.util.MappingUtil; import com.cappielloantonio.play.util.MappingUtil;
import com.cappielloantonio.play.util.Preferences;
import com.cappielloantonio.play.viewmodel.StarredSyncViewModel; import com.cappielloantonio.play.viewmodel.StarredSyncViewModel;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -23,13 +24,13 @@ import java.util.stream.Collectors;
public class StarredSyncDialog extends DialogFragment { public class StarredSyncDialog extends DialogFragment {
private static final String TAG = "ServerUnreachableDialog"; private static final String TAG = "ServerUnreachableDialog";
private DialogConnectionAlertBinding bind; private DialogStarredSyncBinding bind;
private StarredSyncViewModel starredSyncViewModel; private StarredSyncViewModel starredSyncViewModel;
@NonNull @NonNull
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
bind = DialogConnectionAlertBinding.inflate(LayoutInflater.from(requireContext())); bind = DialogStarredSyncBinding.inflate(LayoutInflater.from(requireContext()));
starredSyncViewModel = new ViewModelProvider(requireActivity()).get(StarredSyncViewModel.class); starredSyncViewModel = new ViewModelProvider(requireActivity()).get(StarredSyncViewModel.class);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
@ -71,6 +72,12 @@ public class StarredSyncDialog extends DialogFragment {
dialog.dismiss(); dialog.dismiss();
}); });
}); });
Button negativeButton = dialog.getButton(Dialog.BUTTON_NEGATIVE);
negativeButton.setOnClickListener(v -> {
Preferences.setStarredSyncEnabled(false);
dialog.dismiss();
});
} }
} }
} }

View file

@ -0,0 +1,14 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="4dp"
android:text="@string/starred_sync_dialog_summary" />
</LinearLayout>