Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
29 changes: 0 additions & 29 deletions .idea/codeStyles/Project.xml

This file was deleted.

18 changes: 13 additions & 5 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion '25.0.2'
compileSdkVersion 28

defaultConfig {
applicationId "sed.inf.u_szeged.hu.androidiotsimulator"
minSdkVersion 19
targetSdkVersion 23
targetSdkVersion 28
versionCode 13
versionName "1.3"
versionName "1.4"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
Expand All @@ -20,10 +20,10 @@ android {
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.0.2'
compile 'com.google.code.gson:gson:2.7'
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.1'
implementation 'com.google.code.gson:gson:2.8.2'
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ protected void onResume() {
}

private void initializeButtons() {
((FloatingActionButton) findViewById(R.id.new_cloud_fab)).setOnClickListener(new View.OnClickListener() {
findViewById(R.id.new_cloud_fab).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

AlertDialog.Builder builder = new AlertDialog.Builder(CloudActivity.this);
builder.setTitle("Select a Cloud Type");
final String cloudTypes[] = {"Bluemix Quickstart demo", "Bluemix regular"};
final String[] cloudTypes = {"Bluemix Quickstart demo", "Bluemix regular"};
builder.setItems(cloudTypes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Expand Down Expand Up @@ -90,7 +90,7 @@ public void onClick(DialogInterface dialog, int which) {
}
});

((Button) findViewById(R.id.edit_btn)).setOnClickListener(new View.OnClickListener() {
findViewById(R.id.edit_btn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(CloudActivity.this, CloudSettingsActivity.class);
Expand Down Expand Up @@ -138,10 +138,10 @@ public void onClick(View v) {
}
});

((Button) findViewById(R.id.delete_btn)).setOnClickListener(new View.OnClickListener() {
findViewById(R.id.delete_btn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Spinner spinner = (Spinner) findViewById(R.id.cloud_providers_spinner);
Spinner spinner = findViewById(R.id.cloud_providers_spinner);
String currentlySelected = MobIoTApplication.loadData(CloudSettingsActivity.KEY_NAME);

ArrayList<String> providers = createProvidersList();
Expand Down Expand Up @@ -205,7 +205,7 @@ private void loadSettingsFromPreferences() {


private void saveActualCloud() {
Spinner cloudSpinner = (Spinner) findViewById(R.id.cloud_providers_spinner);
Spinner cloudSpinner = findViewById(R.id.cloud_providers_spinner);
int pos = cloudSpinner.getSelectedItemPosition();
CloudSettingsWrapper cloudSettingsWrapper = cloudSettingsWrappers.get(pos);

Expand Down Expand Up @@ -250,7 +250,7 @@ private void initCloudProvidersSpinner(String overrideSelected) {

ArrayList<String> providers = createProvidersList();

Spinner spinner = (Spinner) findViewById(R.id.cloud_providers_spinner);
Spinner spinner = findViewById(R.id.cloud_providers_spinner);
// Create an ArrayAdapter using the string array and a default spinner layout
adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, providers);
// Specify the layout to use when the list of choices appears
Expand Down Expand Up @@ -350,7 +350,7 @@ private void setConnectionTypeSpinner(String connectionType) {
if (connectionType == null) {
connectionType = "";
}
Spinner connectionTypeSpinner = ((Spinner) findViewById(R.id.connection_type_spinner));
Spinner connectionTypeSpinner = findViewById(R.id.connection_type_spinner);
connectionTypeSpinner.setEnabled(false);
int count = connectionTypeSpinner.getCount();
for (int i = 0; i < count; i++) {
Expand All @@ -364,7 +364,7 @@ private void setConnectionTypeSpinner(String connectionType) {


private void initConnectionTypeSpinner() {
Spinner spinner = (Spinner) findViewById(R.id.connection_type_spinner);
Spinner spinner = findViewById(R.id.connection_type_spinner);
// Create an ArrayAdapter using the string array and a default spinner layout
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
R.array.connection_types, android.R.layout.simple_spinner_item);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,12 @@ public void handleMessage(Message msg) {

private static boolean isExternalStorageReadOnly() {
String extStorageState = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(extStorageState)) {
return true;
}
return false;
return Environment.MEDIA_MOUNTED_READ_ONLY.equals(extStorageState);
}

private static boolean isExternalStorageAvailable() {
String extStorageState = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(extStorageState)) {
return true;
}
return false;
return Environment.MEDIA_MOUNTED.equals(extStorageState);
}

private void deleteParamter(int position) {
Expand Down Expand Up @@ -155,7 +149,7 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_device_settings);

Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

getSupportActionBar().setDisplayHomeAsUpEnabled(true);
Expand All @@ -178,10 +172,10 @@ public void onClick(View view) {

res = getResources();

listView = (ExpandedListView) findViewById(R.id.list);
listView = findViewById(R.id.list);
SensorDataWrapper sdw;

aSwitch = (Switch) findViewById(R.id.sw_random);
aSwitch = findViewById(R.id.sw_random);
aSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton cb, boolean on) {
Expand Down Expand Up @@ -249,7 +243,7 @@ public void onCheckedChanged(CompoundButton cb, boolean on) {
// });


((Button) findViewById(R.id.add_btn)).setOnClickListener(new View.OnClickListener() {
findViewById(R.id.add_btn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String paramName = res.getString(R.string.new_paramter_name);
Expand All @@ -269,7 +263,7 @@ public void onClick(View v) {
// }
// });

((Button) findViewById(R.id.trace_import_btn)).setOnClickListener(new View.OnClickListener() {
findViewById(R.id.trace_import_btn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showFileChooser();
Expand All @@ -282,9 +276,7 @@ public void onClick(View v) {
// }


listView.setOnTouchListener(new View.OnTouchListener()

{
listView.setOnTouchListener(new View.OnTouchListener() {
// Setting on Touch Listener for handling the touch inside ScrollView
@Override
public boolean onTouch(View v, MotionEvent event) {
Expand Down Expand Up @@ -357,7 +349,7 @@ private ArrayList<String> loadOrganizationIds() {
}

private void initOrgIdSpinner(String defaultOrgId) {
Spinner spinner = (Spinner) findViewById(R.id.orgid_spinner);
Spinner spinner = findViewById(R.id.orgid_spinner);
ArrayList<String> organizationIds = loadOrganizationIds();
// Create an ArrayAdapter using the string array and a default spinner layout
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<>(this,
Expand All @@ -384,7 +376,7 @@ public void onNothingSelected(AdapterView<?> parent) {
}

private void initTypeSpinner(int selectedPos) {
Spinner spinner = (Spinner) findViewById(R.id.type_spinner);
Spinner spinner = findViewById(R.id.type_spinner);
// Create an ArrayAdapter using the string array and a default spinner layout
ArrayAdapter<CharSequence> spinnerAdapter = ArrayAdapter.createFromResource(this,
R.array.device_types, android.R.layout.simple_spinner_item);
Expand All @@ -399,7 +391,7 @@ private void initTypeSpinner(int selectedPos) {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {

EditText freqET = (EditText) findViewById(R.id.freq_value_et);
EditText freqET = findViewById(R.id.freq_value_et);

switch (position) {
case 0:
Expand Down Expand Up @@ -549,12 +541,10 @@ private void setData(Bundle bundle) {
}

private void initTypeIdSpinner(String type_id) {
Spinner spinner = (Spinner) findViewById(R.id.typeid_spinner);
Spinner spinner = findViewById(R.id.typeid_spinner);
ArrayList<String> typeIds = deviceTypeIds;

if (typeIds.contains("Create new type...")) {
typeIds.remove("Create new type...");
}
typeIds.remove("Create new type...");

typeIds.add("Create new type...");
final int positionOfLast = typeIds.size() - 1;
Expand Down Expand Up @@ -593,7 +583,7 @@ private void showInputDialog() {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(DeviceSettingsActivity.this);
alertDialogBuilder.setView(promptView);

final EditText editText = (EditText) promptView.findViewById(R.id._dialog_input_et);
final EditText editText = promptView.findViewById(R.id._dialog_input_et);
// setup a dialog window
alertDialogBuilder.setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
Expand Down Expand Up @@ -639,17 +629,23 @@ private class TypeSpinnerFillingTask extends AsyncTask<String, String, Void> {

@Override
protected Void doInBackground(String... strings) {

jsonTypeIds = restTools.getDeviceTypes();

try {
jsonTypeIds = restTools.getDeviceTypes();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}

@Override
protected void onPostExecute(Void aVoid) {
deviceTypeIds = new ArrayList<>();
for (Result result : jsonTypeIds) {
deviceTypeIds.add(result.getId());
if (jsonTypeIds != null) {
for (Result result : jsonTypeIds) {
deviceTypeIds.add(result.getId());
}
} else {
deviceTypeIds.add("MobIoTSimType");
}
initTypeIdSpinner(defaultTypeid);
}
Expand Down
Loading