Android Open Source - StoichiometryForDummies Launcher Menu






From Project

Back to project page StoichiometryForDummies.

License

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.

Java Source Code

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);
  }
}




Java Source Code List

com.noahl98.perGProject.BalancingFragment.java
com.noahl98.perGProject.BuildConfig.java
com.noahl98.perGProject.FontAdapter.java
com.noahl98.perGProject.IntroFragment.java
com.noahl98.perGProject.LauncherMenu.java
com.noahl98.perGProject.LinksFragment.java
com.noahl98.perGProject.MainMenuActivity.java
com.noahl98.perGProject.MoleFragment.java
com.noahl98.perGProject.RatioFragment.java
com.noahl98.perGProject.ReagentFragment.java
com.noahl98.perGProject.SignificantFragment.java
com.noahl98.perGProject.YieldFragment.java