setTitle()源码实例Demo

android.content.RestrictionEntry#setTitle()源码实例Demo

下面列出了android.content.RestrictionEntry#setTitle() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

public static void populateChoiceEntry(Resources res, RestrictionEntry reSingleChoice) {
    String[] choiceEntries = res.getStringArray(R.array.choice_entry_entries);
    String[] choiceValues = res.getStringArray(R.array.choice_entry_values);
    if (reSingleChoice.getSelectedString() == null) {
        reSingleChoice.setSelectedString(choiceValues[0]);
    }
    reSingleChoice.setTitle(res.getString(R.string.choice_entry_title));
    reSingleChoice.setChoiceEntries(choiceEntries);
    reSingleChoice.setChoiceValues(choiceValues);
    reSingleChoice.setType(RestrictionEntry.TYPE_CHOICE);
}
 
public static void populateMultiEntry(Resources res, RestrictionEntry reMultiSelect) {
    String[] multiEntries = res.getStringArray(R.array.multi_entry_entries);
    String[] multiValues = res.getStringArray(R.array.multi_entry_values);
    if (reMultiSelect.getAllSelectedStrings() == null) {
        reMultiSelect.setAllSelectedStrings(new String[0]);
    }
    reMultiSelect.setTitle(res.getString(R.string.multi_entry_title));
    reMultiSelect.setChoiceEntries(multiEntries);
    reMultiSelect.setChoiceValues(multiValues);
    reMultiSelect.setType(RestrictionEntry.TYPE_MULTI_SELECT);
}
 
public static void populateChoiceEntry(Resources res, RestrictionEntry reSingleChoice) {
    String[] choiceEntries = res.getStringArray(R.array.choice_entry_entries);
    String[] choiceValues = res.getStringArray(R.array.choice_entry_values);
    if (reSingleChoice.getSelectedString() == null) {
        reSingleChoice.setSelectedString(choiceValues[0]);
    }
    reSingleChoice.setTitle(res.getString(R.string.choice_entry_title));
    reSingleChoice.setChoiceEntries(choiceEntries);
    reSingleChoice.setChoiceValues(choiceValues);
    reSingleChoice.setType(RestrictionEntry.TYPE_CHOICE);
}
 
public static void populateMultiEntry(Resources res, RestrictionEntry reMultiSelect) {
    String[] multiEntries = res.getStringArray(R.array.multi_entry_entries);
    String[] multiValues = res.getStringArray(R.array.multi_entry_values);
    if (reMultiSelect.getAllSelectedStrings() == null) {
        reMultiSelect.setAllSelectedStrings(new String[0]);
    }
    reMultiSelect.setTitle(res.getString(R.string.multi_entry_title));
    reMultiSelect.setChoiceEntries(multiEntries);
    reMultiSelect.setChoiceValues(multiValues);
    reMultiSelect.setType(RestrictionEntry.TYPE_MULTI_SELECT);
}
 
源代码5 项目: bitmask_android   文件: GetRestrictionReceiver.java
private ArrayList<RestrictionEntry> initRestrictions(Context context) {
    ArrayList<RestrictionEntry> restrictions = new ArrayList<RestrictionEntry>();
    RestrictionEntry allowChanges = new RestrictionEntry("allow_changes",false);
    allowChanges.setTitle(context.getString(R.string.allow_vpn_changes));
    restrictions.add(allowChanges);

    return restrictions;
}
 
public static void populateBooleanEntry(Resources res, RestrictionEntry entry) {
    entry.setType(RestrictionEntry.TYPE_BOOLEAN);
    entry.setTitle(res.getString(R.string.boolean_entry_title));
}
 
public static void populateBooleanEntry(Resources res, RestrictionEntry entry) {
    entry.setType(RestrictionEntry.TYPE_BOOLEAN);
    entry.setTitle(res.getString(R.string.boolean_entry_title));
}
 
如果文章对您有帮助,请点击页面广告。以鼓励作者做出的努力。