Java Code Examples for android.view.Menu#FIRST

The following examples show how to use android.view.Menu#FIRST . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DialChart4Activity.java    From XCL-Charts with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    super.onOptionsItemSelected(item);
    switch(item.getItemId())
    {
    case Menu.FIRST+1: 
    	//String chartsHelp[] = getResources().getStringArray(R.array.chartsHelp);	        
    	//String URL = chartsHelp[mSelected]; 	        	
    	String URL =getResources().getString(R.string.helpurl);	        		        
     Uri uri = Uri.parse(URL);  
     Intent intent2 = new Intent(Intent.ACTION_VIEW, uri);  
     startActivity(intent2);  
     finish();
        break;
    case Menu.FIRST+2:
     Intent intent = new Intent();  
		intent.setClass(DialChart4Activity.this,AboutActivity.class);    				
		startActivity(intent); 	        
        break;
    }
    return true;
}
 
Example 2
Source File: DialChartActivity.java    From XCL-Charts with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    super.onOptionsItemSelected(item);
    switch(item.getItemId())
    {
    case Menu.FIRST+1: 
    	//String chartsHelp[] = getResources().getStringArray(R.array.chartsHelp);	        
    	//String URL = chartsHelp[mSelected]; 	        	
    	String URL =getResources().getString(R.string.helpurl);	        		        
     Uri uri = Uri.parse(URL);  
     Intent intent2 = new Intent(Intent.ACTION_VIEW, uri);  
     startActivity(intent2);  
     finish();
        break;
    case Menu.FIRST+2:
     Intent intent = new Intent();  
		intent.setClass(DialChartActivity.this,AboutActivity.class);    				
		startActivity(intent); 	        
        break;
    }
    return true;
}
 
Example 3
Source File: HLNScrollActivity.java    From XCL-Charts with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    super.onOptionsItemSelected(item);
    switch(item.getItemId())
    {
    case Menu.FIRST+1: 
        
    	String URL =getResources().getString(R.string.helpurl);	        		        
     Uri uri = Uri.parse(URL);  
     Intent intent2 = new Intent(Intent.ACTION_VIEW, uri);  
     startActivity(intent2);  
     finish();
        break;
    case Menu.FIRST+2:
     Intent intent = new Intent();  
		intent.setClass(HLNScrollActivity.this,AboutActivity.class);    				
		startActivity(intent); 	        
        break;
    }
    return true;
}
 
Example 4
Source File: SpinnerActivity.java    From XCL-Charts with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    super.onOptionsItemSelected(item);
    switch(item.getItemId())
    {
    case Menu.FIRST+1:        	
    	String URL = getResources().getString(R.string.helpurl);	        		        
     Uri uri = Uri.parse(URL);  
     Intent intent2 = new Intent(Intent.ACTION_VIEW, uri);  
     startActivity(intent2);  
     finish();
        break;
    case Menu.FIRST+2:
     Intent intent = new Intent();  
		intent.setClass(SpinnerActivity.this,AboutActivity.class);    				
		startActivity(intent); 	        
        break;
     default:
    }
    return true;
}
 
Example 5
Source File: DailyReportFragment.java    From privacy-friendly-pedometer with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void inflateWalkingModeMenu(Menu menu) {
    // Add the walking modes to option menu
    menu.clear();
    menuWalkingModes = new HashMap<>();
    List<WalkingMode> walkingModes = WalkingModePersistenceHelper.getAllItems(getContext());
    int i = 0;
    for (WalkingMode walkingMode : walkingModes) {
        int id = Menu.FIRST + (i++);
        menuWalkingModes.put(id, walkingMode);
        menu.add(0, id, Menu.NONE, walkingMode.getName()).setChecked(walkingMode.isActive());
    }
    menu.add(1, Menu.FIRST + i, Menu.NONE, getString(R.string.correct_steps)).setCheckable(false);
    menuCorrectStepId = Menu.FIRST + i;
    menu.setGroupCheckable(0, true, true);
}
 
Example 6
Source File: ChartsActivity.java    From XCL-Charts with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    super.onOptionsItemSelected(item);
    switch(item.getItemId())
    {
    case Menu.FIRST+1: 
    	//String chartsHelp[] = getResources().getStringArray(R.array.chartsHelp);	        
    	//String URL = chartsHelp[mSelected]; 	        	
    	String URL =getResources().getString(R.string.helpurl);	        		        
     Uri uri = Uri.parse(URL);  
     Intent intent2 = new Intent(Intent.ACTION_VIEW, uri);  
     startActivity(intent2);  
     finish();
        break;
    case Menu.FIRST+2:
     Intent intent = new Intent();  
		intent.setClass(ChartsActivity.this,AboutActivity.class);    				
		startActivity(intent); 	        
        break;
    }
    return true;
}
 
Example 7
Source File: WithRecyclerViewActivity.java    From SmoothRefreshLayout with MIT License 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case android.R.id.home:
            onBackPressed();
            return true;
        case Menu.FIRST:
            if (mRefreshLayout.getFooterView().getStyle() == IRefreshView.STYLE_SCALE)
                ((MaterialFooter) mRefreshLayout.getFooterView())
                        .setStyle(IRefreshView.STYLE_DEFAULT);
            else
                ((MaterialFooter) mRefreshLayout.getFooterView())
                        .setStyle(IRefreshView.STYLE_SCALE);
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
 
Example 8
Source File: DialChart2Activity.java    From XCL-Charts with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    super.onOptionsItemSelected(item);
    switch(item.getItemId())
    {
    case Menu.FIRST+1: 
    	//String chartsHelp[] = getResources().getStringArray(R.array.chartsHelp);	        
    	//String URL = chartsHelp[mSelected]; 	        	
    	String URL =getResources().getString(R.string.helpurl);	        		        
     Uri uri = Uri.parse(URL);  
     Intent intent2 = new Intent(Intent.ACTION_VIEW, uri);  
     startActivity(intent2);  
     finish();
        break;
    case Menu.FIRST+2:
     Intent intent = new Intent();  
		intent.setClass(DialChart2Activity.this,AboutActivity.class);    				
		startActivity(intent); 	        
        break;
    }
    return true;
}
 
Example 9
Source File: GaugeChartActivity.java    From XCL-Charts with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    super.onOptionsItemSelected(item);
    switch(item.getItemId())
    {
    case Menu.FIRST+1: 
    	//String chartsHelp[] = getResources().getStringArray(R.array.chartsHelp);	        
    	//String URL = chartsHelp[mSelected]; 	        	
    	String URL =getResources().getString(R.string.helpurl);	        		        
     Uri uri = Uri.parse(URL);  
     Intent intent2 = new Intent(Intent.ACTION_VIEW, uri);  
     startActivity(intent2);  
     finish();
        break;
    case Menu.FIRST+2:
     Intent intent = new Intent();  
		intent.setClass(GaugeChartActivity.this,AboutActivity.class);    				
		startActivity(intent); 	        
        break;
    }
    return true;
}
 
Example 10
Source File: ClickChartsActivity.java    From XCL-Charts with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    super.onOptionsItemSelected(item);
    switch(item.getItemId())
    {
    case Menu.FIRST+1: 
    	//String chartsHelp[] = getResources().getStringArray(R.array.chartsHelp);	        
    	//String URL = chartsHelp[mSelected]; 	        	
    	String URL =getResources().getString(R.string.helpurl);	        		        
     Uri uri = Uri.parse(URL);  
     Intent intent2 = new Intent(Intent.ACTION_VIEW, uri);  
     startActivity(intent2);  
     finish();
        break;
    case Menu.FIRST+2:
     Intent intent = new Intent();  
		intent.setClass(ClickChartsActivity.this,AboutActivity.class);    				
		startActivity(intent); 	        
        break;
    }
    return true;
}
 
Example 11
Source File: DialChart3Activity.java    From XCL-Charts with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    super.onOptionsItemSelected(item);
    switch(item.getItemId())
    {
    case Menu.FIRST+1: 
    	//String chartsHelp[] = getResources().getStringArray(R.array.chartsHelp);	        
    	//String URL = chartsHelp[mSelected]; 	        	
    	String URL =getResources().getString(R.string.helpurl);	        		        
     Uri uri = Uri.parse(URL);  
     Intent intent2 = new Intent(Intent.ACTION_VIEW, uri);  
     startActivity(intent2);  
     finish();
        break;
    case Menu.FIRST+2:
     Intent intent = new Intent();  
		intent.setClass(DialChart3Activity.this,AboutActivity.class);    				
		startActivity(intent); 	        
        break;
    }
    return true;
}
 
Example 12
Source File: menus.java    From crosswalk-cordova-android with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    int base = Menu.FIRST;
    // Group, item id, order, title
    menu.add(base, base, base, "Item1");
    menu.add(base, base + 1, base + 1, "Item2");
    menu.add(base, base + 2, base + 2, "Item3");
    return true;
}
 
Example 13
Source File: menus.java    From cordova-android-chromeview with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    int base = Menu.FIRST;
    // Group, item id, order, title
    menu.add(base, base, base, "Item1");
    menu.add(base, base + 1, base + 1, "Item2");
    menu.add(base, base + 2, base + 2, "Item3");
    return true;
}
 
Example 14
Source File: WithWebViewActivity.java    From SmoothRefreshLayout with MIT License 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case android.R.id.home:
            onBackPressed();
            return true;
        case Menu.FIRST:
            mAutoRefreshUtil.autoRefresh(false, true);
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
 
Example 15
Source File: MonthlyReportFragment.java    From privacy-friendly-pedometer with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void inflateWalkingModeMenu(Menu menu) {
    // Add the walking modes to option menu
    menu.clear();
    menuWalkingModes = new HashMap<>();
    List<WalkingMode> walkingModes = WalkingModePersistenceHelper.getAllItems(getContext());
    int i = 0;
    for (WalkingMode walkingMode : walkingModes) {
        int id = Menu.FIRST + (i++);
        menuWalkingModes.put(id, walkingMode);
        menu.add(0, id, Menu.NONE, walkingMode.getName()).setChecked(walkingMode.isActive());
    }
    menu.setGroupCheckable(0, true, true);
}
 
Example 16
Source File: WeeklyReportFragment.java    From privacy-friendly-pedometer with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void inflateWalkingModeMenu(Menu menu) {
    // Add the walking modes to option menu
    menu.clear();
    menuWalkingModes = new HashMap<>();
    List<WalkingMode> walkingModes = WalkingModePersistenceHelper.getAllItems(getContext());
    int i = 0;
    for (WalkingMode walkingMode : walkingModes) {
        int id = Menu.FIRST + (i++);
        menuWalkingModes.put(id, walkingMode);
        menu.add(0, id, Menu.NONE, walkingMode.getName()).setChecked(walkingMode.isActive());
    }
    menu.setGroupCheckable(0, true, true);
}
 
Example 17
Source File: TrainingActivity.java    From privacy-friendly-pedometer with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    // Add the walking modes to option menu
    menu.clear();
    menuWalkingModes = new HashMap<>();
    List<WalkingMode> walkingModes = WalkingModePersistenceHelper.getAllItems(this);
    int i = 0;
    for (WalkingMode walkingMode : walkingModes) {
        int id = Menu.FIRST + (i++);
        menuWalkingModes.put(id, walkingMode);
        menu.add(0, id, Menu.NONE, walkingMode.getName()).setChecked(walkingMode.isActive());
    }
    menu.setGroupCheckable(0, true, true);
    return super.onPrepareOptionsMenu(menu);
}
 
Example 18
Source File: TrainingOverviewActivity.java    From privacy-friendly-pedometer with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    // Add the walking modes to option menu
    menu.clear();
    menuWalkingModes = new HashMap<>();
    List<WalkingMode> walkingModes = WalkingModePersistenceHelper.getAllItems(this);
    int i = 0;
    for (WalkingMode walkingMode : walkingModes) {
        int id = Menu.FIRST + (i++);
        menuWalkingModes.put(id, walkingMode);
        menu.add(0, id, Menu.NONE, walkingMode.getName()).setChecked(walkingMode.isActive());
    }
    menu.setGroupCheckable(0, true, true);
    return super.onPrepareOptionsMenu(menu);
}
 
Example 19
Source File: menus.java    From cordova-amazon-fireos with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    int base = Menu.FIRST;
    // Group, item id, order, title
    menu.add(base, base, base, "Item1");
    menu.add(base, base + 1, base + 1, "Item2");
    menu.add(base, base + 2, base + 2, "Item3");
    return true;
}
 
Example 20
Source File: UserDetailedInfoActivity.java    From weixin with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
	switch (item.getItemId()) {
	case android.R.id.home://返回上一菜单页
		AppToast.getToast().show("返回上一页");
		Intent upIntent = NavUtils.getParentActivityIntent(this);
		if (NavUtils.shouldUpRecreateTask(this, upIntent)) {
			TaskStackBuilder.create(this).addNextIntentWithParentStack(upIntent).startActivities();
		} else {
			upIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
			NavUtils.navigateUpTo(this, upIntent);
		}
		break;
	case R.id.menu_userDetailedInfo_pencil:
		AppToast.getToast().show(R.string.text_menu_userDetailedInfo_pencil);
		break;
	case R.id.menu_userDetailedInfo_stars:
		AppToast.getToast().show(R.string.text_menu_userDetailedInfo_stars);
		break;
	case R.id.menu_userDetailedInfo_jurisdiction:
		AppToast.getToast().show(R.string.text_menu_userDetailedInfo_jurisdiction);
		break;
	case R.id.menu_userDetailedInfo_forward:
		AppToast.getToast().show(R.string.text_menu_userDetailedInfo_forward);
		break;
	case R.id.menu_userDetailedInfo_blacklist:
		AppToast.getToast().show(R.string.text_menu_userDetailedInfo_blacklist);
		break;
	case R.id.menu_userDetailedInfo_delete:
		AppToast.getToast().show(R.string.text_menu_userDetailedInfo_delete);
		break;
	case Menu.FIRST + 1:
		AppToast.getToast().show(R.string.text_menu_userDetailedInfo_addTodesktop);
		break;
	default:
		break;
	}
	return super.onOptionsItemSelected(item);
}