devsoftprog.java.file.manager.android.fm_f_and.WebActivity.java Source code

Java tutorial

Introduction

Here is the source code for devsoftprog.java.file.manager.android.fm_f_and.WebActivity.java

Source

package devsoftprog.java.file.manager.android.fm_f_and;

/*
@
devsoftprog.java.file.manager.android.fm_f_and
Copyright (c) 2015 tigo
@
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
@
    
@
*/

import android.app.Activity;
//import android.app.AlertDialog.Builder;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.res.Configuration;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.EditText;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
import android.accounts.AccountManager;
import android.accounts.Account;
import android.content.Intent;
//import com.google.android.gms.common.AccountPicker;
import android.view.MenuItem;
import android.view.Menu;
import android.view.MenuInflater;
import android.net.Uri;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.os.Vibrator;
import android.view.Window;
import android.widget.CheckBox;
import org.apache.commons.lang3.exception.ExceptionUtils;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.widget.LinearLayout;
import android.text.InputType;
import java.io.File;
import android.os.Environment;
import android.widget.CheckBox;
import org.apache.commons.io.FileUtils;
import java.io.File;
import android.app.Dialog;
//import com.android.vending.billing.IInAppBillingService;
import android.content.ServiceConnection;
import org.json.JSONObject;
import org.json.JSONException;
import java.util.ArrayList;
import android.content.ComponentName;
import android.os.IBinder;
import android.app.PendingIntent;
//import com.google.android.vending.licensing.LicenseChecker;
//import com.google.android.vending.licensing.LicenseCheckerCallback;
//import com.google.android.vending.licensing.ServerManagedPolicy;
//import com.google.android.vending.licensing.AESObfuscator;
import android.provider.Settings.Secure;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ApplicationInfo;
import android.widget.ProgressBar;
import android.app.NotificationManager;
import android.support.v4.app.NotificationCompat.Builder;
import android.support.v4.app.NotificationCompat;
//import com.google.android.gms.auth.GoogleAuthUtil;
//import com.google.android.gms.auth.UserRecoverableAuthException;
//import com.google.android.gms.auth.GoogleAuthException;
import java.io.IOException;
import android.provider.MediaStore;
import android.widget.ListView;
import android.widget.ArrayAdapter;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView;
import android.view.ViewGroup;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;

import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan;
import android.graphics.Color;
import android.text.method.ScrollingMovementMethod;
import android.text.Html;
import android.text.Layout;

import android.webkit.WebView;
import android.view.ViewGroup.LayoutParams;

import java.net.URL;
import java.net.URLConnection;
import java.net.HttpURLConnection;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import android.app.ProgressDialog;

import java.io.ObjectOutputStream;
import java.io.ObjectInputStream;
import java.io.FileOutputStream;
import java.io.FileInputStream;

import java.util.HashMap;
import android.text.ClipboardManager;

public class WebActivity extends Activity {

    String activityTag = "WebActivity";

    private App app;

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        Log.i(activityTag, "onCreate");
        //Toast.makeText(WebActivity.this, "onCreate", Toast.LENGTH_SHORT).show();
        super.onCreate(savedInstanceState);

        setContentView(R.layout.web);

        app = (App) getApplication();

        //Toast.makeText(WebActivity.this, "new", Toast.LENGTH_SHORT).show();
        app.wv = (TextView) findViewById(R.id.wv);

        //app.wv.getSettings().setSupportZoom(true);
        //app.wv.getSettings().setUseWideViewPort(true);

        //app.wv.loadDataWithBaseURL("", app.html, "text/html", "utf-8", "");
        app.wv.setText(app.html);

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.web, menu);
        return true;
    }

    public boolean onOptionsItemSelected(MenuItem item) {

        switch (item.getItemId()) {

        case R.id.clip:
            try {
                ClipboardManager clipboard = (ClipboardManager) WebActivity.this
                        .getSystemService(Context.CLIPBOARD_SERVICE);
                clipboard.setText(app.html);
            } catch (Exception e) {
                Toast.makeText(WebActivity.this, "error: " + e.getMessage(), Toast.LENGTH_LONG).show();
                e = null;
            }
            return true;

        default:

            return true;

        }

    }

}