-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #739 from haiwen/fix_block_open_fail
Fix block open fail
- Loading branch information
Showing
22 changed files
with
258 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
app/src/main/java/com/seafile/seadroid2/data/BlockInfoBean.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.seafile.seadroid2.data; | ||
|
||
import com.seafile.seadroid2.util.Utils; | ||
|
||
import org.json.JSONArray; | ||
import org.json.JSONException; | ||
import org.json.JSONObject; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
|
||
public class BlockInfoBean { | ||
public List<String> blkIds; | ||
public String rawblksurl; | ||
public String commiturl; | ||
|
||
public static BlockInfoBean fromJson(String json) throws JSONException { | ||
BlockInfoBean bean = new BlockInfoBean(); | ||
JSONObject obj = Utils.parseJsonObject(json); | ||
bean.rawblksurl = obj.optString("rawblksurl"); | ||
bean.commiturl = obj.optString("commiturl"); | ||
JSONArray jsonArray = obj.optJSONArray("blklist"); | ||
bean.blkIds = new ArrayList<>(); | ||
for (int i = 0; i < jsonArray.length(); i++) { | ||
bean.blkIds.add(jsonArray.getString(i)); | ||
} | ||
return bean; | ||
} | ||
|
||
public BlockInfoBean() { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.