Skip to content

Commit

Permalink
fix list
Browse files Browse the repository at this point in the history
  • Loading branch information
daktak committed Jul 8, 2016
1 parent afa492c commit b3f6502
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "org.afhdownloader"
minSdkVersion 16
targetSdkVersion 24
versionCode 3
versionName "0.2.1"
versionCode 4
versionName "0.3"
}
buildTypes {
release {
Expand Down
52 changes: 26 additions & 26 deletions app/src/main/java/org/afhdownloader/MyCustomAdapter.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package org.afhdownloader;
import android.app.Activity;
import android.content.Context;
import android.support.v4.content.ContextCompat;
import android.util.Log;
Expand Down Expand Up @@ -28,45 +29,44 @@ public MyCustomAdapter(Context context, String[] values, File[] file, String[] m

@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

ViewHolder holder;
String s = values[position];
android.graphics.drawable.Drawable img = null;
int color = ContextCompat.getColor(context, R.color.colorBlack);

if (convertView == null) {
LayoutInflater inflater = ((Activity)context).getLayoutInflater();
convertView = inflater.inflate(R.layout.rowlayout, parent, false);
holder = new ViewHolder();
holder.text = (TextView) convertView.findViewById(R.id.label);
holder.icon = (ImageView) convertView.findViewById(R.id.img);
convertView.setTag(holder);

try {
for (int j = 0; j < file.length; j++) {
if (s.equals(file[j].getName())) {
int color = ContextCompat.getColor(context, R.color.disabledText);
android.graphics.drawable.Drawable img = ContextCompat.getDrawable(context, R.drawable.unknown);
Log.d(LOGTAG, file[j].getName() + " md5: " + md5check[position]);
if (md5check[position].equalsIgnoreCase("Y") ) {
color =ContextCompat.getColor(context, R.color.md5_match);
img = ContextCompat.getDrawable(context, R.drawable.match);
} else if (md5check[position].equalsIgnoreCase("N")) {
color = ContextCompat.getColor(context, R.color.md5_nomatch);
img = ContextCompat.getDrawable(context, R.drawable.nomatch);
}
holder.text.setTextColor(color);
holder.icon.setImageDrawable(img);

//Log.w("BasketBuild","have file: "+s+ ":"+file[j] + " : "+ j+"pos:" + position);
convertView.setEnabled(false);
} else {
holder = (ViewHolder) convertView.getTag();
}
try {
for (int j = 0; j < file.length; j++) {
if (s.equals(file[j].getName())) {
color = ContextCompat.getColor(context, R.color.disabledText);
img = ContextCompat.getDrawable(context, R.drawable.unknown);
Log.d(LOGTAG, file[j].getName() + " md5: " + md5check[position]);
if (md5check[position].equalsIgnoreCase("Y") ) {
color =ContextCompat.getColor(context, R.color.md5_match);
img = ContextCompat.getDrawable(context, R.drawable.match);
} else if (md5check[position].equalsIgnoreCase("N")) {
color = ContextCompat.getColor(context, R.color.md5_nomatch);
img = ContextCompat.getDrawable(context, R.drawable.nomatch);
}
//Log.w("BasketBuild","have file: "+s+ ":"+file[j] + " : "+ j+"pos:" + position);
//convertView.setEnabled(false);
}
} catch (Exception e) {
Log.w(LOGTAG, "Cant "+e.getMessage());
}
} else {
holder = (ViewHolder) convertView.getTag();
} catch (Exception e) {
Log.w(LOGTAG, "Cant "+e.getMessage());
}

holder.text.setTextColor(color);
holder.icon.setImageDrawable(img);
holder.text.setText(s);

return convertView;
Expand Down

0 comments on commit b3f6502

Please sign in to comment.