@Override public int getNextPart() { if (parts.size() > 0) { currentPart = parts.get(0); parts.remove(0); return currentPart; } return -1; }
@Override public void updatePartition(int index, String curPackage) { ((ImageView) ((Activity) photoContext).findViewById(GlobalResource.partviewID[index])) .setBackgroundResource( getContext() .getResources() .getIdentifier(colorfiles.get(index), "drawable", curPackage)); }
@Override public void solveHint() { ((ImageView) ((Activity) photoContext).findViewById(R.id.currentPart)) .setBackgroundResource( getContext() .getResources() .getIdentifier(colorfiles.get(currentPart), "drawable", curPackage)); getNextPart(); }
@Override public void setResourceOn(String curPackage) { super.setResourceOn(curPackage); for (int i = 0; i < GlobalResource.PARTITION_PIECE; i++) { ((ImageView) ((Activity) photoContext).findViewById(GlobalResource.partviewID[i])) .setBackgroundResource( getContext().getResources().getIdentifier(blackfiles.get(i), "drawable", curPackage)); } }
@Override public void resetTouch() { // TODO Auto-generated method stub for (int i = 0; i < GlobalResource.PARTITION_PIECE; i++) { parts.add(i); /*Drawable drawable = ((ImageView)((Activity)photoContext).findViewById(GlobalResource.partviewID[i])).getDrawable(); if (drawable instanceof BitmapDrawable) { BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable; Bitmap bitmap = bitmapDrawable.getBitmap(); bitmap.recycle(); }*/ } }
public void addSource(String filecode) { for (int i = 1; i <= 9; i++) { colorfiles.add(filecode + "_" + i); blackfiles.add(filecode + "_" + i + "_b"); } }
public PartitionPhoto(Context context) { super(context); timeAllow = 25000; for (int i = 0; i < GlobalResource.PARTITION_PIECE; i++) parts.add(i); Collections.shuffle(parts); }