summaryrefslogtreecommitdiff
path: root/vdrmanager/src
diff options
context:
space:
mode:
Diffstat (limited to 'vdrmanager/src')
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/data/MacFetchEditTextPreference.java94
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerListActivity.java6
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java17
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrListActivity.java8
4 files changed, 117 insertions, 8 deletions
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/MacFetchEditTextPreference.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/MacFetchEditTextPreference.java
new file mode 100644
index 0000000..3b5ab4f
--- /dev/null
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/MacFetchEditTextPreference.java
@@ -0,0 +1,94 @@
+package de.bjusystems.vdrmanager.data;
+
+import android.content.Context;
+import android.content.DialogInterface;
+import android.preference.DialogPreference;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.EditText;
+import android.widget.ImageButton;
+import de.bjusystems.vdrmanager.R;
+import de.bjusystems.vdrmanager.data.VdrSharedPreferences.Editor;
+
+public class MacFetchEditTextPreference extends DialogPreference {
+
+ private EditText mEditText;
+
+ private String initialValue;
+
+ public String getInitialValue() {
+ return initialValue;
+ }
+
+ public void setInitialValue(String initialValue) {
+ this.initialValue = initialValue;
+ }
+
+ public EditText getmEditText() {
+ return mEditText;
+ }
+
+ public void setEditText(String text) {
+ this.mEditText.setText(text);
+ }
+
+ private ImageButton mButton;
+
+ private String mText;
+ //private CharSequence mCompoundButtonText;
+ private View.OnClickListener mCompoundButtonCallback;
+
+ public MacFetchEditTextPreference(Context context, AttributeSet attrs,
+ int defStyle) {
+ super(context, attrs, defStyle);
+ setDialogLayoutResource(R.layout.mac_fetch_preference);
+ }
+
+ public MacFetchEditTextPreference(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ setDialogLayoutResource(R.layout.mac_fetch_preference);
+ }
+
+ @Override
+ protected View onCreateDialogView() {
+ View root = super.onCreateDialogView();
+ mEditText = (EditText) root.findViewById(R.id.edit);
+ mButton = (ImageButton) root.findViewById(R.id.button);
+ return root;
+ }
+
+ public void setText(String text) {
+ mText = text;
+ }
+
+ public String getText() {
+ return mText;
+ }
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ switch (which) {
+ case DialogInterface.BUTTON_POSITIVE: // User clicked OK!
+ mText = mEditText.getText().toString();
+ callChangeListener(mText);
+ Editor editor = (Editor) getEditor();
+ editor.putString(getKey(), mText);
+ editor.commit();
+ break;
+ }
+ super.onClick(dialog, which);
+ }
+
+ @Override
+ protected void onBindDialogView(View view) {
+ mEditText.setText(mText);
+ //mButton.setText(mCompoundButtonText);
+
+ // Set a callback to our button.
+ mButton.setOnClickListener(mCompoundButtonCallback);
+ }
+
+ public void setCompoundButtonListener(View.OnClickListener callback) {
+ mCompoundButtonCallback = callback;
+ }
+} \ No newline at end of file
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerListActivity.java
index c117623..b40a544 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerListActivity.java
@@ -198,7 +198,7 @@ public class TimerListActivity extends BaseTimerEditActivity<Timer> implements
* de.bjusystems.vdrmanager.gui.BaseActivity#onOptionsItemSelected(android
* .view.MenuItem)
*/
- public boolean onOptionsItemSelected(final MenuItem item) {
+ public boolean onOptionsItemSelected(final com.actionbarsherlock.view.MenuItem item) {
switch (item.getItemId()) {
case R.id.timer_menu_add:
@@ -220,14 +220,14 @@ public class TimerListActivity extends BaseTimerEditActivity<Timer> implements
return super.onOptionsItemSelected(item);
}
- public boolean onCreateOptionsMenu(final Menu menu) {
+ public boolean onCreateOptionsMenu(final com.actionbarsherlock.view.Menu menu) {
// MenuItem item;
// item = menu.add(MENU_GROUP_NEW_TIMER, MENU_NEW_TIMER, 0,
// R.string.new_timer);
// item.setIcon(android.R.drawable.ic_menu_add);;
// /item.setAlphabeticShortcut('r');
- final MenuInflater inflater = getMenuInflater();
+ final com.actionbarsherlock.view.MenuInflater inflater = getSupportMenuInflater();
inflater.inflate(R.menu.timer_list_menu, menu);
return super.onCreateOptionsMenu(menu);
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java
index 1014b80..842de8a 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java
@@ -249,6 +249,9 @@ public class Utils {
return minuts;
}
+
+
+
public static void shareEvent(Activity activity, Event event) {
final Intent share = new Intent(android.content.Intent.ACTION_SEND);
share.setType("text/plain");
@@ -272,6 +275,18 @@ public class Utils {
activity.getString(R.string.share_chooser)));
}
+
+ public static void addCalendarEvent(Activity activity, Event event){
+ Intent intent = new Intent(Intent.ACTION_EDIT);
+ intent.setType("vnd.android.cursor.item/event");
+ intent.putExtra("title", event.getTitle());
+ intent.putExtra("description", event.getShortText());
+ intent.putExtra("beginTime", event.getStart().getTime());
+ intent.putExtra("endTime", event.getStop().getTime());
+ activity.startActivity(intent);
+ }
+
+
public static String mapSpecialChars(String src) {
if (src == null) {
return "";
@@ -372,7 +387,7 @@ public class Utils {
/**
* Formats the date and time based on user's phone date/time preferences.
- *
+ *
* @param context
* the context
* @param time
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrListActivity.java
index 87c9439..85dbe8f 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrListActivity.java
@@ -110,7 +110,7 @@ public class VdrListActivity extends ListActivity
}
Vdr vdr = getItem(position);
- String name = vdr.getName();
+ String name = (vdr.getName() != null ? vdr.getName() : "");
String host = vdr.getHost();
holder.text2.setText(host);
@@ -164,7 +164,7 @@ public class VdrListActivity extends ListActivity
/*
* (non-Javadoc)
- *
+ *
* @see
* android.widget.AdapterView.OnItemClickListener#onItemClick(android.widget
* .AdapterView, android.view.View, int, long)
@@ -176,7 +176,7 @@ public class VdrListActivity extends ListActivity
/**
* Start {@link VdrPreferencesActivity} to create or edit a vdr
- *
+ *
* @param id
* may be null. Then a new vdr is created
*/
@@ -188,7 +188,7 @@ public class VdrListActivity extends ListActivity
/*
* (non-Javadoc)
- *
+ *
* @see android.app.Activity#onActivityResult(int, int,
* android.content.Intent)
*/