File tree Expand file tree Collapse file tree 8 files changed +69
-7
lines changed
android/views/notifications
example/snippet/views/appwidget Expand file tree Collapse file tree 8 files changed +69
-7
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ plugins {
18
18
}
19
19
20
20
android {
21
- namespace = " com.example.example.snippet .views"
21
+ namespace = " com.example.android .views"
22
22
compileSdk = 35
23
23
24
24
defaultConfig {
@@ -48,6 +48,8 @@ android {
48
48
49
49
dependencies {
50
50
51
+ implementation(" androidx.core:core:1.13.1" )
52
+ implementation(" androidx.appcompat:appcompat:1.6.1" )
51
53
implementation(libs.androidx.core.ktx)
52
54
implementation(libs.androidx.appcompat)
53
55
implementation(libs.google.android.material)
Original file line number Diff line number Diff line change 15
15
limitations under the License.
16
16
-->
17
17
<manifest xmlns : android =" http://schemas.android.com/apk/res/android" >
18
-
18
+ <application >
19
+ <activity android : name =" .notifications.NotificationSnippets$MainActivity"
20
+ android : exported =" true" >
21
+ <intent-filter >
22
+ <action android : name =" android.intent.action.MAIN" />
23
+ <category android : name =" android.intent.category.LAUNCHER" />
24
+ </intent-filter >
25
+ </activity >
26
+ </application >
19
27
</manifest >
Original file line number Diff line number Diff line change
1
+ package com .example .android .views .notifications ;
2
+
3
+ import android .app .Activity ;
4
+ import android .os .Bundle ;
5
+ import androidx .core .app .NotificationCompat ;
6
+ import com .example .android .views .R ;
7
+
8
+ public class NotificationSnippets {
9
+ private static final String CHANNEL_ID = "channel_id" ;
10
+ private static final String textTitle = "Notification Title" ;
11
+ private static final String textContent = "Notification Content" ;
12
+
13
+ public static class MainActivity extends Activity {
14
+ @ Override
15
+ protected void onCreate (Bundle savedInstanceState ) {
16
+ super .onCreate (savedInstanceState );
17
+ // [START android_views_notifications_build_basic]
18
+ NotificationCompat .Builder builder = new NotificationCompat .Builder (this , CHANNEL_ID )
19
+ .setSmallIcon (R .drawable .notification_icon )
20
+ .setContentTitle (textTitle )
21
+ .setContentText (textContent )
22
+ .setPriority (NotificationCompat .PRIORITY_DEFAULT );
23
+ // [END android_views_notifications_build_basic]
24
+ }
25
+ }
26
+ }
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ import android.widget.RemoteViews
25
25
import androidx.glance.GlanceId
26
26
import androidx.glance.appwidget.GlanceAppWidget
27
27
import androidx.glance.appwidget.compose
28
- import com.example.example.snippet .views.R
28
+ import com.example.android .views.R
29
29
30
30
class ExampleAppWidget : GlanceAppWidget () {
31
31
override suspend fun provideGlance (context : Context , id : GlanceId ) {
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ import androidx.core.view.ViewCompat
25
25
import androidx.core.view.WindowInsetsCompat
26
26
import androidx.core.view.insets.GradientProtection
27
27
import androidx.core.view.insets.ProtectionLayout
28
- import com.example.example.snippet .views.R
28
+ import com.example.android .views.R
29
29
30
30
class SystemBarProtectionSnippet : AppCompatActivity () {
31
31
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" utf-8" ?>
2
+ <!--
3
+ Copyright 2025 The Android Open Source Project
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ https://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+ -->
17
+ <shape xmlns : android =" http://schemas.android.com/apk/res/android"
18
+ android : shape =" rectangle" >
19
+ <solid android : color =" #FF0000" />
20
+ <size android : width =" 24dp"
21
+ android : height =" 24dp" />
22
+ </shape >
Original file line number Diff line number Diff line change @@ -22,6 +22,10 @@ plugins {
22
22
application
23
23
}
24
24
25
+ kotlin {
26
+ jvmToolchain(17 )
27
+ }
28
+
25
29
application {
26
30
mainClass.set(" com.example.validator.Main" )
27
31
}
Original file line number Diff line number Diff line change @@ -16,11 +16,11 @@ android {
16
16
versionName = " 1.0"
17
17
}
18
18
compileOptions {
19
- sourceCompatibility = JavaVersion .VERSION_11
20
- targetCompatibility = JavaVersion .VERSION_11
19
+ sourceCompatibility = JavaVersion .VERSION_17
20
+ targetCompatibility = JavaVersion .VERSION_17
21
21
}
22
22
kotlin {
23
- jvmToolchain(11 )
23
+ jvmToolchain(17 )
24
24
}
25
25
buildFeatures {
26
26
compose = true
You can’t perform that action at this time.
0 commit comments