2018.11.28
2018.11.28private fun getNotifyExpand(ctx: Context, event: String, song: String, isPlay: Boolean, progress: Int, time: Long):RemoteViews{val notify_expand = RemoteViews(ctx.packageName, R.layout.activ
·
2018.11.28
private fun getNotifyExpand(ctx: Context, event: String, song: String, isPlay: Boolean, progress: Int, time: Long):RemoteViews{
val notify_expand = RemoteViews(ctx.packageName, R.layout.activity_main)
if(isPlay){
notify_expand.setTextViewText(R.id.gone, "pause")
notify_expand.setTextViewText(R.id.packed, song+" playing")
notify_expand.setChronometer(R.id.percent, time, "%s", true)
}else{
notify_expand.setTextViewText(R.id.spread, "continue")
notify_expand.setTextViewText(R.id.wrap, song+ "continue")
notify_expand.setChronometer(R.id.percent, time, "%s", false)
}
notify_expand.setProgressBar(R.id.gone, 100, progress, false)
val pIntent = Intent(event)
val piPause = PendingIntent.getBroadcast(ctx, R.string.app_name, pIntent, PendingIntent.FLAG_UPDATE_CURRENT)
notify_expand.setOnClickPendingIntent(R.id.gone, piPause)
val bIntent = Intent(ctx, MainActivity::class.java)
val piBack = PendingIntent.getActivity(ctx, R.string.app_name, bIntent, PendingIntent.FLAG_UPDATE_CURRENT)
notify_expand.setOnClickPendingIntent(R.id.packed, piBack)
return notify_expand
}

更多推荐
所有评论(0)