From b54c164c1bd744cc8463fc55d20ef9f2c2504575 Mon Sep 17 00:00:00 2001 From: xufulong <839789740@qq.com> Date: Wed, 8 Apr 2020 23:33:58 +0800 Subject: [PATCH] tranlate the note of HorizontalAdapter into English tranlate the note of HorizontalAdapter into English --- .../ffmpeg/activity/VideoPreviewActivity.java | 2 +- .../ffmpeg/adapter/HorizontalAdapter.java | 25 +++++++++++-------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/frank/ffmpeg/activity/VideoPreviewActivity.java b/app/src/main/java/com/frank/ffmpeg/activity/VideoPreviewActivity.java index 72fec7b..89da6c0 100644 --- a/app/src/main/java/com/frank/ffmpeg/activity/VideoPreviewActivity.java +++ b/app/src/main/java/com/frank/ffmpeg/activity/VideoPreviewActivity.java @@ -20,7 +20,7 @@ import java.io.IOException; import static com.frank.ffmpeg.handler.FFmpegHandler.MSG_TOAST; /** - * 视频拖动实时预览 + * Preview the thumbnail of video when seeking * Created by frank on 2019/11/16. */ diff --git a/app/src/main/java/com/frank/ffmpeg/adapter/HorizontalAdapter.java b/app/src/main/java/com/frank/ffmpeg/adapter/HorizontalAdapter.java index c0ed3fe..db14bdd 100644 --- a/app/src/main/java/com/frank/ffmpeg/adapter/HorizontalAdapter.java +++ b/app/src/main/java/com/frank/ffmpeg/adapter/HorizontalAdapter.java @@ -1,36 +1,41 @@ package com.frank.ffmpeg.adapter; import android.graphics.Color; + +import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; + import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; + import com.frank.ffmpeg.R; import com.frank.ffmpeg.listener.OnItemClickListener; -import java.util.ArrayList; + import java.util.List; /** - * RecyclerView适配器 + * the horizontal adapter of RecyclerView * Created by frank on 2018/6/6. */ -public class HorizontalAdapter extends RecyclerView.Adapter{ +public class HorizontalAdapter extends RecyclerView.Adapter { - private List itemList = new ArrayList<>(); + private List itemList; private OnItemClickListener onItemClickListener; private int lastClickPosition; - public HorizontalAdapter(List itemList){ + public HorizontalAdapter(List itemList) { this.itemList = itemList; } - public void setOnItemClickListener(OnItemClickListener onItemClickListener){ + public void setOnItemClickListener(OnItemClickListener onItemClickListener) { this.onItemClickListener = onItemClickListener; } + @NonNull @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { return new OkViewHolder(LayoutInflater.from(parent.getContext()). @@ -39,10 +44,10 @@ public class HorizontalAdapter extends RecyclerView.Adapter{ @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { - final OkViewHolder okViewHolder = (OkViewHolder)holder; + final OkViewHolder okViewHolder = (OkViewHolder) holder; okViewHolder.btn_select.setText(itemList.get(position)); okViewHolder.btn_select.setTextColor(Color.DKGRAY); - if(onItemClickListener != null){ + if (onItemClickListener != null) { okViewHolder.btn_select.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -62,12 +67,12 @@ public class HorizontalAdapter extends RecyclerView.Adapter{ return itemList != null ? itemList.size() : 0; } - private class OkViewHolder extends RecyclerView.ViewHolder{ + private class OkViewHolder extends RecyclerView.ViewHolder { Button btn_select; OkViewHolder(View itemView) { super(itemView); - btn_select = (Button)itemView.findViewById(R.id.btn_select); + btn_select = itemView.findViewById(R.id.btn_select); } }