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);
}
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);
}
}
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();
}
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);
}
}
}
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;
}
Aggregations