mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 23:28:42 +03:00
Inject ShortcutUtil instead of manually creating it
Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
This commit is contained in:
parent
d555847fea
commit
8a24ea03a0
2 changed files with 5 additions and 3 deletions
|
@ -42,11 +42,12 @@ import com.owncloud.android.ui.activity.FileActivity
|
|||
import com.owncloud.android.ui.activity.FileDisplayActivity
|
||||
import com.owncloud.android.utils.MimeTypeUtil
|
||||
import com.owncloud.android.utils.theme.ViewThemeUtils
|
||||
import javax.inject.Inject
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
private const val i = 108
|
||||
|
||||
class ShortcutUtil(val mContext: Context) {
|
||||
class ShortcutUtil @Inject constructor(private val mContext: Context) {
|
||||
|
||||
/**
|
||||
* Adds a pinned shortcut to the home screen that points to the passed file/folder.
|
||||
|
@ -121,4 +122,4 @@ class ShortcutUtil(val mContext: Context) {
|
|||
drawable.draw(canvas)
|
||||
return bitmap
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -199,6 +199,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
|||
@Inject ViewThemeUtils viewThemeUtils;
|
||||
@Inject FastScrollUtils fastScrollUtils;
|
||||
@Inject EditorUtils editorUtils;
|
||||
@Inject ShortcutUtil shortcutUtil;
|
||||
|
||||
protected FileFragment.ContainerActivity mContainerActivity;
|
||||
|
||||
|
@ -1150,7 +1151,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
|||
mContainerActivity.getFileOperationsHelper().toggleFileLock(singleFile, false);
|
||||
} else if (itemId == R.id.action_pin_to_homescreen) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
new ShortcutUtil(getContext()).addShortcutToHomescreen(singleFile, viewThemeUtils);
|
||||
shortcutUtil.addShortcutToHomescreen(singleFile, viewThemeUtils);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue