[Android] Interface: display the title of the current fragment in the action bar
Adrien Maglo
git at videolan.org
Fri Dec 6 17:56:05 CET 2013
vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Fri Dec 6 17:53:57 2013 +0100| [c85a3d382cd8ddfdaafadc01f0b77c5b669a218c] | committer: Adrien Maglo
Interface: display the title of the current fragment in the action bar
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=c85a3d382cd8ddfdaafadc01f0b77c5b669a218c
---
vlc-android/res/values/colors.xml | 1 +
vlc-android/res/values/styles.xml | 6 ++++++
vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java | 2 ++
vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java | 2 ++
vlc-android/src/org/videolan/vlc/gui/MainActivity.java | 1 -
.../src/org/videolan/vlc/gui/video/VideoGridFragment.java | 3 +++
6 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/vlc-android/res/values/colors.xml b/vlc-android/res/values/colors.xml
index c6b3861..76de097 100644
--- a/vlc-android/res/values/colors.xml
+++ b/vlc-android/res/values/colors.xml
@@ -14,5 +14,6 @@
<color name="darkorange">#ff8800</color>
<color name="black">#000001</color>
<color name="transparent_gray">#8000</color>
+ <color name="action_bar_title">#FFFFFF</color>
</resources>
\ No newline at end of file
diff --git a/vlc-android/res/values/styles.xml b/vlc-android/res/values/styles.xml
index b6dd38b..b79efc9 100644
--- a/vlc-android/res/values/styles.xml
+++ b/vlc-android/res/values/styles.xml
@@ -68,6 +68,12 @@
<style name="ActionBar" parent="Widget.Sherlock.Light.ActionBar">
<item name="android:background">@drawable/actionbar_background</item>
<item name="background">@drawable/actionbar_background</item>
+ <item name="android:titleTextStyle">@style/ActionBar.Text</item>
+ </style>
+
+ <style name="ActionBar.Text" parent="@android:style/TextAppearance">
+ <item name="android:textColor">@color/action_bar_title</item>
+ <item name="android:textAllCaps">true</item>
</style>
<style name="Theme.VLC.AlertMenu" parent="android:Theme.Dialog">
diff --git a/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java b/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java
index 70d113a..321fba9 100644
--- a/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java
@@ -78,6 +78,8 @@ public class DirectoryViewFragment extends SherlockListFragment implements ISort
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
+ getSherlockActivity().getSupportActionBar().setTitle(R.string.directories);
+
View v = inflater.inflate(R.layout.directory_view, container, false);
setListAdapter(mDirectoryAdapter);
final ListView listView = (ListView)v.findViewById(android.R.id.list);
diff --git a/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java b/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java
index 253a60b..b0bfae1 100644
--- a/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java
@@ -57,6 +57,8 @@ public class HistoryFragment extends SherlockListFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
+ getSherlockActivity().getSupportActionBar().setTitle(R.string.history);
+
View v = inflater.inflate(R.layout.history_list, container, false);
setListAdapter(mHistoryAdapter);
final ListView listView = (ListView)v.findViewById(android.R.id.list);
diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index 26e4f7b..c888a83 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -283,7 +283,6 @@ public class MainActivity extends SherlockFragmentActivity {
private void prepareActionBar() {
mActionBar = getSupportActionBar();
mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
- mActionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);
mActionBar.setDisplayHomeAsUpEnabled(true);
}
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
index 08c4c5a..c0cf7f0 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -105,6 +105,7 @@ public class VideoGridFragment extends SherlockGridFragment implements ISortable
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+
mVideoAdapter = new VideoListAdapter(getActivity(), this);
mMediaLibrary = MediaLibrary.getInstance(getActivity());
setListAdapter(mVideoAdapter);
@@ -118,6 +119,8 @@ public class VideoGridFragment extends SherlockGridFragment implements ISortable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
+ getSherlockActivity().getSupportActionBar().setTitle(R.string.video);
+
View v = inflater.inflate(R.layout.video_grid, container, false);
// init the information for the scan (1/2)
More information about the Android
mailing list