Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ local.properties
.idea/caches/
.idea/codeStyles/
.idea/deploymentTargetDropDown.xml
.idea/appInsightsSettings.xml
.idea/deploymentTargetSelector.xml
*.iml

# OS-specific files
Expand Down
20 changes: 10 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apply plugin: 'com.android.application'

android {
compileSdk 34
compileSdk 35
defaultConfig {
applicationId "com.samsung.microbit"
minSdkVersion 21
targetSdk 34
targetSdk 35
// When target SDK version is 30+,
// requestLegacyExternalStorage will continue to work for 29 Android 10
}
Expand Down Expand Up @@ -33,16 +33,16 @@ android {
}

dependencies {
implementation 'androidx.lifecycle:lifecycle-process:2.7.0'
testImplementation 'junit:junit:4.12'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.11.0'
implementation 'androidx.lifecycle:lifecycle-process:2.9.2'
testImplementation 'junit:junit:4.13.2'
implementation 'androidx.appcompat:appcompat:1.7.1'
implementation 'com.google.android.material:material:1.12.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.19'
implementation 'androidx.recyclerview:recyclerview:1.4.0'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.29'
implementation 'no.nordicsemi.android:dfu:2.4.1'
implementation project(':pfLibrary')
implementation 'com.google.android.gms:play-services-analytics:18.0.4'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.google.android.gms:play-services-analytics:18.1.1'
implementation 'com.google.code.gson:gson:2.13.1'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'
}
8 changes: 3 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
<activity
android:name=".ui.activity.NotificationActivity"
android:label="@string/device_details"
android:screenOrientation="portrait"/>
android:configChanges="orientation|screenSize" />
<activity
android:name=".ui.activity.PairingActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
Expand All @@ -146,14 +146,12 @@
android:name=".ui.activity.AudioRecorderActivity"
android:configChanges="orientation|screenSize"
android:label="Audio Recorder"
android:launchMode="singleTask"
android:screenOrientation="portrait"/>
android:launchMode="singleTask"/>
<activity
android:name=".ui.activity.HelpWebView"
android:configChanges="orientation|screenSize"
android:label="Help Webview"
android:launchMode="singleTask"
android:screenOrientation="portrait"/>
android:launchMode="singleTask"/>
<activity
android:name=".ui.activity.MakeCodeWebView"
android:configChanges="orientation|screenSize"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ public void onClick(View v) {

@Override
protected void onCreate(Bundle savedInstanceState) {

// TODO: EdgeToEdge - Remove once activities handle insets.
// Call before the DecorView is accessed in setContentView
getTheme().applyStyle(R.style.OptOutEdgeToEdgeEnforcement, /* force */ false);

super.onCreate(savedInstanceState);

mLaunchActivity = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@ public void run() {
@Override
protected void onCreate(Bundle savedInstanceState) {
logi("onCreate");

// TODO: EdgeToEdge - Remove once activities handle insets.
// Call before the DecorView is accessed in setContentView
getTheme().applyStyle(R.style.OptOutEdgeToEdgeEnforcement, /* force */ false);

super.onCreate(savedInstanceState);

displayCreate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ protected void onStop() {

@Override
protected void onCreate(Bundle savedInstanceState) {

// TODO: EdgeToEdge - Remove once activities handle insets.
// Call before the DecorView is accessed in setContentView
getTheme().applyStyle(R.style.OptOutEdgeToEdgeEnforcement, /* force */ false);

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_help_web_view);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,14 @@ protected void onStop() {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
logi("onCreate() :: ");

// TODO: EdgeToEdge - Remove once activities handle insets.
// Call before the DecorView is accessed in setContentView
getTheme().applyStyle(R.style.OptOutEdgeToEdgeEnforcement, /* force */ false);

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_home);

if(savedInstanceState == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ protected void onStop() {

@Override
protected void onCreate(Bundle savedInstanceState) {

// TODO: EdgeToEdge - Remove once activities handle insets.
// Call before the DecorView is accessed in setContentView
getTheme().applyStyle(R.style.OptOutEdgeToEdgeEnforcement, /* force */ false);

super.onCreate(savedInstanceState);

activityHandle = this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@

import android.app.Activity;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;

import com.samsung.microbit.R;

public class NotificationActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {

// TODO: EdgeToEdge - Remove once activities handle insets.
// Call before the DecorView is accessed in setContentView
getTheme().applyStyle(R.style.OptOutEdgeToEdgeEnforcement, /* force */ false);

super.onCreate(savedInstanceState);

// If this activity is the root activity of the task, the app is not running
Expand All @@ -23,6 +31,11 @@ protected void onCreate(Bundle savedInstanceState) {
finish();
}

@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}

@Override
protected void onStart() {
super.onStart();
Expand All @@ -33,4 +46,4 @@ protected void onStop() {
super.onStop();
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,10 @@ public void onPause() {
protected void onCreate(Bundle savedInstanceState) {
logi("onCreate() ::");

// TODO: EdgeToEdge - Remove once activities handle insets.
// Call before the DecorView is accessed in setContentView
getTheme().applyStyle(R.style.OptOutEdgeToEdgeEnforcement, /* force */ false);

super.onCreate(savedInstanceState);

MBApp application = MBApp.getApp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@ private void releaseViews() {

@Override
protected void onCreate(Bundle savedInstanceState) {

// TODO: EdgeToEdge - Remove once activities handle insets.
// Call before the DecorView is accessed in setContentView
getTheme().applyStyle(R.style.OptOutEdgeToEdgeEnforcement, /* force */ false);

super.onCreate(savedInstanceState);

Log.d("PopUpActivity", "onCreate() popuptype = " + getIntent().getIntExtra(INTENT_EXTRA_TYPE, PopUp.TYPE_NONE));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,11 @@ private void releaseViews() {

@Override
protected void onCreate(Bundle savedInstanceState) {

// TODO: EdgeToEdge - Remove once activities handle insets.
// Call before the DecorView is accessed in setContentView
getTheme().applyStyle(R.style.OptOutEdgeToEdgeEnforcement, /* force */ false);

super.onCreate(savedInstanceState);

MBApp application = MBApp.getApp();
Expand Down Expand Up @@ -1474,6 +1479,15 @@ private void startDFUFlash() {
.setKeepBond(true)
.setForeground(true)
.setZip( getCachePathAppZip());

// https://github.com/microbit-foundation/microbit-android/issues/82
// ? if ( Build.HARDWARE.equals("ums512_1h10")) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you still consider this as an option? Or leaving in case we want to broaden it to other manufacturers/devices with the same hardware in future?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what is the best way to catch the required devices. I felt most comfortable with using the names, but I had seen this:
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/94e8f9a8def016fab237d2d480698c3b3957e280/lib/dfu/src/main/java/no/nordicsemi/android/dfu/BaseDfuImpl.java#L745

Copy link

@microbit-matt-hillsdon microbit-matt-hillsdon Sep 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting! I guess in the ideal world we'd test with a different vendor's ums512_1h10 (presumably that string came from your test device?) but that's not likely to be possible.

I'm happy going either way based on your judgement. If the slowdown isn't too bad maybe it's better to use the hardware and potentially fix more devices at the risk of perhaps making some working devices a bit slower? Please decide and merge one or the other.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just removed the comment. I didn't time them, but had the impression the M10 isn't as slow as my Samsung A8, but still I wouldn't want the slow down imposed on a device that was working before!

if ( Build.MANUFACTURER.toLowerCase().contains("lenovo")
&& Build.DEVICE.toLowerCase().contains("tb328")) {
// Tested with Lenovo M10 TB328FU with Android 12 - returns mtu 247, but DFU fails
starter.disableMtuRequest(); // faster than setMtu(23), which also works
}

final DfuServiceController controller = starter.start(this, DfuService.class);
} else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ public class SplashScreenActivity extends Activity implements View.OnClickListen

@Override
protected void onCreate(Bundle savedInstanceState) {

// TODO: EdgeToEdge - Remove once activities handle insets.
// Call before the DecorView is accessed in setContentView
getTheme().applyStyle(R.style.OptOutEdgeToEdgeEnforcement, /* force */ false);

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_splash_screen);
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/res/values-v35/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- TODO: EdgeToEdge - Remove once activities handle insets. -->
<style name="OptOutEdgeToEdgeEnforcement">
<item name="android:windowOptOutEdgeToEdgeEnforcement">true</item>
</style>
</resources>
7 changes: 7 additions & 0 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -324,4 +324,11 @@
<style name="AlertDialogDarkButtons" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="android:textColor">@color/black_color</item>
</style>

<!-- TODO: EdgeToEdge - Remove once activities handle insets. -->
<style name="OptOutEdgeToEdgeEnforcement">
<!-- android:windowOptOutEdgeToEdgeEnforcement
isn't supported before SDK 35. This empty
style enables programmatically opting-out. -->
</style>
</resources>
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
maven { url 'https://maven.google.com' }
jcenter()
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.2.1'
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.android.tools.build:gradle:8.6.1'
classpath 'com.google.gms:google-services:4.4.3'
}
}

allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion pfLibrary
Submodule pfLibrary updated 1 files
+7 −7 build.gradle