本文整理汇总了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);