Skip to content

Commit 92f56a5

Browse files
Kunal RaiCloudyPadmal
authored andcommitted
robotic arm crash solved (#1982)
1 parent 1c2caab commit 92f56a5

File tree

2 files changed

+26
-16
lines changed

2 files changed

+26
-16
lines changed

app/src/main/java/io/pslab/activity/RoboticArmActivity.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ public void onClick(View v) {
150150
scrollView = findViewById(R.id.horizontal_scroll_view);
151151
servoCSVLogger = new CSVLogger(getResources().getString(R.string.robotic_arm));
152152

153-
degreeText1.setText(getResources().getString(R.string.zero) + getResources().getString(R.string.robotic_arm_degree_symbol));
154-
degreeText2.setText(getResources().getString(R.string.zero) + getResources().getString(R.string.robotic_arm_degree_symbol));
155-
degreeText3.setText(getResources().getString(R.string.zero) + getResources().getString(R.string.robotic_arm_degree_symbol));
156-
degreeText4.setText(getResources().getString(R.string.zero) + getResources().getString(R.string.robotic_arm_degree_symbol));
153+
degreeText1.setText(getResources().getString(R.string.zero));
154+
degreeText2.setText(getResources().getString(R.string.zero));
155+
degreeText3.setText(getResources().getString(R.string.zero));
156+
degreeText4.setText(getResources().getString(R.string.zero));
157157

158158
LinearLayout.LayoutParams servoControllerParams = new LinearLayout.LayoutParams(screen_width / 4 - 4, screen_height / 2 - 4);
159159
servoControllerParams.setMargins(2, 5, 2, 0);
@@ -231,10 +231,10 @@ public void onClick(View v) {
231231
@Override
232232
public void onProgressChanged(SeekArc seekArc, int i, boolean b) {
233233
if (editEnter) {
234-
degreeText1.setText(String.valueOf(degree) + getResources().getString(R.string.robotic_arm_degree_symbol));
234+
degreeText1.setText(String.valueOf(degree));
235235
editEnter = false;
236236
} else {
237-
degreeText1.setText(String.valueOf((int) (i * 3.6)) + getResources().getString(R.string.robotic_arm_degree_symbol));
237+
degreeText1.setText(String.valueOf((int) (i * 3.6)));
238238
}
239239
degreeText1.setCursorVisible(false);
240240
}
@@ -254,10 +254,10 @@ public void onStopTrackingTouch(SeekArc seekArc) {
254254
@Override
255255
public void onProgressChanged(SeekArc seekArc, int i, boolean b) {
256256
if (editEnter) {
257-
degreeText2.setText(String.valueOf(degree) + getResources().getString(R.string.robotic_arm_degree_symbol));
257+
degreeText2.setText(String.valueOf(degree));
258258
editEnter = false;
259259
} else {
260-
degreeText2.setText(String.valueOf((int) (i * 3.6)) + getResources().getString(R.string.robotic_arm_degree_symbol));
260+
degreeText2.setText(String.valueOf((int) (i * 3.6)));
261261
}
262262
degreeText2.setCursorVisible(false);
263263
}
@@ -277,10 +277,10 @@ public void onStopTrackingTouch(SeekArc seekArc) {
277277
@Override
278278
public void onProgressChanged(SeekArc seekArc, int i, boolean b) {
279279
if (editEnter) {
280-
degreeText3.setText(String.valueOf(degree) + getResources().getString(R.string.robotic_arm_degree_symbol));
280+
degreeText3.setText(String.valueOf(degree));
281281
editEnter = false;
282282
} else {
283-
degreeText3.setText(String.valueOf((int) (i * 3.6)) + getResources().getString(R.string.robotic_arm_degree_symbol));
283+
degreeText3.setText(String.valueOf((int) (i * 3.6)));
284284
}
285285
degreeText3.setCursorVisible(false);
286286
}
@@ -300,10 +300,10 @@ public void onStopTrackingTouch(SeekArc seekArc) {
300300
@Override
301301
public void onProgressChanged(SeekArc seekArc, int i, boolean b) {
302302
if (editEnter) {
303-
degreeText4.setText(String.valueOf(degree) + getResources().getString(R.string.robotic_arm_degree_symbol));
303+
degreeText4.setText(String.valueOf(degree));
304304
editEnter = false;
305305
} else {
306-
degreeText4.setText(String.valueOf((int) (i * 3.6)) + getResources().getString(R.string.robotic_arm_degree_symbol));
306+
degreeText4.setText(String.valueOf((int) (i * 3.6)));
307307
}
308308
degreeText4.setCursorVisible(false);
309309
}
@@ -362,7 +362,7 @@ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
362362
if (actionId == EditorInfo.IME_ACTION_DONE) {
363363
degree = Integer.valueOf(degreeText1.getText().toString());
364364
if (degree > 360 || degree < 0) {
365-
degreeText1.setText(getResources().getString(R.string.zero) + getResources().getString(R.string.robotic_arm_degree_symbol));
365+
degreeText1.setText(getResources().getString(R.string.zero));
366366
seekArc1.setProgress(0);
367367
toastInvalidValueMessage();
368368
} else {
@@ -388,7 +388,7 @@ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
388388
if (actionId == EditorInfo.IME_ACTION_DONE) {
389389
degree = Integer.valueOf(degreeText2.getText().toString());
390390
if (degree > 360 || degree < 0) {
391-
degreeText2.setText(getResources().getString(R.string.zero) + getResources().getString(R.string.robotic_arm_degree_symbol));
391+
degreeText2.setText(getResources().getString(R.string.zero));
392392
seekArc2.setProgress(0);
393393
toastInvalidValueMessage();
394394
} else {
@@ -414,7 +414,7 @@ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
414414
if (actionId == EditorInfo.IME_ACTION_DONE) {
415415
degree = Integer.valueOf(degreeText3.getText().toString());
416416
if (degree > 360 || degree < 0) {
417-
degreeText3.setText(getResources().getString(R.string.zero) + getResources().getString(R.string.robotic_arm_degree_symbol));
417+
degreeText3.setText(getResources().getString(R.string.zero));
418418
seekArc3.setProgress(0);
419419
toastInvalidValueMessage();
420420
} else {
@@ -440,7 +440,7 @@ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
440440
if (actionId == EditorInfo.IME_ACTION_DONE) {
441441
degree = Integer.valueOf(degreeText4.getText().toString());
442442
if (degree > 360 || degree < 0) {
443-
degreeText4.setText(getResources().getString(R.string.zero) + getResources().getString(R.string.robotic_arm_degree_symbol));
443+
degreeText4.setText(getResources().getString(R.string.zero));
444444
seekArc4.setProgress(0);
445445
toastInvalidValueMessage();
446446
} else {

app/src/main/res/layout/servo_controller_layout.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,15 @@
4949
android:maxLines="1"
5050
android:imeOptions="flagNoExtractUi"
5151
/>
52+
53+
<TextView
54+
android:layout_width="wrap_content"
55+
android:layout_height="wrap_content"
56+
android:text="@string/robotic_arm_degree_symbol"
57+
android:textStyle="bold"
58+
android:textAppearance="@style/TextAppearance.AppCompat.Large"
59+
android:layout_toEndOf="@+id/degreeText"
60+
android:layout_centerInParent="true"
61+
/>
5262
</RelativeLayout>
5363
</RelativeLayout>

0 commit comments

Comments
 (0)