Added menu items for selecting and deselecting all items
This commit is contained in:
parent
dfd3dc8bf8
commit
5f7d5d5e04
|
@ -128,7 +128,7 @@
|
|||
</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>
|
||||
<activity android:label="@string/opml_import_label" android:name=".activity.OpmlFeedChooserActivity" android:theme="@style/Theme.Sherlock.Light.NoActionBar"></activity>
|
||||
<activity android:label="@string/opml_import_label" android:name=".activity.OpmlFeedChooserActivity"></activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -5,5 +5,7 @@
|
|||
<item name="move_up_item" type="id"/>
|
||||
<item name="move_down_item" type="id"/>
|
||||
<item type="id" name="clear_queue_item"/>
|
||||
<item type="id" name="select_all_item"/>
|
||||
<item type="id" name="deselect_all_item"/>
|
||||
|
||||
</resources>
|
|
@ -134,5 +134,8 @@
|
|||
<string name="reading_opml_label">Reading OPML file</string>
|
||||
<string name="opml_reader_error">An error has occured while reading the opml document:</string>
|
||||
<string name="opml_import_error_dir_empty">It seems like the import directory is empty. Please copy a OPML file into the directory to import it.</string>
|
||||
<string name="select_all_label">Select all</string>
|
||||
<string name="deselect_all_label">Deselect all</string>
|
||||
|
||||
|
||||
</resources>
|
|
@ -14,6 +14,8 @@ import android.widget.Button;
|
|||
import android.widget.ListView;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockActivity;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.opml.OpmlElement;
|
||||
|
@ -76,7 +78,8 @@ public class OpmlFeedChooserActivity extends SherlockActivity {
|
|||
intent.putExtra(EXTRA_SELECTED_ITEMS, selection);
|
||||
setResult(RESULT_OK, intent);
|
||||
finish();
|
||||
}});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
@ -91,5 +94,35 @@ public class OpmlFeedChooserActivity extends SherlockActivity {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
menu.add(Menu.NONE, R.id.select_all_item, Menu.NONE,
|
||||
R.string.select_all_label).setShowAsAction(
|
||||
MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||
menu.add(Menu.NONE, R.id.deselect_all_item, Menu.NONE,
|
||||
R.string.deselect_all_label).setShowAsAction(
|
||||
MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.select_all_item:
|
||||
selectAllItems(true);
|
||||
return true;
|
||||
case R.id.deselect_all_item:
|
||||
selectAllItems(false);
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void selectAllItems(boolean b) {
|
||||
for (int i = 0; i < feedlist.getCount(); i++) {
|
||||
feedlist.setItemChecked(i, b);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue