use of android.content.Intent in project cw-omnibus by commonsguy.
the class WebServerService method foregroundify.
private void foregroundify() {
NotificationCompat.Builder b = new NotificationCompat.Builder(this);
Intent iReceiver = new Intent(this, StopReceiver.class);
PendingIntent piReceiver = PendingIntent.getBroadcast(this, 0, iReceiver, 0);
b.setAutoCancel(true).setDefaults(Notification.DEFAULT_ALL);
buildForegroundNotification(b);
b.addAction(R.drawable.ic_stop_white_24dp, getString(R.string.notify_stop), piReceiver);
startForeground(NOTIFY_ID, b.build());
}
use of android.content.Intent in project cw-omnibus by commonsguy.
the class ActionMenu method addIntentOptions.
public int addIntentOptions(int groupId, int itemId, int order, ComponentName caller, Intent[] specifics, Intent intent, int flags, MenuItem[] outSpecificItems) {
PackageManager pm = mContext.getPackageManager();
final List<ResolveInfo> lri = pm.queryIntentActivityOptions(caller, specifics, intent, 0);
final int N = lri != null ? lri.size() : 0;
if ((flags & FLAG_APPEND_TO_GROUP) == 0) {
removeGroup(groupId);
}
for (int i = 0; i < N; i++) {
final ResolveInfo ri = lri.get(i);
Intent rintent = new Intent(ri.specificIndex < 0 ? intent : specifics[ri.specificIndex]);
rintent.setComponent(new ComponentName(ri.activityInfo.applicationInfo.packageName, ri.activityInfo.name));
final MenuItem item = add(groupId, itemId, order, ri.loadLabel(pm)).setIcon(ri.loadIcon(pm)).setIntent(rintent);
if (outSpecificItems != null && ri.specificIndex >= 0) {
outSpecificItems[ri.specificIndex] = item;
}
}
return N;
}
use of android.content.Intent in project cw-omnibus by commonsguy.
the class WebServerService method foregroundify.
private void foregroundify() {
NotificationCompat.Builder b = new NotificationCompat.Builder(this);
Intent iActivity = new Intent(this, MainActivity.class);
PendingIntent piActivity = PendingIntent.getActivity(this, 0, iActivity, 0);
Intent iReceiver = new Intent(this, StopReceiver.class);
PendingIntent piReceiver = PendingIntent.getBroadcast(this, 0, iReceiver, 0);
b.setAutoCancel(true).setDefaults(Notification.DEFAULT_ALL).setContentTitle(getString(R.string.app_name)).setContentIntent(piActivity).setSmallIcon(R.mipmap.ic_launcher).setTicker(getString(R.string.app_name)).addAction(R.drawable.ic_stop_white_24dp, getString(R.string.notify_stop), piReceiver);
startForeground(1337, b.build());
}
use of android.content.Intent in project cw-omnibus by commonsguy.
the class WebServerService method foregroundify.
private void foregroundify() {
NotificationCompat.Builder b = new NotificationCompat.Builder(this);
Intent iActivity = new Intent(this, MainActivity.class);
PendingIntent piActivity = PendingIntent.getActivity(this, 0, iActivity, 0);
Intent iReceiver = new Intent(this, StopReceiver.class);
PendingIntent piReceiver = PendingIntent.getBroadcast(this, 0, iReceiver, 0);
b.setAutoCancel(true).setDefaults(Notification.DEFAULT_ALL).setContentTitle(getString(R.string.app_name)).setContentIntent(piActivity).setSmallIcon(R.mipmap.ic_launcher).setTicker(getString(R.string.app_name)).addAction(R.drawable.ic_stop_white_24dp, getString(R.string.notify_stop), piReceiver);
startForeground(1337, b.build());
}
use of android.content.Intent in project cw-omnibus by commonsguy.
the class WebServerService method foregroundify.
private void foregroundify() {
NotificationCompat.Builder b = new NotificationCompat.Builder(this);
Intent iActivity = new Intent(this, MainActivity.class);
PendingIntent piActivity = PendingIntent.getActivity(this, 0, iActivity, 0);
Intent iReceiver = new Intent(this, StopReceiver.class);
PendingIntent piReceiver = PendingIntent.getBroadcast(this, 0, iReceiver, 0);
b.setAutoCancel(true).setDefaults(Notification.DEFAULT_ALL).setContentTitle(getString(R.string.app_name)).setContentIntent(piActivity).setSmallIcon(R.mipmap.ic_launcher).setTicker(getString(R.string.app_name)).addAction(R.drawable.ic_stop_white_24dp, getString(R.string.notify_stop), piReceiver);
startForeground(1337, b.build());
}
Aggregations