summaryrefslogtreecommitdiff
path: root/vdrmanager/de.bjusystems.vdrmanager/src/main
diff options
context:
space:
mode:
authorlado <herrlado@gmail.com>2019-10-10 23:00:02 +0200
committerlado <herrlado@gmail.com>2019-10-10 23:00:02 +0200
commitc2ce599d38e1ea8027df0fb7b5b76d0d42432db5 (patch)
tree8769381bbfcd858cfadd5d4e722427919b42d765 /vdrmanager/de.bjusystems.vdrmanager/src/main
parentf7e4be33ef77323b30af6753957d5a62cf80d46a (diff)
downloadvdr-manager-c2ce599d38e1ea8027df0fb7b5b76d0d42432db5.tar.gz
vdr-manager-c2ce599d38e1ea8027df0fb7b5b76d0d42432db5.tar.bz2
remote control
Diffstat (limited to 'vdrmanager/de.bjusystems.vdrmanager/src/main')
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/AndroidManifest.xml9
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/assets/fonts/fontawesome-webfont.ttfbin122092 -> 165548 bytes
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/androvdr/widget/FontAwesomeButton.java3
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/androvdr/widget/FontAwesomeTextView.java36
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/ButtonMapping.java49
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/BaseActivity.java1217
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/ChannelListActivity.java50
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/ColoredButton.java6
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/PreferencesActivity.java14
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/TimerDetailsActivity.java133
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/Utils.java267
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/VdrListActivity.java544
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/VdrManagerActivity.java5
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/VdrPreferencesActivity.java977
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/colorpicker/ColorPickerDialog.java502
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/colorpicker/ColorPickerPreference.java637
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/colorpicker/ColorPickerView.java177
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/remote/FaListDialog.java200
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/remote/HITK.java20
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/remote/RemoteActivity.java261
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/utils/VdrManagerExceptionHandler.java96
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/res/layout-land/remote.xml399
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/res/layout-land/remote_test.xml344
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/res/layout/edit_remote_key.xml35
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/res/layout/fa_search.xml21
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/res/layout/remote.xml152
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/res/layout/searchspinner.xml6
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/res/layout/simple_list_item_1_fa.xml27
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/res/values/arrays.xml806
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/res/values/colorpicker.xml23
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/res/values/dimens.xml2
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/res/values/font.xml13
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/res/values/strings.xml22
-rw-r--r--vdrmanager/de.bjusystems.vdrmanager/src/main/res/values/styles.xml2
34 files changed, 5480 insertions, 1575 deletions
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/AndroidManifest.xml b/vdrmanager/de.bjusystems.vdrmanager/src/main/AndroidManifest.xml
index ad02637..e02fcdb 100644
--- a/vdrmanager/de.bjusystems.vdrmanager/src/main/AndroidManifest.xml
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/AndroidManifest.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.bjusystems.vdrmanager"
- android:versionCode="12710"
- android:versionName="12.71">
+ android:versionCode="12800"
+ android:versionName="12.80">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
@@ -10,9 +10,6 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
- <uses-sdk
- android:minSdkVersion="8"
- android:targetSdkVersion="23" />
<application
android:name=".app.VdrManagerApp"
@@ -156,7 +153,7 @@
<activity
android:name=".remote.RemoteActivity"
android:theme="@style/AppTheme"
- android:configChanges="orientation|locale|screenSize">
+ android:configChanges="locale|screenSize">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/assets/fonts/fontawesome-webfont.ttf b/vdrmanager/de.bjusystems.vdrmanager/src/main/assets/fonts/fontawesome-webfont.ttf
index ed9372f..35acda2 100644
--- a/vdrmanager/de.bjusystems.vdrmanager/src/main/assets/fonts/fontawesome-webfont.ttf
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/assets/fonts/fontawesome-webfont.ttf
Binary files differ
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/androvdr/widget/FontAwesomeButton.java b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/androvdr/widget/FontAwesomeButton.java
index 22c4de1..f35971c 100644
--- a/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/androvdr/widget/FontAwesomeButton.java
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/androvdr/widget/FontAwesomeButton.java
@@ -2,12 +2,11 @@ package de.androvdr.widget;
import android.content.Context;
import android.util.AttributeSet;
-import android.widget.Button;
/**
* Created by lado on 04.05.15.
*/
-public class FontAwesomeButton extends Button {
+public class FontAwesomeButton extends android.support.v7.widget.AppCompatButton {
public FontAwesomeButton(Context context, AttributeSet attrs, int defStyle) {
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/androvdr/widget/FontAwesomeTextView.java b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/androvdr/widget/FontAwesomeTextView.java
new file mode 100644
index 0000000..a6b5b42
--- /dev/null
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/androvdr/widget/FontAwesomeTextView.java
@@ -0,0 +1,36 @@
+package de.androvdr.widget;
+
+import android.content.Context;
+import android.graphics.Typeface;
+import android.support.annotation.Nullable;
+import android.util.AttributeSet;
+import android.widget.TextView;
+
+/**
+ * Created by lado on 17.11.17.
+ */
+
+public class FontAwesomeTextView extends TextView {
+ public FontAwesomeTextView(Context context) {
+ super(context);
+ initFontAwesome();
+ }
+
+ public FontAwesomeTextView(Context context, @Nullable AttributeSet attrs) {
+ super(context, attrs);
+ initFontAwesome();
+ }
+
+ public FontAwesomeTextView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ initFontAwesome();
+ }
+
+ private void initFontAwesome() {
+ if (isInEditMode() == false) {
+ setTypeface(FontAwesome.getFontAwesome(getContext().getApplicationContext().getApplicationContext()));
+ }
+ }
+
+
+}
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/ButtonMapping.java b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/ButtonMapping.java
new file mode 100644
index 0000000..cacef1a
--- /dev/null
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/ButtonMapping.java
@@ -0,0 +1,49 @@
+package de.bjusystems.vdrmanager;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+/**
+ * Created by lado on 05.11.17.
+ */
+public class ButtonMapping {
+
+ public static final String KEY = "key";
+ public static final String LABEL = "label";
+ public static final String COLOR = "color";
+
+ public static final String PREFIX_SEPARATOR = "_";
+
+ public static final String KEY_PREFIX = KEY + PREFIX_SEPARATOR;
+ public static final String LABEL_PREFIX = LABEL + PREFIX_SEPARATOR;
+ public static final String COLOR_PREFIX = COLOR + PREFIX_SEPARATOR;
+
+ public static final Integer NO_COLOR = -1;
+
+ /**
+ * The Key.
+ */
+ public String key;
+ /**
+ * The Label.
+ */
+ public String label;
+ /**
+ * The Color.
+ */
+ public Integer color;
+
+ public ButtonMapping() {
+
+ }
+
+ public ButtonMapping(String key, String label, Integer color) {
+ this.key = key;
+ this.label = label;
+ this.color = color;
+ }
+
+ public JSONObject toJson() throws JSONException {
+ return new JSONObject().put("key", key).put("label", label).put("color", color);
+ }
+}
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/BaseActivity.java b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/BaseActivity.java
index 26fe8e4..a3f752a 100644
--- a/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/BaseActivity.java
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/BaseActivity.java
@@ -8,7 +8,7 @@ import android.os.Bundle;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
-import android.support.v7.app.ActionBarActivity;
+import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
@@ -27,6 +27,7 @@ import de.bjusystems.vdrmanager.app.VdrManagerApp;
import de.bjusystems.vdrmanager.data.Channel;
import de.bjusystems.vdrmanager.data.Preferences;
import de.bjusystems.vdrmanager.remote.RemoteActivity;
+import de.bjusystems.vdrmanager.utils.VdrManagerExceptionHandler;
import de.bjusystems.vdrmanager.utils.svdrp.SvdrpAsyncTask;
import de.bjusystems.vdrmanager.utils.svdrp.SvdrpClient;
import de.bjusystems.vdrmanager.utils.svdrp.SvdrpEvent;
@@ -36,619 +37,621 @@ import de.bjusystems.vdrmanager.utils.svdrp.SvdrpFinishedListener;
import de.bjusystems.vdrmanager.utils.svdrp.SvdrpListener;
public abstract class BaseActivity<Result, T extends ListView> extends
- ActionBarActivity implements OnClickListener, SvdrpListener,
- SvdrpExceptionListener, SvdrpFinishedListener<Result> {
+ AppCompatActivity implements OnClickListener, SvdrpListener,
+ SvdrpExceptionListener, SvdrpFinishedListener<Result> {
- public static final String TAG = BaseActivity.class.getName();
+ public static final String TAG = BaseActivity.class.getName();
- public static final int MENU_GROUP_REFRESH = 99;
+ public static final int MENU_GROUP_REFRESH = 99;
- public static final int MENU_REFRESH = 99;
-
- protected T listView;
-
- protected ViewFlipper flipper;
-
- private Button retry;
-
- private ProgressDialog progress;
-
- protected Preferences getPrefs(){
- return Preferences.get();
- }
-
- // protected SvdrpProgressDialog progress;
-
- private CharSequence mDrawerTitle;
- private DrawerLayout mDrawerLayout;
- private ListView mDrawerList;
- private ActionBarDrawerToggle mDrawerToggle;
- private String[] mTitles;
-
- abstract protected String getWindowTitle();
-
- abstract protected int getMainLayout();
-
- protected void noInternetConnection() {
- alert(R.string.no_internet_connection);
- }
-
- abstract protected boolean displayingResults();
-
- /**
- * When using the ActionBarDrawerToggle, you must call it during
- * onPostCreate() and onConfigurationChanged()...
- */
-
- @Override
- protected void onPostCreate(Bundle savedInstanceState) {
- super.onPostCreate(savedInstanceState);
- // Sync the toggle state after onRestoreInstanceState has occurred.
- mDrawerToggle.syncState();
- }
-
- protected boolean isForceRefresh() {
- if (forceRefresh == false) {
- return false;
- }
- forceRefresh = false;
- return true;
- }
-
- protected boolean forceRefresh = false;
-
- protected void switchNoConnection() {
- if (flipper == null) {
- say(R.string.no_connection);
- return;
- }
-
- if (displayingResults()) {
- say(R.string.no_connection);
- } else {
- flipper.setDisplayedChild(1);
- }
- }
-
- protected CertificateProblemDialog getCertificateProblemDialog() {
- return new CertificateProblemDialog(this);
- }
-
- @Override
- public void onConfigurationChanged(final Configuration newConfig) {
- Preferences.setLocale(this);
- super.onConfigurationChanged(newConfig);
- mDrawerToggle.onConfigurationChanged(newConfig);
- }
-
- @Override
- protected void onResume() {
- Preferences.init(this);
- super.onResume();
- }
-
- protected void initFlipper() {
- this.flipper = (ViewFlipper) findViewById(R.id.flipper);
- retry = (Button) findViewById(R.id.retry_button);
- retry.setOnClickListener(this);
- }
-
- @Override
- public void onClick(final View v) {
- if (v.getId() == R.id.retry_button) {
- retry();
- }
- }
-
- //
- // protected void updateWindowTitle(int topic, int subtopic) {
- // String title;
- // title = getString(topic);
- // if (subtopic != -1) {
- // title += " > " + getString(subtopic);
- // }
- // setTitle(title);
- // }
- //
- // protected void updateWindowTitle(String topic, String subtopic) {
- // String title = topic;
- // if (subtopic != null) {
- // title += " > " + subtopic;
- // }
- // setTitle(title);
- // }
-
- abstract protected int getListNavigationIndex();
-
- public static final int LIST_NAVIGATION_CHANNELS = 0;
- public static final int LIST_NAVIGATION_EPG_BY_TIME = 1;
- public static final int LIST_NAVIGATION_EPG_BY_CHANNEL = 2;
- public static final int LIST_NAVIGATION_RECORDINGS = 3;
- public static final int LIST_NAVIGATION_TIMERS = 4;
- public static final int LIST_NAVIGATION_REMOTE = 5;
-
- protected boolean hasListNavigation() {
- return true;
- }
-
- protected void initListNavigation() {
-
- if (hasListNavigation() == false) {
- return;
- }
-
- // getSupportActionBar().setDisplayShowTitleEnabled(false);
- //
- // getSupportActionBar().setNavigationMode(
- // getSupportActionBar().NAVIGATION_MODE_LIST);
- //
- // final ArrayAdapter<CharSequence> mSpinnerAdapter = ArrayAdapter
- // .createFromResource(this, R.array.navigation_array,
- // android.R.layout.simple_spinner_dropdown_item);
- //
- // getSupportActionBar().setListNavigationCallbacks(mSpinnerAdapter,
- // new OnNavigationListener() {
- //
- // private boolean firstHit = true;
- //
- // @Override
- // public boolean onNavigationItemSelected(
- // final int itemPosition, final long itemId) {
- //
- // if (firstHit == true) {
- // firstHit = false;
- // return false;
- // }
- // switch (itemPosition) {
- //
- // case LIST_NAVIGATION_CHANNELS: {
- // startActivity(ChannelListActivity.class);
- // return true;
- // }
- // case LIST_NAVIGATION_EPG_BY_TIME: {
- // startActivity(TimeEpgListActivity.class);
- // return true;
- // }
- //
- // case LIST_NAVIGATION_EPG_BY_CHANNEL: {
- // startActivity(EventEpgListActivity.class);
- // return true;
- // }
- //
- // case LIST_NAVIGATION_RECORDINGS: {
- // startActivity(RecordingListActivity.class);
- // return true;
- // }
- //
- // case LIST_NAVIGATION_TIMERS: {
- // startActivity(TimerListActivity.class);
- // return true;
- // }
- //
- // }
- // return false;
- // }
- // });
- // getSupportActionBar().setSelectedNavigationItem(
- // getListNavigationIndex());
-
- }
-
- @Override
- protected void onCreate(final Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- Preferences.setLocale(this);
- setContentView(getMainLayout());
- progress = new ProgressDialog(this);
- progress.setCancelable(false);
- progress.setCanceledOnTouchOutside(false);
- // progress.setOnCancelListener(new OnCancelListener() {
- // @Override
- // public void onCancel(DialogInterface dialog) {
- //
- // }
- // });
-
- initActionBar();
-
- initListNavigation();
-
- initLeftDrawer(savedInstanceState);
-
- // new OnNavigationListener() {
- // @Override
- // public boolean onNavigationItemSelected(int itemPosition, long
- // itemId) {
- // System.err.println("itemPosition: "+ itemPosition +", itemId:" +
- // itemId);
- // rturn false;
- // }
- // });
-
- // your logic for click listner
- // setListenerForActionBarCustomView(actionBarView);
-
- // private void setListenerForActionBarCustomView(View actionBarView) {
- // ActionBarCustomViewOnClickListener actionBarCustomViewOnClickListener
- // = new ActionBarCustomViewOnClickListener();
- // actionBarView.findViewById(R.id.text_view_title).setOnClickListener(actionBarCustomViewOnClickListener);
- // }
-
- }
-
- protected void initLeftDrawer(final Bundle savedInstanceState) {
-
- mDrawerTitle = getTitle();
-
- mTitles = getResources().getStringArray(R.array.navigation_array);
-
- mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
- mDrawerList = (ListView) findViewById(R.id.left_drawer);
-
- // set a custom shadow that overlays the main content when the drawer
- // opens
- mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow,
- GravityCompat.START);
- // set up the drawer's list view with items and click listener
- mDrawerList.setAdapter(new ArrayAdapter<String>(this,
- R.layout.drawer_list_item, mTitles));
- mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
-
- // enable ActionBar app icon to behave as action to toggle nav drawer
- getSupportActionBar().setDisplayHomeAsUpEnabled(true);
-
- // ActionBarDrawerToggle ties together the the proper interactions
- // between the sliding drawer and the action bar app icon
- mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */
- mDrawerLayout, /* DrawerLayout object */
- R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */
- R.string.drawer_open, /* "open drawer" description for accessibility */
- R.string.drawer_close /* "close drawer" description for accessibility */
- ) {
- public void onDrawerClosed(View view) {
- // getSupportActionBar().setTitle(mTitle);
- //invalidateOptionsMenu(); // creates call to
- // onPrepareOptionsMenu()
- }
-
- public void onDrawerOpened(View drawerView) {
- // getSupportActionBar().setTitle(mDrawerTitle);
- //invalidateOptionsMenu(); // creates call to
- // onPrepareOptionsMenu()
- }
- };
- mDrawerLayout.setDrawerListener(mDrawerToggle);
+ public static final int MENU_REFRESH = 99;
+
+ protected T listView;
+
+ protected ViewFlipper flipper;
+
+ private Button retry;
+
+ private ProgressDialog progress;
+
+ protected Preferences getPrefs() {
+ return Preferences.get();
+ }
+
+ // protected SvdrpProgressDialog progress;
+
+ private CharSequence mDrawerTitle;
+ private DrawerLayout mDrawerLayout;
+ private ListView mDrawerList;
+ private ActionBarDrawerToggle mDrawerToggle;
+ private String[] mTitles;
+
+ abstract protected String getWindowTitle();
+
+ abstract protected int getMainLayout();
+
+ protected void noInternetConnection() {
+ alert(R.string.no_internet_connection);
+ }
+
+ abstract protected boolean displayingResults();
+
+ /**
+ * When using the ActionBarDrawerToggle, you must call it during
+ * onPostCreate() and onConfigurationChanged()...
+ */
+
+ @Override
+ protected void onPostCreate(Bundle savedInstanceState) {
+ super.onPostCreate(savedInstanceState);
+ // Sync the toggle state after onRestoreInstanceState has occurred.
+ mDrawerToggle.syncState();
+ }
+
+ protected boolean isForceRefresh() {
+ if (forceRefresh == false) {
+ return false;
+ }
+ forceRefresh = false;
+ return true;
+ }
+
+ protected boolean forceRefresh = false;
+
+ protected void switchNoConnection() {
+ if (flipper == null) {
+ say(R.string.no_connection);
+ return;
+ }
+
+ if (displayingResults()) {
+ say(R.string.no_connection);
+ } else {
+ flipper.setDisplayedChild(1);
+ }
+ }
+
+ protected CertificateProblemDialog getCertificateProblemDialog() {
+ return new CertificateProblemDialog(this);
+ }
+
+ @Override
+ public void onConfigurationChanged(final Configuration newConfig) {
+ Preferences.setLocale(this);
+ super.onConfigurationChanged(newConfig);
+ mDrawerToggle.onConfigurationChanged(newConfig);
+ }
+
+ @Override
+ protected void onResume() {
+ Preferences.init(this);
+ super.onResume();
+ }
+
+ protected void initFlipper() {
+ this.flipper = (ViewFlipper) findViewById(R.id.flipper);
+ retry = (Button) findViewById(R.id.retry_button);
+ retry.setOnClickListener(this);
+ }
+
+ @Override
+ public void onClick(final View v) {
+ if (v.getId() == R.id.retry_button) {
+ retry();
+ }
+ }
+
+ //
+ // protected void updateWindowTitle(int topic, int subtopic) {
+ // String title;
+ // title = getString(topic);
+ // if (subtopic != -1) {
+ // title += " > " + getString(subtopic);
+ // }
+ // setTitle(title);
+ // }
+ //
+ // protected void updateWindowTitle(String topic, String subtopic) {
+ // String title = topic;
+ // if (subtopic != null) {
+ // title += " > " + subtopic;
+ // }
+ // setTitle(title);
+ // }
+
+ abstract protected int getListNavigationIndex();
+
+ public static final int LIST_NAVIGATION_CHANNELS = 0;
+ public static final int LIST_NAVIGATION_EPG_BY_TIME = 1;
+ public static final int LIST_NAVIGATION_EPG_BY_CHANNEL = 2;
+ public static final int LIST_NAVIGATION_RECORDINGS = 3;
+ public static final int LIST_NAVIGATION_TIMERS = 4;
+ public static final int LIST_NAVIGATION_REMOTE = 5;
+
+ protected boolean hasListNavigation() {
+ return true;
+ }
+
+ protected void initListNavigation() {
+
+ if (hasListNavigation() == false) {
+ return;
+ }
+
+ // getSupportActionBar().setDisplayShowTitleEnabled(false);
+ //
+ // getSupportActionBar().setNavigationMode(
+ // getSupportActionBar().NAVIGATION_MODE_LIST);
+ //
+ // final ArrayAdapter<CharSequence> mSpinnerAdapter = ArrayAdapter
+ // .createFromResource(this, R.array.navigation_array,
+ // android.R.layout.simple_spinner_dropdown_item);
+ //
+ // getSupportActionBar().setListNavigationCallbacks(mSpinnerAdapter,
+ // new OnNavigationListener() {
+ //
+ // private boolean firstHit = true;
+ //
+ // @Override
+ // public boolean onNavigationItemSelected(
+ // final int itemPosition, final long itemId) {
+ //
+ // if (firstHit == true) {
+ // firstHit = false;
+ // return false;
+ // }
+ // switch (itemPosition) {
+ //
+ // case LIST_NAVIGATION_CHANNELS: {
+ // startActivity(ChannelListActivity.class);
+ // return true;
+ // }
+ // case LIST_NAVIGATION_EPG_BY_TIME: {
+ // startActivity(TimeEpgListActivity.class);
+ // return true;
+ // }
+ //
+ // case LIST_NAVIGATION_EPG_BY_CHANNEL: {
+ // startActivity(EventEpgListActivity.class);
+ // return true;
+ // }
+ //
+ // case LIST_NAVIGATION_RECORDINGS: {
+ // startActivity(RecordingListActivity.class);
+ // return true;
+ // }
+ //
+ // case LIST_NAVIGATION_TIMERS: {
+ // startActivity(TimerListActivity.class);
+ // return true;
+ // }
+ //
+ // }
+ // return false;
+ // }
+ // });
+ // getSupportActionBar().setSelectedNavigationItem(
+ // getListNavigationIndex());
+
+ }
+
+ @Override
+ protected void onCreate(final Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ Thread.setDefaultUncaughtExceptionHandler(VdrManagerExceptionHandler.get(this,
+ Thread.getDefaultUncaughtExceptionHandler()));
+ Preferences.setLocale(this);
+ setContentView(getMainLayout());
+ progress = new ProgressDialog(this);
+ progress.setCancelable(false);
+ progress.setCanceledOnTouchOutside(false);
+ // progress.setOnCancelListener(new OnCancelListener() {
+ // @Override
+ // public void onCancel(DialogInterface dialog) {
+ //
+ // }
+ // });
+
+ initActionBar();
+
+ initListNavigation();
+
+ initLeftDrawer(savedInstanceState);
+
+ // new OnNavigationListener() {
+ // @Override
+ // public boolean onNavigationItemSelected(int itemPosition, long
+ // itemId) {
+ // System.err.println("itemPosition: "+ itemPosition +", itemId:" +
+ // itemId);
+ // rturn false;
+ // }
+ // });
+
+ // your logic for click listner
+ // setListenerForActionBarCustomView(actionBarView);
+
+ // private void setListenerForActionBarCustomView(View actionBarView) {
+ // ActionBarCustomViewOnClickListener actionBarCustomViewOnClickListener
+ // = new ActionBarCustomViewOnClickListener();
+ // actionBarView.findViewById(R.id.text_view_title).setOnClickListener(actionBarCustomViewOnClickListener);
+ // }
+
+ }
+
+ protected void initLeftDrawer(final Bundle savedInstanceState) {
+
+ mDrawerTitle = getTitle();
+
+ mTitles = getResources().getStringArray(R.array.navigation_array);
+
+ mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
+ mDrawerList = (ListView) findViewById(R.id.left_drawer);
+
+ // set a custom shadow that overlays the main content when the drawer
+ // opens
+ mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow,
+ GravityCompat.START);
+ // set up the drawer's list view with items and click listener
+ mDrawerList.setAdapter(new ArrayAdapter<String>(this,
+ R.layout.drawer_list_item, mTitles));
+ mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
+
+ // enable ActionBar app icon to behave as action to toggle nav drawer
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+
+ // ActionBarDrawerToggle ties together the the proper interactions
+ // between the sliding drawer and the action bar app icon
+ mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */
+ mDrawerLayout, /* DrawerLayout object */
+ R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */
+ R.string.drawer_open, /* "open drawer" description for accessibility */
+ R.string.drawer_close /* "close drawer" description for accessibility */
+ ) {
+ public void onDrawerClosed(View view) {
+ // getSupportActionBar().setTitle(mTitle);
+ //invalidateOptionsMenu(); // creates call to
+ // onPrepareOptionsMenu()
+ }
+
+ public void onDrawerOpened(View drawerView) {
+ // getSupportActionBar().setTitle(mDrawerTitle);
+ //invalidateOptionsMenu(); // creates call to
+ // onPrepareOptionsMenu()
+ }
+ };
+ mDrawerLayout.setDrawerListener(mDrawerToggle);
// if (savedInstanceState == null) {
// selectItem(0);
// }
- }
-
- /* The click listner for ListView in the navigation drawer */
- private class DrawerItemClickListener implements
- ListView.OnItemClickListener {
- @Override
- public void onItemClick(AdapterView<?> parent, View view, int position,
- long id) {
- selectItem(position);
- }
- }
-
- private void selectItem(int position) {
-
- // update selected item and title, then close the drawer
- mDrawerList.setItemChecked(position, true);
- // setTitle(mPlanetTitles[position]);
-
- switch (position) {
-
- case LIST_NAVIGATION_CHANNELS: {
- startActivity(ChannelListActivity.class);
- break;
- }
- case LIST_NAVIGATION_EPG_BY_TIME: {
- startActivity(TimeEpgListActivity.class);
- break;
- }
-
- case LIST_NAVIGATION_EPG_BY_CHANNEL: {
- startActivity(EventEpgListActivity.class);
- break;
- }
-
- case LIST_NAVIGATION_RECORDINGS: {
- startActivity(RecordingListActivity.class);
- break;
- }
-
- case LIST_NAVIGATION_TIMERS: {
- startActivity(TimerListActivity.class);
- break;
- }
- case LIST_NAVIGATION_REMOTE: {
- startActivity(RemoteActivity.class);
- break;
- }
- }
-
- mDrawerLayout.closeDrawer(mDrawerList);
- }
-
- protected void initActionBar() {
- getSupportActionBar().setHomeButtonEnabled(true);
- }
-
- public void startActivity(final Class<?> clazz) {
- final Intent intent = new Intent(Intent.ACTION_VIEW);
- intent.setClass(this, clazz);
- startActivity(intent);
- finish();
- }
-
- protected int getBaseMenu() {
- return R.menu.refresh_filter_menu;
- }
-
- @Override
- public boolean onCreateOptionsMenu(final Menu menu) {
-
- // MenuItem item;
- // item = menu.add(MENU_GROUP_REFRESH, MENU_REFRESH, 0,
- // R.string.refresh);
- // item.setIcon(R.drawable.ic_menu_refresh);
- // item.setAlphabeticShortcut('r');
- final MenuInflater inf = getMenuInflater();
- inf.inflate(getBaseMenu(), menu);
-
- // SearchView searchView = (SearchView)
- // menu.findItem(R.id.menu_search).getActionView();
- // searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
-
- return true;
- }
-
- abstract protected void refresh();
-
- abstract protected void retry();
-
- // abstract protected SvdrpClient<Result> getClient();
-
- @Override
- public boolean onOptionsItemSelected(final MenuItem item) {
-
- if (mDrawerToggle != null && mDrawerToggle.onOptionsItemSelected(item)) {
- return true;
- }
-
- switch (item.getItemId()) {
- case R.id.list_refresh:
- backupViewSelection();
- refresh();
- return true;
- case R.id.list_filter: {
- onSearchRequested();
- return true;
- }
- case android.R.id.home:
- final Intent intent = new Intent(this, VdrManagerActivity.class);
- intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
- startActivity(intent);
- return true;
- default:
- return false;
- }
- }
-
- protected void setCurrent(final Channel channel) {
- getApp().setCurrentChannel(channel);
- }
-
- protected VdrManagerApp getApp() {
- final VdrManagerApp app = (VdrManagerApp) getApplication();
- return app;
- }
-
- // protected Channel getCurrentChannel(){
- // final Channel channel = ((VdrManagerApp) getApplication())
- // .getCurrentChannel();
- // return channel;
- // }
-
- protected void say(final int res) {
- say(this.getString(res));
- }
-
- protected void say(final String msg) {
- Utils.say(this, msg);
- }
-
- protected boolean noConnection(final SvdrpEvent event) {
- switch (event) {
- case CONNECTION_TIMEOUT:
- say(R.string.progress_connect_timeout);
- switchNoConnection();
- case CONNECT_ERROR:
- say(R.string.progress_connect_error);
- switchNoConnection();
- break;
- case FINISHED_ABNORMALY:
- alert(R.string.progress_connect_finished_abnormal);
- switchNoConnection();
- break;
- case LOGIN_ERROR:
- say(R.string.progress_login_error);
- switchNoConnection();
- break;
- default:
- return false;
- }
- return true;
- }
-
- protected void alert(final String msg) {
- if (isFinishing()) {
- return;
- }
- new AlertDialog.Builder(this)//
- .setMessage(msg)//
- .setPositiveButton(android.R.string.ok, null)//
- .create()//
- .show();//
- }
-
- protected void alert(final int resId) {
- alert(getString(resId));
- }
-
- protected void restoreViewSelection() {
- listView.setSelectionFromTop(index, top);
- }
-
- protected void backupViewSelection() {
- index = listView.getFirstVisiblePosition();
- final View v = listView.getChildAt(0);
- top = (v == null) ? 0 : v.getTop();
- }
-
- int index;
- int top;
-
- protected boolean checkInternetConnection() {
- if (Utils.checkInternetConnection(this)) {
- return true;
- }
- noInternetConnection();
- return false;
- }
-
- // public void svdrpEvent(Result result) {
- // resultReceived(result);
- // }
-
- @Override
- public void svdrpEvent(final SvdrpEvent event, final Throwable t) {
- progress.dismiss();
- Utils.say(this, t.getMessage());
- }
-
- protected void addListener(
- final SvdrpAsyncTask<Result, SvdrpClient<Result>> task) {
- task.addSvdrpExceptionListener(this);
- task.addSvdrpListener(this);
- task.addSvdrpFinishedListener(this);
- }
-
- @Override
- public void svdrpEvent(final SvdrpEvent event) {
-
- switch (event) {
- case LOGIN:
- break;
- case COMMAND_SENDING:
- break;
- case CONNECTING:
- progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
- setMessage(R.string.progress_connect);
- if (!isFinishing()) {
- progress.show();
- }
- break;
- case LOGGED_IN:
- setMessage(R.string.progress_login);
- break;
- case COMMAND_SENT:
- setMessage(getProgressTextId());
- break;
- case DISCONNECTING:
- setMessage(R.string.progress_disconnect);
- break;
- case DISCONNECTED:
- break;
- case ABORTED:
- progress.dismiss();
- say(R.string.aborted);
- break;
- case ERROR:
- progress.dismiss();
- alert(R.string.epg_client_errors);
- break;
- case CONNECTED:
- connected();
- break;
- case CONNECTION_TIMEOUT:
- case CONNECT_ERROR:
- case FINISHED_ABNORMALY:
- case LOGIN_ERROR:
- progress.dismiss();
- noConnection(event);
- break;
- case CACHE_HIT:
- progress.dismiss();
- cacheHit();
- return;
- case FINISHED_SUCCESS:
- progress.dismiss();
- break;
- }
- // case RESULT_RECEIVED:
- // resultReceived(result);
- // break;
- // }
- }
-
- protected int getProgressTextId() {
- return R.string.progress_loading;
- }
-
- private void setMessage(final int progressConnect) {
- progress.setMessage(getString(progressConnect));
- }
-
- protected boolean finishedSuccess = false;
-
- protected void cacheHit() {
-
- }
-
- /**
- * @return false, if no results found
- */
- protected abstract boolean finishedSuccess(List<Result> results);
-
- // /**
- // * @param result
- // */
- // protected abstract void resultReceived(Result result);
-
- protected void connected() {
- if (flipper != null) {
- flipper.setDisplayedChild(0);
- }
- }
-
- public void svdrpException(final SvdrpException exception) {
- // svdrpException(exception);
- // Log.w(TAG, exception);
- alert(getString(R.string.vdr_error_text, exception.getMessage()));
- }
-
- @Override
- protected void onDestroy() {
- if (progress.isShowing()) {
- progress.dismiss();
- }
- super.onDestroy();
- }
-
- @Override
- public void finished(final List<Result> results) {
- if (finishedSuccess(results)) {
- finishedSuccess = true;
- restoreViewSelection();
- } else {
- say(R.string.epg_no_items);
- }
- }
+ }
+
+ /* The click listner for ListView in the navigation drawer */
+ private class DrawerItemClickListener implements
+ ListView.OnItemClickListener {
+ @Override
+ public void onItemClick(AdapterView<?> parent, View view, int position,
+ long id) {
+ selectItem(position);
+ }
+ }
+
+ private void selectItem(int position) {
+
+ // update selected item and title, then close the drawer
+ mDrawerList.setItemChecked(position, true);
+ // setTitle(mPlanetTitles[position]);
+
+ switch (position) {
+
+ case LIST_NAVIGATION_CHANNELS: {
+ startActivity(ChannelListActivity.class);
+ break;
+ }
+ case LIST_NAVIGATION_EPG_BY_TIME: {
+ startActivity(TimeEpgListActivity.class);
+ break;
+ }
+
+ case LIST_NAVIGATION_EPG_BY_CHANNEL: {
+ startActivity(EventEpgListActivity.class);
+ break;
+ }
+
+ case LIST_NAVIGATION_RECORDINGS: {
+ startActivity(RecordingListActivity.class);
+ break;
+ }
+
+ case LIST_NAVIGATION_TIMERS: {
+ startActivity(TimerListActivity.class);
+ break;
+ }
+ case LIST_NAVIGATION_REMOTE: {
+ startActivity(RemoteActivity.class);
+ break;
+ }
+ }
+
+ mDrawerLayout.closeDrawer(mDrawerList);
+ }
+
+ protected void initActionBar() {
+ getSupportActionBar().setHomeButtonEnabled(true);
+ }
+
+ public void startActivity(final Class<?> clazz) {
+ final Intent intent = new Intent(Intent.ACTION_VIEW);
+ intent.setClass(this, clazz);
+ startActivity(intent);
+ finish();
+ }
+
+ protected int getBaseMenu() {
+ return R.menu.refresh_filter_menu;
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(final Menu menu) {
+
+ // MenuItem item;
+ // item = menu.add(MENU_GROUP_REFRESH, MENU_REFRESH, 0,
+ // R.string.refresh);
+ // item.setIcon(R.drawable.ic_menu_refresh);
+ // item.setAlphabeticShortcut('r');
+ final MenuInflater inf = getMenuInflater();
+ inf.inflate(getBaseMenu(), menu);
+
+ // SearchView searchView = (SearchView)
+ // menu.findItem(R.id.menu_search).getActionView();
+ // searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
+
+ return true;
+ }
+
+ abstract protected void refresh();
+
+ abstract protected void retry();
+
+ // abstract protected SvdrpClient<Result> getClient();
+
+ @Override
+ public boolean onOptionsItemSelected(final MenuItem item) {
+
+ if (mDrawerToggle != null && mDrawerToggle.onOptionsItemSelected(item)) {
+ return true;
+ }
+
+ switch (item.getItemId()) {
+ case R.id.list_refresh:
+ backupViewSelection();
+ refresh();
+ return true;
+ case R.id.list_filter: {
+ onSearchRequested();
+ return true;
+ }
+ case android.R.id.home:
+ final Intent intent = new Intent(this, VdrManagerActivity.class);
+ intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ startActivity(intent);
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ protected void setCurrent(final Channel channel) {
+ getApp().setCurrentChannel(channel);
+ }
+
+ protected VdrManagerApp getApp() {
+ final VdrManagerApp app = (VdrManagerApp) getApplication();
+ return app;
+ }
+
+ // protected Channel getCurrentChannel(){
+ // final Channel channel = ((VdrManagerApp) getApplication())
+ // .getCurrentChannel();
+ // return channel;
+ // }
+
+ protected void say(final int res) {
+ say(this.getString(res));
+ }
+
+ protected void say(final String msg) {
+ Utils.say(this, msg);
+ }
+
+ protected boolean noConnection(final SvdrpEvent event) {
+ switch (event) {
+ case CONNECTION_TIMEOUT:
+ say(R.string.progress_connect_timeout);
+ switchNoConnection();
+ case CONNECT_ERROR:
+ say(R.string.progress_connect_error);
+ switchNoConnection();
+ break;
+ case FINISHED_ABNORMALY:
+ alert(R.string.progress_connect_finished_abnormal);
+ switchNoConnection();
+ break;
+ case LOGIN_ERROR:
+ say(R.string.progress_login_error);
+ switchNoConnection();
+ break;
+ default:
+ return false;
+ }
+ return true;
+ }
+
+ protected void alert(final String msg) {
+ if (isFinishing()) {
+ return;
+ }
+ new AlertDialog.Builder(this)//
+ .setMessage(msg)//
+ .setPositiveButton(android.R.string.ok, null)//
+ .create()//
+ .show();//
+ }
+
+ protected void alert(final int resId) {
+ alert(getString(resId));
+ }
+
+ protected void restoreViewSelection() {
+ listView.setSelectionFromTop(index, top);
+ }
+
+ protected void backupViewSelection() {
+ index = listView.getFirstVisiblePosition();
+ final View v = listView.getChildAt(0);
+ top = (v == null) ? 0 : v.getTop();
+ }
+
+ int index;
+ int top;
+
+ protected boolean checkInternetConnection() {
+ if (Utils.checkInternetConnection(this)) {
+ return true;
+ }
+ noInternetConnection();
+ return false;
+ }
+
+ // public void svdrpEvent(Result result) {
+ // resultReceived(result);
+ // }
+
+ @Override
+ public void svdrpEvent(final SvdrpEvent event, final Throwable t) {
+ progress.dismiss();
+ Utils.say(this, t.getMessage());
+ }
+
+ protected void addListener(
+ final SvdrpAsyncTask<Result, SvdrpClient<Result>> task) {
+ task.addSvdrpExceptionListener(this);
+ task.addSvdrpListener(this);
+ task.addSvdrpFinishedListener(this);
+ }
+
+ @Override
+ public void svdrpEvent(final SvdrpEvent event) {
+
+ switch (event) {
+ case LOGIN:
+ break;
+ case COMMAND_SENDING:
+ break;
+ case CONNECTING:
+ progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
+ setMessage(R.string.progress_connect);
+ if (!isFinishing()) {
+ progress.show();
+ }
+ break;
+ case LOGGED_IN:
+ setMessage(R.string.progress_login);
+ break;
+ case COMMAND_SENT:
+ setMessage(getProgressTextId());
+ break;
+ case DISCONNECTING:
+ setMessage(R.string.progress_disconnect);
+ break;
+ case DISCONNECTED:
+ break;
+ case ABORTED:
+ progress.dismiss();
+ say(R.string.aborted);
+ break;
+ case ERROR:
+ progress.dismiss();
+ alert(R.string.epg_client_errors);
+ break;
+ case CONNECTED:
+ connected();
+ break;
+ case CONNECTION_TIMEOUT:
+ case CONNECT_ERROR:
+ case FINISHED_ABNORMALY:
+ case LOGIN_ERROR:
+ progress.dismiss();
+ noConnection(event);
+ break;
+ case CACHE_HIT:
+ progress.dismiss();
+ cacheHit();
+ return;
+ case FINISHED_SUCCESS:
+ progress.dismiss();
+ break;
+ }
+ // case RESULT_RECEIVED:
+ // resultReceived(result);
+ // break;
+ // }
+ }
+
+ protected int getProgressTextId() {
+ return R.string.progress_loading;
+ }
+
+ private void setMessage(final int progressConnect) {
+ progress.setMessage(getString(progressConnect));
+ }
+
+ protected boolean finishedSuccess = false;
+
+ protected void cacheHit() {
+
+ }
+
+ /**
+ * @return false, if no results found
+ */
+ protected abstract boolean finishedSuccess(List<Result> results);
+
+ // /**
+ // * @param result
+ // */
+ // protected abstract void resultReceived(Result result);
+
+ protected void connected() {
+ if (flipper != null) {
+ flipper.setDisplayedChild(0);
+ }
+ }
+
+ public void svdrpException(final SvdrpException exception) {
+ // svdrpException(exception);
+ // Log.w(TAG, exception);
+ alert(getString(R.string.vdr_error_text, exception.getMessage()));
+ }
+
+ @Override
+ protected void onDestroy() {
+ if (progress.isShowing()) {
+ progress.dismiss();
+ }
+ super.onDestroy();
+ }
+
+ @Override
+ public void finished(final List<Result> results) {
+ if (finishedSuccess(results)) {
+ finishedSuccess = true;
+ restoreViewSelection();
+ } else {
+ say(R.string.epg_no_items);
+ }
+ }
}
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/ChannelListActivity.java b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/ChannelListActivity.java
index d5b0b3f..5b78c05 100644
--- a/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/ChannelListActivity.java
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/ChannelListActivity.java
@@ -29,6 +29,7 @@ import de.bjusystems.vdrmanager.data.Preferences;
import de.bjusystems.vdrmanager.data.RecenteChannel;
import de.bjusystems.vdrmanager.data.db.DBAccess;
import de.bjusystems.vdrmanager.tasks.VoidAsyncTask;
+import de.bjusystems.vdrmanager.utils.VdrManagerExceptionHandler;
import de.bjusystems.vdrmanager.utils.svdrp.ChannelClient;
import de.bjusystems.vdrmanager.utils.svdrp.SvdrpAsyncTask;
import de.bjusystems.vdrmanager.utils.svdrp.SvdrpClient;
@@ -50,26 +51,53 @@ public class ChannelListActivity extends
private static final String TAG = ChannelListActivity.class.getName();
+ /**
+ * The Adapter.
+ */
ChannelAdapter adapter;
+ /**
+ * The Prefs.
+ */
Preferences prefs;
// private static final LinkedList<Channel> RECENT = new
// LinkedList<Channel>();
+ /**
+ * The constant MENU_GROUP.
+ */
public static final int MENU_GROUP = 0;
+ /**
+ * The constant MENU_PROVIDER.
+ */
public static final int MENU_PROVIDER = 1;
+ /**
+ * The constant MENU_SOURCE.
+ */
public static final int MENU_SOURCE = 2;
+ /**
+ * The constant MENU_NAME.
+ */
public static final int MENU_NAME = 3;
+ /**
+ * The constant GROUP_NATURAL.
+ */
public static final boolean GROUP_NATURAL = false;
+ /**
+ * The constant GROUP_REVERSE.
+ */
public static final boolean GROUP_REVERSE = true;
private int groupBy;
private boolean groupByReverse;
+ /**
+ * The constant ALL_CHANNELS_GROUP.
+ */
final static ArrayList<String> ALL_CHANNELS_GROUP = new ArrayList<String>(1);
@Override
@@ -82,6 +110,8 @@ public class ChannelListActivity extends
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ Thread.setDefaultUncaughtExceptionHandler(VdrManagerExceptionHandler.get(this,
+ Thread.getDefaultUncaughtExceptionHandler()));
// Attach view
@@ -147,12 +177,26 @@ public class ChannelListActivity extends
task.run();
}
+ /**
+ * The Recent adapter.
+ */
static RecentChannelsAdapter RECENT_ADAPTER = null;
+ /**
+ * The type Recent channels adapter.
+ */
static class RecentChannelsAdapter extends ArrayAdapter<Channel> {
private final Activity context;
+ /**
+ * The Res id.
+ */
int resId;
+ /**
+ * Instantiates a new Recent channels adapter.
+ *
+ * @param context the context
+ */
public RecentChannelsAdapter(final Activity context) {
super(context, android.R.layout.simple_list_item_1);
this.context = context;
@@ -165,6 +209,9 @@ public class ChannelListActivity extends
}
}
+ /**
+ * The Show channel numbers.
+ */
public boolean showChannelNumbers;
@Override
@@ -285,6 +332,9 @@ public class ChannelListActivity extends
return R.array.channels_group_by;
}
+ /**
+ * The Group by dialog.
+ */
AlertDialog groupByDialog = null;
@Override
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/ColoredButton.java b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/ColoredButton.java
index f10860c..8f09496 100644
--- a/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/ColoredButton.java
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/ColoredButton.java
@@ -1,7 +1,6 @@
package de.bjusystems.vdrmanager.gui;
import android.content.Context;
-import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.CornerPathEffect;
@@ -15,14 +14,13 @@ import android.graphics.drawable.StateListDrawable;
import android.graphics.drawable.shapes.RectShape;
import android.os.Build;
import android.util.AttributeSet;
-import android.widget.Button;
import de.bjusystems.vdrmanager.R;
/**
* Created by lado on 03.05.15.
*/
-public class ColoredButton extends Button {
+public class ColoredButton extends android.support.v7.widget.AppCompatButton {
private final float defaultRadius = 0.0f;
@@ -89,4 +87,4 @@ private int defaultPrimaryColor;
}
//typedArray.recycle();
}
-} \ No newline at end of file
+}
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/PreferencesActivity.java b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/PreferencesActivity.java
index 4dce431..5688bc7 100644
--- a/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/PreferencesActivity.java
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/PreferencesActivity.java
@@ -12,7 +12,11 @@ import android.preference.PreferenceManager;
import de.bjusystems.vdrmanager.R;
import de.bjusystems.vdrmanager.backup.BackupSettingsActivity;
import de.bjusystems.vdrmanager.data.Preferences;
+import de.bjusystems.vdrmanager.utils.VdrManagerExceptionHandler;
+/**
+ * The type Preferences activity.
+ */
public class PreferencesActivity extends BasePreferencesActivity implements
OnSharedPreferenceChangeListener, OnPreferenceChangeListener,
OnPreferenceClickListener {
@@ -29,6 +33,8 @@ public class PreferencesActivity extends BasePreferencesActivity implements
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ Thread.setDefaultUncaughtExceptionHandler(VdrManagerExceptionHandler.get(this,
+ Thread.getDefaultUncaughtExceptionHandler()));
this.getPreferenceManager().setSharedPreferencesName(
Preferences.getPreferenceFile(this));
@@ -49,7 +55,13 @@ public class PreferencesActivity extends BasePreferencesActivity implements
updateChildPreferences();
}
- // /** Return a properly configured SharedPreferences instance */
+ /**
+ * Gets shared preferences.
+ *
+ * @param context the context
+ * @return the shared preferences
+ */
+// /** Return a properly configured SharedPreferences instance */
public static SharedPreferences getSharedPreferences(Context context) {
return PreferenceManager.getDefaultSharedPreferences(context);
}
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/TimerDetailsActivity.java b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/TimerDetailsActivity.java
index 1b30890..1ea3046 100644
--- a/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/TimerDetailsActivity.java
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/TimerDetailsActivity.java
@@ -34,17 +34,30 @@ import de.bjusystems.vdrmanager.data.Preferences;
import de.bjusystems.vdrmanager.data.Timer;
import de.bjusystems.vdrmanager.tasks.CreateTimerTask;
import de.bjusystems.vdrmanager.tasks.ModifyTimerTask;
+import de.bjusystems.vdrmanager.utils.VdrManagerExceptionHandler;
import de.bjusystems.vdrmanager.utils.date.DateFormatter;
import de.bjusystems.vdrmanager.utils.svdrp.SetTimerClient.TimerOperation;
import de.bjusystems.vdrmanager.utils.svdrp.SvdrpEvent;
+/**
+ * The type Timer details activity.
+ */
public class TimerDetailsActivity extends Activity implements OnClickListener,
OnDateSetListener, OnTimeSetListener {
+ /**
+ * The constant REQUEST_CODE_TIMER_MODIFIED.
+ */
public static final int REQUEST_CODE_TIMER_MODIFIED = 34;
+ /**
+ * The constant REQUEST_CODE_TIMER_EDIT.
+ */
public static final int REQUEST_CODE_TIMER_EDIT = 35;
+ /**
+ * The constant REQUEST_CODE_TIMER_ADD.
+ */
public static final int REQUEST_CODE_TIMER_ADD = 36;
private CharSequence prevStart;
@@ -56,6 +69,8 @@ public class TimerDetailsActivity extends Activity implements OnClickListener,
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ Thread.setDefaultUncaughtExceptionHandler(VdrManagerExceptionHandler.get(this,
+ Thread.getDefaultUncaughtExceptionHandler()));
View view = getLayoutInflater().inflate(R.layout.timer_detail, null);
tView = new EditTimerViewHolder();
tView.view = view;
@@ -170,29 +185,80 @@ public class TimerDetailsActivity extends Activity implements OnClickListener,
tView.dateField.setEnabled(true);
}
+ /**
+ * The type Edit timer view holder.
+ */
public class EditTimerViewHolder {
+ /**
+ * The View.
+ */
View view;
+ /**
+ * The Title.
+ */
TextView title;
+ /**
+ * The Channel.
+ */
TextView channel;
+ /**
+ * The Date field.
+ */
Button dateField;
+ /**
+ * The Start field.
+ */
Button startField;
+ /**
+ * The End field.
+ */
Button endField;
+ /**
+ * The Save button.
+ */
Button saveButton;
+ /**
+ * The Modify button.
+ */
Button modifyButton;
+ /**
+ * The Vps.
+ */
CheckBox vps;
+ /**
+ * The Repeat.
+ */
Button repeat;
+ /**
+ * The Priority.
+ */
EditText priority;
+ /**
+ * The Lifecycle.
+ */
EditText lifecycle;
}
+ /**
+ * The T view.
+ */
EditTimerViewHolder tView = null;
+ /**
+ * The Edit start.
+ */
boolean editStart;
// SetTimerClient setTimerClient;
+ /**
+ * The Timer.
+ */
Timer timer;
+ /**
+ * The Original.
+ */
Timer original;
private void updateDates(Date start, Date stop) {
@@ -261,15 +327,26 @@ public class TimerDetailsActivity extends Activity implements OnClickListener,
}
+ /**
+ * Gets app.
+ *
+ * @return the app
+ */
protected VdrManagerApp getApp() {
final VdrManagerApp app = (VdrManagerApp) getApplication();
return app;
}
+ /**
+ * Add.
+ */
public void add() {
updateDisplay(TimerOperation.CREATE);
}
+ /**
+ * Modify.
+ */
public void modify() {
updateDisplay(TimerOperation.MODIFY);
}
@@ -384,6 +461,11 @@ public class TimerDetailsActivity extends Activity implements OnClickListener,
}
}
+ /**
+ * Gets selected items.
+ *
+ * @return the selected items
+ */
DaysOfWeek getSelectedItems() {
String str = timer.getWeekdays();
@@ -410,6 +492,11 @@ public class TimerDetailsActivity extends Activity implements OnClickListener,
return Integer.valueOf(text.getText().toString());
}
+ /**
+ * Say.
+ *
+ * @param res the res
+ */
protected void say(int res) {
Toast.makeText(this, res, Toast.LENGTH_SHORT).show();
}
@@ -475,6 +562,9 @@ public class TimerDetailsActivity extends Activity implements OnClickListener,
task.start();
}
+ /**
+ * Done.
+ */
public void done() {
setResult(RESULT_OK);
finish();
@@ -490,6 +580,9 @@ public class TimerDetailsActivity extends Activity implements OnClickListener,
task.start();
}
+ /**
+ * The type Days of week.
+ */
/*
* Days of week code as a single int. 0x00: no day 0x01: Monday 0x02:
* Tuesday 0x04: Wednesday 0x08: Thursday 0x10: Friday 0x20: Saturday 0x40:
@@ -504,10 +597,22 @@ public class TimerDetailsActivity extends Activity implements OnClickListener,
// Bitmask of all repeating days
private int mDays;
+ /**
+ * Instantiates a new Days of week.
+ *
+ * @param days the days
+ */
DaysOfWeek(int days) {
mDays = days;
}
+ /**
+ * To string string.
+ *
+ * @param context the context
+ * @param showNever the show never
+ * @return the string
+ */
public String toString(Context context, boolean showNever) {
StringBuilder ret = new StringBuilder();
@@ -551,6 +656,12 @@ public class TimerDetailsActivity extends Activity implements OnClickListener,
return ((mDays & (1 << day)) > 0);
}
+ /**
+ * Set.
+ *
+ * @param day the day
+ * @param set the set
+ */
public void set(int day, boolean set) {
if (set) {
mDays |= (1 << day);
@@ -559,15 +670,30 @@ public class TimerDetailsActivity extends Activity implements OnClickListener,
}
}
+ /**
+ * Set.
+ *
+ * @param dow the dow
+ */
public void set(DaysOfWeek dow) {
mDays = dow.mDays;
}
+ /**
+ * Gets coded.
+ *
+ * @return the coded
+ */
public int getCoded() {
return mDays;
}
- // Returns days of week encoded in an array of booleans.
+ /**
+ * Get boolean array boolean [ ].
+ *
+ * @return the boolean [ ]
+ */
+// Returns days of week encoded in an array of booleans.
public boolean[] getBooleanArray() {
boolean[] ret = new boolean[7];
for (int i = 0; i < 7; i++) {
@@ -576,6 +702,11 @@ public class TimerDetailsActivity extends Activity implements OnClickListener,
return ret;
}
+ /**
+ * Is repeat set boolean.
+ *
+ * @return the boolean
+ */
public boolean isRepeatSet() {
return mDays != 0;
}
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/Utils.java b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/Utils.java
index a880fcf..6c57ecc 100644
--- a/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/Utils.java
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/Utils.java
@@ -45,16 +45,38 @@ import de.bjusystems.vdrmanager.utils.svdrp.SvdrpException;
import de.bjusystems.vdrmanager.utils.svdrp.SvdrpListener;
import de.bjusystems.vdrmanager.utils.svdrp.SwitchChannelClient;
+/**
+ * The type Utils.
+ */
public class Utils {
+ /**
+ * The constant TAG.
+ */
public static final String TAG = Utils.class.getName();
+ /**
+ * The constant EMPTY_LIST.
+ */
public static final List EMPTY_LIST = new ArrayList(0);
+ /**
+ * The constant EMPTY.
+ */
public static final String[] EMPTY = new String[]{};
+ /**
+ * The constant HIGHLIGHT_TEXT.
+ */
public static final ForegroundColorSpan HIGHLIGHT_TEXT = new ForegroundColorSpan(
Color.RED);
+ /**
+ * Highlight char sequence.
+ *
+ * @param where the where
+ * @param what the what
+ * @return the char sequence
+ */
public static CharSequence highlight(final String where, String what) {
if (TextUtils.isEmpty(what)) {
return where;
@@ -72,6 +94,13 @@ public class Utils {
return ss;
}
+ /**
+ * Highlight 2 pair.
+ *
+ * @param where the where
+ * @param what the what
+ * @return the pair
+ */
public static Pair<Boolean, CharSequence> highlight2(final String where,
String what) {
if (TextUtils.isEmpty(what)) {
@@ -90,11 +119,24 @@ public class Utils {
return Pair.create(Boolean.TRUE, (CharSequence) ss);
}
+ /**
+ * Gets progress.
+ *
+ * @param start the start
+ * @param stop the stop
+ * @return the progress
+ */
public static int getProgress(final Date start, final Date stop) {
final long now = System.currentTimeMillis();
return getProgress(now, start.getTime(), stop.getTime());
}
+ /**
+ * Gets progress.
+ *
+ * @param e the e
+ * @return the progress
+ */
public static int getProgress(final Event e) {
if (e instanceof Recording == false) {
return getProgress(e.getStart(), e.getStop());
@@ -109,8 +151,8 @@ public class Utils {
/**
* @param now
- * @param time
- * @param time2
+ * @param start
+ * @param stop
* @return -1, is not not between start stop,
*/
private static int getProgress(final long now, final long start,
@@ -123,6 +165,12 @@ public class Utils {
return -1;
}
+ /**
+ * Is live boolean.
+ *
+ * @param event the event
+ * @return the boolean
+ */
public static boolean isLive(final Event event) {
final long now = System.currentTimeMillis();
return now >= event.getStart().getTime()
@@ -175,14 +223,42 @@ public class Utils {
return sb.toString();
}
+ /**
+ * Stream.
+ *
+ * @param activity the activity
+ * @param event the event
+ */
public static void stream(final Activity activity, final Event event) {
stream(activity, event.getStreamId());
}
+ /**
+ * Stream.
+ *
+ * @param activity the activity
+ * @param channel the channel
+ */
public static void stream(final Activity activity, final Channel channel) {
stream(activity, channel.getId());
}
+ /**
+ * Stream.
+ *
+ * @param activity the activity
+ * @param rec the channel
+ */
+ public static void stream(final Activity activity, final Recording rec) {
+ stream(activity, rec.getDevInode());
+ }
+
+ /**
+ * Stream.
+ *
+ * @param activity the activity
+ * @param idornr the idornr
+ */
public static void stream(final Activity activity, final String idornr) {
if (Preferences.get().isEnableRemux() == false) {
@@ -224,10 +300,16 @@ public class Utils {
}).create().show();
}
+ /**
+ * Start stream.
+ *
+ * @param activity the activity
+ * @param url the url
+ */
public static void startStream(final Activity activity, final String url) {
try {
final Intent intent = new Intent(Intent.ACTION_VIEW);
- intent.setDataAndType(Uri.parse(url.toString()), "video/*");
+ intent.setDataAndType(Uri.parse(url), "video/*");
activity.startActivityForResult(intent, 1);
} catch (final ActivityNotFoundException anfe) {
Log.w(TAG, anfe);
@@ -236,6 +318,12 @@ public class Utils {
}
}
+ /**
+ * Md 5 string.
+ *
+ * @param s the s
+ * @return the string
+ */
public static final String md5(final String s) {
try {
// Create MD5 Hash
@@ -261,12 +349,24 @@ public class Utils {
return "";
}
+ /**
+ * Gets duration.
+ *
+ * @param event the event
+ * @return the duration
+ */
public static int getDuration(final Event event) {
final long millis = event.getDuration();
final int minuts = (int) (millis / 1000 / 60);
return minuts;
}
+ /**
+ * Share event.
+ *
+ * @param activity the activity
+ * @param event the event
+ */
public static void shareEvent(final Activity activity, final Event event) {
final Intent share = new Intent(android.content.Intent.ACTION_SEND);
share.setType("text/plain");
@@ -290,6 +390,12 @@ public class Utils {
activity.getString(R.string.share_chooser)));
}
+ /**
+ * Add calendar event.
+ *
+ * @param activity the activity
+ * @param event the event
+ */
public static void addCalendarEvent(final Activity activity,
final Event event) {
final Intent intent = new Intent(Intent.ACTION_EDIT);
@@ -301,6 +407,12 @@ public class Utils {
activity.startActivity(intent);
}
+ /**
+ * Map special chars string.
+ *
+ * @param src the src
+ * @return the string
+ */
public static String mapSpecialChars(final String src) {
if (src == null) {
return "";
@@ -308,6 +420,12 @@ public class Utils {
return src.replace("|##", C.DATA_SEPARATOR).replace("||#", "\n");
}
+ /**
+ * Un map special chars string.
+ *
+ * @param src the src
+ * @return the string
+ */
public static String unMapSpecialChars(final String src) {
if (src == null) {
return "";
@@ -315,6 +433,12 @@ public class Utils {
return src.replace(C.DATA_SEPARATOR, "|##").replace("\n", "||#");
}
+ /**
+ * Gets package info.
+ *
+ * @param ctx the ctx
+ * @return the package info
+ */
public static PackageInfo getPackageInfo(final Context ctx) {
PackageInfo pi = null;
try {
@@ -326,6 +450,12 @@ public class Utils {
return pi;
}
+ /**
+ * Check internet connection boolean.
+ *
+ * @param ctx the ctx
+ * @return the boolean
+ */
public static boolean checkInternetConnection(final Context ctx) {
final ConnectivityManager cm = (ConnectivityManager) ctx
.getSystemService(Context.CONNECTIVITY_SERVICE);
@@ -337,7 +467,7 @@ public class Utils {
return false;
}
- private static String getRecordingStream(final Activity ctx,
+ private static String getRecordingStream(final Context ctx,
final Recording rec) {
@@ -388,20 +518,71 @@ public class Utils {
return url.toString();
}
- public static void streamRecording(final Activity ctx, final Recording rec) {
+
+ public static void streamRecording(final Activity activity, final Recording rec) {
+
+
+ if (Preferences.get().isEnableRemux() == false) {
+ streamRecordingDirect(activity, rec);
+ return;
+ }
+
+ final String sf = Preferences.get().getStreamFormat();
+ final String ext = activity.getString(R.string.remux_title);
+ new AlertDialog.Builder(activity)
+ .setTitle(R.string.stream_via_as)
+ //
+ .setItems(
+ new String[]{
+ activity.getString(R.string.stream_as, sf),
+ activity.getString(R.string.stream_via, ext)},// TODO
+ // add
+ // here
+ // what
+ // will
+ // be
+ // used
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(final DialogInterface dialog,
+ final int which) {
+ switch (which) {
+ case 0:
+ streamRecordingDirect(activity, rec);
+ break;
+ case 1:
+ startStream(activity, getRemuxStreamUrl(rec.getDevInode()));
+ break;
+ }
+ }
+ }).create().show();
+
+
+ }
+
+
+ private static void streamRecordingDirect(final Activity ctx, final Recording rec) {
final String urlstring = getRecordingStream(ctx, rec);
Log.d(TAG, "try stream: " + urlstring);
Utils.startStream(ctx, urlstring);
}
+ /**
+ * Switch to.
+ *
+ * @param activity the activity
+ * @param channel the channel
+ */
public static void switchTo(final Activity activity, final Channel channel) {
switchTo(activity, channel.getId(), channel.getName());
}
/**
- * @param ctx
- * @param id
- * @param name Optional für die Anzeige
+ * Switch to.
+ *
+ * @param activity the activity
+ * @param id the id
+ * @param name Optional für die Anzeige
*/
public static void switchTo(final Activity activity, final String id,
final String name) {
@@ -436,20 +617,45 @@ public class Utils {
task.run();
}
+ /**
+ * Say.
+ *
+ * @param ctx the ctx
+ * @param msg the msg
+ */
public static void say(final Context ctx, final String msg) {
final Toast t = Toast.makeText(ctx, msg, Toast.LENGTH_SHORT);
t.setGravity(Gravity.CENTER, 0, 0);
t.show();
}
+ /**
+ * Encode url path string.
+ *
+ * @param path the path
+ * @return the string
+ */
public static String encodeUrlPath(String path) {
return path.replaceAll("%", "%25");
}
+ /**
+ * Say.
+ *
+ * @param ctx the ctx
+ * @param msg the msg
+ */
public static void say(final Context ctx, final int msg) {
say(ctx, msg, Toast.LENGTH_SHORT);
}
+ /**
+ * Say.
+ *
+ * @param ctx the ctx
+ * @param msg the msg
+ * @param duration the duration
+ */
public static void say(final Context ctx, final int msg, final int duration) {
final Toast t = Toast.makeText(ctx, msg, duration);
t.setGravity(Gravity.CENTER, 0, 0);
@@ -461,8 +667,8 @@ public class Utils {
*
* @param context the context
* @param time the time in milliseconds
+ * @return the string
*/
-
public static String formatDateTime(final Context context, final long time) {
return android.text.format.DateFormat.getDateFormat(context).format(
time)
@@ -471,6 +677,16 @@ public class Utils {
DateUtils.FORMAT_SHOW_TIME).toString();
}
+ /**
+ * Gets timer state drawable.
+ *
+ * @param match the match
+ * @param full the full
+ * @param begin the begin
+ * @param end the end
+ * @param conflict the conflict
+ * @return the timer state drawable
+ */
public static int getTimerStateDrawable(final TimerMatch match,
final int full, final int begin, final int end, final int conflict) {
@@ -486,6 +702,13 @@ public class Utils {
}
}
+ /**
+ * Format audio string.
+ *
+ * @param context the context
+ * @param tracks the tracks
+ * @return the string
+ */
public static String formatAudio(final Context context,
final List<AudioTrack> tracks) {
@@ -505,6 +728,13 @@ public class Utils {
}
+ /**
+ * Gets timer match.
+ *
+ * @param event the event
+ * @param timer the timer
+ * @return the timer match
+ */
public static TimerMatch getTimerMatch(Event event, Timer timer) {
if (timer == null) {
return null;
@@ -522,6 +752,12 @@ public class Utils {
return timerMatch;
}
+ /**
+ * Content to string int.
+ *
+ * @param c the c
+ * @return the int
+ */
public static int contentToString(int c) {
;
switch (c & 0xF0) {
@@ -743,6 +979,13 @@ public class Utils {
return R.string.Content_Unknown;
}
+ /**
+ * Gets conten string.
+ *
+ * @param ctx the ctx
+ * @param contents the contents
+ * @return the conten string
+ */
public static String getContenString(Context ctx, int[] contents) {
if (contents.length == 0) {
@@ -762,6 +1005,12 @@ public class Utils {
return sb.toString();
}
+ /**
+ * Is serie boolean.
+ *
+ * @param contents the contents
+ * @return the boolean
+ */
public static boolean isSerie(int[] contents) {
if (contents.length == 0) {
return false;
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/VdrListActivity.java b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/VdrListActivity.java
index af1b532..05a8368 100644
--- a/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/VdrListActivity.java
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/VdrListActivity.java
@@ -19,6 +19,10 @@ import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
+
+import java.util.ArrayList;
+import java.util.List;
+
import de.bjusystems.vdrmanager.R;
import de.bjusystems.vdrmanager.app.Intents;
import de.bjusystems.vdrmanager.backup.BackupSettingsActivity;
@@ -27,276 +31,274 @@ import de.bjusystems.vdrmanager.data.Preferences;
import de.bjusystems.vdrmanager.data.Vdr;
import de.bjusystems.vdrmanager.data.db.DBAccess;
-import java.util.ArrayList;
-import java.util.List;
-
public class VdrListActivity extends AppCompatActivity implements
- OnItemClickListener, OnItemLongClickListener, View.OnClickListener {
-
- private static final String TAG = VdrListActivity.class.getName();
-
- List<Vdr> list = new ArrayList<Vdr>();
-
- ArrayAdapter<Vdr> adapter = null;
-
- // Cursor cursor;
-
- String[] listItems = {};
-
- private boolean emptyConfig = false;
-
- // private void initCursor() {
- //
- // //if (cursor != null) {
- // //if (!cursor.isClosed()) {
- // //cursor.close();
- // // }
- // //}
- // try {
- // cursor = getHelper().getVdrCursor();
- // //startManagingCursor(cursor);
- // } catch (Exception ex) {
- // Log.w(TAG,ex);
- // }
- // }
-
- private void populateIntent() {
- emptyConfig = getIntent().getBooleanExtra(Intents.EMPTY_CONFIG,
- Boolean.FALSE);
- }
-
-
- @Override
- public void onClick(View v) {
-
- if(v.getId() == R.id.new_vdr){
- editVdr(null);
- return;
- }
-
- }
-
- static class Holder {
- public TextView text1;
- public TextView text2;
- }
-
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- populateIntent();
-
- setContentView(R.layout.vdr_list_add_delete);
-
-
- findViewById(R.id.new_vdr).setOnClickListener(this);
-
- // initCursor();
- final Vdr cur = Preferences.get().getCurrentVdr();
- adapter = new ArrayAdapter<Vdr>(this,
- android.R.layout.simple_list_item_2, list) {
-
- @Override
- public View getView(int position, View convertView, ViewGroup parent) {
- // recycle view?
- Holder holder = null;
- View view = convertView;
- if (view == null) {
- view = getLayoutInflater().inflate(
- android.R.layout.simple_list_item_2, null);
- holder = new Holder();
-
- holder.text1 = (TextView) view
- .findViewById(android.R.id.text1);
- holder.text2 = (TextView) view
- .findViewById(android.R.id.text2);
- view.setTag(holder);
- } else {
- holder = (Holder) view.getTag();
- }
-
- Vdr vdr = getItem(position);
- String name = (vdr.getName() != null ? vdr.getName() : "");
- String host = vdr.getHost();
- holder.text2.setText(host);
-
- if (cur != null && cur.getId() == vdr.getId()) {
- SpannableString content = new SpannableString(name);
- content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
- holder.text1.setText(content);
- // text1.setText(text1.getText());
- } else {
- holder.text1.setTypeface(Typeface.DEFAULT);
- holder.text1.setText(name);
- }
- return view;
- }
-
- };
-
- // adapter = new ArrayAdapter<Vdr>(
- // "name", "host" }, new int[] { android.R.id.text1,
- // 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);
- // }
- //
- //
- // }
- //
- // };
- ListView listView = (ListView) findViewById(R.id.vdr_list);
- listView.setAdapter(adapter);
- registerForContextMenu(listView);
- listView.setOnItemClickListener(this);
- listView.setOnItemLongClickListener(this);
- listView.setLongClickable(true);
- listView.setEmptyView(findViewById(R.id.empty_view));
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * android.widget.AdapterView.OnItemClickListener#onItemClick(android.widget
- * .AdapterView, android.view.View, int, long)
- */
- public void onItemClick(AdapterView<?> parent, View view, int position,
- long id) {
- editVdr(adapter.getItem(position).getId());
- }
-
- /**
- * Start {@link VdrPreferencesActivity} to create or edit a vdr
- *
- * @param id
- * may be null. Then a new vdr is created
- */
- private void editVdr(Integer id) {
- Intent intent = new Intent(this, VdrPreferencesActivity.class);
- intent.putExtra(Intents.VDR_ID, id);
- startActivityForResult(intent, Intents.EDIT_VDR);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see android.app.Activity#onActivityResult(int, int,
- * android.content.Intent)
- */
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-
- if (resultCode != RESULT_OK) {
- return;
- }
- if (requestCode == Intents.EDIT_VDR) {
- refresh();
- return;
- }
-
- }
-
- @Override
- protected void onResume() {
- refresh();
- super.onResume();
- }
-
- @Override
- public void onBackPressed() {
- if (list.isEmpty()) {
- finish();
- return;
- }
- if (emptyConfig) {
- Intent intent = new Intent(this, VdrManagerActivity.class);
- intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
- startActivity(intent);
- finish();
- } else {
- super.onBackPressed();
- }
- }
-
- /**
- * Refresh the list
- */
- private void refresh() {
- list.clear();
- list.addAll(DBAccess.get(this).getVdrDAO().queryForAll());
- adapter.notifyDataSetChanged();
- }
-
- public boolean onItemLongClick(AdapterView<?> parent, View view,
- final int position, final long id) {
-
- new AlertDialog.Builder(this)
- .setMessage(R.string.vdr_device_delete_qeustion)//
- .setPositiveButton(android.R.string.ok,
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog,
- int which) {
- if (DBAccess
- .get(VdrListActivity.this)
- .getVdrDAO()
- .deleteById(
- adapter.getItem(position)
- .getId()) > 0) {
- if (Preferences.get().getCurrentVdrContext(
- VdrListActivity.this) == id) {
- Preferences.setCurrentVdr(
- VdrListActivity.this, null);
- }
- refresh();
- }
-
- }
- })//
- .setNegativeButton(android.R.string.cancel, null)//
- .create()//
- .show();
- return true;
- }
-
- @Override
- public final boolean onCreateOptionsMenu(final Menu menu) {
- super.onCreateOptionsMenu(menu);
-
- final MenuInflater inflater = getMenuInflater();
- inflater.inflate(R.menu.vdrlist, menu);
-
- return true;
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- if (item.getItemId() == R.id.main_menu_vdrlist_restore) {
-
- Intent intent = IntentUtils.newIntent(this,
- BackupSettingsActivity.class);
- startActivity(intent);
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
+ OnItemClickListener, OnItemLongClickListener, View.OnClickListener {
+
+ private static final String TAG = VdrListActivity.class.getName();
+
+ List<Vdr> list = new ArrayList<Vdr>();
+
+ ArrayAdapter<Vdr> adapter = null;
+
+ // Cursor cursor;
+
+ String[] listItems = {};
+
+ private boolean emptyConfig = false;
+
+ // private void initCursor() {
+ //
+ // //if (cursor != null) {
+ // //if (!cursor.isClosed()) {
+ // //cursor.close();
+ // // }
+ // //}
+ // try {
+ // cursor = getHelper().getVdrCursor();
+ // //startManagingCursor(cursor);
+ // } catch (Exception ex) {
+ // Log.w(TAG,ex);
+ // }
+ // }
+
+ private void populateIntent() {
+ emptyConfig = getIntent().getBooleanExtra(Intents.EMPTY_CONFIG,
+ Boolean.FALSE);
+ }
+
+
+ @Override
+ public void onClick(View v) {
+
+ if (v.getId() == R.id.new_vdr) {
+ editVdr(null);
+ return;
+ }
+
+ }
+
+ static class Holder {
+ public TextView text1;
+ public TextView text2;
+ }
+
+ /**
+ * Called when the activity is first created.
+ */
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ populateIntent();
+
+ setContentView(R.layout.vdr_list_add_delete);
+
+
+ findViewById(R.id.new_vdr).setOnClickListener(this);
+
+ // initCursor();
+ final Vdr cur = Preferences.get().getCurrentVdr();
+ adapter = new ArrayAdapter<Vdr>(this,
+ android.R.layout.simple_list_item_2, list) {
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ // recycle view?
+ Holder holder = null;
+ View view = convertView;
+ if (view == null) {
+ view = getLayoutInflater().inflate(
+ android.R.layout.simple_list_item_2, null);
+ holder = new Holder();
+
+ holder.text1 = (TextView) view
+ .findViewById(android.R.id.text1);
+ holder.text2 = (TextView) view
+ .findViewById(android.R.id.text2);
+ view.setTag(holder);
+ } else {
+ holder = (Holder) view.getTag();
+ }
+
+ Vdr vdr = getItem(position);
+ String name = (vdr.getName() != null ? vdr.getName() : "");
+ String host = vdr.getHost();
+ holder.text2.setText(host);
+
+ if (cur != null && cur.getId() == vdr.getId()) {
+ SpannableString content = new SpannableString(name);
+ content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
+ holder.text1.setText(content);
+ // text1.setText(text1.getText());
+ } else {
+ holder.text1.setTypeface(Typeface.DEFAULT);
+ holder.text1.setText(name);
+ }
+ return view;
+ }
+
+ };
+
+ // adapter = new ArrayAdapter<Vdr>(
+ // "name", "host" }, new int[] { android.R.id.text1,
+ // 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);
+ // }
+ //
+ //
+ // }
+ //
+ // };
+ ListView listView = (ListView) findViewById(R.id.vdr_list);
+ listView.setAdapter(adapter);
+ registerForContextMenu(listView);
+ listView.setOnItemClickListener(this);
+ listView.setOnItemLongClickListener(this);
+ listView.setLongClickable(true);
+ listView.setEmptyView(findViewById(R.id.empty_view));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * android.widget.AdapterView.OnItemClickListener#onItemClick(android.widget
+ * .AdapterView, android.view.View, int, long)
+ */
+ public void onItemClick(AdapterView<?> parent, View view, int position,
+ long id) {
+ editVdr(adapter.getItem(position).getId());
+ }
+
+ /**
+ * Start {@link VdrPreferencesActivity} to create or edit a vdr
+ *
+ * @param id may be null. Then a new vdr is created
+ */
+ private void editVdr(Integer id) {
+ Intent intent = new Intent(this, VdrPreferencesActivity.class);
+ intent.putExtra(Intents.VDR_ID, id);
+ startActivityForResult(intent, Intents.EDIT_VDR);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see android.app.Activity#onActivityResult(int, int,
+ * android.content.Intent)
+ */
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+
+ if (resultCode != RESULT_OK) {
+ return;
+ }
+ if (requestCode == Intents.EDIT_VDR) {
+ refresh();
+ return;
+ }
+
+ }
+
+ @Override
+ protected void onResume() {
+ refresh();
+ super.onResume();
+ }
+
+ @Override
+ public void onBackPressed() {
+ if (list.isEmpty()) {
+ finish();
+ return;
+ }
+ if (emptyConfig) {
+ Intent intent = new Intent(this, VdrManagerActivity.class);
+ intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ startActivity(intent);
+ finish();
+ } else {
+ super.onBackPressed();
+ }
+ }
+
+ /**
+ * Refresh the list
+ */
+ private void refresh() {
+ list.clear();
+ list.addAll(DBAccess.get(this).getVdrDAO().queryForAll());
+ adapter.notifyDataSetChanged();
+ }
+
+ public boolean onItemLongClick(AdapterView<?> parent, View view,
+ final int position, final long id) {
+
+ new AlertDialog.Builder(this)
+ .setMessage(R.string.vdr_device_delete_qeustion)//
+ .setPositiveButton(android.R.string.ok,
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog,
+ int which) {
+ if (DBAccess
+ .get(VdrListActivity.this)
+ .getVdrDAO()
+ .deleteById(
+ adapter.getItem(position)
+ .getId()) > 0) {
+ if (Preferences.get().getCurrentVdrContext(
+ VdrListActivity.this) == id) {
+ Preferences.setCurrentVdr(
+ VdrListActivity.this, null);
+ }
+ refresh();
+ }
+
+ }
+ })//
+ .setNegativeButton(android.R.string.cancel, null)//
+ .create()//
+ .show();
+ return true;
+ }
+
+ @Override
+ public final boolean onCreateOptionsMenu(final Menu menu) {
+ super.onCreateOptionsMenu(menu);
+
+ final MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.vdrlist, menu);
+
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (item.getItemId() == R.id.main_menu_vdrlist_restore) {
+
+ Intent intent = IntentUtils.newIntent(this,
+ BackupSettingsActivity.class);
+ startActivity(intent);
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
+ }
}
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/VdrManagerActivity.java b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/VdrManagerActivity.java
index 8f3c68c..6b2ee9f 100644
--- a/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/VdrManagerActivity.java
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/VdrManagerActivity.java
@@ -37,6 +37,7 @@ import de.bjusystems.vdrmanager.data.Vdr;
import de.bjusystems.vdrmanager.data.db.DBAccess;
import de.bjusystems.vdrmanager.data.db.EPGSearchSuggestionsProvider;
import de.bjusystems.vdrmanager.remote.RemoteActivity;
+import de.bjusystems.vdrmanager.utils.VdrManagerExceptionHandler;
import de.bjusystems.vdrmanager.utils.wakeup.AsyncWakeupTask;
public class VdrManagerActivity extends AppCompatActivity implements
@@ -92,7 +93,8 @@ public class VdrManagerActivity extends AppCompatActivity implements
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
-
+ Thread.setDefaultUncaughtExceptionHandler(VdrManagerExceptionHandler.get(this,
+ Thread.getDefaultUncaughtExceptionHandler()));
// Preferences.initVDR(this);
// if(Preferences.get().getCurrentVdr() == null){
@@ -108,6 +110,7 @@ public class VdrManagerActivity extends AppCompatActivity implements
intent.putExtra(Intents.EMPTY_CONFIG, Boolean.TRUE);
startActivity(intent);
Toast.makeText(this, R.string.no_vdr, Toast.LENGTH_SHORT).show();
+ checkAndRequestPermission();
finish();
return;
}
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/VdrPreferencesActivity.java b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/VdrPreferencesActivity.java
index 143954c..9743d4e 100644
--- a/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/VdrPreferencesActivity.java
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/VdrPreferencesActivity.java
@@ -1,16 +1,5 @@
package de.bjusystems.vdrmanager.gui;
-import java.io.BufferedReader;
-import java.io.FileReader;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.Socket;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.fueri.reeldroid.network.DeviceManager;
-
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
@@ -24,6 +13,18 @@ import android.os.Bundle;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.view.View;
+
+import org.fueri.reeldroid.network.DeviceManager;
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.util.ArrayList;
+import java.util.List;
+
import de.bjusystems.vdrmanager.R;
import de.bjusystems.vdrmanager.VdrSharedPreferencesImpl;
import de.bjusystems.vdrmanager.ZonePicker;
@@ -33,478 +34,490 @@ import de.bjusystems.vdrmanager.data.Preferences;
import de.bjusystems.vdrmanager.data.Vdr;
import de.bjusystems.vdrmanager.data.db.DBAccess;
import de.bjusystems.vdrmanager.tasks.VoidAsyncTask;
+import de.bjusystems.vdrmanager.utils.VdrManagerExceptionHandler;
public class VdrPreferencesActivity extends BasePreferencesActivity implements
- OnSharedPreferenceChangeListener, OnPreferenceClickListener {
-
- public static final int REQUEST_CODE_PICK_A_TIME_ZONE = 1;
-
- Vdr vdr;
-
- VdrSharedPreferencesImpl pref;
-
- int id = -1;
-
- @Override
- public SharedPreferences getSharedPreferences(String name, int mode) {
- return this.pref;
- }
-
- @Override
- public Preference findPreference(CharSequence key) {
- return super.findPreference(key);
- }
-
- @Override
- protected void updateSummary(Preference ep) {
- if (ep.getKey().equals("key_timezone")) {
- String text = vdr.getServerTimeZone();
- if (text == null) {
- return;
- }
- setSummary(text, ep);
- return;
- }
- super.updateSummary(ep);
- }
-
- private boolean isNew = false;
-
- private boolean hasChanged = false;
-
- private void initVDRInstance() {
- id = getIntent().getIntExtra(Intents.VDR_ID, -1);
- if (id == -1) {// new vdr
- vdr = new Vdr();
- isNew = true;
- } else {// edit
- Vdr v = DBAccess.get(this).getVdrDAO().queryForId(id);
- if (v != null) {
- vdr = v;
- } else {
- vdr = new Vdr();
- id = -1;
- isNew = true;
- }
- }
- pref = new VdrSharedPreferencesImpl(vdr, DBAccess.get(this).getVdrDAO());
- }
-
- public static String ARP_CACHE = "/proc/net/arp";
-
- /**
- * return mac address as a string.
- *
- * @param ip
- * @return
- */
- public static String getMacFromArpCache(String ip) {
-
- if (ip == null) {
- return null;
- }
-
- BufferedReader br = null;
-
- try {
- br = new BufferedReader(new FileReader(ARP_CACHE));
-
- String line;
-
- while ((line = br.readLine()) != null) {
- String[] values = line.split("\\s+");
- if (values != null && values.length >= 4
- && ip.equals(values[0])) {
- // format check
- String mac = values[3];
- if (mac.matches("..:..:..:..:..:..")) {
- return mac;
- } else {
- return null;
- }
- }
- }
- } catch (Exception e) {
-
- } finally {
- try {
- br.close();
- } catch (IOException e) {
-
- }
- }
- return null;
- }
-
- // private String getIp() throws Exception {
- // final Preferences prefs = Preferences.get();
- // String host = prefs.getSvdrpHost();
- // return InetAddress.getByName(host).getHostAddress();
- // }
-
- private void ping(String ip, int port) throws Exception {
- Socket socket = new Socket();
- socket.connect(new InetSocketAddress(ip, port), 5 * 1000);
- socket.setSoTimeout(5 * 1000);
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
-
- super.onCreate(savedInstanceState);
-
- initVDRInstance();
-
- this.addPreferencesFromResource(R.xml.vdr_prefs);
-
- // this.getPreferenceManager().setSharedPreferencesName(Preferences.getPreferenceFile(this));
-
- pref.registerOnSharedPreferenceChangeListener(this);
-
- String recstream = pref.getString("key_recstream_method", "vdr-live");
-
- if (recstream.equals("vdr-live") == false) {
- Preference p = findPreference("key_live_port");
- p.setEnabled(false);
- // PreferenceCategory cat = (PreferenceCategory)
- // findPreference("key_streaming_category");
- // cat.removePreference(p);
- }
-
- if (recstream.equals("vdr-smarttvweb") == false) {
- Preference p = findPreference("key_smarttvweb_port");
- p.setEnabled(false);
- p = findPreference("key_smarttvweb_recstream_method");
- p.setEnabled(false);
-
- }
-
- // create background task
-
- // start task
-
- final FetchEditTextPreference macedit = (FetchEditTextPreference) findPreference(getString(R.string.wakeup_wol_mac_key));
- String mac = vdr.getMac();
- if (mac == null) {
- mac = "";
- }
- macedit.setText(mac);
- macedit.setCompoundButtonListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- final String host = vdr.getHost();
- if (host == null) {
- Utils.say(VdrPreferencesActivity.this,
- getString(R.string.vdr_host_not_defined));
- return;
- }
-
- new VoidAsyncTask() {
-
- ProgressDialog pd;
-
- private String mac;
-
- String message;
-
- protected void onPreExecute() {
- pd = new ProgressDialog(VdrPreferencesActivity.this);
- pd.setMessage(getString(R.string.processing));
- pd.show();
- };
-
- protected void onPostExecute(Void result) {
- pd.dismiss();
- if (message != null) {
- Utils.say(VdrPreferencesActivity.this, message);
- return;
- }
- macedit.setEditText(mac);
- };
-
- @Override
- protected Void doInBackground(Void... params) {
- try {
- String ip = InetAddress.getByName(host)
- .getHostAddress();
- ping(ip, vdr.getPort());
- mac = getMacFromArpCache(ip);
- } catch (Exception ex) {
- message = ex.getLocalizedMessage();
- }
-
- return null;
- }
- }.execute();
- }
- });
-
- final FetchEditTextPreference ipEdit = (FetchEditTextPreference) findPreference(getString(R.string.vdr_host_key));
- String ip = vdr.getHost();
- ipEdit.setText(ip);
- ipEdit.setCompoundButtonListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
-
- new AsyncTask<Void, String, List<String>>() {
-
- ProgressDialog pd;
-
- String message;
-
- protected void onPreExecute() {
- pd = new ProgressDialog(VdrPreferencesActivity.this);
- pd.setMessage(getString(R.string.processing));
- pd.show();
- };
-
- protected void onPostExecute(final List<String> ips) {
- pd.dismiss();
- if (message != null) {
- Utils.say(VdrPreferencesActivity.this, message);
- return;
- }
-
- if (ips.isEmpty()) {
- Utils.say(VdrPreferencesActivity.this,
- R.string.no_results);
- return;
- }
- if (ips.size() == 1) {
- ipEdit.setEditText(ips.get(0).toString());
- } else {
- new AlertDialog.Builder(VdrPreferencesActivity.this)
- .setItems(
- ips.toArray(new CharSequence[] {}),
- new DialogInterface.OnClickListener() {
- @Override
- public void onClick(
- DialogInterface dialog,
- int which) {
- String ip = ips.get(which);
- ipEdit.setEditText(ip);
- }
- }).show();
- }
-
- }
-
- protected void onProgressUpdate(String... values) {
- pd.setMessage(getString(R.string.probing, values[0]));
- };
-
- @Override
- protected List<String> doInBackground(Void... params) {
- try {
-
- final int port = vdr.getPort();
- return DeviceManager.findVDRHosts(
- VdrPreferencesActivity.this, port,
- new DeviceManager.ProgressListener() {
-
- @Override
- public void publish(String currentIP) {
- publishProgress(currentIP);
- }
- });
-
- } catch (Exception ex) {
- message = ex.getLocalizedMessage();
- }
- return new ArrayList<String>(0);
- }
- }.execute();
-
- }
- });
-
- updateChildPreferences();
-
- findPreference(getString(R.string.timezone_key))
- .setOnPreferenceClickListener(this);
-
- }
-
- public void onSharedPreferenceChanged(SharedPreferences arg0, String key) {
- hasChanged = true;
- updateChildPreferences();
- Preference p = findPreference(key);
- updateSummary(p);
-
- if (key != null && key.equals("key_recstream_method")) {
- String recstream = pref.getString("key_recstream_method",
- "vdr-live");
- Preference pk = findPreference("key_live_port");
- if (recstream.equals("vdr-live") == false) {
-
- pk.setEnabled(false);
- // PreferenceCategory cat = (PreferenceCategory)
- // findPreference("key_streaming_category");
- // cat.removePreference(p);
- } else {
- pk.setEnabled(true);
- }
-
- if (recstream.equals("vdr-smarttvweb") == false) {
- p = findPreference("key_smarttvweb_port");
- p.setEnabled(false);
- p = findPreference("key_smarttvweb_recstream_method");
- p.setEnabled(false);
-
- } else {
- p = findPreference("key_smarttvweb_port");
- p.setEnabled(true);
- p = findPreference("key_smarttvweb_recstream_method");
- p.setEnabled(true);
-
- }
-
- // if(pk)
- // cat.addPreference(pk);
- // } else {
- // cat.removePreference(pk);
- // }
- }
-
- Preferences.reloadVDR(this);
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- pref.registerOnSharedPreferenceChangeListener(this);
- }
-
- @Override
- protected void onPause() {
- super.onPause();
- // Unregister the listener whenever a key changes
- pref.unregisterOnSharedPreferenceChangeListener(this);
- }
-
- private void enableWolPreferences() {
- Preference p = findPreference(getString(R.string.wakeup_wol_mac_key));
- if (p != null)
-
- p.setEnabled(true);
- p = findPreference(getString(R.string.wakeup_wol_custom_broadcast_key));
- if (p != null) {
- p.setEnabled(true);
- }
- }
-
- private void disableWolPreferences() {
- Preference p = findPreference(getString(R.string.wakeup_wol_mac_key));
- if (p != null)
- p.setEnabled(false);
-
- p = findPreference(getString(R.string.wakeup_wol_custom_broadcast_key));
- if (p != null)
- p.setEnabled(false);
-
- }
-
- private void disableWakeupUrlPreferences() {
- Preference p = findPreference(getString(R.string.wakeup_url_key));
- if (p != null) {
- p.setEnabled(false);
- }
- p = findPreference(getString(R.string.wakeup_password_key));
- if (p != null) {
- p.setEnabled(false);
- }
-
- p = findPreference(getString(R.string.wakeup_user_key));
- if (p != null) {
- p.setEnabled(false);
- }
- }
-
- private void enableWakeupUrlPrefenreces() {
- Preference p = findPreference(getString(R.string.wakeup_url_key));
- if (p != null) {
- p.setEnabled(true);
- }
-
- p = findPreference(getString(R.string.wakeup_password_key));
- if (p != null) {
- p.setEnabled(true);
- }
- p = findPreference(getString(R.string.wakeup_user_key));
- if (p != null) {
- p.setEnabled(true);
- }
- }
-
- private void updateChildPreferences() {
- String wakup = pref.getString(getString(R.string.wakeup_method_key),
- "wol");
-
- if (wakup.equals("url")) {
- disableWolPreferences();
- enableWakeupUrlPrefenreces();
- } else {// remote url
- disableWakeupUrlPreferences();
- enableWolPreferences();
- }
-
- for (String key : pref.getAll().keySet()) {
- Preference p = findPreference(key);
- updateSummary(p);
- }
-
- }
-
- @Override
- public void onBackPressed() {
- if (id != -1) {// no new devices
- setResult(RESULT_OK);
- finish();
- return;
- }
- if (isNew == true && hasChanged == false) {
- // if (pref.commits < 2) {// user has not changed anything
- DBAccess.get(this).getVdrDAO().delete(pref.getVdr());
- finish();
- return;
- }
- super.onBackPressed();
- }
-
- @Override
- public boolean onPreferenceClick(Preference preference) {
-
- String timezone = vdr.getServerTimeZone();
-
- Intent intent = new Intent(this, ZonePicker.class);
- intent.putExtra("current_tz", timezone);
- startActivityForResult(intent, REQUEST_CODE_PICK_A_TIME_ZONE);
- return true;
- }
-
-
-
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- if (resultCode != Activity.RESULT_OK) {
- super.onActivityResult(requestCode, resultCode, data);
- return;
- }
-
- // never mind, onResume also registers this, but the listenres are held
- // in a map (as key) so that no double occurance
- pref.registerOnSharedPreferenceChangeListener(this);
-
- if (requestCode == REQUEST_CODE_PICK_A_TIME_ZONE) {
- String ntz = data.getStringExtra("new_tz");
- if (ntz != null) {
- vdr.setServerTimeZone(ntz);
- Editor editor = findPreference("key_timezone").getEditor();
- editor.putString("key_timezone", ntz);
- editor.commit();
- // setSummary(ntz, );
- }
- }
- }
+ OnSharedPreferenceChangeListener, OnPreferenceClickListener {
+
+ public static final int REQUEST_CODE_PICK_A_TIME_ZONE = 1;
+
+ Vdr vdr;
+
+ VdrSharedPreferencesImpl pref;
+
+ int id = -1;
+
+ @Override
+ public SharedPreferences getSharedPreferences(String name, int mode) {
+ return this.pref;
+ }
+
+ @Override
+ public Preference findPreference(CharSequence key) {
+ return super.findPreference(key);
+ }
+
+ @Override
+ protected void updateSummary(Preference ep) {
+ if (ep.getKey().equals("key_timezone")) {
+ String text = vdr.getServerTimeZone();
+ if (text == null) {
+ return;
+ }
+ setSummary(text, ep);
+ return;
+ }
+ super.updateSummary(ep);
+ }
+
+ private boolean isNew = false;
+
+ private boolean hasChanged = false;
+
+ private void initVDRInstance() {
+ id = getIntent().getIntExtra(Intents.VDR_ID, -1);
+ if (id == -1) {// new vdr
+ vdr = new Vdr();
+ isNew = true;
+ } else {// edit
+ Vdr v = DBAccess.get(this).getVdrDAO().queryForId(id);
+ if (v != null) {
+ vdr = v;
+ } else {
+ vdr = new Vdr();
+ id = -1;
+ isNew = true;
+ }
+ }
+ pref = new VdrSharedPreferencesImpl(vdr, DBAccess.get(this).getVdrDAO());
+ }
+
+ public static String ARP_CACHE = "/proc/net/arp";
+
+ /**
+ * return mac address as a string.
+ *
+ * @param ip
+ * @return
+ */
+ public static String getMacFromArpCache(String ip) {
+
+ if (ip == null) {
+ return null;
+ }
+
+ BufferedReader br = null;
+
+ try {
+ br = new BufferedReader(new FileReader(ARP_CACHE));
+
+ String line;
+
+ while ((line = br.readLine()) != null) {
+ String[] values = line.split("\\s+");
+ if (values != null && values.length >= 4
+ && ip.equals(values[0])) {
+ // format check
+ String mac = values[3];
+ if (mac.matches("..:..:..:..:..:..")) {
+ return mac;
+ } else {
+ return null;
+ }
+ }
+ }
+ } catch (Exception e) {
+
+ } finally {
+ try {
+ br.close();
+ } catch (IOException e) {
+
+ }
+ }
+ return null;
+ }
+
+ // private String getIp() throws Exception {
+ // final Preferences prefs = Preferences.get();
+ // String host = prefs.getSvdrpHost();
+ // return InetAddress.getByName(host).getHostAddress();
+ // }
+
+ private void ping(String ip, int port) throws Exception {
+ Socket socket = new Socket();
+ socket.connect(new InetSocketAddress(ip, port), 5 * 1000);
+ socket.setSoTimeout(5 * 1000);
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+
+ super.onCreate(savedInstanceState);
+ Thread.setDefaultUncaughtExceptionHandler(VdrManagerExceptionHandler.get(this,
+ Thread.getDefaultUncaughtExceptionHandler()));
+ initVDRInstance();
+
+ this.addPreferencesFromResource(R.xml.vdr_prefs);
+
+ // this.getPreferenceManager().setSharedPreferencesName(Preferences.getPreferenceFile(this));
+
+ pref.registerOnSharedPreferenceChangeListener(this);
+
+ String recstream = pref.getString("key_recstream_method", "vdr-live");
+
+ if (recstream.equals("vdr-live") == false) {
+ Preference p = findPreference("key_live_port");
+ p.setEnabled(false);
+ // PreferenceCategory cat = (PreferenceCategory)
+ // findPreference("key_streaming_category");
+ // cat.removePreference(p);
+ }
+
+ if (recstream.equals("vdr-smarttvweb") == false) {
+ Preference p = findPreference("key_smarttvweb_port");
+ p.setEnabled(false);
+ p = findPreference("key_smarttvweb_recstream_method");
+ p.setEnabled(false);
+
+ }
+
+ // create background task
+
+ // start task
+
+ final FetchEditTextPreference macedit = (FetchEditTextPreference) findPreference(getString(R.string.wakeup_wol_mac_key));
+ String mac = vdr.getMac();
+ if (mac == null) {
+ mac = "";
+ }
+ macedit.setText(mac);
+ macedit.setCompoundButtonListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ final String host = vdr.getHost();
+ if (host == null) {
+ Utils.say(VdrPreferencesActivity.this,
+ getString(R.string.vdr_host_not_defined));
+ return;
+ }
+
+ new VoidAsyncTask() {
+
+ ProgressDialog pd;
+
+ private String mac;
+
+ String message;
+
+ protected void onPreExecute() {
+ pd = new ProgressDialog(VdrPreferencesActivity.this);
+ pd.setMessage(getString(R.string.processing));
+ pd.show();
+ }
+
+ ;
+
+ protected void onPostExecute(Void result) {
+ pd.dismiss();
+ if (message != null) {
+ Utils.say(VdrPreferencesActivity.this, message);
+ return;
+ }
+ macedit.setEditText(mac);
+ }
+
+ ;
+
+ @Override
+ protected Void doInBackground(Void... params) {
+ try {
+ String ip = InetAddress.getByName(host)
+ .getHostAddress();
+ ping(ip, vdr.getPort());
+ mac = getMacFromArpCache(ip);
+ } catch (Exception ex) {
+ message = ex.getLocalizedMessage();
+ }
+
+ return null;
+ }
+ }.execute();
+ }
+ });
+
+ final FetchEditTextPreference ipEdit = (FetchEditTextPreference) findPreference(getString(R.string.vdr_host_key));
+ String ip = vdr.getHost();
+ ipEdit.setText(ip);
+ ipEdit.setCompoundButtonListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+
+ new AsyncTask<Void, String, List<String>>() {
+
+ ProgressDialog pd;
+
+ String message;
+
+ protected void onPreExecute() {
+ pd = new ProgressDialog(VdrPreferencesActivity.this);
+ pd.setMessage(getString(R.string.processing));
+ pd.show();
+ }
+
+ ;
+
+ protected void onPostExecute(final List<String> ips) {
+ pd.dismiss();
+ if (message != null) {
+ Utils.say(VdrPreferencesActivity.this, message);
+ return;
+ }
+
+ if (ips.isEmpty()) {
+ Utils.say(VdrPreferencesActivity.this,
+ R.string.no_results);
+ return;
+ }
+ if (ips.size() == 1) {
+ ipEdit.setEditText(ips.get(0).toString());
+ } else {
+ new AlertDialog.Builder(VdrPreferencesActivity.this)
+ .setItems(
+ ips.toArray(new CharSequence[]{}),
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(
+ DialogInterface dialog,
+ int which) {
+ String ip = ips.get(which);
+ ipEdit.setEditText(ip);
+ }
+ }).show();
+ }
+
+ }
+
+ protected void onProgressUpdate(String... values) {
+ pd.setMessage(getString(R.string.probing, values[0]));
+ }
+
+ ;
+
+ @Override
+ protected List<String> doInBackground(Void... params) {
+ try {
+
+ final int port = vdr.getPort();
+ return DeviceManager.findVDRHosts(
+ VdrPreferencesActivity.this, port,
+ new DeviceManager.ProgressListener() {
+
+ @Override
+ public void publish(String currentIP) {
+ publishProgress(currentIP);
+ }
+ });
+
+ } catch (Exception ex) {
+ message = ex.getLocalizedMessage();
+ }
+ return new ArrayList<String>(0);
+ }
+ }.execute();
+
+ }
+ });
+
+ updateChildPreferences();
+
+ findPreference(getString(R.string.timezone_key))
+ .setOnPreferenceClickListener(this);
+
+ }
+
+ public void onSharedPreferenceChanged(SharedPreferences arg0, String key) {
+ hasChanged = true;
+ updateChildPreferences();
+ Preference p = findPreference(key);
+ updateSummary(p);
+
+ if (key != null && key.equals("key_recstream_method")) {
+ String recstream = pref.getString("key_recstream_method",
+ "vdr-live");
+ Preference pk = findPreference("key_live_port");
+ if (recstream.equals("vdr-live") == false) {
+
+ pk.setEnabled(false);
+ // PreferenceCategory cat = (PreferenceCategory)
+ // findPreference("key_streaming_category");
+ // cat.removePreference(p);
+ } else {
+ pk.setEnabled(true);
+ }
+
+ if (recstream.equals("vdr-smarttvweb") == false) {
+ p = findPreference("key_smarttvweb_port");
+ p.setEnabled(false);
+ p = findPreference("key_smarttvweb_recstream_method");
+ p.setEnabled(false);
+
+ } else {
+ p = findPreference("key_smarttvweb_port");
+ p.setEnabled(true);
+ p = findPreference("key_smarttvweb_recstream_method");
+ p.setEnabled(true);
+
+ }
+
+ // if(pk)
+ // cat.addPreference(pk);
+ // } else {
+ // cat.removePreference(pk);
+ // }
+ }
+
+ Preferences.reloadVDR(this);
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ pref.registerOnSharedPreferenceChangeListener(this);
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ // Unregister the listener whenever a key changes
+ pref.unregisterOnSharedPreferenceChangeListener(this);
+ }
+
+ private void enableWolPreferences() {
+ Preference p = findPreference(getString(R.string.wakeup_wol_mac_key));
+ if (p != null)
+
+ p.setEnabled(true);
+ p = findPreference(getString(R.string.wakeup_wol_custom_broadcast_key));
+ if (p != null) {
+ p.setEnabled(true);
+ }
+ }
+
+ private void disableWolPreferences() {
+ Preference p = findPreference(getString(R.string.wakeup_wol_mac_key));
+ if (p != null)
+ p.setEnabled(false);
+
+ p = findPreference(getString(R.string.wakeup_wol_custom_broadcast_key));
+ if (p != null)
+ p.setEnabled(false);
+
+ }
+
+ private void disableWakeupUrlPreferences() {
+ Preference p = findPreference(getString(R.string.wakeup_url_key));
+ if (p != null) {
+ p.setEnabled(false);
+ }
+ p = findPreference(getString(R.string.wakeup_password_key));
+ if (p != null) {
+ p.setEnabled(false);
+ }
+
+ p = findPreference(getString(R.string.wakeup_user_key));
+ if (p != null) {
+ p.setEnabled(false);
+ }
+ }
+
+ private void enableWakeupUrlPrefenreces() {
+ Preference p = findPreference(getString(R.string.wakeup_url_key));
+ if (p != null) {
+ p.setEnabled(true);
+ }
+
+ p = findPreference(getString(R.string.wakeup_password_key));
+ if (p != null) {
+ p.setEnabled(true);
+ }
+ p = findPreference(getString(R.string.wakeup_user_key));
+ if (p != null) {
+ p.setEnabled(true);
+ }
+ }
+
+ private void updateChildPreferences() {
+ String wakup = pref.getString(getString(R.string.wakeup_method_key),
+ "wol");
+
+ if (wakup.equals("url")) {
+ disableWolPreferences();
+ enableWakeupUrlPrefenreces();
+ } else {// remote url
+ disableWakeupUrlPreferences();
+ enableWolPreferences();
+ }
+
+ for (String key : pref.getAll().keySet()) {
+ Preference p = findPreference(key);
+ if (p == null) {
+ continue;
+ }
+ updateSummary(p);
+ }
+
+ }
+
+ @Override
+ public void onBackPressed() {
+ if (id != -1) {// no new devices
+ setResult(RESULT_OK);
+ finish();
+ return;
+ }
+ if (isNew == true && hasChanged == false) {
+ // if (pref.commits < 2) {// user has not changed anything
+ DBAccess.get(this).getVdrDAO().delete(pref.getVdr());
+ finish();
+ return;
+ }
+ super.onBackPressed();
+ }
+
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+
+ String timezone = vdr.getServerTimeZone();
+
+ Intent intent = new Intent(this, ZonePicker.class);
+ intent.putExtra("current_tz", timezone);
+ startActivityForResult(intent, REQUEST_CODE_PICK_A_TIME_ZONE);
+ return true;
+ }
+
+
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ if (resultCode != Activity.RESULT_OK) {
+ super.onActivityResult(requestCode, resultCode, data);
+ return;
+ }
+
+ // never mind, onResume also registers this, but the listenres are held
+ // in a map (as key) so that no double occurance
+ pref.registerOnSharedPreferenceChangeListener(this);
+
+ if (requestCode == REQUEST_CODE_PICK_A_TIME_ZONE) {
+ String ntz = data.getStringExtra("new_tz");
+ if (ntz != null) {
+ vdr.setServerTimeZone(ntz);
+ Editor editor = findPreference("key_timezone").getEditor();
+ editor.putString("key_timezone", ntz);
+ editor.commit();
+ // setSummary(ntz, );
+ }
+ }
+ }
}
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/colorpicker/ColorPickerDialog.java b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/colorpicker/ColorPickerDialog.java
new file mode 100644
index 0000000..37fa552
--- /dev/null
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/colorpicker/ColorPickerDialog.java
@@ -0,0 +1,502 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package de.bjusystems.vdrmanager.gui.colorpicker;
+
+import android.app.Dialog;
+import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.BlurMaskFilter;
+import android.graphics.BlurMaskFilter.Blur;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.ColorFilter;
+import android.graphics.Paint;
+import android.graphics.Paint.Style;
+import android.graphics.PixelFormat;
+import android.graphics.Rect;
+import android.graphics.RectF;
+import android.graphics.Shader;
+import android.graphics.SweepGradient;
+import android.graphics.Typeface;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.os.SystemClock;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.util.StateSet;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.animation.Animation;
+import android.view.animation.AnimationUtils;
+import android.view.animation.DecelerateInterpolator;
+import android.view.animation.Transformation;
+import android.widget.EditText;
+import android.widget.LinearLayout;
+import android.widget.SeekBar;
+import android.widget.TextView;
+
+import de.bjusystems.vdrmanager.R;
+
+public class ColorPickerDialog extends Dialog {
+ private static int CENTER_X = 100;
+ private static int CENTER_Y = 100;
+ private static int CENTER_RADIUS = 32;
+
+ public interface OnColorChangedListener {
+ void colorChanged(int color);
+ }
+
+ private OnColorChangedListener mListener;
+
+ private int mInitialColor;
+
+ public int lastColor = 0;
+
+ public void setOnColorChangedListener(OnColorChangedListener listener){
+ mListener = listener;
+ };
+
+
+ private class ColorPickerView extends View {
+ private Paint mPaint;
+ private Paint mCenterPaint;
+ private final int[] mColors;
+ private OnColorChangedListener mListener;
+
+ ColorPickerView(Context c, OnColorChangedListener l, int color) {
+ super(c);
+ mListener = l;
+ lastColor = color;
+ mColors = new int[] {
+ 0xFFFF0000, 0xFFFF00FF, 0xFF0000FF, 0xFF00FFFF, 0xFF00FF00,
+ 0xFFFFFF00, 0xFFFFFFFF, 0xFF808080, 0xFF000000, 0xFFFF0000
+ };
+ Shader s = new SweepGradient(0, 0, mColors, null);
+
+ mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ mPaint.setShader(s);
+ mPaint.setStyle(Style.STROKE);
+ mPaint.setStrokeWidth(CENTER_RADIUS);
+
+ mCenterPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ mCenterPaint.setColor(color);
+ mCenterPaint.setStrokeWidth(5);
+ }
+
+ private boolean mTrackingCenter;
+ private boolean mHighlightCenter;
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ float r = CENTER_X - mPaint.getStrokeWidth()*0.8f;
+
+ canvas.translate(CENTER_X, CENTER_X);
+
+ canvas.drawOval(new RectF(-r, -r, r, r), mPaint);
+ canvas.drawCircle(0, 0, CENTER_RADIUS, mCenterPaint);
+
+ if (mTrackingCenter) {
+ int c = mCenterPaint.getColor();
+ mCenterPaint.setStyle(Style.STROKE);
+
+ if (mHighlightCenter) {
+ mCenterPaint.setAlpha(0xFF);
+ } else {
+ mCenterPaint.setAlpha(0x80);
+ }
+ canvas.drawCircle(0, 0,
+ CENTER_RADIUS + mCenterPaint.getStrokeWidth(),
+ mCenterPaint);
+
+ mCenterPaint.setStyle(Style.FILL);
+ mCenterPaint.setColor(c);
+ }
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ setMeasuredDimension(CENTER_X*2, CENTER_Y*2);
+ }
+
+ public void setCenterColor(int color) {
+ mCenterPaint.setColor(color);
+ invalidate();
+ }
+
+ public void setTransparency(int alpha) {
+ int color = mCenterPaint.getColor();
+ int newColor = Color.argb(alpha, Color.red(color), Color.green(color), Color.blue(color));
+ mCenterPaint.setColor(newColor);
+ mEditText.setText(convertToARGB(newColor));
+ invalidate();
+ }
+
+ private int ave(int s, int d, float p) {
+ return s + Math.round(p * (d - s));
+ }
+
+ private int interpColor(int colors[], float unit) {
+ if (unit <= 0) {
+ return colors[0];
+ }
+ if (unit >= 1) {
+ return colors[colors.length - 1];
+ }
+
+ float p = unit * (colors.length - 1);
+ int i = (int)p;
+ p -= i;
+
+ // now p is just the fractional part [0...1) and i is the index
+ int c0 = colors[i];
+ int c1 = colors[i+1];
+ int a = ave(Color.alpha(c0), Color.alpha(c1), p);
+ int r = ave(Color.red(c0), Color.red(c1), p);
+ int g = ave(Color.green(c0), Color.green(c1), p);
+ int b = ave(Color.blue(c0), Color.blue(c1), p);
+
+ return Color.argb(a, r, g, b);
+ }
+
+ private static final float PI = 3.1415926f;
+
+ @Override
+ public boolean onTouchEvent(MotionEvent event) {
+ float x = event.getX() - CENTER_X;
+ float y = event.getY() - CENTER_Y;
+ boolean inCenter = Math.sqrt(x*x + y*y) <= CENTER_RADIUS;
+
+ switch (event.getAction()) {
+ case MotionEvent.ACTION_DOWN:
+ mTrackingCenter = inCenter;
+ if (inCenter) {
+ mHighlightCenter = true;
+ invalidate();
+ break;
+ }
+ case MotionEvent.ACTION_MOVE:
+ if (mTrackingCenter) {
+ if (mHighlightCenter != inCenter) {
+ mHighlightCenter = inCenter;
+ invalidate();
+ }
+ } else {
+ float angle = (float) Math.atan2(y, x);
+ // need to turn angle [-PI ... PI] into unit [0....1]
+ float unit = angle/(2*PI);
+ if (unit < 0) {
+ unit += 1;
+ }
+ int color = interpColor(mColors, unit);
+ mCenterPaint.setColor(color);
+ mEditText.setText(convertToARGB(color));
+ invalidate();
+ }
+ break;
+ case MotionEvent.ACTION_UP:
+ if (mTrackingCenter) {
+ if (inCenter) {
+ mListener.colorChanged(mCenterPaint.getColor());
+ lastColor = mCenterPaint.getColor();
+ }
+ mTrackingCenter = false; // so we draw w/o halo
+ invalidate();
+ }
+ break;
+ }
+ return true;
+ }
+ }
+
+ private String convertToARGB(int color) {
+ String alpha = Integer.toHexString(Color.alpha(color));
+ String red = Integer.toHexString(Color.red(color));
+ String green = Integer.toHexString(Color.green(color));
+ String blue = Integer.toHexString(Color.blue(color));
+
+ if (alpha.length() == 1) {
+ alpha = "0" + alpha;
+ }
+
+ if (red.length() == 1) {
+ red = "0" + red;
+ }
+
+ if (green.length() == 1) {
+ green = "0" + green;
+ }
+
+ if (blue.length() == 1) {
+ blue = "0" + blue;
+ }
+
+ return "#" + alpha + red + green + blue;
+ }
+
+ private int convertToColorInt(String argb) throws NumberFormatException {
+
+ int alpha = -1, red = -1, green = -1, blue = -1;
+
+ if (argb.length() == 8) {
+ alpha = Integer.parseInt(argb.substring(0, 2), 16);
+ red = Integer.parseInt(argb.substring(2, 4), 16);
+ green = Integer.parseInt(argb.substring(4, 6), 16);
+ blue = Integer.parseInt(argb.substring(6, 8), 16);
+ }
+ else if (argb.length() == 6) {
+ alpha = 255;
+ red = Integer.parseInt(argb.substring(0, 2), 16);
+ green = Integer.parseInt(argb.substring(2, 4), 16);
+ blue = Integer.parseInt(argb.substring(4, 6), 16);
+ }
+
+ return Color.argb(alpha, red, green, blue);
+ }
+
+ private Context mContext;
+ private EditText mEditText;
+ private ColorPickerView mColorPickerView;
+ private SeekBar mTransparencyBar;
+
+ public ColorPickerDialog(Context context, OnColorChangedListener listener, int initialColor) {
+ super(context);
+ mContext = context;
+ mListener = listener;
+ mInitialColor = initialColor;
+ CENTER_Y=CENTER_X=context.getResources().getDimensionPixelSize(R.dimen.color_picker_center);
+ CENTER_RADIUS=context.getResources().getDimensionPixelSize(R.dimen.color_picker_radius);
+ }
+
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ LinearLayout layout = new LinearLayout(mContext);
+ layout.setOrientation(LinearLayout.VERTICAL);
+ layout.setGravity(android.view.Gravity.CENTER);
+
+ LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,
+ LinearLayout.LayoutParams.WRAP_CONTENT);
+ layoutParams.setMargins(10, 0, 10, 5);
+
+ TextView tv = new TextView(mContext);
+ tv.setText(mContext.getString(R.string.pref_dialog_message_color_picker));
+ layout.addView(tv, layoutParams);
+
+ mColorPickerView = new ColorPickerView(getContext(), onColorChangedListener, mInitialColor);
+ layout.addView(mColorPickerView, layoutParams);
+
+ mTransparencyBar = new SeekBar(mContext);
+ mTransparencyBar.setMax(255);
+ mTransparencyBar.setProgressDrawable(new TextSeekBarDrawable(mContext.getResources(), mContext.getString(R.string.pref_dialog_color_picker_alpha), true));
+ mTransparencyBar.setProgress(Color.alpha(mInitialColor));
+ mTransparencyBar.setOnSeekBarChangeListener(onTransparencyChangedListener);
+ layout.addView(mTransparencyBar, layoutParams);
+
+ mEditText = new EditText(mContext);
+ mEditText.addTextChangedListener(mEditTextListener);
+ mEditText.setText(convertToARGB(mInitialColor));
+ layout.addView(mEditText, layoutParams);
+
+ setContentView(layout);
+ setTitle(mContext.getString(R.string.pref_dialog_title_color_picker));
+ }
+
+ private OnColorChangedListener onColorChangedListener = new OnColorChangedListener() {
+ public void colorChanged(int color) {
+ mListener.colorChanged(color);
+ lastColor = color;
+ dismiss();
+ }
+ };
+
+ private SeekBar.OnSeekBarChangeListener onTransparencyChangedListener = new SeekBar.OnSeekBarChangeListener() {
+
+ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
+ mColorPickerView.setTransparency(progress);
+ }
+
+ public void onStartTrackingTouch(SeekBar seekBar) {
+ }
+
+ public void onStopTrackingTouch(SeekBar seekBar) {
+ }
+ };
+
+ private TextWatcher mEditTextListener = new TextWatcher() {
+
+ public void afterTextChanged(Editable s) {
+ }
+
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+ }
+
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
+ try {
+ String s2 = (s.toString()).replace("#", "");
+ if (s2.length() == 6 || s2.length() == 8) {
+ int color = convertToColorInt(s2);
+ mColorPickerView.setCenterColor(color);
+ mTransparencyBar.setProgress(Color.alpha(color));
+ }
+ }
+ catch (NumberFormatException e) {
+ }
+ }
+ };
+
+ //Source: http://www.anddev.org/announce_color_picker_dialog-t10771.html
+ static final int[] STATE_FOCUSED = {android.R.attr.state_focused};
+ static final int[] STATE_PRESSED = {android.R.attr.state_pressed};
+
+ static class TextSeekBarDrawable extends Drawable implements Runnable {
+
+ private static final long DELAY = 50;
+ private String mText;
+ private Drawable mProgress;
+ private Paint mPaint;
+ private Paint mOutlinePaint;
+ private float mTextWidth;
+ private boolean mActive;
+ private float mTextXScale;
+ private int mDelta;
+ private ScrollAnimation mAnimation;
+
+ public TextSeekBarDrawable(Resources res, String label, boolean labelOnRight) {
+ mText = label;
+ mProgress = res.getDrawable(android.R.drawable.progress_horizontal);
+ mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ mPaint.setTypeface(Typeface.DEFAULT_BOLD);
+ mPaint.setTextSize(16);
+ mPaint.setColor(0xff000000);
+ mOutlinePaint = new Paint(mPaint);
+ mOutlinePaint.setStyle(Style.STROKE);
+ mOutlinePaint.setStrokeWidth(3);
+ mOutlinePaint.setColor(0xbbffc300);
+ mOutlinePaint.setMaskFilter(new BlurMaskFilter(1, Blur.NORMAL));
+ mTextWidth = mOutlinePaint.measureText(mText);
+ mTextXScale = labelOnRight? 1 : 0;
+ mAnimation = new ScrollAnimation();
+ }
+
+ @Override
+ protected void onBoundsChange(Rect bounds) {
+ mProgress.setBounds(bounds);
+ }
+
+ @Override
+ protected boolean onStateChange(int[] state) {
+ mActive = StateSet.stateSetMatches(STATE_FOCUSED, state) | StateSet.stateSetMatches(STATE_PRESSED, state);
+ invalidateSelf();
+ return false;
+ }
+
+ @Override
+ public boolean isStateful() {
+ return true;
+ }
+
+ @Override
+ protected boolean onLevelChange(int level) {
+// Log.d(TAG, "onLevelChange " + level);
+ if (level < 4000 && mDelta <= 0) {
+// Log.d(TAG, "onLevelChange scheduleSelf ++");
+ mDelta = 1;
+ mAnimation.startScrolling(mTextXScale, 1);
+ scheduleSelf(this, SystemClock.uptimeMillis() + DELAY);
+ } else
+ if (level > 6000 && mDelta >= 0) {
+// Log.d(TAG, "onLevelChange scheduleSelf --");
+ mDelta = -1;
+ mAnimation.startScrolling(mTextXScale, 0);
+ scheduleSelf(this, SystemClock.uptimeMillis() + DELAY);
+ }
+ return mProgress.setLevel(level);
+ }
+
+ @Override
+ public void draw(Canvas canvas) {
+ mProgress.draw(canvas);
+
+ if (mAnimation.hasStarted() && !mAnimation.hasEnded()) {
+ // pending animation
+ mAnimation.getTransformation(AnimationUtils.currentAnimationTimeMillis(), null);
+ mTextXScale = mAnimation.getCurrent();
+// Log.d(TAG, "draw " + mTextX + " " + SystemClock.uptimeMillis());
+ }
+
+ Rect bounds = getBounds();
+ float x = 6 + mTextXScale * (bounds.width() - mTextWidth - 6 - 6);
+ float y = (bounds.height() + mPaint.getTextSize()) / 2;
+ mOutlinePaint.setAlpha(mActive? 255 : 255 / 2);
+ mPaint.setAlpha(mActive? 255 : 255 / 2);
+ canvas.drawText(mText, x, y, mOutlinePaint);
+ canvas.drawText(mText, x, y, mPaint);
+ }
+
+ @Override
+ public int getOpacity() {
+ return PixelFormat.TRANSLUCENT;
+ }
+
+ @Override
+ public void setAlpha(int alpha) {
+ }
+
+ @Override
+ public void setColorFilter(ColorFilter cf) {
+ }
+
+ public void run() {
+ mAnimation.getTransformation(AnimationUtils.currentAnimationTimeMillis(), null);
+ // close interpolation of mTextX
+ mTextXScale = mAnimation.getCurrent();
+ if (!mAnimation.hasEnded()) {
+ scheduleSelf(this, SystemClock.uptimeMillis() + DELAY);
+ }
+ invalidateSelf();
+// Log.d(TAG, "run " + mTextX + " " + SystemClock.uptimeMillis());
+ }
+ }
+
+ static class ScrollAnimation extends Animation {
+ private static final long DURATION = 750;
+ private float mFrom;
+ private float mTo;
+ private float mCurrent;
+
+ public ScrollAnimation() {
+ setDuration(DURATION);
+ setInterpolator(new DecelerateInterpolator());
+ }
+
+ public void startScrolling(float from, float to) {
+ mFrom = from;
+ mTo = to;
+ startNow();
+ }
+
+ @Override
+ protected void applyTransformation(float interpolatedTime, Transformation t) {
+ mCurrent = mFrom + (mTo - mFrom) * interpolatedTime;
+// Log.d(TAG, "applyTransformation " + mCurrent);
+ }
+
+ public float getCurrent() {
+ return mCurrent;
+ }
+ }
+}
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/colorpicker/ColorPickerPreference.java b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/colorpicker/ColorPickerPreference.java
new file mode 100644
index 0000000..441e9c3
--- /dev/null
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/colorpicker/ColorPickerPreference.java
@@ -0,0 +1,637 @@
+package de.bjusystems.vdrmanager.gui.colorpicker;
+
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.res.Resources;
+import android.graphics.BlurMaskFilter;
+import android.graphics.BlurMaskFilter.Blur;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.ColorFilter;
+import android.graphics.ColorMatrix;
+import android.graphics.Paint;
+import android.graphics.Paint.Style;
+import android.graphics.PixelFormat;
+import android.graphics.Rect;
+import android.graphics.RectF;
+import android.graphics.Shader;
+import android.graphics.SweepGradient;
+import android.graphics.Typeface;
+import android.graphics.drawable.Drawable;
+import android.os.SystemClock;
+import android.preference.DialogPreference;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.util.AttributeSet;
+import android.util.StateSet;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.animation.Animation;
+import android.view.animation.AnimationUtils;
+import android.view.animation.DecelerateInterpolator;
+import android.view.animation.Transformation;
+import android.widget.CheckBox;
+import android.widget.EditText;
+import android.widget.LinearLayout;
+import android.widget.SeekBar;
+import android.widget.TextView;
+
+/**
+ * Color Picker dialog as DialogPreference
+ * @author lado
+ *
+ */
+public class ColorPickerPreference extends DialogPreference {
+
+ public static interface OnColorChangedListener {
+ void colorChanged(int color);
+ }
+
+ //private OnColorChangedListener mListener;
+ private int mInitialColor;
+
+ //private int color;
+
+ private class ColorPickerView extends View {
+ private Paint mPaint;
+ private Paint mCenterPaint;
+ private final int[] mColors;
+ private ColorPickerPreference dialog;
+ //private OnColorChangedListener mListener;
+
+ ColorPickerView(final ColorPickerPreference d,// OnColorChangedListener l,
+ int color) {
+ super(d.getContext());
+ dialog = d;
+ //mListener = l;
+ mColors = new int[] { 0xFFFF0000, 0xFFFF00FF, 0xFF0000FF,
+ 0xFF00FFFF, 0xFF00FF00, 0xFFFFFF00, 0xFFFFFFFF, 0xFF808080,
+ 0xFF000000, 0xFFFF0000 };
+ Shader s = new SweepGradient(0, 0, mColors, null);
+
+ mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ mPaint.setShader(s);
+ mPaint.setStyle(Style.STROKE);
+ mPaint.setStrokeWidth(32);
+
+ mCenterPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ mCenterPaint.setColor(color);
+ mCenterPaint.setStrokeWidth(5);
+ }
+
+ private boolean mTrackingCenter;
+ private boolean mHighlightCenter;
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ float r = CENTER_X - mPaint.getStrokeWidth() * 0.5f;
+
+ canvas.translate(CENTER_X, CENTER_X);
+
+ canvas.drawOval(new RectF(-r, -r, r, r), mPaint);
+ canvas.drawCircle(0, 0, CENTER_RADIUS, mCenterPaint);
+
+ if (mTrackingCenter) {
+ int c = mCenterPaint.getColor();
+ mCenterPaint.setStyle(Style.STROKE);
+
+ if (mHighlightCenter) {
+ mCenterPaint.setAlpha(0xFF);
+ } else {
+ mCenterPaint.setAlpha(0x80);
+ }
+ canvas.drawCircle(0, 0,
+ CENTER_RADIUS + mCenterPaint.getStrokeWidth(),
+ mCenterPaint);
+
+ mCenterPaint.setStyle(Style.FILL);
+ mCenterPaint.setColor(c);
+ }
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ setMeasuredDimension(CENTER_X * 2, CENTER_Y * 2);
+ }
+
+ private static final int CENTER_X = 100;
+ private static final int CENTER_Y = 100;
+ private static final int CENTER_RADIUS = 32;
+
+ private int floatToByte(float x) {
+ int n = Math.round(x);
+ return n;
+ }
+
+ private int pinToByte(int n) {
+ if (n < 0) {
+ n = 0;
+ } else if (n > 255) {
+ n = 255;
+ }
+ return n;
+ }
+
+ public void setCenterColor(int color) {
+ mCenterPaint.setColor(color);
+ invalidate();
+ }
+
+ public void setTransparency(int alpha) {
+ int color = mCenterPaint.getColor();
+ int newColor = Color.argb(alpha, Color.red(color),
+ Color.green(color), Color.blue(color));
+ mCenterPaint.setColor(newColor);
+ mEditText.setText(convertToARGB(newColor));
+ invalidate();
+ }
+
+ private int ave(int s, int d, float p) {
+ return s + Math.round(p * (d - s));
+ }
+
+ private int interpColor(int colors[], float unit) {
+ if (unit <= 0) {
+ return colors[0];
+ }
+ if (unit >= 1) {
+ return colors[colors.length - 1];
+ }
+
+ float p = unit * (colors.length - 1);
+ int i = (int) p;
+ p -= i;
+
+ // now p is just the fractional part [0...1) and i is the index
+ int c0 = colors[i];
+ int c1 = colors[i + 1];
+ int a = ave(Color.alpha(c0), Color.alpha(c1), p);
+ int r = ave(Color.red(c0), Color.red(c1), p);
+ int g = ave(Color.green(c0), Color.green(c1), p);
+ int b = ave(Color.blue(c0), Color.blue(c1), p);
+
+ return Color.argb(a, r, g, b);
+ }
+
+ private int rotateColor(int color, float rad) {
+ float deg = rad * 180 / 3.1415927f;
+ int r = Color.red(color);
+ int g = Color.green(color);
+ int b = Color.blue(color);
+
+ ColorMatrix cm = new ColorMatrix();
+ ColorMatrix tmp = new ColorMatrix();
+
+ cm.setRGB2YUV();
+ tmp.setRotate(0, deg);
+ cm.postConcat(tmp);
+ tmp.setYUV2RGB();
+ cm.postConcat(tmp);
+
+ final float[] a = cm.getArray();
+
+ int ir = floatToByte(a[0] * r + a[1] * g + a[2] * b);
+ int ig = floatToByte(a[5] * r + a[6] * g + a[7] * b);
+ int ib = floatToByte(a[10] * r + a[11] * g + a[12] * b);
+
+ return Color.argb(Color.alpha(color), pinToByte(ir), pinToByte(ig),
+ pinToByte(ib));
+ }
+
+ private static final float PI = 3.1415926f;
+
+ @Override
+ public boolean onTouchEvent(MotionEvent event) {
+ float x = event.getX() - CENTER_X;
+ float y = event.getY() - CENTER_Y;
+ boolean inCenter = Math.sqrt(x * x + y * y) <= CENTER_RADIUS;
+
+ switch (event.getAction()) {
+ case MotionEvent.ACTION_DOWN:
+ mTrackingCenter = inCenter;
+ if (inCenter) {
+ mHighlightCenter = true;
+ invalidate();
+ break;
+ }
+ case MotionEvent.ACTION_MOVE:
+ if (mTrackingCenter) {
+ if (mHighlightCenter != inCenter) {
+ mHighlightCenter = inCenter;
+ invalidate();
+ }
+ } else {
+ float angle = (float) Math.atan2(y, x);
+ // need to turn angle [-PI ... PI] into unit [0....1]
+ float unit = angle / (2 * PI);
+ if (unit < 0) {
+ unit += 1;
+ }
+ int color = interpColor(mColors, unit);
+ mCenterPaint.setColor(color);
+ mEditText.setText(convertToARGB(color));
+ invalidate();
+ }
+ break;
+ case MotionEvent.ACTION_UP:
+ if (mTrackingCenter) {
+ if (inCenter) {
+ //color = mCenterPaint.getColor();
+ dialog.onClick(dialog.getDialog(), DialogInterface.BUTTON_POSITIVE);
+ dialog.getDialog().dismiss();
+ }
+ mTrackingCenter = false; // so we draw w/o halo
+ invalidate();
+ }
+ break;
+ }
+ return true;
+ }
+ }
+
+ private String convertToARGB(int color) {
+ String alpha = Integer.toHexString(Color.alpha(color));
+ String red = Integer.toHexString(Color.red(color));
+ String green = Integer.toHexString(Color.green(color));
+ String blue = Integer.toHexString(Color.blue(color));
+
+ if (alpha.length() == 1) {
+ alpha = "0" + alpha;
+ }
+
+ if (red.length() == 1) {
+ red = "0" + red;
+ }
+
+ if (green.length() == 1) {
+ green = "0" + green;
+ }
+
+ if (blue.length() == 1) {
+ blue = "0" + blue;
+ }
+
+ return "#" + alpha + red + green + blue;
+ }
+
+ private int convertToColorInt(String argb) throws NumberFormatException {
+
+ int alpha = -1, red = -1, green = -1, blue = -1;
+
+ if (argb.length() == 8) {
+ alpha = Integer.parseInt(argb.substring(0, 2), 16);
+ red = Integer.parseInt(argb.substring(2, 4), 16);
+ green = Integer.parseInt(argb.substring(4, 6), 16);
+ blue = Integer.parseInt(argb.substring(6, 8), 16);
+ } else if (argb.length() == 6) {
+ alpha = 255;
+ red = Integer.parseInt(argb.substring(0, 2), 16);
+ green = Integer.parseInt(argb.substring(2, 4), 16);
+ blue = Integer.parseInt(argb.substring(4, 6), 16);
+ }
+
+ return Color.argb(alpha, red, green, blue);
+ }
+
+ //private Context mContext;
+ private EditText mEditText;
+ private ColorPickerView mColorPickerView;
+ private SeekBar mTransparencyBar;
+
+ // public ColorPickerDialog(Context context, OnColorChangedListener
+ // listener, int initialColor) {
+ //
+ // mContext = context;
+ // mListener = listener;
+ // mInitialColor = initialColor;
+ // }
+
+// private OnColorChangedListener onColorChangedListener = new OnColorChangedListener() {
+// public void colorChanged(int color) {
+// //mListener.colorChanged(color);
+// // dismiss();
+// }
+// };
+
+ private SeekBar.OnSeekBarChangeListener onTransparencyChangedListener = new SeekBar.OnSeekBarChangeListener() {
+
+ public void onProgressChanged(SeekBar seekBar, int progress,
+ boolean fromUser) {
+ mColorPickerView.setTransparency(progress);
+ }
+
+ public void onStartTrackingTouch(SeekBar seekBar) {
+ }
+
+ public void onStopTrackingTouch(SeekBar seekBar) {
+ }
+ };
+
+ private TextWatcher mEditTextListener = new TextWatcher() {
+
+ public void afterTextChanged(Editable s) {
+ }
+
+ public void beforeTextChanged(CharSequence s, int start, int count,
+ int after) {
+ }
+
+ public void onTextChanged(CharSequence s, int start, int before,
+ int count) {
+ try {
+ String s2 = (s.toString()).replace("#", "");
+ if (s2.length() == 6 || s2.length() == 8) {
+ int color = convertToColorInt(s2);
+ mColorPickerView.setCenterColor(color);
+ mTransparencyBar.setProgress(Color.alpha(color));
+ }
+ } catch (NumberFormatException e) {
+ }
+ }
+ };
+
+ // Source: http://www.anddev.org/announce_color_picker_dialog-t10771.html
+ static final int[] STATE_FOCUSED = { android.R.attr.state_focused };
+ static final int[] STATE_PRESSED = { android.R.attr.state_pressed };
+
+ static class TextSeekBarDrawable extends Drawable implements Runnable {
+
+ private static final String TAG = "TextSeekBarDrawable";
+ private static final long DELAY = 50;
+ private String mText;
+ private Drawable mProgress;
+ private Paint mPaint;
+ private Paint mOutlinePaint;
+ private float mTextWidth;
+ private boolean mActive;
+ private float mTextXScale;
+ private int mDelta;
+ private ScrollAnimation mAnimation;
+
+ public TextSeekBarDrawable(Resources res, String label,
+ boolean labelOnRight) {
+ mText = label;
+ mProgress = res.getDrawable(android.R.drawable.progress_horizontal);
+ mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ mPaint.setTypeface(Typeface.DEFAULT_BOLD);
+ mPaint.setTextSize(16);
+ mPaint.setColor(0xff000000);
+ mOutlinePaint = new Paint(mPaint);
+ mOutlinePaint.setStyle(Style.STROKE);
+ mOutlinePaint.setStrokeWidth(3);
+ mOutlinePaint.setColor(0xbbffc300);
+ mOutlinePaint.setMaskFilter(new BlurMaskFilter(1, Blur.NORMAL));
+ mTextWidth = mOutlinePaint.measureText(mText);
+ mTextXScale = labelOnRight ? 1 : 0;
+ mAnimation = new ScrollAnimation();
+ }
+
+ @Override
+ protected void onBoundsChange(Rect bounds) {
+ mProgress.setBounds(bounds);
+ }
+
+ @Override
+ protected boolean onStateChange(int[] state) {
+ mActive = StateSet.stateSetMatches(STATE_FOCUSED, state)
+ | StateSet.stateSetMatches(STATE_PRESSED, state);
+ invalidateSelf();
+ return false;
+ }
+
+ @Override
+ public boolean isStateful() {
+ return true;
+ }
+
+ @Override
+ protected boolean onLevelChange(int level) {
+ // Log.d(TAG, "onLevelChange " + level);
+ if (level < 4000 && mDelta <= 0) {
+ // Log.d(TAG, "onLevelChange scheduleSelf ++");
+ mDelta = 1;
+ mAnimation.startScrolling(mTextXScale, 1);
+ scheduleSelf(this, SystemClock.uptimeMillis() + DELAY);
+ } else if (level > 6000 && mDelta >= 0) {
+ // Log.d(TAG, "onLevelChange scheduleSelf --");
+ mDelta = -1;
+ mAnimation.startScrolling(mTextXScale, 0);
+ scheduleSelf(this, SystemClock.uptimeMillis() + DELAY);
+ }
+ return mProgress.setLevel(level);
+ }
+
+ @Override
+ public void draw(Canvas canvas) {
+ mProgress.draw(canvas);
+
+ if (mAnimation.hasStarted() && !mAnimation.hasEnded()) {
+ // pending animation
+ mAnimation.getTransformation(
+ AnimationUtils.currentAnimationTimeMillis(), null);
+ mTextXScale = mAnimation.getCurrent();
+ // Log.d(TAG, "draw " + mTextX + " " +
+ // SystemClock.uptimeMillis());
+ }
+
+ Rect bounds = getBounds();
+ float x = 6 + mTextXScale * (bounds.width() - mTextWidth - 6 - 6);
+ float y = (bounds.height() + mPaint.getTextSize()) / 2;
+ mOutlinePaint.setAlpha(mActive ? 255 : 255 / 2);
+ mPaint.setAlpha(mActive ? 255 : 255 / 2);
+ canvas.drawText(mText, x, y, mOutlinePaint);
+ canvas.drawText(mText, x, y, mPaint);
+ }
+
+ @Override
+ public int getOpacity() {
+ return PixelFormat.TRANSLUCENT;
+ }
+
+ @Override
+ public void setAlpha(int alpha) {
+ }
+
+ @Override
+ public void setColorFilter(ColorFilter cf) {
+ }
+
+ public void run() {
+ mAnimation.getTransformation(
+ AnimationUtils.currentAnimationTimeMillis(), null);
+ // close interpolation of mTextX
+ mTextXScale = mAnimation.getCurrent();
+ if (!mAnimation.hasEnded()) {
+ scheduleSelf(this, SystemClock.uptimeMillis() + DELAY);
+ }
+ invalidateSelf();
+ // Log.d(TAG, "run " + mTextX + " " + SystemClock.uptimeMillis());
+ }
+ }
+
+ static class ScrollAnimation extends Animation {
+ private static final String TAG = "ScrollAnimation";
+ private static final long DURATION = 750;
+ private float mFrom;
+ private float mTo;
+ private float mCurrent;
+
+ public ScrollAnimation() {
+ setDuration(DURATION);
+ setInterpolator(new DecelerateInterpolator());
+ }
+
+ public void startScrolling(float from, float to) {
+ mFrom = from;
+ mTo = to;
+ startNow();
+ }
+
+ @Override
+ protected void applyTransformation(float interpolatedTime,
+ Transformation t) {
+ mCurrent = mFrom + (mTo - mFrom) * interpolatedTime;
+ // Log.d(TAG, "applyTransformation " + mCurrent);
+ }
+
+ public float getCurrent() {
+ return mCurrent;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected View onCreateDialogView() {
+
+ LinearLayout layout = new LinearLayout(getContext());
+ layout.setOrientation(LinearLayout.VERTICAL);
+ layout.setGravity(android.view.Gravity.CENTER);
+
+ LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
+ LinearLayout.LayoutParams.FILL_PARENT,
+ LinearLayout.LayoutParams.WRAP_CONTENT);
+ layoutParams.setMargins(10, 0, 10, 5);
+
+ TextView tv = new TextView(getContext());
+ tv.setText("Pick a Color");
+ layout.addView(tv, layoutParams);
+
+ mColorPickerView = new ColorPickerView(this,
+// onColorChangedListener,
+ mInitialColor);
+ layout.addView(mColorPickerView, layoutParams);
+
+ mTransparencyBar = new SeekBar(getContext());
+ mTransparencyBar.setMax(255);
+ mTransparencyBar.setProgressDrawable(new TextSeekBarDrawable(getContext()
+ .getResources(), "alpha", true));
+ mTransparencyBar.setProgress(Color.alpha(mInitialColor));
+ mTransparencyBar
+ .setOnSeekBarChangeListener(onTransparencyChangedListener);
+ layout.addView(mTransparencyBar, layoutParams);
+
+ mEditText = new EditText(getContext());
+ mEditText.addTextChangedListener(mEditTextListener);
+ mEditText.setText(convertToARGB(mInitialColor));
+ layout.addView(mEditText, layoutParams);
+
+ CheckBox cb = new CheckBox(getContext());
+
+
+// OnColorChangedListener l = new OnColorChangedListener() {
+// public void colorChanged(int color) {
+// mListener.colorChanged(color);
+// }
+// };
+ return layout;
+ }
+
+
+ @Override
+ protected void onSetInitialValue(boolean restoreValue, Object defaultValue) {
+ mInitialColor = (restoreValue ? getPersistedInt(mInitialColor) : (Integer) defaultValue);
+ persistInt(mInitialColor);
+ }
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setDefaultValue(final Object defaultValue) {
+ super.setDefaultValue(defaultValue);
+ // if (defaultValue instanceof String) {
+ // this.defValue = Utils.parseLong((String) defaultValue,
+ // this.defValue);
+ // } else if (defaultValue instanceof Long) {
+ // this.defValue = (Long) defaultValue;
+ // }
+ }
+
+
+ public ColorPickerPreference(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ this.setPersistent(true);
+ mInitialColor = this.getPersistedInt(0);
+ }
+
+
+ @Override
+ protected void onDialogClosed(boolean positiveResult) {
+ super.onDialogClosed(positiveResult);
+
+ if (positiveResult) {
+ int c = mColorPickerView.mCenterPaint.getColor();
+ callChangeListener(c);
+ persistInt(c);
+ mInitialColor = c;
+
+ }
+ }
+
+// @Override
+// protected void onSetInitialValue(boolean restorePersistedValue,
+// Object defaultValue) {
+// mInitialColor = (restorePersistedValue ? getPersistedInt(mInitialColor) : (Integer) defaultValue);
+// }
+
+ // public ColorPickerDialog(Context context,
+ // OnColorChangedListener listener,
+ // int initialColor) {
+ // //super(context);
+ //
+ // mListener = listener;
+ // mInitialColor = initialColor;
+ // }
+ //
+ // @Override
+ // protected void onCreate(Bundle savedInstanceState) {
+ // super.onCreate(savedInstanceState);
+ // OnColorChangedListener l = new OnColorChangedListener() {
+ // public void colorChanged(int color) {
+ // mListener.colorChanged(color);
+ // dismiss();
+ // }
+ // };
+ //
+ // setContentView(new ColorPickerView(getContext(), l, mInitialColor));
+ // setTitle("Pick a Color");
+ // }
+}
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/colorpicker/ColorPickerView.java b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/colorpicker/ColorPickerView.java
new file mode 100644
index 0000000..b645bf0
--- /dev/null
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/gui/colorpicker/ColorPickerView.java
@@ -0,0 +1,177 @@
+/*
+ * Copyright (C) 2011 Menny Even Danan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+http://blog.evendanan.net/2011/08/Fingerpainting-app-for-Hagar-OR-Multitouch-sample-code
+*/
+package de.bjusystems.vdrmanager.gui.colorpicker;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.graphics.RectF;
+import android.graphics.Shader;
+import android.graphics.SweepGradient;
+import android.util.DisplayMetrics;
+import android.view.MotionEvent;
+import android.view.View;
+
+
+class ColorPickerView extends View {
+ private Paint mPaint;
+ private Paint mCenterPaint;
+ private final int[] mColors;
+ private ColorPickerDialog.OnColorChangedListener mListener;
+
+ ColorPickerView(Context c, ColorPickerDialog.OnColorChangedListener l, int color) {
+ super(c);
+ mListener = l;
+ mColors = new int[]{
+ 0xFFFF0000, 0xFFFF00FF, 0xFF0000FF, 0xFF00FFFF, 0xFF00FF00,
+ 0xFFFFFF00, 0xFFFFFFFF, 0xFF000000, 0xFFFF0000
+ };
+ Shader s = new SweepGradient(0, 0, mColors, null);
+
+ mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ mPaint.setShader(s);
+ mPaint.setStyle(Paint.Style.STROKE);
+ mPaint.setStrokeWidth(32);
+
+ mCenterPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ mCenterPaint.setColor(color);
+ mCenterPaint.setStrokeWidth(5);
+
+
+ DisplayMetrics dm = c.getResources().getDisplayMetrics();
+
+ CENTER_X = Math.min(dm.widthPixels, dm.heightPixels) / 3;
+ CENTER_Y = CENTER_X;
+ }
+
+ private boolean mTrackingCenter;
+ private boolean mHighlightCenter;
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ float r = CENTER_X - mPaint.getStrokeWidth() * 0.5f;
+
+ canvas.translate(CENTER_X, CENTER_X);
+
+ canvas.drawOval(new RectF(-r, -r, r, r), mPaint);
+ canvas.drawCircle(0, 0, CENTER_RADIUS, mCenterPaint);
+
+ if (mTrackingCenter) {
+ int c = mCenterPaint.getColor();
+ mCenterPaint.setStyle(Paint.Style.STROKE);
+
+ if (mHighlightCenter) {
+ mCenterPaint.setAlpha(0xFF);
+ } else {
+ mCenterPaint.setAlpha(0x80);
+ }
+ canvas.drawCircle(0, 0,
+ CENTER_RADIUS + mCenterPaint.getStrokeWidth(),
+ mCenterPaint);
+
+ mCenterPaint.setStyle(Paint.Style.FILL);
+ mCenterPaint.setColor(c);
+ }
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+
+ setMeasuredDimension(CENTER_X * 2, CENTER_Y * 2);
+ }
+
+ private int CENTER_X = 100;
+ private int CENTER_Y = 100;
+ private int CENTER_RADIUS = 32;
+
+ private int ave(int s, int d, float p) {
+ return s + Math.round(p * (d - s));
+ }
+
+ private int interpColor(int colors[], float unit) {
+ if (unit <= 0) {
+ return colors[0];
+ }
+ if (unit >= 1) {
+ return colors[colors.length - 1];
+ }
+
+ float p = unit * (colors.length - 1);
+ int i = (int) p;
+ p -= i;
+
+ // now p is just the fractional part [0...1) and i is the index
+ int c0 = colors[i];
+ int c1 = colors[i + 1];
+ int a = ave(Color.alpha(c0), Color.alpha(c1), p);
+ int r = ave(Color.red(c0), Color.red(c1), p);
+ int g = ave(Color.green(c0), Color.green(c1), p);
+ int b = ave(Color.blue(c0), Color.blue(c1), p);
+
+ return Color.argb(a, r, g, b);
+ }
+
+ private static final float PI = 3.1415926f;
+
+ @Override
+ public boolean onTouchEvent(MotionEvent event) {
+ float x = event.getX() - CENTER_X;
+ float y = event.getY() - CENTER_Y;
+ boolean inCenter = Math.sqrt(x * x + y * y) <= CENTER_RADIUS;
+
+ switch (event.getAction()) {
+ case MotionEvent.ACTION_DOWN:
+ mTrackingCenter = inCenter;
+ if (inCenter) {
+ mHighlightCenter = true;
+ invalidate();
+ break;
+ }
+ case MotionEvent.ACTION_MOVE:
+ if (mTrackingCenter) {
+ if (mHighlightCenter != inCenter) {
+ mHighlightCenter = inCenter;
+ invalidate();
+ }
+ } else {
+ float angle = (float) Math.atan2(y, x);
+ // need to turn angle [-PI ... PI] into unit [0....1]
+ float unit = angle / (2 * PI);
+ if (unit < 0) {
+ unit += 1;
+ }
+ mCenterPaint.setColor(interpColor(mColors, unit));
+ invalidate();
+ }
+ break;
+ case MotionEvent.ACTION_UP:
+ if (mTrackingCenter) {
+ if (inCenter) {
+ mListener.colorChanged(mCenterPaint.getColor());
+ }
+ mTrackingCenter = false; // so we draw w/o halo
+ invalidate();
+ }
+ break;
+ }
+ return true;
+ }
+}
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/remote/FaListDialog.java b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/remote/FaListDialog.java
new file mode 100644
index 0000000..7ea9844
--- /dev/null
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/remote/FaListDialog.java
@@ -0,0 +1,200 @@
+package de.bjusystems.vdrmanager.remote;
+
+
+import android.app.Dialog;
+import android.content.Context;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+import android.widget.SearchView;
+
+import java.io.Serializable;
+
+import de.bjusystems.vdrmanager.R;
+
+public class FaListDialog extends Dialog implements
+ SearchView.OnQueryTextListener, SearchView.OnCloseListener {
+
+ private static final String ITEMS = "items";
+
+ private ArrayAdapter listAdapter;
+
+ private SearchableItem<String> searchableItem;
+
+ public FaListDialog(Context context) {
+ super(context);
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ // Getting the layout inflater to inflate the view in an alert dialog.
+ LayoutInflater inflater = LayoutInflater.from(getContext());
+
+ // Crash on orientation change #7
+ // Change Start
+ // Description: As the instance was re initializing to null on rotating the device,
+ // getting the instance from the saved instance
+ // Change End
+
+ View rootView = inflater.inflate(R.layout.searchable_list_dialog, null);
+
+ final ListView viewById = (ListView) rootView.findViewById(R.id.listItems);
+ viewById.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+ String item = String.valueOf(listAdapter.getItem(position));
+ if (searchableItem != null) {
+ searchableItem.onSearchableItemClicked(item, position);
+ }
+ FaListDialog.this.dismiss();
+ }
+ });
+ ((SearchView) rootView.findViewById(R.id.search)).setOnQueryTextListener(new SearchView.OnQueryTextListener() {
+ @Override
+ public boolean onQueryTextSubmit(String query) {
+ return false;
+ }
+
+ @Override
+ public boolean onQueryTextChange(String newText) {
+ listAdapter.getFilter().filter(newText);
+ return false;
+ }
+ });
+//
+// //create the adapter by passing your ArrayList data
+ listAdapter = ArrayAdapter.createFromResource(getContext(), R.array.font, R.layout.simple_list_item_1_fa);
+ viewById.setAdapter(listAdapter);
+ setContentView(rootView);
+ }
+
+ @Override
+ public boolean onClose() {
+ return false;
+ }
+
+ @Override
+ public boolean onQueryTextSubmit(String query) {
+ return false;
+ }
+
+ @Override
+ public boolean onQueryTextChange(String newText) {
+ return false;
+ }
+
+ public SearchableItem getSearchableItem() {
+ return searchableItem;
+ }
+
+ public void setSearchableItem(SearchableItem searchableItem) {
+ this.searchableItem = searchableItem;
+ }
+
+// // Crash on orientation change #7
+// // Change Start
+// // Description: Saving the instance of searchable item instance.
+// @Override
+// public void onSaveInstanceState(Bundle outState) {
+// outState.putSerializable("item", _searchableItem);
+// super.onSaveInstanceState(outState);
+// }
+// // Change End
+//
+// public void setTitle(String strTitle) {
+// _strTitle = strTitle;
+// }
+//
+// public void setPositiveButton(String strPositiveButtonText) {
+// _strPositiveButtonText = strPositiveButtonText;
+// }
+//
+// public void setPositiveButton(String strPositiveButtonText, DialogInterface.OnClickListener onClickListener) {
+// _strPositiveButtonText = strPositiveButtonText;
+// _onClickListener = onClickListener;
+// }
+//
+// public void setOnSearchableItemClickListener(SearchableItem searchableItem) {
+// this._searchableItem = searchableItem;
+// }
+//
+// public void setOnSearchTextChangedListener(OnSearchTextChanged onSearchTextChanged) {
+// this._onSearchTextChanged = onSearchTextChanged;
+// }
+//
+// private void setData(View rootView) {
+// SearchManager searchManager = (SearchManager) getActivity().getSystemService(Context
+// .SEARCH_SERVICE);
+//
+// _searchView = (SearchView) rootView.findViewById(R.id.search);
+// _searchView.setSearchableInfo(searchManager.getSearchableInfo(getActivity().getComponentName
+// ()));
+// _searchView.setIconifiedByDefault(false);
+// _searchView.setOnQueryTextListener(this);
+// _searchView.setOnCloseListener(this);
+// _searchView.clearFocus();
+// InputMethodManager mgr = (InputMethodManager) getActivity().getSystemService(Context
+// .INPUT_METHOD_SERVICE);
+// mgr.hideSoftInputFromWindow(_searchView.getWindowToken(), 0);
+//
+//
+// List items = (List) getArguments().getSerializable(ITEMS);
+//
+// _listViewItems = (ListView) rootView.findViewById(R.id.listItems);
+//
+// //create the adapter by passing your ArrayList data
+// listAdapter = new ArrayAdapter(getActivity(), android.R.layout.simple_list_item_1,
+// items);
+// //attach the adapter to the list
+// _listViewItems.setAdapter(listAdapter);
+//
+// _listViewItems.setTextFilterEnabled(true);
+//
+// _listViewItems.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+// @Override
+// public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+// _searchableItem.onSearchableItemClicked(listAdapter.getItem(position), position);
+// getDialog().dismiss();
+// }
+// });
+// }
+//
+// @Override
+// public boolean onClose() {
+// return false;
+// }
+//
+// @Override
+// public boolean onQueryTextSubmit(String s) {
+// _searchView.clearFocus();
+// return true;
+// }
+//
+// @Override
+// public boolean onQueryTextChange(String s) {
+//// listAdapter.filterData(s);
+// if (TextUtils.isEmpty(s)) {
+//// _listViewItems.clearTextFilter();
+// ((ArrayAdapter) _listViewItems.getAdapter()).getFilter().filter(null);
+// } else {
+// ((ArrayAdapter) _listViewItems.getAdapter()).getFilter().filter(s);
+// }
+// if (null != _onSearchTextChanged) {
+// _onSearchTextChanged.onSearchTextChanged(s);
+// }
+// return true;
+// }
+
+ public interface SearchableItem<T> extends Serializable {
+ void onSearchableItemClicked(T item, int position);
+ }
+
+ public interface OnSearchTextChanged {
+ void onSearchTextChanged(String strText);
+ }
+}
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/remote/HITK.java b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/remote/HITK.java
index 5d0c596..10513b3 100644
--- a/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/remote/HITK.java
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/remote/HITK.java
@@ -15,16 +15,16 @@ public enum HITK {
Green,
Yellow,
Blue,
- Zero("0"),
- One("1"),
- Two("2"),
- Three("3"),
- Four("4"),
- Five("5"),
- Six("6"),
- Seven("7"),
- Eight("8"),
- Nine("9"),
+ Zero("0"),
+ One("1"),
+ Two("2"),
+ Three("3"),
+ Four("4"),
+ Five("5"),
+ Six("6"),
+ Seven("7"),
+ Eight("8"),
+ Nine("9"),
Info,
Play_Pause("Play/Pause"),
Play,
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/remote/RemoteActivity.java b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/remote/RemoteActivity.java
index 254150e..d935eda 100644
--- a/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/remote/RemoteActivity.java
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/remote/RemoteActivity.java
@@ -4,6 +4,7 @@ package de.bjusystems.vdrmanager.remote;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
+import android.content.ContextWrapper;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
@@ -13,7 +14,6 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
-import android.util.Pair;
import android.view.ContextMenu;
import android.view.KeyEvent;
import android.view.Menu;
@@ -51,13 +51,22 @@ import java.util.Set;
import de.androvdr.widget.AnimatedTextView;
import de.androvdr.widget.FontAwesome;
+import de.bjusystems.vdrmanager.ButtonMapping;
import de.bjusystems.vdrmanager.R;
import de.bjusystems.vdrmanager.backup.IOUtils;
import de.bjusystems.vdrmanager.data.Preferences;
-import de.bjusystems.vdrmanager.gui.ColoredButton;
import de.bjusystems.vdrmanager.gui.Utils;
+import de.bjusystems.vdrmanager.gui.colorpicker.ColorPickerDialog;
import de.bjusystems.vdrmanager.tasks.VoidAsyncTask;
+import static de.bjusystems.vdrmanager.ButtonMapping.COLOR;
+import static de.bjusystems.vdrmanager.ButtonMapping.COLOR_PREFIX;
+import static de.bjusystems.vdrmanager.ButtonMapping.KEY;
+import static de.bjusystems.vdrmanager.ButtonMapping.KEY_PREFIX;
+import static de.bjusystems.vdrmanager.ButtonMapping.LABEL;
+import static de.bjusystems.vdrmanager.ButtonMapping.LABEL_PREFIX;
+import static de.bjusystems.vdrmanager.ButtonMapping.NO_COLOR;
+
/**
* The type Remote activity.
*/
@@ -187,22 +196,20 @@ public class RemoteActivity extends Activity implements OnClickListener, View.On
public void export() {
SharedPreferences sharedPref = getSharedPreferences("remote_" + Preferences.get().getCurrentVdr().getId(), Context.MODE_PRIVATE);
ViewGroup viewGroup = (ViewGroup) findViewById(R.id.remoteroot);
- HashMap<String, Pair<String, String>> map = new HashMap<>();
+ HashMap<String, ButtonMapping> map = new HashMap<>();
collect(viewGroup, map, sharedPref);
- if(map.isEmpty()){
+ if (map.isEmpty()) {
Utils.say(this, R.string.remote_nothing_to_import);
return;
}
JSONObject root = new JSONObject();
try {
- for (Map.Entry<String, Pair<String, String>> e : map.entrySet()) {
- JSONObject pair = new JSONObject();
- Pair<String, String> stringStringPair = e.getValue();
- pair.put("key", stringStringPair.first);
- pair.put("label", stringStringPair.second);
- root.put(e.getKey(), pair);
+ for (Map.Entry<String, ButtonMapping> e : map.entrySet()) {
+ JSONObject button = new JSONObject();
+ ButtonMapping buttonMapping = e.getValue();
+ root.put(e.getKey(), buttonMapping.toJson());
}
} catch (JSONException jse) {
Utils.say(this, jse.getLocalizedMessage());
@@ -248,7 +255,7 @@ public class RemoteActivity extends Activity implements OnClickListener, View.On
* @param map the map
* @param sharedPref the shared pref
*/
- public void collect(ViewGroup viewGroup, HashMap<String, Pair<String, String>> map, SharedPreferences sharedPref) {
+ public void collect(ViewGroup viewGroup, HashMap<String, ButtonMapping> map, SharedPreferences sharedPref) {
for (int i = 0; i < viewGroup.getChildCount(); i++) {
View v = viewGroup.getChildAt(i);
if (v instanceof ViewGroup) {
@@ -258,12 +265,13 @@ public class RemoteActivity extends Activity implements OnClickListener, View.On
continue;
}
String tagKey = String.valueOf(v.getTag());
- String hitk = sharedPref.getString("key_" + tagKey, null);
- String label = sharedPref.getString("label_" + tagKey, null);
- if (hitk == null && label == null) {
+ String hitk = sharedPref.getString(KEY_PREFIX + tagKey, null);
+ String label = sharedPref.getString(LABEL_PREFIX + tagKey, null);
+ Integer color = sharedPref.getInt(COLOR_PREFIX + tagKey, -1);
+ if (hitk == null && label == null && color == -1) {
continue;
}
- map.put(tagKey, Pair.create(hitk, label));
+ map.put(tagKey, new ButtonMapping(hitk, label, color));
}
}
}
@@ -317,14 +325,24 @@ public class RemoteActivity extends Activity implements OnClickListener, View.On
((Button) v).setOnClickListener(this);
((Button) v).setOnLongClickListener(this);
- String hitk = sharedPref.getString("key_" + String.valueOf(v.getTag()), null);
+ String hitk = sharedPref.getString(KEY_PREFIX + String.valueOf(v.getTag()), null);
setOverrideTag(v, hitk);
- String label = sharedPref.getString("label_" + String.valueOf(v.getTag()), null);
+ String label = sharedPref.getString(LABEL_PREFIX + String.valueOf(v.getTag()), null);
setOverrideLabel((Button) v, label);
+ Integer color = sharedPref.getInt(COLOR_PREFIX + String.valueOf(v.getTag()), NO_COLOR);
+ setOverrideColor((Button) v, color);
+
}
}
}
+ private void setOverrideColor(Button v, Integer color) {
+ if (color == null || color == NO_COLOR) {
+ return;
+ }
+ v.setTextColor(color);
+ }
+
private void setOverrideLabel(Button b, CharSequence label) {
if (label == null) {
return;
@@ -334,7 +352,7 @@ public class RemoteActivity extends Activity implements OnClickListener, View.On
private void restart() {
- if(getIntent() != null) {
+ if (getIntent() != null) {
getIntent().removeExtra(Intent.EXTRA_STREAM);
}
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
@@ -412,6 +430,18 @@ public class RemoteActivity extends Activity implements OnClickListener, View.On
MenuItem item = menu.findItem(R.id.remapback);
}
+
+ private Activity scanForActivity(Context cont) {
+ if (cont == null)
+ return null;
+ else if (cont instanceof Activity)
+ return (Activity) cont;
+ else if (cont instanceof ContextWrapper)
+ return scanForActivity(((ContextWrapper) cont).getBaseContext());
+
+ return null;
+ }
+
@Override
public boolean onLongClick(final View v) {
@@ -420,48 +450,130 @@ public class RemoteActivity extends Activity implements OnClickListener, View.On
return true;
}
- CharSequence text = ((Button) v).getText();
final String tag = (String) v.getTag();
+
+ final Button button = (Button) v;
+ final CharSequence initilHitkLabel = button.getText();
final String override = (String) v.getTag(TAG_KEY);
- String current = override != null ? override : tag;
+ final String initialHitk = override != null ? override : tag;
- View view = getLayoutInflater().inflate(R.layout.edit_remote_key, null);
+ final View rview = getLayoutInflater().inflate(R.layout.edit_remote_key, null);
- final EditText hitk = (EditText) view.findViewById(R.id.hitk);
- TextView hitkLabel = (TextView) view.findViewById(R.id.hitkLabel);
- if (v instanceof ColoredButton) {
- hitk.setVisibility(View.GONE);
- hitkLabel.setVisibility(View.GONE);
- } else {
- hitk.setVisibility(View.VISIBLE);
- hitkLabel.setVisibility(View.VISIBLE);
- hitk.setTypeface(
- FontAwesome.getFontAwesome(this)
- );
- }
- hitk.setText(text);
- final Spinner hitkspinner = (Spinner) view.findViewById(R.id.hitkSpinner);
+ final EditText hitk = (EditText) rview.findViewById(R.id.hitk);
+ TextView hitkLabel = (TextView) rview.findViewById(R.id.hitkLabel);
+ View hitkLabelColorPicker = rview.findViewById(R.id.hitkLabelColorPicker);
+ View faPicker = rview.findViewById(R.id.faPicker);
+
+ faPicker.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+
+ ArrayList items = new ArrayList();
+ FaListDialog faListDialog = new FaListDialog(RemoteActivity.this);
+ faListDialog.setSearchableItem(new FaListDialog.SearchableItem<String>() {
+ @Override
+ public void onSearchableItemClicked(String item, int position) {
+ hitk.setText(item.substring(0,1));
+ hitk.setSelection(hitk.getText().
+ length());
+ }
+ });
+ //faListDialog.setOnSearchableItemClickListener(new FaListDialog.SearchableItem() {
+ // @Override
+ //public void onSearchableItemClicked(Object item, int position) {
+
+// }
+// });
+
+
+ faListDialog.show();
+// AlertDialog.Builder builder = new AlertDialog.Builder(RemoteActivity.this);
+// View view = getLayoutInflater().inflate(R.layout.searchspinner, null);
+// builder.setView(view);
+// if (view instanceof ViewGroup) {
+// ViewGroup faPickerVG = (ViewGroup) view;
+// for (int i = 0; i < faPickerVG.getChildCount(); ++i) {
+// final View childAt = faPickerVG.getChildAt(i);
+// if (childAt instanceof TextView) {
+// ((TextView) childAt).setTypeface(FontAwesome.getFontAwesome(RemoteActivity.this));
+// }
+// }
+// }
+// builder.create().show();
+
+ }
+ });
+// if (v instanceof ColoredButton) {
+// hitk.setVisibility(View.GONE);
+// hitkLabel.setVisibility(View.GONE);
+// } else {
+ hitk.setVisibility(View.VISIBLE);
+ hitkLabel.setVisibility(View.VISIBLE);
+ hitk.setTypeface(
+ FontAwesome.getFontAwesome(this));
+ //);
+ //}
+ hitk.setText(initilHitkLabel);
+ hitk.setSelection(hitk.getText().
+
+ length());
+
+ final int initialTextColor = button.getCurrentTextColor();
+ final int[] currentTextColor = {initialTextColor};
+ hitk.setTextColor(currentTextColor[0]);
+ final ColorPickerDialog colorPicker = new ColorPickerDialog(
+
+ RemoteActivity.this, null, currentTextColor[0]);
+ colorPicker
+ .setOnColorChangedListener(new ColorPickerDialog.OnColorChangedListener() {
+ @Override
+ public void colorChanged(int color) {
+ currentTextColor[0] = color;
+ hitk.setTextColor(currentTextColor[0]);
+
+ colorPicker.dismiss();
+ }
+ });
+ hitkLabelColorPicker.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+
+ colorPicker.show();
+ }
+ });
+
+
+ final Spinner hitkspinner = (Spinner) rview.findViewById(R.id.hitkSpinner);
final ArrayList<String> keys = new ArrayList<>();
- for (de.bjusystems.vdrmanager.remote.HITK hk : de.bjusystems.vdrmanager.remote.HITK.values()) {
+ for (
+ de.bjusystems.vdrmanager.remote.HITK hk : de.bjusystems.vdrmanager.remote.HITK.values())
+
+ {
keys.add(hk.getValue());
}
+
ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(this, android.R.layout.simple_spinner_dropdown_item, keys.toArray(new String[]{}));
// Specify the layout to use when the list of choices appears
// hitkspinner.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
// Apply the adapter to the spinner
hitkspinner.setAdapter(adapter);
int selected = -1;
- for (int i = 0; i < keys.size(); ++i) {
+ for (
+ int i = 0; i < keys.size(); ++i)
+
+ {
String k = keys.get(i);
- if (k.equals(current)) {
+ if (k.equals(initialHitk)) {
selected = i;
break;
}
}
hitkspinner.setSelection(selected);
- hitkspinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+ hitkspinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener()
+
+ {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
@@ -474,26 +586,54 @@ public class RemoteActivity extends Activity implements OnClickListener, View.On
});
AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
+ builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener()
+
+ {
@Override
public void onClick(DialogInterface dialog, int which) {
CharSequence nhk = hitk.getText();
- ((Button) v).setText(nhk);
String hitk = (String) hitkspinner.getSelectedItem();
- putVdrKey("key_" + tag, hitk);
- putVdrKey("label_" + tag, nhk);
+ if (initialTextColor == currentTextColor[0] &&//
+ initilHitkLabel.toString().equals(nhk.toString()) && //
+ initialHitk.equals(hitk)
+ ) {
+ return;
+ }
+
+ ((Button) v).setText(nhk);
+ ((Button) v).setTextColor(currentTextColor[0]);
+ putVdrKey(KEY_PREFIX + tag, hitk);
+ putVdrKey(LABEL_PREFIX + tag, nhk);
+ if (currentTextColor[0] != NO_COLOR) {
+ putVdrKey(COLOR_PREFIX + tag, currentTextColor[0]);
+ }
setOverrideTag(v, hitk);
}
})
- .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
+ .
+
+ setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+
+ }
+ }).
+ setNeutralButton(R.string.reset, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
-
+ removeVdrKey(KEY_PREFIX + tag);
+ removeVdrKey(LABEL_PREFIX + tag);
+ removeVdrKey(COLOR_PREFIX + tag);
+ restart();
}
- }).setView(view);
+ })
+
+ .setView(rview);
+
+ builder.create().
- builder.create().show();
+ show();
return false;
@@ -539,14 +679,17 @@ public class RemoteActivity extends Activity implements OnClickListener, View.On
if (all.contains(next) == false) {
continue;
}
- JSONObject pair = object.getJSONObject(next);
- String key = pair.getString("key");
+ JSONObject button = object.getJSONObject(next);
+ String key = button.getString(KEY);
if (all.contains(key) == false) {
continue;
}
- String value = pair.getString("label");
- edit.putString("key_" + next, key);
- edit.putString("label_" + next, value);
+ String value = button.getString(LABEL);
+ edit.putString(KEY_PREFIX + next, key);
+ edit.putString(LABEL_PREFIX + next, value);
+ if (button.getInt(COLOR) != NO_COLOR) {
+ edit.putInt(COLOR_PREFIX + next, button.getInt(COLOR));
+ }
counter++;
}
edit.commit();
@@ -570,6 +713,20 @@ public class RemoteActivity extends Activity implements OnClickListener, View.On
edit.commit();
}
+ private void removeVdrKey(String key) {
+ SharedPreferences sharedPref = getSharedPreferences("remote_" + Preferences.get().getCurrentVdr().getId(), Context.MODE_PRIVATE);
+ SharedPreferences.Editor edit = sharedPref.edit();
+ edit.remove(key);
+ edit.commit();
+ }
+
+ private void putVdrKey(String key, Integer value) {
+ SharedPreferences sharedPref = getSharedPreferences("remote_" + Preferences.get().getCurrentVdr().getId(), Context.MODE_PRIVATE);
+ SharedPreferences.Editor edit = sharedPref.edit();
+ edit.putInt(key, value);
+ edit.commit();
+ }
+
private String getCurrentTag(View view) {
Object tag = view.getTag();
if (tag instanceof String == false) {
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/utils/VdrManagerExceptionHandler.java b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/utils/VdrManagerExceptionHandler.java
new file mode 100644
index 0000000..bde604c
--- /dev/null
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/java/de/bjusystems/vdrmanager/utils/VdrManagerExceptionHandler.java
@@ -0,0 +1,96 @@
+package de.bjusystems.vdrmanager.utils;
+
+import android.content.Context;
+import android.content.Intent;
+
+import java.util.logging.Logger;
+
+/**
+ * The type Vdr manager exception handler.
+ */
+public class VdrManagerExceptionHandler implements Thread.UncaughtExceptionHandler {
+ private Context context;
+
+ /**
+ * The Log.
+ */
+ Logger log = Logger.getLogger(VdrManagerExceptionHandler.class.getSimpleName());
+
+ private Thread.UncaughtExceptionHandler previous;
+
+ private static VdrManagerExceptionHandler INSTANCE;
+
+ /**
+ * The constant RECEIVER.
+ */
+ public static final String RECEIVER = "herrlado@gmail.com";
+
+ private VdrManagerExceptionHandler(Context context,
+ Thread.UncaughtExceptionHandler previous) {
+ this.context = context;
+ this.previous = previous;
+
+ }
+
+ /**
+ * Get vdr manager exception handler.
+ *
+ * @param context the context
+ * @param previous the previous
+ * @return the vdr manager exception handler
+ */
+ public static VdrManagerExceptionHandler get(Context context,
+ Thread.UncaughtExceptionHandler previous) {
+
+ if (INSTANCE != null) {
+ return INSTANCE;
+ }
+ INSTANCE = new VdrManagerExceptionHandler(context, previous);
+
+ return INSTANCE;
+ }
+
+ @Override
+ public void uncaughtException(Thread thread, Throwable e) {
+
+ log.warning(e.getMessage());
+
+ StackTraceElement[] arr = e.getStackTrace();
+ String report = e.toString() + "\n\n";
+ report += "--------- Stack trace ---------\n\n";
+ for (int i = 0; i < arr.length; i++) {
+ report += " " + arr[i].toString() + "\n";
+ }
+ report += "-------------------------------\n\n";
+
+ // If the exception was thrown in a background thread inside
+ // AsyncTask, then the actual exception can be found with getCause
+ report += "--------- Cause ---------\n\n";
+ Throwable cause = e.getCause();
+ if (cause != null) {
+ report += cause.toString() + "\n\n";
+ arr = cause.getStackTrace();
+ for (int i = 0; i < arr.length; i++) {
+ report += " " + arr[i].toString() + "\n";
+ }
+ }
+ report += "-------------------------------\n\n";
+
+ Intent sendIntent = new Intent(Intent.ACTION_SEND);
+ String subject = "Force Close Report VDR Manager";
+ String body = "Sendlog for VDR Manager\n\n\n" + report
+ + "\n\n";
+
+ sendIntent.putExtra(Intent.EXTRA_EMAIL,
+ new String[]{RECEIVER});
+ sendIntent.putExtra(Intent.EXTRA_TEXT, body);
+ sendIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
+ sendIntent.setType("message/rfc822");
+
+
+ context.startActivity(Intent.createChooser(sendIntent,
+ "Force Close Report VDR Manager"));
+
+ previous.uncaughtException(thread, e);
+ }
+}
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/res/layout-land/remote.xml b/vdrmanager/de.bjusystems.vdrmanager/src/main/res/layout-land/remote.xml
new file mode 100644
index 0000000..c7e01a8
--- /dev/null
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/res/layout-land/remote.xml
@@ -0,0 +1,399 @@
+<?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-auto"
+ android:id="@+id/remoteroot"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:orientation="vertical"
+ android:padding="5dp">
+
+
+ <LinearLayout
+ android:id="@+id/resultwrapper"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentEnd="true"
+ android:layout_alignParentRight="true"
+ android:layout_alignParentTop="true">
+
+ <de.androvdr.widget.AnimatedTextView
+ android:id="@+id/result"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="right"
+ android:maxLines="1"
+ android:textSize="10sp" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_below="@+id/resultwrapper"
+ android:orientation="horizontal">
+
+ <RelativeLayout
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:orientation="vertical">
+
+
+ <LinearLayout
+ android:id="@+id/rows0"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentStart="true"
+ android:layout_marginBottom="10dp"
+ android:orientation="horizontal">
+
+ <de.androvdr.widget.FontAwesomeButton
+ android:id="@+id/Power"
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="Power"
+ android:text="XXX" />
+
+ <de.androvdr.widget.FontAwesomeButton
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="Back"
+ android:text="@string/back" />
+
+ <de.androvdr.widget.FontAwesomeButton
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="" />
+
+
+ <de.androvdr.widget.FontAwesomeButton
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="Setup"
+ android:text="@string/f085" />
+ </LinearLayout>
+
+ <RelativeLayout
+ android:id="@+id/navigation"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_above="@+id/rows1"
+ android:layout_alignParentEnd="true"
+ android:layout_alignParentRight="true"
+ android:layout_below="@+id/colorButtons">
+
+ <de.androvdr.widget.SquareButton
+ android:id="@+id/ok"
+ style="@style/cursorButton"
+ android:layout_centerVertical="true"
+ android:layout_gravity="center_horizontal"
+ android:layout_toLeftOf="@+id/right"
+ android:layout_toStartOf="@+id/right"
+ android:tag="Ok"
+ android:text="@string/ok" />
+
+
+ <de.androvdr.widget.SquareButton
+ android:id="@+id/right"
+ style="@style/cursorButton"
+ android:layout_centerVertical="true"
+ android:layout_toEndOf="@+id/up"
+ android:layout_toRightOf="@+id/up"
+ android:tag="Right"
+ android:text="@string/f061" />
+
+
+ <de.androvdr.widget.SquareButton
+ android:id="@+id/left"
+ style="@style/cursorButton"
+ android:layout_centerVertical="true"
+ android:layout_toLeftOf="@+id/ok"
+ android:layout_toStartOf="@+id/ok"
+ android:tag="Left"
+ android:text="@string/f060" />
+
+ <de.androvdr.widget.SquareButton
+ android:id="@+id/up"
+ style="@style/cursorButton"
+ android:layout_above="@+id/ok"
+ android:layout_centerHorizontal="true"
+ android:layout_gravity="center_horizontal"
+ android:tag="Up"
+ android:text="@string/f062" />
+
+ <de.androvdr.widget.FontAwesomeButton
+ android:id="@+id/ChannelUp"
+ style="@style/volChanButton"
+
+ android:layout_alignParentEnd="true"
+ android:layout_alignParentRight="true"
+ android:layout_alignTop="@+id/up"
+ android:tag="Channel+"
+ android:text="@string/f0aa" />
+
+ <de.androvdr.widget.FontAwesomeButton
+ android:id="@+id/VolumeUp"
+ style="@style/volChanButton"
+ android:layout_height="wrap_content"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentStart="true"
+ android:layout_alignTop="@+id/up"
+ android:tag="Volume+"
+ android:text="@string/f028" />
+
+ <de.androvdr.widget.SquareButton
+ android:id="@+id/down"
+ style="@style/cursorButton"
+
+ android:layout_below="@+id/ok"
+
+ android:layout_gravity="center_horizontal"
+ android:layout_toLeftOf="@+id/right"
+ android:layout_toStartOf="@+id/right"
+ android:tag="Down"
+ android:text="@string/f063" />
+
+ <de.androvdr.widget.FontAwesomeButton
+ android:id="@+id/ChannelDown"
+ style="@style/volChanButton"
+ android:layout_alignBottom="@+id/down"
+ android:layout_alignParentEnd="true"
+ android:layout_alignParentRight="true"
+ android:tag="Channel-"
+ android:text="@string/f0ab" />
+
+ <de.androvdr.widget.FontAwesomeButton
+ android:id="@+id/VolumeDown"
+ style="@style/volChanButton"
+ android:layout_alignBottom="@+id/down"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentStart="true"
+ android:tag="Volume-"
+ android:text="@string/f027" />
+
+ </RelativeLayout>
+
+
+ <LinearLayout
+ android:id="@+id/colorButtons"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentEnd="true"
+ android:layout_alignParentRight="true"
+ android:layout_below="@+id/rows0"
+ android:orientation="horizontal">
+
+
+ <de.androvdr.widget.FontAwesomeButton
+ android:id="@+id/red"
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="Red"
+ android:text="@string/remotesquares"
+ android:textColor="@color/red" />
+
+
+ <de.androvdr.widget.FontAwesomeButton
+ android:id="@+id/green"
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="Green"
+ android:text="@string/remotesquares"
+ android:textColor="@color/green" />
+
+
+ <de.androvdr.widget.FontAwesomeButton
+ android:id="@+id/yellow"
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="Yellow"
+ android:text="@string/remotesquares"
+ android:textColor="@color/yellow" />
+
+
+ <de.androvdr.widget.FontAwesomeButton
+ android:id="@+id/blue"
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="Blue"
+ android:text="@string/remotesquares"
+ android:textColor="@color/blue" />
+
+
+ </LinearLayout>
+
+
+ <LinearLayout
+ android:id="@+id/rows1"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_above="@+id/rows2"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentStart="true"
+ android:orientation="horizontal">
+
+ <de.androvdr.widget.FontAwesomeButton
+ style="?android:attr/buttonStyleSmall"
+
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="Mute"
+ android:text="@string/fa_mute" />
+
+
+ <de.androvdr.widget.FontAwesomeButton
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="Info"
+ android:text="@string/f129" />
+
+ <de.androvdr.widget.FontAwesomeButton
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="Back"
+ android:text="@string/f177" />
+
+
+ <de.androvdr.widget.FontAwesomeButton
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="Menu"
+ android:text="@string/f0c9" />
+
+ </LinearLayout>
+
+
+ <LinearLayout
+
+ android:id="@+id/rows2"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
+ android:layout_marginBottom="10dp"
+ android:layout_marginTop="10dp"
+ android:orientation="horizontal">
+
+ <de.androvdr.widget.FontAwesomeButton
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="Audio"
+ android:text="@string/f025" />
+
+
+ <de.androvdr.widget.FontAwesomeButton
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="Subtitles"
+ android:text="@string/fa_bars" />
+
+ <de.androvdr.widget.FontAwesomeButton
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="PrevChannel"
+ android:text="@string/f0e2" />
+
+
+ <de.androvdr.widget.FontAwesomeButton
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="Commands"
+ android:text="@string/f120" />
+ </LinearLayout>
+
+
+ </RelativeLayout>
+
+ <RelativeLayout
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_weight="1">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_alignParentBottom="true"
+ android:layout_centerInParent="true"
+ android:orientation="horizontal">
+
+ <de.androvdr.widget.FontAwesomeButton
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="Audio"
+ android:text="@string/f025" />
+
+
+ <de.androvdr.widget.FontAwesomeButton
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="Subtitles"
+ android:text="S" />
+
+ <de.androvdr.widget.FontAwesomeButton
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="PrevChannel"
+ android:text="@string/f0e2" />
+
+
+ <de.androvdr.widget.FontAwesomeButton
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="Commands"
+ android:text="@string/f120" />
+ </LinearLayout>
+
+
+
+ </RelativeLayout>
+
+
+ </LinearLayout>
+
+</RelativeLayout>
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/res/layout-land/remote_test.xml b/vdrmanager/de.bjusystems.vdrmanager/src/main/res/layout-land/remote_test.xml
new file mode 100644
index 0000000..8ac2b55
--- /dev/null
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/res/layout-land/remote_test.xml
@@ -0,0 +1,344 @@
+<?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-auto"
+ android:id="@+id/remoteroot"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:orientation="vertical"
+ android:padding="5dp">
+
+
+
+ <LinearLayout
+ android:id="@+id/resultwrapper"
+ android:layout_width="fill_parent"
+ android:layout_alignParentEnd="true"
+ android:layout_alignParentRight="true"
+ android:layout_alignParentTop="true"
+ android:layout_height="wrap_content">
+ <de.androvdr.widget.AnimatedTextView
+ android:id="@+id/result"
+ android:maxLines="1"
+ android:layout_width="0dp"
+ android:layout_weight="1"
+ android:layout_height="wrap_content"
+ android:textSize="10sp"
+ android:gravity="right" />
+ </LinearLayout>
+
+
+
+ <LinearLayout
+ android:id="@+id/rows0"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentStart="true"
+ android:layout_marginBottom="10dp"
+ android:layout_below="@+id/resultwrapper">
+
+ <de.androvdr.widget.FontAwesomeButton
+ style="?android:attr/buttonStyleSmall"
+
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="Power"
+ android:text="&#xf011;"
+ android:id="@+id/Power" />
+
+ <de.androvdr.widget.FontAwesomeButton
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="Back"
+ android:text="Back" />
+
+ <de.androvdr.widget.FontAwesomeButton
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag=""
+ />
+
+
+
+
+
+
+
+ <de.androvdr.widget.FontAwesomeButton
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="Setup"
+ android:text="&#xf085;" />
+ </LinearLayout>
+
+ <RelativeLayout
+ android:id="@+id/navigation"
+
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentRight="true"
+ android:layout_alignParentEnd="true"
+ android:layout_below="@+id/colorButtons"
+ android:layout_above="@+id/rows1">
+
+ <de.androvdr.widget.SquareButton
+ android:id="@+id/ok"
+ style="@style/cursorButton"
+ android:layout_centerVertical="true"
+ android:layout_gravity="center_horizontal"
+ android:layout_toLeftOf="@+id/right"
+ android:layout_toStartOf="@+id/right"
+ android:tag="Ok"
+ android:text="OK" />
+
+
+ <de.androvdr.widget.SquareButton
+ android:id="@+id/right"
+ style="@style/cursorButton"
+ android:tag="Right"
+ android:text="&#xf061;"
+ android:layout_centerVertical="true"
+ android:layout_toRightOf="@+id/up"
+ android:layout_toEndOf="@+id/up" />
+
+
+ <de.androvdr.widget.SquareButton
+ android:id="@+id/left"
+ style="@style/cursorButton"
+ android:tag="Left"
+ android:text="&#xf060;"
+ android:layout_centerVertical="true"
+ android:layout_toLeftOf="@+id/ok"
+ android:layout_toStartOf="@+id/ok" />
+
+ <de.androvdr.widget.SquareButton
+ android:id="@+id/up"
+ style="@style/cursorButton"
+ android:layout_gravity="center_horizontal"
+ android:tag="Up"
+ android:text="&#xf062;"
+ android:layout_above="@+id/ok"
+ android:layout_centerHorizontal="true" />
+
+ <de.androvdr.widget.FontAwesomeButton
+ android:id="@+id/ChannelUp"
+ style="@style/volChanButton"
+
+ android:tag="Channel+"
+ android:text="&#xf0aa;"
+ android:layout_alignTop="@+id/up"
+ android:layout_alignParentRight="true"
+ android:layout_alignParentEnd="true" />
+
+ <de.androvdr.widget.FontAwesomeButton
+ android:id="@+id/VolumeUp"
+ style="@style/volChanButton"
+ android:layout_height="wrap_content"
+ android:tag="Volume+"
+ android:text="&#xf028;"
+ android:layout_alignTop="@+id/up"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentStart="true" />
+
+ <de.androvdr.widget.SquareButton
+ android:id="@+id/down"
+ style="@style/cursorButton"
+
+ android:layout_gravity="center_horizontal"
+
+ android:tag="Down"
+ android:text="&#xf063;"
+ android:layout_below="@+id/ok"
+ android:layout_toLeftOf="@+id/right"
+ android:layout_toStartOf="@+id/right" />
+
+ <de.androvdr.widget.FontAwesomeButton
+ android:id="@+id/ChannelDown"
+ style="@style/volChanButton"
+ android:tag="Channel-"
+ android:text="&#xf0ab;"
+ android:layout_alignBottom="@+id/down"
+ android:layout_alignParentRight="true"
+ android:layout_alignParentEnd="true" />
+
+ <de.androvdr.widget.FontAwesomeButton
+ android:id="@+id/VolumeDown"
+ style="@style/volChanButton"
+ android:tag="Volume-"
+ android:text="&#xf027;"
+ android:layout_alignBottom="@+id/down"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentStart="true" />
+
+ </RelativeLayout>
+
+
+
+ <LinearLayout
+ android:id="@+id/colorButtons"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:layout_alignParentRight="true"
+ android:layout_alignParentEnd="true"
+ android:layout_below="@+id/rows0">
+
+
+ <de.androvdr.widget.FontAwesomeButton
+ android:id="@+id/red"
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="Red"
+ android:text="&#xf04d;&#xf04d;&#xf04d;"
+ android:textColor="@color/red"
+ />
+
+
+ <de.androvdr.widget.FontAwesomeButton
+ android:id="@+id/green"
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="&#xf04d;&#xf04d;&#xf04d;"
+ android:tag="Green"
+ android:textColor="@color/green"
+ />
+
+
+ <de.androvdr.widget.FontAwesomeButton
+ android:id="@+id/yellow"
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="Yellow"
+ android:text="&#xf04d;&#xf04d;&#xf04d;"
+ android:textColor="@color/yellow"
+ />
+
+
+ <de.androvdr.widget.FontAwesomeButton
+ android:id="@+id/blue"
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="Blue"
+ android:text="&#xf04d;&#xf04d;&#xf04d;"
+ android:textColor="@color/blue"
+ />
+
+
+ </LinearLayout>
+
+
+ <LinearLayout
+ android:id="@+id/rows1"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentStart="true"
+ android:orientation="horizontal"
+ android:layout_above="@+id/rows2">
+
+ <de.androvdr.widget.FontAwesomeButton
+ style="?android:attr/buttonStyleSmall"
+
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="Mute"
+ android:text="&#xf026;" />
+
+
+ <de.androvdr.widget.FontAwesomeButton
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="Info"
+ android:text="&#xf129;" />
+
+ <de.androvdr.widget.FontAwesomeButton
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="Back"
+ android:text="&#xf177;" />
+
+
+ <de.androvdr.widget.FontAwesomeButton
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="Menu"
+ android:text="&#xf0c9;" />
+
+ </LinearLayout>
+
+
+ <LinearLayout
+
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:id="@+id/rows2"
+ android:orientation="horizontal"
+ android:layout_marginTop="10dp"
+ android:layout_marginBottom="10dp"
+ android:layout_alignParentBottom="true">
+
+ <de.androvdr.widget.FontAwesomeButton
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="Audio"
+ android:text="&#xf025;" />
+
+
+ <de.androvdr.widget.FontAwesomeButton
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="Subtitles"
+ android:text="S" />
+
+ <de.androvdr.widget.FontAwesomeButton
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="PrevChannel"
+ android:text="&#xf0e2;" />
+
+
+ <de.androvdr.widget.FontAwesomeButton
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="0dp"
+
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:tag="Commands"
+ android:text="&#xf120;" />
+ </LinearLayout>
+
+
+</RelativeLayout>
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/res/layout/edit_remote_key.xml b/vdrmanager/de.bjusystems.vdrmanager/src/main/res/layout/edit_remote_key.xml
index 2dfe156..ea20cc2 100644
--- a/vdrmanager/de.bjusystems.vdrmanager/src/main/res/layout/edit_remote_key.xml
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/res/layout/edit_remote_key.xml
@@ -9,7 +9,7 @@
android:id="@+id/hitkLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_weight="1"
+ android:clickable="true"
android:text="@string/label" />
@@ -26,8 +26,19 @@
<de.androvdr.widget.FontAwesomeButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:id="@+id/faPicker"
android:text="&#xf0b0;" />
+ <de.androvdr.widget.FontAwesomeButton
+ android:id="@+id/hitkLabelColorPicker"
+ android:layout_width="wrap_content"
+ android:textColor="@color/yellow"
+ android:layout_height="wrap_content"
+ android:text="&#xf1fc;" />
+
+
+
+
</LinearLayout>
<TextView
@@ -40,26 +51,4 @@
android:id="@+id/hitkSpinner"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:visibility="gone">
-
- <Button
- android:id="@+id/button7"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="right"
- android:layout_weight="1"
- android:text="@android:string/cancel" />
-
- <Button
- android:id="@+id/button6"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="@android:string/ok" />
- </LinearLayout>
</LinearLayout>
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/res/layout/fa_search.xml b/vdrmanager/de.bjusystems.vdrmanager/src/main/res/layout/fa_search.xml
new file mode 100644
index 0000000..8764059
--- /dev/null
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/res/layout/fa_search.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:paddingLeft="8dp"
+ android:paddingRight="8dp"
+ android:paddingTop="8dp">
+
+ <SearchView
+ android:id="@+id/faSearch"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:iconifiedByDefault="false" />
+
+ <ListView
+ android:id="@+id/faItems"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+</LinearLayout>
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/res/layout/remote.xml b/vdrmanager/de.bjusystems.vdrmanager/src/main/res/layout/remote.xml
index c75d83e..4604b07 100644
--- a/vdrmanager/de.bjusystems.vdrmanager/src/main/res/layout/remote.xml
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/res/layout/remote.xml
@@ -8,45 +8,44 @@
android:padding="5dp">
-
<LinearLayout
android:id="@+id/resultwrapper"
android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
- android:layout_alignParentTop="true"
- android:layout_height="wrap_content">
- <de.androvdr.widget.AnimatedTextView
- android:id="@+id/result"
- android:maxLines="1"
- android:layout_width="0dp"
- android:layout_weight="1"
- android:layout_height="wrap_content"
- android:textSize="10sp"
- android:gravity="right" />
- </LinearLayout>
+ android:layout_alignParentTop="true">
+ <de.androvdr.widget.AnimatedTextView
+ android:id="@+id/result"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:gravity="right"
+ android:maxLines="1"
+ android:textSize="10sp" />
+ </LinearLayout>
<LinearLayout
android:id="@+id/rows0"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:orientation="horizontal"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
+ android:layout_below="@+id/resultwrapper"
android:layout_marginBottom="10dp"
- android:layout_below="@+id/resultwrapper">
+ android:orientation="horizontal">
<de.androvdr.widget.FontAwesomeButton
- style="?android:attr/buttonStyleSmall"
+ android:id="@+id/Power"
+ style="?android:attr/buttonStyleSmall"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:tag="Power"
- android:text="&#xf011;"
- android:id="@+id/Power" />
+ android:text="@string/fa_power_off" />
<de.androvdr.widget.FontAwesomeButton
style="?android:attr/buttonStyleSmall"
@@ -62,13 +61,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
- android:tag=""
- />
-
-
-
-
-
+ android:tag="" />
<de.androvdr.widget.FontAwesomeButton
@@ -85,10 +78,10 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:layout_alignParentRight="true"
+ android:layout_above="@+id/rows1"
android:layout_alignParentEnd="true"
- android:layout_below="@+id/colorButtons"
- android:layout_above="@+id/rows1">
+ android:layout_alignParentRight="true"
+ android:layout_below="@+id/colorButtons">
<de.androvdr.widget.SquareButton
android:id="@+id/ok"
@@ -104,93 +97,92 @@
<de.androvdr.widget.SquareButton
android:id="@+id/right"
style="@style/cursorButton"
- android:tag="Right"
- android:text="&#9654;"
android:layout_centerVertical="true"
+ android:layout_toEndOf="@+id/up"
android:layout_toRightOf="@+id/up"
- android:layout_toEndOf="@+id/up" />
+ android:tag="Right"
+ android:text="&#xf061;" />
<de.androvdr.widget.SquareButton
android:id="@+id/left"
style="@style/cursorButton"
- android:tag="Left"
- android:text="&#9664;"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/ok"
- android:layout_toStartOf="@+id/ok" />
+ android:layout_toStartOf="@+id/ok"
+ android:tag="Left"
+ android:text="&#xf060;" />
<de.androvdr.widget.SquareButton
android:id="@+id/up"
style="@style/cursorButton"
+ android:layout_above="@+id/ok"
+ android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal"
android:tag="Up"
- android:text="&#9650;"
- android:layout_above="@+id/ok"
- android:layout_centerHorizontal="true" />
+ android:text="&#xf062;" />
<de.androvdr.widget.FontAwesomeButton
android:id="@+id/ChannelUp"
style="@style/volChanButton"
- android:tag="Channel+"
- android:text="&#xf0aa;"
- android:layout_alignTop="@+id/up"
+ android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
- android:layout_alignParentEnd="true" />
+ android:layout_alignTop="@+id/up"
+ android:tag="Channel+"
+ android:text="&#xf0aa;" />
<de.androvdr.widget.FontAwesomeButton
android:id="@+id/VolumeUp"
style="@style/volChanButton"
android:layout_height="wrap_content"
- android:tag="Volume+"
- android:text="&#xf028;"
- android:layout_alignTop="@+id/up"
android:layout_alignParentLeft="true"
- android:layout_alignParentStart="true" />
+ android:layout_alignParentStart="true"
+ android:layout_alignTop="@+id/up"
+ android:tag="Volume+"
+ android:text="&#xf028;" />
<de.androvdr.widget.SquareButton
android:id="@+id/down"
style="@style/cursorButton"
- android:layout_gravity="center_horizontal"
-
- android:tag="Down"
- android:text="&#9660;"
android:layout_below="@+id/ok"
+
+ android:layout_gravity="center_horizontal"
android:layout_toLeftOf="@+id/right"
- android:layout_toStartOf="@+id/right" />
+ android:layout_toStartOf="@+id/right"
+ android:tag="Down"
+ android:text="&#xf063;" />
<de.androvdr.widget.FontAwesomeButton
android:id="@+id/ChannelDown"
style="@style/volChanButton"
- android:tag="Channel-"
- android:text="&#xf0ab;"
android:layout_alignBottom="@+id/down"
+ android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
- android:layout_alignParentEnd="true" />
+ android:tag="Channel-"
+ android:text="&#xf0ab;" />
<de.androvdr.widget.FontAwesomeButton
android:id="@+id/VolumeDown"
style="@style/volChanButton"
- android:tag="Volume-"
- android:text="&#xf027;"
android:layout_alignBottom="@+id/down"
android:layout_alignParentLeft="true"
- android:layout_alignParentStart="true" />
+ android:layout_alignParentStart="true"
+ android:tag="Volume-"
+ android:text="&#xf027;" />
</RelativeLayout>
-
<LinearLayout
android:id="@+id/colorButtons"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
- android:layout_below="@+id/rows0">
+ android:layout_alignParentRight="true"
+ android:layout_below="@+id/rows0"
+ android:orientation="horizontal">
<de.androvdr.widget.FontAwesomeButton
@@ -200,33 +192,30 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:tag="Red"
- android:text="&#xf04d;&#xf04d;&#xf04d;"
- android:textColor="@color/red"
- />
+ android:text="@string/remotesquares"
+ android:textColor="@color/red" />
<de.androvdr.widget.FontAwesomeButton
android:id="@+id/green"
style="?android:attr/buttonStyleSmall"
- android:layout_width="0dp"
+ android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
- android:text="&#xf04d;&#xf04d;&#xf04d;"
android:tag="Green"
- android:textColor="@color/green"
- />
+ android:text="@string/remotesquares"
+ android:textColor="@color/green" />
<de.androvdr.widget.FontAwesomeButton
android:id="@+id/yellow"
style="?android:attr/buttonStyleSmall"
- android:layout_width="0dp"
+ android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:tag="Yellow"
- android:text="&#xf04d;&#xf04d;&#xf04d;"
- android:textColor="@color/yellow"
- />
+ android:text="@string/remotesquares"
+ android:textColor="@color/yellow" />
<de.androvdr.widget.FontAwesomeButton
@@ -236,9 +225,8 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:tag="Blue"
- android:text="&#xf04d;&#xf04d;&#xf04d;"
- android:textColor="@color/blue"
- />
+ android:text="@string/remotesquares"
+ android:textColor="@color/blue" />
</LinearLayout>
@@ -248,10 +236,10 @@
android:id="@+id/rows1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
+ android:layout_above="@+id/rows2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
- android:orientation="horizontal"
- android:layout_above="@+id/rows2">
+ android:orientation="horizontal">
<de.androvdr.widget.FontAwesomeButton
style="?android:attr/buttonStyleSmall"
@@ -260,7 +248,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:tag="Mute"
- android:text="&#xf026;" />
+ android:text="@string/fa_mute" />
<de.androvdr.widget.FontAwesomeButton
@@ -295,13 +283,13 @@
<LinearLayout
+ android:id="@+id/rows2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:id="@+id/rows2"
- android:orientation="horizontal"
- android:layout_marginTop="10dp"
+ android:layout_alignParentBottom="true"
android:layout_marginBottom="10dp"
- android:layout_alignParentBottom="true">
+ android:layout_marginTop="10dp"
+ android:orientation="horizontal">
<de.androvdr.widget.FontAwesomeButton
style="?android:attr/buttonStyleSmall"
@@ -309,7 +297,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:tag="Audio"
- android:text="&#xf025;" />
+ android:text="@string/f025" />
<de.androvdr.widget.FontAwesomeButton
@@ -318,7 +306,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:tag="Subtitles"
- android:text="S" />
+ android:text="@string/fa_bars" />
<de.androvdr.widget.FontAwesomeButton
style="?android:attr/buttonStyleSmall"
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/res/layout/searchspinner.xml b/vdrmanager/de.bjusystems.vdrmanager/src/main/res/layout/searchspinner.xml
new file mode 100644
index 0000000..c71b36f
--- /dev/null
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/res/layout/searchspinner.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<com.toptoche.searchablespinnerlibrary.SearchableSpinner xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/spinner"
+ android:entries="@array/font"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/res/layout/simple_list_item_1_fa.xml b/vdrmanager/de.bjusystems.vdrmanager/src/main/res/layout/simple_list_item_1_fa.xml
new file mode 100644
index 0000000..6a493e1
--- /dev/null
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/res/layout/simple_list_item_1_fa.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2006 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<de.androvdr.widget.FontAwesomeTextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@android:id/text1"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceListItemSmall"
+ android:gravity="center_vertical"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:minHeight="?android:attr/listPreferredItemHeightSmall"
+ android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
+ android:paddingRight="?android:attr/listPreferredItemPaddingRight" />
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/res/values/arrays.xml b/vdrmanager/de.bjusystems.vdrmanager/src/main/res/values/arrays.xml
index c0398bd..94d1831 100644
--- a/vdrmanager/de.bjusystems.vdrmanager/src/main/res/values/arrays.xml
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/res/values/arrays.xml
@@ -37,17 +37,803 @@
<item>vdr-smarttvweb</item>
</string-array>
- <string-array name="recent_channels_order_entry_values">
- <item>most</item>
- <item>last</item>
- </string-array>
- <array name="recstream_smarttvweb_entry_values">
- <item>progressive</item>
+ <string-array name="recent_channels_order_entry_values">
+ <item>most</item>
+ <item>last</item>
+ </string-array>
+ <array name="recstream_smarttvweb_entry_values">
+ <item>progressive</item>
<item>has</item>
<item>hls</item>
- </array>
-
-
+ </array>
+ <string-array name="font">
+ <item> 500px </item>
+ <item> address-book </item>
+ <item> address-book-o </item>
+ <item> address-card </item>
+ <item> address-card-o </item>
+ <item> adjust </item>
+ <item> adn </item>
+ <item> align-center </item>
+ <item> align-justify </item>
+ <item> align-left </item>
+ <item> align-right </item>
+ <item> amazon </item>
+ <item> ambulance </item>
+ <item> american-sign-language-interpreting </item>
+ <item> anchor </item>
+ <item> android </item>
+ <item> angellist </item>
+ <item> angle-double-down </item>
+ <item> angle-double-left </item>
+ <item> angle-double-right </item>
+ <item> angle-double-up </item>
+ <item> angle-down </item>
+ <item> angle-left </item>
+ <item> angle-right </item>
+ <item> angle-up </item>
+ <item> apple </item>
+ <item> archive </item>
+ <item> area-chart </item>
+ <item> arrow-circle-down </item>
+ <item> arrow-circle-left </item>
+ <item> arrow-circle-o-down </item>
+ <item> arrow-circle-o-left </item>
+ <item> arrow-circle-o-right </item>
+ <item> arrow-circle-o-up </item>
+ <item> arrow-circle-right </item>
+ <item> arrow-circle-up </item>
+ <item> arrow-down </item>
+ <item> arrow-left </item>
+ <item> arrow-right </item>
+ <item> arrow-up </item>
+ <item> arrows </item>
+ <item> arrows-alt </item>
+ <item> arrows-h </item>
+ <item> arrows-v </item>
+ <item> asl-interpreting </item>
+ <item> assistive-listening-systems </item>
+ <item> asterisk </item>
+ <item> at </item>
+ <item> audio-description </item>
+ <item> automobile </item>
+ <item> backward </item>
+ <item> balance-scale </item>
+ <item> ban </item>
+ <item> bandcamp </item>
+ <item> bank </item>
+ <item> bar-chart </item>
+ <item> bar-chart-o </item>
+ <item> barcode </item>
+ <item> bars </item>
+ <item> bath </item>
+ <item> bathtub </item>
+ <item> battery </item>
+ <item> battery-0 </item>
+ <item> battery-1 </item>
+ <item> battery-2 </item>
+ <item> battery-3 </item>
+ <item> battery-4 </item>
+ <item> battery-empty </item>
+ <item> battery-full </item>
+ <item> battery-half </item>
+ <item> battery-quarter </item>
+ <item> battery-three-quarters </item>
+ <item> bed </item>
+ <item> beer </item>
+ <item> behance </item>
+ <item> behance-square </item>
+ <item> bell </item>
+ <item> bell-o </item>
+ <item> bell-slash </item>
+ <item> bell-slash-o </item>
+ <item> bicycle </item>
+ <item> binoculars </item>
+ <item> birthday-cake </item>
+ <item> bitbucket </item>
+ <item> bitbucket-square </item>
+ <item> bitcoin </item>
+ <item> black-tie </item>
+ <item> blind </item>
+ <item> bluetooth </item>
+ <item> bluetooth-b </item>
+ <item> bold </item>
+ <item> bolt </item>
+ <item> bomb </item>
+ <item> book </item>
+ <item> bookmark </item>
+ <item> bookmark-o </item>
+ <item> braille </item>
+ <item> briefcase </item>
+ <item> btc </item>
+ <item> bug </item>
+ <item> building </item>
+ <item> building-o </item>
+ <item> bullhorn </item>
+ <item> bullseye </item>
+ <item> bus </item>
+ <item> buysellads </item>
+ <item> cab </item>
+ <item> calculator </item>
+ <item> calendar </item>
+ <item> calendar-check-o </item>
+ <item> calendar-minus-o </item>
+ <item> calendar-o </item>
+ <item> calendar-plus-o </item>
+ <item> calendar-times-o </item>
+ <item> camera </item>
+ <item> camera-retro </item>
+ <item> car </item>
+ <item> caret-down </item>
+ <item> caret-left </item>
+ <item> caret-right </item>
+ <item> caret-square-o-down </item>
+ <item> caret-square-o-left </item>
+ <item> caret-square-o-right </item>
+ <item> caret-square-o-up </item>
+ <item> caret-up </item>
+ <item> cart-arrow-down </item>
+ <item> cart-plus </item>
+ <item> cc </item>
+ <item> cc-amex </item>
+ <item> cc-diners-club </item>
+ <item> cc-discover </item>
+ <item> cc-jcb </item>
+ <item> cc-mastercard </item>
+ <item> cc-paypal </item>
+ <item> cc-stripe </item>
+ <item> cc-visa </item>
+ <item> certificate </item>
+ <item> chain </item>
+ <item> chain-broken </item>
+ <item> check </item>
+ <item> check-circle </item>
+ <item> check-circle-o </item>
+ <item> check-square </item>
+ <item> check-square-o </item>
+ <item> chevron-circle-down </item>
+ <item> chevron-circle-left </item>
+ <item> chevron-circle-right </item>
+ <item> chevron-circle-up </item>
+ <item> chevron-down </item>
+ <item> chevron-left </item>
+ <item> chevron-right </item>
+ <item> chevron-up </item>
+ <item> child </item>
+ <item> chrome </item>
+ <item> circle </item>
+ <item> circle-o </item>
+ <item> circle-o-notch </item>
+ <item> circle-thin </item>
+ <item> clipboard </item>
+ <item> clock-o </item>
+ <item> clone </item>
+ <item> close </item>
+ <item> cloud </item>
+ <item> cloud-download </item>
+ <item> cloud-upload </item>
+ <item> cny </item>
+ <item> code </item>
+ <item> code-fork </item>
+ <item> codepen </item>
+ <item> codiepie </item>
+ <item> coffee </item>
+ <item> cog </item>
+ <item> cogs </item>
+ <item> columns </item>
+ <item> comment </item>
+ <item> comment-o </item>
+ <item> commenting </item>
+ <item> commenting-o </item>
+ <item> comments </item>
+ <item> comments-o </item>
+ <item> compass </item>
+ <item> compress </item>
+ <item> connectdevelop </item>
+ <item> contao </item>
+ <item> copy </item>
+ <item> copyright </item>
+ <item> creative-commons </item>
+ <item> credit-card </item>
+ <item> credit-card-alt </item>
+ <item> crop </item>
+ <item> crosshairs </item>
+ <item> css3 </item>
+ <item> cube </item>
+ <item> cubes </item>
+ <item> cut </item>
+ <item> cutlery </item>
+ <item> dashboard </item>
+ <item> dashcube </item>
+ <item> database </item>
+ <item> deaf </item>
+ <item> deafness </item>
+ <item> dedent </item>
+ <item> delicious </item>
+ <item> desktop </item>
+ <item> deviantart </item>
+ <item> diamond </item>
+ <item> digg </item>
+ <item> dollar </item>
+ <item> dot-circle-o </item>
+ <item> download </item>
+ <item> dribbble </item>
+ <item> drivers-license </item>
+ <item> drivers-license-o </item>
+ <item> dropbox </item>
+ <item> drupal </item>
+ <item> edge </item>
+ <item> edit </item>
+ <item> eercast </item>
+ <item> eject </item>
+ <item> ellipsis-h </item>
+ <item> ellipsis-v </item>
+ <item> empire </item>
+ <item> envelope </item>
+ <item> envelope-o </item>
+ <item> envelope-open </item>
+ <item> envelope-open-o </item>
+ <item> envelope-square </item>
+ <item> envira </item>
+ <item> eraser </item>
+ <item> etsy </item>
+ <item> eur </item>
+ <item> euro </item>
+ <item> exchange </item>
+ <item> exclamation </item>
+ <item> exclamation-circle </item>
+ <item> exclamation-triangle </item>
+ <item> expand </item>
+ <item> expeditedssl </item>
+ <item> external-link </item>
+ <item> external-link-square </item>
+ <item> eye </item>
+ <item> eye-slash </item>
+ <item> eyedropper </item>
+ <item> fa </item>
+ <item> facebook </item>
+ <item> facebook-f </item>
+ <item> facebook-official </item>
+ <item> facebook-square </item>
+ <item> fast-backward </item>
+ <item> fast-forward </item>
+ <item> fax </item>
+ <item> feed </item>
+ <item> female </item>
+ <item> fighter-jet </item>
+ <item> file </item>
+ <item> file-archive-o </item>
+ <item> file-audio-o </item>
+ <item> file-code-o </item>
+ <item> file-excel-o </item>
+ <item> file-image-o </item>
+ <item> file-movie-o </item>
+ <item> file-o </item>
+ <item> file-pdf-o </item>
+ <item> file-photo-o </item>
+ <item> file-picture-o </item>
+ <item> file-powerpoint-o </item>
+ <item> file-sound-o </item>
+ <item> file-text </item>
+ <item> file-text-o </item>
+ <item> file-video-o </item>
+ <item> file-word-o </item>
+ <item> file-zip-o </item>
+ <item> files-o </item>
+ <item> film </item>
+ <item> filter </item>
+ <item> fire </item>
+ <item> fire-extinguisher </item>
+ <item> firefox </item>
+ <item> first-order </item>
+ <item> flag </item>
+ <item> flag-checkered </item>
+ <item> flag-o </item>
+ <item> flash </item>
+ <item> flask </item>
+ <item> flickr </item>
+ <item> floppy-o </item>
+ <item> folder </item>
+ <item> folder-o </item>
+ <item> folder-open </item>
+ <item> folder-open-o </item>
+ <item> font </item>
+ <item> font-awesome </item>
+ <item> fonticons </item>
+ <item> fort-awesome </item>
+ <item> forumbee </item>
+ <item> forward </item>
+ <item> foursquare </item>
+ <item> free-code-camp </item>
+ <item> frown-o </item>
+ <item> futbol-o </item>
+ <item> gamepad </item>
+ <item> gavel </item>
+ <item> gbp </item>
+ <item> ge </item>
+ <item> gear </item>
+ <item> gears </item>
+ <item> genderless </item>
+ <item> get-pocket </item>
+ <item> gg </item>
+ <item> gg-circle </item>
+ <item> gift </item>
+ <item> git </item>
+ <item> git-square </item>
+ <item> github </item>
+ <item> github-alt </item>
+ <item> github-square </item>
+ <item> gitlab </item>
+ <item> gittip </item>
+ <item> glass </item>
+ <item> glide </item>
+ <item> glide-g </item>
+ <item> globe </item>
+ <item> google </item>
+ <item> google-plus </item>
+ <item> google-plus-circle </item>
+ <item> google-plus-official </item>
+ <item> google-plus-square </item>
+ <item> google-wallet </item>
+ <item> graduation-cap </item>
+ <item> gratipay </item>
+ <item> grav </item>
+ <item> group </item>
+ <item> h-square </item>
+ <item> hacker-news </item>
+ <item> hand-grab-o </item>
+ <item> hand-lizard-o </item>
+ <item> hand-o-down </item>
+ <item> hand-o-left </item>
+ <item> hand-o-right </item>
+ <item> hand-o-up </item>
+ <item> hand-paper-o </item>
+ <item> hand-peace-o </item>
+ <item> hand-pointer-o </item>
+ <item> hand-rock-o </item>
+ <item> hand-scissors-o </item>
+ <item> hand-spock-o </item>
+ <item> hand-stop-o </item>
+ <item> handshake-o </item>
+ <item> hard-of-hearing </item>
+ <item> hashtag </item>
+ <item> hdd-o </item>
+ <item> header </item>
+ <item> headphones </item>
+ <item> heart </item>
+ <item> heart-o </item>
+ <item> heartbeat </item>
+ <item> history </item>
+ <item> home </item>
+ <item> hospital-o </item>
+ <item> hotel </item>
+ <item> hourglass </item>
+ <item> hourglass-1 </item>
+ <item> hourglass-2 </item>
+ <item> hourglass-3 </item>
+ <item> hourglass-end </item>
+ <item> hourglass-half </item>
+ <item> hourglass-o </item>
+ <item> hourglass-start </item>
+ <item> houzz </item>
+ <item> html5 </item>
+ <item> i-cursor </item>
+ <item> id-badge </item>
+ <item> id-card </item>
+ <item> id-card-o </item>
+ <item> ils </item>
+ <item> image </item>
+ <item> imdb </item>
+ <item> inbox </item>
+ <item> indent </item>
+ <item> industry </item>
+ <item> info </item>
+ <item> info-circle </item>
+ <item> inr </item>
+ <item> instagram </item>
+ <item> institution </item>
+ <item> internet-explorer </item>
+ <item> intersex </item>
+ <item> ioxhost </item>
+ <item> italic </item>
+ <item> joomla </item>
+ <item> jpy </item>
+ <item> jsfiddle </item>
+ <item> key </item>
+ <item> keyboard-o </item>
+ <item> krw </item>
+ <item> language </item>
+ <item> laptop </item>
+ <item> lastfm </item>
+ <item> lastfm-square </item>
+ <item> leaf </item>
+ <item> leanpub </item>
+ <item> legal </item>
+ <item> lemon-o </item>
+ <item> level-down </item>
+ <item> level-up </item>
+ <item> life-bouy </item>
+ <item> life-buoy </item>
+ <item> life-ring </item>
+ <item> life-saver </item>
+ <item> lightbulb-o </item>
+ <item> line-chart </item>
+ <item> link </item>
+ <item> linkedin </item>
+ <item> linkedin-square </item>
+ <item> linode </item>
+ <item> linux </item>
+ <item> list </item>
+ <item> list-alt </item>
+ <item> list-ol </item>
+ <item> list-ul </item>
+ <item> location-arrow </item>
+ <item> lock </item>
+ <item> long-arrow-down </item>
+ <item> long-arrow-left </item>
+ <item> long-arrow-right </item>
+ <item> long-arrow-up </item>
+ <item> low-vision </item>
+ <item> magic </item>
+ <item> magnet </item>
+ <item> mail-forward </item>
+ <item> mail-reply </item>
+ <item> mail-reply-all </item>
+ <item> male </item>
+ <item> map </item>
+ <item> map-marker </item>
+ <item> map-o </item>
+ <item> map-pin </item>
+ <item> map-signs </item>
+ <item> mars </item>
+ <item> mars-double </item>
+ <item> mars-stroke </item>
+ <item> mars-stroke-h </item>
+ <item> mars-stroke-v </item>
+ <item> maxcdn </item>
+ <item> meanpath </item>
+ <item> medium </item>
+ <item> medkit </item>
+ <item> meetup </item>
+ <item> meh-o </item>
+ <item> mercury </item>
+ <item> microchip </item>
+ <item> microphone </item>
+ <item> microphone-slash </item>
+ <item> minus </item>
+ <item> minus-circle </item>
+ <item> minus-square </item>
+ <item> minus-square-o </item>
+ <item> mixcloud </item>
+ <item> mobile </item>
+ <item> mobile-phone </item>
+ <item> modx </item>
+ <item> money </item>
+ <item> moon-o </item>
+ <item> mortar-board </item>
+ <item> motorcycle </item>
+ <item> mouse-pointer </item>
+ <item> music </item>
+ <item> navicon </item>
+ <item> neuter </item>
+ <item> newspaper-o </item>
+ <item> object-group </item>
+ <item> object-ungroup </item>
+ <item> odnoklassniki </item>
+ <item> odnoklassniki-square </item>
+ <item> opencart </item>
+ <item> openid </item>
+ <item> opera </item>
+ <item> optin-monster </item>
+ <item> outdent </item>
+ <item> pagelines </item>
+ <item> paint-brush </item>
+ <item> paper-plane </item>
+ <item> paper-plane-o </item>
+ <item> paperclip </item>
+ <item> paragraph </item>
+ <item> paste </item>
+ <item> pause </item>
+ <item> pause-circle </item>
+ <item> pause-circle-o </item>
+ <item> paw </item>
+ <item> paypal </item>
+ <item> pencil </item>
+ <item> pencil-square </item>
+ <item> pencil-square-o </item>
+ <item> percent </item>
+ <item> phone </item>
+ <item> phone-square </item>
+ <item> photo </item>
+ <item> picture-o </item>
+ <item> pie-chart </item>
+ <item> pied-piper </item>
+ <item> pied-piper-alt </item>
+ <item> pied-piper-pp </item>
+ <item> pinterest </item>
+ <item> pinterest-p </item>
+ <item> pinterest-square </item>
+ <item> plane </item>
+ <item> play </item>
+ <item> play-circle </item>
+ <item> play-circle-o </item>
+ <item> plug </item>
+ <item> plus </item>
+ <item> plus-circle </item>
+ <item> plus-square </item>
+ <item> plus-square-o </item>
+ <item> podcast </item>
+ <item> power-off </item>
+ <item> print </item>
+ <item> product-hunt </item>
+ <item> puzzle-piece </item>
+ <item> qq </item>
+ <item> qrcode </item>
+ <item> question </item>
+ <item> question-circle </item>
+ <item> question-circle-o </item>
+ <item> quora </item>
+ <item> quote-left </item>
+ <item> quote-right </item>
+ <item> ra </item>
+ <item> random </item>
+ <item> ravelry </item>
+ <item> rebel </item>
+ <item> recycle </item>
+ <item> reddit </item>
+ <item> reddit-alien </item>
+ <item> reddit-square </item>
+ <item> refresh </item>
+ <item> registered </item>
+ <item> remove </item>
+ <item> renren </item>
+ <item> reorder </item>
+ <item> repeat </item>
+ <item> reply </item>
+ <item> reply-all </item>
+ <item> resistance </item>
+ <item> retweet </item>
+ <item> rmb </item>
+ <item> road </item>
+ <item> rocket </item>
+ <item> rotate-left </item>
+ <item> rotate-right </item>
+ <item> rouble </item>
+ <item> rss </item>
+ <item> rss-square </item>
+ <item> rub </item>
+ <item> ruble </item>
+ <item> rupee </item>
+ <item> s15 </item>
+ <item> safari </item>
+ <item> save </item>
+ <item> scissors </item>
+ <item> scribd </item>
+ <item> search </item>
+ <item> search-minus </item>
+ <item> search-plus </item>
+ <item> sellsy </item>
+ <item> send </item>
+ <item> send-o </item>
+ <item> server </item>
+ <item> share </item>
+ <item> share-alt </item>
+ <item> share-alt-square </item>
+ <item> share-square </item>
+ <item> share-square-o </item>
+ <item> shekel </item>
+ <item> sheqel </item>
+ <item> shield </item>
+ <item> ship </item>
+ <item> shirtsinbulk </item>
+ <item> shopping-bag </item>
+ <item> shopping-basket </item>
+ <item> shopping-cart </item>
+ <item> shower </item>
+ <item> sign-in </item>
+ <item> sign-language </item>
+ <item> sign-out </item>
+ <item> signal </item>
+ <item> signing </item>
+ <item> simplybuilt </item>
+ <item> sitemap </item>
+ <item> skyatlas </item>
+ <item> skype </item>
+ <item> slack </item>
+ <item> sliders </item>
+ <item> slideshare </item>
+ <item> smile-o </item>
+ <item> snapchat </item>
+ <item> snapchat-ghost </item>
+ <item> snapchat-square </item>
+ <item> snowflake-o </item>
+ <item> soccer-ball-o </item>
+ <item> sort </item>
+ <item> sort-alpha-asc </item>
+ <item> sort-alpha-desc </item>
+ <item> sort-amount-asc </item>
+ <item> sort-amount-desc </item>
+ <item> sort-asc </item>
+ <item> sort-desc </item>
+ <item> sort-down </item>
+ <item> sort-numeric-asc </item>
+ <item> sort-numeric-desc </item>
+ <item> sort-up </item>
+ <item> soundcloud </item>
+ <item> space-shuttle </item>
+ <item> spinner </item>
+ <item> spoon </item>
+ <item> spotify </item>
+ <item> square </item>
+ <item> square-o </item>
+ <item> stack-exchange </item>
+ <item> stack-overflow </item>
+ <item> star </item>
+ <item> star-half </item>
+ <item> star-half-empty </item>
+ <item> star-half-full </item>
+ <item> star-half-o </item>
+ <item> star-o </item>
+ <item> steam </item>
+ <item> steam-square </item>
+ <item> step-backward </item>
+ <item> step-forward </item>
+ <item> stethoscope </item>
+ <item> sticky-note </item>
+ <item> sticky-note-o </item>
+ <item> stop </item>
+ <item> stop-circle </item>
+ <item> stop-circle-o </item>
+ <item> street-view </item>
+ <item> strikethrough </item>
+ <item> stumbleupon </item>
+ <item> stumbleupon-circle </item>
+ <item> subscript </item>
+ <item> subway </item>
+ <item> suitcase </item>
+ <item> sun-o </item>
+ <item> superpowers </item>
+ <item> superscript </item>
+ <item> support </item>
+ <item> table </item>
+ <item> tablet </item>
+ <item> tachometer </item>
+ <item> tag </item>
+ <item> tags </item>
+ <item> tasks </item>
+ <item> taxi </item>
+ <item> telegram </item>
+ <item> television </item>
+ <item> tencent-weibo </item>
+ <item> terminal </item>
+ <item> text-height </item>
+ <item> text-width </item>
+ <item> th </item>
+ <item> th-large </item>
+ <item> th-list </item>
+ <item> themeisle </item>
+ <item> thermometer </item>
+ <item> thermometer-0 </item>
+ <item> thermometer-1 </item>
+ <item> thermometer-2 </item>
+ <item> thermometer-3 </item>
+ <item> thermometer-4 </item>
+ <item> thermometer-empty </item>
+ <item> thermometer-full </item>
+ <item> thermometer-half </item>
+ <item> thermometer-quarter </item>
+ <item> thermometer-three-quarters </item>
+ <item> thumb-tack </item>
+ <item> thumbs-down </item>
+ <item> thumbs-o-down </item>
+ <item> thumbs-o-up </item>
+ <item> thumbs-up </item>
+ <item> ticket </item>
+ <item> times </item>
+ <item> times-circle </item>
+ <item> times-circle-o </item>
+ <item> times-rectangle </item>
+ <item> times-rectangle-o </item>
+ <item> tint </item>
+ <item> toggle-down </item>
+ <item> toggle-left </item>
+ <item> toggle-off </item>
+ <item> toggle-on </item>
+ <item> toggle-right </item>
+ <item> toggle-up </item>
+ <item> trademark </item>
+ <item> train </item>
+ <item> transgender </item>
+ <item> transgender-alt </item>
+ <item> trash </item>
+ <item> trash-o </item>
+ <item> tree </item>
+ <item> trello </item>
+ <item> tripadvisor </item>
+ <item> trophy </item>
+ <item> truck </item>
+ <item> try </item>
+ <item> tty </item>
+ <item> tumblr </item>
+ <item> tumblr-square </item>
+ <item> turkish-lira </item>
+ <item> tv </item>
+ <item> twitch </item>
+ <item> twitter </item>
+ <item> twitter-square </item>
+ <item> umbrella </item>
+ <item> underline </item>
+ <item> undo </item>
+ <item> universal-access </item>
+ <item> university </item>
+ <item> unlink </item>
+ <item> unlock </item>
+ <item> unlock-alt </item>
+ <item> unsorted </item>
+ <item> upload </item>
+ <item> usb </item>
+ <item> usd </item>
+ <item> user </item>
+ <item> user-circle </item>
+ <item> user-circle-o </item>
+ <item> user-md </item>
+ <item> user-o </item>
+ <item> user-plus </item>
+ <item> user-secret </item>
+ <item> user-times </item>
+ <item> users </item>
+ <item> vcard </item>
+ <item> vcard-o </item>
+ <item> venus </item>
+ <item> venus-double </item>
+ <item> venus-mars </item>
+ <item> viacoin </item>
+ <item> viadeo </item>
+ <item> viadeo-square </item>
+ <item> video-camera </item>
+ <item> vimeo </item>
+ <item> vimeo-square </item>
+ <item> vine </item>
+ <item> vk </item>
+ <item> volume-control-phone </item>
+ <item> volume-down </item>
+ <item> volume-off </item>
+ <item> volume-up </item>
+ <item> warning </item>
+ <item> wechat </item>
+ <item> weibo </item>
+ <item> weixin </item>
+ <item> whatsapp </item>
+ <item> wheelchair </item>
+ <item> wheelchair-alt </item>
+ <item> wifi </item>
+ <item> wikipedia-w </item>
+ <item> window-close </item>
+ <item> window-close-o </item>
+ <item> window-maximize </item>
+ <item> window-minimize </item>
+ <item> window-restore </item>
+ <item> windows </item>
+ <item> won </item>
+ <item> wordpress </item>
+ <item> wpbeginner </item>
+ <item> wpexplorer </item>
+ <item> wpforms </item>
+ <item> wrench </item>
+ <item> xing </item>
+ <item> xing-square </item>
+ <item> y-combinator </item>
+ <item> y-combinator-square </item>
+ <item> yahoo </item>
+ <item> yc </item>
+ <item> yc-square </item>
+ <item> yelp </item>
+ <item> yen </item>
+ <item> yoast </item>
+ <item> youtube </item>
+ <item> youtube-play </item>
+ <item> youtube-square </item>
+ </string-array>
-</resources> \ No newline at end of file
+</resources>
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/res/values/colorpicker.xml b/vdrmanager/de.bjusystems.vdrmanager/src/main/res/values/colorpicker.xml
new file mode 100644
index 0000000..3be024e
--- /dev/null
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/res/values/colorpicker.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2007 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+ <string name="pref_summary_drawer_color">Set the color for the drawer background</string>
+ <string name="pref_dialog_title_color_picker">Pick a color.</string>
+ <string name="pref_dialog_color_picker_alpha">alpha</string>
+ <string name="pref_dialog_message_color_picker">Tap on center color to confirm.\nPress back to cancel.</string>
+</resources> \ No newline at end of file
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/res/values/dimens.xml b/vdrmanager/de.bjusystems.vdrmanager/src/main/res/values/dimens.xml
index 1ee0176..16758e5 100644
--- a/vdrmanager/de.bjusystems.vdrmanager/src/main/res/values/dimens.xml
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/res/values/dimens.xml
@@ -4,4 +4,6 @@
<dimen name="item_margin">0dp</dimen>
<dimen name="item_inset">2dp</dimen>
<dimen name="recycler_height">200dp</dimen>
+ <dimen name="color_picker_center">90dip</dimen>
+ <dimen name="color_picker_radius">30dip</dimen>
</resources>
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/res/values/font.xml b/vdrmanager/de.bjusystems.vdrmanager/src/main/res/values/font.xml
deleted file mode 100644
index 554cc96..0000000
--- a/vdrmanager/de.bjusystems.vdrmanager/src/main/res/values/font.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-
-<resources>
- <string-array name="font">
- <item> 500px</item>
- <item> address-book</item>
- <item> address-book-o</item>
- <item> address-card</item>
- <item> address-card-o</item>
- <item> adjust</item>
- <item> adn</item>
- </string-array>
-</resources>
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/res/values/strings.xml b/vdrmanager/de.bjusystems.vdrmanager/src/main/res/values/strings.xml
index 4f62261..433f581 100644
--- a/vdrmanager/de.bjusystems.vdrmanager/src/main/res/values/strings.xml
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/res/values/strings.xml
@@ -560,4 +560,26 @@
<string name="permission_rationale">The app needs Storage permissions to import/export.</string>
<string name="remote_keys_imported">Remote Keys imported: %1$s</string>
<string name="remote_nothing_to_import" >No custom mapping…</string>
+ <string name="reset">Reset</string>
+ <string name="back">Back</string>
+ <string name="ok">OK</string>
+ <string name="f061"></string>
+ <string name="f060"></string>
+ <string name="f062"></string>
+ <string name="remotesquares"></string>
+ <string name="fa_mute"></string>
+ <string name="f129"></string>
+ <string name="f177"></string>
+ <string name="f0c9"></string>
+ <string name="f0e2"></string>
+ <string name="f120"></string>
+ <string name="f027"></string>
+ <string name="f0ab"></string>
+ <string name="f063"></string>
+ <string name="f028"></string>
+ <string name="f0aa"></string>
+ <string name="f085"></string>
+ <string name="fa_power_off"></string>
+ <string name="fa_bars"></string>
+ <string name="f025"></string>
</resources>
diff --git a/vdrmanager/de.bjusystems.vdrmanager/src/main/res/values/styles.xml b/vdrmanager/de.bjusystems.vdrmanager/src/main/res/values/styles.xml
index 8ab89d1..f028cdc 100644
--- a/vdrmanager/de.bjusystems.vdrmanager/src/main/res/values/styles.xml
+++ b/vdrmanager/de.bjusystems.vdrmanager/src/main/res/values/styles.xml
@@ -84,7 +84,7 @@
<style name="AppTheme" parent="@style/Base.Theme.AppCompat" />
<style name="cursorButton">
- <item name="android:layout_width">70dp</item>
+ <item name="android:layout_width">50dp</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_margin">5dp</item>
</style>