Commit c27772fc authored by Sophie Chang's avatar Sophie Chang Committed by Commit Bot

Make data reduction screen KK-friendly (fix crash on KK devices)

Placing a vectordrawable as the android:drawable is not allowed, so we have to bind it in onBindView

Bug: 874723
Change-Id: I20cf9856ca83bb5786da7223c828b9bb5679ba8e
Reviewed-on: https://chromium-review.googlesource.com/1178311Reviewed-by: default avatarTheresa <twellington@chromium.org>
Commit-Queue: Sophie Chang <sophiechang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583799}
parent bba9dc79
......@@ -18,7 +18,6 @@
android:layout_marginTop="8dp"
android:gravity="center_horizontal"
android:drawablePadding="3dp"
android:drawableTop="@drawable/data_reduction_big"
android:text="@string/data_reduction_initial_title"
android:textAppearance="@style/BlackDisabledText1" />
......
......@@ -15,6 +15,7 @@ import android.annotation.SuppressLint;
import android.content.Context;
import android.content.DialogInterface;
import android.preference.Preference;
import android.support.graphics.drawable.VectorDrawableCompat;
import android.support.v7.app.AlertDialog;
import android.text.format.DateUtils;
import android.util.AttributeSet;
......@@ -274,6 +275,10 @@ public class DataReductionStatsPreference extends Preference {
protected void onBindView(View view) {
super.onBindView(view);
mInitialDataSavingsTextView = (TextView) view.findViewById(R.id.initial_data_savings);
mInitialDataSavingsTextView.setCompoundDrawablesWithIntrinsicBounds(null,
VectorDrawableCompat.create(getContext().getResources(),
R.drawable.data_reduction_big, getContext().getTheme()),
null, null);
mDataSavingsSummaryContainer =
(LinearLayout) view.findViewById(R.id.data_savings_summary_container);
mDataUsageTextView = (TextView) view.findViewById(R.id.data_reduction_usage);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment