From 0904a689b918b8d7a6bdacc958eca37a3ad7d101 Mon Sep 17 00:00:00 2001 From: Filip Stanis Date: Sun, 11 Feb 2018 15:50:17 +0000 Subject: [PATCH] Update package names and function calls for gobind --- app/.gitignore | 1 + .../io/upspin/upspin/DirEntryAdapter.java | 2 +- .../main/java/io/upspin/upspin/ListDir.java | 21 +++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) create mode 100644 app/.gitignore diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/src/main/java/io/upspin/upspin/DirEntryAdapter.java b/app/src/main/java/io/upspin/upspin/DirEntryAdapter.java index 70e5a9b..b55eca3 100644 --- a/app/src/main/java/io/upspin/upspin/DirEntryAdapter.java +++ b/app/src/main/java/io/upspin/upspin/DirEntryAdapter.java @@ -14,7 +14,7 @@ import java.util.Date; import java.util.Locale; -import go.gobind.Gobind.DirEntry; +import gobind.DirEntry; /** * DirEntryAdapter is a recycler view adapter for displaying cards on the UI that contain directory diff --git a/app/src/main/java/io/upspin/upspin/ListDir.java b/app/src/main/java/io/upspin/upspin/ListDir.java index d377e6c..35d7244 100644 --- a/app/src/main/java/io/upspin/upspin/ListDir.java +++ b/app/src/main/java/io/upspin/upspin/ListDir.java @@ -33,10 +33,9 @@ import java.io.FileNotFoundException; import java.io.IOException; -import go.gobind.Gobind; -import go.gobind.Gobind.Client; -import go.gobind.Gobind.ClientConfig; -import go.gobind.Gobind.DirEntry; +import gobind.Client; +import gobind.ClientConfig; +import gobind.DirEntry; /** * ListDir is an Activity for listing and navigating the contents of a user directory. @@ -116,7 +115,7 @@ private ClientConfig reloadPreferences() { if (pubKey.length() > 0 && pubKey.charAt(pubKey.length() - 1) != '\n') { pubKey = pubKey + "\n"; } - ClientConfig cfg = Gobind.NewClientConfig(); + ClientConfig cfg = new ClientConfig(); cfg.setUserName(userName); cfg.setPublicKey(pubKey); cfg.setPrivateKey(privKey); @@ -210,7 +209,7 @@ public void navigateToDir(final String dir) { protected DirEntry doInBackground(Void... params) { DirEntry entry = null; try { - entry = mClient.Glob(dir + "/*"); + entry = mClient.glob(dir + "/*"); } catch (java.lang.Exception e) { opException = e; return null; @@ -238,7 +237,7 @@ private void refresh() { // This does not do networking operations hence it is suitable for the main thread. try { - mClient = Gobind.NewClient(mClientConfig); + mClient = new Client(mClientConfig); } catch (java.lang.Exception e) { showModalErrorMessage(e.getLocalizedMessage(), "Error Connecting Client"); return; @@ -256,7 +255,7 @@ private void refresh() { } @Override - public void onClick(Gobind.DirEntry de) { + public void onClick(DirEntry de) { if (de.getIsDir()) { navigateToDir(de.getName()); } else { @@ -273,7 +272,7 @@ protected byte[] doInBackground(Void... voids) { // TODO: show a spinner while loading. byte[] data = null; try { - data = mClient.Get(fullFilename); + data = mClient.get(fullFilename); } catch (java.lang.Exception e) { opException = e; return null; @@ -389,7 +388,7 @@ protected Void doInBackground(Void... voids) { // TODO: Use the size to choose between reading all into memory and the streaming API. byte[] data = readAll(uri); try { - String ref = mClient.Put(fname, data); + String ref = mClient.put(fname, data); Log.i("ListDir.Put", "ref: " + ref + " fname:" + fname); } catch (Exception e) { opException = e; @@ -413,4 +412,4 @@ public void onPostExecute(Void voids) { } } } -} \ No newline at end of file +}