Compare commits

...

12 Commits

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

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

@ -45,9 +45,9 @@ public class RockerView extends View{
bubblePaint.setAntiAlias(true); bubblePaint.setAntiAlias(true);
bubblePaint.setColor(grayColor); bubblePaint.setColor(grayColor);
rectfPaint.setAntiAlias(true); // rectfPaint.setAntiAlias(true);
rectfPaint.setColor(Color.parseColor("red")); // rectfPaint.setColor(Color.parseColor("red"));
rectfPaint.setAlpha(144); // rectfPaint.setAlpha(144);
} }
@Override @Override
protected void onDraw(Canvas canvas) { protected void onDraw(Canvas canvas) {
@ -82,24 +82,24 @@ public class RockerView extends View{
case "LEFT": case "LEFT":
// TODO Auto-generated method stub // TODO Auto-generated method stub
try { 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(); socketWriter.flush();
} catch (Exception e) { } catch (Exception e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
canvas.drawArc(mRectF, 135, 90, true, rectfPaint); canvas.drawArc(mRectF, -45, 90, true, rectfPaint);
break; break;
case "RIGHT": case "RIGHT":
// TODO Auto-generated method stub // TODO Auto-generated method stub
try { 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(); socketWriter.flush();
} catch (Exception e) { } catch (Exception e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
canvas.drawArc(mRectF, -45, 90, true, rectfPaint); canvas.drawArc(mRectF, 135, 90, true, rectfPaint);
break; break;
case "STOP": case "STOP":
// TODO Auto-generated method stub // TODO Auto-generated method stub

@ -2,9 +2,12 @@ package wificar;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.Button;
import my.wificar.R; import my.wificar.R;
@ -16,5 +19,8 @@ public class SettingsActivity extends AppCompatActivity {
this.requestWindowFeature(Window.FEATURE_NO_TITLE);//隐去标题应用的名字必须要写在setContentView之前否则会有异常 this.requestWindowFeature(Window.FEATURE_NO_TITLE);//隐去标题应用的名字必须要写在setContentView之前否则会有异常
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_settings); 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"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="wrap_content" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
> >
<TextView
android:id="@+id/textViewIP"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="视频地址" />
<EditText <EditText
android:id="@+id/editIP" android:id="@+id/editIP"
android:layout_width="fill_parent" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="50dp"
android:text="http://192.168.1.1:8080/?action=stream" /> 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 <EditText
android:id="@+id/ip" android:id="@+id/ip"
android:layout_width="fill_parent" app:layout_constraintWidth_percent="0.6"
android:layout_height="wrap_content" android:layout_width="0dp"
android:text="192.168.1.1" /> 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 <EditText
android:id="@+id/port" 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: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: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:layout_height="wrap_content"
android:text="启动" /> android:text="启动" />
</LinearLayout>
<Button <LinearLayout
android:id="@+id/button_set" android:id="@+id/button_set"
android:layout_width="fill_parent" android:layout_width="wrap_content"
android:layout_height="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" />
</LinearLayout> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="设置" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

@ -1,112 +1,98 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent">
> <!-- <wificar.RockerView-->
<!-- <wificar.RockerView--> <!-- android:layout_width="100dp"-->
<!-- android:layout_width="100dp"--> <!-- android:layout_height="100dp"-->
<!-- android:layout_height="100dp"--> <!-- android:layout_marginStart="200dp"-->
<!-- android:layout_marginStart="200dp"--> <!-- android:layout_marginTop="200dp"-->
<!-- android:layout_marginTop="200dp"--> <!-- android:layout_marginEnd="200dp"-->
<!-- android:layout_marginEnd="200dp"--> <!-- android:layout_marginBottom="200dp"-->
<!-- android:layout_marginBottom="200dp"--> <!-- android:visibility="visible"-->
<!-- android:visibility="visible"--> <!-- tools:visibility="visible" />-->
<!-- tools:visibility="visible" />-->
<wificar.MySurfaceView <wificar.MySurfaceView
android:id="@+id/mySurfaceViewVideo" android:id="@+id/mySurfaceViewVideo"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
<ImageView <ImageView
android:id="@+id/floatingView" android:id="@+id/floatingView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"/> android:layout_height="match_parent" />
<Button <ImageButton
android:id="@+id/TakePhoto" android:id="@+id/TakePhoto"
android:layout_marginTop="5dp"
android:layout_width="66dp" android:layout_width="66dp"
android:layout_height="55dp" android:layout_height="55dp"
android:text="拍照" /> android:scaleType="centerCrop"
android:layout_marginStart="20dp"
android:src="@drawable/snapshot" />
<Button <ImageButton
android:layout_toRightOf="@+id/TakePhoto"
android:id="@+id/ViewPhoto" android:id="@+id/ViewPhoto"
android:layout_width="66dp" android:layout_width="66dp"
android:layout_height="55dp" android:layout_height="55dp"
android:layout_marginTop="5dp"
android:layout_toRightOf="@+id/TakePhoto"
android:layout_x="90dp" android:layout_x="90dp"
android:text="查看" /> android:layout_marginStart="20dp"
android:scaleType="centerCrop"
<Button android:src="@drawable/look" />
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="后" />
<Button
android:layout_below="@+id/button_forward"
android:id="@+id/button_left"
android:layout_height="wrap_content"
android:layout_width="100dip"
android:text="左"
/>
<Button
android:id="@+id/button_right" <LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toRightOf="@+id/button_backward" android:layout_alignParentStart="true"
android:layout_below="@+id/button_forward" android:layout_alignParentEnd="true"
android:layout_width="100dip" android:gravity="right"
android:text="右" android:layout_marginTop="15dp"
/> android:layout_marginRight="15dp"
>
<Button
android:id="@+id/button_stop" <TextView
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:layout_width="100dip" android:layout_height="25dp"
android:layout_toRightOf="@+id/button_right" android:layout_marginRight="10dp"
android:text="停" /> android:text="关节特征识别 启用"
android:textSize="18dp"
android:textColor="@android:color/white"
android:textStyle="bold"/>
<!-- <ImageView--> <ImageView
<!-- android:layout_width="wrap_content"--> android:layout_width="25dp"
<!-- android:layout_height="wrap_content"--> android:layout_height="25dp"
<!-- android:layout_alignParentStart="true"--> android:scaleType="centerCrop"
<!-- android:layout_alignParentTop="true"--> android:src="@drawable/circle" />
<!-- android:layout_marginStart="40dp"--> </LinearLayout>
<!-- android:layout_marginLeft="40dp"--> <!-- <ImageView-->
<!-- android:layout_marginTop="260dp"--> <!-- android:layout_width="wrap_content"-->
<!-- android:src="@drawable/rocket_circle1" />--> <!-- android:layout_height="wrap_content"-->
<!-- android:layout_alignParentStart="true"-->
<!-- android:layout_alignParentTop="true"-->
<!-- android:layout_marginStart="40dp"-->
<!-- android:layout_marginLeft="40dp"-->
<!-- android:layout_marginTop="260dp"-->
<!-- android:src="@drawable/rocket_circle1" />-->
<!-- <ImageView--> <!-- <ImageView-->
<!-- android:layout_width="wrap_content"--> <!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"--> <!-- android:layout_height="wrap_content"-->
<!-- android:layout_alignParentStart="true"--> <!-- android:layout_alignParentStart="true"-->
<!-- android:layout_alignParentTop="true"--> <!-- android:layout_alignParentTop="true"-->
<!-- android:layout_marginStart="65dp"--> <!-- android:layout_marginStart="65dp"-->
<!-- android:layout_marginLeft="65dp"--> <!-- android:layout_marginLeft="65dp"-->
<!-- android:layout_marginTop="285dp"--> <!-- android:layout_marginTop="285dp"-->
<!-- android:src="@drawable/rocket_circle2" />--> <!-- android:src="@drawable/rocket_circle2" />-->
<!-- <wificar.RockerView--> <!-- <wificar.RockerView-->
<!-- android:id="@+id/rockerView"--> <!-- android:id="@+id/rockerView"-->
<!-- android:layout_width="265dp"--> <!-- android:layout_width="265dp"-->
<!-- android:layout_height="300dp"--> <!-- android:layout_height="300dp"-->
<!-- android:layout_alignParentStart="true"--> <!-- android:layout_alignParentStart="true"-->
<!-- android:layout_alignParentTop="true"--> <!-- android:layout_alignParentTop="true"-->
<!-- android:layout_marginStart="5dp"--> <!-- android:layout_marginStart="5dp"-->
<!-- android:layout_marginTop="167dp" />--> <!-- android:layout_marginTop="167dp" />-->
</RelativeLayout> </RelativeLayout>
Loading…
Cancel
Save