/*
 * Copyright 2012 Artur Dryomov
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package ru.ming13.gambit.ui.activity;


import android.content.ContentResolver;
import android.os.Bundle;
import android.webkit.WebView;
import com.actionbarsherlock.app.SherlockActivity;
import ru.ming13.gambit.R;


public class LicensesActivity extends SherlockActivity
{
	private static final String SCHEME = ContentResolver.SCHEME_FILE;
	private static final String AUTHORITY = "android_asset";
	private static final String PATH = "licenses.html";

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_licenses);

		setUpLicenses();
	}

	private void setUpLicenses() {
		WebView licensesWebView = (WebView) findViewById(R.id.licenses_webview);
		licensesWebView.loadUrl(buildLicensesUri());
	}

	private String buildLicensesUri() {
		return String.format("%s:///%s/%s", SCHEME, AUTHORITY, PATH);
	}
}

@@ -1255,33 +1255,94 @@
 %7B%0A%09%09
+get
 WebView
- licensesWebView =
+().loadUrl(buildLicensesUri());%0A%09%7D%0A%0A%09private WebView getWebView() %7B%0A%09%09return
  (We
@@ -1389,55 +1389,8 @@
 w);%0A
-%09%09licensesWebView.loadUrl(buildLicensesUri());%0A
 %09%7D%0A%0A
@@ -1492,11 +1492,342 @@
 ATH);%0A%09%7D
+%0A%0A%09@Override%0A%09protected void onSaveInstanceState(Bundle outState) %7B%0A%09%09super.onSaveInstanceState(outState);%0A%0A%09%09getWebView().saveState(outState);%0A%09%7D%0A%0A%09@Override%0A%09protected void onRestoreInstanceState(Bundle savedInstanceState) %7B%0A%09%09super.onRestoreInstanceState(savedInstanceState);%0A%0A%09%09getWebView().restoreState(savedInstanceState);%0A%09%7D
 %0A%7D%0A

Add scroll position saving on configuration changes.