Search in sources :

Example 11 with Device

use of io.spark.core.android.cloud.api.Device in project android-app by spark.

the class NamingFragment method populateName.

private void populateName() {
    Device device = DeviceState.getDeviceById(currentRenameAttemptHexId);
    String name = null;
    if (device != null) {
        // use existing name
        name = device.name;
    }
    // it could still be null if the device was never named
    if (name == null) {
        name = CoreNameGenerator.generateUniqueName(DeviceState.getExistingCoreNames());
    }
    coreNameText.setText(name);
}
Also used : Device(io.spark.core.android.cloud.api.Device)

Example 12 with Device

use of io.spark.core.android.cloud.api.Device in project android-app by spark.

the class DeviceState method initialize.

public static synchronized void initialize(Context ctx) {
    appContext = ctx.getApplicationContext();
    String coresJsonArray = Prefs.getInstance().getCoresJsonArray();
    Type listType = new TypeToken<List<Device>>() {
    }.getType();
    List<Device> devices = WebHelpers.getGson().fromJson(coresJsonArray, listType);
    updateAllKnownDevices(devices);
}
Also used : Type(java.lang.reflect.Type) Device(io.spark.core.android.cloud.api.Device) List(java.util.List)

Aggregations

Device (io.spark.core.android.cloud.api.Device)12 Fragment (android.app.Fragment)1 Intent (android.content.Intent)1 Drawable (android.graphics.drawable.Drawable)1 GradientDrawable (android.graphics.drawable.GradientDrawable)1 LayoutInflater (android.view.LayoutInflater)1 SmartConfigActivity (io.spark.core.android.ui.smartconfig.SmartConfigActivity)1 TinkerFragment (io.spark.core.android.ui.tinker.TinkerFragment)1 NamingHelper (io.spark.core.android.ui.util.NamingHelper)1 Type (java.lang.reflect.Type)1 List (java.util.List)1