Search in sources :

Example 6 with Bundle

use of android.os.Bundle in project cw-omnibus by commonsguy.

the class RestrictionEntriesReceiver method onReceive.

@Override
public void onReceive(Context ctxt, Intent intent) {
    Bundle current = (Bundle) intent.getParcelableExtra(Intent.EXTRA_RESTRICTIONS_BUNDLE);
    ArrayList<RestrictionEntry> restrictions = new ArrayList<RestrictionEntry>();
    restrictions.add(buildBooleanRestriction(ctxt, current));
    restrictions.add(buildChoiceRestriction(ctxt, current));
    restrictions.add(buildMultiSelectRestriction(ctxt, current));
    Bundle result = new Bundle();
    result.putParcelableArrayList(Intent.EXTRA_RESTRICTIONS_LIST, restrictions);
    setResultExtras(result);
}
Also used : Bundle(android.os.Bundle) RestrictionEntry(android.content.RestrictionEntry) ArrayList(java.util.ArrayList)

Example 7 with Bundle

use of android.os.Bundle in project cw-omnibus by commonsguy.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    UserManager mgr = (UserManager) getSystemService(USER_SERVICE);
    Bundle restrictions = mgr.getUserRestrictions();
    if (restrictions.keySet().size() > 0) {
        setContentView(R.layout.activity_main);
        RestrictionsFragment f = (RestrictionsFragment) getFragmentManager().findFragmentById(R.id.contents);
        f.showRestrictions(restrictions);
    } else {
        Toast.makeText(this, R.string.no_restrictions, Toast.LENGTH_LONG).show();
        finish();
    }
}
Also used : UserManager(android.os.UserManager) Bundle(android.os.Bundle)

Example 8 with Bundle

use of android.os.Bundle in project cw-omnibus by commonsguy.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    UserManager mgr = (UserManager) getSystemService(USER_SERVICE);
    Bundle restrictions = mgr.getApplicationRestrictions(getPackageName());
    if (restrictions.keySet().size() > 0) {
        setContentView(R.layout.activity_main);
        RestrictionsFragment f = (RestrictionsFragment) getFragmentManager().findFragmentById(R.id.contents);
        f.showRestrictions(restrictions);
    } else {
        Toast.makeText(this, R.string.no_restrictions, Toast.LENGTH_LONG).show();
        finish();
    }
}
Also used : UserManager(android.os.UserManager) Bundle(android.os.Bundle)

Example 9 with Bundle

use of android.os.Bundle in project cucumber-jvm by cucumber.

the class ArgumentsTest method supports_features_as_direct_bundle_argument.

@Test
public void supports_features_as_direct_bundle_argument() {
    // given
    final Bundle bundle = new Bundle();
    bundle.putString("features", "someFeature");
    final Arguments arguments = new Arguments(bundle);
    // when
    final String cucumberOptions = arguments.getCucumberOptions();
    // then
    // TODO does this space makes sense?
    assertThat(cucumberOptions, is(" someFeature"));
}
Also used : Bundle(android.os.Bundle) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Test(org.junit.Test)

Example 10 with Bundle

use of android.os.Bundle in project cucumber-jvm by cucumber.

the class ArgumentsTest method handles_empty_bundle_gracefully.

@Test
public void handles_empty_bundle_gracefully() {
    // given
    final Arguments arguments = new Arguments(new Bundle());
    // when
    final String cucumberOptions = arguments.getCucumberOptions();
    // then
    assertThat(cucumberOptions, is(""));
}
Also used : Bundle(android.os.Bundle) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Test(org.junit.Test)

Aggregations

Bundle (android.os.Bundle)6155 Intent (android.content.Intent)826 RemoteException (android.os.RemoteException)477 View (android.view.View)342 Test (org.junit.Test)266 ArrayList (java.util.ArrayList)216 TextView (android.widget.TextView)203 PersistableBundle (android.os.PersistableBundle)201 PendingIntent (android.app.PendingIntent)185 IOException (java.io.IOException)176 Uri (android.net.Uri)155 ImageView (android.widget.ImageView)152 ComponentName (android.content.ComponentName)124 Fragment (android.support.v4.app.Fragment)124 Message (android.os.Message)122 JSONObject (org.json.JSONObject)112 Account (android.accounts.Account)108 Context (android.content.Context)102 Parcelable (android.os.Parcelable)99 Bitmap (android.graphics.Bitmap)90