Skip to content

Commit

Permalink
Customized bottom sheet.
Browse files Browse the repository at this point in the history
  • Loading branch information
surinder-tsys committed Nov 2, 2023
1 parent 760fdcd commit 8bbde00
Show file tree
Hide file tree
Showing 18 changed files with 279 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.annotation.IdRes
import androidx.appcompat.content.res.AppCompatResources
import androidx.core.os.bundleOf
import androidx.core.view.isEmpty
import androidx.core.content.res.ResourcesCompat
import androidx.core.view.isVisible
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.setFragmentResult
Expand All @@ -44,7 +44,6 @@ import androidx.lifecycle.ViewModelProvider
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.nextcloud.android.common.ui.theme.utils.ColorRole
import com.nextcloud.client.account.CurrentAccountProvider
import com.nextcloud.client.di.Injectable
import com.nextcloud.client.di.ViewModelFactory
Expand Down Expand Up @@ -164,7 +163,11 @@ class FileActionsBottomSheet : BottomSheetDialogFragment(), Injectable {

private fun setMultipleFilesThumbnail() {
context?.let {
val drawable = viewThemeUtils.platform.tintDrawable(it, R.drawable.file_multiple, ColorRole.PRIMARY)
// NMC Customization
val drawable = viewThemeUtils.platform.colorDrawable(
ResourcesCompat.getDrawable(it.resources, R.drawable.file_multiple, null)!!,
it.resources.getColor(R.color.primary, null)
)
binding.thumbnailLayout.thumbnail.setImageDrawable(drawable)
}
}
Expand Down Expand Up @@ -297,12 +300,8 @@ class FileActionsBottomSheet : BottomSheetDialogFragment(), Injectable {
}
text.setText(action.title)
if (action.icon != null) {
val drawable =
viewThemeUtils.platform.tintDrawable(
requireContext(),
AppCompatResources.getDrawable(requireContext(), action.icon)!!
)
icon.setImageDrawable(drawable)
//NMC customization
icon.setImageResource(action.icon)
}
}
return itemBinding.root
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,6 @@ class GalleryFragmentBottomSheetDialog(
}

private fun setupLayout() {
viewThemeUtils.platform.colorViewBackground(binding.bottomSheet, ColorRole.SURFACE)

listOf(
binding.tickMarkShowImages,
binding.tickMarkShowVideos
).forEach {
viewThemeUtils.platform.colorImageView(it, ColorRole.PRIMARY)
}

listOf(
binding.btnSelectMediaFolder,
binding.btnHideVideos,
binding.btnHideImages
).forEach {
viewThemeUtils.material.colorMaterialButtonText(it)
}

when (currentMediaState) {
MediaState.MEDIA_STATE_PHOTOS_ONLY -> {
binding.tickMarkShowImages.visibility = View.VISIBLE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,6 @@ protected void onCreate(Bundle savedInstanceState) {
binding = FileListActionsBottomSheetFragmentBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());

viewThemeUtils.platform.colorImageView(binding.menuIconUploadFiles);
viewThemeUtils.platform.colorImageView(binding.menuIconUploadFromApp);
viewThemeUtils.platform.colorImageView(binding.menuIconDirectCameraUpload);
viewThemeUtils.platform.colorImageView(binding.menuIconScanDocUpload);
viewThemeUtils.platform.colorImageView(binding.menuIconMkdir);
viewThemeUtils.platform.colorImageView(binding.menuIconAddFolderInfo);

binding.addToCloud.setText(getContext().getResources().getString(R.string.add_to_cloud,
themeUtils.getDefaultDisplayNameForRootFolder(getContext())));

Expand Down Expand Up @@ -149,8 +142,9 @@ protected void onCreate(Bundle savedInstanceState) {
binding.menuDirectCameraUpload.setVisibility(View.GONE);
}

// not required for NMC
// create rich workspace
if (editorUtils.isEditorAvailable(user,
/* if (editorUtils.isEditorAvailable(user,
MimeTypeUtil.MIMETYPE_TEXT_MARKDOWN) &&
file != null && !file.isEncrypted()) {
// richWorkspace
Expand All @@ -167,7 +161,7 @@ protected void onCreate(Bundle savedInstanceState) {
} else {
binding.menuCreateRichWorkspace.setVisibility(View.GONE);
binding.menuCreateRichWorkspaceDivider.setVisibility(View.GONE);
}
} */

setupClickListener();
}
Expand Down
12 changes: 12 additions & 0 deletions app/src/main/res/drawable/ic_encrypted_folder.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M4,21.75a3,3 0,0 1,-3 -3L1,2.25L7.5,2.25a3.65,3.65 0,0 1,2.7 1.2l0.45,0.45a1.43,1.43 0,0 0,0.85 0.35L23,4.25v14.5a3,3 0,0 1,-3 3ZM2.5,18.75a1.46,1.46 0,0 0,1.43 1.5L20,20.25a1.47,1.47 0,0 0,1.5 -1.44L21.5,5.75h-10A2.57,2.57 0,0 1,9.6 4.9l-0.45,-0.45a2.38,2.38 0,0 0,-1.65 -0.7h-5Z"
android:fillColor="#262626"/>
<path
android:pathData="M14.14,16.56L9.86,16.56a1.07,1.07 0,0 1,-1.07 -1.08L8.79,12.09h0.89v-0.71a2.32,2.32 0,0 1,4.64 0v0.71h0.89v3.39A1.07,1.07 0,0 1,14.14 16.56ZM12,13.56a0.54,0.54 0,0 0,-0.54 0.53,0.55 0.55,0 0,0 0.18,0.4v0.68h0.72v-0.68a0.53,0.53 0,0 0,0 -0.75A0.52,0.52 0,0 0,12 13.52ZM12,9.63a1.79,1.79 0,0 0,-1.79 1.79v0.71h3.58v-0.71A1.79,1.79 0,0 0,12 9.59Z"
android:fillColor="#262626"/>
</vector>
12 changes: 12 additions & 0 deletions app/src/main/res/drawable/ic_file_collection.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M17.75,0.5L8,0.5L8,3.5L5,3.5L5,6.5L2,6.5L2,21.25C2,22.4925 3.0075,23.5 4.25,23.5L13.25,23.5C14.4925,23.5 15.5,22.4925 15.5,21.25L15.5,20.5L16.25,20.5C17.4925,20.5 18.5,19.4925 18.5,18.25L18.5,17.5L19.25,17.5C20.4925,17.5 21.5,16.4925 21.5,15.25L21.5,4.3635L17.75,0.5ZM14,21.25C14,21.6635 13.6635,22 13.25,22L4.25,22C3.8365,22 3.5,21.6635 3.5,21.25L3.5,8L5,8L5,18.25C5,19.4925 6.0075,20.5 7.25,20.5L14,20.5L14,21.25ZM17,18.25C17,18.6635 16.6635,19 16.25,19L7.25,19C6.8365,19 6.5,18.6635 6.5,18.25L6.5,5L8,5L8,15.25C8,16.4925 9.0075,17.5 10.25,17.5L17,17.5L17,18.25ZM19.25,16L10.25,16C9.8365,16 9.5,15.6635 9.5,15.25L9.5,2L16,2L16,4.1705C16,4.9045 16.595,5.5 17.3295,5.5L20,5.5L20,15.25C20,15.6635 19.6635,16 19.25,16Z"
android:strokeWidth="1"
android:fillColor="#262626"
android:fillType="nonZero"
android:strokeColor="#00000000"/>
</vector>
12 changes: 12 additions & 0 deletions app/src/main/res/drawable/ic_upload_file.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M2.5,1L2.5,20C2.5,21.65 3.85,23 5.5,23L15.5,23L20.5,18L20.5,1L2.5,1ZM4,20L4,2.5L19,2.5L19,17L16,17C15.15,17 14.5,17.65 14.5,18.5L14.5,21.5L5.5,21.5C4.65,21.5 4,20.85 4,20Z"
android:strokeWidth="1"
android:fillColor="#262626"
android:fillType="evenOdd"
android:strokeColor="#00000000"/>
</vector>
2 changes: 2 additions & 0 deletions app/src/main/res/layout/file_actions_bottom_sheet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
style="@style/Widget.Material3.BottomSheet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/bottom_sheet_bg_color"
android:layout_gravity="bottom"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">

Expand Down Expand Up @@ -72,6 +73,7 @@
android:ellipsize="middle"
android:lines="1"
android:textAppearance="@style/TextAppearance.Material3.HeadlineSmall"
android:textColor="@color/bottom_sheet_txt_color"
tools:text="Test file name which is very very very very very long.pdf" />

</LinearLayout>
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/file_actions_bottom_sheet_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
android:layout_width="@dimen/iconized_single_line_item_icon_size"
android:layout_height="@dimen/iconized_single_line_item_icon_size"
android:contentDescription="@null"
app:tint="@color/primary"
app:tint="@color/bottom_sheet_icon_color"
tools:src="@drawable/ic_delete" />

<LinearLayout
Expand All @@ -59,7 +59,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/bottom_sheet_text_start_margin"
android:textColor="@color/text_color"
android:textColor="@color/bottom_sheet_txt_color"
android:textSize="@dimen/bottom_sheet_text_size"
tools:text="Delete file" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/creator_container"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_item_height"
android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingTop="@dimen/standard_half_padding"
android:paddingBottom="@dimen/standard_half_padding"
android:paddingLeft="@dimen/standard_padding"
android:paddingRight="@dimen/standard_padding"
tools:ignore="UseCompoundDrawables">
Expand All @@ -36,8 +39,7 @@
android:id="@+id/creator_thumbnail"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginTop="@dimen/standard_margin"
android:layout_marginBottom="@dimen/standard_margin"
app:tint="@color/bottom_sheet_icon_color"
android:contentDescription="@null"
android:src="@drawable/file_ppt" />

Expand All @@ -46,8 +48,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/bottom_sheet_text_start_margin"
android:layout_marginStart="@dimen/standard_margin"
android:text="@string/create_new_presentation"
android:textColor="@color/text_color"
android:textColor="@color/bottom_sheet_txt_color"
android:textSize="@dimen/bottom_sheet_text_size" />
</LinearLayout>
Loading

0 comments on commit 8bbde00

Please sign in to comment.