コード例 #1
0
  public void initGameNews() {
    con = DataConnector.getInst();
    Bundle myIntent = getArguments();
    String id = myIntent.getString(Keys.ID_GAME);
    final ArrayList<Bundle> results = con.getLinker().getTempNewsTab(id, "game");
    if (results != null) {
      list = (ListView) mView.findViewById(R.id.mainList);
      txtMessage = (TextView) mView.findViewById(R.id.frag_Gnews_TView);
      if (results.size() != 0) txtMessage.setVisibility(View.GONE);
      System.out.println(results.size());
      NewsListAdapter bindingData =
          new NewsListAdapter(
              getActivity(),
              HelperClass.createHeaderListViewNews(HelperClass.queryNewsList(results)));
      list.setAdapter(bindingData);
      list.setOnItemClickListener(
          new OnItemClickListener() {

            @SuppressLint("SimpleDateFormat")
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

              if (parent.getItemAtPosition(position) instanceof NewsFeed) {
                NewsFeed feed = (NewsFeed) parent.getItemAtPosition(position);
                Bundle edit = new Bundle();
                SimpleDateFormat format = Configurations.dataTemplate;

                edit.putInt(Keys.NEWSCOLID_NEWS, feed.getKey_NewsFeedID());
                edit.putString(Keys.NEWSCOLIMAGE, feed.getKey_NewsImage());
                edit.putString(Keys.NEWSCOLHEADLINE, feed.getKey_NewsTitle());
                edit.putString(Keys.NEWSCOLINTROTEXT, feed.getKey_NewsIntroText());
                edit.putString(Keys.NEWSCOLNEWSTEXT, feed.getKey_NewsText());
                edit.putString(Keys.Author, feed.getKey_Author());
                edit.putString(
                    Keys.NEWSCOLPOSTINGTIME, format.format(feed.getKey_NewsDate().getTime()));

                mCallback.setPageAndTab(Configurations.NewsSTATE, 2, edit);
              }
            }
          });
    }
  }
コード例 #2
0
  @Override
  @SuppressLint("ResourceAsColor")
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    con = DataConnector.getInst();
    View mView = inflater.inflate(R.layout.fragment_template_wall, container, false);
    footer = inflater.inflate(R.layout.component_comment_footer, null);
    expList = (ExpandableListView) mView.findViewById(R.id.fragMsgAndWallTemp_expList);
    mListData = new ArrayList<UserComment>();
    commentText = (EditText) footer.findViewById(R.id.wallsF_comment_EBox);
    Button commentBut = (Button) footer.findViewById(R.id.wallsF_commBut);
    commentBut.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            con.insertComment(
                commentText.getText().toString(),
                "game",
                getArguments().getString(Keys.GAMENAME),
                getArguments().getString(Keys.ID_GAME));

            String playerName = con.getCurrentPlayer().getString(Keys.PLAYERNAME);
            String time = DateFormat.getDateTimeInstance().format(new Date());

            /*
             * mListData.add(new UserComment(new CommentInfo(playerName,
             * commentText.getText().toString(), time), new
             * ArrayList<CommentInfo>()));
             * expAdapter.notifyDataSetChanged();
             */
            Log.i("Games Wall", "Comment Button Pressed" + commentText.getText().toString());
          }
        });
    HelperClass.disableAddComments(footer, commentText, commentBut);
    mCommentsTask =
        new LoadCommentsTask(this, getArguments().getString(Keys.ID_GAME), "game").execute();
    // Inflate the layout for this fragment
    return mView;
  }