Android Open Source - Phonegap-3-Boilerplate Start Activity






From Project

Back to project page Phonegap-3-Boilerplate.

License

The source code is released under:

GNU General Public License

If you think the Android project Phonegap-3-Boilerplate 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 com.rjnpnigrhi.myapp;
//from w  ww. j  a v  a2  s  .  com
import org.apache.cordova.DroidGap;

import android.content.res.Configuration;
import android.os.Bundle;

public class StartActivity extends DroidGap {

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    super.init();
    if (checkScreenSize().equals("large") || checkScreenSize().equals("xlarge")) {
      initiateApp("tablet");
    } else {
      initiateApp("smartphone");
    }
  }

  private void initiateApp(String screenSize) {
    if (screenSize.equals("tablet")) {
      super.loadUrl("file:///android_asset/www/index.html");
    } else {
      super.loadUrl("file:///android_asset/www/index.html");
    }
  }

  private String checkScreenSize() {
    String screenSize;
    if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE) {
      screenSize = "xlarge";
    } else if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) {
      screenSize = "large";
    } else if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL) {
      screenSize = "normal";
    } else if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_SMALL) {
      screenSize = "small";
    } else {
      screenSize = "normal";
    }
    return screenSize;
  }
}




Java Source Code List

com.rjnpnigrhi.myapp.AndroidService.java
com.rjnpnigrhi.myapp.StartActivity.java
org.apache.cordova.batterystatus.BatteryListener.java
org.apache.cordova.camera.CameraLauncher.java
org.apache.cordova.camera.ExifHelper.java
org.apache.cordova.camera.FileHelper.java
org.apache.cordova.contacts.ContactAccessorSdk5.java
org.apache.cordova.contacts.ContactAccessor.java
org.apache.cordova.contacts.ContactManager.java
org.apache.cordova.device.Device.java
org.apache.cordova.devicemotion.AccelListener.java
org.apache.cordova.deviceorientation.CompassListener.java
org.apache.cordova.dialogs.Notification.java
org.apache.cordova.file.DirectoryManager.java
org.apache.cordova.file.EncodingException.java
org.apache.cordova.file.FileExistsException.java
org.apache.cordova.file.FileHelper.java
org.apache.cordova.file.FileUtils.java
org.apache.cordova.file.InvalidModificationException.java
org.apache.cordova.file.NoModificationAllowedException.java
org.apache.cordova.file.TypeMismatchException.java
org.apache.cordova.filetransfer.FileProgressResult.java
org.apache.cordova.filetransfer.FileTransfer.java
org.apache.cordova.filetransfer.FileUploadResult.java
org.apache.cordova.geolocation.CordovaLocationListener.java
org.apache.cordova.geolocation.GPSListener.java
org.apache.cordova.geolocation.GeoBroker.java
org.apache.cordova.geolocation.NetworkListener.java
org.apache.cordova.globalization.GlobalizationError.java
org.apache.cordova.globalization.Globalization.java
org.apache.cordova.inappbrowser.InAppBrowser.java
org.apache.cordova.inappbrowser.InAppChromeClient.java
org.apache.cordova.media.AudioHandler.java
org.apache.cordova.media.AudioPlayer.java
org.apache.cordova.media.FileHelper.java
org.apache.cordova.mediacapture.Capture.java
org.apache.cordova.mediacapture.FileHelper.java
org.apache.cordova.networkinformation.NetworkManager.java
org.apache.cordova.plugins.AndroidPreferences.java
org.apache.cordova.plugins.Appstore.java
org.apache.cordova.plugins.HomeButton.java
org.apache.cordova.plugins.PackageVersion.java
org.apache.cordova.plugins.PreferredScreenSize.java
org.apache.cordova.plugins.Share.java
org.apache.cordova.plugins.Toasts.java
org.apache.cordova.splashscreen.SplashScreen.java
org.apache.cordova.vibration.Vibration.java