List of usage examples for android.content Intent getFlags
public @Flags int getFlags()
From source file:org.geometerplus.android.fbreader.FBReader.java
@Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler(this)); bindService(new Intent(this, DataService.class), DataConnection, DataService.BIND_AUTO_CREATE); final Config config = Config.Instance(); config.runOnConnect(new Runnable() { public void run() { config.requestAllValuesForGroup("Options"); config.requestAllValuesForGroup("Style"); config.requestAllValuesForGroup("LookNFeel"); config.requestAllValuesForGroup("Fonts"); config.requestAllValuesForGroup("Colors"); config.requestAllValuesForGroup("Files"); }/*from w ww.j ava 2 s.c om*/ }); final ZLAndroidLibrary zlibrary = getZLibrary(); myShowStatusBarFlag = zlibrary.ShowStatusBarOption.getValue(); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.main); myRootView = (RelativeLayout) findViewById(R.id.root_view); myMainView = (ZLAndroidWidget) findViewById(R.id.main_view); setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL); zlibrary.setActivity(this); myFBReaderApp = (FBReaderApp) FBReaderApp.Instance(); if (myFBReaderApp == null) { myFBReaderApp = new FBReaderApp(new BookCollectionShadow()); } getCollection().bindToService(this, null); myBook = null; myFBReaderApp.setWindow(this); myFBReaderApp.initWindow(); myFBReaderApp.setExternalFileOpener(new ExternalFileOpener(this)); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, myShowStatusBarFlag ? 0 : WindowManager.LayoutParams.FLAG_FULLSCREEN); if (myFBReaderApp.getPopupById(TextSearchPopup.ID) == null) { new TextSearchPopup(myFBReaderApp); } if (myFBReaderApp.getPopupById(NavigationPopup.ID) == null) { new NavigationPopup(myFBReaderApp); } if (myFBReaderApp.getPopupById(SelectionPopup.ID) == null) { new SelectionPopup(myFBReaderApp); } myFBReaderApp.addAction(ActionCode.SHOW_LIBRARY, new ShowLibraryAction(this, myFBReaderApp)); myFBReaderApp.addAction(ActionCode.SHOW_PREFERENCES, new ShowPreferencesAction(this, myFBReaderApp)); myFBReaderApp.addAction(ActionCode.SHOW_BOOK_INFO, new ShowBookInfoAction(this, myFBReaderApp)); myFBReaderApp.addAction(ActionCode.SHOW_TOC, new ShowTOCAction(this, myFBReaderApp)); myFBReaderApp.addAction(ActionCode.SHOW_BOOKMARKS, new ShowBookmarksAction(this, myFBReaderApp)); myFBReaderApp.addAction(ActionCode.SHOW_NETWORK_LIBRARY, new ShowNetworkLibraryAction(this, myFBReaderApp)); myFBReaderApp.addAction(ActionCode.SHOW_MENU, new ShowMenuAction(this, myFBReaderApp)); myFBReaderApp.addAction(ActionCode.SHOW_NAVIGATION, new ShowNavigationAction(this, myFBReaderApp)); myFBReaderApp.addAction(ActionCode.SEARCH, new SearchAction(this, myFBReaderApp)); myFBReaderApp.addAction(ActionCode.SHARE_BOOK, new ShareBookAction(this, myFBReaderApp)); myFBReaderApp.addAction(ActionCode.SELECTION_SHOW_PANEL, new SelectionShowPanelAction(this, myFBReaderApp)); myFBReaderApp.addAction(ActionCode.SELECTION_HIDE_PANEL, new SelectionHidePanelAction(this, myFBReaderApp)); myFBReaderApp.addAction(ActionCode.SELECTION_COPY_TO_CLIPBOARD, new SelectionCopyAction(this, myFBReaderApp)); myFBReaderApp.addAction(ActionCode.SELECTION_SHARE, new SelectionShareAction(this, myFBReaderApp)); myFBReaderApp.addAction(ActionCode.SELECTION_TRANSLATE, new SelectionTranslateAction(this, myFBReaderApp)); myFBReaderApp.addAction(ActionCode.SELECTION_BOOKMARK, new SelectionBookmarkAction(this, myFBReaderApp)); myFBReaderApp.addAction(ActionCode.PROCESS_HYPERLINK, new ProcessHyperlinkAction(this, myFBReaderApp)); myFBReaderApp.addAction(ActionCode.OPEN_VIDEO, new OpenVideoAction(this, myFBReaderApp)); myFBReaderApp.addAction(ActionCode.SHOW_CANCEL_MENU, new ShowCancelMenuAction(this, myFBReaderApp)); myFBReaderApp.addAction(ActionCode.SET_SCREEN_ORIENTATION_SYSTEM, new SetScreenOrientationAction(this, myFBReaderApp, ZLibrary.SCREEN_ORIENTATION_SYSTEM)); myFBReaderApp.addAction(ActionCode.SET_SCREEN_ORIENTATION_SENSOR, new SetScreenOrientationAction(this, myFBReaderApp, ZLibrary.SCREEN_ORIENTATION_SENSOR)); myFBReaderApp.addAction(ActionCode.SET_SCREEN_ORIENTATION_PORTRAIT, new SetScreenOrientationAction(this, myFBReaderApp, ZLibrary.SCREEN_ORIENTATION_PORTRAIT)); myFBReaderApp.addAction(ActionCode.SET_SCREEN_ORIENTATION_LANDSCAPE, new SetScreenOrientationAction(this, myFBReaderApp, ZLibrary.SCREEN_ORIENTATION_LANDSCAPE)); if (ZLibrary.Instance().supportsAllOrientations()) { myFBReaderApp.addAction(ActionCode.SET_SCREEN_ORIENTATION_REVERSE_PORTRAIT, new SetScreenOrientationAction(this, myFBReaderApp, ZLibrary.SCREEN_ORIENTATION_REVERSE_PORTRAIT)); myFBReaderApp.addAction(ActionCode.SET_SCREEN_ORIENTATION_REVERSE_LANDSCAPE, new SetScreenOrientationAction(this, myFBReaderApp, ZLibrary.SCREEN_ORIENTATION_REVERSE_LANDSCAPE)); } myFBReaderApp.addAction(ActionCode.OPEN_WEB_HELP, new OpenWebHelpAction(this, myFBReaderApp)); myFBReaderApp.addAction(ActionCode.INSTALL_PLUGINS, new InstallPluginsAction(this, myFBReaderApp)); final Intent intent = getIntent(); final String action = intent.getAction(); myOpenBookIntent = intent; if ((intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) == 0) { if (FBReaderIntents.Action.CLOSE.equals(action)) { myCancelIntent = intent; myOpenBookIntent = null; } else if (FBReaderIntents.Action.PLUGIN_CRASH.equals(action)) { myFBReaderApp.ExternalBook = null; myOpenBookIntent = null; getCollection().bindToService(this, new Runnable() { public void run() { myFBReaderApp.openBook(null, null, null, FBReader.this); } }); } } }
From source file:com.android.documentsui.DocumentsActivity.java
public void onAppPicked(ResolveInfo info) { final Intent intent = new Intent(getIntent()); intent.setFlags(intent.getFlags() & ~Intent.FLAG_ACTIVITY_FORWARD_RESULT); intent.setComponent(//from w w w . ja v a2s .c om new ComponentName(info.activityInfo.applicationInfo.packageName, info.activityInfo.name)); startActivityForResult(intent, CODE_FORWARD); }
From source file:cn.edu.wyu.documentviewer.DocumentsActivity.java
public void onAppPicked(ResolveInfo info) { final Intent intent = new Intent(virtualIntent); intent.setFlags(intent.getFlags() & ~Intent.FLAG_ACTIVITY_FORWARD_RESULT); intent.setComponent(/*from w w w . ja v a 2 s . c o m*/ new ComponentName(info.activityInfo.applicationInfo.packageName, info.activityInfo.name)); startActivityForResult(intent, CODE_FORWARD); }
From source file:com.ycdyng.onemulti.OneActivity.java
private final void startFragmentForResult(Intent intent, int requestCode, int[] customAnimations) { hiddenSoftInput();/*from ww w . j av a 2 s . c o m*/ clearAvailIndices(); mCurTransaction = mFragmentManager.beginTransaction(); if (customAnimations != null && customAnimations.length >= 2) { mCurTransaction.setCustomAnimations(customAnimations[0], customAnimations[1]); } String name = makeFragmentName(getClass().getSimpleName(), intent.getComponent().getClassName()); Fragment fragment = getFragment(intent.getComponent().getClassName()); fragment.setTargetFragment(mCurrentPrimaryItem, requestCode); fragment.setArguments(intent.getExtras()); if (intent.getFlags() == LaunchMode.FLAG_FRAGMENT_NO_HISTORY && fragment instanceof MultiFragment) { ((MultiFragment) fragment).setLaunchMode(LaunchMode.FLAG_FRAGMENT_NO_HISTORY); } if (DEBUG) Log.v(TAG, "Adding item #" + name); mCurTransaction.add(android.R.id.content, fragment, name); mCurTransaction.hide(mCurrentPrimaryItem); if (fragment != mCurrentPrimaryItem) { if (mCurrentPrimaryItem != null) { mCurrentPrimaryItem.setMenuVisibility(false); mCurrentPrimaryItem.setUserVisibleHint(false); } fragment.setMenuVisibility(true); fragment.setUserVisibleHint(true); mCurrentPrimaryItem = fragment; } mCurTransaction.commitAllowingStateLoss(); mCurTransaction = null; }
From source file:com.android.contacts.activities.DialtactsActivity.java
/** * Stores the filter text associated with a FILTER_CONTACTS_ACTION intent. * This is so child activities can check if they are supposed to display a filter. * * @param intent The intent received in {@link #onNewIntent(Intent)} *//*ww w . j a v a 2 s. c om*/ private void setupFilterText(Intent intent) { // If the intent was relaunched from history, don't apply the filter text. if ((intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0) { return; } String filter = intent.getStringExtra(UI.FILTER_TEXT_EXTRA_KEY); if (filter != null && filter.length() > 0) { mFilterText = filter; } }
From source file:com.ycdyng.onemulti.OneActivity.java
public void startFragment(Intent intent, int[] customAnimations) { hiddenSoftInput();/*from ww w.j a v a 2 s.c o m*/ clearAvailIndices(); mCurTransaction = mFragmentManager.beginTransaction(); if (customAnimations != null && customAnimations.length >= 2) { mCurTransaction.setCustomAnimations(customAnimations[0], customAnimations[1]); } mCurTransaction.setTransitionStyle(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); String name = makeFragmentName(getClass().getSimpleName(), intent.getComponent().getClassName()); Fragment fragment = null; if (intent.getFlags() == LaunchMode.FLAG_FRAGMENT_CLEAR_TOP) { // at the top of the history stack ? if (mCurrentPrimaryItem.getClass().getName().equals(intent.getComponent().getClassName())) { // Yes fragment = mCurrentPrimaryItem; mCurTransaction.attach(mCurrentPrimaryItem); } else { // Do we already have this fragment? fragment = mFragmentManager.findFragmentByTag(name); if (fragment != null) { // Yes, we have mCurTransaction.attach(fragment); int attachFragmentIndex = getFragmentIndex(fragment); List<Fragment> availableFragments = getAvailableFragments(); for (int i = availableFragments.size() - 1; i >= 0; i--) { if (fragment != availableFragments.get(i)) { Fragment tempFragment = availableFragments.get(i); int index = getFragmentIndex(tempFragment); if (index > attachFragmentIndex) { mCurTransaction.remove(availableFragments.get(i)); } } } } else { fragment = getFragment(intent.getComponent().getClassName()); fragment.setArguments(intent.getExtras()); if (DEBUG) Log.v(TAG, "Adding item #" + name); mCurTransaction.add(android.R.id.content, fragment, name); if (mCurrentPrimaryItem != null) { mCurTransaction.detach(mCurrentPrimaryItem); } } } } else if (intent.getFlags() == LaunchMode.FLAG_FRAGMENT_CLEAR_ALL) { // add new fragment = getFragment(intent.getComponent().getClassName()); fragment.setArguments(intent.getExtras()); if (DEBUG) Log.v(TAG, "Adding item #" + name); mCurTransaction.add(android.R.id.content, fragment, name); // remove all List<Fragment> availableFragments = getAvailableFragments(); for (int i = availableFragments.size() - 1; i >= 0; i--) { mCurTransaction.remove(availableFragments.get(i)); } } else if (intent.getFlags() == LaunchMode.FLAG_FRAGMENT_SINGLE_INSTANCE) { // Do we already have this fragment? fragment = mFragmentManager.findFragmentByTag(name); if (fragment != null) { // Yes, we have mCurTransaction.attach(fragment); if (mCurrentPrimaryItem != null) { mCurTransaction.detach(mCurrentPrimaryItem); } } else { fragment = getFragment(intent.getComponent().getClassName()); fragment.setArguments(intent.getExtras()); if (DEBUG) Log.v(TAG, "Adding item #" + name); mCurTransaction.add(android.R.id.content, fragment, name); if (mCurrentPrimaryItem != null) { if (mCurrentPrimaryItem instanceof MultiFragment && ((MultiFragment) mCurrentPrimaryItem) .getLaunchMode() == LaunchMode.FLAG_FRAGMENT_NO_HISTORY) { mCurTransaction.remove(mCurrentPrimaryItem); } else { mCurTransaction.detach(mCurrentPrimaryItem); } } } } else if (intent.getFlags() == LaunchMode.FLAG_FRAGMENT_SINGLE_TOP) { if (mCurrentPrimaryItem.getClass().getName().equals(intent.getComponent().getClassName())) { mCurTransaction.attach(mCurrentPrimaryItem); } else { // Do we already have this fragment? fragment = mFragmentManager.findFragmentByTag(name); if (fragment != null) { int currentFragmentIndex = getFragmentIndex(mCurrentPrimaryItem); int fragmentIndex = getFragmentIndex(fragment); if (fragmentIndex > currentFragmentIndex) { mCurTransaction.attach(fragment); } else { fragment = getFragment(intent.getComponent().getClassName()); fragment.setArguments(intent.getExtras()); if (DEBUG) Log.v(TAG, "Adding item #" + name); mCurTransaction.add(android.R.id.content, fragment, name); } } else { fragment = getFragment(intent.getComponent().getClassName()); fragment.setArguments(intent.getExtras()); if (DEBUG) Log.v(TAG, "Adding item #" + name); mCurTransaction.add(android.R.id.content, fragment, name); } if (mCurrentPrimaryItem != null) { if (mCurrentPrimaryItem instanceof MultiFragment && ((MultiFragment) mCurrentPrimaryItem) .getLaunchMode() == LaunchMode.FLAG_FRAGMENT_NO_HISTORY) { mCurTransaction.remove(mCurrentPrimaryItem); } else { mCurTransaction.detach(mCurrentPrimaryItem); } } } } else { fragment = getFragment(intent.getComponent().getClassName()); fragment.setArguments(intent.getExtras()); if (DEBUG) Log.v(TAG, "Adding item #" + name); mCurTransaction.add(android.R.id.content, fragment, name); if (intent.getFlags() == LaunchMode.FLAG_FRAGMENT_NO_HISTORY && fragment instanceof MultiFragment) { ((MultiFragment) fragment).setLaunchMode(LaunchMode.FLAG_FRAGMENT_NO_HISTORY); } if (mCurrentPrimaryItem != null) { if (mCurrentPrimaryItem instanceof MultiFragment && ((MultiFragment) mCurrentPrimaryItem) .getLaunchMode() == LaunchMode.FLAG_FRAGMENT_NO_HISTORY) { mCurTransaction.remove(mCurrentPrimaryItem); } else { mCurTransaction.detach(mCurrentPrimaryItem); } } } if (mCurrentPrimaryItem != null && mCurrentPrimaryItem.getView() != null) { mCurrentPrimaryItem.getView().post(new Runnable() { @Override public void run() { finishOp(); } }); } else { finishOp(); } if (fragment != mCurrentPrimaryItem) { if (mCurrentPrimaryItem != null) { mCurrentPrimaryItem.setMenuVisibility(false); mCurrentPrimaryItem.setUserVisibleHint(false); } if (fragment != null) { fragment.setMenuVisibility(true); fragment.setUserVisibleHint(true); mCurrentPrimaryItem = fragment; } } }
From source file:org.andstatus.app.msg.TimelineActivity.java
private void attachmentSelected(Intent data) { Uri uri = UriUtils.notNull(data.getData()); if (!UriUtils.isEmpty(uri)) { UriUtils.takePersistableUriPermission(getActivity(), uri, data.getFlags()); mMessageEditor.startEditingCurrentWithAttachedMedia(uri); }//ww w .j a va 2 s . c o m }
From source file:de.cachebox_test.splash.java
@TargetApi(Build.VERSION_CODES.KITKAT) @Override/*from w w w .j a v a 2 s . c o m*/ protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK && requestCode == Global.REQUEST_CODE_GET_WRITE_PERMISSION_ANDROID_5) { Uri treeUri = data.getData(); Intent intent = new Intent(Intent.ACTION_GET_CONTENT); final int takeFlags = intent.getFlags() & (Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); // Check for the freshest data. // Uri workPathUri = Uri.parse(workPath); ContentResolver cr = getContentResolver(); grantUriPermission(getPackageName(), treeUri, Intent.FLAG_GRANT_READ_URI_PERMISSION); cr.takePersistableUriPermission(treeUri, takeFlags); List<UriPermission> permissionlist = cr.getPersistedUriPermissions(); LolipopworkPath = "content://com.android.externalstorage.documents/tree/B8C5-760B%3A";// treeUri.getPath(); Thread th = new Thread(new Runnable() { @Override public void run() { Initial(width, height); } }); th.start(); } if (resultCode == RESULT_OK && requestCode == Global.REQUEST_CODE_PICK_FILE_OR_DIRECTORY_FROM_PLATFORM_CONECTOR) { if (resultCode == android.app.Activity.RESULT_OK && data != null) { // obtain the filename Uri fileUri = data.getData(); if (fileUri != null) { String filePath = fileUri.getPath(); if (filePath != null) { if (getFolderReturnListener != null) getFolderReturnListener.getFolderReturn(filePath); } } } return; } }
From source file:org.readium.sdk.android.biblemesh.WebViewActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY); setContentView(R.layout.activity_web_view); final int abTitleId = getResources().getIdentifier("action_bar_title", "id", "android"); findViewById(abTitleId).setOnClickListener(new View.OnClickListener() { @Override/*from www. ja va 2 s .co m*/ public void onClick(View v) { finish(); } }); mWebview = (WebView) findViewById(R.id.webview); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && 0 != (getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE)) { WebView.setWebContentsDebuggingEnabled(true); } mProgress = (ProgressBar) findViewById(R.id.progressBar); initWebView(); final GestureDetector gestureDetector = new GestureDetector(this, new MyGestureListener()); mWebview.setOnTouchListener(new View.OnTouchListener() { private final static long MAX_TOUCH_DURATION = 150; float lastEventX; float m_DownTime; @Override public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: lastEventX = event.getX(); m_DownTime = event.getEventTime(); //init time break; case MotionEvent.ACTION_MOVE: { float distanceX = lastEventX - event.getX(); ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) mWebview .getLayoutParams(); marginLayoutParams.leftMargin = marginLayoutParams.leftMargin - (int) distanceX; marginLayoutParams.rightMargin = -marginLayoutParams.leftMargin;// marginLayoutParams.rightMargin + (int) distanceX; mWebview.requestLayout(); } break; case MotionEvent.ACTION_UP: { ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) mWebview .getLayoutParams(); if (marginLayoutParams.leftMargin < 10 && marginLayoutParams.leftMargin > -10) { Log.i("up", "small margin, open menu?"); if (event.getEventTime() - m_DownTime <= MAX_TOUCH_DURATION) { Log.i("up", "quick"); showActionBar(null); } else { Log.i("up", "too long"); } } } case MotionEvent.ACTION_CANCEL: { ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) mWebview .getLayoutParams(); //Log.i("snap", "snap width: "+mWebview.getWidth()+" left:" + marginLayoutParams.leftMargin + " raw:" + event.getRawX() + " " + event.getX());//+" "+e2.toString()+" "+e1.toString()); //mWebview.getWidth() if (marginLayoutParams.leftMargin < -0.5 * mWebview.getWidth()) { mReadiumJSApi.openPageRight(); mWebview.setAlpha(0.0f); } else if (marginLayoutParams.leftMargin > 0.5 * mWebview.getWidth()) { mReadiumJSApi.openPageLeft(); mWebview.setAlpha(0.0f); } else { snapBack(); //return true; } } break; } ; return gestureDetector.onTouchEvent(event); } }); /*mWebview.setHapticFeedbackEnabled(false);*/ Intent intent = getIntent(); if (intent.getFlags() == Intent.FLAG_ACTIVITY_NEW_TASK) { Bundle extras = intent.getExtras(); if (extras != null) { mContainer = ContainerHolder.getInstance().get(extras.getLong(Constants.CONTAINER_ID)); if (mContainer == null) { finish(); return; } mPackage = mContainer.getDefaultPackage(); String rootUrl = "http://" + EpubServer.HTTP_HOST + ":" + EpubServer.HTTP_PORT + "/"; mPackage.setRootUrls(rootUrl, null); try { mOpenPageRequestData = OpenPageRequest .fromJSON(extras.getString(Constants.OPEN_PAGE_REQUEST_DATA)); } catch (JSONException e) { Log.e(TAG, "Constants.OPEN_PAGE_REQUEST_DATA must be a valid JSON object: " + e.getMessage(), e); } } } // No need, EpubServer already launchers its own thread // new AsyncTask<Void, Void, Void>() { // @Override // protected Void doInBackground(Void... params) { // //xxx // return null; // } // }.execute(); mServer = new EpubServer(EpubServer.HTTP_HOST, EpubServer.HTTP_PORT, mPackage, quiet, dataPreProcessor); mServer.startServer(); // Load the page skeleton mWebview.loadUrl(READER_SKELETON); mViewerSettings = new ViewerSettings(ViewerSettings.SyntheticSpreadMode.SINGLE, ViewerSettings.ScrollMode.AUTO, 100, 20); mReadiumJSApi = new ReadiumJSApi(new ReadiumJSApi.JSLoader() { @Override public void loadJS(String javascript) { mWebview.loadUrl(javascript); } }); /*Button back = (Button)findViewById(R.id.btnBack); back.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onBackPressed(); if(getActionBar.isShowing()) { hideActionBar(); } else { getActionBar.show(); hideActionBar(); } } });*/ r = new Runnable() { @Override public void run() { getActionBar().hide(); //getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE); } }; hide2 = null; hideActionBar(); //ActionBar actionBar = getActionBar(); //actionBar.hide(); //getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); }
From source file:com.yahala.ui.LaunchActivity.java
private void handleIntent(Intent intent, boolean isNew, boolean restore) { boolean pushOpened = false; String push_user_jid = "0"; Integer push_chat_id = 0;/*from w ww.j av a2 s .c o m*/ Integer push_enc_id = 0; Integer open_settings = 0; photoPath = null; videoPath = null; sendingText = null; documentPath = null; imagesPathArray = null; documentsPathArray = null; // FileLog.e("intent.getAction()", intent.getAction().toString()); if ((intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) == 0) { if (intent.getAction() != null && intent.getAction().startsWith("com.yahala.openchat") && !restore) { int chatId = intent.getIntExtra("chatId", 0); String userId = intent.getStringExtra("user_jid"); int encId = intent.getIntExtra("encId", 0); if (chatId != 0) { TLRPC.Chat chat = MessagesController.getInstance().chats.get(chatId); if (chat != null) { NotificationCenter.getInstance().postNotificationName(MessagesController.closeChats); push_chat_id = chatId; } } else if (userId != null || userId != "") { TLRPC.User user = ContactsController.getInstance().friendsDict.get(userId); if (user != null) { FileLog.d("closeChats", "" + userId); NotificationCenter.getInstance().postNotificationName(MessagesController.closeChats); push_user_jid = userId; } } } } if (push_user_jid != "0") { if (push_user_jid == UserConfig.currentUser.phone) { open_settings = 1; } else { Bundle args = new Bundle(); args.putString("user_jid", push_user_jid); ChatActivity fragment = new ChatActivity(); fragment.setArguments(args); if (fragment.onFragmentCreate()) { pushOpened = true; ApplicationLoader.fragmentsStack.add(fragment); getSupportFragmentManager().beginTransaction() .replace(R.id.container, fragment, "chat" + Math.random()).commitAllowingStateLoss(); } } } else if (push_chat_id != 0) { Bundle args = new Bundle(); args.putInt("chat_id", push_chat_id); ChatActivity fragment = new ChatActivity(); fragment.setArguments(args); ApplicationLoader.fragmentsStack.add(fragment); fragment.onFragmentCreate(); pushOpened = true; } else if (push_enc_id != 0) { Bundle args = new Bundle(); args.putInt("enc_id", push_enc_id); ChatActivity fragment = new ChatActivity(); fragment.setArguments(args); ApplicationLoader.fragmentsStack.add(fragment); fragment.onFragmentCreate(); pushOpened = true; } /* if (videoPath != null || photoPathsArray != null || sendingText != null || documentsPathsArray != null || contactsToSend != null) { NotificationCenter.getInstance().postNotificationName(MessagesController.closeChats); Bundle args = new Bundle(); args.putBoolean("onlySelect", true); args.putString("selectAlertString", LocaleController.getString("ForwardMessagesTo", R.string.ForwardMessagesTo)); MessagesActivity fragment = new MessagesActivity(args); fragment.setDelegate(this); presentFragment(fragment, false, true); pushOpened = true; } */ if (open_settings != 0) { ApplicationLoader.fragmentsStack.clear(); SettingsActivity fragment = new SettingsActivity(); ApplicationLoader.fragmentsStack.add(fragment); getSupportFragmentManager().beginTransaction().replace(R.id.container, fragment, "settings") .commitAllowingStateLoss(); pushOpened = true; } if (!pushOpened && !isNew) { BaseFragment fragment = ApplicationLoader.fragmentsStack .get(ApplicationLoader.fragmentsStack.size() - 1); getSupportFragmentManager().beginTransaction().replace(R.id.container, fragment, fragment.getTag()) .commitAllowingStateLoss(); } intent.setAction(null); }