use of ingage.ingage20.helpers.ThreadsHelper in project iNGAGE by davis123123.
the class FrontPageFragment method onListItemClick.
@Override
public void onListItemClick(int clickedItemIndex) {
Context context = getActivity().getApplicationContext();
if (mToast != null) {
mToast.cancel();
}
ThreadsHelper threadsHelper = (ThreadsHelper) threadListAdapter.getItem(clickedItemIndex);
String thread_id = threadsHelper.getThread_id();
//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);
/**
Intent startChildActivityIntent = new Intent(getActivity(), ViewThreadActivity.class);
startChildActivityIntent.putExtra(Intent.EXTRA_TEXT, thread_id);
startActivity(startChildActivityIntent);**/
}
use of ingage.ingage20.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.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.ingage20.helpers.ThreadsHelper in project iNGAGE by davis123123.
the class ThreadListAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(ThreadListAdapter.ThreadViewHolder holder, int position) {
ThreadsHelper threadsHelper = (ThreadsHelper) this.getItem(position);
holder.bind(position);
}
use of ingage.ingage20.helpers.ThreadsHelper in project iNGAGE by davis123123.
the class DisplayListView method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getJSON();
setContentView(R.layout.display_listview_layout);
mySQLDbHelper = new MySQLDbHelper();
listView = (ListView) findViewById(R.id.listview);
testadapter = new Testadapter(this, R.layout.thread_row_layout);
//setContentView(R.layout.thread_row_layout);
//textView = (TextView) findViewById(R.id.thread_title_view);
//textView.setText(json_string);
listView.setAdapter(testadapter);
/**try {
jsonObject = new JSONObject(json_string);
jsonArray = jsonObject.getJSONArray("server_response");
int count = 0;
String thread_title, thread_content, thread_by, thread_date, thread_category;
while(count < jsonArray.length()){
JSONObject JO= jsonArray.getJSONObject(count);
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");
ThreadsHelper threadsHelper = new ThreadsHelper(thread_title, thread_content, thread_by, thread_date, thread_category);
HashMap<String, String> threadsDetail = new HashMap<String, String>();
threadsDetail.put("TAG_TITLE", thread_title);
threadsDetail.put("TAG_CONTENT", thread_content);
threadsDetail.put("TAG_BY", thread_by);
threadsDetail.put("TAG_DATE", thread_date);
testadapter.add(threadsHelper);
count++;
}
} catch (JSONException e) {
e.printStackTrace();
}**/
}
use of ingage.ingage20.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);
}
}
Aggregations