Skip to content

Commit 49c7f1a

Browse files
committed
Refactor sample
1 parent 09b1be3 commit 49c7f1a

File tree

6 files changed

+17
-11
lines changed

6 files changed

+17
-11
lines changed

BluetoothLeChat/app/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ dependencies {
5555
implementation fileTree(dir: "libs", include: ["*.jar"])
5656
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
5757
implementation 'androidx.core:core-ktx:1.3.2'
58-
implementation 'androidx.fragment:fragment-ktx:1.3.3'
59-
implementation 'androidx.activity:activity-ktx:1.3.0-alpha07'
58+
implementation 'androidx.fragment:fragment-ktx:1.3.4'
59+
implementation 'androidx.activity:activity-ktx:1.3.0-alpha08'
6060
implementation 'androidx.appcompat:appcompat:1.2.0'
6161
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
6262
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'

BluetoothLeChat/app/src/main/java/com/example/bluetoothlechat/bluetooth/ChatServer.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
@file:Suppress("ObjectPropertyName")
17+
1618
package com.example.bluetoothlechat.bluetooth
1719

1820
import android.app.Application
@@ -305,7 +307,7 @@ object ChatServer {
305307
super.onStartFailure(errorCode)
306308
// Send error state to display
307309
val errorMessage = "Advertise failed with error: $errorCode"
308-
Log.d(TAG, "Advertising failed")
310+
Log.d(TAG, errorMessage)
309311
//_viewState.value = DeviceScanViewState.Error(errorMessage)
310312
}
311313

BluetoothLeChat/app/src/main/res/layout/fragment_bluetooth_chat.xml

+4-1
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,11 @@
6161

6262
<EditText
6363
android:id="@+id/message_text"
64+
android:inputType="text"
65+
android:hint="@string/enter_message"
6466
android:layout_width="match_parent"
65-
android:layout_height="wrap_content" />
67+
android:layout_height="wrap_content"
68+
android:importantForAutofill="no" />
6669

6770
<Button
6871
android:id="@+id/send_message"

BluetoothLeChat/app/src/main/res/values/strings.xml

+1
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@
2929
<string name="connect_device_prompt">Connect with nearby devices</string>
3030
<string name="send_message_button">Send Message</string>
3131
<string name="chatting_with_device">Chatting with %1$s</string>
32+
<string name="enter_message">enter message</string>
3233
</resources>

BluetoothLeChat/build.gradle

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
*/
1616
// Top-level build file where you can add configuration options common to all sub-projects/modules.
1717
buildscript {
18-
ext.kotlin_version = "1.4.32"
18+
ext.kotlin_version = "1.5.0"
1919
repositories {
2020
google()
21-
jcenter()
21+
mavenCentral()
2222
}
2323
dependencies {
24-
classpath 'com.android.tools.build:gradle:4.1.3'
24+
classpath 'com.android.tools.build:gradle:4.2.0'
2525
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
2626
// NOTE: Do not place your application dependencies here; they belong
2727
// in the individual module build.gradle files
@@ -31,7 +31,7 @@ buildscript {
3131
allprojects {
3232
repositories {
3333
google()
34-
jcenter()
34+
mavenCentral()
3535
}
3636
}
3737

Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Thu Sep 03 12:48:38 EDT 2020
1+
#Wed May 19 13:24:30 EDT 2021
22
distributionBase=GRADLE_USER_HOME
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
34
distributionPath=wrapper/dists
4-
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
6+
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)