From 91b72348db5b2b98cf1e9292d579de0c12ccd047 Mon Sep 17 00:00:00 2001 From: Julius Date: Thu, 12 Jul 2018 01:06:06 +0300 Subject: [PATCH] adding bluz & oak filters --- .../android/sdk/ui/DeviceListActivity.java | 6 ++++- .../android/sdk/ui/DeviceListFragment.java | 4 ++- .../main/res/layout/activity_device_list.xml | 26 +++++++++++++++++++ app/src/main/res/values/strings.xml | 2 ++ 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/particle/android/sdk/ui/DeviceListActivity.java b/app/src/main/java/io/particle/android/sdk/ui/DeviceListActivity.java index 5042deb1..a0b41c67 100644 --- a/app/src/main/java/io/particle/android/sdk/ui/DeviceListActivity.java +++ b/app/src/main/java/io/particle/android/sdk/ui/DeviceListActivity.java @@ -64,6 +64,8 @@ public class DeviceListActivity extends BaseActivity implements DeviceListFragme @BindView(R.id.raspberryFilter) protected CheckBox raspberryFilter; @BindView(R.id.p1Filter) protected CheckBox p1Filter; @BindView(R.id.redBearFilter) protected CheckBox redBearFilter; + @BindView(R.id.bluzFilter) protected CheckBox bluzFilter; + @BindView(R.id.oakFilter) protected CheckBox oakFilter; @BindView(R.id.appbar) protected AppBarLayout appBarLayout; private SearchView searchView; @@ -76,7 +78,7 @@ public class DeviceListActivity extends BaseActivity implements DeviceListFragme }; @OnCheckedChanged({R.id.photonFilter, R.id.electronFilter, R.id.coreFilter, - R.id.raspberryFilter, R.id.p1Filter, R.id.redBearFilter}) + R.id.raspberryFilter, R.id.p1Filter, R.id.redBearFilter, R.id.bluzFilter, R.id.oakFilter}) protected void onDeviceType() { ArrayList typeArrayList = new ArrayList<>(); typeArrayList.add(photonFilter.isChecked() ? ParticleDevice.ParticleDeviceType.PHOTON : null); @@ -85,6 +87,8 @@ protected void onDeviceType() { typeArrayList.add(raspberryFilter.isChecked() ? ParticleDevice.ParticleDeviceType.RASPBERRY_PI : null); typeArrayList.add(p1Filter.isChecked() ? ParticleDevice.ParticleDeviceType.P1 : null); typeArrayList.add(redBearFilter.isChecked() ? ParticleDevice.ParticleDeviceType.RED_BEAR_DUO : null); + typeArrayList.add(oakFilter.isChecked() ? ParticleDevice.ParticleDeviceType.DIGISTUMP_OAK : null); + typeArrayList.add(bluzFilter.isChecked() ? ParticleDevice.ParticleDeviceType.BLUZ : null); deviceList.filter(typeArrayList); } diff --git a/app/src/main/java/io/particle/android/sdk/ui/DeviceListFragment.java b/app/src/main/java/io/particle/android/sdk/ui/DeviceListFragment.java index f82f0743..6aca64de 100644 --- a/app/src/main/java/io/particle/android/sdk/ui/DeviceListFragment.java +++ b/app/src/main/java/io/particle/android/sdk/ui/DeviceListFragment.java @@ -65,7 +65,9 @@ import io.particle.android.sdk.utils.ui.Ui; import io.particle.sdk.app.R; +import static io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.BLUZ; import static io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.CORE; +import static io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.DIGISTUMP_OAK; import static io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.ELECTRON; import static io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.P1; import static io.particle.android.sdk.cloud.ParticleDevice.ParticleDeviceType.PHOTON; @@ -397,7 +399,7 @@ static class ViewHolder extends RecyclerView.ViewHolder { private Drawable defaultBackground; private String textFilter = ""; private List typeFilters = list(PHOTON, CORE, ELECTRON, - RASPBERRY_PI, P1, RED_BEAR_DUO); + RASPBERRY_PI, P1, RED_BEAR_DUO, DIGISTUMP_OAK, BLUZ); DeviceListAdapter(FragmentActivity activity) { this.activity = activity; diff --git a/app/src/main/res/layout/activity_device_list.xml b/app/src/main/res/layout/activity_device_list.xml index 5afceda7..e94a62d6 100644 --- a/app/src/main/res/layout/activity_device_list.xml +++ b/app/src/main/res/layout/activity_device_list.xml @@ -74,6 +74,7 @@ android:layout_margin="10dp" android:checked="true" android:text="@string/p1" + app:layout_constraintEnd_toStartOf="@+id/bluzFilter" app:layout_constraintStart_toEndOf="@+id/electronFilter" app:layout_constraintTop_toBottomOf="@+id/filtersLabel"/> @@ -109,6 +110,31 @@ app:layout_constraintStart_toEndOf="@+id/redBearFilter" app:layout_constraintTop_toBottomOf="@+id/p1Filter"/> + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7f4c9a09..6951606c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -70,6 +70,8 @@ Enjoy!]]> Unknown Raspberry Pi Red Bear Duo + Bluz + Oak P1 Filters: Event