Android Open Source - Chit-Chat Bird Grid Fragment






From Project

Back to project page Chit-Chat.

License

The source code is released under:

GNU General Public License

If you think the Android project Chit-Chat listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.dhansiddh.chatmessenger;
// w  w w  . j av a2s  .  c  o  m
import android.annotation.SuppressLint;
import android.app.ActionBar;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

public class BirdGridFragment extends Fragment {

  private int mPos = -1;
  private int mImgRes;
  String name,number,msg;
  EditText ms;
  TextView msbox;
  
  MainActivity ra;
  ListView msglist;
  public BirdGridFragment() { }
  public BirdGridFragment(int pos,String nm,String numb) {
    mPos = pos;
    name=nm;
    number=numb;
  }
  
  @SuppressLint("NewApi")
  @Override
  public RelativeLayout onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (mPos == -1 && savedInstanceState != null)
      mPos = savedInstanceState.getInt("mPos");  
    RelativeLayout gv =(RelativeLayout) inflater.inflate(R.layout.activity_main,null);
    msbox=(TextView) gv.findViewById(R.id.msbox);
    Button but=(Button) gv.findViewById(R.id.sendbut);
    msglist=(ListView) gv.findViewById(R.id.messagelist);
    ra = (MainActivity) getActivity();
    boolean hasActionBar = android.os.Build.VERSION.SDK_INT >= 11;
    if (hasActionBar) {
    ActionBar abActionBar = ra.getActionBar();
    abActionBar.setTitle(name);
    abActionBar.setSubtitle(number);
    }
    ra.setadap(msglist,number);
    but.setOnClickListener(new OnClickListener() {
      
      @Override
      public void onClick(View arg0) {
        // TODO Auto-generated method stub
        MainActivity mm=(MainActivity) getActivity();
        msg=msbox.getText().toString();
        msbox.setText("");
        if(msg.length()==0)
        Toast.makeText(ra,"Enter the Message",Toast.LENGTH_LONG).show();
        else{
        mm.senddmsg(number,msg);
        }
      }
    });
      return gv;
  }
  @Override
  public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putInt("mPos", mPos);
  }
}




Java Source Code List

com.dhansiddh.chatmessenger.AlertDialogManager.java
com.dhansiddh.chatmessenger.BaseActivity.java
com.dhansiddh.chatmessenger.BirdGridFragment.java
com.dhansiddh.chatmessenger.BirdMenuFragment.java
com.dhansiddh.chatmessenger.CommonUtilities.java
com.dhansiddh.chatmessenger.ConnectionDetector.java
com.dhansiddh.chatmessenger.GCMIntentService.java
com.dhansiddh.chatmessenger.JSONParser.java
com.dhansiddh.chatmessenger.MainActivity.java
com.dhansiddh.chatmessenger.MainPage.java
com.dhansiddh.chatmessenger.MessageAdapter.java
com.dhansiddh.chatmessenger.MessageItem.java
com.dhansiddh.chatmessenger.MessageMainListAdapter.java
com.dhansiddh.chatmessenger.Register_Number.java
com.dhansiddh.chatmessenger.Register.java
com.dhansiddh.chatmessenger.SampleListFragment.java
com.dhansiddh.chatmessenger.ServerUtilities.java
com.dhansiddh.chatmessenger.WakeLocker.java