Moved Opml import button to AddfeedActivity, Opml export button to

preferences
This commit is contained in:
daniel oeh 2012-10-03 15:54:50 +02:00
parent b76ab8053c
commit c042145875
9 changed files with 182 additions and 94 deletions

View File

@ -4,41 +4,6 @@
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/txtvFeedurl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_margin="8dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:text="@string/txtvfeedurl_label" />
<EditText
android:id="@+id/etxtFeedurl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtvFeedurl"
android:layout_margin="8dp"
android:hint="@string/feedurl_label"
android:inputType="textUri" />
<TextView
android:id="@+id/txtvBrowseMiroguide"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/etxtFeedurl"
android:layout_margin="8dp"
android:text="@string/txtv_browse_miroguide_label" />
<Button
android:id="@+id/butBrowseMiroguide"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtvBrowseMiroguide"
android:layout_margin="8dp"
android:text="@string/browse_miroguide_label" />
<RelativeLayout
android:id="@+id/footer"
android:layout_width="fill_parent"
@ -84,4 +49,70 @@
android:text="@string/confirm_label" />
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_above="@id/footer"
android:layout_alignParentTop="true"
android:scrollbars="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/txtvFeedurl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_margin="8dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:text="@string/txtvfeedurl_label" />
<EditText
android:id="@+id/etxtFeedurl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtvFeedurl"
android:layout_margin="8dp"
android:hint="@string/feedurl_label"
android:inputType="textUri" />
<TextView
android:id="@+id/txtvBrowseMiroguide"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/etxtFeedurl"
android:layout_margin="8dp"
android:text="@string/txtv_browse_miroguide_label" />
<Button
android:id="@+id/butBrowseMiroguide"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtvBrowseMiroguide"
android:layout_margin="8dp"
android:text="@string/browse_miroguide_label" />
<TextView
android:id="@+id/txtvOpmlImport"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/butBrowseMiroguide"
android:layout_margin="8dp"
android:text="@string/opml_import_txtv_button_lable" />
<Button
android:id="@+id/butOpmlImport"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtvOpmlImport"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:text="@string/opml_import_label" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>

View File

@ -4,41 +4,6 @@
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/txtvFeedurl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_margin="8dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:text="@string/txtvfeedurl_label" />
<EditText
android:id="@+id/etxtFeedurl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtvFeedurl"
android:layout_margin="8dp"
android:hint="@string/feedurl_label"
android:inputType="textUri" />
<TextView
android:id="@+id/txtvBrowseMiroguide"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/etxtFeedurl"
android:layout_margin="8dp"
android:text="@string/txtv_browse_miroguide_label" />
<Button
android:id="@+id/butBrowseMiroguide"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtvBrowseMiroguide"
android:layout_margin="8dp"
android:text="@string/browse_miroguide_label" />
<LinearLayout
android:id="@+id/footer"
style="@android:style/ButtonBar"
@ -62,4 +27,70 @@
android:text="@string/cancel_label" />
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_above="@id/footer"
android:layout_alignParentTop="true"
android:scrollbars="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/txtvFeedurl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_margin="8dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:text="@string/txtvfeedurl_label" />
<EditText
android:id="@+id/etxtFeedurl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtvFeedurl"
android:layout_margin="8dp"
android:hint="@string/feedurl_label"
android:inputType="textUri" />
<TextView
android:id="@+id/txtvBrowseMiroguide"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/etxtFeedurl"
android:layout_margin="8dp"
android:text="@string/txtv_browse_miroguide_label" />
<Button
android:id="@+id/butBrowseMiroguide"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtvBrowseMiroguide"
android:layout_margin="8dp"
android:text="@string/browse_miroguide_label" />
<TextView
android:id="@+id/txtvOpmlImport"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/butBrowseMiroguide"
android:layout_margin="8dp"
android:text="@string/opml_import_txtv_button_lable" />
<Button
android:id="@+id/butOpmlImport"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtvOpmlImport"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:text="@string/opml_import_label" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>

View File

@ -10,9 +10,7 @@
<item android:id="@id/search_item" android:icon="@drawable/action_search" android:title="@string/search_label" android:showAsAction="ifRoom|collapseActionView"></item><item android:id="@+id/show_player" android:title="@string/show_player_label" android:icon="@drawable/av_play" android:showAsAction="collapseActionView"></item>
<item android:id="@+id/opml_import" android:title="@string/opml_import_label" android:showAsAction="collapseActionView"></item>
<item android:id="@+id/opml_export" android:title="@string/opml_export_label"></item><item android:id="@+id/show_playback_history" android:title="@string/playback_history_label" android:showAsAction="collapseActionView"></item><item android:id="@+id/show_downloads" android:title="@string/downloads_label" android:icon="@drawable/av_download" android:showAsAction="collapseActionView">
<item android:id="@id/search_item" android:icon="@drawable/action_search" android:title="@string/search_label" android:showAsAction="ifRoom|collapseActionView"></item><item android:id="@+id/show_player" android:title="@string/show_player_label" android:icon="@drawable/av_play" android:showAsAction="collapseActionView"></item><item android:id="@+id/show_playback_history" android:title="@string/playback_history_label" android:showAsAction="collapseActionView"></item><item android:id="@+id/show_downloads" android:title="@string/downloads_label" android:icon="@drawable/av_download" android:showAsAction="collapseActionView">
</item><item android:id="@+id/show_preferences" android:title="@string/settings_label" android:icon="@drawable/action_settings" android:showAsAction="collapseActionView"></item>

View File

@ -14,7 +14,7 @@
<!-- Playback history -->
<string name="clear_history_label">Clear history</string>
<!-- Other -->
<string name="confirm_label">Confirm</string>
<string name="cancel_label">Cancel</string>
@ -90,8 +90,8 @@
<string name="download_type_feed">Feed</string>
<string name="download_type_media">Media file</string>
<string name="download_type_image">Image</string>
<string name="download_request_error_dialog_message_prefix">An error occurred when trying to download the file:\u0020</string>
<string name="download_request_error_dialog_message_prefix">An error occurred when trying to download the file:\u0020</string>
<!-- Mediaplayer messages -->
<string name="player_error_msg">Error!</string>
<string name="player_stopped_msg">No media playing</string>
@ -178,6 +178,7 @@
<string name="found_in_title_label">Found in title</string>
<!-- OPML import and export -->
<string name="opml_import_txtv_button_lable">You can also import an OPML file. OPML files allow you to move your podcasts from one podcatcher to another:</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>

View File

@ -55,9 +55,10 @@
android:summary="@string/pref_flattr_this_app_sum"
android:title="@string/pref_flattr_this_app_title" >
</Preference>
<Preference
<Preference android:key="prefOpmlExport" android:title="@string/opml_export_label"/><Preference
android:key="prefAbout"
android:title="@string/about_pref" />
</PreferenceCategory>
</PreferenceScreen>

View File

@ -35,6 +35,7 @@ public class AddFeedActivity extends SherlockActivity {
private EditText etxtFeedurl;
private Button butBrowseMiroGuide;
private Button butOpmlImport;
private Button butConfirm;
private Button butCancel;
@ -52,6 +53,7 @@ public class AddFeedActivity extends SherlockActivity {
etxtFeedurl = (EditText) findViewById(R.id.etxtFeedurl);
butBrowseMiroGuide = (Button) findViewById(R.id.butBrowseMiroguide);
butOpmlImport = (Button) findViewById(R.id.butOpmlImport);
butConfirm = (Button) findViewById(R.id.butConfirm);
butCancel = (Button) findViewById(R.id.butCancel);
@ -64,6 +66,15 @@ public class AddFeedActivity extends SherlockActivity {
}
});
butOpmlImport.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(AddFeedActivity.this,
OpmlImportActivity.class));
}
});
butConfirm.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -125,7 +136,8 @@ public class AddFeedActivity extends SherlockActivity {
@Override
public void onConnectionSuccessful() {
try {
requester.downloadFeed(AddFeedActivity.this, feed);
requester.downloadFeed(AddFeedActivity.this,
feed);
if (progDialog.isShowing()) {
progDialog.dismiss();
finish();
@ -134,7 +146,7 @@ public class AddFeedActivity extends SherlockActivity {
e.printStackTrace();
onConnectionFailure(DownloadError.ERROR_REQUEST_ERROR);
}
}
@Override
@ -159,12 +171,13 @@ public class AddFeedActivity extends SherlockActivity {
errorDialog.setTitle(R.string.error_label);
errorDialog.setMessage(getString(R.string.error_msg_prefix) + " "
+ DownloadError.getErrorString(this, reason));
errorDialog.setButton(getString(android.R.string.ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
errorDialog.dismiss();
}
});
errorDialog.setButton(getString(android.R.string.ok),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
errorDialog.dismiss();
}
});
if (progDialog.isShowing()) {
progDialog.dismiss();
}
@ -181,7 +194,8 @@ public class AddFeedActivity extends SherlockActivity {
switch (item.getItemId()) {
case android.R.id.home:
Intent intent = new Intent(this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
| Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
return true;
default:

View File

@ -118,12 +118,6 @@ public class MainActivity extends SherlockFragmentActivity {
case R.id.show_player:
startActivity(PlaybackService.getPlayerActivityIntent(this));
return true;
case R.id.opml_import:
startActivity(new Intent(this, OpmlImportActivity.class));
return true;
case R.id.opml_export:
new OpmlExportWorker(this).executeAsync();
return false;
case R.id.search_item:
onSearchRequested();
return true;
@ -146,7 +140,6 @@ public class MainActivity extends SherlockFragmentActivity {
}
boolean hasFeeds = !manager.getFeeds().isEmpty();
menu.findItem(R.id.opml_export).setVisible(hasFeeds);
menu.findItem(R.id.all_feed_refresh).setVisible(hasFeeds);
return true;
}

View File

@ -208,7 +208,10 @@ public class OpmlImportActivity extends SherlockActivity {
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
finish();
Intent intent = new Intent(OpmlImportActivity.this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
| Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
};

View File

@ -11,6 +11,8 @@ import com.actionbarsherlock.view.MenuItem;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.asynctask.FlattrClickWorker;
import de.danoeh.antennapod.asynctask.OpmlExportWorker;
import de.danoeh.antennapod.feed.FeedManager;
import de.danoeh.antennapod.util.flattr.FlattrUtils;
/** The main preference activity */
@ -20,6 +22,7 @@ public class PreferenceActivity extends SherlockPreferenceActivity {
private static final String PREF_FLATTR_THIS_APP = "prefFlattrThisApp";
private static final String PREF_FLATTR_AUTH = "pref_flattr_authenticate";
private static final String PREF_FLATTR_REVOKE = "prefRevokeAccess";
private static final String PREF_OPML_EXPORT = "prefOpmlExport";
private static final String PREF_ABOUT = "prefAbout";
@SuppressWarnings("deprecation")
@ -64,6 +67,19 @@ public class PreferenceActivity extends SherlockPreferenceActivity {
});
findPreference(PREF_OPML_EXPORT).setOnPreferenceClickListener(
new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
if (!FeedManager.getInstance().getFeeds().isEmpty()) {
new OpmlExportWorker(PreferenceActivity.this)
.executeAsync();
}
return true;
}
});
}
@Override