mirror of
https://codeberg.org/gitnex/GitNex
synced 2025-02-03 04:37:53 +01:00
Proper URL parsing, label redesign and other improvements. (#564)
Final improvements. Fixing reply mention. Do NOT use "instanceUrlRaw" as of now. Minor fixes Merge remote-tracking branch 'remotes/main/master' into login-fix URL parsing, label and other improvements. Co-authored-by: opyale <opyale@noreply.gitea.io> Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/564 Reviewed-by: M M Arif <mmarif@noreply.codeberg.org>
This commit is contained in:
parent
5672208fd0
commit
e872069093
@ -66,7 +66,7 @@ We use [Crowdin](https://crowdin.com/project/gitnex) for translation. If your la
|
||||
## Thanks
|
||||
Thanks to all the open source libraries, contributors and donators.
|
||||
|
||||
Open source libraries
|
||||
#### Open source libraries
|
||||
- Retrofit
|
||||
- Gson
|
||||
- Okhttp
|
||||
@ -88,5 +88,6 @@ Open source libraries
|
||||
- Barteksc/AndroidPdfViewer
|
||||
- Ge0rg/MemorizingTrustManager
|
||||
- Dimezis/BlurView
|
||||
- mikaelhg/urlbuilder
|
||||
|
||||
[Follow me on Fediverse - mastodon.social/@mmarif](https://mastodon.social/@mmarif)
|
||||
|
@ -86,6 +86,7 @@ dependencies {
|
||||
implementation "ch.acra:acra-mail:$acra"
|
||||
implementation "ch.acra:acra-limiter:$acra"
|
||||
implementation "ch.acra:acra-notification:$acra"
|
||||
implementation 'com.eightbitlab:blurview:1.6.3'
|
||||
implementation "com.eightbitlab:blurview:1.6.3"
|
||||
implementation "io.mikael:urlbuilder:2.0.9"
|
||||
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import com.tooltip.Tooltip;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.clients.RetrofitClient;
|
||||
import org.mian.gitnex.helpers.NetworkObserver;
|
||||
import org.mian.gitnex.helpers.PathsHelper;
|
||||
import org.mian.gitnex.helpers.SnackBar;
|
||||
import org.mian.gitnex.helpers.UrlHelper;
|
||||
import org.mian.gitnex.helpers.Version;
|
||||
@ -30,10 +31,11 @@ import org.mian.gitnex.models.UserInfo;
|
||||
import org.mian.gitnex.models.UserTokens;
|
||||
import org.mian.gitnex.util.AppUtil;
|
||||
import org.mian.gitnex.util.TinyDB;
|
||||
import java.net.URL;
|
||||
import java.net.URI;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import io.mikael.urlbuilder.UrlBuilder;
|
||||
import okhttp3.Credentials;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
@ -166,17 +168,23 @@ public class LoginActivity extends BaseActivity {
|
||||
String loginToken = loginTokenCode.getText().toString().trim();
|
||||
|
||||
Protocol protocol = (Protocol) protocolSpinner.getSelectedItem();
|
||||
URL rawInstanceUrl = new URL(UrlHelper.fixScheme(instanceUrlET.getText().toString(), protocol.name().toLowerCase()));
|
||||
LoginType loginType = (loginMethod.getCheckedRadioButtonId() == R.id.loginUsernamePassword) ? LoginType.BASIC : LoginType.TOKEN;
|
||||
|
||||
String portAppendix = (rawInstanceUrl.getPort() > 0) ? ":" + rawInstanceUrl.getPort() : "";
|
||||
String instanceUrlWithProtocol = protocol.name().toLowerCase() + "://" + rawInstanceUrl.getHost() + portAppendix;
|
||||
String instanceUrl = instanceUrlWithProtocol + "/api/v1/";
|
||||
URI rawInstanceUrl = UrlBuilder.fromString(UrlHelper.fixScheme(instanceUrlET.getText().toString(), "http"))
|
||||
.toUri();
|
||||
|
||||
URI instanceUrlWithProtocol = UrlBuilder.fromUri(rawInstanceUrl)
|
||||
.withScheme(protocol.name().toLowerCase())
|
||||
.toUri();
|
||||
|
||||
URI instanceUrl = UrlBuilder.fromUri(instanceUrlWithProtocol)
|
||||
.withPath(PathsHelper.join(instanceUrlWithProtocol.getPath(), "/api/v1/"))
|
||||
.toUri();
|
||||
|
||||
tinyDB.putString("loginType", loginType.name().toLowerCase());
|
||||
tinyDB.putString("instanceUrlRaw", rawInstanceUrl.getHost());
|
||||
tinyDB.putString("instanceUrl", instanceUrl);
|
||||
tinyDB.putString("instanceUrlWithProtocol", instanceUrlWithProtocol);
|
||||
tinyDB.putString("instanceUrlRaw", instanceUrlET.getText().toString());
|
||||
tinyDB.putString("instanceUrl", instanceUrl.toString());
|
||||
tinyDB.putString("instanceUrlWithProtocol", instanceUrlWithProtocol.toString());
|
||||
|
||||
if(instanceUrlET.getText().toString().equals("")) {
|
||||
|
||||
@ -188,7 +196,13 @@ public class LoginActivity extends BaseActivity {
|
||||
|
||||
if(loginType == LoginType.BASIC) {
|
||||
|
||||
int loginOTP = (otpCode.getText().toString().length() == 6) ? Integer.parseInt(otpCode.getText().toString().trim()) : 0;
|
||||
if(otpCode.length() != 0 && otpCode.length() != 6) {
|
||||
|
||||
SnackBar.warning(ctx, layoutView, getResources().getString(R.string.loginOTPTypeError));
|
||||
enableProcessButton();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if(rawInstanceUrl.getUserInfo() != null) {
|
||||
|
||||
@ -197,8 +211,6 @@ public class LoginActivity extends BaseActivity {
|
||||
|
||||
}
|
||||
|
||||
tinyDB.putString("loginUid", loginUid);
|
||||
|
||||
if(loginUid.equals("")) {
|
||||
|
||||
SnackBar.warning(ctx, layoutView, getResources().getString(R.string.emptyFieldUsername));
|
||||
@ -215,7 +227,10 @@ public class LoginActivity extends BaseActivity {
|
||||
|
||||
}
|
||||
|
||||
versionCheck(instanceUrl, loginUid, loginPass, loginOTP, loginToken, 1);
|
||||
int loginOTP = (otpCode.length() > 0) ? Integer.parseInt(otpCode.getText().toString().trim()) : 0;
|
||||
tinyDB.putString("loginUid", loginUid);
|
||||
|
||||
versionCheck(instanceUrl.toString(), loginUid, loginPass, loginOTP, loginToken, 1);
|
||||
|
||||
}
|
||||
else {
|
||||
@ -228,7 +243,7 @@ public class LoginActivity extends BaseActivity {
|
||||
|
||||
}
|
||||
|
||||
versionCheck(instanceUrl, loginUid, loginPass, 123, loginToken, 2);
|
||||
versionCheck(instanceUrl.toString(), loginUid, loginPass, 123, loginToken, 2);
|
||||
|
||||
}
|
||||
|
||||
@ -358,8 +373,8 @@ public class LoginActivity extends BaseActivity {
|
||||
switch(response.code()) {
|
||||
|
||||
case 200:
|
||||
tinyDB.putBoolean("loggedInMode", true);
|
||||
assert userDetails != null;
|
||||
tinyDB.putBoolean("loggedInMode", true);
|
||||
tinyDB.putString(userDetails.getLogin() + "-token", loginToken);
|
||||
tinyDB.putString("loginUid", userDetails.getLogin());
|
||||
tinyDB.putString("userLogin", userDetails.getUsername());
|
||||
@ -423,8 +438,8 @@ public class LoginActivity extends BaseActivity {
|
||||
|
||||
if(response.code() == 200) {
|
||||
|
||||
boolean setTokenFlag = false;
|
||||
assert userTokens != null;
|
||||
boolean setTokenFlag = false;
|
||||
|
||||
if(userTokens.size() > 0) { // FIXME This is in need of a refactor, but i don't understand what the code is used for.
|
||||
|
||||
@ -494,9 +509,9 @@ public class LoginActivity extends BaseActivity {
|
||||
switch(response.code()) {
|
||||
|
||||
case 200:
|
||||
assert userDetails != null;
|
||||
tinyDB.remove("loginPass");
|
||||
tinyDB.putBoolean("loggedInMode", true);
|
||||
assert userDetails != null;
|
||||
tinyDB.putString("userLogin", userDetails.getUsername());
|
||||
tinyDB.putString(loginUid + "-token", newToken.getSha1());
|
||||
tinyDB.putString(loginUid + "-token-last-eight", appUtil.getLastCharactersOfWord(newToken.getSha1(), 8));
|
||||
|
@ -515,7 +515,7 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
|
||||
tinyDb.putString("userLang", userDetails.getLang());
|
||||
}
|
||||
else {
|
||||
tinyDb.putString("userLang", "...");
|
||||
tinyDb.putString("userLang", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -526,7 +526,7 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
|
||||
}
|
||||
else {
|
||||
|
||||
String toastError = getResources().getString(R.string.genericApiStatusError) + String.valueOf(response.code());
|
||||
String toastError = getResources().getString(R.string.genericApiStatusError) + response.code();
|
||||
Toasty.info(ctx, toastError);
|
||||
|
||||
}
|
||||
|
@ -5,7 +5,13 @@ import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.helpers.PathsHelper;
|
||||
import org.mian.gitnex.helpers.Toasty;
|
||||
import org.mian.gitnex.util.TinyDB;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import io.mikael.urlbuilder.UrlBuilder;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
@ -20,19 +26,27 @@ public class OpenRepoInBrowserActivity extends AppCompatActivity {
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
appCtx = getApplicationContext();
|
||||
|
||||
TinyDB tinyDb = new TinyDB(appCtx);
|
||||
String instanceUrlWithProtocol = "https://" + tinyDb.getString("instanceUrlRaw");
|
||||
if (!tinyDb.getString("instanceUrlWithProtocol").isEmpty()) {
|
||||
instanceUrlWithProtocol = tinyDb.getString("instanceUrlWithProtocol");
|
||||
}
|
||||
|
||||
String repoFullNameBrowser = getIntent().getStringExtra("repoFullNameBrowser");
|
||||
Uri url = Uri.parse(instanceUrlWithProtocol + "/" + repoFullNameBrowser);
|
||||
Intent i = new Intent(Intent.ACTION_VIEW, url);
|
||||
try {
|
||||
|
||||
URI instanceUrl = new URI(tinyDb.getString("instanceUrlWithProtocol"));
|
||||
|
||||
String browserPath = PathsHelper.join(instanceUrl.getPath(), getIntent().getStringExtra("repoFullNameBrowser"));
|
||||
|
||||
String browserUrl = UrlBuilder.fromUri(instanceUrl)
|
||||
.withPath(browserPath)
|
||||
.toString();
|
||||
|
||||
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(browserUrl));
|
||||
startActivity(i);
|
||||
finish();
|
||||
|
||||
}
|
||||
catch(URISyntaxException e) {
|
||||
Toasty.error(appCtx, getString(R.string.genericError));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -154,7 +154,12 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<IssueCommentsAdap
|
||||
commentMenuQuote.setOnClickListener(v1 -> {
|
||||
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append("@").append(commenterUsername.getText().toString()).append("\n\n");
|
||||
String commenterName = commenterUsername.getText().toString();
|
||||
|
||||
if(!commenterName.equals(tinyDb.getString("userLogin"))) {
|
||||
|
||||
stringBuilder.append("@").append(commenterName).append("\n\n");
|
||||
}
|
||||
|
||||
String[] lines = commendBodyRaw.getText().toString().split("\\R");
|
||||
|
||||
|
@ -3,26 +3,25 @@ package org.mian.gitnex.adapters;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import com.amulyakhare.textdrawable.TextDrawable;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.cardview.widget.CardView;
|
||||
import androidx.core.widget.ImageViewCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||
import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.activities.CreateLabelActivity;
|
||||
import org.mian.gitnex.helpers.AlertDialogs;
|
||||
import org.mian.gitnex.helpers.ColorInverter;
|
||||
import org.mian.gitnex.helpers.LabelWidthCalculator;
|
||||
import org.mian.gitnex.models.Labels;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
@ -39,12 +38,17 @@ public class LabelsAdapter extends RecyclerView.Adapter<LabelsAdapter.LabelsView
|
||||
private TextView labelTitle;
|
||||
private TextView labelId;
|
||||
private TextView labelColor;
|
||||
private ImageView labelsView;
|
||||
|
||||
private CardView labelView;
|
||||
private ImageView labelIcon;
|
||||
private TextView labelName;
|
||||
|
||||
private LabelsViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
|
||||
labelsView = itemView.findViewById(R.id.labelsView);
|
||||
labelView = itemView.findViewById(R.id.labelView);
|
||||
labelIcon = itemView.findViewById(R.id.labelIcon);
|
||||
labelName = itemView.findViewById(R.id.labelName);
|
||||
ImageView labelsOptionsMenu = itemView.findViewById(R.id.labelsOptionsMenu);
|
||||
labelTitle = itemView.findViewById(R.id.labelTitle);
|
||||
labelId = itemView.findViewById(R.id.labelId);
|
||||
@ -119,19 +123,13 @@ public class LabelsAdapter extends RecyclerView.Adapter<LabelsAdapter.LabelsView
|
||||
String labelName = currentItem.getName();
|
||||
|
||||
int color = Color.parseColor("#" + labelColor);
|
||||
int contrastColor = new ColorInverter().getContrastColor(color);
|
||||
|
||||
TextDrawable drawable = TextDrawable.builder()
|
||||
.beginConfig()
|
||||
.useFont(Typeface.DEFAULT)
|
||||
.bold()
|
||||
.textColor(new ColorInverter().getContrastColor(color))
|
||||
.fontSize(35)
|
||||
.width(LabelWidthCalculator.calculateLabelWidth(labelName, Typeface.DEFAULT, 40, 20))
|
||||
.height(55)
|
||||
.endConfig()
|
||||
.buildRoundRect(labelName, color, 10);
|
||||
ImageViewCompat.setImageTintList(holder.labelIcon, ColorStateList.valueOf(contrastColor));
|
||||
|
||||
holder.labelsView.setImageDrawable(drawable);
|
||||
holder.labelName.setTextColor(contrastColor);
|
||||
holder.labelName.setText(labelName);
|
||||
holder.labelView.setCardBackgroundColor(color);
|
||||
|
||||
}
|
||||
|
||||
|
@ -19,10 +19,14 @@ import org.mian.gitnex.activities.AddRemoveLabelsActivity;
|
||||
import org.mian.gitnex.activities.EditIssueActivity;
|
||||
import org.mian.gitnex.activities.FileDiffActivity;
|
||||
import org.mian.gitnex.activities.MergePullRequestActivity;
|
||||
import org.mian.gitnex.helpers.PathsHelper;
|
||||
import org.mian.gitnex.helpers.Toasty;
|
||||
import org.mian.gitnex.helpers.Version;
|
||||
import org.mian.gitnex.util.TinyDB;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.Objects;
|
||||
import io.mikael.urlbuilder.UrlBuilder;
|
||||
|
||||
/**
|
||||
* Author M M Arif
|
||||
@ -138,15 +142,15 @@ public class BottomSheetSingleIssueFragment extends BottomSheetDialogFragment {
|
||||
|
||||
shareIssue.setOnClickListener(v1 -> {
|
||||
|
||||
// get url of repo
|
||||
String repoFullName = tinyDB.getString("repoFullName");
|
||||
String instanceUrlWithProtocol = "https://" + tinyDB.getString("instanceUrlRaw");
|
||||
if(!tinyDB.getString("instanceUrlWithProtocol").isEmpty()) {
|
||||
instanceUrlWithProtocol = tinyDB.getString("instanceUrlWithProtocol");
|
||||
}
|
||||
try {
|
||||
|
||||
// get issue Url
|
||||
String issueUrl = instanceUrlWithProtocol + "/" + repoFullName + "/issues/" + tinyDB.getString("issueNumber");
|
||||
URI instanceUrl = new URI(tinyDB.getString("instanceUrlWithProtocol"));
|
||||
|
||||
String issuePath = PathsHelper.join(instanceUrl.getPath(), tinyDB.getString("repoFullName"), "/issues/", tinyDB.getString("issueNumber"));
|
||||
|
||||
String issueUrl = UrlBuilder.fromUri(instanceUrl)
|
||||
.withPath(issuePath)
|
||||
.toString();
|
||||
|
||||
// share issue
|
||||
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
|
||||
@ -155,36 +159,44 @@ public class BottomSheetSingleIssueFragment extends BottomSheetDialogFragment {
|
||||
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, issueUrl);
|
||||
startActivity(Intent.createChooser(sharingIntent, getResources().getString(R.string.hash) + tinyDB.getString("issueNumber") + " " + tinyDB.getString("issueTitle")));
|
||||
|
||||
}
|
||||
catch(URISyntaxException e) {
|
||||
Toasty.error(ctx, getString(R.string.genericError));
|
||||
}
|
||||
finally {
|
||||
dismiss();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
copyIssueUrl.setOnClickListener(new View.OnClickListener() {
|
||||
copyIssueUrl.setOnClickListener(v12 -> {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
try {
|
||||
|
||||
// get url of repo
|
||||
String repoFullName = tinyDB.getString("repoFullName");
|
||||
String instanceUrlWithProtocol = "https://" + tinyDB.getString("instanceUrlRaw");
|
||||
if(!tinyDB.getString("instanceUrlWithProtocol").isEmpty()) {
|
||||
instanceUrlWithProtocol = tinyDB.getString("instanceUrlWithProtocol");
|
||||
}
|
||||
URI instanceUrl = new URI(tinyDB.getString("instanceUrlWithProtocol"));
|
||||
|
||||
// get issue Url
|
||||
String issueUrl = instanceUrlWithProtocol + "/" + repoFullName + "/issues/" + tinyDB.getString("issueNumber");
|
||||
String issuePath = PathsHelper.join(instanceUrl.getPath(), tinyDB.getString("repoFullName"), "/issues/", tinyDB.getString("issueNumber"));
|
||||
|
||||
String issueUrl = UrlBuilder.fromUri(instanceUrl)
|
||||
.withPath(issuePath)
|
||||
.toString();
|
||||
|
||||
// copy to clipboard
|
||||
ClipboardManager clipboard = (ClipboardManager) Objects.requireNonNull(ctx).getSystemService(android.content.Context.CLIPBOARD_SERVICE);
|
||||
ClipboardManager clipboard = (ClipboardManager) Objects.requireNonNull(ctx).getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
ClipData clip = ClipData.newPlainText("issueUrl", issueUrl);
|
||||
assert clipboard != null;
|
||||
clipboard.setPrimaryClip(clip);
|
||||
|
||||
dismiss();
|
||||
|
||||
Toasty.info(ctx, ctx.getString(R.string.copyIssueUrlToastMsg));
|
||||
|
||||
}
|
||||
catch(URISyntaxException e) {
|
||||
Toasty.error(ctx, getString(R.string.genericError));
|
||||
}
|
||||
finally {
|
||||
dismiss();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if(tinyDB.getString("issueType").equals("issue")) {
|
||||
|
@ -63,11 +63,19 @@ public class ProfileFragment extends Fragment {
|
||||
ViewGroup aboutFrame = v.findViewById(R.id.aboutFrame);
|
||||
|
||||
String[] userLanguageCodes = tinyDb.getString("userLang").split("-");
|
||||
|
||||
if(userLanguageCodes.length >= 2) {
|
||||
|
||||
Locale locale = new Locale(userLanguageCodes[0], userLanguageCodes[1]);
|
||||
userLanguage.setText(locale.getDisplayCountry());
|
||||
}
|
||||
else {
|
||||
|
||||
userLanguage.setText(R.string.notSupported);
|
||||
}
|
||||
|
||||
userFullName.setText(tinyDb.getString("userFullname"));
|
||||
userLogin.setText(getString(R.string.usernameWithAt, tinyDb.getString("userLogin")));
|
||||
userLanguage.setText(locale.getDisplayCountry());
|
||||
|
||||
PicassoService.getInstance(ctx).get()
|
||||
.load(tinyDb.getString("userAvatar"))
|
||||
|
37
app/src/main/java/org/mian/gitnex/helpers/PathsHelper.java
Normal file
37
app/src/main/java/org/mian/gitnex/helpers/PathsHelper.java
Normal file
@ -0,0 +1,37 @@
|
||||
package org.mian.gitnex.helpers;
|
||||
|
||||
/**
|
||||
* Author opyale
|
||||
*/
|
||||
|
||||
public class PathsHelper {
|
||||
|
||||
public static String join(String... paths) {
|
||||
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
|
||||
for(String path : paths) {
|
||||
|
||||
if(path != null && !path.isEmpty()) {
|
||||
|
||||
if(!path.startsWith("/")) {
|
||||
|
||||
stringBuilder.append("/");
|
||||
}
|
||||
|
||||
if(path.endsWith("/")) {
|
||||
|
||||
path = path.substring(0, path.lastIndexOf("/"));
|
||||
}
|
||||
|
||||
stringBuilder.append(path);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return stringBuilder.append("/").toString();
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -14,7 +14,8 @@ public class UrlHelper {
|
||||
URI uri = null;
|
||||
try {
|
||||
uri = new URI(url);
|
||||
} catch (URISyntaxException e) {
|
||||
}
|
||||
catch(URISyntaxException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@ -44,4 +45,3 @@ public class UrlHelper {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ public class AppUtil {
|
||||
return str.matches("^[\\w-]+$");
|
||||
}
|
||||
|
||||
public Boolean checkIntegers(String str) {
|
||||
public static Boolean checkIntegers(String str) {
|
||||
|
||||
return str.matches("\\d+");
|
||||
}
|
||||
|
@ -1,61 +1,86 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/linearLayoutMainFrame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:id="@+id/relativeLayoutMainFrame"
|
||||
android:background="?attr/primaryBackgroundColor">
|
||||
android:background="?attr/primaryBackgroundColor"
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/labelTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:id="@+id/labelTitle"/>
|
||||
android:layout_weight="1"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/labelId"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:id="@+id/labelId"/>
|
||||
android:layout_weight="1"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/labelColor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:id="@+id/labelColor"/>
|
||||
android:layout_weight="1"
|
||||
android:visibility="gone" />
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/labelView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardCornerRadius="5dp"
|
||||
app:cardElevation="0dp"
|
||||
app:contentPaddingBottom="3dp"
|
||||
app:contentPaddingLeft="10dp"
|
||||
app:contentPaddingRight="10dp"
|
||||
app:contentPaddingTop="3dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="15dp"
|
||||
android:id="@+id/labelsFrame"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/labelsView"
|
||||
android:id="@+id/labelIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0"
|
||||
android:contentDescription="@string/generalImgContentText"
|
||||
android:tint="@color/colorWhite"
|
||||
app:srcCompat="@drawable/ic_label" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/labelName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_weight="1"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<Space
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start"
|
||||
android:paddingTop="5dp"
|
||||
android:contentDescription="@string/labelMenuContentDesc"
|
||||
android:gravity="start"
|
||||
android:layout_weight="1"
|
||||
android:scaleType="fitStart"
|
||||
android:src="@drawable/ic_label" />
|
||||
android:layout_weight="1" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/labelsOptionsMenu"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:layout_weight="0.15"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:contentDescription="@string/labelMenuContentDesc"
|
||||
android:gravity="end"
|
||||
android:scaleType="fitEnd"
|
||||
android:paddingLeft="10dp"
|
||||
android:src="@drawable/ic_dotted_menu_horizontal" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
@ -27,8 +27,7 @@
|
||||
android:singleLine="true"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
tools:text="3.0.0-rc1" />
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/releaseType"
|
||||
@ -68,8 +67,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="5dp"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="14sp"
|
||||
tools:text="Published by @mmarif" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@ -99,8 +97,7 @@
|
||||
android:layout_marginStart="5dp"
|
||||
android:singleLine="true"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="14sp"
|
||||
tools:text="3.0.0-rc1" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@ -125,8 +122,7 @@
|
||||
android:layout_marginStart="5dp"
|
||||
android:singleLine="true"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="14sp"
|
||||
tools:text="8b1c79c0c3" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@ -150,8 +146,7 @@
|
||||
android:layout_marginStart="5dp"
|
||||
android:singleLine="true"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="14sp"
|
||||
tools:text="1 day ago" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@ -172,9 +167,10 @@
|
||||
android:id="@+id/releaseBodyContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:autoLink="web|email"
|
||||
android:textColorLink="@color/lightBlue"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="14sp"
|
||||
tools:text="Put your release body here" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@ -207,8 +203,7 @@
|
||||
android:layout_marginStart="3dp"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="14sp"
|
||||
android:text="@string/releaseDownloadText"
|
||||
tools:text="Downloads" />
|
||||
android:text="@string/releaseDownloadText" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@ -229,8 +224,7 @@
|
||||
android:drawableStart="@drawable/ic_file_download_24dp"
|
||||
android:drawablePadding="8dp"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="14sp"
|
||||
tools:text="Source code (ZIP)" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/releaseTarDownload"
|
||||
@ -241,8 +235,7 @@
|
||||
android:drawableStart="@drawable/ic_file_download_24dp"
|
||||
android:drawablePadding="8dp"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="14sp"
|
||||
tools:text="Source code (TAR)" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/downloadList"
|
||||
|
@ -29,19 +29,17 @@
|
||||
android:id="@+id/userAvatar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_android"
|
||||
android:maxHeight="24dp"
|
||||
android:maxWidth="24dp"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="5dp"
|
||||
android:contentDescription="@string/app_name"/>
|
||||
android:contentDescription="@string/generalImgContentText"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/userFullname"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="10dp"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="18sp"
|
||||
android:textIsSelectable="true"
|
||||
android:textColor="@color/white"
|
||||
@ -59,7 +57,6 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="0.85"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/appEmail"
|
||||
android:textSize="14sp"
|
||||
android:textIsSelectable="true"
|
||||
android:textColor="@color/white"
|
||||
|
@ -527,6 +527,8 @@
|
||||
<string name="filesGenericError">Sorry this file cannot be viewed as API returned an error</string>
|
||||
<string name="filesBreadcrumb">Root</string>
|
||||
|
||||
<string name="notSupported">Not supported</string>
|
||||
|
||||
<!-- generic copy -->
|
||||
<string name="okButton">OK</string>
|
||||
<string name="doneButton">Done</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user