Merge pull request #3165 from ByteHamster/opml-import-mismatch
Removed opml pick action
This commit is contained in:
commit
a8b05c3c66
@ -25,7 +25,6 @@ public class OpmlImportFromPathActivity extends OpmlImportBaseActivity {
|
|||||||
|
|
||||||
private static final int CHOOSE_OPML_FILE = 1;
|
private static final int CHOOSE_OPML_FILE = 1;
|
||||||
|
|
||||||
private Intent intentPickAction;
|
|
||||||
private Intent intentGetContentAction;
|
private Intent intentGetContentAction;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -36,50 +35,30 @@ public class OpmlImportFromPathActivity extends OpmlImportBaseActivity {
|
|||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
setContentView(R.layout.opml_import);
|
setContentView(R.layout.opml_import);
|
||||||
|
|
||||||
final TextView txtvHeaderExplanation1 = findViewById(R.id.txtvHeadingExplanation1);
|
final TextView txtvHeaderExplanation = findViewById(R.id.txtvHeadingExplanation);
|
||||||
final TextView txtvExplanation1 = findViewById(R.id.txtvExplanation1);
|
final TextView txtvExplanation = findViewById(R.id.txtvExplanation);
|
||||||
final TextView txtvHeaderExplanation2 = findViewById(R.id.txtvHeadingExplanation2);
|
final TextView txtvHeaderExplanationOpenWith = findViewById(R.id.txtvHeadingExplanationOpenWith);
|
||||||
final TextView txtvExplanation2 = findViewById(R.id.txtvExplanation2);
|
|
||||||
final TextView txtvHeaderExplanation3 = findViewById(R.id.txtvHeadingExplanation3);
|
|
||||||
|
|
||||||
Button butChooseFilesystem = findViewById(R.id.butChooseFileFromFilesystem);
|
Button butChooseFilesystem = findViewById(R.id.butChooseFileFromFilesystem);
|
||||||
butChooseFilesystem.setOnClickListener(v -> chooseFileFromFilesystem());
|
butChooseFilesystem.setOnClickListener(v -> chooseFileFromExternal());
|
||||||
|
|
||||||
Button butChooseExternal = findViewById(R.id.butChooseFileFromExternal);
|
|
||||||
butChooseExternal.setOnClickListener(v -> chooseFileFromExternal());
|
|
||||||
|
|
||||||
int nextOption = 1;
|
int nextOption = 1;
|
||||||
String optionLabel = getString(R.string.opml_import_option);
|
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 = new Intent(Intent.ACTION_GET_CONTENT);
|
||||||
intentGetContentAction.addCategory(Intent.CATEGORY_OPENABLE);
|
intentGetContentAction.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
intentGetContentAction.setType("*/*");
|
intentGetContentAction.setType("*/*");
|
||||||
if(!IntentUtils.isCallable(getApplicationContext(), intentGetContentAction)) {
|
|
||||||
txtvHeaderExplanation2.setVisibility(View.GONE);
|
if (IntentUtils.isCallable(getApplicationContext(), intentGetContentAction)) {
|
||||||
txtvExplanation2.setVisibility(View.GONE);
|
txtvHeaderExplanation.setText(String.format(optionLabel, nextOption));
|
||||||
findViewById(R.id.divider2).setVisibility(View.GONE);
|
|
||||||
butChooseExternal.setVisibility(View.GONE);
|
|
||||||
} else {
|
|
||||||
txtvHeaderExplanation2.setText(String.format(optionLabel, nextOption));
|
|
||||||
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
|
@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() {
|
private void chooseFileFromExternal() {
|
||||||
try {
|
try {
|
||||||
startActivityForResult(intentGetContentAction, CHOOSE_OPML_FILE);
|
startActivityForResult(intentGetContentAction, CHOOSE_OPML_FILE);
|
||||||
|
@ -15,14 +15,14 @@
|
|||||||
tools:background="@android:color/darker_gray">
|
tools:background="@android:color/darker_gray">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/txtvHeadingExplanation1"
|
android:id="@+id/txtvHeadingExplanation"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
style="@style/AntennaPod.TextView.Heading"
|
style="@style/AntennaPod.TextView.Heading"
|
||||||
android:text="@string/txtvfeedurl_label"/>
|
android:text="@string/txtvfeedurl_label"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/txtvExplanation1"
|
android:id="@+id/txtvExplanation"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/opml_import_explanation_1"
|
android:text="@string/opml_import_explanation_1"
|
||||||
@ -39,52 +39,21 @@
|
|||||||
android:text="@string/choose_file_from_filesystem" />
|
android:text="@string/choose_file_from_filesystem" />
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/divider1"
|
android:id="@+id/divider"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:layout_margin="16dp"
|
android:layout_margin="16dp"
|
||||||
android:background="?android:attr/listDivider"/>
|
android:background="?android:attr/listDivider"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/txtvHeadingExplanation2"
|
android:id="@+id/txtvHeadingExplanationOpenWith"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
style="@style/AntennaPod.TextView.Heading"
|
style="@style/AntennaPod.TextView.Heading"
|
||||||
android:text="@string/txtvfeedurl_label"/>
|
android:text="@string/txtvfeedurl_label"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/txtvExplanation2"
|
android:id="@+id/txtvExplanationOpenWith"
|
||||||
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:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/opml_import_explanation_3"
|
android:text="@string/opml_import_explanation_3"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user