use of ingage.ingage20.helpers.ThreadsHelper in project iNGAGE by davis123123.
the class CategoriesPageFragment method inflateThreads.
void inflateThreads() {
try {
jsonObject = new JSONObject(json_string);
jsonArray = jsonObject.getJSONArray("server_response");
int count = 0;
String thread_id, thread_title, thread_content, thread_by, thread_date, thread_category;
String thread_img_bitmap = null;
String thread_img = null;
while (count < jsonArray.length()) {
JSONObject JO = jsonArray.getJSONObject(count);
thread_id = JO.getString("thread_id");
thread_title = JO.getString("thread_title");
thread_content = JO.getString("thread_content");
thread_by = JO.getString("thread_by");
thread_date = JO.getString("thread_date");
thread_category = JO.getString("thread_category");
thread_img = JO.getString("thread_image_link");
/*DownloadImageHandler dlHandler = new DownloadImageHandler(getContext());
String type = "download";
//String thread_id = threadsHelper.getThread_id();
//do conversion
try {
thread_img_bitmap = dlHandler.execute(type, thread_id).get();
//Log.d("STATE", "room title: " + threadsHelper.getThread_title());
Log.d("STATE", "download thread img result: " + result);
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
Log.d("THREAD_BITMAP","result" + thread_img_bitmap);*/
ThreadsHelper threadsHelper = new ThreadsHelper(thread_id, thread_title, thread_content, thread_by, thread_date, thread_category, thread_img);
threadListAdapter.add(threadsHelper);
threadListAdapter.notifyDataSetChanged();
count++;
}
} catch (JSONException e) {
e.printStackTrace();
}
}
use of ingage.ingage20.helpers.ThreadsHelper in project iNGAGE by davis123123.
the class FragmentBase method spectate.
public void spectate(int p) {
ThreadsHelper threadsHelper = (ThreadsHelper) threadListAdapter.getItem(p);
String thread_id = threadsHelper.getThread_id();
String type = "spectate";
session = new SessionManager(getActivity().getApplicationContext());
HashMap<String, String> user = session.getUserDetails();
String username = user.get(SessionManager.KEY_NAME);
SpectateRoomHandler spectateRoomHandler = new SpectateRoomHandler(getActivity().getApplicationContext());
try {
// Log.d("JOINSPECTATE", "yes");
result = spectateRoomHandler.execute(type, thread_id, username).get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
if (result.equals("Spectate room failed")) {
Toast.makeText(getActivity(), "spectate room failed!", Toast.LENGTH_LONG).show();
} else {
chatRoomManager = new ChatRoomManager(getActivity().getApplicationContext());
chatRoomManager.updateUserRoomSession(thread_id, null, "true");
goToChat(result);
}
}
use of ingage.ingage20.helpers.ThreadsHelper in project iNGAGE by davis123123.
the class FragmentBase method itemClick.
public void itemClick(int p) {
Context context = getActivity().getApplicationContext();
if (mToast != null) {
mToast.cancel();
}
ThreadsHelper threadsHelper = (ThreadsHelper) threadListAdapter.getItem(p);
String thread_id = threadsHelper.getThread_id();
threadTitle = threadsHelper.getThread_title();
Log.i("clicked: ", threadTitle);
// LEAVE UNTIL COMMENTS A RE FINISHED
// String toastMessage = "Item #" + thread_id + "clicked.";
// mToast = Toast.makeText(getActivity(), toastMessage, Toast.LENGTH_LONG);
// mToast.show();
String type = "view";
chooseSideDialog(context, thread_id, type);
}
use of ingage.ingage20.helpers.ThreadsHelper in project iNGAGE by davis123123.
the class FrontPageFragment method inflateThreads.
void inflateThreads() {
try {
jsonObject = new JSONObject(json_string);
jsonArray = jsonObject.getJSONArray("server_response");
int count = 0;
String thread_id, thread_title, thread_content, thread_by, thread_date, thread_category;
String thread_img_bitmap = null;
String thread_img = null;
while (count < jsonArray.length()) {
JSONObject JO = jsonArray.getJSONObject(count);
thread_id = JO.getString("thread_id");
thread_title = JO.getString("thread_title");
thread_content = JO.getString("thread_content");
thread_by = JO.getString("thread_by");
thread_date = JO.getString("thread_date");
thread_category = JO.getString("thread_category");
thread_img = JO.getString("thread_image_link");
/* DownloadImageHandler dlHandler = new DownloadImageHandler(getContext());
String type = "download";
//String thread_id = threadsHelper.getThread_id();
//do conversion
try {
thread_img_bitmap = dlHandler.execute(type, thread_id).get();
//Log.d("STATE", "room title: " + threadsHelper.getThread_title());
Log.d("STATE", "download thread img result: " + result);
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
Log.d("THREAD_BITMAP","result" + thread_img_bitmap);*/
// thread_img_bitmap = "asdf";
ThreadsHelper threadsHelper = new ThreadsHelper(thread_id, thread_title, thread_content, thread_by, thread_date, thread_category, thread_img);
threadListAdapter.add(threadsHelper);
threadListAdapter.notifyDataSetChanged();
count++;
}
} catch (JSONException e) {
e.printStackTrace();
}
}
use of ingage.ingage20.helpers.ThreadsHelper in project iNGAGE by davis123123.
the class SearchResultFragment method inflateThreads.
void inflateThreads() {
try {
jsonObject = new JSONObject(json_string);
jsonArray = jsonObject.getJSONArray("server_response");
int count = 0;
String thread_id, thread_title, thread_content, thread_by, thread_date, thread_category;
String thread_img_bitmap = null;
String thread_img = null;
while (count < jsonArray.length()) {
JSONObject JO = jsonArray.getJSONObject(count);
thread_id = JO.getString("thread_id");
thread_title = JO.getString("thread_title");
thread_content = JO.getString("thread_content");
thread_by = JO.getString("thread_by");
thread_date = JO.getString("thread_date");
thread_category = JO.getString("thread_category");
thread_img = JO.getString("thread_image_link");
/*DownloadImageHandler dlHandler = new DownloadImageHandler(getContext());
String type = "download";
//String thread_id = threadsHelper.getThread_id();
//do conversion
try {
thread_img_bitmap = dlHandler.execute(type, thread_id).get();
//Log.d("STATE", "room title: " + threadsHelper.getThread_title());
Log.d("STATE", "download thread img result: " + result);
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
Log.d("THREAD_BITMAP","result" + thread_img_bitmap);*/
ThreadsHelper threadsHelper = new ThreadsHelper(thread_id, thread_title, thread_content, thread_by, thread_date, thread_category, thread_img);
threadListAdapter.add(threadsHelper);
threadListAdapter.notifyDataSetChanged();
count++;
}
} catch (JSONException e) {
e.printStackTrace();
}
}
Aggregations