Skip to content

Commit

Permalink
Merge pull request #45 from particle-iot/fix/filter
Browse files Browse the repository at this point in the history
Bluz & Oak filters
  • Loading branch information
jensck authored Jul 12, 2018
2 parents f03eb68 + 91b7234 commit f7c6b6f
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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<ParticleDevice.ParticleDeviceType> typeArrayList = new ArrayList<>();
typeArrayList.add(photonFilter.isChecked() ? ParticleDevice.ParticleDeviceType.PHOTON : null);
Expand All @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -397,7 +399,7 @@ static class ViewHolder extends RecyclerView.ViewHolder {
private Drawable defaultBackground;
private String textFilter = "";
private List<ParticleDevice.ParticleDeviceType> 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;
Expand Down
26 changes: 26 additions & 0 deletions app/src/main/res/layout/activity_device_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>

Expand Down Expand Up @@ -109,6 +110,31 @@
app:layout_constraintStart_toEndOf="@+id/redBearFilter"
app:layout_constraintTop_toBottomOf="@+id/p1Filter"/>

<CheckBox
android:id="@+id/bluzFilter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:checked="true"
android:text="@string/bluz"
app:layout_constraintEnd_toStartOf="@+id/oakFilter"
app:layout_constraintStart_toEndOf="@+id/p1Filter"
app:layout_constraintTop_toBottomOf="@+id/filtersLabel"/>

<CheckBox
android:id="@+id/oakFilter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingEnd="10dp"
android:paddingRight="10dp"
android:paddingLeft="10dp"
android:paddingStart="10dp"
android:layout_margin="10dp"
android:checked="true"
android:text="@string/oak"
app:layout_constraintStart_toEndOf="@+id/bluzFilter"
app:layout_constraintTop_toBottomOf="@+id/filtersLabel"/>

</android.support.constraint.ConstraintLayout>
</HorizontalScrollView>

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ Enjoy!]]></string>
<string name="unknown">Unknown</string>
<string name="raspberry">Raspberry Pi</string>
<string name="red_bear_duo">Red Bear Duo</string>
<string name="bluz">Bluz</string>
<string name="oak">Oak</string>
<string name="p1">P1</string>
<string name="filters">Filters:</string>
<string name="event">Event</string>
Expand Down

0 comments on commit f7c6b6f

Please sign in to comment.