1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

AndroidGCS: Add load button to the object browser.

This commit is contained in:
James Cotton 2012-08-05 18:17:26 -05:00
parent fd9dc66efb
commit bd280f6fec
2 changed files with 39 additions and 8 deletions

View File

@ -78,14 +78,26 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/editButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_marginBottom="32dp"
android:layout_marginRight="12dp"
android:text="Edit" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="@+id/object_load_button"
android:layout_width="wrap_content"
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>

View File

@ -26,6 +26,7 @@ import android.widget.TextView;
import android.widget.AdapterView.OnItemClickListener;
import org.openpilot.uavtalk.UAVDataObject;
import org.openpilot.uavtalk.UAVObject;
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();
}