Search in sources :

Example 6 with ComponentsGetter

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);
}
Also used : ComponentsGetter(com.owncloud.android.ui.activity.ComponentsGetter)

Example 7 with ComponentsGetter

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;
}
Also used : ComponentsGetter(com.owncloud.android.ui.activity.ComponentsGetter) Account(android.accounts.Account) FileDataStorageManager(com.owncloud.android.datamodel.FileDataStorageManager) ArbitraryDataProvider(com.owncloud.android.datamodel.ArbitraryDataProvider)

Example 8 with ComponentsGetter

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()));
    }
}
Also used : ComponentsGetter(com.owncloud.android.ui.activity.ComponentsGetter) TransferProgressController(com.owncloud.android.ui.controller.TransferProgressController) RelativeLayout(android.widget.RelativeLayout) ProgressBar(android.widget.ProgressBar) LinearLayout(android.widget.LinearLayout)

Aggregations

ComponentsGetter (com.owncloud.android.ui.activity.ComponentsGetter)8 FileDataStorageManager (com.owncloud.android.datamodel.FileDataStorageManager)3 OCFile (com.owncloud.android.datamodel.OCFile)2 ArrayList (java.util.ArrayList)2 Account (android.accounts.Account)1 LinearLayout (android.widget.LinearLayout)1 ProgressBar (android.widget.ProgressBar)1 RelativeLayout (android.widget.RelativeLayout)1 ArbitraryDataProvider (com.owncloud.android.datamodel.ArbitraryDataProvider)1 TransferProgressController (com.owncloud.android.ui.controller.TransferProgressController)1