mirror of
https://codeberg.org/gitnex/GitNex.git
synced 2024-12-16 15:48:13 +08:00
Improving design of "Show more information" (#527)
Adding comments to editorconfig. Formatting. Adding link color attribute. Minor improvements. Use dedicated layout for additional information. Co-authored-by: opyale <opyale@noreply.gitea.io> Reviewed-by: 6543 <6543@noreply.codeberg.org>
This commit is contained in:
parent
546346ff48
commit
55473701b8
@ -10,6 +10,10 @@ max_line_length = 150
|
||||
[*.java]
|
||||
indent_style = tab
|
||||
max_line_length = 220
|
||||
line_comment = //
|
||||
block_comment_start = /*
|
||||
block_comment = *
|
||||
block_comment_end = */
|
||||
|
||||
[*.json]
|
||||
indent_size = 2
|
||||
|
@ -4,10 +4,34 @@ import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.Spanned;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.clients.RetrofitClient;
|
||||
import org.mian.gitnex.helpers.AlertDialogs;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.helpers.ClickListener;
|
||||
import org.mian.gitnex.helpers.TimeHelper;
|
||||
import org.mian.gitnex.helpers.Toasty;
|
||||
import org.mian.gitnex.models.UserRepositories;
|
||||
import org.mian.gitnex.util.AppUtil;
|
||||
import org.mian.gitnex.util.TinyDB;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import io.noties.markwon.AbstractMarkwonPlugin;
|
||||
import io.noties.markwon.Markwon;
|
||||
import io.noties.markwon.core.CorePlugin;
|
||||
@ -26,30 +50,6 @@ import io.noties.markwon.image.svg.SvgMediaDecoder;
|
||||
import io.noties.markwon.linkify.LinkifyPlugin;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import android.text.Spanned;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.clients.RetrofitClient;
|
||||
import org.mian.gitnex.helpers.AlertDialogs;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.helpers.ClickListener;
|
||||
import org.mian.gitnex.helpers.TimeHelper;
|
||||
import org.mian.gitnex.helpers.Toasty;
|
||||
import org.mian.gitnex.models.UserRepositories;
|
||||
import org.mian.gitnex.util.AppUtil;
|
||||
import org.mian.gitnex.util.TinyDB;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
@ -269,7 +269,7 @@ public class RepoInfoFragment extends Fragment {
|
||||
repoMetaSize.setText(AppUtil.formatFileSize(repoInfo.getSize()));
|
||||
}
|
||||
else {
|
||||
repoMetaSize.setText("0");
|
||||
repoMetaSize.setText("0 B");
|
||||
}
|
||||
|
||||
repoMetaCreatedAt.setText(TimeHelper.formatTime(repoInfo.getCreated_at(), new Locale(locale), timeFormat, ctx));
|
||||
@ -284,27 +284,42 @@ public class RepoInfoFragment extends Fragment {
|
||||
|
||||
repoAdditionalButton.setOnClickListener(v -> {
|
||||
|
||||
StringBuilder message = new StringBuilder();
|
||||
View view = LayoutInflater.from(ctx).inflate(R.layout.layout_repo_more_info, null);
|
||||
|
||||
message.append(getResources().getString(R.string.infoTabRepoDefaultBranch))
|
||||
.append(" :\n").append(repoInfo.getDefault_branch()).append("\n\n");
|
||||
TextView defaultBranchHeader = view.findViewById(R.id.defaultBranchHeader);
|
||||
TextView defaultBranchContent = view.findViewById(R.id.defaultBranchContent);
|
||||
|
||||
message.append(getResources().getString(R.string.infoTabRepoUpdatedAt))
|
||||
.append(" :\n").append(repoMetaUpdatedAt).append("\n\n");
|
||||
TextView lastUpdatedHeader = view.findViewById(R.id.lastUpdatedHeader);
|
||||
TextView lastUpdatedContent = view.findViewById(R.id.lastUpdatedContent);
|
||||
|
||||
message.append(getResources().getString(R.string.infoTabRepoSshUrl))
|
||||
.append(" :\n").append(repoInfo.getSsh_url()).append("\n\n");
|
||||
TextView sshUrlHeader = view.findViewById(R.id.sshUrlHeader);
|
||||
TextView sshUrlContent = view.findViewById(R.id.sshUrlContent);
|
||||
|
||||
message.append(getResources().getString(R.string.infoTabRepoCloneUrl))
|
||||
.append(" :\n").append(repoInfo.getClone_url()).append("\n\n");
|
||||
TextView cloneUrlHeader = view.findViewById(R.id.cloneUrlHeader);
|
||||
TextView cloneUrlContent = view.findViewById(R.id.cloneUrlContent);
|
||||
|
||||
message.append(getResources().getString(R.string.infoTabRepoRepoUrl))
|
||||
.append(" :\n").append(repoInfo.getHtml_url());
|
||||
TextView repoUrlHeader = view.findViewById(R.id.repoUrlHeader);
|
||||
TextView repoUrlContent = view.findViewById(R.id.repoUrlContent);
|
||||
|
||||
defaultBranchHeader.setText(getString(R.string.infoTabRepoDefaultBranch));
|
||||
defaultBranchContent.setText(repoInfo.getDefault_branch());
|
||||
|
||||
lastUpdatedHeader.setText(getString(R.string.infoTabRepoUpdatedAt));
|
||||
lastUpdatedContent.setText(repoMetaUpdatedAt);
|
||||
|
||||
sshUrlHeader.setText(getString(R.string.infoTabRepoSshUrl));
|
||||
sshUrlContent.setText(repoInfo.getSsh_url());
|
||||
|
||||
cloneUrlHeader.setText(getString(R.string.infoTabRepoCloneUrl));
|
||||
cloneUrlContent.setText(repoInfo.getClone_url());
|
||||
|
||||
repoUrlHeader.setText(getString(R.string.infoTabRepoRepoUrl));
|
||||
repoUrlContent.setText(repoInfo.getHtml_url());
|
||||
|
||||
AlertDialog.Builder alertDialog = new AlertDialog.Builder(ctx);
|
||||
|
||||
alertDialog.setTitle(getResources().getString(R.string.infoMoreInformation));
|
||||
alertDialog.setMessage(message);
|
||||
alertDialog.setView(view);
|
||||
alertDialog.setPositiveButton(getResources().getString(R.string.close), (dialog, which) -> dialog.dismiss());
|
||||
alertDialog.create().show();
|
||||
|
||||
|
116
app/src/main/res/layout/layout_repo_more_info.xml
Normal file
116
app/src/main/res/layout/layout_repo_more_info.xml
Normal file
@ -0,0 +1,116 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="25dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/defaultBranchHeader"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/defaultBranchContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?attr/primaryTextColor" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="15dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lastUpdatedHeader"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lastUpdatedContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?attr/primaryTextColor" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="15dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sshUrlHeader"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sshUrlContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?attr/primaryTextColor" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="15dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cloneUrlHeader"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cloneUrlContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:autoLink="web"
|
||||
android:textColorLink="@color/lightBlue"
|
||||
android:textColor="?attr/primaryTextColor" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="15dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/repoUrlHeader"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/repoUrlContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:autoLink="web"
|
||||
android:textColorLink="@color/lightBlue"
|
||||
android:textColor="?attr/primaryTextColor" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
Loading…
Reference in New Issue
Block a user