Skip to content
This repository was archived by the owner on May 4, 2023. It is now read-only.

Commit 1c3e197

Browse files
committed
Change how Accept-Language header is processed.
1 parent ad3c9e2 commit 1c3e197

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

app/src/main/java/com/fox2code/mmm/androidacy/AndroidacyActivity.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
import com.fox2code.mmm.utils.Http;
3232
import com.fox2code.mmm.utils.IntentHelper;
3333

34+
import java.util.HashMap;
35+
3436
/**
3537
* Per Androidacy repo implementation agreement, no request of this WebView shall be modified.
3638
*/
@@ -190,7 +192,10 @@ public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathC
190192
this.webView.addJavascriptInterface(androidacyWebAPI =
191193
new AndroidacyWebAPI(this, allowInstall), "mmm");
192194
if (compatLevel != 0) androidacyWebAPI.notifyCompatModeRaw(compatLevel);
193-
this.webView.loadUrl(url);
195+
HashMap<String, String> headers = new HashMap<>();
196+
headers.put("Accept-Language", this.getResources()
197+
.getConfiguration().locale.toLanguageTag());
198+
this.webView.loadUrl(url, headers);
194199
}
195200

196201
@Override

app/src/main/java/com/fox2code/mmm/utils/Http.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public class Http {
130130
}
131131
if (chain.request().header("Accept-Language") == null) {
132132
request.header("Accept-Language", // Send system language to the server
133-
Resources.getSystem().getConfiguration().locale.toLanguageTag());
133+
mainApplication.getResources().getConfiguration().locale.toLanguageTag());
134134
}
135135
return chain.proceed(request.build());
136136
});

app/src/main/res/drawable/ic_foreground.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@
1212
android:fillColor="@color/black" android:fillAlpha="0.25"
1313
android:pathData="M20.5,11H19V7c0,-1.1 -0.9,-2 -2,-2h-4V3.5C13,2.12 11.88,1 10.5,1S8,2.12 8,3.5V5H4c-1.1,0 -1.99,0.9 -1.99,2v3.8H3.5c1.49,0 2.7,1.21 2.7,2.7s-1.21,2.7 -2.7,2.7H2V20c0,1.1 0.9,2 2,2h3.8v-1.5c0,-1.49 1.21,-2.7 2.7,-2.7 1.49,0 2.7,1.21 2.7,2.7V22H17c1.1,0 2,-0.9 2,-2v-4h1.5c1.38,0 2.5,-1.12 2.5,-2.5S21.88,11 20.5,11z"/>
1414
</group>
15+
<group android:scaleX="2"
16+
android:scaleY="2"
17+
android:translateX="31"
18+
android:translateY="31">
19+
<path
20+
android:fillColor="@color/black" android:fillAlpha="0.25"
21+
android:pathData="M20.5,11H19V7c0,-1.1 -0.9,-2 -2,-2h-4V3.5C13,2.12 11.88,1 10.5,1S8,2.12 8,3.5V5H4c-1.1,0 -1.99,0.9 -1.99,2v3.8H3.5c1.49,0 2.7,1.21 2.7,2.7s-1.21,2.7 -2.7,2.7H2V20c0,1.1 0.9,2 2,2h3.8v-1.5c0,-1.49 1.21,-2.7 2.7,-2.7 1.49,0 2.7,1.21 2.7,2.7V22H17c1.1,0 2,-0.9 2,-2v-4h1.5c1.38,0 2.5,-1.12 2.5,-2.5S21.88,11 20.5,11z"/>
22+
</group>
1523
<group android:scaleX="2"
1624
android:scaleY="2"
1725
android:translateX="30"

0 commit comments

Comments
 (0)