Change tab background color for android v11 and higher
|
After Width: | Height: | Size: 105 B |
|
After Width: | Height: | Size: 100 B |
|
After Width: | Height: | Size: 105 B |
|
After Width: | Height: | Size: 111 B |
|
After Width: | Height: | Size: 102 B |
|
After Width: | Height: | Size: 111 B |
|
After Width: | Height: | Size: 102 B |
|
After Width: | Height: | Size: 96 B |
|
After Width: | Height: | Size: 102 B |
|
After Width: | Height: | Size: 107 B |
|
After Width: | Height: | Size: 103 B |
|
After Width: | Height: | Size: 110 B |
|
After Width: | Height: | Size: 110 B |
|
After Width: | Height: | Size: 104 B |
|
After Width: | Height: | Size: 110 B |
|
After Width: | Height: | Size: 122 B |
|
After Width: | Height: | Size: 114 B |
|
After Width: | Height: | Size: 121 B |
@@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright 2013 Google Inc.
|
||||||
|
|
||||||
|
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">
|
||||||
|
<!-- Non focused states -->
|
||||||
|
<item android:drawable="@drawable/tab_unselected_mytracks" android:state_focused="false" android:state_pressed="false" android:state_selected="false"/>
|
||||||
|
<item android:drawable="@drawable/tab_selected_mytracks" android:state_focused="false" android:state_pressed="false" android:state_selected="true"/>
|
||||||
|
<!-- Focused states -->
|
||||||
|
<item android:drawable="@drawable/tab_unselected_focused_mytracks" android:state_focused="true" android:state_pressed="false" android:state_selected="false"/>
|
||||||
|
<item android:drawable="@drawable/tab_selected_focused_mytracks" android:state_focused="true" android:state_pressed="false" android:state_selected="true"/>
|
||||||
|
<!-- Pressed -->
|
||||||
|
<!-- Non focused states -->
|
||||||
|
<item android:drawable="@drawable/tab_unselected_pressed_mytracks" android:state_focused="false" android:state_pressed="true" android:state_selected="false"/>
|
||||||
|
<item android:drawable="@drawable/tab_selected_pressed_mytracks" android:state_focused="false" android:state_pressed="true" android:state_selected="true"/>
|
||||||
|
<!-- Focused states -->
|
||||||
|
<item android:drawable="@drawable/tab_unselected_pressed_mytracks" android:state_focused="true" android:state_pressed="true" android:state_selected="false"/>
|
||||||
|
<item android:drawable="@drawable/tab_selected_pressed_mytracks" android:state_focused="true" android:state_pressed="true" android:state_selected="true"/>
|
||||||
|
</selector>
|
||||||
@@ -15,6 +15,10 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<resources xmlns:android="http://schemas.android.com/apk/res/android">
|
<resources xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<style name="ActionBarStyle.MyTracks" parent="@android:style/Widget.Holo.ActionBar">
|
||||||
|
<!-- Same image as the source except using a grey line instead of a blue line -->
|
||||||
|
<item name="android:background">@drawable/ab_transparent_dark_holo</item>
|
||||||
|
</style>
|
||||||
<style name="BottomButton" parent="@android:style/Widget.Holo.Button.Borderless">
|
<style name="BottomButton" parent="@android:style/Widget.Holo.Button.Borderless">
|
||||||
<!-- Same as BottomButton in values/styles.xml except inheriting from a parent -->
|
<!-- Same as BottomButton in values/styles.xml except inheriting from a parent -->
|
||||||
<item name="android:layout_height">wrap_content</item>
|
<item name="android:layout_height">wrap_content</item>
|
||||||
@@ -32,11 +36,7 @@ limitations under the License.
|
|||||||
<style name="ListItem">
|
<style name="ListItem">
|
||||||
<item name="android:background">?android:attr/activatedBackgroundIndicator</item>
|
<item name="android:background">?android:attr/activatedBackgroundIndicator</item>
|
||||||
</style>
|
</style>
|
||||||
<style name="MyTracksActionBar" parent="@android:style/Widget.Holo.ActionBar">
|
|
||||||
<!-- Same image as the source except using a grey line instead of a blue line -->
|
|
||||||
<item name="android:background">@drawable/ab_transparent_dark_holo</item>
|
|
||||||
</style>
|
|
||||||
<style name="ThemeSelector" parent="android:Theme.Holo">
|
<style name="ThemeSelector" parent="android:Theme.Holo">
|
||||||
<item name="android:actionBarStyle">@style/MyTracksActionBar</item>
|
<item name="android:actionBarStyle">@style/ActionBarStyle.MyTracks</item>
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -37,6 +37,7 @@ import com.google.android.apps.mytracks.io.sendtogoogle.SendRequest;
|
|||||||
import com.google.android.apps.mytracks.services.TrackRecordingServiceConnection;
|
import com.google.android.apps.mytracks.services.TrackRecordingServiceConnection;
|
||||||
import com.google.android.apps.mytracks.settings.SettingsActivity;
|
import com.google.android.apps.mytracks.settings.SettingsActivity;
|
||||||
import com.google.android.apps.mytracks.util.AnalyticsUtils;
|
import com.google.android.apps.mytracks.util.AnalyticsUtils;
|
||||||
|
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
|
||||||
import com.google.android.apps.mytracks.util.GoogleFeedbackUtils;
|
import com.google.android.apps.mytracks.util.GoogleFeedbackUtils;
|
||||||
import com.google.android.apps.mytracks.util.IntentUtils;
|
import com.google.android.apps.mytracks.util.IntentUtils;
|
||||||
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||||
@@ -214,6 +215,10 @@ public class TrackDetailActivity extends AbstractSendToGoogleActivity
|
|||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
tabHost.setCurrentTabByTag(savedInstanceState.getString(CURRENT_TAB_TAG_KEY));
|
tabHost.setCurrentTabByTag(savedInstanceState.getString(CURRENT_TAB_TAG_KEY));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set the background after all three tabs are added
|
||||||
|
ApiAdapterFactory.getApiAdapter().setTabBackground(tabHost.getTabWidget());
|
||||||
|
|
||||||
trackController = new TrackController(
|
trackController = new TrackController(
|
||||||
this, trackRecordingServiceConnection, false, recordListener, stopListener);
|
this, trackRecordingServiceConnection, false, recordListener, stopListener);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import android.widget.ArrayAdapter;
|
|||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.SearchView;
|
import android.widget.SearchView;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
|
import android.widget.TabWidget;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -241,4 +242,11 @@ public class Api11Adapter extends Api10Adapter {
|
|||||||
public boolean isSpinnerBackgroundLight() {
|
public boolean isSpinnerBackgroundLight() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTabBackground(TabWidget tabWidget) {
|
||||||
|
for (int i = 0; i < tabWidget.getChildCount(); i++) {
|
||||||
|
tabWidget.getChildAt(i).setBackgroundResource(R.drawable.tab_indicator_mytracks);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import android.view.ViewTreeObserver.OnGlobalLayoutListener;
|
|||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
import android.widget.TabWidget;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
@@ -142,6 +143,11 @@ public class Api8Adapter implements ApiAdapter {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTabBackground(TabWidget tabWidget) {
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handleSearchKey(MenuItem menuItem) {
|
public boolean handleSearchKey(MenuItem menuItem) {
|
||||||
// Return false and allow the framework to handle the search key.
|
// Return false and allow the framework to handle the search key.
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import android.view.MenuItem;
|
|||||||
import android.view.ViewTreeObserver;
|
import android.view.ViewTreeObserver;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
import android.widget.TabWidget;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -175,6 +176,13 @@ public interface ApiAdapter {
|
|||||||
*/
|
*/
|
||||||
public boolean isSpinnerBackgroundLight();
|
public boolean isSpinnerBackgroundLight();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the tab background.
|
||||||
|
*
|
||||||
|
* @param tabWidget the tab widget
|
||||||
|
*/
|
||||||
|
public void setTabBackground(TabWidget tabWidget);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the search key press. Returns true if handled.
|
* Handles the search key press. Returns true if handled.
|
||||||
* <p>
|
* <p>
|
||||||
|
|||||||