Search in sources :

Example 1 with Optional

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);
    }
}
Also used : RoomOverall(com.nextcloud.talk.models.json.rooms.RoomOverall) Disposable(io.reactivex.disposables.Disposable) RetrofitBucket(com.nextcloud.talk.models.RetrofitBucket) Bundle(android.os.Bundle) ArrayList(java.util.ArrayList) Handler(android.os.Handler) VerticalChangeHandler(com.bluelinelabs.conductor.changehandler.VerticalChangeHandler) HorizontalChangeHandler(com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler) Intent(android.content.Intent) CallActivity(com.nextcloud.talk.activities.CallActivity) UserItem(com.nextcloud.talk.adapters.items.UserItem) Room(com.nextcloud.talk.models.json.rooms.Room) Optional(butterknife.Optional) OnClick(butterknife.OnClick)

Example 2 with Optional

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);
}
Also used : MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) ThemeColorMaterialDialogBuilder(com.stardust.theme.dialog.ThemeColorMaterialDialogBuilder) ScriptListView(com.stardust.scriptdroid.ui.main.scripts.ScriptListView) Optional(butterknife.Optional) OnClick(butterknife.OnClick)

Example 3 with Optional

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);
}
Also used : OperationDialogBuilder(com.stardust.app.OperationDialogBuilder) Optional(butterknife.Optional) OnClick(butterknife.OnClick)

Example 4 with Optional

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));
    });
}
Also used : LayoutBoundsFloatyWindow(com.stardust.scriptdroid.ui.floating.layoutinspector.LayoutBoundsFloatyWindow) Optional(butterknife.Optional) OnClick(butterknife.OnClick)

Example 5 with Optional

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();
}
Also used : UserItem(com.nextcloud.talk.adapters.items.UserItem) Optional(butterknife.Optional) OnClick(butterknife.OnClick)

Aggregations

OnClick (butterknife.OnClick)6 Optional (butterknife.Optional)6 UserItem (com.nextcloud.talk.adapters.items.UserItem)2 Intent (android.content.Intent)1 Bundle (android.os.Bundle)1 Handler (android.os.Handler)1 MaterialDialog (com.afollestad.materialdialogs.MaterialDialog)1 HorizontalChangeHandler (com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler)1 VerticalChangeHandler (com.bluelinelabs.conductor.changehandler.VerticalChangeHandler)1 CallActivity (com.nextcloud.talk.activities.CallActivity)1 RetrofitBucket (com.nextcloud.talk.models.RetrofitBucket)1 Room (com.nextcloud.talk.models.json.rooms.Room)1 RoomOverall (com.nextcloud.talk.models.json.rooms.RoomOverall)1 OperationDialogBuilder (com.stardust.app.OperationDialogBuilder)1 LayoutBoundsFloatyWindow (com.stardust.scriptdroid.ui.floating.layoutinspector.LayoutBoundsFloatyWindow)1 LayoutHierarchyFloatyWindow (com.stardust.scriptdroid.ui.floating.layoutinspector.LayoutHierarchyFloatyWindow)1 ScriptListView (com.stardust.scriptdroid.ui.main.scripts.ScriptListView)1 ThemeColorMaterialDialogBuilder (com.stardust.theme.dialog.ThemeColorMaterialDialogBuilder)1 Disposable (io.reactivex.disposables.Disposable)1 ArrayList (java.util.ArrayList)1