Search in sources :

Example 1 with NamingHelper

use of io.spark.core.android.ui.util.NamingHelper in project android-app by spark.

the class TinkerFragment method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.action_rename_core:
            new NamingHelper(getActivity(), api).showRenameDialog(device);
            return true;
        case R.id.action_reflash_tinker:
            api.reflashTinker(device.id);
            return true;
        case R.id.action_clear_tinker:
            prefs.clearTinker(device.id);
            for (Pin pin : allPins) {
                pin.setConfiguredAction(PinAction.NONE);
                pin.reset();
            }
            return true;
    }
    return super.onOptionsItemSelected(item);
}
Also used : NamingHelper(io.spark.core.android.ui.util.NamingHelper)

Example 2 with NamingHelper

use of io.spark.core.android.ui.util.NamingHelper in project android-app by spark.

the class NamingFragment method nameCurrentCore.

private void nameCurrentCore() {
    String name = coreNameText.getText().toString();
    Device existingDevice = DeviceState.getDeviceById(currentRenameAttemptHexId);
    // is this the name of an existing device?
    if (DeviceState.getExistingCoreNames().contains(name)) {
        // is it the current device?
        if (existingDevice == null || !name.equals(existingDevice.name)) {
            // No, it's not, which means this name belongs to another device
            // for this user, so it's a dupe name -- don't allow it.
            new NamingHelper(getActivity(), api).showDupeNameDialog(null);
            return;
        }
    }
    api.nameCore(currentRenameAttemptHexId, name);
    showProgress(true);
}
Also used : Device(io.spark.core.android.cloud.api.Device) NamingHelper(io.spark.core.android.ui.util.NamingHelper)

Aggregations

NamingHelper (io.spark.core.android.ui.util.NamingHelper)2 Device (io.spark.core.android.cloud.api.Device)1