From 3fc26be6dcaf707d6af13b9c610b71e8686df8c2 Mon Sep 17 00:00:00 2001 From: Filip Date: Tue, 13 Feb 2018 20:33:33 +0100 Subject: [PATCH] Added quote and entry reply buttons. Beta 0.6 (Finally!) --- app/build.gradle | 7 ++++--- app/src/main/AndroidManifest.xml | 4 ---- .../github/feelfreelinux/wykopmobilny/WykopApp.kt | 2 ++ .../ui/adapters/EntryCommentAdapter.kt | 2 +- .../ui/adapters/EntryDetailAdapter.kt | 7 +++++-- .../wykopmobilny/ui/adapters/EntryLinkAdapter.kt | 2 +- .../wykopmobilny/ui/adapters/FeedAdapter.kt | 2 +- .../ui/adapters/viewholders/CommentViewHolder.kt | 4 +++- .../ui/adapters/viewholders/EntryViewHolder.kt | 4 +++- .../ui/modules/input/BaseInputActivity.kt | 5 ++++- .../mikroblog/entry/EntryDetailActivity.kt | 3 +++ .../NotificationsListViewPagerAdapter.kt | 2 +- .../wykopmobilny/ui/widgets/InputToolbar.kt | 9 +++++++++ .../wykopmobilny/ui/widgets/entry/EntryWidget.kt | 8 +++++++- .../ui/widgets/entry/comment/CommentWidget.kt | 3 +++ .../wykopmobilny/utils/Extensions.kt | 15 +++++++++++++++ .../wykopmobilny/utils/api/ApiUtils.kt | 8 ++++++++ app/src/main/res/layout/entry_comment_layout.xml | 9 +++++++++ app/src/main/res/layout/entry_layout.xml | 9 +++++++++ app/src/main/res/values/strings.xml | 1 + 20 files changed, 89 insertions(+), 17 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 3bafcb12b..761c45e01 100755 --- a/app/build.gradle +++ b/app/build.gradle @@ -28,8 +28,8 @@ android { applicationId "io.github.feelfreelinux.wykopmobilny" minSdkVersion 17 targetSdkVersion 27 - versionCode 26 - versionName "0.5.4" + versionCode 27 + versionName "0.6" def credentialsPropertiesFile = rootProject.file("credentials.properties") def credentialsProperties = new Properties() @@ -90,7 +90,7 @@ dependencies { implementation "com.android.support:support-v4:$versions.supportLibrary" implementation "com.android.support:customtabs:$versions.supportLibrary" implementation "com.android.support.constraint:constraint-layout:$versions.constraintLayout" - + implementation "com.google.android.gms:play-services-gcm:11.6.0" // Utils implementation "com.bugsnag:bugsnag-android:4.1.3" implementation "org.ocpsoft.prettytime:prettytime:$versions.prettytime" @@ -107,6 +107,7 @@ dependencies { // RxJava implementation "io.reactivex.rxjava2:rxandroid:$versions.rxandroid" implementation "io.reactivex.rxjava2:rxjava:$versions.rxjava" + implementation 'com.jakewharton.threetenabp:threetenabp:1.0.5' // AppUpdater implementation "com.github.javiersantos:AppUpdater:$versions.appUpdater" diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 5242f88f3..2369756aa 100755 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -93,10 +93,6 @@ android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider_paths"/> - - diff --git a/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/WykopApp.kt b/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/WykopApp.kt index 3ad5f85e2..dbb06868e 100755 --- a/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/WykopApp.kt +++ b/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/WykopApp.kt @@ -3,6 +3,7 @@ package io.github.feelfreelinux.wykopmobilny import android.content.Context import com.bugsnag.android.Bugsnag import com.evernote.android.job.JobManager +import com.jakewharton.threetenabp.AndroidThreeTen import com.squareup.leakcanary.LeakCanary import com.squareup.leakcanary.RefWatcher import dagger.android.AndroidInjector @@ -31,6 +32,7 @@ class WykopApp : DaggerApplication() { override fun onCreate() { super.onCreate() + AndroidThreeTen.init(this) refWatcher = LeakCanary.install(this) JobManager.create(this).addJobCreator(jobCreator) if (!BuildConfig.DEBUG) { diff --git a/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/adapters/EntryCommentAdapter.kt b/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/adapters/EntryCommentAdapter.kt index 5893b3f01..6c011bc87 100755 --- a/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/adapters/EntryCommentAdapter.kt +++ b/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/adapters/EntryCommentAdapter.kt @@ -26,7 +26,7 @@ class EntryCommentAdapter @Inject constructor(val presenterFactory: CommentPrese } override fun createViewHolder(parent: ViewGroup): CommentViewHolder = - CommentViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.comment_list_item, parent, false), {}, settingsPreferencesApi, userManagerApi, presenterFactory.create()) + CommentViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.comment_list_item, parent, false), {}, {}, settingsPreferencesApi, userManagerApi, presenterFactory.create()) override fun onViewRecycled(holder: RecyclerView.ViewHolder?) { (holder as? RecyclableViewHolder)?.cleanRecycled() diff --git a/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/adapters/EntryDetailAdapter.kt b/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/adapters/EntryDetailAdapter.kt index f90eed36f..d268020ef 100755 --- a/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/adapters/EntryDetailAdapter.kt +++ b/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/adapters/EntryDetailAdapter.kt @@ -6,6 +6,7 @@ import android.view.ViewGroup import io.github.feelfreelinux.wykopmobilny.R import io.github.feelfreelinux.wykopmobilny.models.dataclass.Author import io.github.feelfreelinux.wykopmobilny.models.dataclass.Entry +import io.github.feelfreelinux.wykopmobilny.models.dataclass.EntryComment import io.github.feelfreelinux.wykopmobilny.ui.adapters.viewholders.CommentViewHolder import io.github.feelfreelinux.wykopmobilny.ui.adapters.viewholders.EntryViewHolder import io.github.feelfreelinux.wykopmobilny.ui.adapters.viewholders.RecyclableViewHolder @@ -24,6 +25,8 @@ class EntryDetailAdapter @Inject constructor(val userManagerApi: UserManagerApi, private const val COMMENT_HOLDER = 1 } lateinit var addReceiverListener: (Author) -> Unit + lateinit var quoteCommentListener: (EntryComment) -> Unit + var entry: Entry? = null var commentId : Int? = null @@ -52,8 +55,8 @@ class EntryDetailAdapter @Inject constructor(val userManagerApi: UserManagerApi, override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { return when (viewType) { - ENTRY_HOLDER -> EntryViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.entry_list_item, parent, false), userManagerApi, settingsPreferencesApi, entryPresenterFactory.create()) - else -> CommentViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.comment_list_item, parent, false), addReceiverListener, settingsPreferencesApi, userManagerApi, commentPresenterFactory.create()) + ENTRY_HOLDER -> EntryViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.entry_list_item, parent, false), userManagerApi, addReceiverListener, settingsPreferencesApi, entryPresenterFactory.create()) + else -> CommentViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.comment_list_item, parent, false), addReceiverListener, quoteCommentListener, settingsPreferencesApi, userManagerApi, commentPresenterFactory.create()) } } diff --git a/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/adapters/EntryLinkAdapter.kt b/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/adapters/EntryLinkAdapter.kt index ba5f290f8..890a56605 100755 --- a/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/adapters/EntryLinkAdapter.kt +++ b/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/adapters/EntryLinkAdapter.kt @@ -29,7 +29,7 @@ class EntryLinkAdapter @Inject constructor(val userManagerApi: UserManagerApi, v override fun createViewHolder(viewType: Int, parent: ViewGroup): RecyclerView.ViewHolder = when (viewType) { - ENTRY_VIEWTYPE -> EntryViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.entry_list_item, parent, false), userManagerApi, settingsPreferencesApi, entryPresenterFactory.create()) + ENTRY_VIEWTYPE -> EntryViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.entry_list_item, parent, false), userManagerApi, null, settingsPreferencesApi, entryPresenterFactory.create()) else -> LinkViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.link_layout, parent, false)) } diff --git a/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/adapters/FeedAdapter.kt b/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/adapters/FeedAdapter.kt index 1dc91ab04..7ae5bd3d5 100755 --- a/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/adapters/FeedAdapter.kt +++ b/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/adapters/FeedAdapter.kt @@ -19,7 +19,7 @@ class FeedAdapter @Inject constructor(val userManagerApi: UserManagerApi, val se } override fun createViewHolder(parent: ViewGroup): EntryViewHolder = - EntryViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.entry_list_item, parent, false), userManagerApi, settingsPreferencesApi, entryPresenterFactory.create()) + EntryViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.entry_list_item, parent, false), userManagerApi, null, settingsPreferencesApi, entryPresenterFactory.create()) override fun onViewRecycled(holder: RecyclerView.ViewHolder?) { (holder as? RecyclableViewHolder)?.cleanRecycled() diff --git a/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/adapters/viewholders/CommentViewHolder.kt b/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/adapters/viewholders/CommentViewHolder.kt index a9ea84093..d50dc604e 100755 --- a/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/adapters/viewholders/CommentViewHolder.kt +++ b/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/adapters/viewholders/CommentViewHolder.kt @@ -12,12 +12,13 @@ import io.github.feelfreelinux.wykopmobilny.utils.usermanager.UserManagerApi import kotlinx.android.synthetic.main.comment_list_item.view.* import kotlinx.android.synthetic.main.entry_comment_layout.view.* -class CommentViewHolder(val view: View, private val addReceiverListener : (Author) -> Unit, val settingsPreferencesApi: SettingsPreferencesApi, val userManagerApi: UserManagerApi, val commentPresenter: CommentPresenter) : RecyclableViewHolder(view) { +class CommentViewHolder(val view: View, private val addReceiverListener : (Author) -> Unit, val quoteListener : (EntryComment) -> Unit, val settingsPreferencesApi: SettingsPreferencesApi, val userManagerApi: UserManagerApi, val commentPresenter: CommentPresenter) : RecyclableViewHolder(view) { fun bindView(comment : EntryComment, isAuthorComment: Boolean, commentId : Int?, shouldEnableClickListener : Boolean = false) { view.entryComment.shouldEnableClickListener = shouldEnableClickListener view.entryComment.addReceiverListener = addReceiverListener view.entryComment.setCommentData(comment, userManagerApi, settingsPreferencesApi, commentPresenter) view.entryComment.setStyleForComment(isAuthorComment, commentId ?: -1) + view.entryComment.quoteCommentListener = quoteListener } override fun cleanRecycled() { @@ -26,6 +27,7 @@ class CommentViewHolder(val view: View, private val addReceiverListener : (Autho view.entryComment.shouldEnableClickListener = false view.entryComment.entryContentTextView.text = null view.entryComment.addReceiverListener = null + view.entryComment.quoteCommentListener = null view.entryComment.setOnClickListener(null) } } diff --git a/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/adapters/viewholders/EntryViewHolder.kt b/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/adapters/viewholders/EntryViewHolder.kt index 7d6dd8e2e..e3189df8f 100755 --- a/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/adapters/viewholders/EntryViewHolder.kt +++ b/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/adapters/viewholders/EntryViewHolder.kt @@ -3,6 +3,7 @@ package io.github.feelfreelinux.wykopmobilny.ui.adapters.viewholders import android.support.v7.widget.RecyclerView import android.view.View import io.github.feelfreelinux.wykopmobilny.glide.GlideApp +import io.github.feelfreelinux.wykopmobilny.models.dataclass.Author import io.github.feelfreelinux.wykopmobilny.models.dataclass.Entry import io.github.feelfreelinux.wykopmobilny.ui.widgets.entry.EntryPresenter import io.github.feelfreelinux.wykopmobilny.utils.SettingsPreferencesApi @@ -11,10 +12,11 @@ import kotlinx.android.synthetic.main.entry_layout.view.* import kotlinx.android.synthetic.main.entry_list_item.view.* -class EntryViewHolder(val view: View, val userManagerApi: UserManagerApi, val settingsPreferencesApi: SettingsPreferencesApi, val entryPresenter: EntryPresenter) : RecyclableViewHolder(view) { +class EntryViewHolder(val view: View, val userManagerApi: UserManagerApi, val entryReplyListener : ((Author) -> Unit)?, val settingsPreferencesApi: SettingsPreferencesApi, val entryPresenter: EntryPresenter) : RecyclableViewHolder(view) { fun bindView(entry : Entry, enableClickListener : Boolean = true) { view.entry.apply { shouldEnableClickListener = enableClickListener + replyListener = entryReplyListener setEntryData(entry, userManagerApi, settingsPreferencesApi, entryPresenter) } } diff --git a/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/modules/input/BaseInputActivity.kt b/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/modules/input/BaseInputActivity.kt index 718bde531..5770ac331 100755 --- a/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/modules/input/BaseInputActivity.kt +++ b/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/modules/input/BaseInputActivity.kt @@ -67,7 +67,10 @@ abstract class BaseInputActivity : BaseActivity(), BaseI if (contains(" resources.getString(R.string.notifications_title) + 0 -> resources.getString(R.string.notifications_directed) else -> resources.getString(R.string.hashtags_notifications_title) } } diff --git a/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/widgets/InputToolbar.kt b/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/widgets/InputToolbar.kt index d5cecfd33..0a2c887c4 100755 --- a/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/widgets/InputToolbar.kt +++ b/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/widgets/InputToolbar.kt @@ -9,11 +9,13 @@ import android.view.View import io.github.feelfreelinux.wykopmobilny.R import io.github.feelfreelinux.wykopmobilny.api.entries.TypedInputStream import io.github.feelfreelinux.wykopmobilny.api.suggest.SuggestApi +import io.github.feelfreelinux.wykopmobilny.models.dataclass.Author import io.github.feelfreelinux.wykopmobilny.ui.suggestions.HashTagsSuggestionsAdapter import io.github.feelfreelinux.wykopmobilny.ui.suggestions.UsersSuggestionsAdapter import io.github.feelfreelinux.wykopmobilny.ui.suggestions.WykopSuggestionsTokenizer import io.github.feelfreelinux.wykopmobilny.ui.widgets.markdown_toolbar.MarkdownToolbarListener import io.github.feelfreelinux.wykopmobilny.utils.isVisible +import io.github.feelfreelinux.wykopmobilny.utils.textview.removeHtml import io.github.feelfreelinux.wykopmobilny.utils.usermanager.UserManagerApi import kotlinx.android.synthetic.main.input_toolbar.view.* @@ -149,6 +151,13 @@ class InputToolbar : ConstraintLayout, MarkdownToolbarListener { selectionPosition = textBody.length } + fun addQuoteText(quote : String, quoteAuthor : String) { + defaultText = "" + body.requestFocus() + textBody += "\n> @$quoteAuthor: ${quote.removeHtml()}" + selectionPosition = textBody.length + } + fun setCustomHint(hint : String) { body.hint = hint } diff --git a/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/widgets/entry/EntryWidget.kt b/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/widgets/entry/EntryWidget.kt index c61240eaa..aa236d189 100755 --- a/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/widgets/entry/EntryWidget.kt +++ b/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/widgets/entry/EntryWidget.kt @@ -12,6 +12,7 @@ import android.util.TypedValue import android.view.Gravity import android.view.View import io.github.feelfreelinux.wykopmobilny.R +import io.github.feelfreelinux.wykopmobilny.models.dataclass.Author import io.github.feelfreelinux.wykopmobilny.models.dataclass.Entry import io.github.feelfreelinux.wykopmobilny.models.dataclass.Survey import io.github.feelfreelinux.wykopmobilny.models.dataclass.Voter @@ -35,6 +36,7 @@ class EntryWidget(context: Context, attrs: AttributeSet) : CardView(context, att private lateinit var settingsPreferencesApi : SettingsPreferencesApi private lateinit var votersDialogListener : (List) -> Unit var shouldEnableClickListener = true + var replyListener : ((Author) -> Unit)? = null init { View.inflate(context, R.layout.entry_layout, this) @@ -85,11 +87,15 @@ class EntryWidget(context: Context, attrs: AttributeSet) : CardView(context, att } } - + replyTextView.isVisible = !shouldEnableClickListener if (shouldEnableClickListener) { + replyTextView.setOnClickListener(null) setOnClickListener { presenter.openDetails(entry.embed?.isRevealed ?: false) } + } else { + replyTextView.setOnClickListener { replyListener?.invoke(entry.author) } + } voteButton.apply { diff --git a/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/widgets/entry/comment/CommentWidget.kt b/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/widgets/entry/comment/CommentWidget.kt index e512e8d4a..6be012580 100755 --- a/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/widgets/entry/comment/CommentWidget.kt +++ b/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/widgets/entry/comment/CommentWidget.kt @@ -36,6 +36,8 @@ class CommentWidget : CardView, CommentView { lateinit var comment : EntryComment var addReceiverListener: ((Author) -> Unit)? = null + var quoteCommentListener: ((EntryComment) -> Unit)? = null + lateinit var presenter : CommentPresenter var shouldEnableClickListener = false private lateinit var userManagerApi: UserManagerApi @@ -100,6 +102,7 @@ class CommentWidget : CardView, CommentView { private fun setupBody() { moreOptionsTextView.setOnClickListener { openOptionsMenu() } replyTextView.setOnClickListener { addReceiver() } + quoteTextView.setOnClickListener { quoteCommentListener?.invoke(comment) } val clickListener = { presenter.handleLink(url) } if (shouldEnableClickListener) setOnClickListener { clickListener() } if (comment.body.isNotEmpty()) { diff --git a/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/utils/Extensions.kt b/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/utils/Extensions.kt index 5be92f3df..baa24df0b 100755 --- a/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/utils/Extensions.kt +++ b/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/utils/Extensions.kt @@ -14,13 +14,19 @@ import android.webkit.MimeTypeMap import android.widget.ImageView import com.bumptech.glide.GenericTransitionOptions import com.bumptech.glide.load.DataSource +import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.load.engine.GlideException import com.bumptech.glide.request.RequestListener import com.bumptech.glide.request.target.Target import io.github.feelfreelinux.wykopmobilny.R import io.github.feelfreelinux.wykopmobilny.glide.GlideApp import io.github.feelfreelinux.wykopmobilny.utils.api.parseDate +import io.github.feelfreelinux.wykopmobilny.utils.api.parseDateJavaTime import org.ocpsoft.prettytime.PrettyTime +import org.threeten.bp.Duration +import org.threeten.bp.Instant +import org.threeten.bp.LocalDate +import org.threeten.bp.Period import java.util.* @@ -64,6 +70,7 @@ fun View.disableFor(millis: Long){ fun ImageView.loadImage(url : String) { GlideApp.with(context) .load(url) + .diskCacheStrategy(DiskCacheStrategy.ALL) .override(Target.SIZE_ORIGINAL) .into(this) } @@ -72,6 +79,14 @@ fun String.toPrettyDate() : String { return PrettyTime(Locale("pl")).format(parseDate(this)) } fun String.toDurationPrettyDate() : String { + val duration = Period.between(parseDateJavaTime(this), LocalDate.now()) + if (duration.years > 1 && duration.months > 0) { + return "${duration.years} lata ${duration.months} mies." + } else if (duration.years == 1 && duration.months > 0) { + return "${duration.years} rok ${duration.months} mies." + } else if (duration.years == 0) { + return "${duration.months} mies." + } return PrettyTime(Locale("pl")).formatDurationUnrounded(parseDate(this)) } fun Uri.queryFileName(contentResolver: ContentResolver) : String { diff --git a/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/utils/api/ApiUtils.kt b/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/utils/api/ApiUtils.kt index d93047e09..05abbee07 100755 --- a/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/utils/api/ApiUtils.kt +++ b/app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/utils/api/ApiUtils.kt @@ -6,6 +6,9 @@ import android.net.Uri import android.util.TypedValue import io.github.feelfreelinux.wykopmobilny.R import io.github.feelfreelinux.wykopmobilny.utils.printout +import org.threeten.bp.LocalDate +import org.threeten.bp.ZoneId +import org.threeten.bp.format.DateTimeFormatter import java.security.MessageDigest import java.text.SimpleDateFormat import java.util.* @@ -16,6 +19,11 @@ fun parseDate(date : String) : Date { return format.parse(date) } +fun parseDateJavaTime(date : String) : LocalDate { + val format = DateTimeFormatter.ofPattern("yyyy-MM-dd kk:mm:ss", Locale.GERMANY) + return LocalDate.parse(date, format.withZone(ZoneId.of("Europe/Warsaw"))) +} + fun getGroupColor(role : Int, isUsingDarkTheme : Boolean = true) : Int = when(role) { 0 -> Color.parseColor("#339933") 1 -> Color.parseColor("#ff5917") diff --git a/app/src/main/res/layout/entry_comment_layout.xml b/app/src/main/res/layout/entry_comment_layout.xml index 356ebe771..2f2c710c1 100755 --- a/app/src/main/res/layout/entry_comment_layout.xml +++ b/app/src/main/res/layout/entry_comment_layout.xml @@ -87,6 +87,15 @@ app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent"/> + + + + Najnowsze komentarze Najlepsze komentarze Najstarsze komentarze + Do mnie Komentowane Wykopywane