|
|
|
@ -100,6 +100,16 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
|
|
|
|
|
"story_fbid", "fbid", "id", "comment_id"
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
private ImageButton ibMore;
|
|
|
|
|
private TextView tvMore;
|
|
|
|
|
private Button btnOwner;
|
|
|
|
|
private ContentLoadingProgressBar pbWait;
|
|
|
|
|
private TextView tvOwnerRemark;
|
|
|
|
|
private TextView tvHost;
|
|
|
|
|
private TextView tvOwner;
|
|
|
|
|
private Group grpOwner;
|
|
|
|
|
private Button btnSettings;
|
|
|
|
|
|
|
|
|
|
@NonNull
|
|
|
|
|
@Override
|
|
|
|
|
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
|
|
|
@ -147,15 +157,21 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
|
|
|
|
|
final ImageButton ibCopy = dview.findViewById(R.id.ibCopy);
|
|
|
|
|
final CheckBox cbSecure = dview.findViewById(R.id.cbSecure);
|
|
|
|
|
final CheckBox cbSanitize = dview.findViewById(R.id.cbSanitize);
|
|
|
|
|
final Button btnOwner = dview.findViewById(R.id.btnOwner);
|
|
|
|
|
final TextView tvOwnerRemark = dview.findViewById(R.id.tvOwnerRemark);
|
|
|
|
|
final ContentLoadingProgressBar pbWait = dview.findViewById(R.id.pbWait);
|
|
|
|
|
final TextView tvHost = dview.findViewById(R.id.tvHost);
|
|
|
|
|
final TextView tvOwner = dview.findViewById(R.id.tvOwner);
|
|
|
|
|
final CheckBox cbNotAgain = dview.findViewById(R.id.cbNotAgain);
|
|
|
|
|
final Button btnMore = dview.findViewById(R.id.btnMore);
|
|
|
|
|
|
|
|
|
|
ibMore = dview.findViewById(R.id.ibMore);
|
|
|
|
|
tvMore = dview.findViewById(R.id.tvMore);
|
|
|
|
|
btnOwner = dview.findViewById(R.id.btnOwner);
|
|
|
|
|
pbWait = dview.findViewById(R.id.pbWait);
|
|
|
|
|
tvOwnerRemark = dview.findViewById(R.id.tvOwnerRemark);
|
|
|
|
|
tvHost = dview.findViewById(R.id.tvHost);
|
|
|
|
|
tvOwner = dview.findViewById(R.id.tvOwner);
|
|
|
|
|
grpOwner = dview.findViewById(R.id.grpOwner);
|
|
|
|
|
btnSettings = dview.findViewById(R.id.btnSettings);
|
|
|
|
|
|
|
|
|
|
final Group grpDifferent = dview.findViewById(R.id.grpDifferent);
|
|
|
|
|
final Group grpOwner = dview.findViewById(R.id.grpOwner);
|
|
|
|
|
|
|
|
|
|
// Wire
|
|
|
|
|
|
|
|
|
|
ibInfo.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
@ -272,24 +288,15 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
btnMore.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
View.OnClickListener onMore = new View.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(View v) {
|
|
|
|
|
Intent privacy = new Intent(v.getContext(), ActivitySetup.class)
|
|
|
|
|
.setAction("privacy")
|
|
|
|
|
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
|
|
|
|
.putExtra("tab", "privacy");
|
|
|
|
|
v.getContext().startActivity(privacy);
|
|
|
|
|
setMore(btnOwner.getVisibility() == View.GONE);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
tvOwnerRemark.setMovementMethod(LinkMovementMethod.getInstance());
|
|
|
|
|
cbNotAgain.setText(context.getString(R.string.title_no_ask_for_again, uri.getHost()));
|
|
|
|
|
cbNotAgain.setVisibility(
|
|
|
|
|
"https".equals(uri.getScheme()) && !TextUtils.isEmpty(uri.getHost())
|
|
|
|
|
? View.VISIBLE : View.GONE);
|
|
|
|
|
pbWait.setVisibility(View.GONE);
|
|
|
|
|
grpOwner.setVisibility(View.GONE);
|
|
|
|
|
ibMore.setOnClickListener(onMore);
|
|
|
|
|
tvMore.setOnClickListener(onMore);
|
|
|
|
|
|
|
|
|
|
btnOwner.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
@ -300,6 +307,8 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
|
|
|
|
|
new SimpleTask<Pair<InetAddress, IPInfo.Organization>>() {
|
|
|
|
|
@Override
|
|
|
|
|
protected void onPreExecute(Bundle args) {
|
|
|
|
|
ibMore.setEnabled(false);
|
|
|
|
|
tvMore.setEnabled(false);
|
|
|
|
|
btnOwner.setEnabled(false);
|
|
|
|
|
pbWait.setVisibility(View.VISIBLE);
|
|
|
|
|
grpOwner.setVisibility(View.GONE);
|
|
|
|
@ -307,6 +316,8 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onPostExecute(Bundle args) {
|
|
|
|
|
ibMore.setEnabled(true);
|
|
|
|
|
tvMore.setEnabled(true);
|
|
|
|
|
btnOwner.setEnabled(true);
|
|
|
|
|
pbWait.setVisibility(View.GONE);
|
|
|
|
|
grpOwner.setVisibility(View.VISIBLE);
|
|
|
|
@ -339,6 +350,21 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
tvOwnerRemark.setMovementMethod(LinkMovementMethod.getInstance());
|
|
|
|
|
|
|
|
|
|
btnSettings.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(View v) {
|
|
|
|
|
Intent privacy = new Intent(v.getContext(), ActivitySetup.class)
|
|
|
|
|
.setAction("privacy")
|
|
|
|
|
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
|
|
|
|
.putExtra("tab", "privacy");
|
|
|
|
|
v.getContext().startActivity(privacy);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Initialize
|
|
|
|
|
|
|
|
|
|
tvTitle.setText(title);
|
|
|
|
|
tvTitle.setVisibility(TextUtils.isEmpty(title) ? View.GONE : View.VISIBLE);
|
|
|
|
|
|
|
|
|
@ -374,8 +400,17 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
|
|
|
|
|
categories = DisconnectBlacklist.getCategories(uri.getHost());
|
|
|
|
|
if (categories != null)
|
|
|
|
|
tvDisconnectCategories.setText(TextUtils.join(", ", categories));
|
|
|
|
|
tvDisconnect.setVisibility(categories == null ? View.GONE : View.VISIBLE);
|
|
|
|
|
tvDisconnectCategories.setVisibility(categories == null ? View.GONE : View.VISIBLE);
|
|
|
|
|
tvDisconnect.setVisibility(
|
|
|
|
|
categories == null ? View.GONE : View.VISIBLE);
|
|
|
|
|
tvDisconnectCategories.setVisibility(
|
|
|
|
|
categories == null || !BuildConfig.DEBUG ? View.GONE : View.VISIBLE);
|
|
|
|
|
|
|
|
|
|
cbNotAgain.setText(context.getString(R.string.title_no_ask_for_again, uri.getHost()));
|
|
|
|
|
cbNotAgain.setVisibility(
|
|
|
|
|
"https".equals(uri.getScheme()) && !TextUtils.isEmpty(uri.getHost())
|
|
|
|
|
? View.VISIBLE : View.GONE);
|
|
|
|
|
|
|
|
|
|
setMore(false);
|
|
|
|
|
|
|
|
|
|
return new AlertDialog.Builder(context)
|
|
|
|
|
.setView(dview)
|
|
|
|
@ -405,6 +440,15 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
|
|
|
|
|
.create();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void setMore(boolean show) {
|
|
|
|
|
ibMore.setImageLevel(show ? 0 : 1);
|
|
|
|
|
btnOwner.setVisibility(show ? View.VISIBLE : View.GONE);
|
|
|
|
|
pbWait.setVisibility(View.GONE);
|
|
|
|
|
tvOwnerRemark.setVisibility(show ? View.VISIBLE : View.GONE);
|
|
|
|
|
grpOwner.setVisibility(View.GONE);
|
|
|
|
|
btnSettings.setVisibility(show ? View.VISIBLE : View.GONE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static Uri sanitize(Uri uri) {
|
|
|
|
|
boolean changed = false;
|
|
|
|
|
|
|
|
|
|