Skip to content

Commit

Permalink
Fix incompatibility with S Note
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Abraham committed Feb 15, 2017
1 parent 6920526 commit 85530e1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "com.sueztech.screenoffmemo"
minSdkVersion 19
targetSdkVersion 25
versionCode 5
versionName "1.3.0"
versionCode 6
versionName "1.3.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
12 changes: 8 additions & 4 deletions app/src/main/java/com/sueztech/screenoffmemo/ActionMemo.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

class ActionMemo {

private static final SimpleDateFormat dateParser = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US);

private Date date;
private static final SimpleDateFormat dateParser
= new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US);
private final String name;
private Date date;

ActionMemo(File f) {
name = f.getName();
try {
date = dateParser.parse(name.replace("ActionMemo_", "").replace(".spd", ""));
date = dateParser.parse(name.substring(11).replace(".spd", ""));
} catch (ParseException e) {
date = null;
e.printStackTrace();
Expand All @@ -27,6 +27,10 @@ String getName() {
return name;
}

Date getDate() {
return date;
}

@Override
public String toString() {
return date.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

import static android.content.Intent.ACTION_VIEW;

Expand All @@ -38,6 +40,13 @@ protected void onCreate(Bundle savedInstanceState) {
}
}

Collections.sort(actionMemos, new Comparator<ActionMemo>() {
@Override
public int compare(ActionMemo actionMemo, ActionMemo t1) {
return actionMemo.getDate().compareTo(t1.getDate());
}
});

ArrayAdapter<ActionMemo> mAdapter = new ArrayAdapter<>(this,
android.R.layout.simple_list_item_1, actionMemos);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ private void saveAndExit(boolean penInsert) {

saveFilePath = filePath.getPath() + '/';

fileName = "ActionMemo_" + new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US)
fileName = "Action memo" + new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US)
.format(new Date(System.currentTimeMillis())) + ".spd";
saveFilePath += fileName;

Expand Down
Binary file added app/src/main/web_hi_res_114.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 85530e1

Please sign in to comment.