Android. The Toolbar

Similar documents
CS371m - Mobile Computing. More UI Navigation, Fragments, and App / Action Bars

CS371m - Mobile Computing. More UI Action Bar, Navigation, and Fragments

CHAPTER 4. Fragments ActionBar Menus

CS378 -Mobile Computing. More UI -Part 2

Office 2010: New Features Course 01 - The Office 2010 Interface

EMBEDDED SYSTEMS PROGRAMMING UI and Android

Quick & Simple Imaging. User Guide

Designing and Implementing Android UIs for Phones and Tablets

Getting Started Guide

Admin console design changes

CS 4518 Mobile and Ubiquitous Computing Lecture 5: Rotating Device, Saving Data, Intents and Fragments Emmanuel Agu

Topics of Discussion

CE881: Mobile & Social Application Programming

Excel 2007 New Features Table of Contents

PM4 + Partners Knowledge Articles

CE881: Mobile & Social Application Programming

Action Bar. Action bar: Top navigation bar at each screen The action bar is split into four different functional areas that apply to most apps.

Reviewing Hidden Content during Native Review

Microsoft Office Outlook 2007: Basic Course 01 - Getting Started

CS 528 Mobile and Ubiquitous Computing Lecture 4a: Fragments, Camera Emmanuel Agu

CS 528 Mobile and Ubiquitous Computing Lecture 3b: Android Activity Lifecycle and Intents Emmanuel Agu

Introduction To JAVA Programming Language

Creating/Updating Your Webpage

Microsoft Power Point Lab Manual

You will follow these steps: A. Verify that a student account exists. B. Create a classroom to hold lecture slides.

Power Point. Created with the Freeware Edition of HelpNDoc: Single source CHM, PDF, DOC and HTML Help creation

e-snaps Online Training Navigation Tutorial

BoardBookit for ipad Quick Start Guide

Viewing and Filtering the Calendar Scheduling Grid in Astra

Navigating Viewpoint V6 Working with Grids

How to use the Acrobat interface and basic navigation

The purpose of this tutorial is to introduce you to the Construct 2 program. First, you will be told where the software is located on the computer

TABLE OF CONTENTS TABLE OF CONTENTS... 1 INTRODUCTION... 2 USING WORD S MENUS... 3 USING WORD S TOOLBARS... 5 TASK PANE... 9

Lesson 5: Review and Deliver Presentations Microsoft PowerPoint 2016 IN THIS CHAPTER, YOU WILL LEARN HOW TO

Mobile Computing Practice # 2a Android Applications - Interface

You ve been told lies about Fragments.

By: Ms. Fatima Shannag Ms. Essra Al-Mousa. Edited by: Khawlah Almutlaq

XPress 2.3 Annotation

Material Design Guidelines

Word 2016: Using Section Breaks

Getting started in Outlook Web App for Office 365

Lenovo TAB A User Guide V1.0. Please read the safety precautions and important notes in the supplied manual before use.

Mobile Application Development Android

Access Groups. Collect and Store. Text Currency Date/Time. Tables Fields Data Type. You Your Friend Your Parent. Unique information

Android Programming Lecture 2 9/7/2011

ACTIVITY, FRAGMENT, NAVIGATION. Roberto Beraldi

3D Anatomy for Resistance Training: new user-interface

MS Word Professional Document Alignment

button Double-click any tab on the Ribbon to minimize it. To expand, click the Expand the Ribbon button

Getting Started with. Microsoft Office 2010

ICS Tutorials: Basic Operations

BOM (Bill of Material) Management. Updated as of 4/22/2016

Quick Start Guide - Contents. Opening Word Locating Big Lottery Fund Templates The Word 2013 Screen... 3

Inserting Typed Comments Applies to Microsoft Word 2007

CHEMICAL SAFETY EMS SOFTWARE. Accumulation Inventory

Budget Entry Documents Supporting Attachments Work Instructions

Windows 8.1 User Guide for ANU Staff

Compare 9.5. Getting started guide

Space Details. Available Pages

Using Online Help. About the built-in help features Using Help Using the How To window Using other assistance features

Quick Start Guide for Lotus Notes 8.5.1

1 Introduction to MARS

SmartArt Office 2007

WPI Project Center WordPress Manual For Editors

Getting Help in Microsoft Office

Using Help Contents Index Back 1

ALES Wordpress Editor documentation ALES Research websites

Action Bar. (c) 2010 Haim Michael. All Rights Reserv ed.

If there is not a shortcut icon on the desktop: Click on the Start menu > All Apps> and select Word 2016 from the list.

MS PowerPoint Useful Features. Choose start options. Change Office backgrounds and colours

Module 5: Triggers and Hotspots

PowerPoint 2010 Level 1 Computer Training Solutions Student Guide Version Revision Date Course Length

Introduction to iauditor +

CS 403X Mobile and Ubiquitous Computing Lecture 5: Web Services, Broadcast Receivers, Tracking Location, SQLite Databases Emmanuel Agu

Web Viewer Guide. HiPER LOOK Version Copyright 2016 PIXIA Corp. All Rights Reserved.

Salesforce Classic User Guide for Android

INTERMEDIATE WORD. Class Objective:

HCA Tech Note 120. Configuring the Control UI Home Page. Option 1: HCA constructs the home page

Mastering SmartList & Navigation Lists in Dynamics GP

Discovering Computers & Microsoft Office Office 2010 and Windows 7: Essential Concepts and Skills

Promethean ActivInspire

Activities and Fragments

Victaulic Tools for Revit

Urology, new user-interface

Using Microsoft Word. Paragraph Formatting. Displaying Hidden Characters

GeoGebra 4. Introduction and Point Plotting

Microsoft Lync 2013 Quick-Start Guide. ThinkTel Communications Professional Services Last Updated: June 18, 2013

VA DAP App Android Users Guide

Astra Scheduling Grids

Release Notes. TimeMap, Version 6.0. Enhancements Current Issues

Introduction to PowerPoint 2007

ProPresenter-Scoreboard. A Renewed Vision Product

ConstraintLayouts in Android

Introduction. The topics included in this guide are:

ELET4133: Embedded Systems. Topic 3 Eclipse Tour & Building a First App

Mobile 3.1 ios & Android v2

Produced by. Mobile Application Development. David Drohan Department of Computing & Mathematics Waterford Institute of Technology

11.1 Create Speaker Notes Print a Presentation Package a Presentation PowerPoint Tips... 44

Teamcenter Mobility Product decisions, anywhere, anytime. Features. Siemens AG All Rights Reserved.

Contents I - Navigating is easy p. 2. III - Controls p. 7. II - Using Whiteboard Active pages: making a new page, saving, opening, printing p.

Transcription:

Android The Toolbar

Credits Lectures are heavily based of materials and examples from: Android Programming The Big Nerd Ranch Guides Bill Phillips and Brian Hardy April 7, 2013

ToDoList We re going to extend the ToDoList application from Lecture 19. Here we are going to create a toolbar.

Toolbar vs ActionBar The toolbar is the latest style of bar as of 5.0 The actionbar was what was used prior to 5.0 We will want to ensure that our program is backwards compatible

AppCompat Library We need to add the app compatibility library Go to File -> Project Structure Select app -> Dependencies tab Add the library dependency appcompat-v7

Styles You will want to be using the appcompat Dark ActionBar in your styles

ActionBarActivity We know want our Activities (SingleFragmentActivity and ToDoPagerActivity) to implement ActionBarActivity rather than FragmentActivity

ToolBar You should now see your toolbar, at the top. Note how it says MyList

+ Menu Item We will be adding the + menu item When clicked this item will allow the user to add a new todo item

Adding Strings First we ll add the strings that we need to achieve our tasks

Create options menu xml Under res/menu create a new file called menu_to_do_list.xml. It might already exist Here we are making that + icon for users to add new ToDo s

menu_to_do_list.xml The icon list here represents the + icon. It s a standard icon that comes with Android The last line says only display in Action Menu if there s room, otherwise display in overflow menu

Landscape The last line in the previous slide, said display text if room. On a Landscape device there is room so it ll display the text, New ToDo

Enabling the Menu in Code Now we need to hook up the Options Menu to the ToDoListFragment In OnCreate we need to indicate it has an Options Menu with sethasoptionsmenu

Connect the XML File Now we want to specify how the options in the Menu by tying it to the xml file In ToDoListFragment we ll add the following

See the Options Menu You should now see the options Menu If you long click on the + you ll see New Crime

Responding to user actions Now, when the user clicks options in the menu we want to create a new ToDo item. First, we need extend the model to allow for this.

ToDoSet First let s get rid of the for loop that makes the ToDos, as from now the user can make them using the program Now, make the ability to add a ToDo

ToDo Now, when we create a new ToDo let s set the date so we don t get any null pointers

Responding to user click Now in ToDoListFragment we ll need to respond to the user clicking the +

Now try it Add new ToDos. When you navigate back to the list screen you should see them.

The up button WILL SEND THE USER BACK TO THE PARENT SCREEN

Enabling the up button The up button sends the user to the previous screen We ll be enabling the Up button In the ToDoFragment, the up button will navigate the user back to the list fragment.

Enabling the up button We can enable the up button, by specifying the parent element on the item in the Manifest. Here we are saying, if you re in the pager activity, and you press up, then go back to the list

The up Button working Now it should navigate you to the parent

Show/Hide Subtitle

Show the subtitle We ll be activating the feature in the ToDoListFragement We ll be responding to the menu item click

Adding the subtitle menu item Let s add our second menu item to menu_to_do_list.xml

Show the Subtitle

Now it should show Click the menu item to show the subtitle clicked show subtitle

Toggling the subtitle We also have to make sure to change the menu items title between show and hide First we need to create a boolean to keep track of the visibility

Switch flag Each time you click the button you want to switch the flag for visibility

Toggle Flag Each time the button is clicked, make the flag toggle Also, make the label toggle Also, show/hide the subtitle

Toggle the subtitle

Toggling should work

Rotation on rotation we want to make sure we keep the state of the subtitle, and don t reset it to not showing. Try rotating right now. The subtitle should go back to its default state each time.

Save boolean variable We need to save the state of our boolean variable when we rotate First create a constant for saving

Save boolean variable Next, save the boolean variable in the onsavedinstancestate method

Updating the subtitle Because we ll be updating the subtitle on rotation and when the menu item is selected we should have a method for it.

Update onitemselected Let s now update the onitemselected method to use the udpatesubtitle method

updateui now we add the call to updatesubtitle to updateui

Updating initial state Last, we need to show the correct string show/hide subtitle when we rotate. We do this in oncreateoptionsmenu

All done Now, both your menu items should work as described.