Change around the handling for navigation from the action bar.
This commit is contained in:
		
							parent
							
								
									cfac7dcc81
								
							
						
					
					
						commit
						bdb8298979
					
				| @ -11,7 +11,8 @@ public abstract class ActivityHelpers { | ||||
| 
 | ||||
| 	public static void goHome( Activity parent ) { | ||||
| 		Intent i = new Intent(parent, Main.class); | ||||
| 		i.addFlags( Intent.FLAG_ACTIVITY_CLEAR_TOP); | ||||
| 		i.putExtra(Main.restartFlag, true); | ||||
| 		i.addFlags( Intent.FLAG_ACTIVITY_CLEAR_TOP + Intent.FLAG_ACTIVITY_NEW_TASK ); | ||||
| 		parent.startActivity(i); | ||||
| 	} | ||||
| 	 | ||||
|  | ||||
| @ -2,6 +2,7 @@ package net.sf.openrocket.android; | ||||
| 
 | ||||
| import net.sf.openrocket.R; | ||||
| import net.sf.openrocket.android.rocket.OpenRocketLoaderActivity; | ||||
| import android.content.Intent; | ||||
| import android.os.Bundle; | ||||
| import android.view.View; | ||||
| import android.widget.Button; | ||||
| @ -12,15 +13,16 @@ import com.actionbarsherlock.view.MenuItem; | ||||
| 
 | ||||
| public class Main extends OpenRocketLoaderActivity { | ||||
| 
 | ||||
| 	public final static String restartFlag = "restart"; | ||||
| 
 | ||||
| 	/** Called when the activity is first created. */ | ||||
| 	@Override | ||||
| 	public void onCreate(Bundle icicle) { | ||||
| 		super.onCreate(icicle); | ||||
| 		// Rocket already loaded.  go to viewer. | ||||
| 		if ( CurrentRocketHolder.getCurrentRocket().getRocketDocument() != null ) { | ||||
| 		Intent i = getIntent(); | ||||
| 		// Rocket already loaded.  go to viewer unless we want to restart. | ||||
| 		if ( ( i.getBooleanExtra(restartFlag, false) == false)  && CurrentRocketHolder.getCurrentRocket().getRocketDocument() != null ) { | ||||
| 			moveOnToViewer(); | ||||
| 			return; | ||||
| 		} | ||||
| 		setContentView(R.layout.main); | ||||
| 		((Button) findViewById(R.id.main_open)).setOnClickListener( | ||||
|  | ||||
| @ -53,7 +53,9 @@ implements MotorListFragment.OnMotorSelectedListener | ||||
| 		AndroidLogWrapper.d(MotorBrowserActivity.class,"onMenuItemSelected" + item.getItemId()); | ||||
| 		switch(item.getItemId()) { | ||||
| 		case android.R.id.home: | ||||
| 			ActivityHelpers.goHome(this); | ||||
| 			// we implement home in the motor browser as "back" since then it will return to | ||||
| 			// either main or the viewer. | ||||
| 			finish(); | ||||
| 			return true; | ||||
| 		case R.id.download_from_thrustcurve_menu_option: | ||||
| 			ActivityHelpers.downloadFromThrustcurve(this,DOWNLOAD_REQUEST_CODE); | ||||
|  | ||||
| @ -42,7 +42,7 @@ implements Simulations.OnSimulationSelectedListener | ||||
| 		super.onCreate(savedInstanceState); | ||||
| 
 | ||||
| 		setTitle(CurrentRocketHolder.getCurrentRocket().getRocketDocument().getRocket().getName()); | ||||
| 		getSupportActionBar().setDisplayHomeAsUpEnabled(true); | ||||
| 		getSupportActionBar().setHomeButtonEnabled(true); | ||||
| 
 | ||||
| 		setContentView(R.layout.openrocketviewer); | ||||
| 		ViewPager viewPager = (ViewPager)findViewById(R.id.pager); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user