android n highligts
TRANSCRIPT
![Page 1: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/1.jpg)
#dfkutahya
Android N Highlights!
![Page 3: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/3.jpg)
#dfkutahya
• So many Android N Features
• ConstraintLayout
• Suprise!
• Demo
• How to Implement Some of Them in our App
![Page 4: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/4.jpg)
#dfkutahya
Multi-Window : Split Screen
android:resizeableActivity=["true" | "false"]
<activity android:name=".MyActivity"> <layout android:defaultHeight="500dp" android:defaultWidth="600dp" android:gravity="top|end" android:minHeight="450dp" android:minWidth="300dp" /> </activity>
Activity.isInMultiWindowMode()
Activity.onMultiWindowModeChanged()
Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT
![Page 5: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/5.jpg)
#dfkutahya
Multi-Window : Split Screen Intent intent = new Intent(Intent.ACTION_VIEW);intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT);
![Page 6: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/6.jpg)
#dfkutahya
Drag and Drop
Now between activities!
![Page 7: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/7.jpg)
#dfkutahya
Drag And Dropandroid.view.DragAndDropPermissions Token object responsible for specifying the permissions granted to the app that receives a drop.
View.startDragAndDrop()
View.DRAG_FLAG_GLOBAL View.DRAG_FLAG_GLOBAL_URI_READ View.DRAG_FLAG_GLOBAL_URI_WRITE
View.cancelDragAndDrop()
View.updateDragShadow()
Activity.requestDragAndDropPermissions() Requests the permissions for the content URIs passed with the ClipData contained in a DragEvent.
![Page 8: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/8.jpg)
#dfkutahya
Notifications
![Page 9: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/9.jpg)
#dfkutahya
Notifications• New Templates
![Page 10: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/10.jpg)
#dfkutahya
Notifications• New Templates
• Bundled Notifications
![Page 11: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/11.jpg)
#dfkutahya
Notifications• New Templates
• Bundled Notifications
• Direct reply
![Page 12: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/12.jpg)
#dfkutahya
Required notification contents
A Notification object must contain the following: • A small icon, set by setSmallIcon() • A title, set by setContentTitle() • Detail text, set by setContentText()
Notification.DecoratedCustomViewStyle()
Notification.DecoratedMediaCustomViewStyle()
Builder.setCustomContentView()
![Page 13: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/13.jpg)
#dfkutahya
Bundled Notifications
ApplicationCompat.Builder.setGroup(String);
![Page 14: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/14.jpg)
#dfkutahya
Notification priority
![Page 15: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/15.jpg)
#dfkutahya
Notification priority
NotificationCompat.Builder.setPriority()
PRIORITY_MIN (-2) PRIORITY_MAX (2) PRIORITY_DEFAULT (0)
![Page 16: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/16.jpg)
#dfkutahya
Quick Settings Tile
![Page 17: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/17.jpg)
#dfkutahya
Quick Settings Tile
![Page 18: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/18.jpg)
#dfkutahya
Quick Settings Tile
holds the state of a tile that will be displayed in Quick Settings
•TileServiceprovides the user a tile that can be added to Quick Settings
•Tile
![Page 19: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/19.jpg)
#dfkutahya
Quick Settings Tile
<service
android:name=".feature.PocketQuickSettingsTileService"
android:icon="@drawable/ic_bookmark"
android:label="@string/unread_articles"
android:permission=“android.permission
.BIND_QUICK_SETTINGS_TILE">
<intent-filter>
<action android:name=“android.service
.quicksettings.action.QS_TILE" />
</intent-filter>
</service>
![Page 20: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/20.jpg)
#dfkutahya
TileSTATE_ACTIVE
STATE_INACTIVE
STATE_UNAVAILABLE
describeContents()
getContentDescription()
getIcon()
getLabel()
getState()setContentDescription (CharSequence contentDescription)
setLabel(CharSequence label)
setIcon(Icon icon)
setState(int state)
updateTile()
![Page 21: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/21.jpg)
#dfkutahya
TileService
![Page 22: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/22.jpg)
#dfkutahya
TileService
![Page 23: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/23.jpg)
#dfkutahya
TileService
![Page 24: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/24.jpg)
#dfkutahya
TileService
![Page 25: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/25.jpg)
#dfkutahya
Doze Mode
![Page 26: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/26.jpg)
#dfkutahya
Data Saver
![Page 27: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/27.jpg)
#dfkutahya
ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
if (connMgr.isActiveNetworkMetered()) {
switch (connMgr.getRestrictBackgroundStatus) {
case RESTRICT_BACKGROUND_STATUS_ENABLED: // background data blocked, use less data in foreground
too break;
case RESTRICT_BACKGROUND_STATUS_WHITELISTED: // App should limit usage in fg and bg
break;
case RESTRICT_BACKGROUND_STATUS_DISABLED: // data saver disabled, but still on metered network
break; }
Data Saver
![Page 28: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/28.jpg)
#dfkutahya
Display Size
![Page 29: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/29.jpg)
#dfkutahya
Multi Local
• User can select multiple languages
• Order them
• Also added new languages, variants
![Page 30: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/30.jpg)
#dfkutahya
ACTION_USER_UNLOCKED
Direct Boot
![Page 31: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/31.jpg)
#dfkutahya
•Scoped Directory Access
•Number Blocking
•Call Screening
• Project Svelte: Background Optimizations
•OpenGL™ ES 3.2 & Vulkan API
![Page 32: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/32.jpg)
#dfkutahya
ConstraintLayout
![Page 33: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/33.jpg)
#dfkutahya
ConstraintLayout
● Designed to reduce nesting ● Small - 100 kb ● Compatible since Gingerbread(2.3) (%99.9 percent of
devices) ● First Layout in conjunction with tool (Android Studio) ● Designed to reduce nesting
![Page 34: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/34.jpg)
#dfkutahya
1. Ensure you have the latest Android Support Repository (version 32 or higher): a. Click Tools > Android > SDK Manager. b. Click the SDK Tools tab. c. Select Android Support Repository, then click OK.
2. Add the Constraint Layout library as a dependency in your build.gradle file: dependencies { compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha5'}
3. In the toolbar or sync notification, click Sync Project with Gradle Files.——
To add a new constraint layout to your project: 1. Right-click on your module's layout directory, then click New > XML > Layout XML. 2. Enter a name for the layout and enter "android.support.constraint.ConstraintLayout" for the Root
Tag. 3. Click Finish.
![Page 35: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/35.jpg)
#dfkutahya
![Page 36: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/36.jpg)
#dfkutahya
![Page 37: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/37.jpg)
#dfkutahya
Creating Manual Constraints
![Page 38: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/38.jpg)
#dfkutahya
AutoConnect
![Page 39: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/39.jpg)
#dfkutahya
AutoConnect
![Page 40: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/40.jpg)
#dfkutahya
Infer Constraints
![Page 41: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/41.jpg)
#dfkutahya
ConstraintLayout
![Page 42: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/42.jpg)
#dfkutahya
Layout Inspector
![Page 43: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/43.jpg)
#dfkutahya
Layout Inspector
Delete Constraint
Positioning the widget relative to constraints
Horizontal - vertical bias
![Page 44: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/44.jpg)
#dfkutahya
Layout Inspector Inner Dimensions
Wrap Content
Any Size
Fixed
![Page 45: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/45.jpg)
#dfkutahya
Handling Visibility
Invisible
Gone
![Page 46: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/46.jpg)
#dfkutahya
constraint_layout_devfest.xml
<ImageView android:src="@android:drawable/btn_star" android:layout_width="0dp" android:layout_height="267dp" android:id="@+id/imageView" android:layout_marginBottom="16dp" android:layout_marginStart="16dp" android:layout_marginTop="16dp" android:layout_marginEnd="16dp" app:layout_constraintLeft_toLeftOf="@+id/constraintLayout" app:layout_constraintTop_toTopOf="@+id/constraintLayout" app:layout_constraintRight_toRightOf="@+id/constraintLayout" app:layout_constraintBottom_toBottomOf="@+id/constraintLayout" tools:layout_constraintLeft_creator="1" tools:layout_constraintTop_creator="1" tools:layout_constraintRight_creator="1" />
standard
already know
important
only for Android Studio
![Page 47: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/47.jpg)
#dfkutahya
ConstraintLayout Attributes ● layout_constraintTop_toTopOf — Align the top of the desired view to the top of another.
● layout_constraintTop_toBottomOf — Align the top of the desired view to the bottom of another.
● layout_constraintBottom_toTopOf — Align the bottom of the desired view to the top of another.
● layout_constraintBottom_toBottomOf — Align the bottom of the desired view to the bottom of another.
● layout_constraintLeft_toTopOf — Align the left of the desired view to the top of another.
● layout_constraintLeft_toBottomOf — Align the left of the desired view to the bottom of another.
● layout_constraintLeft_toLeftOf — Align the left of the desired view to the left of another.
● layout_constraintLeft_toRightOf — Align the left of the desired view to the right of another.
● layout_constraintRight_toTopOf — Align the right of the desired view to the top of another.
● layout_constraintRight_toBottomOf — Align the right of the desired view to the bottom of another.
● layout_constraintRight_toLeftOf — Align the right of the desired view to the left of another.
● layout_constraintRight_toRightOf — Align the right of the desired view to the right of another.
![Page 48: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/48.jpg)
#dfkutahya
Demo!!!!
![Page 49: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/49.jpg)
#dfkutahya
Android Nougat 7.1
![Page 50: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/50.jpg)
#dfkutahya
Using Static Shortcuts
![Page 51: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/51.jpg)
#dfkutahya
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.myapplication"> <application ... > <activity android:name="Main"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <meta-data android:name="android.app.shortcuts" android:resource="@xml/shortcuts" /> </activity> </application> </manifest>
Using Static Shortcuts
![Page 52: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/52.jpg)
#dfkutahya
![Page 53: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/53.jpg)
#dfkutahya
Using Dynamic Shortcuts
Dynamic shortcuts should provide links to specific, context-sensitive actions within your app. These actions can change between uses of your app, and they can change even while your app is running. Good candidates for dynamic shortcuts include calling a specific person, navigating to a specific location, and viewing the current score for a specific game.
![Page 54: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/54.jpg)
#dfkutahya
The ShortcutManager API allows you to complete the following operations on dynamic shortcuts:
• Publish: Use setDynamicShortcuts(List) to redefine the entire list of dynamic shortcuts, or use addDynamicShortcuts(List) to augment an existing list of dynamic shortcuts.
• Update: Use the updateShortcuts(List) method.
• Remove: Remove a set of dynamic shortcuts using removeDynamicShortcuts(List), or remove all dynamic shortcuts using removeAllDynamicShortcuts().
![Page 55: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/55.jpg)
#dfkutahya
![Page 56: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/56.jpg)
#dfkutahya
Image Keyboard Support
![Page 57: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/57.jpg)
#dfkutahya
• Enhanced Live Wallpaper Metadata
• Round Icon Resources
When a launcher requests an app icon, the framework returns either android:icon or android:roundIcon, depending on the device build configuration.
![Page 58: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/58.jpg)
#dfkutahya
• Storage Manager Intent
• Improved VR Thread Scheduling
• Demo User HintApps can now check to see if the device is running as the demo user.
• APIs for Carriers and Calling Apps
• New Screen Densities for Wear Devices
• DENSITY_260
• DENSITY_300
• DENSITY_340
![Page 59: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/59.jpg)
#dfkutahya
Questions ?
![Page 60: Android N Highligts](https://reader036.vdocuments.net/reader036/viewer/2022081605/58707fa41a28ab57368b60df/html5/thumbnails/60.jpg)
#dfkutahya
• https://developer.android.com/about/versions/nougat/android-7.0.html
• https://developer.android.com/preview/api-overview.html
• https://www.youtube.com/watch?v=B08iLAtS3AQ&index=5&list=PLOU2XLYxmsILe6_
• https://www.youtube.com/watch?v=sO9aX87hq9c&list=PLWz5rJ2EKKc8jQTUYvIfqA9lMvSGQWtte&index=39