Search in sources :

Example 86 with Intent

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());
}
Also used : NotificationCompat(android.support.v4.app.NotificationCompat) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) PendingIntent(android.app.PendingIntent)

Example 87 with Intent

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;
}
Also used : ResolveInfo(android.content.pm.ResolveInfo) PackageManager(android.content.pm.PackageManager) Intent(android.content.Intent) ComponentName(android.content.ComponentName) MenuItem(com.actionbarsherlock.view.MenuItem)

Example 88 with Intent

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());
}
Also used : NotificationCompat(android.support.v4.app.NotificationCompat) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) PendingIntent(android.app.PendingIntent)

Example 89 with Intent

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());
}
Also used : NotificationCompat(android.support.v4.app.NotificationCompat) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) PendingIntent(android.app.PendingIntent)

Example 90 with Intent

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());
}
Also used : NotificationCompat(android.support.v4.app.NotificationCompat) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) PendingIntent(android.app.PendingIntent)

Aggregations

Intent (android.content.Intent)30598 PendingIntent (android.app.PendingIntent)4802 Test (org.junit.Test)2560 View (android.view.View)2527 Bundle (android.os.Bundle)2094 ComponentName (android.content.ComponentName)1706 TextView (android.widget.TextView)1660 Uri (android.net.Uri)1607 Context (android.content.Context)1506 ResolveInfo (android.content.pm.ResolveInfo)1397 PackageManager (android.content.pm.PackageManager)1125 ArrayList (java.util.ArrayList)1067 IntentFilter (android.content.IntentFilter)917 ImageView (android.widget.ImageView)904 ActivityNotFoundException (android.content.ActivityNotFoundException)859 File (java.io.File)823 RemoteException (android.os.RemoteException)786 DialogInterface (android.content.DialogInterface)752 IOException (java.io.IOException)742 SharedPreferences (android.content.SharedPreferences)665