mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Do not use erroneous thumb url util function (#2901)
* Do not use erroneous thumb url util function * Remove unused code * Fix image loading for peer review * Clear disposable
This commit is contained in:
parent
70b19754fb
commit
a003e9706f
8 changed files with 28 additions and 88 deletions
|
|
@ -9,11 +9,8 @@ import android.net.Uri;
|
|||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.apache.commons.codec.binary.Hex;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.wikipedia.dataclient.WikiSite;
|
||||
import org.wikipedia.page.PageTitle;
|
||||
import org.wikipedia.util.UriUtil;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Pattern;
|
||||
|
|
@ -34,18 +31,6 @@ public class Utils {
|
|||
return new PageTitle(title, new WikiSite(BuildConfig.COMMONS_URL));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an URL for thumbnail
|
||||
*
|
||||
* @param filename Thumbnail file name
|
||||
* @return URL of thumbnail
|
||||
*/
|
||||
public static String makeThumbBaseUrl(@NonNull String filename) {
|
||||
String name = getPageTitle(filename).getPrefixedText();
|
||||
String sha = new String(Hex.encodeHex(DigestUtils.md5(name)));
|
||||
return String.format("%s/%s/%s/%s", BuildConfig.IMAGE_URL_BASE, sha.substring(0, 1), sha.substring(0, 2), UriUtil.encodeURL(name));
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates licence name with given ID
|
||||
* @param license License ID
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue