mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-18 16:53:08 +02:00
fix layout issue for gingerbread
This commit is contained in:
@@ -33,10 +33,8 @@ limitations under the License.
|
|||||||
<!-- Activity type -->
|
<!-- Activity type -->
|
||||||
<Spinner
|
<Spinner
|
||||||
android:id="@+id/stats_activity_type_icon"
|
android:id="@+id/stats_activity_type_icon"
|
||||||
android:layout_gravity="bottom"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="4dp"
|
android:layout_marginLeft="4dp"
|
||||||
android:layout_marginTop="-6dp"
|
|
||||||
android:layout_width="wrap_content" />
|
android:layout_width="wrap_content" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -15,7 +15,7 @@ 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="MyTracksTheme" parent="android:Theme.Black">
|
<style name="ThemeMyTracks" parent="android:Theme.Black">
|
||||||
<!-- Auto generated -->
|
<!-- Auto generated -->
|
||||||
<item name="android:autoCompleteTextViewStyle">@style/AutoCompleteTextViewMyTracks</item>
|
<item name="android:autoCompleteTextViewStyle">@style/AutoCompleteTextViewMyTracks</item>
|
||||||
<item name="android:editTextStyle">@style/EditTextMyTracks</item>
|
<item name="android:editTextStyle">@style/EditTextMyTracks</item>
|
||||||
|
|||||||
@@ -172,12 +172,7 @@ public class Api11Adapter extends Api10Adapter {
|
|||||||
public void invalidMenu(Activity activity) {
|
public void invalidMenu(Activity activity) {
|
||||||
activity.invalidateOptionsMenu();
|
activity.invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSpinnerBackgroundLight() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean showEditTextClearButton() {
|
public boolean showEditTextClearButton() {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -138,11 +138,6 @@ public class Api8Adapter implements ApiAdapter {
|
|||||||
public void invalidMenu(Activity activity) {
|
public void invalidMenu(Activity activity) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSpinnerBackgroundLight() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean showEditTextClearButton() {
|
public boolean showEditTextClearButton() {
|
||||||
|
|||||||
@@ -169,20 +169,13 @@ public interface ApiAdapter {
|
|||||||
*/
|
*/
|
||||||
public void invalidMenu(Activity activity);
|
public void invalidMenu(Activity activity);
|
||||||
|
|
||||||
/**
|
|
||||||
* True if the spinner background is light color.
|
|
||||||
* <p>
|
|
||||||
* Due to changes in API level 11.
|
|
||||||
*/
|
|
||||||
public boolean isSpinnerBackgroundLight();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* True to display a clear button on the right of the edit text.
|
* True to display a clear button on the right of the edit text.
|
||||||
* <p>
|
* <p>
|
||||||
* Due to changes in API level 11.
|
* Due to changes in API level 11.
|
||||||
*/
|
*/
|
||||||
public boolean showEditTextClearButton();
|
public boolean showEditTextClearButton();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the tab background.
|
* Sets the tab background.
|
||||||
* <p>
|
* <p>
|
||||||
|
|||||||
@@ -20,9 +20,7 @@ import com.google.android.maps.mytracks.R;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Bitmap.Config;
|
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.graphics.Color;
|
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
@@ -172,38 +170,6 @@ public class TrackIconUtils {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Inverts the colors in a bitmap.
|
|
||||||
*
|
|
||||||
* @param source the source
|
|
||||||
*/
|
|
||||||
public static Bitmap invertBitmap(Bitmap source) {
|
|
||||||
Config config = source.getConfig();
|
|
||||||
if (config == null) {
|
|
||||||
config = Config.ARGB_8888;
|
|
||||||
}
|
|
||||||
Bitmap output = Bitmap.createBitmap(source.getWidth(), source.getHeight(), config);
|
|
||||||
int height = source.getHeight();
|
|
||||||
int width = source.getWidth();
|
|
||||||
int pixelColor;
|
|
||||||
int alpha;
|
|
||||||
int red;
|
|
||||||
int green;
|
|
||||||
int blue;
|
|
||||||
|
|
||||||
for (int y = 0; y < height; y++) {
|
|
||||||
for (int x = 0; x < width; x++) {
|
|
||||||
pixelColor = source.getPixel(x, y);
|
|
||||||
alpha = Color.alpha(pixelColor);
|
|
||||||
red = 255 - Color.red(pixelColor);
|
|
||||||
green = 255 - Color.green(pixelColor);
|
|
||||||
blue = 255 - Color.blue(pixelColor);
|
|
||||||
output.setPixel(x, y, Color.argb(alpha, red, green, blue));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setIconSpinner(Spinner spinner, String iconValue) {
|
public static void setIconSpinner(Spinner spinner, String iconValue) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
ArrayAdapter<StringBuilder> adapter = (ArrayAdapter<StringBuilder>) spinner.getAdapter();
|
ArrayAdapter<StringBuilder> adapter = (ArrayAdapter<StringBuilder>) spinner.getAdapter();
|
||||||
@@ -223,9 +189,6 @@ public class TrackIconUtils {
|
|||||||
: new ImageView(getContext());
|
: new ImageView(getContext());
|
||||||
Bitmap source = BitmapFactory.decodeResource(
|
Bitmap source = BitmapFactory.decodeResource(
|
||||||
context.getResources(), TrackIconUtils.getIconDrawable(getItem(position).toString()));
|
context.getResources(), TrackIconUtils.getIconDrawable(getItem(position).toString()));
|
||||||
if (ApiAdapterFactory.getApiAdapter().isSpinnerBackgroundLight()) {
|
|
||||||
source = TrackIconUtils.invertBitmap(source);
|
|
||||||
}
|
|
||||||
imageView.setImageBitmap(source);
|
imageView.setImageBitmap(source);
|
||||||
imageView.setPadding(4, 4, -4, -4);
|
imageView.setPadding(4, 4, -4, -4);
|
||||||
return imageView;
|
return imageView;
|
||||||
|
|||||||
Reference in New Issue
Block a user