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


Java EventBus.post方法代碼示例

本文整理匯總了Java中org.greenrobot.eventbus.EventBus.post方法的典型用法代碼示例。如果您正苦於以下問題:Java EventBus.post方法的具體用法?Java EventBus.post怎麽用?Java EventBus.post使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.greenrobot.eventbus.EventBus的用法示例。


在下文中一共展示了EventBus.post方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleOnClick

import org.greenrobot.eventbus.EventBus; //導入方法依賴的package包/類
public static void handleOnClick(DialogInterface dialog, int which, Activity activity, Bundle arguments) {
    if (EVENT_TYPE_ON_CLICK != null) {
        Object event;
        try {
            event = EVENT_TYPE_ON_CLICK.newInstance();
        } catch (Exception e) {
            throw new RuntimeException("Event cannot be constructed", e);
        }
        EventBus eventBus = ErrorDialogManager.factory.config.getEventBus();
        eventBus.post(event);
    }
    boolean finish = arguments.getBoolean(ErrorDialogManager.KEY_FINISH_AFTER_DIALOG, false);
    if (finish && activity != null) {
        activity.finish();
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:17,代碼來源:ErrorDialogFragments.java

示例2: syncItems

import org.greenrobot.eventbus.EventBus; //導入方法依賴的package包/類
private synchronized void syncItems() {
    int numReceived = this.streamItems.size();

    for (int i = 0; i < this.receivers.size(); i++) {
        int numSent = this.numSents.get(i);
        if (numSent < numReceived) {
            this.numSents.set(i, numReceived);
            EventBus eventBus = this.eventBuses.get(i);
            int currentReceiverCount = this.receiverCount;
            for (int itemId = numSent; itemId < numReceived; itemId++) {
                eventBus.post(streamItems.get(itemId));
                if (currentReceiverCount != this.receiverCount) break;
            }
        }
    }
}
 
開發者ID:PrivacyStreams,項目名稱:PrivacyStreams,代碼行數:17,代碼來源:Stream.java

示例3: apply

import org.greenrobot.eventbus.EventBus; //導入方法依賴的package包/類
public final Tout apply(UQI uqi, Tin input) {
    this.uqi = uqi;
    this.input = input;
    this.output = this.init(uqi, input);
    EventBus tempBus = new EventBus();
    tempBus.register(this);
    tempBus.post(new Object());
    return this.output;
}
 
開發者ID:PrivacyStreams,項目名稱:PrivacyStreams,代碼行數:10,代碼來源:AsyncFunction.java

示例4: ShareTresorViewModel

import org.greenrobot.eventbus.EventBus; //導入方法依賴的package包/類
@Inject
public ShareTresorViewModel(Zerokit zerokit, AdminApi adminApi, final EventBus eventBus) {
    this.zerokit = zerokit;
    this.adminApi = adminApi;

    this.inProgress = new ObservableField<>(false);
    this.userId = new ObservableField<>();
    this.textSummary = new ObservableField<>();
    this.sharedWithUserId = new ObservableField<>("");
    this.clickListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            shareTresor(tresorId, userId.get());
        }
    };
    errorResponseHandlerSdk = new Action<ResponseZerokitError>() {
        @Override
        public void call(ResponseZerokitError errorResponse) {
            inProgress.set(false);
            eventBus.post(new ShowMessageMessage(errorResponse.toString()));
        }
    };
    errorResponseHandlerAdminapi = new Action<ResponseAdminApiError>() {
        @Override
        public void call(ResponseAdminApiError errorResponse) {
            inProgress.set(false);
            eventBus.post(new ShowMessageMessage(errorResponse.toString()));
        }
    };
}
 
開發者ID:tresorit,項目名稱:ZeroKit-Android-SDK,代碼行數:31,代碼來源:ShareTresorViewModel.java

示例5: EncryptTextViewModel

import org.greenrobot.eventbus.EventBus; //導入方法依賴的package包/類
@Inject
public EncryptTextViewModel(Zerokit zerokit, final EventBus eventBus) {
    this.zerokit = zerokit;

    this.inProgressEncrypt = new ObservableField<>(false);
    this.inProgressDecrypt = new ObservableField<>(false);
    this.encryptClicked = new ObservableField<>(false);
    this.textOriginal = new ObservableField<>();
    this.textEncrypted = new ObservableField<>();
    this.textSummary = new ObservableField<>();
    this.textDecrypted = new ObservableField<>();
    this.clickListenerEncrypt = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            encryptClicked.set(true);
            encrypt(tresorId, textOriginal.get());
        }
    };
    this.clickListenerDecrypt = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            decrypt(textEncrypted.get());
        }
    };
    this.clickListenerCopy = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            eventBus.post(new CopyEncryptedTextMessage(textEncrypted.get()));
        }
    };
}
 
開發者ID:tresorit,項目名稱:ZeroKit-Android-SDK,代碼行數:32,代碼來源:EncryptTextViewModel.java

示例6: CreateTresorViewModel

import org.greenrobot.eventbus.EventBus; //導入方法依賴的package包/類
@Inject
public CreateTresorViewModel(final Zerokit zerokit, final AdminApi adminApi, final EventBus eventBus) {
    this.zerokit = zerokit;
    this.adminApi = adminApi;
    this.eventBus = eventBus;


    this.inProgress = new ObservableField<>(false);
    this.tresorId = new ObservableField<>("");
    this.clickListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            createTresor();
            inProgress.set(true);
        }
    };

    errorResponseHandlerSdk = new Action<ResponseZerokitError>() {
        @Override
        public void call(ResponseZerokitError errorResponse) {
            inProgress.set(false);
            eventBus.post(new ShowMessageMessage(errorResponse.toString()));
        }
    };
    errorResponseHandlerAdminapi = new Action<ResponseAdminApiError>() {
        @Override
        public void call(ResponseAdminApiError errorResponse) {
            inProgress.set(false);
            eventBus.post(new ShowMessageMessage(errorResponse.toString()));
        }
    };
}
 
開發者ID:tresorit,項目名稱:ZeroKit-Android-SDK,代碼行數:33,代碼來源:CreateTresorViewModel.java

示例7: MainViewModel

import org.greenrobot.eventbus.EventBus; //導入方法依賴的package包/類
@Inject
public MainViewModel(final EventBus eventBus) {
    onNavigationItemSelectedListener = new BottomNavigationView.OnNavigationItemSelectedListener() {
        @Override
        public boolean onNavigationItemSelected(@NonNull MenuItem item) {
            eventBus.post(new TabSelectMessage(item.getItemId()));
            return true;
        }
    };
}
 
開發者ID:tresorit,項目名稱:ZeroKit-Android-SDK,代碼行數:11,代碼來源:MainViewModel.java

示例8: sendSystemEventBroadcast

import org.greenrobot.eventbus.EventBus; //導入方法依賴的package包/類
private void sendSystemEventBroadcast(DeviceStateChange deviceStateChange, EventBus eventBus) {
    cloud.sendSystemEventBroadcast(deviceStateChange);
    eventBus.post(deviceStateChange);
}
 
開發者ID:Datatellit,項目名稱:xlight_android_native,代碼行數:5,代碼來源:ParticleDevice.java

示例9: RegistrationViewModel

import org.greenrobot.eventbus.EventBus; //導入方法依賴的package包/類
@Inject
public RegistrationViewModel(final Zerokit zerokit, AdminApi adminApi, final EventBus eventBus, SharedPreferences sharedPreferences, final Resources resources) {
    this.zerokit = zerokit;
    this.adminApi = adminApi;
    this.eventBus = eventBus;
    this.sharedPreferences = sharedPreferences;

    inProgress = new ObservableField<>(false);
    userName = new ObservableField<>("");
    passwordError = new ObservableField<>("");
    passwordConfirmError = new ObservableField<>("");
    userNameError = new ObservableField<>("");
    passwordStrength = new ObservableInt();
    seekbarColor = new ObservableField<>(resources.getDrawable(R.drawable.progress));
    colorRes = new int[]{R.color.red, R.color.deep_orange, R.color.orange, R.color.light_green, R.color.green};

    clickListenerRegistration = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            attemptRegistration();
        }
    };
    errorResponseHandlerAdmin = new Action<ResponseAdminApiError>() {
        @Override
        public void call(ResponseAdminApiError responseAdminApiError) {
            inProgress.set(false);
            eventBus.post(new ShowMessageMessage(responseAdminApiError.getMessage()));
        }
    };
    errorResponseHandlerSdk = new Action<ResponseZerokitError>() {
        @Override
        public void call(ResponseZerokitError errorResponse) {
            inProgress.set(false);
            eventBus.post(new ShowMessageMessage(errorResponse.getDescription()));
        }
    };
    focusChangeListener = new View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            passwordError.set("");
            userNameError.set("");
            passwordConfirmError.set("");
        }
    };

    passwordExporter = new PasswordEditText.PasswordExporter();
    passwordExporterConfirm = new PasswordEditText.PasswordExporter();

    passwordExporter.setOnChangeListener(new PasswordEditText.OnChangeListener() {
        @Override
        public void onChanged() {
            zerokit.getPasswordStrength(passwordExporter).enqueue(new Action<ResponseZerokitPasswordStrength>() {
                @Override
                public void call(ResponseZerokitPasswordStrength responseZerokitPasswordStrength) {
                    int score = responseZerokitPasswordStrength.getScore();
                    passwordStrength.set((score + 1) * 20);
                    ((LayerDrawable) seekbarColor.get()).findDrawableByLayerId(android.R.id.progress).setColorFilter(resources.getColor(colorRes[score]), PorterDuff.Mode.SRC_IN);
                }
            });
        }
    });
}
 
開發者ID:tresorit,項目名稱:ZeroKit-Android-SDK,代碼行數:63,代碼來源:RegistrationViewModel.java

示例10: LoginViewModel

import org.greenrobot.eventbus.EventBus; //導入方法依賴的package包/類
@Inject
public LoginViewModel(Zerokit zerokit, AdminApi adminApi, final EventBus eventBus) {
    this.zerokit = zerokit;
    this.adminApi = adminApi;
    this.eventBus = eventBus;

    this.passwordExporter = new PasswordEditText.PasswordExporter();

    this.clickListenerLogin = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            attemptLogin();
        }
    };

    userName = new ObservableField<>("");
    passwordError = new ObservableField<>("");
    usernameError = new ObservableField<>("");
    inProgress = new ObservableField<>(false);
    errorResponseHandlerSdk = new Action<ResponseZerokitError>() {
        @Override
        public void call(ResponseZerokitError errorResponse) {
            inProgress.set(false);
            eventBus.post(new ShowMessageMessage(errorResponse.toString()));
        }
    };
    errorResponseHandlerAdminapi = new Action<ResponseAdminApiError>() {
        @Override
        public void call(ResponseAdminApiError errorResponse) {
            inProgress.set(false);
            eventBus.post(new ShowMessageMessage(errorResponse.toString()));
        }
    };
    focusChangeListener = new View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            passwordError.set("");
            usernameError.set("");
        }
    };
}
 
開發者ID:tresorit,項目名稱:ZeroKit-Android-SDK,代碼行數:42,代碼來源:LoginViewModel.java


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