2019-09-17 19:36:13 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2019 Hemanth Savarala.
|
|
|
|
*
|
|
|
|
* Licensed under the GNU General Public License v3
|
|
|
|
*
|
|
|
|
* This is free software: you can redistribute it and/or modify it under
|
|
|
|
* the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
* See the GNU General Public License for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package code.name.monkey.retromusic.adapter.base;
|
|
|
|
|
2020-01-17 17:19:06 +00:00
|
|
|
import android.graphics.Color;
|
2019-09-17 19:36:13 +00:00
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.widget.ImageButton;
|
|
|
|
import android.widget.ImageView;
|
|
|
|
import android.widget.TextView;
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
|
|
import code.name.monkey.retromusic.R;
|
2020-01-02 03:53:43 +00:00
|
|
|
import com.google.android.material.card.MaterialCardView;
|
|
|
|
import com.h6ah4i.android.widget.advrecyclerview.utils.AbstractDraggableSwipeableItemViewHolder;
|
2019-09-17 19:36:13 +00:00
|
|
|
|
2020-01-02 03:53:43 +00:00
|
|
|
public class MediaEntryViewHolder extends AbstractDraggableSwipeableItemViewHolder
|
|
|
|
implements View.OnLongClickListener, View.OnClickListener {
|
2019-09-17 19:36:13 +00:00
|
|
|
|
|
|
|
@Nullable
|
2020-01-02 03:53:43 +00:00
|
|
|
public View dragView;
|
2019-09-17 19:36:13 +00:00
|
|
|
|
|
|
|
@Nullable
|
2020-01-02 03:53:43 +00:00
|
|
|
public View dummyContainer;
|
2019-09-17 19:36:13 +00:00
|
|
|
|
|
|
|
@Nullable
|
2020-01-02 03:53:43 +00:00
|
|
|
public ImageView image;
|
2019-09-17 19:36:13 +00:00
|
|
|
|
|
|
|
@Nullable
|
|
|
|
public ViewGroup imageContainer;
|
|
|
|
|
|
|
|
@Nullable
|
|
|
|
public MaterialCardView imageContainerCard;
|
|
|
|
|
|
|
|
@Nullable
|
2020-01-02 03:53:43 +00:00
|
|
|
public TextView imageText;
|
2019-09-17 19:36:13 +00:00
|
|
|
|
|
|
|
@Nullable
|
2020-01-02 03:53:43 +00:00
|
|
|
public MaterialCardView imageTextContainer;
|
2019-09-17 19:36:13 +00:00
|
|
|
|
|
|
|
@Nullable
|
2020-01-02 03:53:43 +00:00
|
|
|
public View mask;
|
2019-09-17 19:36:13 +00:00
|
|
|
|
|
|
|
@Nullable
|
2020-01-02 03:53:43 +00:00
|
|
|
public View menu;
|
|
|
|
|
|
|
|
@Nullable
|
|
|
|
public View paletteColorContainer;
|
2019-09-17 19:36:13 +00:00
|
|
|
|
|
|
|
@Nullable
|
|
|
|
public ImageButton playSongs;
|
|
|
|
|
|
|
|
@Nullable
|
2020-01-02 03:53:43 +00:00
|
|
|
public RecyclerView recyclerView;
|
2019-09-17 19:36:13 +00:00
|
|
|
|
|
|
|
@Nullable
|
2020-01-02 03:53:43 +00:00
|
|
|
public TextView text;
|
2019-09-17 19:36:13 +00:00
|
|
|
|
|
|
|
@Nullable
|
2020-01-02 03:53:43 +00:00
|
|
|
public TextView time;
|
|
|
|
|
2019-12-08 16:38:51 +00:00
|
|
|
@Nullable
|
2020-01-02 03:53:43 +00:00
|
|
|
public TextView title;
|
2019-09-17 19:36:13 +00:00
|
|
|
|
|
|
|
public MediaEntryViewHolder(@NonNull View itemView) {
|
|
|
|
super(itemView);
|
|
|
|
title = itemView.findViewById(R.id.title);
|
|
|
|
text = itemView.findViewById(R.id.text);
|
|
|
|
|
|
|
|
image = itemView.findViewById(R.id.image);
|
|
|
|
time = itemView.findViewById(R.id.time);
|
|
|
|
|
2019-11-08 17:07:30 +00:00
|
|
|
imageText = itemView.findViewById(R.id.imageText);
|
|
|
|
imageContainer = itemView.findViewById(R.id.imageContainer);
|
|
|
|
imageTextContainer = itemView.findViewById(R.id.imageTextContainer);
|
|
|
|
imageContainerCard = itemView.findViewById(R.id.imageContainerCard);
|
2019-09-17 19:36:13 +00:00
|
|
|
|
|
|
|
menu = itemView.findViewById(R.id.menu);
|
|
|
|
dragView = itemView.findViewById(R.id.drag_view);
|
2019-11-08 17:07:30 +00:00
|
|
|
paletteColorContainer = itemView.findViewById(R.id.paletteColorContainer);
|
2019-09-17 19:36:13 +00:00
|
|
|
recyclerView = itemView.findViewById(R.id.recycler_view);
|
|
|
|
mask = itemView.findViewById(R.id.mask);
|
|
|
|
playSongs = itemView.findViewById(R.id.playSongs);
|
2019-12-08 16:38:51 +00:00
|
|
|
dummyContainer = itemView.findViewById(R.id.dummy_view);
|
2019-09-17 19:36:13 +00:00
|
|
|
|
|
|
|
if (imageContainerCard != null) {
|
2020-01-17 17:19:06 +00:00
|
|
|
imageContainerCard.setCardBackgroundColor(Color.TRANSPARENT);
|
2019-09-17 19:36:13 +00:00
|
|
|
}
|
|
|
|
itemView.setOnClickListener(this);
|
|
|
|
itemView.setOnLongClickListener(this);
|
|
|
|
}
|
|
|
|
|
2019-12-08 16:38:51 +00:00
|
|
|
@Override
|
|
|
|
public View getSwipeableContainerView() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2019-09-17 19:36:13 +00:00
|
|
|
@Override
|
2020-01-02 03:53:43 +00:00
|
|
|
public void onClick(View v) {
|
|
|
|
|
2019-09-17 19:36:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2020-01-02 03:53:43 +00:00
|
|
|
public boolean onLongClick(View v) {
|
|
|
|
return false;
|
2019-09-17 19:36:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void setImageTransitionName(@NonNull String transitionName) {
|
2020-01-02 03:53:43 +00:00
|
|
|
if (imageContainerCard != null) {
|
|
|
|
imageContainerCard.setTransitionName(transitionName);
|
|
|
|
}
|
2019-11-08 17:07:30 +00:00
|
|
|
if (image != null) {
|
2019-09-17 19:36:13 +00:00
|
|
|
image.setTransitionName(transitionName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|