Commit dbf8746f by Yu_Tung

去掉多餘的圖片

parent 4b1c599e
...@@ -263,20 +263,23 @@ public class MainActivity extends BaseActivity implements MainContract.View, Vie ...@@ -263,20 +263,23 @@ public class MainActivity extends BaseActivity implements MainContract.View, Vie
} }
try { try {
Date c = Calendar.getInstance(Locale.TAIWAN).getTime(); Date c = Calendar.getInstance(Locale.TAIWAN).getTime();
SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd_HH_mm_ss"); SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd_HHmmss");
String formattedDate = df.format(c); String formattedDate = df.format(c);
filePhth = path + "/" + formattedDate + ".png"; filePhth = path + "/" + formattedDate + ".jpg";
fileName = System.currentTimeMillis() + ""; fileName = System.currentTimeMillis() + "";
Log.e("filepath", filePhth); Log.e("filepath", filePhth);
File file1 = new File(filePhth); File file1 = new File(filePhth);
fileOutputStream = new FileOutputStream(file1.getPath()); fileOutputStream = new FileOutputStream(file1.getPath());
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream);
fileOutputStream.close(); fileOutputStream.close();
//图片路径 //图片路径
// MediaStore.Images.Media.insertImage(context.getContentResolver(), // MediaStore.Images.Media.insertImage(context.getContentResolver(),
// filePhth,fileName , null); // filePhth,fileName , null);
MediaStore.Images.Media.insertImage(this.getContentResolver(), bitmap, "", "");
// MediaStore.Images.Media.insertImage(this.getContentResolver(), bitmap, "", "");
this.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.parse("file://" + file1.getAbsolutePath()))); this.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.parse("file://" + file1.getAbsolutePath())));
Log.d("aaa", file1.getAbsolutePath() + "-----" + path); Log.d("aaa", file1.getAbsolutePath() + "-----" + path);
// context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.parse("file://"+ Environment.getExternalStorageDirectory()))); // context.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.parse("file://"+ Environment.getExternalStorageDirectory())));
...@@ -327,6 +330,7 @@ public class MainActivity extends BaseActivity implements MainContract.View, Vie ...@@ -327,6 +330,7 @@ public class MainActivity extends BaseActivity implements MainContract.View, Vie
Bitmap myBitmap = BitmapFactory.decodeFile(mCameraImagePath); Bitmap myBitmap = BitmapFactory.decodeFile(mCameraImagePath);
String path1 = Environment.getExternalStorageDirectory().toString() + "/Pictures"; String path1 = Environment.getExternalStorageDirectory().toString() + "/Pictures";
SavaImage(myBitmap, path1); SavaImage(myBitmap, path1);
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:hint="@string/login_account_hint" android:hint="@string/login_account_hint"
android:text="N000158385"
android:textColorHint="@color/white" android:textColorHint="@color/white"
android:paddingStart="100dp" android:paddingStart="100dp"
app:layout_constraintWidth_percent="0.9" app:layout_constraintWidth_percent="0.9"
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:hint="@string/login_password_hint" android:hint="@string/login_password_hint"
android:text="781122222"
android:textColorHint="@color/white" android:textColorHint="@color/white"
android:paddingStart="100dp" android:paddingStart="100dp"
android:background="@drawable/bg_login_password" android:background="@drawable/bg_login_password"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment