use of com.owncloud.android.ui.activity.ComponentsGetter in project android by nextcloud.
the class RemoveFilesDialogFragment method onConfirmation.
/**
* Performs the removal of the target file, both locally and in the server.
*/
@Override
public void onConfirmation(String callerTag) {
ComponentsGetter cg = (ComponentsGetter) getActivity();
cg.getFileOperationsHelper().removeFiles(mTargetFiles, false);
}
use of com.owncloud.android.ui.activity.ComponentsGetter in project android by nextcloud.
the class PreferenceManager method getFolderPreference.
/**
* Get preference value for a folder.
* If folder is not set itself, it finds an ancestor that is set.
*
* @param context Context object.
* @param preferenceName Name of the preference to lookup.
* @param folder Folder.
* @param defaultValue Fallback value in case no ancestor is set.
* @return Preference value
*/
public static String getFolderPreference(Context context, String preferenceName, OCFile folder, String defaultValue) {
Account account = AccountUtils.getCurrentOwnCloudAccount(context);
if (account == null) {
return defaultValue;
}
ArbitraryDataProvider dataProvider = new ArbitraryDataProvider(context.getContentResolver());
FileDataStorageManager storageManager = ((ComponentsGetter) context).getStorageManager();
if (storageManager == null) {
storageManager = new FileDataStorageManager(account, context.getContentResolver());
}
String value = dataProvider.getValue(account.name, getKeyFromFolder(preferenceName, folder));
while (folder != null && value.isEmpty()) {
folder = storageManager.getFileById(folder.getParentId());
value = dataProvider.getValue(account.name, getKeyFromFolder(preferenceName, folder));
}
return value.isEmpty() ? defaultValue : value;
}
use of com.owncloud.android.ui.activity.ComponentsGetter in project android by owncloud.
the class FileDetailFragment method onActivityCreated.
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
setHasOptionsMenu(true);
mProgressController = new TransferProgressController((ComponentsGetter) getActivity());
ProgressBar progressBar = mView.findViewById(R.id.fdProgressBar);
mProgressController.setProgressBar(progressBar);
// Allow or disallow touches with other visible windows
if (mLayout == R.layout.file_details_fragment) {
RelativeLayout fileDetailsLayout = getActivity().findViewById(R.id.fileDetailsLayout);
fileDetailsLayout.setFilterTouchesWhenObscured(PreferenceUtils.shouldDisallowTouchesWithOtherVisibleWindows(getContext()));
} else {
LinearLayout fileDetailsEmptyLayout = getActivity().findViewById(R.id.fileDetailsEmptyLayout);
fileDetailsEmptyLayout.setFilterTouchesWhenObscured(PreferenceUtils.shouldDisallowTouchesWithOtherVisibleWindows(getContext()));
}
}
Aggregations