[Android] About activity: change the tab styles
Adrien Maglo
git at videolan.org
Wed Dec 4 16:42:31 CET 2013
vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Wed Dec 4 16:41:13 2013 +0100| [adaf8eaebfc0f89ddbba7218dc4d6b4d17e3eec9] | committer: Adrien Maglo
About activity: change the tab styles
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=adaf8eaebfc0f89ddbba7218dc4d6b4d17e3eec9
---
vlc-android/AndroidManifest.xml | 3 ++-
vlc-android/res/drawable/about_bg.xml | 8 -------
vlc-android/res/layout/about.xml | 6 ++---
.../src/org/videolan/vlc/gui/AboutActivity.java | 23 ++++++++++----------
4 files changed, 17 insertions(+), 23 deletions(-)
diff --git a/vlc-android/AndroidManifest.xml b/vlc-android/AndroidManifest.xml
index 33cd35f..63e6010 100644
--- a/vlc-android/AndroidManifest.xml
+++ b/vlc-android/AndroidManifest.xml
@@ -52,7 +52,8 @@
android:resource="@xml/searchable" />
</activity>
<activity
- android:name=".gui.AboutActivity" />
+ android:name=".gui.AboutActivity"
+ android:theme="@style/Theme.VLC.NoTitleBar" />
<activity
android:name=".gui.PreferencesActivity" />
<activity
diff --git a/vlc-android/res/drawable/about_bg.xml b/vlc-android/res/drawable/about_bg.xml
deleted file mode 100644
index 1983490..0000000
--- a/vlc-android/res/drawable/about_bg.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
- android:shape="rectangle">
- <solid android:color="#EBEBEE" />
-
- <!-- corners android:bottomRightRadius="7dp" android:bottomLeftRadius="7dp"
- android:topLeftRadius="7dp" android:topRightRadius="7dp"/-->
-</shape>
diff --git a/vlc-android/res/layout/about.xml b/vlc-android/res/layout/about.xml
index da00b94..92c7da9 100644
--- a/vlc-android/res/layout/about.xml
+++ b/vlc-android/res/layout/about.xml
@@ -46,8 +46,7 @@
<TabHost
android:id="@+id/about_tabhost"
android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:background="@drawable/about_bg">
+ android:layout_height="fill_parent" >
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
@@ -55,7 +54,8 @@
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
- android:layout_height="wrap_content" />
+ android:layout_height="wrap_content"
+ android:background="?attr/background_menu" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
diff --git a/vlc-android/src/org/videolan/vlc/gui/AboutActivity.java b/vlc-android/src/org/videolan/vlc/gui/AboutActivity.java
index 5af1be3..3ec2ba7 100644
--- a/vlc-android/src/org/videolan/vlc/gui/AboutActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/AboutActivity.java
@@ -29,7 +29,7 @@ import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
-import android.util.TypedValue;
+import android.view.LayoutInflater;
import android.view.View;
import android.widget.TabHost;
import android.widget.TabHost.OnTabChangeListener;
@@ -78,21 +78,15 @@ public class AboutActivity extends FragmentActivity implements OnTabChangeListen
mTabHost.setup();
TabHost.TabSpec tab_main = mTabHost.newTabSpec("main");
tab_main.setContent(dcf);
- tab_main.setIndicator(getResources().getText(R.string.about));
+ tab_main.setIndicator(getNewTabIndicator(mTabHost.getContext(),
+ getResources().getText(R.string.about).toString()));
mTabHost.addTab(tab_main);
TabHost.TabSpec tab_licence = mTabHost.newTabSpec("licence");
tab_licence.setContent(dcf);
- tab_licence.setIndicator(getResources().getText(R.string.licence));
+ tab_licence.setIndicator(getNewTabIndicator(mTabHost.getContext(),
+ getResources().getText(R.string.licence).toString()));
mTabHost.addTab(tab_licence);
- for(int i = 0; i < mTabHost.getTabWidget().getChildCount(); i++) {
- TextView tv = (TextView)mTabHost.getTabWidget().getChildTabViewAt(i).findViewById(android.R.id.title);
- tv.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
- //android.util.Log.d(TAG, "TextSize = " + ((Float)tv.getTextSize()).toString());
- // Scale the tab height to the text size on the device and leave enough space
- mTabHost.getTabWidget().getChildAt(i).getLayoutParams().height = (int)(tv.getTextSize() * 2.21);
- }
-
mTabHost.setOnTabChangedListener(this);
this.onTabChanged("main");
if (savedInstanceState != null) {
@@ -101,6 +95,13 @@ public class AboutActivity extends FragmentActivity implements OnTabChangeListen
}
}
+ private View getNewTabIndicator(Context context, String title) {
+ View v = LayoutInflater.from(context).inflate(R.layout.audio_browser_tab_layout, null);
+ TextView tv = (TextView) v.findViewById(R.id.textView);
+ tv.setText(title);
+ return v;
+ }
+
protected void onSaveInstanceState(Bundle outState) {
outState.putString(CURRENT_TAB_TAG, mCurrentTabTag);
outState.putInt(CURRENT_TAB_ID, mTabHost.getCurrentTab());
More information about the Android
mailing list