Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Russian translate, string constants, API=28 #13

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
6 changes: 3 additions & 3 deletions folderpicker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ ext {
}

android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
compileSdkVersion 28
buildToolsVersion "28.0.3"

defaultConfig {
minSdkVersion 9
targetSdkVersion 27
targetSdkVersion 28
versionCode 4
versionName "2.4"

Expand Down
46 changes: 27 additions & 19 deletions folderpicker/src/main/java/lib/folderpicker/FolderAdapter.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package lib.folderpicker;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -12,35 +12,43 @@

public class FolderAdapter extends ArrayAdapter<FilePojo> {

Activity context;
ArrayList<FilePojo> dataList;
/**
*
*/
private class FileViewHolder {
ImageView iconView;
TextView nameView;
}

public FolderAdapter(Activity context, ArrayList<FilePojo> dataList) {
private LayoutInflater mInflater;
private Context mContext;
private ArrayList<FilePojo> dataList;

public FolderAdapter(Context context, ArrayList<FilePojo> dataList) {
super(context, R.layout.fp_filerow, dataList);
this.context = context;
this.mContext = context;
this.mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
this.dataList = dataList;

}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = context.getLayoutInflater();
convertView = inflater.inflate(R.layout.fp_filerow, parent, false);

ImageView imageView = (ImageView) convertView.findViewById(R.id.fp_iv_icon);
TextView name = (TextView) convertView.findViewById(R.id.fp_tv_name);

if( dataList.get(position).isFolder() )
{
imageView.setImageResource( R.drawable.fp_folder);
}
else
{
imageView.setImageResource( R.drawable.fp_file);
FileViewHolder viewHolder;
if (convertView == null) {
viewHolder = new FileViewHolder();
convertView = mInflater.inflate(R.layout.fp_filerow, null);
viewHolder.iconView = convertView.findViewById(R.id.fp_iv_icon);
viewHolder.nameView = convertView.findViewById(R.id.fp_tv_name);
convertView.setTag(viewHolder);
} else {
viewHolder = (FileViewHolder) convertView.getTag();
}

name.setText( dataList.get(position).getName() );
FilePojo item = dataList.get(position);
int iconRes = (item.isFolder()) ? R.drawable.fp_folder : R.drawable.fp_file;
viewHolder.iconView.setImageResource(iconRes);
viewHolder.nameView.setText(item.getName());

return convertView;
}
Expand Down
Loading