Merge remote-tracking branch 'origin/master'

chenghonghao_branch
Marcus 1 year ago
commit de756573ba

@ -18,6 +18,7 @@ import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Toast;
import java.util.Random;
@ -28,8 +29,8 @@ public class MyMainFrm extends Activity {
public static String CameraIp;
EditText CameraIP, ControlIP, Port;
Button Button_go;
Button Button_set;
LinearLayout Button_go;
LinearLayout Button_set;
String videoUrl, controlUrl, port;
/*
* 退
@ -83,7 +84,6 @@ public class MyMainFrm extends Activity {
intent.setClass(MyMainFrm.this, MyVideo.class);
//通过Intent对象启动另外一个Activity
startActivity(intent);
finish();
});
Button_set.setOnClickListener(v -> {
@ -100,7 +100,6 @@ public class MyMainFrm extends Activity {
intent.setClass(MyMainFrm.this, SettingsActivity.class);
//通过Intent对象启动另外一个Activity
startActivity(intent);
finish();
});
}

@ -12,6 +12,7 @@ import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.Toast;
@ -23,6 +24,9 @@ import java.net.InetAddress;
import java.net.Socket;
import java.net.URL;
import java.net.UnknownHostException;
import java.sql.Time;
import java.util.Timer;
import java.util.TimerTask;
import my.wificar.R;
@ -33,9 +37,8 @@ public class MyVideo extends Activity {
URL videoUrl;
MySurfaceView r;
OutputStream socketWriter;
private Button TakePhotos;
private Button ViewPhotos;
private Button BtnForward, BtnBackward, BtnLeft, BtnRight, BtnStop;
private ImageButton TakePhotos;
private ImageButton ViewPhotos;
private Socket socket;
private RockerView rockerView;
private long exitTime = 0;
@ -54,12 +57,6 @@ public class MyVideo extends Activity {
TakePhotos = findViewById(R.id.TakePhoto);
ViewPhotos = findViewById(R.id.ViewPhoto);
BtnForward = findViewById(R.id.button_forward);
BtnBackward = findViewById(R.id.button_backward);
BtnLeft = findViewById(R.id.button_left);
BtnRight = findViewById(R.id.button_right);
BtnStop = findViewById(R.id.button_stop);
Intent intent = getIntent();
//´ÓIntentµ±Öиù¾ÝkeyÈ¡µÃvalue
CameraIp = intent.getStringExtra("CameraIp");
@ -72,57 +69,6 @@ public class MyVideo extends Activity {
rockerView = new RockerView(this,socketWriter,this.getApplicationContext(),null);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(1000,1000);
addContentView(rockerView,params);
BtnForward.setOnClickListener(arg0 -> {
// TODO Auto-generated method stub
try {
socketWriter.write(new byte[]{(byte) 0xff, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0xff});
socketWriter.flush();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
});
BtnBackward.setOnClickListener(arg0 -> {
// TODO Auto-generated method stub
try {
socketWriter.write(new byte[]{(byte) 0xff, (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0xff});
socketWriter.flush();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
});
BtnRight.setOnClickListener(arg0 -> {
// TODO Auto-generated method stub
try {
socketWriter.write(new byte[]{(byte) 0xff, (byte) 0x00, (byte) 0x03, (byte) 0x00, (byte) 0xff});
socketWriter.flush();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
});
BtnLeft.setOnClickListener(arg0 -> {
// TODO Auto-generated method stub
try {
socketWriter.write(new byte[]{(byte) 0xff, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0xff});
socketWriter.flush();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
});
BtnStop.setOnClickListener(arg0 -> {
// TODO Auto-generated method stub
try {
socketWriter.write(new byte[]{(byte) 0xff, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0xff});
socketWriter.flush();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
});
TakePhotos.setOnClickListener(arg0 -> {
// TODO Auto-generated method stub
if (null != Constant.handler) {
@ -140,7 +86,6 @@ public class MyVideo extends Activity {
MyVideo.this.startActivity(intent1);
});
}
public void InitSocket() {

@ -45,9 +45,9 @@ public class RockerView extends View{
bubblePaint.setAntiAlias(true);
bubblePaint.setColor(grayColor);
rectfPaint.setAntiAlias(true);
rectfPaint.setColor(Color.parseColor("red"));
rectfPaint.setAlpha(144);
// rectfPaint.setAntiAlias(true);
// rectfPaint.setColor(Color.parseColor("red"));
// rectfPaint.setAlpha(144);
}
@Override
protected void onDraw(Canvas canvas) {
@ -82,24 +82,24 @@ public class RockerView extends View{
case "LEFT":
// TODO Auto-generated method stub
try {
socketWriter.write(new byte[]{(byte) 0xff, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0xff});
socketWriter.write(new byte[]{(byte) 0xff, (byte) 0x00, (byte) 0x03, (byte) 0x00, (byte) 0xff});
socketWriter.flush();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
canvas.drawArc(mRectF, 135, 90, true, rectfPaint);
canvas.drawArc(mRectF, -45, 90, true, rectfPaint);
break;
case "RIGHT":
// TODO Auto-generated method stub
try {
socketWriter.write(new byte[]{(byte) 0xff, (byte) 0x00, (byte) 0x03, (byte) 0x00, (byte) 0xff});
socketWriter.write(new byte[]{(byte) 0xff, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0xff});
socketWriter.flush();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
canvas.drawArc(mRectF, -45, 90, true, rectfPaint);
canvas.drawArc(mRectF, 135, 90, true, rectfPaint);
break;
case "STOP":
// TODO Auto-generated method stub

@ -2,9 +2,12 @@ package wificar;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import my.wificar.R;
@ -16,5 +19,8 @@ public class SettingsActivity extends AppCompatActivity {
this.requestWindowFeature(Window.FEATURE_NO_TITLE);//隐去标题应用的名字必须要写在setContentView之前否则会有异常
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_settings);
Button back = findViewById(R.id.back);
back.setOnClickListener(view -> finish());
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
>
<corners
android:radius="100dp"
/>
<solid
android:color="#B200FF35"
/>
<size
android:width="100dp"
android:height="100dp"
/>
</shape>

@ -1,45 +1,116 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
<androidx.constraintlayout.widget.ConstraintLayout 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"
>
<TextView
android:id="@+id/textViewIP"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="视频地址" />
<EditText
android:id="@+id/editIP"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="http://192.168.1.1:8080/?action=stream" />
android:layout_width="0dp"
android:layout_height="50dp"
android:text="http://192.168.1.1:8080/?action=stream"
app:layout_constraintBottom_toBottomOf="@+id/textViewIP"
app:layout_constraintStart_toEndOf="@id/textViewIP"
app:layout_constraintTop_toTopOf="@+id/textViewIP"
app:layout_constraintWidth_percent="0.6" />
<TextView
android:id="@+id/textView2"
android:layout_width="0dp"
android:layout_height="50dp"
android:gravity="center"
android:text="控制地址"
app:layout_constraintStart_toStartOf="@+id/textViewIP"
app:layout_constraintTop_toBottomOf="@+id/textViewIP"
app:layout_constraintWidth_percent="0.15" />
<EditText
android:id="@+id/ip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="192.168.1.1" />
app:layout_constraintWidth_percent="0.6"
android:layout_width="0dp"
android:layout_height="50dp"
android:text="192.168.1.1"
app:layout_constraintStart_toEndOf="@+id/textViewIP"
app:layout_constraintTop_toBottomOf="@+id/editIP" />
<TextView
android:layout_width="0dp"
android:layout_height="50dp"
android:gravity="center"
android:text="控制端口"
app:layout_constraintStart_toStartOf="@+id/textViewIP"
app:layout_constraintTop_toBottomOf="@+id/textView2"
app:layout_constraintWidth_percent="0.15" />
<EditText
android:id="@+id/port"
android:layout_width="fill_parent"
android:layout_width="0dp"
android:layout_height="50dp"
android:text="2001"
app:layout_constraintStart_toStartOf="@+id/editIP"
app:layout_constraintTop_toBottomOf="@+id/ip"
app:layout_constraintWidth_percent="0.6" />
<TextView
android:id="@+id/textViewIP"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_marginStart="90dp"
android:layout_marginTop="100dp"
android:gravity="center"
android:text="视频地址"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_percent="0.15" />
<LinearLayout
android:id="@+id/linearLayout"
android:layout_marginBottom="40dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="2001" />
android:layout_gravity="bottom"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent">
<Button
<LinearLayout
android:id="@+id/button_go"
android:layout_width="fill_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="120dp"
android:gravity="center">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginRight="20dp"
android:src="@drawable/start" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="启动" />
</LinearLayout>
<Button
<LinearLayout
android:id="@+id/button_set"
android:layout_width="fill_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="设置" />
android:gravity="center">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginRight="20dp"
android:src="@drawable/settings" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="设置" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

@ -1,9 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
android:layout_height="fill_parent">
<!-- <wificar.RockerView-->
<!-- android:layout_width="100dp"-->
<!-- android:layout_height="100dp"-->
@ -18,69 +16,57 @@
android:id="@+id/mySurfaceViewVideo"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView
android:id="@+id/floatingView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<Button
<ImageButton
android:id="@+id/TakePhoto"
android:layout_marginTop="5dp"
android:layout_width="66dp"
android:layout_height="55dp"
android:text="拍照" />
android:scaleType="centerCrop"
android:layout_marginStart="20dp"
android:src="@drawable/snapshot" />
<Button
android:layout_toRightOf="@+id/TakePhoto"
<ImageButton
android:id="@+id/ViewPhoto"
android:layout_width="66dp"
android:layout_height="55dp"
android:layout_marginTop="5dp"
android:layout_toRightOf="@+id/TakePhoto"
android:layout_x="90dp"
android:text="查看" />
<Button
android:layout_below="@+id/TakePhoto"
android:id="@+id/button_forward"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/button_left"
android:layout_width="100dip"
android:text="前"
/>
<Button
android:id="@+id/button_backward"
android:layout_width="100dip"
android:layout_height="wrap_content"
android:layout_below="@+id/button_forward"
android:layout_centerInParent="true"
android:layout_toRightOf="@+id/button_left"
android:text="后" />
android:layout_marginStart="20dp"
android:scaleType="centerCrop"
android:src="@drawable/look" />
<Button
android:layout_below="@+id/button_forward"
android:id="@+id/button_left"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="100dip"
android:text="左"
/>
<Button
android:id="@+id/button_right"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/button_backward"
android:layout_below="@+id/button_forward"
android:layout_width="100dip"
android:text="右"
/>
<Button
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:gravity="right"
android:layout_marginTop="15dp"
android:layout_marginRight="15dp"
>
android:id="@+id/button_stop"
android:layout_height="wrap_content"
android:layout_width="100dip"
android:layout_toRightOf="@+id/button_right"
android:text="停" />
<TextView
android:layout_width="wrap_content"
android:layout_height="25dp"
android:layout_marginRight="10dp"
android:text="关节特征识别 启用"
android:textSize="18dp"
android:textColor="@android:color/white"
android:textStyle="bold"/>
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:scaleType="centerCrop"
android:src="@drawable/circle" />
</LinearLayout>
<!-- <ImageView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->

Loading…
Cancel
Save