Android Open Source - ChitChat Profile Fragment






From Project

Back to project page ChitChat.

License

The source code is released under:

MIT License

If you think the Android project ChitChat 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.shivamb7.chitchat.fragments;
/*from  ww w  .  java2 s . com*/


import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
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.TextView;
import android.widget.Toast;

import com.parse.ParseUser;
import com.shivamb7.chitchat.AddFriendsActivity;
import com.shivamb7.chitchat.R;
import com.squareup.picasso.Picasso;

public class ProfileFragment extends Fragment {
  
  TextView mName,mUsername,mFriends;
  int PICK_PICTURE = 100;
  Uri pictureUri;
  com.shivamb7.chitchat.workers.CircularImageView img;
  ParseUser currentUser = ParseUser.getCurrentUser();
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
  {
    View rootView = inflater.inflate(R.layout.profile_view, container, false);
    mName = (TextView)rootView.findViewById(R.id.profile_name);
    mUsername = (TextView)rootView.findViewById(R.id.profile_username);
    mFriends = (TextView)rootView.findViewById(R.id.profile_friends);
    mName.setText(currentUser.getString("Name"));
    mUsername.setText(currentUser.getUsername());
    //String friendCount = (AddFriendsActivity.count)+" friends";
    //mFriends.setText(friendCount);
    final Fragment fg = this;
    img = (com.shivamb7.chitchat.workers.CircularImageView)rootView.findViewById(R.id.profile_picture);
    img.setBorderColor(getResources().getColor(R.color.orange_800));
    img.setBorderWidth(40);
    img.setSelectorColor(getResources().getColor(R.color.orange_800));
    img.setOnClickListener(new OnClickListener() {
      
      @Override
      public void onClick(View v) {
        // TODO Auto-generated method stub
        
        Toast.makeText(getActivity(), "Stuuf", Toast.LENGTH_SHORT).show();
        Intent choosePictureIntent = new Intent(Intent.ACTION_GET_CONTENT);
        choosePictureIntent.setType("image/*");
        getActivity().startActivityForResult(choosePictureIntent, PICK_PICTURE);
        //getActivity().start
      }
    });
    /*TextView textView = (TextView) rootView.findViewById(R.id.section_label);
    textView.setText(Integer.toString(getArguments().getInt(ARG_SECTION_NUMBER)));*/
    return rootView;
  }
  
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if(resultCode == Activity.RESULT_OK)
    {

      if(requestCode == PICK_PICTURE)
      {
        if(data==null)
        {
          Toast.makeText(getActivity(), "Try picking a file again", Toast.LENGTH_SHORT).show();
        }
        else
        {
          pictureUri = data.getData();
          Picasso.with(getActivity()).load(pictureUri.toString()).into(img);
          Toast.makeText(getActivity(), "ffdc", Toast.LENGTH_SHORT).show();
          
        }
      }
      else
      {
        super.onActivityResult(requestCode, resultCode, data);
      }
    }
  }

}




Java Source Code List

com.pkmmte.circularimageview.CircularImageView.java
com.shivamb7.chitchat.AddFriendsActivity.java
com.shivamb7.chitchat.ChatsActivity.java
com.shivamb7.chitchat.ComposeTextActivity.java
com.shivamb7.chitchat.ImageMessageActivity.java
com.shivamb7.chitchat.MainActivity.java
com.shivamb7.chitchat.ProfileActivity.java
com.shivamb7.chitchat.RecipientsActivity.java
com.shivamb7.chitchat.RegisterActivity2.java
com.shivamb7.chitchat.RegisterActivity.java
com.shivamb7.chitchat.adapters.ChatsAdapter.java
com.shivamb7.chitchat.adapters.FriendGridAdapter.java
com.shivamb7.chitchat.adapters.LevelAdapter.java
com.shivamb7.chitchat.fragments.ChatsFragment.java
com.shivamb7.chitchat.fragments.ContactsFragment.java
com.shivamb7.chitchat.fragments.ProfileFragment.java
com.shivamb7.chitchat.workers.ChitChatApplication.java
com.shivamb7.chitchat.workers.CircularImageView.java
com.shivamb7.chitchat.workers.Constants.java
com.shivamb7.chitchat.workers.Fab.java
com.shivamb7.chitchat.workers.FileHelper.java
com.shivamb7.chitchat.workers.ImageResizer.java
com.shivamb7.chitchat.workers.Level.java
com.shivamb7.chitchat.workers.RippleView.java
com.shivamb7.chitchat.workers.TypefaceSpan.java