summaryrefslogtreecommitdiff
path: root/vdrmanager/src/de/bjusystems
diff options
context:
space:
mode:
authorlado <herrlado@gmail.com>2012-01-22 15:21:28 +0100
committerlado <herrlado@gmail.com>2012-01-22 15:21:28 +0100
commit72ccd948f28c90074b17a0fd7061a1d8f9917297 (patch)
tree43b2644d6518f0143ea7df155fde56f8b08d824f /vdrmanager/src/de/bjusystems
parent717d466225e428e5e74ec2bfa88b90163fe85893 (diff)
downloadvdr-manager-72ccd948f28c90074b17a0fd7061a1d8f9917297.tar.gz
vdr-manager-72ccd948f28c90074b17a0fd7061a1d8f9917297.tar.bz2
added omdb.org
Diffstat (limited to 'vdrmanager/src/de/bjusystems')
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java15
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java55
2 files changed, 55 insertions, 15 deletions
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java
index ea3cfa2..8cc6a39 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java
@@ -10,6 +10,7 @@ import android.content.res.Configuration;
import android.text.TextUtils;
import android.widget.Toast;
import de.bjusystems.vdrmanager.R;
+import de.bjusystems.vdrmanager.app.Intents;
import de.bjusystems.vdrmanager.data.db.OrmDatabaseHelper;
import de.bjusystems.vdrmanager.gui.VdrListActivity;
@@ -67,6 +68,15 @@ public class Preferences {
private boolean showImdbButton = true;
/**
+ * Show OMDB button in epg details
+ */
+ private boolean showOmdbButton = true;
+
+ public boolean isShowOmdbButton() {
+ return showOmdbButton;
+ }
+
+ /**
* On Which imdb site to search?
*/
private String imdbUrl = "akas.imdb.com";
@@ -443,6 +453,10 @@ public class Preferences {
prefs.showImdbButton = getBoolean(context,
R.string.qui_show_imdb_button_key, true);
+ prefs.showOmdbButton = getBoolean(context,
+ R.string.qui_show_omdb_button_key, true);
+
+
prefs.imdbUrl = getString(context, R.string.qui_imdb_url_key, "imdb.de");
thePrefs = prefs;
@@ -504,6 +518,7 @@ public class Preferences {
Intent intent = new Intent();
intent.setClass(context, VdrListActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ intent.putExtra(Intents.EMPTY_CONFIG, Boolean.TRUE);
context.startActivity(intent);
Toast.makeText(context, R.string.no_vdr, Toast.LENGTH_SHORT).show();
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java
index 7843844..1b03a97 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java
@@ -57,7 +57,13 @@ public class EpgDetailsActivity extends ICSBaseActivity implements OnClickListen
public static String IMDB_URL = "http://%s/find?s=all&q=%s";
+ public static String OMDB_URL = "http://www.omdb.org/search?search[text]=%s";
+
private static final String IMDB_URL_ENCODING = "ISO-8859-1";
+
+ private static final String OMDB_URL_ENCODING = "UTF-8";
+
+
private String highlight = null;
@@ -308,25 +314,29 @@ public class EpgDetailsActivity extends ICSBaseActivity implements OnClickListen
b.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
- final TextView title = (TextView) view
- .findViewById(R.id.epg_detail_title);
- String url = String.format(IMDB_URL, Preferences.get()
- .getImdbUrl(), encode(String.valueOf(title.getText()), IMDB_URL_ENCODING));
- //url = encode(url, "utf-8");
- Intent i = new Intent(Intent.ACTION_VIEW);
- i.setData(Uri.parse(url));
- i.addCategory(Intent.CATEGORY_BROWSABLE);
- try{
- startActivity(i);
- }catch(ActivityNotFoundException anfe){
- Log.w(TAG, anfe);
- say(anfe.getLocalizedMessage());
- }
+ startFilmDatabaseBrowseIntent(String.format(IMDB_URL, Preferences.get().getImdbUrl()), view, IMDB_URL_ENCODING);
}
});
- // setThisAsOnClickListener(b);
}
+
+ b = view.findViewById(R.id.epg_event_omdb);
+
+ if (Preferences.get().isShowOmdbButton() == false) {
+ b.setVisibility(View.GONE);
+ } else {
+ b.setVisibility(View.VISIBLE);
+ b.setOnClickListener(new OnClickListener() {
+
+ public void onClick(View v) {
+ startFilmDatabaseBrowseIntent(OMDB_URL, view, OMDB_URL_ENCODING);
+ }
+ });
+ }
+
+
+
+
b = view.findViewById(R.id.epg_event_livetv);
if (Utils.isLive(event) == false) {
b.setVisibility(View.GONE);
@@ -345,6 +355,21 @@ public class EpgDetailsActivity extends ICSBaseActivity implements OnClickListen
}
}
+
+ private void startFilmDatabaseBrowseIntent(String url, View view, String encoding){
+ final TextView title = (TextView) view
+ .findViewById(R.id.epg_detail_title);
+ url = String.format(url, encode(String.valueOf(title.getText()), encoding));
+ Intent i = new Intent(Intent.ACTION_VIEW);
+ i.setData(Uri.parse(url));
+ i.addCategory(Intent.CATEGORY_BROWSABLE);
+ try{
+ startActivity(i);
+ }catch(ActivityNotFoundException anfe){
+ Log.w(TAG, anfe);
+ say(anfe.getLocalizedMessage());
+ }
+ }
private void setThisAsOnClickListener(View v) {
if (v != null) {