1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-11-21 20:02:07 +01:00

new date format for screenshots (2)

This commit is contained in:
scoute-dich 2016-04-28 21:36:27 +02:00
parent 59a1174b62
commit d0cc3726ea
3 changed files with 15 additions and 8 deletions

View file

@ -90,6 +90,7 @@ import java.io.OutputStream;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.Locale;
import butterknife.Bind; import butterknife.Bind;
import butterknife.ButterKnife; import butterknife.ButterKnife;
@ -442,7 +443,7 @@ public class MainActivity extends AppCompatActivity
private File createImageFile() throws IOException { private File createImageFile() throws IOException {
// Create an image file name // Create an image file name
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); String timeStamp = new SimpleDateFormat("dd-MM-yy_HH-mm", Locale.getDefault()).format(new Date());
String imageFileName = "JPEG_" + timeStamp + "_"; String imageFileName = "JPEG_" + timeStamp + "_";
File storageDir = Environment.getExternalStoragePublicDirectory( File storageDir = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES); Environment.DIRECTORY_PICTURES);
@ -625,14 +626,17 @@ public class MainActivity extends AppCompatActivity
return; return;
} }
} }
Snackbar.make(swipeRefreshLayout, R.string.toast_screenshot, Snackbar.LENGTH_LONG).show();
File directory = new File(Environment.getExternalStorageDirectory() + "/Pictures/Diaspora/"); File directory = new File(Environment.getExternalStorageDirectory() + "/Pictures/Diaspora/");
if (!directory.exists()) { if (!directory.exists()) {
directory.mkdirs(); directory.mkdirs();
} }
Date date = new Date(); Date date = new Date();
DateFormat dateFormat = android.text.format.DateFormat.getDateFormat(getApplicationContext()); DateFormat dateFormat = new SimpleDateFormat("dd-MM-yy_HH-mm", Locale.getDefault());
String filename = getString(R.string.toast_screenshot) + " " + Environment.getExternalStorageDirectory() + "/Pictures/Diaspora/" + dateFormat.format(date) + ".jpg";
Snackbar.make(swipeRefreshLayout, filename, Snackbar.LENGTH_LONG).show();
webView.measure(View.MeasureSpec.makeMeasureSpec( webView.measure(View.MeasureSpec.makeMeasureSpec(
View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED),
@ -704,14 +708,17 @@ public class MainActivity extends AppCompatActivity
return; return;
} }
} }
Snackbar.make(swipeRefreshLayout, R.string.toast_screenshot, Snackbar.LENGTH_LONG).show();
File directory = new File(Environment.getExternalStorageDirectory() + "/Pictures/Diaspora/"); File directory = new File(Environment.getExternalStorageDirectory() + "/Pictures/Diaspora/");
if (!directory.exists()) { if (!directory.exists()) {
directory.mkdirs(); directory.mkdirs();
} }
Date date = new Date(); Date date = new Date();
DateFormat dateFormat = android.text.format.DateFormat.getDateFormat(getApplicationContext()); DateFormat dateFormat = new SimpleDateFormat("dd-MM-yy_HH-mm", Locale.getDefault());
String filename = getString(R.string.toast_screenshot) + " " + Environment.getExternalStorageDirectory() + "/Pictures/Diaspora/" + dateFormat.format(date) + ".jpg";
Snackbar.make(swipeRefreshLayout, filename, Snackbar.LENGTH_LONG).show();
webView.measure(View.MeasureSpec.makeMeasureSpec( webView.measure(View.MeasureSpec.makeMeasureSpec(
View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED),

View file

@ -76,8 +76,8 @@
<string name="jb_share">Inhalt Teilen</string> <string name="jb_share">Inhalt Teilen</string>
<string name="share_link">Link als Text teilen</string> <string name="share_link">Link als Text teilen</string>
<string name="share_screenshot">Bildschirmfoto teilen</string> <string name="share_screenshot">Bildschirmfoto teilen</string>
<string name="take_screenshot">Bildschirmfoto machen</string> <string name="take_screenshot">Bildschirmfoto speichern</string>
<string name="toast_screenshot">Bildschirmfoto wird gespeichert</string> <string name="toast_screenshot">Bildschirmfoto wird gespeichert unter:</string>
<string name="jb_settings_diaspora">Diaspora Einstellungen</string> <string name="jb_settings_diaspora">Diaspora Einstellungen</string>
<string name="jb_settings_view">Ansichtseinstellungen</string> <string name="jb_settings_view">Ansichtseinstellungen</string>
<string name="help_help">Markdown Formatierung</string> <string name="help_help">Markdown Formatierung</string>

View file

@ -78,7 +78,7 @@
<string name="help_help">Markdown formating</string> <string name="help_help">Markdown formating</string>
<string name="help_about">Changelog</string> <string name="help_about">Changelog</string>
<string name="toast_screenshot">Taking screenshot …</string> <string name="toast_screenshot">Saving screenshot as:</string>
// Floating Action Buttons - Titles // Floating Action Buttons - Titles