Android Open Source - MarsImagesAndroid About This App Activity






From Project

Back to project page MarsImagesAndroid.

License

The source code is released under:

Apache License

If you think the Android project MarsImagesAndroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package gov.nasa.jpl.hi.marsimages.ui;
/*from  w  w w .j  a  va  2 s . c  o  m*/
import android.app.Activity;
import android.content.res.Configuration;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class AboutThisAppActivity extends Activity {

    public static final String INTENT_ACTION_ABOUT_THIS_APP = "gov.nasa.jpl.hi.marsimages.ABOUT_THIS_APP";

    private WebView view;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        view = new WebView(this);
        view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT));
        setContentView(view);

        if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
            DisplayMetrics dm = new DisplayMetrics();
            getWindowManager().getDefaultDisplay().getMetrics(dm);
            if (dm.widthPixels < 360) {
                view.setInitialScale((int) (dm.widthPixels / 360.0 * 100));
            }
        }

        view.loadUrl("http://www.powellware.net/MarsImagesAndroid.html");
        view.setWebViewClient(new MarsImagesWebViewClient());
    }

    private class MarsImagesWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            //keep only my web content in this view, let external links go to system browser
            if (view != null && url.startsWith("http://www.powellware.net")) {
                view.loadUrl(url);
                return true;
            }
            return false;
        }
    }
}




Java Source Code List

gov.nasa.jpl.hi.marsimages.EvernoteMars.java
gov.nasa.jpl.hi.marsimages.MarsImagesApp.java
gov.nasa.jpl.hi.marsimages.Utils.java
gov.nasa.jpl.hi.marsimages.rovers.Curiosity.java
gov.nasa.jpl.hi.marsimages.rovers.MERTitle.java
gov.nasa.jpl.hi.marsimages.rovers.MarsTime.java
gov.nasa.jpl.hi.marsimages.rovers.Opportunity.java
gov.nasa.jpl.hi.marsimages.rovers.Rover.java
gov.nasa.jpl.hi.marsimages.rovers.Spirit.java
gov.nasa.jpl.hi.marsimages.rovers.Title.java
gov.nasa.jpl.hi.marsimages.ui.AboutThisAppActivity.java
gov.nasa.jpl.hi.marsimages.ui.HackyDrawerLayout.java
gov.nasa.jpl.hi.marsimages.ui.HackyViewPager.java
gov.nasa.jpl.hi.marsimages.ui.ImageListFragment.java
gov.nasa.jpl.hi.marsimages.ui.ImageViewActivity.java
gov.nasa.jpl.hi.marsimages.ui.ImageViewFragment.java
gov.nasa.jpl.hi.marsimages.ui.MarsClockActivity.java