本文整理汇总了Java中org.apache.cordova.CordovaInterface.getActivity方法的典型用法代码示例。如果您正苦于以下问题:Java CordovaInterface.getActivity方法的具体用法?Java CordovaInterface.getActivity怎么用?Java CordovaInterface.getActivity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cordova.CordovaInterface
的用法示例。
在下文中一共展示了CordovaInterface.getActivity方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import org.apache.cordova.CordovaInterface; //导入方法依赖的package包/类
@Override
public void initialize(final CordovaInterface cordova, final CordovaWebView webView) {
super.initialize(cordova, webView);
parseCordovaConfigXml();
loadPluginInternalPreferences();
Log.d("CHCP", "Currently running release version " + pluginInternalPrefs.getCurrentReleaseVersionName());
// clean up file system
cleanupFileSystemFromOldReleases();
handler = new Handler();
fileStructure = new PluginFilesStructure(cordova.getActivity(), pluginInternalPrefs.getCurrentReleaseVersionName());
appConfigStorage = new ApplicationConfigStorage();
defaultCallbackStoredResults = new ArrayList<PluginResult>();
}
示例2: createDialog
import org.apache.cordova.CordovaInterface; //导入方法依赖的package包/类
@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());
}
}
示例3: createProgressDialog
import org.apache.cordova.CordovaInterface; //导入方法依赖的package包/类
@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: initialize
import org.apache.cordova.CordovaInterface; //导入方法依赖的package包/类
@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");
}
示例5: initialize
import org.apache.cordova.CordovaInterface; //导入方法依赖的package包/类
@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
super.initialize(cordova, webView);
activity = cordova.getActivity();
//如果是首次启动,并且点击的通知消息,则处理消息
if (openNotificationId != 0) {
notificationOpened(openNotificationId, openNotificationExtras);
}
}
示例6: initialize
import org.apache.cordova.CordovaInterface; //导入方法依赖的package包/类
@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();
}
}
示例7: initialize
import org.apache.cordova.CordovaInterface; //导入方法依赖的package包/类
@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
super.initialize(cordova, webView);
mContext = cordova.getActivity();
}