Search in sources :

Example 1 with ThreadsHelper

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);**/
}
Also used : Context(android.content.Context) ThreadsHelper(ingage.ingage20.helpers.ThreadsHelper)

Example 2 with ThreadsHelper

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;
}
Also used : LayoutInflater(android.view.LayoutInflater) TextView(android.widget.TextView) View(android.view.View) ThreadsHelper(ingage.ingage20.helpers.ThreadsHelper) NonNull(android.support.annotation.NonNull)

Example 3 with ThreadsHelper

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);
}
Also used : ThreadsHelper(ingage.ingage20.helpers.ThreadsHelper)

Example 4 with ThreadsHelper

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();
        }**/
}
Also used : Testadapter(ingage.ingage20.adapters.Testadapter) MySQLDbHelper(ingage.ingage20.handlers.MySQLDbHelper)

Example 5 with ThreadsHelper

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);
    }
}
Also used : RelativeLayout(android.widget.RelativeLayout) ThreadsHelper(ingage.ingage20.helpers.ThreadsHelper)

Aggregations

ThreadsHelper (ingage.ingage20.helpers.ThreadsHelper)9 JSONException (org.json.JSONException)3 JSONObject (org.json.JSONObject)3 Context (android.content.Context)2 NonNull (android.support.annotation.NonNull)1 LayoutInflater (android.view.LayoutInflater)1 View (android.view.View)1 RelativeLayout (android.widget.RelativeLayout)1 TextView (android.widget.TextView)1 Testadapter (ingage.ingage20.adapters.Testadapter)1 MySQLDbHelper (ingage.ingage20.handlers.MySQLDbHelper)1 SpectateRoomHandler (ingage.ingage20.handlers.SpectateRoomHandler)1 ChatRoomManager (ingage.ingage20.managers.ChatRoomManager)1 SessionManager (ingage.ingage20.managers.SessionManager)1 ExecutionException (java.util.concurrent.ExecutionException)1