diff options
author | lado <herrlado@gmail.com> | 2016-01-04 17:11:22 +0100 |
---|---|---|
committer | lado <herrlado@gmail.com> | 2016-01-04 17:11:22 +0100 |
commit | 96367cf54a15167925a7fe8bdf207e027f32d593 (patch) | |
tree | 4b1453d6f4e2636fac81f147519cce94ca14c4f9 | |
parent | 44f80541e006a1c2b499201247dd47d9bf8f04b1 (diff) | |
download | vdr-manager-96367cf54a15167925a7fe8bdf207e027f32d593.tar.gz vdr-manager-96367cf54a15167925a7fe8bdf207e027f32d593.tar.bz2 |
avoid static field null in Preferences
22 files changed, 152 insertions, 79 deletions
diff --git a/vdrmanager/app/app.iml b/vdrmanager/app/app.iml index d4aab26..2904ba2 100644 --- a/vdrmanager/app/app.iml +++ b/vdrmanager/app/app.iml @@ -65,26 +65,19 @@ <sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.0/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/21.0.0/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" /> - <excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" /> + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/resources" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" /> + <excludeFolder url="file://$MODULE_DIR$/build/intermediates/tmp" /> <excludeFolder url="file://$MODULE_DIR$/build/outputs" /> <excludeFolder url="file://$MODULE_DIR$/build/tmp" /> </content> diff --git a/vdrmanager/app/src/main/AndroidManifest.xml b/vdrmanager/app/src/main/AndroidManifest.xml index 6615b76..11ee937 100644 --- a/vdrmanager/app/src/main/AndroidManifest.xml +++ b/vdrmanager/app/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="12270" - android:versionName="12.27" > + android:versionCode="12290" + android:versionName="12.29" > <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> diff --git a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/backup/Api14Adapter.java b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/backup/Api14Adapter.java index 0425191..642ceb7 100644 --- a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/backup/Api14Adapter.java +++ b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/backup/Api14Adapter.java @@ -33,6 +33,9 @@ public class Api14Adapter extends Api11Adapter { @Override public void configureActionBarHomeAsUp(Activity activity) { ActionBar actionBar = activity.getActionBar(); + if(actionBar == null){ + return; + } actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); } diff --git a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/data/EpgSearchTimeValues.java b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/data/EpgSearchTimeValues.java index 19878f3..c859db1 100644 --- a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/data/EpgSearchTimeValues.java +++ b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/data/EpgSearchTimeValues.java @@ -18,14 +18,14 @@ public class EpgSearchTimeValues { public List<EpgSearchTimeValue> getValues() { - final Preferences prefs = Preferences.getPreferences(); + // fixed values for now and next values.add(new EpgSearchTimeValue(0, context.getString(R.string.epg_list_time_now))); values.add(new EpgSearchTimeValue(1, context.getString(R.string.epg_list_time_next))); // get user defined values - final String userValueString = prefs.getEpgSearchTimes(); + final String userValueString = Preferences.get().getEpgSearchTimes(); final String[] userValues = userValueString.split(","); @@ -48,7 +48,7 @@ public class EpgSearchTimeValues { public void saveValues(final List<EpgSearchTimeValue> values) { // get old values - final Preferences prefs = Preferences.getPreferences(); + final Preferences prefs = Preferences.get(); // add value String newValues = ""; diff --git a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/data/Preferences.java b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/data/Preferences.java index a73a786..d4aaab9 100644 --- a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/data/Preferences.java +++ b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/data/Preferences.java @@ -10,6 +10,7 @@ import android.text.TextUtils; import de.bjusystems.vdrmanager.R; import de.bjusystems.vdrmanager.StringUtils; +import de.bjusystems.vdrmanager.app.VdrManagerApp; import de.bjusystems.vdrmanager.data.db.DBAccess; /** @@ -488,9 +489,9 @@ public class Preferences { * * @return preferences */ - public static Preferences getPreferences() { - return thePrefs; - } + //public static Preferences getPreferences() { + //return thePrefs; + //} public String getRecStreamMethod() { return getCurrentVdr().getRecStreamMethod(); @@ -505,6 +506,7 @@ public class Preferences { return thePrefs; } + private static void initInternal(final Context context) { final Preferences prefs = new Preferences(); @@ -593,18 +595,24 @@ public class Preferences { * @return Preferences */ public static void init(final Context context) { - // if (thePrefs != null) { - // return; - // } - synchronized (Preferences.class) { - // if (thePrefs != null) { - // return; - // } - initInternal(context); + + try { + if (thePrefs != null) { + return; + } + synchronized (Preferences.class) { + if(thePrefs != null){ + return; + } + initInternal(context); + initVDR(context); + } + } finally { setLocale(context); } } + private static boolean initFromOldVersion(Context context) { Vdr vdr = new Vdr(); diff --git a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/data/Timer.java b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/data/Timer.java index 7782dca..1c48ca5 100644 --- a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/data/Timer.java +++ b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/data/Timer.java @@ -4,6 +4,7 @@ import java.util.Calendar; import java.util.Date; import java.util.TimeZone; +import android.content.Context; import android.text.TextUtils; import de.bjusystems.vdrmanager.StringUtils; import de.bjusystems.vdrmanager.app.C; diff --git a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/gui/BaseActivity.java b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/gui/BaseActivity.java index 9e0ccc4..ce5e089 100644 --- a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/gui/BaseActivity.java +++ b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/gui/BaseActivity.java @@ -53,6 +53,10 @@ public abstract class BaseActivity<Result, T extends ListView> extends private ProgressDialog progress; + protected Preferences getPrefs(){ + return Preferences.get(); + } + // protected SvdrpProgressDialog progress; private CharSequence mDrawerTitle; @@ -119,8 +123,7 @@ public abstract class BaseActivity<Result, T extends ListView> extends @Override protected void onResume() { - Preferences.setLocale(this); - // Preferences.init(this); + Preferences.init(this); super.onResume(); } diff --git a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java index 3b6bf94..a41be92 100644 --- a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java +++ b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java @@ -2,6 +2,7 @@ package de.bjusystems.vdrmanager.gui; import java.net.URLEncoder; import java.util.ArrayList; +import java.util.Date; import java.util.List; import android.app.AlertDialog; @@ -9,6 +10,7 @@ import android.app.SearchManager; import android.content.ActivityNotFoundException; import android.content.DialogInterface; import android.content.Intent; +import android.gesture.Prediction; import android.net.Uri; import android.os.Bundle; import android.os.Parcelable; @@ -52,7 +54,7 @@ import de.bjusystems.vdrmanager.utils.svdrp.SvdrpEvent; /** * This class is used for showing what's current running on all channels * - * @author bju + * @author bju22 */ public class EpgDetailsActivity extends ActionBarActivity implements OnClickListener, OnPageChangeListener, View.OnLongClickListener { @@ -97,6 +99,15 @@ public class EpgDetailsActivity extends ActionBarActivity implements } final Timer timer = new Timer(cEvent); + + Date start = new Date(timer.getStart().getTime() + - Preferences.get().getTimerPreMargin() * 60000); + timer.setStart(start); + + Date end = new Date(timer.getStop().getTime() + + Preferences.get().getTimerPostMargin() * 60000); + timer.setStop(end); + final CreateTimerTask task = new CreateTimerTask( EpgDetailsActivity.this, timer) { boolean error = false; @@ -405,7 +416,9 @@ public class EpgDetailsActivity extends ActionBarActivity implements public void onClick(View v) { startFilmDatabaseBrowseIntent( - String.format(IMDB_BASE_URL, Preferences.get() + String.format(IMDB_BASE_URL, Preferences.get( + + ) .getImdbUrl()) + IMDB_URL_QUERY, view, IMDB_URL_ENCODING); } @@ -493,7 +506,7 @@ public class EpgDetailsActivity extends ActionBarActivity implements @Override protected void onResume() { super.onResume(); - // TODO Check here whether the config has changed for imdb + Preferences.init(this); } @Override diff --git a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/gui/EpgSearchTimesListActivity.java b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/gui/EpgSearchTimesListActivity.java index 9be94cb..0a131ff 100644 --- a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/gui/EpgSearchTimesListActivity.java +++ b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/gui/EpgSearchTimesListActivity.java @@ -94,6 +94,7 @@ public class EpgSearchTimesListActivity extends Activity @Override protected void onResume() { super.onResume(); + Preferences.init(this); } @Override diff --git a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/gui/TimerDetailsActivity.java b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/gui/TimerDetailsActivity.java index c6ce4a6..1b30890 100644 --- a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/gui/TimerDetailsActivity.java +++ b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/gui/TimerDetailsActivity.java @@ -147,6 +147,12 @@ public class TimerDetailsActivity extends Activity implements OnClickListener, } + @Override + protected void onResume() { + super.onResume(); + Preferences.init(this); + } + private void vpsUnchecked() { if (prevStart != null) { tView.startField.setText(prevStart); diff --git a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/gui/Utils.java b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/gui/Utils.java index 1116736..4d039fd 100644 --- a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/gui/Utils.java +++ b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/gui/Utils.java @@ -140,7 +140,7 @@ public class Utils { private static String getBaseUrl() { final StringBuilder sb = new StringBuilder(); - final Preferences p = Preferences.getPreferences(); + final Preferences p = Preferences.get(); String auth = trimToEmpty(p.getStreamingUsername()) + ":" + trimToEmpty(p.getStreamingPassword()); if (auth.length() == 1) { @@ -156,7 +156,7 @@ public class Utils { private static String getStreamUrl(final String chn) { // "http://192.168.1.119:3000/TS/" - final Preferences p = Preferences.getPreferences(); + final Preferences p = Preferences.get(); final StringBuilder sb = new StringBuilder(); sb.append(getBaseUrl()).append("/").append(p.getStreamFormat()) .append("/").append(chn); @@ -167,7 +167,7 @@ public class Utils { private static String getRemuxStreamUrl(final String chn) { // "http://192.168.1.119:3000/TS/" final StringBuilder sb = new StringBuilder(); - final Preferences p = Preferences.getPreferences(); + final Preferences p = Preferences.get(); sb.append(getBaseUrl()).append("/").append(p.getRemuxCommand()) .append(";").append(p.getRemuxParameter()).append("/") .append(chn); @@ -339,16 +339,19 @@ public class Utils { private static String getRecordingStream(final Activity ctx, final Recording rec) { - final String m = Preferences.get().getRecStreamMethod(); + + Preferences prefs = Preferences.get(); + + final String m = prefs.getRecStreamMethod(); final StringBuilder url = new StringBuilder(); if (StringUtils.equals(m, "vdr-live")) { url.append("http://") - .append(Preferences.get().getHost()) + .append(prefs.getHost()) // .append(":") - .append(Integer.valueOf(Preferences.get().getLivePort())) + .append(Integer.valueOf(prefs.getLivePort())) // .append("/recstream.html?recid=recording_") .append(Utils.md5(rec.getFileName())); @@ -356,21 +359,22 @@ public class Utils { final String urlstring = url.toString(); return urlstring; } else if (StringUtils.equals(m, "vdr-streamdev")) { - url.append("http://").append(Preferences.get().getHost()) + url.append("http://").append(prefs.getHost()) // .append(":") - .append(Integer.valueOf(Preferences.get().getStreamPort())) + .append(Integer.valueOf( + prefs.getStreamPort())) // .append("/").append(rec.getDevInode()); } else if (StringUtils.equals(m, "vdr-smarttvweb")) { - String type = Preferences.get().getSmarttvewebType(); + String type = prefs.getSmarttvewebType(); url.append("http://") - .append(Preferences.get().getHost()) + .append(prefs.getHost()) // .append(":") - .append(Integer.valueOf(Preferences.get() + .append(Integer.valueOf(prefs .getSmarttvewebPort())) // .append(Utils.encodeUrlPath(rec.getFileName())); diff --git a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/gui/VdrListActivity.java b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/gui/VdrListActivity.java index a499d00..615917a 100644 --- a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/gui/VdrListActivity.java +++ b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/gui/VdrListActivity.java @@ -3,12 +3,14 @@ package de.bjusystems.vdrmanager.gui; import java.util.ArrayList; import java.util.List; +import android.app.Activity; import android.app.AlertDialog; import android.app.ListActivity; import android.content.DialogInterface; import android.content.Intent; import android.graphics.Typeface; import android.os.Bundle; +import android.support.v7.app.ActionBarActivity; import android.text.SpannableString; import android.text.style.UnderlineSpan; import android.view.Menu; @@ -20,6 +22,7 @@ import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemLongClickListener; import android.widget.ArrayAdapter; +import android.widget.ListView; import android.widget.TextView; import de.bjusystems.vdrmanager.R; import de.bjusystems.vdrmanager.app.Intents; @@ -29,8 +32,8 @@ import de.bjusystems.vdrmanager.data.Preferences; import de.bjusystems.vdrmanager.data.Vdr; import de.bjusystems.vdrmanager.data.db.DBAccess; -public class VdrListActivity extends ListActivity implements - OnItemClickListener, OnItemLongClickListener { +public class VdrListActivity extends ActionBarActivity implements + OnItemClickListener, OnItemLongClickListener, View.OnClickListener { private static final String TAG = VdrListActivity.class.getName(); @@ -64,6 +67,17 @@ public class VdrListActivity extends ListActivity implements 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; @@ -78,6 +92,9 @@ public class VdrListActivity extends ListActivity implements 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, @@ -149,10 +166,13 @@ public class VdrListActivity extends ListActivity implements // } // // }; - setListAdapter(adapter); - registerForContextMenu(getListView()); - getListView().setOnItemClickListener(this); - getListView().setOnItemLongClickListener(this); + 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)); } /* @@ -257,7 +277,7 @@ public class VdrListActivity extends ListActivity implements .setNegativeButton(android.R.string.cancel, null)// .create()// .show(); - return false; + return true; } @Override @@ -278,9 +298,6 @@ public class VdrListActivity extends ListActivity implements BackupSettingsActivity.class); startActivity(intent); return true; - } else if (item.getItemId() == R.id.main_menu_vdrlist_add) { - editVdr(null); - return true; } return super.onOptionsItemSelected(item); } diff --git a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/gui/VdrPreferencesActivity.java b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/gui/VdrPreferencesActivity.java index 0d01737..143954c 100644 --- a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/gui/VdrPreferencesActivity.java +++ b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/gui/VdrPreferencesActivity.java @@ -482,6 +482,8 @@ public class VdrPreferencesActivity extends BasePreferencesActivity implements return true; } + + @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode != Activity.RESULT_OK) { diff --git a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/remote/RemoteActivity.java b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/remote/RemoteActivity.java index 57f76d4..34f5533 100644 --- a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/remote/RemoteActivity.java +++ b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/remote/RemoteActivity.java @@ -85,6 +85,7 @@ public class RemoteActivity extends Activity implements OnClickListener, View.On return true; } + @Override public void onBackPressed() { if(isBackKeyRemapped() == false) { @@ -188,6 +189,12 @@ public class RemoteActivity extends Activity implements OnClickListener, View.On } + @Override + protected void onResume() { + super.onResume(); + Preferences.init(this); + } + public void setAllButtonListener(ViewGroup viewGroup) { // diff --git a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/utils/svdrp/EpgClient.java b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/utils/svdrp/EpgClient.java index a3d5b7e..6b651ab 100644 --- a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/utils/svdrp/EpgClient.java +++ b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/utils/svdrp/EpgClient.java @@ -1,5 +1,7 @@ package de.bjusystems.vdrmanager.utils.svdrp; +import android.content.Context; + import de.bjusystems.vdrmanager.R; import de.bjusystems.vdrmanager.data.Channel; import de.bjusystems.vdrmanager.data.Epg; @@ -63,7 +65,7 @@ public class EpgClient extends SvdrpClient<Epg> { @Override public void run() { if (time != null) { - runCommand(String.format("tevents %s %s", time, Preferences.getPreferences().getChannels())); + runCommand(String.format("tevents %s %s", time, Preferences.get().getChannels())); } else if (channel != null) { runCommand(String.format("cevents %s", channel.getNumber())); } else if (search != null) { diff --git a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/utils/svdrp/RecordingClient.java b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/utils/svdrp/RecordingClient.java index f201ed9..99d88f9 100644 --- a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/utils/svdrp/RecordingClient.java +++ b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/utils/svdrp/RecordingClient.java @@ -1,5 +1,7 @@ package de.bjusystems.vdrmanager.utils.svdrp; +import android.content.Context; + import de.bjusystems.vdrmanager.R; import de.bjusystems.vdrmanager.data.Recording; diff --git a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/utils/svdrp/SetTimerClient.java b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/utils/svdrp/SetTimerClient.java index f672791..8abc02a 100644 --- a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/utils/svdrp/SetTimerClient.java +++ b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/utils/svdrp/SetTimerClient.java @@ -1,5 +1,7 @@ package de.bjusystems.vdrmanager.utils.svdrp; +import android.content.Context; + import de.bjusystems.vdrmanager.R; import de.bjusystems.vdrmanager.data.Timer; diff --git a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/utils/svdrp/SvdrpClient.java b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/utils/svdrp/SvdrpClient.java index 6efee8b..a1b13f5 100644 --- a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/utils/svdrp/SvdrpClient.java +++ b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/utils/svdrp/SvdrpClient.java @@ -16,6 +16,7 @@ import java.util.TimerTask; import java.util.zip.GZIPInputStream; import java.util.zip.InflaterInputStream; +import android.content.Context; import android.sax.StartElementListener; import android.util.Log; import de.bjusystems.vdrmanager.app.C; @@ -66,7 +67,7 @@ public abstract class SvdrpClient<Result> { private final Timer watchDog = new Timer(); private String encoding; - + // private NativeDES crypt = new NativeDES(); @@ -96,11 +97,8 @@ public abstract class SvdrpClient<Result> { * @param prefs * Preferences */ - protected SvdrpClient( - final CertificateProblemListener certificateProblemListener) { - // results.clear(); + protected SvdrpClient(final CertificateProblemListener certificateProblemListener) { this.certificateProblemListener = certificateProblemListener; - encoding = Preferences.get().getEncoding(); } /** @@ -223,11 +221,12 @@ public abstract class SvdrpClient<Result> { protected boolean connect() throws IOException { final Preferences prefs = Preferences.get(); + encoding = prefs.getEncoding(); try { // connect informListener(SvdrpEvent.CONNECTING); - if (Preferences.get().isSecure()) { + if (prefs.isSecure()) { socket = new MySSLSocketFactory(false, certificateProblemListener).createSocket(); } else { diff --git a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/utils/svdrp/TimerClient.java b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/utils/svdrp/TimerClient.java index 1f55750..90ad2f7 100644 --- a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/utils/svdrp/TimerClient.java +++ b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/utils/svdrp/TimerClient.java @@ -1,5 +1,7 @@ package de.bjusystems.vdrmanager.utils.svdrp; +import android.content.Context; + import java.util.HashMap; import java.util.Map; diff --git a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/utils/wakeup/AsyncWakeupTask.java b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/utils/wakeup/AsyncWakeupTask.java index 5268eb4..5c30983 100644 --- a/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/utils/wakeup/AsyncWakeupTask.java +++ b/vdrmanager/app/src/main/java/de/bjusystems/vdrmanager/utils/wakeup/AsyncWakeupTask.java @@ -23,9 +23,9 @@ public class AsyncWakeupTask extends AsyncTask<Object, WakeupProgress, Void> { Wakeuper getWakeuper() { // Preferences - final Preferences prefs = Preferences.getPreferences(); + final Preferences prefs = Preferences.get(); - if (Preferences.getPreferences().getWakeupMethod().equals("url")) { + if (Preferences.get().getWakeupMethod().equals("url")) { return new Wakeuper() { public void wakeup(Context context) { // wakeup by http request diff --git a/vdrmanager/app/src/main/res/layout/vdr_list_add_delete.xml b/vdrmanager/app/src/main/res/layout/vdr_list_add_delete.xml index 054b4d5..a8b0e85 100644 --- a/vdrmanager/app/src/main/res/layout/vdr_list_add_delete.xml +++ b/vdrmanager/app/src/main/res/layout/vdr_list_add_delete.xml @@ -1,24 +1,37 @@ <?xml version="1.0" encoding="utf-8"?> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="fill_parent" android:orientation="vertical" - android:layout_height="fill_parent" > +<RelativeLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="fill_parent"> + - <ListView - android:id="@id/android:list" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:choiceMode="singleChoice" - android:drawSelectorOnTop="false" - android:fastScrollEnabled="true" - android:scrollingCache="true" /> <TextView - android:id="@android:id/empty" + android:id="@+id/empty_view" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" - android:padding="20dip" + android:padding="20.0dip" android:text="@string/no_vdr" android:textAppearance="?android:textAppearanceMedium" /> -</LinearLayout>
\ No newline at end of file + <Button + android:id="@+id/new_vdr" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_alignParentBottom="true" + + android:text="@string/new_vdr" /> + + + <ListView + android:id="@+id/vdr_list" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_alignParentTop="true" + android:choiceMode="singleChoice" + android:drawSelectorOnTop="false" + android:fastScrollEnabled="true" + android:layout_above="@+id/new_vdr" + android:scrollingCache="true" /> +</RelativeLayout>
\ No newline at end of file diff --git a/vdrmanager/app/src/main/res/menu/vdrlist.xml b/vdrmanager/app/src/main/res/menu/vdrlist.xml index f156173..821dc21 100644 --- a/vdrmanager/app/src/main/res/menu/vdrlist.xml +++ b/vdrmanager/app/src/main/res/menu/vdrlist.xml @@ -2,11 +2,6 @@ <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:v7="http://schemas.android.com/apk/res-auto" > <item - android:id="@+id/main_menu_vdrlist_add" - android:icon="@android:drawable/ic_menu_add" - v7:showAsAction="always" - android:title="@string/new_vdr"/> - <item android:id="@+id/main_menu_vdrlist_restore" android:title="@string/settings_backup_restore"/> |