use of org.greenrobot.eventbus.ThreadMode in project EventBus by greenrobot.
the class TestSetupActivity method startClick.
public void startClick(View v) {
TestParams params = new TestParams();
Spinner spinnerThread = findViewById(R.id.spinnerThread);
String threadModeStr = spinnerThread.getSelectedItem().toString();
ThreadMode threadMode = ThreadMode.valueOf(threadModeStr);
params.setThreadMode(threadMode);
params.setEventInheritance(((CheckBox) findViewById(R.id.checkBoxEventBusEventHierarchy)).isChecked());
params.setIgnoreGeneratedIndex(((CheckBox) findViewById(R.id.checkBoxEventBusIgnoreGeneratedIndex)).isChecked());
EditText editTextEvent = findViewById(R.id.editTextEvent);
params.setEventCount(Integer.parseInt(editTextEvent.getText().toString()));
EditText editTextSubscriber = findViewById(R.id.editTextSubscribe);
params.setSubscriberCount(Integer.parseInt(editTextSubscriber.getText().toString()));
Spinner spinnerTestToRun = findViewById(R.id.spinnerTestToRun);
int testPos = spinnerTestToRun.getSelectedItemPosition();
params.setTestNumber(testPos + 1);
ArrayList<Class<? extends Test>> testClasses = initTestClasses(testPos);
params.setTestClasses(testClasses);
Intent intent = new Intent();
intent.setClass(this, TestRunnerActivity.class);
intent.putExtra("params", params);
startActivity(intent);
}
use of org.greenrobot.eventbus.ThreadMode in project PhotoNoter by yydcdut.
the class HomePresenterImpl method onCategoryDeleteEvent.
@Subscribe(threadMode = ThreadMode.MAIN)
public void onCategoryDeleteEvent(CategoryDeleteEvent categoryDeleteEvent) {
mRxCategory.getAllCategories().observeOn(AndroidSchedulers.mainThread()).subscribe(categories -> {
int beforeCategoryId = mCategoryId;
for (Category category : categories) {
if (category.isCheck()) {
mCategoryId = category.getId();
break;
}
}
mHomeView.updateCategoryList(categories);
if (mCategoryId != beforeCategoryId) {
mHomeView.changePhotos4Category(mCategoryId);
}
}, (throwable -> YLog.e(throwable)));
}
use of org.greenrobot.eventbus.ThreadMode in project Signal-Android by WhisperSystems.
the class MainActivity method onEventMainThread.
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onEventMainThread(@NonNull TransferStatus event) {
TextView text = new TextView(this);
text.setText(event.getTransferMode().toString());
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
text.setLayoutParams(params);
list.addView(text);
if (event.getTransferMode() == TransferStatus.TransferMode.VERIFICATION_REQUIRED) {
new AlertDialog.Builder(this).setTitle("Verification Required").setMessage("Code: " + event.getAuthenticationCode()).setPositiveButton("Yes, Same", (d, w) -> DeviceToDeviceTransferService.setAuthenticationCodeVerified(this, true)).setNegativeButton("No, different", (d, w) -> DeviceToDeviceTransferService.setAuthenticationCodeVerified(this, false)).setCancelable(false).show();
}
}
Aggregations