本文整理汇总了Java中org.chromium.base.ActivityStatus类的典型用法代码示例。如果您正苦于以下问题:Java ActivityStatus类的具体用法?Java ActivityStatus怎么用?Java ActivityStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActivityStatus类属于org.chromium.base包,在下文中一共展示了ActivityStatus类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import org.chromium.base.ActivityStatus; //导入依赖的package包/类
/**
* Start listening for location updates.
* @param gpsEnabled Whether or not we're interested in high accuracy GPS.
*/
private void start(boolean gpsEnabled) {
if (!mIsRunning && !mShouldRunAfterActivityResume) {
// Currently idle so start listening to activity status changes.
ActivityStatus.registerStateListener(this);
}
mIsGpsEnabled = gpsEnabled;
int activityState = ActivityStatus.getState();
if (activityState == ActivityStatus.PAUSED
|| activityState == ActivityStatus.STOPPED
|| activityState == ActivityStatus.DESTROYED) {
mShouldRunAfterActivityResume = true;
} else {
unregisterFromLocationUpdates();
registerForLocationUpdates();
}
}
示例2: start
import org.chromium.base.ActivityStatus; //导入依赖的package包/类
/**
* Start listening for location updates.
* @param gpsEnabled Whether or not we're interested in high accuracy GPS.
*/
private void start(boolean gpsEnabled) {
if (!mIsRunning && !mShouldRunAfterActivityResume) {
// Currently idle so start listening to activity status changes.
ActivityStatus.registerStateListener(this);
}
mIsGpsEnabled = gpsEnabled;
if (ActivityStatus.isPaused()) {
mShouldRunAfterActivityResume = true;
} else {
unregisterFromLocationUpdates();
registerForLocationUpdates();
}
}
示例3: NetworkChangeNotifierAutoDetect
import org.chromium.base.ActivityStatus; //导入依赖的package包/类
public NetworkChangeNotifierAutoDetect(Observer observer, Context context) {
mObserver = observer;
mContext = context.getApplicationContext();
mConnectivityManagerDelegate = new ConnectivityManagerDelegate(context);
mConnectionType = getCurrentConnectionType();
ActivityStatus.registerStateListener(this);
}
示例4: onActivityStateChange
import org.chromium.base.ActivityStatus; //导入依赖的package包/类
@Override
public void onActivityStateChange(int state) {
if (state == ActivityStatus.RESUMED) {
// Note that this also covers the case where the main activity is created. The CREATED
// event is always followed by the RESUMED event. This is a temporary "hack" until
// http://crbug.com/176837 is fixed. The CREATED event can't be used reliably for now
// since its notification is deferred. This means that it can immediately follow a
// DESTROYED/STOPPED/... event which is problematic.
// TODO(pliard): fix http://crbug.com/176837.
connectionTypeChanged();
registerReceiver();
} else if (state == ActivityStatus.PAUSED) {
unregisterReceiver();
}
}
示例5: selectClientCertificate
import org.chromium.base.ActivityStatus; //导入依赖的package包/类
/**
* Create a new asynchronous request to select a client certificate.
*
* @param nativePtr The native object responsible for this request.
* @param keyTypes The list of supported key exchange types.
* @param encodedPrincipals The list of CA DistinguishedNames.
* @param host_name The server host name is available (empty otherwise).
* @param port The server port if available (0 otherwise).
* @return true on success.
* Note that nativeOnSystemRequestComplete will be called iff this method returns true.
*/
@CalledByNative
static private boolean selectClientCertificate(
int nativePtr, String[] keyTypes, byte[][] encodedPrincipals, String hostName,
int port) {
ThreadUtils.assertOnUiThread();
Activity activity = ActivityStatus.getActivity();
if (activity == null) {
Log.w(TAG, "No active Chromium main activity!?");
return false;
}
// Build the list of principals from encoded versions.
Principal[] principals = null;
if (encodedPrincipals.length > 0) {
principals = new X500Principal[encodedPrincipals.length];
try {
for (int n = 0; n < encodedPrincipals.length; n++) {
principals[n] = new X500Principal(encodedPrincipals[n]);
}
} catch (Exception e) {
// Bail on error.
Log.w(TAG, "Exception while decoding issuers list: " + e);
return false;
}
}
// All good, create new request, add it to our list and launch the certificate selection
// activity.
SSLClientCertificateRequest request = new SSLClientCertificateRequest(nativePtr);
KeyChain.choosePrivateKeyAlias(
activity, request, keyTypes, principals, hostName, port, null);
return true;
}
示例6: shouldPerformSync
import org.chromium.base.ActivityStatus; //导入依赖的package包/类
@VisibleForTesting
boolean shouldPerformSync(Context ctx, Bundle extras, Account account) {
boolean manualSync = isManualSync(extras);
if (manualSync || ActivityStatus.isApplicationVisible()) {
clearDelayedSyncs(ctx);
return true;
} else {
Log.d(TAG, "Delaying sync.");
setDelayedSync(ctx, account.name);
return false;
}
}
示例7: onActivityStateChange
import org.chromium.base.ActivityStatus; //导入依赖的package包/类
@Override
public void onActivityStateChange(int newState) {
if (SyncStatusHelper.get(mContext).isSyncEnabled()) {
if (newState == ActivityStatus.PAUSED) {
stop();
} else if (newState == ActivityStatus.RESUMED) {
start();
}
}
}
示例8: start
import org.chromium.base.ActivityStatus; //导入依赖的package包/类
/**
* Start listening for location updates.
* @param gpsEnabled Whether or not we're interested in high accuracy GPS.
*/
private void start(boolean gpsEnabled) {
if (!mIsRunning && !mShouldRunAfterActivityResume) {
// Currently idle so start listening to activity status changes.
ActivityStatus.registerStateListener(this);
}
mIsGpsEnabled = gpsEnabled;
if (ActivityStatus.getState() != ActivityStatus.RESUMED) {
mShouldRunAfterActivityResume = true;
} else {
unregisterFromLocationUpdates();
registerForLocationUpdates();
}
}
示例9: NetworkChangeNotifierAutoDetect
import org.chromium.base.ActivityStatus; //导入依赖的package包/类
public NetworkChangeNotifierAutoDetect(Observer observer, Context context) {
mObserver = observer;
mContext = context.getApplicationContext();
mConnectivityManagerDelegate = new ConnectivityManagerDelegate(context);
mWifiManagerDelegate = new WifiManagerDelegate(context);
mConnectionType = getCurrentConnectionType();
mWifiSSID = getCurrentWifiSSID();
ActivityStatus.registerStateListener(this);
}
示例10: stop
import org.chromium.base.ActivityStatus; //导入依赖的package包/类
/**
* Stop listening for location updates.
*/
private void stop() {
unregisterFromLocationUpdates();
ActivityStatus.unregisterStateListener(this);
mShouldRunAfterActivityResume = false;
}
示例11: InvalidationController
import org.chromium.base.ActivityStatus; //导入依赖的package包/类
/**
* Creates an instance using {@code context} to send intents.
*/
@VisibleForTesting
InvalidationController(Context context) {
mContext = Preconditions.checkNotNull(context.getApplicationContext());
ActivityStatus.registerStateListener(this);
}
示例12: isChromeInForeground
import org.chromium.base.ActivityStatus; //导入依赖的package包/类
/**
* Returns whether Chrome is in the foreground. Local method so it can be overridden in tests.
*/
@VisibleForTesting
boolean isChromeInForeground() {
return ActivityStatus.isApplicationVisible();
}