org.apache.cordova.CordovaInterface#getActivity ( )源码实例Demo

下面列出了org.apache.cordova.CordovaInterface#getActivity ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: cordova-androidwear   文件: AndroidWearPlugin.java
@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
	super.initialize(cordova, webView);

	Log.d(TAG, "initialize");

	Activity context = cordova.getActivity();

	serviceIntent = new Intent(context, WearProviderService.class);

	Log.d(TAG, "Attempting to start service");
	context.startService(serviceIntent);

	Log.d(TAG, "Attempting to bind to service");
	context.bindService(serviceIntent, serviceConnection,
			Context.BIND_AUTO_CREATE);
}
 
@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
    super.initialize(cordova, webView);
    _cordova = cordova;
    _cordovaActivity = cordova.getActivity();
    _sharedPreferences = PreferenceManager.getDefaultSharedPreferences(_cordovaActivity);
    _permissionsController = new PermissionsController(_cordovaActivity, _cordova);
    _permissionsController.handleOnInitialize();
    removeActionPreferences();
    Log.d(TAG, "Initialized");
}
 
源代码3 项目: reader   文件: Notification.java
@SuppressLint("InlinedApi")
private ProgressDialog createProgressDialog(CordovaInterface cordova) {
    int currentapiVersion = android.os.Build.VERSION.SDK_INT;
    if (currentapiVersion >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        return new ProgressDialog(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
    } else {
        return new ProgressDialog(cordova.getActivity());
    }
}
 
源代码4 项目: reader   文件: Notification.java
@SuppressLint("NewApi")
private AlertDialog.Builder createDialog(CordovaInterface cordova) {
    int currentapiVersion = android.os.Build.VERSION.SDK_INT;
    if (currentapiVersion >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        return new AlertDialog.Builder(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
    } else {
        return new AlertDialog.Builder(cordova.getActivity());
    }
}
 
源代码5 项目: reader   文件: Notification.java
@SuppressLint("NewApi")
private AlertDialog.Builder createDialog(CordovaInterface cordova) {
    int currentapiVersion = android.os.Build.VERSION.SDK_INT;
    if (currentapiVersion >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        return new AlertDialog.Builder(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
    } else {
        return new AlertDialog.Builder(cordova.getActivity());
    }
}
 
源代码6 项目: reader   文件: Notification.java
@SuppressLint("NewApi")
private AlertDialog.Builder createDialog(CordovaInterface cordova) {
    int currentapiVersion = android.os.Build.VERSION.SDK_INT;
    if (currentapiVersion >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        return new AlertDialog.Builder(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
    } else {
        return new AlertDialog.Builder(cordova.getActivity());
    }
}
 
源代码7 项目: phonegapbootcampsite   文件: Notification.java
/**
 * Show the progress dialog.
 *
 * @param title     Title of the dialog
 * @param message   The message of the dialog
 */
public synchronized void progressStart(final String title, final String message) {
    if (this.progressDialog != null) {
        this.progressDialog.dismiss();
        this.progressDialog = null;
    }
    final Notification notification = this;
    final CordovaInterface cordova = this.cordova;
    Runnable runnable = new Runnable() {
        public void run() {
            notification.progressDialog = new ProgressDialog(cordova.getActivity());
            notification.progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
            notification.progressDialog.setTitle(title);
            notification.progressDialog.setMessage(message);
            notification.progressDialog.setCancelable(true);
            notification.progressDialog.setMax(100);
            notification.progressDialog.setProgress(0);
            notification.progressDialog.setOnCancelListener(
                    new DialogInterface.OnCancelListener() {
                        public void onCancel(DialogInterface dialog) {
                            notification.progressDialog = null;
                        }
                    });
            notification.progressDialog.show();
        }
    };
    this.cordova.getActivity().runOnUiThread(runnable);
}
 
源代码8 项目: phonegapbootcampsite   文件: Notification.java
/**
 * Show the progress dialog.
 *
 * @param title     Title of the dialog
 * @param message   The message of the dialog
 */
public synchronized void progressStart(final String title, final String message) {
    if (this.progressDialog != null) {
        this.progressDialog.dismiss();
        this.progressDialog = null;
    }
    final Notification notification = this;
    final CordovaInterface cordova = this.cordova;
    Runnable runnable = new Runnable() {
        public void run() {
            notification.progressDialog = new ProgressDialog(cordova.getActivity());
            notification.progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
            notification.progressDialog.setTitle(title);
            notification.progressDialog.setMessage(message);
            notification.progressDialog.setCancelable(true);
            notification.progressDialog.setMax(100);
            notification.progressDialog.setProgress(0);
            notification.progressDialog.setOnCancelListener(
                    new DialogInterface.OnCancelListener() {
                        public void onCancel(DialogInterface dialog) {
                            notification.progressDialog = null;
                        }
                    });
            notification.progressDialog.show();
        }
    };
    this.cordova.getActivity().runOnUiThread(runnable);
}
 
@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
  super.initialize(cordova, webView);

  mainActivity = cordova.getActivity();
  getApiClient();
}
 
源代码10 项目: reader   文件: FileUtils.java
@Override
 public void initialize(CordovaInterface cordova, CordovaWebView webView) {
 	super.initialize(cordova, webView);
 	this.filesystems = new ArrayList<Filesystem>();

 	String tempRoot = null;
 	String persistentRoot = null;

 	Activity activity = cordova.getActivity();
 	String packageName = activity.getPackageName();
 	
 	String location = activity.getIntent().getStringExtra("androidpersistentfilelocation");
 	if (location == null) {
 		location = "compatibility";
 	}
 	tempRoot = activity.getCacheDir().getAbsolutePath();
 	if ("internal".equalsIgnoreCase(location)) {
 		persistentRoot = activity.getFilesDir().getAbsolutePath() + "/files/";
 		this.configured = true;
 	} else if ("compatibility".equalsIgnoreCase(location)) {
 		/*
 		 *  Fall-back to compatibility mode -- this is the logic implemented in
 		 *  earlier versions of this plugin, and should be maintained here so
 		 *  that apps which were originally deployed with older versions of the
 		 *  plugin can continue to provide access to files stored under those
 		 *  versions.
 		 */
 		if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
 			persistentRoot = Environment.getExternalStorageDirectory().getAbsolutePath();
 			tempRoot = Environment.getExternalStorageDirectory().getAbsolutePath() +
 					"/Android/data/" + packageName + "/cache/";
 		} else {
 			persistentRoot = "/data/data/" + packageName;
 		}
 		this.configured = true;
 	}

 	if (this.configured) {
// Create the directories if they don't exist.
new File(tempRoot).mkdirs();
new File(persistentRoot).mkdirs();

 		// Register initial filesystems
 		// Note: The temporary and persistent filesystems need to be the first two
 		// registered, so that they will match window.TEMPORARY and window.PERSISTENT,
 		// per spec.
 		this.registerFilesystem(new LocalFilesystem("temporary", cordova, tempRoot));
 		this.registerFilesystem(new LocalFilesystem("persistent", cordova, persistentRoot));
 		this.registerFilesystem(new ContentFilesystem(cordova, webView));

         registerExtraFileSystems(getExtraFileSystemsPreference(activity), getAvailableFileSystems(activity));

 		// Initialize static plugin reference for deprecated getEntry method
 		if (filePlugin == null) {
 			FileUtils.filePlugin = this;
 		}
 	} else {
 		Log.e(LOG_TAG, "File plugin configuration error: Please set AndroidPersistentFileLocation in config.xml to one of \"internal\" (for new applications) or \"compatibility\" (for compatibility with previous versions)");
 		activity.finish();
 	}
 }
 
源代码11 项目: keemob   文件: FileUtils.java
@Override
 public void initialize(CordovaInterface cordova, CordovaWebView webView) {
 	super.initialize(cordova, webView);
 	this.filesystems = new ArrayList<Filesystem>();
     this.pendingRequests = new PendingRequests();

 	String tempRoot = null;
 	String persistentRoot = null;

 	Activity activity = cordova.getActivity();
 	String packageName = activity.getPackageName();

     String location = preferences.getString("androidpersistentfilelocation", "internal");

 	tempRoot = activity.getCacheDir().getAbsolutePath();
 	if ("internal".equalsIgnoreCase(location)) {
 		persistentRoot = activity.getFilesDir().getAbsolutePath() + "/files/";
 		this.configured = true;
 	} else if ("compatibility".equalsIgnoreCase(location)) {
 		/*
 		 *  Fall-back to compatibility mode -- this is the logic implemented in
 		 *  earlier versions of this plugin, and should be maintained here so
 		 *  that apps which were originally deployed with older versions of the
 		 *  plugin can continue to provide access to files stored under those
 		 *  versions.
 		 */
 		if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
 			persistentRoot = Environment.getExternalStorageDirectory().getAbsolutePath();
 			tempRoot = Environment.getExternalStorageDirectory().getAbsolutePath() +
 					"/Android/data/" + packageName + "/cache/";
 		} else {
 			persistentRoot = "/data/data/" + packageName;
 		}
 		this.configured = true;
 	}

 	if (this.configured) {
// Create the directories if they don't exist.
File tmpRootFile = new File(tempRoot);
         File persistentRootFile = new File(persistentRoot);
         tmpRootFile.mkdirs();
         persistentRootFile.mkdirs();

 		// Register initial filesystems
 		// Note: The temporary and persistent filesystems need to be the first two
 		// registered, so that they will match window.TEMPORARY and window.PERSISTENT,
 		// per spec.
 		this.registerFilesystem(new LocalFilesystem("temporary", webView.getContext(), webView.getResourceApi(), tmpRootFile));
 		this.registerFilesystem(new LocalFilesystem("persistent", webView.getContext(), webView.getResourceApi(), persistentRootFile));
 		this.registerFilesystem(new ContentFilesystem(webView.getContext(), webView.getResourceApi()));
         this.registerFilesystem(new AssetFilesystem(webView.getContext().getAssets(), webView.getResourceApi()));

         registerExtraFileSystems(getExtraFileSystemsPreference(activity), getAvailableFileSystems(activity));

 		// Initialize static plugin reference for deprecated getEntry method
 		if (filePlugin == null) {
 			FileUtils.filePlugin = this;
 		}
 	} else {
 		LOG.e(LOG_TAG, "File plugin configuration error: Please set AndroidPersistentFileLocation in config.xml to one of \"internal\" (for new applications) or \"compatibility\" (for compatibility with previous versions)");
 		activity.finish();
 	}
 }
 
源代码12 项目: keemob   文件: FileUtils.java
@Override
 public void initialize(CordovaInterface cordova, CordovaWebView webView) {
 	super.initialize(cordova, webView);
 	this.filesystems = new ArrayList<Filesystem>();
     this.pendingRequests = new PendingRequests();

 	String tempRoot = null;
 	String persistentRoot = null;

 	Activity activity = cordova.getActivity();
 	String packageName = activity.getPackageName();

     String location = preferences.getString("androidpersistentfilelocation", "internal");

 	tempRoot = activity.getCacheDir().getAbsolutePath();
 	if ("internal".equalsIgnoreCase(location)) {
 		persistentRoot = activity.getFilesDir().getAbsolutePath() + "/files/";
 		this.configured = true;
 	} else if ("compatibility".equalsIgnoreCase(location)) {
 		/*
 		 *  Fall-back to compatibility mode -- this is the logic implemented in
 		 *  earlier versions of this plugin, and should be maintained here so
 		 *  that apps which were originally deployed with older versions of the
 		 *  plugin can continue to provide access to files stored under those
 		 *  versions.
 		 */
 		if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
 			persistentRoot = Environment.getExternalStorageDirectory().getAbsolutePath();
 			tempRoot = Environment.getExternalStorageDirectory().getAbsolutePath() +
 					"/Android/data/" + packageName + "/cache/";
 		} else {
 			persistentRoot = "/data/data/" + packageName;
 		}
 		this.configured = true;
 	}

 	if (this.configured) {
// Create the directories if they don't exist.
File tmpRootFile = new File(tempRoot);
         File persistentRootFile = new File(persistentRoot);
         tmpRootFile.mkdirs();
         persistentRootFile.mkdirs();

 		// Register initial filesystems
 		// Note: The temporary and persistent filesystems need to be the first two
 		// registered, so that they will match window.TEMPORARY and window.PERSISTENT,
 		// per spec.
 		this.registerFilesystem(new LocalFilesystem("temporary", webView.getContext(), webView.getResourceApi(), tmpRootFile));
 		this.registerFilesystem(new LocalFilesystem("persistent", webView.getContext(), webView.getResourceApi(), persistentRootFile));
 		this.registerFilesystem(new ContentFilesystem(webView.getContext(), webView.getResourceApi()));
         this.registerFilesystem(new AssetFilesystem(webView.getContext().getAssets(), webView.getResourceApi()));

         registerExtraFileSystems(getExtraFileSystemsPreference(activity), getAvailableFileSystems(activity));

 		// Initialize static plugin reference for deprecated getEntry method
 		if (filePlugin == null) {
 			FileUtils.filePlugin = this;
 		}
 	} else {
 		LOG.e(LOG_TAG, "File plugin configuration error: Please set AndroidPersistentFileLocation in config.xml to one of \"internal\" (for new applications) or \"compatibility\" (for compatibility with previous versions)");
 		activity.finish();
 	}
 }
 
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
    super.initialize(cordova, webView);
    Log.v(TAG, "Init Fingerprint");
    mPromptInfoBuilder = new PromptInfo.Builder(cordova.getActivity());
}
 
源代码14 项目: L.TileLayer.Cordova   文件: FileUtils.java
@Override
 public void initialize(CordovaInterface cordova, CordovaWebView webView) {
 	super.initialize(cordova, webView);
 	this.filesystems = new ArrayList<Filesystem>();

 	String tempRoot = null;
 	String persistentRoot = null;

 	Activity activity = cordova.getActivity();
 	String packageName = activity.getPackageName();
 	
 	String location = activity.getIntent().getStringExtra("androidpersistentfilelocation");
 	if (location == null) {
 		location = "compatibility";
 	}
 	tempRoot = activity.getCacheDir().getAbsolutePath();
 	if ("internal".equalsIgnoreCase(location)) {
 		persistentRoot = activity.getFilesDir().getAbsolutePath() + "/files/";
 		this.configured = true;
 	} else if ("compatibility".equalsIgnoreCase(location)) {
 		/*
 		 *  Fall-back to compatibility mode -- this is the logic implemented in
 		 *  earlier versions of this plugin, and should be maintained here so
 		 *  that apps which were originally deployed with older versions of the
 		 *  plugin can continue to provide access to files stored under those
 		 *  versions.
 		 */
 		if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
 			persistentRoot = Environment.getExternalStorageDirectory().getAbsolutePath();
 			tempRoot = Environment.getExternalStorageDirectory().getAbsolutePath() +
 					"/Android/data/" + packageName + "/cache/";
 		} else {
 			persistentRoot = "/data/data/" + packageName;
 		}
 		this.configured = true;
 	}

 	if (this.configured) {
// Create the directories if they don't exist.
new File(tempRoot).mkdirs();
new File(persistentRoot).mkdirs();

 		// Register initial filesystems
 		// Note: The temporary and persistent filesystems need to be the first two
 		// registered, so that they will match window.TEMPORARY and window.PERSISTENT,
 		// per spec.
 		this.registerFilesystem(new LocalFilesystem("temporary", cordova, tempRoot));
 		this.registerFilesystem(new LocalFilesystem("persistent", cordova, persistentRoot));
 		this.registerFilesystem(new ContentFilesystem(cordova, webView));

         registerExtraFileSystems(getExtraFileSystemsPreference(activity), getAvailableFileSystems(activity));

 		// Initialize static plugin reference for deprecated getEntry method
 		if (filePlugin == null) {
 			FileUtils.filePlugin = this;
 		}
 	} else {
 		Log.e(LOG_TAG, "File plugin configuration error: Please set AndroidPersistentFileLocation in config.xml to one of \"internal\" (for new applications) or \"compatibility\" (for compatibility with previous versions)");
 		activity.finish();
 	}
 }
 
源代码15 项目: reader   文件: FileUtils.java
@Override
 public void initialize(CordovaInterface cordova, CordovaWebView webView) {
 	super.initialize(cordova, webView);
 	this.filesystems = new ArrayList<Filesystem>();

 	String tempRoot = null;
 	String persistentRoot = null;

 	Activity activity = cordova.getActivity();
 	String packageName = activity.getPackageName();
 	
 	String location = activity.getIntent().getStringExtra("androidpersistentfilelocation");
 	if (location == null) {
 		location = "compatibility";
 	}
 	tempRoot = activity.getCacheDir().getAbsolutePath();
 	if ("internal".equalsIgnoreCase(location)) {
 		persistentRoot = activity.getFilesDir().getAbsolutePath() + "/files/";
 		this.configured = true;
 	} else if ("compatibility".equalsIgnoreCase(location)) {
 		/*
 		 *  Fall-back to compatibility mode -- this is the logic implemented in
 		 *  earlier versions of this plugin, and should be maintained here so
 		 *  that apps which were originally deployed with older versions of the
 		 *  plugin can continue to provide access to files stored under those
 		 *  versions.
 		 */
 		if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
 			persistentRoot = Environment.getExternalStorageDirectory().getAbsolutePath();
 			tempRoot = Environment.getExternalStorageDirectory().getAbsolutePath() +
 					"/Android/data/" + packageName + "/cache/";
 		} else {
 			persistentRoot = "/data/data/" + packageName;
 		}
 		this.configured = true;
 	}

 	if (this.configured) {
// Create the directories if they don't exist.
new File(tempRoot).mkdirs();
new File(persistentRoot).mkdirs();

 		// Register initial filesystems
 		// Note: The temporary and persistent filesystems need to be the first two
 		// registered, so that they will match window.TEMPORARY and window.PERSISTENT,
 		// per spec.
 		this.registerFilesystem(new LocalFilesystem("temporary", cordova, tempRoot));
 		this.registerFilesystem(new LocalFilesystem("persistent", cordova, persistentRoot));
 		this.registerFilesystem(new ContentFilesystem(cordova, webView));

         registerExtraFileSystems(getExtraFileSystemsPreference(activity), getAvailableFileSystems(activity));

 		// Initialize static plugin reference for deprecated getEntry method
 		if (filePlugin == null) {
 			FileUtils.filePlugin = this;
 		}
 	} else {
 		Log.e(LOG_TAG, "File plugin configuration error: Please set AndroidPersistentFileLocation in config.xml to one of \"internal\" (for new applications) or \"compatibility\" (for compatibility with previous versions)");
 		activity.finish();
 	}
 }
 
源代码16 项目: reacteu-app   文件: FileUtils.java
@Override
 public void initialize(CordovaInterface cordova, CordovaWebView webView) {
 	super.initialize(cordova, webView);
 	this.filesystems = new ArrayList<Filesystem>();
     this.pendingRequests = new PendingRequests();

 	String tempRoot = null;
 	String persistentRoot = null;

 	Activity activity = cordova.getActivity();
 	String packageName = activity.getPackageName();

     String location = preferences.getString("androidpersistentfilelocation", "internal");

 	tempRoot = activity.getCacheDir().getAbsolutePath();
 	if ("internal".equalsIgnoreCase(location)) {
 		persistentRoot = activity.getFilesDir().getAbsolutePath() + "/files/";
 		this.configured = true;
 	} else if ("compatibility".equalsIgnoreCase(location)) {
 		/*
 		 *  Fall-back to compatibility mode -- this is the logic implemented in
 		 *  earlier versions of this plugin, and should be maintained here so
 		 *  that apps which were originally deployed with older versions of the
 		 *  plugin can continue to provide access to files stored under those
 		 *  versions.
 		 */
 		if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
 			persistentRoot = Environment.getExternalStorageDirectory().getAbsolutePath();
 			tempRoot = Environment.getExternalStorageDirectory().getAbsolutePath() +
 					"/Android/data/" + packageName + "/cache/";
 		} else {
 			persistentRoot = "/data/data/" + packageName;
 		}
 		this.configured = true;
 	}

 	if (this.configured) {
// Create the directories if they don't exist.
File tmpRootFile = new File(tempRoot);
         File persistentRootFile = new File(persistentRoot);
         tmpRootFile.mkdirs();
         persistentRootFile.mkdirs();

 		// Register initial filesystems
 		// Note: The temporary and persistent filesystems need to be the first two
 		// registered, so that they will match window.TEMPORARY and window.PERSISTENT,
 		// per spec.
 		this.registerFilesystem(new LocalFilesystem("temporary", webView.getContext(), webView.getResourceApi(), tmpRootFile));
 		this.registerFilesystem(new LocalFilesystem("persistent", webView.getContext(), webView.getResourceApi(), persistentRootFile));
 		this.registerFilesystem(new ContentFilesystem(webView.getContext(), webView.getResourceApi()));
         this.registerFilesystem(new AssetFilesystem(webView.getContext().getAssets(), webView.getResourceApi()));

         registerExtraFileSystems(getExtraFileSystemsPreference(activity), getAvailableFileSystems(activity));

 		// Initialize static plugin reference for deprecated getEntry method
 		if (filePlugin == null) {
 			FileUtils.filePlugin = this;
 		}
 	} else {
 		Log.e(LOG_TAG, "File plugin configuration error: Please set AndroidPersistentFileLocation in config.xml to one of \"internal\" (for new applications) or \"compatibility\" (for compatibility with previous versions)");
 		activity.finish();
 	}
 }
 
源代码17 项目: reader   文件: FileUtils.java
@Override
 public void initialize(CordovaInterface cordova, CordovaWebView webView) {
 	super.initialize(cordova, webView);
 	this.filesystems = new ArrayList<Filesystem>();

 	String tempRoot = null;
 	String persistentRoot = null;

 	Activity activity = cordova.getActivity();
 	String packageName = activity.getPackageName();
 	
 	String location = activity.getIntent().getStringExtra("androidpersistentfilelocation");
 	if (location == null) {
 		location = "compatibility";
 	}
 	tempRoot = activity.getCacheDir().getAbsolutePath();
 	if ("internal".equalsIgnoreCase(location)) {
 		persistentRoot = activity.getFilesDir().getAbsolutePath() + "/files/";
 		this.configured = true;
 	} else if ("compatibility".equalsIgnoreCase(location)) {
 		/*
 		 *  Fall-back to compatibility mode -- this is the logic implemented in
 		 *  earlier versions of this plugin, and should be maintained here so
 		 *  that apps which were originally deployed with older versions of the
 		 *  plugin can continue to provide access to files stored under those
 		 *  versions.
 		 */
 		if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
 			persistentRoot = Environment.getExternalStorageDirectory().getAbsolutePath();
 			tempRoot = Environment.getExternalStorageDirectory().getAbsolutePath() +
 					"/Android/data/" + packageName + "/cache/";
 		} else {
 			persistentRoot = "/data/data/" + packageName;
 		}
 		this.configured = true;
 	}

 	if (this.configured) {
// Create the directories if they don't exist.
new File(tempRoot).mkdirs();
new File(persistentRoot).mkdirs();

 		// Register initial filesystems
 		// Note: The temporary and persistent filesystems need to be the first two
 		// registered, so that they will match window.TEMPORARY and window.PERSISTENT,
 		// per spec.
 		this.registerFilesystem(new LocalFilesystem("temporary", cordova, tempRoot));
 		this.registerFilesystem(new LocalFilesystem("persistent", cordova, persistentRoot));
 		this.registerFilesystem(new ContentFilesystem(cordova, webView));

         registerExtraFileSystems(getExtraFileSystemsPreference(activity), getAvailableFileSystems(activity));

 		// Initialize static plugin reference for deprecated getEntry method
 		if (filePlugin == null) {
 			FileUtils.filePlugin = this;
 		}
 	} else {
 		Log.e(LOG_TAG, "File plugin configuration error: Please set AndroidPersistentFileLocation in config.xml to one of \"internal\" (for new applications) or \"compatibility\" (for compatibility with previous versions)");
 		activity.finish();
 	}
 }
 
源代码18 项目: cordova-dialog-gps   文件: DialogGPS.java
/**
 *  Method that create a new Dialog.   
 *
 *   @param cordova     CordovaInterface to append the dialog created. 
 *                      the dialog is forced to display with the theme light default
 **/
@SuppressLint( "NewApi" )
private AlertDialog.Builder newDialog(CordovaInterface cordova,final String title,final String message, final String description) {
    final Context context = cordova.getActivity().getApplicationContext();
    final String packageName = context.getPackageName();
    AlertDialog.Builder builder;
    int dpi = context.getResources().getDisplayMetrics().densityDpi;
    int currentapiVersion = android.os.Build.VERSION.SDK_INT;
    
    
    if (currentapiVersion >= android.os.Build.VERSION_CODES.HONEYCOMB) {
       builder = new AlertDialog.Builder(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
    } else {
       builder = new AlertDialog.Builder(cordova.getActivity());
    }
    
    builder.setMessage(message);
    builder.setTitle(title);
    
    LinearLayout _layout = new LinearLayout(context);
    LinearLayout.LayoutParams _layout_params  = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT);
    _layout.setLayoutParams(_layout_params);
    _layout.setPadding(0, dpToPixels(20,dpi),dpToPixels(24,dpi),0);
    _layout.setOrientation(LinearLayout.HORIZONTAL);

    ImageView  _icon = new ImageView(context);
    _icon.setImageResource(cordova.getActivity().getResources().getIdentifier("ic_location","drawable",packageName));
    TextView _description = new TextView(context);
    
    _icon.setLayoutParams(new LinearLayout.LayoutParams(dpToPixels(72,dpi),dpToPixels(72,dpi)));
    _description.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,dpToPixels(72,dpi)));

    _icon.setContentDescription("Location Icon");
    _icon.setPadding(dpToPixels(24,dpi),0,dpToPixels(24,dpi),dpToPixels(24,dpi));
    _icon.setColorFilter(Color.argb(139,0,0,0));
    
    _description.setTextSize(16);
    _description.setText(description);
    _description.setTextColor(Color.argb(139,0,0,0));
    
    _layout.addView(_icon);
    _layout.addView(_description);
    builder.setView(_layout);
    
    return builder;
}
 
@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
    super.initialize(cordova, webView);
    mCustomTabPluginHelper = new CustomTabServiceHelper(cordova.getActivity());
}
 
源代码20 项目: cordova-plugin-googlefit   文件: GoogleFit.java
@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
    super.initialize(cordova, webView);

    actContext = cordova.getActivity();
    appContext = actContext.getApplicationContext();

    initDataTypes();

    cordova.setActivityResultCallback(this);


    buildFitnessClient();
}
 
 同类方法