mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-02 10:24:11 +01:00
Start of a widget for monitoring telemetry status
This commit is contained in:
parent
529b450f1d
commit
515a4c4fd1
@ -1,23 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.openpilot.androidgcs"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
<uses-sdk android:minSdkVersion="7" />
|
||||
package="org.openpilot.androidgcs" android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
<uses-sdk android:minSdkVersion="7" />
|
||||
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
||||
|
||||
<application android:icon="@drawable/icon" android:label="@string/app_name" >
|
||||
|
||||
<activity android:name="ObjectBrowser"
|
||||
android:label="@string/app_name">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<application android:icon="@drawable/icon" android:label="@string/app_name">
|
||||
|
||||
<!-- Object browser - main activity at the moment -->
|
||||
<activity android:name="ObjectBrowser" android:label="@string/app_name">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="org.openpilot.intent.action.CONNECTED" />
|
||||
<action android:name="org.openpilot.intent.action.DISCONNECTED" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<receiver android:name="TelemetryWidget">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="org.openpilot.intent.action.CONNECTED" />
|
||||
<action android:name="org.openpilot.intent.action.DISCONNECTED" />
|
||||
</intent-filter>
|
||||
<meta-data android:name="android.appwidget.provider"
|
||||
android:resource="@xml/telemetry_widget_info" />
|
||||
</receiver>
|
||||
|
||||
<service android:name=".OPTelemetryService"></service>
|
||||
</application>
|
||||
</application>
|
||||
</manifest>
|
7
androidgcs/res/layout/telemetry_widget.xml
Normal file
7
androidgcs/res/layout/telemetry_widget.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<TextView android:text="TextView" android:layout_width="wrap_content" android:id="@+id/telemetryWidgetStatus" android:layout_height="wrap_content"></TextView>
|
||||
</LinearLayout>
|
31
androidgcs/src/org/openpilot/androidgcs/TelemetryWidget.java
Normal file
31
androidgcs/src/org/openpilot/androidgcs/TelemetryWidget.java
Normal file
@ -0,0 +1,31 @@
|
||||
package org.openpilot.androidgcs;
|
||||
|
||||
import android.appwidget.AppWidgetManager;
|
||||
import android.appwidget.AppWidgetProvider;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.widget.RemoteViews;
|
||||
|
||||
public class TelemetryWidget extends AppWidgetProvider {
|
||||
|
||||
private static boolean connected = false;
|
||||
|
||||
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
|
||||
final int N = appWidgetIds.length;
|
||||
|
||||
// Perform this loop procedure for each App Widget that belongs to this provider
|
||||
for (int i=0; i<N; i++) {
|
||||
int appWidgetId = appWidgetIds[i];
|
||||
|
||||
// Get the layout for the App Widget and attach an on-click listener to the button
|
||||
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.telemetry_widget);
|
||||
//views.setOnClickPendingIntent(R.id.button, pendingIntent);
|
||||
|
||||
// Tell the AppWidgetManager to perform an update on the current App Widget
|
||||
appWidgetManager.updateAppWidget(appWidgetId, views);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user