|
|
@@ -9,9 +9,13 @@ import android.content.DialogInterface;
|
|
|
import android.content.Intent;
|
|
|
import android.content.IntentFilter;
|
|
|
import android.content.SharedPreferences;
|
|
|
+import android.content.res.Resources;
|
|
|
import android.database.Cursor;
|
|
|
import android.graphics.Bitmap;
|
|
|
import android.graphics.BitmapFactory;
|
|
|
+import android.graphics.Shader;
|
|
|
+import android.graphics.drawable.BitmapDrawable;
|
|
|
+import android.graphics.drawable.Drawable;
|
|
|
import android.net.ConnectivityManager;
|
|
|
import android.net.NetworkInfo;
|
|
|
import android.net.Uri;
|
|
|
@@ -719,6 +723,10 @@ public class MainActivity extends AppCompatActivity
|
|
|
|
|
|
protected void initView() {
|
|
|
thumbsImageView = (ImageView)findViewById(R.id.photo_iv);
|
|
|
+
|
|
|
+ thumbsImageView.setBackground(mosaicBitmap());
|
|
|
+ clearThumbnail();
|
|
|
+
|
|
|
countTextView = (TextView)findViewById(R.id.photo_count_lb);
|
|
|
pidval = (EditText)findViewById(R.id.barcode_et);
|
|
|
|
|
|
@@ -1149,13 +1157,13 @@ public class MainActivity extends AppCompatActivity
|
|
|
if(thumbBitmap!=null)
|
|
|
thumbsImageView.setImageBitmap(thumbBitmap);
|
|
|
else
|
|
|
- thumbsImageView.setImageResource(R.drawable.no_pic);
|
|
|
+ clearThumbnail();
|
|
|
Log.e(TAG, "recovery: photolist"+photoList.size());
|
|
|
}
|
|
|
else
|
|
|
|
|
|
{
|
|
|
- thumbsImageView.setImageResource(R.drawable.no_pic);
|
|
|
+ clearThumbnail();
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1606,7 +1614,7 @@ public class MainActivity extends AppCompatActivity
|
|
|
if (newVersion) {
|
|
|
thumbsImageView = this.thumbsImageView;
|
|
|
}
|
|
|
- thumbsImageView.setImageResource(R.drawable.no_pic);
|
|
|
+ clearThumbnail();
|
|
|
thumbBitmap = null;
|
|
|
} else {
|
|
|
thumbBitmap = BitmapFactory.decodeFile(photoList.get(photoList.size() - 1));
|
|
|
@@ -1840,7 +1848,7 @@ public class MainActivity extends AppCompatActivity
|
|
|
pidval.setText("");
|
|
|
updateUploadButton();
|
|
|
// ImageView thumbsImageView = (ImageView) findViewById(R.id.ivThumbs);
|
|
|
- thumbsImageView.setImageResource(R.drawable.no_pic);
|
|
|
+ clearThumbnail();
|
|
|
thumbBitmap = null;
|
|
|
// TextView countTextView = (TextView) findViewById(R.id.tvPhotoCount);
|
|
|
countTextView.setText("no photo");
|
|
|
@@ -1858,6 +1866,24 @@ public class MainActivity extends AppCompatActivity
|
|
|
|
|
|
}
|
|
|
|
|
|
+ private void clearThumbnail() {
|
|
|
+ if (thumbsImageView != null) {
|
|
|
+ thumbsImageView.setImageDrawable(null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private Drawable mosaicBitmap() {
|
|
|
+
|
|
|
+ Resources res = getResources();
|
|
|
+ Bitmap bmp = BitmapFactory.decodeResource(res, R.drawable.mosaic);
|
|
|
+
|
|
|
+ BitmapDrawable drawable = new BitmapDrawable(res,bmp);
|
|
|
+ drawable.setTileModeXY(Shader.TileMode.REPEAT , Shader.TileMode.REPEAT );
|
|
|
+ drawable.setDither(true);
|
|
|
+
|
|
|
+ return drawable;
|
|
|
+ }
|
|
|
+
|
|
|
private final BroadcastReceiver MainActivityReceiver = new BroadcastReceiver()
|
|
|
{
|
|
|
|