Skip to content

Commit

Permalink
Merge pull request #1199 from dji-sdk/sdk_releases/4.16.4
Browse files Browse the repository at this point in the history
Sdk releases/4.16.4
  • Loading branch information
dji-dev authored Nov 11, 2022
2 parents 359210c + 3a2c81d commit 2b11ef4
Show file tree
Hide file tree
Showing 7 changed files with 161 additions and 10 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ MSDK V5 Supported Product:
* [M30 Series](https://www.dji.com/matrice-30?site=brandsite&from=nav)
* [M300 RTK](https://www.dji.com/matrice-300?site=brandsite&from=nav)

# DJI Mobile SDK V4 for Android Latest Version 4.16.3
# DJI Mobile SDK V4 for Android Latest Version 4.16.4

## What Is This?

Expand All @@ -19,21 +19,21 @@ Declare dependency via Maven:
<dependency>
<groupId>com.dji</groupId>
<artifactId>dji-sdk</artifactId>
<version>4.16.3</version>
<version>4.16.4</version>
</dependency>

<dependency>
<groupId>com.dji</groupId>
<artifactId>dji-sdk-provided</artifactId>
<version>4.16.3</version>
<version>4.16.4</version>
</dependency>
~~~

or Gradle:

~~~groovy
compile 'com.dji:dji-sdk:4.16.3'
provided 'com.dji:dji-sdk-provided:4.16.3'
compile 'com.dji:dji-sdk:4.16.4'
provided 'com.dji:dji-sdk-provided:4.16.4'
~~~

For further detail on how to integrate the DJI Android SDK into your Android Studio project, please check the [Integrate SDK into Application](http://developer.dji.com/mobile-sdk/documentation/application-development-workflow/workflow-integrate.html#import-maven-dependency) tutorial.
Expand Down
4 changes: 2 additions & 2 deletions Sample Code/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ android {
dependencies {
implementation 'androidx.multidex:multidex:2.0.0'
implementation 'com.squareup:otto:1.3.8'
implementation('com.dji:dji-sdk:4.16.3', {
implementation('com.dji:dji-sdk:4.16.4', {
/**
* Uncomment the "library-anti-distortion" if your app does not need Anti Distortion for Mavic 2 Pro and Mavic 2 Zoom.
* Uncomment the "fly-safe-database" if you need database for release, or we will download it when DJISDKManager.getInstance().registerApp
Expand All @@ -87,7 +87,7 @@ dependencies {
exclude module: 'library-anti-distortion'
//exclude module: 'fly-safe-database'
})
compileOnly 'com.dji:dji-sdk-provided:4.16.3'
compileOnly 'com.dji:dji-sdk-provided:4.16.4'

implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.core:core:1.0.0'
Expand Down
104 changes: 104 additions & 0 deletions Sample Code/app/src/main/java/com/dji/sdk/sample/demo/rid/UASView.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
package com.dji.sdk.sample.demo.rid;

import android.app.Service;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.dji.sdk.sample.R;
import com.dji.sdk.sample.internal.utils.Helper;
import com.dji.sdk.sample.internal.utils.PopupUtils;
import com.dji.sdk.sample.internal.view.PresentableView;

import androidx.annotation.NonNull;
import dji.sdk.sdkmanager.DJISDKManager;
import dji.sdk.uas.AreaCode;
import dji.sdk.uas.UASRemoteIDStatus;
import dji.sdk.uas.UASRemoteIDStatusListener;

import static com.google.android.gms.internal.zzahn.runOnUiThread;

public class UASView extends LinearLayout implements View.OnClickListener, PresentableView {

Button changeUasCountryBtn;
TextView uasInfoTV;

private final UASRemoteIDStatusListener uasRemoteIDStatusListener = new UASRemoteIDStatusListener() {
@Override
public void onUpdate(UASRemoteIDStatus uasRemoteIDStatus) {
runOnUiThread(()-> uasInfoTV.setText(uasRemoteIDStatus.toString()));
}
};

public UASView(Context context) {
super(context);
setOrientation(LinearLayout.HORIZONTAL);
setClickable(true);
LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Service.LAYOUT_INFLATER_SERVICE);
layoutInflater.inflate(R.layout.view_uas, this, true);
init();
}

private void init() {

}

private void initUI() {
changeUasCountryBtn = findViewById(R.id.btn_change_uas_country);
uasInfoTV = findViewById(R.id.tv_uas_info);
initOnclickListener();
}

private void initOnclickListener() {
changeUasCountryBtn.setOnClickListener(this);
}

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

@Override
public void onClick(View v) {
if (v != null) {
switch (v.getId()) {
case R.id.btn_change_uas_country:
changeUasCountry();
break;
default:
break;
}
}
}

void changeUasCountry() {
final AreaCode[] areaCodes = AreaCode.values();
final Runnable r = () -> {
DJISDKManager.getInstance().getUasRemoteIDManager().setAreaCode(areaCodes[PopupUtils.INSTANCE.getIndex()[0]]);
initUasListener();
PopupUtils.INSTANCE.resetIndex();
};
PopupUtils.INSTANCE.initPopupNumberPicker(Helper.makeList(areaCodes), r,this);
}

private void initUasListener() {
uasInfoTV.setText("");
DJISDKManager.getInstance().getUasRemoteIDManager().addUASRemoteIDStatusListener(uasRemoteIDStatusListener);
}

@Override
public int getDescription() {
return R.string.uas_view;
}

@NonNull
@Override
public String getHint() {
return this.getClass().getSimpleName() + ".java";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import com.dji.sdk.sample.demo.radar.RadarView;
import com.dji.sdk.sample.demo.remotecontroller.DualRemoteControllerView;
import com.dji.sdk.sample.demo.remotecontroller.PushRemoteControllerDataView;
import com.dji.sdk.sample.demo.rid.UASView;
import com.dji.sdk.sample.demo.timeline.TimelineMissionControlView;
import com.dji.sdk.sample.demo.useraccount.LDMView;
import com.dji.sdk.sample.internal.controller.DJISampleApplication;
Expand Down Expand Up @@ -94,6 +95,7 @@ private void initView(Context context) {
ListItem.ListBuilder builder = new ListItem.ListBuilder();
builder.addGroup(R.string.component_listview_sdk_4_16,
false,
new GroupItem(R.string.uas_view, UASView.class),
new GroupItem(R.string.look_at_mission, LookAtMissionView.class));
builder.addGroup(R.string.component_listview_sdk_4_15,
false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
import com.dji.sdk.sample.internal.utils.ToastUtils;
import com.squareup.otto.Subscribe;

import dji.sdk.sdkmanager.LDMModule;
import dji.sdk.sdkmanager.LDMModuleType;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
Expand All @@ -61,6 +59,8 @@
import dji.sdk.sdkmanager.BluetoothProductConnector;
import dji.sdk.sdkmanager.DJISDKInitEvent;
import dji.sdk.sdkmanager.DJISDKManager;
import dji.sdk.sdkmanager.LDMModule;
import dji.sdk.sdkmanager.LDMModuleType;
import dji.sdk.useraccount.UserAccountManager;

/**
Expand Down Expand Up @@ -478,7 +478,6 @@ private void checkAndRequestPermissions() {
missingPermission.toArray(new String[missingPermission.size()]),
REQUEST_PERMISSION_CODE);
}

}

private void startSDKRegistration() {
Expand Down
44 changes: 44 additions & 0 deletions Sample Code/app/src/main/res/layout/view_uas.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">

<Button
android:id="@+id/btn_change_uas_country"
style="@style/common_button"
android:layout_alignParentLeft="true"
android:layout_marginLeft="5dp"
android:layout_marginTop="20dp"
android:text="Change UAS Country" />
</LinearLayout>

<ScrollView
android:layout_width="250dp"
android:layout_height="200dp"
android:layout_alignParentRight="true"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp"
android:layout_marginRight="5dp"
android:scrollbars="vertical">

<TextView
android:id="@+id/tv_uas_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollbars="vertical"
android:textColor="@color/black" />
</ScrollView>

</LinearLayout>

</merge>
2 changes: 2 additions & 0 deletions Sample Code/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -362,4 +362,6 @@
<string name="laser_enable">Laser Enabled</string>
<string name="split_screen_display">Split Screen Display</string>

<string name="uas_view">UAS</string>

</resources>

0 comments on commit 2b11ef4

Please sign in to comment.