Skip to content

Commit

Permalink
Merge pull request #5 from modular-ftc/update-to-5.2-lite
Browse files Browse the repository at this point in the history
Update to 5.2 lite
  • Loading branch information
iamwood committed Sep 26, 2019
2 parents 4f214eb + f4ed535 commit f38e73d
Show file tree
Hide file tree
Showing 82 changed files with 405 additions and 149 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.ftc_version = '4.3'
ext.ftc_version = '5.2'

repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Oct 30 19:28:07 CDT 2017
#Thu Sep 26 14:16:06 CDT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\:https://services.gradle.org/distributions/gradle-4.6-all.zip
distributionUrl=https\:https://services.gradle.org/distributions/gradle-5.4.1-all.zip
7 changes: 6 additions & 1 deletion library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ android {
compileSdkVersion 27
defaultConfig {
minSdkVersion 19
//noinspection ExpiredTargetSdkVersion
targetSdkVersion 19
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

versionCode 45
versionCode 46
versionName "$ftc_version.0-lite"

ndk {
Expand All @@ -28,8 +29,12 @@ project.archivesBaseName = 'ftc-common-repackaged'

dependencies {
implementation "com.github.modular-ftc:robotcore-repackaged:$ftc_version.0-lite"
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.google.code.gson:gson:2.8.5'

implementation "org.first.ftc:hardware:$ftc_version"
implementation "org.first.ftc:inspection:$ftc_version"
implementation "org.first.ftc:robotserver:$ftc_version"
}

//For JitPack
Expand Down
9 changes: 7 additions & 2 deletions library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- FtcCommon manifest -->
<manifest xmlns:android="http:https://schemas.android.com/apk/res/android"
xmlns:tools="http:https://schemas.android.com/tools"
package="com.qualcomm.ftccommon"
android:versionCode="55"
android:versionName="8.9" >
android:versionCode="64"
android:versionName="11.6" >

<uses-sdk
android:targetSdkVersion="26"
tools:ignore="GradleOverrides,OldTargetApi" />

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission
Expand Down
2 changes: 2 additions & 0 deletions library/src/main/java/com/qualcomm/ftccommon/CommandList.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
package com.qualcomm.ftccommon;

import android.support.annotation.NonNull;
import android.util.Base64;

import com.qualcomm.robotcore.util.RobotLog;
import com.qualcomm.robotcore.util.SerialNumber;

import org.firstinspires.ftc.robotcore.internal.collections.SimpleGson;
Expand Down
33 changes: 30 additions & 3 deletions library/src/main/java/com/qualcomm/ftccommon/FtcAboutActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceCategory;
import android.preference.PreferenceFragment;
import android.support.annotation.StringRes;
import android.text.TextUtils;
import android.widget.FrameLayout;

import com.qualcomm.robotcore.hardware.configuration.LynxConstants;
import com.qualcomm.robotcore.robocol.Command;
import com.qualcomm.robotcore.robocol.RobocolConfig;
import com.qualcomm.robotcore.util.RobotLog;
Expand All @@ -32,6 +35,7 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;


public class FtcAboutActivity extends ThemedActivity
{
//----------------------------------------------------------------------------------------------
Expand All @@ -40,6 +44,7 @@ public class FtcAboutActivity extends ThemedActivity

public static final String TAG = "FtcDriverStationAboutActivity";
@Override public String getTag() { return TAG; }
@Override protected FrameLayout getBackBar() { return findViewById(org.firstinspires.inspection.R.id.backbar); }

protected final Context context = AppUtil.getDefContext();
protected final boolean remoteConfigure = AppUtil.getInstance().isDriverStation();
Expand Down Expand Up @@ -83,6 +88,7 @@ public static CommandList.AboutInfo getLocalAboutInfo()
info.libVersion = Version.getLibraryVersion();
info.buildTime = getBuildTime();
info.networkProtocolVersion = String.format(Locale.US, "v%d", RobocolConfig.ROBOCOL_VERSION);
info.osVersion = LynxConstants.getControlHubOsVersion();

NetworkConnection networkConnection = NetworkConnectionHandler.getInstance().getNetworkConnection();
if (networkConnection != null)
Expand Down Expand Up @@ -138,6 +144,7 @@ protected static String getBuildTime()
public static class AboutFragment extends PreferenceFragment
{
protected final boolean remoteConfigure = AppUtil.getInstance().isDriverStation();
private boolean firstRemoteRefresh = true;

public void refreshLocal(RobotCoreCommandList.AboutInfo aboutInfo)
{
Expand All @@ -146,17 +153,28 @@ public void refreshLocal(RobotCoreCommandList.AboutInfo aboutInfo)
setPreferenceSummary(R.string.pref_network_protocol_version, aboutInfo.networkProtocolVersion);
setPreferenceSummary(R.string.pref_build_time, aboutInfo.buildTime);
setPreferenceSummary(R.string.pref_network_connection_info, aboutInfo.networkConnectionInfo);
setPreferenceSummary(R.string.pref_os_version, aboutInfo.osVersion);
}

public void refreshRemote(RobotCoreCommandList.AboutInfo aboutInfo)
{
if (remoteConfigure)
{
if (firstRemoteRefresh && aboutInfo.osVersion != null) // If the remote device reports an OS version, we need to add a preference for it
{
PreferenceCategory prefAppCategoryRc = (PreferenceCategory) findPreference(getString(R.string.pref_app_category_rc));
Preference osVersionPreference = new Preference(getPreferenceScreen().getContext());
osVersionPreference.setTitle(getString(R.string.about_ch_os_version));
osVersionPreference.setKey(getString(R.string.pref_os_version_rc));
prefAppCategoryRc.addPreference(osVersionPreference);
}
firstRemoteRefresh = false;
setPreferenceSummary(R.string.pref_app_version_rc, aboutInfo.appVersion);
setPreferenceSummary(R.string.pref_lib_version_rc, aboutInfo.libVersion);
setPreferenceSummary(R.string.pref_network_protocol_version_rc, aboutInfo.networkProtocolVersion);
setPreferenceSummary(R.string.pref_build_time_rc, aboutInfo.buildTime);
setPreferenceSummary(R.string.pref_network_connection_info_rc, aboutInfo.networkConnectionInfo);
setPreferenceSummary(R.string.pref_os_version_rc, aboutInfo.osVersion);
}
}

Expand All @@ -167,20 +185,22 @@ public void refreshAllUnavailable()
setPreferenceSummary(R.string.pref_network_protocol_version, null);
setPreferenceSummary(R.string.pref_build_time, null);
setPreferenceSummary(R.string.pref_network_connection_info, null);
setPreferenceSummary(R.string.pref_os_version, null);

setPreferenceSummary(R.string.pref_app_version_rc, null);
setPreferenceSummary(R.string.pref_lib_version_rc, null);
setPreferenceSummary(R.string.pref_network_protocol_version_rc, null);
setPreferenceSummary(R.string.pref_build_time_rc, null);
setPreferenceSummary(R.string.pref_network_connection_info_rc, null);
setPreferenceSummary(R.string.pref_os_version_rc, null);
}

@Override public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);

addPreferencesFromResource(com.qualcomm.ftccommon.R.xml.ftc_about_activity);
Preference prefAppCategory = findPreference(getString(R.string.pref_app_category));
PreferenceCategory prefAppCategory = (PreferenceCategory) findPreference(getString(R.string.pref_app_category));
prefAppCategory.setTitle(remoteConfigure ? R.string.prefcat_about_ds : R.string.prefcat_about_rc);

if (remoteConfigure)
Expand All @@ -189,6 +209,13 @@ public void refreshAllUnavailable()
Preference prefAppCategoryRc = findPreference(getString(R.string.pref_app_category_rc));
prefAppCategoryRc.setTitle(R.string.prefcat_about_rc);
}
else if (LynxConstants.getControlHubOsVersion() != null)
{
Preference osVersionPreference = new Preference(getPreferenceScreen().getContext());
osVersionPreference.setTitle(getString(R.string.about_ch_os_version));
osVersionPreference.setKey(getString(R.string.pref_os_version));
prefAppCategory.addPreference(osVersionPreference);
}

refreshAllUnavailable();
}
Expand Down Expand Up @@ -266,7 +293,7 @@ protected void refresh()
{
RobotLog.vv(TAG, "onCreate()");
super.onCreate(savedInstanceState);
setContentView(com.qualcomm.ftccommon.R.layout.activity_generic_settings);
setContentView(R.layout.activity_generic_settings);

// Always make sure we have a real device name before we launch
DeviceNameManagerFactory.getInstance().initializeDeviceNameIfNecessary();
Expand All @@ -276,7 +303,7 @@ protected void refresh()

getFragmentManager()
.beginTransaction()
.replace(android.R.id.content, aboutFragment)
.replace(R.id.container, aboutFragment)
.commit();

NetworkConnectionHandler.getInstance().pushReceiveLoopCallback(recvLoopCallback);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ are permitted (subject to the limitations in the disclaimer below) provided that
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS
LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESSFOR A PARTICULAR PURPOSE
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Expand All @@ -36,6 +36,7 @@ are permitted (subject to the limitations in the disclaimer below) provided that
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.widget.FrameLayout;

import com.qualcomm.robotcore.util.Device;
import com.qualcomm.robotcore.util.RobotLog;
Expand All @@ -58,6 +59,7 @@ public class FtcAdvancedRCSettingsActivity extends ThemedActivity

public static final String TAG = "FtcAdvancedRCSettingsActivity";
@Override public String getTag() { return TAG; }
@Override protected FrameLayout getBackBar() { return findViewById(org.firstinspires.inspection.R.id.backbar); }

//----------------------------------------------------------------------------------------------
// Life Cycle
Expand All @@ -84,6 +86,8 @@ public void onCreate(Bundle savedInstanceState)
Preference prefChangeChannel = findPreference(getString(R.string.pref_launch_wifi_channel_edit));
Preference prefLynxFirmwareUpdateMode = findPreference(getString(R.string.pref_launch_lynx_firmware_update));

// TODO(CHv1): Update this channel changer to work for both Wifi Direct and the CH

// If we're not connected to RC, then disable controls that edit same
prefChangeChannel.setEnabled(!remoteConfigure ||
(clientConnected && preferencesHelper.readBoolean(getString(R.string.pref_wifip2p_remote_channel_change_works), false)));
Expand Down Expand Up @@ -133,8 +137,7 @@ protected void onCreate(Bundle savedInstanceState)

getFragmentManager()
.beginTransaction()
.replace(android.R.id.content, settingsFragment)
.replace(R.id.container, settingsFragment)
.commit();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
import org.firstinspires.ftc.robotcore.internal.ftdi.FtDeviceManager;
import org.firstinspires.ftc.robotcore.internal.network.CallbackResult;
import org.firstinspires.ftc.robotcore.internal.opmode.OpModeManagerImpl;
import org.firstinspires.inspection.InspectionState;

import java.util.ArrayList;
import java.util.HashSet;
Expand Down Expand Up @@ -184,6 +185,7 @@ public void init(EventLoopManager eventLoopManager) throws RobotCoreException, I

opModeManager.setHardwareMap(hardwareMap);
hardwareMap.logDevices();
InspectionState.cacheFirmwareInspectionVersion(hardwareMap);

RobotLog.ii(TAG, "======= INIT FINISH =======");
}
Expand Down
Loading

0 comments on commit f38e73d

Please sign in to comment.