Merge branch 'master' into fix/boot-widgets
This commit is contained in:
commit
790410ce20
147 changed files with 353 additions and 344 deletions
|
|
@ -32,6 +32,7 @@ public class AppWidgetBig extends BaseAppWidget {
|
|||
public static final String NAME = "app_widget_big";
|
||||
|
||||
private static AppWidgetBig mInstance;
|
||||
private Target<Bitmap> target; // for cancellation
|
||||
|
||||
public static synchronized AppWidgetBig getInstance() {
|
||||
if (mInstance == null) {
|
||||
|
|
@ -125,14 +126,14 @@ public class AppWidgetBig extends BaseAppWidget {
|
|||
int playPauseRes = isPlaying ? R.drawable.ic_pause_white_24dp : R.drawable.ic_play_arrow_white_24dp;
|
||||
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(Util.getTintedVectorDrawable(service, playPauseRes, MaterialValueHelper.getPrimaryTextColor(service, false)), 1f));
|
||||
|
||||
// set prev/next button drawables
|
||||
// Set prev/next button drawables
|
||||
appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(Util.getTintedVectorDrawable(service, R.drawable.ic_skip_next_white_24dp, MaterialValueHelper.getPrimaryTextColor(service, false)), 1f));
|
||||
appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(Util.getTintedVectorDrawable(service, R.drawable.ic_skip_previous_white_24dp, MaterialValueHelper.getPrimaryTextColor(service, false)), 1f));
|
||||
|
||||
// Link actions buttons to intents
|
||||
linkButtons(service, appWidgetView);
|
||||
|
||||
// load the album cover async and push the update on completion
|
||||
// Load the album cover async and push the update on completion
|
||||
Point p = Util.getScreenSize(service);
|
||||
final int widgetImageSize = Math.min(p.x, p.y);
|
||||
final Context appContext = service.getApplicationContext();
|
||||
|
|
@ -171,8 +172,6 @@ public class AppWidgetBig extends BaseAppWidget {
|
|||
});
|
||||
}
|
||||
|
||||
private Target<Bitmap> target; // for cancellation
|
||||
|
||||
/**
|
||||
* Link up various button actions using {@link PendingIntent}.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ public class AppWidgetClassic extends BaseAppWidget {
|
|||
public static final String NAME = "app_widget_classic";
|
||||
|
||||
private static AppWidgetClassic mInstance;
|
||||
private Target<Bitmap> target; // for cancellation
|
||||
|
||||
public static synchronized AppWidgetClassic getInstance() {
|
||||
if (mInstance == null) {
|
||||
|
|
@ -124,14 +125,14 @@ public class AppWidgetClassic extends BaseAppWidget {
|
|||
int playPauseRes = isPlaying ? R.drawable.ic_pause_white_24dp : R.drawable.ic_play_arrow_white_24dp;
|
||||
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(Util.getTintedVectorDrawable(service, playPauseRes, MaterialValueHelper.getSecondaryTextColor(service, false)), 1f));
|
||||
|
||||
// set prev/next button drawables
|
||||
// Set prev/next button drawables
|
||||
appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(Util.getTintedVectorDrawable(service, R.drawable.ic_skip_next_white_24dp, MaterialValueHelper.getSecondaryTextColor(service, false)), 1f));
|
||||
appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(Util.getTintedVectorDrawable(service, R.drawable.ic_skip_previous_white_24dp, MaterialValueHelper.getSecondaryTextColor(service, false)), 1f));
|
||||
|
||||
// Link actions buttons to intents
|
||||
linkButtons(service, appWidgetView);
|
||||
|
||||
// load the album cover async and push the update on completion
|
||||
// Load the album cover async and push the update on completion
|
||||
final Context appContext = service.getApplicationContext();
|
||||
final int widgetImageSize = service.getResources().getDimensionPixelSize(R.dimen.app_widget_classic_image_size);
|
||||
service.runOnUiThread(new Runnable() {
|
||||
|
|
@ -169,8 +170,6 @@ public class AppWidgetClassic extends BaseAppWidget {
|
|||
});
|
||||
}
|
||||
|
||||
private Target<Bitmap> target; // for cancellation
|
||||
|
||||
/**
|
||||
* Link up various button actions using {@link PendingIntent}.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ public class AppWidgetSmall extends BaseAppWidget {
|
|||
public static final String NAME = "app_widget_small";
|
||||
|
||||
private static AppWidgetSmall mInstance;
|
||||
private Target<Bitmap> target; // for cancellation
|
||||
|
||||
public static synchronized AppWidgetSmall getInstance() {
|
||||
if (mInstance == null) {
|
||||
|
|
@ -130,14 +131,14 @@ public class AppWidgetSmall extends BaseAppWidget {
|
|||
int playPauseRes = isPlaying ? R.drawable.ic_pause_white_24dp : R.drawable.ic_play_arrow_white_24dp;
|
||||
appWidgetView.setImageViewBitmap(R.id.button_toggle_play_pause, createBitmap(Util.getTintedVectorDrawable(service, playPauseRes, MaterialValueHelper.getSecondaryTextColor(service, false)), 1f));
|
||||
|
||||
// set prev/next button drawables
|
||||
// Set prev/next button drawables
|
||||
appWidgetView.setImageViewBitmap(R.id.button_next, createBitmap(Util.getTintedVectorDrawable(service, R.drawable.ic_skip_next_white_24dp, MaterialValueHelper.getSecondaryTextColor(service, false)), 1f));
|
||||
appWidgetView.setImageViewBitmap(R.id.button_prev, createBitmap(Util.getTintedVectorDrawable(service, R.drawable.ic_skip_previous_white_24dp, MaterialValueHelper.getSecondaryTextColor(service, false)), 1f));
|
||||
|
||||
// Link actions buttons to intents
|
||||
linkButtons(service, appWidgetView);
|
||||
|
||||
// load the album cover async and push the update on completion
|
||||
// Load the album cover async and push the update on completion
|
||||
final Context appContext = service.getApplicationContext();
|
||||
final int widgetImageSize = service.getResources().getDimensionPixelSize(R.dimen.app_widget_small_image_size);
|
||||
service.runOnUiThread(new Runnable() {
|
||||
|
|
@ -175,8 +176,6 @@ public class AppWidgetSmall extends BaseAppWidget {
|
|||
});
|
||||
}
|
||||
|
||||
private Target<Bitmap> target; // for cancellation
|
||||
|
||||
/**
|
||||
* Link up various button actions using {@link PendingIntent}.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -14,12 +14,6 @@ import android.graphics.drawable.Drawable;
|
|||
*/
|
||||
public class BaseAppWidget extends AppWidgetProvider {
|
||||
|
||||
protected PendingIntent buildPendingIntent(Context context, final String action, final ComponentName serviceName) {
|
||||
Intent intent = new Intent(action);
|
||||
intent.setComponent(serviceName);
|
||||
return PendingIntent.getService(context, 0, intent, 0);
|
||||
}
|
||||
|
||||
protected static Bitmap createBitmap(Drawable drawable, float sizeMultiplier) {
|
||||
Bitmap bitmap = Bitmap.createBitmap((int) (drawable.getIntrinsicWidth() * sizeMultiplier), (int) (drawable.getIntrinsicHeight() * sizeMultiplier), Bitmap.Config.ARGB_8888);
|
||||
Canvas c = new Canvas(bitmap);
|
||||
|
|
@ -27,4 +21,10 @@ public class BaseAppWidget extends AppWidgetProvider {
|
|||
drawable.draw(c);
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
protected PendingIntent buildPendingIntent(Context context, final String action, final ComponentName serviceName) {
|
||||
Intent intent = new Intent(action);
|
||||
intent.setComponent(serviceName);
|
||||
return PendingIntent.getService(context, 0, intent, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue