-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Custom sampling rates for streams added
- Loading branch information
1 parent
a1f0ad5
commit f724b0e
Showing
7 changed files
with
440 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
app/src/main/java/com/example/aliayubkhan/senda/SettingsActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
package com.example.aliayubkhan.senda; | ||
|
||
import android.annotation.SuppressLint; | ||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.view.View; | ||
import android.widget.Button; | ||
import android.widget.EditText; | ||
|
||
/** | ||
* Created by aliayubkhan on 21/10/2018. | ||
*/ | ||
|
||
|
||
|
||
public class SettingsActivity extends AppCompatActivity { | ||
|
||
@SuppressLint("StaticFieldLeak") | ||
static EditText accelerometer_sampling_rate; | ||
@SuppressLint("StaticFieldLeak") | ||
static EditText light_sampling_rate; | ||
@SuppressLint("StaticFieldLeak") | ||
static EditText proximity_sampling_rate; | ||
@SuppressLint("StaticFieldLeak") | ||
static EditText gravity_sampling_rate; | ||
@SuppressLint("StaticFieldLeak") | ||
static EditText linear_acceleration_sampling_rate; | ||
@SuppressLint("StaticFieldLeak") | ||
static EditText rotation_vector_sampling_rate; | ||
@SuppressLint("StaticFieldLeak") | ||
static EditText step_count_sampling_rate; | ||
@SuppressLint("StaticFieldLeak") | ||
static EditText audio_sampling_rate; | ||
|
||
//Variables to store sampling rates | ||
|
||
public static int accelerometer_sampling_rate_data = 12; | ||
public static int light_sampling_rate_data = 12; | ||
public static int proximity_sampling_rate_data = 12; | ||
public static int gravity_sampling_rate_data = 12; | ||
public static int linear_acceleration_sampling_rate_data = 12; | ||
public static int rotation_vector_sampling_rate_data = 12; | ||
public static int step_count_sampling_rate_data = 12; | ||
public static int audio_sampling_rate_data = 8000; | ||
|
||
public static Boolean samplingRate_set_Check = Boolean.FALSE; | ||
|
||
//Button for setting values | ||
Button samplingSet; | ||
|
||
@Override | ||
public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.settings_activity); | ||
|
||
samplingRate_set_Check = Boolean.TRUE; | ||
samplingSet = (Button) findViewById(R.id.samplingSetBtn); | ||
|
||
samplingSet.setOnClickListener(new View.OnClickListener() { | ||
|
||
@Override | ||
public void onClick(View v) { | ||
getSamplingRates(); | ||
Intent intent = new Intent(SettingsActivity.this, MainActivity.class); | ||
startActivity(intent); | ||
} | ||
}); | ||
accelerometer_sampling_rate = (EditText) findViewById(R.id.accelerometer_sampling_rate); | ||
light_sampling_rate = (EditText) findViewById(R.id.light_sampling_rate); | ||
proximity_sampling_rate = (EditText) findViewById(R.id.proximity_sampling_rate); | ||
gravity_sampling_rate = (EditText) findViewById(R.id.gravity_sampling_rate); | ||
linear_acceleration_sampling_rate = (EditText) findViewById(R.id.linear_acceleration_sampling_rate); | ||
rotation_vector_sampling_rate = (EditText) findViewById(R.id.rotation_vector_sampling_rate); | ||
step_count_sampling_rate = (EditText) findViewById(R.id.step_count_sampling_rate); | ||
audio_sampling_rate = (EditText) findViewById(R.id.audio_sampling_rate); | ||
|
||
|
||
accelerometer_sampling_rate.setText(String.valueOf(accelerometer_sampling_rate_data)); | ||
light_sampling_rate.setText(String.valueOf(light_sampling_rate_data)); | ||
proximity_sampling_rate.setText(String.valueOf(proximity_sampling_rate_data)); | ||
gravity_sampling_rate.setText(String.valueOf(gravity_sampling_rate_data)); | ||
linear_acceleration_sampling_rate.setText(String.valueOf(linear_acceleration_sampling_rate_data)); | ||
rotation_vector_sampling_rate.setText(String.valueOf(rotation_vector_sampling_rate_data)); | ||
step_count_sampling_rate.setText(String.valueOf(step_count_sampling_rate_data)); | ||
audio_sampling_rate.setText(String.valueOf(audio_sampling_rate_data)); | ||
} | ||
|
||
@Override | ||
public void onBackPressed() { | ||
getSamplingRates(); | ||
Intent intent = new Intent(SettingsActivity.this, MainActivity.class); | ||
startActivity(intent); | ||
} | ||
|
||
static void getSamplingRates(){ | ||
accelerometer_sampling_rate_data = Integer.parseInt(String.valueOf(accelerometer_sampling_rate.getText())); | ||
light_sampling_rate_data = Integer.parseInt(String.valueOf(light_sampling_rate.getText())); | ||
proximity_sampling_rate_data = Integer.parseInt(String.valueOf(proximity_sampling_rate.getText())); | ||
gravity_sampling_rate_data = Integer.parseInt(String.valueOf(gravity_sampling_rate.getText())); | ||
linear_acceleration_sampling_rate_data = Integer.parseInt(String.valueOf(linear_acceleration_sampling_rate.getText())); | ||
rotation_vector_sampling_rate_data = Integer.parseInt(String.valueOf(rotation_vector_sampling_rate.getText())); | ||
step_count_sampling_rate_data = Integer.parseInt(String.valueOf(step_count_sampling_rate.getText())); | ||
audio_sampling_rate_data = Integer.parseInt(String.valueOf(audio_sampling_rate.getText())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<vector android:height="24dp" android:viewportHeight="478.703" | ||
android:viewportWidth="478.703" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<path android:fillColor="#FF000000" android:pathData="M454.2,189.1l-33.6,-5.7c-3.5,-11.3 -8,-22.2 -13.5,-32.6l19.8,-27.7c8.4,-11.8 7.1,-27.9 -3.2,-38.1l-29.8,-29.8c-5.6,-5.6 -13,-8.7 -20.9,-8.7c-6.2,0 -12.1,1.9 -17.1,5.5l-27.8,19.8c-10.8,-5.7 -22.1,-10.4 -33.8,-13.9l-5.6,-33.2c-2.4,-14.3 -14.7,-24.7 -29.2,-24.7h-42.1c-14.5,0 -26.8,10.4 -29.2,24.7l-5.8,34c-11.2,3.5 -22.1,8.1 -32.5,13.7l-27.5,-19.8c-5,-3.6 -11,-5.5 -17.2,-5.5c-7.9,0 -15.4,3.1 -20.9,8.7l-29.9,29.8c-10.2,10.2 -11.6,26.3 -3.2,38.1l20,28.1c-5.5,10.5 -9.9,21.4 -13.3,32.7l-33.2,5.6c-14.3,2.4 -24.7,14.7 -24.7,29.2v42.1c0,14.5 10.4,26.8 24.7,29.2l34,5.8c3.5,11.2 8.1,22.1 13.7,32.5l-19.7,27.4c-8.4,11.8 -7.1,27.9 3.2,38.1l29.8,29.8c5.6,5.6 13,8.7 20.9,8.7c6.2,0 12.1,-1.9 17.1,-5.5l28.1,-20c10.1,5.3 20.7,9.6 31.6,13l5.6,33.6c2.4,14.3 14.7,24.7 29.2,24.7h42.2c14.5,0 26.8,-10.4 29.2,-24.7l5.7,-33.6c11.3,-3.5 22.2,-8 32.6,-13.5l27.7,19.8c5,3.6 11,5.5 17.2,5.5l0,0c7.9,0 15.3,-3.1 20.9,-8.7l29.8,-29.8c10.2,-10.2 11.6,-26.3 3.2,-38.1l-19.8,-27.8c5.5,-10.5 10.1,-21.4 13.5,-32.6l33.6,-5.6c14.3,-2.4 24.7,-14.7 24.7,-29.2v-42.1C478.9,203.8 468.5,191.5 454.2,189.1zM451.9,260.4c0,1.3 -0.9,2.4 -2.2,2.6l-42,7c-5.3,0.9 -9.5,4.8 -10.8,9.9c-3.8,14.7 -9.6,28.8 -17.4,41.9c-2.7,4.6 -2.5,10.3 0.6,14.7l24.7,34.8c0.7,1 0.6,2.5 -0.3,3.4l-29.8,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-0.5c0.4,0 1.2,0.1 1.9,0.8l29.8,29.8c0.9,0.9 1,2.3 0.3,3.4l-24.7,34.7c-3.1,4.3 -3.3,10.1 -0.6,14.7c7.8,13.1 13.6,27.2 17.4,41.9c1.3,5.2 5.6,9.1 10.8,9.9l42,7.1c1.3,0.2 2.2,1.3 2.2,2.6v42.1H451.9z"/> | ||
<path android:fillColor="#FF000000" android:pathData="M239.4,136c-57,0 -103.3,46.3 -103.3,103.3s46.3,103.3 103.3,103.3s103.3,-46.3 103.3,-103.3S296.4,136 239.4,136zM239.4,315.6c-42.1,0 -76.3,-34.2 -76.3,-76.3s34.2,-76.3 76.3,-76.3s76.3,34.2 76.3,76.3S281.5,315.6 239.4,315.6z"/> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.