Refactored ColorStateList of attribution control to a Drawable selector, added images responding to different states.

This commit is contained in:
tobrun
2015-09-06 15:16:56 +02:00
committed by Justin R. Miller
parent 75aefb7f9d
commit f8b8ca7273
17 changed files with 6 additions and 7 deletions

View File

@@ -9,9 +9,7 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.graphics.PointF;
@@ -30,7 +28,6 @@ import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.support.v4.view.GestureDetectorCompat;
import android.support.v4.view.ScaleGestureDetectorCompat;
import android.text.TextUtils;
@@ -423,10 +420,7 @@ public class MapView extends FrameLayout implements LocationListener {
// Setup Attributions control
mAttributionsView = new ImageView(mContext);
Drawable attrDrawable = ContextCompat.getDrawable(mContext, R.drawable.ic_info_outline_black_24dp);
attrDrawable = DrawableCompat.wrap(attrDrawable);
DrawableCompat.setTintList(attrDrawable, getResources().getColorStateList(R.color.material_bg_selector, mContext.getTheme()));
mAttributionsView.setImageDrawable(attrDrawable);
mAttributionsView.setBackgroundResource(R.drawable.ic_info_selector);
mAttributionsView.setContentDescription(getResources().getString(R.string.attributionsIconContentDescription));
LayoutParams attrParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
mAttributionsView.setLayoutParams(attrParams);

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 487 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 323 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 640 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 940 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 730 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 836 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

View File

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