Merge pull request #3053 from harshlele/copy-comment-long-press
added ability to copy comments on long press
This commit is contained in:
commit
487952f52e
|
@ -1,9 +1,15 @@
|
||||||
package org.schabi.newpipe.info_list.holder;
|
package org.schabi.newpipe.info_list.holder;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import android.content.ClipData;
|
||||||
|
import android.content.ClipboardManager;
|
||||||
|
import android.content.Context;
|
||||||
import android.text.util.Linkify;
|
import android.text.util.Linkify;
|
||||||
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import org.jsoup.helper.StringUtil;
|
import org.jsoup.helper.StringUtil;
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
|
@ -120,6 +126,21 @@ public class CommentsMiniInfoItemHolder extends InfoItemHolder {
|
||||||
itemBuilder.getOnCommentsSelectedListener().selected(item);
|
itemBuilder.getOnCommentsSelectedListener().selected(item);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
itemView.setOnLongClickListener(new View.OnLongClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onLongClick(View view) {
|
||||||
|
|
||||||
|
ClipboardManager clipboardManager = (ClipboardManager) itemBuilder.getContext()
|
||||||
|
.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||||
|
clipboardManager.setPrimaryClip(ClipData.newPlainText(null,commentText));
|
||||||
|
Toast.makeText(itemBuilder.getContext(), R.string.msg_copied, Toast.LENGTH_SHORT).show();
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ellipsize() {
|
private void ellipsize() {
|
||||||
|
|
Loading…
Reference in New Issue