Android Open Source - bodyapps-android Main Activity






From Project

Back to project page bodyapps-android.

License

The source code is released under:

GNU Lesser General Public License

If you think the Android project bodyapps-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

/*
 * Copyright (c) 2014, Fashiontec (http://fashiontec.org)
 * Licensed under LGPL, Version 3/*w ww.  j  a v  a2s. c o  m*/
 */

package fossasia.valentina.bodyapp.main;

import android.app.Activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

/**
 * 
 * Landing Screen of the app. All the functions will start from here.
 *
 */

public class MainActivity extends Activity implements OnClickListener{

  private Button create;
  private Button saved;
  private Button settings;
  private Button exit;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    
    exit=(Button)findViewById(R.id.main_btn_exit);
    exit.setOnClickListener(this);
    saved=(Button)findViewById(R.id.main_btn_saved);
    saved.setOnClickListener(this);
    settings=(Button)findViewById(R.id.main_btn_settings);
    settings.setOnClickListener(this);
    create=(Button)findViewById(R.id.main_btn_create);
    create.setOnClickListener(this);
  }

  @Override
  public boolean onCreateOptionsMenu(Menu menu) {

    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
  }

  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    if (id == R.id.action_settings) {
      return true;
    }
    return super.onOptionsItemSelected(item);
  }

  @Override
  public void onClick(View v) {
    //Handles the clicks of every Button
    Intent intent;
    switch (v.getId()) {
    case R.id.main_btn_create:
      intent=new Intent(MainActivity.this, CreateActivity.class);
      startActivity(intent);
      break;
    case R.id.main_btn_saved:
      intent=new Intent(MainActivity.this, SavedActivity.class);
      startActivity(intent);
      break;
    case R.id.main_btn_settings:
      intent=new Intent(MainActivity.this, SettingsActivity.class);
      startActivity(intent);
      break;
    case R.id.main_btn_exit:
      finish();
      break;
    }
    
  }
  @Override
  public void onBackPressed() {
    finish();
  }


}




Java Source Code List

fossasia.valentina.bodyapp.db.DBContract.java
fossasia.valentina.bodyapp.db.DatabaseHandler.java
fossasia.valentina.bodyapp.main.CreateActivity.java
fossasia.valentina.bodyapp.main.GridAdapter.java
fossasia.valentina.bodyapp.main.MainActivity.java
fossasia.valentina.bodyapp.main.MeasurementActivity.java
fossasia.valentina.bodyapp.main.SavedActivity.java
fossasia.valentina.bodyapp.main.SavedAdapter.java
fossasia.valentina.bodyapp.main.SettingsActivity.java
fossasia.valentina.bodyapp.managers.MeasurementManager.java
fossasia.valentina.bodyapp.managers.PersonManager.java
fossasia.valentina.bodyapp.managers.UserManager.java
fossasia.valentina.bodyapp.models.MeasurementListModel.java
fossasia.valentina.bodyapp.models.Measurement.java
fossasia.valentina.bodyapp.models.Person.java
fossasia.valentina.bodyapp.models.User.java
fossasia.valentina.bodyapp.sync.SyncMeasurement.java
fossasia.valentina.bodyapp.sync.SyncUser.java
fossasia.valentina.bodyapp.sync.Sync.java