Skip to content

Commit

Permalink
Fixing the time on Notes
Browse files Browse the repository at this point in the history
  • Loading branch information
BijoySingh committed Jan 31, 2018
1 parent 2727f05 commit 16c8750
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ public CharSequence getLockedText(Context context, boolean isMarkdownEnabled) {

public String getDisplayTime() {
long time = updateTimestamp != 0 ? updateTimestamp : (timestamp == null ? 0 : timestamp);
return DateFormatter.getDate("dd MMMM yyyy", time);
String format = (Calendar.getInstance().getTimeInMillis() - time < 1000 * 60 * 60 * 2)
? "hh:mm aa" : "dd MMM";
return DateFormatter.getDate(format, time);
}

public List<Format> getFormats() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import android.os.Bundle
import android.support.v4.content.ContextCompat
import android.support.v7.widget.CardView
import android.view.View
import android.view.View.GONE
import android.view.View.VISIBLE
import android.widget.ImageView
import android.widget.TextView
import com.bijoysingh.quicknote.R
Expand Down Expand Up @@ -63,13 +65,18 @@ open class NoteRecyclerViewHolderBase(context: Context, view: View) : RecyclerVi

pinIndicator.visibility = if (data.pinned) View.VISIBLE else View.GONE

val noteTimestamp = data.displayTime
if (!TextUtils.isNullOrEmpty(data.tags)) {
tags.setTextColor(ContextCompat.getColor(context, R.color.light_secondary_text))
val source = Markwon.markdown(context, data.getTagString(context))
tags.setText(trim(source))
} else {
tags.text = trim(source)
tags.visibility = VISIBLE
} else if (!TextUtils.isNullOrEmpty(noteTimestamp)) {
tags.setTextColor(ContextCompat.getColor(context, R.color.light_hint_text))
tags.text = data.displayTime
tags.text = noteTimestamp
tags.visibility = VISIBLE
} else {
tags.visibility = GONE
}

view.setOnClickListener { viewClick(data, extra) }
Expand Down

0 comments on commit 16c8750

Please sign in to comment.