Upgrade to Pro — share decks privately, control downloads, hide ads and more …

[Dmytro Danylyk] Planning Android Screens

[Dmytro Danylyk] Planning Android Screens

Presentation from GDG DevFest Ukraine 2015 - the biggest Google related event in the country. October 23-24, Lviv. Learn more at http://devfest.gdg.org.ua/

Google Developers Group Lviv

October 24, 2015
Tweet

More Decks by Google Developers Group Lviv

Other Decks in Programming

Transcript

  1. What is it? What is it? "Screens Planing - is

    a process of preparing app flow, screens logic, layout & design - before programmer writes the first lines of code."
  2. Sound like designer job Sound like designer job "Designer should

    not be the sole decision-maker". "Be sure your lead developer/architect is involved very early in the screen planning process".
  3. Why developer must be involved? Why developer must be involved?

    "Developer will be able to give your design team visibility into areas of the design that can either become costly to implement, or present performance challenges for the app."
  4. Why screen planning is important? Why screen planning is important?

    "To prevent development surprises and cost overruns during the project".
  5. Screen planning process Screen planning process Answers question: "Is this

    screen necessary?" App flow diagram App flow diagram
  6. Screen planning process Screen planning process Answers question: "How other

    applications solve similar problems?" App flow diagram App flow diagram Research other apps Research other apps
  7. Screen planning process Screen planning process Answers question: "What is

    this screen responsible for?" App flow diagram App flow diagram Research other apps Research other apps Screen logic Screen logic
  8. Screen planning process Screen planning process App flow diagram App

    flow diagram Research other apps Research other apps Screen logic Screen logic Layout & Design Layout & Design Answers question: "How this screen will look like?"
  9. Research other apps Research other apps Download few applications which

    have Sign In screen and check how they solve problems like: 1. Internet is not available 2. Input data is not valid 3. Loading indicator 4. ...
  10. Network check Network check Vine application checks if network is

    available, after the user clicks on the Sign In button. Vine application
  11. Airbnb application tracks when text inside login and password input

    fields changes. Log In button stays disabled until input data is valid. Data validation: Data validation: "as user type" "as user type" Airbnb application
  12. Data validation: Data validation: "lazy" "lazy" Keep application validates data

    after user clicks on Done button. Keep application
  13. Swarm application disables login, password and sign in widgets, and

    replaces sign in button text with loading indicator. Loading indicator: Loading indicator: button button Swarm application
  14. Swarm application disables login, password and sign in widgets, and

    replaces sign in button text with loading indicator. Loading indicator: Loading indicator: button button Swarm application
  15. Duolingo application disables login, password and sign in widgets without

    displaying any loading indicator. Loading indicator: Loading indicator: none none Duolingo application
  16. Duolingo application disables login, password and sign in widgets without

    displaying any loading indicator. Loading indicator: Loading indicator: none none Duolingo application
  17. Pre-fill data Pre-fill data Pinterest application pre-fills email field so

    we don't have to type it manually. Pineterst application
  18. Airbnb application greatly improves user experience because allows to Sign

    In with a simple tap. Social Sign In Social Sign In Airbnb application
  19. Keyboard done Keyboard done button button By default when user

    presses keyboard Done button – it closes keyboard. Tumblr application handles this click and performs Sign In request. Tumblr application
  20. 1. Perform Sign In 2. Handle network state 3. Handle

    data validation 4. Display loading indicator 5. Pre-fill data 6. Social Sign In Screen logic Screen logic Write down a list of Sign In screen features.
  21. Do not place important functional buttons at the bottom of

    your screen. At least make sure they are moved to top when keyboard is displayed. Tumblr Android
  22. Do not place important functional buttons at the bottom of

    your screen. At least make sure they are moved to top when keyboard is displayed. Tumblr Android
  23. Do not force users to make unnecessary clicks, show keyboard

    automatically. Remember the 3 clicks rule: with every three clicks you lose 50% of your audience’s attention. Pinterest application
  24. Make sure keyboard doesn't overlap your Sign In button or

    any other top componenets. At least make your container scrollable. Foursquare application
  25. public boolean isEmailValid() { return Patterns.EMAIL_ADDRESS.matcher(getEmail()).matches(); } public String getEmail()

    { return mEditEmail.getText().toString().trim(); // mEditEmail } To validate email you can use Patterns.EMAIL_ADDRESS 1.
  26. String phoneNumber = "044 668 18 00" // Switzerland phone

    number PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance(); PhoneNumber phoneNumberProto = phoneUtil.parse(phoneNumber, "CH"); // CH - Switzerland country code boolean isValid = phoneUtil.isValidNumber(phoneNumberProto); // returns true // Produces "+41 44 668 18 00" phoneUtil.format(phoneNumberProto, PhoneNumberFormat.INTERNATIONAL // Produces "044 668 18 00" phoneUtil.format(phoneNumberProto, PhoneNumberFormat.NATIONAL // Produces "+41446681800" phoneUtil.format(phoneNumberProto, PhoneNumberFormat.E164) To validate/format phone number you can use google libphonenumber 2.
  27. Pattern emailPattern = Patterns.EMAIL_ADDRESS; Account[] accounts = AccountManager.get(context).getAccounts(); for (Account

    account : accounts) { if (emailPattern.matcher(account.name).matches()) { String possibleEmail = account.name; } } To pre-fill user data you can use AccountManager 3.
  28. Don't forget to set EditText attributes 4. – hint text

    to display when the text is empty. – constrains the text to a single horizontally scrolling line instead of letting it wrap onto multiple lines. – the type of data being placed in a text field, used to help an input method decide how to let the user enter text. (E.g. textPassword, phone, textEmailAddress) android:hint android:singleLine android:inputType
  29. Handle keyboard done button 5. mEditPassword.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public

    boolean onEditorAction(TextView v, int actionId, KeyEvent event) { boolean isValidKey = event != null && event.getKeyCode() == KeyEvent.KEYCODE_ENTER; boolean isValidAction = actionId == EditorInfo.IME_ACTION_DONE; if (isValidKey || isValidAction) { // do login request } return false; } }); Note: some keyboards support changing keyboard action button text android:imeActionLabel="SignIn".
  30. Provide meaningful error messages 6. if(!isEmailValid()) { showToast("Please enter valid

    username."); } else if(isPasswordEmpty()) { showToast("Please enter password."); } else if(!isNetworkOn()) { showToast("You don't have internet connection."); } else { doSignIn(); } Note: error message should answer a question "What is wrong?" and in some cases give user a hint how to fix it.
  31. When you try to Sign In to Airbnb application without

    internet connection it displays error dialog with advice "Please try again". Airbnb application
  32. Trying to use Social Sign In inside Airbnb application without

    internet connection, ends with obscure error message and infinity loading dialogue. Airbnb application
  33. Provide cancellation mechanism 7. class SignInRequest extends AsyncTask { //

    implementation omitted } SignInRequest mSignInRequest; void showLoadingDialog() { ... alertDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { // guarantees that onPostExecute() is never invoked mSignInRequest.cancel(false); } }); alertDialog.show(); }
  34. Vine application 1. Type your email & password 2. Press

    Sign In button 3. Once the loading dialog appears, press system back button
  35. Vine application 1. Type your email & password 2. Press

    Sign In button 3. Once the loading dialog appears, press system back button 4. Previous action will close the dialog, but won't cancel request
  36. Vine application 1. Type your email & password 2. Press

    Sign In button 3. Once the loading dialog appears, press system back button 4. Previous action will close the dialog, but won't cancel request 5. After some time you will see result of Sign In request
  37. Vine application Vine application doesn't ignore http request callback when

    dialog is dismissed. As a result Toast with error message appears after loading dialog was dismissed.
  38. 1. Type your email & password 2. Press Sign In

    button 3. Once the loading indicator appears, press Sign Up button Tumblr application
  39. 1. Type your email & password 2. Press Sign In

    button 3. Once the loading indicator appears, press Sign Up button 4. Previous action will switch you to Sign Up view, but won't cancel request Tumblr application
  40. Tumblr application 1. Type your email & password 2. Press

    Sign In button 3. Once the loading indicator appears, press Sign Up button 4. Previous action will switch you to Sign Up view, but won't cancel request 5. After some time you will see result of Sign In request
  41. Tumblr application Tumblr application doesn't ignore http request callback when

    user switch from Log In to Sign Up. As a result error labels appears in wrong state.
  42. Use AccountManage and SyncAdapter 8. AccountManager gives users a central

    point to define their credentials Android decides when is best time to make synchronization via SyncAdapter
  43. Sign In screen is not always MAIN 9. <activity android:name=".SignInActivity">

    <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> When you have a sign in screen in your application it doesn’t mean it should be your main launcher screen.
  44. Launch Sign In activity Check if access token is valid

    If access token is valid launch Home activity Typical flow Unnecessary delay, because Sign In activity launch every time user open application. Issues Sign In activity if(isAccessTokenValid()) { startHomeActivity(); finish(); } else { initViews(); }
  45. Launch Home activity Check if access token is valid If

    access token is NOT valid launch Sign In activity Better flow Home activity if(isAccessTokenValid()) { initViews(); } else { startSignInActivity(); finish(); }
  46. Summary Summary Take time to plan Take time to plan

    Keep your technical team involved Keep your technical team involved Research and learn from other apps Research and learn from other apps
  47. Why animations are important? Why animations are important? "You can

    get an application into production without animations, but these little things can be the difference between your app receiving 4 star or 5 star reviews."
  48. How to make decision to add How to make decision

    to add animations? animations?
  49. What type of animations we have? What type of animations

    we have? 1. Functional 1. Functional 2. "Delightful & Cute" 2. "Delightful & Cute"
  50. What are functional animations? What are functional animations? "Animations which

    help to provide context are called - functional. They help brains understand how the information flows".
  51. What are "Delightful & Cute" What are "Delightful & Cute"

    animations? animations? "Animations which make usage of your app more interesting and fun are called - "delightful & cute". They bring uniqueness to your application and help user to remember you."
  52. When to start coding animation? When to start coding animation?

    "Flow and design changes very often during development iteration. That's why development of complex, time- consuming animations is usually postponed to the very end, when core application development is completed."
  53. What is animation prototyping? What is animation prototyping? "Animation prototyping

    is a way to quickly mock up animation without having to write any code."
  54. Why it's useful for developers? Why it's useful for developers?

    "Because you can see order of transformations applied in prototype and convert them into code."
  55. High Level Concepts High Level Concepts Pixate creates 100% native

    app prototypes that run directly on your iOS or Android device. The process works like this: 1. Make changes to your prototype in Pixate 2. As edits are saved, the Pixate app will generate or refresh the native prototype on your mobile device in real-time
  56. What I need? What I need? 1. Pixate Mobile Application

    2. Pixate Studio 3. Android device
  57. Connecting your devices Connecting your devices In order to see

    and interact with what you're creating, you'll need to connect your device to Pixate Studio. Detailed tutorial is available on official Pixate . knowledgebase
  58. A - THE TOOLBOX/ASSETS TABS A - THE TOOLBOX/ASSETS TABS

    The layer list is home to all of the layers in your prototype. The second tab is where you upload images to use in your Prototype.
  59. B - ACTIONS B - ACTIONS Actions are scripts that

    can be run to complete common tasks, like setting up a scrollview or aligning a layer.
  60. C - INTERACTIONS C - INTERACTIONS Interactions are gestures and

    actions users will perform in your app.
  61. C - ANIMATIONS C - ANIMATIONS Animations move, scale and

    change layers, depending on the interaction performed by the user and the properties you set up
  62. D - CANVAS D - CANVAS The canvas is the

    visual representation of your prototype. What you see here, is what you will see in the preview.
  63. E - LAYER PROPERTIES E - LAYER PROPERTIES This is

    where you can adjust the layer’s position, size or orientation with values and change the appearance of the layer.
  64. F - ANIMATION PROPERTIES F - ANIMATION PROPERTIES These are

    used to define the conditions, ranges of an animation and interaction relationships.
  65. The layer the animation will be based on. Read as:

    when someone taps on 'picture'. 'Move' animation 'Move' animation
  66. Read as: when someone taps on 'picture' move this layer

    '90pt left' with 'spring' easing curve. 'Move' animation 'Move' animation
  67. 'Move' animation code 'Move' animation code int tension = 300;

    AnticipateOvershootInterpolator interpolator = new AnticipateOvershootInterpolator(tension); detailView.animate() .yBy(-90) // left 90 pt .setDuration(2500) // friction 2.5 sec .setInterpolator(interpolator) .start();
  68. Summary Summary Simple process of prototyping Simple process of prototyping

    Preview on a real Android device Preview on a real Android device Limited basic asset kit Limited basic asset kit
  69. Resources used Resources used Planning Mobile App Design Why Programmers

    Should Be A Part Of The Design Process Transitional Interfaces Prototyping in Pixate and Development Pixate knowledgebase