mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-05 19:13:07 +02:00
Change tab background color for android v11 and higher
This commit is contained in:
@@ -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.settings.SettingsActivity;
|
||||
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.IntentUtils;
|
||||
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||
@@ -214,6 +215,10 @@ public class TrackDetailActivity extends AbstractSendToGoogleActivity
|
||||
if (savedInstanceState != null) {
|
||||
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(
|
||||
this, trackRecordingServiceConnection, false, recordListener, stopListener);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.SearchView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TabWidget;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -241,4 +242,11 @@ public class Api11Adapter extends Api10Adapter {
|
||||
public boolean isSpinnerBackgroundLight() {
|
||||
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.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TabWidget;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
@@ -142,6 +143,11 @@ public class Api8Adapter implements ApiAdapter {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTabBackground(TabWidget tabWidget) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleSearchKey(MenuItem menuItem) {
|
||||
// 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.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TabWidget;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
@@ -173,7 +174,14 @@ public interface ApiAdapter {
|
||||
* <p>
|
||||
* Due to changes in API level 11.
|
||||
*/
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user