Compare commits
12 Commits
master
...
chiyanzhen
Author | SHA1 | Date |
---|---|---|
|
e5a791765b | 2 years ago |
|
e32124e9b3 | 2 years ago |
|
b81662a42a | 2 years ago |
|
479f2e9648 | 2 years ago |
|
d99f8f6612 | 2 years ago |
|
db545bbb14 | 2 years ago |
|
30b6dbde0c | 2 years ago |
|
0f44c4ccb5 | 2 years ago |
|
8890fa72e6 | 2 years ago |
|
114c0b690e | 2 years ago |
|
8af5a913f5 | 2 years ago |
|
c129749983 | 2 years ago |
@ -1,17 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetDropDown">
|
||||
<targetSelectedWithDropDown>
|
||||
<runningDeviceTargetSelectedWithDropDown>
|
||||
<Target>
|
||||
<type value="QUICK_BOOT_TARGET" />
|
||||
<type value="RUNNING_DEVICE_TARGET" />
|
||||
<deviceKey>
|
||||
<Key>
|
||||
<type value="VIRTUAL_DEVICE_PATH" />
|
||||
<value value="C:\Users\zqy04\.android\avd\Pixel_XL_API_31.avd" />
|
||||
<type value="SERIAL_NUMBER" />
|
||||
<value value="W3VBB21918206146" />
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</targetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2023-03-28T17:08:46.341846900Z" />
|
||||
</runningDeviceTargetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2023-06-28T03:24:01.996639400Z" />
|
||||
</component>
|
||||
</project>
|
@ -1,14 +0,0 @@
|
||||
package com.example.sixaunyi;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
public class ControlActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_control);
|
||||
}
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package com.example.sixaunyi;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class LoginActivity extends AppCompatActivity {
|
||||
|
||||
private EditText mUsername;
|
||||
private EditText mPassword;
|
||||
private Button mLoginButton;
|
||||
private CheckBox Account_remember;
|
||||
private SharedPreferences sharedPreferences;
|
||||
private Map<String, String> mUsers = new HashMap<>();
|
||||
{
|
||||
mUsers.put("admin", "123456");
|
||||
mUsers.put("tiequan", "8731");
|
||||
mUsers.put("zhenghaoyuan", "6666");
|
||||
}
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_login);
|
||||
// 获取输入框和按钮的实例
|
||||
mUsername = findViewById(R.id.username);
|
||||
mPassword = findViewById(R.id.password);
|
||||
mLoginButton = findViewById(R.id.login);
|
||||
Account_remember = findViewById(R.id.remember_check);
|
||||
sharedPreferences = getSharedPreferences("account", Context.MODE_PRIVATE);
|
||||
String username = sharedPreferences.getString("username", "");
|
||||
String password =sharedPreferences.getString("password", "");
|
||||
boolean isChecked = sharedPreferences.getBoolean("checkbox_state", false);
|
||||
mUsername.setText(username);
|
||||
mPassword.setText(password);
|
||||
Account_remember.setChecked(isChecked);
|
||||
// 设置登录按钮的点击事件
|
||||
mLoginButton.setOnClickListener(v -> {
|
||||
attemptLogin();
|
||||
});
|
||||
}
|
||||
private void attemptLogin() {
|
||||
String username = mUsername.getText().toString();
|
||||
String password = mPassword.getText().toString();
|
||||
boolean if_correct = verifyUser(username,password);
|
||||
if (if_correct) {
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putString("username", username);
|
||||
editor.putBoolean("checkbox_state", Account_remember.isChecked());
|
||||
editor.apply();
|
||||
if (Account_remember.isChecked()){
|
||||
editor.putString("password", password);
|
||||
}else{
|
||||
editor.putString("password", "");
|
||||
}
|
||||
editor.apply();
|
||||
Toast.makeText(this, "登录成功", Toast.LENGTH_SHORT).show();
|
||||
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
} else {
|
||||
Toast.makeText(this, "用户名或密码错误", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
private boolean verifyUser(String username, String password){
|
||||
if (mUsers.containsKey(username) && mUsers.get(username).equals(password)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,194 @@
|
||||
package com.example.sixaunyi;
|
||||
|
||||
import static androidx.constraintlayout.motion.utils.Oscillator.TAG;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.SeekBar;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.DatagramPacket;
|
||||
import java.net.DatagramSocket;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
public class SettingActivity extends AppCompatActivity {
|
||||
|
||||
private final static String SEND_to_IP = "192.168.39.47";
|
||||
private SeekBar Speed_btn;
|
||||
private SeekBar Battery_btn;
|
||||
private ImageButton return_btn;
|
||||
private final static int SEND_PORT = 8888;
|
||||
private ExecutorService mThreadPool = Executors.newCachedThreadPool();
|
||||
private Switch photo_btn;
|
||||
private Context context;
|
||||
private SharedPreferences sharedPreferences;
|
||||
private TextView tvProgress;
|
||||
private TextView Battery_warning;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_setting);
|
||||
Speed_btn= findViewById(R.id.speed);
|
||||
return_btn=findViewById(R.id.returns);
|
||||
photo_btn = findViewById(R.id.photo);
|
||||
Battery_btn = findViewById(R.id.warning_num);
|
||||
tvProgress = findViewById(R.id.tvProgress);
|
||||
Battery_warning=findViewById(R.id.Battery_warning);
|
||||
sharedPreferences = getSharedPreferences("control_state", MODE_PRIVATE);
|
||||
boolean photo_btn_state= sharedPreferences.getBoolean("photo_btn_state", false);
|
||||
photo_btn.setChecked(photo_btn_state);
|
||||
// 恢复SeekBar状态
|
||||
int speedProgress = sharedPreferences.getInt("speed_progress", 0);
|
||||
Speed_btn.setProgress(speedProgress);
|
||||
tvProgress.setText(String.valueOf(speedProgress+10));
|
||||
int warning_num= sharedPreferences.getInt("battery_num", 0);
|
||||
Battery_btn.setProgress(warning_num);
|
||||
Battery_warning.setText(String.valueOf(warning_num));
|
||||
photo_btn.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
// 保存Switch状态
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putBoolean("photo_btn_state", isChecked);
|
||||
editor.apply();
|
||||
}
|
||||
});
|
||||
Speed_btn.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
tvProgress.setText(String.valueOf(progress+10));
|
||||
int speed=progress+10;
|
||||
String s = "SPEED " + Integer.toString(speed);
|
||||
try {
|
||||
sendCommand(s);
|
||||
} catch (UnknownHostException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putInt("speed_progress", progress);
|
||||
editor.apply();
|
||||
}
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {}
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {}
|
||||
|
||||
});
|
||||
Battery_btn.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
Battery_warning.setText(String.valueOf(progress));
|
||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||
editor.putInt("battery_num", progress);
|
||||
editor.apply();
|
||||
}
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {}
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {}
|
||||
|
||||
});
|
||||
return_btn.setOnClickListener(new View.OnClickListener(){
|
||||
public void onClick(View v) {
|
||||
// 启动目标 Activity
|
||||
passingParameters();
|
||||
}
|
||||
});
|
||||
photo_btn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (photo_btn.isChecked()) {
|
||||
try {
|
||||
sendCommand("PHOTO_HIGH");
|
||||
} catch (UnknownHostException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}else
|
||||
{
|
||||
try {
|
||||
sendCommand("PHOTO_LOW");
|
||||
} catch (UnknownHostException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
/*
|
||||
* UDP数据发送线程
|
||||
* */
|
||||
class SendRunnable implements Runnable {
|
||||
byte[] mData;
|
||||
InetAddress mAddress;
|
||||
int mPort;
|
||||
public SendRunnable(byte[] data, InetAddress address, int port) {
|
||||
mData = data;
|
||||
mAddress = address;
|
||||
mPort = port;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
// 创建发送数据报文
|
||||
DatagramPacket packet = new DatagramPacket(mData, mData.length, mAddress, mPort);
|
||||
// 创建 DatagramSocket 对象并发送数据报文
|
||||
DatagramSocket socket = new DatagramSocket();
|
||||
socket.send(packet);
|
||||
|
||||
// 关闭 DatagramSocket 对象
|
||||
socket.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*封装函数*/
|
||||
private void sendCommand(String str) throws UnknownHostException {
|
||||
byte[] sendData = str.getBytes();
|
||||
InetAddress address = InetAddress.getByName(SEND_to_IP);
|
||||
SendRunnable sendRunnable1 = new SendRunnable(sendData, address, SEND_PORT);
|
||||
mThreadPool.execute(sendRunnable1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
// 在这里处理返回事件的逻辑
|
||||
super.onBackPressed(); // 调用父类的方法,执行默认的返回操作
|
||||
passingParameters();
|
||||
}
|
||||
|
||||
private void passingParameters(){
|
||||
int warning_num= sharedPreferences.getInt("battery_num", 0);
|
||||
Log.i(TAG, "111111111111111111111"+String.valueOf(warning_num));
|
||||
Intent intent = new Intent(SettingActivity.this,VideoActivity.class);
|
||||
intent.putExtra("BATTERY_NUM", warning_num); // 设置要传递的参数
|
||||
setResult(RESULT_OK, intent);
|
||||
finish();
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 6.1 KiB |
After Width: | Height: | Size: 6.1 KiB |
After Width: | Height: | Size: 6.0 KiB |
After Width: | Height: | Size: 6.0 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 992 B |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 600 KiB |
After Width: | Height: | Size: 1.3 KiB |
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/auto" android:state_checked="false" /> <!-- 当未选中时的背景 -->
|
||||
<item android:drawable="@drawable/manual" android:state_checked="true" /> <!-- 当选中时的背景 -->
|
||||
</selector>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/zidongkongzhi" android:state_checked="false" /> <!-- 当未选中时的图标 -->
|
||||
<item android:drawable="@drawable/shoudong" android:state_checked="true" /> <!-- 当选中时的图标 -->
|
||||
</selector>
|
After Width: | Height: | Size: 1.6 KiB |
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- 设置透明背景色 -->
|
||||
<solid android:color="#80000000" />
|
||||
|
||||
<!-- 设置一个黑色边框 -->
|
||||
<stroke
|
||||
android:width="2px"
|
||||
android:color="#000000" />
|
||||
<!-- 设置四个圆角的半径 -->
|
||||
<corners
|
||||
android:bottomLeftRadius="10px"
|
||||
android:bottomRightRadius="10px"
|
||||
android:topLeftRadius="10px"
|
||||
android:topRightRadius="10px" />
|
||||
<!-- 设置一下边距,让空间大一点 -->
|
||||
<padding
|
||||
android:bottom="5dp"
|
||||
android:left="5dp"
|
||||
android:right="5dp"
|
||||
android:top="5dp" />
|
||||
|
||||
</shape>
|
@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/bg"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:background="@drawable/android"
|
||||
android:layout_marginTop="200dp"
|
||||
android:layout_gravity="center"/>
|
||||
<EditText
|
||||
android:id="@+id/username"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="账号:"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginLeft="30dp"
|
||||
android:layout_marginRight="30dp"/>
|
||||
<EditText
|
||||
android:id="@+id/password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="密码:"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginLeft="30dp"
|
||||
android:layout_marginRight="30dp"/>
|
||||
<CheckBox
|
||||
android:id="@+id/remember_check"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:text="记住密码"
|
||||
android:layout_marginLeft="280dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<Button
|
||||
android:id="@+id/login"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="57dp"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:text="登录" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,106 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#80000000" />
|
||||
|
||||
<!-- 这里是其他控件 -->
|
||||
<LinearLayout
|
||||
android:layout_width="414dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="right"
|
||||
android:background="#80FFFFFF"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
<ImageButton
|
||||
android:id="@+id/returns"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="70dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="#00000000"
|
||||
android:scaleType="centerInside"
|
||||
app:srcCompat="@drawable/returns" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/txt_radiuborder">
|
||||
|
||||
<TextView
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="50dp"
|
||||
android:text="电量预警"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="28dp" />
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/warning_num"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="50dp"
|
||||
android:max="100"
|
||||
android:progress="0"
|
||||
android:thumbTint='@color/teal_200' />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/Battery_warning"
|
||||
android:layout_width="77dp"
|
||||
android:layout_height="30dp"
|
||||
android:text="0"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="18dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Switch
|
||||
android:id="@+id/photo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="图像高画质"
|
||||
android:textSize="28dp"
|
||||
android:textColor="@color/white"
|
||||
android:background="@drawable/txt_radiuborder"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/txt_radiuborder">
|
||||
|
||||
<TextView
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="50dp"
|
||||
android:text="飞行速度"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="28dp" />
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/speed"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="50dp"
|
||||
android:max="90"
|
||||
android:progress="0"
|
||||
android:thumbTint='@color/teal_200' />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvProgress"
|
||||
android:layout_width="77dp"
|
||||
android:layout_height="30dp"
|
||||
android:text="10"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="18dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
@ -0,0 +1,40 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dialogTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:padding="16dp"
|
||||
android:text="当前状态"
|
||||
android:textColor="#000000"
|
||||
android:textSize="28sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/battery"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="当前电量:"
|
||||
android:padding="16dp"
|
||||
android:textSize="18dp"
|
||||
android:textColor="#000000" />
|
||||
<TextView
|
||||
android:id="@+id/speed"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="18dp"
|
||||
android:text="当前速度:"
|
||||
android:padding="16dp"
|
||||
android:textColor="#000000" />
|
||||
<TextView
|
||||
android:id="@+id/distance"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="当前距离:"
|
||||
android:textSize="18dp"
|
||||
android:padding="16dp"
|
||||
android:textColor="#000000" />
|
||||
</LinearLayout>
|
@ -0,0 +1,21 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical">
|
||||
|
||||
<view
|
||||
android:id="@+id/slide_unlock_view"
|
||||
class="com.example.sixaunyi.VideoActivity$SlideUnlockView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:backgroundColor="#03A9F4"
|
||||
app:lockText="Slide to unlock"
|
||||
app:sliderColor="@color/purple_200"
|
||||
app:textColor="@color/purple_500"
|
||||
app:textSize="50sp"
|
||||
app:unlockText="Unlocked!" />
|
||||
|
||||
<!-- 其他控件 -->
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<declare-styleable name="SlideUnlockView">
|
||||
<attr name="textSize" format="dimension" />
|
||||
<attr name="textColor" format="color" />
|
||||
<attr name="sliderColor" format="color" />
|
||||
<attr name="backgroundColor" format="color" />
|
||||
<attr name="unlockText" format="string" />
|
||||
<attr name="lockText" format="string" />
|
||||
</declare-styleable>
|
||||
</resources>
|
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="MyDialogStyle" parent="Theme.AppCompat.Light.Dialog">
|
||||
<item name="android:background">@android:color/transparent</item>
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<item name="android:windowIsFloating">true</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:windowAnimationStyle">@style/MyDialogAnimation</item>
|
||||
</style>
|
||||
|
||||
<style name="MyDialogAnimation" parent="@android:style/Animation">
|
||||
<item name="android:windowEnterAnimation">@android:anim/fade_in</item>
|
||||
<item name="android:windowExitAnimation">@android:anim/fade_out</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light">
|
||||
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
</resources>
|
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="TransparentTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<item name="android:windowBackground">#00000000</item>
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:colorBackgroundCacheHint">@null</item>
|
||||
<item name="android:windowAnimationStyle">@android:style/Animation</item>
|
||||
</style>
|
||||
</resources>
|