forked from CeuiLiSA/Pixiv-Shaft
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
CeuiLiSA
authored and
CeuiLiSA
committed
Mar 19, 2020
1 parent
c5f58c6
commit 349a8ed
Showing
56 changed files
with
762 additions
and
525 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 0 additions & 91 deletions
91
app/src/main/java/ceui/lisa/adapters/DownloadTaskAdapter.java
This file was deleted.
Oops, something went wrong.
81 changes: 81 additions & 0 deletions
81
app/src/main/java/ceui/lisa/adapters/DownloadedAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package ceui.lisa.adapters; | ||
|
||
import android.content.Context; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
|
||
import androidx.databinding.DataBindingUtil; | ||
|
||
import com.bumptech.glide.Glide; | ||
|
||
import java.text.SimpleDateFormat; | ||
import java.util.List; | ||
|
||
import ceui.lisa.R; | ||
import ceui.lisa.activities.Shaft; | ||
import ceui.lisa.database.DownloadEntity; | ||
import ceui.lisa.databinding.RecyViewHistoryBinding; | ||
import ceui.lisa.models.IllustsBean; | ||
import ceui.lisa.utils.GlideUtil; | ||
|
||
public class DownloadedAdapter extends BaseAdapter<DownloadEntity, RecyViewHistoryBinding> { | ||
|
||
private int imageSize = 0; | ||
private SimpleDateFormat mTime = new SimpleDateFormat("MM月dd日 HH: mm"); | ||
|
||
public DownloadedAdapter(List<DownloadEntity> targetList, Context context) { | ||
super(targetList, context); | ||
imageSize = (mContext.getResources().getDisplayMetrics().widthPixels - | ||
mContext.getResources().getDimensionPixelSize(R.dimen.four_dp)) / 2; | ||
} | ||
|
||
@Override | ||
public void initLayout() { | ||
mLayoutID = R.layout.recy_view_history; | ||
} | ||
|
||
@Override | ||
public void bindData(DownloadEntity target, | ||
ViewHolder<RecyViewHistoryBinding> bindView, int position) { | ||
ViewGroup.LayoutParams params = bindView.baseBind.illustImage.getLayoutParams(); | ||
params.height = imageSize; | ||
params.width = imageSize; | ||
bindView.baseBind.illustImage.setLayoutParams(params); | ||
|
||
IllustsBean currentIllust = Shaft.sGson.fromJson(allIllust.get(position).getIllustGson(), IllustsBean.class); | ||
Glide.with(mContext) | ||
.load(allIllust.get(position).getFilePath()) | ||
.placeholder(R.color.light_bg) | ||
.into(bindView.baseBind.illustImage); | ||
bindView.baseBind.title.setText(allIllust.get(position).getFileName()); | ||
bindView.baseBind.author.setText("by: " + currentIllust.getUser().getName()); | ||
bindView.baseBind.time.setText(mTime.format(allIllust.get(position).getDownloadTime())); | ||
|
||
if (currentIllust.getPage_count() == 1) { | ||
bindView.baseBind.pSize.setVisibility(View.GONE); | ||
} else { | ||
bindView.baseBind.pSize.setVisibility(View.VISIBLE); | ||
bindView.baseBind.pSize.setText(currentIllust.getPage_count() + "P"); | ||
} | ||
|
||
//从-400 丝滑滑动到0 | ||
((SpringHolder) bindView).spring.setCurrentValue(-400); | ||
((SpringHolder) bindView).spring.setEndValue(0); | ||
|
||
if (mOnItemClickListener != null) { | ||
bindView.itemView.setOnClickListener(v -> | ||
mOnItemClickListener.onItemClick(v, position, 0)); | ||
bindView.baseBind.author.setOnClickListener(v -> { | ||
bindView.baseBind.author.setTag(currentIllust.getUser().getId()); | ||
mOnItemClickListener.onItemClick(bindView.baseBind.author, position, 1); | ||
}); | ||
} | ||
} | ||
|
||
@Override | ||
public ViewHolder<RecyViewHistoryBinding> getNormalItem(ViewGroup parent) { | ||
return new SpringHolder(DataBindingUtil.inflate( | ||
LayoutInflater.from(mContext), mLayoutID, parent, false).getRoot()); | ||
} | ||
} |
Oops, something went wrong.