[Frontport] Fix date and minor ui improvements (#774)

Fix date and minor ui improvements

Co-authored-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: M M Arif <mmarif@swatian.com>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/774
Reviewed-by: 6543 <6543@noreply.codeberg.org>
This commit is contained in:
M M Arif 2020-11-17 05:40:58 +01:00 committed by 6543
parent e9fa2984a1
commit 3aa819f3ef
3 changed files with 29 additions and 12 deletions

View File

@ -24,6 +24,7 @@ import org.mian.gitnex.clients.RetrofitClient;
import org.mian.gitnex.fragments.BottomSheetReplyFragment;
import org.mian.gitnex.helpers.AlertDialogs;
import org.mian.gitnex.helpers.AppUtil;
import org.mian.gitnex.helpers.ClickListener;
import org.mian.gitnex.helpers.Markdown;
import org.mian.gitnex.helpers.RoundedTransformation;
import org.mian.gitnex.helpers.TimeHelper;
@ -308,6 +309,7 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<IssueCommentsAdap
@Override
public void onBindViewHolder(@NonNull IssueCommentsAdapter.IssueCommentViewHolder holder, int position) {
String timeFormat = tinyDB.getString("dateFormat");
IssueComments issueComment = issuesComments.get(position);
holder.issueComment = issueComment;
@ -323,15 +325,30 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<IssueCommentsAdap
new Markdown(ctx, EmojiParser.parseToUnicode(issueComment.getBody()), holder.comment);
StringBuilder informationBuilder = new StringBuilder(TimeHelper.formatTime(issueComment.getCreated_at(), Locale.getDefault(), "pretty", ctx));
StringBuilder informationBuilder = null;
if(issueComment.getCreated_at() != null) {
if(!issueComment.getCreated_at().equals(issueComment.getUpdated_at())) {
if(timeFormat.equals("pretty")) {
informationBuilder.append(ctx.getString(R.string.colorfulBulletSpan))
.append(ctx.getString(R.string.modifiedText));
informationBuilder = new StringBuilder(TimeHelper.formatTime(issueComment.getCreated_at(), Locale.getDefault(), "pretty", ctx));
holder.information
.setOnClickListener(new ClickListener(TimeHelper.customDateFormatForToastDateFormat(issueComment.getCreated_at()), ctx));
}
else if(timeFormat.equals("normal")) {
informationBuilder = new StringBuilder(TimeHelper.formatTime(issueComment.getCreated_at(), Locale.getDefault(), "normal", ctx));
}
if(!issueComment.getCreated_at().equals(issueComment.getUpdated_at())) {
if(informationBuilder != null) {
informationBuilder.append(ctx.getString(R.string.colorfulBulletSpan)).append(ctx.getString(R.string.modifiedText));
}
}
}
holder.information.setText(informationBuilder.toString());
holder.information.setText(informationBuilder);
Bundle bundle1 = new Bundle();
bundle1.putAll(bundle);

View File

@ -210,16 +210,16 @@
android:gravity="start"
android:text="@string/createdText"
android:visibility="gone"
android:textColor="?attr/primaryTextColor"
android:textSize="12sp" />
android:textColor="?attr/hintColor"
android:textSize="14sp" />
<TextView
android:id="@+id/issueModified"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?attr/primaryTextColor"
android:textColor="?attr/hintColor"
android:layout_toEndOf="@+id/issueCreatedTime"
android:textSize="12sp"
android:textSize="14sp"
android:visibility="gone"
android:text="@string/modifiedText" />

View File

@ -6,7 +6,7 @@
android:layout_height="wrap_content"
android:background="?attr/primaryBackgroundColor"
android:orientation="vertical"
android:padding="20dp">
android:padding="16dp">
<LinearLayout
android:layout_width="match_parent"
@ -48,7 +48,7 @@
android:ellipsize="end"
android:singleLine="true"
android:textColor="?attr/hintColor"
android:textSize="15sp" />
android:textSize="14sp" />
</LinearLayout>
<ImageView
@ -66,7 +66,7 @@
android:id="@+id/comment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginTop="12dp"
android:textColor="?attr/primaryTextColor"
android:textIsSelectable="true"
android:autoLink="web"