5-1 More UI CSNB544 Mobile Application Development Thanks to Utexas Austin.

Slides:



Advertisements
Similar presentations
CE881: Mobile and Social Application Programming Simon M. Lucas Menus and Dialogs.
Advertisements

Introduction to Microsoft Excel 2010 Chapter Extension 3.
Programming with Android: Widgets and Events Luca Bedogni Marco Di Felice Dipartimento di Scienze dell’Informazione Università di Bologna.
User Interface Classes.  Design Principles  Views & Layouts  Event Handling  Menus  Dialogs.
Filip Debelić What is it? Android is a mobile operating system (OS) based on the Linux kernel and currently developed by Google Android,
Android Fragments.
1 of 5 This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT. © 2007 Microsoft Corporation.
By: Jeremy Smith.  Introduction  Droid Draw  Add XML file  Layouts  LinearLayout  RelativeLayout  Objects  Notifications  Toast  Status Bar.
Android Development (Basics)
CS378 - Mobile Computing User Interface Basics MIKE!! LOOK HERE FOR intercepting the ListView items:
Android Application Development 2013 PClassic Chris Murphy 1.
Android Fragments A very brief introduction Android Fragments1.
CS378 - Mobile Computing What's Next?. Fragments Added in Android 3.0, a release aimed at tablets A fragment is a portion of the UI in an Activity multiple.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 9: Customize! Navigating with a Master/Detail.
Android Development: Application Layout Richard S. Stansbury 2015.
Introducing the Sudoku Example
CS5103 Software Engineering Lecture 08 Android Development II.
ANDROID UI – FRAGMENTS. Fragment  An activity is a container for views  When you have a larger screen device than a phone –like a tablet it can look.
6-2 2D Graphics CSNB544 Mobile Application Development Thanks to Utexas Austin.
Favorite Twitter® Searches App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
Tip Calculator App Building an Android App with Java © by Pearson Education, Inc. All Rights Reserved.
Understanding Hello Android 1 CS300. Activity  Similar to a form  Base class for the visual, interactive components of your application  Android API.
16 Services and Broadcast Receivers CSNB544 Mobile Application Development Thanks to Utexas Austin.
Frank Xu Gannon University.  Linear Layout  Relative Layout  Table Layout.
CS378 - Mobile Computing More UI - Part 2. Special Menus Two special application menus – options menu – context menu Options menu replaced by action bar.
Programming Mobile Applications with Android September, Albacete, Spain Jesus Martínez-Gómez.
9 Persistence - SQLite CSNB544 Mobile Application Development Thanks to Utexas Austin.
Android – Fragments L. Grewe.
Cosc 5/4730 Dialogs and below 3.0 and above (fragment)
WaveMaker Visual AJAX Studio 4.0 Training Basics: Building Your First Application Binding Basics.
Cosc 4730 Android Fragments. Fragments You can think of a fragment as a modular section of an activity, which has its own lifecycle, receives its own.
Styles, Dialog Boxes, and Menus. Styles Allow creation of a common format – placed in res/values/styles.xml – file name is incidental Can be applied.
CRSD Technology Training Tony Judice. Quick Access Toolbar – can be modifiedSave as… allows you to save the file to a different location and also as an.
HW#9 Clues CSCI 571 Fall, HW#9 Prototype
MOBILE COMPUTING D10K-7D02 MC05: Android UI Design Dr. Setiawan Hadi, M.Sc.CS. Program Studi S-1 Teknik Informatika FMIPA Universitas Padjadjaran.
 2002 Prentice Hall. All rights reserved. 1 Chapter 2 – Introduction to the Visual Studio.NET IDE Outline 2.1Introduction 2.2Visual Studio.NET Integrated.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
CS378 - Mobile Computing More UI - Part 2. Special Menus Two special application menus – options menu – context menu Options menu replaced by action bar.
1 Android Development Lean and mean introduction Based on a presentation by Mihail L. Sichitiu.
CS378 - Mobile Computing User Interface Basics. User Interface Elements View – Control – ViewGroup Layout Widget (Compound Control) Many pre built Views.
More UI Action Bar, Navigation, and Fragments
Building User Interfaces Basic Applications
CS378 - Mobile Computing More UI. UI Review Containers – more formally ViewGroups – store widgets and other containers – examples: LinearLayout, RelativeLayout,
Chapter 2 Building User Interfaces and Basic Applications.
Interstage BPM v11.2 1Copyright © 2010 FUJITSU LIMITED FORMS.
CS371m - Mobile Computing User Interface Basics. UI Programming with Widgets Widget is an element in a Graphical User Interface (GUI) – not to be confused.
ANDROID LAYOUTS AND WIDGETS. Slide 2 Introduction Parts of the Android screen Sizing widgets and fonts Layouts and their characteristics Buttons, checkboxes.
Android Fragments. Slide 2 Lecture Overview Getting resources and configuration information Conceptualizing the Back Stack Introduction to fragments.
The Flag Quiz app tests your ability to correctly identify 10 flags from various countries and territories.
ANDROID DIALOGS. Slide 2 Dialogs (Introduction) The Dialog class is the base class for all dialogs A dialog is a small window that prompts the user to.
UI Redux, Navigation Patterns, Tabbed Views, Pagers, Drawers
Guided By: Dr. Mingon Kang
Java FX: Scene Builder.
Activities, Fragments, and Events
Mobile Application Development BSCS-7 Lecture # 6
Activities and Intents
Microsoft Excel.
Creation of an Android App By Keith Lynn
Mobile Application Development Chapter 4 [Android Navigation and Interface Design] IT448-Fall 2017 IT448- Fall2017.
ANDROID UI – FRAGMENTS UNIT II.
CS371m - Mobile Computing User Interface Basics.
Fundamentals of Python: From First Programs Through Data Structures
Chapter 3: Coding the GUI Programmatically, Layout Managers
CS371m - Mobile Computing User Interface Basics.
Chapter 2 – Introduction to the Visual Studio .NET IDE
Building User Interfaces Basic Applications
Programming Mobile Applications with Android
Android Developer Fundamentals V2
Android Development Tools
Cosc 5/4730 EmojiCompat library..
Presentation transcript:

5-1 More UI CSNB544 Mobile Application Development Thanks to Utexas Austin

Concrete Example Tip Calculator What kind of layout to use? Widgets: – TextView – EditText – SeekBar

TextViews

EditText All but top EditText are uneditable Alternative? TextViews?

SeekBar

Layout TableLayout row 0 row 1 row 2 row 3 row 4 row 5

Layout Attributes android:background – #RGB, #ARGB, #RRGGBB, #AARRGGBB – can place colors in res/values/colors.xml

Color Resources Good Resource / W3C colors –

StretchColumns columns 0 indexed columns 1, 2, 3 stretch to fill layout width column 0 wide as widest element, plus any padding for that element

Initial UI Done via some Drag and Drop, Outline view, and editing XML Demo outline view – properties

Changes to UI Outline multiple select properties – all TextViews' textColor set to black # change column for %DD labels use center gravity for components

Changes to UI change bill total and seekbar to span more columns gravity and padding for text in column 0 align text with seekBar set seekBar progress to 18 set seekBar focusable to false - keep keyboard on screen

Changes to UI Prevent Editing in EditText – focusable, long clickable, and cursor visible properties to false Set text in EditText to 0.00 Change weights to 1 to spread out

Functionality onCreate instance variables assigned to components found via ids update standard percents:

Functionality - Saving State onSaveInstance – save BillTotal and CustomPercent to the Bundle – check for these in onCreate

Functionality Responding to SeekBar customSeekBarListener instance variable Of type OnSeekBarChangeListener

Create an Anonymous Inner Class Class notified when seek bar changed and program updates custom tip and total amount must register with the seekBar instance variable in onCreate.

Functionality - Total EditText Another anonymous inner class implement onTextChanged to converts to double and call update methods register with EditText for total in onCreate()!

Constraining Input EditText from tip calculator input was numberDecimal Use InputFilter to constrain input Several built in filters such as AllCaps and LengthFilter

Custom Input Filter InputFilter has one method: public CharSequence filter( CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { replace dstart to dend in dest with new text, start to end of source

DIALOGS

Dialogs - Old Way Dialogs from tutorials were cut and paste Implementing Dialogs demonstrates evolution of Android SDK legacy approach has Activity manage its own Dialogs created, initialized, updated, and destroyed using Activity class call back methods

Dialogs - New Way Android evolving from smartphone OS to smart device OS API level 11 (Android 3.0, the tablet release) introduced Fragments A fragment represents a behavior or a portion of a UI in an Activity – like a sub activity multiple fragments combined in multi-pane UI reuse fragments in multiple activities

Fragments

Dialogs as Fragments Dialogs are special type of Fragment managed by the FragmentManager class still part of an activity, but lifecycle not managed by the Activity – life cycle issues of Dialogs as Fragments will be more difficult to deal with – must save state and restore instance

Types of Dialogs Used to organize information and react to user events without creating a whole new activity Old Dialogs: – Dialog, AlertDialog, DatePickerDialog, TimePickerDialog, ProgressDialog New Dialogs: – DialogFragment 28

Sample Dialogs 29

Legacy Approach Dialog defined in Activity it is used Activity maintains a pool of Dialogs showDialog() method displays Dialog dismissDialog() method used to stop showing a Dialog – in tutorial, when we have difficulty removeDialog removes from pool

Legacy Approach - Steps Define unique indentifier for the Dialog in Activity (constants) implement onCreateDialog method, returns Dialog of appropriate type

onCreateDialog

Dialog Steps - Legacy Approach implement onPrepareDialog() if necessary – if necessary to update dialog each time it is displayed – for example, a time picker, update with the current time launch dialog with showDialog() – in tutorials done when a menu or action bar menu item selected – could launch Dialogs for other reasons

Alert Dialogs Most common type Title, Content Area, Action buttons (up to 3) Content area could be message, list, seekbar, etc. set positive, set negative, set neutral

Custom Dialogs AlertDialog very flexible, but you can create CustomDialogs Create a layout 35

Custom Dialogs from onCreateDialog 36

Custom Dialog Simple dialogs are dismissed with the back button dialog title 37

Dialogs - Fragment Method Decouple Dialogs from the Activity – good SE approach? – TicTacToe UI is almost 500 lines long! Implement a class that is a subclass of DialogFragment – DifficultyFragment – Send info to newInstance method (current difficulty, listener for updates) – onCreateDialog now in DifficultyFragment

DifficultyFragment

DifficultyFragment - onCreateDialog

Using DifficultyFragment In AndroidTicTacToe create a listener to pass to the newInstance method create and show Dialog as part of onOptionsItemSelected()

DifficultyListener

Using Fragments Fragments added in API level 11, Android 3.0, the tablet release Developers behind Android think fragments are so important that can be used in pre API 11 builds using the Android Support Library Froyo and Gingerbread pre API 11

Android Support Library (ASL) add library to project and application android.support.v4.app.DialogFragment – for example – instead of android.app.DialogFragment ASL does not support action bar in earlier versions of API

Fragment Lifecycle Demo Tic Tac Toe with old style Dialog and Fragment Dialog Alter orientation - result?