mirror of
https://codeberg.org/gitnex/GitNex.git
synced 2024-12-16 15:48:13 +08:00
Fix missing subpath for assets (#1219)
Closes #1218 Co-authored-by: qwerty287 <ndev@web.de> Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1219 Reviewed-by: M M Arif <mmarif@noreply.codeberg.org> Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org> Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
This commit is contained in:
parent
5d77766831
commit
fa259112c2
@ -29,6 +29,7 @@ import org.mian.gitnex.helpers.AppUtil;
|
|||||||
import org.mian.gitnex.helpers.RoundedTransformation;
|
import org.mian.gitnex.helpers.RoundedTransformation;
|
||||||
import org.mian.gitnex.helpers.TinyDB;
|
import org.mian.gitnex.helpers.TinyDB;
|
||||||
import org.mian.gitnex.helpers.Toasty;
|
import org.mian.gitnex.helpers.Toasty;
|
||||||
|
import org.mian.gitnex.helpers.UrlHelper;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
import retrofit2.Callback;
|
||||||
|
|
||||||
@ -130,7 +131,7 @@ public class UserAccountsAdapter
|
|||||||
|
|
||||||
PicassoService.getInstance(context)
|
PicassoService.getInstance(context)
|
||||||
.get()
|
.get()
|
||||||
.load(url + "assets/img/favicon.png")
|
.load(UrlHelper.appendPath(currentItem.getInstanceUrl(), "assets/img/favicon.png"))
|
||||||
.placeholder(R.drawable.loader_animated)
|
.placeholder(R.drawable.loader_animated)
|
||||||
.transform(new RoundedTransformation(imgRadius, 0))
|
.transform(new RoundedTransformation(imgRadius, 0))
|
||||||
.resize(120, 120)
|
.resize(120, 120)
|
||||||
|
@ -15,7 +15,6 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.drawerlayout.widget.DrawerLayout;
|
import androidx.drawerlayout.widget.DrawerLayout;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import io.mikael.urlbuilder.UrlBuilder;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.mian.gitnex.R;
|
import org.mian.gitnex.R;
|
||||||
import org.mian.gitnex.activities.AddNewAccountActivity;
|
import org.mian.gitnex.activities.AddNewAccountActivity;
|
||||||
@ -23,6 +22,7 @@ import org.mian.gitnex.clients.PicassoService;
|
|||||||
import org.mian.gitnex.database.models.UserAccount;
|
import org.mian.gitnex.database.models.UserAccount;
|
||||||
import org.mian.gitnex.helpers.AppUtil;
|
import org.mian.gitnex.helpers.AppUtil;
|
||||||
import org.mian.gitnex.helpers.RoundedTransformation;
|
import org.mian.gitnex.helpers.RoundedTransformation;
|
||||||
|
import org.mian.gitnex.helpers.UrlHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author M M Arif
|
* @author M M Arif
|
||||||
@ -59,13 +59,11 @@ public class UserAccountsNavAdapter
|
|||||||
|
|
||||||
UserAccount currentItem = userAccountsList.get(position);
|
UserAccount currentItem = userAccountsList.get(position);
|
||||||
|
|
||||||
String url = UrlBuilder.fromString(currentItem.getInstanceUrl()).withPath("/").toString();
|
|
||||||
|
|
||||||
int imageSize = AppUtil.getPixelsFromDensity(context, 36);
|
int imageSize = AppUtil.getPixelsFromDensity(context, 36);
|
||||||
|
|
||||||
PicassoService.getInstance(context)
|
PicassoService.getInstance(context)
|
||||||
.get()
|
.get()
|
||||||
.load(url + "assets/img/favicon.png")
|
.load(UrlHelper.appendPath(currentItem.getInstanceUrl(), "assets/img/favicon.png"))
|
||||||
.placeholder(R.drawable.loader_animated)
|
.placeholder(R.drawable.loader_animated)
|
||||||
.transform(new RoundedTransformation(18, 0))
|
.transform(new RoundedTransformation(18, 0))
|
||||||
.resize(imageSize, imageSize)
|
.resize(imageSize, imageSize)
|
||||||
|
@ -38,4 +38,17 @@ public class UrlHelper {
|
|||||||
|
|
||||||
return !url.matches("^(http|https)://.+$") ? scheme + "://" + url : url;
|
return !url.matches("^(http|https)://.+$") ? scheme + "://" + url : url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String appendPath(String url, String path) {
|
||||||
|
if (url.endsWith("/")) {
|
||||||
|
// remove it
|
||||||
|
url = url.substring(0, url.length() - 1);
|
||||||
|
}
|
||||||
|
if (!path.startsWith("/")) {
|
||||||
|
// add it
|
||||||
|
path = "/" + path;
|
||||||
|
}
|
||||||
|
|
||||||
|
return url + path;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -771,7 +771,7 @@
|
|||||||
<string name="adoptRepo">Adopt</string>
|
<string name="adoptRepo">Adopt</string>
|
||||||
<string name="repoAdopted">Adopted repository %s</string>
|
<string name="repoAdopted">Adopted repository %s</string>
|
||||||
<string name="unadoptedRepos">Unadopted Repositories</string>
|
<string name="unadoptedRepos">Unadopted Repositories</string>
|
||||||
<string name="unadoptedReposMessage">- Adopt will add repository %s to organization/user %s.\n- Delete will remove it from the system.</string>
|
<string name="unadoptedReposMessage">- Adopt will add repository %1$s to organization/user %2$s.\n- Delete will remove it from the system.</string>
|
||||||
<string name="commits">Commits</string>
|
<string name="commits">Commits</string>
|
||||||
|
|
||||||
<!-- wiki -->
|
<!-- wiki -->
|
||||||
|
Loading…
Reference in New Issue
Block a user