Skip to content

Commit

Permalink
version 1.2
Browse files Browse the repository at this point in the history
* fix bug
  • Loading branch information
abbasalim committed Sep 24, 2018
1 parent ba39c05 commit 047ab40
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 35 deletions.
4 changes: 0 additions & 4 deletions library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,5 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<application>

<activity android:name="ir.esfandune.filepickerDialog.ui.FilePickerActivity"
android:theme="@style/MFP_BaseTheme">
</activity>
</application>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -22,37 +22,11 @@
public class DirectoryAdapter extends RecyclerView.Adapter<DirectoryAdapter.DirectoryViewHolder> {


public interface OnItemClickListener {
void onItemClick(View view, int position);
}

public class DirectoryViewHolder extends RecyclerView.ViewHolder {
private ImageView mFileImage;
private TextView mFileTitle;
private TextView mFileSubtitle;


public DirectoryViewHolder(View itemView, final OnItemClickListener clickListener) {
super(itemView);

itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
clickListener.onItemClick(v, getAdapterPosition());
}
});

mFileImage = itemView.findViewById(R.id.item_file_image);
mFileTitle = itemView.findViewById(R.id.item_file_title);
mFileSubtitle = itemView.findViewById(R.id.item_file_subtitle);
}
}

private List<File> mFiles;
private Context mContext;
private OnItemClickListener mOnItemClickListener;

public DirectoryAdapter(Context context, List<File> files,boolean addBackBtn) {
public DirectoryAdapter(Context context, List<File> files, boolean addBackBtn) {
mContext = context;
mFiles = files;
if (addBackBtn) {
Expand All @@ -72,8 +46,6 @@ public DirectoryViewHolder onCreateViewHolder(ViewGroup parent,
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.item_file, parent, false);



return new DirectoryViewHolder(view, mOnItemClickListener);
}

Expand All @@ -85,11 +57,12 @@ public void onBindViewHolder(DirectoryViewHolder holder, int position) {
holder.mFileImage.setImageResource(R.drawable.ic_back);
holder.mFileSubtitle.setText("");
holder.mFileTitle.setText(R.string.back);
}else {
} else {
FileTypeUtils.FileType fileType = FileTypeUtils.getFileType(currentFile);
holder.mFileImage.setImageResource(fileType.getIcon());
holder.mFileSubtitle.setText(fileType.getDescription());
holder.mFileTitle.setText(currentFile.getName());

}
}

Expand All @@ -105,4 +78,31 @@ public int getItemCount() {
public File getModel(int index) {
return mFiles.get(index);
}

public interface OnItemClickListener {
void onItemClick(View view, int position);
}

public class DirectoryViewHolder extends RecyclerView.ViewHolder {
private ImageView mFileImage;
private TextView mFileTitle;
private TextView mFileSubtitle;


public DirectoryViewHolder(View itemView, final OnItemClickListener clickListener) {
super(itemView);

itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
clickListener.onItemClick(v, getAdapterPosition());
}
});

mFileImage = itemView.findViewById(R.id.item_file_image);
mFileTitle = itemView.findViewById(R.id.item_file_title);
mFileTitle.setSelected(true);
mFileSubtitle = itemView.findViewById(R.id.item_file_subtitle);
}
}
}
9 changes: 8 additions & 1 deletion library/src/main/res/layout/item_file.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,16 @@
android:id="@+id/item_file_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
style="@style/TextAppearance.AppCompat.Medium"
android:textStyle="bold"

android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:freezesText="true"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
/>

<TextView
Expand Down

0 comments on commit 047ab40

Please sign in to comment.