当前位置: 首页>>代码示例>>Java>>正文


Java ParticleDeviceSetupLibrary类代码示例

本文整理汇总了Java中io.particle.android.sdk.devicesetup.ParticleDeviceSetupLibrary的典型用法代码示例。如果您正苦于以下问题:Java ParticleDeviceSetupLibrary类的具体用法?Java ParticleDeviceSetupLibrary怎么用?Java ParticleDeviceSetupLibrary使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ParticleDeviceSetupLibrary类属于io.particle.android.sdk.devicesetup包,在下文中一共展示了ParticleDeviceSetupLibrary类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import io.particle.android.sdk.devicesetup.ParticleDeviceSetupLibrary; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ParticleDeviceSetupLibrary.init(this.getApplicationContext());

    Ui.findView(this, R.id.start_setup_button).setOnClickListener(view -> invokeDeviceSetup());
    Ui.findView(this, R.id.start_setup_custom_intent_button).setOnClickListener(v -> invokeDeviceSetupWithCustomIntentBuilder());

    String setupLaunchTime = this.getIntent().getStringExtra(EXTRA_SETUP_LAUNCHED_TIME);

    if (setupLaunchTime != null) {
        TextView label = Ui.findView(this, R.id.textView);

        label.setText(String.format(getString(R.string.welcome_back), setupLaunchTime));
    }
}
 
开发者ID:particle-iot,项目名称:spark-setup-android,代码行数:18,代码来源:MainActivity.java

示例2: onCreate

import io.particle.android.sdk.devicesetup.ParticleDeviceSetupLibrary; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.particle_activity_login);
    ParticleDeviceSetupLibrary.getInstance().getApplicationComponent().activityComponentBuilder()
            .apModule(new ApModule()).build().inject(this);
    ButterKnife.bind(this);
    ParticleUi.enableBrandLogoInverseVisibilityAgainstSoftKeyboard(this);
    SEGAnalytics.screen("Auth: Login Screen");

    Ui.setText(this, R.id.log_in_header_text,
            Phrase.from(this, R.string.log_in_header_text)
                    .put("brand_name", getString(R.string.brand_name))
                    .format()
    );

    Ui.setTextFromHtml(this, R.id.user_has_no_account, R.string.msg_no_account)
            .setOnClickListener(v -> {
                startActivity(new Intent(v.getContext(), CreateAccountActivity.class));
                finish();
            });

    Ui.setTextFromHtml(this, R.id.forgot_password, R.string.msg_forgot_password);
}
 
开发者ID:particle-iot,项目名称:spark-setup-android,代码行数:25,代码来源:LoginActivity.java

示例3: onCreate

import io.particle.android.sdk.devicesetup.ParticleDeviceSetupLibrary; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_password_entry);
    ParticleDeviceSetupLibrary.getInstance().getApplicationComponent().activityComponentBuilder()
            .apModule(new ApModule()).build().inject(this);
    ButterKnife.bind(this);
    SEGAnalytics.screen("Device Setup: Password Entry Screen");
    ParticleUi.enableBrandLogoInverseVisibilityAgainstSoftKeyboard(this);

    networkToConnectTo = gson.fromJson(
            getIntent().getStringExtra(EXTRA_NETWORK_TO_CONFIGURE),
            ScanApCommand.Scan.class);
    softApSSID = getIntent().getParcelableExtra(EXTRA_SOFT_AP_SSID);
    passwordBox.requestFocus();
    initViews();
}
 
开发者ID:particle-iot,项目名称:spark-setup-android,代码行数:18,代码来源:PasswordEntryActivity.java

示例4: onCreate

import io.particle.android.sdk.devicesetup.ParticleDeviceSetupLibrary; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Fabric.with(this, new Crashlytics());
    ParticleDeviceSetupLibrary.init(this.getApplicationContext(), DeviceListActivity.class);

    if (SPLASH_DISPLAY_TIME < 1) {
        // don't display the splash screen at all, immediately move to the next activity.
        onShowingSplashComplete();
        return;
    }

    this.setContentView(R.layout.activity_splash);

    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
    }
}
 
开发者ID:particle-iot,项目名称:photon-tinker-android,代码行数:19,代码来源:SplashActivity.java

示例5: onViewCreated

import io.particle.android.sdk.devicesetup.ParticleDeviceSetupLibrary; //导入依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ButterKnife.bind(this, view);

    refreshLayout.setOnRefreshListener(this::refreshDevices);

    deviceSetupCompleteReceiver = new ParticleDeviceSetupLibrary.DeviceSetupCompleteReceiver() {
        @Override
        public void onSetupSuccess(String id) {
            log.d("Successfully set up " + id);
        }

        @Override
        public void onSetupFailure() {
            log.w("Device not set up.");
        }
    };
    deviceSetupCompleteReceiver.register(getActivity());

    getLoaderManager().initLoader(R.id.device_list_devices_loader_id, null, this);
    refreshLayout.setRefreshing(true);
}
 
开发者ID:particle-iot,项目名称:photon-tinker-android,代码行数:24,代码来源:DeviceListFragment.java

示例6: getNextActivityIntent

import io.particle.android.sdk.devicesetup.ParticleDeviceSetupLibrary; //导入依赖的package包/类
public static Intent getNextActivityIntent(Context ctx,
                                           ParticleCloud particleCloud,
                                           SensitiveDataStorage credStorage,
                                           SetupResult setupResult) {
    NextActivitySelector selector = new NextActivitySelector(particleCloud, credStorage,
            ParticleDeviceSetupLibrary.getInstance().getSetupCompleteIntentBuilder());

    return selector.buildIntentForNextActivity(ctx, setupResult);
}
 
开发者ID:Datatellit,项目名称:xlight_android_native,代码行数:10,代码来源:NextActivitySelector.java

示例7: testSetupFlow

import io.particle.android.sdk.devicesetup.ParticleDeviceSetupLibrary; //导入依赖的package包/类
@Test
    public void testSetupFlow() {
        //create/mock photon device SSID
        String ssid = (InstrumentationRegistry.getInstrumentation().getTargetContext()
                .getApplicationContext().getString(R.string.network_name_prefix) + "-") + "TestSSID";
        //mock scan results object to fake photon device SSID as scan result
        mockDeviceDiscoveryResult(ssid);
        //fake scan wifi screen results by creating mock wifi scan result
        CommandClient commandClient = mock(CommandClient.class);
        when(commandClientFactory.newClientUsingDefaultsForDevices(any(WifiFacade.class), any(SSID.class))).thenReturn(commandClient);
        String wifiSSID = "fakeWifiToConnectTo";
        mockWifiResult(wifiSSID, commandClient);
        //fake configuration steps
        mockSetupSteps();
        mockConfigureApStep(commandClient);
        mockConnectApStep(commandClient);
        //launch test activity
        activityRule.launchActivity(null);
        //launch setup process
        ParticleDeviceSetupLibrary.startDeviceSetup(activityRule.getActivity(), MainActivity.class);
        try {
            setupFlow(ssid, wifiSSID);
        } catch (NoMatchingViewException e) {
//            loginFlow(ssid, wifiSSID);
            loginFlow();
        }
    }
 
开发者ID:particle-iot,项目名称:spark-setup-android,代码行数:28,代码来源:SetupFlowTest.java

示例8: EspressoDaggerMockRule

import io.particle.android.sdk.devicesetup.ParticleDeviceSetupLibrary; //导入依赖的package包/类
public EspressoDaggerMockRule() {
    super(ApplicationComponent.class, new ApplicationModule(getApp()));
    set(component -> {
        ParticleDeviceSetupLibrary.init(getApp());
        ParticleDeviceSetupLibrary.getInstance().setComponent(component);
    });
}
 
开发者ID:particle-iot,项目名称:spark-setup-android,代码行数:8,代码来源:EspressoDaggerMockRule.java

示例9: onCreate

import io.particle.android.sdk.devicesetup.ParticleDeviceSetupLibrary; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_password_reset);
    ParticleDeviceSetupLibrary.getInstance().getApplicationComponent().activityComponentBuilder()
            .apModule(new ApModule()).build().inject(this);
    ButterKnife.bind(this);

    SEGAnalytics.screen("Auth: Forgot password screen");
    ParticleUi.enableBrandLogoInverseVisibilityAgainstSoftKeyboard(this);

    Ui.findView(this, R.id.action_cancel).setOnClickListener(view -> finish());
    emailView.setText(getIntent().getStringExtra(EXTRA_EMAIL));
}
 
开发者ID:particle-iot,项目名称:spark-setup-android,代码行数:15,代码来源:PasswordResetActivity.java

示例10: buildIntent

import io.particle.android.sdk.devicesetup.ParticleDeviceSetupLibrary; //导入依赖的package包/类
public static Intent buildIntent(Context ctx, SSID deviceSoftApSsid,
                                 ScanApCommand.Scan networkToConnectTo) {
    return new Intent(ctx, ConnectingActivity.class)
            .putExtra(EXTRA_NETWORK_TO_CONFIGURE, ParticleDeviceSetupLibrary.getInstance()
                    .getApplicationComponent().getGson().toJson(networkToConnectTo))
            .putExtra(EXTRA_SOFT_AP_SSID, deviceSoftApSsid);
}
 
开发者ID:particle-iot,项目名称:spark-setup-android,代码行数:8,代码来源:ConnectingActivity.java

示例11: onCreate

import io.particle.android.sdk.devicesetup.ParticleDeviceSetupLibrary; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_connecting);
    ParticleDeviceSetupLibrary.getInstance().getApplicationComponent().activityComponentBuilder()
            .apModule(new ApModule()).build().inject(this);
    ButterKnife.bind(this);
    SEGAnalytics.screen("Device Setup: Connecting progress screen");
    publicKey = DeviceSetupState.publicKey;
    deviceSoftApSsid = getIntent().getParcelableExtra(EXTRA_SOFT_AP_SSID);

    String asJson = getIntent().getStringExtra(EXTRA_NETWORK_TO_CONFIGURE);
    networkToConnectTo = gson.fromJson(asJson, ScanApCommand.Scan.class);
    networkSecretPlaintext = getIntent().getStringExtra(EXTRA_NETWORK_SECRET);

    log.d("Connecting to " + networkToConnectTo + ", with networkSecretPlaintext of size: "
            + ((networkSecretPlaintext == null) ? 0 : networkSecretPlaintext.length()));

    Ui.setText(this, R.id.network_name, networkToConnectTo.ssid);
    Ui.setText(this, R.id.connecting_text,
            Phrase.from(this, R.string.connecting_text)
                    .put("device_name", getString(R.string.device_name))
                    .format()
    );
    Ui.setText(this, R.id.network_name, networkToConnectTo.ssid);

    connectingProcessWorkerTask = new ConnectingProcessWorkerTask(this, buildSteps(), 15);
    connectingProcessWorkerTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
 
开发者ID:particle-iot,项目名称:spark-setup-android,代码行数:30,代码来源:ConnectingActivity.java

示例12: ConnectingProcessWorkerTask

import io.particle.android.sdk.devicesetup.ParticleDeviceSetupLibrary; //导入依赖的package包/类
ConnectingProcessWorkerTask(Activity activity, List<SetupStep> steps, int maxOverallAttempts) {
    super(steps, maxOverallAttempts);
    ParticleDeviceSetupLibrary.getInstance().getApplicationComponent().activityComponentBuilder()
            .build().inject(this);
    this.deviceId = DeviceSetupState.deviceToBeSetUpId;
    this.activityReference = new WeakReference<>(activity);
    this.tintedSpinner = Ui.getTintedDrawable(activity, R.drawable.progress_spinner, R.color.element_text_color);
    this.tintedCheckmark = Ui.getTintedDrawable(activity, R.drawable.checkmark, R.color.element_text_color);
}
 
开发者ID:particle-iot,项目名称:spark-setup-android,代码行数:10,代码来源:ConnectingProcessWorkerTask.java

示例13: onCreate

import io.particle.android.sdk.devicesetup.ParticleDeviceSetupLibrary; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ParticleDeviceSetupLibrary.getInstance().getApplicationComponent().activityComponentBuilder()
            .apModule(new ApModule()).build().inject(this);
    SEGAnalytics.screen("Device Setup: Manual network entry screen");
    softApSSID = getIntent().getParcelableExtra(EXTRA_SOFT_AP);

    setContentView(R.layout.activity_manual_network_entry);
    ButterKnife.bind(this);
    ParticleUi.enableBrandLogoInverseVisibilityAgainstSoftKeyboard(this);
}
 
开发者ID:particle-iot,项目名称:spark-setup-android,代码行数:13,代码来源:ManualNetworkEntryActivity.java

示例14: onCreate

import io.particle.android.sdk.devicesetup.ParticleDeviceSetupLibrary; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_get_ready);
    ParticleDeviceSetupLibrary.getInstance().getApplicationComponent().activityComponentBuilder()
            .apModule(new ApModule()).build().inject(this);
    SEGAnalytics.screen("Device Setup: Get ready screen");
    softAPConfigRemover.removeAllSoftApConfigs();
    softAPConfigRemover.reenableWifiNetworks();

    PermissionsFragment.ensureAttached(this);

    Ui.findView(this, R.id.action_im_ready).setOnClickListener(this::onReadyButtonClicked);
    Ui.setTextFromHtml(this, R.id.action_troubleshooting, R.string.troubleshooting)
            .setOnClickListener(v -> {
                Uri uri = Uri.parse(v.getContext().getString(R.string.troubleshooting_uri));
                startActivity(WebViewActivity.buildIntent(v.getContext(), uri));
            });

    Ui.setText(this, R.id.get_ready_text,
            Phrase.from(this, R.string.get_ready_text)
                    .put("device_name", getString(R.string.device_name))
                    .put("indicator_light_setup_color_name", getString(R.string.listen_mode_led_color_name))
                    .put("setup_button_identifier", getString(R.string.mode_button_name))
                    .format());

    Ui.setText(this, R.id.get_ready_text_title,
            Phrase.from(this, R.string.get_ready_title_text)
                    .put("device_name", getString(R.string.device_name))
                    .format());
}
 
开发者ID:particle-iot,项目名称:spark-setup-android,代码行数:32,代码来源:GetReadyActivity.java

示例15: onCreate

import io.particle.android.sdk.devicesetup.ParticleDeviceSetupLibrary; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ParticleDeviceSetupLibrary.getInstance().getApplicationComponent().activityComponentBuilder()
            .apModule(new ApModule()).build().inject(this);
    SEGAnalytics.screen("Device Setup: Select Network Screen");
    softApSSID = getIntent().getParcelableExtra(EXTRA_SOFT_AP);
    setContentView(R.layout.activity_select_network);
    ButterKnife.bind(this);

    wifiListFragment = Ui.findFrag(this, R.id.wifi_list_fragment);
}
 
开发者ID:particle-iot,项目名称:spark-setup-android,代码行数:13,代码来源:SelectNetworkActivity.java


注:本文中的io.particle.android.sdk.devicesetup.ParticleDeviceSetupLibrary类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。