summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vdrmanager/res/layout/vdr_list_add_delete.xml52
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrListActivity.java22
2 files changed, 32 insertions, 42 deletions
diff --git a/vdrmanager/res/layout/vdr_list_add_delete.xml b/vdrmanager/res/layout/vdr_list_add_delete.xml
index 7fcc2be..054b4d5 100644
--- a/vdrmanager/res/layout/vdr_list_add_delete.xml
+++ b/vdrmanager/res/layout/vdr_list_add_delete.xml
@@ -1,34 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res/de.ub0r.android.callmeter"
- android:layout_height="fill_parent" android:layout_width="fill_parent">
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent" android:orientation="vertical"
+ android:layout_height="fill_parent" >
- <LinearLayout android:id="@+id/item_add" android:padding="4dip"
- android:layout_alignParentBottom="true" android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:orientation="horizontal"
- android:gravity="right|center_vertical"
- style="@android:style/ButtonBar"
- >
- <TextView android:layout_width="wrap_content" android:text="@string/new_vdr"
- android:layout_height="wrap_content"
- android:layout_marginRight="4dip"
- android:textAppearance="?android:textAppearanceMedium"
- />
- <ImageButton android:id="@+id/add_item" android:layout_width="wrap_content"
- android:layout_height="wrap_content" style="@style/PlusButton" />
- </LinearLayout>
- <RelativeLayout android:layout_width="fill_parent"
- android:layout_height="fill_parent" android:layout_above="@id/item_add">
- <ListView android:id="@id/android:list" android:layout_width="fill_parent"
- android:layout_height="fill_parent" android:drawSelectorOnTop="false"
- android:scrollingCache="true" android:fastScrollEnabled="true"
- android:choiceMode="singleChoice" />
-
- <TextView android:id="@android:id/empty" android:layout_width="fill_parent"
- android:gravity="center"
- android:padding="20dip"
- android:textAppearance="?android:textAppearanceMedium"
- android:layout_height="wrap_content" android:text="@string/no_vdr" />
- </RelativeLayout>
+ <ListView
+ android:id="@id/android:list"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:choiceMode="singleChoice"
+ android:drawSelectorOnTop="false"
+ android:fastScrollEnabled="true"
+ android:scrollingCache="true" />
-</RelativeLayout> \ No newline at end of file
+ <TextView
+ android:id="@android:id/empty"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:padding="20dip"
+ android:text="@string/no_vdr"
+ android:textAppearance="?android:textAppearanceMedium" />
+
+</LinearLayout> \ No newline at end of file
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrListActivity.java
index 85dbe8f..a499d00 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrListActivity.java
@@ -29,8 +29,8 @@ import de.bjusystems.vdrmanager.data.Preferences;
import de.bjusystems.vdrmanager.data.Vdr;
import de.bjusystems.vdrmanager.data.db.DBAccess;
-public class VdrListActivity extends ListActivity
- implements OnItemClickListener, OnItemLongClickListener {
+public class VdrListActivity extends ListActivity implements
+ OnItemClickListener, OnItemLongClickListener {
private static final String TAG = VdrListActivity.class.getName();
@@ -78,13 +78,6 @@ public class VdrListActivity extends ListActivity
setContentView(R.layout.vdr_list_add_delete);
- findViewById(R.id.add_item).setOnClickListener(
- new View.OnClickListener() {
- public void onClick(View v) {
- editVdr(null);
- }
- });
-
// initCursor();
final Vdr cur = Preferences.get().getCurrentVdr();
adapter = new ArrayAdapter<Vdr>(this,
@@ -245,8 +238,12 @@ public class VdrListActivity extends ListActivity
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int which) {
- if (DBAccess.get(VdrListActivity.this).getVdrDAO().deleteById(
- adapter.getItem(position).getId()) > 0) {
+ if (DBAccess
+ .get(VdrListActivity.this)
+ .getVdrDAO()
+ .deleteById(
+ adapter.getItem(position)
+ .getId()) > 0) {
if (Preferences.get().getCurrentVdrContext(
VdrListActivity.this) == id) {
Preferences.setCurrentVdr(
@@ -281,6 +278,9 @@ public class VdrListActivity extends ListActivity
BackupSettingsActivity.class);
startActivity(intent);
return true;
+ } else if (item.getItemId() == R.id.main_menu_vdrlist_add) {
+ editVdr(null);
+ return true;
}
return super.onOptionsItemSelected(item);
}