// Path: src/com/openxc/openxcdiagnostic/util/ActivityLauncher.java
// public class ActivityLauncher {
// 
//     public static Map<Integer, Class<?>> sActivityMap = new HashMap<>();
// 
//     static {
//         sActivityMap.put(R.id.Diagnostic, DiagnosticActivity.class);
//         sActivityMap.put(R.id.Menu, MenuActivity.class);
//         sActivityMap.put(R.id.Dashboard, DashboardActivity.class);
//         sActivityMap.put(R.id.Dump, DumpActivity.class);
//     }
// 
//     public static void launchActivity(Activity activity, int itemId) {
// 
//         Class<?> newActivityClass = sActivityMap.get(Integer.valueOf(itemId));
//         if (!activity.getClass().equals(newActivityClass)) {
//             activity.startActivity(new Intent(activity, newActivityClass));
//         }
//     }
// 
// }


import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import com.openxc.openxcdiagnostic.R;
import com.openxc.openxcdiagnostic.util.ActivityLauncher;
            	MenuActivity.this.startActivity(intent);
            	Log.i(TAG, "Launching Grapher Activity");
            }
        });
        
    }    
    
    private void flipButtonBackground(View v) {
    	Drawable pressed = getResources().getDrawable(GridManager.MenuButtonPressedImgID);
    	Drawable unpressed = getResources().getDrawable(GridManager.MenuButtonUnpressedImgID);
    	if (GridManager.drawablesAreEqual(v.getBackground(), pressed)) {
    		v.setBackground(unpressed);
    	} else if (GridManager.drawablesAreEqual(v.getBackground(), unpressed)) {
    		v.setBackground(pressed);
    	}    	
    }

    @Override
    public void onResume() {
    	super.onResume();

    }

    @Override
    public void onPause() {
        super.onPause();
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
// Path: src/com/openxc/openxcdiagnostic/util/ActivityLauncher.java
// public class ActivityLauncher {
// 
//     public static Map<Integer, Class<?>> sActivityMap = new HashMap<>();
// 
//     static {
//         sActivityMap.put(R.id.Diagnostic, DiagnosticActivity.class);
//         sActivityMap.put(R.id.Menu, MenuActivity.class);
//         sActivityMap.put(R.id.Dashboard, DashboardActivity.class);
//         sActivityMap.put(R.id.Dump, DumpActivity.class);
//     }
// 
//     public static void launchActivity(Activity activity, int itemId) {
// 
//         Class<?> newActivityClass = sActivityMap.get(Integer.valueOf(itemId));
//         if (!activity.getClass().equals(newActivityClass)) {
//             activity.startActivity(new Intent(activity, newActivityClass));
//         }
//     }
// 
// }


// Path: src/com/openxc/openxcdiagnostic/menu/MenuActivity.java
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import com.openxc.openxcdiagnostic.R;
import com.openxc.openxcdiagnostic.util.ActivityLauncher;

            	MenuActivity.this.startActivity(intent);
            	Log.i(TAG, "Launching Grapher Activity");
            }
        });
        
    }    
    
    private void flipButtonBackground(View v) {
    	Drawable pressed = getResources().getDrawable(GridManager.MenuButtonPressedImgID);
    	Drawable unpressed = getResources().getDrawable(GridManager.MenuButtonUnpressedImgID);
    	if (GridManager.drawablesAreEqual(v.getBackground(), pressed)) {
    		v.setBackground(unpressed);
    	} else if (GridManager.drawablesAreEqual(v.getBackground(), unpressed)) {
    		v.setBackground(pressed);
    	}    	
    }

    @Override
    public void onResume() {
    	super.onResume();

    }

    @Override
    public void onPause() {
        super.onPause();
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        ActivityLauncher.launchActivity(this, item.getItemId());