API version nonsense

This commit is contained in:
Jaculabilis 2016-10-16 01:09:03 -05:00
parent 7d85c34570
commit db0aa13624
3 changed files with 4 additions and 11 deletions

View File

@ -5,7 +5,7 @@ android {
buildToolsVersion "24.0.3" buildToolsVersion "24.0.3"
defaultConfig { defaultConfig {
applicationId "horse.jaeil.microframe" applicationId "horse.jaeil.microframe"
minSdkVersion 23 minSdkVersion 21
targetSdkVersion 23 targetSdkVersion 23
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"

View File

@ -23,6 +23,7 @@
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" /> <action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter> </intent-filter>
</activity> </activity>
</application> </application>
</manifest> </manifest>

View File

@ -5,8 +5,6 @@ import android.appwidget.AppWidgetManager;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
@ -17,7 +15,6 @@ import android.widget.TextView;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.InputStream; import java.io.InputStream;
import java.net.URI;
/** /**
* The configuration screen for the {@link FrameWidget FrameWidget} AppWidget. * The configuration screen for the {@link FrameWidget FrameWidget} AppWidget.
@ -50,7 +47,6 @@ public class FrameWidgetConfigureActivity extends Activity {
// Get the URI of the preview image // Get the URI of the preview image
TextView textView = (TextView) findViewById(R.id.previewUri); TextView textView = (TextView) findViewById(R.id.previewUri);
String uriString = textView.getText().toString(); String uriString = textView.getText().toString();
Log.i(TAG, "Finish clicked with URI = \"" + uriString + "\"");
// Send an update to the widget so it can load the image // Send an update to the widget so it can load the image
saveImgRef(context, mAppWidgetId, uriString); saveImgRef(context, mAppWidgetId, uriString);
@ -73,18 +69,14 @@ public class FrameWidgetConfigureActivity extends Activity {
protected void onActivityResult(int requestCode, int resultCode, Intent data) { protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_IMAGE_GET && resultCode == RESULT_OK) { if (requestCode == REQUEST_IMAGE_GET && resultCode == RESULT_OK) {
// Parse the URI into a drawable // Parse the URI into a drawable
Uri fullPhotoUri = data.getData(); Uri uri = data.getData();
Log.i(TAG, "URI selected: \"" + fullPhotoUri + "\"");
String uriString = fullPhotoUri.toString();
Uri uri = Uri.parse(uriString);
Log.i(TAG, "URI reread : \"" + uri + "\"");
Drawable drawable; Drawable drawable;
TextView previewText = (TextView) findViewById(R.id.previewUri); TextView previewText = (TextView) findViewById(R.id.previewUri);
try { try {
InputStream inputStream = getContentResolver().openInputStream(uri); InputStream inputStream = getContentResolver().openInputStream(uri);
drawable = Drawable.createFromStream(inputStream, uri.toString()); drawable = Drawable.createFromStream(inputStream, uri.toString());
// If the Drawable was successfully loaded, then store the URI for the widget // If the Drawable was successfully loaded, then store the URI for the widget
previewText.setText(uriString); previewText.setText(uri.toString());
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
Log.e(TAG, "Selected image not found!"); Log.e(TAG, "Selected image not found!");
drawable = getResources().getDrawable(R.drawable.frame_default, null); drawable = getResources().getDrawable(R.drawable.frame_default, null);