use of android.content.Intent in project cw-omnibus by commonsguy.
the class ActivityChooserModel method chooseActivity.
/**
* Chooses a activity to handle the current intent. This will result in
* adding a historical record for that action and construct intent with
* its component name set such that it can be immediately started by the
* client.
* <p>
* <strong>Note:</strong> By calling this method the client guarantees
* that the returned intent will be started. This intent is returned to
* the client solely to let additional customization before the start.
* </p>
*
* @return An {@link Intent} for launching the activity or null if the
* policy has consumed the intent.
*
* @see HistoricalRecord
* @see OnChooseActivityListener
*/
public Intent chooseActivity(int index) {
ActivityResolveInfo chosenActivity = mActivites.get(index);
ComponentName chosenName = new ComponentName(chosenActivity.resolveInfo.activityInfo.packageName, chosenActivity.resolveInfo.activityInfo.name);
Intent choiceIntent = new Intent(mIntent);
choiceIntent.setComponent(chosenName);
if (mActivityChoserModelPolicy != null) {
// Do not allow the policy to change the intent.
Intent choiceIntentCopy = new Intent(choiceIntent);
final boolean handled = mActivityChoserModelPolicy.onChooseActivity(this, choiceIntentCopy);
if (handled) {
return null;
}
}
HistoricalRecord historicalRecord = new HistoricalRecord(chosenName, System.currentTimeMillis(), DEFAULT_HISTORICAL_RECORD_WEIGHT);
addHisoricalRecord(historicalRecord);
return choiceIntent;
}
use of android.content.Intent in project UltimateAndroid by cymcsg.
the class DefaultIntro method loadMainActivity.
private void loadMainActivity() {
Intent intent = new Intent(this, AppintroActivity.class);
startActivity(intent);
}
use of android.content.Intent in project UltimateAndroid by cymcsg.
the class SecondLayoutIntro method loadMainActivity.
private void loadMainActivity() {
Intent intent = new Intent(this, AppintroActivity.class);
startActivity(intent);
}
use of android.content.Intent in project android by cSploit.
the class WifiScannerFragment method onBackPressed.
public void onBackPressed() {
mScanReceiver.unregister();
mConnectionReceiver.unregister();
Bundle bundle = new Bundle();
bundle.putBoolean(CONNECTED, mConnected);
Intent intent = new Intent();
intent.putExtras(bundle);
getActivity().setResult(AppCompatActivity.RESULT_OK, intent);
getActivity().finish();
getActivity().overridePendingTransition(R.anim.fadeout, R.anim.fadein);
}
use of android.content.Intent in project android-betterpickers by code-troopers.
the class ListSamples method getData.
protected List<Map<String, Object>> getData(String prefix) {
List<Map<String, Object>> myData = new ArrayList<Map<String, Object>>();
Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(INTENT_SAMPLE);
PackageManager pm = getPackageManager();
List<ResolveInfo> list = pm.queryIntentActivities(mainIntent, 0);
if (null == list) {
return myData;
}
String[] prefixPath;
String prefixWithSlash = prefix;
if (prefix.equals("")) {
prefixPath = null;
} else {
prefixPath = prefix.split("/");
prefixWithSlash = prefix + "/";
}
int len = list.size();
Map<String, Boolean> entries = new HashMap<String, Boolean>();
for (int i = 0; i < len; i++) {
ResolveInfo info = list.get(i);
CharSequence labelSeq = info.loadLabel(pm);
String label = labelSeq != null ? labelSeq.toString() : info.activityInfo.name;
if (prefixWithSlash.length() == 0 || label.startsWith(prefixWithSlash)) {
String[] labelPath = label.split("/");
String nextLabel = prefixPath == null ? labelPath[0] : labelPath[prefixPath.length];
if ((prefixPath != null ? prefixPath.length : 0) == labelPath.length - 1) {
addItem(myData, nextLabel, activityIntent(info.activityInfo.applicationInfo.packageName, info.activityInfo.name));
} else {
if (entries.get(nextLabel) == null) {
addItem(myData, nextLabel, browseIntent(prefix.equals("") ? nextLabel : prefix + "/" + nextLabel));
entries.put(nextLabel, true);
}
}
}
}
Collections.sort(myData, NAME_COMPARATOR);
return myData;
}
Aggregations