UCam Driving recorder v3.2.5版本的 MD5 值为:80b4271bc5ccc520b2146c142992977d
以下内容为反编译后的 ServerActivity.java 源代码,内容仅作参考
package com.sicadroid.carcamera.server;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Typeface;
import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.sicadroid.carcamera.ucamservice.Log;
import com.sicadroid.carcamera.ucamservice.UCamCoreService;
import com.sicadroid.carcamera.ucamservice.UCamDevice;
import com.sicadroid.carcamera.ucamservice.UCamGLView;
import com.sicadroid.carcamera.ucamservice.UCamSuperDog;
import com.sicadroid.carcamera.utils.BitmapUtils;
import com.sicadroid.carcamera.utils.UCamIniUtils;
import com.sicadroid.carcamera.utils.UCamPreference;
import com.sicadroid.carcamera.utils.UCamUtils;
import com.sicadroid.carcamera.utils.UCamWiFiManager;
import com.sicadroid.carcamera.view.IconButton;
import com.sicadroid.carcamera.view.RotateImageView;
import com.sicadroid.ucam_car.R;
import java.io.File;
public class ServerActivity extends Activity implements UCamDevice.UCamDevcieStatusCallback, UCamSuperDog.UCamSuperDogStatusCallback, View.OnClickListener {
private static final int HANDEL_AUTOHIDE_CTRLVIEW = 4;
private static final int HANDEL_AUTO_HIDESTATUS = 3;
private static final int HANDEL_HIDE_LOGO = 9;
private static final int HANDEL_UPDATEVERSION = 8;
private static final int HANDEL_UPDATE_ADADANIM1 = 5;
private static final int HANDEL_UPDATE_ADADANIM2 = 6;
private static final int HANDEL_UPDATE_CONNECTCLIENT = 7;
private static final int HANDEL_UPDATE_DEVICESTATUS = 2;
private static final int HANDEL_UPDATE_GPSSTATUS = 1;
private static final int HANDEL_UPDATE_LOCALSTATUS = 1;
private static final int HANDEL_UPDATE_SUPERDOGSTATUS = 2;
private static final int HANDEL_UPDATE_TEXTTATUS = 3;
private static final String TAG = "Hz-server";
private View mAdas;
private ImageView mAdasAnim;
private ImageView mAdasCdpyLeft;
private ImageView mAdasCdpyRight;
private Animation mAnimationBottom;
private Animation mAnimationLeft;
private Animation mAnimationRight;
private UCamGLView mCamGLView;
private View mDog;
private RotateImageView mDogCompass;
private TextView mDogJuLi;
private TextView mDogSuDu;
private ImageView mDogType;
private TextView mDogXianSu;
private View mDualScreenView;
private UCamPreference mPreference;
private ImageView mStatusAdas;
private ImageView mStatusCollision;
private ImageView mStatusDog;
private ImageView mStatusFloatWindow;
private ImageView mStatusFrontRearCam;
private ImageView mStatusLock;
private ImageView mStatusRec;
private ImageView mStatusRecordaudio;
private ImageView mStatusRecordtime;
private ImageView mStatusSSLY;
private ImageView mStatusShare;
private TextView mStatusText;
private ImageView mStatusWifi;
private IconButton mbtLock;
private IconButton mbtRec;
private IconButton mbtReplay;
private IconButton mbtSettings;
private IconButton mbtTakePic;
private static boolean DEBUG = false;
static int[] chedao_dhlist = {R.drawable.ic_adas_chedao_dh_1, R.drawable.ic_adas_chedao_dh_2, R.drawable.ic_adas_chedao_dh_3, R.drawable.ic_adas_chedao_dh_4};
static int[] chedao_dhlist_duration = {100, 100, 100, 100};
static int[] chedao_py_left = {R.drawable.ic_adas_chedao_py_left, R.drawable.ic_adas_chedao_dh_c_transparent};
static int[] chedao_py_left_duration = {250, 250};
static int[] chedao_py_right = {R.drawable.ic_adas_chedao_py_right, R.drawable.ic_adas_chedao_dh_c_transparent};
static int[] chedao_py_right_duration = {250, 250};
static int[] chedao_pengzhuang = {R.drawable.ic_adas_chedao_dh_c_1, R.drawable.ic_adas_chedao_dh_c_transparent};
static int[] chedao_pengzhuang_duration = {250, 250};
private boolean mbAnimation = false;
private AnimationDrawable mcdDrawable = null;
private AnimationDrawable mpztxDrawable = null;
private AnimationDrawable mcdpyleftDrawable = null;
private AnimationDrawable mcdpyrightDrawable = null;
private int mClientViewStatus = 0;
private UCamCoreService mCoreServices = null;
private AlertDialog mWiFiDialog = null;
private ServiceConnection mSConn = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder bs) {
if (ServerActivity.DEBUG) {
Log.d(ServerActivity.TAG, "ServerActivity onServiceConnected");
}
ServerActivity.this.mCoreServices = ((UCamCoreService.UCamCoreBinder) bs).getService();
if (ServerActivity.this.mCoreServices != null) {
ServerActivity.this.mCoreServices.hideFloatWindow();
ServerActivity.this.mCoreServices.checkUpdateApp();
ServerActivity.this.updateUser();
}
}
@Override
public void onServiceDisconnected(ComponentName name) {
if (ServerActivity.DEBUG) {
Log.d(ServerActivity.TAG, "ServerActivity onServiceDisconnected");
}
if (ServerActivity.this.mCoreServices != null) {
ServerActivity.this.mCoreServices = null;
}
}
};
private int mCheckTimes = 0;
private Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
AnimationDrawable adasanim;
AnimationDrawable adasanim2;
AnimationDrawable adasanim3;
AnimationDrawable adasanim4;
AnimationDrawable adasanim5;
AnimationDrawable adasanim6;
super.handleMessage(msg);
switch (msg.what) {
case 1:
switch (ServerActivity.this.mPreference.getAdasQysdLevel()) {
case 0:
ServerActivity.this.mStatusAdas.setImageResource(R.drawable.ic_adas_show_off);
break;
case 1:
ServerActivity.this.mStatusAdas.setImageResource(R.drawable.ic_adas_show_on);
break;
case 2:
ServerActivity.this.mStatusAdas.setImageResource(R.drawable.ic_adas_show_60);
break;
case 3:
ServerActivity.this.mStatusAdas.setImageResource(R.drawable.ic_adas_show_80);
break;
case ServerActivity.HANDEL_AUTOHIDE_CTRLVIEW:
ServerActivity.this.mStatusAdas.setImageResource(R.drawable.ic_adas_show_100);
break;
}
switch (ServerActivity.this.mPreference.getRecordTimeLevel()) {
case 0:
ServerActivity.this.mStatusRecordtime.setImageResource(R.drawable.ic_record_time_1);
break;
case 1:
ServerActivity.this.mStatusRecordtime.setImageResource(R.drawable.ic_record_time_2);
break;
case 2:
ServerActivity.this.mStatusRecordtime.setImageResource(R.drawable.ic_record_time_3);
break;
case 3:
ServerActivity.this.mStatusRecordtime.setImageResource(R.drawable.ic_record_time_5);
break;
}
switch (ServerActivity.this.mPreference.getSensorLevle()) {
case 0:
ServerActivity.this.mStatusCollision.setImageResource(R.drawable.ic_collision_off);
break;
case 1:
ServerActivity.this.mStatusCollision.setImageResource(R.drawable.ic_collision_low);
break;
case 2:
ServerActivity.this.mStatusCollision.setImageResource(R.drawable.ic_collision_normal);
break;
case 3:
ServerActivity.this.mStatusCollision.setImageResource(R.drawable.ic_collision_high);
break;
}
if (ServerActivity.this.mPreference.getRecordAudioStatus() == 1) {
ServerActivity.this.mStatusRecordaudio.setImageResource(R.drawable.ic_recording_on);
} else {
ServerActivity.this.mStatusRecordaudio.setImageResource(R.drawable.ic_recording_off);
}
if (UCamSuperDog.getSuperDog().isExistSuperDog(ServerActivity.this)) {
switch (ServerActivity.this.mPreference.getDogQysdLevel()) {
case 0:
ServerActivity.this.mStatusDog.setImageResource(R.drawable.ic_dog_off);
ServerActivity.this.mDog.setVisibility(8);
break;
case 1:
ServerActivity.this.mStatusDog.setImageResource(R.drawable.ic_dog_on);
ServerActivity.this.mDog.setVisibility(0);
break;
case 2:
ServerActivity.this.mStatusDog.setImageResource(R.drawable.ic_dog_60);
ServerActivity.this.mDog.setVisibility(0);
break;
case 3:
ServerActivity.this.mStatusDog.setImageResource(R.drawable.ic_dog_80);
ServerActivity.this.mDog.setVisibility(0);
break;
case ServerActivity.HANDEL_AUTOHIDE_CTRLVIEW:
ServerActivity.this.mStatusDog.setImageResource(R.drawable.ic_dog_100);
ServerActivity.this.mDog.setVisibility(0);
break;
}
} else {
ServerActivity.this.mDog.setVisibility(8);
ServerActivity.this.mStatusDog.setImageResource(R.drawable.ic_dog_off);
}
switch (ServerActivity.this.mPreference.getSslyQyzlLevel()) {
case 0:
ServerActivity.this.mStatusSSLY.setImageResource(R.drawable.ic_ssly_off);
return;
case 1:
ServerActivity.this.mStatusSSLY.setImageResource(R.drawable.ic_ssly_on);
return;
case 2:
ServerActivity.this.mStatusSSLY.setImageResource(R.drawable.ic_ssly_on);
return;
default:
return;
}
case 2:
if (UCamDevice.getDevice().isShowAdas()) {
ServerActivity.this.mStatusAdas.setVisibility(0);
ServerActivity.this.mAdas.setVisibility(0);
} else {
ServerActivity.this.mStatusAdas.setVisibility(8);
ServerActivity.this.mAdas.setVisibility(8);
}
if (UCamDevice.getDevice().isGsensor()) {
ServerActivity.this.mStatusCollision.setVisibility(0);
} else {
ServerActivity.this.mStatusCollision.setVisibility(8);
}
if (UCamDevice.getDevice().isTimelapsevideo()) {
ServerActivity.this.mStatusSSLY.setVisibility(0);
ServerActivity.this.mStatusDog.setVisibility(8);
} else {
ServerActivity.this.mStatusSSLY.setVisibility(8);
ServerActivity.this.mStatusDog.setVisibility(0);
}
if (UCamDevice.getDevice().isShowAdas()) {
boolean bshowadas = false;
if (ServerActivity.this.mCoreServices != null && ServerActivity.this.mCoreServices.isOpenLdw() && UCamDevice.getDevice().isStartedUcam() && UCamDevice.getDevice().isShowAdas()) {
bshowadas = true;
}
if (UCamDevice.getDevice().isStartServerClient() && (ServerActivity.this.mClientViewStatus != 0 || ServerActivity.this.mPreference.getDualscreenStatus() == 0)) {
bshowadas = false;
}
if (!UCamDevice.getDevice().isFrontCamera()) {
bshowadas = false;
}
if (bshowadas && ServerActivity.this.mPreference.getAdasGdpy() == 1 && UCamDevice.getDevice().isLdwWarning() && UCamDevice.getDevice().isLdwLeftWarning()) {
ServerActivity.this.mHandler.removeMessages(ServerActivity.HANDEL_UPDATE_ADADANIM2);
Message msgadas = Message.obtain();
msgadas.what = ServerActivity.HANDEL_UPDATE_ADADANIM2;
msgadas.arg1 = 2;
ServerActivity.this.mHandler.sendMessage(msgadas);
} else if (bshowadas && ServerActivity.this.mPreference.getAdasGdpy() == 1 && UCamDevice.getDevice().isLdwWarning() && UCamDevice.getDevice().isLdwRightWarning()) {
ServerActivity.this.mHandler.removeMessages(ServerActivity.HANDEL_UPDATE_ADADANIM2);
Message msgadas2 = Message.obtain();
msgadas2.what = ServerActivity.HANDEL_UPDATE_ADADANIM2;
msgadas2.arg1 = 3;
ServerActivity.this.mHandler.sendMessage(msgadas2);
} else if (!bshowadas || ServerActivity.this.mPreference.getAdasGdpy() != 1 || !UCamDevice.getDevice().isLdwWarning()) {
if (ServerActivity.this.mAdasCdpyLeft.getVisibility() == 0) {
if (ServerActivity.this.mAdasCdpyLeft.getDrawable() instanceof AnimationDrawable) {
AnimationDrawable adasanim7 = (AnimationDrawable) ServerActivity.this.mAdasCdpyLeft.getDrawable();
if (adasanim7.isRunning()) {
adasanim7.stop();
}
ServerActivity.this.mAdasCdpyLeft.setImageDrawable(null);
}
ServerActivity.this.mAdasCdpyLeft.setVisibility(ServerActivity.HANDEL_AUTOHIDE_CTRLVIEW);
}
if (ServerActivity.this.mAdasCdpyRight.getVisibility() == 0) {
if (ServerActivity.this.mAdasCdpyRight.getDrawable() instanceof AnimationDrawable) {
AnimationDrawable adasanim8 = (AnimationDrawable) ServerActivity.this.mAdasCdpyRight.getDrawable();
if (adasanim8.isRunning()) {
adasanim8.stop();
}
ServerActivity.this.mAdasCdpyRight.setImageDrawable(null);
}
ServerActivity.this.mAdasCdpyRight.setVisibility(ServerActivity.HANDEL_AUTOHIDE_CTRLVIEW);
}
} else {
ServerActivity.this.mHandler.removeMessages(ServerActivity.HANDEL_UPDATE_ADADANIM2);
Message msgadas3 = Message.obtain();
msgadas3.what = ServerActivity.HANDEL_UPDATE_ADADANIM2;
msgadas3.arg1 = 1;
ServerActivity.this.mHandler.sendMessage(msgadas3);
}
if (bshowadas && ServerActivity.this.mPreference.getAdasPztx() == 1 && UCamDevice.getDevice().isPZTXWarning()) {
ServerActivity.this.mHandler.removeMessages(ServerActivity.HANDEL_UPDATE_ADADANIM1);
Message msgadas4 = Message.obtain();
msgadas4.what = ServerActivity.HANDEL_UPDATE_ADADANIM1;
msgadas4.arg1 = 2;
ServerActivity.this.mHandler.sendMessage(msgadas4);
} else if (!bshowadas || ServerActivity.this.mPreference.getAdasGdpy() != 1) {
if (ServerActivity.this.mAdasAnim.getVisibility() == 0) {
if (ServerActivity.this.mAdasAnim.getDrawable() instanceof AnimationDrawable) {
AnimationDrawable adasanim9 = (AnimationDrawable) ServerActivity.this.mAdasAnim.getDrawable();
if (adasanim9.isRunning()) {
adasanim9.stop();
}
ServerActivity.this.mAdasAnim.setImageDrawable(null);
}
ServerActivity.this.mAdasAnim.setVisibility(8);
}
} else {
ServerActivity.this.mHandler.removeMessages(ServerActivity.HANDEL_UPDATE_ADADANIM1);
Message msgadas5 = Message.obtain();
msgadas5.what = ServerActivity.HANDEL_UPDATE_ADADANIM1;
msgadas5.arg1 = 1;
ServerActivity.this.mHandler.sendMessage(msgadas5);
}
}
if (UCamDevice.getDevice().isDoubleCamera()) {
ServerActivity.this.mStatusFrontRearCam.setVisibility(0);
if (UCamDevice.getDevice().isFrontCamera()) {
ServerActivity.this.mStatusFrontRearCam.setImageResource(R.drawable.ic_front_cam);
} else {
ServerActivity.this.mStatusFrontRearCam.setImageResource(R.drawable.ic_rear_cam);
}
} else if (ServerActivity.this.mStatusFrontRearCam.getVisibility() != 8) {
ServerActivity.this.mStatusFrontRearCam.setVisibility(8);
}
if (UCamDevice.getDevice().isLockFile()) {
ServerActivity.this.mStatusLock.setVisibility(0);
} else if (ServerActivity.this.mStatusLock.getVisibility() != 8) {
ServerActivity.this.mStatusLock.setVisibility(8);
}
if (UCamDevice.getDevice().isRecord()) {
AnimationDrawable animrec = (AnimationDrawable) ServerActivity.this.mStatusRec.getDrawable();
if (!animrec.isRunning()) {
animrec.start();
break;
}
} else {
AnimationDrawable animrec2 = (AnimationDrawable) ServerActivity.this.mStatusRec.getDrawable();
if (animrec2.isRunning()) {
animrec2.stop();
}
animrec2.selectDrawable(0);
break;
}
break;
case 3:
break;
case ServerActivity.HANDEL_AUTOHIDE_CTRLVIEW:
case 8:
default:
return;
case ServerActivity.HANDEL_UPDATE_ADADANIM1:
long freesize = UCamUtils.getRomAvailableSize(ServerActivity.this);
switch (msg.arg1) {
case 1:
if (ServerActivity.this.mcdDrawable == null) {
ServerActivity.this.mcdDrawable = ServerActivity.this.loadAnimation(ServerActivity.chedao_dhlist, ServerActivity.chedao_dhlist_duration, freesize < 300);
}
if (ServerActivity.this.mcdDrawable != null && (adasanim6 = (AnimationDrawable) ServerActivity.this.mAdasAnim.getDrawable()) != ServerActivity.this.mcdDrawable) {
if (adasanim6 != null && adasanim6.isRunning()) {
adasanim6.stop();
}
ServerActivity.this.mcdDrawable.setOneShot(false);
ServerActivity.this.mAdasAnim.setImageDrawable(ServerActivity.this.mcdDrawable);
ServerActivity.this.mcdDrawable.start();
if (ServerActivity.this.mAdasAnim.getVisibility() != 0) {
ServerActivity.this.mAdasAnim.setVisibility(0);
return;
}
return;
}
return;
case 2:
if (ServerActivity.this.mpztxDrawable == null) {
ServerActivity.this.mpztxDrawable = ServerActivity.this.loadAnimation(ServerActivity.chedao_pengzhuang, ServerActivity.chedao_pengzhuang_duration, freesize < 300);
}
if (ServerActivity.this.mpztxDrawable != null && (adasanim5 = (AnimationDrawable) ServerActivity.this.mAdasAnim.getDrawable()) != ServerActivity.this.mpztxDrawable) {
if (adasanim5 != null && adasanim5.isRunning()) {
adasanim5.stop();
}
ServerActivity.this.mpztxDrawable.setOneShot(false);
ServerActivity.this.mAdasAnim.setImageDrawable(ServerActivity.this.mpztxDrawable);
ServerActivity.this.mpztxDrawable.start();
if (ServerActivity.this.mAdasAnim.getVisibility() != 0) {
ServerActivity.this.mAdasAnim.setVisibility(0);
return;
}
return;
}
return;
default:
return;
}
case ServerActivity.HANDEL_UPDATE_ADADANIM2:
long freesize2 = UCamUtils.getRomAvailableSize(ServerActivity.this);
switch (msg.arg1) {
case 1:
if (ServerActivity.this.mcdpyleftDrawable == null) {
ServerActivity.this.mcdpyleftDrawable = ServerActivity.this.loadAnimation(ServerActivity.chedao_py_left, ServerActivity.chedao_py_left_duration, freesize2 < 300);
}
if (ServerActivity.this.mcdpyleftDrawable != null && (adasanim4 = (AnimationDrawable) ServerActivity.this.mAdasCdpyLeft.getDrawable()) != ServerActivity.this.mcdpyleftDrawable) {
if (adasanim4 != null && adasanim4.isRunning()) {
adasanim4.stop();
}
ServerActivity.this.mcdpyleftDrawable.setOneShot(false);
ServerActivity.this.mAdasCdpyLeft.setImageDrawable(ServerActivity.this.mcdpyleftDrawable);
ServerActivity.this.mcdpyleftDrawable.start();
if (ServerActivity.this.mAdasCdpyLeft.getVisibility() != 0) {
ServerActivity.this.mAdasCdpyLeft.setVisibility(0);
}
}
if (ServerActivity.this.mcdpyrightDrawable == null) {
ServerActivity.this.mcdpyrightDrawable = ServerActivity.this.loadAnimation(ServerActivity.chedao_py_right, ServerActivity.chedao_py_right_duration, freesize2 < 300);
}
if (ServerActivity.this.mcdpyrightDrawable != null && (adasanim3 = (AnimationDrawable) ServerActivity.this.mAdasCdpyRight.getDrawable()) != ServerActivity.this.mcdpyrightDrawable) {
if (adasanim3 != null && adasanim3.isRunning()) {
adasanim3.stop();
}
ServerActivity.this.mcdpyrightDrawable.setOneShot(false);
ServerActivity.this.mAdasCdpyRight.setImageDrawable(ServerActivity.this.mcdpyrightDrawable);
ServerActivity.this.mcdpyrightDrawable.start();
if (ServerActivity.this.mAdasCdpyRight.getVisibility() != 0) {
ServerActivity.this.mAdasCdpyRight.setVisibility(0);
return;
}
return;
}
return;
case 2:
if (ServerActivity.this.mAdasCdpyRight.getVisibility() == 0) {
if (ServerActivity.this.mAdasCdpyRight.getDrawable() instanceof AnimationDrawable) {
AnimationDrawable adasanim10 = (AnimationDrawable) ServerActivity.this.mAdasCdpyRight.getDrawable();
if (adasanim10.isRunning()) {
adasanim10.stop();
}
ServerActivity.this.mAdasCdpyRight.setImageDrawable(null);
}
ServerActivity.this.mAdasCdpyRight.setVisibility(ServerActivity.HANDEL_AUTOHIDE_CTRLVIEW);
}
if (ServerActivity.this.mcdpyleftDrawable == null) {
ServerActivity.this.mcdpyleftDrawable = ServerActivity.this.loadAnimation(ServerActivity.chedao_py_left, ServerActivity.chedao_py_left_duration, freesize2 < 300);
}
if (ServerActivity.this.mcdpyleftDrawable != null && (adasanim2 = (AnimationDrawable) ServerActivity.this.mAdasCdpyLeft.getDrawable()) != ServerActivity.this.mcdpyleftDrawable) {
if (adasanim2 != null && adasanim2.isRunning()) {
adasanim2.stop();
}
ServerActivity.this.mcdpyleftDrawable.setOneShot(false);
ServerActivity.this.mAdasCdpyLeft.setImageDrawable(ServerActivity.this.mcdpyleftDrawable);
ServerActivity.this.mcdpyleftDrawable.start();
if (ServerActivity.this.mAdasCdpyLeft.getVisibility() != 0) {
ServerActivity.this.mAdasCdpyLeft.setVisibility(0);
return;
}
return;
}
return;
case 3:
if (ServerActivity.this.mAdasCdpyLeft.getVisibility() == 0) {
if (ServerActivity.this.mAdasCdpyLeft.getDrawable() instanceof AnimationDrawable) {
AnimationDrawable adasanim11 = (AnimationDrawable) ServerActivity.this.mAdasCdpyLeft.getDrawable();
if (adasanim11.isRunning()) {
adasanim11.stop();
}
ServerActivity.this.mAdasCdpyLeft.setImageDrawable(null);
}
ServerActivity.this.mAdasCdpyLeft.setVisibility(ServerActivity.HANDEL_AUTOHIDE_CTRLVIEW);
}
if (ServerActivity.this.mcdpyrightDrawable == null) {
ServerActivity.this.mcdpyrightDrawable = ServerActivity.this.loadAnimation(ServerActivity.chedao_py_right, ServerActivity.chedao_py_right_duration, freesize2 < 300);
}
if (ServerActivity.this.mcdpyrightDrawable != null && (adasanim = (AnimationDrawable) ServerActivity.this.mAdasCdpyRight.getDrawable()) != ServerActivity.this.mcdpyrightDrawable) {
if (adasanim != null && adasanim.isRunning()) {
adasanim.stop();
}
ServerActivity.this.mcdpyrightDrawable.setOneShot(false);
ServerActivity.this.mAdasCdpyRight.setImageDrawable(ServerActivity.this.mcdpyrightDrawable);
ServerActivity.this.mcdpyrightDrawable.start();
if (ServerActivity.this.mAdasCdpyRight.getVisibility() != 0) {
ServerActivity.this.mAdasCdpyRight.setVisibility(0);
return;
}
return;
}
return;
default:
return;
}
case ServerActivity.HANDEL_UPDATE_CONNECTCLIENT:
if (!UCamDevice.getDevice().isStartServerClient() || ServerActivity.this.mPreference.getDualscreenStatus() != 0) {
ServerActivity.this.mCamGLView.setDrawBlack(false);
ServerActivity.this.mDualScreenView.setVisibility(8);
if (ServerActivity.this.mPreference.getDogQysdLevel() > 0 && UCamSuperDog.getSuperDog().isExistSuperDog(ServerActivity.this)) {
ServerActivity.this.mDog.setVisibility(0);
}
if (UCamDevice.getDevice().isStartServerClient()) {
ServerActivity.this.mStatusWifi.setImageResource(R.drawable.ic_wifi_on);
} else {
ServerActivity.this.mStatusWifi.setImageResource(R.drawable.ic_wifi_off);
}
ServerActivity.this.mHandler.removeMessages(2);
ServerActivity.this.mHandler.sendEmptyMessage(2);
return;
}
if (ServerActivity.this.mAdasAnim.getDrawable() instanceof AnimationDrawable) {
AnimationDrawable adasanim12 = (AnimationDrawable) ServerActivity.this.mAdasAnim.getDrawable();
if (adasanim12.isRunning()) {
adasanim12.stop();
}
ServerActivity.this.mAdasAnim.setImageDrawable(null);
}
ServerActivity.this.mAdasAnim.setVisibility(8);
ServerActivity.this.mDualScreenView.setVisibility(0);
ServerActivity.this.mCamGLView.setDrawBlack(true);
if (ServerActivity.this.mPreference.getDogQysdLevel() > 0 && UCamSuperDog.getSuperDog().isExistSuperDog(ServerActivity.this)) {
ServerActivity.this.mDog.setVisibility(8);
return;
}
return;
case ServerActivity.HANDEL_HIDE_LOGO:
UCamIniUtils devicefile = new UCamIniUtils(UCamUtils.getNetParamFile(ServerActivity.this));
String struname = (String) devicefile.get("sys", "uname", "1");
String strutoken = (String) devicefile.get("sys", "utoken", "1");
String strtime = (String) devicefile.get("sys", "ulgtime", "0");
View logoview = ServerActivity.this.findViewById(R.id.activity_logo);
if ("1".equals(struname) && "1".equals(strutoken) && "0".equals(strtime)) {
logoview.setVisibility(8);
devicefile.set("sys", "ulgtime", new StringBuilder().append(System.currentTimeMillis() / 1000).toString());
devicefile.save();
return;
} else {
if (("1".equals(struname) || "1".equals(strutoken)) && System.currentTimeMillis() / 1000 > Long.valueOf(strtime).longValue() + 1296000000) {
float density = ServerActivity.this.getResources().getDisplayMetrics().density;
ViewGroup.LayoutParams lp = logoview.getLayoutParams();
lp.width = (int) (644.0f * density);
lp.height = (int) (213.0f * density);
logoview.setLayoutParams(lp);
logoview.setBackgroundResource(R.drawable.ic_default_update_tip);
ServerActivity.this.findViewById(R.id.button_abort).setVisibility(8);
logoview.setVisibility(0);
return;
}
logoview.setVisibility(8);
return;
}
}
ServerActivity.this.mCheckTimes++;
if (!UCamDevice.getDevice().isStartedUcam()) {
ServerActivity.this.mStatusText.setText(R.string.status_nodevices);
ServerActivity.this.mStatusText.setVisibility(0);
return;
}
int sdstatus = UCamDevice.getDevice().getSDStatus();
if (ServerActivity.this.mCheckTimes <= 3) {
ServerActivity.this.mStatusText.setText(R.string.status_readydevices);
} else if (sdstatus == 0) {
ServerActivity.this.mStatusText.setText(R.string.status_storage_state_null);
ServerActivity.this.mStatusText.setVisibility(0);
} else if (sdstatus == 2) {
ServerActivity.this.mStatusText.setText(R.string.status_storage_state_full);
ServerActivity.this.mStatusText.setVisibility(0);
} else if (sdstatus == 3) {
ServerActivity.this.mStatusText.setText(R.string.status_storage_state_error);
ServerActivity.this.mStatusText.setVisibility(0);
} else {
ServerActivity.this.mStatusText.setVisibility(8);
}
if (ServerActivity.this.mCheckTimes > ServerActivity.HANDEL_UPDATE_ADADANIM1) {
ServerActivity.this.mCheckTimes = ServerActivity.HANDEL_UPDATE_ADADANIM1;
}
if (UCamDevice.getDevice().isRecord()) {
ServerActivity.this.mStatusText.setVisibility(8);
}
}
};
private Handler mDogHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch (msg.what) {
case 1:
if (ServerActivity.this.mPreference.getDogQysdLevel() > 0) {
int speed = msg.arg1;
int breaing = msg.arg2;
if (ServerActivity.this.mDogCompass != null) {
ServerActivity.this.mDogCompass.setAngle((-breaing) / 10);
}
if (ServerActivity.this.mDogSuDu != null) {
ServerActivity.this.mDogSuDu.setText(new StringBuilder().append(speed / 10).toString());
return;
}
return;
}
return;
case 2:
if ((ServerActivity.this.mCoreServices == null || ServerActivity.this.mCoreServices.isOpenDog()) && ServerActivity.this.mPreference.getDogQysdLevel() >= 1) {
int type = msg.arg1;
if (ServerActivity.this.mPreference.getDogGdcsd() != 1 || type >= 20) {
if (ServerActivity.this.mDogJuLi != null) {
ServerActivity.this.mDogJuLi.setVisibility(ServerActivity.HANDEL_AUTOHIDE_CTRLVIEW);
}
if (ServerActivity.this.mDogXianSu != null) {
ServerActivity.this.mDogXianSu.setVisibility(ServerActivity.HANDEL_AUTOHIDE_CTRLVIEW);
}
} else {
int gap = msg.arg2;
int limit = ((Integer) msg.obj).intValue();
if (ServerActivity.this.mDogJuLi != null) {
ServerActivity.this.mDogJuLi.setText(new StringBuilder().append(gap).toString());
ServerActivity.this.mDogJuLi.setVisibility(0);
}
if (ServerActivity.this.mDogXianSu != null) {
ServerActivity.this.mDogXianSu.setText(new StringBuilder().append(limit).toString());
ServerActivity.this.mDogXianSu.setVisibility(0);
}
}
if (ServerActivity.this.mDogType != null && ((ServerActivity.this.mPreference.getDogGdcsd() == 1 && type < 20) || (ServerActivity.this.mPreference.getDogAqxxd() == 1 && type > 20))) {
String pathName = String.valueOf(UCamUtils.getSuperDogPath(ServerActivity.this)) + File.separator + "ic_dog_type_" + type + ".png";
Bitmap bm = null;
try {
bm = BitmapFactory.decodeFile(pathName);
} catch (Exception e) {
e.printStackTrace();
}
if (bm != null) {
ServerActivity.this.mDogType.setImageBitmap(bm);
} else {
ServerActivity.this.mDogType.setImageBitmap(null);
}
ServerActivity.this.mDogType.setVisibility(0);
}
ServerActivity.this.mDogHandler.removeMessages(3);
ServerActivity.this.mDogHandler.sendEmptyMessageDelayed(3, 5000L);
return;
}
return;
case 3:
if (ServerActivity.this.mDogJuLi != null) {
ServerActivity.this.mDogJuLi.setVisibility(ServerActivity.HANDEL_AUTOHIDE_CTRLVIEW);
}
if (ServerActivity.this.mDogXianSu != null) {
ServerActivity.this.mDogXianSu.setVisibility(ServerActivity.HANDEL_AUTOHIDE_CTRLVIEW);
}
if (ServerActivity.this.mDogType != null) {
ServerActivity.this.mDogType.setVisibility(ServerActivity.HANDEL_AUTOHIDE_CTRLVIEW);
return;
}
return;
default:
return;
}
}
};
final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (UCamCoreService.ACTION_USER.equals(action)) {
boolean bupdateicon = intent.getBooleanExtra("usericon", false);
if (bupdateicon) {
ServerActivity.this.updateUser();
}
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
DisplayMetrics dm = getResources().getDisplayMetrics();
Window window = getWindow();
WindowManager.LayoutParams lp = window.getAttributes();
lp.screenBrightness = 1.0f;
if (dm.heightPixels > dm.widthPixels) {
lp.width = dm.widthPixels;
lp.height = (dm.widthPixels * HANDEL_HIDE_LOGO) / 16;
}
window.setAttributes(lp);
window.setFlags(1024, 1024);
window.setFlags(128, 128);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_server);
this.mPreference = new UCamPreference(this);
UCamDevice.getDevice().addActivity(this);
this.mCamGLView = (UCamGLView) findViewById(R.id.server_glview_server);
View rootview = findViewById(R.id.main_ucam_ctrl_status);
this.mDog = findViewById(R.id.electronic_dog);
this.mDog.setVisibility(8);
this.mAdas = findViewById(R.id.adas);
this.mAdas.setVisibility(8);
this.mAdasAnim = (ImageView) findViewById(R.id.adas_anim);
this.mAdasAnim.setVisibility(8);
this.mAdasCdpyLeft = (ImageView) findViewById(R.id.adas_cdpy_left);
this.mAdasCdpyRight = (ImageView) findViewById(R.id.adas_cdpy_right);
this.mStatusText = (TextView) findViewById(R.id.status_status_text);
this.mStatusFloatWindow = (ImageView) rootview.findViewById(R.id.status_floatwindow);
this.mStatusFloatWindow.setOnClickListener(this);
this.mStatusShare = (ImageView) rootview.findViewById(R.id.status_share);
this.mStatusShare.setOnClickListener(this);
this.mStatusRec = (ImageView) rootview.findViewById(R.id.status_rec);
AnimationDrawable animrec = (AnimationDrawable) this.mStatusRec.getDrawable();
animrec.stop();
this.mStatusLock = (ImageView) rootview.findViewById(R.id.status_lock);
this.mStatusLock.setVisibility(8);
this.mStatusFrontRearCam = (ImageView) rootview.findViewById(R.id.status_front_rear_cam);
this.mStatusFrontRearCam.setOnClickListener(this);
this.mStatusWifi = (ImageView) rootview.findViewById(R.id.status_wifi);
this.mStatusWifi.setOnClickListener(this);
this.mStatusCollision = (ImageView) rootview.findViewById(R.id.status_collision);
this.mStatusCollision.setOnClickListener(this);
this.mStatusDog = (ImageView) rootview.findViewById(R.id.status_dog);
this.mStatusDog.setOnClickListener(this);
this.mStatusSSLY = (ImageView) rootview.findViewById(R.id.status_ssly);
this.mStatusSSLY.setOnClickListener(this);
if (this.mPreference.getWiFiUsedTimes() > HANDEL_AUTOHIDE_CTRLVIEW) {
rootview.findViewById(R.id.status_wifi_new).setVisibility(8);
}
this.mDogCompass = (RotateImageView) this.mDog.findViewById(R.id.dog_bg_compass);
this.mDogType = (ImageView) this.mDog.findViewById(R.id.dog_type);
this.mDogSuDu = (TextView) this.mDog.findViewById(R.id.text_dog_sd);
this.mDogJuLi = (TextView) this.mDog.findViewById(R.id.text_dog_jl);
this.mDogXianSu = (TextView) this.mDog.findViewById(R.id.text_dog_xs);
Typeface tf = Typeface.createFromAsset(getAssets(), "digifaw.ttf");
this.mDogSuDu.setTypeface(tf);
this.mStatusAdas = (ImageView) rootview.findViewById(R.id.status_adas);
this.mStatusAdas.setOnClickListener(this);
this.mStatusAdas.setVisibility(8);
this.mStatusRecordaudio = (ImageView) rootview.findViewById(R.id.status_recordaudio);
this.mStatusRecordaudio.setOnClickListener(this);
this.mStatusRecordtime = (ImageView) rootview.findViewById(R.id.status_record_time);
this.mStatusRecordtime.setOnClickListener(this);
this.mbtTakePic = (IconButton) rootview.findViewById(R.id.ctrl_takepic);
this.mbtTakePic.setOnClickListener(this);
this.mbtRec = (IconButton) rootview.findViewById(R.id.ctrl_rec);
this.mbtRec.setOnClickListener(this);
this.mbtLock = (IconButton) rootview.findViewById(R.id.ctrl_lock);
this.mbtLock.setOnClickListener(this);
this.mbtReplay = (IconButton) rootview.findViewById(R.id.ctrl_replay);
this.mbtReplay.setOnClickListener(this);
this.mbtSettings = (IconButton) rootview.findViewById(R.id.ctrl_settings);
this.mbtSettings.setOnClickListener(this);
this.mDualScreenView = findViewById(R.id.status_dualscreen);
this.mDualScreenView.setOnClickListener(this);
findViewById(R.id.button_abort).setOnClickListener(this);
Intent service = new Intent(getApplicationContext(), (Class<?>) UCamCoreService.class);
bindService(service, this.mSConn, 1);
if (DEBUG) {
Log.d(TAG, "ServerActivity onCreate");
}
this.mHandler.sendEmptyMessageDelayed(HANDEL_HIDE_LOGO, 5000L);
IntentFilter mFilter = new IntentFilter();
mFilter.addAction(UCamCoreService.ACTION_USER);
registerReceiver(this.mReceiver, mFilter);
}
@Override
protected void onDestroy() {
this.mHandler.removeMessages(1);
this.mHandler.removeMessages(2);
this.mHandler.removeMessages(HANDEL_AUTOHIDE_CTRLVIEW);
this.mHandler.removeMessages(HANDEL_UPDATE_ADADANIM1);
this.mHandler.removeMessages(HANDEL_UPDATE_ADADANIM2);
this.mHandler.removeMessages(HANDEL_UPDATE_CONNECTCLIENT);
this.mDogHandler.removeMessages(1);
this.mDogHandler.removeMessages(2);
unregisterReceiver(this.mReceiver);
unbindService(this.mSConn);
this.mCoreServices = null;
super.onDestroy();
UCamDevice.getDevice().removeActivity(this);
if (DEBUG) {
Log.d(TAG, "ServerActivity onDestroy");
}
}
@Override
protected void onPause() {
super.onPause();
if (this.mWiFiDialog != null && this.mWiFiDialog.isShowing()) {
this.mWiFiDialog.dismiss();
}
this.mCamGLView.stopRender();
UCamDevice.getDevice().removeStatusCallback(this);
UCamSuperDog.getSuperDog().removeStatusCallback(this);
this.mHandler.removeMessages(1);
this.mHandler.removeMessages(2);
if (this.mAdasAnim.getDrawable() instanceof AnimationDrawable) {
AnimationDrawable adasanim = (AnimationDrawable) this.mAdasAnim.getDrawable();
if (adasanim.isRunning()) {
adasanim.stop();
}
this.mAdasAnim.setImageDrawable(null);
}
if (this.mcdDrawable != null) {
tryRecycleAnimationDrawable(this.mcdDrawable);
this.mcdDrawable = null;
}
if (this.mpztxDrawable != null) {
tryRecycleAnimationDrawable(this.mpztxDrawable);
this.mpztxDrawable = null;
}
if (DEBUG) {
Log.d(TAG, "ServerActivity onPause");
}
}
@Override
protected void onResume() {
super.onResume();
if (this.mCoreServices != null) {
this.mCoreServices.hideFloatWindow();
}
this.mCamGLView.startRender();
UCamDevice.getDevice().addStatusCallback(this);
UCamSuperDog.getSuperDog().addStatusCallback(this);
this.mHandler.sendEmptyMessage(1);
if (UCamDevice.getDevice().isStartedUcam() && !UCamDevice.getDevice().isRecord() && UCamDevice.getDevice().getSDStatus() == 1) {
UCamDevice.getDevice().sendCmdData(1, 0);
}
this.mHandler.sendEmptyMessage(2);
this.mHandler.sendEmptyMessage(HANDEL_UPDATE_CONNECTCLIENT);
}
private void showWiFiDialog() {
if (this.mWiFiDialog != null && this.mWiFiDialog.isShowing()) {
this.mWiFiDialog.dismiss();
}
if (!UCamDevice.getDevice().isStartedUcam()) {
Toast.makeText(this, R.string.status_nodevices, 0).show();
return;
}
LayoutInflater inflater = LayoutInflater.from(this);
View rootview = inflater.inflate(R.layout.activity_server_wifi_settings, (ViewGroup) null);
TextView tvmode = (TextView) rootview.findViewById(R.id.wifi_settings_mode);
TextView tvmame = (TextView) rootview.findViewById(R.id.wifi_settings_name);
TextView tvip = (TextView) rootview.findViewById(R.id.wifi_settings_serverip);
TextView tvport = (TextView) rootview.findViewById(R.id.wifi_settings_serverport);
TextView tvinfo = (TextView) rootview.findViewById(R.id.wifi_settings_info);
ImageView imqrcode = (ImageView) rootview.findViewById(R.id.wifi_settings_qrcode_wifi);
tvinfo.getPaint().setFlags(8);
tvinfo.setOnClickListener(this);
if (this.mCoreServices.getWiFiMode() == 1) {
tvmode.setText(R.string.settings_wifi_type_wifihotspot);
tvinfo.setText(R.string.wifi_settings_info2);
} else {
tvmode.setText(R.string.settings_wifi_type_wifi);
tvinfo.setText(R.string.wifi_settings_info1);
}
String ssid = this.mCoreServices.getWiFiName();
String ip = this.mCoreServices.getWiFiIP();
int port = this.mCoreServices.getServerPort();
if ((!UCamWiFiManager.isWiFiConnected(this) && this.mCoreServices.getWiFiMode() == 0) || (!UCamWiFiManager.isWifiApEnabled(this) && !UCamWiFiManager.isWifiEnabled(this))) {
Toast.makeText(this, R.string.wifi_settings_notconnect, 0).show();
return;
}
tvmame.setText(" " + ssid);
if (!UCamDevice.getDevice().isStartedServer() || TextUtils.isEmpty(ssid) || TextUtils.isEmpty(ip) || ip.startsWith("0.") || port <= 0) {
UCamDevice.getDevice().startServer();
Toast.makeText(this, R.string.wifi_settings_servernotstart, 0).show();
return;
}
tvip.setText(" " + ip);
tvport.setText(" " + port);
float density = getResources().getDisplayMetrics().density;
String link = "http://qr02.cn/D7rkwJ#" + ssid + "#" + ip + "#" + port + "#" + this.mCoreServices.getWiFiMode();
Bitmap qrBitmap = UCamUtils.generateBitmap(link, (int) (200.0f * density), (int) (200.0f * density));
imqrcode.setImageBitmap(qrBitmap);
int usedtime = this.mPreference.getWiFiUsedTimes();
if (usedtime < HANDEL_UPDATE_ADADANIM1) {
this.mPreference.setWiFiUsedTimes(usedtime + 1);
} else {
findViewById(R.id.status_wifi_new).setVisibility(8);
}
this.mWiFiDialog = new AlertDialog.Builder(this).setView(rootview).show();
this.mWiFiDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface arg0) {
ServerActivity.this.mWiFiDialog = null;
}
});
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.button_abort:
findViewById(R.id.activity_logo).setVisibility(8);
return;
case R.id.status_dualscreen:
if (this.mCoreServices != null) {
this.mCoreServices.setDualscreenStatus(1);
this.mHandler.removeMessages(HANDEL_UPDATE_CONNECTCLIENT);
this.mHandler.sendEmptyMessage(HANDEL_UPDATE_CONNECTCLIENT);
return;
}
return;
case R.id.wifi_settings_info:
LayoutInflater inflater = LayoutInflater.from(this);
View view = inflater.inflate(R.layout.operation_tips_info, (ViewGroup) null);
AlertDialog dialog = new AlertDialog.Builder(this).setView(view).show();
WindowManager.LayoutParams params = dialog.getWindow().getAttributes();
params.width = 750;
params.height = 440;
dialog.getWindow().setAttributes(params);
return;
case R.id.ctrl_takepic:
if (!UCamDevice.getDevice().isStartedUcam() || UCamDevice.getDevice().getSDStatus() != 1 || this.mCoreServices == null) {
return;
}
this.mCoreServices.takePicture();
return;
case R.id.status_floatwindow:
if (UCamDevice.getDevice().isStartedUcam()) {
if (this.mCoreServices != null) {
this.mCoreServices.showFloatWindow(true);
}
finish();
return;
}
return;
case R.id.status_share:
if (UCamWiFiManager.isNetworkAvailable(this)) {
this.mCoreServices.checkUpdateAppNow();
}
Toast.makeText(this, R.string.prompt_udate_tonew, 1).show();
return;
case R.id.status_wifi:
if (UCamDevice.getDevice().isStartServerClient()) {
UCamDevice.getDevice().stopServerClient();
return;
} else {
if (this.mCoreServices != null) {
showWiFiDialog();
return;
}
return;
}
case R.id.status_front_rear_cam:
if (!UCamDevice.getDevice().isStartedUcam() || !UCamDevice.getDevice().isDoubleCamera() || this.mCoreServices == null) {
return;
}
this.mCoreServices.switchCamera();
return;
case R.id.status_collision:
if (this.mCoreServices != null) {
this.mCoreServices.addSensorLevel();
this.mHandler.removeMessages(1);
this.mHandler.sendEmptyMessage(1);
return;
}
return;
case R.id.status_adas:
if (this.mCoreServices != null) {
this.mCoreServices.addAdasQysdLevel();
this.mHandler.removeMessages(1);
this.mHandler.sendEmptyMessage(1);
this.mHandler.removeMessages(2);
this.mHandler.sendEmptyMessage(2);
return;
}
return;
case R.id.status_dog:
if (!UCamSuperDog.getSuperDog().isExistSuperDog(this)) {
Toast.makeText(this, R.string.settings_dog_nodata, 0).show();
return;
} else {
if (this.mCoreServices != null) {
this.mCoreServices.addDogQysdLevel();
this.mHandler.removeMessages(1);
this.mHandler.sendEmptyMessage(1);
return;
}
return;
}
case R.id.status_ssly:
if (this.mCoreServices != null) {
this.mCoreServices.addSslyQyzlLevel();
this.mHandler.removeMessages(1);
this.mHandler.sendEmptyMessage(1);
return;
}
return;
case R.id.status_park:
if (this.mCoreServices != null) {
this.mCoreServices.addParkStatus();
this.mHandler.removeMessages(1);
this.mHandler.sendEmptyMessage(1);
return;
}
return;
case R.id.status_recordaudio:
if (this.mCoreServices != null) {
this.mCoreServices.addRecordAudioStatus();
this.mHandler.removeMessages(1);
this.mHandler.sendEmptyMessage(1);
return;
}
return;
case R.id.status_record_time:
if (this.mCoreServices != null) {
this.mCoreServices.addRecordTimeLevel();
this.mHandler.removeMessages(1);
this.mHandler.sendEmptyMessage(1);
return;
}
return;
case R.id.ctrl_rec:
if (!UCamDevice.getDevice().isStartedUcam() || UCamDevice.getDevice().getSDStatus() != 1 || this.mCoreServices == null) {
return;
}
this.mCoreServices.switchRec();
return;
case R.id.ctrl_lock:
if (!UCamDevice.getDevice().isRecord() || UCamDevice.getDevice().getSDStatus() != 1 || this.mCoreServices == null) {
return;
}
this.mCoreServices.lockFile();
return;
case R.id.ctrl_replay:
if (UCamDevice.getDevice().isHasSD() && !UCamDevice.getDevice().isStartServerClient()) {
Intent intent = new Intent();
intent.setClass(this, FileListActivity.class);
intent.setFlags(1048576);
startActivity(intent);
return;
}
return;
case R.id.ctrl_settings:
Intent intent2 = new Intent();
intent2.setClass(this, SettingsActivity.class);
intent2.setFlags(1048576);
startActivity(intent2);
return;
default:
return;
}
}
@Override
public void onBegin() {
this.mCheckTimes = 0;
this.mHandler.removeMessages(3);
this.mHandler.sendEmptyMessageDelayed(3, 2000L);
this.mHandler.sendEmptyMessageDelayed(3, 2100L);
this.mHandler.sendEmptyMessageDelayed(3, 2200L);
}
@Override
public void onVersion() {
this.mHandler.removeMessages(8);
this.mHandler.sendEmptyMessage(8);
}
@Override
public void onUpdateStatus() {
this.mHandler.removeMessages(2);
this.mHandler.sendEmptyMessage(2);
}
@Override
public void onConnectClientBegin() {
this.mHandler.removeMessages(HANDEL_UPDATE_CONNECTCLIENT);
this.mHandler.sendEmptyMessage(HANDEL_UPDATE_CONNECTCLIENT);
}
@Override
public void onConnectClientReady() {
}
@Override
public void onConnectClientEnd() {
this.mHandler.removeMessages(HANDEL_UPDATE_CONNECTCLIENT);
this.mHandler.sendEmptyMessage(HANDEL_UPDATE_CONNECTCLIENT);
}
@Override
public void onClientChanged(String userinfo) {
if (this.mWiFiDialog != null && this.mWiFiDialog.isShowing()) {
this.mWiFiDialog.dismiss();
}
findViewById(R.id.activity_logo).setVisibility(8);
}
@Override
public void onUpdateUserStatus(int command, int status, String strstatus) {
if (command == 70022) {
this.mClientViewStatus = status;
}
this.mHandler.removeMessages(1);
this.mHandler.sendEmptyMessageDelayed(1, 500L);
this.mHandler.removeMessages(2);
this.mHandler.sendEmptyMessageDelayed(2, 600L);
}
@Override
public void onEnd() {
this.mHandler.removeMessages(2);
this.mHandler.sendEmptyMessage(2);
}
public AnimationDrawable loadAnimation(int[] resIds, int[] interval, boolean bSmall) {
AnimationDrawable clipDrawable = new AnimationDrawable();
for (int i = 0; i < resIds.length; i++) {
BitmapFactory.Options options = new BitmapFactory.Options();
if (bSmall) {
options.inSampleSize = 2;
} else {
options.inSampleSize = 1;
}
options.inJustDecodeBounds = false;
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), resIds[i], options);
clipDrawable.addFrame(new BitmapDrawable(getResources(), bitmap), interval[i]);
}
return clipDrawable;
}
private static void tryRecycleAnimationDrawable(AnimationDrawable animationDrawable) {
if (animationDrawable != null) {
for (int i = 0; i < animationDrawable.getNumberOfFrames(); i++) {
Drawable frame = animationDrawable.getFrame(i);
if (frame instanceof BitmapDrawable) {
((BitmapDrawable) frame).getBitmap().recycle();
}
frame.setCallback(null);
}
animationDrawable.setCallback(null);
}
}
@Override
public void onGpsMsg(int speed, int bearing) {
Message msg = Message.obtain();
msg.what = 1;
msg.arg1 = speed;
msg.arg2 = bearing;
this.mDogHandler.sendMessage(msg);
}
@Override
public void onAlarmMsg(int type, int gap, int limit) {
Message msg = Message.obtain();
msg.what = 2;
msg.arg1 = type;
msg.arg2 = gap;
msg.obj = Integer.valueOf(limit);
this.mDogHandler.sendMessage(msg);
}
public void updateUser() {
ImageView iv = (ImageView) findViewById(R.id.status_user);
iv.setVisibility(8);
String imgpath = String.valueOf(UCamUtils.getUpdatePath(this)) + File.separator + "user_img.jpg";
File file = new File(imgpath);
if (file.exists()) {
Bitmap bmp = BitmapFactory.decodeFile(imgpath);
iv.setImageBitmap(BitmapUtils.getCircleBitmap(bmp));
iv.setVisibility(0);
return;
}
UCamDevice.getDevice().sendCmdData(UCamDevice.TCP_USER_GETFILE, 1003);
}
}