Skip to content
Browse files

added icons to the demo app.

  • Loading branch information...
1 parent 5eba9ad commit 96c269fa33256aafb50d6219fc9a29199db032ab Mike Novak committed Jan 29, 2011
View
18 AndroidManifest.xml
@@ -1,5 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+<!--
+/*
+ * Copyright 2010-2011 Mike Novak <michael.novakjr@gmail.com>
+ *
+ * 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.
+ */
+--><manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.droidkit"
android:versionCode="1"
android:versionName="1.0">
View
BIN demos/res/drawable-hdpi/ic_tab_favorite_selected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN demos/res/drawable-hdpi/ic_tab_favorite_unselected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN demos/res/drawable-mdpi/ic_tab_favorite_selected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN demos/res/drawable-mdpi/ic_tab_favorite_unselected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
22 demos/res/drawable/ic_tab_favorite.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright (C) 2010-2011 Mike Novak <michael.novakjr@gmail.com>
+ *
+ * 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.
+ */
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_selected="true" android:drawable="@drawable/ic_tab_favorite_selected" />
+ <item android:drawable="@drawable/ic_tab_favorite_unselected" />
+</selector>
View
2 demos/src/org/droidkit/demos/widget/SampleTabWidget.java
@@ -37,10 +37,12 @@ public void onCreate(Bundle savedInstanceState) {
TabItem item = new TabItem(this);
item.setText("Activity One");
+ item.setIcon(R.drawable.ic_tab_favorite);
item.setContent(new Intent(this, TabActivityOne.class));
TabItem tabTwo = new TabItem(this);
tabTwo.setText("Activity Two");
+ tabTwo.setIcon(R.drawable.ic_tab_favorite);
tabTwo.setContent(new Intent(this, TabActivityTwo.class));
mTabWidget.addTab(item);
View
2 demos/src/org/droidkit/demos/widget/SampleTabWidgetView.java
@@ -35,10 +35,12 @@ public void onCreate(Bundle savedInstanceState) {
TabItem item = new TabItem(this);
item.setText("Activity One");
+ item.setIcon(R.drawable.ic_tab_favorite);
item.setContent(R.layout.tab_one);
TabItem tabTwo = new TabItem(this);
tabTwo.setText("Activity Two");
+ tabTwo.setIcon(R.drawable.ic_tab_favorite);
tabTwo.setContent(R.layout.tab_two);
mTabWidget.addTab(item);
View
7 src/org/droidkit/widget/TabItem.java
@@ -58,7 +58,6 @@ public TabItem(Context context, AttributeSet attrs) {
private void init() {
mIcon = new ImageView(getContext());
mLabel = new TextView(getContext());
- mLabel.setTextColor(mUnselectedTextColor);
LayoutParams iconParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
iconParams.addRule(CENTER_HORIZONTAL, TRUE);
@@ -73,6 +72,8 @@ private void init() {
setBackgroundResource(mBackgroundId);
mLabel.setPadding(0, 0, 0, 6);
+ mLabel.setTextColor(mUnselectedTextColor);
+
addView(mLabel, labelParams);
}
@@ -124,11 +125,11 @@ public void setBackground(int id) {
public void setTabSelected(boolean selected) {
if (selected) {
- setSelected(true);
mLabel.setTextColor(mSelectedTextColor);
+ setSelected(true);
} else {
- setSelected(false);
mLabel.setTextColor(mUnselectedTextColor);
+ setSelected(false);
}
}

0 comments on commit 96c269f

Please sign in to comment.
Something went wrong with that request. Please try again.