當前位置: 首頁>>代碼示例>>Java>>正文


Java MerlinsBeard類代碼示例

本文整理匯總了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();
}
 
開發者ID:novoda,項目名稱:merlin,代碼行數:27,代碼來源:MerlinServiceBinder.java

示例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);
}
 
開發者ID:novoda,項目名稱:merlin,代碼行數:15,代碼來源:DemoActivity.java

示例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);
}
 
開發者ID:novoda,項目名稱:merlin,代碼行數:15,代碼來源:RxJavaDemoActivity.java

示例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);
}
 
開發者ID:novoda,項目名稱:merlin,代碼行數:15,代碼來源:RxJava2DemoActivity.java

示例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();
    }
}
 
開發者ID:novoda,項目名稱:merlin,代碼行數:8,代碼來源:ConnectivityChangeEventCreator.java

示例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);
    }
}
 
開發者ID:novoda,項目名稱:merlin,代碼行數:8,代碼來源:ConnectivityReceiverConnectivityChangeNotifier.java

示例7: provideMerlinsBeard

import com.novoda.merlin.MerlinsBeard; //導入依賴的package包/類
@Provides
@Singleton
public MerlinsBeard provideMerlinsBeard(@NonNull final Context poContext) {
    return MerlinsBeard.from(poContext);
}
 
開發者ID:RoRoche,項目名稱:AndroidStarter,代碼行數:6,代碼來源:ModuleRest.java

示例8: NetworkStatusDisplayer

import com.novoda.merlin.MerlinsBeard; //導入依賴的package包/類
public NetworkStatusDisplayer(Resources resources, MerlinsBeard merlinsBeard) {
    this.resources = resources;
    this.merlinsBeard = merlinsBeard;
}
 
開發者ID:novoda,項目名稱:merlin,代碼行數:5,代碼來源:NetworkStatusDisplayer.java

示例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);
}
 
開發者ID:novoda,項目名稱:merlin,代碼行數:7,代碼來源:ConnectivityChangeEventCreator.java

示例10: NetworkStatusRetriever

import com.novoda.merlin.MerlinsBeard; //導入依賴的package包/類
NetworkStatusRetriever(MerlinsBeard merlinsBeard) {
    this.merlinsBeard = merlinsBeard;
}
 
開發者ID:novoda,項目名稱:merlin,代碼行數:4,代碼來源:NetworkStatusRetriever.java

示例11: createMerlinsBeard

import com.novoda.merlin.MerlinsBeard; //導入依賴的package包/類
MerlinsBeard createMerlinsBeard(Context context); 
開發者ID:novoda,項目名稱:merlin,代碼行數:2,代碼來源:ConnectivityReceiver.java


注:本文中的com.novoda.merlin.MerlinsBeard類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。