Tabnine Logo
RestrictionEntry
Code IndexAdd Tabnine to your IDE (free)

How to use
RestrictionEntry
in
android.content

Best Java code snippets using android.content.RestrictionEntry (Showing top 12 results out of 315)

origin: commonsguy/cw-omnibus

private RestrictionEntry buildChoiceRestriction(Context ctxt,
                        Bundle current) {
 RestrictionEntry entry=
   new RestrictionEntry(RESTRICTION_CHOICE,
              current.getString(RESTRICTION_CHOICE));
 entry.setTitle(ctxt.getString(R.string.choice_restriction_title));
 entry.setChoiceEntries(ctxt, R.array.display_values);
 entry.setChoiceValues(ctxt, R.array.restriction_values);
 return(entry);
}
origin: commonsguy/cw-omnibus

private RestrictionEntry buildBooleanRestriction(Context ctxt,
                         Bundle current) {
 RestrictionEntry entry=
   new RestrictionEntry(RESTRICTION_BOOLEAN,
              current.getBoolean(RESTRICTION_BOOLEAN,
                       false));
 entry.setTitle(ctxt.getString(R.string.boolean_restriction_title));
 entry.setDescription(ctxt.getString(R.string.boolean_restriction_desc));
 return(entry);
}
origin: googlesamples/android-AppRestrictionEnforcer

SharedPreferences prefs = activity.getSharedPreferences(PREFS_KEY, Context.MODE_PRIVATE);
for (RestrictionEntry restriction : restrictions) {
  String key = restriction.getKey();
  if (RESTRICTION_KEY_SAY_HELLO.equals(key)) {
    updateCanSayHello(prefs.getBoolean(RESTRICTION_KEY_SAY_HELLO,
        restriction.getSelectedState()));
  } else if (RESTRICTION_KEY_MESSAGE.equals(key)) {
    updateMessage(prefs.getString(RESTRICTION_KEY_MESSAGE,
        restriction.getSelectedString()));
  } else if (RESTRICTION_KEY_NUMBER.equals(key)) {
    updateNumber(prefs.getInt(RESTRICTION_KEY_NUMBER,
        restriction.getIntValue()));
  } else if (RESTRICTION_KEY_RANK.equals(key)) {
    updateRank(activity, restriction.getChoiceValues(),
        prefs.getString(RESTRICTION_KEY_RANK, restriction.getSelectedString()));
  } else if (RESTRICTION_KEY_APPROVALS.equals(key)) {
    updateApprovals(activity, restriction.getChoiceValues(),
        TextUtils.split(prefs.getString(RESTRICTION_KEY_APPROVALS,
                TextUtils.join(DELIMETER,
                    restriction.getAllSelectedStrings())),
            DELIMETER));
  } else if (BUNDLE_SUPPORTED && RESTRICTION_KEY_ITEMS.equals(key)) {
origin: robolectric/robolectric

 @Test
 public void getManifestRestrictions() {
  RestrictionEntry restrictionEntry = Iterables.getOnlyElement(restrictionsManager
    .getManifestRestrictions(context.getPackageName()));

  assertThat(restrictionEntry.getKey()).isEqualTo("restrictionKey");
 }
}
origin: stackoverflow.com

 RestrictionEntry myEntry = new RestrictionEntry(KEY, oldRestrictions.getBoolean(KEY, false)); 
myEntry.setType(RestrictionEntry.TYPE_BOOLEAN);
myEntry.setTitle("KEY TITLE");
newEntries.add(myEntry);
origin: googlesamples/android-AppRestrictionSchema

private void updateMessage(RestrictionEntry entry, Bundle restrictions) {
  if (restrictions == null || !restrictions.containsKey(KEY_MESSAGE)) {
    mMessage = entry.getSelectedString();
  } else {
    mMessage = restrictions.getString(KEY_MESSAGE);
  }
}
origin: googlesamples/android-AppRestrictionSchema

private void updateCanSayHello(RestrictionEntry entry, Bundle restrictions) {
  boolean canSayHello;
  if (restrictions == null || !restrictions.containsKey(KEY_CAN_SAY_HELLO)) {
    canSayHello = entry.getSelectedState();
  } else {
    canSayHello = restrictions.getBoolean(KEY_CAN_SAY_HELLO);
  }
  mTextSayHello.setText(canSayHello ?
      R.string.explanation_can_say_hello_true :
      R.string.explanation_can_say_hello_false);
  mButtonSayHello.setEnabled(canSayHello);
}
origin: googlesamples/android-AppRestrictionSchema

private void updateNumber(RestrictionEntry entry, Bundle restrictions) {
  int number;
  if (restrictions == null || !restrictions.containsKey(KEY_NUMBER)) {
    number = entry.getIntValue();
  } else {
    number = restrictions.getInt(KEY_NUMBER);
  }
  mTextNumber.setText(getString(R.string.your_number, number));
}
origin: googlesamples/android-AppRestrictionSchema

private void updateApprovals(RestrictionEntry entry, Bundle restrictions) {
  String[] approvals;
  if (restrictions == null || !restrictions.containsKey(KEY_APPROVALS)) {
    approvals = entry.getAllSelectedStrings();
  } else {
    approvals = restrictions.getStringArray(KEY_APPROVALS);
  }
  String text;
  if (approvals == null || approvals.length == 0) {
    text = getString(R.string.none);
  } else {
    text = TextUtils.join(", ", approvals);
  }
  mTextApprovals.setText(getString(R.string.approvals_you_have, text));
}
origin: googlesamples/android-AppRestrictionSchema

private void resolveRestrictions() {
  RestrictionsManager manager =
      (RestrictionsManager) getActivity().getSystemService(Context.RESTRICTIONS_SERVICE);
  Bundle restrictions = manager.getApplicationRestrictions();
  List<RestrictionEntry> entries = manager.getManifestRestrictions(
      getActivity().getApplicationContext().getPackageName());
  for (RestrictionEntry entry : entries) {
    String key = entry.getKey();
    Log.d(TAG, "key: " + key);
    if (key.equals(KEY_CAN_SAY_HELLO)) {
      updateCanSayHello(entry, restrictions);
    } else if (key.equals(KEY_MESSAGE)) {
      updateMessage(entry, restrictions);
    } else if (key.equals(KEY_NUMBER)) {
      updateNumber(entry, restrictions);
    } else if (key.equals(KEY_RANK)) {
      updateRank(entry, restrictions);
    } else if (key.equals(KEY_APPROVALS)) {
      updateApprovals(entry, restrictions);
    } else if (key.equals(KEY_ITEMS)) {
      updateItems(restrictions);
    }
  }
}
origin: googlesamples/android-AppRestrictionSchema

private void updateRank(RestrictionEntry entry, Bundle restrictions) {
  String rank;
  if (restrictions == null || !restrictions.containsKey(KEY_RANK)) {
    rank = entry.getSelectedString();
  } else {
    rank = restrictions.getString(KEY_RANK);
  }
  mTextRank.setText(getString(R.string.your_rank, rank));
}
origin: commonsguy/cw-omnibus

 private RestrictionEntry buildMultiSelectRestriction(Context ctxt,
                            Bundle current) {
  RestrictionEntry entry=
    new RestrictionEntry(RESTRICTION_MULTI,
               current.getStringArray(RESTRICTION_MULTI));

  entry.setTitle("A Multi-Select Restriction");
  entry.setChoiceEntries(ctxt, R.array.display_values);
  entry.setChoiceValues(ctxt, R.array.restriction_values);

  return(entry);
 }
}
android.contentRestrictionEntry

Most used methods

  • getKey
  • getAllSelectedStrings
  • getIntValue
  • getSelectedState
  • getSelectedString
  • setTitle
  • <init>
  • getChoiceValues
  • setChoiceEntries
  • setChoiceValues
  • setDescription
  • setType
  • setDescription,
  • setType

Popular in Java

  • Start an intent from android
  • setRequestProperty (URLConnection)
  • setContentView (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • Collectors (java.util.stream)
  • JList (javax.swing)
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now