use of ingage.ingage.helpers.ThreadsHelper in project iNGAGE by davis123123.
the class CategoriesPageFragment method inflateThreads.
void inflateThreads() {
int count = 0;
try {
jsonObject = new JSONObject(json_string);
jsonArray = jsonObject.getJSONArray("server_response");
String thread_id, thread_title, thread_content, thread_by, thread_date, thread_category, thread_time_remaining;
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");
thread_time_remaining = JO.getString("seconds_remaining");
long timer = time_remaining(thread_time_remaining);
ThreadsHelper threadsHelper = new ThreadsHelper(thread_id, thread_title, thread_content, thread_by, thread_date, thread_category, thread_img, timer);
threadListAdapter.add(threadsHelper);
threadListAdapter.notifyDataSetChanged();
count++;
}
} catch (JSONException e) {
e.printStackTrace();
}
checkIfNoThreads(count);
}
use of ingage.ingage.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();
threadDescription = threadsHelper.getThread_content();
Log.i("clicked: ", threadTitle);
String type = "view";
chooseSideDialog(context, thread_id, type);
}
use of ingage.ingage.helpers.ThreadsHelper in project iNGAGE by davis123123.
the class Testadapter method getView.
@NonNull
@Override
public View getView(int position, View convertView, @NonNull ViewGroup parent) {
View row;
row = convertView;
ThreadHolder threadHolder;
if (row == null) {
LayoutInflater layoutInflater = (LayoutInflater) this.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
row = layoutInflater.inflate(R.layout.item_thread_row_layout, parent, false);
threadHolder = new ThreadHolder();
threadHolder.thread_title = (TextView) row.findViewById(R.id.thread_title_view);
row.setTag(threadHolder);
} else {
threadHolder = (ThreadHolder) row.getTag();
}
ThreadsHelper threadsHelper = (ThreadsHelper) this.getItem(position);
assert threadsHelper != null;
threadHolder.thread_title.setText(threadsHelper.getThread_title());
return row;
}
use of ingage.ingage.helpers.ThreadsHelper in project iNGAGE by davis123123.
the class ThreadListAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
if (holder instanceof ThreadViewHolder) {
ThreadsHelper threadsHelper = (ThreadsHelper) this.getItem(position);
String containImg = threadsHelper.getThread_img();
// Check if view holder contains an image
if (containImg.trim().length() == 0) {
((ThreadViewHolder) holder).threadImageView.setVisibility(View.GONE);
} else {
((ThreadViewHolder) holder).threadImageView.setVisibility(View.VISIBLE);
// ((ThreadViewHolder) holder).threadContentTextView.setVisibility(View.GONE);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.BELOW, R.id.thread_title_view);
params.setMargins(0, 0, 0, 0);
((ThreadViewHolder) holder).threadImageView.setLayoutParams(params);
}
// holder.bind(position);
ThreadViewHolder threadViewHolder = (ThreadViewHolder) holder;
threadViewHolder.bind(position);
} else if (holder instanceof LoadingViewHolder) {
LoadingViewHolder loadingViewHolder = (LoadingViewHolder) holder;
loadingViewHolder.progressBar.setIndeterminate(true);
}
}
use of ingage.ingage.helpers.ThreadsHelper in project iNGAGE by davis123123.
the class ArchivedFragment method inflateThreads.
void inflateThreads() {
int count = 0;
Log.d("archiveinflate", "clicked");
try {
jsonObject = new JSONObject(json_string);
jsonArray = jsonObject.getJSONArray("server_response");
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");
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();
}
checkIfNoThreads(count);
}
Aggregations