11 package com.freerdp.freerdpcore.presentation;
13 import android.content.res.Configuration;
14 import android.os.Bundle;
15 import androidx.appcompat.app.AppCompatActivity;
16 import android.util.Log;
17 import android.webkit.WebSettings;
18 import android.webkit.WebView;
20 import java.io.BufferedReader;
21 import java.io.IOException;
22 import java.io.InputStream;
23 import java.io.InputStreamReader;
24 import java.util.Locale;
29 private static final String TAG =
HelpActivity.class.toString();
31 @Override
public void onCreate(Bundle savedInstanceState)
33 super.onCreate(savedInstanceState);
35 WebView webview =
new WebView(
this);
36 setContentView(webview);
39 if ((getResources().getConfiguration().screenLayout &
40 Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE)
41 filename =
"gestures.html";
43 filename =
"gestures_phone.html";
45 WebSettings settings = webview.getSettings();
46 settings.setDomStorageEnabled(
true);
47 settings.setUseWideViewPort(
true);
48 settings.setLoadWithOverviewMode(
true);
49 settings.setSupportZoom(
true);
50 settings.setJavaScriptEnabled(
true);
52 settings.setAllowContentAccess(
true);
53 settings.setAllowFileAccess(
true);
55 final Locale def = Locale.getDefault();
56 final String prefix = def.getLanguage().toLowerCase(def);
58 final String base =
"file:///android_asset/";
59 final String baseName =
"help_page";
60 String dir = prefix +
"_" + baseName +
"/";
61 String file = dir + filename;
65 is = getAssets().open(file);
70 Log.e(TAG,
"Missing localized asset " + file, e);
72 file = dir + filename;
75 webview.loadUrl(base + file);