Skip to content

Commit

Permalink
Add language parameter in load webview with game (uberspot#48)
Browse files Browse the repository at this point in the history
* Add in .gitignore Eclipse specific project files excludes

* Add language parameter in load webview with game
  • Loading branch information
a4vi2r authored and uberspot committed Mar 1, 2017
1 parent c4f26fc commit 8378937
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@ proguard/
# Gradle stuff
build
.gradle

# Eclipse project files
.classpath
.project
.settings/
project.properties
6 changes: 5 additions & 1 deletion src/com/uberspot/a2048/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

package com.uberspot.a2048;

import java.util.Locale;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.SharedPreferences;
Expand Down Expand Up @@ -92,9 +94,11 @@ protected void onCreate(Bundle savedInstanceState) {

// If there is a previous instance restore it in the webview
if (savedInstanceState != null) {
// TODO: If app was minimized and Locale language was changed, we need to reload webview with changed language
mWebView.restoreState(savedInstanceState);
} else {
mWebView.loadUrl("file:///android_asset/2048/index.html");
// Load webview with current Locale language
mWebView.loadUrl("file:///android_asset/2048/index.html?lang=" + Locale.getDefault().getLanguage());
}

Toast.makeText(getApplication(), R.string.toggle_fullscreen, Toast.LENGTH_SHORT).show();
Expand Down

0 comments on commit 8378937

Please sign in to comment.