reduce large links in branches and releases to small text with links.

Signed-off-by: M M Arif <mmarif@swatian.com>
This commit is contained in:
M M Arif 2019-09-16 20:28:34 +05:00
parent e8e0cf904b
commit b4c0745b40
8 changed files with 31 additions and 10 deletions

View File

@ -1,12 +1,13 @@
package org.mian.gitnex.adapters;
import android.content.Context;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import org.mian.gitnex.R;
import org.mian.gitnex.helpers.UrlHelper;
import org.mian.gitnex.models.Branches;
import org.mian.gitnex.util.TinyDB;
import java.util.List;
@ -66,7 +67,9 @@ public class BranchesAdapter extends RecyclerView.Adapter<BranchesAdapter.Branch
holder.branchCommitAuthor.setText(mCtx.getResources().getString(R.string.commitAuthor, currentItem.getCommit().getAuthor().getUsername()));
}
holder.branchCommitHash.setText(mCtx.getResources().getString(R.string.commitHash, "", currentItem.getCommit().getUrl()));
holder.branchCommitHash.setText(
Html.fromHtml("<a href='" + currentItem.getCommit().getUrl() + "'>" + mCtx.getResources().getString(R.string.commitLinkBranchesTab) + "</a> "));
holder.branchCommitHash.setMovementMethod(LinkMovementMethod.getInstance());
}

View File

@ -2,6 +2,8 @@ package org.mian.gitnex.adapters;
import android.content.Context;
import android.graphics.Color;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -139,8 +141,14 @@ public class ReleasesAdapter extends RecyclerView.Adapter<ReleasesAdapter.Releas
else {
holder.releaseDescription.setVisibility(View.GONE);
}
holder.releaseZipDownload.setText(currentItem.getZipball_url());
holder.releaseTarDownload.setText(currentItem.getTarball_url());
holder.releaseZipDownload.setText(
Html.fromHtml("<a href='" + currentItem.getZipball_url() + "'>" + mCtx.getResources().getString(R.string.zipArchiveDownloadReleasesTab) + "</a> "));
holder.releaseZipDownload.setMovementMethod(LinkMovementMethod.getInstance());
holder.releaseTarDownload.setText(
Html.fromHtml("<a href='" + currentItem.getTarball_url() + "'>" + mCtx.getResources().getString(R.string.tarArchiveDownloadReleasesTab) + "</a> "));
holder.releaseTarDownload.setMovementMethod(LinkMovementMethod.getInstance());
}

View File

@ -36,10 +36,8 @@
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:textColor="@color/colorWhite"
android:textSize="16sp"
android:autoLink="web"
android:textColorLink="@color/lightBlue"/>
</LinearLayout>

View File

@ -83,10 +83,8 @@
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="@string/releaseZip"
android:textIsSelectable="true"
android:textColor="@color/colorWhite"
android:textSize="16sp"
android:autoLink="web"
android:textColorLink="@color/lightBlue"/>
<TextView
@ -94,11 +92,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/releaseTar"
android:textIsSelectable="true"
android:layout_marginTop="5dp"
android:textColor="@color/colorWhite"
android:textSize="16sp"
android:autoLink="web"
android:textColorLink="@color/lightBlue"/>
</LinearLayout>

View File

@ -404,6 +404,10 @@
<string name="starMember">Star</string>
<string name="watcherMember">Watcher</string>
<string name="commitLinkBranchesTab">Commit</string>
<string name="zipArchiveDownloadReleasesTab">Zip Archive</string>
<string name="tarArchiveDownloadReleasesTab">Tar Archive</string>
<!-- generic copy -->
<string name="okButton">OK</string>
<string name="doneButton">Fertig</string>

View File

@ -404,6 +404,10 @@
<string name="starMember">Star</string>
<string name="watcherMember">Watcher</string>
<string name="commitLinkBranchesTab">Commit</string>
<string name="zipArchiveDownloadReleasesTab">Zip Archive</string>
<string name="tarArchiveDownloadReleasesTab">Tar Archive</string>
<!-- generic copy -->
<string name="okButton">OK</string>
<string name="doneButton">Done</string>

View File

@ -404,6 +404,10 @@
<string name="starMember">Star</string>
<string name="watcherMember">Watcher</string>
<string name="commitLinkBranchesTab">Commit</string>
<string name="zipArchiveDownloadReleasesTab">Zip Archive</string>
<string name="tarArchiveDownloadReleasesTab">Tar Archive</string>
<!-- generic copy -->
<string name="okButton">OK</string>
<string name="doneButton">Готово</string>

View File

@ -441,6 +441,10 @@
<string name="starMember">Star</string>
<string name="watcherMember">Watcher</string>
<string name="commitLinkBranchesTab">Commit</string>
<string name="zipArchiveDownloadReleasesTab">Zip Archive</string>
<string name="tarArchiveDownloadReleasesTab">Tar Archive</string>
<!-- generic copy -->
<string name="okButton">OK</string>
<string name="doneButton">Done</string>