/**
 * Copyright (C) 2013 by Raphael Michel under the MIT license:
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), 
 * to deal in the Software without restriction, including without limitation 
 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 
 * and/or sell copies of the Software, and to permit persons to whom the Software 
 * is furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in 
 * all copies or substantial portions of the Software.
 * 
 * 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.
 */
package de.geeksfactory.opacclient.frontend;

import org.holoeverywhere.LayoutInflater;
import org.holoeverywhere.app.Fragment;
import org.holoeverywhere.widget.ProgressBar;
import org.json.JSONException;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.TextView;
import de.geeksfactory.opacclient.OpacClient;
import de.geeksfactory.opacclient.R;
import de.geeksfactory.opacclient.frontend.OpacActivity.AccountSelectedListener;
import de.geeksfactory.opacclient.objects.Account;

public class InfoFragment extends Fragment implements AccountSelectedListener {

	private WebView wvInfo;
	private OpacClient app;
	private View view;

	public void load() {
		wvInfo = (WebView) view.findViewById(R.id.wvInfo);
		TextView tvErr = (TextView) view.findViewById(R.id.tvErr);
		wvInfo.loadData(getString(R.string.loading), "text/html", null);

		try {
			String infoUrl = app.getLibrary().getData()
					.getString("information");
			if (infoUrl == null || infoUrl.equals("null")) {
				wvInfo.setVisibility(View.GONE);
				tvErr.setVisibility(View.VISIBLE);
				tvErr.setText(R.string.info_unsupported);
			} else if (infoUrl.startsWith("http")) {
				wvInfo.loadUrl(infoUrl);
			} else {
				wvInfo.loadUrl(app.getLibrary().getData().getString("baseurl")
						+ infoUrl);
			}
		} catch (JSONException e) {
			e.printStackTrace();
			wvInfo.setVisibility(View.GONE);
			tvErr.setVisibility(View.VISIBLE);
			tvErr.setText(R.string.info_error);
		}
	}

	@SuppressWarnings("deprecation")
	@SuppressLint("SetJavaScriptEnabled")
	@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		view = inflater.inflate(R.layout.fragment_info, container, false);
		app = (OpacClient) getActivity().getApplication();
		
		setHasOptionsMenu(true);

		load();

		getSupportActionBar().setDisplayHomeAsUpEnabled(true);

		wvInfo = (WebView) view.findViewById(R.id.wvInfo);

		wvInfo.getSettings().setSupportZoom(true);
		wvInfo.getSettings().setJavaScriptEnabled(true);
		wvInfo.getSettings().setAppCacheMaxSize(5 * 1024 * 1024);
		wvInfo.getSettings().setAppCacheEnabled(true);
		wvInfo.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);

		wvInfo.setWebChromeClient(new WebChromeClient() {
			@Override
			public void onProgressChanged(WebView v, int progress) {
				ProgressBar Pbar = (ProgressBar) view.findViewById(R.id.pbWebProgress);
				if (progress < 100 && Pbar.getVisibility() == View.GONE) {
					Pbar.setVisibility(View.VISIBLE);
				}
				Pbar.setProgress(progress);
				if (progress == 100) {
					Pbar.setVisibility(View.GONE);
				}
			}
		});
		
		return view;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		if (item.getItemId() == R.id.action_refresh) {
			wvInfo.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
			load();
			return true;
		}
		return super.onOptionsItemSelected(item);
	}

	@Override
	public void onCreateOptionsMenu(android.view.Menu menu, MenuInflater inflater) {
		inflater.inflate(R.menu.activity_info, menu);
		super.onCreateOptionsMenu(menu, inflater);
	}

	@Override
	public void accountSelected(Account account) {
		load();
	}
}

@@ -1983,21 +1983,23 @@
 r %7B%0A%0A%09pr
-ivate
+otected
  WebView
@@ -2010,21 +2010,23 @@
 nfo;%0A%09pr
-ivate
+otected
  OpacCli
@@ -2041,13 +2041,15 @@
 %0A%09pr
-ivate
+otected
  Vie

Make attributes protected