commit b474348afbcb9c05f7be5eb94db7cd93196c3c68
parent 91db3105351b29f95ff435b531dc1c89f5baae45
Author: Jan Dankert <devnull@localhost>
Date: Wed, 10 Oct 2012 01:01:26 +0200
Neben dem IBC-Theme ein weitere Default-Theme ohne Farbvorgaben.
Diffstat:
5 files changed, 68 insertions(+), 43 deletions(-)
diff --git a/res/layout/exp_listing.xml b/res/layout/exp_listing.xml
@@ -3,7 +3,7 @@
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:orientation="vertical">
- <ExpandableListView android:id="@id/android:list" android:textSize="25sp"
+ <ExpandableListView android:id="@id/android:list" android:textSize="25sp" style="?titleBox"
android:layout_width="fill_parent" android:layout_height="wrap_content">
</ExpandableListView>
diff --git a/res/layout/rss_item.xml b/res/layout/rss_item.xml
@@ -3,23 +3,23 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_margin="8sp"
- android:padding="5sp" style="@style/textbox">
+ android:padding="5sp" style="?textbox">
- <LinearLayout android:orientation="horizontal" style="@style/textbox"
+ <LinearLayout android:orientation="horizontal" style="?textbox"
android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/item_date"
- style="@style/infoText"></TextView>
+ style="?infoText"></TextView>
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:id="@+id/item_name"
- style="@style/infoText" android:gravity="right"></TextView>
+ style="?infoText" android:gravity="right"></TextView>
</LinearLayout>
<TextView android:text="" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:id="@+id/item_title"
- style="@style/titleText"></TextView>
+ style="?titleText"></TextView>
<TextView android:text="" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:id="@+id/item_description"
- style="@style/normalText"></TextView>
+ style="?normalText"></TextView>
</LinearLayout>
diff --git a/res/values/ibc.xml b/res/values/ibc.xml
@@ -1,11 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
+ <attr name="textbox" format="reference" />
+ <attr name="normalText" format="reference" />
+ <attr name="infoText" format="reference" />
+ <attr name="titleText" format="reference" />
+ <attr name="titleBox" format="reference" />
<color name="ibcgrey">#E3E3E3</color>
<color name="ibctext">#003399</color>
<color name="ibcbg">#FFCC66</color>
- <style name="IBC" parent="android:Theme">
+ <!--
+ IBC-Theme, erweitert den Standard-Android-Theme um verschiedene Farben
+ -->
+ <style name="IBC" parent="@style/Default">
+
+ <item name="textbox">@style/ibctextbox</item>
+ <item name="normalText">@style/ibcnormalText</item>
+ <item name="infoText">@style/ibcinfoText</item>
+ <item name="titleText">@style/ibctitleText</item>
+ <item name="titleBox">@style/ibctitleBox</item>
<item name="android:background">@color/ibcbg</item>
<item name="android:buttonStyle">@style/button</item>
@@ -13,6 +27,17 @@
</style>
+ <!--
+ Default-Theme, erweitert den Standard-Android-Theme um einzelne
+ Textgrößen
+ -->
+ <style name="Default" parent="android:Theme">
+
+ <item name="normalText">@style/normalText</item>
+ <item name="infoText">@style/infoText</item>
+ <item name="titleText">@style/titleText</item>
+ </style>
+
<style name="button" parent="@android:style/Widget.Button">
<!--
<item name="android:layout_width">wrap_content</item> <item
@@ -27,26 +52,43 @@
-->
</style>
- <style name="textbox">
+ <style name="ibctextbox">
<item name="android:background">@color/ibcgrey</item>
</style>
- <style name="normalText">
+ <style name="ibctitleBox">
+ <item name="android:background">@color/ibcbg</item>
+ </style>
+
+ <style name="ibcnormalText">
<item name="android:background">@color/ibcgrey</item>
<item name="android:textSize">16sp</item>
<item name="android:textColor">#000000</item>
</style>
- <style name="infoText">
+ <style name="ibcinfoText">
<item name="android:background">@color/ibcgrey</item>
<item name="android:textSize">13sp</item>
<item name="android:textColor">#000000</item>
</style>
- <style name="titleText">
+ <style name="ibctitleText">
<item name="android:background">@color/ibcgrey</item>
<item name="android:textSize">20sp</item>
<item name="android:textColor">@color/ibctext</item>
</style>
+
+ <style name="normalText">
+ <item name="android:textSize">16sp</item>
+ </style>
+
+ <style name="infoText">
+ <item name="android:textSize">13sp</item>
+ </style>
+
+ <style name="titleText">
+ <item name="android:textSize">20sp</item>
+ </style>
+
</resources>
\ No newline at end of file
diff --git a/src/de/mtbnews/android/IBCApplication.java b/src/de/mtbnews/android/IBCApplication.java
@@ -63,7 +63,7 @@ public class IBCApplication extends Application
prefs = PreferenceManager.getDefaultSharedPreferences(this);
themeResId = (prefs.getBoolean("ibc_theme", true)) ? R.style.IBC
- : android.R.style.Theme;
+ : R.style.Default;
if (prefs.getBoolean("autostart_subscription_service", false))
{
diff --git a/src/de/mtbnews/android/adapter/ExpandableForumContentAdapter.java b/src/de/mtbnews/android/adapter/ExpandableForumContentAdapter.java
@@ -6,7 +6,6 @@ package de.mtbnews.android.adapter;
import java.util.List;
import android.content.Context;
-import android.graphics.Color;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
@@ -23,11 +22,6 @@ import de.mtbnews.android.tapatalk.wrapper.Forum;
public class ExpandableForumContentAdapter extends BaseExpandableListAdapter
{
- private static final int IBC_GELB = Color.parseColor("#FFCC66");
-
- /** Remember our context so we can use it when constructing views. */
- private Context mContext;
-
/**
* Hold onto a copy of the entire Contact List.
*/
@@ -37,7 +31,6 @@ public class ExpandableForumContentAdapter extends BaseExpandableListAdapter
public ExpandableForumContentAdapter(Context context, List<Forum> forumList)
{
- mContext = context;
inflator = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
@@ -63,19 +56,19 @@ public class ExpandableForumContentAdapter extends BaseExpandableListAdapter
{
Forum e = forumList.get(groupPosition).subForen.get(childPosition);
- final View view = inflator.inflate(R.layout.rss_item, null);
+ final View itemView = inflator.inflate(R.layout.rss_item, null);
- TextView datum = (TextView) view.findViewById(R.id.item_date);
+ TextView datum = (TextView) itemView.findViewById(R.id.item_date);
datum.setVisibility(View.INVISIBLE);
- TextView name = (TextView) view.findViewById(R.id.item_title);
+ TextView name = (TextView) itemView.findViewById(R.id.item_title);
name.setText(e.getTitle());
- TextView desc = (TextView) view.findViewById(R.id.item_description);
+ TextView desc = (TextView) itemView.findViewById(R.id.item_description);
desc.setText(e.getContent());
- return view;
+ return itemView;
}
@Override
@@ -99,7 +92,6 @@ public class ExpandableForumContentAdapter extends BaseExpandableListAdapter
@Override
public long getGroupId(int groupPosition)
{
- // TODO Auto-generated method stub
return groupPosition;
}
@@ -107,33 +99,24 @@ public class ExpandableForumContentAdapter extends BaseExpandableListAdapter
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent)
{
- Forum e = forumList.get(groupPosition);
+ final Forum forum = forumList.get(groupPosition);
- final View view = inflator.inflate(R.layout.rss_item, null);
- view.setBackgroundColor(IBC_GELB);
+ final View itemView = inflator.inflate(R.layout.rss_item, null);
- TextView datum = (TextView) view.findViewById(R.id.item_date);
+ TextView datum = (TextView) itemView.findViewById(R.id.item_date);
datum.setText("");
- datum.setBackgroundColor(IBC_GELB);
- // datum.setVisibility(View.INVISIBLE);
- TextView name = (TextView) view.findViewById(R.id.item_name);
+ TextView name = (TextView) itemView.findViewById(R.id.item_name);
name.setText("");
- name.setBackgroundColor(IBC_GELB);
- // name.setVisibility(View.INVISIBLE);
- TextView title = (TextView) view.findViewById(R.id.item_title);
+ TextView title = (TextView) itemView.findViewById(R.id.item_title);
title.setGravity(Gravity.CENTER);
- title.setBackgroundColor(IBC_GELB);
- title.setText(e.getTitle());
+ title.setText(forum.getTitle());
- TextView desc = (TextView) view.findViewById(R.id.item_description);
- // desc.setVisibility(View.INVISIBLE);
- // desc.setText(e.getContent());
+ TextView desc = (TextView) itemView.findViewById(R.id.item_description);
desc.setText("");
- desc.setBackgroundColor(IBC_GELB);
- return view;
+ return itemView;
}
@Override