This commit is contained in:
JasonYANG17 2023-05-10 18:12:04 +08:00
parent 148f82b633
commit 5301cd5346
5 changed files with 68 additions and 16 deletions

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -13,8 +13,8 @@
android:theme="@style/Theme.MyApplication"
tools:targetApi="31">
<activity android:name="com.YANG.Chat.SecondActivity"
android:label="YANG Chat by Android V2.1"
android:label="YANG Chat by Android V3.0"
android:windowSoftInputMode="adjustResize"
android:exported="true">
<intent-filter>
<action android:name="A"/>

View File

@ -1,6 +1,11 @@
package com.YANG.Chat;
import android.content.ComponentName;
import android.content.Intent;
import android.net.Uri;
import android.view.View;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
@ -26,7 +31,12 @@ public class SecondActivity extends AppCompatActivity {
}
return false;
}
public static boolean isNumeri2(String str){
if(str.equals("")){
return true;
}
return false;
}
// private long mPressedTime = 0; // 用于记录返回键按下时间
@Override
@ -57,11 +67,16 @@ public class SecondActivity extends AppCompatActivity {
try {
JSONObject jsonObject = new JSONObject(asd);
String ves = jsonObject.getString("text");
if(ves.equals("V2.1")) {
if(ves.equals("V3.0")) {
bt = findViewById(R.id.button);
bt.setTextSize(15);
bt.setText("暂无更新");
}else{
// tv1 = findViewById(R.id.textView3);
// tv1.setTextSize(20);
bt = findViewById(R.id.button);
bt.setTextSize(15);
bt.setText("发现新版本");
know="发现新版本\""+ves+"\"请更新。\n\n";
// Toast.makeText(SecondActivity.this, know, Toast.LENGTH_LONG).show();
}
@ -124,10 +139,12 @@ public class SecondActivity extends AppCompatActivity {
tv1.setText("正在等待服务器验证您的密钥......");
RequestQueue queue2 = Volley.newRequestQueue(this);
String pass2 = tv2.getText().toString();
if(isNumeric(pass2)){
if(isNumeric(pass2)||isNumeri2(pass2)){
tv1 = findViewById(R.id.textView3);
tv1.setTextSize(20);
tv1.setText("请先输入密钥完成身份验证");
et = findViewById(R.id.editTextTextPersonName);
et.setText("");
}else {
@ -148,6 +165,8 @@ public class SecondActivity extends AppCompatActivity {
tv1 = findViewById(R.id.textView3);
tv1.setTextSize(20);
tv1.setText("验证成功,您已成功登录。");
et = findViewById(R.id.editTextTextPersonName);
et.setText("");
} else {
tv1 = findViewById(R.id.textView3);
tv1.setTextSize(20);
@ -192,6 +211,8 @@ public class SecondActivity extends AppCompatActivity {
tv1 = findViewById(R.id.textView3);
tv1.setTextSize(20);
tv1.setText(name);
et = findViewById(R.id.editTextTextPersonName);
et.setText("");
} catch (JSONException e) {
e.printStackTrace();
}
@ -212,6 +233,15 @@ public class SecondActivity extends AppCompatActivity {
queue.add(request);
}
}
private EditText et;
private Button bt;
public void myOnclick2(View view) {
Uri uri = Uri.parse("https://www.baidu.com");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
}

View File

@ -19,7 +19,7 @@
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="1dp" android:layout_marginEnd="1dp" app:layout_constraintHorizontal_bias="0.0"/>
<TextView
android:text="V2.1"
android:text="V3.0"
android:layout_width="0dp"
android:layout_height="wrap_content" android:id="@+id/textView"
android:textStyle="bold"

View File

@ -18,13 +18,29 @@
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintBottom_toBottomOf="parent">
<TextView
android:text="YANG Chat "
<LinearLayout
android:layout_width="match_parent"
android:layout_height="51dp" android:id="@+id/textView4"
android:textColor="@android:color/holo_orange_light" android:textStyle="bold"
android:textAlignment="center" android:textSize="24sp"
/>
android:layout_height="51dp">
<Space
android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_weight="1"/>
<TextView
android:text="YANG Chat "
android:layout_width="208dp"
android:layout_height="match_parent" android:id="@+id/textView4"
android:textColor="@android:color/holo_orange_light" android:textStyle="bold"
android:textAlignment="center" android:textSize="24sp"
/>
<Button
android:text="Button"
android:layout_width="113dp"
android:layout_height="38dp" android:id="@+id/button"
android:onClick="myOnclick2"
android:background="@drawable/shape"/>
<Space
android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_weight="1"/>
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="543dp">
@ -59,17 +75,17 @@
android:layout_width="match_parent"
android:layout_height="81dp">
<FrameLayout
android:layout_width="268dp"
android:layout_width="262dp"
android:layout_height="match_parent">
<View
android:layout_width="match_parent"
android:layout_height="77dp" android:id="@+id/view2"
android:layout_height="match_parent" android:id="@+id/view2"
android:background="@drawable/shape2"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_height="64dp"
android:inputType="textPersonName"
android:text=""
android:ems="10"