Beruflich Dokumente
Kultur Dokumente
Class About................................................................................................................................................ 3
com.eatin.ui
Class About
The Class About is the Fragment class that is launched when the user clicks on
About option in Left navigation drawer and it simply shows a dummy text for
About. You can customize this to display actual contents.
Constructor Detail
o
About
public About()
Method Detail
o
o
o
onCreateView
public android.view.View onCreateView(android.view.LayoutInflater
inflater,
android.view.ViewGroup container,
android.os.Bundle savedInstanceState)
Overrides:
onCreateView
in class android.support.v4.app.Fragment
com.eatin.ui
Class AddCart
The Class AddCart is the Fragment class that is currently launched when the
user clicks on Cart option in Left navigation drawer. It simply shows a dummy
cart. You need to customize this class to display actual contents for the Cart.
Field Detail
o
lbl
The lbl.
Constructor Detail
o
AddCart
public AddCart()
Method Detail
o
o
o
onCreateView
public android.view.View onCreateView(android.view.LayoutInflater
inflater,
android.view.ViewGroup container,
android.os.Bundle savedInstanceState)
Overrides:
onCreateView
o
in class android.support.v4.app.Fragment
onClick
public void onClick(android.view.View v)
Specified by:
onClick
in interface android.view.View.OnClickListener
Overrides:
onClick
o
o
in class CustomFragment
onCreateOptionsMenu
public void onCreateOptionsMenu(android.view.Menu menu,
android.view.MenuInflater inflater)
Overrides:
onCreateOptionsMenu
in class CustomFragment
com.eatin
Class Checkout
The Checkout is the activity class that shows the final Checkout interface.
Currently this is launched when ever user select Add to Cart option from Cart
screen. You need to write your own logic to show actual price, food names
and all other details as per your need.
Constructor Detail
o
Checkout
public Checkout()
Method Detail
o
onCreate
Overrides:
onCreate
o
in class CustomActivity
onClick
public void onClick(android.view.View v)
Specified by:
onClick
in interface android.view.View.OnClickListener
Overrides:
onClick
o
in class CustomActivity
onCreateOptionsMenu
public boolean onCreateOptionsMenu(android.view.Menu menu)
Overrides:
onCreateOptionsMenu
o
in class android.app.Activity
onOptionsItemSelected
public boolean onOptionsItemSelected(android.view.MenuItem item)
Overrides:
onOptionsItemSelected
in class android.app.Activity
com.eatin.custom
Class CustomActivity
Direct Known Subclasses:
Checkout, MainActivity
This is a common activity that all other activities of the app can extend to
inherit the common behaviors like implementing a common interface that can
be used in all child activities.
Field Detail
o
TOUCH
public static final TouchEffect TOUCH
Apply this Constant as touch listener for views to provide alpha touch
effect. The view must have a Non-Transparent background.
Constructor Detail
o
CustomActivity
public CustomActivity()
Method Detail
o
onCreate
Overrides:
onCreate
o
in class android.support.v4.app.FragmentActivity
setupActionBar
protected void setupActionBar()
This method will setup the top title bar (Action bar) content and display
values. It will also setup the custom background theme for ActionBar.
You can override this method to change the behavior of ActionBar for
particular Activity
o
setTouchNClick
public android.view.View setTouchNClick(int id)
Sets the touch and click listener for a view with given id.
Parameters:
id
- the id
Returns:
the view on which listeners applied
o
setClick
public android.view.View setClick(int id)
- the id
Returns:
onClick
public void onClick(android.view.View v)
Specified by:
onClick
in interface android.view.View.OnClickListener
com.eatin.custom
Class CustomFragment
Direct Known Subclasses:
About, AddCart, Home, RestaurantDetail, Restaurants, RestuarantItem
The Class CustomFragment is the base Fragment class. You can extend your
Fragment classes with this class in case you want to apply common set of rules
for those Fragments.
Constructor Detail
o
CustomFragment
public CustomFragment()
Method Detail
o
setTouchNClick
public android.view.View setTouchNClick(android.view.View v)
- the view
Returns:
setClick
public android.view.View setClick(android.view.View v)
- the view
Returns:
onClick
Specified by:
onClick
o
o
in interface android.view.View.OnClickListener
onCreateOptionsMenu
public void onCreateOptionsMenu(android.view.Menu menu,
android.view.MenuInflater inflater)
Overrides:
onCreateOptionsMenu
in class android.support.v4.app.Fragment
com.eatin.model
Class Data
The Class Data is a simple Java Bean that is used to hold Name, Detail and
image pairs.
Field Detail
o
title1
private java.lang.String title1
The title1.
o
title2
private java.lang.String title2
The title2.
desc
The description.
image1
The image2.
Constructor Detail
Data
o
o
o
o
- the title1
title2
- the title2
desc
- the desc
image1
o
o
o
- the image1
Data
public Data(java.lang.String title1,
int image1,
int image2)
title1
- the title1
image1
- the image1
image2
- the image2
Method Detail
o
getTitle1
setTitle1
public void setTitle1(java.lang.String title1)
setTitle2
public void setTitle2(java.lang.String title2)
Parameters:
title2
getImage1
public int getImage1()
setImage1
public void setImage1(int image1)
getImage2
public int getImage2()
setImage2
public void setImage2(int image2)
com.eatin.ui
Class Home
The Class Home is the Fragment class that is launched when the user clicks on
Home option in Left navigation drawer and this is also used as a default
fragment for MainActivity. It simply shows an Edittext to enter the address.
You need to write actual code for searching the contents based on the address
entered by user.
Constructor Detail
o
Home
public Home()
Method Detail
o
o
o
onCreateView
public android.view.View onCreateView(android.view.LayoutInflater
inflater,
android.view.ViewGroup container,
android.os.Bundle savedInstanceState)
Overrides:
onCreateView
o
in class android.support.v4.app.Fragment
onClick
public void onClick(android.view.View v)
Specified by:
onClick
in interface android.view.View.OnClickListener
Overrides:
onClick
in class CustomFragment
com.eatin.ui
Class LeftNavAdapter
The Adapter class for the ListView displayed in the left navigation drawer.
Field Detail
o
items
The items.
o
context
private android.content.Context context
The context.
o
selected
private int selected
The selected.
Constructor Detail
o
o
LeftNavAdapter
public LeftNavAdapter(android.content.Context context,
java.util.ArrayList<Data> items)
Method Detail
o
setSelection
public void setSelection(int position)
getCount
getItem
public Data getItem(int arg0)
getItemId
public long getItemId(int position)
o
o
o
getView
public android.view.View getView(int position,
android.view.View convertView,
android.view.ViewGroup parent)
com.eatin
Class MainActivity
The Class MainActivity is the base activity class of the application. This activity
is launched after the Splash and it holds all the Fragments used in the app. It
also creates the Navigation Drawer on left side.
Field Detail
o
drawerLayout
private android.support.v4.widget.DrawerLayout drawerLayout
drawerLeft
drawerToggle
private android.support.v4.app.ActionBarDrawerToggle drawerToggle
adapter
private LeftNavAdapter adapter
tab1
private android.view.View tab1
The tab.
Constructor Detail
o
MainActivity
public MainActivity()
Method Detail
o
onCreate
Overrides:
onCreate in class CustomActivity
o
setupDrawer
private void setupDrawer()
Setup the drawer layout. This method also includes the method calls for
setting up the Left side drawer.
o
setupLeftNavDrawer
private void setupLeftNavDrawer()
Setup the left navigation drawer/slider. You can add your logic to load
the contents to be displayed on the left side drawer. You can also setup
the Header and Footer contents of left drawer if you need them.
o
getDummyLeftNavItems
private java.util.ArrayList<Data> getDummyLeftNavItems()
This method returns a list of dummy items for left navigation slider. You
can write or replace this method with the actual implementation for list
items.
Returns:
the dummy items
o
launchFragment
public void launchFragment(int pos)
setupContainer
private void setupContainer()
setActionBarTitle
private void setActionBarTitle()
onPostCreate
protected void onPostCreate(android.os.Bundle savedInstanceState)
Overrides:
onPostCreate
o
in class android.app.Activity
onConfigurationChanged
public void onConfigurationChanged(android.content.res.Configurat
ion newConfig)
Specified by:
onConfigurationChanged
in interface android.content.ComponentCallbacks
Overrides:
onConfigurationChanged
o
in class android.support.v4.app.FragmentActivity
onOptionsItemSelected
public boolean onOptionsItemSelected(android.view.MenuItem item)
Overrides:
onOptionsItemSelected
o
o
in class android.app.Activity
onKeyDown
public boolean onKeyDown(int keyCode,
android.view.KeyEvent event)
Specified by:
onKeyDown
in interface android.view.KeyEvent.Callback
Overrides:
onKeyDown
o
in class android.support.v4.app.FragmentActivity
onClick
public void onClick(android.view.View v)
Specified by:
onClick
in interface android.view.View.OnClickListener
Overrides:
onClick in class CustomActivity
com.eatin.ui
Class RestaurantDetail
The Class RestaurantDetail is the Fragment class that is launched when the
user select a Restaurant in Restaurant listing screen . It simply shows a dummy
list of Restaurant food items. You can customize this class to display actual
Food listing.
private class
Field Detail
o
fList1
fList2
private java.util.ArrayList<Data> fList2
Constructor Detail
o
RestaurantDetail
public RestaurantDetail()
Method Detail
o
o
o
onCreateView
public android.view.View onCreateView(android.view.LayoutInflater
inflater,
android.view.ViewGroup container,
android.os.Bundle savedInstanceState)
Overrides:
onCreateView
o
in class android.support.v4.app.Fragment
setFoodList
private void setFoodList(android.view.View v)
loadDummyFoods
private void loadDummyFoods()
Load a dummy list of foods. You need to write your own logic to load
actual list of food items.
com.eatin.ui
Class Restaurants
The Class Restaurants is the Fragment class that is launched when the user
clicks on Favorites option in Left navigation drawer or when user click Order
now button on Home screen. It simply shows a dummy list of Restaurants. You
can customize this class to display actual Restaurants listing.
private
class
The Class PageAdapter is the adapter class for ViewPager that shows a
few list of Restaurants for each page based on the tabs shown at top.
Field Detail
o
tab
private android.view.View tab
The tab.
o
pager
private android.support.v4.view.ViewPager pager
The pager.
Constructor Detail
o
Restaurants
public Restaurants()
Method Detail
o
o
o
onCreateView
public android.view.View onCreateView(android.view.LayoutInflater
inflater,
android.view.ViewGroup container,
android.os.Bundle savedInstanceState)
Overrides:
onCreateView
o
in class android.support.v4.app.Fragment
setupPager
private void setupPager(android.view.View v)
onClick
public void onClick(android.view.View v)
Specified by:
onClick
in interface android.view.View.OnClickListener
Overrides:
onClick in class CustomFragment
com.eatin.ui
Class RestuarantItem
private
class
Field Detail
o
rList
Constructor Detail
o
RestuarantItem
public RestuarantItem()
Method Detail
o
onCreateView
o
o
Overrides:
onCreateView
o
in class android.support.v4.app.Fragment
loadDummyRestaurants
private void loadDummyRestaurants()
Load a dummy list of Restaurants. You need to write your own logic to
load actual list of Restaurants.
com.eatin
Class SplashScreen
The Class SplashScreen will launched at the start of the application. It will be
displayed for 3 seconds and than finished automatically and it will also start the
next activity of app.
Field Detail
o
isRunning
private boolean isRunning
Constructor Detail
o
SplashScreen
public SplashScreen()
Method Detail
o
onCreate
Overrides:
onCreate
o
in class android.app.Activity
startSplash
private void startSplash()
Starts the count down timer for 3-seconds. It simply sleeps the thread
for 3-seconds.
o
doFinish
private void doFinish()
If the app is still running than this method will start the MainActivity
activity and finish the Splash.
o
o
onKeyDown
public boolean onKeyDown(int keyCode,
android.view.KeyEvent event)
Specified by:
onKeyDown
in interface android.view.KeyEvent.Callback
Overrides:
onKeyDown
in class android.app.Activity
com.eatin.utils
Class TouchEffect
Constructor Detail
o
TouchEffect
public TouchEffect()
Method Detail
o
o
onTouch
Specified by:
onTouch
in interface android.view.View.OnTouchListener