Skip to content
Snippets Groups Projects
Commit ff726908 authored by Maxime Graulich's avatar Maxime Graulich
Browse files

Android: fix parameters name

parent fe485672
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Intervals type" /> android:text="@string/postpro_intervalstype" />
<Spinner <Spinner
android:id="@+id/intervals_type" android:id="@+id/intervals_type"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Intervals" /> android:text="@string/postpro_intervals" />
<EditText <EditText
android:id="@+id/intervals" android:id="@+id/intervals"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Raise (Z)" /> android:text="@string/postpro_raizez" />
<SeekBar <SeekBar
android:id="@+id/raisez" android:id="@+id/raisez"
android:layout_width="match_parent" android:layout_width="match_parent"
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:contentDescription="icon" android:contentDescription="preview"
android:layout_weight="25." android:layout_weight="25."
android:src="@drawable/ic_launcher" android:src="@drawable/ic_launcher"
android:paddingRight="10dp" android:paddingRight="10dp"
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item type="layout" name="main_activity_layout">@layout/activity_fragment</item>
</resources>
\ No newline at end of file
...@@ -89,7 +89,7 @@ public class OptionsModelFragment extends Fragment{ ...@@ -89,7 +89,7 @@ public class OptionsModelFragment extends Fragment{
}); });
params.add(mParam); params.add(mParam);
if(_listView != null) if(_listView != null)
_listView.addItem(mParam.getName().split("/")[0], mParam.getView()); _listView.addItem(mParam.getName().split("/")[0].equals("Parameters")? mParam.getName().split("/")[0] + " > " + mParam.getName().split("/")[1]: mParam.getName().split("/")[0], mParam.getView());
} }
} }
} }
......
...@@ -34,17 +34,26 @@ public class Parameter { ...@@ -34,17 +34,26 @@ public class Parameter {
protected void update(){ protected void update(){
if(_label != null && !_label.equals("")) if(_label != null && !_label.equals(""))
_title.setText(_label); _title.setText(_label);
else { else
String tmp[] = _name.split("/"); _title.setText(getShortName());
_title.setText(tmp[tmp.length-1]);
}
if(isReadOnly()) _title.setAlpha(0.423f); if(isReadOnly()) _title.setAlpha(0.423f);
} }
public void setName(String name) {_name = name;this.update();} public void setName(String name) {_name = name;this.update();}
public void setReadOnly(boolean readOnly) {_readOnly = readOnly;this.update();} public void setReadOnly(boolean readOnly) {_readOnly = readOnly;this.update();}
public void setLabel(String label) {_label = label;this.update();} public void setLabel(String label) {
public String getName() {return _name;} _label = label;
this.update();
}
public String getName() { return _name;}
public String getShortName() {
if(_label != null && _label.length() > 0) return _label;
String[] splited = _name.split("/");
String name = splited[splited.length-1];
while(name.length() > 0 && name.charAt(0) >= '0' && name.charAt(0) <= '9')
name = name.substring(1);
return name;
}
public boolean isReadOnly() {return _readOnly;} public boolean isReadOnly() {return _readOnly;}
public String getLabel() {return _label;} public String getLabel() {return _label;}
public int fromString(String s){ public int fromString(String s){
......
...@@ -48,13 +48,8 @@ public class ParameterNumber extends Parameter{ ...@@ -48,13 +48,8 @@ public class ParameterNumber extends Parameter{
protected void update(){ protected void update(){
super.update(); super.update();
int nDecimal = String.valueOf(this.getStep()).length() - String.valueOf(this.getStep()).lastIndexOf('.') - 1; // hack for double round int nDecimal = String.valueOf(this.getStep()).length() - String.valueOf(this.getStep()).lastIndexOf('.') - 1; // hack for double round
if(_bar != null){ if(_bar != null) {
if(_label != null && !_label.equals("")) _title.setText(getShortName() + " (" + Math.round(_value*Math.pow(10, nDecimal))/Math.pow(10, nDecimal) + ")");
_title.setText(_label + " (" + Math.round(_value*Math.pow(10, nDecimal))/Math.pow(10, nDecimal) + ")");
else {
String tmp[] = _name.split("/");
_title.setText(tmp[tmp.length-1] + " (" + Math.round(_value*Math.pow(10, nDecimal))/Math.pow(10, nDecimal) + ")");
}
_bar.setProgress((int) ((_value-_min)/_step)); _bar.setProgress((int) ((_value-_min)/_step));
_bar.setMax((int) ((_max-_min)/_step)); _bar.setMax((int) ((_max-_min)/_step));
_bar.setEnabled(!this.isReadOnly()); _bar.setEnabled(!this.isReadOnly());
...@@ -67,8 +62,7 @@ public class ParameterNumber extends Parameter{ ...@@ -67,8 +62,7 @@ public class ParameterNumber extends Parameter{
} }
else if(_checkbox != null) else if(_checkbox != null)
{ {
if(_label != null) _checkbox.setText(_label); _checkbox.setText(getShortName());
else _checkbox.setText(_name);
_checkbox.setChecked((_value == 0)? false : true); _checkbox.setChecked((_value == 0)? false : true);
} }
else if(_edittext != null) else if(_edittext != null)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment