Skip to content

Commit

Permalink
Pushed to next version
Browse files Browse the repository at this point in the history
  • Loading branch information
sepp89117 committed Feb 5, 2023
1 parent 8440c39 commit e44fe15
Show file tree
Hide file tree
Showing 35 changed files with 938 additions and 417 deletions.
5 changes: 3 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId 'com.sepp89117.goeasypro_android'
minSdk 27
targetSdk 33
versionCode 153
versionName "1.5.3"
versionCode 154
versionName "1.5.4"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
Expand All @@ -38,6 +38,7 @@ dependencies {
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.android.gms:play-services-location:21.0.1'
implementation 'androidx.preference:preference:1.1.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
Expand Down
43 changes: 19 additions & 24 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,14 @@
tools:ignore="ScopedStorage" />
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32"/>

<!-- BT permissions for Android S up -->
android:maxSdkVersion="32" /> <!-- BT permissions for Android S up -->
<uses-permission
android:name="android.permission.BLUETOOTH_SCAN"
android:minSdkVersion="31"
android:usesPermissionFlags="neverForLocation" />
<uses-permission
android:name="android.permission.BLUETOOTH_CONNECT"
android:minSdkVersion="31" />

<!-- BT permissions for Android R down -->
android:minSdkVersion="31" /> <!-- BT permissions for Android R down -->
<uses-permission
android:name="android.permission.BLUETOOTH"
android:maxSdkVersion="30" />
Expand All @@ -39,27 +35,18 @@
<uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION"
android:maxSdkVersion="30" />


<uses-permission android:name="android.permission.INTERNET" />

<!-- Wifi permissions for Android Q up -->
<uses-permission android:name="android.permission.INTERNET" /> <!-- Wifi permissions for Android Q up -->
<uses-permission
android:name="android.permission.ACCESS_NETWORK_STATE"
android:minSdkVersion="29" />
<uses-permission
android:name="android.permission.CHANGE_NETWORK_STATE"
android:minSdkVersion="29" />

<!-- Wifi permissions for Android P down -->
android:minSdkVersion="29" /> <!-- Wifi permissions for Android P down -->
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"
android:maxSdkVersion="30" />

<uses-permission
android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission
android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />

<application
android:name=".MyApplication"
Expand All @@ -68,12 +55,20 @@
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:requestLegacyExternalStorage="true"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.GoPro_RC"
android:usesCleartextTraffic="true"
android:requestLegacyExternalStorage="true"
tools:targetApi="31">
<activity
android:name=".SettingsActivity"
android:exported="false"
android:label="@string/title_activity_settings">
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
<activity
android:name=".GoSettingsActivity"
android:exported="false">
Expand All @@ -83,16 +78,16 @@
</activity>
<activity
android:name=".StorageBrowserActivity"
android:exported="false"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden" >
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden"
android:exported="false">
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
<activity
android:name=".PreviewActivity"
android:exported="false"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden" >
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden"
android:exported="false">
<meta-data
android:name="android.app.lib_name"
android:value="" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ public class GoHeader {
private int headerLength = 1;
private int msgLength = 0;

public void parse(byte[] payload) {
public GoHeader(byte[] payload) {
int byte0 = payload[0] & 0xff;
int byte1 = payload[1] & 0xff;
int byte2 = payload[2] & 0xff;

if ((byte0 & 32) > 0) {
headerLength = 2;
msgLength = ((byte0 & 0x0f) << 8) | byte1; //0x24 & 0xf = 0x4; 0x4 << 8 = 0x400; 0x400 | 0xb5 = 0x4b5; (1205)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public View getView(int position, View view, ViewGroup parent) {

TextView name = rowView.findViewById(R.id.name);
TextView model = rowView.findViewById(R.id.model);
TextView mode = rowView.findViewById(R.id.flat_mode);
TextView preset = rowView.findViewById(R.id.preset);
TextView memory = rowView.findViewById(R.id.memory);
TextView battery = rowView.findViewById(R.id.battery);
Expand All @@ -62,6 +63,8 @@ public View getView(int position, View view, ViewGroup parent) {
ImageView bt_symbol = rowView.findViewById(R.id.bt_symbol);
ImageView batt_symbol = rowView.findViewById(R.id.batt_symbol);
ImageView shutter_symbol = rowView.findViewById(R.id.shutter_symbol);
ImageView hot_view = rowView.findViewById(R.id.hot_view);
ImageView cold_view = rowView.findViewById(R.id.cold_view);
//ImageView mode_imageView = rowView.findViewById(R.id.mode_imageView);

name.setText(goProDevice.displayName);
Expand Down Expand Up @@ -101,13 +104,26 @@ public View getView(int position, View view, ViewGroup parent) {
shutter_symbol.setVisibility(View.INVISIBLE);
}

if(goProDevice.isCold) {
cold_view.setVisibility(View.VISIBLE);
} else {
cold_view.setVisibility(View.INVISIBLE);
}

if(goProDevice.isHot) {
hot_view.setVisibility(View.VISIBLE);
} else {
hot_view.setVisibility(View.INVISIBLE);
}

model.setText(goProDevice.modelName);

if (goProDevice.btConnectionStage == BT_CONNECTED) {
name.setTextColor(LIGHTBLUE);
rssi.setText(String.valueOf(goProDevice.btRssi));
battery.setText(String.format("%d%%", goProDevice.remainingBatteryPercent));
preset.setText(goProDevice.Preset);
preset.setText(goProDevice.preset.getTitle());
mode.setText(goProDevice.mode.getTitle());
memory.setText(goProDevice.remainingMemory);


Expand All @@ -129,7 +145,8 @@ public View getView(int position, View view, ViewGroup parent) {
} else {
rssi.setText("NC");
battery.setText("NC");
preset.setText("NC");
preset.setText("Preset");
mode.setText("Mode");
memory.setText("NC");

if (goProDevice.btConnectionStage == BT_NOT_CONNECTED) {
Expand Down
56 changes: 56 additions & 0 deletions app/src/main/java/com/sepp89117/goeasypro_android/GoMode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package com.sepp89117.goeasypro_android;

import java.util.HashMap;
import java.util.Map;

public class GoMode {
private int id = -1;
private String title = "NC";

private static final Map<Integer, String> modes = new HashMap<Integer, String>() {{
put(-1, "NC");
put(0, "Video");
put(1, "Photo");
put(2, "Multishot");
put(3, "Broadcast");
put(4, "Playback");
put(5, "Setup");
put(6, "FW Update");
put(7, "USB MTP");
put(8, "SOS");
put(9, "MEdit");
put(10, "Calibration");
put(11, "Direct Offload");
put(12, "Video");
put(13, "Time Lapse Video");
put(14, "Video + Photo");
put(15, "Looping");
put(16, "Single Photo");
put(17, "Photo");
put(18, "Night Photo");
put(19, "Burst Photo");
put(20, "Time Lapse Photo");
put(21, "Night Lapse Photo");
put(22, "Broadcast Record");
put(23, "Webcam");
put(24, "Time Warp Video");
put(25, "Live Burst");
put(26, "Night Lapse Video");
put(27, "Slo-Mo");
}};

public GoMode(){};

public GoMode(int id) {
this.id = id;
this.title = modes.getOrDefault(this.id, "UNK " + this.id);
}

public int getId() {
return id;
}

public String getTitle() {
return title;
}
}
48 changes: 48 additions & 0 deletions app/src/main/java/com/sepp89117/goeasypro_android/GoPreset.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.sepp89117.goeasypro_android;

import java.util.HashMap;
import java.util.Map;

public class GoPreset {
private int id = -1;
private String title = "NC";

private static final Map<Integer, String> presets = new HashMap<Integer, String>() {{
put(-2, "NA");
put(-1, "NC");
put(0x00000000, "Standard");
put(0x00000001, "Activity");
put(0x00000002, "Cinematic");
put(0x00000003, "Slo-Mo");
put(0x00000004, "Ultra Slo-Mo");
put(0x00000005, "Basic");
put(0x00000006, "Water");
put(0x00000007, "Indoor");
put(0x00010000, "Photo");
put(0x00010001, "Live Burst");
put(0x00010002, "Burst Photo");
put(0x00010003, "Night Photo");
put(0x00020000, "Time Warp");
put(0x00020001, "Time Lapse");
put(0x00020002, "Night Lapse");
put(0x00030000, "Max Video");
put(0x00040000, "Max Photo");
put(0x00050000, "Max Time Warp");
}};

//To determine which presets are available for immediate use, get Preset Status.
public GoPreset(){};

public GoPreset(int id) {
this.id = id;
this.title = presets.getOrDefault(this.id, "UNK " + this.id);
}

public int getId() {
return id;
}

public String getTitle() {
return title;
}
}
Loading

0 comments on commit e44fe15

Please sign in to comment.