android.content.Intent#FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY源码实例Demo

下面列出了android.content.Intent#FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: OpenLibre   文件: MainActivity.java
private void resolveIntent(Intent data) {
    this.setIntent(data);

    if ((data.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0) {
        return;
    }

    if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(data.getAction())) {
        mLastNfcTag = data.getParcelableExtra(NfcAdapter.EXTRA_TAG);
        long now = new Date().getTime();

        if (mContinuousSensorReadingFlag) {
            startContinuousSensorReadingTimer();

        } else if (now - mLastScanTime > 5000) {
            DataPlotFragment dataPlotFragment = (DataPlotFragment)
                    mSectionsPagerAdapter.getRegisteredFragment(R.integer.viewpager_page_show_scan);
            if (dataPlotFragment != null) {
                dataPlotFragment.clearScanData();
            }

            new NfcVReaderTask(this).execute(mLastNfcTag);
        }
    }
}
 
源代码2 项目: SendBird-Android   文件: SplashActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);

    if (getIntent() != null && (getIntent().getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) == Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) {
        getIntent().removeExtra(MainActivity.EXTRA_GROUP_CHANNEL_URL);
    }

    if (ConnectionManager.isLogin() && PreferenceUtils.getUserId() != null) {
        setUpSyncManager();
    } else {
        startActivity(new Intent(SplashActivity.this, LoginActivity.class));
        finish();
    }
}
 
源代码3 项目: delion   文件: ChromeTabbedActivity.java
@Override
public void preInflationStartup() {
    super.preInflationStartup();

    // Decide whether to record startup UMA histograms. This is done  early in the main
    // Activity.onCreate() to avoid recording navigation delays when they require user input to
    // proceed. For example, FRE (First Run Experience) happens before the activity is created,
    // and triggers initialization of the native library. At the moment it seems safe to assume
    // that uninitialized native library is an indication of an application start that is
    // followed by navigation immediately without user input.
    if (!LibraryLoader.isInitialized()) {
        UmaUtils.setRunningApplicationStart(true);
    }

    CommandLine commandLine = CommandLine.getInstance();
    if (commandLine.hasSwitch(ContentSwitches.ENABLE_TEST_INTENTS)
            && getIntent() != null
            && getIntent().hasExtra(
                    ChromeTabbedActivity.INTENT_EXTRA_TEST_RENDER_PROCESS_LIMIT)) {
        int value = getIntent().getIntExtra(
                ChromeTabbedActivity.INTENT_EXTRA_TEST_RENDER_PROCESS_LIMIT, -1);
        if (value != -1) {
            String[] args = new String[1];
            args[0] = "--" + ContentSwitches.RENDER_PROCESS_LIMIT
                    + "=" + Integer.toString(value);
            commandLine.appendSwitchesAndArguments(args);
        }
    }

    supportRequestWindowFeature(Window.FEATURE_ACTION_MODE_OVERLAY);

    // We are starting from history with a URL after data has been cleared. On Samsung this
    // can happen after user clears data and clicks on a recents item on pre-L devices.
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP
            && getIntent().getData() != null
            && (getIntent().getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0
            && OmahaClient.isFreshInstallOrDataHasBeenCleared(getApplicationContext())) {
        getIntent().setData(null);
    }
}
 
源代码4 项目: xDrip   文件: NFCFilterX.java
@Override
protected void onResume() {
    super.onResume();

    final Intent intent = getIntent();
    this.setIntent(intent);

    if ((intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0) {
        return;
    }
    NFCReaderX.scanFromActivity(this, intent);

}
 
源代码5 项目: xDrip   文件: NFCFilterX.java
@Override
protected void onResume() {
    super.onResume();

    final Intent intent = getIntent();
    this.setIntent(intent);

    if ((intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0) {
        return;
    }
    NFCReaderX.scanFromActivity(this, intent);

}
 
源代码6 项目: xDrip-plus   文件: NFCFilterX.java
@Override
protected void onResume() {
    super.onResume();

    final Intent intent = getIntent();
    this.setIntent(intent);

    if ((intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0) {
        return;
    }
    NFCReaderX.scanFromActivity(this, intent);

}
 
源代码7 项目: xDrip-plus   文件: NFCFilterX.java
@Override
protected void onResume() {
    super.onResume();

    final Intent intent = getIntent();
    this.setIntent(intent);

    if ((intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0) {
        return;
    }
    NFCReaderX.scanFromActivity(this, intent);

}
 
源代码8 项目: xDrip-plus   文件: NFCScanningX.java
@Override
protected void onResume() {
    super.onResume();

    final Intent intent = getIntent();
    this.setIntent(intent);

    if ((intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0) {
        return;
    }
}
 
源代码9 项目: AndroidChromium   文件: ChromeTabbedActivity.java
@Override
public void preInflationStartup() {
    super.preInflationStartup();

    // Decide whether to record startup UMA histograms. This is done  early in the main
    // Activity.onCreate() to avoid recording navigation delays when they require user input to
    // proceed. For example, FRE (First Run Experience) happens before the activity is created,
    // and triggers initialization of the native library. At the moment it seems safe to assume
    // that uninitialized native library is an indication of an application start that is
    // followed by navigation immediately without user input.
    if (!LibraryLoader.isInitialized()) {
        UmaUtils.setRunningApplicationStart(true);
    }

    CommandLine commandLine = CommandLine.getInstance();
    if (commandLine.hasSwitch(ContentSwitches.ENABLE_TEST_INTENTS)
            && getIntent() != null
            && getIntent().hasExtra(
                    ChromeTabbedActivity.INTENT_EXTRA_TEST_RENDER_PROCESS_LIMIT)) {
        int value = getIntent().getIntExtra(
                ChromeTabbedActivity.INTENT_EXTRA_TEST_RENDER_PROCESS_LIMIT, -1);
        if (value != -1) {
            String[] args = new String[1];
            args[0] = "--" + ContentSwitches.RENDER_PROCESS_LIMIT
                    + "=" + Integer.toString(value);
            commandLine.appendSwitchesAndArguments(args);
        }
    }

    supportRequestWindowFeature(Window.FEATURE_ACTION_MODE_OVERLAY);

    // We are starting from history with a URL after data has been cleared. On Samsung this
    // can happen after user clears data and clicks on a recents item on pre-L devices.
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP
            && getIntent().getData() != null
            && (getIntent().getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0
            && OmahaClient.isFreshInstallOrDataHasBeenCleared(getApplicationContext())) {
        getIntent().setData(null);
    }
}
 
源代码10 项目: SkyTube   文件: BaseActivity.java
private void handleExternalPlayOnChromecast(final Intent intent) {
	if(intent != null) {
		// If we're connected to a chromecast when we receive this video to play, play it there, otherwise
		// forward it on to the local player. HOWEVER, we need to skip this if the calling Intent's class name
		// is YouTubePlayerActivity, otherwise we'll get stuck in an endless loop!
		if(intent.getAction() != null &&
						intent.getAction().equals(Intent.ACTION_VIEW) &&
						!intent.getComponent().getClassName().equals(YouTubePlayerActivity.class.getName()) &&
						(intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) == 0) {


			/**
			 * If a default Chromecast has been set for videos received via an external app (AutoCast), show the
			 * loading spinner and save the intent (which contains the video to play). When the Chromecast (route) is
			 * discovered above, it will find the default Chromecast and connect to it. Once the connection is
			 * established, {@link #handleExternalPlayOnChromecast(Intent)} will be called again, this time with
			 * externalPlayIntent set, which will allow the video to be launched on the Chromecast. Also only do
			 * this if we aren't already connected to a Chromecast.
			 */
			final boolean connectedToChromecast = YouTubePlayer.isConnectedToChromecast();
			if(launchExternalOnDefaultChromecast(this) && externalPlayIntent == null && !connectedToChromecast) {
				showLoadingSpinner();
				externalPlayIntent = intent;
			} else {
				if (connectedToChromecast) {
					new GetVideoDetailsTask(this, intent, (videoId, video) -> playVideoOnChromecast(video, 0)).executeInParallel();
				} else {
					Intent i = new Intent(this, YouTubePlayerActivity.class);
					i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
					i.setAction(Intent.ACTION_VIEW);
					i.setData(intent.getData());
					startActivity(i);
					finish(); // Finish this activity, so that the back button returns to the app that launched this video
				}
			}
		}
	}
}
 
源代码11 项目: travelguide   文件: ArticleInfoListActivity.java
private void handleIntent(Intent intent)
{
  if ((intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0)
    return;

  final MWMResponse mwmResponse = MWMResponse.extractFromIntent(this, intent);
  final MWMPoint point = mwmResponse.getPoint();

  if (point != null && point.getId() != null)
  {
    final String id = point.getId();
    Log.d(TAG, id);
    onItemSelected(Storage.get(this).getArticleInfoByUrl(id));
  }
}
 
源代码12 项目: AcDisplay   文件: BlacklistActivity.java
@Override
public void onNewIntent(Intent intent) {
    super.onNewIntent(intent);

    // If it is not launched from history, then reset to top-level
    if ((intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) == 0) {
        if (mFirstHeader != null && !onIsHidingHeaders() && onIsMultiPane()) {
            switchToHeaderLocal(mFirstHeader);
        }
        getListView().setSelectionFromTop(0, 0);
    }
}
 
源代码13 项目: coursera-android   文件: 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)}
 */
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;
    }
}
 
源代码14 项目: TelePlus-Android   文件: AndroidUtilities.java
public static boolean handleProxyIntent(Activity activity, Intent intent)
{
    if (intent == null)
    {
        return false;
    }
    try
    {
        if ((intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0)
        {
            return false;
        }
        Uri data = intent.getData();
        if (data != null)
        {
            String user = null;
            String password = null;
            String port = null;
            String address = null;
            String secret = null;
            String scheme = data.getScheme();
            if (scheme != null)
            {
                if ((scheme.equals("http") || scheme.equals("https")))
                {
                    String host = data.getHost().toLowerCase();
                    if (host.equals("telegram.me") || host.equals("t.me") || host.equals("telegram.dog") || host.equals("telesco.pe"))
                    {
                        String path = data.getPath();
                        if (path != null)
                        {
                            if (path.startsWith("/socks") || path.startsWith("/proxy"))
                            {
                                address = data.getQueryParameter("server");
                                port = data.getQueryParameter("port");
                                user = data.getQueryParameter("user");
                                password = data.getQueryParameter("pass");
                                secret = data.getQueryParameter("secret");
                            }
                        }
                    }
                }
                else if (scheme.equals("tg"))
                {
                    String url = data.toString();
                    if (url.startsWith("tg:proxy") || url.startsWith("tg://proxy") || url.startsWith("tg:socks") || url.startsWith("tg://socks"))
                    {
                        url = url.replace("tg:proxy", "tg://telegram.org").replace("tg://proxy", "tg://telegram.org").replace("tg://socks", "tg://telegram.org").replace("tg:socks", "tg://telegram.org");
                        data = Uri.parse(url);
                        address = data.getQueryParameter("server");
                        port = data.getQueryParameter("port");
                        user = data.getQueryParameter("user");
                        password = data.getQueryParameter("pass");
                        secret = data.getQueryParameter("secret");
                    }
                }
            }
            if (!TextUtils.isEmpty(address) && !TextUtils.isEmpty(port))
            {
                if (user == null)
                {
                    user = "";
                }
                if (password == null)
                {
                    password = "";
                }
                if (secret == null)
                {
                    secret = "";
                }
                showProxyAlert(activity, address, port, user, password, secret);
                return true;
            }
        }
    }
    catch (Exception ignore) {}
    return false;
}
 
源代码15 项目: TelePlus-Android   文件: AndroidUtilities.java
public static boolean handleProxyIntent(Activity activity, Intent intent)
{
    if (intent == null)
    {
        return false;
    }
    try
    {
        if ((intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0)
        {
            return false;
        }
        Uri data = intent.getData();
        if (data != null)
        {
            String user = null;
            String password = null;
            String port = null;
            String address = null;
            String secret = null;
            String scheme = data.getScheme();
            if (scheme != null)
            {
                if ((scheme.equals("http") || scheme.equals("https")))
                {
                    String host = data.getHost().toLowerCase();
                    if (host.equals("telegram.me") || host.equals("t.me") || host.equals("telegram.dog") || host.equals("telesco.pe"))
                    {
                        String path = data.getPath();
                        if (path != null)
                        {
                            if (path.startsWith("/socks") || path.startsWith("/proxy"))
                            {
                                address = data.getQueryParameter("server");
                                port = data.getQueryParameter("port");
                                user = data.getQueryParameter("user");
                                password = data.getQueryParameter("pass");
                                secret = data.getQueryParameter("secret");
                            }
                        }
                    }
                }
                else if (scheme.equals("tg"))
                {
                    String url = data.toString();
                    if (url.startsWith("tg:proxy") || url.startsWith("tg://proxy") || url.startsWith("tg:socks") || url.startsWith("tg://socks"))
                    {
                        url = url.replace("tg:proxy", "tg://telegram.org").replace("tg://proxy", "tg://telegram.org").replace("tg://socks", "tg://telegram.org").replace("tg:socks", "tg://telegram.org");
                        data = Uri.parse(url);
                        address = data.getQueryParameter("server");
                        port = data.getQueryParameter("port");
                        user = data.getQueryParameter("user");
                        password = data.getQueryParameter("pass");
                        secret = data.getQueryParameter("secret");
                    }
                }
            }
            if (!TextUtils.isEmpty(address) && !TextUtils.isEmpty(port))
            {
                if (user == null)
                {
                    user = "";
                }
                if (password == null)
                {
                    password = "";
                }
                if (secret == null)
                {
                    secret = "";
                }
                showProxyAlert(activity, address, port, user, password, secret);
                return true;
            }
        }
    }
    catch (Exception ignore) {}
    return false;
}
 
源代码16 项目: Telegram   文件: AndroidUtilities.java
public static boolean handleProxyIntent(Activity activity, Intent intent) {
    if (intent == null) {
        return false;
    }
    try {
        if ((intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0) {
            return false;
        }
        Uri data = intent.getData();
        if (data != null) {
            String user = null;
            String password = null;
            String port = null;
            String address = null;
            String secret = null;
            String scheme = data.getScheme();
            if (scheme != null) {
                if ((scheme.equals("http") || scheme.equals("https"))) {
                    String host = data.getHost().toLowerCase();
                    if (host.equals("telegram.me") || host.equals("t.me") || host.equals("telegram.dog")) {
                        String path = data.getPath();
                        if (path != null) {
                            if (path.startsWith("/socks") || path.startsWith("/proxy")) {
                                address = data.getQueryParameter("server");
                                port = data.getQueryParameter("port");
                                user = data.getQueryParameter("user");
                                password = data.getQueryParameter("pass");
                                secret = data.getQueryParameter("secret");
                            }
                        }
                    }
                } else if (scheme.equals("tg")) {
                    String url = data.toString();
                    if (url.startsWith("tg:proxy") || url.startsWith("tg://proxy") || url.startsWith("tg:socks") || url.startsWith("tg://socks")) {
                        url = url.replace("tg:proxy", "tg://telegram.org").replace("tg://proxy", "tg://telegram.org").replace("tg://socks", "tg://telegram.org").replace("tg:socks", "tg://telegram.org");
                        data = Uri.parse(url);
                        address = data.getQueryParameter("server");
                        port = data.getQueryParameter("port");
                        user = data.getQueryParameter("user");
                        password = data.getQueryParameter("pass");
                        secret = data.getQueryParameter("secret");
                    }
                }
            }
            if (!TextUtils.isEmpty(address) && !TextUtils.isEmpty(port)) {
                if (user == null) {
                    user = "";
                }
                if (password == null) {
                    password = "";
                }
                if (secret == null) {
                    secret = "";
                }
                showProxyAlert(activity, address, port, user, password, secret);
                return true;
            }
        }
    } catch (Exception ignore) {

    }
    return false;
}
 
源代码17 项目: Telegram-FOSS   文件: AndroidUtilities.java
public static boolean handleProxyIntent(Activity activity, Intent intent) {
    if (intent == null) {
        return false;
    }
    try {
        if ((intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0) {
            return false;
        }
        Uri data = intent.getData();
        if (data != null) {
            String user = null;
            String password = null;
            String port = null;
            String address = null;
            String secret = null;
            String scheme = data.getScheme();
            if (scheme != null) {
                if ((scheme.equals("http") || scheme.equals("https"))) {
                    String host = data.getHost().toLowerCase();
                    if (host.equals("telegram.me") || host.equals("t.me") || host.equals("telegram.dog")) {
                        String path = data.getPath();
                        if (path != null) {
                            if (path.startsWith("/socks") || path.startsWith("/proxy")) {
                                address = data.getQueryParameter("server");
                                port = data.getQueryParameter("port");
                                user = data.getQueryParameter("user");
                                password = data.getQueryParameter("pass");
                                secret = data.getQueryParameter("secret");
                            }
                        }
                    }
                } else if (scheme.equals("tg")) {
                    String url = data.toString();
                    if (url.startsWith("tg:proxy") || url.startsWith("tg://proxy") || url.startsWith("tg:socks") || url.startsWith("tg://socks")) {
                        url = url.replace("tg:proxy", "tg://telegram.org").replace("tg://proxy", "tg://telegram.org").replace("tg://socks", "tg://telegram.org").replace("tg:socks", "tg://telegram.org");
                        data = Uri.parse(url);
                        address = data.getQueryParameter("server");
                        port = data.getQueryParameter("port");
                        user = data.getQueryParameter("user");
                        password = data.getQueryParameter("pass");
                        secret = data.getQueryParameter("secret");
                    }
                }
            }
            if (!TextUtils.isEmpty(address) && !TextUtils.isEmpty(port)) {
                if (user == null) {
                    user = "";
                }
                if (password == null) {
                    password = "";
                }
                if (secret == null) {
                    secret = "";
                }
                showProxyAlert(activity, address, port, user, password, secret);
                return true;
            }
        }
    } catch (Exception ignore) {

    }
    return false;
}
 
源代码18 项目: Ansole   文件: Term.java
private void populateViewFlipper() {
    if (mTermService != null) {
        mTermSessions = mTermService.getSessions();
        mTermSessions.addCallback(this);

        if (mTermSessions.size() == 0) {
            try {
                mTermSessions.add(createTermSession());
            } catch (IOException e) {
                Toast.makeText(this, "Failed to start terminal session", Toast.LENGTH_LONG).show();
                finish();
                return;
            }
        }

        for (TermSession session : mTermSessions) {
            EmulatorView view = createEmulatorView(session);
            mViewFlipper.addView(view);
        }

        updatePrefs();

        Intent intent = getIntent();
        int flags = intent.getFlags();
        String action = intent.getAction();
        if ((flags & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) == 0
                && action != null) {
            if (action.equals(RemoteInterface.PRIVATE_OPEN_NEW_WINDOW)) {
                mViewFlipper.setDisplayedChild(mTermSessions.size() - 1);
            } else if (action.equals(RemoteInterface.PRIVATE_SWITCH_WINDOW)) {
                int target = intent.getIntExtra(
                        RemoteInterface.PRIVATE_EXTRA_TARGET_WINDOW, -1);
                if (target >= 0) {
                    mViewFlipper.setDisplayedChild(target);
                }
            }
        }

        mViewFlipper.resumeCurrentView();
    }
}
 
源代码19 项目: 365browser   文件: ChromeTabbedActivity.java
@Override
public void preInflationStartup() {
    super.preInflationStartup();

    // Decide whether to record startup UMA histograms. This is done  early in the main
    // Activity.onCreate() to avoid recording navigation delays when they require user input to
    // proceed. For example, FRE (First Run Experience) happens before the activity is created,
    // and triggers initialization of the native library. At the moment it seems safe to assume
    // that uninitialized native library is an indication of an application start that is
    // followed by navigation immediately without user input.
    if (!LibraryLoader.isInitialized()) {
        UmaUtils.setRunningApplicationStart(true);
    }

    CommandLine commandLine = CommandLine.getInstance();
    if (commandLine.hasSwitch(ContentSwitches.ENABLE_TEST_INTENTS)
            && getIntent() != null
            && getIntent().hasExtra(
                    ChromeTabbedActivity.INTENT_EXTRA_TEST_RENDER_PROCESS_LIMIT)) {
        int value = getIntent().getIntExtra(
                ChromeTabbedActivity.INTENT_EXTRA_TEST_RENDER_PROCESS_LIMIT, -1);
        if (value != -1) {
            String[] args = new String[1];
            args[0] = "--" + ContentSwitches.RENDER_PROCESS_LIMIT
                    + "=" + Integer.toString(value);
            commandLine.appendSwitchesAndArguments(args);
        }
    }

    supportRequestWindowFeature(Window.FEATURE_ACTION_MODE_OVERLAY);

    // We are starting from history with a URL after data has been cleared. On Samsung this
    // can happen after user clears data and clicks on a recents item on pre-L devices.
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP
            && getIntent().getData() != null
            && (getIntent().getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0
            && OmahaBase.isProbablyFreshInstall(this)) {
        getIntent().setData(null);
    }

    launchFirstRunExperience();
}
 
源代码20 项目: dynamic-support   文件: DynamicSystemActivity.java
/**
 * Checks whether this activity is launched from the history.
 *
 * @return {@code true} if this activity is launched from the history.
 */
public boolean isLaunchedFromHistory() {
    return getIntent() != null && (getIntent().getFlags()
            & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0;
}
 
 方法所在类
 同类方法