public LicensesDialog(
     final Context context,
     final int rawNoticesResourceId,
     final boolean showFullLicenseText,
     boolean includeOwnLicense) {
   mContext = context;
   mHeaderText = null;
   // Load defaults
   final String style = context.getString(R.string.notices_default_style);
   mTitleText = context.getString(R.string.notices_title);
   try {
     final Resources resources = context.getResources();
     if ("raw".equals(resources.getResourceTypeName(rawNoticesResourceId))) {
       final Notices notices =
           NoticesXmlParser.parse(resources.openRawResource(rawNoticesResourceId));
       if (includeOwnLicense) {
         final List<Notice> noticeList = notices.getNotices();
         noticeList.add(LICENSES_DIALOG_NOTICE);
       }
       mLicensesText =
           NoticesHtmlBuilder.create(mContext)
               .setShowFullLicenseText(showFullLicenseText)
               .setNotices(notices)
               .setStyle(style)
               .build();
     } else {
       throw new IllegalStateException("not a raw resource");
     }
   } catch (Exception e) {
     throw new IllegalStateException(e);
   }
   mCloseText = context.getString(R.string.notices_close);
 }
Esempio n. 2
0
 public static Notices getNotices() {
   for (Notice notice : NOTICE_LIST) notices.addNotice(notice);
   return notices;
 }