mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-23 08:30:44 +00:00
make download dialog use radio button
This commit is contained in:
parent
931f34d2fd
commit
2b89e24a4b
@ -19,8 +19,8 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.CheckBox;
|
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.RadioButton;
|
||||||
import android.widget.SeekBar;
|
import android.widget.SeekBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@ -175,13 +175,15 @@ public class DownloadDialog extends DialogFragment {
|
|||||||
protected void checkDownloadOptions(){
|
protected void checkDownloadOptions(){
|
||||||
View view = getView();
|
View view = getView();
|
||||||
Bundle arguments = getArguments();
|
Bundle arguments = getArguments();
|
||||||
CheckBox audio = (CheckBox) view.findViewById(R.id.audio);
|
RadioButton audioButton = (RadioButton) view.findViewById(R.id.audio_button);
|
||||||
CheckBox video = (CheckBox) view.findViewById(R.id.video);
|
RadioButton videoButton = (RadioButton) view.findViewById(R.id.video_button);
|
||||||
|
|
||||||
if(arguments.getString(AUDIO_URL) == null) {
|
if(arguments.getString(AUDIO_URL) == null) {
|
||||||
audio.setVisibility(View.GONE);
|
audioButton.setVisibility(View.GONE);
|
||||||
|
videoButton.setChecked(true);
|
||||||
} else if(arguments.getString(VIDEO_URL) == null) {
|
} else if(arguments.getString(VIDEO_URL) == null) {
|
||||||
video.setVisibility(View.GONE);
|
videoButton.setVisibility(View.GONE);
|
||||||
|
audioButton.setChecked(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,15 +213,15 @@ public class DownloadDialog extends DialogFragment {
|
|||||||
Bundle arguments = getArguments();
|
Bundle arguments = getArguments();
|
||||||
final EditText name = (EditText) view.findViewById(R.id.file_name);
|
final EditText name = (EditText) view.findViewById(R.id.file_name);
|
||||||
final SeekBar threads = (SeekBar) view.findViewById(R.id.threads);
|
final SeekBar threads = (SeekBar) view.findViewById(R.id.threads);
|
||||||
CheckBox audio = (CheckBox) view.findViewById(R.id.audio);
|
RadioButton audioButton = (RadioButton) view.findViewById(R.id.audio_button);
|
||||||
CheckBox video = (CheckBox) view.findViewById(R.id.video);
|
RadioButton videoButton = (RadioButton) view.findViewById(R.id.video_button);
|
||||||
|
|
||||||
String fName = name.getText().toString().trim();
|
String fName = name.getText().toString().trim();
|
||||||
|
|
||||||
// todo: add timeout? would be bad if the thread gets locked dueto this.
|
// todo: add timeout? would be bad if the thread gets locked dueto this.
|
||||||
while (mBinder == null);
|
while (mBinder == null);
|
||||||
|
|
||||||
if(audio.isChecked()){
|
if(audioButton.isChecked()){
|
||||||
int res = mManager.startMission(
|
int res = mManager.startMission(
|
||||||
arguments.getString(AUDIO_URL),
|
arguments.getString(AUDIO_URL),
|
||||||
fName + arguments.getString(FILE_SUFFIX_AUDIO),
|
fName + arguments.getString(FILE_SUFFIX_AUDIO),
|
||||||
@ -227,7 +229,7 @@ public class DownloadDialog extends DialogFragment {
|
|||||||
mBinder.onMissionAdded(mManager.getMission(res));
|
mBinder.onMissionAdded(mManager.getMission(res));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(video.isChecked()){
|
if(videoButton.isChecked()){
|
||||||
int res = mManager.startMission(
|
int res = mManager.startMission(
|
||||||
arguments.getString(VIDEO_URL),
|
arguments.getString(VIDEO_URL),
|
||||||
fName + arguments.getString(FILE_SUFFIX_VIDEO),
|
fName + arguments.getString(FILE_SUFFIX_VIDEO),
|
||||||
|
@ -58,15 +58,21 @@
|
|||||||
android:layout_marginBottom="24dp"
|
android:layout_marginBottom="24dp"
|
||||||
android:gravity="left"
|
android:gravity="left"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
<CheckBox android:id="@+id/video"
|
<RadioGroup
|
||||||
|
android:id="@+id/video_audio_group"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<RadioButton android:id="@+id/video_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/video"
|
android:text="@string/video"
|
||||||
android:checked="true"/>
|
android:checked="true"/>
|
||||||
<CheckBox android:id="@+id/audio"
|
<RadioButton android:id="@+id/audio_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/audio" />
|
android:text="@string/audio" />
|
||||||
|
</RadioGroup>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
Loading…
Reference in New Issue
Block a user