fix layout issue for gingerbread

This commit is contained in:
Jimmy Shih
2013-11-22 15:35:02 -08:00
parent dfe7606dd5
commit bb5d4069cd
6 changed files with 3 additions and 59 deletions
-2
View File
@@ -33,10 +33,8 @@ limitations under the License.
<!-- Activity type -->
<Spinner
android:id="@+id/stats_activity_type_icon"
android:layout_gravity="bottom"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:layout_marginTop="-6dp"
android:layout_width="wrap_content" />
</LinearLayout>
</LinearLayout>
+1 -1
View File
@@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
<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 -->
<item name="android:autoCompleteTextViewStyle">@style/AutoCompleteTextViewMyTracks</item>
<item name="android:editTextStyle">@style/EditTextMyTracks</item>
@@ -172,12 +172,7 @@ public class Api11Adapter extends Api10Adapter {
public void invalidMenu(Activity activity) {
activity.invalidateOptionsMenu();
}
@Override
public boolean isSpinnerBackgroundLight() {
return false;
}
@Override
public boolean showEditTextClearButton() {
return true;
@@ -138,11 +138,6 @@ public class Api8Adapter implements ApiAdapter {
public void invalidMenu(Activity activity) {
// Do nothing
}
@Override
public boolean isSpinnerBackgroundLight() {
return true;
}
@Override
public boolean showEditTextClearButton() {
@@ -169,20 +169,13 @@ public interface ApiAdapter {
*/
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.
* <p>
* Due to changes in API level 11.
*/
public boolean showEditTextClearButton();
/**
* Sets the tab background.
* <p>
@@ -20,9 +20,7 @@ import com.google.android.maps.mytracks.R;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.util.Pair;
import android.view.View;
import android.widget.ArrayAdapter;
@@ -172,38 +170,6 @@ public class TrackIconUtils {
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) {
@SuppressWarnings("unchecked")
ArrayAdapter<StringBuilder> adapter = (ArrayAdapter<StringBuilder>) spinner.getAdapter();
@@ -223,9 +189,6 @@ public class TrackIconUtils {
: new ImageView(getContext());
Bitmap source = BitmapFactory.decodeResource(
context.getResources(), TrackIconUtils.getIconDrawable(getItem(position).toString()));
if (ApiAdapterFactory.getApiAdapter().isSpinnerBackgroundLight()) {
source = TrackIconUtils.invertBitmap(source);
}
imageView.setImageBitmap(source);
imageView.setPadding(4, 4, -4, -4);
return imageView;