删除原本人脸识别的内容
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.READ_LOGS" tools:ignore="ProtectedPermissions"/>
|
||||
<uses-permission android:name="android.permission.READ_LOGS"/>
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
@@ -17,7 +17,7 @@
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||
<uses-permission android:name="android.permission.INSTALL_PACKAGES" tools:ignore="ProtectedPermissions"/>
|
||||
<uses-permission android:name="android.permission.INSTALL_PACKAGES"/>
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
|
||||
|
||||
|
||||
@@ -9,16 +9,13 @@ import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.SurfaceView;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.tencent.bugly.crashreport.CrashReport;
|
||||
import com.ydd.sportfaceid.config.SDAppConfig;
|
||||
import com.ydd.sportfaceid.event.QRCodeEvent;
|
||||
import com.ydd.sportfaceid.main.SDBaseActivity;
|
||||
import com.ydd.sportfaceid.service.ClientService;
|
||||
@@ -26,20 +23,14 @@ import com.ydd.sportfaceid.setting.SDSettingActivity;
|
||||
import com.ydd.sportfaceid.utils.EggClickUtil;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
import org.videolan.libvlc.IVLCVout;
|
||||
import org.videolan.libvlc.LibVLC;
|
||||
import org.videolan.libvlc.Media;
|
||||
import org.videolan.libvlc.MediaPlayer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.OnClick;
|
||||
import de.hdodenhof.circleimageview.CircleImageView;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
public class MainActivity extends SDBaseActivity implements IVLCVout.OnNewVideoLayoutListener {
|
||||
public class MainActivity extends SDBaseActivity {
|
||||
|
||||
private final String TAG = "MainActivity";
|
||||
|
||||
@@ -75,7 +66,7 @@ public class MainActivity extends SDBaseActivity implements IVLCVout.OnNewVideoL
|
||||
TextView user_amount_label;
|
||||
|
||||
@BindView(R.id.faceid_video_view)
|
||||
SurfaceView faceid_video_view;
|
||||
WebView faceid_video_view;
|
||||
|
||||
@BindView(R.id.sb_string_label)
|
||||
TextView sb_string_label;
|
||||
@@ -139,8 +130,6 @@ public class MainActivity extends SDBaseActivity implements IVLCVout.OnNewVideoL
|
||||
|
||||
|
||||
private final Handler mHandler = new Handler();
|
||||
private LibVLC mLibVLC = null;
|
||||
private MediaPlayer mMediaPlayer = null;
|
||||
private int mVideoHeight = 0;
|
||||
private int mVideoWidth = 0;
|
||||
private int mVideoVisibleHeight = 0;
|
||||
@@ -161,19 +150,10 @@ public class MainActivity extends SDBaseActivity implements IVLCVout.OnNewVideoL
|
||||
initScreen();
|
||||
//注册消息bus
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
//初始化视频播放
|
||||
final ArrayList<String> args = new ArrayList<>();
|
||||
// args.add("--aout=opensles");
|
||||
// args.add("--audio-time-stretch");
|
||||
args.add("-vvv");
|
||||
mLibVLC = new LibVLC(this, args);
|
||||
mMediaPlayer = new MediaPlayer(mLibVLC);
|
||||
|
||||
//初始化设置视图
|
||||
configView();
|
||||
|
||||
// 应该是原来的保持屏幕常亮的代码
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||
|
||||
//启动Service
|
||||
Intent socketService = new Intent(this, ClientService.class);
|
||||
startService(socketService);
|
||||
@@ -182,57 +162,8 @@ public class MainActivity extends SDBaseActivity implements IVLCVout.OnNewVideoL
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
StartApplication.executor.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
startPlay();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void startPlay() {
|
||||
final IVLCVout vlcVout = mMediaPlayer.getVLCVout();
|
||||
vlcVout.setVideoView(faceid_video_view);
|
||||
vlcVout.attachViews(this);
|
||||
|
||||
String media_url = SDAppConfig.getInstance().getCurrentCameraUrl();
|
||||
Media media = new Media(mLibVLC, Uri.parse(media_url));
|
||||
|
||||
mMediaPlayer.setEventListener(new MediaPlayer.EventListener() {
|
||||
@Override
|
||||
public void onEvent(MediaPlayer.Event event) {
|
||||
// Log.d("MediaPlayer", "onEvent: " + String.valueOf(event.type));
|
||||
if (event.type == MediaPlayer.Event.EndReached) {
|
||||
// Log.d("MediaPlayer", "onEvent: MediaPlayer.Event.EndReached");
|
||||
mMediaPlayer.setMedia(media);
|
||||
mMediaPlayer.play();
|
||||
}
|
||||
}
|
||||
});
|
||||
mMediaPlayer.setMedia(media);
|
||||
media.release();
|
||||
mMediaPlayer.play();
|
||||
|
||||
if (mOnLayoutChangeListener == null) {
|
||||
mOnLayoutChangeListener = new View.OnLayoutChangeListener() {
|
||||
private final Runnable mRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
updateVideoSurfaces();
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onLayoutChange(View v, int left, int top, int right,
|
||||
int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
|
||||
if (left != oldLeft || top != oldTop || right != oldRight || bottom != oldBottom) {
|
||||
mHandler.removeCallbacks(mRunnable);
|
||||
mHandler.post(mRunnable);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
faceid_video_view.loadUrl("https://www.baidu.com");
|
||||
faceid_video_view.onResume();
|
||||
}
|
||||
|
||||
private void initScreen() {
|
||||
@@ -241,7 +172,6 @@ public class MainActivity extends SDBaseActivity implements IVLCVout.OnNewVideoL
|
||||
manager.getDefaultDisplay().getMetrics(outMetrics);
|
||||
int mScreenW = outMetrics.widthPixels;
|
||||
int mScreenH = outMetrics.heightPixels;
|
||||
|
||||
Log.d("sander", mScreenW + "==== " + mScreenH);
|
||||
}
|
||||
|
||||
@@ -271,17 +201,10 @@ public class MainActivity extends SDBaseActivity implements IVLCVout.OnNewVideoL
|
||||
}
|
||||
|
||||
public void configView() {
|
||||
// String avator = "http://img5.duitang.com/uploads/item/201409/26/20140926190238_sdZHL.thumb.700_0.jpeg";
|
||||
// Glide.with(this).load(avator).into(this.avator_imageview); // 暂时没有网络
|
||||
this.setCurrentStatus(welcome_show);
|
||||
|
||||
|
||||
eggClickUtil = new EggClickUtil(new EggClickUtil.onEggClickListener() {
|
||||
@Override
|
||||
public void onClickAction() {
|
||||
Intent intent = new Intent(MainActivity.this, SDSettingActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
eggClickUtil = new EggClickUtil(() -> {
|
||||
Intent intent = new Intent(MainActivity.this, SDSettingActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -337,10 +260,6 @@ public class MainActivity extends SDBaseActivity implements IVLCVout.OnNewVideoL
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
|
||||
mMediaPlayer.stop();
|
||||
|
||||
mMediaPlayer.getVLCVout().detachViews();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -351,118 +270,6 @@ public class MainActivity extends SDBaseActivity implements IVLCVout.OnNewVideoL
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新视频窗口
|
||||
*/
|
||||
private void updateVideoSurfaces() {
|
||||
int sw = getWindow().getDecorView().getWidth();
|
||||
int sh = getWindow().getDecorView().getHeight();
|
||||
|
||||
// sanity check
|
||||
if (sw * sh == 0) {
|
||||
Log.e(TAG, "Invalid surface size");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Log.d("sander", "size : " + sw + " : " + sh);
|
||||
|
||||
// 目前不清楚这里布局的条件,这个慢慢调出来的
|
||||
mMediaPlayer.getVLCVout().setWindowSize(1400, 800);
|
||||
|
||||
ViewGroup.LayoutParams lp = faceid_video_view.getLayoutParams();
|
||||
if (true) {
|
||||
/* Case of OpenGL vouts: handles the placement of the video using MediaPlayer API */
|
||||
lp.width = sw;
|
||||
lp.height = sh;
|
||||
faceid_video_view.setLayoutParams(lp);
|
||||
mMediaPlayer.setAspectRatio(null);
|
||||
mMediaPlayer.setScale(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (lp.width == lp.height && lp.width == ViewGroup.LayoutParams.MATCH_PARENT) {
|
||||
/* We handle the placement of the video using Android View LayoutParams */
|
||||
mMediaPlayer.setAspectRatio(null);
|
||||
mMediaPlayer.setScale(0);
|
||||
}
|
||||
|
||||
double dw = sw, dh = sh;
|
||||
final boolean isPortrait = getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;
|
||||
|
||||
if (sw > sh && isPortrait || sw < sh && !isPortrait) {
|
||||
dw = sh;
|
||||
dh = sw;
|
||||
}
|
||||
|
||||
// compute the aspect ratio
|
||||
double ar, vw;
|
||||
if (mVideoSarDen == mVideoSarNum) {
|
||||
/* No indication about the density, assuming 1:1 */
|
||||
vw = mVideoVisibleWidth;
|
||||
ar = (double) mVideoVisibleWidth / (double) mVideoVisibleHeight;
|
||||
} else {
|
||||
/* Use the specified aspect ratio */
|
||||
vw = mVideoVisibleWidth * (double) mVideoSarNum / mVideoSarDen;
|
||||
ar = vw / mVideoVisibleHeight;
|
||||
}
|
||||
|
||||
// compute the display aspect ratio
|
||||
double dar = dw / dh;
|
||||
|
||||
switch (CURRENT_SIZE) {
|
||||
case SURFACE_BEST_FIT:
|
||||
if (dar < ar)
|
||||
dh = dw / ar;
|
||||
else
|
||||
dw = dh * ar;
|
||||
break;
|
||||
case SURFACE_FIT_SCREEN:
|
||||
if (dar >= ar)
|
||||
dh = dw / ar; /* horizontal */
|
||||
else
|
||||
dw = dh * ar; /* vertical */
|
||||
break;
|
||||
case SURFACE_FILL:
|
||||
break;
|
||||
case SURFACE_16_9:
|
||||
ar = 16.0 / 9.0;
|
||||
if (dar < ar)
|
||||
dh = dw / ar;
|
||||
else
|
||||
dw = dh * ar;
|
||||
break;
|
||||
case SURFACE_4_3:
|
||||
ar = 4.0 / 3.0;
|
||||
if (dar < ar)
|
||||
dh = dw / ar;
|
||||
else
|
||||
dw = dh * ar;
|
||||
break;
|
||||
case SURFACE_ORIGINAL:
|
||||
dh = mVideoVisibleHeight;
|
||||
dw = vw;
|
||||
break;
|
||||
}
|
||||
|
||||
// set display size
|
||||
lp.width = (int) Math.ceil(dw * mVideoWidth / mVideoVisibleWidth);
|
||||
lp.height = (int) Math.ceil(dh * mVideoHeight / mVideoVisibleHeight);
|
||||
faceid_video_view.setLayoutParams(lp);
|
||||
faceid_video_view.invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNewVideoLayout(IVLCVout vlcVout, int width, int height, int visibleWidth, int visibleHeight, int sarNum, int sarDen) {
|
||||
mVideoWidth = width;
|
||||
mVideoHeight = height;
|
||||
mVideoVisibleWidth = visibleWidth;
|
||||
mVideoVisibleHeight = visibleHeight;
|
||||
mVideoSarNum = sarNum;
|
||||
mVideoSarDen = sarDen;
|
||||
updateVideoSurfaces();
|
||||
}
|
||||
|
||||
public void firstEnterHome(){
|
||||
if (this.firstCountDownTimer != null){
|
||||
this.firstCountDownTimer.cancel();
|
||||
@@ -483,7 +290,6 @@ public class MainActivity extends SDBaseActivity implements IVLCVout.OnNewVideoL
|
||||
public void onTick(long l) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
firstCountDownTimer.cancel();
|
||||
@@ -496,10 +302,8 @@ public class MainActivity extends SDBaseActivity implements IVLCVout.OnNewVideoL
|
||||
}
|
||||
|
||||
public void startCountDownTime(final int current_status) {
|
||||
|
||||
if (this.countDownTimer != null) {
|
||||
stopCountDownTime();
|
||||
|
||||
}
|
||||
if (this.firstCountDownTimer != null){
|
||||
firstCountDownTimer.cancel();
|
||||
@@ -517,9 +321,7 @@ public class MainActivity extends SDBaseActivity implements IVLCVout.OnNewVideoL
|
||||
}else if (current_status == user_info_fail){
|
||||
topInfoTextView.setText("入场失败");
|
||||
}
|
||||
|
||||
this.setCurrentStatus(current_status);
|
||||
|
||||
this.countDownTimer = new CountDownTimer(maxTime * 1000, 1 * 1000) {
|
||||
@Override
|
||||
public void onTick(long l) {
|
||||
@@ -532,14 +334,12 @@ public class MainActivity extends SDBaseActivity implements IVLCVout.OnNewVideoL
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
setCurrentStatus(welcome_show);
|
||||
stopCountDownTime();
|
||||
}
|
||||
};
|
||||
|
||||
this.countDownTimer.start();
|
||||
}
|
||||
|
||||
@@ -555,7 +355,6 @@ public class MainActivity extends SDBaseActivity implements IVLCVout.OnNewVideoL
|
||||
errorDialog.showDialog();
|
||||
}
|
||||
|
||||
|
||||
@OnClick({R.id.gust_info_view}) void onClick(View view){
|
||||
if (view.getId() == R.id.gust_info_view){
|
||||
eggClickUtil.checkoutHideFunction();
|
||||
|
||||
@@ -8,7 +8,6 @@ import android.graphics.drawable.ColorDrawable;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.text.TextUtils;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Toast;
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
package com.ydd.sportfaceid.setting;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.media.Image;
|
||||
import android.support.annotation.BinderThread;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.ydd.sportfaceid.MainActivity;
|
||||
import com.ydd.sportfaceid.R;
|
||||
import com.ydd.sportfaceid.config.SDAppConfig;
|
||||
import com.ydd.sportfaceid.main.SDBaseActivity;
|
||||
@@ -19,11 +13,11 @@ import butterknife.OnClick;
|
||||
public class SDSettingActivity extends SDBaseActivity {
|
||||
|
||||
|
||||
@BindView(R.id.camer_check_1)
|
||||
ImageView camer_check_1_image_view;
|
||||
// @BindView(R.id.camer_check_1)
|
||||
// ImageView camer_check_1_image_view;
|
||||
|
||||
@BindView(R.id.camer_check_2)
|
||||
ImageView camer_check_2_image_view;
|
||||
// @BindView(R.id.camer_check_2)
|
||||
// ImageView camer_check_2_image_view;
|
||||
|
||||
|
||||
private int selectedCameraIndex;
|
||||
@@ -40,8 +34,8 @@ public class SDSettingActivity extends SDBaseActivity {
|
||||
|
||||
|
||||
private void configView(){
|
||||
this.camer_check_1_image_view.setVisibility(View.GONE);
|
||||
this.camer_check_2_image_view.setVisibility(View.GONE);
|
||||
// this.camer_check_1_image_view.setVisibility(View.GONE);
|
||||
// this.camer_check_2_image_view.setVisibility(View.GONE);
|
||||
}
|
||||
private void configData(){
|
||||
this.setSelectedCameraIndex(SDAppConfig.getInstance().getCurrent_selected_camera());
|
||||
@@ -49,11 +43,11 @@ public class SDSettingActivity extends SDBaseActivity {
|
||||
public void setSelectedCameraIndex(int selectedCameraIndex) {
|
||||
this.selectedCameraIndex = selectedCameraIndex;
|
||||
if (this.selectedCameraIndex == 0 ){
|
||||
this.camer_check_2_image_view.setVisibility(View.GONE);
|
||||
this.camer_check_1_image_view.setVisibility(View.VISIBLE);
|
||||
// this.camer_check_2_image_view.setVisibility(View.GONE);
|
||||
// this.camer_check_1_image_view.setVisibility(View.VISIBLE);
|
||||
}else if (this.selectedCameraIndex == 1){
|
||||
this.camer_check_2_image_view.setVisibility(View.VISIBLE);
|
||||
this.camer_check_1_image_view.setVisibility(View.GONE);
|
||||
// this.camer_check_2_image_view.setVisibility(View.VISIBLE);
|
||||
// this.camer_check_1_image_view.setVisibility(View.GONE);
|
||||
}
|
||||
SDAppConfig.getInstance().setCurrent_selected_camera(selectedCameraIndex);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import java.util.TimerTask;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
import rx.Observable;
|
||||
import rx.Subscriber;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
|
||||
<SurfaceView
|
||||
<WebView
|
||||
android:id="@+id/faceid_video_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
@@ -58,17 +58,10 @@
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/camera_1"
|
||||
android:text="这里整一个下拉框,选场馆"
|
||||
android:textSize="20dp"
|
||||
android:textStyle="bold"
|
||||
android:layout_weight="1"/>
|
||||
<ImageView
|
||||
android:id="@+id/camer_check_1"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:src="@mipmap/ico_check"
|
||||
android:layout_marginRight="20dp"
|
||||
android:visibility="gone"/>
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -89,17 +82,10 @@
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/camera_2"
|
||||
android:text="这里整一个下拉框,只能选出场、进场"
|
||||
android:textSize="20dp"
|
||||
android:textStyle="bold"
|
||||
android:layout_weight="1"/>
|
||||
<ImageView
|
||||
android:id="@+id/camer_check_2"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:src="@mipmap/ico_check"
|
||||
android:layout_marginRight="20dp"
|
||||
android:visibility="gone"/>
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
<resources>
|
||||
<string name="app_name">sport-faceid</string>
|
||||
<string name="top_line_info1">获取人脸信息中。。。</string>
|
||||
<string name="top_line_info1">预订信息如下</string>
|
||||
<string name="well_string1">新用户注册</string>
|
||||
<string name="setting">设置</string>
|
||||
<string name="camera_stting_type_title">当前设备为哪个摄像头服务?</string>
|
||||
<string name="camera_1">摄像头1</string>
|
||||
<string name="camera_2">摄像头2</string>
|
||||
<string name="camera_stting_type_title">请选择场馆,以及门禁类型</string>
|
||||
<string name="stranger_info_string">您好 \n 您尚未注册成为本智能运动场用户 \n请扫描门禁上张贴的场馆二维码进行注册后再试</string>
|
||||
<string name="stranger_info_detail_string">如遇注册用户无法识别请联系场馆管理人员</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user