summaryrefslogtreecommitdiff
path: root/vdrmanager
diff options
context:
space:
mode:
authorlado <herrlado@gmail.com>2012-02-02 15:03:33 +0100
committerlado <herrlado@gmail.com>2012-02-02 15:03:33 +0100
commit5f7f91013d38786e2b2e07328afcb0eddd759572 (patch)
tree5417176aea93e3afcec52b494408891a631f08b9 /vdrmanager
parent0deb7edb7cb99dead12407b71ddfd517c47ebe99 (diff)
downloadvdr-manager-5f7f91013d38786e2b2e07328afcb0eddd759572.tar.gz
vdr-manager-5f7f91013d38786e2b2e07328afcb0eddd759572.tar.bz2
underline current vdr
Diffstat (limited to 'vdrmanager')
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrListActivity.java44
1 files changed, 42 insertions, 2 deletions
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrListActivity.java
index 8f8d67d..c8c5ca3 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrListActivity.java
@@ -1,13 +1,22 @@
package de.bjusystems.vdrmanager.gui;
+import java.util.Currency;
+
import android.app.AlertDialog;
+import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
+import android.graphics.Typeface;
import android.os.Bundle;
+import android.text.SpannableString;
+import android.text.style.UnderlineSpan;
import android.util.Log;
import android.view.View;
+import android.view.ViewGroup;
import android.widget.AdapterView;
+import android.widget.SimpleCursorAdapter.CursorToStringConverter;
+import android.widget.TextView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.SimpleCursorAdapter;
@@ -17,6 +26,7 @@ import com.j256.ormlite.android.apptools.OrmLiteBaseListActivity;
import de.bjusystems.vdrmanager.R;
import de.bjusystems.vdrmanager.app.Intents;
import de.bjusystems.vdrmanager.data.Preferences;
+import de.bjusystems.vdrmanager.data.Vdr;
import de.bjusystems.vdrmanager.data.db.OrmDatabaseHelper;
public class VdrListActivity extends OrmLiteBaseListActivity<OrmDatabaseHelper>
@@ -51,6 +61,11 @@ public class VdrListActivity extends OrmLiteBaseListActivity<OrmDatabaseHelper>
emptyConfig = getIntent().getBooleanExtra(Intents.EMPTY_CONFIG, Boolean.FALSE);
}
+ static class Holder{
+ public TextView text1;
+ public TextView text2;
+ }
+
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -68,10 +83,36 @@ public class VdrListActivity extends OrmLiteBaseListActivity<OrmDatabaseHelper>
});
initCursor();
+ final Vdr cur = Preferences.get().getCurrentVdr();
adapter = new SimpleCursorAdapter(this,
android.R.layout.simple_list_item_2, cursor, new String[] {
"name", "host" }, new int[] { android.R.id.text1,
- android.R.id.text2 });
+ android.R.id.text2}) {
+ @Override
+ public void bindView(View view, Context context,
+ Cursor cursor) {
+
+ TextView text1 = (TextView)view.findViewById(android.R.id.text1);
+ TextView text2 = (TextView)view.findViewById(android.R.id.text2);
+ int id = cursor.getInt(cursor.getColumnIndex("_id"));
+ String name = cursor.getString(cursor.getColumnIndex("name"));
+ String host = cursor.getString(cursor.getColumnIndex("host"));
+ text2.setText(host);
+
+ if(cur != null && cur.getId() == id) {
+ SpannableString content = new SpannableString(name);
+ content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
+ text1.setText(content);
+ //text1.setText(text1.getText());
+ } else {
+ text1.setTypeface(Typeface.DEFAULT);
+ text1.setText(name);
+ }
+
+
+ }
+
+ };
setListAdapter(adapter);
registerForContextMenu(getListView());
getListView().setOnItemClickListener(this);
@@ -132,7 +173,6 @@ public class VdrListActivity extends OrmLiteBaseListActivity<OrmDatabaseHelper>
finish();
return;
}
- Preferences.init(this);
if (emptyConfig) {
Intent intent = new Intent(this, VdrManagerActivity.class);
startActivity(intent);