Replaced TimerDialog with HmsDialog from the BetterPickers-library
This commit is contained in:
parent
45646d4c26
commit
5ede220e63
|
@ -0,0 +1,13 @@
|
|||
Copyright 2013 Derek Brameyer
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
|
@ -60,5 +60,7 @@ licensed under the Apache 2.0 license <a href="LICENSE_FLATTR4J.txt">(View)</a>
|
|||
licensed under the Apache 2.0 license <a href="LICENSE_DSLV.txt">(View)</a>
|
||||
<h2>Presto Client <a href="http://www.aocate.com/presto/">(Link)</a></h2>
|
||||
licensed under the Apache 2.0 license <a href="LICENSE_PRESTO.txt">(View)</a>
|
||||
<h2>Better Pickers <a href="https://github.com/derekbrameyer/android-betterpickers">(Link)</a></h2>
|
||||
licensed under the Apache 2.0 license <a href="LICENSE_BETTERPICKERS.txt">(View)</a>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -30,6 +30,9 @@ dependencies {
|
|||
compile project(':submodules:dslv:library')
|
||||
|
||||
compile 'com.jayway.android.robotium:robotium-solo:5.1'
|
||||
compile ("com.doomonafireball.betterpickers:library:1.5.2") {
|
||||
exclude group: 'com.android.support', module: 'support-v4'
|
||||
}
|
||||
}
|
||||
|
||||
android {
|
||||
|
|
|
@ -145,4 +145,30 @@
|
|||
<item name="android:textColor">@color/new_indicator_green</item>
|
||||
<item name="android:text">@string/new_label</item>
|
||||
</style>
|
||||
|
||||
<style name="AntennaPodBetterPickerThemeLight">
|
||||
<item name="bpDialogBackground">@drawable/dialog_full_holo_light</item>
|
||||
<item name="bpTitleColor">@color/dialog_text_color_holo_light</item>
|
||||
<item name="bpTextColor">@color/dialog_text_color_holo_light</item>
|
||||
<item name="bpDeleteIcon">@drawable/ic_backspace_light</item>
|
||||
<item name="bpCheckIcon">@drawable/ic_check_light</item>
|
||||
<item name="bpKeyBackground">@drawable/borderless_button</item>
|
||||
<item name="bpButtonBackground">@drawable/borderless_button</item>
|
||||
<item name="bpTitleDividerColor">@color/default_keyboard_indicator_color_dark</item>
|
||||
<item name="bpDividerColor">@color/default_divider_color_light</item>
|
||||
<item name="bpKeyboardIndicatorColor">@color/selection_background_color_light</item>
|
||||
</style>
|
||||
|
||||
<style name="AntennaPodBetterPickerThemeDark">
|
||||
<item name="bpDialogBackground">@drawable/dialog_full_holo_dark</item>
|
||||
<item name="bpTitleColor">@color/dialog_text_color_holo_dark</item>
|
||||
<item name="bpTextColor">@color/dialog_text_color_holo_dark</item>
|
||||
<item name="bpDeleteIcon">@drawable/ic_backspace_dark</item>
|
||||
<item name="bpCheckIcon">@drawable/ic_check_dark</item>
|
||||
<item name="bpKeyBackground">@drawable/borderless_button_dark</item>
|
||||
<item name="bpButtonBackground">@drawable/borderless_button_dark</item>
|
||||
<item name="bpTitleDividerColor">@color/default_keyboard_indicator_color_dark</item>
|
||||
<item name="bpDividerColor">@color/default_divider_color_dark</item>
|
||||
<item name="bpKeyboardIndicatorColor">@color/selection_background_color_dark</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
|
|
@ -3,10 +3,13 @@ package de.danoeh.antennapod.activity;
|
|||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.media.AudioManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
|
@ -16,6 +19,8 @@ import android.widget.ImageButton;
|
|||
import android.widget.SeekBar;
|
||||
import android.widget.SeekBar.OnSeekBarChangeListener;
|
||||
import android.widget.TextView;
|
||||
import com.doomonafireball.betterpickers.hmspicker.HmsPickerBuilder;
|
||||
import com.doomonafireball.betterpickers.hmspicker.HmsPickerDialogFragment;
|
||||
import de.danoeh.antennapod.BuildConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.dialog.TimeDialog;
|
||||
|
@ -30,6 +35,7 @@ import de.danoeh.antennapod.util.StorageUtils;
|
|||
import de.danoeh.antennapod.util.playback.MediaPlayerError;
|
||||
import de.danoeh.antennapod.util.playback.Playable;
|
||||
import de.danoeh.antennapod.util.playback.PlaybackController;
|
||||
import org.shredzone.flattr4j.model.User;
|
||||
|
||||
/**
|
||||
* Provides general features which are both needed for playing audio and video
|
||||
|
@ -312,16 +318,34 @@ public abstract class MediaplayerActivity extends ActionBarActivity
|
|||
break;
|
||||
case R.id.set_sleeptimer_item:
|
||||
if (controller.serviceAvailable()) {
|
||||
TimeDialog td = new TimeDialog(this,
|
||||
R.string.set_sleeptimer_label,
|
||||
R.string.set_sleeptimer_label) {
|
||||
int pickerStyle = (UserPreferences.getTheme() == R.style.Theme_AntennaPod_Light) ?
|
||||
R.style.AntennaPodBetterPickerThemeLight : R.style.AntennaPodBetterPickerThemeDark;
|
||||
if (Build.VERSION.SDK_INT > 10) { // TODO remove this as soon as dialog is shown correctly on 2.3
|
||||
HmsPickerBuilder hpb = new HmsPickerBuilder()
|
||||
.setStyleResId(pickerStyle)
|
||||
.setFragmentManager(getSupportFragmentManager());
|
||||
|
||||
@Override
|
||||
public void onTimeEntered(long millis) {
|
||||
controller.setSleepTimer(millis);
|
||||
}
|
||||
};
|
||||
td.show();
|
||||
hpb.addHmsPickerDialogHandler(new HmsPickerDialogFragment.HmsPickerDialogHandler() {
|
||||
@Override
|
||||
public void onDialogHmsSet(int ref, int hours, int minutes, int seconds) {
|
||||
if (controller != null && controller.serviceAvailable()) {
|
||||
controller.setSleepTimer((hours * 3600 + minutes * 60 + seconds) * 1000);
|
||||
}
|
||||
}
|
||||
});
|
||||
hpb.show();
|
||||
} else {
|
||||
TimeDialog td = new TimeDialog(this,
|
||||
R.string.set_sleeptimer_label,
|
||||
R.string.set_sleeptimer_label) {
|
||||
|
||||
@Override
|
||||
public void onTimeEntered(long millis) {
|
||||
controller.setSleepTimer(millis);
|
||||
}
|
||||
};
|
||||
td.show();
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue