diff options
author | Danial Klimkin <dklimkin@github.com> | 2017-10-15 10:56:03 +0200 |
---|---|---|
committer | Danial Klimkin <dklimkin@github.com> | 2017-10-15 10:56:03 +0200 |
commit | 77858ec8dfe0340478daed5a5cc1ab8692bcb30e (patch) | |
tree | 11f0a142cf21e7acd0771c933f4f20cf16393fe0 /app/src/main/java/de/danoeh/antennapod/dialog | |
parent | 6c8f9bc80ee32efeb06798676a97dfc5bc375544 (diff) | |
download | AntennaPod-77858ec8dfe0340478daed5a5cc1ab8692bcb30e.zip |
lambdas break old Androids, sigh.
Diffstat (limited to 'app/src/main/java/de/danoeh/antennapod/dialog')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/dialog/ChooseDataFolderDialog.java | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/ChooseDataFolderDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/ChooseDataFolderDialog.java index 339d9a8c2..e8faa7c29 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/ChooseDataFolderDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/ChooseDataFolderDialog.java @@ -10,7 +10,6 @@ import com.afollestad.materialdialogs.MaterialDialog; import java.io.File; import java.util.ArrayList; import java.util.List; -import java.util.function.Consumer; import de.danoeh.antennapod.R; import de.danoeh.antennapod.core.preferences.UserPreferences; @@ -19,9 +18,19 @@ import de.danoeh.antennapod.core.util.StorageUtils; public class ChooseDataFolderDialog { + public static abstract class RunnableWithString implements Runnable { + public RunnableWithString() { + super(); + } + public abstract void run(final String arg); + @Override public void run() { + throw new IllegalArgumentException("Expect one String parameter."); + } + } + private ChooseDataFolderDialog() {} - public static void showDialog(final Context context, Consumer<String> handlerFunc) { + public static void showDialog(final Context context, RunnableWithString handlerFunc) { File dataFolder = UserPreferences.getDataFolder(null); if (dataFolder == null) { new MaterialDialog.Builder(context) @@ -68,7 +77,7 @@ public class ChooseDataFolderDialog { .items(choices) .itemsCallbackSingleChoice(selectedIndex, (dialog1, itemView, which, text) -> { String folder = folders.get(which); - handlerFunc.accept(folder); + handlerFunc.run(folder); return true; }) .negativeText(R.string.cancel_label) @@ -79,10 +88,10 @@ public class ChooseDataFolderDialog { @SuppressWarnings("deprecation") private static CharSequence fromHtmlVersioned(final String html) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - return Html.fromHtml(html, Html.FROM_HTML_MODE_LEGACY); + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { + return Html.fromHtml(html); } - return Html.fromHtml(html); + return Html.fromHtml(html, Html.FROM_HTML_MODE_LEGACY); } }
\ No newline at end of file |