test-看看这次修改了什么

This commit is contained in:
liubohahaha
2021-08-20 20:58:20 +08:00
parent e19a8efd11
commit c4b04300e8
6 changed files with 25 additions and 4 deletions
@@ -73,6 +73,7 @@ public class LoginActivity extends MINVpnBaseActivity<LoginActivityPresenter>
private ClearAbleEditText etPassword;
private CircularProgressButton export_identity;
private CircularProgressButton import_identity;
private CircularProgressButton test;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
@@ -90,6 +91,7 @@ public class LoginActivity extends MINVpnBaseActivity<LoginActivityPresenter>
etPassword=findViewById(R.id.etPassword);
export_identity=findViewById(R.id.export_identity);
import_identity=findViewById(R.id.import_identity);
test=findViewById(R.id.test);
initView();
}
@@ -230,6 +232,11 @@ public class LoginActivity extends MINVpnBaseActivity<LoginActivityPresenter>
mPresenter.login(loginRequest);
});
//测试地址转换方案
test.setOnClickListener(v->{
});
// 监听键盘是否弹起
ActivityExtensionsKt.listenKeyboardVisible(this,(isOpen)->{
if(isOpen){
@@ -162,6 +162,7 @@ public class MainActivity extends MINVpnBaseActivity<MainActivityPresenter>
if (!checkPackages(packageNames)) {
return;
}
//判断是否授权vpn连接
Intent intent = VpnService.prepare(this);
if (intent != null) {
System.out.println("用户尚未授权过开启VPN连接,请求用户授权...");
@@ -207,6 +208,7 @@ public class MainActivity extends MINVpnBaseActivity<MainActivityPresenter>
}
@Override
//用户授权vpn连接后
protected void onActivityResult(int requestCode, int resultCode, @androidx.annotation.Nullable @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(resultCode==Activity.RESULT_OK){
@@ -163,7 +163,7 @@ public class MINVpnInnerConnection implements MINVpnConnection{
@RequiresApi(api = Build.VERSION_CODES.Q)
@Override
public void run() {
// 1. 建立一条连接服务器的TCP-LogicFace
// 1. 建立一条连接服务器的TCP-LogicFace
LogicFace face=initTCPLogicFace(this.mServerName,this.mServerPort);
if(face==null){
LoggerHelper.severe("vpn connection run error: tcp logic face init error");
@@ -363,6 +363,7 @@ public class MINVpnInnerConnection implements MINVpnConnection{
* @param face
* @param buf
*/
//构造MIN包
private void sendInterestPkt(LogicFace face, ByteBuffer buf,int bufLen) {
// 1. 构造CPacket
// 构造目的标识:/{service prefix}/{cPacket seq}/{defraudString}
@@ -80,7 +80,7 @@ public class MINVpnService extends VpnService implements Handler.Callback{
}
@RequiresApi(api = Build.VERSION_CODES.O)
@Override
@Override //启动服务时依次执行onCreateonStartCommandonStart
public int onStartCommand(Intent intent, int flags, int startId) {
// 根据intent传递的消息进行vpn的连接或断开操作
if (intent != null && ACTION_DISCONNECT.equals(intent.getAction())) {
@@ -113,7 +113,7 @@ public class MINVpnService extends VpnService implements Handler.Callback{
@RequiresApi(api = Build.VERSION_CODES.O)
private void updateForegroundNotification(final int message) {
// copy的,不知道啥意思
// copy的,不知道啥意思 将该服务改写成前台服务,不被杀死
final String NOTIFICATION_CHANNEL_ID = "MIN-VPN";
NotificationManager mNotificationManager = (NotificationManager) getSystemService(
NOTIFICATION_SERVICE);
@@ -176,4 +176,15 @@
app:layout_constraintTop_toBottomOf="@id/btnLogin"
/>
<br.com.simplepass.loadingbutton.customViews.CircularProgressButton
android:id="@+id/test"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="test"
android:background="@drawable/button_shape_default"
tools:ignore="MissingConstraints"
android:textColor="@color/white"
tools:layout_editor_absoluteX="43dp"
tools:layout_editor_absoluteY="568dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -119,7 +119,7 @@ public class FileSelectorActivity extends AppCompatActivity implements OnItemCli
if (mSelectedList.isEmpty()) {
return;
}
//不为空,向main activity返回数据
//不为空,向login activity返回数据
Intent result = new Intent();
result.putStringArrayListExtra(Const.EXTRA_RESULT_SELECTION, mSelectedList);
setResult(RESULT_OK, result);