SlideShare a Scribd company logo
1 of 49
Advancing the UI – Part I:
Look, Motion, and Gesture
Anna Schaller
Sr. Manager, Developer Relations
Samsung Media Solutions Center America

#SDC13
Creating Moments of Delight
What’s Next for the UI?

 Mobile SDK
–
–
–
–
–

Look
Gestures
Motion
MultiWindow
Visual View

Part I

Part II
Look
A “Look” at features

 Writing Buddy
– Hand writing recognition extension to UI elements

 Air Button
– Quick access menu for various arrays of data

 Smart Clip
– Clipboard capture with metadata recognition

 Pointer Icon
– Extends icon for hover pointer to user-defined
images
Architecturally speaking……

 View System modified to support extensions to
Android UI elements
– New default behaviors (Writing Buddy enabled on all
editable fields)
– New packaged library with added functionality to enhance
your UI
APPLICATION FRAMEWORK

View System

Slook Impl

Resource Manager

Activity Manager

Window Manager

Notification Manager

Telephony Manager

…..

Content Provider
Look implementation
Application
SDK Module

MyBeautifulApp
1.Request(Call Public API)
2.Check Feature
3.Check version

Slook
JAR

Slook

SlookWritingBuddy

SlookAirButton

Implement

7.Response

SlookSmartClip

SlookHoverPointIc
on

APPLICATION
5.Request(Call Internal API)

Slook
Implement

SlookImpl

WritingBuddyImpl

AirButtonImpl

View System
APPLICATION FRAMEWORK

6.Response

SmartClipImpl

HoverPointIconIm
pl
Samsung Mobile SDK Libraries

 New APIs to check for presence
and properties of technology
Implementing Look Features
@Override
public void onCreate(Bundle savedInstanceState) {
Slook slook = new Slook();
try {
slook.initialize(this);
} catch (SsdkUnsupportedException e) {
// notify user device does not support
return;
}
if (slook.isFeatureEnabled(Slook.AIRBUTTON)
if (slook.isFeatureEnabled(Slook.SPEN_HOVER_ICON)
if (slook.isFeatureEnabled(Slook.SMARTCLIP)
if (slook.isFeatureEnabled(Slook.WRITINGBUDDY) {
Slook<class> variable = new Slook<class> }
Writing Buddy

 On by default for editable fields (EditText, DatePicker)
 Disable system wide with Direct pen input turned off
 Disable on app-by-app basis through look library
Writing Buddy Extensions

 SLookWritingBuddy class
– 2 constructors: ViewGroup and EditText

 Support for text and images
– 2 Listeners with callbacks
Writing Buddy Styles

 EditText (text
only) (default)

 ViewGroup

 EditText (text and
image toggle)
Implementing Writing Buddy – Text and Image
SlookWritingBuddy mWritingBuddy;
EditText editInput;
ImageView mOutputImageView;
public void onCreate(. . . ) {

editInput = (EditText) findViewById(R.id.edit_input);
mOutputImageView = (ImageView) findViewById(R.id.image_output);
mWritingBuddy = new SlookWritingBuddy(editInput);
mWritingBuddy.setImageWritingListener(
new SlookWritingBuddy.ImageWritingListener() {
public void onImageReceived(Bitmap arg0) {
mOutputImageView.setBackground(
new BitmapDrawable(getResources(), arg0));
}
});
Implementing Writing Buddy – ViewGroup
public void onCreate(. . . ) {
FrameLayout fl = (FrameLayout) findViewById(R.id.input);
mOutputTextView = (TextView) findViewById(R.id.text_output);
mWritingBuddy = new SlookWritingBuddy(fl);
mWritingBuddy.setTextWritingListener(
new SlookWritingBuddy.TextWritingListener() {
public void onTextReceived(CharSequence arg0) {
mOutputTextView.setText(arg0);
}
});
<LinearLayout>
<FrameLayout>
<SomeView>
</FrameLayout>
<TextView>
</LinearLayout>
Writing Buddy Miscellaneous Features
// Turn recognition on for numeric or alphanumeric
mType = SlookWritingBuddy.TYPE_EDITOR_NUMBER;
mType = SlookWritingBuddy.TYPE_EDITOR_TEXT;
mWritingBuddy.setEditorType(mType);

// enable or disable Writing Buddy
mWritingBuddy.setEnabled(mIsEnabled);

// true or false
Air Button

 Activated with S Pen hover + side button
 Defaults to “Air Command” system wide
 Override behavior inside app
– com.samsung.android.sdk.look.airbutton

 Implemented with an ArrayAdapter
– Array of “data” attached to view
– Array data can be text, images, contacts, video, audio
Data Types
Air Button -- Text
protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_airbutton_simple);
Button btnText = (Button) findViewById(R.id.btn_text);
createTextListWidgetFromView(btnText);
}
public SlookAirButton createTextListWidgetFromView(View v) {
SlookAirButton airButtonWidget = new SlookAirButton(
v,
// Button
getAdapterStringList(),
// Adapter
SlookAirButton.UI_TYPE_LIST); // Data type
airButtonWidget.setItemSelectListener(mCallback);
airButtonWidget.setPosition(0, 50);
return airButtonWidget;
}
Creating the list of Air Button Strings
public SlookAirButtonAdapter getAdapterStringList() {
ArrayList<AirButtonItem> stringList =
new ArrayList<AirButtonItem>();
stringList.add(new AirButtonItem(null,
“Come here at 5:00", null));
stringList.add(new AirButtonItem(null, "Why?", null));
stringList.add(new AirButtonItem(null,
"I wanna watch movie", null));
stringList.add(new AirButtonItem(null,
"Ok. No problem", null));
return new SlookAirButtonAdapter(stringList);

}
Data Types
new SlookAirButton(View parentview, SlookAirButtonAdapter adapter,
int uiType)
where uiType is:
SlookAirButton.UI_TYPE_LIST // use with text and media arrays
SlookAirButton.UI_TYPE_MENU // use with menu arrays
// ArrayAdapter Items
AirButtonItem(Drawable image,
String description,
Object data)

// R.drawable.image or null,
// Text or null
// null

new AirButtonItem(null, “text”, null)
new AirButtonItem(R.drawable.png, “text”, null)

// text only
// image and text
Positioning the List
get/setGravity(int g)
// within view
SlookAirButton.GRAVITY_LEFT
SlookAirButton.GRAVITY_RIGHT
SlookAirButton.GRAVITY_TOP
SlookAirButton.GRAVITY_BOTTOM
get/setDirection(int d)
// for adapter
SlookAirButton.DIRECTION_UPPER
SlookAirButton.DIRECTION_LOWER
SlookAirButton.DIRECTION_RIGHT
SlookAirButton.DIRECTION_LEFT
get/setPosition(int x, int y)

// coordinates

y

x
AirButton -- Gravity versus Direction
More . . .
// lets user scroll through lists
setScrollEnabled(boolean enable)
// animates the elements in the list when it opens
setBounceEffectEnabled(boolean enable)
// animates the list when hovering over elements
start/stopAnimationIcon(MotionEvent event)
ACTION_HOVER_ENTER | ACTION_HOVER_EXIT
Smart Clip
Smart Clip Features

 Default behavior
– Captures the text and images in ImageView and TextView

 Extensions with Look
– Meta-data can now be included with the image clip
– Meta-data includes URLs, strings, as well as the launch
intent for your activity
– Meta data can be Static or Dynamic
Simple Use Case -- Scrapbook
public void onCreate(. . .) {
TextView tv = (TextView) findViewById(R.id.text_static);
SlookSmartClip sc = new SlookSmartClip(tv);
sc.clearAllMetaTag();

sc.addMetaTag(new SlookSmartClipMetaTag
(SlookSmartClipMetaTag.TAG_TYPE_URL, "http://www.samsung.com"));
sc.addMetaTag(new SlookSmartClipMetaTag
(SlookSmartClipMetaTag.TAG_TYPE_PLAIN_TEXT,
"This is android textview."));
}
public void someRoutine() {
sendData();
}
Simple Use Case – Scrapbook (con’t)
public void sendData() {
Intent intent = new Intent();
intent.setComponent(new
ComponentName("com.samsung.android.app.pinboard",
"com.samsung.android.app.pinboard.ui.PinboardActivity"));
try {
startActivity(intent);
} catch (ActivityNotFoundException e) {
Toast.makeText(SmartClipActivity.this,
”Scrapbook application is not installed.”,
Toast.LENGTH_SHORT).show();
}
}
Pointer Icon

 Set pointer icon for the View you want it to appear
with
– Can be ViewGroup or View

 Writing Buddy icon overrides
pointer icon
– Cannot redefine hover icon for these
fields without disabling writing buddy
Pointer Icon – Adding in code
public class MainActivity extends Activity {
SlookPointerIcon mPointerIcon = new SlookPointerIcon();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
RelativeLayout panel = (RelativeLayout)
findViewById(R.id.container);
mPointerIcon.setHoverIcon (panel,
getResources().
getDrawable(R.drawable.x_pointer_icon));
}
LOOK Demo
Gesture
What is Gesture?

 Gesture allows you to use events generated by user’s
hand movements in your application
 Recognizes hand movements using data from the
gesture sensor to the right of the device speaker
 Requirements:
– Gesture sensor
– Android 4.3 (Jelly Bean API level
18) or higher
Gesture Package
Implementation -- Check for support of feature
public void onCreate() {
private Sgesture mGesture;
private SgestureHand mHand;
mGesture = new Sgesture();
try {

mGesture.initialize(this);
} catch (IllegalArgumentException e) {
//Error Handling
} catch (SsdkUnsupportedException e) {
//Error Handling
}
if(mGesture.isFeatureEnabled(Sgesture.TYPE_HAND_PRIMITIVE)){
mHand = new SgestureHand(Looper.getMainLooper(), mGesture);
mHand.start(Sgesture.TYPE_HAND_PRIMITIVE, mChangeListener);
}
}
Register Listener
private final SgestureHand.ChangeListener mChangeListener =
new SgestureHand.ChangeListener() {
@Override
public void onChanged(Info info) {
Log.d(TAG, “Hand : angle = “ + info.getAngle());
// do something with data
180º / UP
}
};
270º / LEFT

public void onStop() {
mGestureHand.stop();
}

90º / RIGHT

0º / DOWN
Reporting Angles
Motion
What is Motion?

 Package allows you to take advantage of movement
data coming in from sensors for both “calling”
motion and “forward” motion (walking or running)
“Calling” motion

 Recognizes the motion of bringing device up to your ear
 When you read a message on your device and bring the
device up to your ear, the call motion event is triggered,
and your application calls the phone number that sent
the message.

 Requirements:
– Proximity sensor, acceleration
sensor, and a gyro sensor
– Android 4.3 (Jelly Bean API level 18) or
higher
“Forward” motion

 Pedometer data generated when walking/running
with device (steps, calories, speed, distance, and step
status)

 Requirements:
– Acceleration sensor, pressure sensor
– If no pressure sensor, number of
up/down steps is not recognized
– Android 4.3 (Jelly Bean API level 18) or
higher
Motion Library

Call data

Forward data
Implementation -- Check for support of feature
public void onCreate() {
private Smotion mMotion;
private SmotionCall mCall;

// SmotionPedometer

mMotion = new Smotion();
try {

mMotion.initialize(this);
} catch (IllegalArgumentException e) {
//Error Handling
} catch (SsdkUnsupportedException e) {
//Error Handling
}
if(mMotion.isFeatureEnabled(Smotion.TYPE_CALL)){
// TYPE_PEDOMETER
mCall = new SmotionCall(Looper.getMainLooper(),mMotion);
mCall.start(Smotion.TYPE_CALL, mChangeListener);
}
}
Register Listener – “Call” Motion
private SmotionCall.ChangeListener mChangeListener =
new SmotionCall.ChangeListener() {
@Override
public void onChanged(Info info) {
int position = info.getCallPosition();
switch (position){
case SmotionCall.POSITION_LEFT:
Log.d(TAG, "Call motion happened! : left");
break;
case SmotionCall.POSITION_RIGHT:
Log.d(TAG, "Call motion happened! : Right");
break;
default:
break;
}
}
};
Register Listener – “Forward” Motion
private SmotionPedometer.ChangeListener mChangeListener =
new SmotionPedometer.ChangeListener() {
@Override
public void onChanged(Info info) {
Log.d(TAG, “Pedometer : calorie = “ + info.getCalorie());
Log.d(TAG, “Pedometer : distance = “ + info.getDistance());
Log.d(TAG, “Pedometer : speed = “ + info.getSpeed());
Log.d(TAG, “Pedometer : step = “ +
info.getCount(SmotionPedometer.Info.COUNT_TOTAL));
Log.d(TAG, “Pedometer : status = “ + info.getStatus());
}
};
Sensing the data

Application
…

Screen off

SDK
…

SensorHub
Pedometer
happened

…

…
1 step

1 step

1 step

1 step

1 step

1 step

1 step

1 step

1 step
Getting the latest Pedometer data
mPedometer.getInfo();
Application

mPedometer.updateInfo();
Application

SDK

Screen : ON
getInfo()

The latest
pedometer info.

SDK just knows the
pedometer information
before screen is off.
It can’t know whether
the data is the latest
data or not.
So in this case it returns
null.

SensorHub

SDK

Screen : OFF
updateInfo()
Request

Screen : OFF
getInfo()

null

You can receive the
latest pedometer info
through ChangeListener
though screen is off.

The latest data
The latest
pedometer info
What’s next…….

 Advancing the UI -- Part II: MultiWindow and Visual
View
– Tuesday 9:00
– California West
Thank You!
License Notices
Except where noted, sample source code written by Samsung Electronics Co. Ltd and provided to you is licensed as described below.
Copyright © 2010-2013, Samsung Electronics Co. Ltd. All rights reserved except as otherwise explicitly indicated.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.

Neither the name of the Samsung Electronics Co. Ltd nor the names of its contributors may be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Other source code displayed in this presentation may be offered under other licenses.

Apache 2.0
Copyright © 2010, Android Open Source Project. All rights reserved unless otherwise explicitly indicated.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Creative Commons 3.0 Attribution License
Portions of this presentation are reproduced from work created and shared by Google (http://code.google.com/policies.html) and used according to terms described in the
Creative Commons 3.0 Attribution License (http://creativecommons.org/licenses/by/3.0/).

More Related Content

What's hot

Android App Development - 05 Action bar
Android App Development - 05 Action barAndroid App Development - 05 Action bar
Android App Development - 05 Action barDiego Grancini
 
Handling action bar in Android
Handling action bar in AndroidHandling action bar in Android
Handling action bar in Androidindiangarg
 
Android app material design from dev's perspective
Android app material design from dev's perspectiveAndroid app material design from dev's perspective
Android app material design from dev's perspectiveDeSmart Agile Software House
 
Android Lollipop - Webinar vom 11.12.2014
Android Lollipop - Webinar vom 11.12.2014Android Lollipop - Webinar vom 11.12.2014
Android Lollipop - Webinar vom 11.12.2014inovex GmbH
 
Android development - Activities, Views & Intents
Android development - Activities, Views & IntentsAndroid development - Activities, Views & Intents
Android development - Activities, Views & IntentsLope Emano
 
I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)Katsumi Kishikawa
 
Luca Passani - Essential Tools for Mobile-Aware Web Professionals | Codemoti...
Luca Passani - Essential Tools for Mobile-Aware Web Professionals |  Codemoti...Luca Passani - Essential Tools for Mobile-Aware Web Professionals |  Codemoti...
Luca Passani - Essential Tools for Mobile-Aware Web Professionals | Codemoti...Codemotion
 
Android Navigation Component
Android Navigation ComponentAndroid Navigation Component
Android Navigation ComponentŁukasz Ciupa
 
Navigation Architecture Component
Navigation Architecture ComponentNavigation Architecture Component
Navigation Architecture ComponentYasutaka Kawamoto
 
3D Touch by Karol Kozub, Macoscope
3D Touch by Karol Kozub, Macoscope3D Touch by Karol Kozub, Macoscope
3D Touch by Karol Kozub, MacoscopeMacoscope
 
ハンズオン資料 電話を作ろう(v1.6用)
ハンズオン資料 電話を作ろう(v1.6用)ハンズオン資料 電話を作ろう(v1.6用)
ハンズオン資料 電話を作ろう(v1.6用)Kenji Sakashita
 
Kick start your experience with android wear - Codemotion Rome 2015
Kick start your experience with android wear - Codemotion Rome 2015Kick start your experience with android wear - Codemotion Rome 2015
Kick start your experience with android wear - Codemotion Rome 2015Codemotion
 

What's hot (20)

Android basic 2 UI Design
Android basic 2 UI DesignAndroid basic 2 UI Design
Android basic 2 UI Design
 
Android App Development - 05 Action bar
Android App Development - 05 Action barAndroid App Development - 05 Action bar
Android App Development - 05 Action bar
 
Action bar
Action barAction bar
Action bar
 
Handling action bar in Android
Handling action bar in AndroidHandling action bar in Android
Handling action bar in Android
 
Eddystone beacons demo
Eddystone beacons demoEddystone beacons demo
Eddystone beacons demo
 
Android app material design from dev's perspective
Android app material design from dev's perspectiveAndroid app material design from dev's perspective
Android app material design from dev's perspective
 
Action Bar in Android
Action Bar in AndroidAction Bar in Android
Action Bar in Android
 
Android Lollipop - Webinar vom 11.12.2014
Android Lollipop - Webinar vom 11.12.2014Android Lollipop - Webinar vom 11.12.2014
Android Lollipop - Webinar vom 11.12.2014
 
@Ionic native/google-maps
@Ionic native/google-maps@Ionic native/google-maps
@Ionic native/google-maps
 
Ms Ajax Dom Event Class
Ms Ajax Dom Event ClassMs Ajax Dom Event Class
Ms Ajax Dom Event Class
 
Android development - Activities, Views & Intents
Android development - Activities, Views & IntentsAndroid development - Activities, Views & Intents
Android development - Activities, Views & Intents
 
I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)
 
Luca Passani - Essential Tools for Mobile-Aware Web Professionals | Codemoti...
Luca Passani - Essential Tools for Mobile-Aware Web Professionals |  Codemoti...Luca Passani - Essential Tools for Mobile-Aware Web Professionals |  Codemoti...
Luca Passani - Essential Tools for Mobile-Aware Web Professionals | Codemoti...
 
Android App Dev Manual-1.doc
Android App Dev Manual-1.docAndroid App Dev Manual-1.doc
Android App Dev Manual-1.doc
 
Android Navigation Component
Android Navigation ComponentAndroid Navigation Component
Android Navigation Component
 
Navigation Architecture Component
Navigation Architecture ComponentNavigation Architecture Component
Navigation Architecture Component
 
Exercises
ExercisesExercises
Exercises
 
3D Touch by Karol Kozub, Macoscope
3D Touch by Karol Kozub, Macoscope3D Touch by Karol Kozub, Macoscope
3D Touch by Karol Kozub, Macoscope
 
ハンズオン資料 電話を作ろう(v1.6用)
ハンズオン資料 電話を作ろう(v1.6用)ハンズオン資料 電話を作ろう(v1.6用)
ハンズオン資料 電話を作ろう(v1.6用)
 
Kick start your experience with android wear - Codemotion Rome 2015
Kick start your experience with android wear - Codemotion Rome 2015Kick start your experience with android wear - Codemotion Rome 2015
Kick start your experience with android wear - Codemotion Rome 2015
 

Similar to Advancing the UI — Part 1: Look, Motion, and Gestures

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
 
Android Location-based應用開發分享
Android Location-based應用開發分享Android Location-based應用開發分享
Android Location-based應用開發分享koji lin
 
Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best PracticesYekmer Simsek
 
Workshop 26: React Native - The Native Side
Workshop 26: React Native - The Native SideWorkshop 26: React Native - The Native Side
Workshop 26: React Native - The Native SideVisual Engineering
 
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 appVitali Pekelis
 
Capture image on eye blink
Capture image on eye blinkCapture image on eye blink
Capture image on eye blinkInnovationM
 
Android activity, service, and broadcast recievers
Android activity, service, and broadcast recieversAndroid activity, service, and broadcast recievers
Android activity, service, and broadcast recieversUtkarsh Mankad
 
Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesAhsanul Karim
 
Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesAhsanul Karim
 
Android应用开发简介
Android应用开发简介Android应用开发简介
Android应用开发简介easychen
 
Android Event and IntentAndroid Event and Intent
Android Event and IntentAndroid Event and IntentAndroid Event and IntentAndroid Event and Intent
Android Event and IntentAndroid Event and Intentadmin220812
 
Mobile 2.0 Open Ideas WorkShop: Building Social Media Enabled Apps on Android
Mobile 2.0 Open Ideas WorkShop: Building Social Media Enabled Apps on AndroidMobile 2.0 Open Ideas WorkShop: Building Social Media Enabled Apps on Android
Mobile 2.0 Open Ideas WorkShop: Building Social Media Enabled Apps on AndroidAlberto Ruibal
 
Improving android experience for both users and developers
Improving android experience for both users and developersImproving android experience for both users and developers
Improving android experience for both users and developersPavel Lahoda
 
Droidcon2013 android experience lahoda
Droidcon2013 android experience lahodaDroidcon2013 android experience lahoda
Droidcon2013 android experience lahodaDroidcon Berlin
 

Similar to Advancing the UI — Part 1: Look, Motion, and Gestures (20)

Android Oreo
Android OreoAndroid Oreo
Android Oreo
 
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...
 
Android Location-based應用開發分享
Android Location-based應用開發分享Android Location-based應用開發分享
Android Location-based應用開發分享
 
Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best Practices
 
Introduction toandroid
Introduction toandroidIntroduction toandroid
Introduction toandroid
 
Workshop 26: React Native - The Native Side
Workshop 26: React Native - The Native SideWorkshop 26: React Native - The Native Side
Workshop 26: React Native - The Native Side
 
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
 
Capture image on eye blink
Capture image on eye blinkCapture image on eye blink
Capture image on eye blink
 
Android activity, service, and broadcast recievers
Android activity, service, and broadcast recieversAndroid activity, service, and broadcast recievers
Android activity, service, and broadcast recievers
 
package org dev
package org devpackage org dev
package org dev
 
Package org dev
Package org devPackage org dev
Package org dev
 
Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through Activities
 
Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through Activities
 
Android应用开发简介
Android应用开发简介Android应用开发简介
Android应用开发简介
 
Android Event and IntentAndroid Event and Intent
Android Event and IntentAndroid Event and IntentAndroid Event and IntentAndroid Event and Intent
Android Event and IntentAndroid Event and Intent
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 
Day 5
Day 5Day 5
Day 5
 
Mobile 2.0 Open Ideas WorkShop: Building Social Media Enabled Apps on Android
Mobile 2.0 Open Ideas WorkShop: Building Social Media Enabled Apps on AndroidMobile 2.0 Open Ideas WorkShop: Building Social Media Enabled Apps on Android
Mobile 2.0 Open Ideas WorkShop: Building Social Media Enabled Apps on Android
 
Improving android experience for both users and developers
Improving android experience for both users and developersImproving android experience for both users and developers
Improving android experience for both users and developers
 
Droidcon2013 android experience lahoda
Droidcon2013 android experience lahodaDroidcon2013 android experience lahoda
Droidcon2013 android experience lahoda
 

Recently uploaded

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 

Recently uploaded (20)

E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 

Advancing the UI — Part 1: Look, Motion, and Gestures

  • 1. Advancing the UI – Part I: Look, Motion, and Gesture Anna Schaller Sr. Manager, Developer Relations Samsung Media Solutions Center America #SDC13
  • 3. What’s Next for the UI?  Mobile SDK – – – – – Look Gestures Motion MultiWindow Visual View Part I Part II
  • 5. A “Look” at features  Writing Buddy – Hand writing recognition extension to UI elements  Air Button – Quick access menu for various arrays of data  Smart Clip – Clipboard capture with metadata recognition  Pointer Icon – Extends icon for hover pointer to user-defined images
  • 6. Architecturally speaking……  View System modified to support extensions to Android UI elements – New default behaviors (Writing Buddy enabled on all editable fields) – New packaged library with added functionality to enhance your UI APPLICATION FRAMEWORK View System Slook Impl Resource Manager Activity Manager Window Manager Notification Manager Telephony Manager ….. Content Provider
  • 7. Look implementation Application SDK Module MyBeautifulApp 1.Request(Call Public API) 2.Check Feature 3.Check version Slook JAR Slook SlookWritingBuddy SlookAirButton Implement 7.Response SlookSmartClip SlookHoverPointIc on APPLICATION 5.Request(Call Internal API) Slook Implement SlookImpl WritingBuddyImpl AirButtonImpl View System APPLICATION FRAMEWORK 6.Response SmartClipImpl HoverPointIconIm pl
  • 8. Samsung Mobile SDK Libraries  New APIs to check for presence and properties of technology
  • 9. Implementing Look Features @Override public void onCreate(Bundle savedInstanceState) { Slook slook = new Slook(); try { slook.initialize(this); } catch (SsdkUnsupportedException e) { // notify user device does not support return; } if (slook.isFeatureEnabled(Slook.AIRBUTTON) if (slook.isFeatureEnabled(Slook.SPEN_HOVER_ICON) if (slook.isFeatureEnabled(Slook.SMARTCLIP) if (slook.isFeatureEnabled(Slook.WRITINGBUDDY) { Slook<class> variable = new Slook<class> }
  • 10. Writing Buddy  On by default for editable fields (EditText, DatePicker)  Disable system wide with Direct pen input turned off  Disable on app-by-app basis through look library
  • 11. Writing Buddy Extensions  SLookWritingBuddy class – 2 constructors: ViewGroup and EditText  Support for text and images – 2 Listeners with callbacks
  • 12. Writing Buddy Styles  EditText (text only) (default)  ViewGroup  EditText (text and image toggle)
  • 13. Implementing Writing Buddy – Text and Image SlookWritingBuddy mWritingBuddy; EditText editInput; ImageView mOutputImageView; public void onCreate(. . . ) { editInput = (EditText) findViewById(R.id.edit_input); mOutputImageView = (ImageView) findViewById(R.id.image_output); mWritingBuddy = new SlookWritingBuddy(editInput); mWritingBuddy.setImageWritingListener( new SlookWritingBuddy.ImageWritingListener() { public void onImageReceived(Bitmap arg0) { mOutputImageView.setBackground( new BitmapDrawable(getResources(), arg0)); } });
  • 14. Implementing Writing Buddy – ViewGroup public void onCreate(. . . ) { FrameLayout fl = (FrameLayout) findViewById(R.id.input); mOutputTextView = (TextView) findViewById(R.id.text_output); mWritingBuddy = new SlookWritingBuddy(fl); mWritingBuddy.setTextWritingListener( new SlookWritingBuddy.TextWritingListener() { public void onTextReceived(CharSequence arg0) { mOutputTextView.setText(arg0); } }); <LinearLayout> <FrameLayout> <SomeView> </FrameLayout> <TextView> </LinearLayout>
  • 15. Writing Buddy Miscellaneous Features // Turn recognition on for numeric or alphanumeric mType = SlookWritingBuddy.TYPE_EDITOR_NUMBER; mType = SlookWritingBuddy.TYPE_EDITOR_TEXT; mWritingBuddy.setEditorType(mType); // enable or disable Writing Buddy mWritingBuddy.setEnabled(mIsEnabled); // true or false
  • 16. Air Button  Activated with S Pen hover + side button  Defaults to “Air Command” system wide  Override behavior inside app – com.samsung.android.sdk.look.airbutton  Implemented with an ArrayAdapter – Array of “data” attached to view – Array data can be text, images, contacts, video, audio
  • 18. Air Button -- Text protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_airbutton_simple); Button btnText = (Button) findViewById(R.id.btn_text); createTextListWidgetFromView(btnText); } public SlookAirButton createTextListWidgetFromView(View v) { SlookAirButton airButtonWidget = new SlookAirButton( v, // Button getAdapterStringList(), // Adapter SlookAirButton.UI_TYPE_LIST); // Data type airButtonWidget.setItemSelectListener(mCallback); airButtonWidget.setPosition(0, 50); return airButtonWidget; }
  • 19. Creating the list of Air Button Strings public SlookAirButtonAdapter getAdapterStringList() { ArrayList<AirButtonItem> stringList = new ArrayList<AirButtonItem>(); stringList.add(new AirButtonItem(null, “Come here at 5:00", null)); stringList.add(new AirButtonItem(null, "Why?", null)); stringList.add(new AirButtonItem(null, "I wanna watch movie", null)); stringList.add(new AirButtonItem(null, "Ok. No problem", null)); return new SlookAirButtonAdapter(stringList); }
  • 20. Data Types new SlookAirButton(View parentview, SlookAirButtonAdapter adapter, int uiType) where uiType is: SlookAirButton.UI_TYPE_LIST // use with text and media arrays SlookAirButton.UI_TYPE_MENU // use with menu arrays // ArrayAdapter Items AirButtonItem(Drawable image, String description, Object data) // R.drawable.image or null, // Text or null // null new AirButtonItem(null, “text”, null) new AirButtonItem(R.drawable.png, “text”, null) // text only // image and text
  • 21. Positioning the List get/setGravity(int g) // within view SlookAirButton.GRAVITY_LEFT SlookAirButton.GRAVITY_RIGHT SlookAirButton.GRAVITY_TOP SlookAirButton.GRAVITY_BOTTOM get/setDirection(int d) // for adapter SlookAirButton.DIRECTION_UPPER SlookAirButton.DIRECTION_LOWER SlookAirButton.DIRECTION_RIGHT SlookAirButton.DIRECTION_LEFT get/setPosition(int x, int y) // coordinates y x
  • 22. AirButton -- Gravity versus Direction
  • 23. More . . . // lets user scroll through lists setScrollEnabled(boolean enable) // animates the elements in the list when it opens setBounceEffectEnabled(boolean enable) // animates the list when hovering over elements start/stopAnimationIcon(MotionEvent event) ACTION_HOVER_ENTER | ACTION_HOVER_EXIT
  • 25. Smart Clip Features  Default behavior – Captures the text and images in ImageView and TextView  Extensions with Look – Meta-data can now be included with the image clip – Meta-data includes URLs, strings, as well as the launch intent for your activity – Meta data can be Static or Dynamic
  • 26. Simple Use Case -- Scrapbook public void onCreate(. . .) { TextView tv = (TextView) findViewById(R.id.text_static); SlookSmartClip sc = new SlookSmartClip(tv); sc.clearAllMetaTag(); sc.addMetaTag(new SlookSmartClipMetaTag (SlookSmartClipMetaTag.TAG_TYPE_URL, "http://www.samsung.com")); sc.addMetaTag(new SlookSmartClipMetaTag (SlookSmartClipMetaTag.TAG_TYPE_PLAIN_TEXT, "This is android textview.")); } public void someRoutine() { sendData(); }
  • 27. Simple Use Case – Scrapbook (con’t) public void sendData() { Intent intent = new Intent(); intent.setComponent(new ComponentName("com.samsung.android.app.pinboard", "com.samsung.android.app.pinboard.ui.PinboardActivity")); try { startActivity(intent); } catch (ActivityNotFoundException e) { Toast.makeText(SmartClipActivity.this, ”Scrapbook application is not installed.”, Toast.LENGTH_SHORT).show(); } }
  • 28. Pointer Icon  Set pointer icon for the View you want it to appear with – Can be ViewGroup or View  Writing Buddy icon overrides pointer icon – Cannot redefine hover icon for these fields without disabling writing buddy
  • 29. Pointer Icon – Adding in code public class MainActivity extends Activity { SlookPointerIcon mPointerIcon = new SlookPointerIcon(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); RelativeLayout panel = (RelativeLayout) findViewById(R.id.container); mPointerIcon.setHoverIcon (panel, getResources(). getDrawable(R.drawable.x_pointer_icon)); }
  • 32. What is Gesture?  Gesture allows you to use events generated by user’s hand movements in your application  Recognizes hand movements using data from the gesture sensor to the right of the device speaker  Requirements: – Gesture sensor – Android 4.3 (Jelly Bean API level 18) or higher
  • 34. Implementation -- Check for support of feature public void onCreate() { private Sgesture mGesture; private SgestureHand mHand; mGesture = new Sgesture(); try { mGesture.initialize(this); } catch (IllegalArgumentException e) { //Error Handling } catch (SsdkUnsupportedException e) { //Error Handling } if(mGesture.isFeatureEnabled(Sgesture.TYPE_HAND_PRIMITIVE)){ mHand = new SgestureHand(Looper.getMainLooper(), mGesture); mHand.start(Sgesture.TYPE_HAND_PRIMITIVE, mChangeListener); } }
  • 35. Register Listener private final SgestureHand.ChangeListener mChangeListener = new SgestureHand.ChangeListener() { @Override public void onChanged(Info info) { Log.d(TAG, “Hand : angle = “ + info.getAngle()); // do something with data 180º / UP } }; 270º / LEFT public void onStop() { mGestureHand.stop(); } 90º / RIGHT 0º / DOWN
  • 38. What is Motion?  Package allows you to take advantage of movement data coming in from sensors for both “calling” motion and “forward” motion (walking or running)
  • 39. “Calling” motion  Recognizes the motion of bringing device up to your ear  When you read a message on your device and bring the device up to your ear, the call motion event is triggered, and your application calls the phone number that sent the message.  Requirements: – Proximity sensor, acceleration sensor, and a gyro sensor – Android 4.3 (Jelly Bean API level 18) or higher
  • 40. “Forward” motion  Pedometer data generated when walking/running with device (steps, calories, speed, distance, and step status)  Requirements: – Acceleration sensor, pressure sensor – If no pressure sensor, number of up/down steps is not recognized – Android 4.3 (Jelly Bean API level 18) or higher
  • 42. Implementation -- Check for support of feature public void onCreate() { private Smotion mMotion; private SmotionCall mCall; // SmotionPedometer mMotion = new Smotion(); try { mMotion.initialize(this); } catch (IllegalArgumentException e) { //Error Handling } catch (SsdkUnsupportedException e) { //Error Handling } if(mMotion.isFeatureEnabled(Smotion.TYPE_CALL)){ // TYPE_PEDOMETER mCall = new SmotionCall(Looper.getMainLooper(),mMotion); mCall.start(Smotion.TYPE_CALL, mChangeListener); } }
  • 43. Register Listener – “Call” Motion private SmotionCall.ChangeListener mChangeListener = new SmotionCall.ChangeListener() { @Override public void onChanged(Info info) { int position = info.getCallPosition(); switch (position){ case SmotionCall.POSITION_LEFT: Log.d(TAG, "Call motion happened! : left"); break; case SmotionCall.POSITION_RIGHT: Log.d(TAG, "Call motion happened! : Right"); break; default: break; } } };
  • 44. Register Listener – “Forward” Motion private SmotionPedometer.ChangeListener mChangeListener = new SmotionPedometer.ChangeListener() { @Override public void onChanged(Info info) { Log.d(TAG, “Pedometer : calorie = “ + info.getCalorie()); Log.d(TAG, “Pedometer : distance = “ + info.getDistance()); Log.d(TAG, “Pedometer : speed = “ + info.getSpeed()); Log.d(TAG, “Pedometer : step = “ + info.getCount(SmotionPedometer.Info.COUNT_TOTAL)); Log.d(TAG, “Pedometer : status = “ + info.getStatus()); } };
  • 45. Sensing the data Application … Screen off SDK … SensorHub Pedometer happened … … 1 step 1 step 1 step 1 step 1 step 1 step 1 step 1 step 1 step
  • 46. Getting the latest Pedometer data mPedometer.getInfo(); Application mPedometer.updateInfo(); Application SDK Screen : ON getInfo() The latest pedometer info. SDK just knows the pedometer information before screen is off. It can’t know whether the data is the latest data or not. So in this case it returns null. SensorHub SDK Screen : OFF updateInfo() Request Screen : OFF getInfo() null You can receive the latest pedometer info through ChangeListener though screen is off. The latest data The latest pedometer info
  • 47. What’s next…….  Advancing the UI -- Part II: MultiWindow and Visual View – Tuesday 9:00 – California West
  • 49. License Notices Except where noted, sample source code written by Samsung Electronics Co. Ltd and provided to you is licensed as described below. Copyright © 2010-2013, Samsung Electronics Co. Ltd. All rights reserved except as otherwise explicitly indicated. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:  Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.  Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.  Neither the name of the Samsung Electronics Co. Ltd nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Other source code displayed in this presentation may be offered under other licenses. Apache 2.0 Copyright © 2010, Android Open Source Project. All rights reserved unless otherwise explicitly indicated. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Creative Commons 3.0 Attribution License Portions of this presentation are reproduced from work created and shared by Google (http://code.google.com/policies.html) and used according to terms described in the Creative Commons 3.0 Attribution License (http://creativecommons.org/licenses/by/3.0/).

Editor's Notes

  1. My name is Anna Schaller and I head up the Tech Evangelist team of Developer Relations.As I said earlier today our job is to inspire you to create those “Moments of delight” in your apps. So I wanted to show you use cases for some of the features I’m going to talk about in this session. You saw examples of Air Button, Smart Clip, and Writing Buddy among other things.
  2. If you’ve read through the Android Design Guidelines or listened to the “Android Design In Action” sound bites you’re already on the right path. You know, and have implemented the recommendations for layouts and design patterns, developing for multiple screen sizes, how to effectively use the Android widgets and resources. There is information out there on all this. So where do you go from here? How do you enhance the UI beyond all of this?
  3. This is where the Mobile SDK comes in. There are several packages that offer features which enhance the user experience. Not just the UI, but the way a user engages with the device. This is what I’ll cover in two different sessions. This is part 1, where I’ll walk through Look, Gestures, and Motion. Part 2 is tomorrow morning at 9:00 and I”ll cover MultiWindwo and Visual View.
  4. There are 4 components of the Look package:There’s Writing Buddy – which eliminates the need for a soft keyboard. It uses the recognition engine included in the platform to conters handwriting into text for editable fields.There’s Air Button – gives you a different way to access lists of thingsThere’s Smart Clip – which allows users to grab screen shots of thingsAnd there’s Pointer Icon – which lets you change out the default icon for pen hoverNOTE: all components of LOOK require a Pen to use the feature.
  5. Before I get into the “how to” of it, I wanted to show you a bit of the architecture. The View System in the Android framework has been extended to include the implementations of LOOK APIs. The sid effect of that is that there are now new default behaviors in some cases (Writing Buddy). There is also a packaged library that needs to be included in your app but let me show you what you’re including……
  6. LOOK functionality is coded in two parts. The library that you include in your application is just a set of interfaces. The actual implementation of each API is in the framework. Those are the modifications made to the VIEW System. So If we look at it from the application standpoint, overall size of APK does not increase by much because the library is so small.
  7. Prior to this SDK release, there was no consistent way to tell if the technology was supported on any given device. Even across Samsung devices. For instance S Pen was only supported on the Note series of devices so if your app ran on a GS3 or GS4 it would fail. The sdk-v1.0.0.jar file contains an interface that’s implemented by every package. Each package tries to initialize itself inside an exception handler. If the call to initialize fails, that technology is not supported on that device. Let’s us support technologies on devices where it makes sense.LIGHTWAY SOLUTION
  8. Okay, so lets “look” at what you need to do to get started. As we mentioned in the Mobile SDK session, every application should include the sdk-v1.0.0.jar file.
  9. So lets start with Writing BuddyOn the Note 3 and 2014 10” tablet, it’s on by default for editable fields. The user can disable this system wide through a Setting for Direct Pen Input – turn off. It can also be disabled on an app-by-app basis. The icon you see on the right is what the user will see when they hover over the field. The
  10. 2 constructors – means you can attach the WritingBuddy panel to either an EditText widget OR any ViewGroup (FrameLayout, RelativeLayout, whatever container you want to assign it to) Different behavior for eachEditText accepts the text written in the WritingBuddy panelViewGroup allows you to open Writing Buddy but the text needs to be assigned to specific UI element (TextEdit for instance with setText)
  11. These are the different forms the Writing Buddy take depending on how you initialize SLookWritingBuddy (ViewGroup) or (EditText). You can extend the default editText so that it also accepts images.
  12. To add image recognition, you register the setImageWritingListener with the instance of WritingBuddy. (CODE WALKTHROUGH).To go to text mode you would set the Listener to null. mWritingBUddy.setImageWritingListener(null)
  13. This shows you how to useWritingBuddy with a ViewGroup. In this case the nested FrameLayout is the ViewGroup where the WritingBuddy opens up. The actual text is written to the TextView element outside the FrameLayout at the bottom of the screen with a call to SetText().
  14. There are a handful of APIs that let you control the environment. setEditorType() can be used to define the recognition that’s done – numeric only or text.setEnabled() is the call you make to turn WritingBuddy on or off programmatically.There are more but these should get you started.
  15. AirButton is the second feature of the LOOK package.
  16. Here are three examples of what Air Button looks likeArray of imagesArray of contactsArray of menu items.
  17. To useAriButton with a list of text, the code looks like this. Standard onCreate() inflating the view and getting a handle to the buttonThe call to SlookAirButton() is where you define the list. The first parameter is the button, the second is the list of strings (we’ll see in a second), and the third defines the list type with UI_TTYPE_LIST
  18. The list is initialized here. As I mentioned it’s using an ArrayAdapter with the array type defined as “AirButtonItem”. We’ll look at that on the next slide. Next just add the strings themselves.
  19. So I mentioned the UITYPE as a parameter to SlookAirButton(). There are 2 types, one for lists that you use for text and images; and one for menusThe AirButtonItem supports three parameters -- only 2 of which are used – Image and string. Null can be used where no data is available so the two examples on the bottom show you how to set up the calls for different arrays
  20. You can also position the array within the UI. setGravity() sets the starting location iwthin the view (button for instance)setDiretion() sets the direction of the array.setPosition() sets the distance from the view to open the list.
  21. This is a picture of what it would look like. You have gravity – top, bottton, left and right. And you have direction. *Tip: In fullscreen view, GRAVITY_HOVER_POINT gravity is recommended.
  22. So that’s Air Button.The third component in Look is Smart Clip. It’s leveraging the clipboard and letting users capture selected areas of the screen. It’s been available in previous released of the platforms but is expanded on in LOOK.
  23. [Activity Link]:When the user captures with smartclip, you can add your activity as metadata and the user can launch your activity in scrapbook.[Static vs Dynamic]-Static: You can add meta data when your view is created.-Dynamic: You can add meta data when the user capture the screen by SmartClip
  24. You can send it directly to Scrapbook, or let the system offer a list of apps that accept data from the clipboard.
  25. Create an instance of SlookPointerIcon. Pass in the handle to the view to setHoverIcon() along with the new iimage.
  26. 1. Writing Buddy  Text Message : TO person / message / toggle image and text // write hello and then scratch out / write welcome2. Air Button – Defalut Adapter – open Receip List; open image list – Simple Adapter – open menu3. Smart Clip – Open Bloomberg – select article and grab – drop in scrapbook – open scrapbook and see extra data4. Pointer Icon – Open S Note and see pointer icon
  27. So that’s LOOK. Gesture is another way you can engage your users with your application.
  28. Hand uses data from the gesture sensor to the right of the device speaker to recognize hand movements.Hand indicates theangle the hand moved. When your application receives a Hand gesture event, You can play a song in the music player or view images in the gallery. You can move your hand right, left and right to receive calls without touching the screen. You can also move your hand up and down to scroll in the browser or e-mail without touching the screen.
  29. Create an Sgesture instancePass the Sgesture instance as a parameter to create an SgestureHand instance.Looper.getMainLooper()  Class used to run a message loop for a thread. Returns the application&apos;s main looper, which lives in the main thread of the application.Call start() to register a ChangeListener instance for SgestureHand.
  30. In the onChanged(Info info) method, handle the gesture events.
  31. That raw data is retuned as either CALL data or PEDOMETER data depending on which class you’ve initialized in the package.
  32. Create an Smotion instance
  33. With CALL motion, you are retrieving whether the motion was on the right side of your head or the left side.
  34. Forward motion data includes calories burned, distance, speed, and how many steps you’ve taken.
  35. When a pedometer event happens while screen is on, you can receive pedometer informationIf Sensorhub has a pedometer information while screen is off, you can receive pedometer information as soon as the screen is on.The Galaxy S4 is also fitted with Atmel’s sensor hub management MCU (microcontroller unit) which collects and processes data from all connected sensors in real-time, optimizing multiple user experiences, such as gaming, navigation and virtual reality. In addition, the sensor hub MCU lowers the overall system power consumption via picoPower technology to prevent drain and enable longer battery life.“Samsung’s new Galaxy S4 illustrates how motion sensing is an important function in the new device,” explained IngarFredriksen, Senior Director of Flash-based Microcontrollers, Atmel Corporation. “With a sensor hub management solution, Atmel allows Galaxy S4 users the ability to enjoy applications requiring real-time motion sensing, without ever compromising battery life.”
  36. If the screen is off, you can collect the information in one of two waysgetInfo() only collects data when the screen is on so when event to ????