本文整理匯總了Java中com.novoda.merlin.MerlinsBeard類的典型用法代碼示例。如果您正苦於以下問題:Java MerlinsBeard類的具體用法?Java MerlinsBeard怎麽用?Java MerlinsBeard使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
MerlinsBeard類屬於com.novoda.merlin包,在下文中一共展示了MerlinsBeard類的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onServiceConnected
import com.novoda.merlin.MerlinsBeard; //導入依賴的package包/類
@Override
public void onServiceConnected(ComponentName name, IBinder binder) {
Logger.d("onServiceConnected");
MerlinService.LocalBinder merlinServiceBinder = ((MerlinService.LocalBinder) binder);
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
ConnectivityChangeEventExtractor connectivityChangeEventExtractor = new ConnectivityChangeEventExtractor(connectivityManager);
ConnectivityChangesRegister connectivityChangesRegister = new ConnectivityChangesRegister(
context,
connectivityManager,
new AndroidVersion(),
connectivityChangeEventExtractor
);
NetworkStatusRetriever networkStatusRetriever = new NetworkStatusRetriever(MerlinsBeard.from(context));
EndpointPinger endpointPinger = EndpointPinger.withCustomEndpointAndValidation(endpoint, validator);
ConnectivityChangesForwarder connectivityChangesForwarder = new ConnectivityChangesForwarder(
networkStatusRetriever,
listenerHolder.disconnectCallbackManager,
listenerHolder.connectCallbackManager,
listenerHolder.bindCallbackManager,
endpointPinger
);
merlinServiceBinder.setConnectivityChangesRegister(connectivityChangesRegister);
merlinServiceBinder.setConnectivityChangesForwarder(connectivityChangesForwarder);
merlinServiceBinder.onBindComplete();
}
示例2: onCreate
import com.novoda.merlin.MerlinsBeard; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
viewToAttachDisplayerTo = findViewById(R.id.displayerAttachableView);
merlinsBeard = MerlinsBeard.from(this);
networkStatusDisplayer = new NetworkStatusDisplayer(getResources(), merlinsBeard);
findViewById(R.id.current_status).setOnClickListener(networkStatusOnClick);
findViewById(R.id.wifi_connected).setOnClickListener(wifiConnectedOnClick);
findViewById(R.id.mobile_connected).setOnClickListener(mobileConnectedOnClick);
findViewById(R.id.network_subtype).setOnClickListener(networkSubtypeOnClick);
}
示例3: onCreate
import com.novoda.merlin.MerlinsBeard; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
viewToAttachDisplayerTo = findViewById(R.id.displayerAttachableView);
merlinsBeard = MerlinsBeard.from(this);
networkStatusDisplayer = new NetworkStatusDisplayer(getResources(), merlinsBeard);
subscriptions = new CompositeSubscription();
findViewById(R.id.current_status).setOnClickListener(networkStatusOnClick);
findViewById(R.id.wifi_connected).setOnClickListener(wifiConnectedOnClick);
findViewById(R.id.mobile_connected).setOnClickListener(mobileConnectedOnClick);
findViewById(R.id.network_subtype).setOnClickListener(networkSubtypeOnClick);
}
示例4: onCreate
import com.novoda.merlin.MerlinsBeard; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
viewToAttachDisplayerTo = findViewById(R.id.displayerAttachableView);
merlinsBeard = MerlinsBeard.from(this);
networkStatusDisplayer = new NetworkStatusDisplayer(getResources(), merlinsBeard);
disposables = new CompositeDisposable();
findViewById(R.id.current_status).setOnClickListener(networkStatusOnClick);
findViewById(R.id.wifi_connected).setOnClickListener(wifiConnectedOnClick);
findViewById(R.id.mobile_connected).setOnClickListener(mobileConnectedOnClick);
findViewById(R.id.network_subtype).setOnClickListener(networkSubtypeOnClick);
}
示例5: extractIsConnectedFrom
import com.novoda.merlin.MerlinsBeard; //導入依賴的package包/類
private boolean extractIsConnectedFrom(Intent intent, MerlinsBeard merlinsBeard) {
if (intent.hasExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY)) {
return !intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, false);
} else {
return merlinsBeard.isConnected();
}
}
示例6: notify
import com.novoda.merlin.MerlinsBeard; //導入依賴的package包/類
void notify(Context context, Intent intent) {
if (intent != null && connectivityActionMatchesActionFor(intent)) {
MerlinsBeard merlinsBeard = merlinsBeardCreator.createMerlinsBeard(context);
ConnectivityChangeEvent connectivityChangeEvent = creator.createFrom(intent, merlinsBeard);
notifyMerlinService(context, connectivityChangeEvent);
}
}
示例7: provideMerlinsBeard
import com.novoda.merlin.MerlinsBeard; //導入依賴的package包/類
@Provides
@Singleton
public MerlinsBeard provideMerlinsBeard(@NonNull final Context poContext) {
return MerlinsBeard.from(poContext);
}
示例8: NetworkStatusDisplayer
import com.novoda.merlin.MerlinsBeard; //導入依賴的package包/類
public NetworkStatusDisplayer(Resources resources, MerlinsBeard merlinsBeard) {
this.resources = resources;
this.merlinsBeard = merlinsBeard;
}
示例9: createFrom
import com.novoda.merlin.MerlinsBeard; //導入依賴的package包/類
ConnectivityChangeEvent createFrom(Intent intent, MerlinsBeard merlinsBeard) {
boolean isConnected = extractIsConnectedFrom(intent, merlinsBeard);
String info = intent.getStringExtra(ConnectivityManager.EXTRA_EXTRA_INFO);
String reason = intent.getStringExtra(ConnectivityManager.EXTRA_REASON);
return ConnectivityChangeEvent.createWithNetworkInfoChangeEvent(isConnected, info, reason);
}
示例10: NetworkStatusRetriever
import com.novoda.merlin.MerlinsBeard; //導入依賴的package包/類
NetworkStatusRetriever(MerlinsBeard merlinsBeard) {
this.merlinsBeard = merlinsBeard;
}
示例11: createMerlinsBeard
import com.novoda.merlin.MerlinsBeard; //導入依賴的package包/類
MerlinsBeard createMerlinsBeard(Context context);