Back to project page StoichiometryForDummies.
The source code is released under:
GNU Lesser General Public License
If you think the Android project StoichiometryForDummies listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.noahl98.perGProject; /*from w w w. j av a2s . c o m*/ import java.util.ArrayList; import android.R.anim; import android.content.Intent; import android.graphics.Typeface; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ListView; import android.widget.TextView; public class LauncherMenu extends FragmentActivity{ ListView listView1; //names of items in the ToC String[] items = {"Intro", "Balancing Equations", "Significant Digits","Moles and Conversions", "Ratios", "Limiting Reagents", "Theoretical and Percent Yield", "External Links"}; ArrayList<String> finalItems; private FontAdapter arrayAdapter; private TextView toc; private TextView label; public static TextView introTitle; public static Typeface coolvetica; public static Typeface stoneBird; @Override public void onCreate(Bundle arg0){ super.onCreate(arg0); setContentView(R.layout.list_layout); //moves list items to finalList finalItems = new ArrayList<String>(); for(int i=0; i<items.length;i++){ finalItems.add(items[i]); } //defines needed vars listView1 = (ListView) findViewById(R.id.list); toc = (TextView) findViewById(R.id.toc_view); label = (TextView) findViewById(R.id.label); introTitle = (TextView)findViewById(R.id.intro_title); //setup for fragment transactions later on //sets up the listview for the table of contents and populates it arrayAdapter = new FontAdapter(this, finalItems); listView1.setAdapter(arrayAdapter); //sets an onItemClickListener for the table of contents listView1.setOnItemClickListener(new OnItemClickListener(){ @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // TODO Auto-generated method stub if(position==0){ Intent intent = new Intent(LauncherMenu.this, IntroFragment.class); startActivity(intent); }else if(position==1){ Intent intent= new Intent(LauncherMenu.this, BalancingFragment.class); startActivity(intent); }else if(position==2){ Intent intent = new Intent(LauncherMenu.this, SignificantFragment.class); startActivity(intent); }else if(position==3){ Intent intent = new Intent(LauncherMenu.this, MoleFragment.class); startActivity(intent); }else if(position==4){ Intent intent = new Intent(LauncherMenu.this, RatioFragment.class); startActivity(intent); }else if(position==5){ Intent intent = new Intent(LauncherMenu.this, ReagentFragment.class); startActivity(intent); }else if(position==6){ Intent intent = new Intent(LauncherMenu.this, YieldFragment.class); startActivity(intent); }else if(position==7){ Intent intent = new Intent(LauncherMenu.this, LinksFragment.class); startActivity(intent); } } }); //changes the fonts stoneBird = Typeface.createFromAsset(getAssets(), "fonts/StoneBird.ttf"); coolvetica = Typeface.createFromAsset(getAssets(), "fonts/coolvetica_rg.ttf"); toc.setTypeface(coolvetica); } }