diff options
author | ByteHamster <info@bytehamster.com> | 2018-12-26 08:40:40 +0100 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2018-12-26 08:40:40 +0100 |
commit | bb4b4655d25713dfddca7a52c5088938c604114b (patch) | |
tree | 29546dd59b232b0843cd52e80d950111aefddb81 /app | |
parent | 20328dbd97c0ff561b815efe3cc088884f7378eb (diff) | |
parent | 9a92e66ffdcb7648ad641fa4f17ffe11d4d72298 (diff) | |
download | AntennaPod-bb4b4655d25713dfddca7a52c5088938c604114b.zip |
Merge branch 'develop' into rxjava2
Diffstat (limited to 'app')
116 files changed, 1098 insertions, 587 deletions
diff --git a/app/build.gradle b/app/build.gradle index f4153f21f..97a6ff835 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -43,7 +43,7 @@ android { versionCode getMyVersionCode() versionName "${getMyVersionName()}" testApplicationId "de.test.antennapod" - testInstrumentationRunner "de.test.antennapod.AntennaPodTestRunner" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" generatedDensities = [] } @@ -120,6 +120,10 @@ android { additionalParameters "--no-version-vectors" } + testOptions { + animationsDisabled = true + } + flavorDimensions "market" productFlavors { free { @@ -150,6 +154,7 @@ dependencies { implementation "com.android.support:gridlayout-v7:$supportVersion" implementation "com.android.support:percent:$supportVersion" implementation "com.android.support:recyclerview-v7:$supportVersion" + compileOnly 'com.google.android.wearable:wearable:2.2.0' implementation "org.apache.commons:commons-lang3:$commonslangVersion" implementation("org.shredzone.flattr4j:flattr4j-core:$flattr4jVersion") { exclude group: "org.json", module: "json" @@ -182,6 +187,11 @@ dependencies { implementation 'com.github.ByteHamster:SearchPreference:v1.0.8' androidTestImplementation "com.jayway.android.robotium:robotium-solo:$robotiumSoloVersion" + androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' + androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.0.2' + androidTestImplementation 'com.android.support.test.espresso:espresso-intents:3.0.2' + androidTestImplementation 'com.android.support.test:runner:1.0.2' + androidTestImplementation 'com.android.support.test:rules:1.0.2' } play { diff --git a/app/proguard.cfg b/app/proguard.cfg index 01b1708f7..6bb98dc9e 100644 --- a/app/proguard.cfg +++ b/app/proguard.cfg @@ -71,8 +71,6 @@ -dontwarn android.support.v7.** -dontwarn com.google.android.wearable.** --keepattributes *Annotation* - -keep class org.shredzone.flattr4j.** { *; } -dontwarn org.shredzone.flattr4j.** @@ -94,6 +92,7 @@ -keepclassmembers class ** { public void onEvent*(**); } +-keep class de.danoeh.antennapod.core.event.* # android-iconify -keep class com.joanzapata.** { *; } @@ -125,3 +124,13 @@ -keep class com.squareup.moshi.** { *; } -keep interface com.squareup.moshi.** { *; } -keep public class retrofit2.adapter.rxjava.RxJavaCallAdapterFactory { *; } + +# awaitility +-dontwarn java.beans.BeanInfo +-dontwarn java.beans.Introspector +-dontwarn java.beans.IntrospectionException +-dontwarn java.beans.PropertyDescriptor +-dontwarn java.lang.management.ManagementFactory +-dontwarn java.lang.management.ThreadInfo +-dontwarn java.lang.management.ThreadMXBean + diff --git a/app/src/androidTest/java/de/test/antennapod/AntennaPodTestRunner.java b/app/src/androidTest/java/de/test/antennapod/AntennaPodTestRunner.java deleted file mode 100644 index c321e6494..000000000 --- a/app/src/androidTest/java/de/test/antennapod/AntennaPodTestRunner.java +++ /dev/null @@ -1,18 +0,0 @@ -package de.test.antennapod; - -import android.test.InstrumentationTestRunner; -import android.test.suitebuilder.TestSuiteBuilder; - -import junit.framework.TestSuite; - -public class AntennaPodTestRunner extends InstrumentationTestRunner { - - @Override - public TestSuite getAllTests() { - return new TestSuiteBuilder(AntennaPodTestRunner.class) - .includeAllPackagesUnderHere() - .excludePackages("de.test.antennapod.gpodnet") - .build(); - } - -} diff --git a/app/src/androidTest/java/de/test/antennapod/NthMatcher.java b/app/src/androidTest/java/de/test/antennapod/NthMatcher.java new file mode 100644 index 000000000..f9ecacda5 --- /dev/null +++ b/app/src/androidTest/java/de/test/antennapod/NthMatcher.java @@ -0,0 +1,38 @@ +package de.test.antennapod; + +import org.hamcrest.BaseMatcher; +import org.hamcrest.Description; +import org.hamcrest.Matcher; + +import java.util.concurrent.atomic.AtomicInteger; + +public class NthMatcher { + public static <T> Matcher<T> first(final Matcher<T> matcher) { + return nth(matcher, 1); + } + + public static <T> Matcher<T> second(final Matcher<T> matcher) { + return nth(matcher, 2); + } + + private static <T> Matcher<T> nth(final Matcher<T> matcher, final int index) { + return new BaseMatcher<T>() { + AtomicInteger count = new AtomicInteger(0); + + @Override + public boolean matches(final Object item) { + if (matcher.matches(item)) { + if (count.incrementAndGet() == index) { + return true; + } + } + return false; + } + + @Override + public void describeTo(final Description description) { + description.appendText("should return first matching item"); + } + }; + } +} diff --git a/app/src/androidTest/java/de/test/antennapod/feed/FeedItemTest.java b/app/src/androidTest/java/de/test/antennapod/feed/FeedItemTest.java index db463132d..ced0d7a28 100644 --- a/app/src/androidTest/java/de/test/antennapod/feed/FeedItemTest.java +++ b/app/src/androidTest/java/de/test/antennapod/feed/FeedItemTest.java @@ -1,6 +1,7 @@ package de.test.antennapod.feed; import android.test.AndroidTestCase; + import de.danoeh.antennapod.core.feed.FeedItem; public class FeedItemTest extends AndroidTestCase { diff --git a/app/src/androidTest/java/de/test/antennapod/gpodnet/GPodnetServiceTest.java b/app/src/androidTest/java/de/test/antennapod/gpodnet/GPodnetServiceTest.java index a880c330b..91e31e73c 100644 --- a/app/src/androidTest/java/de/test/antennapod/gpodnet/GPodnetServiceTest.java +++ b/app/src/androidTest/java/de/test/antennapod/gpodnet/GPodnetServiceTest.java @@ -1,43 +1,43 @@ package de.test.antennapod.gpodnet; -import android.test.AndroidTestCase; - import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import android.support.test.runner.AndroidJUnit4; import de.danoeh.antennapod.core.gpoddernet.GpodnetService; import de.danoeh.antennapod.core.gpoddernet.GpodnetServiceException; import de.danoeh.antennapod.core.gpoddernet.model.GpodnetDevice; import de.danoeh.antennapod.core.gpoddernet.model.GpodnetTag; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; import static java.util.Collections.singletonList; /** * Test class for GpodnetService */ -public class GPodnetServiceTest extends AndroidTestCase { +@Ignore +@RunWith(AndroidJUnit4.class) +public class GPodnetServiceTest { private GpodnetService service; private static final String USER = ""; private static final String PW = ""; - @Override - protected void setUp() throws Exception { - super.setUp(); + @Before + protected void setUp() { service = new GpodnetService(); } - @Override - protected void tearDown() throws Exception { - super.tearDown(); - } - private void authenticate() throws GpodnetServiceException { service.authenticate(USER, PW); } + @Test public void testUploadSubscription() throws GpodnetServiceException { authenticate(); ArrayList<String> l = new ArrayList<>(); @@ -45,6 +45,7 @@ public class GPodnetServiceTest extends AndroidTestCase { service.uploadSubscriptions(USER, "radio", l); } + @Test public void testUploadSubscription2() throws GpodnetServiceException { authenticate(); ArrayList<String> l = new ArrayList<>(); @@ -53,6 +54,7 @@ public class GPodnetServiceTest extends AndroidTestCase { service.uploadSubscriptions(USER, "radio", l); } + @Test public void testUploadChanges() throws GpodnetServiceException { authenticate(); String[] URLS = {"http://bitsundso.de/feed", "http://gamesundso.de/feed", "http://cre.fm/feed/mp3/", "http://freakshow.fm/feed/m4a/"}; @@ -63,53 +65,63 @@ public class GPodnetServiceTest extends AndroidTestCase { service.uploadChanges(USER, "radio", added, removed); } + @Test public void testGetSubscriptionChanges() throws GpodnetServiceException { authenticate(); service.getSubscriptionChanges(USER, "radio", 1362322610L); } + @Test public void testGetSubscriptionsOfUser() throws GpodnetServiceException { authenticate(); service.getSubscriptionsOfUser(USER); } + @Test public void testGetSubscriptionsOfDevice() throws GpodnetServiceException { authenticate(); service.getSubscriptionsOfDevice(USER, "radio"); } + @Test public void testConfigureDevices() throws GpodnetServiceException { authenticate(); service.configureDevice(USER, "foo", "This is an updated caption", GpodnetDevice.DeviceType.LAPTOP); } + @Test public void testGetDevices() throws GpodnetServiceException { authenticate(); service.getDevices(USER); } + @Test public void testGetSuggestions() throws GpodnetServiceException { authenticate(); service.getSuggestions(10); } + @Test public void testTags() throws GpodnetServiceException { service.getTopTags(20); } + @Test public void testPodcastForTags() throws GpodnetServiceException { List<GpodnetTag> tags = service.getTopTags(20); service.getPodcastsForTag(tags.get(1), 10); } + @Test public void testSearch() throws GpodnetServiceException { service.searchPodcasts("linux", 64); } + @Test public void testToplist() throws GpodnetServiceException { service.getPodcastToplist(10); } diff --git a/app/src/androidTest/java/de/test/antennapod/storage/DBTasksTest.java b/app/src/androidTest/java/de/test/antennapod/storage/DBTasksTest.java index 93a9408b7..9cd7689ba 100644 --- a/app/src/androidTest/java/de/test/antennapod/storage/DBTasksTest.java +++ b/app/src/androidTest/java/de/test/antennapod/storage/DBTasksTest.java @@ -5,7 +5,6 @@ import android.test.FlakyTest; import android.test.InstrumentationTestCase; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.Date; import java.util.List; diff --git a/app/src/androidTest/java/de/test/antennapod/storage/DBTestUtils.java b/app/src/androidTest/java/de/test/antennapod/storage/DBTestUtils.java index c9c715a86..a577e5e36 100644 --- a/app/src/androidTest/java/de/test/antennapod/storage/DBTestUtils.java +++ b/app/src/androidTest/java/de/test/antennapod/storage/DBTestUtils.java @@ -21,6 +21,7 @@ import de.danoeh.antennapod.core.util.flattr.FlattrStatus; */ class DBTestUtils { + private DBTestUtils(){} /** * Use this method when tests don't involve chapters. */ diff --git a/app/src/androidTest/java/de/test/antennapod/storage/DBWriterTest.java b/app/src/androidTest/java/de/test/antennapod/storage/DBWriterTest.java index 387ab91b3..427cc8ddd 100644 --- a/app/src/androidTest/java/de/test/antennapod/storage/DBWriterTest.java +++ b/app/src/androidTest/java/de/test/antennapod/storage/DBWriterTest.java @@ -18,7 +18,6 @@ import java.util.concurrent.TimeoutException; import de.danoeh.antennapod.core.feed.Feed; import de.danoeh.antennapod.core.feed.FeedItem; import de.danoeh.antennapod.core.feed.FeedMedia; -import de.danoeh.antennapod.core.feed.SimpleChapter; import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.storage.PodDBAdapter; diff --git a/app/src/androidTest/java/de/test/antennapod/ui/MainActivityTest.java b/app/src/androidTest/java/de/test/antennapod/ui/MainActivityTest.java index 6156da926..9a60b04b8 100644 --- a/app/src/androidTest/java/de/test/antennapod/ui/MainActivityTest.java +++ b/app/src/androidTest/java/de/test/antennapod/ui/MainActivityTest.java @@ -2,16 +2,14 @@ package de.test.antennapod.ui; import android.content.Context; import android.content.SharedPreferences; -import android.test.ActivityInstrumentationTestCase2; -import android.test.FlakyTest; +import android.support.test.espresso.contrib.DrawerActions; +import android.support.test.espresso.intent.Intents; +import android.support.test.filters.FlakyTest; +import android.support.test.rule.ActivityTestRule; +import android.support.test.runner.AndroidJUnit4; import android.widget.ListView; - import com.robotium.solo.Solo; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - +import com.robotium.solo.Timeout; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.activity.OnlineFeedViewActivity; @@ -23,25 +21,46 @@ import de.danoeh.antennapod.fragment.DownloadsFragment; import de.danoeh.antennapod.fragment.EpisodesFragment; import de.danoeh.antennapod.fragment.PlaybackHistoryFragment; import de.danoeh.antennapod.fragment.QueueFragment; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import static android.support.test.InstrumentationRegistry.getInstrumentation; +import static android.support.test.espresso.Espresso.onView; +import static android.support.test.espresso.action.ViewActions.click; +import static android.support.test.espresso.action.ViewActions.longClick; +import static android.support.test.espresso.intent.Intents.intended; +import static android.support.test.espresso.intent.matcher.IntentMatchers.hasComponent; +import static android.support.test.espresso.matcher.ViewMatchers.withId; +import static android.support.test.espresso.matcher.ViewMatchers.withText; +import static de.test.antennapod.NthMatcher.first; +import static junit.framework.TestCase.assertTrue; +import static org.junit.Assert.assertEquals; /** * User interface tests for MainActivity */ -public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActivity> { +@RunWith(AndroidJUnit4.class) +public class MainActivityTest { private Solo solo; private UITestUtils uiTestUtils; - private SharedPreferences prefs; - public MainActivityTest() { - super(MainActivity.class); - } + @Rule + public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(MainActivity.class); - @Override - protected void setUp() throws Exception { - super.setUp(); - Context context = getInstrumentation().getTargetContext(); + @Before + public void setUp() throws IOException { + Intents.init(); + Context context = mActivityRule.getActivity(); uiTestUtils = new UITestUtils(context); uiTestUtils.setup(); @@ -54,30 +73,26 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv // override first launch preference // do this BEFORE calling getActivity()! - prefs = getInstrumentation().getTargetContext().getSharedPreferences(MainActivity.PREF_NAME, Context.MODE_PRIVATE); + prefs = context.getSharedPreferences(MainActivity.PREF_NAME, Context.MODE_PRIVATE); prefs.edit().putBoolean(MainActivity.PREF_IS_FIRST_LAUNCH, false).commit(); - solo = new Solo(getInstrumentation(), getActivity()); + solo = new Solo(getInstrumentation(), mActivityRule.getActivity()); } - @Override - protected void tearDown() throws Exception { + @After + public void tearDown() throws Exception { uiTestUtils.tearDown(); solo.finishOpenedActivities(); - + Intents.release(); PodDBAdapter.deleteDatabase(); - - // reset preferences prefs.edit().clear().commit(); - - super.tearDown(); } private void openNavDrawer() { - solo.clickOnImageButton(0); - getInstrumentation().waitForIdleSync(); + onView(withId(R.id.drawer_layout)).perform(DrawerActions.open()); } + @Test public void testAddFeed() throws Exception { uiTestUtils.addHostedFeedData(); final Feed feed = uiTestUtils.hostedFeeds.get(0); @@ -89,10 +104,12 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv solo.waitForView(R.id.butSubscribe); assertEquals(solo.getString(R.string.subscribe_label), solo.getButton(0).getText().toString()); solo.clickOnButton(0); - solo.waitForText(solo.getString(R.string.subscribed_label)); + assertTrue(solo.waitForText(solo.getString(R.string.open_podcast), 0, Timeout.getLargeTimeout(), false)); } - @FlakyTest(tolerance = 3) + + @Test + @FlakyTest public void testClickNavDrawer() throws Exception { uiTestUtils.addLocalFeedData(false); @@ -150,57 +167,60 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv return ((MainActivity) solo.getCurrentActivity()).getSupportActionBar().getTitle().toString(); } - @SuppressWarnings("unchecked") - @FlakyTest(tolerance = 3) + + @Test + @FlakyTest public void testGoToPreferences() { openNavDrawer(); - solo.clickOnText(solo.getString(R.string.settings_label)); - solo.waitForActivity(PreferenceActivity.class); + onView(withText(R.string.settings_label)).perform(click()); + intended(hasComponent(PreferenceActivity.class.getName())); } + @Test public void testDrawerPreferencesHideSomeElements() { UserPreferences.setHiddenDrawerItems(new ArrayList<>()); openNavDrawer(); - solo.clickLongOnText(solo.getString(R.string.queue_label)); - solo.waitForDialogToOpen(); - solo.clickOnText(solo.getString(R.string.episodes_label)); - solo.clickOnText(solo.getString(R.string.playback_history_label)); - solo.clickOnText(solo.getString(R.string.confirm_label)); - solo.waitForDialogToClose(); + onView(first(withText(R.string.queue_label))).perform(longClick()); + onView(withText(R.string.episodes_label)).perform(click()); + onView(withText(R.string.playback_history_label)).perform(click()); + onView(withText(R.string.confirm_label)).perform(click()); + List<String> hidden = UserPreferences.getHiddenDrawerItems(); assertEquals(2, hidden.size()); assertTrue(hidden.contains(EpisodesFragment.TAG)); assertTrue(hidden.contains(PlaybackHistoryFragment.TAG)); } + @Test public void testDrawerPreferencesUnhideSomeElements() { List<String> hidden = Arrays.asList(PlaybackHistoryFragment.TAG, DownloadsFragment.TAG); UserPreferences.setHiddenDrawerItems(hidden); openNavDrawer(); - solo.clickLongOnText(solo.getString(R.string.queue_label)); - solo.waitForDialogToOpen(); - solo.clickOnText(solo.getString(R.string.downloads_label)); - solo.clickOnText(solo.getString(R.string.queue_label)); - solo.clickOnText(solo.getString(R.string.confirm_label)); - solo.waitForDialogToClose(); + onView(first(withText(R.string.queue_label))).perform(longClick()); + + onView(withText(R.string.downloads_label)).perform(click()); + onView(withText(R.string.queue_label)).perform(click()); + onView(withText(R.string.confirm_label)).perform(click()); + hidden = UserPreferences.getHiddenDrawerItems(); assertEquals(2, hidden.size()); assertTrue(hidden.contains(QueueFragment.TAG)); assertTrue(hidden.contains(PlaybackHistoryFragment.TAG)); } + + @Test public void testDrawerPreferencesHideAllElements() { UserPreferences.setHiddenDrawerItems(new ArrayList<>()); - String[] titles = getInstrumentation().getTargetContext().getResources().getStringArray(R.array.nav_drawer_titles); + String[] titles = mActivityRule.getActivity().getResources().getStringArray(R.array.nav_drawer_titles); openNavDrawer(); - solo.clickLongOnText(solo.getString(R.string.queue_label)); - solo.waitForDialogToOpen(); + onView(first(withText(R.string.queue_label))).perform(longClick()); for (String title : titles) { - solo.clickOnText(title); + onView(first(withText(title))).perform(click()); } - solo.clickOnText(solo.getString(R.string.confirm_label)); - solo.waitForDialogToClose(); + onView(withText(R.string.confirm_label)).perform(click()); + List<String> hidden = UserPreferences.getHiddenDrawerItems(); assertEquals(titles.length, hidden.size()); for (String tag : MainActivity.NAV_DRAWER_TAGS) { @@ -208,21 +228,85 @@ public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActiv } } + @Test public void testDrawerPreferencesHideCurrentElement() { UserPreferences.setHiddenDrawerItems(new ArrayList<>()); - openNavDrawer(); - String downloads = solo.getString(R.string.downloads_label); - solo.clickOnText(downloads); - solo.waitForView(android.R.id.list); + onView(withText(R.string.downloads_label)).perform(click()); openNavDrawer(); - solo.clickLongOnText(downloads); - solo.waitForDialogToOpen(); - solo.clickOnText(downloads); - solo.clickOnText(solo.getString(R.string.confirm_label)); - solo.waitForDialogToClose(); + + onView(first(withText(R.string.queue_label))).perform(longClick()); + onView(first(withText(R.string.downloads_label))).perform(click()); + onView(withText(R.string.confirm_label)).perform(click()); + List<String> hidden = UserPreferences.getHiddenDrawerItems(); assertEquals(1, hidden.size()); assertTrue(hidden.contains(DownloadsFragment.TAG)); } + + @Test + public void testBackButtonBehaviorGoToPage() { + openNavDrawer(); + solo.clickOnText(solo.getString(R.string.settings_label)); + solo.clickOnText(solo.getString(R.string.user_interface_label)); + solo.clickOnText(solo.getString(R.string.pref_back_button_behavior_title)); + solo.clickOnText(solo.getString(R.string.back_button_go_to_page)); + solo.waitForDialogToOpen(); + solo.clickOnText(solo.getString(R.string.subscriptions_label)); + solo.clickOnText(solo.getString(R.string.confirm_label)); + solo.goBackToActivity(MainActivity.class.getSimpleName()); + solo.goBack(); + assertEquals(solo.getString(R.string.subscriptions_label), getActionbarTitle()); + } + + @Test + public void testBackButtonBehaviorOpenDrawer() { + openNavDrawer(); + solo.clickOnText(solo.getString(R.string.settings_label)); + solo.clickOnText(solo.getString(R.string.user_interface_label)); + solo.clickOnText(solo.getString(R.string.pref_back_button_behavior_title)); + solo.clickOnText(solo.getString(R.string.back_button_open_drawer)); + solo.goBackToActivity(MainActivity.class.getSimpleName()); + solo.goBack(); + assertTrue(((MainActivity)solo.getCurrentActivity()).isDrawerOpen()); + } + + @Test + public void testBackButtonBehaviorDoubleTap() { + openNavDrawer(); + solo.clickOnText(solo.getString(R.string.settings_label)); + solo.clickOnText(solo.getString(R.string.user_interface_label)); + solo.clickOnText(solo.getString(R.string.pref_back_button_behavior_title)); + solo.clickOnText(solo.getString(R.string.back_button_double_tap)); + solo.goBackToActivity(MainActivity.class.getSimpleName()); + solo.goBack(); + solo.goBack(); + assertTrue(solo.getCurrentActivity().isFinishing()); + } + + @Test + public void testBackButtonBehaviorPrompt() { + openNavDrawer(); + solo.clickOnText(solo.getString(R.string.settings_label)); + solo.clickOnText(solo.getString(R.string.user_interface_label)); + solo.clickOnText(solo.getString(R.string.pref_back_button_behavior_title)); + solo.clickOnText(solo.getString(R.string.back_button_show_prompt)); + solo.goBackToActivity(MainActivity.class.getSimpleName()); + solo.goBack(); + solo.clickOnText(solo.getString(R.string.yes)); + solo.waitForDialogToClose(); + assertTrue(solo.getCurrentActivity().isFinishing()); + } + + @Test + public void testBackButtonBehaviorDefault() { + openNavDrawer(); + solo.clickOnText(solo.getString(R.string.settings_label)); + solo.clickOnText(solo.getString(R.string.user_interface_label)); + solo.clickOnText(solo.getString(R.string.pref_back_button_behavior_title)); + solo.clickOnText(solo.getString(R.string.back_button_default)); + solo.goBackToActivity(MainActivity.class.getSimpleName()); + solo.goBack(); + assertTrue(solo.getCurrentActivity().isFinishing()); + } } diff --git a/app/src/androidTest/java/de/test/antennapod/ui/PlaybackSonicTest.java b/app/src/androidTest/java/de/test/antennapod/ui/PlaybackSonicTest.java index 293ed2848..55ed998bb 100644 --- a/app/src/androidTest/java/de/test/antennapod/ui/PlaybackSonicTest.java +++ b/app/src/androidTest/java/de/test/antennapod/ui/PlaybackSonicTest.java @@ -59,7 +59,7 @@ public class PlaybackSonicTest extends ActivityInstrumentationTestCase2<MainActi .clear() .putBoolean(UserPreferences.PREF_UNPAUSE_ON_HEADSET_RECONNECT, false) .putBoolean(UserPreferences.PREF_PAUSE_ON_HEADSET_DISCONNECT, false) - .putBoolean(UserPreferences.PREF_SONIC, true) + .putString(UserPreferences.PREF_MEDIA_PLAYER, "sonic") .commit(); solo = new Solo(getInstrumentation(), getActivity()); diff --git a/app/src/androidTest/java/de/test/antennapod/ui/PreferencesTest.java b/app/src/androidTest/java/de/test/antennapod/ui/PreferencesTest.java index 9a5ea437c..f217ecffa 100644 --- a/app/src/androidTest/java/de/test/antennapod/ui/PreferencesTest.java +++ b/app/src/androidTest/java/de/test/antennapod/ui/PreferencesTest.java @@ -1,15 +1,14 @@ package de.test.antennapod.ui; -import android.content.Context; +import android.content.SharedPreferences; import android.content.res.Resources; -import android.test.ActivityInstrumentationTestCase2; - +import android.preference.PreferenceManager; +import android.support.test.espresso.contrib.RecyclerViewActions; +import android.support.test.rule.ActivityTestRule; +import android.support.test.runner.AndroidJUnit4; +import android.view.View; import com.robotium.solo.Solo; import com.robotium.solo.Timeout; - -import java.util.Arrays; -import java.util.concurrent.TimeUnit; - import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.PreferenceActivity; import de.danoeh.antennapod.core.preferences.UserPreferences; @@ -17,36 +16,58 @@ import de.danoeh.antennapod.core.storage.APCleanupAlgorithm; import de.danoeh.antennapod.core.storage.APNullCleanupAlgorithm; import de.danoeh.antennapod.core.storage.APQueueCleanupAlgorithm; import de.danoeh.antennapod.core.storage.EpisodeCleanupAlgorithm; +import de.danoeh.antennapod.fragment.EpisodesFragment; +import de.danoeh.antennapod.fragment.QueueFragment; +import de.danoeh.antennapod.fragment.SubscriptionFragment; -public class PreferencesTest extends ActivityInstrumentationTestCase2<PreferenceActivity> { +import org.hamcrest.Matcher; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; - private static final String TAG = "PreferencesTest"; +import java.util.Arrays; +import java.util.concurrent.TimeUnit; +import static android.support.test.InstrumentationRegistry.getInstrumentation; +import static android.support.test.espresso.Espresso.onView; +import static android.support.test.espresso.action.ViewActions.click; +import static android.support.test.espresso.matcher.ViewMatchers.hasDescendant; +import static android.support.test.espresso.matcher.ViewMatchers.withId; +import static android.support.test.espresso.matcher.ViewMatchers.withText; +import static junit.framework.TestCase.assertEquals; +import static junit.framework.TestCase.assertTrue; + +@RunWith(AndroidJUnit4.class) +public class PreferencesTest { private Solo solo; - private Context context; private Resources res; + private SharedPreferences prefs; - public PreferencesTest() { - super(PreferenceActivity.class); - } + @Rule + public ActivityTestRule<PreferenceActivity> mActivityRule = new ActivityTestRule<>(PreferenceActivity.class); - @Override - public void setUp() throws Exception { - super.setUp(); - solo = new Solo(getInstrumentation(), getActivity()); + @Before + public void setUp() { + solo = new Solo(getInstrumentation(), mActivityRule.getActivity()); Timeout.setSmallTimeout(500); Timeout.setLargeTimeout(1000); - context = getInstrumentation().getTargetContext(); - res = getActivity().getResources(); - UserPreferences.init(context); + res = mActivityRule.getActivity().getResources(); + UserPreferences.init(mActivityRule.getActivity()); + + prefs = PreferenceManager.getDefaultSharedPreferences(mActivityRule.getActivity()); + prefs.edit().clear(); + prefs.edit().putBoolean(UserPreferences.PREF_ENABLE_AUTODL, true).commit(); } - @Override - public void tearDown() throws Exception { + @After + public void tearDown() { solo.finishOpenedActivities(); - super.tearDown(); + prefs.edit().clear(); } + @Test public void testSwitchTheme() { final int theme = UserPreferences.getTheme(); int otherTheme; @@ -55,13 +76,13 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference } else { otherTheme = R.string.pref_theme_title_light; } - solo.clickOnText(solo.getString(R.string.user_interface_label)); - solo.clickOnText(solo.getString(R.string.pref_set_theme_title)); - solo.waitForDialogToOpen(); - solo.clickOnText(solo.getString(otherTheme)); + clickPreference(withText(R.string.user_interface_label)); + clickPreference(withText(R.string.pref_set_theme_title)); + onView(withText(otherTheme)).perform(click()); assertTrue(solo.waitForCondition(() -> UserPreferences.getTheme() != theme, Timeout.getLargeTimeout())); } + @Test public void testSwitchThemeBack() { final int theme = UserPreferences.getTheme(); int otherTheme; @@ -70,33 +91,23 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference } else { otherTheme = R.string.pref_theme_title_light; } - solo.clickOnText(solo.getString(R.string.user_interface_label)); - solo.clickOnText(solo.getString(R.string.pref_set_theme_title)); - solo.waitForDialogToOpen(1000); - solo.clickOnText(solo.getString(otherTheme)); + clickPreference(withText(R.string.user_interface_label)); + clickPreference(withText(R.string.pref_set_theme_title)); + onView(withText(otherTheme)).perform(click()); assertTrue(solo.waitForCondition(() -> UserPreferences.getTheme() != theme, Timeout.getLargeTimeout())); } - public void testExpandNotification() { - solo.clickOnText(solo.getString(R.string.user_interface_label)); - final int priority = UserPreferences.getNotifyPriority(); - solo.clickOnText(solo.getString(R.string.pref_expandNotify_title)); - assertTrue(solo.waitForCondition(() -> priority != UserPreferences.getNotifyPriority(), Timeout.getLargeTimeout())); - solo.clickOnText(solo.getString(R.string.pref_expandNotify_title)); - assertTrue(solo.waitForCondition(() -> priority == UserPreferences.getNotifyPriority(), Timeout.getLargeTimeout())); - } - + @Test public void testEnablePersistentPlaybackControls() { - solo.clickOnText(solo.getString(R.string.user_interface_label)); final boolean persistNotify = UserPreferences.isPersistNotify(); - solo.scrollDown(); - solo.scrollDown(); - solo.clickOnText(solo.getString(R.string.pref_persistNotify_title)); + clickPreference(withText(R.string.user_interface_label)); + clickPreference(withText(R.string.pref_persistNotify_title)); assertTrue(solo.waitForCondition(() -> persistNotify != UserPreferences.isPersistNotify(), Timeout.getLargeTimeout())); - solo.clickOnText(solo.getString(R.string.pref_persistNotify_title)); + clickPreference(withText(R.string.pref_persistNotify_title)); assertTrue(solo.waitForCondition(() -> persistNotify == UserPreferences.isPersistNotify(), Timeout.getLargeTimeout())); } + @Test public void testSetLockscreenButtons() { solo.clickOnText(solo.getString(R.string.user_interface_label)); solo.scrollDown(); @@ -123,6 +134,7 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference assertTrue(solo.waitForCondition(() -> !UserPreferences.showSkipOnCompactNotification(), Timeout.getLargeTimeout())); } + @Test public void testEnqueueAtFront() { solo.clickOnText(solo.getString(R.string.playback_pref)); final boolean enqueueAtFront = UserPreferences.enqueueAtFront(); @@ -134,6 +146,7 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference assertTrue(solo.waitForCondition(() -> enqueueAtFront == UserPreferences.enqueueAtFront(), Timeout.getLargeTimeout())); } + @Test public void testHeadPhonesDisconnect() { solo.clickOnText(solo.getString(R.string.playback_pref)); final boolean pauseOnHeadsetDisconnect = UserPreferences.isPauseOnHeadsetDisconnect(); @@ -143,6 +156,7 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference assertTrue(solo.waitForCondition(() -> pauseOnHeadsetDisconnect == UserPreferences.isPauseOnHeadsetDisconnect(), Timeout.getLargeTimeout())); } + @Test public void testHeadPhonesReconnect() { solo.clickOnText(solo.getString(R.string.playback_pref)); if(UserPreferences.isPauseOnHeadsetDisconnect() == false) { @@ -156,6 +170,7 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference assertTrue(solo.waitForCondition(() -> unpauseOnHeadsetReconnect == UserPreferences.isUnpauseOnHeadsetReconnect(), Timeout.getLargeTimeout())); } + @Test public void testBluetoothReconnect() { solo.clickOnText(solo.getString(R.string.playback_pref)); if(UserPreferences.isPauseOnHeadsetDisconnect() == false) { @@ -169,6 +184,7 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference assertTrue(solo.waitForCondition(() -> unpauseOnBluetoothReconnect == UserPreferences.isUnpauseOnBluetoothReconnect(), Timeout.getLargeTimeout())); } + @Test public void testContinuousPlayback() { solo.clickOnText(solo.getString(R.string.playback_pref)); final boolean continuousPlayback = UserPreferences.isFollowQueue(); @@ -180,6 +196,7 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference assertTrue(solo.waitForCondition(() -> continuousPlayback == UserPreferences.isFollowQueue(), Timeout.getLargeTimeout())); } + @Test public void testAutoDelete() { solo.clickOnText(solo.getString(R.string.storage_pref)); final boolean autoDelete = UserPreferences.isAutoDelete(); @@ -189,17 +206,15 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference assertTrue(solo.waitForCondition(() -> autoDelete == UserPreferences.isAutoDelete(), Timeout.getLargeTimeout())); } + @Test public void testPlaybackSpeeds() { - solo.clickOnText(solo.getString(R.string.playback_pref)); - solo.scrollDown(); - solo.scrollDown(); - solo.clickOnText(solo.getString(R.string.pref_playback_speed_title)); - solo.waitForDialogToOpen(1000); + clickPreference(withText(R.string.playback_pref)); + clickPreference(withText(R.string.pref_playback_speed_title)); assertTrue(solo.searchText(res.getStringArray(R.array.playback_speed_values)[0])); - solo.clickOnText(solo.getString(R.string.cancel_label)); - solo.waitForDialogToClose(1000); + onView(withText(R.string.cancel_label)).perform(click()); } + @Test public void testPauseForInterruptions() { solo.clickOnText(solo.getString(R.string.playback_pref)); final boolean pauseForFocusLoss = UserPreferences.shouldPauseForFocusLoss(); @@ -209,6 +224,7 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference assertTrue(solo.waitForCondition(() -> pauseForFocusLoss == UserPreferences.shouldPauseForFocusLoss(), Timeout.getLargeTimeout())); } + @Test public void testDisableUpdateInterval() { solo.clickOnText(solo.getString(R.string.network_pref)); solo.clickOnText(solo.getString(R.string.pref_autoUpdateIntervallOrTime_sum)); @@ -217,31 +233,31 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference assertTrue(solo.waitForCondition(() -> UserPreferences.getUpdateInterval() == 0, 1000)); } + @Test public void testSetUpdateInterval() { - solo.clickOnText(solo.getString(R.string.network_pref)); - solo.clickOnText(solo.getString(R.string.pref_autoUpdateIntervallOrTime_title)); - solo.waitForDialogToOpen(); - solo.clickOnText(solo.getString(R.string.pref_autoUpdateIntervallOrTime_Interval)); - solo.waitForDialogToOpen(); + clickPreference(withText(R.string.network_pref)); + clickPreference(withText(R.string.pref_autoUpdateIntervallOrTime_title)); + onView(withText(R.string.pref_autoUpdateIntervallOrTime_Interval)).perform(click()); String search = "12 " + solo.getString(R.string.pref_update_interval_hours_plural); - solo.clickOnText(search); - solo.waitForDialogToClose(); + onView(withText(search)).perform(click()); assertTrue(solo.waitForCondition(() -> UserPreferences.getUpdateInterval() == TimeUnit.HOURS.toMillis(12), Timeout.getLargeTimeout())); } + @Test public void testMobileUpdates() { - solo.clickOnText(solo.getString(R.string.network_pref)); + clickPreference(withText(R.string.network_pref)); final boolean mobileUpdates = UserPreferences.isAllowMobileUpdate(); - solo.clickOnText(solo.getString(R.string.pref_mobileUpdate_title)); + clickPreference(withText(R.string.pref_mobileUpdate_title)); assertTrue(solo.waitForCondition(() -> mobileUpdates != UserPreferences.isAllowMobileUpdate(), Timeout.getLargeTimeout())); - solo.clickOnText(solo.getString(R.string.pref_mobileUpdate_title)); + clickPreference(withText(R.string.pref_mobileUpdate_title)); assertTrue(solo.waitForCondition(() -> mobileUpdates == UserPreferences.isAllowMobileUpdate(), Timeout.getLargeTimeout())); } + @Test public void testSetSequentialDownload() { - solo.clickOnText(solo.getString(R.string.network_pref)); - solo.clickOnText(solo.getString(R.string.pref_parallel_downloads_title)); + clickPreference(withText(R.string.network_pref)); + clickPreference(withText(R.string.pref_parallel_downloads_title)); solo.waitForDialogToOpen(); solo.clearEditText(0); solo.enterText(0, "1"); @@ -249,9 +265,10 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference assertTrue(solo.waitForCondition(() -> UserPreferences.getParallelDownloads() == 1, Timeout.getLargeTimeout())); } + @Test public void testSetParallelDownloads() { - solo.clickOnText(solo.getString(R.string.network_pref)); - solo.clickOnText(solo.getString(R.string.pref_parallel_downloads_title)); + clickPreference(withText(R.string.network_pref)); + clickPreference(withText(R.string.pref_parallel_downloads_title)); solo.waitForDialogToOpen(); solo.clearEditText(0); solo.enterText(0, "10"); @@ -259,50 +276,50 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference assertTrue(solo.waitForCondition(() -> UserPreferences.getParallelDownloads() == 10, Timeout.getLargeTimeout())); } + @Test public void testSetParallelDownloadsInvalidInput() { - solo.clickOnText(solo.getString(R.string.network_pref)); - solo.clickOnText(solo.getString(R.string.pref_parallel_downloads_title)); + clickPreference(withText(R.string.network_pref)); + clickPreference(withText(R.string.pref_parallel_downloads_title)); solo.waitForDialogToOpen(); solo.clearEditText(0); solo.enterText(0, "0"); - assertEquals("1", solo.getEditText(0).getText().toString()); + assertEquals("", solo.getEditText(0).getText().toString()); solo.clearEditText(0); solo.enterText(0, "100"); - assertEquals("50", solo.getEditText(0).getText().toString()); + assertEquals("", solo.getEditText(0).getText().toString()); } + @Test public void testSetEpisodeCache() { String[] entries = res.getStringArray(R.array.episode_cache_size_entries); String[] values = res.getStringArray(R.array.episode_cache_size_values); String entry = entries[entries.length/2]; final int value = Integer.valueOf(values[values.length/2]); - solo.clickOnText(solo.getString(R.string.network_pref)); - solo.clickOnText(solo.getString(R.string.pref_automatic_download_title)); - solo.waitForText(solo.getString(R.string.pref_automatic_download_title)); - solo.clickOnText(solo.getString(R.string.pref_episode_cache_title)); + clickPreference(withText(R.string.network_pref)); + clickPreference(withText(R.string.pref_automatic_download_title)); + clickPreference(withText(R.string.pref_episode_cache_title)); solo.waitForDialogToOpen(); solo.clickOnText(entry); assertTrue(solo.waitForCondition(() -> UserPreferences.getEpisodeCacheSize() == value, Timeout.getLargeTimeout())); } + @Test public void testSetEpisodeCacheMin() { String[] entries = res.getStringArray(R.array.episode_cache_size_entries); String[] values = res.getStringArray(R.array.episode_cache_size_values); String minEntry = entries[0]; final int minValue = Integer.valueOf(values[0]); - solo.clickOnText(solo.getString(R.string.network_pref)); - solo.clickOnText(solo.getString(R.string.pref_automatic_download_title)); - solo.waitForText(solo.getString(R.string.pref_automatic_download_title)); - if(!UserPreferences.isEnableAutodownload()) { - solo.clickOnText(solo.getString(R.string.pref_automatic_download_title)); - } - solo.clickOnText(solo.getString(R.string.pref_episode_cache_title)); + + clickPreference(withText(R.string.network_pref)); + clickPreference(withText(R.string.pref_automatic_download_title)); + clickPreference(withText(R.string.pref_episode_cache_title)); solo.waitForDialogToOpen(1000); solo.scrollUp(); solo.clickOnText(minEntry); assertTrue(solo.waitForCondition(() -> UserPreferences.getEpisodeCacheSize() == minValue, Timeout.getLargeTimeout())); } + @Test public void testSetEpisodeCacheMax() { String[] entries = res.getStringArray(R.array.episode_cache_size_entries); String[] values = res.getStringArray(R.array.episode_cache_size_values); @@ -311,24 +328,22 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference solo.clickOnText(solo.getString(R.string.network_pref)); solo.clickOnText(solo.getString(R.string.pref_automatic_download_title)); solo.waitForText(solo.getString(R.string.pref_automatic_download_title)); - if(!UserPreferences.isEnableAutodownload()) { - solo.clickOnText(solo.getString(R.string.pref_automatic_download_title)); - } solo.clickOnText(solo.getString(R.string.pref_episode_cache_title)); solo.waitForDialogToOpen(); solo.clickOnText(maxEntry); assertTrue(solo.waitForCondition(() -> UserPreferences.getEpisodeCacheSize() == maxValue, Timeout.getLargeTimeout())); } + @Test public void testAutomaticDownload() { final boolean automaticDownload = UserPreferences.isEnableAutodownload(); - solo.clickOnText(solo.getString(R.string.network_pref)); - solo.clickOnText(solo.getString(R.string.pref_automatic_download_title)); - solo.waitForText(solo.getString(R.string.pref_automatic_download_title)); - solo.clickOnText(solo.getString(R.string.pref_automatic_download_title)); + clickPreference(withText(R.string.network_pref)); + clickPreference(withText(R.string.pref_automatic_download_title)); + clickPreference(withText(R.string.pref_automatic_download_title)); + assertTrue(solo.waitForCondition(() -> automaticDownload != UserPreferences.isEnableAutodownload(), Timeout.getLargeTimeout())); if(UserPreferences.isEnableAutodownload() == false) { - solo.clickOnText(solo.getString(R.string.pref_automatic_download_title)); + clickPreference(withText(R.string.pref_automatic_download_title)); } assertTrue(solo.waitForCondition(() -> UserPreferences.isEnableAutodownload() == true, Timeout.getLargeTimeout())); final boolean enableAutodownloadOnBattery = UserPreferences.isEnableAutodownloadOnBattery(); @@ -343,6 +358,7 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference assertTrue(solo.waitForCondition(() -> enableWifiFilter == UserPreferences.isEnableAutodownloadWifiFilter(), Timeout.getLargeTimeout())); } + @Test public void testEpisodeCleanupQueueOnly() { solo.clickOnText(solo.getString(R.string.network_pref)); solo.clickOnText(solo.getString(R.string.pref_automatic_download_title)); @@ -356,6 +372,7 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference Timeout.getLargeTimeout())); } + @Test public void testEpisodeCleanupNeverAlg() { solo.clickOnText(solo.getString(R.string.network_pref)); solo.clickOnText(solo.getString(R.string.pref_automatic_download_title)); @@ -369,6 +386,7 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference Timeout.getLargeTimeout())); } + @Test public void testEpisodeCleanupClassic() { solo.clickOnText(solo.getString(R.string.network_pref)); solo.clickOnText(solo.getString(R.string.pref_automatic_download_title)); @@ -386,12 +404,14 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference Timeout.getLargeTimeout())); } + @Test public void testEpisodeCleanupNumDays() { - solo.clickOnText(solo.getString(R.string.network_pref)); - solo.clickOnText(solo.getString(R.string.pref_automatic_download_title)); - solo.clickOnText(solo.getString(R.string.pref_episode_cleanup_title)); - solo.waitForText(solo.getString(R.string.episode_cleanup_after_listening)); - solo.clickOnText("5"); + clickPreference(withText(R.string.network_pref)); + clickPreference(withText(R.string.pref_automatic_download_title)); + clickPreference(withText(R.string.pref_episode_cleanup_title)); + solo.waitForDialogToOpen(); + String search = res.getQuantityString(R.plurals.episode_cleanup_days_after_listening, 5, 5); + onView(withText(search)).perform(click()); assertTrue(solo.waitForCondition(() -> { EpisodeCleanupAlgorithm alg = UserPreferences.getEpisodeCleanupAlgorithm(); if (alg instanceof APCleanupAlgorithm) { @@ -403,15 +423,13 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference Timeout.getLargeTimeout())); } - + @Test public void testRewindChange() { int seconds = UserPreferences.getRewindSecs(); int deltas[] = res.getIntArray(R.array.seek_delta_values); - solo.clickOnText(solo.getString(R.string.playback_pref)); - solo.scrollDown(); - solo.scrollDown(); - solo.clickOnText(solo.getString(R.string.pref_rewind)); + clickPreference(withText(R.string.playback_pref)); + clickPreference(withText(R.string.pref_rewind)); solo.waitForDialogToOpen(); int currentIndex = Arrays.binarySearch(deltas, seconds); @@ -419,24 +437,22 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference // Find next value (wrapping around to next) int newIndex = (currentIndex + 1) % deltas.length; - - solo.clickOnText(String.valueOf(deltas[newIndex]) + " seconds"); - solo.clickOnButton("Confirm"); + onView(withText(String.valueOf(deltas[newIndex]) + " seconds")).perform(click()); + onView(withText("Confirm")).perform(click()); solo.waitForDialogToClose(); assertTrue(solo.waitForCondition(() -> UserPreferences.getRewindSecs() == deltas[newIndex], Timeout.getLargeTimeout())); } + @Test public void testFastForwardChange() { - solo.clickOnText(solo.getString(R.string.playback_pref)); - solo.scrollDown(); - solo.scrollDown(); + clickPreference(withText(R.string.playback_pref)); for (int i = 2; i > 0; i--) { // repeat twice to catch any error where fastforward is tracking rewind int seconds = UserPreferences.getFastForwardSecs(); int deltas[] = res.getIntArray(R.array.seek_delta_values); - solo.clickOnText(solo.getString(R.string.pref_fast_forward)); + clickPreference(withText(R.string.pref_fast_forward)); solo.waitForDialogToOpen(); int currentIndex = Arrays.binarySearch(deltas, seconds); @@ -445,12 +461,52 @@ public class PreferencesTest extends ActivityInstrumentationTestCase2<Preference // Find next value (wrapping around to next) int newIndex = (currentIndex + 1) % deltas.length; - solo.clickOnText(String.valueOf(deltas[newIndex]) + " seconds"); - solo.clickOnButton("Confirm"); + onView(withText(String.valueOf(deltas[newIndex]) + " seconds")).perform(click()); + onView(withText("Confirm")).perform(click()); solo.waitForDialogToClose(); assertTrue(solo.waitForCondition(() -> UserPreferences.getFastForwardSecs() == deltas[newIndex], Timeout.getLargeTimeout())); } } + + @Test + public void testBackButtonBehaviorGoToPageSelector() { + clickPreference(withText(R.string.user_interface_label)); + clickPreference(withText(R.string.pref_back_button_behavior_title)); + solo.waitForDialogToOpen(); + solo.clickOnText(solo.getString(R.string.back_button_go_to_page)); + solo.waitForDialogToOpen(); + solo.clickOnText(solo.getString(R.string.queue_label)); + solo.clickOnText(solo.getString(R.string.confirm_label)); + assertTrue(solo.waitForCondition(() -> UserPreferences.getBackButtonBehavior() == UserPreferences.BackButtonBehavior.GO_TO_PAGE, + Timeout.getLargeTimeout())); + assertTrue(solo.waitForCondition(() -> UserPreferences.getBackButtonGoToPage().equals(QueueFragment.TAG), + Timeout.getLargeTimeout())); + clickPreference(withText(R.string.pref_back_button_behavior_title)); + solo.waitForDialogToOpen(); + solo.clickOnText(solo.getString(R.string.back_button_go_to_page)); + solo.waitForDialogToOpen(); + solo.clickOnText(solo.getString(R.string.episodes_label)); + solo.clickOnText(solo.getString(R.string.confirm_label)); + assertTrue(solo.waitForCondition(() -> UserPreferences.getBackButtonBehavior() == UserPreferences.BackButtonBehavior.GO_TO_PAGE, + Timeout.getLargeTimeout())); + assertTrue(solo.waitForCondition(() -> UserPreferences.getBackButtonGoToPage().equals(EpisodesFragment.TAG), + Timeout.getLargeTimeout())); + clickPreference(withText(R.string.pref_back_button_behavior_title)); + solo.waitForDialogToOpen(); + solo.clickOnText(solo.getString(R.string.back_button_go_to_page)); + solo.waitForDialogToOpen(); + solo.clickOnText(solo.getString(R.string.subscriptions_label)); + solo.clickOnText(solo.getString(R.string.confirm_label)); + assertTrue(solo.waitForCondition(() -> UserPreferences.getBackButtonBehavior() == UserPreferences.BackButtonBehavior.GO_TO_PAGE, + Timeout.getLargeTimeout())); + assertTrue(solo.waitForCondition(() -> UserPreferences.getBackButtonGoToPage().equals(SubscriptionFragment.TAG), + Timeout.getLargeTimeout())); + } + + private void clickPreference(Matcher<View> matcher) { + onView(withId(R.id.list)) + .perform(RecyclerViewActions.actionOnItem(hasDescendant(matcher), click())); + } } diff --git a/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/GeneratorUtil.java b/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/GeneratorUtil.java index 7f6f0fb0f..89542d222 100644 --- a/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/GeneratorUtil.java +++ b/app/src/androidTest/java/de/test/antennapod/util/syndication/feedgenerator/GeneratorUtil.java @@ -8,6 +8,7 @@ import java.io.IOException; * Utility methods for FeedGenerator */ class GeneratorUtil { + private GeneratorUtil(){} public static void addPaymentLink(XmlSerializer xml, String paymentLink, boolean withNamespace) throws IOException { String ns = (withNamespace) ? "http://www.w3.org/2005/Atom" : null; diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 8cbbc4cbf..c3310721f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,8 +2,8 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="de.danoeh.antennapod" android:installLocation="auto" - android:versionCode="1060690" - android:versionName="1.6.6-RC1"> + android:versionCode="1070195" + android:versionName="1.7.1"> <!-- Version code schema: "1.2.3-SNAPSHOT" -> 1020300 diff --git a/app/src/main/java/de/danoeh/antennapod/PodcastApp.java b/app/src/main/java/de/danoeh/antennapod/PodcastApp.java index 3abf7557a..fde9af16f 100644 --- a/app/src/main/java/de/danoeh/antennapod/PodcastApp.java +++ b/app/src/main/java/de/danoeh/antennapod/PodcastApp.java @@ -20,7 +20,7 @@ public class PodcastApp extends Application { try { Class.forName("de.danoeh.antennapod.config.ClientConfigurator"); } catch (Exception e) { - throw new RuntimeException("ClientConfigurator not found"); + throw new RuntimeException("ClientConfigurator not found", e); } } diff --git a/app/src/main/java/de/danoeh/antennapod/activity/AboutActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/AboutActivity.java index 6cbfbc6a7..2270c144c 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/AboutActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/AboutActivity.java @@ -43,8 +43,8 @@ public class AboutActivity extends AppCompatActivity { super.onCreate(savedInstanceState); getSupportActionBar().setDisplayShowHomeEnabled(true); setContentView(R.layout.about); - webViewContainer = (LinearLayout) findViewById(R.id.webViewContainer); - webView = (WebView) findViewById(R.id.webViewAbout); + webViewContainer = findViewById(R.id.webViewContainer); + webView = findViewById(R.id.webViewAbout); webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE); if (UserPreferences.getTheme() == R.style.Theme_AntennaPod_Dark) { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) { diff --git a/app/src/main/java/de/danoeh/antennapod/activity/DirectoryChooserActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/DirectoryChooserActivity.java index 390d4cef8..33def125e 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/DirectoryChooserActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/DirectoryChooserActivity.java @@ -64,11 +64,11 @@ public class DirectoryChooserActivity extends AppCompatActivity { getSupportActionBar().setDisplayHomeAsUpEnabled(true); setContentView(R.layout.directory_chooser); - butConfirm = (Button) findViewById(R.id.butConfirm); - butCancel = (Button) findViewById(R.id.butCancel); - butNavUp = (ImageButton) findViewById(R.id.butNavUp); - txtvSelectedFolder = (TextView) findViewById(R.id.txtvSelectedFolder); - listDirectories = (ListView) findViewById(R.id.directory_list); + butConfirm = findViewById(R.id.butConfirm); + butCancel = findViewById(R.id.butCancel); + butNavUp = findViewById(R.id.butNavUp); + txtvSelectedFolder = findViewById(R.id.txtvSelectedFolder); + listDirectories = findViewById(R.id.directory_list); butConfirm.setOnClickListener(new OnClickListener() { diff --git a/app/src/main/java/de/danoeh/antennapod/activity/DownloadAuthenticationActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/DownloadAuthenticationActivity.java index e726afaec..5e04d743d 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/DownloadAuthenticationActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/DownloadAuthenticationActivity.java @@ -49,11 +49,11 @@ public class DownloadAuthenticationActivity extends AppCompatActivity { } setContentView(R.layout.download_authentication_activity); - TextView txtvDescription = (TextView) findViewById(R.id.txtvDescription); - etxtUsername = (EditText) findViewById(R.id.etxtUsername); - etxtPassword = (EditText) findViewById(R.id.etxtPassword); - Button butConfirm = (Button) findViewById(R.id.butConfirm); - Button butCancel = (Button) findViewById(R.id.butCancel); + TextView txtvDescription = findViewById(R.id.txtvDescription); + etxtUsername = findViewById(R.id.etxtUsername); + etxtPassword = findViewById(R.id.etxtPassword); + Button butConfirm = findViewById(R.id.butConfirm); + Button butCancel = findViewById(R.id.butCancel); Validate.isTrue(getIntent().hasExtra(ARG_DOWNLOAD_REQUEST), "Download request missing"); DownloadRequest request = getIntent().getParcelableExtra(ARG_DOWNLOAD_REQUEST); diff --git a/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java index ebb826287..f6a878873 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java @@ -86,22 +86,22 @@ public class FeedInfoActivity extends AppCompatActivity { getSupportActionBar().setDisplayHomeAsUpEnabled(true); long feedId = getIntent().getLongExtra(EXTRA_FEED_ID, -1); - imgvCover = (ImageView) findViewById(R.id.imgvCover); - txtvTitle = (TextView) findViewById(R.id.txtvTitle); - TextView txtvAuthorHeader = (TextView) findViewById(R.id.txtvAuthor); - ImageView imgvBackground = (ImageView) findViewById(R.id.imgvBackground); + imgvCover = findViewById(R.id.imgvCover); + txtvTitle = findViewById(R.id.txtvTitle); + TextView txtvAuthorHeader = findViewById(R.id.txtvAuthor); + ImageView imgvBackground = findViewById(R.id.imgvBackground); findViewById(R.id.butShowInfo).setVisibility(View.INVISIBLE); findViewById(R.id.butShowSettings).setVisibility(View.INVISIBLE); // https://github.com/bumptech/glide/issues/529 imgvBackground.setColorFilter(new LightingColorFilter(0xff828282, 0x000000)); - txtvDescription = (TextView) findViewById(R.id.txtvDescription); - lblLanguage = (TextView) findViewById(R.id.lblLanguage); - txtvLanguage = (TextView) findViewById(R.id.txtvLanguage); - lblAuthor = (TextView) findViewById(R.id.lblAuthor); - txtvAuthor = (TextView) findViewById(R.id.txtvDetailsAuthor); - txtvUrl = (TextView) findViewById(R.id.txtvUrl); + txtvDescription = findViewById(R.id.txtvDescription); + lblLanguage = findViewById(R.id.lblLanguage); + txtvLanguage = findViewById(R.id.txtvLanguage); + lblAuthor = findViewById(R.id.lblAuthor); + txtvAuthor = findViewById(R.id.txtvDetailsAuthor); + txtvUrl = findViewById(R.id.txtvUrl); txtvUrl.setOnClickListener(copyUrlToClipboard); diff --git a/app/src/main/java/de/danoeh/antennapod/activity/FeedSettingsActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/FeedSettingsActivity.java index 0a724d149..fcda186ad 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/FeedSettingsActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/FeedSettingsActivity.java @@ -112,27 +112,27 @@ public class FeedSettingsActivity extends AppCompatActivity { getSupportActionBar().setDisplayHomeAsUpEnabled(true); long feedId = getIntent().getLongExtra(EXTRA_FEED_ID, -1); - imgvCover = (ImageView) findViewById(R.id.imgvCover); - txtvTitle = (TextView) findViewById(R.id.txtvTitle); - TextView txtvAuthorHeader = (TextView) findViewById(R.id.txtvAuthor); - ImageView imgvBackground = (ImageView) findViewById(R.id.imgvBackground); + imgvCover = findViewById(R.id.imgvCover); + txtvTitle = findViewById(R.id.txtvTitle); + TextView txtvAuthorHeader = findViewById(R.id.txtvAuthor); + ImageView imgvBackground = findViewById(R.id.imgvBackground); findViewById(R.id.butShowInfo).setVisibility(View.INVISIBLE); findViewById(R.id.butShowSettings).setVisibility(View.INVISIBLE); // https://github.com/bumptech/glide/issues/529 imgvBackground.setColorFilter(new LightingColorFilter(0xff828282, 0x000000)); - cbxAutoDownload = (CheckBox) findViewById(R.id.cbxAutoDownload); - cbxKeepUpdated = (CheckBox) findViewById(R.id.cbxKeepUpdated); - spnAutoDelete = (Spinner) findViewById(R.id.spnAutoDelete); - etxtUsername = (EditText) findViewById(R.id.etxtUsername); - etxtPassword = (EditText) findViewById(R.id.etxtPassword); - etxtFilterText = (EditText) findViewById(R.id.etxtEpisodeFilterText); - rdoFilterInclude = (RadioButton) findViewById(R.id.radio_filter_include); + cbxAutoDownload = findViewById(R.id.cbxAutoDownload); + cbxKeepUpdated = findViewById(R.id.cbxKeepUpdated); + spnAutoDelete = findViewById(R.id.spnAutoDelete); + etxtUsername = findViewById(R.id.etxtUsername); + etxtPassword = findViewById(R.id.etxtPassword); + etxtFilterText = findViewById(R.id.etxtEpisodeFilterText); + rdoFilterInclude = findViewById(R.id.radio_filter_include); rdoFilterInclude.setOnClickListener(v -> { filterInclude = true; filterTextChanged = true; }); - rdoFilterExclude = (RadioButton) findViewById(R.id.radio_filter_exclude); + rdoFilterExclude = findViewById(R.id.radio_filter_exclude); rdoFilterExclude.setOnClickListener(v -> { filterInclude = false; filterTextChanged = true; diff --git a/app/src/main/java/de/danoeh/antennapod/activity/FlattrAuthActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/FlattrAuthActivity.java index 26352f58f..2b4384a02 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/FlattrAuthActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/FlattrAuthActivity.java @@ -41,9 +41,9 @@ public class FlattrAuthActivity extends AppCompatActivity { if (BuildConfig.DEBUG) Log.d(TAG, "Activity created"); getSupportActionBar().setDisplayHomeAsUpEnabled(true); setContentView(R.layout.flattr_auth); - txtvExplanation = (TextView) findViewById(R.id.txtvExplanation); - butAuthenticate = (Button) findViewById(R.id.but_authenticate); - butReturn = (Button) findViewById(R.id.but_return_home); + txtvExplanation = findViewById(R.id.txtvExplanation); + butAuthenticate = findViewById(R.id.but_authenticate); + butReturn = findViewById(R.id.but_return_home); butReturn.setOnClickListener(v -> { Intent intent = new Intent(FlattrAuthActivity.this, MainActivity.class); diff --git a/app/src/main/java/de/danoeh/antennapod/activity/ImportExportActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/ImportExportActivity.java index 91462bce9..e6c9c37cc 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/ImportExportActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/ImportExportActivity.java @@ -13,9 +13,7 @@ import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.MenuItem; -import de.danoeh.antennapod.R; -import de.danoeh.antennapod.core.preferences.UserPreferences; -import de.danoeh.antennapod.core.storage.PodDBAdapter; + import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; @@ -26,6 +24,10 @@ import java.io.IOException; import java.io.InputStream; import java.nio.channels.FileChannel; +import de.danoeh.antennapod.R; +import de.danoeh.antennapod.core.preferences.UserPreferences; +import de.danoeh.antennapod.core.storage.PodDBAdapter; + /** * Displays the 'import/export' screen */ diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java index 71f18ec01..35c468b53 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java @@ -27,6 +27,7 @@ import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; +import android.widget.Toast; import com.bumptech.glide.Glide; @@ -123,6 +124,8 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi private Disposable disposable; + private long lastBackButtonPressTime = 0; + @Override public void onCreate(Bundle savedInstanceState) { setTheme(UserPreferences.getNoTitleTheme()); @@ -130,7 +133,7 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi StorageUtils.checkStorageAvailability(this); setContentView(R.layout.main); - toolbar = (Toolbar) findViewById(R.id.toolbar); + toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { @@ -142,8 +145,8 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi currentTitle = getTitle(); - drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); - navList = (ListView) findViewById(R.id.nav_list); + drawerLayout = findViewById(R.id.drawer_layout); + navList = findViewById(R.id.nav_list); navDrawer = findViewById(R.id.nav_layout); drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.drawer_open, R.string.drawer_close); @@ -643,10 +646,40 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi @Override public void onBackPressed() { - if(isDrawerOpen()) { + if (isDrawerOpen()) { drawerLayout.closeDrawer(navDrawer); - } else { + } else if (getSupportFragmentManager().getBackStackEntryCount() != 0) { super.onBackPressed(); + } else { + switch (UserPreferences.getBackButtonBehavior()) { + case OPEN_DRAWER: + drawerLayout.openDrawer(navDrawer); + break; + case SHOW_PROMPT: + new AlertDialog.Builder(this) + .setMessage(R.string.close_prompt) + .setPositiveButton(R.string.yes, (dialogInterface, i) -> MainActivity.super.onBackPressed()) + .setNegativeButton(R.string.no, null) + .setCancelable(false) + .show(); + break; + case DOUBLE_TAP: + if (lastBackButtonPressTime < System.currentTimeMillis() - 2000) { + Toast.makeText(this, R.string.double_tap_toast, Toast.LENGTH_SHORT).show(); + lastBackButtonPressTime = System.currentTimeMillis(); + } else { + super.onBackPressed(); + } + break; + case GO_TO_PAGE: + if (getLastNavFragment().equals(UserPreferences.getBackButtonGoToPage())) { + super.onBackPressed(); + } else { + loadFragment(UserPreferences.getBackButtonGoToPage(), null); + } + break; + default: super.onBackPressed(); + } } } diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java index 09d2c447d..165cb7679 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java @@ -234,7 +234,6 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements Log.d(TAG, "onCreate()"); StorageUtils.checkStorageAvailability(this); - orientation = getResources().getConfiguration().orientation; getWindow().setFormat(PixelFormat.TRANSPARENT); } @@ -268,15 +267,10 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements private void onBufferUpdate(float progress) { if (sbPosition != null) { - sbPosition.setSecondaryProgress((int) progress * sbPosition.getMax()); + sbPosition.setSecondaryProgress((int) (progress * sbPosition.getMax())); } } - /** - * Current screen orientation. - */ - private int orientation; - @Override protected void onStart() { super.onStart(); @@ -808,13 +802,13 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements void setupGUI() { setContentView(getContentViewResourceId()); - sbPosition = (SeekBar) findViewById(R.id.sbPosition); - txtvPosition = (TextView) findViewById(R.id.txtvPosition); + sbPosition = findViewById(R.id.sbPosition); + txtvPosition = findViewById(R.id.txtvPosition); SharedPreferences prefs = getSharedPreferences(PREFS, MODE_PRIVATE); showTimeLeft = prefs.getBoolean(PREF_SHOW_TIME_LEFT, false); Log.d("timeleft", showTimeLeft ? "true" : "false"); - txtvLength = (TextView) findViewById(R.id.txtvLength); + txtvLength = findViewById(R.id.txtvLength); if (txtvLength != null) { txtvLength.setOnClickListener(v -> { showTimeLeft = !showTimeLeft; @@ -838,18 +832,18 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements }); } - butRev = (ImageButton) findViewById(R.id.butRev); - txtvRev = (TextView) findViewById(R.id.txtvRev); + butRev = findViewById(R.id.butRev); + txtvRev = findViewById(R.id.txtvRev); if (txtvRev != null) { txtvRev.setText(String.valueOf(UserPreferences.getRewindSecs())); } - butPlay = (ImageButton) findViewById(R.id.butPlay); - butFF = (ImageButton) findViewById(R.id.butFF); - txtvFF = (TextView) findViewById(R.id.txtvFF); + butPlay = findViewById(R.id.butPlay); + butFF = findViewById(R.id.butFF); + txtvFF = findViewById(R.id.txtvFF); if (txtvFF != null) { txtvFF.setText(String.valueOf(UserPreferences.getFastForwardSecs())); } - butSkip = (ImageButton) findViewById(R.id.butSkip); + butSkip = findViewById(R.id.butSkip); // SEEKBAR SETUP @@ -1002,7 +996,7 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements } @Override - public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { + public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { if (requestCode == REQUEST_CODE_STORAGE) { if (grantResults.length <= 0 || grantResults[0] != PackageManager.PERMISSION_GRANTED) { Toast.makeText(this, R.string.needs_storage_permission, Toast.LENGTH_LONG).show(); diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java index feac289cc..e549f0115 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerInfoActivity.java @@ -227,18 +227,18 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem @Override protected void setupGUI() { super.setupGUI(); - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle(""); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { findViewById(R.id.shadow).setVisibility(View.GONE); - AppBarLayout appBarLayout = (AppBarLayout) findViewById(R.id.appBar); + AppBarLayout appBarLayout = findViewById(R.id.appBar); float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getResources().getDisplayMetrics()); appBarLayout.setElevation(px); } - drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); - navList = (ListView) findViewById(R.id.nav_list); + drawerLayout = findViewById(R.id.drawer_layout); + navList = findViewById(R.id.nav_list); navDrawer = findViewById(R.id.nav_layout); drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.drawer_open, R.string.drawer_close); @@ -274,14 +274,14 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem startActivity(new Intent(MediaplayerInfoActivity.this, PreferenceActivity.class)); }); - butPlaybackSpeed = (Button) findViewById(R.id.butPlaybackSpeed); - butCastDisconnect = (ImageButton) findViewById(R.id.butCastDisconnect); + butPlaybackSpeed = findViewById(R.id.butPlaybackSpeed); + butCastDisconnect = findViewById(R.id.butCastDisconnect); - pager = (ViewPager) findViewById(R.id.pager); + pager = findViewById(R.id.pager); pagerAdapter = new MediaplayerInfoPagerAdapter(getSupportFragmentManager(), media); pagerAdapter.setController(controller); pager.setAdapter(pagerAdapter); - CirclePageIndicator pageIndicator = (CirclePageIndicator) findViewById(R.id.page_indicator); + CirclePageIndicator pageIndicator = findViewById(R.id.page_indicator); pageIndicator.setViewPager(pager); loadLastFragment(); pager.onSaveInstanceState(); @@ -357,7 +357,7 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem @Override public boolean onOptionsItemSelected(MenuItem item) { - return drawerToggle != null && drawerToggle.onOptionsItemSelected(item) || super.onOptionsItemSelected(item); + return (drawerToggle != null && drawerToggle.onOptionsItemSelected(item)) || super.onOptionsItemSelected(item); } @Override diff --git a/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java index ea063e47d..55128e1fe 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java @@ -144,7 +144,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity { feedUrl = getIntent().getStringExtra(ARG_FEEDURL); } else if (TextUtils.equals(getIntent().getAction(), Intent.ACTION_SEND) || TextUtils.equals(getIntent().getAction(), Intent.ACTION_VIEW)) { - feedUrl = (TextUtils.equals(getIntent().getAction(), Intent.ACTION_SEND)) + feedUrl = TextUtils.equals(getIntent().getAction(), Intent.ACTION_SEND) ? getIntent().getStringExtra(Intent.EXTRA_TEXT) : getIntent().getDataString(); if (actionBar != null) { actionBar.setTitle(R.string.add_feed_label); @@ -306,7 +306,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity { } private void parseFeed() { - if (feed == null || feed.getFile_url() == null && feed.isDownloaded()) { + if (feed == null || (feed.getFile_url() == null && feed.isDownloaded())) { throw new IllegalStateException("feed must be non-null and downloaded when parseFeed is called"); } Log.d(TAG, "Parsing feed"); @@ -379,20 +379,20 @@ public class OnlineFeedViewActivity extends AppCompatActivity { this.feed = feed; this.selectedDownloadUrl = feed.getDownload_url(); EventDistributor.getInstance().register(listener); - ListView listView = (ListView) findViewById(R.id.listview); + ListView listView = findViewById(R.id.listview); LayoutInflater inflater = LayoutInflater.from(this); View header = inflater.inflate(R.layout.onlinefeedview_header, listView, false); listView.addHeaderView(header); listView.setAdapter(new FeedItemlistDescriptionAdapter(this, 0, feed.getItems())); - ImageView cover = (ImageView) header.findViewById(R.id.imgvCover); - TextView title = (TextView) header.findViewById(R.id.txtvTitle); - TextView author = (TextView) header.findViewById(R.id.txtvAuthor); - TextView description = (TextView) header.findViewById(R.id.txtvDescription); - Spinner spAlternateUrls = (Spinner) header.findViewById(R.id.spinnerAlternateUrls); + ImageView cover = header.findViewById(R.id.imgvCover); + TextView title = header.findViewById(R.id.txtvTitle); + TextView author = header.findViewById(R.id.txtvAuthor); + TextView description = header.findViewById(R.id.txtvDescription); + Spinner spAlternateUrls = header.findViewById(R.id.spinnerAlternateUrls); - subscribeButton = (Button) header.findViewById(R.id.butSubscribe); + subscribeButton = header.findViewById(R.id.butSubscribe); if (StringUtils.isNotBlank(feed.getImageUrl())) { Glide.with(this) diff --git a/app/src/main/java/de/danoeh/antennapod/activity/OpmlFeedChooserActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/OpmlFeedChooserActivity.java index cd375a65a..72759c59c 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/OpmlFeedChooserActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/OpmlFeedChooserActivity.java @@ -39,9 +39,9 @@ public class OpmlFeedChooserActivity extends AppCompatActivity { super.onCreate(savedInstanceState); setContentView(R.layout.opml_selection); - butConfirm = (Button) findViewById(R.id.butConfirm); - butCancel = (Button) findViewById(R.id.butCancel); - feedlist = (ListView) findViewById(R.id.feedlist); + butConfirm = findViewById(R.id.butConfirm); + butCancel = findViewById(R.id.butCancel); + feedlist = findViewById(R.id.feedlist); feedlist.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); listAdapter = new ArrayAdapter<>(this, diff --git a/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromPathActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromPathActivity.java index ed7ab5d34..a63d3b735 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromPathActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromPathActivity.java @@ -36,16 +36,16 @@ public class OpmlImportFromPathActivity extends OpmlImportBaseActivity { getSupportActionBar().setDisplayHomeAsUpEnabled(true); setContentView(R.layout.opml_import); - final TextView txtvHeaderExplanation1 = (TextView) findViewById(R.id.txtvHeadingExplanation1); - final TextView txtvExplanation1 = (TextView) findViewById(R.id.txtvExplanation1); - final TextView txtvHeaderExplanation2 = (TextView) findViewById(R.id.txtvHeadingExplanation2); - final TextView txtvExplanation2 = (TextView) findViewById(R.id.txtvExplanation2); - final TextView txtvHeaderExplanation3 = (TextView) findViewById(R.id.txtvHeadingExplanation3); + final TextView txtvHeaderExplanation1 = findViewById(R.id.txtvHeadingExplanation1); + final TextView txtvExplanation1 = findViewById(R.id.txtvExplanation1); + final TextView txtvHeaderExplanation2 = findViewById(R.id.txtvHeadingExplanation2); + final TextView txtvExplanation2 = findViewById(R.id.txtvExplanation2); + final TextView txtvHeaderExplanation3 = findViewById(R.id.txtvHeadingExplanation3); - Button butChooseFilesystem = (Button) findViewById(R.id.butChooseFileFromFilesystem); + Button butChooseFilesystem = findViewById(R.id.butChooseFileFromFilesystem); butChooseFilesystem.setOnClickListener(v -> chooseFileFromFilesystem()); - Button butChooseExternal = (Button) findViewById(R.id.butChooseFileFromExternal); + Button butChooseExternal = findViewById(R.id.butChooseFileFromExternal); butChooseExternal.setOnClickListener(v -> chooseFileFromExternal()); int nextOption = 1; diff --git a/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportHolder.java b/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportHolder.java index b01cf43e4..dc5570dc0 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportHolder.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportHolder.java @@ -14,6 +14,8 @@ import de.danoeh.antennapod.core.export.opml.OpmlElement; */ public class OpmlImportHolder { + private OpmlImportHolder(){} + private static ArrayList<OpmlElement> readElements; public static ArrayList<OpmlElement> getReadElements() { diff --git a/app/src/main/java/de/danoeh/antennapod/activity/PreferenceActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/PreferenceActivity.java index 3f005fe36..452e91bd3 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/PreferenceActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/PreferenceActivity.java @@ -12,11 +12,11 @@ import android.view.MenuItem; import android.view.ViewGroup; import android.widget.FrameLayout; -import java.lang.ref.WeakReference; - -import com.bytehamster.lib.preferencesearch.SearchPreference; import com.bytehamster.lib.preferencesearch.SearchPreferenceResult; import com.bytehamster.lib.preferencesearch.SearchPreferenceResultListener; + +import java.lang.ref.WeakReference; + import de.danoeh.antennapod.R; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.preferences.PreferenceController; diff --git a/app/src/main/java/de/danoeh/antennapod/activity/StatisticsActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/StatisticsActivity.java index 0ed4be906..37199ccf7 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/StatisticsActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/StatisticsActivity.java @@ -53,9 +53,9 @@ public class StatisticsActivity extends AppCompatActivity prefs = getSharedPreferences(PREF_NAME, MODE_PRIVATE); countAll = prefs.getBoolean(PREF_COUNT_ALL, false); - totalTimeTextView = (TextView) findViewById(R.id.total_time); - feedStatisticsList = (ListView) findViewById(R.id.statistics_list); - progressBar = (ProgressBar) findViewById(R.id.progressBar); + totalTimeTextView = findViewById(R.id.total_time); + feedStatisticsList = findViewById(R.id.statistics_list); + progressBar = findViewById(R.id.progressBar); listAdapter = new StatisticsListAdapter(this); listAdapter.setCountAll(countAll); feedStatisticsList.setAdapter(listAdapter); diff --git a/app/src/main/java/de/danoeh/antennapod/activity/StorageErrorActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/StorageErrorActivity.java index a2a49f54e..20e34cc52 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/StorageErrorActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/StorageErrorActivity.java @@ -42,7 +42,7 @@ public class StorageErrorActivity extends AppCompatActivity { setContentView(R.layout.storage_error); - Button btnChooseDataFolder = (Button) findViewById(R.id.btnChooseDataFolder); + Button btnChooseDataFolder = findViewById(R.id.btnChooseDataFolder); btnChooseDataFolder.setOnClickListener(v -> { if (Build.VERSION_CODES.KITKAT <= Build.VERSION.SDK_INT && Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1) { diff --git a/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java index ea408c650..78cc15b2c 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/VideoplayerActivity.java @@ -23,6 +23,10 @@ import android.widget.FrameLayout; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.SeekBar; + +import java.lang.ref.WeakReference; +import java.util.concurrent.atomic.AtomicBoolean; + import de.danoeh.antennapod.R; import de.danoeh.antennapod.core.feed.MediaType; import de.danoeh.antennapod.core.preferences.UserPreferences; @@ -32,9 +36,6 @@ import de.danoeh.antennapod.core.util.gui.PictureInPictureUtil; import de.danoeh.antennapod.core.util.playback.Playable; import de.danoeh.antennapod.view.AspectRatioVideoView; -import java.lang.ref.WeakReference; -import java.util.concurrent.atomic.AtomicBoolean; - /** * Activity for playing video files. */ @@ -142,11 +143,11 @@ public class VideoplayerActivity extends MediaplayerActivity { } super.setupGUI(); getSupportActionBar().setDisplayHomeAsUpEnabled(true); - controls = (LinearLayout) findViewById(R.id.controls); - videoOverlay = (LinearLayout) findViewById(R.id.overlay); - videoview = (AspectRatioVideoView) findViewById(R.id.videoview); - videoframe = (FrameLayout) findViewById(R.id.videoframe); - progressIndicator = (ProgressBar) findViewById(R.id.progressIndicator); + controls = findViewById(R.id.controls); + videoOverlay = findViewById(R.id.overlay); + videoview = findViewById(R.id.videoview); + videoframe = findViewById(R.id.videoframe); + progressIndicator = findViewById(R.id.progressIndicator); videoview.getHolder().addCallback(surfaceHolderCallback); videoframe.setOnTouchListener(onVideoviewTouched); videoOverlay.setOnTouchListener((view, motionEvent) -> true); // To suppress touches directly below the slider diff --git a/app/src/main/java/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java index 8f447ac90..8fcdb4371 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/gpoddernet/GpodnetAuthenticationActivity.java @@ -45,8 +45,6 @@ import de.danoeh.antennapod.core.service.GpodnetSyncService; public class GpodnetAuthenticationActivity extends AppCompatActivity { private static final String TAG = "GpodnetAuthActivity"; - private static final String CURRENT_STEP = "current_step"; - private ViewFlipper viewFlipper; private static final int STEP_DEFAULT = -1; @@ -72,7 +70,7 @@ public class GpodnetAuthenticationActivity extends AppCompatActivity { setContentView(R.layout.gpodnetauth_activity); service = new GpodnetService(); - viewFlipper = (ViewFlipper) findViewById(R.id.viewflipper); + viewFlipper = findViewById(R.id.viewflipper); LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); views = new View[]{ @@ -109,11 +107,11 @@ public class GpodnetAuthenticationActivity extends AppCompatActivity { } private void setupLoginView(View view) { - final EditText username = (EditText) view.findViewById(R.id.etxtUsername); - final EditText password = (EditText) view.findViewById(R.id.etxtPassword); - final Button login = (Button) view.findViewById(R.id.butLogin); - final TextView txtvError = (TextView) view.findViewById(R.id.txtvError); - final ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.progBarLogin); + final EditText username = view.findViewById(R.id.etxtUsername); + final EditText password = view.findViewById(R.id.etxtPassword); + final Button login = view.findViewById(R.id.butLogin); + final TextView txtvError = view.findViewById(R.id.txtvError); + final ProgressBar progressBar = view.findViewById(R.id.progBarLogin); password.setOnEditorActionListener((v, actionID, event) -> actionID == EditorInfo.IME_ACTION_GO && login.performClick()); @@ -177,13 +175,13 @@ public class GpodnetAuthenticationActivity extends AppCompatActivity { } private void setupDeviceView(View view) { - final EditText deviceID = (EditText) view.findViewById(R.id.etxtDeviceID); - final EditText caption = (EditText) view.findViewById(R.id.etxtCaption); - final Button createNewDevice = (Button) view.findViewById(R.id.butCreateNewDevice); - final Button chooseDevice = (Button) view.findViewById(R.id.butChooseExistingDevice); - final TextView txtvError = (TextView) view.findViewById(R.id.txtvError); - final ProgressBar progBarCreateDevice = (ProgressBar) view.findViewById(R.id.progbarCreateDevice); - final Spinner spinnerDevices = (Spinner) view.findViewById(R.id.spinnerChooseDevice); + final EditText deviceID = view.findViewById(R.id.etxtDeviceID); + final EditText caption = view.findViewById(R.id.etxtCaption); + final Button createNewDevice = view.findViewById(R.id.butCreateNewDevice); + final Button chooseDevice = view.findViewById(R.id.butChooseExistingDevice); + final TextView txtvError = view.findViewById(R.id.txtvError); + final ProgressBar progBarCreateDevice = view.findViewById(R.id.progbarCreateDevice); + final Spinner spinnerDevices = view.findViewById(R.id.spinnerChooseDevice); // load device list @@ -348,8 +346,8 @@ public class GpodnetAuthenticationActivity extends AppCompatActivity { } private void setupFinishView(View view) { - final Button sync = (Button) view.findViewById(R.id.butSyncNow); - final Button back = (Button) view.findViewById(R.id.butGoMainscreen); + final Button sync = view.findViewById(R.id.butSyncNow); + final Button back = view.findViewById(R.id.butGoMainscreen); sync.setOnClickListener(v -> { GpodnetSyncService.sendSyncIntent(GpodnetAuthenticationActivity.this); diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/AllEpisodesRecycleAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/AllEpisodesRecycleAdapter.java index 9739b999b..da1ce7670 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/AllEpisodesRecycleAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/AllEpisodesRecycleAdapter.java @@ -1,6 +1,7 @@ package de.danoeh.antennapod.adapter; import android.os.Build; +import android.support.annotation.Nullable; import android.support.v4.content.ContextCompat; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.helper.ItemTouchHelper; @@ -51,7 +52,7 @@ public class AllEpisodesRecycleAdapter extends RecyclerView.Adapter<AllEpisodesR private final ActionButtonUtils actionButtonUtils; private final boolean showOnlyNewEpisodes; - private int position = -1; + private FeedItem selectedItem; private final int playingBackGroundColor; private final int normalBackGroundColor; @@ -76,24 +77,24 @@ public class AllEpisodesRecycleAdapter extends RecyclerView.Adapter<AllEpisodesR View view = LayoutInflater.from(parent.getContext()) .inflate(R.layout.new_episodes_listitem, parent, false); Holder holder = new Holder(view); - holder.container = (FrameLayout) view.findViewById(R.id.container); - holder.content = (LinearLayout) view.findViewById(R.id.content); - holder.placeholder = (TextView) view.findViewById(R.id.txtvPlaceholder); - holder.title = (TextView) view.findViewById(R.id.txtvTitle); + holder.container = view.findViewById(R.id.container); + holder.content = view.findViewById(R.id.content); + holder.placeholder = view.findViewById(R.id.txtvPlaceholder); + holder.title = view.findViewById(R.id.txtvTitle); if(Build.VERSION.SDK_INT >= 23) { holder.title.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_FULL); } - holder.pubDate = (TextView) view + holder.pubDate = view .findViewById(R.id.txtvPublished); holder.statusUnread = view.findViewById(R.id.statusUnread); - holder.butSecondary = (ImageButton) view + holder.butSecondary = view .findViewById(R.id.butSecondaryAction); - holder.queueStatus = (ImageView) view + holder.queueStatus = view .findViewById(R.id.imgvInPlaylist); - holder.progress = (ProgressBar) view + holder.progress = view .findViewById(R.id.pbar_progress); - holder.cover = (ImageView) view.findViewById(R.id.imgvCover); - holder.txtvDuration = (TextView) view.findViewById(R.id.txtvDuration); + holder.cover = view.findViewById(R.id.imgvCover); + holder.txtvDuration = view.findViewById(R.id.txtvDuration); holder.item = null; holder.mainActivityRef = mainActivityRef; // so we can grab this later @@ -107,7 +108,7 @@ public class AllEpisodesRecycleAdapter extends RecyclerView.Adapter<AllEpisodesR final FeedItem item = itemAccess.getItem(position); if (item == null) return; holder.itemView.setOnLongClickListener(v -> { - this.position = holder.getAdapterPosition(); + this.selectedItem = item; return false; }); holder.item = item; @@ -200,6 +201,11 @@ public class AllEpisodesRecycleAdapter extends RecyclerView.Adapter<AllEpisodesR .into(new CoverTarget(item.getFeed().getImageLocation(), holder.placeholder, holder.cover, mainActivityRef.get())); } + @Nullable + public FeedItem getSelectedItem() { + return selectedItem; + } + @Override public long getItemId(int position) { FeedItem item = itemAccess.getItem(position); @@ -211,16 +217,6 @@ public class AllEpisodesRecycleAdapter extends RecyclerView.Adapter<AllEpisodesR return itemAccess.getCount(); } - public FeedItem getItem(int position) { - return itemAccess.getItem(position); - } - - public int getPosition() { - int pos = position; - position = -1; // reset - return pos; - } - private final View.OnClickListener secondaryActionListener = new View.OnClickListener() { @Override public void onClick(View v) { diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/ChaptersListAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/ChaptersListAdapter.java index cbd089d4c..c3fac7e18 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/ChaptersListAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/ChaptersListAdapter.java @@ -57,12 +57,12 @@ public class ChaptersListAdapter extends ArrayAdapter<Chapter> { convertView = inflater.inflate(R.layout.simplechapter_item, parent, false); holder.view = convertView; - holder.title = (TextView) convertView.findViewById(R.id.txtvTitle); + holder.title = convertView.findViewById(R.id.txtvTitle); defaultTextColor = holder.title.getTextColors().getDefaultColor(); - holder.start = (TextView) convertView.findViewById(R.id.txtvStart); - holder.link = (TextView) convertView.findViewById(R.id.txtvLink); - holder.duration = (TextView) convertView.findViewById(R.id.txtvDuration); - holder.butPlayChapter = (ImageButton) convertView.findViewById(R.id.butPlayChapter); + holder.start = convertView.findViewById(R.id.txtvStart); + holder.link = convertView.findViewById(R.id.txtvLink); + holder.duration = convertView.findViewById(R.id.txtvDuration); + holder.butPlayChapter = convertView.findViewById(R.id.butPlayChapter); convertView.setTag(holder); } else { holder = (Holder) convertView.getTag(); diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/DefaultActionButtonCallback.java b/app/src/main/java/de/danoeh/antennapod/adapter/DefaultActionButtonCallback.java index 08b2908ac..1286d9dc7 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/DefaultActionButtonCallback.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/DefaultActionButtonCallback.java @@ -1,13 +1,12 @@ package de.danoeh.antennapod.adapter; import android.content.Context; +import android.support.annotation.NonNull; import android.content.Intent; import android.widget.Toast; import com.afollestad.materialdialogs.MaterialDialog; -import de.danoeh.antennapod.core.util.IntentUtils; -import de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter; import org.apache.commons.lang3.Validate; import de.danoeh.antennapod.R; @@ -21,8 +20,10 @@ import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.storage.DownloadRequestException; import de.danoeh.antennapod.core.storage.DownloadRequester; +import de.danoeh.antennapod.core.util.IntentUtils; import de.danoeh.antennapod.core.util.LongList; import de.danoeh.antennapod.core.util.NetworkUtils; +import de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter; /** * Default implementation of an ActionButtonCallback diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/DownloadLogAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/DownloadLogAdapter.java index 163366c3c..789c01a26 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/DownloadLogAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/DownloadLogAdapter.java @@ -49,15 +49,15 @@ public class DownloadLogAdapter extends BaseAdapter { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.downloadlog_item, parent, false); - holder.icon = (IconTextView) convertView.findViewById(R.id.txtvIcon); - holder.retry = (IconButton) convertView.findViewById(R.id.btnRetry); - holder.date = (TextView) convertView.findViewById(R.id.txtvDate); - holder.title = (TextView) convertView.findViewById(R.id.txtvTitle); + holder.icon = convertView.findViewById(R.id.txtvIcon); + holder.retry = convertView.findViewById(R.id.btnRetry); + holder.date = convertView.findViewById(R.id.txtvDate); + holder.title = convertView.findViewById(R.id.txtvTitle); if(Build.VERSION.SDK_INT >= 23) { holder.title.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_FULL); } - holder.type = (TextView) convertView.findViewById(R.id.txtvType); - holder.reason = (TextView) convertView.findViewById(R.id.txtvReason); + holder.type = convertView.findViewById(R.id.txtvType); + holder.reason = convertView.findViewById(R.id.txtvReason); convertView.setTag(holder); } else { holder = (Holder) convertView.getTag(); diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/DownloadedEpisodesListAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/DownloadedEpisodesListAdapter.java index 51e1271d9..014e43ee7 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/DownloadedEpisodesListAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/DownloadedEpisodesListAdapter.java @@ -61,16 +61,16 @@ public class DownloadedEpisodesListAdapter extends BaseAdapter { .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.downloaded_episodeslist_item, parent, false); - holder.imageView = (ImageView) convertView.findViewById(R.id.imgvImage); - holder.title = (TextView) convertView.findViewById(R.id.txtvTitle); + holder.imageView = convertView.findViewById(R.id.imgvImage); + holder.title = convertView.findViewById(R.id.txtvTitle); if(Build.VERSION.SDK_INT >= 23) { holder.title.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_FULL); } - holder.txtvSize = (TextView) convertView.findViewById(R.id.txtvSize); - holder.queueStatus = (ImageView) convertView.findViewById(R.id.imgvInPlaylist); - holder.pubDate = (TextView) convertView + holder.txtvSize = convertView.findViewById(R.id.txtvSize); + holder.queueStatus = convertView.findViewById(R.id.imgvInPlaylist); + holder.pubDate = convertView .findViewById(R.id.txtvPublished); - holder.butSecondary = (ImageButton) convertView + holder.butSecondary = convertView .findViewById(R.id.butSecondaryAction); convertView.setTag(holder); } else { diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/DownloadlistAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/DownloadlistAdapter.java index a8c60c19e..b85d1d35d 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/DownloadlistAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/DownloadlistAdapter.java @@ -59,14 +59,14 @@ public class DownloadlistAdapter extends BaseAdapter { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.downloadlist_item, parent, false); - holder.title = (TextView) convertView.findViewById(R.id.txtvTitle); - holder.downloaded = (TextView) convertView + holder.title = convertView.findViewById(R.id.txtvTitle); + holder.downloaded = convertView .findViewById(R.id.txtvDownloaded); - holder.percent = (TextView) convertView + holder.percent = convertView .findViewById(R.id.txtvPercent); - holder.progbar = (ProgressBar) convertView + holder.progbar = convertView .findViewById(R.id.progProgress); - holder.butSecondary = (ImageButton) convertView + holder.butSecondary = convertView .findViewById(R.id.butSecondaryAction); convertView.setTag(holder); diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistAdapter.java index cf3dd8b09..738a0a636 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistAdapter.java @@ -90,24 +90,24 @@ public class FeedItemlistAdapter extends BaseAdapter { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.feeditemlist_item, parent, false); - holder.container = (LinearLayout) convertView + holder.container = convertView .findViewById(R.id.container); - holder.title = (TextView) convertView.findViewById(R.id.txtvItemname); + holder.title = convertView.findViewById(R.id.txtvItemname); if(Build.VERSION.SDK_INT >= 23) { holder.title.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_FULL); } - holder.lenSize = (TextView) convertView + holder.lenSize = convertView .findViewById(R.id.txtvLenSize); - holder.butAction = (ImageButton) convertView + holder.butAction = convertView .findViewById(R.id.butSecondaryAction); - holder.published = (TextView) convertView + holder.published = convertView .findViewById(R.id.txtvPublished); - holder.inPlaylist = (ImageView) convertView + holder.inPlaylist = convertView .findViewById(R.id.imgvInPlaylist); - holder.type = (ImageView) convertView.findViewById(R.id.imgvType); + holder.type = convertView.findViewById(R.id.imgvType); holder.statusUnread = convertView .findViewById(R.id.statusUnread); - holder.episodeProgress = (ProgressBar) convertView + holder.episodeProgress = convertView .findViewById(R.id.pbar_episode_progress); convertView.setTag(holder); diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistDescriptionAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistDescriptionAdapter.java index 5b205e91f..c10bb7638 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistDescriptionAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/FeedItemlistDescriptionAdapter.java @@ -34,9 +34,9 @@ public class FeedItemlistDescriptionAdapter extends ArrayAdapter<FeedItem> { LayoutInflater inflater = (LayoutInflater) getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.itemdescription_listitem, parent, false); - holder.title = (TextView) convertView.findViewById(R.id.txtvTitle); - holder.pubDate = (TextView) convertView.findViewById(R.id.txtvPubDate); - holder.description = (TextView) convertView.findViewById(R.id.txtvDescription); + holder.title = convertView.findViewById(R.id.txtvTitle); + holder.pubDate = convertView.findViewById(R.id.txtvPubDate); + holder.description = convertView.findViewById(R.id.txtvDescription); convertView.setTag(holder); } else { diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/NavListAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/NavListAdapter.java index 2daa5e70f..5adf662b3 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/NavListAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/NavListAdapter.java @@ -212,7 +212,7 @@ public class NavListAdapter extends BaseAdapter v = getFeedView(position, convertView, parent); } if (v != null && viewType != VIEW_TYPE_SECTION_DIVIDER) { - TextView txtvTitle = (TextView) v.findViewById(R.id.txtvTitle); + TextView txtvTitle = v.findViewById(R.id.txtvTitle); if (position == itemAccess.getSelectedItemIndex()) { txtvTitle.setTypeface(null, Typeface.BOLD); } else { @@ -235,9 +235,9 @@ public class NavListAdapter extends BaseAdapter convertView = inflater.inflate(R.layout.nav_listitem, parent, false); - holder.image = (ImageView) convertView.findViewById(R.id.imgvCover); - holder.title = (TextView) convertView.findViewById(R.id.txtvTitle); - holder.count = (TextView) convertView.findViewById(R.id.txtvCount); + holder.image = convertView.findViewById(R.id.imgvCover); + holder.title = convertView.findViewById(R.id.txtvTitle); + holder.count = convertView.findViewById(R.id.txtvCount); convertView.setTag(holder); } else { holder = (NavHolder) convertView.getTag(); @@ -325,10 +325,10 @@ public class NavListAdapter extends BaseAdapter convertView = inflater.inflate(R.layout.nav_feedlistitem, parent, false); - holder.image = (ImageView) convertView.findViewById(R.id.imgvCover); - holder.title = (TextView) convertView.findViewById(R.id.txtvTitle); - holder.failure = (IconTextView) convertView.findViewById(R.id.itxtvFailure); - holder.count = (TextView) convertView.findViewById(R.id.txtvCount); + holder.image = convertView.findViewById(R.id.imgvCover); + holder.title = convertView.findViewById(R.id.txtvTitle); + holder.failure = convertView.findViewById(R.id.itxtvFailure); + holder.count = convertView.findViewById(R.id.txtvCount); convertView.setTag(holder); } else { holder = (FeedHolder) convertView.getTag(); diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/QueueRecyclerAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/QueueRecyclerAdapter.java index ee14cb70a..3ad9dc79c 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/QueueRecyclerAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/QueueRecyclerAdapter.java @@ -25,7 +25,6 @@ import android.widget.TextView; import com.bumptech.glide.Glide; import com.joanzapata.iconify.Iconify; -import de.danoeh.antennapod.core.util.ThemeUtils; import org.apache.commons.lang3.ArrayUtils; import java.lang.ref.WeakReference; @@ -41,6 +40,7 @@ import de.danoeh.antennapod.core.util.Converter; import de.danoeh.antennapod.core.util.DateUtils; import de.danoeh.antennapod.core.util.LongList; import de.danoeh.antennapod.core.util.NetworkUtils; +import de.danoeh.antennapod.core.util.ThemeUtils; import de.danoeh.antennapod.fragment.ItemFragment; import de.danoeh.antennapod.menuhandler.FeedItemMenuHandler; @@ -134,19 +134,19 @@ public class QueueRecyclerAdapter extends RecyclerView.Adapter<QueueRecyclerAdap public ViewHolder(View v) { super(v); - container = (FrameLayout) v.findViewById(R.id.container); - dragHandle = (ImageView) v.findViewById(R.id.drag_handle); - placeholder = (TextView) v.findViewById(R.id.txtvPlaceholder); - cover = (ImageView) v.findViewById(R.id.imgvCover); - title = (TextView) v.findViewById(R.id.txtvTitle); + container = v.findViewById(R.id.container); + dragHandle = v.findViewById(R.id.drag_handle); + placeholder = v.findViewById(R.id.txtvPlaceholder); + cover = v.findViewById(R.id.imgvCover); + title = v.findViewById(R.id.txtvTitle); if(Build.VERSION.SDK_INT >= 23) { title.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_FULL); } - pubDate = (TextView) v.findViewById(R.id.txtvPubDate); - progressLeft = (TextView) v.findViewById(R.id.txtvProgressLeft); - progressRight = (TextView) v.findViewById(R.id.txtvProgressRight); - butSecondary = (ImageButton) v.findViewById(R.id.butSecondaryAction); - progressBar = (ProgressBar) v.findViewById(R.id.progressBar); + pubDate = v.findViewById(R.id.txtvPubDate); + progressLeft = v.findViewById(R.id.txtvProgressLeft); + progressRight = v.findViewById(R.id.txtvProgressRight); + butSecondary = v.findViewById(R.id.butSecondaryAction); + progressBar = v.findViewById(R.id.progressBar); v.setTag(this); v.setOnClickListener(this); v.setOnCreateContextMenuListener(this); diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/SearchlistAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/SearchlistAdapter.java index beb62b3bb..74c0d6473 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/SearchlistAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/SearchlistAdapter.java @@ -61,13 +61,13 @@ public class SearchlistAdapter extends BaseAdapter { .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.searchlist_item, parent, false); - holder.title = (TextView) convertView.findViewById(R.id.txtvTitle); + holder.title = convertView.findViewById(R.id.txtvTitle); if(Build.VERSION.SDK_INT >= 23) { holder.title.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_FULL); } - holder.cover = (ImageView) convertView + holder.cover = convertView .findViewById(R.id.imgvFeedimage); - holder.subtitle = (TextView) convertView + holder.subtitle = convertView .findViewById(R.id.txtvSubtitle); convertView.setTag(holder); diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/StatisticsListAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/StatisticsListAdapter.java index 50255c11f..d1f1d85bc 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/StatisticsListAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/StatisticsListAdapter.java @@ -62,9 +62,9 @@ public class StatisticsListAdapter extends BaseAdapter { convertView = inflater.inflate(R.layout.statistics_listitem, parent, false); - holder.image = (ImageView) convertView.findViewById(R.id.imgvCover); - holder.title = (TextView) convertView.findViewById(R.id.txtvTitle); - holder.time = (TextView) convertView.findViewById(R.id.txtvTime); + holder.image = convertView.findViewById(R.id.imgvCover); + holder.title = convertView.findViewById(R.id.txtvTitle); + holder.time = convertView.findViewById(R.id.txtvTime); convertView.setTag(holder); } else { holder = (StatisticsHolder) convertView.getTag(); diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/SubscriptionsAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/SubscriptionsAdapter.java index bb76ab501..9230967ab 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/SubscriptionsAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/SubscriptionsAdapter.java @@ -89,9 +89,9 @@ public class SubscriptionsAdapter extends BaseAdapter implements AdapterView.OnI LayoutInflater layoutInflater = (LayoutInflater) mainActivityRef.get().getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = layoutInflater.inflate(R.layout.subscription_item, parent, false); - holder.feedTitle = (TextView) convertView.findViewById(R.id.txtvTitle); - holder.imageView = (ImageView) convertView.findViewById(R.id.imgvCover); - holder.count = (TriangleLabelView) convertView.findViewById(R.id.triangleCountView); + holder.feedTitle = convertView.findViewById(R.id.txtvTitle); + holder.imageView = convertView.findViewById(R.id.imgvCover); + holder.count = convertView.findViewById(R.id.triangleCountView); convertView.setTag(holder); diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/gpodnet/PodcastListAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/gpodnet/PodcastListAdapter.java index aea3d583f..9cc0e36cf 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/gpodnet/PodcastListAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/gpodnet/PodcastListAdapter.java @@ -40,10 +40,10 @@ public class PodcastListAdapter extends ArrayAdapter<GpodnetPodcast> { .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.gpodnet_podcast_listitem, parent, false); - holder.image = (ImageView) convertView.findViewById(R.id.imgvCover); - holder.title = (TextView) convertView.findViewById(R.id.txtvTitle); - holder.subscribers = (TextView) convertView.findViewById(R.id.txtvSubscribers); - holder.url = (TextView) convertView.findViewById(R.id.txtvUrl); + holder.image = convertView.findViewById(R.id.imgvCover); + holder.title = convertView.findViewById(R.id.txtvTitle); + holder.subscribers = convertView.findViewById(R.id.txtvSubscribers); + holder.url = convertView.findViewById(R.id.txtvUrl); convertView.setTag(holder); } else { holder = (Holder) convertView.getTag(); diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/gpodnet/TagListAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/gpodnet/TagListAdapter.java index b4eadefb5..52fca792e 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/gpodnet/TagListAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/gpodnet/TagListAdapter.java @@ -34,8 +34,8 @@ public class TagListAdapter extends ArrayAdapter<GpodnetTag> { .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.gpodnet_tag_listitem, parent, false); - holder.title = (TextView) convertView.findViewById(R.id.txtvTitle); - holder.usage = (TextView) convertView.findViewById(R.id.txtvUsage); + holder.title = convertView.findViewById(R.id.txtvTitle); + holder.usage = convertView.findViewById(R.id.txtvUsage); convertView.setTag(holder); } else { holder = (Holder) convertView.getTag(); diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/itunes/ItunesAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/itunes/ItunesAdapter.java index 4a941275d..b103026dc 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/itunes/ItunesAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/itunes/ItunesAdapter.java @@ -182,9 +182,9 @@ public class ItunesAdapter extends ArrayAdapter<ItunesAdapter.Podcast> { * @param view GridView cell */ PodcastViewHolder(View view){ - coverView = (ImageView) view.findViewById(R.id.imgvCover); - titleView = (TextView) view.findViewById(R.id.txtvTitle); - urlView = (TextView) view.findViewById(R.id.txtvUrl); + coverView = view.findViewById(R.id.imgvCover); + titleView = view.findViewById(R.id.txtvTitle); + urlView = view.findViewById(R.id.txtvUrl); } } } diff --git a/app/src/main/java/de/danoeh/antennapod/config/ClientConfigurator.java b/app/src/main/java/de/danoeh/antennapod/config/ClientConfigurator.java index d2498955c..4138738f6 100644 --- a/app/src/main/java/de/danoeh/antennapod/config/ClientConfigurator.java +++ b/app/src/main/java/de/danoeh/antennapod/config/ClientConfigurator.java @@ -8,6 +8,8 @@ import de.danoeh.antennapod.core.ClientConfig; */ class ClientConfigurator { + private ClientConfigurator(){} + static { ClientConfig.USER_AGENT = "AntennaPod/" + BuildConfig.VERSION_NAME; ClientConfig.applicationCallbacks = new ApplicationCallbacksImpl(); diff --git a/app/src/main/java/de/danoeh/antennapod/config/PlaybackServiceCallbacksImpl.java b/app/src/main/java/de/danoeh/antennapod/config/PlaybackServiceCallbacksImpl.java index 83dd3fe9c..eb70d8e0b 100644 --- a/app/src/main/java/de/danoeh/antennapod/config/PlaybackServiceCallbacksImpl.java +++ b/app/src/main/java/de/danoeh/antennapod/config/PlaybackServiceCallbacksImpl.java @@ -2,7 +2,6 @@ package de.danoeh.antennapod.config; import android.content.Context; import android.content.Intent; - import android.os.Build; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.AudioplayerActivity; diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/AuthenticationDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/AuthenticationDialog.java index 6f9e221ec..2c41b8cb8 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/AuthenticationDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/AuthenticationDialog.java @@ -35,11 +35,11 @@ public abstract class AuthenticationDialog extends Dialog { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.authentication_dialog); - final EditText etxtUsername = (EditText) findViewById(R.id.etxtUsername); - final EditText etxtPassword = (EditText) findViewById(R.id.etxtPassword); - final CheckBox saveUsernamePassword = (CheckBox) findViewById(R.id.chkSaveUsernamePassword); - final Button butConfirm = (Button) findViewById(R.id.butConfirm); - final Button butCancel = (Button) findViewById(R.id.butCancel); + final EditText etxtUsername = findViewById(R.id.etxtUsername); + final EditText etxtPassword = findViewById(R.id.etxtPassword); + final CheckBox saveUsernamePassword = findViewById(R.id.chkSaveUsernamePassword); + final Button butConfirm = findViewById(R.id.butConfirm); + final Button butCancel = findViewById(R.id.butCancel); if (titleRes != 0) { setTitle(titleRes); diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/AutoFlattrPreferenceDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/AutoFlattrPreferenceDialog.java index 93425949c..c28342374 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/AutoFlattrPreferenceDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/AutoFlattrPreferenceDialog.java @@ -29,9 +29,9 @@ public class AutoFlattrPreferenceDialog { AlertDialog.Builder builder = new AlertDialog.Builder(activity); @SuppressLint("InflateParams") View view = activity.getLayoutInflater().inflate(R.layout.autoflattr_preference_dialog, null); - final CheckBox chkAutoFlattr = (CheckBox) view.findViewById(R.id.chkAutoFlattr); - final SeekBar skbPercent = (SeekBar) view.findViewById(R.id.skbPercent); - final TextView txtvStatus = (TextView) view.findViewById(R.id.txtvStatus); + final CheckBox chkAutoFlattr = view.findViewById(R.id.chkAutoFlattr); + final SeekBar skbPercent = view.findViewById(R.id.skbPercent); + final TextView txtvStatus = view.findViewById(R.id.txtvStatus); chkAutoFlattr.setChecked(UserPreferences.isAutoFlattr()); skbPercent.setEnabled(chkAutoFlattr.isChecked()); diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/EpisodesApplyActionFragment.java b/app/src/main/java/de/danoeh/antennapod/dialog/EpisodesApplyActionFragment.java index d1ee926ac..07a64cde8 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/EpisodesApplyActionFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/EpisodesApplyActionFragment.java @@ -1,5 +1,6 @@ package de.danoeh.antennapod.dialog; +import android.app.AlertDialog; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.os.Bundle; @@ -84,7 +85,7 @@ public class EpisodesApplyActionFragment extends Fragment { Bundle savedInstanceState) { View view = inflater.inflate(R.layout.episodes_apply_action_fragment, container, false); - mListView = (ListView) view.findViewById(android.R.id.list); + mListView = view.findViewById(android.R.id.list); mListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); mListView.setOnItemClickListener((ListView, view1, position, rowId) -> { long id = episodes.get(position).getId(); @@ -95,6 +96,28 @@ public class EpisodesApplyActionFragment extends Fragment { } refreshCheckboxes(); }); + mListView.setOnItemLongClickListener((adapterView, view12, position, id) -> { + new AlertDialog.Builder(getActivity()) + .setItems(R.array.batch_long_press_options, (dialogInterface, item) -> { + int direction; + if (item == 0) { + direction = -1; + } else { + direction = 1; + } + + int currentPosition = position + direction; + while (currentPosition >= 0 && currentPosition < episodes.size()) { + long id1 = episodes.get(currentPosition).getId(); + if (!checkedIds.contains(id1)) { + checkedIds.add(id1); + } + currentPosition += direction; + } + refreshCheckboxes(); + }).show(); + return true; + }); for(FeedItem episode : episodes) { titles.add(episode.getTitle()); @@ -106,7 +129,7 @@ public class EpisodesApplyActionFragment extends Fragment { checkAll(); int lastVisibleDiv = 0; - btnAddToQueue = (Button) view.findViewById(R.id.btnAddToQueue); + btnAddToQueue = view.findViewById(R.id.btnAddToQueue); if((actions & ACTION_QUEUE) != 0) { btnAddToQueue.setOnClickListener(v -> queueChecked()); lastVisibleDiv = R.id.divider1; @@ -114,7 +137,7 @@ public class EpisodesApplyActionFragment extends Fragment { btnAddToQueue.setVisibility(View.GONE); view.findViewById(R.id.divider1).setVisibility(View.GONE); } - btnMarkAsPlayed = (Button) view.findViewById(R.id.btnMarkAsPlayed); + btnMarkAsPlayed = view.findViewById(R.id.btnMarkAsPlayed); if((actions & ACTION_MARK_PLAYED) != 0) { btnMarkAsPlayed.setOnClickListener(v -> markedCheckedPlayed()); lastVisibleDiv = R.id.divider2; @@ -122,7 +145,7 @@ public class EpisodesApplyActionFragment extends Fragment { btnMarkAsPlayed.setVisibility(View.GONE); view.findViewById(R.id.divider2).setVisibility(View.GONE); } - btnMarkAsUnplayed = (Button) view.findViewById(R.id.btnMarkAsUnplayed); + btnMarkAsUnplayed = view.findViewById(R.id.btnMarkAsUnplayed); if((actions & ACTION_MARK_UNPLAYED) != 0) { btnMarkAsUnplayed.setOnClickListener(v -> markedCheckedUnplayed()); lastVisibleDiv = R.id.divider3; @@ -130,7 +153,7 @@ public class EpisodesApplyActionFragment extends Fragment { btnMarkAsUnplayed.setVisibility(View.GONE); view.findViewById(R.id.divider3).setVisibility(View.GONE); } - btnDownload = (Button) view.findViewById(R.id.btnDownload); + btnDownload = view.findViewById(R.id.btnDownload); if((actions & ACTION_DOWNLOAD) != 0) { btnDownload.setOnClickListener(v -> downloadChecked()); lastVisibleDiv = R.id.divider4; @@ -138,7 +161,7 @@ public class EpisodesApplyActionFragment extends Fragment { btnDownload.setVisibility(View.GONE); view.findViewById(R.id.divider4).setVisibility(View.GONE); } - btnDelete = (Button) view.findViewById(R.id.btnDelete); + btnDelete = view.findViewById(R.id.btnDelete); if((actions & ACTION_REMOVE) != 0) { btnDelete.setOnClickListener(v -> deleteChecked()); } else { diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/GpodnetSetHostnameDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/GpodnetSetHostnameDialog.java index e64f1e08b..933ced0f9 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/GpodnetSetHostnameDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/GpodnetSetHostnameDialog.java @@ -17,6 +17,9 @@ import de.danoeh.antennapod.core.preferences.GpodnetPreferences; * Creates a dialog that lets the user change the hostname for the gpodder.net service. */ public class GpodnetSetHostnameDialog { + + private GpodnetSetHostnameDialog(){} + private static final String TAG = "GpodnetSetHostnameDialog"; public static AlertDialog createDialog(final Context context) { diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/ProxyDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/ProxyDialog.java index f5632cad3..cc331e24a 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/ProxyDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/ProxyDialog.java @@ -102,7 +102,7 @@ public class ProxyDialog { .autoDismiss(false) .build(); View view = dialog.getCustomView(); - spType = (Spinner) view.findViewById(R.id.spType); + spType = view.findViewById(R.id.spType); String[] types = { Proxy.Type.DIRECT.name(), Proxy.Type.HTTP.name() }; ArrayAdapter<String> adapter = new ArrayAdapter<>(context, android.R.layout.simple_spinner_item, types); @@ -110,22 +110,22 @@ public class ProxyDialog { spType.setAdapter(adapter); ProxyConfig proxyConfig = UserPreferences.getProxyConfig(); spType.setSelection(adapter.getPosition(proxyConfig.type.name())); - etHost = (EditText) view.findViewById(R.id.etHost); + etHost = view.findViewById(R.id.etHost); if(!TextUtils.isEmpty(proxyConfig.host)) { etHost.setText(proxyConfig.host); } etHost.addTextChangedListener(requireTestOnChange); - etPort = (EditText) view.findViewById(R.id.etPort); + etPort = view.findViewById(R.id.etPort); if(proxyConfig.port > 0) { etPort.setText(String.valueOf(proxyConfig.port)); } etPort.addTextChangedListener(requireTestOnChange); - etUsername = (EditText) view.findViewById(R.id.etUsername); + etUsername = view.findViewById(R.id.etUsername); if(!TextUtils.isEmpty(proxyConfig.username)) { etUsername.setText(proxyConfig.username); } etUsername.addTextChangedListener(requireTestOnChange); - etPassword = (EditText) view.findViewById(R.id.etPassword); + etPassword = view.findViewById(R.id.etPassword); if(!TextUtils.isEmpty(proxyConfig.password)) { etPassword.setText(proxyConfig.username); } @@ -146,7 +146,7 @@ public class ProxyDialog { enableSettings(false); } }); - txtvMessage = (TextView) view.findViewById(R.id.txtvMessage); + txtvMessage = view.findViewById(R.id.txtvMessage); checkValidity(); return dialog; } diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/RatingDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/RatingDialog.java index 72000170e..ece184035 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/RatingDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/RatingDialog.java @@ -17,6 +17,8 @@ import de.danoeh.antennapod.R; public class RatingDialog { + private RatingDialog(){} + private static final String TAG = RatingDialog.class.getSimpleName(); private static final int AFTER_DAYS = 7; 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 be7850495..4b8601ec6 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/SleepTimerDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/SleepTimerDialog.java @@ -61,11 +61,11 @@ public abstract class SleepTimerDialog { dialog = builder.build(); View view = dialog.getView(); - etxtTime = (EditText) view.findViewById(R.id.etxtTime); - spTimeUnit = (Spinner) view.findViewById(R.id.spTimeUnit); - cbShakeToReset = (CheckBox) view.findViewById(R.id.cbShakeToReset); - cbVibrate = (CheckBox) view.findViewById(R.id.cbVibrate); - chAutoEnable = (CheckBox) view.findViewById(R.id.chAutoEnable); + etxtTime = view.findViewById(R.id.etxtTime); + spTimeUnit = view.findViewById(R.id.spTimeUnit); + cbShakeToReset = view.findViewById(R.id.cbShakeToReset); + cbVibrate = view.findViewById(R.id.cbVibrate); + chAutoEnable = view.findViewById(R.id.chAutoEnable); etxtTime.setText(SleepTimerPreferences.lastTimerValue()); etxtTime.addTextChangedListener(new TextWatcher() { 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 a243ddcdc..ee2373da8 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/AddFeedFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/AddFeedFragment.java @@ -32,18 +32,18 @@ public class AddFeedFragment extends Fragment { super.onCreateView(inflater, container, savedInstanceState); View root = inflater.inflate(R.layout.addfeed, container, false); - final EditText etxtFeedurl = (EditText) root.findViewById(R.id.etxtFeedurl); + final EditText etxtFeedurl = root.findViewById(R.id.etxtFeedurl); Bundle args = getArguments(); if (args != null && args.getString(ARG_FEED_URL) != null) { etxtFeedurl.setText(args.getString(ARG_FEED_URL)); } - Button butSearchITunes = (Button) root.findViewById(R.id.butSearchItunes); - Button butBrowserGpoddernet = (Button) root.findViewById(R.id.butBrowseGpoddernet); - Button butSearchFyyd = (Button) root.findViewById(R.id.butSearchFyyd); - Button butOpmlImport = (Button) root.findViewById(R.id.butOpmlImport); - Button butConfirm = (Button) root.findViewById(R.id.butConfirm); + Button butSearchITunes = root.findViewById(R.id.butSearchItunes); + Button butBrowserGpoddernet = root.findViewById(R.id.butBrowseGpoddernet); + Button butSearchFyyd = root.findViewById(R.id.butSearchFyyd); + Button butOpmlImport = root.findViewById(R.id.butOpmlImport); + Button butConfirm = root.findViewById(R.id.butConfirm); final MainActivity activity = (MainActivity) getActivity(); activity.getSupportActionBar().setTitle(R.string.add_feed_label); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/AllEpisodesFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/AllEpisodesFragment.java index e98265a82..485ae25fd 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/AllEpisodesFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/AllEpisodesFragment.java @@ -275,14 +275,10 @@ public class AllEpisodesFragment extends Fragment { if(item.getItemId() == R.id.share_item) { return true; // avoids that the position is reset when we need it in the submenu } - int pos = listAdapter.getPosition(); - if(pos < 0) { - return false; - } - FeedItem selectedItem = itemAccess.getItem(pos); + FeedItem selectedItem = listAdapter.getSelectedItem(); if (selectedItem == null) { - Log.i(TAG, "Selected item at position " + pos + " was null, ignoring selection"); + Log.i(TAG, "Selected item was null, ignoring selection"); return super.onContextItemSelected(item); } @@ -313,7 +309,7 @@ public class AllEpisodesFragment extends Fragment { View root = inflater.inflate(fragmentResource, container, false); - recyclerView = (RecyclerView) root.findViewById(android.R.id.list); + recyclerView = root.findViewById(android.R.id.list); RecyclerView.ItemAnimator animator = recyclerView.getItemAnimator(); if (animator instanceof SimpleItemAnimator) { ((SimpleItemAnimator) animator).setSupportsChangeAnimations(false); @@ -323,7 +319,7 @@ public class AllEpisodesFragment extends Fragment { recyclerView.setHasFixedSize(true); recyclerView.addItemDecoration(new HorizontalDividerItemDecoration.Builder(getActivity()).build()); - progLoading = (ProgressBar) root.findViewById(R.id.progLoading); + progLoading = root.findViewById(R.id.progLoading); if (!itemsLoaded) { progLoading.setVisibility(View.VISIBLE); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java index 1d3fcefba..0230c9036 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/CoverFragment.java @@ -22,7 +22,6 @@ import de.danoeh.antennapod.core.util.playback.Playable; public class CoverFragment extends Fragment implements MediaplayerInfoContentFragment { private static final String TAG = "CoverFragment"; - private static final String ARG_PLAYABLE = "arg.playable"; private Playable media; @@ -49,9 +48,9 @@ public class CoverFragment extends Fragment implements MediaplayerInfoContentFra public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { root = inflater.inflate(R.layout.cover_fragment, container, false); - txtvPodcastTitle = (TextView) root.findViewById(R.id.txtvPodcastTitle); - txtvEpisodeTitle = (TextView) root.findViewById(R.id.txtvEpisodeTitle); - imgvCover = (ImageView) root.findViewById(R.id.imgvCover); + txtvPodcastTitle = root.findViewById(R.id.txtvPodcastTitle); + txtvEpisodeTitle = root.findViewById(R.id.txtvEpisodeTitle); + imgvCover = root.findViewById(R.id.imgvCover); return root; } diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/DownloadsFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/DownloadsFragment.java index 9c4d00e31..aa6029c84 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/DownloadsFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/DownloadsFragment.java @@ -38,12 +38,12 @@ public class DownloadsFragment extends Fragment { super.onCreateView(inflater, container, savedInstanceState); View root = inflater.inflate(R.layout.pager_fragment, container, false); - viewPager = (ViewPager)root.findViewById(R.id.viewpager); + viewPager = root.findViewById(R.id.viewpager); DownloadsPagerAdapter pagerAdapter = new DownloadsPagerAdapter(getChildFragmentManager(), getResources()); viewPager.setAdapter(pagerAdapter); // Give the TabLayout the ViewPager - tabLayout = (TabLayout) root.findViewById(R.id.sliding_tabs); + tabLayout = root.findViewById(R.id.sliding_tabs); tabLayout.setupWithViewPager(viewPager); return root; diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/EpisodesFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/EpisodesFragment.java index 417ecff89..0610bfd24 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/EpisodesFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/EpisodesFragment.java @@ -46,11 +46,11 @@ public class EpisodesFragment extends Fragment { ((MainActivity) getActivity()).getSupportActionBar().setTitle(R.string.episodes_label); View rootView = inflater.inflate(R.layout.pager_fragment, container, false); - viewPager = (ViewPager)rootView.findViewById(R.id.viewpager); + viewPager = rootView.findViewById(R.id.viewpager); viewPager.setAdapter(new EpisodesPagerAdapter(getChildFragmentManager(), getResources())); // Give the TabLayout the ViewPager - tabLayout = (TabLayout) rootView.findViewById(R.id.sliding_tabs); + tabLayout = rootView.findViewById(R.id.sliding_tabs); tabLayout.setupWithViewPager(viewPager); return rootView; diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java index 0f4d6b6eb..4e010f184 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java @@ -20,7 +20,6 @@ import de.danoeh.antennapod.R; import de.danoeh.antennapod.core.feed.MediaType; import de.danoeh.antennapod.core.glide.ApGlideSettings; import de.danoeh.antennapod.core.service.playback.PlaybackService; -import de.danoeh.antennapod.core.util.Converter; import de.danoeh.antennapod.core.util.playback.Playable; import de.danoeh.antennapod.core.util.playback.PlaybackController; import io.reactivex.Maybe; @@ -53,12 +52,12 @@ public class ExternalPlayerFragment extends Fragment { Bundle savedInstanceState) { View root = inflater.inflate(R.layout.external_player_fragment, container, false); - fragmentLayout = (ViewGroup) root.findViewById(R.id.fragmentLayout); - imgvCover = (ImageView) root.findViewById(R.id.imgvCover); - txtvTitle = (TextView) root.findViewById(R.id.txtvTitle); - butPlay = (ImageButton) root.findViewById(R.id.butPlay); - mFeedName = (TextView) root.findViewById(R.id.txtvAuthor); - mProgressBar = (ProgressBar) root.findViewById(R.id.episodeProgress); + fragmentLayout = root.findViewById(R.id.fragmentLayout); + imgvCover = root.findViewById(R.id.imgvCover); + txtvTitle = root.findViewById(R.id.txtvTitle); + butPlay = root.findViewById(R.id.butPlay); + mFeedName = root.findViewById(R.id.txtvAuthor); + mProgressBar = root.findViewById(R.id.episodeProgress); fragmentLayout.setOnClickListener(v -> { Log.d(TAG, "layoutInfo was clicked"); @@ -83,7 +82,7 @@ public class ExternalPlayerFragment extends Fragment { super.onActivityCreated(savedInstanceState); controller = setupPlaybackController(); butPlay.setOnClickListener(v -> { - if(controller != null) { + if (controller != null) { controller.playPause(); } }); @@ -144,6 +143,9 @@ public class ExternalPlayerFragment extends Fragment { if (controller != null) { controller.release(); } + if (disposable != null) { + disposable.dispose(); + } } @Override @@ -164,7 +166,7 @@ public class ExternalPlayerFragment extends Fragment { controller = setupPlaybackController(); if (butPlay != null) { butPlay.setOnClickListener(v -> { - if(controller != null) { + if (controller != null) { controller.playPause(); } }); @@ -179,6 +181,9 @@ public class ExternalPlayerFragment extends Fragment { return false; } + if (disposable != null) { + disposable.dispose(); + } disposable = Maybe.create(emitter -> { Playable media = controller.getMedia(); if(media != null) { @@ -216,15 +221,10 @@ public class ExternalPlayerFragment extends Fragment { butPlay.setVisibility(View.VISIBLE); } } else { - Log.w(TAG, "loadMediaInfo was called while the media object of playbackService was null!"); + Log.w(TAG, "loadMediaInfo was called while the media object of playbackService was null!"); } } - private String getPositionString(int position, int duration) { - return Converter.getDurationStringLong(position) + " / " - + Converter.getDurationStringLong(duration); - } - public PlaybackController getPlaybackControllerTestingOnly() { return controller; } diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/FyydSearchFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/FyydSearchFragment.java index a5fd467a7..dadc596e2 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/FyydSearchFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/FyydSearchFragment.java @@ -75,7 +75,7 @@ public class FyydSearchFragment extends Fragment { Bundle savedInstanceState) { // Inflate the layout for this fragment View root = inflater.inflate(R.layout.fragment_itunes_search, container, false); - gridView = (GridView) root.findViewById(R.id.gridView); + gridView = root.findViewById(R.id.gridView); adapter = new ItunesAdapter(getActivity(), new ArrayList<>()); gridView.setAdapter(adapter); @@ -87,10 +87,10 @@ public class FyydSearchFragment extends Fragment { intent.putExtra(OnlineFeedViewActivity.ARG_TITLE, podcast.title); startActivity(intent); }); - progressBar = (ProgressBar) root.findViewById(R.id.progressBar); - txtvError = (TextView) root.findViewById(R.id.txtvError); - butRetry = (Button) root.findViewById(R.id.butRetry); - txtvEmpty = (TextView) root.findViewById(android.R.id.empty); + progressBar = root.findViewById(R.id.progressBar); + txtvError = root.findViewById(R.id.txtvError); + butRetry = root.findViewById(R.id.butRetry); + txtvEmpty = root.findViewById(android.R.id.empty); return root; } diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java index cfcc99171..ea480a7fb 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java @@ -165,25 +165,25 @@ public class ItemFragment extends Fragment implements OnSwipeGesture { super.onCreateView(inflater, container, savedInstanceState); View layout = inflater.inflate(R.layout.feeditem_fragment, container, false); - root = (ViewGroup) layout.findViewById(R.id.content_root); + root = layout.findViewById(R.id.content_root); - LinearLayout header = (LinearLayout) root.findViewById(R.id.header); + LinearLayout header = root.findViewById(R.id.header); if(feedItems.length > 0) { header.setOnTouchListener((v, event) -> headerGestureDetector.onTouchEvent(event)); } - txtvPodcast = (TextView) layout.findViewById(R.id.txtvPodcast); + txtvPodcast = layout.findViewById(R.id.txtvPodcast); txtvPodcast.setOnClickListener(v -> openPodcast()); - txtvTitle = (TextView) layout.findViewById(R.id.txtvTitle); + txtvTitle = layout.findViewById(R.id.txtvTitle); if(Build.VERSION.SDK_INT >= 23) { txtvTitle.setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_FULL); } - txtvDuration = (TextView) layout.findViewById(R.id.txtvDuration); - txtvPublished = (TextView) layout.findViewById(R.id.txtvPublished); + txtvDuration = layout.findViewById(R.id.txtvDuration); + txtvPublished = layout.findViewById(R.id.txtvPublished); if (Build.VERSION.SDK_INT >= 14) { // ellipsize is causing problems on old versions, see #448 txtvTitle.setEllipsize(TextUtils.TruncateAt.END); } - webvDescription = (WebView) layout.findViewById(R.id.webvDescription); + webvDescription = layout.findViewById(R.id.webvDescription); if (UserPreferences.getTheme() == R.style.Theme_AntennaPod_Dark || UserPreferences.getTheme() == R.style.Theme_AntennaPod_TrueBlack) { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) { @@ -215,12 +215,12 @@ public class ItemFragment extends Fragment implements OnSwipeGesture { }); registerForContextMenu(webvDescription); - imgvCover = (ImageView) layout.findViewById(R.id.imgvCover); + imgvCover = layout.findViewById(R.id.imgvCover); imgvCover.setOnClickListener(v -> openPodcast()); - progbarDownload = (ProgressBar) layout.findViewById(R.id.progbarDownload); - progbarLoading = (ProgressBar) layout.findViewById(R.id.progbarLoading); - butAction1 = (IconButton) layout.findViewById(R.id.butAction1); - butAction2 = (IconButton) layout.findViewById(R.id.butAction2); + progbarDownload = layout.findViewById(R.id.progbarDownload); + progbarLoading = layout.findViewById(R.id.progbarLoading); + butAction1 = layout.findViewById(R.id.butAction1); + butAction2 = layout.findViewById(R.id.butAction2); butAction1.setOnClickListener(v -> { if (item == null) { diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItemlistFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemlistFragment.java index d5dc851fb..e5fda97ce 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemlistFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemlistFragment.java @@ -412,13 +412,10 @@ public class ItemlistFragment extends ListFragment { } - private boolean insideOnFragmentLoaded = false; - private void onFragmentLoaded() { if(!isVisible()) { return; } - insideOnFragmentLoaded = true; if (adapter == null) { setListAdapter(null); setupHeaderView(); @@ -435,9 +432,6 @@ public class ItemlistFragment extends ListFragment { if (feed != null && feed.getNextPageLink() == null && listFooter != null) { getListView().removeFooterView(listFooter.getRoot()); } - - insideOnFragmentLoaded = false; - } private void refreshHeaderView() { @@ -481,14 +475,14 @@ public class ItemlistFragment extends ListFragment { View header = inflater.inflate(R.layout.feeditemlist_header, lv, false); lv.addHeaderView(header); - txtvTitle = (TextView) header.findViewById(R.id.txtvTitle); - TextView txtvAuthor = (TextView) header.findViewById(R.id.txtvAuthor); - imgvBackground = (ImageView) header.findViewById(R.id.imgvBackground); - imgvCover = (ImageView) header.findViewById(R.id.imgvCover); - ImageButton butShowInfo = (ImageButton) header.findViewById(R.id.butShowInfo); - ImageButton butShowSettings = (ImageButton) header.findViewById(R.id.butShowSettings); - txtvInformation = (TextView) header.findViewById(R.id.txtvInformation); - txtvFailure = (IconTextView) header.findViewById(R.id.txtvFailure); + txtvTitle = header.findViewById(R.id.txtvTitle); + TextView txtvAuthor = header.findViewById(R.id.txtvAuthor); + imgvBackground = header.findViewById(R.id.imgvBackground); + imgvCover = header.findViewById(R.id.imgvCover); + ImageButton butShowInfo = header.findViewById(R.id.butShowInfo); + ImageButton butShowSettings = header.findViewById(R.id.butShowSettings); + txtvInformation = header.findViewById(R.id.txtvInformation); + txtvFailure = header.findViewById(R.id.txtvFailure); txtvTitle.setText(feed.getTitle()); txtvAuthor.setText(feed.getAuthor()); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItunesSearchFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItunesSearchFragment.java index 51054abc0..a0e2ca22a 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ItunesSearchFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItunesSearchFragment.java @@ -110,7 +110,7 @@ public class ItunesSearchFragment extends Fragment { Bundle savedInstanceState) { // Inflate the layout for this fragment View root = inflater.inflate(R.layout.fragment_itunes_search, container, false); - gridView = (GridView) root.findViewById(R.id.gridView); + gridView = root.findViewById(R.id.gridView); adapter = new ItunesAdapter(getActivity(), new ArrayList<>()); gridView.setAdapter(adapter); @@ -170,10 +170,10 @@ public class ItunesSearchFragment extends Fragment { }); } }); - progressBar = (ProgressBar) root.findViewById(R.id.progressBar); - txtvError = (TextView) root.findViewById(R.id.txtvError); - butRetry = (Button) root.findViewById(R.id.butRetry); - txtvEmpty = (TextView) root.findViewById(android.R.id.empty); + progressBar = root.findViewById(R.id.progressBar); + txtvError = root.findViewById(R.id.txtvError); + butRetry = root.findViewById(R.id.butRetry); + txtvEmpty = root.findViewById(android.R.id.empty); loadToplist(); diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java index 6a44e917e..faeabf75c 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java @@ -380,8 +380,8 @@ public class QueueFragment extends Fragment { ((MainActivity) getActivity()).getSupportActionBar().setTitle(R.string.queue_label); View root = inflater.inflate(R.layout.queue_fragment, container, false); - infoBar = (TextView) root.findViewById(R.id.info_bar); - recyclerView = (RecyclerView) root.findViewById(R.id.recyclerView); + infoBar = root.findViewById(R.id.info_bar); + recyclerView = root.findViewById(R.id.recyclerView); RecyclerView.ItemAnimator animator = recyclerView.getItemAnimator(); if (animator instanceof SimpleItemAnimator) { ((SimpleItemAnimator) animator).setSupportsChangeAnimations(false); @@ -487,16 +487,16 @@ public class QueueFragment extends Fragment { private void reallyMoved(int from, int to) { // Write drag operation to database - Log.d(TAG, "Write to database move(" + dragFrom + ", " + dragTo + ")"); - DBWriter.moveQueueItem(dragFrom, dragTo, true); + Log.d(TAG, "Write to database move(" + from + ", " + to + ")"); + DBWriter.moveQueueItem(from, to, true); } } ); itemTouchHelper.attachToRecyclerView(recyclerView); - txtvEmpty = (TextView) root.findViewById(android.R.id.empty); + txtvEmpty = root.findViewById(android.R.id.empty); txtvEmpty.setVisibility(View.GONE); - progLoading = (ProgressBar) root.findViewById(R.id.progLoading); + progLoading = root.findViewById(R.id.progLoading); progLoading.setVisibility(View.VISIBLE); return root; @@ -533,9 +533,12 @@ public class QueueFragment extends Fragment { String info = queue.size() + getString(R.string.episodes_suffix); if(queue.size() > 0) { long timeLeft = 0; + float playbackSpeed = Float.valueOf(UserPreferences.getPlaybackSpeed()); for(FeedItem item : queue) { if(item.getMedia() != null) { - timeLeft += item.getMedia().getDuration() - item.getMedia().getPosition(); + timeLeft += + (long) ((item.getMedia().getDuration() - item.getMedia().getPosition()) + / playbackSpeed); } } info += " \u2022 "; diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java index 6a1dd4c2d..5f09be8ce 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java @@ -68,7 +68,7 @@ public class SubscriptionFragment extends Fragment { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.inflate(R.layout.fragment_subscriptions, container, false); - subscriptionGridLayout = (GridView) root.findViewById(R.id.subscriptions_grid); + subscriptionGridLayout = root.findViewById(R.id.subscriptions_grid); registerForContextMenu(subscriptionGridLayout); return root; } diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/GpodnetMainFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/GpodnetMainFragment.java index b48027668..4dc114f9b 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/GpodnetMainFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/GpodnetMainFragment.java @@ -31,12 +31,12 @@ public class GpodnetMainFragment extends Fragment { super.onCreateView(inflater, container, savedInstanceState); View root = inflater.inflate(R.layout.pager_fragment, container, false); - viewPager = (ViewPager)root.findViewById(R.id.viewpager); + viewPager = root.findViewById(R.id.viewpager); GpodnetPagerAdapter pagerAdapter = new GpodnetPagerAdapter(getChildFragmentManager(), getResources()); viewPager.setAdapter(pagerAdapter); // Give the TabLayout the ViewPager - tabLayout = (TabLayout) root.findViewById(R.id.sliding_tabs); + tabLayout = root.findViewById(R.id.sliding_tabs); tabLayout.setupWithViewPager(viewPager); return root; diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/PodcastListFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/PodcastListFragment.java index 055358c64..49851ebb4 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/PodcastListFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/gpodnet/PodcastListFragment.java @@ -78,10 +78,10 @@ public abstract class PodcastListFragment extends Fragment { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.inflate(R.layout.gpodnet_podcast_list, container, false); - gridView = (GridView) root.findViewById(R.id.gridView); - progressBar = (ProgressBar) root.findViewById(R.id.progressBar); - txtvError = (TextView) root.findViewById(R.id.txtvError); - butRetry = (Button) root.findViewById(R.id.butRetry); + gridView = root.findViewById(R.id.gridView); + progressBar = root.findViewById(R.id.progressBar); + txtvError = root.findViewById(R.id.txtvError); + butRetry = root.findViewById(R.id.butRetry); gridView.setOnItemClickListener((parent, view, position, id) -> onPodcastSelected((GpodnetPodcast) gridView.getAdapter().getItem(position))); diff --git a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java index ab7d0e7c6..bd4fe9bcf 100644 --- a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java +++ b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedMenuHandler.java @@ -30,6 +30,9 @@ import de.danoeh.antennapod.core.util.ShareUtils; * Handles interactions with the FeedItemMenu. */ public class FeedMenuHandler { + + private FeedMenuHandler(){ } + private static final String TAG = "FeedMenuHandler"; public static boolean onCreateOptionsMenu(MenuInflater inflater, Menu menu) { diff --git a/app/src/main/java/de/danoeh/antennapod/menuhandler/MenuItemUtils.java b/app/src/main/java/de/danoeh/antennapod/menuhandler/MenuItemUtils.java index 66e229bdd..7b9fcad9b 100644 --- a/app/src/main/java/de/danoeh/antennapod/menuhandler/MenuItemUtils.java +++ b/app/src/main/java/de/danoeh/antennapod/menuhandler/MenuItemUtils.java @@ -19,7 +19,7 @@ public class MenuItemUtils extends de.danoeh.antennapod.core.menuhandler.MenuIte public static void adjustTextColor(Context context, SearchView sv) { if(Build.VERSION.SDK_INT < 14) { - EditText searchEditText = (EditText) sv.findViewById(R.id.search_src_text); + EditText searchEditText = sv.findViewById(R.id.search_src_text); if (UserPreferences.getTheme() == de.danoeh.antennapod.R.style.Theme_AntennaPod_Dark || UserPreferences.getTheme() == R.style.Theme_AntennaPod_TrueBlack) { searchEditText.setTextColor(Color.WHITE); diff --git a/app/src/main/java/de/danoeh/antennapod/preferences/MasterSwitchPreference.java b/app/src/main/java/de/danoeh/antennapod/preferences/MasterSwitchPreference.java index e500267fe..b810cbfa6 100644 --- a/app/src/main/java/de/danoeh/antennapod/preferences/MasterSwitchPreference.java +++ b/app/src/main/java/de/danoeh/antennapod/preferences/MasterSwitchPreference.java @@ -9,6 +9,7 @@ import android.support.v7.preference.PreferenceViewHolder; import android.util.AttributeSet; import android.util.TypedValue; import android.widget.TextView; + import de.danoeh.antennapod.R; public class MasterSwitchPreference extends SwitchPreference { diff --git a/app/src/main/java/de/danoeh/antennapod/preferences/NumberPickerPreference.java b/app/src/main/java/de/danoeh/antennapod/preferences/NumberPickerPreference.java index 20b07e486..50e76838c 100644 --- a/app/src/main/java/de/danoeh/antennapod/preferences/NumberPickerPreference.java +++ b/app/src/main/java/de/danoeh/antennapod/preferences/NumberPickerPreference.java @@ -8,6 +8,7 @@ import android.util.AttributeSet; import android.view.View; import android.view.WindowManager; import android.widget.EditText; + import de.danoeh.antennapod.R; public class NumberPickerPreference extends Preference { diff --git a/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java b/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java index ca70d9594..31b2cbcb2 100644 --- a/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java +++ b/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java @@ -227,6 +227,33 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc return true; }); + ui.findPreference(UserPreferences.PREF_BACK_BUTTON_BEHAVIOR) + .setOnPreferenceChangeListener((preference, newValue) -> { + if (newValue.equals("page")) { + final Context context = ui.getActivity(); + final String[] navTitles = context.getResources().getStringArray(R.array.back_button_go_to_pages); + final String[] navTags = context.getResources().getStringArray(R.array.back_button_go_to_pages_tags); + final String choice[] = { UserPreferences.getBackButtonGoToPage() }; + + AlertDialog.Builder builder = new AlertDialog.Builder(context); + builder.setTitle(R.string.back_button_go_to_page_title); + builder.setSingleChoiceItems(navTitles, ArrayUtils.indexOf(navTags, UserPreferences.getBackButtonGoToPage()), (dialogInterface, i) -> { + if (i >= 0) { + choice[0] = navTags[i]; + } + }); + builder.setPositiveButton(R.string.confirm_label, (dialogInterface, i) -> UserPreferences.setBackButtonGoToPage(choice[0])); + builder.setNegativeButton(R.string.cancel_label, null); + builder.create().show(); + return true; + } else { + return true; + } + }); + + if (Build.VERSION.SDK_INT >= 26) { + ui.findPreference(UserPreferences.PREF_EXPANDED_NOTIFICATION).setVisible(false); + } } private void setupStorageScreen() { diff --git a/app/src/main/java/de/danoeh/antennapod/spa/SPAUtil.java b/app/src/main/java/de/danoeh/antennapod/spa/SPAUtil.java index 75cbd8b5a..03958508d 100644 --- a/app/src/main/java/de/danoeh/antennapod/spa/SPAUtil.java +++ b/app/src/main/java/de/danoeh/antennapod/spa/SPAUtil.java @@ -33,7 +33,7 @@ public class SPAUtil { * sent before. */ public static synchronized boolean sendSPAppsQueryFeedsIntent(Context context) { - if (context == null) throw new IllegalArgumentException("context = null"); + assert context != null : "context = null"; final Context appContext = context.getApplicationContext(); if (appContext == null) { Log.wtf(TAG, "Unable to get application context"); diff --git a/app/src/main/play/de/listing/fulldescription b/app/src/main/play/de/listing/fulldescription index e5d7ec72a..0e09c5c29 100644 --- a/app/src/main/play/de/listing/fulldescription +++ b/app/src/main/play/de/listing/fulldescription @@ -1,4 +1,4 @@ -AntennaPod ist ein Podcast-Manager und -Player, der Dir unmittelbar Zugriff auf Millionen von freien und bezahlten Podcasts ermöglicht, angefangen von unabhängigen Podcastern zu großen Rundfunkanstalten oder Hörfunksendern wie BBC, NPR und CNN. Abonniere, importiere und exportiere deine Feeds mühelos mit Hilfe des iTunes-Verzeichnisses, OPML-Dateien oder einfachen RSS-URLs. Reduziere Aufwand, Stromverbrauch und Datenverbrauch durch die Kontrolle der Downloads (bestimmte Uhrzeiten, Intervalle, WiFi-Netze) und des Löschens von Episoden (basierend auf deinen Favoriten und weiteren Einstellungen).<br> +AntennaPod ist ein Podcast-Manager und -Player, der Dir unmittelbar Zugriff auf Millionen von freien und kostenpflichtigen Podcasts ermöglicht, angefangen von unabhängigen Podcastern bis hin zu großen Rundfunkanstalten wie BBC, NPR und CNN. Abonniere, importiere und exportiere deine Feeds mühelos mit Hilfe des iTunes-Verzeichnisses, OPML-Dateien oder einfachen RSS-URLs. Reduziere Aufwand, Stromverbrauch und Datenverbrauch durch die Kontrolle der Downloads (bestimmte Uhrzeiten, Intervalle, WiFi-Netze) und des Löschens von Episoden (basierend auf deinen Favoriten und weiteren Einstellungen).<br> Aber am wichtigsten: Downloade, streame oder füge Episoden zur Abspielliste hinzu und genieße sie mit einstellbarer Abspielgeschwindigkeit, Unterstützung von Kapiteln und Schlummerfunktion. Mit Flattr kannst du den Podcastern sogar deine Wertschätzung zeigen. AntennaPod ist, von Podcast-Enthusiasten gemacht, frei im Sinne des Wortes: Open Source, keine Kosten, keine Werbung. @@ -24,7 +24,7 @@ STEUER DAS SYSTEM<br> • Passe das Aussehen mit dem hellen oder dunklen Theme an<br> • Sichere deine Abonnements mit gPodder.net oder über den OPML-Export -<b>Trete der AntennaPod-Community bei!</b><br> +<b>Tritt der AntennaPod-Community bei!</b><br> AntennaPod wird aktiv von Freiwilligen weiterentwickelt. Auch du kannst bei der Entwicklung mit Quellcode oder Kommentaren mitwirken! Wir verwenden GitHub für Funktionswünsche (Feature Requests), Fehlerberichte (Bug Reports) und zum Beisteuern von Code (Code Contributions). diff --git a/app/src/main/play/el/listing/fulldescription b/app/src/main/play/el/listing/fulldescription index 87b477fdc..f0ec3ae38 100644 --- a/app/src/main/play/el/listing/fulldescription +++ b/app/src/main/play/el/listing/fulldescription @@ -1,11 +1,11 @@ -AntennaPod is a podcast manager and player that gives you instant access to millions of free and paid podcasts, from independent podcasters to large publishing houses such as the BBC, NPR and CNN. Add, import and export their feeds hassle-free using the iTunes podcast database, OPML files or simple RSS URLs. Save effort, battery power and mobile data usage with powerful automation controls for downloading episodes (specify times, intervals and WiFi networks) and deleting episodes (based your favourites and delay settings).<br> -But most importantly: Download, stream or queue episodes and enjoy them the way you like with adjustable playback speeds, chapter support and a sleep timer. You can even show your love to the content creators with our Flattr integration. +Το Antennapod είναι μία εφαρμογή διαχείρισης και εκτέλεσης podcasts που σας δίνει άμεση πρόσβαση σε εκατομμύρια δωρεάν και επί πληρωμή podcasts, από ανεξάρτητους podcasters έως μεγάλους εκδοτικούς οίκους όπως το BBC, NPR και CNN. Μπορείτε εύκολα να προσθέσετε, να εισάγετε και να εξάγετε τις ροές τους χρησιμοποιώντας τη βάση δεδομένων podcast του iTunes, αρχεία OPML ή απλά RSS URLs. Γλυτώστε προσπάθεια, μπαταρία και χρήση δεδομένων κινητής τηλεφωνίας με ισχυρές ρυθμίσεις αυτοματισμών για λήψη επεισοδίων (ορίστε τους χρόνους, τα διαστήματα και τα δίκτυα WiFi) και σβήστε επεισόδια (με βάση τα αγαπημένα σας και τις ρυθμίσεις καθυστέρησης).<br> +Αλλά το πλέον σημαντικό: Κατεβάστε, κάντε stream ή βάλτε στη σειρά επεισόδια και απολαύστε τα όπως επιθυμήτε με ρυθμιζόμενη ταχύτητα αναπαραγωγής, υποστήριξη κεφάλαιων και χρονόμετρο απενεργοποίησης. Μπορείτε ακόμη και να δείξετε την αγάπη σας στους δημιουργούς περιεχομένου μέσω της ενσωμάτωσης του Flattr. -Made by podcast-enthousiast, AntennaPod is free in all senses of the word: open source, no costs, no ads. +Φτιαγμένο από λάτρη των podcast, το AntennaPod είναι ελεύθερο με όλες τις έννοιες της λέξης: ανοικτού λογισμικού, χωρίς κόστη, χωρίς διαφημίσεις. -<b>All features:</b><br> -IMPORT, ORGANIZE AND PLAY<br> -• Add and import feeds via the iTunes and gPodder.net directories, OPML files and RSS or Atom links<br> +<b>Όλα τα χαρακτηριστικά:</b><br> +ΕΙΣΑΓΩΓΉ, ΟΡΓΆΝΩΣΗ ΚΑΙ ΕΚΤΈΛΕΣΗ<br> +• Προσθέστε και εισάγετε ροές μέσω των φακέλων του iTunes και του gPodder.net, αρχείων OPML και RSS ή συνδέσμους Atom<br> • Manage playback from anywhere: homescreen widget, system notification and earplug and bluetooth controls<br> • Enjoy listening your way with adjustable playback speed, chapter support (MP3, VorbisComment and Podlove), remembered playback position and an advanced sleep timer (shake to reset, lower volume and slow down playback)<br> • Access password-protected feeds and episodes<br> @@ -24,20 +24,20 @@ CONTROL THE SYSTEM<br> • Adapt to your environment using the light and dark theme<br> • Back-up your subscriptions with the gPodder.net integration and OPML export -<b>Join the AntennaPod community!</b><br> -AntennaPod is under active development by volunteers. You can contribute too, with code or with comment! +<b>Ενταχθείτε στη κοινότητα του AntennaPod!</b><br> +Το AntennaPod βρίσκεται υπό ενεργή ανάπτυξη από εθελοντές. Μπορείτε και εσείς να συνεισφέρετε, με κώδικα ή με κάποιο σχόλιο. -GitHub is the place to go for feature requests, bug reports and code contributions:<br> +Το Github είναι το μέρος να επισκεφθείτε για να ζητήσετε καινούρια χαρακτηριστικά, να αναφέρετε σφάλματα και για συνεισφορά κώδικα:<br> https://www.github.com/AntennaPod/AntennaPod -Our Google Group is the place to share your ideas, favourite podcasting moments and gratitude to all the volunteers:<br> +Το Google Group μας είναι το μέρος να μοιραστείτε τις ιδέες σας, τις αγαπημένες σας στιγμές ενασχόλησης με τα podcasts και ευγνωμοσύνη σε όλους τους εθελοντές:<br> https://groups.google.com/forum/#!forum/antennapod -Have a question or want to give us feedback? +Έχετε κάποια ερώτηση ή θέλετε να μας δώσετε κάποια ανατροφοδότηση; https://twitter.com/@AntennaPod -Transifex is the place to help with translations:<br> +Το Transifex είναι το μέρος για να βοηθήσετε με τις μεταφράσεις:<br> https://www.transifex.com/antennapod/antennapod -Check out our Beta Testing programme to get the latest features first:<br> +Ελέγξτε το πρόγραμμά μας Beta Testing για να λαμβάνετε τα τελευταία χαρακτηριστικά πρώτοι:<br> https://www.github.com/AntennaPod/AntennaPod/wiki/Help-test-AntennaPod
\ No newline at end of file diff --git a/app/src/main/play/es/listing/fulldescription b/app/src/main/play/es/listing/fulldescription index 2f1c8861a..96f914f26 100644 --- a/app/src/main/play/es/listing/fulldescription +++ b/app/src/main/play/es/listing/fulldescription @@ -1,4 +1,4 @@ -AntennaPod is un gestor y reproductor de podcast que te da acceso instantáneo a millones de podcast gratuitos y de pago, desde podcasters independientes a grandes estaciones como la BBC, NPR y CNN. Agrega, importa y exporta las fuentes de manera sencilla usando el listado de iTunes, archivos OPML o las URL de tipo RSS. Ahorra esfuerzo, batería y datos con los controles de descarga (a horas o intervalos específicos, o redes WiFi) y de borrado de episodios (basado en favoritos y ajustes de tiempo).<br> +AntennaPod es un gestor y reproductor de podcast que te da acceso instantáneo a millones de podcast gratuitos y pagos, desde podcasters independientes a grandes estaciones como la BBC, NPR y CNN. Agrega, importa y exporta las fuentes de manera sencilla usando el listado de iTunes, archivos OPML o las URL de tipo RSS. Ahorre esfuerzo, energía de la batería y uso de datos móviles con potentes controles de automatización para descargar episodios (especifique horarios, intervalos y redes WiFi) y elimine episodios (según sus preferencias y configuraciones de demora).<br> Y lo más importante: descarga, escucha en stream y disfrutalos como quieras con velocidad de reproducción variable, soporte para capítulos y temporizador de sueño. Incluso puedes mostrar tu gratitud a los creadores de contenido mediante Flattr. Hecho por entusiastas del podcasting, AntennaPod es libre, gratuito y sin publicidad. diff --git a/app/src/main/res/layout/all_episodes_fragment.xml b/app/src/main/res/layout/all_episodes_fragment.xml index 7dd447bb2..89f900a1f 100644 --- a/app/src/main/res/layout/all_episodes_fragment.xml +++ b/app/src/main/res/layout/all_episodes_fragment.xml @@ -10,12 +10,12 @@ android:id="@android:id/list" android:layout_width="match_parent" android:layout_height="match_parent" - android:scrollbarStyle="outsideOverlay" + android:clipToPadding="false" android:paddingTop="@dimen/list_vertical_padding" android:paddingBottom="@dimen/list_vertical_padding" - android:clipToPadding="false" - tools:listitem="@layout/new_episodes_listitem" - tools:itemCount="13"/> + android:scrollbarStyle="outsideOverlay" + tools:itemCount="13" + tools:listitem="@layout/new_episodes_listitem" /> <ProgressBar android:id="@+id/progLoading" diff --git a/app/src/main/res/layout/audio_controls.xml b/app/src/main/res/layout/audio_controls.xml index 852b6e922..f03e4c03f 100644 --- a/app/src/main/res/layout/audio_controls.xml +++ b/app/src/main/res/layout/audio_controls.xml @@ -21,6 +21,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="16dp" + android:layout_marginStart="16dp" android:text="1.00x"/> </LinearLayout> @@ -35,6 +36,7 @@ android:layout_width="32dp" android:layout_height="32dp" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:gravity="center" android:text="-" android:textStyle="bold" @@ -48,6 +50,7 @@ android:layout_height="32dp" android:minWidth="0dp" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" android:gravity="center" android:text="+" android:textStyle="bold" @@ -60,7 +63,9 @@ android:layout_width="match_parent" android:layout_height="32dp" android:layout_toRightOf="@id/butDecSpeed" + android:layout_toEndOf="@id/butDecSpeed" android:layout_toLeftOf="@id/butIncSpeed" + android:layout_toStartOf="@id/butIncSpeed" android:layout_centerVertical="true" android:max="40"/> @@ -79,6 +84,7 @@ android:layout_height="wrap_content" android:layout_marginTop="-12dp" android:layout_marginLeft="8dp" + android:layout_marginStart="8dp" android:orientation="horizontal" android:gravity="center"> @@ -101,6 +107,7 @@ android:layout_height="wrap_content" android:layout_marginTop="8dp" android:layout_marginLeft="8dp" + android:layout_marginStart="8dp" android:orientation="horizontal" android:gravity="center"> diff --git a/app/src/main/res/layout/authentication_dialog.xml b/app/src/main/res/layout/authentication_dialog.xml index 00e74c9e1..187045c63 100644 --- a/app/src/main/res/layout/authentication_dialog.xml +++ b/app/src/main/res/layout/authentication_dialog.xml @@ -67,8 +67,10 @@ android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:layout_alignParentTop="true" android:layout_toLeftOf="@id/horizontal_divider" + android:layout_toStartOf="@id/horizontal_divider" android:background="?android:attr/selectableItemBackground" android:text="@string/cancel_label" /> @@ -78,8 +80,10 @@ android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" android:layout_alignParentTop="true" android:layout_toRightOf="@id/horizontal_divider" + android:layout_toEndOf="@id/horizontal_divider" android:background="?android:attr/selectableItemBackground" android:text="@string/confirm_label" /> </RelativeLayout> diff --git a/app/src/main/res/layout/directory_chooser.xml b/app/src/main/res/layout/directory_chooser.xml index 14e2f6a38..5b9269607 100644 --- a/app/src/main/res/layout/directory_chooser.xml +++ b/app/src/main/res/layout/directory_chooser.xml @@ -33,8 +33,10 @@ android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:layout_alignParentTop="true" android:layout_toLeftOf="@id/horizontal_divider" + android:layout_toStartOf="@id/horizontal_divider" android:background="?android:attr/selectableItemBackground" android:text="@string/cancel_label" /> @@ -44,8 +46,10 @@ android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" android:layout_alignParentTop="true" android:layout_toRightOf="@id/horizontal_divider" + android:layout_toEndOf="@id/horizontal_divider" android:background="?android:attr/selectableItemBackground" android:text="@string/confirm_label" /> </RelativeLayout> @@ -62,6 +66,7 @@ android:layout_width="60dp" android:layout_height="60dp" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:layout_alignParentTop="true" android:background="?attr/selectableItemBackground" android:src="?attr/navigation_up" @@ -77,6 +82,7 @@ android:layout_marginRight="8dp" android:layout_marginTop="8dp" android:layout_toRightOf="@id/butNavUp" + android:layout_toEndOf="@id/butNavUp" android:text="@string/selected_folder_label" android:textStyle="bold" tools:background="@android:color/holo_green_dark"> @@ -87,9 +93,11 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" android:layout_below="@id/txtvSelectedFolderLabel" android:layout_margin="8dp" android:layout_toRightOf="@id/butNavUp" + android:layout_toEndOf="@id/butNavUp" android:ellipsize="start" android:scrollHorizontally="true" android:singleLine="true" diff --git a/app/src/main/res/layout/download_authentication_activity.xml b/app/src/main/res/layout/download_authentication_activity.xml index f6925dc3a..3414a5e00 100644 --- a/app/src/main/res/layout/download_authentication_activity.xml +++ b/app/src/main/res/layout/download_authentication_activity.xml @@ -77,8 +77,10 @@ android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:layout_alignParentTop="true" android:layout_toLeftOf="@id/horizontal_divider" + android:layout_toStartOf="@id/horizontal_divider" android:background="?android:attr/selectableItemBackground" android:text="@string/cancel_label"/> @@ -88,8 +90,10 @@ android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" android:layout_alignParentTop="true" android:layout_toRightOf="@id/horizontal_divider" + android:layout_toEndOf="@id/horizontal_divider" android:background="?android:attr/selectableItemBackground" android:text="@string/confirm_label"/> </RelativeLayout> diff --git a/app/src/main/res/layout/downloaded_episodeslist_item.xml b/app/src/main/res/layout/downloaded_episodeslist_item.xml index 770b88c7e..66ae6c180 100644 --- a/app/src/main/res/layout/downloaded_episodeslist_item.xml +++ b/app/src/main/res/layout/downloaded_episodeslist_item.xml @@ -13,6 +13,7 @@ android:layout_gravity="center_vertical" android:layout_marginBottom="@dimen/listitem_threeline_verticalpadding" android:layout_marginLeft="@dimen/listitem_threeline_horizontalpadding" + android:layout_marginStart="@dimen/listitem_threeline_horizontalpadding" android:layout_marginTop="@dimen/listitem_threeline_verticalpadding" android:contentDescription="@string/cover_label" android:scaleType="centerCrop" @@ -24,7 +25,9 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginLeft="@dimen/listitem_threeline_textleftpadding" + android:layout_marginStart="@dimen/listitem_threeline_textleftpadding" android:layout_marginRight="@dimen/listitem_threeline_textrightpadding" + android:layout_marginEnd="@dimen/listitem_threeline_textrightpadding" android:layout_marginTop="@dimen/listitem_threeline_verticalpadding" android:layout_marginBottom="@dimen/listitem_threeline_verticalpadding" android:layout_weight="1" @@ -74,6 +77,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="8dp" + android:layout_marginStart="8dp" tools:text="Jan 23" tools:background="@android:color/holo_green_dark"/> diff --git a/app/src/main/res/layout/downloadlist_item.xml b/app/src/main/res/layout/downloadlist_item.xml index 97f3ac1a1..668ec817a 100644 --- a/app/src/main/res/layout/downloadlist_item.xml +++ b/app/src/main/res/layout/downloadlist_item.xml @@ -17,6 +17,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="@dimen/listitem_threeline_horizontalpadding" + android:layout_marginStart="@dimen/listitem_threeline_horizontalpadding" android:layout_marginTop="@dimen/listitem_threeline_verticalpadding" android:ellipsize="end" android:lines="1" @@ -48,6 +49,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:ellipsize="end" android:lines="1" android:textColor="?android:attr/textColorPrimary" @@ -60,6 +62,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" android:ellipsize="end" android:lines="1" android:textColor="?android:attr/textColorPrimary" diff --git a/app/src/main/res/layout/downloadlog_item.xml b/app/src/main/res/layout/downloadlog_item.xml index 712dda63e..505102ea4 100644 --- a/app/src/main/res/layout/downloadlog_item.xml +++ b/app/src/main/res/layout/downloadlog_item.xml @@ -17,6 +17,7 @@ android:layout_height="48sp" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:textSize="48sp" android:gravity="center" /> @@ -26,7 +27,9 @@ android:layout_height="wrap_content" android:layout_below="@id/txtvIcon" android:layout_alignLeft="@id/txtvIcon" + android:layout_alignStart="@id/txtvIcon" android:layout_alignRight="@id/txtvIcon" + android:layout_alignEnd="@id/txtvIcon" android:layout_marginTop="8dp" android:text="{fa-repeat}" tools:text="↻" /> @@ -38,7 +41,9 @@ android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" android:layout_marginLeft="8dp" + android:layout_marginStart="8dp" android:layout_marginBottom="8dp" tools:text="Media file" tools:background="@android:color/holo_green_dark" /> @@ -50,8 +55,11 @@ android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_toRightOf="@id/txtvIcon" + android:layout_toEndOf="@id/txtvIcon" android:layout_toLeftOf="@id/txtvType" + android:layout_toStartOf="@id/txtvType" android:layout_marginLeft="8dp" + android:layout_marginStart="8dp" android:layout_marginBottom="8dp" android:minLines="1" android:maxLines="2" @@ -64,8 +72,10 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/txtvIcon" + android:layout_toEndOf="@id/txtvIcon" android:layout_below="@id/txtvTitle" android:layout_marginLeft="8dp" + android:layout_marginStart="8dp" android:layout_marginBottom="8dp" tools:text="January 23" tools:background="@android:color/holo_green_dark" /> @@ -76,7 +86,9 @@ android:layout_height="wrap_content" android:layout_below="@id/txtvDate" android:layout_toRightOf="@id/txtvIcon" + android:layout_toEndOf="@id/txtvIcon" android:layout_marginLeft="8dp" + android:layout_marginStart="8dp" android:textColor="?android:attr/textColorTertiary" android:textSize="@dimen/text_size_micro" tools:text="@string/design_time_downloaded_log_failure_reason" diff --git a/app/src/main/res/layout/ellipsize_start_listitem.xml b/app/src/main/res/layout/ellipsize_start_listitem.xml index 4a70ff982..1b6c48152 100644 --- a/app/src/main/res/layout/ellipsize_start_listitem.xml +++ b/app/src/main/res/layout/ellipsize_start_listitem.xml @@ -1,22 +1,22 @@ <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="match_parent" - tools:background="@android:color/darker_gray"> + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + tools:background="@android:color/darker_gray"> <TextView android:id="@+id/txtvTitle" - android:textColor="?android:attr/textColorPrimary" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textSize="@dimen/text_size_small" - android:singleLine="true" android:layout_margin="16dp" android:ellipsize="start" - tools:text="List item title" - tools:background="@android:color/holo_green_dark"/> + android:singleLine="true" + android:textColor="?android:attr/textColorPrimary" + android:textSize="@dimen/text_size_small" + tools:background="@android:color/holo_green_dark" + tools:text="List item title" /> </LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/feedinfo.xml b/app/src/main/res/layout/feedinfo.xml index bb544d289..50061c4d8 100644 --- a/app/src/main/res/layout/feedinfo.xml +++ b/app/src/main/res/layout/feedinfo.xml @@ -36,7 +36,9 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:layout_marginRight="8dp" + android:layout_marginEnd="8dp" android:layout_marginBottom="8dp" app:layout_row="0" app:layout_column="0" @@ -60,6 +62,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="8dp" + android:layout_marginEnd="8dp" android:layout_marginBottom="8dp" app:layout_row="1" app:layout_column="0" @@ -83,6 +86,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="8dp" + android:layout_marginEnd="8dp" app:layout_row="2" app:layout_column="0" android:lines="1" diff --git a/app/src/main/res/layout/feeditem_fragment.xml b/app/src/main/res/layout/feeditem_fragment.xml index a6ce221db..78c0b3b16 100644 --- a/app/src/main/res/layout/feeditem_fragment.xml +++ b/app/src/main/res/layout/feeditem_fragment.xml @@ -32,6 +32,7 @@ android:layout_width="50dp" android:layout_height="50dp" android:layout_marginRight="16dp" + android:layout_marginEnd="16dp" android:layout_marginBottom="16dp" android:contentDescription="@string/cover_label" android:gravity="center_vertical" @@ -45,6 +46,7 @@ android:layout_height="wrap_content" android:layout_alignTop="@id/imgvCover" android:layout_toRightOf="@id/imgvCover" + android:layout_toEndOf="@id/imgvCover" tools:text="Podcast title" tools:background="@android:color/holo_green_dark" /> @@ -54,6 +56,7 @@ android:layout_height="wrap_content" android:layout_below="@id/txtvPodcast" android:layout_toRightOf="@id/imgvCover" + android:layout_toEndOf="@id/imgvCover" android:textSize="16sp" android:textColor="?android:attr/textColorPrimary" android:ellipsize="end" @@ -67,6 +70,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/imgvCover" + android:layout_toEndOf="@id/imgvCover" android:layout_below="@id/txtvTitle" tools:text="00:42:23" tools:background="@android:color/holo_green_dark"/> @@ -77,8 +81,10 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" android:layout_below="@id/txtvTitle" android:layout_marginLeft="8dp" + android:layout_marginStart="8dp" tools:text="Jan 23" tools:background="@android:color/holo_green_dark" /> @@ -98,7 +104,9 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="16dp" + android:layout_marginStart="16dp" android:layout_marginRight="16dp" + android:layout_marginEnd="16dp" android:orientation="horizontal" tools:background="@android:color/holo_blue_bright"> @@ -108,6 +116,7 @@ android:layout_height="48dp" android:layout_gravity="center_vertical" android:layout_marginRight="8dp" + android:layout_marginEnd="8dp" android:layout_weight="1" android:background="?attr/selectableItemBackground" android:ellipsize="end" @@ -123,6 +132,7 @@ android:layout_height="48dp" android:layout_gravity="center_vertical" android:layout_marginLeft="8dp" + android:layout_marginStart="8dp" android:layout_weight="1" android:background="?attr/selectableItemBackground" android:ellipsize="end" diff --git a/app/src/main/res/layout/feeditemlist_header.xml b/app/src/main/res/layout/feeditemlist_header.xml index 1478e35d7..e1f451e9e 100644 --- a/app/src/main/res/layout/feeditemlist_header.xml +++ b/app/src/main/res/layout/feeditemlist_header.xml @@ -19,10 +19,12 @@ android:layout_width="@dimen/thumbnail_length_onlinefeedview" android:layout_height="@dimen/thumbnail_length_onlinefeedview" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:layout_alignParentTop="true" android:layout_centerVertical="true" android:layout_marginBottom="16dp" android:layout_marginLeft="16dp" + android:layout_marginStart="16dp" android:layout_marginTop="16dp" android:contentDescription="@string/cover_label" tools:src="@drawable/ic_stat_antenna_default" @@ -33,8 +35,10 @@ android:layout_width="40dp" android:layout_height="40dp" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" android:layout_alignParentTop="true" android:layout_marginLeft="16dp" + android:layout_marginStart="16dp" android:layout_marginTop="8dp" android:background="?attr/selectableItemBackground" android:contentDescription="@string/show_info_label" @@ -62,9 +66,12 @@ android:layout_alignParentTop="true" android:layout_marginBottom="16dp" android:layout_marginLeft="16dp" + android:layout_marginStart="16dp" android:layout_marginTop="16dp" android:layout_toLeftOf="@id/butShowInfo" + android:layout_toStartOf="@id/butShowInfo" android:layout_toRightOf="@id/imgvCover" + android:layout_toEndOf="@id/imgvCover" android:ellipsize="end" android:maxLines="2" android:shadowColor="@color/black" @@ -80,8 +87,13 @@ android:layout_below="@id/txtvTitle" android:layout_marginBottom="16dp" android:layout_marginLeft="16dp" + android:layout_marginStart="16dp" + android:layout_marginRight="16dp" + android:layout_marginEnd="16dp" android:layout_toLeftOf="@id/butShowSettings" + android:layout_toStartOf="@id/butShowSettings" android:layout_toRightOf="@id/imgvCover" + android:layout_toEndOf="@id/imgvCover" android:ellipsize="end" android:lines="1" android:shadowColor="@color/black" diff --git a/app/src/main/res/layout/feeditemlist_item.xml b/app/src/main/res/layout/feeditemlist_item.xml index 5a2f091ec..adf0748eb 100644 --- a/app/src/main/res/layout/feeditemlist_item.xml +++ b/app/src/main/res/layout/feeditemlist_item.xml @@ -13,6 +13,7 @@ android:layout_width="0dp" android:layout_height="match_parent" android:layout_marginLeft="@dimen/listitem_threeline_horizontalpadding" + android:layout_marginStart="@dimen/listitem_threeline_horizontalpadding" android:layout_weight="1" android:layout_marginTop="@dimen/listitem_threeline_verticalpadding" android:layout_marginBottom="@dimen/listitem_threeline_verticalpadding" @@ -24,6 +25,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" android:layout_alignParentTop="true" android:layout_marginLeft="8dp" android:layout_marginRight="8dp" @@ -36,9 +38,11 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:layout_alignParentTop="true" android:layout_marginBottom="4dp" android:layout_toLeftOf="@id/statusUnread" + android:layout_toStartOf="@id/statusUnread" tools:text="Episode title" tools:background="@android:color/holo_green_dark" /> @@ -48,6 +52,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:layout_below="@id/txtvItemname" tools:text="00:42:23" tools:background="@android:color/holo_green_dark" /> @@ -57,8 +62,10 @@ android:layout_width="@dimen/enc_icons_size" android:layout_height="@dimen/enc_icons_size" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" android:layout_below="@id/txtvItemname" android:layout_marginRight="8dp" + android:layout_marginEnd="8dp" android:contentDescription="@string/in_queue_label" android:src="?attr/stat_playlist" android:visibility="visible" @@ -71,7 +78,9 @@ android:layout_height="@dimen/enc_icons_size" android:layout_below="@id/txtvItemname" android:layout_marginRight="8dp" + android:layout_marginEnd="8dp" android:layout_toLeftOf="@id/imgvInPlaylist" + android:layout_toStartOf="@id/imgvInPlaylist" tools:ignore="ContentDescription" tools:src="@drawable/ic_hearing_white_18dp" tools:background="@android:color/holo_red_light" /> @@ -83,7 +92,9 @@ android:layout_height="wrap_content" android:layout_below="@id/txtvItemname" android:layout_marginRight="8dp" + android:layout_marginEnd="8dp" android:layout_toLeftOf="@id/imgvType" + android:layout_toStartOf="@id/imgvType" tools:text="Jan 23" tools:background="@android:color/holo_green_dark" /> @@ -92,16 +103,18 @@ style="?android:attr/progressBarStyleHorizontal" android:layout_width="0dp" android:layout_height="wrap_content" + android:layout_alignBottom="@id/txtvPublished" android:layout_marginLeft="8dp" android:layout_marginRight="8dp" + android:layout_toStartOf="@id/txtvPublished" android:layout_toLeftOf="@id/txtvPublished" + android:layout_toEndOf="@id/txtvLenSize" android:layout_toRightOf="@id/txtvLenSize" - android:layout_alignTop="@id/txtvPublished" - android:layout_alignBottom="@id/txtvPublished" - tools:background="@android:color/holo_blue_light" + android:layoutDirection="ltr" + android:indeterminate="false" android:max="100" android:progress="42" - android:indeterminate="false" /> + tools:background="@android:color/holo_blue_light" /> </RelativeLayout> diff --git a/app/src/main/res/layout/feedsettings.xml b/app/src/main/res/layout/feedsettings.xml index 23d116d4c..9e5f2245b 100644 --- a/app/src/main/res/layout/feedsettings.xml +++ b/app/src/main/res/layout/feedsettings.xml @@ -39,7 +39,8 @@ app:layout_row="0" app:layout_column="0" app:layout_gravity="center_vertical" - android:layout_marginRight="10dp" /> + android:layout_marginRight="10dp" + android:layout_marginEnd="10dp" /> <Spinner android:layout_width="wrap_content" @@ -97,6 +98,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="8dp" + android:layout_marginEnd="8dp" android:layout_marginBottom="8dp" app:layout_row="0" app:layout_column="0" @@ -119,6 +121,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="8dp" + android:layout_marginEnd="8dp" android:layout_marginBottom="8dp" app:layout_row="1" app:layout_column="0" diff --git a/app/src/main/res/layout/gpodnet_podcast_listitem.xml b/app/src/main/res/layout/gpodnet_podcast_listitem.xml index bbe8e65d6..27a8bbdca 100644 --- a/app/src/main/res/layout/gpodnet_podcast_listitem.xml +++ b/app/src/main/res/layout/gpodnet_podcast_listitem.xml @@ -15,8 +15,10 @@ android:layout_width="@dimen/thumbnail_length_itemlist" android:layout_height="@dimen/thumbnail_length_itemlist" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:layout_alignParentTop="true" android:layout_marginRight="8dp" + android:layout_marginEnd="8dp" android:adjustViewBounds="true" android:contentDescription="@string/cover_label" android:cropToPadding="true" @@ -30,6 +32,7 @@ android:layout_height="wrap_content" android:layout_alignTop="@id/txtvTitle" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" android:orientation="horizontal"> <ImageView @@ -37,6 +40,7 @@ android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_marginRight="-4dp" + android:layout_marginEnd="-4dp" android:src="?attr/feed" /> <TextView @@ -56,7 +60,9 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/imgvCover" + android:layout_toEndOf="@id/imgvCover" android:layout_toLeftOf="@id/subscribers_container" + android:layout_toStartOf="@id/subscribers_container" android:layout_alignTop="@id/imgvCover" android:maxLines="2" android:includeFontPadding="false" @@ -69,6 +75,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_toRightOf="@id/imgvCover" + android:layout_toEndOf="@id/imgvCover" android:layout_below="@id/txtvTitle" android:textSize="14sp" android:textColor="?android:attr/textColorSecondary" diff --git a/app/src/main/res/layout/gpodnet_tag_listitem.xml b/app/src/main/res/layout/gpodnet_tag_listitem.xml index 9e545e59d..a377f9ba1 100644 --- a/app/src/main/res/layout/gpodnet_tag_listitem.xml +++ b/app/src/main/res/layout/gpodnet_tag_listitem.xml @@ -13,6 +13,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="@dimen/listitem_threeline_horizontalpadding" + android:layout_marginStart="@dimen/listitem_threeline_horizontalpadding" android:layout_marginTop="@dimen/listitem_threeline_verticalpadding" android:layout_marginBottom="@dimen/listitem_threeline_verticalpadding" android:lines="1" @@ -25,7 +26,9 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" android:layout_marginRight="@dimen/listitem_threeline_horizontalpadding" + android:layout_marginEnd="@dimen/listitem_threeline_horizontalpadding" android:layout_marginTop="@dimen/listitem_threeline_verticalpadding" android:layout_marginBottom="@dimen/listitem_threeline_verticalpadding" tools:text="301" diff --git a/app/src/main/res/layout/gpodnetauth_credentials.xml b/app/src/main/res/layout/gpodnetauth_credentials.xml index a290b682b..f995ae4cc 100644 --- a/app/src/main/res/layout/gpodnetauth_credentials.xml +++ b/app/src/main/res/layout/gpodnetauth_credentials.xml @@ -59,6 +59,7 @@ android:layout_height="wrap_content" android:layout_below="@id/etxtPassword" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" android:text="@string/gpodnetauth_login_butLabel" android:layout_margin="8dp"/> @@ -68,7 +69,9 @@ android:layout_height="wrap_content" android:layout_below="@id/etxtPassword" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:layout_toLeftOf="@id/butLogin" + android:layout_toStartOf="@id/butLogin" android:textColor="@color/download_failed_red" android:textSize="@dimen/text_size_small" android:maxLines="2" @@ -84,7 +87,8 @@ android:layout_height="wrap_content" android:visibility="gone" android:layout_alignTop="@+id/butLogin" - android:layout_toLeftOf="@+id/butLogin"/> + android:layout_toLeftOf="@+id/butLogin" + android:layout_toStartOf="@+id/butLogin"/> <TextView android:layout_width="match_parent" diff --git a/app/src/main/res/layout/gpodnetauth_device.xml b/app/src/main/res/layout/gpodnetauth_device.xml index 38455f02c..5840fe955 100644 --- a/app/src/main/res/layout/gpodnetauth_device.xml +++ b/app/src/main/res/layout/gpodnetauth_device.xml @@ -41,7 +41,8 @@ android:textColor="?android:attr/textColorSecondary" android:layout_margin="8dp" android:layout_alignTop="@+id/etxtDeviceID" - android:layout_alignLeft="@+id/etxtCaption"/> + android:layout_alignLeft="@+id/etxtCaption" + android:layout_alignStart="@+id/etxtCaption"/> <EditText android:id="@+id/etxtDeviceID" @@ -49,7 +50,9 @@ android:layout_height="wrap_content" android:layout_below="@id/etxtCaption" android:layout_toRightOf="@id/txtvDeviceID" + android:layout_toEndOf="@id/txtvDeviceID" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" android:layout_margin="8dp"/> <Button @@ -58,6 +61,7 @@ android:layout_height="wrap_content" android:layout_margin="8dp" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" android:layout_below="@id/etxtDeviceID" android:text="@string/gpodnetauth_device_butCreateNewDevice"/> @@ -66,8 +70,10 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:layout_below="@id/etxtDeviceID" android:layout_toLeftOf="@id/butCreateNewDevice" + android:layout_toStartOf="@id/butCreateNewDevice" android:textColor="@color/download_failed_red" android:layout_margin="16dp" android:textSize="@dimen/text_size_small" @@ -80,6 +86,7 @@ android:layout_height="wrap_content" android:layout_alignTop="@id/butCreateNewDevice" android:layout_toLeftOf="@id/butCreateNewDevice" + android:layout_toStartOf="@id/butCreateNewDevice" android:textColor="@color/download_failed_red" android:textSize="@dimen/text_size_medium" android:visibility="gone" @@ -102,7 +109,9 @@ android:text="@string/gpodnetauth_device_butChoose" android:layout_below="@+id/spinnerChooseDevice" android:layout_alignLeft="@+id/butCreateNewDevice" - android:layout_alignRight="@+id/butCreateNewDevice"/> + android:layout_alignStart="@+id/butCreateNewDevice" + android:layout_alignRight="@+id/butCreateNewDevice" + android:layout_alignEnd="@+id/butCreateNewDevice"/> <Spinner android:id="@+id/spinnerChooseDevice" @@ -110,7 +119,9 @@ android:layout_height="wrap_content" android:layout_below="@id/txtvChooseExistingDevice" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:layout_margin="8dp" - android:layout_alignParentRight="true"/> + android:layout_alignParentRight="true" + android:layout_alignParentEnd="true"/> </RelativeLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/itemdescription_listitem.xml b/app/src/main/res/layout/itemdescription_listitem.xml index 51bc9a5eb..9d03e30a3 100644 --- a/app/src/main/res/layout/itemdescription_listitem.xml +++ b/app/src/main/res/layout/itemdescription_listitem.xml @@ -17,8 +17,10 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" android:layout_alignParentTop="true" android:layout_marginLeft="8dp" + android:layout_marginStart="8dp" android:textSize="14sp" android:textColor="?android:textColorSecondary" android:ellipsize="end" @@ -31,8 +33,10 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:layout_alignParentTop="true" android:layout_toLeftOf="@id/txtvPubDate" + android:layout_toStartOf="@id/txtvPubDate" android:textSize="16sp" android:textColor="?android:attr/textColorPrimary" android:ellipsize="end" diff --git a/app/src/main/res/layout/itunes_podcast_listitem.xml b/app/src/main/res/layout/itunes_podcast_listitem.xml index 1e6e5a836..4848563b1 100644 --- a/app/src/main/res/layout/itunes_podcast_listitem.xml +++ b/app/src/main/res/layout/itunes_podcast_listitem.xml @@ -16,8 +16,10 @@ android:layout_width="@dimen/thumbnail_length_itemlist" android:layout_height="@dimen/thumbnail_length_itemlist" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:layout_alignParentTop="true" android:layout_marginRight="8dp" + android:layout_marginEnd="8dp" android:adjustViewBounds="true" android:contentDescription="@string/cover_label" android:cropToPadding="true" @@ -29,6 +31,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_toRightOf="@id/imgvCover" + android:layout_toEndOf="@id/imgvCover" android:layout_centerVertical="true" android:orientation="vertical"> diff --git a/app/src/main/res/layout/mediaplayerinfo_activity.xml b/app/src/main/res/layout/mediaplayerinfo_activity.xml index 21c4940b5..c9e93e149 100644 --- a/app/src/main/res/layout/mediaplayerinfo_activity.xml +++ b/app/src/main/res/layout/mediaplayerinfo_activity.xml @@ -47,6 +47,7 @@ android:paddingTop="8dp" android:layout_alignParentBottom="true" android:background="?attr/overlay_drawable" + android:layoutDirection="ltr" android:orientation="vertical"> @@ -59,8 +60,10 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:layout_centerVertical="true" android:layout_marginLeft="8dp" + android:layout_marginStart="8dp" android:text="@string/position_default_label" android:textColor="?android:attr/textColorSecondary" android:textSize="@dimen/text_size_micro" @@ -71,8 +74,10 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" android:layout_centerVertical="true" android:layout_marginRight="8dp" + android:layout_marginEnd="8dp" android:text="@string/position_default_label" android:textColor="?android:attr/textColorSecondary" android:textSize="@dimen/text_size_micro" @@ -84,9 +89,13 @@ android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginLeft="8dp" + android:layout_marginStart="8dp" android:layout_marginRight="8dp" + android:layout_marginEnd="8dp" android:layout_toLeftOf="@id/txtvLength" + android:layout_toStartOf="@id/txtvLength" android:layout_toRightOf="@id/txtvPosition" + android:layout_toEndOf="@id/txtvPosition" android:max="500" tools:background="@android:color/holo_green_dark" /> @@ -106,7 +115,9 @@ android:layout_width="@dimen/audioplayer_playercontrols_length" android:layout_height="@dimen/audioplayer_playercontrols_length" android:layout_marginLeft="16dp" + android:layout_marginStart="16dp" android:layout_marginRight="16dp" + android:layout_marginEnd="16dp" android:layout_centerHorizontal="true" android:background="?attr/selectableItemBackground" android:contentDescription="@string/pause_label" @@ -120,7 +131,9 @@ android:layout_width="@dimen/audioplayer_playercontrols_length" android:layout_height="@dimen/audioplayer_playercontrols_length" android:layout_toLeftOf="@id/butPlay" + android:layout_toStartOf="@id/butPlay" android:layout_marginLeft="16dp" + android:layout_marginStart="16dp" android:background="?attr/selectableItemBackground" android:contentDescription="@string/rewind_label" android:src="?attr/av_rew_big" @@ -134,7 +147,9 @@ android:layout_height="wrap_content" android:layout_below="@id/butRev" android:layout_alignLeft="@id/butRev" + android:layout_alignStart="@id/butRev" android:layout_alignRight="@id/butRev" + android:layout_alignEnd="@id/butRev" android:layout_marginTop="-8dp" android:gravity="center" android:text="30" @@ -147,6 +162,7 @@ android:layout_width="@dimen/audioplayer_playercontrols_length" android:layout_height="@dimen/audioplayer_playercontrols_length" android:layout_toLeftOf="@id/butRev" + android:layout_toStartOf="@id/butRev" android:background="?attr/selectableItemBackground" android:contentDescription="@string/set_playback_speed_label" android:src="?attr/av_fast_forward" @@ -161,6 +177,7 @@ android:layout_width="@dimen/audioplayer_playercontrols_length" android:layout_height="@dimen/audioplayer_playercontrols_length" android:layout_toLeftOf="@id/butRev" + android:layout_toStartOf="@id/butRev" android:background="?attr/selectableItemBackground" android:contentDescription="@string/cast_disconnect_label" android:src="?attr/ic_cast_disconnect" @@ -175,7 +192,9 @@ android:layout_width="@dimen/audioplayer_playercontrols_length" android:layout_height="@dimen/audioplayer_playercontrols_length" android:layout_toRightOf="@id/butPlay" + android:layout_toEndOf="@id/butPlay" android:layout_marginRight="16dp" + android:layout_marginEnd="16dp" android:background="?attr/selectableItemBackground" android:contentDescription="@string/fast_forward_label" android:src="?attr/av_ff_big" @@ -189,7 +208,9 @@ android:layout_height="wrap_content" android:layout_below="@id/butFF" android:layout_alignLeft="@id/butFF" + android:layout_alignStart="@id/butFF" android:layout_alignRight="@id/butFF" + android:layout_alignEnd="@id/butFF" android:layout_marginTop="-8dp" android:gravity="center" android:text="30" @@ -202,6 +223,7 @@ android:layout_width="@dimen/audioplayer_playercontrols_length" android:layout_height="@dimen/audioplayer_playercontrols_length" android:layout_toRightOf="@id/butFF" + android:layout_toEndOf="@id/butFF" android:background="?attr/selectableItemBackground" android:scaleType="fitCenter" android:src="?attr/av_skip_big" diff --git a/app/src/main/res/layout/nav_feedlistitem.xml b/app/src/main/res/layout/nav_feedlistitem.xml index 18b5255aa..9f19157fc 100644 --- a/app/src/main/res/layout/nav_feedlistitem.xml +++ b/app/src/main/res/layout/nav_feedlistitem.xml @@ -5,7 +5,6 @@ android:orientation="vertical" android:layout_width="match_parent" android:layout_height="@dimen/listitem_iconwithtext_height" - android:paddingRight="@dimen/listitem_threeline_verticalpadding" tools:background="@android:color/darker_gray"> <ImageView @@ -14,6 +13,7 @@ android:layout_width="@dimen/thumbnail_length_navlist" android:layout_height="@dimen/thumbnail_length_navlist" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:layout_centerVertical="true" android:adjustViewBounds="true" android:cropToPadding="true" @@ -21,6 +21,7 @@ android:layout_marginTop="4dp" android:layout_marginBottom="4dp" android:layout_marginLeft="@dimen/listitem_icon_leftpadding" + android:layout_marginStart="@dimen/listitem_icon_leftpadding" tools:src="@drawable/ic_stat_antenna_default" tools:background="@android:color/holo_green_dark"/> @@ -29,10 +30,14 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="@dimen/list_vertical_padding" + android:layout_marginStart="@dimen/list_vertical_padding" + android:layout_marginRight="@dimen/listitem_icon_rightpadding" + android:layout_marginEnd="@dimen/listitem_icon_rightpadding" android:lines="1" android:textColor="?android:attr/textColorTertiary" android:textSize="@dimen/text_size_navdrawer" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" android:layout_centerVertical="true" tools:text="23" tools:background="@android:color/holo_green_dark"/> @@ -42,7 +47,9 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toLeftOf="@id/txtvCount" + android:layout_toStartOf="@id/txtvCount" android:layout_marginLeft="@dimen/list_vertical_padding" + android:layout_marginStart="@dimen/list_vertical_padding" android:layout_alignWithParentIfMissing="true" android:lines="1" android:text="{fa-exclamation-circle}" @@ -63,8 +70,11 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="@dimen/listitem_iconwithtext_textleftpadding" + android:layout_marginStart="@dimen/listitem_iconwithtext_textleftpadding" android:layout_toRightOf="@id/imgvCover" + android:layout_toEndOf="@id/imgvCover" android:layout_toLeftOf="@id/itxtvFailure" + android:layout_toStartOf="@id/itxtvFailure" android:layout_alignWithParentIfMissing="true" tools:text="Navigation feed item title" tools:background="@android:color/holo_green_dark"/> diff --git a/app/src/main/res/layout/nav_list.xml b/app/src/main/res/layout/nav_list.xml index e2fe61e28..2d044f548 100644 --- a/app/src/main/res/layout/nav_list.xml +++ b/app/src/main/res/layout/nav_list.xml @@ -24,6 +24,7 @@ android:layout_height="@dimen/thumbnail_length_navlist" android:layout_marginBottom="4dp" android:layout_marginLeft="@dimen/listitem_icon_leftpadding" + android:layout_marginStart="@dimen/listitem_icon_leftpadding" android:layout_marginTop="4dp" android:adjustViewBounds="true" android:contentDescription="@string/cover_label" @@ -39,6 +40,7 @@ android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_marginLeft="16dp" + android:layout_marginStart="16dp" android:layout_weight="1" android:gravity="center_vertical" android:text="@string/settings_label" diff --git a/app/src/main/res/layout/nav_listitem.xml b/app/src/main/res/layout/nav_listitem.xml index d62672c34..c140533e6 100644 --- a/app/src/main/res/layout/nav_listitem.xml +++ b/app/src/main/res/layout/nav_listitem.xml @@ -13,12 +13,14 @@ android:layout_width="@dimen/thumbnail_length_navlist" android:layout_height="@dimen/thumbnail_length_navlist" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:layout_centerVertical="true" android:adjustViewBounds="true" android:cropToPadding="true" android:scaleType="centerInside" android:padding="4dp" android:layout_marginLeft="@dimen/listitem_icon_leftpadding" + android:layout_marginStart="@dimen/listitem_icon_leftpadding" android:layout_marginTop="4dp" android:layout_marginBottom="4dp" tools:src="@drawable/ic_new_releases_white_24dp" @@ -36,8 +38,11 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="@dimen/listitem_iconwithtext_textleftpadding" + android:layout_marginStart="@dimen/listitem_iconwithtext_textleftpadding" android:layout_marginRight="48dp" + android:layout_marginEnd="48dp" android:layout_toRightOf="@id/imgvCover" + android:layout_toEndOf="@id/imgvCover" tools:text="Navigation item title" tools:background="@android:color/holo_green_dark" /> @@ -50,8 +55,11 @@ android:textColor="?android:attr/textColorTertiary" android:textSize="@dimen/text_size_navdrawer" android:layout_marginLeft="12dp" + android:layout_marginStart="12dp" android:layout_marginRight="@dimen/listitem_icon_rightpadding" + android:layout_marginEnd="@dimen/listitem_icon_rightpadding" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" android:layout_centerVertical="true" tools:text="23" tools:background="@android:color/holo_green_dark"/> diff --git a/app/src/main/res/layout/new_episodes_listitem.xml b/app/src/main/res/layout/new_episodes_listitem.xml index 5e0d7451b..150d692e7 100644 --- a/app/src/main/res/layout/new_episodes_listitem.xml +++ b/app/src/main/res/layout/new_episodes_listitem.xml @@ -26,6 +26,7 @@ android:layout_gravity="center_vertical" android:layout_marginBottom="@dimen/listitem_threeline_verticalpadding" android:layout_marginLeft="@dimen/listitem_threeline_horizontalpadding" + android:layout_marginStart="@dimen/listitem_threeline_horizontalpadding" android:layout_marginTop="@dimen/listitem_threeline_verticalpadding" android:background="@color/light_gray" android:ellipsize="end" @@ -37,8 +38,10 @@ android:layout_height="64dp" android:layout_width="64dp" android:layout_alignLeft="@id/txtvPlaceholder" + android:layout_alignStart="@id/txtvPlaceholder" android:layout_alignTop="@id/txtvPlaceholder" android:layout_alignRight="@id/txtvPlaceholder" + android:layout_alignEnd="@id/txtvPlaceholder" android:layout_alignBottom="@id/txtvPlaceholder" android:contentDescription="@string/cover_label" tools:src="@tools:sample/avatars" /> @@ -50,7 +53,9 @@ android:layout_height="wrap_content" android:layout_marginBottom="@dimen/listitem_threeline_verticalpadding" android:layout_marginLeft="@dimen/listitem_threeline_textleftpadding" + android:layout_marginStart="@dimen/listitem_threeline_textleftpadding" android:layout_marginRight="@dimen/listitem_threeline_textrightpadding" + android:layout_marginEnd="@dimen/listitem_threeline_textrightpadding" android:layout_marginTop="@dimen/listitem_threeline_verticalpadding" android:layout_weight="1"> @@ -61,8 +66,10 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" android:layout_alignParentTop="true" android:layout_marginLeft="8dp" + android:layout_marginStart="8dp" tools:text="@sample/episodes.json/data/status_label"/> <TextView @@ -71,8 +78,10 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:layout_alignParentTop="true" android:layout_toLeftOf="@id/statusUnread" + android:layout_toStartOf="@id/statusUnread" tools:text="@sample/episodes.json/data/title" /> <RelativeLayout @@ -82,7 +91,9 @@ android:layout_below="@id/txtvTitle" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" - android:layout_alignParentRight="true"> + android:layout_alignParentStart="true" + android:layout_alignParentRight="true" + android:layout_alignParentEnd="true"> <TextView android:id="@+id/txtvDuration" @@ -90,6 +101,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" tools:text="@sample/episodes.json/data/duration" /> <ImageView @@ -97,7 +109,9 @@ android:layout_width="@dimen/enc_icons_size" android:layout_height="@dimen/enc_icons_size" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" android:layout_marginLeft="8dp" + android:layout_marginStart="8dp" android:contentDescription="@string/in_queue_label" android:src="?attr/stat_playlist" tools:src="@sample/inplaylist" /> @@ -109,6 +123,7 @@ android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_toLeftOf="@id/imgvInPlaylist" + android:layout_toStartOf="@id/imgvInPlaylist" android:ellipsize="end" tools:text="@sample/episodes.json/data/published_at" /> diff --git a/app/src/main/res/layout/onlinefeedview_header.xml b/app/src/main/res/layout/onlinefeedview_header.xml index 491d955fb..4217322e4 100644 --- a/app/src/main/res/layout/onlinefeedview_header.xml +++ b/app/src/main/res/layout/onlinefeedview_header.xml @@ -10,6 +10,7 @@ android:layout_width="@dimen/thumbnail_length_onlinefeedview" android:layout_height="@dimen/thumbnail_length_onlinefeedview" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:layout_alignParentTop="true" android:layout_marginLeft="16dp" android:layout_marginRight="16dp" @@ -24,10 +25,13 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" android:layout_marginBottom="8dp" android:layout_marginRight="16dp" + android:layout_marginEnd="16dp" android:layout_marginTop="16dp" android:layout_toRightOf="@id/imgvCover" + android:layout_toEndOf="@id/imgvCover" android:ellipsize="end" android:gravity="center_vertical" android:maxLines="2" @@ -41,7 +45,9 @@ android:layout_below="@id/txtvTitle" android:layout_marginBottom="8dp" android:layout_marginRight="16dp" + android:layout_marginEnd="16dp" android:layout_toRightOf="@id/imgvCover" + android:layout_toEndOf="@id/imgvCover" android:ellipsize="end" android:lines="1" android:textColor="?android:attr/textColorSecondary" @@ -61,7 +67,9 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="16dp" + android:layout_marginStart="16dp" android:layout_marginRight="16dp" + android:layout_marginEnd="16dp" android:layout_marginTop="8dp" android:textColor="?android:attr/textColorPrimary" android:textSize="@dimen/text_size_micro" /> @@ -80,7 +88,9 @@ android:layout_height="wrap_content" android:layout_marginBottom="16dp" android:layout_marginLeft="16dp" + android:layout_marginStart="16dp" android:layout_marginRight="16dp" + android:layout_marginEnd="16dp" android:textColor="?android:attr/textColorSecondary" android:textSize="@dimen/text_size_small" tools:text="@string/design_time_lorem_ipsum" diff --git a/app/src/main/res/layout/opml_selection.xml b/app/src/main/res/layout/opml_selection.xml index 3133debd1..f8f37b5ac 100644 --- a/app/src/main/res/layout/opml_selection.xml +++ b/app/src/main/res/layout/opml_selection.xml @@ -32,8 +32,10 @@ android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:layout_alignParentTop="true" android:layout_toLeftOf="@id/horizontal_divider" + android:layout_toStartOf="@id/horizontal_divider" android:background="?android:attr/selectableItemBackground" android:text="@string/cancel_label" /> @@ -43,8 +45,10 @@ android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" android:layout_alignParentTop="true" android:layout_toRightOf="@id/horizontal_divider" + android:layout_toEndOf="@id/horizontal_divider" android:background="?android:attr/selectableItemBackground" android:text="@string/confirm_label" /> </RelativeLayout> diff --git a/app/src/main/res/layout/queue_listitem.xml b/app/src/main/res/layout/queue_listitem.xml index 7d18b386d..6b41b68d5 100644 --- a/app/src/main/res/layout/queue_listitem.xml +++ b/app/src/main/res/layout/queue_listitem.xml @@ -60,7 +60,9 @@ android:layout_height="wrap_content" android:layout_marginBottom="@dimen/listitem_threeline_verticalpadding" android:layout_marginLeft="@dimen/listitem_threeline_textleftpadding" + android:layout_marginStart="@dimen/listitem_threeline_textleftpadding" android:layout_marginRight="@dimen/listitem_threeline_textrightpadding" + android:layout_marginEnd="@dimen/listitem_threeline_textrightpadding" android:layout_marginTop="@dimen/listitem_threeline_verticalpadding" android:layout_weight="1" tools:background="@android:color/holo_red_dark"> @@ -73,9 +75,11 @@ android:layout_height="wrap_content" android:lines="2" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" android:layout_alignParentTop="true" android:layout_marginLeft="8dp" - android:gravity="right|top" + android:layout_marginStart="8dp" + android:gravity="end|top" android:text="Feb\n12" tools:background="@android:color/holo_blue_light" /> @@ -85,7 +89,9 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toLeftOf="@id/txtvPubDate" + android:layout_toStartOf="@id/txtvPubDate" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:layout_alignParentTop="true" android:text="Queue item title" android:ellipsize="end" @@ -98,7 +104,9 @@ android:layout_below="@id/txtvTitle" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" - android:layout_alignParentRight="true"> + android:layout_alignParentStart="true" + android:layout_alignParentRight="true" + android:layout_alignParentEnd="true"> <TextView android:id="@+id/txtvProgressLeft" @@ -106,6 +114,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:layout_marginBottom="0dp" android:text="00:42:23" tools:background="@android:color/holo_blue_light"/> @@ -116,6 +125,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" android:layout_marginBottom="0dp" tools:text="Jan 23" tools:background="@android:color/holo_green_dark" /> @@ -126,6 +136,7 @@ android:layout_width="match_parent" android:layout_height="4dp" android:layout_below="@id/txtvProgressLeft" + android:layoutDirection="ltr" android:max="100" tools:background="@android:color/holo_blue_light" /> diff --git a/app/src/main/res/layout/searchlist_item.xml b/app/src/main/res/layout/searchlist_item.xml index 83ba39cd5..50374c737 100644 --- a/app/src/main/res/layout/searchlist_item.xml +++ b/app/src/main/res/layout/searchlist_item.xml @@ -12,8 +12,10 @@ android:layout_width="@dimen/thumbnail_length_itemlist" android:layout_height="@dimen/thumbnail_length_itemlist" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:layout_centerVertical="true" android:layout_marginLeft="@dimen/listitem_threeline_horizontalpadding" + android:layout_marginStart="@dimen/listitem_threeline_horizontalpadding" android:contentDescription="@string/cover_label" android:scaleType="centerCrop" tools:src="@drawable/ic_stat_antenna_default" @@ -23,8 +25,11 @@ android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_marginLeft="@dimen/listitem_iconwithtext_textleftpadding" + android:layout_marginStart="@dimen/listitem_iconwithtext_textleftpadding" android:layout_marginRight="@dimen/listitem_threeline_verticalpadding" + android:layout_marginEnd="@dimen/listitem_threeline_verticalpadding" android:layout_toRightOf="@id/imgvFeedimage" + android:layout_toEndOf="@id/imgvFeedimage" android:orientation="vertical" tools:background="@android:color/holo_red_dark"> diff --git a/app/src/main/res/layout/simplechapter_item.xml b/app/src/main/res/layout/simplechapter_item.xml index 28cdb08c3..0d02eac1a 100644 --- a/app/src/main/res/layout/simplechapter_item.xml +++ b/app/src/main/res/layout/simplechapter_item.xml @@ -13,6 +13,7 @@ android:layout_height="match_parent" android:layout_gravity="center_vertical" android:layout_marginLeft="@dimen/listitem_threeline_horizontalpadding" + android:layout_marginStart="@dimen/listitem_threeline_horizontalpadding" android:gravity="center_vertical" tools:text="Start" tools:background="@android:color/holo_green_dark" /> @@ -22,7 +23,9 @@ android:layout_height="match_parent" android:layout_marginBottom="@dimen/listitem_threeline_verticalpadding" android:layout_marginLeft="@dimen/listitem_threeline_horizontalpadding" + android:layout_marginStart="@dimen/listitem_threeline_horizontalpadding" android:layout_marginRight="@dimen/listitem_threeline_horizontalpadding" + android:layout_marginEnd="@dimen/listitem_threeline_horizontalpadding" android:layout_marginTop="@dimen/listitem_threeline_verticalpadding" android:layout_weight="1" android:gravity="center_vertical" diff --git a/app/src/main/res/layout/statistics_listitem.xml b/app/src/main/res/layout/statistics_listitem.xml index 20e01bf32..b186add9e 100644 --- a/app/src/main/res/layout/statistics_listitem.xml +++ b/app/src/main/res/layout/statistics_listitem.xml @@ -4,7 +4,10 @@ android:orientation="vertical" android:layout_width="match_parent" android:layout_height="@dimen/listitem_iconwithtext_height" + android:paddingLeft="@dimen/listitem_threeline_verticalpadding" + android:paddingStart="@dimen/listitem_threeline_verticalpadding" android:paddingRight="@dimen/listitem_threeline_verticalpadding" + android:paddingEnd="@dimen/listitem_threeline_verticalpadding" tools:background="@android:color/darker_gray"> <ImageView @@ -13,13 +16,13 @@ android:layout_width="@dimen/thumbnail_length_navlist" android:layout_height="@dimen/thumbnail_length_navlist" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:layout_centerVertical="true" android:adjustViewBounds="true" android:cropToPadding="true" android:scaleType="centerCrop" android:layout_marginTop="4dp" android:layout_marginBottom="4dp" - android:layout_marginLeft="@dimen/listitem_icon_leftpadding" tools:src="@drawable/ic_stat_antenna_default" tools:background="@android:color/holo_green_dark"/> @@ -28,10 +31,12 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="@dimen/list_vertical_padding" + android:layout_marginStart="@dimen/list_vertical_padding" android:lines="1" android:textColor="?android:attr/textColorTertiary" android:textSize="@dimen/text_size_navdrawer" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" android:layout_centerVertical="true" tools:text="23" tools:background="@android:color/holo_green_dark"/> @@ -47,8 +52,11 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="@dimen/listitem_iconwithtext_textleftpadding" + android:layout_marginStart="@dimen/listitem_iconwithtext_textleftpadding" android:layout_toRightOf="@id/imgvCover" + android:layout_toEndOf="@id/imgvCover" android:layout_toLeftOf="@id/txtvTime" + android:layout_toStartOf="@id/txtvTime" android:layout_alignWithParentIfMissing="true" tools:text="Navigation feed item title" tools:background="@android:color/holo_green_dark"/> diff --git a/app/src/main/res/layout/videoplayer_activity.xml b/app/src/main/res/layout/videoplayer_activity.xml index 10fbf8f49..ebea0c618 100644 --- a/app/src/main/res/layout/videoplayer_activity.xml +++ b/app/src/main/res/layout/videoplayer_activity.xml @@ -25,6 +25,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" + android:layoutDirection="ltr" android:orientation="horizontal"> <ImageButton @@ -68,6 +69,7 @@ android:layout_width="match_parent" android:layout_height="50dp" android:background="#80000000" + android:layoutDirection="ltr" android:paddingTop="8dp"> <TextView @@ -75,10 +77,13 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:layout_alignParentTop="true" android:layout_marginBottom="8dp" android:layout_marginLeft="8dp" + android:layout_marginStart="8dp" android:layout_marginRight="8dp" + android:layout_marginEnd="8dp" android:layout_marginTop="4dp" android:text="@string/position_default_label" android:textColor="@color/white" @@ -89,10 +94,13 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" android:layout_alignParentTop="true" android:layout_marginBottom="8dp" android:layout_marginLeft="8dp" + android:layout_marginStart="8dp" android:layout_marginRight="8dp" + android:layout_marginEnd="8dp" android:layout_marginTop="4dp" android:text="@string/position_default_label" android:textColor="@color/white" @@ -103,7 +111,9 @@ android:layout_width="0px" android:layout_height="wrap_content" android:layout_toLeftOf="@+id/txtvLength" + android:layout_toStartOf="@+id/txtvLength" android:layout_toRightOf="@+id/txtvPosition" + android:layout_toEndOf="@+id/txtvPosition" android:layout_centerInParent="true" android:max="500" /> diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index d3b72e17c..f45847e54 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -8,7 +8,7 @@ <Preference android:key="prefScreenInterface" android:title="@string/user_interface_label" - android:icon="?attr/type_video" /> + android:icon="?attr/ic_cellphone_text" /> <Preference android:key="prefScreenPlayback" @@ -38,16 +38,21 @@ <PreferenceCategory android:title="@string/project_pref"> <Preference android:key="prefFaq" - android:title="@string/pref_faq"/> + android:title="@string/pref_faq" + android:icon="?attr/ic_question_answer" /> + <Preference android:key="prefKnownIssues" - android:title="@string/pref_known_issues"/> + android:title="@string/pref_known_issues" + android:icon="?attr/ic_known_issues" /> <Preference android:key="prefSendCrashReport" android:title="@string/crash_report_title" - android:summary="@string/crash_report_sum"/> + android:summary="@string/crash_report_sum" + android:icon="?attr/ic_bug" /> <Preference android:key="prefAbout" - android:title="@string/about_pref"/> + android:title="@string/about_pref" + android:icon="?attr/action_about" /> </PreferenceCategory> </PreferenceScreen> diff --git a/app/src/main/res/xml/preferences_user_interface.xml b/app/src/main/res/xml/preferences_user_interface.xml index da694b844..1d970a5f7 100644 --- a/app/src/main/res/xml/preferences_user_interface.xml +++ b/app/src/main/res/xml/preferences_user_interface.xml @@ -57,4 +57,14 @@ android:summary="@string/pref_lockscreen_background_sum" android:title="@string/pref_lockscreen_background_title"/> </PreferenceCategory> + <PreferenceCategory android:title="@string/behavior"> + <ListPreference + android:entryValues="@array/back_button_behavior_values" + android:entries="@array/back_button_behavior_options" + android:key="prefBackButtonBehavior" + android:title="@string/pref_back_button_behavior_title" + android:summary="@string/pref_back_button_behavior_sum" + android:defaultValue="default" + app:useStockLayout="true"/> + </PreferenceCategory> </PreferenceScreen> |