parent
04a635307d
commit
4a78395005
@ -6,6 +6,7 @@ import android.appwidget.AppWidgetManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Build;
|
||||
import android.os.IBinder;
|
||||
import android.util.Log;
|
||||
@ -13,10 +14,13 @@ import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.widget.RemoteViews;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.MainActivity;
|
||||
import de.danoeh.antennapod.core.feed.FeedItem;
|
||||
import de.danoeh.antennapod.core.feed.FeedMedia;
|
||||
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.receiver.MediaButtonReceiver;
|
||||
import de.danoeh.antennapod.core.service.playback.PlaybackService;
|
||||
@ -127,6 +131,22 @@ public class PlayerWidgetService extends Service {
|
||||
PlayerStatus status = playbackService.getStatus();
|
||||
views.setOnClickPendingIntent(R.id.layout_left, startMediaplayer);
|
||||
|
||||
try {
|
||||
Bitmap icon = null;
|
||||
int iconSize = getResources().getDimensionPixelSize(
|
||||
android.R.dimen.app_icon_size);
|
||||
icon = Glide.with(PlayerWidgetService.this)
|
||||
.load(media.getImageLocation())
|
||||
.asBitmap()
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.centerCrop()
|
||||
.into(iconSize, iconSize)
|
||||
.get();
|
||||
views.setImageViewBitmap(R.id.imgvCover, icon);
|
||||
} catch (Throwable tr) {
|
||||
Log.e(TAG, "Error loading the media icon for the widget", tr);
|
||||
}
|
||||
|
||||
views.setTextViewText(R.id.txtvTitle, media.getEpisodeTitle());
|
||||
|
||||
String progressString = getProgressString();
|
||||
@ -160,6 +180,7 @@ public class PlayerWidgetService extends Service {
|
||||
views.setOnClickPendingIntent(R.id.layout_left, startAppPending);
|
||||
views.setOnClickPendingIntent(R.id.butPlay, startAppPending);
|
||||
views.setViewVisibility(R.id.txtvProgress, View.INVISIBLE);
|
||||
views.setImageViewResource(R.id.imgvCover, R.drawable.ic_stat_antenna_default);
|
||||
views.setTextViewText(R.id.txtvTitle,
|
||||
this.getString(R.string.no_media_playing_label));
|
||||
views.setImageViewResource(R.id.butPlay, R.drawable.ic_play_arrow_white_24dp);
|
||||
|
@ -12,7 +12,7 @@
|
||||
<ImageButton
|
||||
android:id="@+id/butPlay"
|
||||
android:contentDescription="@string/play_label"
|
||||
android:layout_width="56dp"
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_margin="12dp"
|
||||
@ -26,26 +26,43 @@
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_toLeftOf="@id/butPlay"
|
||||
android:background="@drawable/borderless_button_dark"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical" >
|
||||
android:gravity="fill_horizontal"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtvTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:maxLines="1"
|
||||
android:text="@string/no_media_playing_label"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/text_size_medium"
|
||||
android:textStyle="bold" />
|
||||
<ImageView
|
||||
android:id="@+id/imgvCover"
|
||||
android:layout_width="72dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_toLeftOf="@id/layout_center"
|
||||
android:layout_margin="12dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtvProgress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:textColor="@color/white" />
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentRight="true"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtvTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:maxLines="1"
|
||||
android:text="@string/no_media_playing_label"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/text_size_medium"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtvProgress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="8dp"
|
||||
android:textColor="@color/white" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 8.0 KiB After Width: | Height: | Size: 19 KiB |
Loading…
x
Reference in New Issue
Block a user