diff options
author | lado <herrlado@gmail.com> | 2011-10-06 23:55:23 +0200 |
---|---|---|
committer | lado <herrlado@gmail.com> | 2011-10-06 23:55:23 +0200 |
commit | 0db278911f3b97569a98bbdd294dea30bcc4ad02 (patch) | |
tree | 7a586b104d35a8ab3aabc64460d8055354122faa | |
parent | 24528f410712a25d17e586dd31a0615e2ec86464 (diff) | |
download | vdr-manager-0db278911f3b97569a98bbdd294dea30bcc4ad02.tar.gz vdr-manager-0db278911f3b97569a98bbdd294dea30bcc4ad02.tar.bz2 |
Better vdr logo and the main screen
17 files changed, 198 insertions, 207 deletions
diff --git a/vdrmanager/res/drawable/btn_channels.png b/vdrmanager/res/drawable/btn_channels.png Binary files differnew file mode 100644 index 0000000..b1eff10 --- /dev/null +++ b/vdrmanager/res/drawable/btn_channels.png diff --git a/vdrmanager/res/drawable/btn_clock.png b/vdrmanager/res/drawable/btn_clock.png Binary files differnew file mode 100644 index 0000000..f682d6d --- /dev/null +++ b/vdrmanager/res/drawable/btn_clock.png diff --git a/vdrmanager/res/drawable/btn_epglist.jpg b/vdrmanager/res/drawable/btn_epglist.jpg Binary files differnew file mode 100644 index 0000000..e5a6df5 --- /dev/null +++ b/vdrmanager/res/drawable/btn_epglist.jpg diff --git a/vdrmanager/res/drawable/btn_recordings.png b/vdrmanager/res/drawable/btn_recordings.png Binary files differnew file mode 100644 index 0000000..f2af210 --- /dev/null +++ b/vdrmanager/res/drawable/btn_recordings.png diff --git a/vdrmanager/res/drawable/btn_search.png b/vdrmanager/res/drawable/btn_search.png Binary files differnew file mode 100644 index 0000000..b925f3a --- /dev/null +++ b/vdrmanager/res/drawable/btn_search.png diff --git a/vdrmanager/res/drawable/btn_search_epg.png b/vdrmanager/res/drawable/btn_search_epg.png Binary files differnew file mode 100755 index 0000000..c8a2717 --- /dev/null +++ b/vdrmanager/res/drawable/btn_search_epg.png diff --git a/vdrmanager/res/drawable/btn_timer.png b/vdrmanager/res/drawable/btn_timer.png Binary files differnew file mode 100644 index 0000000..b7fe536 --- /dev/null +++ b/vdrmanager/res/drawable/btn_timer.png diff --git a/vdrmanager/res/drawable/btn_wakeup.png b/vdrmanager/res/drawable/btn_wakeup.png Binary files differnew file mode 100644 index 0000000..eda2e95 --- /dev/null +++ b/vdrmanager/res/drawable/btn_wakeup.png diff --git a/vdrmanager/res/drawable/epg.png b/vdrmanager/res/drawable/epg.png Binary files differdeleted file mode 100644 index 50a1992..0000000 --- a/vdrmanager/res/drawable/epg.png +++ /dev/null diff --git a/vdrmanager/res/drawable/icon.png b/vdrmanager/res/drawable/icon.png Binary files differnew file mode 100644 index 0000000..7197eab --- /dev/null +++ b/vdrmanager/res/drawable/icon.png diff --git a/vdrmanager/res/drawable/vdr_logo.jpg b/vdrmanager/res/drawable/vdr_logo.jpg Binary files differdeleted file mode 100644 index bba3a1f..0000000 --- a/vdrmanager/res/drawable/vdr_logo.jpg +++ /dev/null diff --git a/vdrmanager/res/drawable/vdr_logo.png b/vdrmanager/res/drawable/vdr_logo.png Binary files differnew file mode 100644 index 0000000..6d88fa6 --- /dev/null +++ b/vdrmanager/res/drawable/vdr_logo.png diff --git a/vdrmanager/res/layout-land/vdrmanager.xml b/vdrmanager/res/layout-land/vdrmanager.xml new file mode 100644 index 0000000..73dd011 --- /dev/null +++ b/vdrmanager/res/layout-land/vdrmanager.xml @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" android:layout_height="fill_parent" + android:orientation="vertical" android:padding="10dip"> + + <ImageView android:id="@+id/main_logo" android:layout_width="fill_parent" + android:layout_height="90dip" android:src="@drawable/vdr_logo" android:paddingBottom="5dip" /> + + <!-- <ListView android:id="@+id/vdrmanager_menu" android:layout_width="fill_parent" + android:layout_height="wrap_content" android:layout_below="@id/main_logo"/> --> + + <LinearLayout android:layout_width="fill_parent" + android:layout_height="wrap_content" android:orientation="horizontal" android:padding="3dip"> + <Button android:text="@string/action_menu_channels" + xmlns:android="http://schemas.android.com/apk/res/android" + android:drawableTop="@drawable/btn_channels" android:layout_width="wrap_content" + android:id="@+id/action_menu_channels" android:layout_height="wrap_content" + android:textColor="#FFF" android:layout_weight="1" + android:cacheColorHint="?android:attr/colorBackground" + android:background="@android:drawable/list_selector_background"/> + + + <Button android:text="@string/action_menu_recordings" + xmlns:android="http://schemas.android.com/apk/res/android" android:padding="3dip" + android:drawableTop="@drawable/btn_recordings" android:layout_width="wrap_content" + android:id="@+id/action_menu_recordings" android:layout_height="wrap_content" + android:textAppearance="?android:textAppearanceSmall" android:layout_weight="1" + android:cacheColorHint="?android:attr/colorBackground" + android:background="@android:drawable/list_selector_background" + android:textColor="#FFF" + /> + + <Button android:text="@string/action_menu_timers" + xmlns:android="http://schemas.android.com/apk/res/android" android:padding="3dip" + android:drawableTop="@drawable/btn_timer" android:layout_width="wrap_content" + android:id="@+id/action_menu_timers" android:layout_height="wrap_content" + android:textAppearance="?android:textAppearanceSmall" android:layout_weight="1" + android:cacheColorHint="?android:attr/colorBackground" + android:background="@android:drawable/list_selector_background" + android:textColor="#FFF" /> + </LinearLayout> + <LinearLayout android:layout_width="fill_parent" + android:layout_height="wrap_content" android:orientation="horizontal"> + <Button android:text="@string/action_menu_epg" + xmlns:android="http://schemas.android.com/apk/res/android" + android:drawableTop="@drawable/btn_epglist" android:layout_width="wrap_content" + android:id="@+id/action_menu_epg" android:layout_height="wrap_content" + android:textAppearance="?android:textAppearanceSmall" android:layout_weight="1" + android:cacheColorHint="?android:attr/colorBackground" + android:padding="3dip" + android:background="@android:drawable/list_selector_background" + android:textColor="#FFF" /> + + <Button android:text="@string/action_menu_search" + xmlns:android="http://schemas.android.com/apk/res/android" + android:drawableTop="@drawable/btn_search" android:layout_width="wrap_content" + android:id="@+id/action_menu_search" android:layout_height="wrap_content" + android:textAppearance="?android:textAppearanceSmall" android:layout_weight="1" + android:cacheColorHint="?android:attr/colorBackground" + android:background="@android:drawable/list_selector_background" + android:padding="3dip" + android:textColor="#FFF" /> + + <Button android:text="@string/action_menu_wakeup" + xmlns:android="http://schemas.android.com/apk/res/android" android:layout_weight="1" + android:padding="3dip" + android:drawableTop="@drawable/btn_wakeup" android:layout_width="wrap_content" + android:id="@+id/action_menu_wakeup" android:layout_height="wrap_content" + android:textAppearance="?android:textAppearanceSmall" + android:cacheColorHint="?android:attr/colorBackground" + android:background="@android:drawable/list_selector_background" + android:textColor="#FFF" /> + </LinearLayout> +</LinearLayout> diff --git a/vdrmanager/res/layout/child_layout.xml b/vdrmanager/res/layout/child_layout.xml index 6819fea..8ea125a 100644 --- a/vdrmanager/res/layout/child_layout.xml +++ b/vdrmanager/res/layout/child_layout.xml @@ -6,6 +6,7 @@ android:layout_height="40dip" android:text="Channel" android:gravity="center_vertical|left" android:paddingLeft="15dip" android:paddingRight="5dip" android:textColor="#ffffffff" android:background="@android:drawable/list_selector_background" - android:textSize="17dip"/> + android:textStyle="bold" + android:textAppearance="?android:textAppearanceMedium"/> </LinearLayout> diff --git a/vdrmanager/res/layout/group_layout.xml b/vdrmanager/res/layout/group_layout.xml index 825a8e4..4553ae3 100644 --- a/vdrmanager/res/layout/group_layout.xml +++ b/vdrmanager/res/layout/group_layout.xml @@ -1,10 +1,12 @@ <LinearLayout android:id="@+id/LinearLayout01" android:layout_width="fill_parent" android:layout_height="40dip" xmlns:android="http://schemas.android.com/apk/res/android"> - +<!-- --> <TextView android:id="@+id/channel_name" android:layout_width="fill_parent" android:layout_height="40dip" android:text="Groups" android:gravity="center_vertical|left" android:paddingLeft="35dip" android:paddingRight="5dip" + android:textColor="#BDBDBD" android:textStyle="bold" - android:textSize="16dip"/> + android:textAppearance="?android:textAppearanceMedium" + /> </LinearLayout> diff --git a/vdrmanager/res/layout/vdrmanager.xml b/vdrmanager/res/layout/vdrmanager.xml index d4ca7db..b868f38 100644 --- a/vdrmanager/res/layout/vdrmanager.xml +++ b/vdrmanager/res/layout/vdrmanager.xml @@ -1,28 +1,74 @@ <?xml version="1.0" encoding="utf-8"?> -<RelativeLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:orientation="vertical"> - - <ImageView - android:id="@+id/main_logo" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:src="@drawable/vdr_logo"/> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" android:layout_height="fill_parent" + android:orientation="vertical" android:padding="10dip"> -<!-- - <ListView - android:id="@+id/vdrmanager_menu" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:layout_below="@id/main_logo"/> ---> + <ImageView android:id="@+id/main_logo" android:layout_width="fill_parent" + android:layout_height="150dip" android:src="@drawable/vdr_logo" android:paddingBottom="10dip" /> - <GridView - android:id="@+id/vdrmanager_menu" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:layout_below="@id/main_logo"/> - -</RelativeLayout> + <!-- <ListView android:id="@+id/vdrmanager_menu" android:layout_width="fill_parent" + android:layout_height="wrap_content" android:layout_below="@id/main_logo"/> --> + + <LinearLayout android:layout_width="fill_parent" + android:layout_height="wrap_content" android:orientation="horizontal" android:padding="5dip"> + <Button android:text="@string/action_menu_channels" + xmlns:android="http://schemas.android.com/apk/res/android" + android:drawableTop="@drawable/btn_channels" android:layout_width="wrap_content" + android:id="@+id/action_menu_channels" android:layout_height="wrap_content" + android:textColor="#FFF" android:layout_weight="1" + android:cacheColorHint="?android:attr/colorBackground" + android:background="@android:drawable/list_selector_background"/> + + + <Button android:text="@string/action_menu_recordings" + xmlns:android="http://schemas.android.com/apk/res/android" android:padding="5dip" + android:drawableTop="@drawable/btn_recordings" android:layout_width="wrap_content" + android:id="@+id/action_menu_recordings" android:layout_height="wrap_content" + android:textAppearance="?android:textAppearanceSmall" android:layout_weight="1" + android:cacheColorHint="?android:attr/colorBackground" + android:background="@android:drawable/list_selector_background" + android:textColor="#FFF" + /> + + <Button android:text="@string/action_menu_timers" + xmlns:android="http://schemas.android.com/apk/res/android" android:padding="5dip" + android:drawableTop="@drawable/btn_timer" android:layout_width="wrap_content" + android:id="@+id/action_menu_timers" android:layout_height="wrap_content" + android:textAppearance="?android:textAppearanceSmall" android:layout_weight="1" + android:cacheColorHint="?android:attr/colorBackground" + android:background="@android:drawable/list_selector_background" + android:textColor="#FFF" /> + </LinearLayout> + <LinearLayout android:layout_width="fill_parent" + android:layout_height="wrap_content" android:orientation="horizontal"> + <Button android:text="@string/action_menu_epg" + xmlns:android="http://schemas.android.com/apk/res/android" + android:drawableTop="@drawable/btn_epglist" android:layout_width="wrap_content" + android:id="@+id/action_menu_epg" android:layout_height="wrap_content" + android:textAppearance="?android:textAppearanceSmall" android:layout_weight="1" + android:cacheColorHint="?android:attr/colorBackground" + android:padding="5dip" + android:background="@android:drawable/list_selector_background" + android:textColor="#FFF" /> + + <Button android:text="@string/action_menu_search" + xmlns:android="http://schemas.android.com/apk/res/android" + android:drawableTop="@drawable/btn_search" android:layout_width="wrap_content" + android:id="@+id/action_menu_search" android:layout_height="wrap_content" + android:textAppearance="?android:textAppearanceSmall" android:layout_weight="1" + android:cacheColorHint="?android:attr/colorBackground" + android:background="@android:drawable/list_selector_background" + android:padding="5dip" + android:textColor="#FFF" /> + + <Button android:text="@string/action_menu_wakeup" + xmlns:android="http://schemas.android.com/apk/res/android" android:layout_weight="1" + android:padding="5dip" + android:drawableTop="@drawable/btn_wakeup" android:layout_width="wrap_content" + android:id="@+id/action_menu_wakeup" android:layout_height="wrap_content" + android:textAppearance="?android:textAppearanceSmall" + android:cacheColorHint="?android:attr/colorBackground" + android:background="@android:drawable/list_selector_background" + android:textColor="#FFF" /> + </LinearLayout> +</LinearLayout> diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrManagerActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrManagerActivity.java index a000525..bc55f3c 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrManagerActivity.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrManagerActivity.java @@ -1,166 +1,21 @@ package de.bjusystems.vdrmanager.gui; -import java.util.HashMap; -import java.util.Map; - import android.app.Activity; -import android.content.Context; import android.content.Intent; -import android.content.res.Configuration; import android.os.Bundle; -import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; -import android.view.ViewGroup; -import android.widget.AbsListView; -import android.widget.ArrayAdapter; -import android.widget.GridView; -import android.widget.ImageButton; -import android.widget.TextView; import de.bjusystems.vdrmanager.R; import de.bjusystems.vdrmanager.app.VdrManagerApp; -import de.bjusystems.vdrmanager.data.MenuActionHandler; import de.bjusystems.vdrmanager.data.Preferences; import de.bjusystems.vdrmanager.utils.wakeup.AsyncWakeupTask; -public class VdrManagerActivity extends Activity { - - static class WakeupAction implements MenuActionHandler { - public void executeAction(final Context context) { - // create AsyncTask - final AsyncWakeupTask wakeupTask = new AsyncWakeupTask(context); - wakeupTask.execute(); - } - } - - @SuppressWarnings("rawtypes") - static class MenuActivity { - int iconId; - int textId; - Class handler; - boolean enabled; - - public int getIconId() { - return iconId; - } - - public int getTextId() { - return textId; - } - - public Class getHandler() { - return handler; - } - - public boolean isEnabled() { - return enabled; - } - - public MenuActivity(final int iconId, final int textId, - final Class handler) { - this.iconId = iconId; - this.textId = textId; - this.handler = handler; - this.enabled = true; - } - - public void setEnabled(final boolean enabled) { - this.enabled = enabled; - } - } - - class MenuAdapter extends ArrayAdapter<MenuActivity> implements - OnClickListener { - - private final LayoutInflater inflater; - - public MenuAdapter(final Context context, final int viewId) { - super(context, viewId); - inflater = LayoutInflater.from(context); - } - - @SuppressWarnings("unchecked") - @Override - public View getView(final int position, final View convertView, - final ViewGroup parent) { - - View view = convertView; - View itemView; - if (view == null) { - view = inflater.inflate(R.layout.vdrmanager_menu_item, null); - itemView = view.findViewById(R.id.vdrmanager_menu_item); - view.setTag(itemView); - - // attach click listener - itemView.setOnClickListener(this); - - } else { - itemView = (View) view.getTag(); - } - - // attach menu item - final MenuActivity menuItem = getItem(position); - if (itemView instanceof TextView) { - final TextView textView = (TextView) itemView; - textView.setText(menuItem.getTextId()); - } else { - final ImageButton imageButton = (ImageButton) itemView; - imageButton.setImageResource(menuItem.getIconId()); - } - itemView.setOnClickListener(this); - menuActivityMap.put(itemView, menuItem.getHandler()); - - return view; - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - public void onClick(final View v) { - - // refresh preferences - Preferences.loadPreferences(getContext()); - - // clear state - ((VdrManagerApp) getApplication()).clear(); - - // start activity - final Class actionClass = menuActivityMap.get(v); - if (Activity.class.isAssignableFrom(actionClass)) { - final Intent intent = new Intent(); - intent.setClass(getContext(), actionClass); - startActivity(intent); - } else if (MenuActionHandler.class.isAssignableFrom(actionClass)) { - final Class<? extends MenuActionHandler> handlerClass = actionClass; - try { - final MenuActionHandler handler = handlerClass - .newInstance(); - handler.executeAction(getContext()); - } catch (final InstantiationException e) { - - } catch (final IllegalAccessException e) { - - } - } - } - } - - MenuActivity[] menuItems = new MenuActivity[] { - new MenuActivity(R.drawable.whatson, R.string.action_menu_epg, - TimeEpgListActivity.class), - new MenuActivity(0, R.string.action_menu_search, - EpgSearchActivity.class), - new MenuActivity(R.drawable.timers, R.string.action_menu_timers, - TimerListActivity.class), - new MenuActivity(R.drawable.timers, R.string.action_menu_recordings, - RecordingListActivity.class), - - new MenuActivity(R.drawable.channels, - R.string.action_menu_channels, ChannelListActivity.class), - new MenuActivity(0, R.string.action_menu_wakeup, WakeupAction.class), }; - Map<View, Class<? extends Activity>> menuActivityMap = new HashMap<View, Class<? extends Activity>>(); +public class VdrManagerActivity extends Activity implements OnClickListener { + @Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -169,41 +24,21 @@ public class VdrManagerActivity extends Activity { setContentView(R.layout.vdrmanager); Preferences.loadPreferences(this); - - // add and register buttons - createButtons(); - } - // add main menu buttons - private void createButtons() { - - // refresh preferences - Preferences.loadPreferences(this); - final Preferences prefs = Preferences.getPreferences(); - - // get list - final AbsListView listView = (AbsListView) findViewById(R.id.vdrmanager_menu); - final MenuAdapter adapter = new MenuAdapter(this, - R.layout.vdrmanager_menu_item); - listView.setAdapter(adapter); - - // add menu items - for (final MenuActivity menuItem : menuItems) { - if (menuItem.getTextId() != R.string.action_menu_wakeup - || prefs.isWakeupEnabled()) { - adapter.add(menuItem); - } + findViewById(R.id.action_menu_channels).setOnClickListener(this); + findViewById(R.id.action_menu_recordings).setOnClickListener(this); + findViewById(R.id.action_menu_timers).setOnClickListener(this); + findViewById(R.id.action_menu_epg).setOnClickListener(this); + findViewById(R.id.action_menu_search).setOnClickListener(this); + + if(Preferences.get().isWakeupEnabled() == false){ + findViewById(R.id.action_menu_wakeup).setVisibility(View.GONE); + } else { + findViewById(R.id.action_menu_wakeup).setOnClickListener(this); } - // set grid layout dimensions - if (listView instanceof GridView) { - final GridView grid = (GridView) listView; - if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { - grid.setNumColumns(2); - } else { - grid.setNumColumns(menuItems.length); - } - } + // add and register buttons + // createButtons(); } @Override @@ -239,4 +74,37 @@ public class VdrManagerActivity extends Activity { @Override public void onBackPressed() { } + + public void startActivity(Class<?> clazz) { + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setClass(this, clazz); + startActivity(intent); + } + + public void onClick(View v) { + int id = v.getId(); + + switch (id) { + case R.id.action_menu_channels: + startActivity(ChannelListActivity.class); + break; + case R.id.action_menu_recordings: + startActivity(RecordingListActivity.class); + break; + case R.id.action_menu_timers: + startActivity(TimerListActivity.class); + break; + case R.id.action_menu_epg: + startActivity(TimeEpgListActivity.class); + break; + case R.id.action_menu_search: + startActivity(EpgSearchActivity.class); + break; + case R.id.action_menu_wakeup: + final AsyncWakeupTask wakeupTask = new AsyncWakeupTask(this); + wakeupTask.execute(); + break; + } + + } } |