Loading app/src/main/java/net/sourceforge/opencamera/ImageSaver.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -3207,7 +3207,7 @@ public class ImageSaver extends Thread { Log.d(TAG, " exif orientation string: " + exif_orientation_s); Log.d(TAG, " exif orientation string: " + exif_orientation_s); boolean needs_tf = false; boolean needs_tf = false; int exif_orientation = 0; int exif_orientation = 0; // from http://jpegclub.org/exif_orientation.html // see http://jpegclub.org/exif_orientation.html // and http://stackoverflow.com/questions/20478765/how-to-get-the-correct-orientation-of-the-image-selected-from-the-default-image // and http://stackoverflow.com/questions/20478765/how-to-get-the-correct-orientation-of-the-image-selected-from-the-default-image switch (exif_orientation_s) { switch (exif_orientation_s) { case ExifInterface.ORIENTATION_UNDEFINED: case ExifInterface.ORIENTATION_UNDEFINED: Loading app/src/main/java/net/sourceforge/opencamera/MainActivity.java +10 −12 Original line number Original line Diff line number Diff line Loading @@ -583,12 +583,13 @@ public class MainActivity extends Activity { //Log.d(TAG, "is_pixel_xl_phone? " + is_pixel_xl_phone); //Log.d(TAG, "is_pixel_xl_phone? " + is_pixel_xl_phone); } } if( is_samsung || is_oneplus ) { if( is_samsung || is_oneplus ) { // workaround needed for Samsung S7 at least (tested on Samsung RTL) // workaround needed for Samsung Galaxy S7 at least (tested on Samsung RTL) // workaround needed for OnePlus 3 at least (see http://forum.xda-developers.com/oneplus-3/help/camera2-support-t3453103 ) // workaround needed for OnePlus 3 at least (see http://forum.xda-developers.com/oneplus-3/help/camera2-support-t3453103 ) // update for v1.37: significant improvements have been made for standard flash and Camera2 API. But OnePlus 3T still has problem // update for v1.37: significant improvements have been made for standard flash and Camera2 API. But OnePlus 3T still has problem // that photos come out with a blue tinge if flash is on, and the scene is bright enough not to need it; Samsung devices also seem // that photos come out with a blue tinge if flash is on, and the scene is bright enough not to need it; Samsung devices also seem // to work okay, testing on S7 on RTL, but still keeping the fake flash mode in place for these devices, until we're sure of good // to work okay, testing on S7 on RTL, but still keeping the fake flash mode in place for these devices, until we're sure of good // behaviour // behaviour // update for testing on Galaxy S10e: still needs fake flash if( MyDebug.LOG ) if( MyDebug.LOG ) Log.d(TAG, "set fake flash for camera2"); Log.d(TAG, "set fake flash for camera2"); SharedPreferences.Editor editor = sharedPreferences.edit(); SharedPreferences.Editor editor = sharedPreferences.edit(); Loading Loading @@ -2313,12 +2314,12 @@ public class MainActivity extends Activity { if( sharedPreferences.getBoolean(PreferenceKeys.getKeepDisplayOnPreferenceKey(), true) ) { if( sharedPreferences.getBoolean(PreferenceKeys.getKeepDisplayOnPreferenceKey(), true) ) { if( MyDebug.LOG ) if( MyDebug.LOG ) Log.d(TAG, "do keep screen on"); Log.d(TAG, "do keep screen on"); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } } else { else { if( MyDebug.LOG ) if( MyDebug.LOG ) Log.d(TAG, "don't keep screen on"); Log.d(TAG, "don't keep screen on"); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); this.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } } if( sharedPreferences.getBoolean(PreferenceKeys.getShowWhenLockedPreferenceKey(), true) ) { if( sharedPreferences.getBoolean(PreferenceKeys.getShowWhenLockedPreferenceKey(), true) ) { if( MyDebug.LOG ) if( MyDebug.LOG ) Loading Loading @@ -2772,7 +2773,7 @@ public class MainActivity extends Activity { if( MyDebug.LOG ) if( MyDebug.LOG ) Log.d(TAG, "try ACTION_VIEW"); Log.d(TAG, "try ACTION_VIEW"); Intent intent = new Intent(Intent.ACTION_VIEW, uri); Intent intent = new Intent(Intent.ACTION_VIEW, uri); // from http://stackoverflow.com/questions/11073832/no-activity-found-to-handle-intent - needed to fix crash if no gallery app installed // see http://stackoverflow.com/questions/11073832/no-activity-found-to-handle-intent - needed to fix crash if no gallery app installed //Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("blah")); // test //Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("blah")); // test if( intent.resolveActivity(getPackageManager()) != null ) { if( intent.resolveActivity(getPackageManager()) != null ) { try { try { Loading Loading @@ -2875,14 +2876,11 @@ public class MainActivity extends Activity { Uri treeUri = resultData.getData(); Uri treeUri = resultData.getData(); if( MyDebug.LOG ) if( MyDebug.LOG ) Log.d(TAG, "returned treeUri: " + treeUri); Log.d(TAG, "returned treeUri: " + treeUri); // from https://developer.android.com/guide/topics/providers/document-provider.html#permissions : // see https://developer.android.com/guide/topics/providers/document-provider.html#permissions : final int takeFlags = resultData.getFlags() final int takeFlags = resultData.getFlags() & (Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); & (Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); try { try { /*if( true ) /*if( true ) throw new SecurityException(); // test*/ throw new SecurityException(); // test*/ // Check for the freshest data. getContentResolver().takePersistableUriPermission(treeUri, takeFlags); getContentResolver().takePersistableUriPermission(treeUri, takeFlags); SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); Loading Loading @@ -4309,9 +4307,9 @@ public class MainActivity extends Activity { Log.d(TAG, "restartOpenCamera"); Log.d(TAG, "restartOpenCamera"); this.waitUntilImageQueueEmpty(); this.waitUntilImageQueueEmpty(); // see http://stackoverflow.com/questions/2470870/force-application-to-restart-on-first-activity // see http://stackoverflow.com/questions/2470870/force-application-to-restart-on-first-activity Intent i = this.getBaseContext().getPackageManager().getLaunchIntentForPackage( this.getBaseContext().getPackageName() ); Intent intent = this.getBaseContext().getPackageManager().getLaunchIntentForPackage( this.getBaseContext().getPackageName() ); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(i); this.startActivity(intent); } } public void takePhotoButtonLongClickCancelled() { public void takePhotoButtonLongClickCancelled() { Loading app/src/main/java/net/sourceforge/opencamera/MyWidgetProvider.java +7 −11 Original line number Original line Diff line number Diff line Loading @@ -20,14 +20,13 @@ import android.widget.RemoteViews; public class MyWidgetProvider extends AppWidgetProvider { public class MyWidgetProvider extends AppWidgetProvider { private static final String TAG = "MyWidgetProvider"; private static final String TAG = "MyWidgetProvider"; // from http://developer.android.com/guide/topics/appwidgets/index.html // see http://developer.android.com/guide/topics/appwidgets/index.html public void onUpdate(Context context, AppWidgetManager appWidgetManager, int [] appWidgetIds) { public void onUpdate(Context context, AppWidgetManager appWidgetManager, int [] appWidgetIds) { if( MyDebug.LOG ) if( MyDebug.LOG ) Log.d(TAG, "onUpdate"); Log.d(TAG, "onUpdate"); if( MyDebug.LOG ) if( MyDebug.LOG ) Log.d(TAG, "length = " + appWidgetIds.length); Log.d(TAG, "length = " + appWidgetIds.length); // Perform this loop procedure for each App Widget that belongs to this provider for(int appWidgetId : appWidgetIds) { for(int appWidgetId : appWidgetIds) { if( MyDebug.LOG ) if( MyDebug.LOG ) Log.d(TAG, "appWidgetId: " + appWidgetId); Log.d(TAG, "appWidgetId: " + appWidgetId); Loading @@ -49,19 +48,16 @@ public class MyWidgetProvider extends AppWidgetProvider { pendingIntent = PendingIntent.getActivity(context, 0, intent, 0); pendingIntent = PendingIntent.getActivity(context, 0, intent, 0); } } // Get the layout for the App Widget and attach an on-click listener RemoteViews remote_views = new RemoteViews(context.getPackageName(), R.layout.widget_layout); // to the button remote_views.setOnClickPendingIntent(R.id.widget_launch_open_camera, pendingIntent); RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_layout); views.setOnClickPendingIntent(R.id.widget_launch_open_camera, pendingIntent); /*if( sharedPreferences.getBoolean(MainActivity.getShowWhenLockedPreferenceKey(), true) ) { /*if( sharedPreferences.getBoolean(MainActivity.getShowWhenLockedPreferenceKey(), true) ) { views.setTextViewText(R.id.launch_open_camera, "Open Camera (unlocked)"); remote_views.setTextViewText(R.id.launch_open_camera, "Open Camera (unlocked)"); } } else { else { views.setTextViewText(R.id.launch_open_camera, "Open Camera (locked)"); remote_views.setTextViewText(R.id.launch_open_camera, "Open Camera (locked)"); }*/ }*/ // Tell the AppWidgetManager to perform an update on the current app widget appWidgetManager.updateAppWidget(appWidgetId, remote_views); appWidgetManager.updateAppWidget(appWidgetId, views); } } } } Loading app/src/main/java/net/sourceforge/opencamera/MyWidgetProviderTakePhoto.java +5 −9 Original line number Original line Diff line number Diff line Loading @@ -14,14 +14,13 @@ import android.widget.RemoteViews; public class MyWidgetProviderTakePhoto extends AppWidgetProvider { public class MyWidgetProviderTakePhoto extends AppWidgetProvider { private static final String TAG = "MyWidgetProviderTakePho"; private static final String TAG = "MyWidgetProviderTakePho"; // from http://developer.android.com/guide/topics/appwidgets/index.html // see http://developer.android.com/guide/topics/appwidgets/index.html public void onUpdate(Context context, AppWidgetManager appWidgetManager, int [] appWidgetIds) { public void onUpdate(Context context, AppWidgetManager appWidgetManager, int [] appWidgetIds) { if( MyDebug.LOG ) if( MyDebug.LOG ) Log.d(TAG, "onUpdate"); Log.d(TAG, "onUpdate"); if( MyDebug.LOG ) if( MyDebug.LOG ) Log.d(TAG, "length = " + appWidgetIds.length); Log.d(TAG, "length = " + appWidgetIds.length); // Perform this loop procedure for each App Widget that belongs to this provider for(int appWidgetId : appWidgetIds) { for(int appWidgetId : appWidgetIds) { if( MyDebug.LOG ) if( MyDebug.LOG ) Log.d(TAG, "appWidgetId: " + appWidgetId); Log.d(TAG, "appWidgetId: " + appWidgetId); Loading @@ -29,13 +28,10 @@ public class MyWidgetProviderTakePhoto extends AppWidgetProvider { Intent intent = new Intent(context, TakePhoto.class); Intent intent = new Intent(context, TakePhoto.class); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0); // Get the layout for the App Widget and attach an on-click listener RemoteViews remote_views = new RemoteViews(context.getPackageName(), R.layout.widget_layout_take_photo); // to the button remote_views.setOnClickPendingIntent(R.id.widget_take_photo, pendingIntent); RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_layout_take_photo); views.setOnClickPendingIntent(R.id.widget_take_photo, pendingIntent); // Tell the AppWidgetManager to perform an update on the current app widget appWidgetManager.updateAppWidget(appWidgetId, remote_views); appWidgetManager.updateAppWidget(appWidgetId, views); } } } } Loading app/src/main/java/net/sourceforge/opencamera/StorageUtils.java +2 −3 Original line number Original line Diff line number Diff line Loading @@ -427,8 +427,7 @@ public class StorageUtils { } } else { else { try { try { final Uri contentUri = ContentUris.withAppendedId( final Uri contentUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.parseLong(id)); Uri.parse("content://downloads/public_downloads"), Long.parseLong(id)); String filename = getDataColumn(contentUri, null, null); String filename = getDataColumn(contentUri, null, null); if( filename != null ) if( filename != null ) Loading Loading
app/src/main/java/net/sourceforge/opencamera/ImageSaver.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -3207,7 +3207,7 @@ public class ImageSaver extends Thread { Log.d(TAG, " exif orientation string: " + exif_orientation_s); Log.d(TAG, " exif orientation string: " + exif_orientation_s); boolean needs_tf = false; boolean needs_tf = false; int exif_orientation = 0; int exif_orientation = 0; // from http://jpegclub.org/exif_orientation.html // see http://jpegclub.org/exif_orientation.html // and http://stackoverflow.com/questions/20478765/how-to-get-the-correct-orientation-of-the-image-selected-from-the-default-image // and http://stackoverflow.com/questions/20478765/how-to-get-the-correct-orientation-of-the-image-selected-from-the-default-image switch (exif_orientation_s) { switch (exif_orientation_s) { case ExifInterface.ORIENTATION_UNDEFINED: case ExifInterface.ORIENTATION_UNDEFINED: Loading
app/src/main/java/net/sourceforge/opencamera/MainActivity.java +10 −12 Original line number Original line Diff line number Diff line Loading @@ -583,12 +583,13 @@ public class MainActivity extends Activity { //Log.d(TAG, "is_pixel_xl_phone? " + is_pixel_xl_phone); //Log.d(TAG, "is_pixel_xl_phone? " + is_pixel_xl_phone); } } if( is_samsung || is_oneplus ) { if( is_samsung || is_oneplus ) { // workaround needed for Samsung S7 at least (tested on Samsung RTL) // workaround needed for Samsung Galaxy S7 at least (tested on Samsung RTL) // workaround needed for OnePlus 3 at least (see http://forum.xda-developers.com/oneplus-3/help/camera2-support-t3453103 ) // workaround needed for OnePlus 3 at least (see http://forum.xda-developers.com/oneplus-3/help/camera2-support-t3453103 ) // update for v1.37: significant improvements have been made for standard flash and Camera2 API. But OnePlus 3T still has problem // update for v1.37: significant improvements have been made for standard flash and Camera2 API. But OnePlus 3T still has problem // that photos come out with a blue tinge if flash is on, and the scene is bright enough not to need it; Samsung devices also seem // that photos come out with a blue tinge if flash is on, and the scene is bright enough not to need it; Samsung devices also seem // to work okay, testing on S7 on RTL, but still keeping the fake flash mode in place for these devices, until we're sure of good // to work okay, testing on S7 on RTL, but still keeping the fake flash mode in place for these devices, until we're sure of good // behaviour // behaviour // update for testing on Galaxy S10e: still needs fake flash if( MyDebug.LOG ) if( MyDebug.LOG ) Log.d(TAG, "set fake flash for camera2"); Log.d(TAG, "set fake flash for camera2"); SharedPreferences.Editor editor = sharedPreferences.edit(); SharedPreferences.Editor editor = sharedPreferences.edit(); Loading Loading @@ -2313,12 +2314,12 @@ public class MainActivity extends Activity { if( sharedPreferences.getBoolean(PreferenceKeys.getKeepDisplayOnPreferenceKey(), true) ) { if( sharedPreferences.getBoolean(PreferenceKeys.getKeepDisplayOnPreferenceKey(), true) ) { if( MyDebug.LOG ) if( MyDebug.LOG ) Log.d(TAG, "do keep screen on"); Log.d(TAG, "do keep screen on"); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } } else { else { if( MyDebug.LOG ) if( MyDebug.LOG ) Log.d(TAG, "don't keep screen on"); Log.d(TAG, "don't keep screen on"); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); this.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } } if( sharedPreferences.getBoolean(PreferenceKeys.getShowWhenLockedPreferenceKey(), true) ) { if( sharedPreferences.getBoolean(PreferenceKeys.getShowWhenLockedPreferenceKey(), true) ) { if( MyDebug.LOG ) if( MyDebug.LOG ) Loading Loading @@ -2772,7 +2773,7 @@ public class MainActivity extends Activity { if( MyDebug.LOG ) if( MyDebug.LOG ) Log.d(TAG, "try ACTION_VIEW"); Log.d(TAG, "try ACTION_VIEW"); Intent intent = new Intent(Intent.ACTION_VIEW, uri); Intent intent = new Intent(Intent.ACTION_VIEW, uri); // from http://stackoverflow.com/questions/11073832/no-activity-found-to-handle-intent - needed to fix crash if no gallery app installed // see http://stackoverflow.com/questions/11073832/no-activity-found-to-handle-intent - needed to fix crash if no gallery app installed //Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("blah")); // test //Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("blah")); // test if( intent.resolveActivity(getPackageManager()) != null ) { if( intent.resolveActivity(getPackageManager()) != null ) { try { try { Loading Loading @@ -2875,14 +2876,11 @@ public class MainActivity extends Activity { Uri treeUri = resultData.getData(); Uri treeUri = resultData.getData(); if( MyDebug.LOG ) if( MyDebug.LOG ) Log.d(TAG, "returned treeUri: " + treeUri); Log.d(TAG, "returned treeUri: " + treeUri); // from https://developer.android.com/guide/topics/providers/document-provider.html#permissions : // see https://developer.android.com/guide/topics/providers/document-provider.html#permissions : final int takeFlags = resultData.getFlags() final int takeFlags = resultData.getFlags() & (Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); & (Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); try { try { /*if( true ) /*if( true ) throw new SecurityException(); // test*/ throw new SecurityException(); // test*/ // Check for the freshest data. getContentResolver().takePersistableUriPermission(treeUri, takeFlags); getContentResolver().takePersistableUriPermission(treeUri, takeFlags); SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); Loading Loading @@ -4309,9 +4307,9 @@ public class MainActivity extends Activity { Log.d(TAG, "restartOpenCamera"); Log.d(TAG, "restartOpenCamera"); this.waitUntilImageQueueEmpty(); this.waitUntilImageQueueEmpty(); // see http://stackoverflow.com/questions/2470870/force-application-to-restart-on-first-activity // see http://stackoverflow.com/questions/2470870/force-application-to-restart-on-first-activity Intent i = this.getBaseContext().getPackageManager().getLaunchIntentForPackage( this.getBaseContext().getPackageName() ); Intent intent = this.getBaseContext().getPackageManager().getLaunchIntentForPackage( this.getBaseContext().getPackageName() ); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(i); this.startActivity(intent); } } public void takePhotoButtonLongClickCancelled() { public void takePhotoButtonLongClickCancelled() { Loading
app/src/main/java/net/sourceforge/opencamera/MyWidgetProvider.java +7 −11 Original line number Original line Diff line number Diff line Loading @@ -20,14 +20,13 @@ import android.widget.RemoteViews; public class MyWidgetProvider extends AppWidgetProvider { public class MyWidgetProvider extends AppWidgetProvider { private static final String TAG = "MyWidgetProvider"; private static final String TAG = "MyWidgetProvider"; // from http://developer.android.com/guide/topics/appwidgets/index.html // see http://developer.android.com/guide/topics/appwidgets/index.html public void onUpdate(Context context, AppWidgetManager appWidgetManager, int [] appWidgetIds) { public void onUpdate(Context context, AppWidgetManager appWidgetManager, int [] appWidgetIds) { if( MyDebug.LOG ) if( MyDebug.LOG ) Log.d(TAG, "onUpdate"); Log.d(TAG, "onUpdate"); if( MyDebug.LOG ) if( MyDebug.LOG ) Log.d(TAG, "length = " + appWidgetIds.length); Log.d(TAG, "length = " + appWidgetIds.length); // Perform this loop procedure for each App Widget that belongs to this provider for(int appWidgetId : appWidgetIds) { for(int appWidgetId : appWidgetIds) { if( MyDebug.LOG ) if( MyDebug.LOG ) Log.d(TAG, "appWidgetId: " + appWidgetId); Log.d(TAG, "appWidgetId: " + appWidgetId); Loading @@ -49,19 +48,16 @@ public class MyWidgetProvider extends AppWidgetProvider { pendingIntent = PendingIntent.getActivity(context, 0, intent, 0); pendingIntent = PendingIntent.getActivity(context, 0, intent, 0); } } // Get the layout for the App Widget and attach an on-click listener RemoteViews remote_views = new RemoteViews(context.getPackageName(), R.layout.widget_layout); // to the button remote_views.setOnClickPendingIntent(R.id.widget_launch_open_camera, pendingIntent); RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_layout); views.setOnClickPendingIntent(R.id.widget_launch_open_camera, pendingIntent); /*if( sharedPreferences.getBoolean(MainActivity.getShowWhenLockedPreferenceKey(), true) ) { /*if( sharedPreferences.getBoolean(MainActivity.getShowWhenLockedPreferenceKey(), true) ) { views.setTextViewText(R.id.launch_open_camera, "Open Camera (unlocked)"); remote_views.setTextViewText(R.id.launch_open_camera, "Open Camera (unlocked)"); } } else { else { views.setTextViewText(R.id.launch_open_camera, "Open Camera (locked)"); remote_views.setTextViewText(R.id.launch_open_camera, "Open Camera (locked)"); }*/ }*/ // Tell the AppWidgetManager to perform an update on the current app widget appWidgetManager.updateAppWidget(appWidgetId, remote_views); appWidgetManager.updateAppWidget(appWidgetId, views); } } } } Loading
app/src/main/java/net/sourceforge/opencamera/MyWidgetProviderTakePhoto.java +5 −9 Original line number Original line Diff line number Diff line Loading @@ -14,14 +14,13 @@ import android.widget.RemoteViews; public class MyWidgetProviderTakePhoto extends AppWidgetProvider { public class MyWidgetProviderTakePhoto extends AppWidgetProvider { private static final String TAG = "MyWidgetProviderTakePho"; private static final String TAG = "MyWidgetProviderTakePho"; // from http://developer.android.com/guide/topics/appwidgets/index.html // see http://developer.android.com/guide/topics/appwidgets/index.html public void onUpdate(Context context, AppWidgetManager appWidgetManager, int [] appWidgetIds) { public void onUpdate(Context context, AppWidgetManager appWidgetManager, int [] appWidgetIds) { if( MyDebug.LOG ) if( MyDebug.LOG ) Log.d(TAG, "onUpdate"); Log.d(TAG, "onUpdate"); if( MyDebug.LOG ) if( MyDebug.LOG ) Log.d(TAG, "length = " + appWidgetIds.length); Log.d(TAG, "length = " + appWidgetIds.length); // Perform this loop procedure for each App Widget that belongs to this provider for(int appWidgetId : appWidgetIds) { for(int appWidgetId : appWidgetIds) { if( MyDebug.LOG ) if( MyDebug.LOG ) Log.d(TAG, "appWidgetId: " + appWidgetId); Log.d(TAG, "appWidgetId: " + appWidgetId); Loading @@ -29,13 +28,10 @@ public class MyWidgetProviderTakePhoto extends AppWidgetProvider { Intent intent = new Intent(context, TakePhoto.class); Intent intent = new Intent(context, TakePhoto.class); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0); // Get the layout for the App Widget and attach an on-click listener RemoteViews remote_views = new RemoteViews(context.getPackageName(), R.layout.widget_layout_take_photo); // to the button remote_views.setOnClickPendingIntent(R.id.widget_take_photo, pendingIntent); RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_layout_take_photo); views.setOnClickPendingIntent(R.id.widget_take_photo, pendingIntent); // Tell the AppWidgetManager to perform an update on the current app widget appWidgetManager.updateAppWidget(appWidgetId, remote_views); appWidgetManager.updateAppWidget(appWidgetId, views); } } } } Loading
app/src/main/java/net/sourceforge/opencamera/StorageUtils.java +2 −3 Original line number Original line Diff line number Diff line Loading @@ -427,8 +427,7 @@ public class StorageUtils { } } else { else { try { try { final Uri contentUri = ContentUris.withAppendedId( final Uri contentUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.parseLong(id)); Uri.parse("content://downloads/public_downloads"), Long.parseLong(id)); String filename = getDataColumn(contentUri, null, null); String filename = getDataColumn(contentUri, null, null); if( filename != null ) if( filename != null ) Loading