Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding some changes from leoalekseyev and daniel-kullmann

  • Loading branch information...
commit 261e34d7785015e956475a55c65d8d18dd4b4be6 1 parent 98ea820
@matburt authored
View
3  res/layout/simpletext.xml
@@ -11,6 +11,7 @@
<TextView android:id="@+id/orgTxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:autoLink="all"/>
+ android:autoLink="all"
+ android:textSize="15sp"/>
</LinearLayout>
</ScrollView>
View
6 src/com/matburt/mobileorg/MobileOrgActivity.java
@@ -219,8 +219,10 @@ else if (e.editType.equals("heading")) {
private static final int OP_MENU_CAPTURE = 4;
private static final int RUN_PARSER = 3;
-
+
private static final String LT = "MobileOrg";
+
+ private int displayIndex;
private ProgressDialog syncDialog;
private MobileOrgDatabase appdb;
private ReportableError syncError;
@@ -231,7 +233,7 @@ public void run() {
postSynchronize();
}
};
-
+
@Override
public void onCreate(Bundle savedInstanceState)
{
View
14 src/com/matburt/mobileorg/Synchronizers/DropboxSynchronizer.java
@@ -17,6 +17,7 @@
import java.io.*;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
public class DropboxSynchronizer extends Synchronizer {
private boolean hasToken = false;
@@ -107,6 +108,19 @@ public void pull() throws NotFoundException, ReportableError {
key,
newChecksums.get(key));
}
+
+ // the key-value semantics is switched: in getOrgFiles(), the HashMap has filenames as keys
+ // while in masterList (getOrgFilesFromMaster) the file aliases are keys
+ HashSet<String> filesInDb = new HashSet<String>(this.appdb.getOrgFiles().keySet());
+ HashSet<String> filesInIndexFile = new HashSet<String>(masterList.values());
+ filesInDb.removeAll(filesInIndexFile); //now contains stale DB files
+ if (filesInDb.size() > 0) {
+ Object[] arrObj = filesInDb.toArray();
+ for (int i = 0; i < arrObj.length; i++) {
+ Log.i(LT, "Orphaned file: " + (String)arrObj[i]);
+ removeFile((String)arrObj[i]);
+ }
+ }
}
private String getRootPath() throws ReportableError {
View
14 src/com/matburt/mobileorg/Synchronizers/SDCardSynchronizer.java
@@ -12,6 +12,7 @@
import java.io.*;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
public class SDCardSynchronizer extends Synchronizer
{
@@ -158,6 +159,19 @@ public void pull() throws NotFoundException, ReportableError {
Log.d(LT, "Fetching: " + key + ": " + basePath + "/" + masterList.get(key));
this.appdb.addOrUpdateFile(masterList.get(key), key, newChecksums.get(key));
}
+
+ // the key-value semantics is switched: in getOrgFiles(), the HashMap has filenames as keys
+ // while in masterList (getOrgFilesFromMaster) the file aliases are keys
+ HashSet<String> filesInDb = new HashSet<String>(this.appdb.getOrgFiles().keySet());
+ HashSet<String> filesInIndexFile = new HashSet<String>(masterList.values());
+ filesInDb.removeAll(filesInIndexFile); //now contains stale DB files
+ if (filesInDb.size() > 0) {
+ Object[] arrObj = filesInDb.toArray();
+ for (int i = 0; i < arrObj.length; i++) {
+ Log.i(LT, "Orphaned file: " + (String)arrObj[i]);
+ removeFile((String)arrObj[i]);
+ }
+ }
}
private String readFile(String filePath) throws ReportableError,
View
14 src/com/matburt/mobileorg/Synchronizers/WebDAVSynchronizer.java
@@ -29,6 +29,7 @@
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.regex.Pattern;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSession;
@@ -127,6 +128,19 @@ public void pull() throws NotFoundException, ReportableError {
key,
newChecksums.get(key));
}
+
+ // the key-value semantics is switched: in getOrgFiles(), the HashMap has filenames as keys
+ // while in masterList (getOrgFilesFromMaster) the file aliases are keys
+ HashSet<String> filesInDb = new HashSet<String>(this.appdb.getOrgFiles().keySet());
+ HashSet<String> filesInIndexFile = new HashSet<String>(masterList.values());
+ filesInDb.removeAll(filesInIndexFile); //now contains stale DB files
+ if (filesInDb.size() > 0) {
+ Object[] arrObj = filesInDb.toArray();
+ for (int i = 0; i < arrObj.length; i++) {
+ Log.i(LT, "Orphaned file: " + (String)arrObj[i]);
+ removeFile((String)arrObj[i]);
+ }
+ }
}
public BufferedReader fetchOrgFile(String orgUrl) throws NotFoundException, ReportableError {
Please sign in to comment.
Something went wrong with that request. Please try again.