コード例 #1
0
 public String getPageContents() {
   StringBuffer buffer = new StringBuffer();
   SimpleDateFormat isoFormat = new SimpleDateFormat("yyyy-MM-dd");
   buffer
       .append("== {{int:filedesc}} ==\n")
       .append("{{Information\n")
       .append("|description=")
       .append(description)
       .append("\n")
       .append("|source=")
       .append("{{own}}\n")
       .append("|author=[[User:"******"]]\n");
   if (dateCreated != null) {
     buffer
         .append("|date={{According to EXIF data|")
         .append(isoFormat.format(dateCreated))
         .append("}}\n");
   }
   buffer
       .append("}}")
       .append("\n")
       .append("== {{int:license-header}} ==\n")
       .append("{{self|cc-by-sa-3.0}}\n\n")
       .append("{{Uploaded from Mobile|platform=Android|version=")
       .append(CommonsApplication.APPLICATION_VERSION)
       .append("}}\n")
       .append("{{subst:unc}}"); // Remove when we have categorization
   return buffer.toString();
 }
コード例 #2
0
ファイル: MaskedEditText.java プロジェクト: jinkg/MyFavorate
 private String formatText(String input, String pattern) {
   String regularExpression = "(\\[[\\d]+\\])";
   Pattern p = Pattern.compile(regularExpression);
   Matcher m = p.matcher(pattern);
   StringBuffer sb = new StringBuffer();
   while (m.find()) {
     m.appendReplacement(sb, getSymbol(input, m.group()));
   }
   return sb.toString();
 }
コード例 #3
0
ファイル: Godot.java プロジェクト: gokudomatic/godot
  private boolean obbIsCorrupted(String f, String main_pack_md5) {

    try {

      InputStream fis = new FileInputStream(f);

      // Create MD5 Hash
      byte[] buffer = new byte[16384];

      MessageDigest complete = MessageDigest.getInstance("MD5");
      int numRead;
      do {
        numRead = fis.read(buffer);
        if (numRead > 0) {
          complete.update(buffer, 0, numRead);
        }
      } while (numRead != -1);

      fis.close();
      byte[] messageDigest = complete.digest();

      // Create Hex String
      StringBuffer hexString = new StringBuffer();
      for (int i = 0; i < messageDigest.length; i++) {
        String s = Integer.toHexString(0xFF & messageDigest[i]);

        if (s.length() == 1) {
          s = "0" + s;
        }
        hexString.append(s);
      }
      String md5str = hexString.toString();

      // Log.d("GODOT","**PACK** - My MD5: "+hexString+" - APK md5: "+main_pack_md5);
      if (!md5str.equals(main_pack_md5)) {
        Log.d(
            "GODOT",
            "**PACK MD5 MISMATCH???** - MD5 Found: "
                + md5str
                + " "
                + Integer.toString(md5str.length())
                + " - MD5 Expected: "
                + main_pack_md5
                + " "
                + Integer.toString(main_pack_md5.length()));
        return true;
      }
      return false;
    } catch (Exception e) {
      e.printStackTrace();
      Log.d("GODOT", "**PACK FAIL**");
      return true;
    }
  }
コード例 #4
0
ファイル: MaskedEditText.java プロジェクト: jinkg/MyFavorate
  public void setMaskedText(String input) {
    if ((input != null) && (input.length() == listValidCursorPositions.size())) {
      StringBuffer buffer = new StringBuffer(input);

      Editable text = this.getText();
      if (text != null) {
        for (int i = 0; i < mask.length(); i++) {
          if (!listValidCursorPositions.contains(i)) {
            buffer.insert(i, String.valueOf(mask.charAt(i)));
          }
        }
        maskedInputFilter.setTextSetup(true);
        this.setText(buffer.toString());
        maskedInputFilter.setTextSetup(false);
      }
    }
  }