Skip to content
This repository has been archived by the owner on Jan 18, 2022. It is now read-only.

Commit

Permalink
v0.1.3; bug fix for notification touch event
Browse files Browse the repository at this point in the history
Signed-off-by: Jerry Chen <jerryc05@qq.com>
  • Loading branch information
Jerry Chen committed Jul 16, 2019
1 parent fb7f91e commit cdf520e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ android {
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "0.1.2"
versionName "0.1.3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
resConfigs "xxhdpi"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import javax.net.ssl.HttpsURLConnection;

import jerryc05.unlockme.BuildConfig;
import jerryc05.unlockme.activities.MainActivity;

/**
* A builder for URLConnection class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import jerryc05.unlockme.services.ForegroundService;

import static android.content.Context.NOTIFICATION_SERVICE;
import static jerryc05.unlockme.services.ForegroundService.ACTION_UPDATE_NOTIFICATION;

/**
* A collection class for commonly used User Interface methods.
Expand Down Expand Up @@ -103,7 +104,7 @@ public static void notifyPictureToUI(final String contentText,
final String title = "Picture Taken";

final Intent intent = new Intent(context, ForegroundService.class);
intent.setAction(ForegroundService.ACTION_UPDATE_NOTIFICATION);
intent.setAction(ACTION_UPDATE_NOTIFICATION);

final PendingIntent pendingIntent;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ public void onPictureTaken(byte[] data, Camera camera) {

@SuppressWarnings("WeakerAccess")
static void closeCamera1(Camera camera) {
if(BuildConfig.DEBUG)
Log.d(TAG, "closeCamera1: ");

camera.stopPreview();
camera.release();
mCamera = null;
Expand Down
31 changes: 16 additions & 15 deletions app/src/main/java/jerryc05/unlockme/services/ForegroundService.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import jerryc05.unlockme.BuildConfig;
import jerryc05.unlockme.helpers.UserInterface;
import jerryc05.unlockme.helpers.camera.CameraBaseAPIClass;
import jerryc05.unlockme.receivers.MyDeviceAdminReceiver;

import static jerryc05.unlockme.helpers.UserInterface.notifyToForegroundService;
Expand All @@ -26,10 +27,6 @@ public class ForegroundService extends Service {
private ThreadPoolExecutor threadPoolExecutor;
MyDeviceAdminReceiver myDeviceAdminReceiver;

// public ForegroundService() {
// super("ForegroundService");
// }

@Override
public void onCreate() {
super.onCreate();
Expand All @@ -54,17 +51,21 @@ public void run() {
});
}

// @Override
// protected void onHandleIntent(Intent intent) {
// if (BuildConfig.DEBUG)
// Log.d(TAG, "onHandleIntent: ");
//
// if (ACTION_UPDATE_NOTIFICATION.equals(intent.getAction()))
// UserInterface.notifyToForegroundService(this);//todo
// else
// CameraBaseAPIClass.getImageFromDefaultCamera(
// this, true);
// }
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
threadPoolExecutor.execute(new Runnable() {
@Override
public void run() {
if (ACTION_UPDATE_NOTIFICATION.equals(intent.getAction()))
UserInterface.notifyToForegroundService(ForegroundService.this);
else
CameraBaseAPIClass.getImageFromDefaultCamera(
ForegroundService.this, true);
}
});

return super.onStartCommand(intent, flags, startId);
}

private ThreadPoolExecutor getThreadPoolExecutor() {
if (threadPoolExecutor == null) {
Expand Down

0 comments on commit cdf520e

Please sign in to comment.