Merge pull request #4076 from nextcloud/chromebook
Support for Chromebook
This commit is contained in:
5 files changed
+39
-2
No files matched your search
@@ -74,6 +74,16 @@
|
||||
|
||||
<uses-sdk tools:overrideLibrary="com.blikoon.qrcodescanner" />
|
||||
|
||||
<!-- Some Chromebooks don't support touch. Although not essential,
|
||||
it's a good idea to explicitly include this declaration. -->
|
||||
<uses-feature
|
||||
android:name="android.hardware.touchscreen"
|
||||
android:required="false" />
|
||||
|
||||
<uses-feature
|
||||
android:name="android.hardware.camera"
|
||||
android:required="false" />
|
||||
|
||||
<application
|
||||
android:name=".MainApp"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
|
||||
@@ -21,9 +21,15 @@
|
||||
|
||||
package com.nextcloud.client.device
|
||||
|
||||
import android.content.Context
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Build
|
||||
|
||||
class DeviceInfo {
|
||||
val vendor: String = Build.MANUFACTURER.toLowerCase()
|
||||
val apiLevel: Int = Build.VERSION.SDK_INT
|
||||
|
||||
fun hasCamera(context: Context): Boolean {
|
||||
return context.packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA)
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@ import android.content.res.Resources;
|
||||
import com.nextcloud.client.account.CurrentAccountProvider;
|
||||
import com.nextcloud.client.account.UserAccountManager;
|
||||
import com.nextcloud.client.account.UserAccountManagerImpl;
|
||||
import com.nextcloud.client.device.DeviceInfo;
|
||||
import com.nextcloud.client.preferences.AppPreferences;
|
||||
import com.nextcloud.client.preferences.AppPreferencesImpl;
|
||||
import com.owncloud.android.datamodel.ArbitraryDataProvider;
|
||||
@@ -105,4 +106,9 @@ class AppModule {
|
||||
@Provides CurrentAccountProvider currentAccountProvider(UserAccountManager accountManager) {
|
||||
return accountManager;
|
||||
}
|
||||
|
||||
@Provides
|
||||
DeviceInfo deviceInfo() {
|
||||
return new DeviceInfo();
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@ import android.widget.TextView;
|
||||
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||
import com.nextcloud.client.device.DeviceInfo;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.lib.resources.status.OCCapability;
|
||||
import com.owncloud.android.ui.activity.FileActivity;
|
||||
@@ -59,14 +60,21 @@ public class OCFileListBottomSheetDialog extends BottomSheetDialog {
|
||||
@BindView(R.id.templates)
|
||||
public View templates;
|
||||
|
||||
@BindView(R.id.menu_direct_camera_upload)
|
||||
public View cameraView;
|
||||
|
||||
private Unbinder unbinder;
|
||||
private OCFileListBottomSheetActions actions;
|
||||
private FileActivity fileActivity;
|
||||
private DeviceInfo deviceInfo;
|
||||
|
||||
public OCFileListBottomSheetDialog(FileActivity fileActivity, OCFileListBottomSheetActions actions) {
|
||||
public OCFileListBottomSheetDialog(FileActivity fileActivity,
|
||||
OCFileListBottomSheetActions actions,
|
||||
DeviceInfo deviceInfo) {
|
||||
super(fileActivity);
|
||||
this.actions = actions;
|
||||
this.fileActivity = fileActivity;
|
||||
this.deviceInfo = deviceInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -97,6 +105,10 @@ public class OCFileListBottomSheetDialog extends BottomSheetDialog {
|
||||
templates.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if (!deviceInfo.hasCamera(getContext())) {
|
||||
cameraView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
setOnShowListener(d ->
|
||||
BottomSheetBehavior.from((View) view.getParent()).setPeekHeight(view.getMeasuredHeight())
|
||||
);
|
||||
|
||||
@@ -51,6 +51,7 @@ import android.widget.RelativeLayout;
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.nextcloud.client.account.UserAccountManager;
|
||||
import com.nextcloud.client.device.DeviceInfo;
|
||||
import com.nextcloud.client.di.Injectable;
|
||||
import com.nextcloud.client.preferences.AppPreferences;
|
||||
import com.owncloud.android.MainApp;
|
||||
@@ -196,6 +197,8 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
||||
private AsyncTask remoteOperationAsyncTask;
|
||||
private String mLimitToMimeType;
|
||||
|
||||
@Inject DeviceInfo deviceInfo;
|
||||
|
||||
private enum MenuItemAddRemove {
|
||||
DO_NOTHING, REMOVE_SORT, REMOVE_GRID_AND_SORT, ADD_SORT, ADD_GRID_AND_SORT, ADD_GRID_AND_SORT_WITH_SEARCH,
|
||||
REMOVE_SEARCH
|
||||
@@ -418,7 +421,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
||||
private void registerFabListener() {
|
||||
FileActivity activity = (FileActivity) getActivity();
|
||||
getFabMain().setOnClickListener(v -> {
|
||||
new OCFileListBottomSheetDialog(activity, this).show();
|
||||
new OCFileListBottomSheetDialog(activity, this, deviceInfo).show();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user