java.util.Locale#CHINA源码实例Demo

下面列出了java.util.Locale#CHINA 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: v9porn   文件: AboutActivity.java
@SuppressLint("SetTextI18n")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about);
    ButterKnife.bind(this);

    initToolBar(toolbar);

    initAboutSection();

    mVersionTextView.setText("v" + QMUIPackageHelper.getAppVersion(this));

    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy", Locale.CHINA);
    String currentYear = dateFormat.format(new java.util.Date());
    mCopyrightTextView.setText(String.format(getResources().getString(R.string.about_copyright), currentYear));

    alertDialog = DialogUtils.initLoadingDialog(this, "正在检查更新,请稍后...");
    presenter.countCacheFileSize(getString(R.string.about_item_clean_cache));
}
 
源代码2 项目: Gojuon   文件: Gojuon.java
public void setLanguage() {
    String language = getSharedPreferences().getString(KEY_LANGUAGE, LANGUAGE_AUTO);

    Configuration configuration = getResources().getConfiguration();
    switch (language) {
        case LANGUAGE_AUTO:
            configuration.locale = Locale.getDefault();
            break;

        case LANGUAGE_ENGLISH:
            configuration.locale = Locale.ENGLISH;
            break;

        case LANGUAGE_CHINESE:
            configuration.locale = Locale.CHINA;
            break;
    }

    getBaseContext().getResources().updateConfiguration(configuration, null);
}
 
源代码3 项目: wES   文件: TextUtils.java
public static Date parseDate(String date, String format) {
	if (date == null) {
		return null;
	}
	SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format, Locale.CHINA);
	try {
		return simpleDateFormat.parse(date + "");
	} catch (ParseException e) {
		return null;
	}
}
 
源代码4 项目: dolphin   文件: ResourcesTest.java
@Test
public void testXmlCopyrightReading() {
  Resources resources = new Resources(CommentGenerator.XMBG_CG_I18N_DEFAULT_PATH + "/Copyrights", Locale.CHINA);
  String copyright = resources.getFormatted("XmlSource", "2012", "2015");

  if (StringUtils.isEmpty(copyright)) return;

  String[] array = copyright.split("\\|");
  for (String str : array) {
    if (!str.startsWith("<!--") && !str.startsWith("-->")) {
      str = "    " + str;
    }
    System.out.println(str);
  }
}
 
源代码5 项目: PoetryWeather   文件: AboutActivity.java
private void initAboutList() {
    //初始化LOGO下面的名称和版本号
    mVersionTextView.setText("诗语天气 V1.0.2");

    //作者
    QMUICommonListItemView itemAuthor = mAboutGroupListView.createItemView("作者");
    itemAuthor.setDetailText("黄振敏");
    //微信
    QMUICommonListItemView itemWechat = mAboutGroupListView.createItemView("微信");
    itemWechat.setAccessoryType(QMUICommonListItemView.ACCESSORY_TYPE_CHEVRON);
    itemWechat.setDetailText("hzm1998hzm");
    itemWechat.setTag(R.id.listitem_tag_1);
    //QQ
    QMUICommonListItemView itemQQ = mAboutGroupListView.createItemView("QQ");
    itemQQ.setAccessoryType(QMUICommonListItemView.ACCESSORY_TYPE_CHEVRON);
    itemQQ.setDetailText("934585316");
    itemQQ.setTag(R.id.listitem_tag_2);
    //GitHub主页
    QMUICommonListItemView itemGitHub = mAboutGroupListView.createItemView("作者GitHub主页");
    itemGitHub.setOrientation(QMUICommonListItemView.VERTICAL);
    itemGitHub.setDetailText("https://github.com/hzm0321");
    itemGitHub.setAccessoryType(QMUICommonListItemView.ACCESSORY_TYPE_CHEVRON);
    itemGitHub.setTag(R.id.listitem_tag_3);
    QMUIGroupListView.newSection(this)
            .setDescription(getString(R.string.about_description))
            .addItemView(itemAuthor, null)
            .addItemView(itemWechat, mOnClickListenerListItem)
            .addItemView(itemQQ, mOnClickListenerListItem)
            .addItemView(itemGitHub, mOnClickListenerListItem)
            .addTo(mAboutGroupListView);

    //初始化页面底部的版权
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy", Locale.CHINA);
    String currentYear = dateFormat.format(new java.util.Date());
    mCopyrightTextView.setText(String.format(getResources().getString(R.string.about_copyright), currentYear));

}
 
源代码6 项目: tilesfx   文件: Helper.java
public static final DateTimeFormatter getDateFormat(final Locale LOCALE) {
    if (Locale.US == LOCALE) {
        return DateTimeFormatter.ofPattern("MM/dd/YYYY");
    } else if (Locale.CHINA == LOCALE) {
        return DateTimeFormatter.ofPattern("YYYY.MM.dd");
    } else {
        return DateTimeFormatter.ofPattern("dd.MM.getY()YYY");
    }
}
 
源代码7 项目: myapplication   文件: DateUtil.java
/**
 * @param datePattenStr 日期格式
 * @return 日期字符串
 */
public static String getCurrentTimeStr(String datePattenStr) {
    SimpleDateFormat simpleDateFormat = new SimpleDateFormat(datePattenStr, Locale.CHINA);
    Date date = new Date(System.currentTimeMillis());

    return simpleDateFormat.format(date);
}
 
源代码8 项目: ofdrw   文件: SES_SignatureTest.java
@Test
void build() throws Exception {
    Path p = Paths.get("src/test/resources", "UserV1.esl");
    final Path out = Paths.get("target/SignedValue.dat");

    Path userP12 = Paths.get("src/test/resources", "USER.p12");
    Certificate userCert = PKCS12Tools.ReadUserCert(userP12, "private", "777777");

    byte[] mockDigest = new byte[32];
    SESeal seal = SESeal.getInstance(Files.readAllBytes(p));
    String propertyInfo = "/Doc_0/Signs/Signatures.xml";
    ASN1UTCTime signUTCTime = new ASN1UTCTime(new Date(), Locale.CHINA);
    TBS_Sign tbsSign = new TBS_Sign()
            .setVersion(new ASN1Integer(1))
            .setEseal(seal)
            .setTimeInfo(new DERBitString(signUTCTime))
            .setDataHash(new DERBitString(mockDigest))
            .setPropertyInfo(new DERIA5String(propertyInfo))
            .setCert(new DEROctetString(userCert.getEncoded()))
            .setSignatureAlgorithm(GMObjectIdentifiers.sm2sign_with_sm3);


    char[] pwd = "777777".toCharArray();
    KeyStore userKs = KeyStore.getInstance("PKCS12", new BouncyCastleProvider());
    try (InputStream rootKsIn = Files.newInputStream(userP12)) {
        userKs.load(rootKsIn, pwd);

        // 取得印章制作者证书的私钥
        PrivateKey privateKey = (PrivateKey) userKs.getKey("private", pwd);
        Signature signature = Signature.getInstance("SM3withSm2", "BC");
        signature.initSign(privateKey);
        signature.update(tbsSign.getEncoded("DER"));
        byte[] sign = signature.sign();
        SES_Signature sesSignature = new SES_Signature(tbsSign, new DERBitString(sign));
        Files.write(out, sesSignature.getEncoded("DER"));
    }

}
 
源代码9 项目: Medusa   文件: Helper.java
public static final DateTimeFormatter getDateFormat(final Locale LOCALE) {
    if (Locale.US == LOCALE) {
        return DateTimeFormatter.ofPattern("MM/dd/YYYY");
    } else if (Locale.CHINA == LOCALE) {
        return DateTimeFormatter.ofPattern("YYYY.MM.dd");
    } else {
        return DateTimeFormatter.ofPattern("dd.MM.YYYY");
    }
}
 
源代码10 项目: AndroidWallet   文件: ImageUtils.java
/**
 * 根据系统时间、前缀、后缀产生一个文件
 */
public static File createFile(File folder, String prefix, String suffix) {
    if (!folder.exists() || !folder.isDirectory()) folder.mkdirs();
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd_HHmmssSSS", Locale.CHINA);
    String filename = prefix + dateFormat.format(new Date(System.currentTimeMillis())) + suffix;
    return new File(folder, filename);
}
 
源代码11 项目: BaseProject   文件: Util.java
/**
     * 调试追踪信息,记录到本地文件 注:正式发版时将变量CommonConfigs.DEBUG_TRACE_FLAG 置为false;
     * @param mContext
     * @param message
     */
    public static synchronized void debugTraceLog(Context mContext, String message) {
        if (!CommonConfigs.DEBUG_TRACE_FLAG) {
            return;
        }
        if (mContext == null) {
            mContext = NetHelper.getAppContext();
        }
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
        String oneDayAsFileName = dateFormat.format(new Date());
        File logFile = StorageUtil.getFileInCache(mContext, CommonConfigs.DEBUG_TRACE_DIR_NAME + mContext.getPackageName()
                +
//                CommonConfigs.DEBUG_TRACE_FILE_NAME
                "/"+
                //changed : 以天为文件名
                oneDayAsFileName
        );
        if (!logFile.exists()) {
            return;
        }
        try {
            PrintWriter pw = new PrintWriter(new FileWriter(logFile, true));
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA);
            Date now = new Date();
            String dateInfo = sdf.format(now) + " --- ";
            pw.println(dateInfo + message);
            pw.flush();
            pw.close();
        } catch (Exception e) {
            CommonLog.e("info", e);
        }
    }
 
源代码12 项目: AndroidHybridLib   文件: HybridCacheUtils.java
/**
 * 根据系统时间、前缀、后缀产生一个文件
 */
public static File createFile(File folder, String prefix, String suffix) {
    if (!folder.exists() || !folder.isDirectory()) folder.mkdirs();
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.CHINA);
    String filename = prefix + dateFormat.format(new Date(System.currentTimeMillis())) + suffix;
    return new File(folder, filename);
}
 
源代码13 项目: JAVA-HTTP-SDK   文件: AbstractAPI.java
private ObjectMapper initObjectMapper() {
    ObjectMapper objectMapper = new ObjectMapper();
    //关闭字段不识别报错
    objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    //调整默认时区为北京时间
    TimeZone timeZone = TimeZone.getTimeZone("GMT+8");
    DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA);
    dateFormat.setTimeZone(timeZone);
    objectMapper.setDateFormat(dateFormat);
    objectMapper.setTimeZone(timeZone);
    return objectMapper;
}
 
源代码14 项目: kAndroid   文件: DateUtil.java
/**
 *
 * @param dateString
 * @return
 */
public static Date getDateByByStringDate(String dateString) {
    if (TextUtils.isEmpty(dateString)) {
        return null;
    }
    DateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.CHINA);
    Date date = null;
    try {
        date = sdf.parse(dateString);
    } catch (ParseException e) {
    }
    return date;
}
 
源代码15 项目: Sunshine   文件: DateUtil.java
/**
 * 从字符串中获取月份【字符串形式类似2017-09-29 xx(后面无所谓)】
 *
 * @param dataStr 日期时间字符串
 * @return 月份(1月就是1,0代表解析错误的月份)
 */
public static int getMonthFromString(String dataStr) {
    Calendar calendar = Calendar.getInstance();
    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA);
    try {
        Date date = df.parse(dataStr);
        calendar.setTime(date);
        return calendar.get(Calendar.MONTH) + 1;
    } catch (ParseException e) {
        e.printStackTrace();
        return 0;
    }
}
 
源代码16 项目: jphp   文件: WrapLocale.java
@Signature
public static Memory CHINA(Environment env, Memory... args) {
    return new ObjectMemory(new WrapLocale(env, Locale.CHINA));
}
 
源代码17 项目: HeartBeat   文件: TimeUtils.java
public static String timeFormat(long timeMillis, String pattern){
    SimpleDateFormat format = new SimpleDateFormat(pattern, Locale.CHINA);
    return format.format(new Date(timeMillis));
}
 
源代码18 项目: MapForTour   文件: MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  SDKInitializer.initialize(getApplicationContext());
  setContentView(R.layout.activity_main);
  application = (DeviceMessageApplication) getApplication();
  //设置广播接收器
  mLocalBroadcastManager = LocalBroadcastManager.getInstance(this);
  IntentFilter intentFilter = new IntentFilter();
  intentFilter.addAction("cc.bitlight.broadcast.location.data");
  intentFilter.addAction("cc.bitlight.broadcast.nearbyinfo.data");
  intentFilter.addAction("cc.bitlight.broadcast.track.historytrack.draw");
  intentFilter.addAction("cc.bitlight.broadcast.geofence.reload");
  intentFilter.addAction("cc.bitlight.broadcast.geofence.notification");
  locationReceiver = new MainBroadCastReceiver();
  mLocalBroadcastManager.registerReceiver(locationReceiver, intentFilter);
  coordinatorLayoutContainer = (CoordinatorLayout) findViewById(R.id.coordinatorLayoutContainer);

  //界面UI布局
  setToolbarDrawerLayout();
  setTabLayout();

  //时间格式化
  simpleDateFormatDate = new SimpleDateFormat("yyyy-M-d H:mm", Locale.CHINA);
  calendar = Calendar.getInstance();
  //启动服务
  startService = new Intent(this, MapService.class);
  startService(startService);
  //界面UI刷新
  handler = new Handler() {
    @Override
    public void handleMessage(Message msg) {
      super.handleMessage(msg);
      switch (msg.what) {
        case MESSAGE_LOGIN_SUCCEED:
          optionMapFragment.setLoginSucceed();
          break;

        case UPDATE_NAVIGATIONVIEW_TIME_START:
          navigationViewItemTimeStart.setTitle("起始:" + simpleDateFormatDate.format(application.getdateStartTime()));
          break;

        case UPDATE_NAVIGATIONVIEW_TIME_END:
          navigationViewItemTimeEnd.setTitle("截止:" + simpleDateFormatDate.format(application.getdateEndTime()));

          Log.d("lml", "application.getMillisecondStartTime():" + (int) (application.getMillisecondStartTime() / 1000));

          Log.d("lml", "application.getMillisecondEndTime():" + (int) (application.getMillisecondEndTime() / 1000));

          Log.d("lml", "System.currentTimeMillis():" + (int) (System.currentTimeMillis() / 1000));
          break;

      }
    }
  };
}
 
源代码19 项目: WanAndroid   文件: ReadLaterAdapter.java
public ReadLaterAdapter(Context context, List<ReadLaterArticleData> list){
    this.context = context;
    inflater = LayoutInflater.from(this.context);
    mList = list;
    simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日", Locale.CHINA);
}
 
源代码20 项目: AccountBook   文件: DateUtils.java
/**
 * 将日期对象,格式化为指定日期格式的日期字符串。
 * @param c         日期对象
 * @param format    日期格式
 * @return 根据指定日期格式格式话后的字符串,如:2017-04-07
 */
public static String getDateText(Calendar c, String format){
    SimpleDateFormat f = new SimpleDateFormat(format != null ? format : FORMAT, Locale.CHINA);
    return f.format(c.getTime());
}