Scale the widget resolution
This commit is contained in:
parent
74664dbb2b
commit
fa0376318d
@ -121,8 +121,9 @@ public class CoverView extends View {
|
||||
String title = song.title == null ? "" : song.title;
|
||||
Bitmap cover = song.coverPath == null ? null : BitmapFactory.decodeFile(song.coverPath);
|
||||
|
||||
float titleSize = 12;
|
||||
float padding = 2;
|
||||
DisplayMetrics metrics = ContextApplication.getContext().getResources().getDisplayMetrics();
|
||||
float titleSize = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 12, metrics);
|
||||
float padding = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, metrics);
|
||||
|
||||
paint.setTextSize(titleSize);
|
||||
float titleWidth = paint.measureText(title);
|
||||
|
@ -6,6 +6,7 @@ import android.appwidget.AppWidgetProvider;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.TypedValue;
|
||||
import android.widget.RemoteViews;
|
||||
|
||||
public class OneCellWidget extends AppWidgetProvider {
|
||||
@ -28,8 +29,10 @@ public class OneCellWidget extends AppWidgetProvider {
|
||||
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.one_cell_widget);
|
||||
views.setOnClickPendingIntent(R.id.play_pause, PendingIntent.getBroadcast(context, 0, new Intent(PlaybackService.TOGGLE_PLAYBACK), 0));
|
||||
views.setOnClickPendingIntent(R.id.next, PendingIntent.getBroadcast(context, 0, new Intent(PlaybackService.NEXT_SONG), 0));
|
||||
if (song != null)
|
||||
views.setImageViewBitmap(R.id.cover_view, CoverView.createMiniBitmap(song, 72, 72));
|
||||
if (song != null) {
|
||||
int size = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 72, context.getResources().getDisplayMetrics());
|
||||
views.setImageViewBitmap(R.id.cover_view, CoverView.createMiniBitmap(song, size, size));
|
||||
}
|
||||
|
||||
sendUpdate(context, views);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user