v.0.5
This commit is contained in:
parent
63dfb9b197
commit
d48847d183
135 changed files with 8879 additions and 3693 deletions
|
@ -38,7 +38,7 @@ public class AndroidNativeActivity extends org.qtproject.qt5.android.bindings.Qt
|
|||
// app-defined int constant. The callback method gets the
|
||||
// result of the request.
|
||||
} else {
|
||||
|
||||
|
||||
System.loadLibrary("friendiqa");
|
||||
if((getIntent().getFlags() == (Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY)) || (getIntent().getFlags() == Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) || (getIntent().getFlags() == Intent.FLAG_ACTIVITY_NEW_TASK) || (getIntent().getFlags() == Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED) || (getIntent().getFlags() == (Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED))) {
|
||||
SystemDispatcher.onActivityResume();
|
||||
|
|
|
@ -10,12 +10,18 @@ import android.content.Context;
|
|||
import android.content.ComponentName;
|
||||
import android.app.job.JobScheduler;
|
||||
import android.app.job.JobInfo;
|
||||
import android.app.PendingIntent;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.support.v4.app.NotificationManagerCompat;
|
||||
import org.qtproject.qt5.android.QtNative;
|
||||
import androidnative.friendiqa.FriendiqaService;
|
||||
import androidnative.friendiqa.FriendiqaStopService;
|
||||
import androidnative.friendiqa.FriendiqaActivity;
|
||||
import androidnative.AndroidNativeActivity;
|
||||
import androidnative.AndroidNativeService;
|
||||
import android.content.Intent;
|
||||
import java.util.Map;
|
||||
import org.qtproject.friendiqa.R;
|
||||
|
||||
public class Util {
|
||||
|
||||
|
@ -24,6 +30,7 @@ public class Util {
|
|||
public static final String SET_TRANSLUCENT_STATUS_BAR = "androidnative.Util.setTranslucentStatusBar";
|
||||
public static final String SET_FULL_SCREEN = "androidnative.Util.setFullScreen";
|
||||
public static final String SET_SCHEDULE = "androidnative.Util.setSchedule";
|
||||
public static final String SET_NOTIFICATION = "androidnative.Util.setNotification";
|
||||
|
||||
|
||||
static {
|
||||
|
@ -35,6 +42,8 @@ public class Util {
|
|||
setFullScreen(message);
|
||||
} else if (type.equals(SET_SCHEDULE)) {
|
||||
setSchedule(message);
|
||||
} else if (type.equals(SET_NOTIFICATION)) {
|
||||
setNotification(message);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -98,11 +107,39 @@ public class Util {
|
|||
|
||||
}
|
||||
|
||||
static void setNotification(Map message) {
|
||||
//Log.d(TAG,"setNotification");
|
||||
Context context;
|
||||
//Context appcontext;
|
||||
context = QtNative.service().getApplicationContext();
|
||||
//appcontext = QtNative.activity().getApplicationContext();
|
||||
Intent intent = new Intent(context,FriendiqaActivity.class);
|
||||
//intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
|
||||
|
||||
final String textTitle = (String) message.get("title");
|
||||
final String textContent = (String) message.get("message");
|
||||
final int notificationId = (int) message.get("id");
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
|
||||
.setSmallIcon(R.drawable.friendiqanotification)
|
||||
.setContentIntent(pendingIntent)
|
||||
.setContentTitle(textTitle)
|
||||
.setContentText(textContent)
|
||||
.setStyle(new NotificationCompat.BigTextStyle()
|
||||
.bigText(textContent))
|
||||
|
||||
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
|
||||
.setAutoCancel(true);
|
||||
|
||||
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
|
||||
notificationManager.notify(notificationId, builder.build());
|
||||
}
|
||||
|
||||
static void setSchedule(Map message) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
||||
return;
|
||||
}
|
||||
Log.d(TAG,"Friendiqa schedule Androidnative service");
|
||||
//Log.d(TAG,"Friendiqa schedule Androidnative service");
|
||||
final Integer value = (Integer) message.get("value");
|
||||
//final Activity activity = QtNative.activity();
|
||||
//final Service service = QtNative.service();
|
||||
|
@ -126,7 +163,7 @@ public class Util {
|
|||
jobScheduler.schedule(builder.build());
|
||||
|
||||
if (QtNative.service() != null){
|
||||
Log.d(TAG,"Schedule Stopping Friendiqa Androidnative service");
|
||||
//Log.d(TAG,"Schedule Stopping Friendiqa Androidnative service");
|
||||
ComponentName componentStopper = new ComponentName(context, FriendiqaStopService.class);
|
||||
JobInfo.Builder stopbuilder = new JobInfo.Builder(1, componentStopper)
|
||||
.setMinimumLatency(50)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue