SlideShare a Scribd company logo
Android Wear
Douglas Drumond
douglas@cafelinear.com
Background
≠
⦸
Coding
Not Coding
Notifications
Notifications
Notifications
Notifications
Nada a ser feito
Enhanced notifications
Enhanced notifications
Nada a ser feito
Coding
Ação só p/ relógio
// Create an intent for the reply action
Intent actionIntent = new Intent(this, ActionActivity.class);
PendingIntent actionPendingIntent =
        PendingIntent.getActivity(this, 0, actionIntent,
                PendingIntent.FLAG_UPDATE_CURRENT);
// Create the action
NotificationCompat.Action action =
        new NotificationCompat.Action.Builder(R.drawable.ic_action,
                getString(R.string.label), actionPendingIntent)
                .build();
// Build the notification and add the action via WearableExtender
Notification notification =
        new NotificationCompat.Builder(mContext)
                .setSmallIcon(R.drawable.ic_message)
                .setContentTitle(getString(R.string.title))
                .setContentText(getString(R.string.content))
                .extend(new WearableExtender().addAction(action))
                .build();
Ação só p/ relógio
// Create an intent for the reply action
Intent actionIntent = new Intent(this, ActionActivity.class);
PendingIntent actionPendingIntent =
        PendingIntent.getActivity(this, 0, actionIntent,
                PendingIntent.FLAG_UPDATE_CURRENT);
// Create the action
NotificationCompat.Action action =
        new NotificationCompat.Action.Builder(R.drawable.ic_action,
                getString(R.string.label), actionPendingIntent)
                .build();
// Build the notification and add the action via WearableExtender
Notification notification =
        new NotificationCompat.Builder(mContext)
                .setSmallIcon(R.drawable.ic_message)
                .setContentTitle(getString(R.string.title))
                .setContentText(getString(R.string.content))
                .extend(new WearableExtender().addAction(action))
                .build();
Voz
// Key for the string that's delivered in the action's intent
private static final String EXTRA_VOICE_REPLY = "extra_voice_reply";
String replyLabel = getResources().getString(R.string.reply_label);
RemoteInput remoteInput = new RemoteInput.Builder(EXTRA_VOICE_REPLY)
        .setLabel(replyLabel)
        .build();
Voz com opções
public static final String EXTRA_VOICE_REPLY = "extra_voice_reply";
...
String replyLabel = getResources().getString(R.string.reply_label);
String[] replyChoices =
getResources().getStringArray(R.array.reply_choices);
RemoteInput remoteInput = new RemoteInput.Builder(EXTRA_VOICE_REPLY)
        .setLabel(replyLabel)
        .setChoices(replyChoices)
        .build();
Voz// Create an intent for the reply action
Intent replyIntent = new Intent(this, ReplyActivity.class);
PendingIntent replyPendingIntent =
        PendingIntent.getActivity(this, 0, replyIntent,
                PendingIntent.FLAG_UPDATE_CURRENT);
// Create the reply action and add the remote input
NotificationCompat.Action action =
        new NotificationCompat.Action.Builder(R.drawable.ic_reply_icon,
                getString(R.string.label), replyPendingIntent)
                .addRemoteInput(remoteInput)
                .build();
// Build the notification and add the action via WearableExtender
Notification notification =
        new NotificationCompat.Builder(mContext)
                .setSmallIcon(R.drawable.ic_message)
                .setContentTitle(getString(R.string.title))
                .setContentText(getString(R.string.content))
                .extend(new WearableExtender().addAction(action))
                .build();
Voz// Create an intent for the reply action
Intent replyIntent = new Intent(this, ReplyActivity.class);
PendingIntent replyPendingIntent =
        PendingIntent.getActivity(this, 0, replyIntent,
                PendingIntent.FLAG_UPDATE_CURRENT);
// Create the reply action and add the remote input
NotificationCompat.Action action =
        new NotificationCompat.Action.Builder(R.drawable.ic_reply_icon,
                getString(R.string.label), replyPendingIntent)
                .addRemoteInput(remoteInput)
                .build();
// Build the notification and add the action via WearableExtender
Notification notification =
        new NotificationCompat.Builder(mContext)
                .setSmallIcon(R.drawable.ic_message)
                .setContentTitle(getString(R.string.title))
                .setContentText(getString(R.string.content))
                .extend(new WearableExtender().addAction(action))
                .build();
Voz
private CharSequence getMessageText(Intent intent) {
    Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
    if (remoteInput != null) {
        return remoteInput.getCharSequence(EXTRA_VOICE_REPLY);
    }
    return null;
}
Paginação
Paginação
NotificationCompat.Builder notificationBuilder =
        new NotificationCompat.Builder(this)
        .setSmallIcon(R.drawable.new_message)
        .setContentTitle("Page 1")
        .setContentText("Short message")
        .setContentIntent(viewPendingIntent);
Paginação
BigTextStyle secondPageStyle = new NotificationCompat.BigTextStyle();
secondPageStyle.setBigContentTitle("Page 2")
               .bigText("A lot of text...");
// Create second page notification
Notification secondPageNotification =
        new NotificationCompat.Builder(this)
        .setStyle(secondPageStyle)
        .build();
Paginação
// Extend the notification builder with the second page
Notification notification = notificationBuilder
        .extend(new NotificationCompat.WearableExtender()
                .addPage(secondPageNotification))
        .build();
Paginação
// Extend the notification builder with the second page
Notification notification = notificationBuilder
        .extend(new NotificationCompat.WearableExtender()
                .addPage(secondPageNotification))
        .build();
Pilha
Pilha
setGroup com mesmo ID
Pilha
Notification notif = new NotificationCompat.Builder(mContext)
         .setContentTitle("New mail from " + sender1)
         .setContentText(subject1)
         .setSmallIcon(R.drawable.new_mail)
         .setGroup(GROUP_KEY_EMAILS)
         .build();
…
Notification notif2 = new NotificationCompat.Builder(mContext)
         .setContentTitle("New mail from " + sender2)
         .setContentText(subject2)
         .setSmallIcon(R.drawable.new_mail)
         .setGroup(GROUP_KEY_EMAILS)
         .build();
Pilha
Notification notif = new NotificationCompat.Builder(mContext)
         .setContentTitle("New mail from " + sender1)
         .setContentText(subject1)
         .setSmallIcon(R.drawable.new_mail)
         .setGroup(GROUP_KEY_EMAILS)
         .build();
…
Notification notif2 = new NotificationCompat.Builder(mContext)
         .setContentTitle("New mail from " + sender2)
         .setContentText(subject2)
         .setSmallIcon(R.drawable.new_mail)
         .setGroup(GROUP_KEY_EMAILS)
         .build();
Wearable Apps
O que não tem
• android.webkit
• android.print
• android.app.backup
• android.appwidget
• android.hardware.usb
Requisitos
• SDK tools versão 23.0.0 ou superior
• SDK Android 4.4W (API 20)
Custom notification
public void onCreate(Bundle bundle){
    ...
    setContentView(R.layout.notification_activity);
}
<activity android:name="com.example.NotificationActivity"
     android:exported="true"
     android:allowEmbedded="true"
     android:theme="@android:style/Theme.DeviceDefault.Light" />
Intent notificationIntent = new Intent(this,
NotificationActivity.class);
PendingIntent notificationPendingIntent =
PendingIntent.getActivity(this, 0, notificationIntent,
        PendingIntent.FLAG_UPDATE_CURRENT);
Layouts
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <TextView
        android:id="@+id/text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello_square" />
</LinearLayout>
Layouts
Layouts
compile 'com.google.android.support:wearable:+'
Layouts
<android.support.wearable.view.WatchViewStub
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/watch_view_stub"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:rectLayout="@layout/rect_activity_wear"
    app:roundLayout="@layout/round_activity_wear">
</android.support.wearable.view.WatchViewStub>
Layouts
<android.support.wearable.view.WatchViewStub
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/watch_view_stub"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:rectLayout="@layout/rect_activity_wear"
    app:roundLayout="@layout/round_activity_wear">
</android.support.wearable.view.WatchViewStub>
Layouts
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_wear);
}
⛔
Layouts
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_wear);
    WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
    stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
        @Override public void onLayoutInflated(WatchViewStub stub) {
            // Now you can access your views
            TextView tv = (TextView) stub.findViewById(R.id.text);
            ...
        }
    });
}
Layouts
WatchViewStub stub = (WatchViewStub)
findViewById(R.id.watch_view_stub);
stub.setOnLayoutInflatedListener(new
WatchViewStub.OnLayoutInflatedListener() {
    @Override
public void onLayoutInflated(WatchViewStub stub) {
    // Now you can access your views
    TextView tv = (TextView) stub.findViewById(R.id.text);
    ...
}
});
Layouts
<android.support.wearable.view.BoxInsetLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_height="match_parent"
    android:layout_width=“match_parent>
…
</android.support.wearable.view.BoxInsetLayout>
Layouts
Layouts
• android.support.wearable.view.BoxInsetLayout
• android.support.wearable.view.CardScrollView
• android.support.wearable.view.CardFrame
• android.support.wearable.view.WearableListView
• WearableListView.Adapter
Confirmação
Confirmation
• DelayedConfirmationView

// Two seconds to cancel the action
mDelayedView.setTotalTimeMs(2000);
// Start the timer
mDelayedView.start();
• DelayedConfirmationListener
public void onTimerFinished(View view); // Usuário
não cancelou, continue
public void onTimerSelected(View view); // Usuário
cancelou, abortar


Fechando
• Default: swipe da esquerda
• Pode ser desabilitado
• Long press
Fechando
<style name="AppTheme" parent="Theme.DeviceDefault">
    <item name="android:windowSwipeToDismiss">false</item>
</style>
Fechando
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="match_parent"
    android:layout_width="match_parent">
    <!-- resto do layout -->
    <android.support.wearable.view.DismissOverlayView
        android:id="@+id/dismiss_overlay"
        android:layout_height="match_parent"
        android:layout_width="match_parent"/>
<FrameLayout>
Fechando
mDismissOverlay =
(DismissOverlayView) findViewById(R.id.dismiss_overlay);
mDismissOverlay.setIntroText(R.string.long_press_intro);
mDismissOverlay.showIntroIfNecessary();
// Configure a gesture detector
mDetector = new GestureDetector(this,
new SimpleOnGestureListener() {
public void onLongPress(MotionEvent ev) {
    mDismissOverlay.show();
}
});
O que mais?
• Transferência de dados entre wearable e device:
• Wearable Data Layer
• Watch Face:
• CanvasWatchFaceService,
CanvasWatchFaceService.Engine…
Próximos passos?
• http://developer.android.com/wear/
WatchFace
• https://github.com/ustwo/Clockwise
• http://wear.ustwo.com
Obrigado
Obrigado
+DouglasDrumond
@douglasdrumond
www.cafelinear.com
douglas@cafelinear.com
+GdgCampinasOrg
@gdgcampinas
www.gdg-campinas.org

More Related Content

Similar to Android wear (coding)

Local Notification Tutorial
Local Notification TutorialLocal Notification Tutorial
Local Notification Tutorial
Ketan Raval
 
Slightly Advanced Android Wear ;)
Slightly Advanced Android Wear ;)Slightly Advanced Android Wear ;)
Slightly Advanced Android Wear ;)
Alfredo Morresi
 
Developing for android wear
Developing for android wearDeveloping for android wear
Developing for android wear
Thomas Oldervoll
 
Android For All The Things
Android For All The ThingsAndroid For All The Things
Android For All The Things
Paul Trebilcox-Ruiz
 
Session #8 adding magic to your app
Session #8  adding magic to your appSession #8  adding magic to your app
Session #8 adding magic to your app
Vitali Pekelis
 
Android Wear Development
Android Wear DevelopmentAndroid Wear Development
Android Wear Development
Takahiro (Poly) Horikawa
 
Introduction to Android Wear
Introduction to Android WearIntroduction to Android Wear
Introduction to Android Wear
Peter Friese
 
Getting Ready For Android Wear
Getting Ready For Android WearGetting Ready For Android Wear
Getting Ready For Android Wear
Raveesh Bhalla
 
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
mharkus
 
Notification android
Notification androidNotification android
Notification android
ksheerod shri toshniwal
 
Introduction to Android Wear
Introduction to Android WearIntroduction to Android Wear
Introduction to Android Wear
gabrielemariotti
 
Android Wearables ii
Android Wearables iiAndroid Wearables ii
Android Wearables ii
Ketan Raval
 
Dependency Injection for Android @ Ciklum speakers corner Kiev 29. May 2014
Dependency Injection for Android @ Ciklum speakers corner Kiev 29. May 2014Dependency Injection for Android @ Ciklum speakers corner Kiev 29. May 2014
Dependency Injection for Android @ Ciklum speakers corner Kiev 29. May 2014
First Tuesday Bergen
 
Dependency Injection for Android
Dependency Injection for AndroidDependency Injection for Android
Dependency Injection for Android
First Tuesday Bergen
 
Scala on Your Phone
Scala on Your PhoneScala on Your Phone
Scala on Your Phone
Michael Galpin
 
Exercises broadcast receiver,incoming phone call
Exercises broadcast receiver,incoming phone callExercises broadcast receiver,incoming phone call
Exercises broadcast receiver,incoming phone call
maamir farooq
 
Dicoding Developer Coaching #22: Android | Cara Membuat Notifikasi di Aplikas...
Dicoding Developer Coaching #22: Android | Cara Membuat Notifikasi di Aplikas...Dicoding Developer Coaching #22: Android | Cara Membuat Notifikasi di Aplikas...
Dicoding Developer Coaching #22: Android | Cara Membuat Notifikasi di Aplikas...
DicodingEvent
 
Creating a Facebook Clone - Part XIV - Transcript.pdf
Creating a Facebook Clone - Part XIV - Transcript.pdfCreating a Facebook Clone - Part XIV - Transcript.pdf
Creating a Facebook Clone - Part XIV - Transcript.pdf
ShaiAlmog1
 
Package org dev
Package org devPackage org dev
Package org dev
jaya lakshmi
 

Similar to Android wear (coding) (20)

Local Notification Tutorial
Local Notification TutorialLocal Notification Tutorial
Local Notification Tutorial
 
Slightly Advanced Android Wear ;)
Slightly Advanced Android Wear ;)Slightly Advanced Android Wear ;)
Slightly Advanced Android Wear ;)
 
Developing for android wear
Developing for android wearDeveloping for android wear
Developing for android wear
 
Android For All The Things
Android For All The ThingsAndroid For All The Things
Android For All The Things
 
Session #8 adding magic to your app
Session #8  adding magic to your appSession #8  adding magic to your app
Session #8 adding magic to your app
 
Android Wear Development
Android Wear DevelopmentAndroid Wear Development
Android Wear Development
 
Introduction to Android Wear
Introduction to Android WearIntroduction to Android Wear
Introduction to Android Wear
 
Getting Ready For Android Wear
Getting Ready For Android WearGetting Ready For Android Wear
Getting Ready For Android Wear
 
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
 
Notification android
Notification androidNotification android
Notification android
 
Introduction to Android Wear
Introduction to Android WearIntroduction to Android Wear
Introduction to Android Wear
 
Android Wearables ii
Android Wearables iiAndroid Wearables ii
Android Wearables ii
 
Dependency Injection for Android @ Ciklum speakers corner Kiev 29. May 2014
Dependency Injection for Android @ Ciklum speakers corner Kiev 29. May 2014Dependency Injection for Android @ Ciklum speakers corner Kiev 29. May 2014
Dependency Injection for Android @ Ciklum speakers corner Kiev 29. May 2014
 
Dependency Injection for Android
Dependency Injection for AndroidDependency Injection for Android
Dependency Injection for Android
 
Scala on Your Phone
Scala on Your PhoneScala on Your Phone
Scala on Your Phone
 
Exercises broadcast receiver,incoming phone call
Exercises broadcast receiver,incoming phone callExercises broadcast receiver,incoming phone call
Exercises broadcast receiver,incoming phone call
 
Dicoding Developer Coaching #22: Android | Cara Membuat Notifikasi di Aplikas...
Dicoding Developer Coaching #22: Android | Cara Membuat Notifikasi di Aplikas...Dicoding Developer Coaching #22: Android | Cara Membuat Notifikasi di Aplikas...
Dicoding Developer Coaching #22: Android | Cara Membuat Notifikasi di Aplikas...
 
Creating a Facebook Clone - Part XIV - Transcript.pdf
Creating a Facebook Clone - Part XIV - Transcript.pdfCreating a Facebook Clone - Part XIV - Transcript.pdf
Creating a Facebook Clone - Part XIV - Transcript.pdf
 
package org dev
package org devpackage org dev
package org dev
 
Package org dev
Package org devPackage org dev
Package org dev
 

More from Douglas Drumond

[MobCamp 2014] Android Wear and Google Glass
[MobCamp 2014] Android Wear and Google Glass[MobCamp 2014] Android Wear and Google Glass
[MobCamp 2014] Android Wear and Google Glass
Douglas Drumond
 
[DevCamp 2014] Melhorando a Usabilidade com Animações
[DevCamp 2014] Melhorando a Usabilidade com Animações[DevCamp 2014] Melhorando a Usabilidade com Animações
[DevCamp 2014] Melhorando a Usabilidade com Animações
Douglas Drumond
 
[DevCamp 2014] Melhorando a usabilidade com animações
[DevCamp 2014] Melhorando a usabilidade com animações[DevCamp 2014] Melhorando a usabilidade com animações
[DevCamp 2014] Melhorando a usabilidade com animações
Douglas Drumond
 
[Unicamp Fórum Permanente] Android Faixa Branca – 2011
[Unicamp Fórum Permanente] Android Faixa Branca – 2011[Unicamp Fórum Permanente] Android Faixa Branca – 2011
[Unicamp Fórum Permanente] Android Faixa Branca – 2011
Douglas Drumond
 
[MO901] Android 下忍 – 2011
[MO901] Android 下忍 – 2011[MO901] Android 下忍 – 2011
[MO901] Android 下忍 – 2011
Douglas Drumond
 
[FLISOL] Embelezando o Android – 2013
[FLISOL] Embelezando o Android – 2013[FLISOL] Embelezando o Android – 2013
[FLISOL] Embelezando o Android – 2013
Douglas Drumond
 
[FLISOL] Android Faixa Branca (Iniciando no Android) – 2013
[FLISOL] Android Faixa Branca (Iniciando no Android) – 2013[FLISOL] Android Faixa Branca (Iniciando no Android) – 2013
[FLISOL] Android Faixa Branca (Iniciando no Android) – 2013
Douglas Drumond
 
[Faat] android faixa branca – 2012
[Faat] android faixa branca – 2012[Faat] android faixa branca – 2012
[Faat] android faixa branca – 2012
Douglas Drumond
 
[DevCamp] Layouts Flexíveis no Android – 2013
[DevCamp] Layouts Flexíveis no Android – 2013[DevCamp] Layouts Flexíveis no Android – 2013
[DevCamp] Layouts Flexíveis no Android – 2013
Douglas Drumond
 
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
Douglas Drumond
 
[Unicamp] curso vim – 2010
[Unicamp] curso vim – 2010[Unicamp] curso vim – 2010
[Unicamp] curso vim – 2010
Douglas Drumond
 

More from Douglas Drumond (11)

[MobCamp 2014] Android Wear and Google Glass
[MobCamp 2014] Android Wear and Google Glass[MobCamp 2014] Android Wear and Google Glass
[MobCamp 2014] Android Wear and Google Glass
 
[DevCamp 2014] Melhorando a Usabilidade com Animações
[DevCamp 2014] Melhorando a Usabilidade com Animações[DevCamp 2014] Melhorando a Usabilidade com Animações
[DevCamp 2014] Melhorando a Usabilidade com Animações
 
[DevCamp 2014] Melhorando a usabilidade com animações
[DevCamp 2014] Melhorando a usabilidade com animações[DevCamp 2014] Melhorando a usabilidade com animações
[DevCamp 2014] Melhorando a usabilidade com animações
 
[Unicamp Fórum Permanente] Android Faixa Branca – 2011
[Unicamp Fórum Permanente] Android Faixa Branca – 2011[Unicamp Fórum Permanente] Android Faixa Branca – 2011
[Unicamp Fórum Permanente] Android Faixa Branca – 2011
 
[MO901] Android 下忍 – 2011
[MO901] Android 下忍 – 2011[MO901] Android 下忍 – 2011
[MO901] Android 下忍 – 2011
 
[FLISOL] Embelezando o Android – 2013
[FLISOL] Embelezando o Android – 2013[FLISOL] Embelezando o Android – 2013
[FLISOL] Embelezando o Android – 2013
 
[FLISOL] Android Faixa Branca (Iniciando no Android) – 2013
[FLISOL] Android Faixa Branca (Iniciando no Android) – 2013[FLISOL] Android Faixa Branca (Iniciando no Android) – 2013
[FLISOL] Android Faixa Branca (Iniciando no Android) – 2013
 
[Faat] android faixa branca – 2012
[Faat] android faixa branca – 2012[Faat] android faixa branca – 2012
[Faat] android faixa branca – 2012
 
[DevCamp] Layouts Flexíveis no Android – 2013
[DevCamp] Layouts Flexíveis no Android – 2013[DevCamp] Layouts Flexíveis no Android – 2013
[DevCamp] Layouts Flexíveis no Android – 2013
 
[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012[Android devcamp] Android Bootcamp – 2012
[Android devcamp] Android Bootcamp – 2012
 
[Unicamp] curso vim – 2010
[Unicamp] curso vim – 2010[Unicamp] curso vim – 2010
[Unicamp] curso vim – 2010
 

Recently uploaded

Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
QuickwayInfoSystems3
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
ShamsuddeenMuhammadA
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
abdulrafaychaudhry
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 

Recently uploaded (20)

Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 

Android wear (coding)

  • 2.
  • 3.
  • 4.
  • 5.
  • 7.
  • 8.
  • 9.
  • 10.
  • 20. Ação só p/ relógio // Create an intent for the reply action Intent actionIntent = new Intent(this, ActionActivity.class); PendingIntent actionPendingIntent =         PendingIntent.getActivity(this, 0, actionIntent,                 PendingIntent.FLAG_UPDATE_CURRENT); // Create the action NotificationCompat.Action action =         new NotificationCompat.Action.Builder(R.drawable.ic_action,                 getString(R.string.label), actionPendingIntent)                 .build(); // Build the notification and add the action via WearableExtender Notification notification =         new NotificationCompat.Builder(mContext)                 .setSmallIcon(R.drawable.ic_message)                 .setContentTitle(getString(R.string.title))                 .setContentText(getString(R.string.content))                 .extend(new WearableExtender().addAction(action))                 .build();
  • 21. Ação só p/ relógio // Create an intent for the reply action Intent actionIntent = new Intent(this, ActionActivity.class); PendingIntent actionPendingIntent =         PendingIntent.getActivity(this, 0, actionIntent,                 PendingIntent.FLAG_UPDATE_CURRENT); // Create the action NotificationCompat.Action action =         new NotificationCompat.Action.Builder(R.drawable.ic_action,                 getString(R.string.label), actionPendingIntent)                 .build(); // Build the notification and add the action via WearableExtender Notification notification =         new NotificationCompat.Builder(mContext)                 .setSmallIcon(R.drawable.ic_message)                 .setContentTitle(getString(R.string.title))                 .setContentText(getString(R.string.content))                 .extend(new WearableExtender().addAction(action))                 .build();
  • 22. Voz // Key for the string that's delivered in the action's intent private static final String EXTRA_VOICE_REPLY = "extra_voice_reply"; String replyLabel = getResources().getString(R.string.reply_label); RemoteInput remoteInput = new RemoteInput.Builder(EXTRA_VOICE_REPLY)         .setLabel(replyLabel)         .build();
  • 23. Voz com opções public static final String EXTRA_VOICE_REPLY = "extra_voice_reply"; ... String replyLabel = getResources().getString(R.string.reply_label); String[] replyChoices = getResources().getStringArray(R.array.reply_choices); RemoteInput remoteInput = new RemoteInput.Builder(EXTRA_VOICE_REPLY)         .setLabel(replyLabel)         .setChoices(replyChoices)         .build();
  • 24. Voz// Create an intent for the reply action Intent replyIntent = new Intent(this, ReplyActivity.class); PendingIntent replyPendingIntent =         PendingIntent.getActivity(this, 0, replyIntent,                 PendingIntent.FLAG_UPDATE_CURRENT); // Create the reply action and add the remote input NotificationCompat.Action action =         new NotificationCompat.Action.Builder(R.drawable.ic_reply_icon,                 getString(R.string.label), replyPendingIntent)                 .addRemoteInput(remoteInput)                 .build(); // Build the notification and add the action via WearableExtender Notification notification =         new NotificationCompat.Builder(mContext)                 .setSmallIcon(R.drawable.ic_message)                 .setContentTitle(getString(R.string.title))                 .setContentText(getString(R.string.content))                 .extend(new WearableExtender().addAction(action))                 .build();
  • 25. Voz// Create an intent for the reply action Intent replyIntent = new Intent(this, ReplyActivity.class); PendingIntent replyPendingIntent =         PendingIntent.getActivity(this, 0, replyIntent,                 PendingIntent.FLAG_UPDATE_CURRENT); // Create the reply action and add the remote input NotificationCompat.Action action =         new NotificationCompat.Action.Builder(R.drawable.ic_reply_icon,                 getString(R.string.label), replyPendingIntent)                 .addRemoteInput(remoteInput)                 .build(); // Build the notification and add the action via WearableExtender Notification notification =         new NotificationCompat.Builder(mContext)                 .setSmallIcon(R.drawable.ic_message)                 .setContentTitle(getString(R.string.title))                 .setContentText(getString(R.string.content))                 .extend(new WearableExtender().addAction(action))                 .build();
  • 26. Voz private CharSequence getMessageText(Intent intent) {     Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);     if (remoteInput != null) {         return remoteInput.getCharSequence(EXTRA_VOICE_REPLY);     }     return null; }
  • 28. Paginação NotificationCompat.Builder notificationBuilder =         new NotificationCompat.Builder(this)         .setSmallIcon(R.drawable.new_message)         .setContentTitle("Page 1")         .setContentText("Short message")         .setContentIntent(viewPendingIntent);
  • 29. Paginação BigTextStyle secondPageStyle = new NotificationCompat.BigTextStyle(); secondPageStyle.setBigContentTitle("Page 2")                .bigText("A lot of text..."); // Create second page notification Notification secondPageNotification =         new NotificationCompat.Builder(this)         .setStyle(secondPageStyle)         .build();
  • 30. Paginação // Extend the notification builder with the second page Notification notification = notificationBuilder         .extend(new NotificationCompat.WearableExtender()                 .addPage(secondPageNotification))         .build();
  • 31. Paginação // Extend the notification builder with the second page Notification notification = notificationBuilder         .extend(new NotificationCompat.WearableExtender()                 .addPage(secondPageNotification))         .build();
  • 32. Pilha
  • 34. Pilha Notification notif = new NotificationCompat.Builder(mContext)          .setContentTitle("New mail from " + sender1)          .setContentText(subject1)          .setSmallIcon(R.drawable.new_mail)          .setGroup(GROUP_KEY_EMAILS)          .build(); … Notification notif2 = new NotificationCompat.Builder(mContext)          .setContentTitle("New mail from " + sender2)          .setContentText(subject2)          .setSmallIcon(R.drawable.new_mail)          .setGroup(GROUP_KEY_EMAILS)          .build();
  • 35. Pilha Notification notif = new NotificationCompat.Builder(mContext)          .setContentTitle("New mail from " + sender1)          .setContentText(subject1)          .setSmallIcon(R.drawable.new_mail)          .setGroup(GROUP_KEY_EMAILS)          .build(); … Notification notif2 = new NotificationCompat.Builder(mContext)          .setContentTitle("New mail from " + sender2)          .setContentText(subject2)          .setSmallIcon(R.drawable.new_mail)          .setGroup(GROUP_KEY_EMAILS)          .build();
  • 37. O que não tem • android.webkit • android.print • android.app.backup • android.appwidget • android.hardware.usb
  • 38. Requisitos • SDK tools versão 23.0.0 ou superior • SDK Android 4.4W (API 20)
  • 39. Custom notification public void onCreate(Bundle bundle){     ...     setContentView(R.layout.notification_activity); } <activity android:name="com.example.NotificationActivity"      android:exported="true"      android:allowEmbedded="true"      android:theme="@android:style/Theme.DeviceDefault.Light" /> Intent notificationIntent = new Intent(this, NotificationActivity.class); PendingIntent notificationPendingIntent = PendingIntent.getActivity(this, 0, notificationIntent,         PendingIntent.FLAG_UPDATE_CURRENT);
  • 40. Layouts <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ android"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:orientation="vertical">     <TextView         android:id="@+id/text"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="@string/hello_square" /> </LinearLayout>
  • 43. Layouts <android.support.wearable.view.WatchViewStub     xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     xmlns:tools="http://schemas.android.com/tools"     android:id="@+id/watch_view_stub"     android:layout_width="match_parent"     android:layout_height="match_parent"     app:rectLayout="@layout/rect_activity_wear"     app:roundLayout="@layout/round_activity_wear"> </android.support.wearable.view.WatchViewStub>
  • 44. Layouts <android.support.wearable.view.WatchViewStub     xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     xmlns:tools="http://schemas.android.com/tools"     android:id="@+id/watch_view_stub"     android:layout_width="match_parent"     android:layout_height="match_parent"     app:rectLayout="@layout/rect_activity_wear"     app:roundLayout="@layout/round_activity_wear"> </android.support.wearable.view.WatchViewStub>
  • 45. Layouts @Override protected void onCreate(Bundle savedInstanceState) {     super.onCreate(savedInstanceState);     setContentView(R.layout.activity_wear); }
  • 46.
  • 47. Layouts @Override protected void onCreate(Bundle savedInstanceState) {     super.onCreate(savedInstanceState);     setContentView(R.layout.activity_wear);     WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);     stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {         @Override public void onLayoutInflated(WatchViewStub stub) {             // Now you can access your views             TextView tv = (TextView) stub.findViewById(R.id.text);             ...         }     }); }
  • 48. Layouts WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub); stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {     @Override public void onLayoutInflated(WatchViewStub stub) {     // Now you can access your views     TextView tv = (TextView) stub.findViewById(R.id.text);     ... } });
  • 49. Layouts <android.support.wearable.view.BoxInsetLayout     xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     android:layout_height="match_parent"     android:layout_width=“match_parent> … </android.support.wearable.view.BoxInsetLayout>
  • 51. Layouts • android.support.wearable.view.BoxInsetLayout • android.support.wearable.view.CardScrollView • android.support.wearable.view.CardFrame • android.support.wearable.view.WearableListView • WearableListView.Adapter
  • 53. Confirmation • DelayedConfirmationView
 // Two seconds to cancel the action mDelayedView.setTotalTimeMs(2000); // Start the timer mDelayedView.start(); • DelayedConfirmationListener public void onTimerFinished(View view); // Usuário não cancelou, continue public void onTimerSelected(View view); // Usuário cancelou, abortar 

  • 54. Fechando • Default: swipe da esquerda • Pode ser desabilitado • Long press
  • 55. Fechando <style name="AppTheme" parent="Theme.DeviceDefault">     <item name="android:windowSwipeToDismiss">false</item> </style>
  • 56. Fechando <FrameLayout     xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_height="match_parent"     android:layout_width="match_parent">     <!-- resto do layout -->     <android.support.wearable.view.DismissOverlayView         android:id="@+id/dismiss_overlay"         android:layout_height="match_parent"         android:layout_width="match_parent"/> <FrameLayout>
  • 57. Fechando mDismissOverlay = (DismissOverlayView) findViewById(R.id.dismiss_overlay); mDismissOverlay.setIntroText(R.string.long_press_intro); mDismissOverlay.showIntroIfNecessary(); // Configure a gesture detector mDetector = new GestureDetector(this, new SimpleOnGestureListener() { public void onLongPress(MotionEvent ev) {     mDismissOverlay.show(); } });
  • 58. O que mais? • Transferência de dados entre wearable e device: • Wearable Data Layer • Watch Face: • CanvasWatchFaceService, CanvasWatchFaceService.Engine…