/**
* ORcycle, Copyright 2014, 2015, PSU Transportation, Technology, and People Lab.
*
* @author Robin Murray <robin5@pdx.edu> (code)
* @author Miguel Figliozzi <figliozzi@pdx.edu> and ORcycle team (general app
* design and features, report questionnaires and new ORcycle features)
*
* For more information on the project, go to
* http://www.pdx.edu/transportation-lab/orcycle and http://www.pdx.edu/transportation-lab/app-development
*
* Updated/modified for Oregon pilot study and app deployment.
*
* ORcycle is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or any later version.
* ORcycle is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along with
* ORcycle. If not, see <http://www.gnu.org/licenses/>.
*
*/
package edu.pdx.cecs.orcycle;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.webkit.WebView;
public class WebViewActivity extends Activity {
public static final String MODULE_TAG = "WebViewActivity";
public static final String EXTRA_URL = "url";
public static final String EXTRA_TITLE = "title";
WebView webView;
@SuppressLint("SetJavaScriptEnabled")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
setContentView(R.layout.activity_web_view);
Intent intent = getIntent();
String url = intent.getStringExtra(EXTRA_URL);
String title = intent.getStringExtra(EXTRA_TITLE);
if (null != (title = getIntent().getStringExtra(EXTRA_TITLE))) {
setTitle(title);
}
webView = (WebView) findViewById(R.id.web_view);
//webView.setInitialScale(50);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setBuiltInZoomControls(true);
webView.getSettings().setDisplayZoomControls(true);
webView.loadUrl(url);
getActionBar().hide();
}
catch(Exception ex) {
Log.e(MODULE_TAG, ex.getMessage());
}
}
private void transitionToPreviousActivity() {
Intent intent = new Intent(this, TabsConfig.class);
setResult(RESULT_OK, intent);
finish();
}
@Override
public void onBackPressed() {
try {
transitionToPreviousActivity();
}
catch(Exception ex) {
Log.e(MODULE_TAG, ex.getMessage());
}
}
}