Android Open Source - Sensors2OSC Sensor Fragment






From Project

Back to project page Sensors2OSC.

License

The source code is released under:

Author: Thomas Mayer <thomas@residuum.org> Antonio Deusany de Carvalho Junior Copyright (c) 2014 Thomas Mayer, Antonio Deusany de Carvalho Junior Permission is hereby granted, free of charge, to any...

If you think the Android project Sensors2OSC listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.sensors2.osc.fragments;
/*from www  .  ja v  a  2  s . co m*/

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
import android.widget.TextView;

import org.sensors2.osc.R;
import org.sensors2.osc.communication.SensorConfiguration;

public class SensorFragment extends Fragment {
  private CompoundButton activeButton;
  private SensorConfiguration sensorConfiguration;

  public SensorFragment(){
    super();
    this.sensorConfiguration = new SensorConfiguration();
  }

  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
    View view = inflater.inflate(R.layout.single_sensor, null);
    Bundle args = this.getArguments();
    this.sensorConfiguration.setIndex(args.getInt("index", 0));
    this.sensorConfiguration.setSensorType(args.getInt("sensorType"));
    this.sensorConfiguration.setOscParam(args.getString("oscPrefix"));
    String name = args.getString("name", null);

    if (name != null) {
      view.findViewById(R.id.name).setVisibility(View.VISIBLE);
      ((TextView) view.findViewById(R.id.name)).setText(name);
    }

    this.activeButton = (CompoundButton) view.findViewById(R.id.active);
    this.activeButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
      @Override
      public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
        sensorConfiguration.setSend(checked);
      }
    });
    return view;
  }

  public SensorConfiguration getSensorConfiguration() {
    return sensorConfiguration;
  }
}




Java Source Code List

org.sensors2.osc.ApplicationTest.java
org.sensors2.osc.activities.AboutActivity.java
org.sensors2.osc.activities.SettingsActivity.java
org.sensors2.osc.activities.StartUpActivity.java
org.sensors2.osc.communication.OscCommunication.java
org.sensors2.osc.communication.OscConfiguration.java
org.sensors2.osc.communication.OscDispatcher.java
org.sensors2.osc.communication.SensorConfiguration.java
org.sensors2.osc.fragments.SensorFragment.java
org.sensors2.osc.fragments.SensorGroupFragment.java
org.sensors2.osc.sensors.Parameters.java
org.sensors2.osc.sensors.Settings.java