Download Android Development using Java language and more Study notes Java Programming in PDF only on Docsity!
Usage instructions:
On Eclipse:
Make sure that you have configured the Eclipse with Android ADT Plugin and also
installed JDK 7 and Android SDK with latest plateforms.
For detail you can visit at: http://developer.android.com/sdk/index.html
After Eclipse is fully setup, open the Eclipse, Go to Files menu then select Import->
Existing project into workspace -> Browse, then select for all the projects (Main
Template project and all the related Library files bundled in the Zip provided to
you) then click on Finish.
Sometime Eclipse may show errors about Library project missing, for that just
Right click on Project -> Properties -> Android-> Scroll down -> Remove all the lib
projects that has Red cross -> Click Apply then OK -> Reopen this window and Add
back those projects -> Click Apply then OK
Important Class files:
All the Activity classes can be found in Main package i.e. com.glam
All the Fragments and UI components can be found in ui Package i.e.
com.glam.ui
All the custom code classes can be found in custom package i.e.
com.glam.custom
MyAppTemplates
Glam documentation
Android Template App
All the Java bean classes are located in model package i.e. com.glam.model
You can put all the Utility classes in utils package i.e. com.glam.utils
Photoshop files:
The Photoshop files can be found in the ‘PSD’ folder. They are layered - to use,
simply
open them up in your design tool of choice (i.e. Adobe Photoshop).
Below you will find detailed source code documentation, that will help you in
using and making modifications to this template.
Do not hesitate to email at: [email protected] should you run into
any issues.
- Class Checkout
- o Nested Class Summary
- Field Detail
- Constructor Detail
- Method Detail
- Class CheckoutActivity
- Constructor Detail
- Method Detail
- Class CustomActivity
- Field Detail
- Constructor Detail
- Method Detail
- Class CustomFragment
- Constructor Detail
- Method Detail
- Class Data
- Field Detail
- Constructor Detail
- Method Detail
- Class Home
- Constructor Detail
- Method Detail
- Class LeftNavAdapter
- Field Detail
- Constructor Detail
- Method Detail
- Class Login
- o Nested Class Summary
- Field Detail
- Constructor Detail
- Method Detail
- Class MainActivity
- Field Detail
- Constructor Detail
- Method Detail
- Class MainFragment................................................................................................................................
- o Nested Class Summary
- Field Detail
- Constructor Detail
- Method Detail
- Class OnSale
- o Nested Class Summary
- Field Detail
- Constructor Detail
- Method Detail
- Class ProductDetail
- o Nested Class Summary
- Field Detail
- Constructor Detail
- Method Detail
- Class Settings...........................................................................................................................................
- Constructor Detail
- Method Detail
- Class SplashScreen
- Field Detail
- Constructor Detail
- Method Detail
- Class TouchEffect
- Method Detail
o public android.view.View onCreateView(android.view.LayoutInflater inflater, o android.view.ViewGroup container,
android.os.Bundle savedInstanceState)
Overrides:
onCreateView in class CustomFragment
o onClick
public void onClick(android.view.View v)
Specified by:
onClick in interface android.view.View.OnClickListener
Overrides:
onClick in class CustomFragment
o setupView
private void setupView(android.view.View v)
Setup the view components for this fragment. You write your code for
initializing the views, setting the adapters, touch and click listeners etc.
Parameters:
v - the base view of fragment
o loadDummyData
private void loadDummyData()
Load dummy product data for displaying on the RecyclerView. You need
to write your own code for loading real products from Web-service or
API and displaying them on RecyclerView.
o onCreateOptionsMenu
o public void onCreateOptionsMenu(android.view.Menu menu, android.view.MenuInflater inflater)
Overrides:
onCreateOptionsMenu in class android.support.v4.app.Fragment
com.glam
Class CheckoutActivity
public class CheckoutActivity extends CustomActivity
The Activity CheckoutActivity is just a container class for Checkout fragment to
allow checkout screen to be shown separately.
Constructor Detail
o CheckoutActivity
public CheckoutActivity()
Method Detail
o onCreate
protected void onCreate(android.os.Bundle savedInstanceState)
Overrides:
onCreate in class CustomActivity
o getSupportFragmentManager
public android.support.v4.app.FragmentManager getSupportFragmentM anager()
public boolean onOptionsItemSelected(android.view.MenuItem item)
Overrides:
onOptionsItemSelected in class android.app.Activity
o 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 onClick
public void onClick(android.view.View v)
Specified by:
onClick in interface android.view.View.OnClickListener
o setTouchNClick
public android.view.View setTouchNClick(int id)
Sets the touch and click listeners for a view..
Parameters:
id - the id of View
Returns:
the view
o setClick
public android.view.View setClick(int id)
Sets the click listener for a view.
Parameters:
id - the id of View
Returns:
the view
o getSupportFragmentManager
public android.support.v4.app.FragmentManager getSupportFragmentM anager()
com.glam.custom
Class CustomFragment
Direct Known Subclasses:
Checkout, MainFragment, OnSale, Settings
public class CustomFragment extends android.support.v4.app.Fragment implements android.view.View.OnClickListener
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()
public class Data extends java.lang.Object
The Class Data is simple Java bean class that holds two members only to
represent dummy data for app. You can customize or can write new bean
classes as per you needs.
Field Detail
o texts
private java.lang.String[] texts
The texts.
o resources
private int[] resources
The resources.
Constructor Detail
o Data
o public Data(java.lang.String[] texts, int[] resources)
Instantiates a new data.
Parameters:
texts - the texts
resources - the resources
Method Detail
o getTexts
public java.lang.String[] getTexts()
Gets the texts.
Returns:
the texts
o setTexts
public void setTexts(java.lang.String[] texts)
Sets the texts.
Parameters:
texts - the new texts
o getResources
public int[] getResources()
Gets the resources.
Returns:
the resources
o setResources
public void setResources(int[] resources)
Sets the resources.
Parameters:
resources - the new resources
com.glam
Class Home
com.glam.ui
Class LeftNavAdapter
public class LeftNavAdapter extends android.widget.BaseAdapter
The Adapter class for the ListView displayed in the left navigation drawer.
Field Detail
o items
private java.util.ArrayList items
The items.
o context
private android.content.Context context
The context.
o selection
private int selection
The selection.
Constructor Detail
o LeftNavAdapter
o public LeftNavAdapter(android.content.Context context, java.util.ArrayList items)
Instantiates a new left navigation adapter.
Parameters:
context - the context of activity
items - the array of items to be displayed on ListView
Method Detail
o isSelection
public int isSelection()
Checks if is selection.
Returns:
the int
o setSelection
public void setSelection(int selection)
Sets the selection.
Parameters:
selection - the new selection
o getCount
public int getCount()
o getItem
public Data getItem(int arg0)
o getItemId
public long getItemId(int position)
o getView
o public android.view.View getView(int position, o android.view.View convertView, android.view.ViewGroup parent)
private android.widget.LinearLayout vDots
The view that hold dots.
Constructor Detail
o Login
public Login()
Method Detail
o onCreate
protected void onCreate(android.os.Bundle savedInstanceState)
Overrides:
onCreate in class CustomActivity
o setupView
private void setupView()
Setup the click & other events listeners for the view components of this
screen. You can add your logic for Binding the data to TextViews and
other views as per your need.
o initPager
private void initPager()
Inits the pager view.
o setupDotbar
private void setupDotbar()
Setup the dotbar to show dots for pages of view pager with one dot as
selected to represent current page position.
o onClick
public void onClick(android.view.View v)
Specified by:
onClick in interface android.view.View.OnClickListener
Overrides:
onClick in class CustomActivity
o getSupportFragmentManager
public android.support.v4.app.FragmentManager getSupportFragmentM anager()
com.glam
Class MainActivity
public class MainActivity extends CustomActivity
The Activity MainActivity will launched after the Login and it is the Home/Base
activity of the app which holds all the Fragments and also show the Sliding
Navigation drawer. You can write your code for displaying actual items on
Drawer layout.
Field Detail
o drawerLayout
private android.support.v4.widget.DrawerLayout drawerLayout
The drawer layout.
o drawerLeft
private android.widget.ListView drawerLeft