Share
Embed
Transcript
38 slides
-
Put the pieces of the puzzle together... To create something
beautiful , user friendly & serves a purpose -
Challenges in Android Dev • Tons of Boilerplate Code •
Clean Architecture • Testing • Backward compatibility -
Who wants to build robust high quality production ready apps
in an accelerated manner? -
What is it? • Collection of individual software components -
libraries and tools • Independently adoptable • Built to work together • Unbundled from Platform APIs -
FOUNDATION AppCompat Android KTX Multidex Testing * Core System Components
*Kotlin *Backward Compatibility *Testing Libraries -
UI Layout Fragment Palette Emoji Animations and Transitions Auto TV
Wear * Widgets and helpers *Easy to use *Enhanced User experience -
ARCHITECTURE Lifecycles Livedata Paging Navigation WorkManager Room Viewmodel Data Binding
*Clean & Recommended *Data Management *Robust, scalable & Maintainable -
BEHAVIOUR Notifications Permissions Sharing Slices Media & Playback Download Manager
* Integrate with other Android services *help interact with user -
Foundation UI Architecture Behaviour Easier to Develop Follow Best Practices
Reduces Boilerplate code Simplify tasks Reduces Memory crashes Lessens memory leaks -
Concentrate on the nitty gritty of Android platform Focus on
the Code you actually care about -
AndroidX New improved Android Support Library with consistent Namespacing ,
faster updates , feature parity & new libraries androidx.* androidx.<feature>.ClassName androidx.<feature>:<feature>-<sub-feature> -
Migrate to AndroidX gradle.properties file : Changes in Package and
Maven Artifact names https://developer.android.com/jetpack/androidx/migrate -
FOUNDATION AppCompat Android KTX Multidex Testing * Core System Components
*Kotlin *Backward Compatibility *Testing Libraries -
Android KTX Kotlin Extension Function Null Safety Default & named
arguments Higher order functions Smart Cast Leverages Kotlin Features Optimizes Android APIs with Kotlin Makes Android Development - concise - enjoyable - intuitive lambdas -
Android KTX Parse a string to a URI val uri
= Uri.parse(custom_string) Val uri = custom_string.toUri() import android.view.Menu import androidx.core.view.get import androidx.core.view.minusAssign fun myFunction(menu : Menu) { val firstMenuItem = menu[0] //Gets the first menu item. menu -= firstMenuItem // Removes the menu item } Menu Class • Core KTX • Fragment KTX • Palette KTX • Collections KTX • SQLite KTX • Navigation KTX Build.gradle implementation "androidx.core:core-ktx:$androidx_version" -
UI Layout Fragment Palette Emoji Animations and Transitions Auto TV
Wear * Widgets and helpers *Easy to use *Enhanced User experience -
Responsive Layout ViewGroup View View ViewGroup View View <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/root_view"
android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/margin"> -
Fragment • Dynamic and Flexible UI Designs • Support different
screens • Reusable UI components 1. implementation 'androidx.fragment:fragment-ktx:$currentVersion' supportFragmentManager.transaction(now = false, allowStateLoss = false) { replace(R.id.frag_container, myFragment,FRAGMENT_TAG) } -
Palette API 1. • Vibrant color schemes • Visually appealing
• Pick and choose • Various layout themes fun createPaletteSync(bitmap: Bitmap): Palette = Palette.from(bitmap).generate() fun createPaletteAsync(bitmap: Bitmap) { Palette.from(bitmap).generate { palette -> // Use generated instance } } -
Emoji Compat 1. • Device up to date with Latest
• No need to wait for OS updates • Prevents showing missing ✋ • Identifies emoji for a given CharSequence, replaces them with EmojiSpan & renders ✅ -
Animations 1. Visual Cue to notify users of changes! •
Informative • Focus • Expressive -
ARCHITECTURE Lifecycles Livedata Paging Navigation WorkManager Room Viewmodel Data Binding
*Clean & Recommended *Data Management *Robust, scalable & Maintainable -
Architecture Components • Separation of concerns • Drive UI from
model • Persistence of data • Independent testing -
Paging ➔ Lazy Loading of Data ➔ Economical use of
system resources ➔ Responsive to the user input without a lag DataSource DataSource Factory ViewModel PagedList PagedList Adapter -
Navigation ❖ Actions ❖ Animations ❖ Up/Back Behavior ❖ Passing
Arguments ❖ Deep Links -
Data Binding Bind UI elements to the data sources programmatically
UI Framework methods findViewById() Bind UI elements to the data sources in a declarative format Remove UI Framework methods <TextView android:text="@{viewmodel.userName}" /> -
BEHAVIOUR Notifications Permissions Sharing Slices Media & Playback Download Manager
* Integrate with other Android services *help interact with user -
Want to download something? Download Manager • System service •
Handles HTTP Downloads • Background • Handles interactions • Takes care of retrying Want to share something? ShareActionProvider • Menu item • Handles appearance & behaviour • Needs a share intent -
Want to Notify user? NotificationCompat • Info to user outside
App • Informative/action oriented • Timely reminders • Frequent interruptions are annoying Permissions <uses-permission> • Privacy of user • Permission to access sensitive user data • Dangerous permission on demand -
Slices Embed App content in Google Search through flexible templates
Templated Show relevant app content in a dynamic, app theme user interface Interactive Enable user to perform inline, app actions, deep link, update, toggle Modular -
DevFest MN App 2019 Data --------- --------- --------- --------- ---------
------- ----- User Interface Repository Model View ViewModel Livedata Room Fragments Animations Layouts Navigation Caching Notifications ShareActionProvider -
Android Jetpack has all the pieces needed for putting together
the app Choose and pick the ones you need, integrate App is Ready in no time!