summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromPathActivity.java59
-rw-r--r--app/src/main/res/layout/opml_import.xml41
2 files changed, 18 insertions, 82 deletions
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 a63d3b735..158e3b7a4 100644
--- a/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromPathActivity.java
+++ b/app/src/main/java/de/danoeh/antennapod/activity/OpmlImportFromPathActivity.java
@@ -25,7 +25,6 @@ public class OpmlImportFromPathActivity extends OpmlImportBaseActivity {
private static final int CHOOSE_OPML_FILE = 1;
- private Intent intentPickAction;
private Intent intentGetContentAction;
@Override
@@ -36,50 +35,30 @@ public class OpmlImportFromPathActivity extends OpmlImportBaseActivity {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setContentView(R.layout.opml_import);
- 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);
+ final TextView txtvHeaderExplanation = findViewById(R.id.txtvHeadingExplanation);
+ final TextView txtvExplanation = findViewById(R.id.txtvExplanation);
+ final TextView txtvHeaderExplanationOpenWith = findViewById(R.id.txtvHeadingExplanationOpenWith);
Button butChooseFilesystem = findViewById(R.id.butChooseFileFromFilesystem);
- butChooseFilesystem.setOnClickListener(v -> chooseFileFromFilesystem());
-
- Button butChooseExternal = findViewById(R.id.butChooseFileFromExternal);
- butChooseExternal.setOnClickListener(v -> chooseFileFromExternal());
+ butChooseFilesystem.setOnClickListener(v -> chooseFileFromExternal());
int nextOption = 1;
String optionLabel = getString(R.string.opml_import_option);
- intentPickAction = new Intent(Intent.ACTION_PICK);
-
- if(!IntentUtils.isCallable(getApplicationContext(), intentPickAction)) {
- intentPickAction.setData(null);
- if(!IntentUtils.isCallable(getApplicationContext(), intentPickAction)) {
- txtvHeaderExplanation1.setVisibility(View.GONE);
- txtvExplanation1.setVisibility(View.GONE);
- findViewById(R.id.divider1).setVisibility(View.GONE);
- butChooseFilesystem.setVisibility(View.GONE);
- }
- }
- if(txtvExplanation1.getVisibility() == View.VISIBLE) {
- txtvHeaderExplanation1.setText(String.format(optionLabel, nextOption));
- nextOption++;
- }
-
intentGetContentAction = new Intent(Intent.ACTION_GET_CONTENT);
intentGetContentAction.addCategory(Intent.CATEGORY_OPENABLE);
intentGetContentAction.setType("*/*");
- if(!IntentUtils.isCallable(getApplicationContext(), intentGetContentAction)) {
- txtvHeaderExplanation2.setVisibility(View.GONE);
- txtvExplanation2.setVisibility(View.GONE);
- findViewById(R.id.divider2).setVisibility(View.GONE);
- butChooseExternal.setVisibility(View.GONE);
- } else {
- txtvHeaderExplanation2.setText(String.format(optionLabel, nextOption));
+
+ if (IntentUtils.isCallable(getApplicationContext(), intentGetContentAction)) {
+ txtvHeaderExplanation.setText(String.format(optionLabel, nextOption));
nextOption++;
+ } else {
+ txtvHeaderExplanation.setVisibility(View.GONE);
+ txtvExplanation.setVisibility(View.GONE);
+ findViewById(R.id.divider).setVisibility(View.GONE);
+ butChooseFilesystem.setVisibility(View.GONE);
}
- txtvHeaderExplanation3.setText(String.format(optionLabel, nextOption));
+ txtvHeaderExplanationOpenWith.setText(String.format(optionLabel, nextOption));
}
@Override
@@ -106,18 +85,6 @@ public class OpmlImportFromPathActivity extends OpmlImportBaseActivity {
}
}
- /*
- * Creates an implicit intent to launch a file manager which lets
- * the user choose a specific OPML-file to import from.
- */
- private void chooseFileFromFilesystem() {
- try {
- startActivityForResult(intentPickAction, CHOOSE_OPML_FILE);
- } catch (ActivityNotFoundException e) {
- Log.e(TAG, "No activity found. Should never happen...");
- }
- }
-
private void chooseFileFromExternal() {
try {
startActivityForResult(intentGetContentAction, CHOOSE_OPML_FILE);
diff --git a/app/src/main/res/layout/opml_import.xml b/app/src/main/res/layout/opml_import.xml
index ac75cb8b3..9b2036228 100644
--- a/app/src/main/res/layout/opml_import.xml
+++ b/app/src/main/res/layout/opml_import.xml
@@ -15,14 +15,14 @@
tools:background="@android:color/darker_gray">
<TextView
- android:id="@+id/txtvHeadingExplanation1"
+ android:id="@+id/txtvHeadingExplanation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/AntennaPod.TextView.Heading"
android:text="@string/txtvfeedurl_label"/>
<TextView
- android:id="@+id/txtvExplanation1"
+ android:id="@+id/txtvExplanation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/opml_import_explanation_1"
@@ -39,52 +39,21 @@
android:text="@string/choose_file_from_filesystem" />
<View
- android:id="@+id/divider1"
+ android:id="@+id/divider"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_margin="16dp"
android:background="?android:attr/listDivider"/>
<TextView
- android:id="@+id/txtvHeadingExplanation2"
+ android:id="@+id/txtvHeadingExplanationOpenWith"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/AntennaPod.TextView.Heading"
android:text="@string/txtvfeedurl_label"/>
<TextView
- android:id="@+id/txtvExplanation2"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/opml_import_explanation_2"
- android:textSize="@dimen/text_size_medium"
- android:layout_marginTop="4dp"
- tools:background="@android:color/holo_green_dark" />
-
- <Button
- android:id="@+id/butChooseFileFromExternal"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal"
- android:layout_marginTop="8dp"
- android:text="@string/choose_file_from_external_application" />
-
- <View
- android:id="@+id/divider2"
- android:layout_width="fill_parent"
- android:layout_height="1dp"
- android:layout_margin="16dp"
- android:background="?android:attr/listDivider"/>
-
- <TextView
- android:id="@+id/txtvHeadingExplanation3"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- style="@style/AntennaPod.TextView.Heading"
- android:text="@string/txtvfeedurl_label"/>
-
- <TextView
- android:id="@+id/txtvExplanation3"
+ android:id="@+id/txtvExplanationOpenWith"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/opml_import_explanation_3"