use of butterknife.Optional in project talk-android by nextcloud.
the class ContactsController method onDoneButtonClick.
@Optional
@OnClick(R.id.done_button)
public void onDoneButtonClick() {
if (!isPublicCall && adapter.getSelectedPositions().size() == 1) {
RetrofitBucket retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(userEntity.getBaseUrl(), "1", ((UserItem) adapter.getItem(adapter.getSelectedPositions().get(0))).getModel().getUserId(), null);
ncApi.createRoom(ApiUtils.getCredentials(userEntity.getUsername(), userEntity.getToken()), retrofitBucket.getUrl(), retrofitBucket.getQueryMap()).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<RoomOverall>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(RoomOverall roomOverall) {
if (getActivity() != null) {
Intent callIntent = new Intent(getActivity(), CallActivity.class);
Bundle bundle = new Bundle();
bundle.putString(BundleKeys.KEY_ROOM_TOKEN, roomOverall.getOcs().getData().getToken());
bundle.putParcelable(BundleKeys.KEY_USER_ENTITY, Parcels.wrap(userEntity));
callIntent.putExtras(bundle);
startActivity(callIntent);
new Handler().postDelayed(() -> getRouter().popCurrentController(), 100);
}
}
@Override
public void onError(Throwable e) {
}
@Override
public void onComplete() {
}
});
} else {
Bundle bundle = new Bundle();
Room.RoomType roomType;
if (isPublicCall) {
roomType = Room.RoomType.ROOM_PUBLIC_CALL;
} else {
roomType = Room.RoomType.ROOM_GROUP_CALL;
}
bundle.putParcelable(BundleKeys.KEY_CONVERSATION_TYPE, Parcels.wrap(roomType));
ArrayList<String> userIds = new ArrayList<>();
Set<Integer> selectedPositions = adapter.getSelectedPositionsAsSet();
for (int selectedPosition : selectedPositions) {
if (adapter.getItem(selectedPosition) instanceof UserItem) {
UserItem userItem = (UserItem) adapter.getItem(selectedPosition);
userIds.add(userItem.getModel().getUserId());
}
}
bundle.putStringArrayList(BundleKeys.KEY_INVITED_PARTICIPANTS, userIds);
bundle.putInt(BundleKeys.KEY_OPERATION_CODE, 11);
prepareAndShowBottomSheetWithBundle(bundle);
}
}
use of butterknife.Optional in project Auto.js by hyb1996.
the class CircularMenu method showScriptList.
@Optional
@OnClick(R.id.script_list)
void showScriptList() {
mWindow.collapse();
ScriptListView listView = new ScriptListView(mContext);
listView.setStorageFileProvider(StorageFileProvider.getDefault());
listView.setDirectorySpanSize(2);
final MaterialDialog dialog = new ThemeColorMaterialDialogBuilder(mContext).title(R.string.text_run_script).customView(listView, false).positiveText(R.string.cancel).build();
listView.setOnItemOperatedListener(file -> dialog.dismiss());
listView.setOnScriptFileClickListener((view, file) -> Scripts.run(file));
DialogUtils.showDialog(dialog);
}
use of butterknife.Optional in project Auto.js by hyb1996.
the class CircularMenu method settings.
@Optional
@OnClick(R.id.settings)
void settings() {
mWindow.collapse();
mRunningPackage = AutoJs.getInstance().getInfoProvider().getLatestPackage();
mRunningActivity = AutoJs.getInstance().getInfoProvider().getLatestActivity();
mSettingsDialog = new OperationDialogBuilder(mContext).item(R.id.accessibility_service, R.drawable.ic_service_green, R.string.text_accessibility_settings).item(R.id.package_name, R.drawable.ic_ali_app, mContext.getString(R.string.text_current_package) + mRunningPackage).item(R.id.class_name, R.drawable.ic_ali_android, mContext.getString(R.string.text_current_activity) + mRunningActivity).item(R.id.open_launcher, R.drawable.ic_android_eat_js, R.string.text_open_main_activity).item(R.id.exit, R.drawable.ic_close_white_48dp, R.string.text_exit_floating_window).bindItemClick(this).title(R.string.text_more).build();
DialogUtils.showDialog(mSettingsDialog);
}
use of butterknife.Optional in project Auto.js by hyb1996.
the class CircularMenu method showLayoutBounds.
@Optional
@OnClick(R.id.layout_bounds)
void showLayoutBounds() {
mWindow.collapse();
if (!ensureCapture()) {
return;
}
mCaptureDeferred.promise().done(capture -> {
LayoutBoundsFloatyWindow window = new LayoutBoundsFloatyWindow(capture);
mActionViewIcon.post(() -> FloatyService.addWindow(window));
});
}
use of butterknife.Optional in project talk-android by nextcloud.
the class ContactsController method onClearButtonClick.
@Optional
@OnClick(R.id.clear_button)
public void onClearButtonClick() {
if (adapter != null) {
List<Integer> selectedPositions = adapter.getSelectedPositions();
for (Integer position : selectedPositions) {
if (adapter.getItem(position) instanceof UserItem) {
UserItem userItem = (UserItem) adapter.getItem(position);
adapter.toggleSelection(position);
if (userItem != null) {
userItem.flipItemSelection();
}
}
}
}
checkAndHandleBottomButtons();
}
Aggregations