|
|
|
|
@ -1,6 +1,7 @@ |
|
|
|
|
package com.fongmi.android.tv.ui.dialog; |
|
|
|
|
|
|
|
|
|
import android.app.Activity; |
|
|
|
|
import android.text.TextUtils; |
|
|
|
|
import android.view.LayoutInflater; |
|
|
|
|
import android.view.View; |
|
|
|
|
|
|
|
|
|
@ -21,6 +22,7 @@ public class InfoDialog { |
|
|
|
|
private AlertDialog dialog; |
|
|
|
|
private CharSequence title; |
|
|
|
|
private String header; |
|
|
|
|
private String vid; |
|
|
|
|
private String url; |
|
|
|
|
|
|
|
|
|
public static InfoDialog create(Activity activity) { |
|
|
|
|
@ -44,6 +46,11 @@ public class InfoDialog { |
|
|
|
|
return this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public InfoDialog vid(String vid) { |
|
|
|
|
this.vid = vid; |
|
|
|
|
return this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public InfoDialog url(String url) { |
|
|
|
|
this.url = url; |
|
|
|
|
return this; |
|
|
|
|
@ -65,12 +72,17 @@ public class InfoDialog { |
|
|
|
|
binding.url.setText(url); |
|
|
|
|
binding.title.setText(title); |
|
|
|
|
binding.header.setText(header); |
|
|
|
|
binding.header.setVisibility(header.isEmpty() ? View.GONE : View.VISIBLE); |
|
|
|
|
binding.vid.setText("Vid : ".concat(vid)); |
|
|
|
|
binding.vid.setVisibility(TextUtils.isEmpty(vid) ? View.GONE : View.VISIBLE); |
|
|
|
|
binding.url.setVisibility(TextUtils.isEmpty(url) ? View.GONE : View.VISIBLE); |
|
|
|
|
binding.header.setVisibility(TextUtils.isEmpty(header) ? View.GONE : View.VISIBLE); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void initEvent() { |
|
|
|
|
binding.url.setOnClickListener(this::onShare); |
|
|
|
|
binding.url.setOnLongClickListener(this::onCopy); |
|
|
|
|
binding.vid.setOnLongClickListener(v -> onCopy(vid)); |
|
|
|
|
binding.url.setOnLongClickListener(v -> onCopy(url)); |
|
|
|
|
binding.header.setOnLongClickListener(v -> onCopy(header)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void onShare(View view) { |
|
|
|
|
@ -78,9 +90,9 @@ public class InfoDialog { |
|
|
|
|
dialog.dismiss(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private boolean onCopy(View view) { |
|
|
|
|
private boolean onCopy(String text) { |
|
|
|
|
Notify.show(R.string.copied); |
|
|
|
|
Util.copy(url); |
|
|
|
|
Util.copy(text); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|