Java Code Examples for com.blankj.utilcode.util.TimeUtils#getNowMills()

The following examples show how to use com.blankj.utilcode.util.TimeUtils#getNowMills() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EditNotePresenter.java    From SuperNote with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void initData() {
    Intent intent = mView.getActivityIntent();
    mIsAdd = intent.getBooleanExtra("is_add", false);
    if (mIsAdd) {
        mNoteId = UUID.randomUUID().toString();
        mModifiedTime = TimeUtils.getNowMills();
        mNoteContent = new String("");
    } else {
        mPosition = intent.getIntExtra("position", 0);
        mNoteId = intent.getStringExtra("note_id");
        mModifiedTime = intent.getLongExtra("modified_time", 0);
        mNoteContent = intent.getStringExtra("note_content");
    }
    mView.setTitle(TimeUtils.millis2String(mModifiedTime));
}
 
Example 2
Source File: DataPickBean.java    From DoraemonKit with Apache License 2.0 5 votes vote down vote up
DataPickBean() {
    //初始化基础数据
    this.pId = DokitConstant.PRODUCT_ID;
    this.appName = AppUtils.getAppName();
    this.appId = AppUtils.getAppPackageName();
    this.dokitVersion = BuildConfig.DOKIT_VERSION;
    this.platform = "Android";
    this.phoneMode = DeviceUtils.getModel();
    this.time = "" + TimeUtils.getNowMills();
    this.systemVersion = DeviceUtils.getSDKVersionName();
    this.language = Locale.getDefault().getDisplayLanguage();
}
 
Example 3
Source File: SharePresenter.java    From SuperNote with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Uri saveImageAndGetUri() {
    String filePath = mView.getActivity().getExternalFilesDir("share").getPath() + "/" + TimeUtils.getNowMills() + ".jpg";
    File file = new File(filePath);
    ImageUtils.save(mBitmap, file, Bitmap.CompressFormat.JPEG);
    return Uri.fromFile(file);
}
 
Example 4
Source File: RvNoteListAdapter.java    From SuperNote with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 设置便签的时间显示格式:
 * 便签修改时间与当前时间对比,
 * 同一天的显示为:HH:mm;
 * 同一年的显示为:MM-DD HH:mm
 * 其他显示为:yyyy-MM-DD HH:mm
 *
 * @param time 时间戳
 * @describe
 */
private void setNoteTime(BaseViewHolder helper, long time) {

    // 系统当前时间,用于与便签的修改时间进行对比
    long nowTime = TimeUtils.getNowMills();

    if (DateUtils.isInSameDay(nowTime, time))  // 同一天
        setNoteTimeInfo(helper, time, new SimpleDateFormat("HH:mm"));
    else if (DateUtils.isInSameYear(nowTime, time))  // 同一年
        setNoteTimeInfo(helper, time, new SimpleDateFormat("MM-dd HH:mm"));
    else // 其他
        setNoteTimeInfo(helper, time, new SimpleDateFormat("yyyy-MM-dd HH:mm"));

}
 
Example 5
Source File: RvNoteListAdapter.java    From SuperNote with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 设置线性布局时的分组的格式
 *
 * @describe
 */
private void setLinearGroupStyle(BaseViewHolder helper, long time) {
    long nowTime = TimeUtils.getNowMills();

    if (DateUtils.isInSameYear(nowTime, time)) { // 如果同一年 显示为:x月
        helper.setText(R.id.tv_note_list_linear_month, TimeUtils.millis2String(time, new SimpleDateFormat("MM月")));
    } else { //否则 显示为:xxxx年x月
        helper.setText(R.id.tv_note_list_linear_month, TimeUtils.millis2String(time, new SimpleDateFormat("yyyy年MM月")));
    }
}
 
Example 6
Source File: DataPickBean.java    From DoraemonKit with Apache License 2.0 4 votes vote down vote up
EventBean(String eventName) {
    this.eventName = eventName;
    this.time = "" + TimeUtils.getNowMills();
}
 
Example 7
Source File: SharePresenter.java    From SuperNote with GNU General Public License v3.0 4 votes vote down vote up
private void saveImageToLocation(Bitmap bitmap) {
    File file = new File(Constans.imageSaveFolder + "/" + TimeUtils.getNowMills() + ".jpg");
    ImageUtils.save(bitmap, file, Bitmap.CompressFormat.JPEG);
    ToastUtils.showLong("已保存至" + "/SuperNote/Image/" + "中");
}
 
Example 8
Source File: NoteModel.java    From SuperNote with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void initNote(int folderId) {

    long years = (long)12 * 30 * 24 * 60 * 60 * 1000;
    long month =(long) 24 * 60 * 60 * 1000 * 30;
    long days = (long)24 * 60 * 60 * 1000;
    long m=(long)60*1000;

    long time = TimeUtils.getNowMills();


    Note note2 = new Note();
    note2.setCreatedTime(time-m-m-m-m);
    note2.setModifiedTime(time-m-m-m-m);
    note2.setNoteFolderId(folderId);
    note2.setNoteContent(Utils.getContext().getResources().getString(R.string.database_content_three));
    note2.setIsPrivacy(0);
    note2.setInRecycleBin(0);
    note2.setNoteId(UUID.randomUUID().toString());
    note2.save();

    Note note3 = new Note();
    note3.setCreatedTime(time-m-m-m);
    note3.setModifiedTime(time-m-m-m);
    note3.setNoteFolderId(folderId);
    note3.setNoteContent(Utils.getContext().getResources().getString(R.string.database_content_four));
    note3.setIsPrivacy(0);
    note3.setInRecycleBin(0);
    note3.setNoteId(UUID.randomUUID().toString());
    note3.save();

    Note note4 = new Note();
    note4.setCreatedTime(time-m-m);
    note4.setModifiedTime(time -m-m);
    note4.setNoteFolderId(folderId);
    note4.setNoteContent(Utils.getContext().getResources().getString(R.string.database_content_five));
    note4.setIsPrivacy(0);
    note4.setInRecycleBin(0);
    note4.setNoteId(UUID.randomUUID().toString());
    note4.save();

    Note note5 = new Note();
    note5.setCreatedTime(time -m);
    note5.setModifiedTime(time -m);
    note5.setNoteContent(Utils.getContext().getResources().getString(R.string.database_content_one));
    note5.setNoteFolderId(folderId);
    note5.setIsPrivacy(0);
    note5.setInRecycleBin(0);
    note5.setNoteId(UUID.randomUUID().toString());
    note5.save();

    Note note1 = new Note();
    note1.setCreatedTime(time );
    note1.setModifiedTime(time );
    note1.setNoteFolderId(folderId);
    note1.setNoteContent(Utils.getContext().getResources().getString(R.string.database_content_two));
    note1.setIsPrivacy(0);
    note1.setInRecycleBin(0);
    note1.setNoteId(UUID.randomUUID().toString());
    note1.save();


}