Android Open Source - jpHolo Start Activity Uri






From Project

Back to project page jpHolo.

License

The source code is released under:

GNU Lesser General Public License

If you think the Android project jpHolo 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 org.teusink.jpholo;
//from  w ww .  j  av a2s  . co  m
import org.apache.cordova.CordovaActivity;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.res.Configuration;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.webkit.WebView;

public class StartActivityUri extends CordovaActivity {

  public static final String PREFS_NAME = "jpHoloSharedPreferences";

  @SuppressLint("NewApi")
  @Override
  public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    super.init();
    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
      if ( 0 != ( getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE ) ) {
        WebView.setWebContentsDebuggingEnabled(true);
      }
    }
    final SharedPreferences settings = getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
    final SharedPreferences.Editor editor = settings.edit();
    final Uri data = getIntent().getData();
    // final String scheme = data.getScheme(); // Not needed
    // final String host = data.getHost(); // Not needed
    // final String path = data.getPath(); // Not needed
    final String message = data.getQueryParameter("message");
    editor.putString("UriMessage", message);
    editor.commit();
    if (checkScreenSize().equals("large") || checkScreenSize().equals("xlarge")) {
      initiateApp("tablet");
    } else {
      initiateApp("smartphone");
    }
  }

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

  private String checkScreenSize() {
    String screenSize = "normal";
    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

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.ContactInfoDTO.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.ContentFilesystem.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.Filesystem.java
org.apache.cordova.file.InvalidModificationException.java
org.apache.cordova.file.LocalFilesystemURL.java
org.apache.cordova.file.LocalFilesystem.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.globalization.GlobalizationError.java
org.apache.cordova.globalization.Globalization.java
org.apache.cordova.inappbrowser.InAppBrowserDialog.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.splashscreen.SplashScreen.java
org.apache.cordova.statusbar.StatusBar.java
org.apache.cordova.vibration.Vibration.java
org.teusink.jpholo.AndroidService.java
org.teusink.jpholo.StartActivityUri.java
org.teusink.jpholo.StartActivity.java
org.teusink.plugins.AndroidPreferences.java
org.teusink.plugins.Appstore.java
org.teusink.plugins.PackageVersion.java
org.teusink.plugins.PreferredScreenSize.java
org.teusink.plugins.Share.java
org.teusink.plugins.Toasts.java