Fix icons
This commit is contained in:
parent
44baab2109
commit
4d0107bd74
99 changed files with 999 additions and 789 deletions
|
@ -19,229 +19,239 @@ import androidx.recyclerview.widget.RecyclerView
|
|||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil
|
||||
import code.name.monkey.appthemehelper.util.TintHelper
|
||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
|
||||
import code.name.monkey.retromusic.BuildConfig
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.activities.base.AbsBaseActivity
|
||||
import code.name.monkey.retromusic.extensions.applyToolbar
|
||||
import com.anjlab.android.iab.v3.BillingProcessor
|
||||
import com.anjlab.android.iab.v3.SkuDetails
|
||||
import com.anjlab.android.iab.v3.TransactionDetails
|
||||
import kotlinx.android.synthetic.main.activity_donation.*
|
||||
import kotlinx.android.synthetic.main.activity_about.toolbar
|
||||
import kotlinx.android.synthetic.main.activity_donation.donation
|
||||
import kotlinx.android.synthetic.main.activity_donation.progress
|
||||
import kotlinx.android.synthetic.main.activity_donation.progressContainer
|
||||
import kotlinx.android.synthetic.main.activity_donation.recyclerView
|
||||
import java.lang.ref.WeakReference
|
||||
import java.util.*
|
||||
import java.util.ArrayList
|
||||
import java.util.Arrays
|
||||
|
||||
class SupportDevelopmentActivity : AbsBaseActivity(), BillingProcessor.IBillingHandler {
|
||||
|
||||
companion object {
|
||||
val TAG: String = SupportDevelopmentActivity::class.java.simpleName
|
||||
const val DONATION_PRODUCT_IDS = R.array.donation_ids
|
||||
private const val TEZ_REQUEST_CODE = 123
|
||||
}
|
||||
companion object {
|
||||
val TAG: String = SupportDevelopmentActivity::class.java.simpleName
|
||||
const val DONATION_PRODUCT_IDS = R.array.donation_ids
|
||||
private const val TEZ_REQUEST_CODE = 123
|
||||
}
|
||||
|
||||
var billingProcessor: BillingProcessor? = null
|
||||
private var skuDetailsLoadAsyncTask: AsyncTask<*, *, *>? = null
|
||||
var billingProcessor: BillingProcessor? = null
|
||||
private var skuDetailsLoadAsyncTask: AsyncTask<*, *, *>? = null
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
if (item.itemId == android.R.id.home) {
|
||||
onBackPressed()
|
||||
return true
|
||||
}
|
||||
return super.onOptionsItemSelected(item)
|
||||
}
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
if (item.itemId == android.R.id.home) {
|
||||
onBackPressed()
|
||||
return true
|
||||
}
|
||||
return super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
||||
fun donate(i: Int) {
|
||||
val ids = resources.getStringArray(DONATION_PRODUCT_IDS)
|
||||
billingProcessor!!.purchase(this, ids[i])
|
||||
}
|
||||
fun donate(i: Int) {
|
||||
val ids = resources.getStringArray(DONATION_PRODUCT_IDS)
|
||||
billingProcessor!!.purchase(this, ids[i])
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_donation)
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_donation)
|
||||
|
||||
setStatusbarColorAuto()
|
||||
setNavigationbarColorAuto()
|
||||
setTaskDescriptionColorAuto()
|
||||
setLightNavigationBar(true)
|
||||
setStatusbarColorAuto()
|
||||
setNavigationbarColorAuto()
|
||||
setTaskDescriptionColorAuto()
|
||||
setLightNavigationBar(true)
|
||||
|
||||
setupToolbar()
|
||||
setupToolbar()
|
||||
|
||||
billingProcessor = BillingProcessor(this, BuildConfig.GOOGLE_PLAY_LICENSING_KEY, this)
|
||||
TintHelper.setTint(progress, ThemeStore.accentColor(this))
|
||||
donation.setTextColor(ThemeStore.accentColor(this))
|
||||
}
|
||||
billingProcessor = BillingProcessor(this, BuildConfig.GOOGLE_PLAY_LICENSING_KEY, this)
|
||||
TintHelper.setTint(progress, ThemeStore.accentColor(this))
|
||||
donation.setTextColor(ThemeStore.accentColor(this))
|
||||
}
|
||||
|
||||
private fun setupToolbar() {
|
||||
applyToolbar(toolbar)
|
||||
}
|
||||
private fun setupToolbar() {
|
||||
val toolbarColor = ATHUtil.resolveColor(this, R.attr.colorSurface)
|
||||
toolbar.setBackgroundColor(toolbarColor)
|
||||
ToolbarContentTintHelper.colorBackButton(toolbar)
|
||||
setSupportActionBar(toolbar)
|
||||
}
|
||||
|
||||
override fun onBillingInitialized() {
|
||||
loadSkuDetails()
|
||||
}
|
||||
override fun onBillingInitialized() {
|
||||
loadSkuDetails()
|
||||
}
|
||||
|
||||
private fun loadSkuDetails() {
|
||||
if (skuDetailsLoadAsyncTask != null) {
|
||||
skuDetailsLoadAsyncTask!!.cancel(false)
|
||||
}
|
||||
skuDetailsLoadAsyncTask = SkuDetailsLoadAsyncTask(this).execute()
|
||||
private fun loadSkuDetails() {
|
||||
if (skuDetailsLoadAsyncTask != null) {
|
||||
skuDetailsLoadAsyncTask!!.cancel(false)
|
||||
}
|
||||
skuDetailsLoadAsyncTask = SkuDetailsLoadAsyncTask(this).execute()
|
||||
}
|
||||
|
||||
}
|
||||
override fun onProductPurchased(productId: String, details: TransactionDetails?) {
|
||||
//loadSkuDetails();
|
||||
Toast.makeText(this, R.string.thank_you, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
override fun onProductPurchased(productId: String, details: TransactionDetails?) {
|
||||
//loadSkuDetails();
|
||||
Toast.makeText(this, R.string.thank_you, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
override fun onBillingError(errorCode: Int, error: Throwable?) {
|
||||
Log.e(TAG, "Billing error: code = $errorCode", error)
|
||||
}
|
||||
|
||||
override fun onBillingError(errorCode: Int, error: Throwable?) {
|
||||
Log.e(TAG, "Billing error: code = $errorCode", error)
|
||||
}
|
||||
override fun onPurchaseHistoryRestored() {
|
||||
//loadSkuDetails();
|
||||
Toast.makeText(this, R.string.restored_previous_purchases, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
override fun onPurchaseHistoryRestored() {
|
||||
//loadSkuDetails();
|
||||
Toast.makeText(this, R.string.restored_previous_purchases, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
if (!billingProcessor!!.handleActivityResult(requestCode, resultCode, data)) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
}
|
||||
if (requestCode == TEZ_REQUEST_CODE) {
|
||||
// Process based on the data in response.
|
||||
Log.d("result", data!!.getStringExtra("Status"))
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
if (!billingProcessor!!.handleActivityResult(requestCode, resultCode, data)) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
}
|
||||
if (requestCode == TEZ_REQUEST_CODE) {
|
||||
// Process based on the data in response.
|
||||
Log.d("result", data!!.getStringExtra("Status"))
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
if (billingProcessor != null) {
|
||||
billingProcessor!!.release()
|
||||
}
|
||||
if (skuDetailsLoadAsyncTask != null) {
|
||||
skuDetailsLoadAsyncTask!!.cancel(true)
|
||||
}
|
||||
super.onDestroy()
|
||||
}
|
||||
override fun onDestroy() {
|
||||
if (billingProcessor != null) {
|
||||
billingProcessor!!.release()
|
||||
}
|
||||
if (skuDetailsLoadAsyncTask != null) {
|
||||
skuDetailsLoadAsyncTask!!.cancel(true)
|
||||
}
|
||||
super.onDestroy()
|
||||
}
|
||||
}
|
||||
|
||||
private class SkuDetailsLoadAsyncTask internal constructor(supportDevelopmentActivity: SupportDevelopmentActivity) : AsyncTask<Void, Void, List<SkuDetails>>() {
|
||||
private val weakReference: WeakReference<SupportDevelopmentActivity> = WeakReference(
|
||||
supportDevelopmentActivity
|
||||
)
|
||||
private class SkuDetailsLoadAsyncTask internal constructor(supportDevelopmentActivity: SupportDevelopmentActivity) :
|
||||
AsyncTask<Void, Void, List<SkuDetails>>() {
|
||||
|
||||
override fun onPreExecute() {
|
||||
super.onPreExecute()
|
||||
val supportDevelopmentActivity = weakReference.get() ?: return
|
||||
private val weakReference: WeakReference<SupportDevelopmentActivity> = WeakReference(
|
||||
supportDevelopmentActivity
|
||||
)
|
||||
|
||||
supportDevelopmentActivity.progressContainer.visibility = View.VISIBLE
|
||||
supportDevelopmentActivity.recyclerView.visibility = View.GONE
|
||||
}
|
||||
override fun onPreExecute() {
|
||||
super.onPreExecute()
|
||||
val supportDevelopmentActivity = weakReference.get() ?: return
|
||||
|
||||
override fun doInBackground(vararg params: Void): List<SkuDetails>? {
|
||||
val dialog = weakReference.get()
|
||||
if (dialog != null) {
|
||||
val ids = dialog.resources.getStringArray(SupportDevelopmentActivity.DONATION_PRODUCT_IDS)
|
||||
return dialog.billingProcessor!!.getPurchaseListingDetails(ArrayList(Arrays.asList(*ids)))
|
||||
}
|
||||
cancel(false)
|
||||
return null
|
||||
}
|
||||
supportDevelopmentActivity.progressContainer.visibility = View.VISIBLE
|
||||
supportDevelopmentActivity.recyclerView.visibility = View.GONE
|
||||
}
|
||||
|
||||
override fun onPostExecute(skuDetails: List<SkuDetails>?) {
|
||||
super.onPostExecute(skuDetails)
|
||||
val dialog = weakReference.get() ?: return
|
||||
override fun doInBackground(vararg params: Void): List<SkuDetails>? {
|
||||
val dialog = weakReference.get()
|
||||
if (dialog != null) {
|
||||
val ids = dialog.resources.getStringArray(SupportDevelopmentActivity.DONATION_PRODUCT_IDS)
|
||||
return dialog.billingProcessor!!.getPurchaseListingDetails(ArrayList(Arrays.asList(*ids)))
|
||||
}
|
||||
cancel(false)
|
||||
return null
|
||||
}
|
||||
|
||||
if (skuDetails == null || skuDetails.isEmpty()) {
|
||||
dialog.progressContainer.visibility = View.GONE
|
||||
return
|
||||
}
|
||||
override fun onPostExecute(skuDetails: List<SkuDetails>?) {
|
||||
super.onPostExecute(skuDetails)
|
||||
val dialog = weakReference.get() ?: return
|
||||
|
||||
dialog.progressContainer.visibility = View.GONE
|
||||
dialog.recyclerView.itemAnimator = DefaultItemAnimator()
|
||||
dialog.recyclerView.layoutManager = GridLayoutManager(dialog, 2)
|
||||
dialog.recyclerView.adapter = SkuDetailsAdapter(dialog, skuDetails)
|
||||
dialog.recyclerView.visibility = View.VISIBLE
|
||||
}
|
||||
if (skuDetails == null || skuDetails.isEmpty()) {
|
||||
dialog.progressContainer.visibility = View.GONE
|
||||
return
|
||||
}
|
||||
|
||||
dialog.progressContainer.visibility = View.GONE
|
||||
dialog.recyclerView.itemAnimator = DefaultItemAnimator()
|
||||
dialog.recyclerView.layoutManager = GridLayoutManager(dialog, 2)
|
||||
dialog.recyclerView.adapter = SkuDetailsAdapter(dialog, skuDetails)
|
||||
dialog.recyclerView.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
class SkuDetailsAdapter(
|
||||
private var donationsDialog: SupportDevelopmentActivity, objects: List<SkuDetails>
|
||||
private var donationsDialog: SupportDevelopmentActivity, objects: List<SkuDetails>
|
||||
) : RecyclerView.Adapter<SkuDetailsAdapter.ViewHolder>() {
|
||||
private var skuDetailsList: List<SkuDetails> = ArrayList()
|
||||
|
||||
init {
|
||||
skuDetailsList = objects
|
||||
}
|
||||
private var skuDetailsList: List<SkuDetails> = ArrayList()
|
||||
|
||||
private fun getIcon(position: Int): Int {
|
||||
return when (position) {
|
||||
0 -> R.drawable.ic_cookie_white_24dp
|
||||
1 -> R.drawable.ic_take_away_white_24dp
|
||||
2 -> R.drawable.ic_take_away_coffe_white_24dp
|
||||
3 -> R.drawable.ic_beer_white_24dp
|
||||
4 -> R.drawable.ic_fast_food_meal_white_24dp
|
||||
5 -> R.drawable.ic_popcorn_white_24dp
|
||||
6 -> R.drawable.ic_card_giftcard_white_24dp
|
||||
else -> R.drawable.ic_card_giftcard_white_24dp
|
||||
}
|
||||
}
|
||||
init {
|
||||
skuDetailsList = objects
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(viewGroup: ViewGroup, i: Int): ViewHolder {
|
||||
return ViewHolder(
|
||||
LayoutInflater.from(donationsDialog).inflate(
|
||||
LAYOUT_RES_ID,
|
||||
viewGroup,
|
||||
false
|
||||
)
|
||||
)
|
||||
}
|
||||
private fun getIcon(position: Int): Int {
|
||||
return when (position) {
|
||||
0 -> R.drawable.ic_cookie_white_24dp
|
||||
1 -> R.drawable.ic_take_away_white_24dp
|
||||
2 -> R.drawable.ic_take_away_coffe_white_24dp
|
||||
3 -> R.drawable.ic_beer_white_24dp
|
||||
4 -> R.drawable.ic_fast_food_meal_white_24dp
|
||||
5 -> R.drawable.ic_popcorn_white_24dp
|
||||
6 -> R.drawable.ic_card_giftcard_white_24dp
|
||||
else -> R.drawable.ic_card_giftcard_white_24dp
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(viewHolder: ViewHolder, i: Int) {
|
||||
val skuDetails = skuDetailsList[i]
|
||||
viewHolder.title.text = skuDetails.title.replace("(Retro Music Player)", "")
|
||||
.trim { it <= ' ' }
|
||||
viewHolder.text.text = skuDetails.description
|
||||
viewHolder.text.visibility = View.GONE
|
||||
viewHolder.price.text = skuDetails.priceText
|
||||
viewHolder.image.setImageResource(getIcon(i))
|
||||
override fun onCreateViewHolder(viewGroup: ViewGroup, i: Int): ViewHolder {
|
||||
return ViewHolder(
|
||||
LayoutInflater.from(donationsDialog).inflate(
|
||||
LAYOUT_RES_ID,
|
||||
viewGroup,
|
||||
false
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
val purchased = donationsDialog.billingProcessor!!.isPurchased(skuDetails.productId)
|
||||
val titleTextColor = if (purchased) ATHUtil.resolveColor(
|
||||
donationsDialog,
|
||||
android.R.attr.textColorHint
|
||||
) else ThemeStore.textColorPrimary(donationsDialog)
|
||||
val contentTextColor = if (purchased) titleTextColor else ThemeStore.textColorSecondary(
|
||||
donationsDialog
|
||||
)
|
||||
override fun onBindViewHolder(viewHolder: ViewHolder, i: Int) {
|
||||
val skuDetails = skuDetailsList[i]
|
||||
viewHolder.title.text = skuDetails.title.replace("(Retro Music Player)", "")
|
||||
.trim { it <= ' ' }
|
||||
viewHolder.text.text = skuDetails.description
|
||||
viewHolder.text.visibility = View.GONE
|
||||
viewHolder.price.text = skuDetails.priceText
|
||||
viewHolder.image.setImageResource(getIcon(i))
|
||||
|
||||
val purchased = donationsDialog.billingProcessor!!.isPurchased(skuDetails.productId)
|
||||
val titleTextColor = if (purchased) ATHUtil.resolveColor(
|
||||
donationsDialog,
|
||||
android.R.attr.textColorHint
|
||||
) else ThemeStore.textColorPrimary(donationsDialog)
|
||||
val contentTextColor = if (purchased) titleTextColor else ThemeStore.textColorSecondary(
|
||||
donationsDialog
|
||||
)
|
||||
|
||||
|
||||
viewHolder.title.setTextColor(titleTextColor)
|
||||
viewHolder.text.setTextColor(contentTextColor)
|
||||
viewHolder.price.setTextColor(titleTextColor)
|
||||
viewHolder.title.setTextColor(titleTextColor)
|
||||
viewHolder.text.setTextColor(contentTextColor)
|
||||
viewHolder.price.setTextColor(titleTextColor)
|
||||
|
||||
strikeThrough(viewHolder.title, purchased)
|
||||
strikeThrough(viewHolder.text, purchased)
|
||||
strikeThrough(viewHolder.price, purchased)
|
||||
strikeThrough(viewHolder.title, purchased)
|
||||
strikeThrough(viewHolder.text, purchased)
|
||||
strikeThrough(viewHolder.price, purchased)
|
||||
|
||||
viewHolder.itemView.setOnTouchListener { _, _ -> purchased }
|
||||
viewHolder.itemView.setOnClickListener { donationsDialog.donate(i) }
|
||||
}
|
||||
viewHolder.itemView.setOnTouchListener { _, _ -> purchased }
|
||||
viewHolder.itemView.setOnClickListener { donationsDialog.donate(i) }
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return skuDetailsList.size
|
||||
}
|
||||
override fun getItemCount(): Int {
|
||||
return skuDetailsList.size
|
||||
}
|
||||
|
||||
class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
var title: TextView = view.findViewById(R.id.itemTitle)
|
||||
var text: TextView = view.findViewById(R.id.itemText)
|
||||
var price: TextView = view.findViewById(R.id.itemPrice)
|
||||
var image: AppCompatImageView = view.findViewById(R.id.itemImage)
|
||||
}
|
||||
class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
var title: TextView = view.findViewById(R.id.itemTitle)
|
||||
var text: TextView = view.findViewById(R.id.itemText)
|
||||
var price: TextView = view.findViewById(R.id.itemPrice)
|
||||
var image: AppCompatImageView = view.findViewById(R.id.itemImage)
|
||||
}
|
||||
|
||||
companion object {
|
||||
@LayoutRes
|
||||
private val LAYOUT_RES_ID = R.layout.item_donation_option
|
||||
companion object {
|
||||
@LayoutRes
|
||||
private val LAYOUT_RES_ID = R.layout.item_donation_option
|
||||
|
||||
private fun strikeThrough(textView: TextView, strikeThrough: Boolean) {
|
||||
textView.paintFlags = if (strikeThrough) textView.paintFlags or Paint.STRIKE_THRU_TEXT_FLAG
|
||||
else textView.paintFlags and Paint.STRIKE_THRU_TEXT_FLAG.inv()
|
||||
}
|
||||
}
|
||||
private fun strikeThrough(textView: TextView, strikeThrough: Boolean) {
|
||||
textView.paintFlags = if (strikeThrough) textView.paintFlags or Paint.STRIKE_THRU_TEXT_FLAG
|
||||
else textView.paintFlags and Paint.STRIKE_THRU_TEXT_FLAG.inv()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -187,7 +187,7 @@ abstract class AbsTagEditorActivity : AbsBaseActivity() {
|
|||
|
||||
setUpViews()
|
||||
|
||||
|
||||
setStatusbarColorAuto()
|
||||
setNavigationbarColorAuto()
|
||||
setTaskDescriptionColorAuto()
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ class SongTagEditorActivity : AbsTagEditorActivity(), TextWatcher {
|
|||
setNoImageMode()
|
||||
setUpViews()
|
||||
applyToolbar(toolbar)
|
||||
setStatusbarColorAuto()
|
||||
|
||||
}
|
||||
|
||||
private fun setUpViews() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package code.name.monkey.retromusic.adapter.song
|
||||
|
||||
import android.graphics.Color
|
||||
import android.graphics.PorterDuff
|
||||
import android.graphics.PorterDuff.Mode
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
|
@ -23,16 +23,15 @@ import com.h6ah4i.android.widget.advrecyclerview.swipeable.action.SwipeResultAct
|
|||
import com.h6ah4i.android.widget.advrecyclerview.swipeable.action.SwipeResultActionDefault
|
||||
import com.h6ah4i.android.widget.advrecyclerview.swipeable.action.SwipeResultActionRemoveItem
|
||||
import com.h6ah4i.android.widget.advrecyclerview.swipeable.annotation.SwipeableItemResults
|
||||
import java.util.*
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
class PlayingQueueAdapter(
|
||||
activity: AppCompatActivity,
|
||||
dataSet: ArrayList<Song>,
|
||||
private var current: Int,
|
||||
itemLayoutRes: Int
|
||||
activity: AppCompatActivity,
|
||||
dataSet: ArrayList<Song>,
|
||||
private var current: Int,
|
||||
itemLayoutRes: Int
|
||||
) : SongAdapter(
|
||||
activity, dataSet, itemLayoutRes, false, null
|
||||
activity, dataSet, itemLayoutRes, false, null
|
||||
), DraggableItemAdapter<PlayingQueueAdapter.ViewHolder>, SwipeableItemAdapter<PlayingQueueAdapter.ViewHolder> {
|
||||
|
||||
private var color = -1
|
||||
|
@ -67,7 +66,7 @@ class PlayingQueueAdapter(
|
|||
holder.time?.setTextColor(white)
|
||||
holder.imageText?.setTextColor(white)
|
||||
if (holder.menu != null) {
|
||||
(holder.menu as ImageView).setColorFilter(white, PorterDuff.Mode.SRC_IN)
|
||||
(holder.menu as ImageView).setColorFilter(white, Mode.SRC_IN)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -158,7 +157,7 @@ class PlayingQueueAdapter(
|
|||
override fun onSongMenuItemClick(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
R.id.action_remove_from_playing_queue -> {
|
||||
MusicPlayerRemote.removeFromQueue(adapterPosition)
|
||||
removeFromQueue(adapterPosition)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
@ -186,7 +185,10 @@ class PlayingQueueAdapter(
|
|||
private const val UP_NEXT = 2
|
||||
}
|
||||
|
||||
override fun onSwipeItem(holder: ViewHolder?, position: Int, @SwipeableItemResults result: Int): SwipeResultAction {
|
||||
override fun onSwipeItem(
|
||||
holder: ViewHolder?,
|
||||
position: Int, @SwipeableItemResults result: Int
|
||||
): SwipeResultAction {
|
||||
return if (result === SwipeableItemConstants.RESULT_CANCELED) {
|
||||
SwipeResultActionDefault()
|
||||
} else {
|
||||
|
@ -206,12 +208,14 @@ class PlayingQueueAdapter(
|
|||
}
|
||||
|
||||
override fun onSetSwipeBackground(holder: ViewHolder?, position: Int, result: Int) {
|
||||
|
||||
}
|
||||
|
||||
internal class SwipedResultActionRemoveItem(private val adapter: PlayingQueueAdapter,
|
||||
private val position: Int,
|
||||
private val activity: AppCompatActivity) : SwipeResultActionRemoveItem() {
|
||||
internal class SwipedResultActionRemoveItem(
|
||||
private val adapter: PlayingQueueAdapter,
|
||||
private val position: Int,
|
||||
private val activity: AppCompatActivity
|
||||
) : SwipeResultActionRemoveItem() {
|
||||
|
||||
private var songToRemove: Song? = null
|
||||
private val isPlaying: Boolean = MusicPlayerRemote.isPlaying
|
||||
private val songProgressMillis = 0
|
||||
|
@ -230,6 +234,5 @@ class PlayingQueueAdapter(
|
|||
adapter.setSongToRemove(songToRemove!!)
|
||||
removeFromQueue(songToRemove!!)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,16 @@ import code.name.monkey.retromusic.service.MusicService
|
|||
import code.name.monkey.retromusic.util.MusicUtil
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import code.name.monkey.retromusic.util.ViewUtil
|
||||
import kotlinx.android.synthetic.main.fragment_player_playback_controls.*
|
||||
import kotlinx.android.synthetic.main.fragment_player_playback_controls.nextButton
|
||||
import kotlinx.android.synthetic.main.fragment_player_playback_controls.playPauseButton
|
||||
import kotlinx.android.synthetic.main.fragment_player_playback_controls.previousButton
|
||||
import kotlinx.android.synthetic.main.fragment_player_playback_controls.progressSlider
|
||||
import kotlinx.android.synthetic.main.fragment_player_playback_controls.repeatButton
|
||||
import kotlinx.android.synthetic.main.fragment_player_playback_controls.shuffleButton
|
||||
import kotlinx.android.synthetic.main.fragment_player_playback_controls.songCurrentProgress
|
||||
import kotlinx.android.synthetic.main.fragment_player_playback_controls.songTotalTime
|
||||
import kotlinx.android.synthetic.main.fragment_player_playback_controls.text
|
||||
import kotlinx.android.synthetic.main.fragment_player_playback_controls.title
|
||||
|
||||
|
||||
class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
||||
|
@ -135,7 +144,7 @@ class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
|
|||
if (MusicPlayerRemote.isPlaying) {
|
||||
playPauseButton.setImageResource(R.drawable.ic_pause_white_24dp)
|
||||
} else {
|
||||
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_32dp)
|
||||
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_24dp)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,11 +16,33 @@ package code.name.monkey.retromusic.model;
|
|||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import code.name.monkey.retromusic.R;
|
||||
|
||||
|
||||
public class CategoryInfo implements Parcelable {
|
||||
|
||||
public enum Category {
|
||||
HOME(R.id.action_home, R.string.home, R.drawable.ic_home_white_24dp),
|
||||
SONGS(R.id.action_song, R.string.songs, R.drawable.ic_audiotrack_white_24dp),
|
||||
ALBUMS(R.id.action_album, R.string.albums, R.drawable.ic_album_white_24dp),
|
||||
ARTISTS(R.id.action_artist, R.string.artists, R.drawable.ic_artist_white_24dp),
|
||||
PLAYLISTS(R.id.action_playlist, R.string.playlists, R.drawable.ic_playlist_play_white_24dp),
|
||||
GENRES(R.id.action_genre, R.string.genres, R.drawable.ic_guitar_white_24dp),
|
||||
QUEUE(R.id.action_playing_queue, R.string.queue, R.drawable.ic_queue_music_white_24dp);
|
||||
|
||||
public final int icon;
|
||||
|
||||
public final int id;
|
||||
|
||||
public final int stringRes;
|
||||
|
||||
Category(int id, int stringRes, int icon) {
|
||||
this.stringRes = stringRes;
|
||||
this.id = id;
|
||||
this.icon = icon;
|
||||
}
|
||||
}
|
||||
|
||||
public static final Creator<CategoryInfo> CREATOR = new Creator<CategoryInfo>() {
|
||||
public CategoryInfo createFromParcel(Parcel source) {
|
||||
return new CategoryInfo(source);
|
||||
|
@ -30,15 +52,17 @@ public class CategoryInfo implements Parcelable {
|
|||
return new CategoryInfo[size];
|
||||
}
|
||||
};
|
||||
|
||||
public Category category;
|
||||
|
||||
public boolean visible;
|
||||
|
||||
|
||||
public CategoryInfo(Category category, boolean visible) {
|
||||
this.category = category;
|
||||
this.visible = visible;
|
||||
}
|
||||
|
||||
|
||||
private CategoryInfo(Parcel source) {
|
||||
category = (Category) source.readSerializable();
|
||||
visible = source.readInt() == 1;
|
||||
|
@ -53,24 +77,4 @@ public class CategoryInfo implements Parcelable {
|
|||
dest.writeSerializable(category);
|
||||
dest.writeInt(visible ? 1 : 0);
|
||||
}
|
||||
|
||||
public enum Category {
|
||||
HOME(R.id.action_home, R.string.home, R.drawable.toggle_home),
|
||||
SONGS(R.id.action_song, R.string.songs, R.drawable.toggle_audiotrack),
|
||||
ALBUMS(R.id.action_album, R.string.albums, R.drawable.toggle_album),
|
||||
ARTISTS(R.id.action_artist, R.string.artists, R.drawable.toggle_artist),
|
||||
PLAYLISTS(R.id.action_playlist, R.string.playlists, R.drawable.toggle_playlist),
|
||||
GENRES(R.id.action_genre, R.string.genres, R.drawable.toggle_guitar),
|
||||
QUEUE(R.id.action_playing_queue, R.string.queue, R.drawable.toggle_queue_music);
|
||||
|
||||
public final int stringRes;
|
||||
public final int id;
|
||||
public final int icon;
|
||||
|
||||
Category(int id, int stringRes, int icon) {
|
||||
this.stringRes = stringRes;
|
||||
this.id = id;
|
||||
this.icon = icon;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue