Add tabs to the song selector

They serve no purpose, yet
This commit is contained in:
Christopher Eby 2010-03-07 21:50:51 -06:00
parent ae4fa22c46
commit 1024f36ac4
12 changed files with 79 additions and 6 deletions

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_selected="true"
android:state_pressed="false"
android:drawable="@drawable/tab_albums_selected" />
<item
android:drawable="@drawable/tab_albums_unselected" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 686 B

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_selected="true"
android:state_pressed="false"
android:drawable="@drawable/tab_artists_selected" />
<item
android:drawable="@drawable/tab_artists_unselected" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 595 B

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_selected="true"
android:state_pressed="false"
android:drawable="@drawable/tab_songs_selected" />
<item
android:drawable="@drawable/tab_songs_unselected" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 793 B

View File

@ -5,12 +5,41 @@
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical">
<ListView
android:id="@+id/song_list"
<TabHost
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fastScrollEnabled="true" />
android:layout_weight="1">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/artist_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="this is another tab" />
<TextView
android:id="@+id/album_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="this is a third tab" />
<ListView
android:id="@+id/song_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fastScrollEnabled="true" />
</FrameLayout>
</LinearLayout>
</TabHost>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">

View File

@ -11,6 +11,10 @@
<string name="paused">(Paused)</string>
<string name="widget_start_service">Click to start the music service.</string>
<string name="artists">Artists</string>
<string name="albums">Albums</string>
<string name="songs">Songs</string>
<string name="pref_output">Audio Output</string>
<string name="pref_notifications">Notifications</string>
<string name="pref_song_selector">Song Selector</string>

View File

@ -20,9 +20,10 @@ package org.kreed.vanilla;
import org.kreed.vanilla.R;
import android.app.Activity;
import android.app.TabActivity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.text.Editable;
@ -30,11 +31,14 @@ import android.text.InputType;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TabHost;
import android.widget.TextView;
public class SongSelector extends Activity implements AdapterView.OnItemClickListener, TextWatcher, View.OnClickListener {
public class SongSelector extends TabActivity implements AdapterView.OnItemClickListener, TextWatcher, View.OnClickListener {
private TabHost mTabHost;
private SongAdapter mAdapter;
private ListView mListView;
private TextView mTextView;
@ -44,8 +48,17 @@ public class SongSelector extends Activity implements AdapterView.OnItemClickLis
{
super.onCreate(icicle);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.song_selector);
mTabHost = getTabHost();
Resources res = getResources();
mTabHost.addTab(mTabHost.newTabSpec("tab_artists").setIndicator(res.getText(R.string.artists), res.getDrawable(R.drawable.tab_artists)).setContent(R.id.artist_list));
mTabHost.addTab(mTabHost.newTabSpec("tab_albums").setIndicator(res.getText(R.string.albums), res.getDrawable(R.drawable.tab_albums)).setContent(R.id.album_list));
mTabHost.addTab(mTabHost.newTabSpec("tab_songs").setIndicator(res.getText(R.string.songs), res.getDrawable(R.drawable.tab_songs)).setContent(R.id.song_list));
mAdapter = new SongAdapter(this);
mListView = (ListView)findViewById(R.id.song_list);