1 package com.intel.realsense.camera;
3 import android.app.Activity;
4 import android.content.Context;
5 import android.view.LayoutInflater;
6 import android.view.View;
7 import android.view.ViewGroup;
8 import android.widget.AdapterView;
9 import android.widget.ArrayAdapter;
10 import android.widget.CompoundButton;
11 import android.widget.Spinner;
12 import android.widget.Switch;
18 import java.util.ArrayList;
19 import java.util.HashSet;
30 super(context, mLayoutResourceId, data);
31 mLayoutInflater = ((Activity) context).getLayoutInflater();
32 mStreamProfileCells =
data;
46 public View
getView(
int position, View rawView,
final ViewGroup parent){
47 rawView = mLayoutInflater.inflate(mLayoutResourceId, parent,
false);
52 holder.
type = rawView.findViewById(
R.id.stream_type_switch);
53 holder.
resolution = rawView.findViewById(
R.id.resolution_spinner);
54 holder.
fps = rawView.findViewById(
R.id.fps_spinner);
55 holder.
format = rawView.findViewById(
R.id.format_spinner);
59 holder.
type.setTag(position);
61 createSpinners(holder, position, listViewLine);
71 Set<String> formatsSet =
new HashSet<>();
72 Set<String> frameRatesSet =
new HashSet<>();
73 Set<String> resolutionsSet =
new HashSet<>();
76 formatsSet.add(sp.getFormat().name());
77 frameRatesSet.add(
String.valueOf(sp.getFrameRate()));
84 ArrayList<String> formats =
new ArrayList<>(formatsSet);
85 ArrayList<String> frameRates =
new ArrayList<>(frameRatesSet);
86 ArrayList<String> resolutions =
new ArrayList<>(resolutionsSet);
89 ArrayAdapter<String> formatsAdapter =
new ArrayAdapter<>(
mContext, android.R.layout.simple_spinner_item, formats);
90 formatsAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
91 holder.
format.setAdapter(formatsAdapter);
93 holder.
format.setOnItemSelectedListener(
new AdapterView.OnItemSelectedListener() {
95 public void onItemSelected(AdapterView<?> adapterView, View
view,
int i,
long l) {
99 mListener.onCheckedChanged(s);
102 public void onNothingSelected(AdapterView<?> adapterView) { }
106 ArrayAdapter<String> frameRatesAdapter =
new ArrayAdapter<>(
mContext, android.R.layout.simple_spinner_item, frameRates);
107 frameRatesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
108 holder.
fps.setAdapter(frameRatesAdapter);
110 holder.
fps.setOnItemSelectedListener(
new AdapterView.OnItemSelectedListener() {
112 public void onItemSelected(AdapterView<?> adapterView, View
view,
int i,
long l) {
116 mListener.onCheckedChanged(s);
119 public void onNothingSelected(AdapterView<?> adapterView) { }
123 ArrayAdapter<String> resolutionsAdapter =
new ArrayAdapter<>(
mContext, android.R.layout.simple_spinner_item, resolutions);
124 resolutionsAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
125 holder.
resolution.setAdapter(resolutionsAdapter);
127 holder.
resolution.setOnItemSelectedListener(
new AdapterView.OnItemSelectedListener() {
129 public void onItemSelected(AdapterView<?> adapterView, View
view,
int i,
long l) {
133 mListener.onCheckedChanged(s);
136 public void onNothingSelected(AdapterView<?> adapterView) { }
139 holder.
type.setOnCheckedChangeListener(
new CompoundButton.OnCheckedChangeListener() {
141 public void onCheckedChanged(CompoundButton compoundButton,
boolean b) {
142 int position = (int) compoundButton.getTag();
145 mListener.onCheckedChanged(s);
GLboolean GLboolean GLboolean b
uvc_xu_option< int > super
String getResolutionString()
void updateResolution(String str)
StreamProfile getProfile()
static final int mLayoutResourceId
::std_msgs::String_< std::allocator< void > > String
StreamProfileAdapter(Context context, StreamProfileSelector[] data, Listener listener)
void updateFrameRate(String str)
final StreamProfileSelector mStreamProfileCells[]
void updateEnabled(boolean state)
void updateFormat(String str)
View getView(int position, View rawView, final ViewGroup parent)
List< StreamProfile > getProfiles()
final LayoutInflater mLayoutInflater