|
@@ -5,17 +5,17 @@
|
|
* Copyright (C) 2018 Andy Scherzinger
|
|
* Copyright (C) 2018 Andy Scherzinger
|
|
*
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* This program is free software: you can redistribute it and/or modify
|
|
- * it under the terms of the GNU Affero General Public License as published by
|
|
|
|
|
|
+ * it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
- * at your option) any later version.
|
|
|
|
|
|
+ * (at your option) any later version.
|
|
*
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
- * GNU Affero General Public License for more details.
|
|
|
|
|
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
+ * GNU General Public License for more details.
|
|
*
|
|
*
|
|
- * You should have received a copy of the GNU Affero General Public License
|
|
|
|
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
+ * You should have received a copy of the GNU General Public License
|
|
|
|
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
*/
|
|
|
|
|
|
package com.owncloud.android.ui.fragment;
|
|
package com.owncloud.android.ui.fragment;
|
|
@@ -28,7 +28,6 @@ import android.support.design.widget.BottomSheetDialog;
|
|
import android.view.View;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.view.ViewGroup;
|
|
import android.widget.ImageView;
|
|
import android.widget.ImageView;
|
|
-import android.widget.LinearLayout;
|
|
|
|
import android.widget.TextView;
|
|
import android.widget.TextView;
|
|
|
|
|
|
import com.owncloud.android.R;
|
|
import com.owncloud.android.R;
|
|
@@ -36,6 +35,7 @@ import com.owncloud.android.utils.ThemeUtils;
|
|
|
|
|
|
import butterknife.BindView;
|
|
import butterknife.BindView;
|
|
import butterknife.ButterKnife;
|
|
import butterknife.ButterKnife;
|
|
|
|
+import butterknife.OnClick;
|
|
import butterknife.Unbinder;
|
|
import butterknife.Unbinder;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -43,76 +43,64 @@ import butterknife.Unbinder;
|
|
*/
|
|
*/
|
|
public class OCFileListBottomSheetDialog extends BottomSheetDialog {
|
|
public class OCFileListBottomSheetDialog extends BottomSheetDialog {
|
|
@BindView(R.id.menu_icon_upload_files)
|
|
@BindView(R.id.menu_icon_upload_files)
|
|
- ImageView mIconUploadFiles;
|
|
|
|
|
|
+ public ImageView iconUploadFiles;
|
|
@BindView(R.id.menu_icon_upload_from_app)
|
|
@BindView(R.id.menu_icon_upload_from_app)
|
|
- ImageView mIconUploadFromApp;
|
|
|
|
|
|
+ public ImageView iconUploadFromApp;
|
|
@BindView(R.id.menu_icon_mkdir)
|
|
@BindView(R.id.menu_icon_mkdir)
|
|
- ImageView mIconMakeDir;
|
|
|
|
-
|
|
|
|
|
|
+ public ImageView iconMakeDir;
|
|
@BindView(R.id.add_to_cloud)
|
|
@BindView(R.id.add_to_cloud)
|
|
- TextView mHeadline;
|
|
|
|
-
|
|
|
|
- @BindView(R.id.menu_upload_files)
|
|
|
|
- LinearLayout mMenuUploadFiles;
|
|
|
|
- @BindView(R.id.menu_upload_from_app)
|
|
|
|
- LinearLayout mMenuUploadFromApp;
|
|
|
|
- @BindView(R.id.menu_mkdir)
|
|
|
|
- LinearLayout mMenuMakeDir;
|
|
|
|
|
|
+ public TextView headline;
|
|
|
|
|
|
private Unbinder unbinder;
|
|
private Unbinder unbinder;
|
|
|
|
|
|
- private OCFileListBottomSheetActions mActions;
|
|
|
|
|
|
+ private OCFileListBottomSheetActions actions;
|
|
|
|
|
|
|
|
|
|
- public OCFileListBottomSheetDialog(@NonNull Context context, OCFileListBottomSheetActions
|
|
|
|
- actions) {
|
|
|
|
|
|
+ public OCFileListBottomSheetDialog(@NonNull Context context, OCFileListBottomSheetActions actions) {
|
|
super(context);
|
|
super(context);
|
|
- mActions = actions;
|
|
|
|
|
|
+ this.actions = actions;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
super.onCreate(savedInstanceState);
|
|
super.onCreate(savedInstanceState);
|
|
- final View view = getLayoutInflater()
|
|
|
|
- .inflate(R.layout.file_list_actions_bottom_sheet_fragment, null);
|
|
|
|
|
|
+ final View view = getLayoutInflater().inflate(R.layout.file_list_actions_bottom_sheet_fragment, null);
|
|
setContentView(view);
|
|
setContentView(view);
|
|
|
|
+
|
|
if (getWindow() != null) {
|
|
if (getWindow() != null) {
|
|
- getWindow().setLayout(
|
|
|
|
- ViewGroup.LayoutParams.MATCH_PARENT,
|
|
|
|
- ViewGroup.LayoutParams.WRAP_CONTENT
|
|
|
|
- );
|
|
|
|
|
|
+ getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
|
}
|
|
}
|
|
|
|
|
|
unbinder = ButterKnife.bind(this, view);
|
|
unbinder = ButterKnife.bind(this, view);
|
|
- ThemeUtils.tintDrawable(mIconUploadFiles.getDrawable(), ThemeUtils.primaryColor());
|
|
|
|
- ThemeUtils.tintDrawable(mIconUploadFromApp.getDrawable(), ThemeUtils.primaryColor());
|
|
|
|
- ThemeUtils.tintDrawable(mIconMakeDir.getDrawable(), ThemeUtils.primaryColor());
|
|
|
|
|
|
|
|
- mHeadline.setText(getContext().getResources().getString(R.string.add_to_cloud,
|
|
|
|
- ThemeUtils.getDefaultDisplayNameForRootFolder()));
|
|
|
|
|
|
+ int primaryColor = ThemeUtils.primaryColor();
|
|
|
|
+ ThemeUtils.tintDrawable(iconUploadFiles.getDrawable(), primaryColor);
|
|
|
|
+ ThemeUtils.tintDrawable(iconUploadFromApp.getDrawable(), primaryColor);
|
|
|
|
+ ThemeUtils.tintDrawable(iconMakeDir.getDrawable(), primaryColor);
|
|
|
|
|
|
- mMenuUploadFiles.setOnClickListener(v -> uploadFiles());
|
|
|
|
- mMenuUploadFromApp.setOnClickListener(v -> uploadFromApp());
|
|
|
|
- mMenuMakeDir.setOnClickListener(v -> createFolder());
|
|
|
|
|
|
+ headline.setText(getContext().getResources().getString(R.string.add_to_cloud,
|
|
|
|
+ ThemeUtils.getDefaultDisplayNameForRootFolder()));
|
|
|
|
|
|
setOnShowListener(d ->
|
|
setOnShowListener(d ->
|
|
- BottomSheetBehavior.from((View) view.getParent())
|
|
|
|
- .setPeekHeight(view.getMeasuredHeight())
|
|
|
|
|
|
+ BottomSheetBehavior.from((View) view.getParent()).setPeekHeight(view.getMeasuredHeight())
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
- private void createFolder() {
|
|
|
|
- mActions.createFolder();
|
|
|
|
|
|
+ @OnClick(R.id.menu_mkdir)
|
|
|
|
+ public void createFolder() {
|
|
|
|
+ actions.createFolder();
|
|
dismiss();
|
|
dismiss();
|
|
}
|
|
}
|
|
|
|
|
|
- private void uploadFromApp() {
|
|
|
|
- mActions.uploadFromApp();
|
|
|
|
|
|
+ @OnClick(R.id.menu_upload_from_app)
|
|
|
|
+ public void uploadFromApp() {
|
|
|
|
+ actions.uploadFromApp();
|
|
dismiss();
|
|
dismiss();
|
|
}
|
|
}
|
|
|
|
|
|
- private void uploadFiles() {
|
|
|
|
- mActions.uploadFiles();
|
|
|
|
|
|
+ @OnClick(R.id.menu_upload_files)
|
|
|
|
+ public void uploadFiles() {
|
|
|
|
+ actions.uploadFiles();
|
|
dismiss();
|
|
dismiss();
|
|
}
|
|
}
|
|
|
|
|