collabora-online/android/app/src/main/java/org/libreoffice/androidapp/ShowHTMLActivity.java

61 lines
2.0 KiB
Java

/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.libreoffice.androidapp;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.res.AssetManager;
import android.os.Build;
import android.os.Bundle;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import org.libreoffice.androidapp.ui.LibreOfficeUIActivity;
/**
* This activity displays a html file from assets.
* Used to display license and notice from the about popup.
*/
public class ShowHTMLActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_show_html);
WebView mWebView = findViewById(R.id.browser);
mWebView.setWebViewClient(new WebViewClient());
mWebView.loadUrl("file:///android_asset/" + getIntent().getStringExtra("path"));
Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getBaseContext(), LibreOfficeUIActivity.class);
startActivity(intent);
}
});
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */