<commit_before>package me.kirimin.mitsumine.ui.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import me.kirimin.mitsumine.R;
import me.kirimin.mitsumine.model.MyBookmark;

public class MyBookmarksAdapter extends ArrayAdapter<MyBookmark> implements View.OnClickListener, View.OnLongClickListener {

    public interface OnMyBookmarkClickListener {
        public void onMyBookmarkClick(View v, MyBookmark myBookmark);

        public void onMyBookmarkLongClick(View v, MyBookmark myBookmark);
    }

    private final OnMyBookmarkClickListener listener;

    public MyBookmarksAdapter(Context context, OnMyBookmarkClickListener listener) {
        super(context, 0);
        this.listener = listener;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if (convertView == null) {
            convertView = LayoutInflater.from(getContext()).inflate(R.layout.row_my_bookmarks, null);
            holder = new ViewHolder();
            holder.cardView = convertView.findViewById(R.id.card_view);
            holder.title = (TextView) convertView.findViewById(R.id.MyBookmarksTitleTextView);
            holder.userCount = (TextView) convertView.findViewById(R.id.MyBookmarksUsersTextView);
            holder.url = (TextView) convertView.findViewById(R.id.MyBookmarksUrlTextView);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
        MyBookmark bookmark = getItem(position);
        holder.cardView.setTag(bookmark);
        holder.cardView.setOnClickListener(this);
        holder.cardView.setOnLongClickListener(this);
        holder.title.setText(bookmark.getTitle());
        holder.userCount.setText(bookmark.getBookmarkCount() + "users");
        holder.url.setText(bookmark.getLinkUrl());
        return convertView;
    }

    @Override
    public void onClick(View v) {
        listener.onMyBookmarkClick(v, (MyBookmark) v.getTag());
    }

    @Override
    public boolean onLongClick(View v) {
        listener.onMyBookmarkLongClick(v, (MyBookmark) v.getTag());
        return false;<commit_msg>文字列リソース化<commit_after>package me.kirimin.mitsumine.ui.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import me.kirimin.mitsumine.R;
import me.kirimin.mitsumine.model.MyBookmark;

public class MyBookmarksAdapter extends ArrayAdapter<MyBookmark> implements View.OnClickListener, View.OnLongClickListener {

    public interface OnMyBookmarkClickListener {
        public void onMyBookmarkClick(View v, MyBookmark myBookmark);

        public void onMyBookmarkLongClick(View v, MyBookmark myBookmark);
    }

    private final OnMyBookmarkClickListener listener;

    public MyBookmarksAdapter(Context context, OnMyBookmarkClickListener listener) {
        super(context, 0);
        this.listener = listener;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if (convertView == null) {
            convertView = LayoutInflater.from(getContext()).inflate(R.layout.row_my_bookmarks, null);
            holder = new ViewHolder();
            holder.cardView = convertView.findViewById(R.id.card_view);
            holder.title = (TextView) convertView.findViewById(R.id.MyBookmarksTitleTextView);
            holder.userCount = (TextView) convertView.findViewById(R.id.MyBookmarksUsersTextView);
            holder.url = (TextView) convertView.findViewById(R.id.MyBookmarksUrlTextView);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
        MyBookmark bookmark = getItem(position);
        holder.cardView.setTag(bookmark);
        holder.cardView.setOnClickListener(this);
        holder.cardView.setOnLongClickListener(this);
        holder.title.setText(bookmark.getTitle());
        holder.userCount.setText(bookmark.getBookmarkCount() + getContext().getString(R.string.users_lower_case));
        holder.url.setText(bookmark.getLinkUrl());
        return convertView;
    }

    @Override
    public void onClick(View v) {
        listener.onMyBookmarkClick(v, (MyBookmark) v.getTag());
    }

    @Override
    public boolean onLongClick(View v) {
        listener.onMyBookmarkLongClick(v, (MyBookmark) v.getTag());
        return false;
{'fraction_non_alphanumeric': 0.09655320059944338, 'fraction_numerical': 0.00042817383857846286, 'mean_word_length': 3.4665391969407264, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5529349', 'n_tokens_mistral': 1326, 'n_tokens_neox': 1291, 'n_words': 239}