本文整理匯總了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();
}