Created OrganizeQueueActivity

This commit is contained in:
daniel oeh 2013-02-18 12:49:16 +01:00
parent 2bf99545c2
commit d2649ce4b8
5 changed files with 67 additions and 8 deletions

View File

@ -228,6 +228,7 @@
<activity <activity
android:name=".activity.DirectoryChooserActivity" android:name=".activity.DirectoryChooserActivity"
android:label="@string/choose_data_directory" /> android:label="@string/choose_data_directory" />
<activity android:label="@string/organize_queue_label" android:name=".activity.OrganizeQueueActivity" android:configChanges="orientation"></activity>
</application> </application>
</manifest> </manifest>

View File

@ -2,12 +2,13 @@
<item name="action_bar_refresh" type="id"/> <item name="action_bar_refresh" type="id"/>
<item name="action_bar_add" type="id"/> <item name="action_bar_add" type="id"/>
<item type="id" name="clear_queue_item"/> <item name="clear_queue_item" type="id"/>
<item type="id" name="select_all_item"/> <item name="select_all_item" type="id"/>
<item type="id" name="deselect_all_item"/> <item name="deselect_all_item" type="id"/>
<item type="id" name="search_item"/> <item name="search_item" type="id"/>
<item name="enqueue_all_item" type="id"/> <item name="enqueue_all_item" type="id"/>
<item name="download_all_item" type="id"/> <item name="download_all_item" type="id"/>
<item type="id" name="clear_history_item"/> <item name="clear_history_item" type="id"/>
<item name="organize_queue_item" type="id"/>
</resources> </resources>

View File

@ -112,9 +112,8 @@
<string name="show_player_label">Show player</string> <string name="show_player_label">Show player</string>
<!-- Queue operations --> <!-- Queue operations -->
<string name="move_up_label">Move up</string>
<string name="move_down_label">Move down</string>
<string name="clear_queue_label">Clear queue</string> <string name="clear_queue_label">Clear queue</string>
<string name="organize_queue_label">Organize queue</string>
<!-- Flattr --> <!-- Flattr -->
<string name="flattr_auth_label">Flattr sign-in</string> <string name="flattr_auth_label">Flattr sign-in</string>

View File

@ -0,0 +1,51 @@
package de.danoeh.antennapod.activity;
import android.content.res.TypedArray;
import android.os.Bundle;
import com.actionbarsherlock.app.SherlockListActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import de.danoeh.antennapod.PodcastApp;
import de.danoeh.antennapod.R;
public class OrganizeQueueActivity extends SherlockListActivity {
private static final String TAG = "OrganizeQueueActivity";
private static final int MENU_ID_ACCEPT = 2;
@Override
protected void onCreate(Bundle savedInstanceState) {
setTheme(PodcastApp.getThemeResourceId());
super.onCreate(savedInstanceState);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
TypedArray drawables = obtainStyledAttributes(new int[] { R.attr.navigation_accept });
menu.add(Menu.NONE, MENU_ID_ACCEPT, Menu.NONE, R.string.confirm_label)
.setIcon(drawables.getDrawable(0))
.setShowAsAction(
MenuItem.SHOW_AS_ACTION_IF_ROOM
| MenuItem.SHOW_AS_ACTION_WITH_TEXT);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
case MENU_ID_ACCEPT:
finish();
return true;
default:
return false;
}
}
}

View File

@ -21,6 +21,7 @@ import com.actionbarsherlock.view.Menu;
import de.danoeh.antennapod.AppConfig; import de.danoeh.antennapod.AppConfig;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.ItemviewActivity; import de.danoeh.antennapod.activity.ItemviewActivity;
import de.danoeh.antennapod.activity.OrganizeQueueActivity;
import de.danoeh.antennapod.adapter.ActionButtonCallback; import de.danoeh.antennapod.adapter.ActionButtonCallback;
import de.danoeh.antennapod.adapter.ExternalEpisodesListAdapter; import de.danoeh.antennapod.adapter.ExternalEpisodesListAdapter;
import de.danoeh.antennapod.dialog.DownloadRequestErrorDialogCreator; import de.danoeh.antennapod.dialog.DownloadRequestErrorDialogCreator;
@ -158,6 +159,8 @@ public class EpisodesFragment extends SherlockFragment {
}, selectedItem, false); }, selectedItem, false);
} else if (selectedGroupId == ExternalEpisodesListAdapter.GROUP_POS_QUEUE) { } else if (selectedGroupId == ExternalEpisodesListAdapter.GROUP_POS_QUEUE) {
menu.add(Menu.NONE, R.id.organize_queue_item, Menu.NONE,
R.string.organize_queue_label);
menu.add(Menu.NONE, R.id.clear_queue_item, Menu.NONE, getActivity() menu.add(Menu.NONE, R.id.clear_queue_item, Menu.NONE, getActivity()
.getString(R.string.clear_queue_label)); .getString(R.string.clear_queue_label));
menu.add(Menu.NONE, R.id.download_all_item, Menu.NONE, menu.add(Menu.NONE, R.id.download_all_item, Menu.NONE,
@ -187,6 +190,10 @@ public class EpisodesFragment extends SherlockFragment {
} else if (selectedGroupId == ExternalEpisodesListAdapter.GROUP_POS_QUEUE) { } else if (selectedGroupId == ExternalEpisodesListAdapter.GROUP_POS_QUEUE) {
handled = true; handled = true;
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.organize_queue_item:
startActivity(new Intent(getActivity(),
OrganizeQueueActivity.class));
break;
case R.id.clear_queue_item: case R.id.clear_queue_item:
manager.clearQueue(getActivity()); manager.clearQueue(getActivity());
break; break;