@Override protected void onNewIntent(final Intent intent) { setIntent(intent); handleIntent(intent, false); }
@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); // enable progress bar above action bar requestWindowFeature(Window.FEATURE_PROGRESS); setContentView(R.layout.activity_main); mImageLoading = findViewById(R.id.imageLoading); mIitcWebView = (IITC_WebView) findViewById(R.id.iitc_webview); mLvDebug = (ListView) findViewById(R.id.lvDebug); mViewDebug = findViewById(R.id.viewDebug); mBtnToggleMap = (ImageButton) findViewById(R.id.btnToggleMapVisibility); mEditCommand = (EditText) findViewById(R.id.editCommand); mEditCommand.setOnEditorActionListener( new TextView.OnEditorActionListener() { @Override public boolean onEditorAction( final TextView v, final int actionId, final KeyEvent event) { if (EditorInfo.IME_ACTION_GO == actionId || EditorInfo.IME_ACTION_SEND == actionId || EditorInfo.IME_ACTION_DONE == actionId) { onBtnRunCodeClick(v); final InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(v.getWindowToken(), 0); return true; } return false; } }); mLvDebug.setAdapter(new IITC_LogAdapter(this)); mLvDebug.setOnItemLongClickListener(this); // do something if user changed something in the settings mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); mSharedPrefs.registerOnSharedPreferenceChangeListener(this); // enable/disable mDesktopMode mode on menu create and url load mDesktopMode = mSharedPrefs.getBoolean("pref_force_desktop", false); // enable/disable advance menu final String[] menuDefaults = getResources().getStringArray(R.array.pref_android_menu_default); mAdvancedMenu = mSharedPrefs.getStringSet( "pref_android_menu", new HashSet<String>(Arrays.asList(menuDefaults))); mPersistentZoom = mSharedPrefs.getBoolean("pref_persistent_zoom", false); // get fullscreen status from settings mIitcWebView.updateFullscreenStatus(); mFileManager = new IITC_FileManager(this); mFileManager.setUpdateInterval( Integer.parseInt(mSharedPrefs.getString("pref_update_plugins_interval", "7"))); mUserLocation = new IITC_UserLocation(this); mUserLocation.setLocationMode( Integer.parseInt(mSharedPrefs.getString("pref_user_location_mode", "0"))); // pass ActionBar to helper because we deprecated getActionBar mNavigationHelper = new IITC_NavigationHelper(this, super.getActionBar()); mMapSettings = new IITC_MapSettings(this); // Clear the back stack mBackStack.clear(); // receive downloadManagers downloadComplete intent // afterwards install iitc update registerReceiver( mBroadcastReceiver, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)); final NfcAdapter nfc = NfcAdapter.getDefaultAdapter(this); if (nfc != null) nfc.setNdefPushMessageCallback(this, this); handleIntent(getIntent(), true); }