diff options
Diffstat (limited to 'app/src/main')
3 files changed, 71 insertions, 10 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/SleepTimerDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/SleepTimerDialog.java index 7788641cc..f1a41d753 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/SleepTimerDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/SleepTimerDialog.java @@ -87,6 +87,27 @@ public class SleepTimerDialog extends DialogFragment { timeSetup = content.findViewById(R.id.timeSetup); timeDisplay = content.findViewById(R.id.timeDisplay); time = content.findViewById(R.id.time); + Button extendSleepFiveMinutesButton = content.findViewById(R.id.extendSleepFiveMinutesButton); + extendSleepFiveMinutesButton.setText(getString(R.string.extend_sleep_timer_label, 5)); + Button extendSleepTenMinutesButton = content.findViewById(R.id.extendSleepTenMinutesButton); + extendSleepTenMinutesButton.setText(getString(R.string.extend_sleep_timer_label, 10)); + Button extendSleepTwentyMinutesButton = content.findViewById(R.id.extendSleepTwentyMinutesButton); + extendSleepTwentyMinutesButton.setText(getString(R.string.extend_sleep_timer_label, 20)); + extendSleepFiveMinutesButton.setOnClickListener(v -> { + if (controller != null) { + controller.extendSleepTimer(5 * 1000 * 60); + } + }); + extendSleepTenMinutesButton.setOnClickListener(v -> { + if (controller != null) { + controller.extendSleepTimer(10 * 1000 * 60); + } + }); + extendSleepTwentyMinutesButton.setOnClickListener(v -> { + if (controller != null) { + controller.extendSleepTimer(20 * 1000 * 60); + } + }); etxtTime.setText(SleepTimerPreferences.lastTimerValue()); etxtTime.postDelayed(() -> { diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/AddFeedFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/AddFeedFragment.java index a546eb829..06a974dfd 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/AddFeedFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/AddFeedFragment.java @@ -51,6 +51,7 @@ public class AddFeedFragment extends Fragment { private static final int REQUEST_CODE_CHOOSE_OPML_IMPORT_PATH = 1; private static final int REQUEST_CODE_ADD_LOCAL_FOLDER = 2; + private AddfeedBinding viewBinding; private MainActivity activity; @Override @@ -59,7 +60,7 @@ public class AddFeedFragment extends Fragment { @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); - AddfeedBinding viewBinding = AddfeedBinding.inflate(getLayoutInflater()); + viewBinding = AddfeedBinding.inflate(getLayoutInflater()); activity = (MainActivity) getActivity(); Toolbar toolbar = viewBinding.toolbar; @@ -75,8 +76,7 @@ public class AddFeedFragment extends Fragment { -> activity.loadChildFragment(OnlineSearchFragment.newInstance(PodcastIndexPodcastSearcher.class))); viewBinding.combinedFeedSearchEditText.setOnEditorActionListener((v, actionId, event) -> { - String query = viewBinding.combinedFeedSearchEditText.getText().toString(); - performSearch(query); + performSearch(); return true; }); @@ -114,8 +114,7 @@ public class AddFeedFragment extends Fragment { viewBinding.addLocalFolderButton.setVisibility(View.GONE); } - String query = viewBinding.combinedFeedSearchEditText.getText().toString(); - viewBinding.searchButton.setOnClickListener(view -> performSearch(query)); + viewBinding.searchButton.setOnClickListener(view -> performSearch()); return viewBinding.getRoot(); } @@ -145,8 +144,8 @@ public class AddFeedFragment extends Fragment { startActivity(intent); } - private void performSearch(String query) { - + private void performSearch() { + String query = viewBinding.combinedFeedSearchEditText.getText().toString(); if (query.matches("http[s]?://.*")) { addUrl(query); return; diff --git a/app/src/main/res/layout/time_dialog.xml b/app/src/main/res/layout/time_dialog.xml index 6523bb1be..6b6ab3195 100644 --- a/app/src/main/res/layout/time_dialog.xml +++ b/app/src/main/res/layout/time_dialog.xml @@ -2,6 +2,7 @@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" + xmlns:tools="http://schemas.android.com/tools" android:orientation="vertical" android:gravity="center" android:padding="16dp"> @@ -52,10 +53,11 @@ <TextView android:text="00:00:00" android:layout_gravity="center" + android:gravity="center" android:textSize="32sp" android:textColor="?android:attr/textColorPrimary" - android:layout_width="wrap_content" - android:layout_height="wrap_content" + android:layout_width="match_parent" + android:layout_height="match_parent" android:id="@+id/time"/> <Button @@ -64,6 +66,45 @@ android:layout_height="wrap_content" android:id="@+id/disableSleeptimerButton"/> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + + <Button + android:id="@+id/extendSleepFiveMinutesButton" + style="?attr/materialButtonOutlinedStyle" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginEnd="4dp" + android:layout_marginRight="4dp" + android:layout_weight="1" + android:padding="5dp" + tools:text="+5 min" /> + + <Button + android:id="@+id/extendSleepTenMinutesButton" + style="?attr/materialButtonOutlinedStyle" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginStart="4dp" + android:layout_marginEnd="4dp" + android:layout_weight="1" + tools:text="+10 min" /> + + <Button + android:id="@+id/extendSleepTwentyMinutesButton" + style="?attr/materialButtonOutlinedStyle" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginStart="4dp" + android:layout_marginRight="4dp" + android:layout_marginLeft="4dp" + android:layout_weight="1" + tools:text="+20 min" /> + + </LinearLayout> + </LinearLayout> @@ -93,4 +134,4 @@ </LinearLayout> -</LinearLayout>
\ No newline at end of file +</LinearLayout> |