mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-21 11:54:15 +01:00
AndroidGCS: Add load button to the object browser.
This commit is contained in:
parent
fd9dc66efb
commit
bd280f6fec
@ -78,14 +78,26 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
<Button
|
<LinearLayout
|
||||||
android:id="@+id/editButton"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="wrap_content"
|
android:layout_height="wrap_content" >
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="bottom|right"
|
<Button
|
||||||
android:layout_marginBottom="32dp"
|
android:id="@+id/object_load_button"
|
||||||
android:layout_marginRight="12dp"
|
android:layout_width="wrap_content"
|
||||||
android:text="Edit" />
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Load" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/editButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="right"
|
||||||
|
android:layout_marginBottom="32dp"
|
||||||
|
android:layout_marginRight="12dp"
|
||||||
|
android:text="Edit" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -26,6 +26,7 @@ import android.widget.TextView;
|
|||||||
import android.widget.AdapterView.OnItemClickListener;
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
|
|
||||||
import org.openpilot.uavtalk.UAVDataObject;
|
import org.openpilot.uavtalk.UAVDataObject;
|
||||||
|
import org.openpilot.uavtalk.UAVObject;
|
||||||
|
|
||||||
public class ObjectBrowser extends ObjectManagerActivity implements OnSharedPreferenceChangeListener {
|
public class ObjectBrowser extends ObjectManagerActivity implements OnSharedPreferenceChangeListener {
|
||||||
|
|
||||||
@ -85,6 +86,24 @@ public class ObjectBrowser extends ObjectManagerActivity implements OnSharedPref
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
((Button) findViewById(R.id.object_load_button)).setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
UAVObject objPer = objMngr.getObject("ObjectPersistence");
|
||||||
|
|
||||||
|
if (selected_index > 0 && objPer != null) {
|
||||||
|
objPer.getField("Operation").setValue("Load");
|
||||||
|
objPer.getField("Selection").setValue("SingleObject");
|
||||||
|
Log.d(TAG,"Loading with object id: " + allObjects.get(selected_index).getObjID());
|
||||||
|
objPer.getField("ObjectID").setValue(allObjects.get(selected_index).getObjID());
|
||||||
|
objPer.getField("InstanceID").setValue(0);
|
||||||
|
objPer.updated();
|
||||||
|
|
||||||
|
allObjects.get(selected_index).updateRequested();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
updateList();
|
updateList();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user