|
|
|
|
@ -2,6 +2,7 @@ package com.fongmi.android.tv.ui.activity; |
|
|
|
|
|
|
|
|
|
import android.app.Activity; |
|
|
|
|
import android.content.Intent; |
|
|
|
|
import android.net.Uri; |
|
|
|
|
import android.text.TextUtils; |
|
|
|
|
import android.view.View; |
|
|
|
|
|
|
|
|
|
@ -21,7 +22,17 @@ public class PushActivity extends BaseActivity { |
|
|
|
|
private ActivityPushBinding mBinding; |
|
|
|
|
|
|
|
|
|
public static void start(Activity activity) { |
|
|
|
|
activity.startActivity(new Intent(activity, PushActivity.class)); |
|
|
|
|
start(activity, 2); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void start(Activity activity, int tab) { |
|
|
|
|
Intent intent = new Intent(new Intent(activity, PushActivity.class)); |
|
|
|
|
intent.putExtra("tab", tab); |
|
|
|
|
activity.startActivity(intent); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private int getTab() { |
|
|
|
|
return getIntent().getIntExtra("tab", 2); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@ -31,9 +42,13 @@ public class PushActivity extends BaseActivity { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected void initView() { |
|
|
|
|
String address = Server.get().getAddress(); |
|
|
|
|
mBinding.code.setImageBitmap(QRCode.getBitmap(address, 250, 1)); |
|
|
|
|
mBinding.info.setText(ResUtil.getString(R.string.push_info, address)); |
|
|
|
|
mBinding.code.setImageBitmap(QRCode.getBitmap(Server.get().getAddress(getTab()), 250, 1)); |
|
|
|
|
mBinding.info.setText(ResUtil.getString(R.string.push_info, Server.get().getAddress())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected void initEvent() { |
|
|
|
|
mBinding.code.setOnClickListener(this::onCode); |
|
|
|
|
mBinding.clip.setOnClickListener(this::onClip); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -41,4 +56,10 @@ public class PushActivity extends BaseActivity { |
|
|
|
|
CharSequence text = Util.getClipText(); |
|
|
|
|
if (!TextUtils.isEmpty(text)) VideoActivity.start(this, Sniffer.getUrl(text.toString()), false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void onCode(View view) { |
|
|
|
|
Intent intent = new Intent(Intent.ACTION_VIEW); |
|
|
|
|
intent.setData(Uri.parse(Server.get().getAddress(getTab()))); |
|
|
|
|
startActivity(intent); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|