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.TinyDB;
|
||||
import org.mian.gitnex.helpers.Toasty;
|
||||
import org.mian.gitnex.helpers.UrlHelper;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
|
||||
@ -130,7 +131,7 @@ public class UserAccountsAdapter
|
||||
|
||||
PicassoService.getInstance(context)
|
||||
.get()
|
||||
.load(url + "assets/img/favicon.png")
|
||||
.load(UrlHelper.appendPath(currentItem.getInstanceUrl(), "assets/img/favicon.png"))
|
||||
.placeholder(R.drawable.loader_animated)
|
||||
.transform(new RoundedTransformation(imgRadius, 0))
|
||||
.resize(120, 120)
|
||||
|
@ -15,7 +15,6 @@ import androidx.annotation.NonNull;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import io.mikael.urlbuilder.UrlBuilder;
|
||||
import java.util.List;
|
||||
import org.mian.gitnex.R;
|
||||
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.helpers.AppUtil;
|
||||
import org.mian.gitnex.helpers.RoundedTransformation;
|
||||
import org.mian.gitnex.helpers.UrlHelper;
|
||||
|
||||
/**
|
||||
* @author M M Arif
|
||||
@ -59,13 +59,11 @@ public class UserAccountsNavAdapter
|
||||
|
||||
UserAccount currentItem = userAccountsList.get(position);
|
||||
|
||||
String url = UrlBuilder.fromString(currentItem.getInstanceUrl()).withPath("/").toString();
|
||||
|
||||
int imageSize = AppUtil.getPixelsFromDensity(context, 36);
|
||||
|
||||
PicassoService.getInstance(context)
|
||||
.get()
|
||||
.load(url + "assets/img/favicon.png")
|
||||
.load(UrlHelper.appendPath(currentItem.getInstanceUrl(), "assets/img/favicon.png"))
|
||||
.placeholder(R.drawable.loader_animated)
|
||||
.transform(new RoundedTransformation(18, 0))
|
||||
.resize(imageSize, imageSize)
|
||||
|
@ -38,4 +38,17 @@ public class UrlHelper {
|
||||
|
||||
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="repoAdopted">Adopted repository %s</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>
|
||||
|
||||
<!-- wiki -->
|
||||
|
Loading…
Reference in New Issue
Block a user