Fixes a vector drawable crash on earlier versions.

This commit is contained in:
Vavassor 2017-04-02 19:10:07 -04:00
parent c57e7cee6b
commit eccebc9215

View File

@ -49,6 +49,7 @@ import android.support.v13.view.inputmethod.InputContentInfoCompat;
import android.support.v4.app.ActivityCompat; import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBar;
import android.support.v7.content.res.AppCompatResources;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.text.Editable; import android.text.Editable;
import android.text.InputType; import android.text.InputType;
@ -326,7 +327,7 @@ public class ComposeActivity extends BaseActivity {
actionBar.setTitle(null); actionBar.setTitle(null);
actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowHomeEnabled(true); actionBar.setDisplayShowHomeEnabled(true);
Drawable closeIcon = ContextCompat.getDrawable(this, R.drawable.ic_close_24dp); Drawable closeIcon = AppCompatResources.getDrawable(this, R.drawable.ic_close_24dp);
ThemeUtils.setDrawableTint(this, closeIcon, R.attr.compose_close_button_tint); ThemeUtils.setDrawableTint(this, closeIcon, R.attr.compose_close_button_tint);
actionBar.setHomeAsUpIndicator(closeIcon); actionBar.setHomeAsUpIndicator(closeIcon);
} }
@ -506,9 +507,11 @@ public class ComposeActivity extends BaseActivity {
} }
case "private": { case "private": {
floatingBtn.setText(R.string.action_send); floatingBtn.setText(R.string.action_send);
Drawable lock = ContextCompat.getDrawable(this, R.drawable.send_private); Drawable lock = AppCompatResources.getDrawable(this, R.drawable.send_private);
if (lock != null) {
lock.setBounds(0, 0, lock.getIntrinsicWidth(), lock.getIntrinsicHeight()); lock.setBounds(0, 0, lock.getIntrinsicWidth(), lock.getIntrinsicHeight());
floatingBtn.setCompoundDrawables(null, null, lock, null); floatingBtn.setCompoundDrawables(null, null, lock, null);
}
break; break;
} }
default: { default: {