Search in sources :

Example 31 with Intent

use of android.content.Intent in project sharelock-android by auth0.

the class BaseMenuActivity method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {
        startActivity(new Intent(this, SettingsActivity.class));
        return true;
    }
    if (id == R.id.action_about) {
        startActivity(new Intent(this, AboutActivity.class));
        return true;
    }
    if (id == R.id.action_new) {
        final Intent intent = new Intent(this, ComposeActivity.class);
        startActivity(intent);
        return true;
    }
    if (id == R.id.action_privacy) {
        final Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setData(Uri.parse(getString(R.string.privacy_url)));
        startActivity(intent);
        return true;
    }
    if (id == R.id.action_tos) {
        final Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setData(Uri.parse(getString(R.string.tos_url)));
        startActivity(intent);
        return true;
    }
    if (id == R.id.action_security) {
        final Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setData(Uri.parse(getString(R.string.security_url)));
        startActivity(intent);
        return true;
    }
    return super.onOptionsItemSelected(item);
}
Also used : Intent(android.content.Intent)

Example 32 with Intent

use of android.content.Intent in project sharelock-android by auth0.

the class ComposeActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Fabric.with(this, new Crashlytics());
    setContentView(R.layout.activity_compose);
    Toolbar toolbar = (Toolbar) findViewById(R.id.sharelock_toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setTitle(null);
    bus = EventBus.getDefault();
    handler = new Handler();
    Intent intent = getIntent();
    String action = intent.getAction();
    String type = intent.getType();
    String sharedText = null;
    if (Intent.ACTION_SEND.equals(action) && type != null) {
        if ("text/plain".equals(type)) {
            sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
        }
    }
    if (savedInstanceState == null) {
        final SecretInputFragment fragment = new SecretInputFragment();
        if (sharedText != null) {
            Bundle arguments = new Bundle();
            arguments.putString(SecretInputFragment.SECRET_INPUT_FRAGMENT_SECRET_ARGUMENT, sharedText);
            fragment.setArguments(arguments);
        }
        getSupportFragmentManager().beginTransaction().replace(R.id.sharelock_compose_container, fragment).commit();
    } else {
        secret = savedInstanceState.getParcelable(COMPOSE_CREATED_SECRET);
    }
}
Also used : Bundle(android.os.Bundle) SecretInputFragment(com.auth0.sharelock.fragment.SecretInputFragment) Handler(android.os.Handler) Intent(android.content.Intent) Crashlytics(com.crashlytics.android.Crashlytics) Toolbar(android.support.v7.widget.Toolbar)

Example 33 with Intent

use of android.content.Intent in project ahbottomnavigation by aurelhubert.

the class DemoActivity method reload.

/**
	 * Reload activity
	 */
public void reload() {
    startActivity(new Intent(this, DemoActivity.class));
    finish();
}
Also used : Intent(android.content.Intent)

Example 34 with Intent

use of android.content.Intent in project ADWLauncher2 by boombuler.

the class WidgetCellLayout method onViewportIn.

/**
     * Called when this cell layout get into the viewport
     */
public void onViewportIn() {
    View child;
    AppWidgetHostView widgetView;
    AppWidgetProviderInfo widgetInfo;
    Intent intent;
    for (int i = this.getChildCount() - 1; i >= 0; i--) {
        try {
            child = this.getChildAt(i);
            if (child instanceof AppWidgetHostView) {
                widgetView = ((AppWidgetHostView) child);
                widgetInfo = widgetView.getAppWidgetInfo();
                int appWidgetId = widgetView.getAppWidgetId();
                intent = new Intent(LauncherIntent.Notification.NOTIFICATION_IN_VIEWPORT).setComponent(widgetInfo.provider);
                intent.putExtra(LauncherIntent.Extra.EXTRA_APPWIDGET_ID, appWidgetId);
                intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
                getContext().sendBroadcast(intent);
            }
        } catch (Exception e) {
        // LauncherApplication.reportExceptionStack(e);
        }
    }
}
Also used : AppWidgetHostView(android.appwidget.AppWidgetHostView) AppWidgetProviderInfo(android.appwidget.AppWidgetProviderInfo) LauncherIntent(mobi.intuitit.android.content.LauncherIntent) Intent(android.content.Intent) AppWidgetHostView(android.appwidget.AppWidgetHostView) ImageView(android.widget.ImageView) View(android.view.View)

Example 35 with Intent

use of android.content.Intent in project ADWLauncher2 by boombuler.

the class ActivityPickerActivity method onChildClick.

@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
    ActivityInfo info = (ActivityInfo) getExpandableListAdapter().getChild(groupPosition, childPosition);
    Intent intent = new Intent();
    intent.setComponent(new ComponentName(info.applicationInfo.packageName, info.name));
    Intent mReturnData = new Intent();
    intent.setAction(Intent.ACTION_MAIN);
    intent.addCategory(Intent.CATEGORY_LAUNCHER);
    mReturnData.putExtra(Intent.EXTRA_SHORTCUT_INTENT, intent);
    // Set the name of the activity
    mReturnData.putExtra(Intent.EXTRA_SHORTCUT_NAME, info.loadLabel(mPackageManager));
    ShortcutIconResource iconResource = new ShortcutIconResource();
    iconResource.packageName = info.packageName;
    try {
        Resources resources = mPackageManager.getResourcesForApplication(iconResource.packageName);
        iconResource.resourceName = resources.getResourceName(info.getIconResource());
        mReturnData.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconResource);
    } catch (NameNotFoundException e) {
    } catch (Resources.NotFoundException e) {
    }
    setResult(RESULT_OK, mReturnData);
    finish();
    return true;
}
Also used : ActivityInfo(android.content.pm.ActivityInfo) NameNotFoundException(android.content.pm.PackageManager.NameNotFoundException) ShortcutIconResource(android.content.Intent.ShortcutIconResource) Intent(android.content.Intent) ComponentName(android.content.ComponentName) Resources(android.content.res.Resources)

Aggregations

Intent (android.content.Intent)14391 PendingIntent (android.app.PendingIntent)2805 View (android.view.View)1068 ComponentName (android.content.ComponentName)965 Bundle (android.os.Bundle)888 Uri (android.net.Uri)762 ResolveInfo (android.content.pm.ResolveInfo)757 Context (android.content.Context)686 TextView (android.widget.TextView)669 RemoteException (android.os.RemoteException)657 Test (org.junit.Test)590 PackageManager (android.content.pm.PackageManager)553 IntentFilter (android.content.IntentFilter)519 ArrayList (java.util.ArrayList)486 ActivityNotFoundException (android.content.ActivityNotFoundException)398 ImageView (android.widget.ImageView)395 File (java.io.File)364 IOException (java.io.IOException)361 BroadcastReceiver (android.content.BroadcastReceiver)360 Notification (android.app.Notification)302