mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Merge branch 'master' into structured-data
# Conflicts: # build.gradle
This commit is contained in:
commit
3f6d26c296
9 changed files with 101 additions and 26 deletions
|
|
@ -220,7 +220,7 @@ android {
|
|||
buildConfigField "String", "SIGNUP_LANDING_URL", "\"https://commons.m.wikimedia.org/w/index.php?title=Special:CreateAccount&returnto=Main+Page&returntoquery=welcome%3Dyes\""
|
||||
buildConfigField "String", "SIGNUP_SUCCESS_REDIRECTION_URL", "\"https://commons.m.wikimedia.org/w/index.php?title=Main_Page&welcome=yes\""
|
||||
buildConfigField "String", "FORGOT_PASSWORD_URL", "\"https://commons.wikimedia.org/wiki/Special:PasswordReset\""
|
||||
buildConfigField "String", "PRIVACY_POLICY_URL", "\"https://github.com/commons-app/apps-android-commons/wiki/Privacy-policy\""
|
||||
buildConfigField "String", "PRIVACY_POLICY_URL", "\"https://github.com/commons-app/commons-app-documentation/blob/master/android/Privacy-policy.md\""
|
||||
buildConfigField "String", "ACCOUNT_TYPE", "\"fr.free.nrw.commons\""
|
||||
buildConfigField "String", "CONTRIBUTION_AUTHORITY", "\"fr.free.nrw.commons.contributions.contentprovider\""
|
||||
buildConfigField "String", "MODIFICATION_AUTHORITY", "\"fr.free.nrw.commons.modifications.contentprovider\""
|
||||
|
|
@ -254,7 +254,7 @@ android {
|
|||
buildConfigField "String", "SIGNUP_LANDING_URL", "\"https://commons.m.wikimedia.beta.wmflabs.org/w/index.php?title=Special:CreateAccount&returnto=Main+Page&returntoquery=welcome%3Dyes\""
|
||||
buildConfigField "String", "SIGNUP_SUCCESS_REDIRECTION_URL", "\"https://commons.m.wikimedia.beta.wmflabs.org/w/index.php?title=Main_Page&welcome=yes\""
|
||||
buildConfigField "String", "FORGOT_PASSWORD_URL", "\"https://commons.wikimedia.beta.wmflabs.org/wiki/Special:PasswordReset\""
|
||||
buildConfigField "String", "PRIVACY_POLICY_URL", "\"https://github.com/commons-app/apps-android-commons/wiki/Privacy-policy\""
|
||||
buildConfigField "String", "PRIVACY_POLICY_URL", "\"https://github.com/commons-app/commons-app-documentation/blob/master/android/Privacy-policy.md\""
|
||||
buildConfigField "String", "ACCOUNT_TYPE", "\"fr.free.nrw.commons.beta\""
|
||||
buildConfigField "String", "CONTRIBUTION_AUTHORITY", "\"fr.free.nrw.commons.beta.contributions.contentprovider\""
|
||||
buildConfigField "String", "MODIFICATION_AUTHORITY", "\"fr.free.nrw.commons.beta.modifications.contentprovider\""
|
||||
|
|
|
|||
|
|
@ -65,8 +65,7 @@ import timber.log.Timber;
|
|||
)
|
||||
|
||||
@AcraMailSender(
|
||||
mailTo = "commons-app-android-private@googlegroups.com",
|
||||
reportAsFile = false
|
||||
mailTo = "commons-app-android-private@googlegroups.com"
|
||||
)
|
||||
|
||||
@AcraDialog(
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ internal object Urls {
|
|||
const val GITHUB_REPO_URL = "https://github.com/commons-app/apps-android-commons"
|
||||
const val WEBSITE_URL = "https://commons-app.github.io"
|
||||
const val CREDITS_URL = "https://github.com/commons-app/apps-android-commons/blob/master/CREDITS"
|
||||
const val FAQ_URL = "https://github.com/commons-app/apps-android-commons/wiki/Frequently-Asked-Questions"
|
||||
const val FAQ_URL = "https://github.com/commons-app/commons-app-documentation/blob/master/android/Frequently-Asked-Questions.md"
|
||||
const val PLAY_STORE_PREFIX = "market://details?id="
|
||||
const val PLAY_STORE_URL_PREFIX = "https://play.google.com/store/apps/details?id="
|
||||
const val TRANSLATE_WIKI_URL = "https://translatewiki.net/w/i.php?title=Special:Translate&group=commons-android-strings&filter=%21translated&action=translate&language="
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ import android.net.Uri;
|
|||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
|
|
@ -33,7 +33,6 @@ import com.facebook.imagepipeline.request.ImageRequest;
|
|||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.wikipedia.util.DateUtil;
|
||||
import org.wikipedia.util.StringUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
|
@ -245,7 +244,15 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment {
|
|||
.setVisibility(View.GONE);
|
||||
}
|
||||
media = detailProvider.getMediaAtPosition(index);
|
||||
displayMediaDetails();
|
||||
scrollView.getViewTreeObserver().addOnGlobalLayoutListener(
|
||||
new OnGlobalLayoutListener() {
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
scrollView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||
displayMediaDetails();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private void displayMediaDetails() {
|
||||
|
|
@ -264,7 +271,8 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment {
|
|||
|
||||
private void updateAspectRatio(ImageInfo imageInfo) {
|
||||
if (imageInfo != null) {
|
||||
int finalHeight = (scrollView.getWidth()*imageInfo.getHeight()) / imageInfo.getWidth();
|
||||
int screenWidth = scrollView.getWidth();
|
||||
int finalHeight = (screenWidth*imageInfo.getHeight()) / imageInfo.getWidth();
|
||||
ViewGroup.LayoutParams params = image.getLayoutParams();
|
||||
params.height = finalHeight;
|
||||
image.setLayoutParams(params);
|
||||
|
|
|
|||
|
|
@ -25,9 +25,10 @@ public class CommonsDateUtil {
|
|||
* Gets the timestamp pattern for a date
|
||||
* @return timestamp
|
||||
*/
|
||||
public static SimpleDateFormat getIso8601DateFormatTimestamp() {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ROOT);
|
||||
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
return simpleDateFormat;
|
||||
public static SimpleDateFormat getIso8601DateFormatTimestamp() {
|
||||
final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX",
|
||||
Locale.ROOT);
|
||||
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
return simpleDateFormat;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
package fr.free.nrw.commons.utils
|
||||
|
||||
import org.hamcrest.core.IsEqual.equalTo
|
||||
import org.junit.Assert.assertThat
|
||||
import org.junit.Test
|
||||
|
||||
class CommonsDateUtilTest {
|
||||
|
||||
@Test
|
||||
fun `Iso8601DateFormatTimestamp parses legal date`() {
|
||||
val iso8601DateFormatTimestamp = CommonsDateUtil
|
||||
.getIso8601DateFormatTimestamp()
|
||||
val parsedDate = iso8601DateFormatTimestamp
|
||||
.parse("2020-04-07T14:21:57Z")
|
||||
assertThat(
|
||||
"2020-04-07T14:21:57Z",
|
||||
equalTo(iso8601DateFormatTimestamp.format(parsedDate))
|
||||
)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue