Skip to content

Commit dfd150c

Browse files
Merge pull request #25 from jagmohansingh/use-correct-method
Fall back to setBackgroundDrawable for API < 16
2 parents f7424df + 7cbb8a9 commit dfd150c

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

helpstack/src/com/tenmiles/helpstack/activities/EditAttachmentActivity.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import android.graphics.Bitmap;
3131
import android.graphics.BitmapFactory;
3232
import android.net.Uri;
33+
import android.os.Build;
3334
import android.os.Bundle;
3435
import android.provider.MediaStore;
3536
import android.support.v7.app.ActionBarActivity;
@@ -83,7 +84,11 @@ public void onClick(View view) {
8384
});
8485

8586
currentPaint = (ImageButton) findViewById(R.id.hs_red_brush);
86-
currentPaint.setBackground(getResources().getDrawable(R.drawable.paint_pressed));
87+
if(Build.VERSION.SDK_INT >= 16) {
88+
currentPaint.setBackground(getResources().getDrawable(R.drawable.paint_pressed));
89+
} else {
90+
currentPaint.setBackgroundDrawable(getResources().getDrawable(R.drawable.paint_pressed));
91+
}
8792
clearChangesTextView = (TextView)findViewById(R.id.clear_change_text);
8893

8994
Intent intent = new Intent();
@@ -197,9 +202,13 @@ public void paintColorClicked(View view) {
197202
String color = imageButton.getTag().toString();
198203

199204
drawView.setColor(color);
200-
201-
imageButton.setBackground(getResources().getDrawable(R.drawable.paint_pressed));
202-
currentPaint.setBackground(getResources().getDrawable(R.drawable.paint));
205+
if(Build.VERSION.SDK_INT >= 16) {
206+
imageButton.setBackground(getResources().getDrawable(R.drawable.paint_pressed));
207+
currentPaint.setBackground(getResources().getDrawable(R.drawable.paint));
208+
} else {
209+
imageButton.setBackgroundDrawable(getResources().getDrawable(R.drawable.paint_pressed));
210+
currentPaint.setBackgroundDrawable(getResources().getDrawable(R.drawable.paint));
211+
}
203212

204213
currentPaint = (ImageButton) view;
205214
}

0 commit comments

Comments
 (0)