Android Open Source - ManipalNow-Android Coffee






From Project

Back to project page ManipalNow-Android.

License

The source code is released under:

Apache License

If you think the Android project ManipalNow-Android 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.example.nav;
//  w  w  w  .j av  a2 s.c om
import java.util.Locale;

import android.app.Activity;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.speech.tts.TextToSpeech;
import android.speech.tts.TextToSpeech.OnInitListener;
import android.support.v4.app.NavUtils;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.GridView;

public class Coffee extends ActionBarActivity {

  static final String speak1="Here are some of the restaurants near you";
  //TextToSpeech tts;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.city1);
    // Show the Up button in the action bar.
    setupActionBar();
    ActionBar ab=getSupportActionBar();
        Resources r=getResources();
    Drawable d=r.getDrawable(R.color.playred);
    ab.setBackgroundDrawable(d);
    
    //tts=new TextToSpeech(Coffee.this,new OnInitListener() {
      
      /*public void onInit(int status) {
        // TODO Auto-generated method stub
        if(status!=TextToSpeech.ERROR)
        {
          tts.setLanguage(Locale.UK);
        }
      }
    });
    tts.speak(speak1, TextToSpeech.QUEUE_FLUSH, null);
    */GridView gv1=(GridView)findViewById(R.id.gridview);
    Level data[]=new Level[]
        {
         new Level("Barista","",R.drawable.barista2),
         new Level("Basil Cafe","",R.drawable.basil),
         new Level("Cafe Coffee Day","",R.drawable.ccd),
         new Level("Cosmo Cafe",R.drawable.cosmo),
         new Level("Cafe MnM",R.drawable.mnm),
         new Level("7 Bees",R.drawable.cafe_empty),
         };
    ImageAdapter ia=new ImageAdapter(this, R.layout.grid_item_2, data);
    gv1.setAdapter(ia);


  }

  /**
   * Set up the {@link android.app.ActionBar}.
   */
  private void setupActionBar() {

    getActionBar().setDisplayHomeAsUpEnabled(true);

  }

  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.coffee, menu);
    return true;
  }

  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
      // This ID represents the Home or Up button. In the case of this
      // activity, the Up button is shown. Use NavUtils to allow users
      // to navigate up one level in the application structure. For
      // more details, see the Navigation pattern on Android Design:
      //
      // http://developer.android.com/design/patterns/navigation.html#up-vs-back
      //
      NavUtils.navigateUpFromSameTask(this);
      this.overridePendingTransition(R.anim.push_down_out,R.anim.push_down_in);

      return true;
    }
    return super.onOptionsItemSelected(item);
  }

}




Java Source Code List

com.example.nav.BarFragment.java
com.example.nav.BarInfo.java
com.example.nav.Bars.java
com.example.nav.CafeFragment.java
com.example.nav.CafeInfo.java
com.example.nav.Cafes.java
com.example.nav.Coffee.java
com.example.nav.Food.java
com.example.nav.HelpAct.java
com.example.nav.HelpFragment1.java
com.example.nav.HelpFragment2.java
com.example.nav.HelpFragment3.java
com.example.nav.HelpFragment4.java
com.example.nav.HelpFragment5.java
com.example.nav.HelpFragment6.java
com.example.nav.HelpFragment7.java
com.example.nav.HelpFragment8.java
com.example.nav.HospitalFragment.java
com.example.nav.HospitalInfo.java
com.example.nav.Hospitals.java
com.example.nav.ImageAdapter.java
com.example.nav.LevelAdapter.java
com.example.nav.Level.java
com.example.nav.MainActivity.java
com.example.nav.RestaurantFragment.java
com.example.nav.RestaurantInfo.java
com.example.nav.Restaurants.java
com.example.nav.Settings3.java
com.example.nav.ShowCity3.java
com.example.nav.ShowCity5.java
com.example.nav.ShowCity6.java
com.example.nav.ShowCity7.java
com.example.nav.util.SystemUiHiderBase.java
com.example.nav.util.SystemUiHiderHoneycomb.java
com.example.nav.util.SystemUiHider.java