Android Open Source - Gloggr Menu Helper






From Project

Back to project page Gloggr.

License

The source code is released under:

GNU General Public License

If you think the Android project Gloggr 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.JordHan.Gloggr.Helper;
/*w ww. j a  va2s. co  m*/
import android.content.Context;
import android.content.Intent;
import android.view.MenuItem;
import android.widget.Toast;

import com.JordHan.Gloggr.R;
import com.JordHan.Gloggr.Activities.CurrentlyPlayingActivity;
import com.JordHan.Gloggr.Activities.GameListActivity;
import com.JordHan.Gloggr.Activities.MainActivity;
import com.JordHan.Gloggr.Activities.PreferencesActivity;

public class MenuHelper {
  // Pass in MenuItem
  // Return an Intent to an activity to open
  public static Intent performMenuOperation(MenuItem item, Context baseContext, Context applicationContext) {
        Intent activityToSwitchTo = new Intent();

        switch(item.getItemId()) {
        case R.id.itemMainActivity:
            activityToSwitchTo = new Intent(baseContext, MainActivity.class);
          break;
        case R.id.itemCurrentlyPlayingActivity:
          activityToSwitchTo = new Intent(baseContext, CurrentlyPlayingActivity.class);
          break;
        case R.id.itemGameListActivity:
          activityToSwitchTo = new Intent(baseContext, GameListActivity.class);
          break;
        case R.id.itemPreferencesActivity:
          activityToSwitchTo = new Intent(baseContext, PreferencesActivity.class);
          break;
        default:
          Toast.makeText(applicationContext, "Error opening activity", Toast.LENGTH_SHORT).show();
          activityToSwitchTo = null;
        }
        
        return activityToSwitchTo;
  }
}




Java Source Code List

com.JordHan.Gloggr.Activities.CurrentlyPlayingActivity.java
com.JordHan.Gloggr.Activities.GameListActivity.java
com.JordHan.Gloggr.Activities.MainActivity.java
com.JordHan.Gloggr.Activities.PreferencesActivity.java
com.JordHan.Gloggr.Activities.SearchActivity.java
com.JordHan.Gloggr.Activities.Notification.AboutAppActivity.java
com.JordHan.Gloggr.Activities.Notification.AboutDeveloperActivity.java
com.JordHan.Gloggr.Helper.MenuHelper.java
com.JordHan.Gloggr.Model.Game.java
com.JordHan.Gloggr.Services.AbstractService.java
com.JordHan.Gloggr.Services.GameSearchService.java
com.JordHan.Gloggr.Services.IServiceListener.java
com.JordHan.Gloggr.db.DatabaseHelper.java
com.JordHan.Gloggr.db.DatabaseManager.java