mirror of
https://github.com/lubosz/overte.git
synced 2025-04-06 12:02:19 +02:00
Android - Search - Domains local file not needed anymore
This commit is contained in:
parent
a363041482
commit
de00f680fa
2 changed files with 0 additions and 58 deletions
|
@ -1,24 +0,0 @@
|
|||
{
|
||||
"hifi_domains" : [
|
||||
{
|
||||
"name": "Your last location",
|
||||
"url": "",
|
||||
"thumbnail": ""
|
||||
},
|
||||
{
|
||||
"name": "dev-mobile-master",
|
||||
"url": "hifi://dev-mobile-master",
|
||||
"thumbnail": ""
|
||||
},
|
||||
{
|
||||
"name": "dev-mobile",
|
||||
"url": "hifi://dev-mobile",
|
||||
"thumbnail": ""
|
||||
},
|
||||
{
|
||||
"name": "dev-welcome",
|
||||
"url": "hifi://dev-welcome",
|
||||
"thumbnail": ""
|
||||
}
|
||||
]
|
||||
}
|
|
@ -30,7 +30,6 @@ import io.highfidelity.hifiinterface.provider.UserStoryDomainProvider;
|
|||
*/
|
||||
public class DomainAdapter extends RecyclerView.Adapter<DomainAdapter.ViewHolder> {
|
||||
|
||||
private static final java.lang.String DOMAINS_FILE = "hifi_domains.json";
|
||||
private static final String TAG = "HiFi Interface";
|
||||
private Context mContext;
|
||||
private LayoutInflater mInflater;
|
||||
|
@ -76,39 +75,6 @@ public class DomainAdapter extends RecyclerView.Adapter<DomainAdapter.ViewHolder
|
|||
});
|
||||
}
|
||||
|
||||
private void loadDomainsLocalFile() {
|
||||
try {
|
||||
JSONObject json = new JSONObject(loadJSONFromAsset());
|
||||
JSONArray hifiDomains = json.getJSONArray("hifi_domains");
|
||||
List<Domain> domains = new ArrayList<>();
|
||||
for (int i = 0; i < hifiDomains.length(); i++) {
|
||||
JSONObject jDomain = hifiDomains.getJSONObject(i);
|
||||
|
||||
String domainName = jDomain.getString("name");
|
||||
String domainUrl = jDomain.getString("url");
|
||||
String domainThumb = jDomain.getString("thumbnail");
|
||||
|
||||
domains.add(new Domain(domainName, domainUrl, domainThumb));
|
||||
}
|
||||
mDomains = domains.toArray(mDomains);
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "Error loading domains from local file", e);
|
||||
} catch (JSONException e) {
|
||||
Log.e(TAG, "Error loading domains from local file", e);
|
||||
}
|
||||
}
|
||||
|
||||
public String loadJSONFromAsset() throws IOException {
|
||||
String json = null;
|
||||
InputStream is = mContext.getAssets().open(DOMAINS_FILE);
|
||||
int size = is.available();
|
||||
byte[] buffer = new byte[size];
|
||||
is.read(buffer);
|
||||
is.close();
|
||||
json = new String(buffer, "UTF-8");
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = mInflater.inflate(R.layout.domain_view, parent, false);
|
||||
|
|
Loading…
Reference in a new issue