Skip to content

Commit b554d0e

Browse files
committed
2025/09/28
before changing theme
1 parent 7dc022d commit b554d0e

File tree

9 files changed

+256
-43
lines changed

9 files changed

+256
-43
lines changed

.idea/deploymentTargetSelector.xml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SmartFileBrowser/src/main/java/ir/smartdevelopers/smartfilebrowser/acitivties/FileBrowserMainActivity.java

Lines changed: 189 additions & 29 deletions
Large diffs are not rendered by default.

SmartFileBrowser/src/main/java/ir/smartdevelopers/smartfilebrowser/adapters/GalleryAdapter.java

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,11 @@ public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup,
7474
if (viewType==GalleryModel.TYPE_CAMERA){
7575
view=LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_camera_layout,viewGroup,false);
7676
return new CameraViewHolder(view);
77+
} else if (viewType == GalleryModel.TYPE_SYSTEM_GALLERY) {
78+
view=LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_system_gallery_layout,viewGroup,false);
79+
return new SystemGalleryAdapter(view);
7780
}
78-
view= LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_gallery_layout,viewGroup,false);
81+
view= LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_gallery_layout,viewGroup,false);
7982
return new GalleryViewHolder(view);
8083
}
8184

@@ -109,9 +112,7 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi
109112
@Override
110113
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
111114

112-
if (holder.getItemViewType()==GalleryModel.TYPE_CAMERA){
113-
114-
}else {
115+
if(holder instanceof GalleryViewHolder) {
115116
((GalleryViewHolder)holder).bindView(mGalleryModels.get(position));
116117
}
117118
}
@@ -275,6 +276,17 @@ public CameraViewHolder(@NonNull View itemView) {
275276
// spanCount=itemView.getResources().getInteger(R.integer.sfb_gallery_grid);
276277
}
277278
}
279+
class SystemGalleryAdapter extends RecyclerView.ViewHolder{
280+
281+
public SystemGalleryAdapter(@NonNull View itemView) {
282+
super(itemView);
283+
itemView.setOnClickListener(v->{
284+
if (mOnItemClickListener != null) {
285+
mOnItemClickListener.onItemClicked(mGalleryModels.get(getAdapterPosition()),v,getAdapterPosition());
286+
}
287+
});
288+
}
289+
}
278290

279291
class GalleryViewHolder extends RecyclerView.ViewHolder {
280292
ImageView mImageView;

SmartFileBrowser/src/main/java/ir/smartdevelopers/smartfilebrowser/models/GalleryModel.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
public class GalleryModel implements FileModel ,Comparable<GalleryModel>{
1212

1313
public static final int TYPE_CAMERA = -102;
14+
public static final int TYPE_SYSTEM_GALLERY = -103;
15+
1416
private long id;
1517
private String mPath;
1618
private Uri mUri;

SmartFileBrowser/src/main/java/ir/smartdevelopers/smartfilebrowser/viewModel/FilesViewModel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ private String getFilesCountSubtitle(int count) {
147147
return getApplication().getString(R.string.sfb_inner_more_than_one_file_count_text, count);
148148

149149
} else {
150-
return getApplication().getString(R.string.sfb_innser_one_file_count_text, count);
150+
return getApplication().getString(R.string.sfb_inner_one_file_count_text, count);
151151

152152
}
153153
}
8.63 KB
Loading

SmartFileBrowser/src/main/res/layout/activity_file_browser_main.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,12 @@
5858
android:gravity="center_vertical"
5959
>
6060
<com.google.android.material.textview.MaterialTextView
61+
android:id="@+id/sfb_txtPermissionMessage"
6162
android:layout_width="0dp"
6263
android:layout_height="wrap_content"
6364
android:layout_weight="1"
6465
android:textColor="?attr/colorOnTertiaryFixed"
65-
android:text="@string/partial_selection_warning"
66+
android:text="@string/sfb_partial_selection_warning"
6667
android:layout_marginStart="8dp"
6768
android:layout_marginEnd="8dp"
6869
/>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<ir.smartdevelopers.smartfilebrowser.customClasses.SquareLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
android:layout_width="match_parent"
5+
android:layout_height="wrap_content"
6+
android:background="?attr/selectableItemBackground"
7+
xmlns:app="http://schemas.android.com/apk/res-auto">
8+
<LinearLayout
9+
android:layout_width="match_parent"
10+
android:layout_height="match_parent"
11+
android:orientation="vertical"
12+
>
13+
<androidx.appcompat.widget.AppCompatImageView
14+
android:id="@+id/item_system_gallery"
15+
android:layout_width="match_parent"
16+
android:layout_height="0dp"
17+
android:layout_weight="1"
18+
android:scaleType="fitCenter"
19+
android:src="@drawable/sfb_img_gallery"
20+
tools:ignore="ContentDescription"
21+
/>
22+
<TextView
23+
android:layout_width="wrap_content"
24+
android:layout_height="wrap_content"
25+
android:layout_marginStart="8dp"
26+
android:layout_marginEnd="8dp"
27+
android:text="@string/sfb_gallery"
28+
android:layout_gravity="bottom|center"
29+
android:textStyle="bold"
30+
android:layout_marginBottom="4dp"
31+
/>
32+
</LinearLayout>
33+
34+
</ir.smartdevelopers.smartfilebrowser.customClasses.SquareLayout>

SmartFileBrowser/src/main/res/values/strings.xml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@
1212
<string name="download_folder_subTitle">%2d Files</string>
1313
<string name="recent">"Recent files "</string>
1414
<string name="home">Home</string>
15-
<string name="sfb_innser_one_file_count_text">%2d file</string>
15+
<string name="sfb_inner_one_file_count_text">%2d file</string>
1616
<string name="sfb_inner_more_than_one_file_count_text">%2d files</string>
1717
<string name="sfb_done">done</string>
1818
<string name="sfb_pick_from_gallery">Pick from gallery</string>
1919
<string name="sfb_search">Search</string>
2020
<string name="sfb_clear">Clear</string>
21-
<string name="sfb_file_broswer_toolbar_title">Select file</string>
22-
<string name="sfb_video_file_broswer_toolbar_title">Select video</string>
23-
<string name="sfb_pdf_file_broswer_toolbar_title">Select pdf</string>
24-
<string name="sfb_audio_file_broswer_toolbar_title">Select audio</string>
21+
<string name="sfb_file_browser_toolbar_title">Select file</string>
22+
<string name="sfb_video_file_browser_toolbar_title">Select video</string>
23+
<string name="sfb_pdf_file_browser_toolbar_title">Select pdf</string>
24+
<string name="sfb_audio_file_browser_toolbar_title">Select audio</string>
2525
<string name="sfb_all_media">All Media</string>
2626
<string name="sfb_no_result_found">No result found</string>
2727
<string name="sfb_no_results_found_sub_title"><![CDATA[There are no matches with <b>%s</b> in current directory]]></string>
@@ -37,6 +37,10 @@
3737
<string name="openSystemFileBrowser_audios">Choose Audio</string>
3838
<string name="sfb_pdfs">PDFs</string>
3939
<string name="openSystemFileBrowser_pdfs">Choose PDF</string>
40-
<string name="partial_selection_warning">You\'ve given access to a selected number of photos and videos</string>
40+
<string name="sfb_partial_selection_warning">You\'ve given access to a selected number of photos and videos</string>
4141
<string name="sfb_manage">Manage</string>
42+
<string name="sfb_gallery_permission_denied_message">Visual media permission NOT allowed! For better experience allow it.</string>
43+
<string name="sfb_allow">Allow</string>
44+
<string name="sfb_file_permission_denied_message">All files permission is NOT allowed! For better experience allow it.</string>
45+
<string name="sfb_audio_permission_denied_message">Read audio permission is NOT allowed! For better experience allow it.</string>
4246
</resources>

0 commit comments

Comments
 (0)