Custom default images now being used
This commit is contained in:
parent
efe58d3319
commit
4cc82c594a
@ -18,10 +18,7 @@ public class FrameWidget extends AppWidgetProvider {
|
||||
|
||||
static void updateAppWidget(Context context, AppWidgetManager appWidgetManager,
|
||||
int appWidgetId) {
|
||||
|
||||
String uriString = FrameWidgetConfigureActivity.loadImgRef(context, appWidgetId);
|
||||
Log.i(TAG, "Widget updating with uriString = \"" + uriString + "\"");
|
||||
|
||||
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.frame_widget);
|
||||
if (uriString.equals("")) {
|
||||
views.setImageViewResource(R.id.frameImage, R.drawable.frame_default);
|
||||
@ -31,22 +28,11 @@ public class FrameWidget extends AppWidgetProvider {
|
||||
Bitmap bitmap = MediaStore.Images.Media.getBitmap(context.getContentResolver(), uri);
|
||||
views.setImageViewBitmap(R.id.frameImage, bitmap);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.e(TAG, "Could not load bitmap from URI \"" + uriString + "\"");
|
||||
views.setImageViewResource(R.id.frameImage, R.drawable.frame_default);
|
||||
}
|
||||
|
||||
}
|
||||
appWidgetManager.updateAppWidget(appWidgetId, views);
|
||||
|
||||
// Depending on the URI string, set the widget image
|
||||
// if (!uriString.equals("")) {
|
||||
// Uri uri = Uri.parse(uriString);
|
||||
// Log.i(TAG, "Parsed URI: " + uri.toString());
|
||||
// views
|
||||
// .setImageViewUri(R.id.frameImage, uri);
|
||||
// } else {
|
||||
// views
|
||||
// .setImageViewResource(R.id.frameImage, R.drawable.frame_default);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 3.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 16 KiB |
BIN
app/src/main/res/drawable-nodpi/microframe_preview.png
Normal file
BIN
app/src/main/res/drawable-nodpi/microframe_preview.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
@ -2,14 +2,14 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#09C"
|
||||
android:background="#0000"
|
||||
android:padding="@dimen/widget_margin">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/frameImage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#09C"
|
||||
android:background="#0000"
|
||||
tools:ignore="ContentDescription"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
|
@ -30,8 +30,8 @@
|
||||
<TextView
|
||||
android:id="@+id/previewUri"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<!--android:visibility="gone"> /-->
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/finish_button"
|
||||
|
@ -5,7 +5,7 @@
|
||||
android:initialLayout="@layout/frame_widget"
|
||||
android:minHeight="40dp"
|
||||
android:minWidth="40dp"
|
||||
android:previewImage="@drawable/example_appwidget_preview"
|
||||
android:previewImage="@drawable/microframe_preview"
|
||||
android:resizeMode="horizontal|vertical"
|
||||
android:updatePeriodMillis="86400000"
|
||||
android:widgetCategory="home_screen"></appwidget-provider>
|
Loading…
Reference in New Issue
Block a user