Skip to content

Commit

Permalink
修改DJI SDK为Dji UI SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
jackxieweiwu committed May 8, 2017
1 parent 591303e commit 0a3767f
Show file tree
Hide file tree
Showing 639 changed files with 494 additions and 45,365 deletions.
2 changes: 1 addition & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

import android.content.Context;
import android.graphics.Bitmap;
import android.icu.util.JapaneseCalendar;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import zkrtdrone.zkrt.com.jackmvvm.base.BaseApplication;
import zkrtdrone.zkrt.com.jackmvvm.mvvm.util.show.T;
import zkrtdrone.zkrt.com.maplib.info.mission.coordinate.LatLong;

/**
Expand Down Expand Up @@ -99,6 +103,7 @@ private void checkForWaypointMarker(MarkerInfo markerInfo) {
}

public void setDroneBitmap(Bitmap droneBitmap) {
if(droneBitmap !=null || mMapFragment !=null);
mMapFragment.setDroneMap(droneBitmap);
}
}
Binary file not shown.
2 changes: 2 additions & 0 deletions android-uilib-release/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
configurations.maybeCreate("default")
artifacts.add("default", file('android-uilib-release.aar'))
26 changes: 7 additions & 19 deletions app/src/main/java/zkrtdrone/zkrt/com/MainContent.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package zkrtdrone.zkrt.com;

import android.content.Context;
import android.content.Intent;
import android.util.AttributeSet;
import android.view.View;
import android.widget.Button;
Expand All @@ -15,8 +16,6 @@
import zkrtdrone.zkrt.com.view.MainStart;
import zkrtdrone.zkrt.com.view.dialog.DialogPairimg;

import static zkrtdrone.zkrt.com.jackmvvm.base.BaseApplication.boolRemote;

/**
* Created by jack_xie on 15/12/18.
*/
Expand Down Expand Up @@ -78,30 +77,19 @@ public void run() {
private void refreshSDKRelativeUI() {
mProduct = JackApplication.getProductInstance();
//检查与遥控器连接是否正常
if(JackApplication.isAircraftConnected()){
boolRemote = JackApplication.getAircraftInstance().getRemoteController().isConnected();
if(!boolRemote){
ftb_start.setVisibility(GONE);
ftb_frequency.setVisibility(GONE);
txt_log_remote.setVisibility(VISIBLE);
}else{
txt_log_remote.setVisibility(GONE);
}
}

if (null != mProduct && mProduct.isConnected()) {
ftb_start.setVisibility(VISIBLE);
ftb_frequency.setVisibility(GONE);
BaseApplication.bool = false;
/*if (null != mProduct.getModel()) {
mTextProduct.setText("" + mProduct.getModel().getDisplayName());
} else {
mTextProduct.setText(R.string.product_information);
}*/
} else {
ftb_start.setVisibility(VISIBLE);
ftb_start.setVisibility(GONE);
BaseApplication.bool = true; //需要遥控器配对的
ftb_frequency.setVisibility(GONE);
}

Intent intent = new Intent();
intent.setAction("com.xiazdong");
intent.putExtra("name", "xiazdong");
JackApplication.mActivity.sendBroadcast(intent);
}
}
101 changes: 91 additions & 10 deletions app/src/main/java/zkrtdrone/zkrt/com/view/MainStart.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -10,12 +11,30 @@
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.squareup.otto.Subscribe;

import java.util.List;

import dji.keysdk.CameraKey;
import dji.keysdk.DJIKey;
import dji.midware.data.model.P3.DataCameraVirtualKey;
import dji.sdk.base.BaseProduct;
import dji.ui.widget.FPVWidget;
import zkrtdrone.zkrt.com.JackApplication;
import zkrtdrone.zkrt.com.R;
import zkrtdrone.zkrt.com.jackmvvm.mvvm.util.KeyBoardUtils;
import zkrtdrone.zkrt.com.jackmvvm.mvvm.util.ScreenUtil;
import zkrtdrone.zkrt.com.jackmvvm.mvvm.util.show.T;
import zkrtdrone.zkrt.com.jackmvvm.rxbean.IOTask;
import zkrtdrone.zkrt.com.jackmvvm.util.GeneralUtils;
import zkrtdrone.zkrt.com.jackmvvm.util.ModuleVerificationUtil;
import zkrtdrone.zkrt.com.jackmvvm.util.rxutil.RxjavaUtil;
import zkrtdrone.zkrt.com.maplib.info.EditorMapFragment;
import zkrtdrone.zkrt.com.maplib.info.GestureMapFragment;
import zkrtdrone.zkrt.com.maplib.info.OnEditorInteraction;
import zkrtdrone.zkrt.com.maplib.info.mission.coordinate.LatLong;
import zkrtdrone.zkrt.com.view.fragment.DroneFragment;
import zkrtdrone.zkrt.com.view.fragment.HandStateFragment;
import zkrtdrone.zkrt.com.view.fragment.MapMountFragment;
import zkrtdrone.zkrt.com.view.fragment.MountFragment;
Expand All @@ -37,18 +56,20 @@ public class MainStart extends RelativeLayout implements GestureMapFragment.OnPa
img_common_clear_pryline,img_common_exchange2,img_common_conceal3,img_common_conceal;
private FrameLayout start_common_map_video;
//private SlidingDrawer slidingDrawer;
private TelemetryFragment telemetryFragment;
//private TelemetryFragment telemetryFragment;
private MountFragment mountFragment;
private GestureMapFragment gestureMapFragment;
private HandStateFragment handStateFragment;
private MapMountFragment mapMountFragment;
private ImageView mount_open;
private DroneFragment droneFragment;
private ImageView mount_open,img_clean_click;
private int numberMapView = 0; //0为camera / map is min 1为 Map/camera
//切换窗口
private BaseFpvView fpvCamera;
private FrameLayout fpvCameraView;
//private BaseFpvView fpvCamera;
private FPVWidget fpvCamera,fpvCamera2;
private FrameLayout fpvCameraView,framefpvcamera;
private FrameLayout mapMain;
private RelativeLayout relayout_id_moudle;
private RelativeLayout relayout_id_moudle,PreflightCheckView;

public MainStart(Context context) {
super(context);
Expand All @@ -68,9 +89,11 @@ private void initView(Context context) {
//slidingDrawer = (SlidingDrawer) view.findViewById(R.id.slidingDrawerRight);
start_common_map_video = (FrameLayout) view.findViewById(R.id.start_common_map_video);
relayout_id_moudle = (RelativeLayout) view.findViewById(R.id.relayout_id_moudle);
PreflightCheckView = (RelativeLayout) view.findViewById(R.id.PreflightCheckView);
img_common_exchange = (ImageView) view.findViewById(R.id.img_common_exchange);
img_common_location = (ImageView) view.findViewById(R.id.img_common_location);
img_common_conceal = (ImageView) view.findViewById(R.id.img_common_conceal);
img_clean_click = (ImageView) view.findViewById(R.id.img_clean_click);
//img_common_conceal2 = (ImageView) view.findViewById(R.id.img_common_conceal2);
img_common_exchange2 = (ImageView) view.findViewById(R.id.img_common_exchange2);
img_common_conceal3 = (ImageView) view.findViewById(R.id.img_common_conceal3);
Expand All @@ -84,11 +107,14 @@ private void initView(Context context) {
img_common_conceal3.setOnClickListener(this);
img_common_clear_pryline.setOnClickListener(this);
mount_open.setOnClickListener(this);
img_clean_click.setOnClickListener(this);

//切换窗口
mapMain = (FrameLayout) view.findViewById(R.id.mapMain);
fpvCamera = (BaseFpvView) view.findViewById(R.id.fpvCamera);
fpvCamera = (FPVWidget) view.findViewById(R.id.fpvCamera);
//fpvCamera2 = (FPVWidget) view.findViewById(R.id.fpvCamera2);
fpvCameraView = (FrameLayout) view.findViewById(R.id.fpvCameraView);
//framefpvcamera = (FrameLayout) view.findViewById(R.id.framefpvcamera);

if (handStateFragment == null) {
handStateFragment = new HandStateFragment();
Expand All @@ -102,12 +128,12 @@ private void initView(Context context) {
.add(R.id.gestureMapFragment, gestureMapFragment)
.commit();
}
if (telemetryFragment == null) {
/*if (telemetryFragment == null) {
telemetryFragment = new TelemetryFragment();
fragmentManager.beginTransaction()
.add(R.id.telemetryFragment, telemetryFragment)
.commit();
}
}*/
if (mountFragment == null) {
mountFragment = new MountFragment();
fragmentManager.beginTransaction()
Expand All @@ -120,9 +146,15 @@ private void initView(Context context) {
.add(R.id.fragment_map, mapMountFragment)
.commit();
}
/*if (droneFragment == null) {
droneFragment = new DroneFragment();
fragmentManager.beginTransaction()
.add(R.id.drone_value, droneFragment)
.commit();
}*/
mountFragment.setImgOpen(mount_open);
mapMountFragment.GestureMapFragment(gestureMapFragment);
telemetryFragment.setGestureMapFragment(gestureMapFragment);
//telemetryFragment.setGestureMapFragment(gestureMapFragment);

/*fragmentManager.findFragmentById(R.id.fragment_hand).getView().
findViewById(R.id.hand_setting).setOnClickListener(new OnClickListener() {
Expand Down Expand Up @@ -162,6 +194,7 @@ public void onDrawerOpened() {

@Override
public void onClick(View v) {
if (GeneralUtils.isFastDoubleClick()) return;
switch (v.getId()){
case R.id.img_common_exchange2:
case R.id.img_common_exchange: //切换窗口
Expand All @@ -175,16 +208,24 @@ public void onClick(View v) {

mapMain.bringToFront();
fpvCameraView.bringToFront();
fpvCamera.transformValue(null,null);
/*fpvCameraView.setVisibility(GONE);
framefpvcamera.setVisibility(VISIBLE);*/
//framefpvcamera.bringToFront();
}else {
img_common_exchange.setVisibility(VISIBLE);
numberMapView = 0;
RelativeLayout.LayoutParams lay = new RelativeLayout.LayoutParams(fpvCameraView.getWidth(), fpvCameraView.getHeight());
lay.setMargins(getScreenWidth()-fpvCameraView.getWidth(),getScreenHeigh()-fpvCameraView.getHeight(),0,0);
mapMain.setLayoutParams(lay);
fpvCameraView.setLayoutParams(new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));

fpvCamera.transformValue(null,null);
/*framefpvcamera.setVisibility(GONE);
fpvCameraView.setVisibility(VISIBLE);*/
fpvCameraView.bringToFront();

mapMain.bringToFront();
Log.d("MainStart","切换窗口");
}
img_common_exchange2.setVisibility(img_common_exchange.getVisibility() == GONE? VISIBLE:GONE);
img_common_conceal3.setVisibility(img_common_exchange.getVisibility() == GONE? VISIBLE:GONE);
Expand Down Expand Up @@ -243,6 +284,9 @@ public void run() {
mountFragment.frame_mount.startAnimation(mountFragment.startAnimViewGone());
}
break;
case R.id.img_clean_click:
PreflightCheckView.setVisibility(GONE);
break;
}
}

Expand Down Expand Up @@ -320,4 +364,41 @@ public void onMapClick(LatLong coord) {
public void onListVisibilityChanged() {

}

@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
refreshSDKRelativeUI();
}

private void refreshSDKRelativeUI() {
if(ModuleVerificationUtil.isRemoteControllerAvailable()){
final BaseProduct mProduct = JackApplication.getProductInstance();
final boolean bool = JackApplication.getAircraftInstance().getRemoteController().isConnected();
JackApplication.mActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
if(bool){
if (null != mProduct && mProduct.isConnected()){}else{
handStateFragment.isRemoteDrone(false,400);
ScreenUtil.getInstance().setGreyScale(getRootView(),false);
}
}else{
handStateFragment.isRemoteDrone(bool,401);
ScreenUtil.getInstance().setGreyScale(getRootView(),bool);
}
}
});
}
}

@Subscribe
public void onConnectivityChange(JackApplication.ConnectivityChangeEvent event) {
post(new Runnable() {
@Override
public void run() {
refreshSDKRelativeUI();
}
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package zkrtdrone.zkrt.com.view.fragment;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import butterknife.Bind;
import butterknife.OnClick;
import zkrtdrone.zkrt.com.R;
import zkrtdrone.zkrt.com.jackmvvm.mvvm.core.AbsFragment;
import zkrtdrone.zkrt.com.jackmvvm.util.GeneralUtils;

/**
* Created by jack_xie on 17-5-8.
*/

public class DroneFragment extends AbsFragment{
@Bind(R.id.img_drone_takeoff) ImageView img_drone_takeoff;
@Bind(R.id.img_drone_land) ImageView img_drone_land;
@Bind(R.id.img_drone_gohome) ImageView img_drone_gohome;
@Bind(R.id.img_drone_hover) ImageView img_drone_hover;
@Bind(R.id.img_drone_waypoint) ImageView img_drone_waypoint;

@Override
protected void init(Bundle savedInstanceState) {

}

@Override
protected int setLayoutId() {
return R.layout.fragment_drone;
}

@OnClick(R.id.img_drone_takeoff)
public void imageBtnTakeOffLang(View v){
if (GeneralUtils.isFastDoubleClick()) return;
}

@Override
protected void dataCallback(int result, Object obj) {

}

@Override
protected void onDelayLoad() {

}

}
Loading

0 comments on commit 0a3767f

Please sign in to comment.