Created opml import activity
This commit is contained in:
parent
65505fad56
commit
7ce5cfc513
|
@ -127,6 +127,7 @@
|
|||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:label="@string/about_pref" android:name=".activity.AboutActivity" android:theme="@style/Theme.Sherlock.Light.NoActionBar"></activity>
|
||||
<activity android:label="@string/opml_import_label" android:name=".activity.OpmlImportActivity"></activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:text="@string/opml_import_explanation" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtvPath"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/butStartImport"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_margin="8dp"
|
||||
android:text="@string/start_import_label" />
|
||||
|
||||
</LinearLayout>
|
|
@ -127,5 +127,9 @@
|
|||
<string name="flattring_label">flattring</string>
|
||||
<string name="chapters_label">Chapters</string>
|
||||
<string name="shownotes_label">Shownotes</string>
|
||||
<string name="opml_import_explanation">To import an OPML file, you have to place it in the following directory and press the button below to start the import process. </string>
|
||||
<string name="start_import_label">Start import</string>
|
||||
<string name="opml_import_label">OPML import</string>
|
||||
<string name="opml_directory_error">ERROR!</string>
|
||||
|
||||
</resources>
|
|
@ -0,0 +1,57 @@
|
|||
package de.danoeh.antennapod.activity;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockActivity;
|
||||
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.util.StorageUtils;
|
||||
|
||||
public class OpmlImportActivity extends SherlockActivity {
|
||||
private static final String TAG = "OpmlImportActivity";
|
||||
|
||||
private static final String IMPORT_DIR = "import/";
|
||||
|
||||
private TextView txtvPath;
|
||||
private Button butStart;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
setContentView(R.layout.opml_import);
|
||||
|
||||
txtvPath = (TextView) findViewById(R.id.txtvPath);
|
||||
butStart = (Button) findViewById(R.id.butStartImport);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
StorageUtils.checkStorageAvailability(this);
|
||||
setImportPath();
|
||||
}
|
||||
|
||||
private void setImportPath() {
|
||||
File importDir = getExternalFilesDir(IMPORT_DIR);
|
||||
boolean success = true;
|
||||
if (!importDir.exists()) {
|
||||
if (AppConfig.DEBUG) Log.d(TAG, "Import directory doesn't exist. Creating...");
|
||||
success = importDir.mkdir();
|
||||
if (!success) {
|
||||
Log.e(TAG, "Could not create directory");
|
||||
}
|
||||
}
|
||||
if (success) {
|
||||
txtvPath.setText(importDir.toString());
|
||||
} else {
|
||||
txtvPath.setText(R.string.opml_directory_error);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue