added guard for API17 TextView method setCompoundDrawablesRelativeWithIntrinsicBounds
This commit is contained in:
parent
bbad38a97d
commit
845888b1e3
@ -3,6 +3,7 @@ package com.cradle.iitc_mobile.share;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
@ -11,6 +12,7 @@ import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Pair;
|
||||
import android.view.LayoutInflater;
|
||||
@ -40,6 +42,7 @@ public class IntentListView extends ListView {
|
||||
super(IntentListView.this.getContext(), android.R.layout.simple_list_item_1);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
LayoutInflater inflater = ((Activity) getContext()).getLayoutInflater();
|
||||
@ -51,7 +54,9 @@ public class IntentListView extends ListView {
|
||||
|
||||
view.setText(label);
|
||||
view.setCompoundDrawablePadding((int) getResources().getDimension(R.dimen.icon_margin));
|
||||
view.setCompoundDrawablesRelativeWithIntrinsicBounds(icon, null, null, null);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
view.setCompoundDrawablesRelativeWithIntrinsicBounds(icon, null, null, null);
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
@ -133,7 +138,8 @@ public class IntentListView extends ListView {
|
||||
hasCopyIntent = true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < activities.size(); i++) { // use traditional loop since List may change during interation
|
||||
// use traditional loop since list may change during iteration
|
||||
for (int i = 0; i < activities.size(); i++) {
|
||||
ResolveInfo info = activities.get(i);
|
||||
ActivityInfo activity = info.activityInfo;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user