mirror of
https://github.com/etesync/android
synced 2024-11-16 04:49:06 +00:00
Use the safe getDrawable function instead of the version specific one.
This commit is contained in:
parent
52723dac67
commit
ea91063178
@ -32,6 +32,7 @@ import android.provider.ContactsContract;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.NotificationManagerCompat;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.app.NotificationCompat;
|
||||
import android.util.Log;
|
||||
|
||||
@ -195,9 +196,8 @@ public class App extends Application {
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
public static Bitmap getLauncherBitmap(@NonNull Context context) {
|
||||
Bitmap bitmapLogo = null;
|
||||
Drawable drawableLogo = android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP ?
|
||||
context.getDrawable(R.mipmap.ic_launcher) :
|
||||
context.getResources().getDrawable(R.mipmap.ic_launcher);
|
||||
Drawable drawableLogo = ContextCompat.getDrawable(context, R.mipmap.ic_launcher);
|
||||
|
||||
if (drawableLogo instanceof BitmapDrawable)
|
||||
bitmapLogo = ((BitmapDrawable)drawableLogo).getBitmap();
|
||||
return bitmapLogo;
|
||||
|
@ -33,6 +33,7 @@ import android.os.IBinder;
|
||||
import android.provider.CalendarContract;
|
||||
import android.provider.ContactsContract;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.CardView;
|
||||
@ -95,8 +96,7 @@ public class AccountActivity extends AppCompatActivity implements Toolbar.OnMenu
|
||||
|
||||
setContentView(R.layout.activity_account);
|
||||
|
||||
Drawable icMenu = Build.VERSION.SDK_INT >= 21 ? getDrawable(R.drawable.ic_menu_light) :
|
||||
getResources().getDrawable(R.drawable.ic_menu_light);
|
||||
Drawable icMenu = ContextCompat.getDrawable(this, R.drawable.ic_menu_light);
|
||||
|
||||
// CardDAV toolbar
|
||||
tbCardDAV = (Toolbar)findViewById(R.id.carddav_menu);
|
||||
|
Loading…
Reference in New Issue
Block a user