Android Open Source - socialcde4android W User Colleague Profile_ Fragment






From Project

Back to project page socialcde4android.

License

The source code is released under:

MIT License

If you think the Android project socialcde4android 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 it.uniba.socialcde4android.fragments;
/*w w w.  ja  v  a2 s  .  co  m*/

import java.util.ArrayList;

import it.uniba.socialcde4android.R;

import it.uniba.socialcde4android.shared.library.WPost;
import it.uniba.socialcde4android.shared.library.WUser;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;


public class WUserColleagueProfile_Fragment extends TimeLine_AbstractFragment{
  


  private static final String ARG_WUSER = "wuser";
  private WUser wuser;
  private ImageView userImage;
  private TextView userNameText;
  private TextView postsText;
  private TextView followersText;
  private TextView followingText;
  private CheckBox followCheckBox;
  private Button hideButton;
  private OnProfileFragmentInteractionListener mListenerWUser;
  private static final String ARG_PASSWORD = "password";



  @Override
  public int getFragmentViewId() {
    return R.layout.fragment_wusercolleague_profile;
  }

  public static WUserColleagueProfile_Fragment newInstance(WUser wuser, String passw_string) {
    WUserColleagueProfile_Fragment fragment = new WUserColleagueProfile_Fragment();
    Bundle args = new Bundle();
    args.putParcelable(ARG_WUSER, wuser);
    args.putString(ARG_PASSWORD, passw_string);
    fragment.setArguments(args);
    return fragment;
  }

  public WUserColleagueProfile_Fragment() {
  //  super();
    // Required empty public constructor
  }
  
  


  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (getArguments() != null) {
      wuser = getArguments().getParcelable(ARG_WUSER);
      password = getArguments().getString(ARG_PASSWORD);

    }
  }


  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
      Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = super.onCreateView(inflater, container, savedInstanceState);
    pullListView.setOnRefreshListener(WUserColleagueProfile_Fragment.this);

    userImage = (ImageView) view.findViewById(R.id.imageViewFrament);
    userNameText = (TextView) view.findViewById(R.id.textViewUsernameFragment);
    postsText = (TextView) view.findViewById(R.id.textViewPostsFragment);
    followersText = (TextView) view.findViewById(R.id.textViewFollowersFragment);
    followingText = (TextView) view.findViewById(R.id.textViewFollowingFragment);
    followCheckBox = (CheckBox) view.findViewById(R.id.checkBoxFollowFragment);
    hideButton = (Button) view.findViewById(R.id.buttonHideUnide);


    String avatar_address = wuser.getAvatar();
    
    hideButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
          mListenerWUser.loadUserHideSettings(wuser.getId());
        }
    });
    
    
    if (avatar_address != null){
      imageloader.displayImage(avatar_address, userImage);

    }
    userNameText.setText(wuser.getUsername());
    postsText.setText("Posts: "+wuser.getStatuses());
    followersText.setText("Followers: "+wuser.getFollowers());
    followingText.setText("Following: "+wuser.getFollowings());
    followCheckBox.setChecked(wuser.isFollowed());
    followCheckBox.setOnClickListener(new CheckBox.OnClickListener(){

      @Override
      public void onClick(View arg0) {
        onFollowCheckBoxClicked(followCheckBox.isChecked());
      }
    });
    
    return view;
  }

  public void changeCheckBoxState(){
    followCheckBox.setChecked(!followCheckBox.isChecked()) ;
  }

  public void onFollowCheckBoxClicked(Boolean checked) {
    if (mListenerWUser != null) {
      mListenerWUser.onProfileFragmentCheckBoxChanged(checked, wuser);
    }
  }

  public interface OnProfileFragmentInteractionListener {
    // TODO: Update argument type and name
    public void onProfileFragmentCheckBoxChanged(Boolean followChecked, WUser wuser_profile);
    
    public void loadUserHideSettings(int userId);
  }

//  public void loadDialogHideUnhide(WHidden widden){
//    //richiamare la dialog impostando i checkbox con i valori di hidden
//    HideUnhideDialog hideUnhide_dialog = HideUnhideDialog.newInstance(widden);
//    hideUnhide_dialog.show(getFragmentManager(), "Change Hide Settings");
//  }

  @Override
  public void onAttach(Activity activity) {
    super.onAttach(activity);
    try {
      mListenerWUser = (OnProfileFragmentInteractionListener) activity;
    } catch (ClassCastException e) {
      throw new ClassCastException(activity.toString()
          + " must implement OnProfileFragmentInteractionListener");
    }
  }

  @Override
  public void onDetach() {
    super.onDetach();
    mListenerWUser = null;
  }


  @Override
  public void onPause() {
    super.onPause();
    //if (getDataTask != null )   getDataTask.cancel(true);
    //if (getMoreDataTask != null )getMoreDataTask.cancel(true);
  }

  @Override
  public String getRequestType() {
    return "/GetUserTimeline";
  }

  @Override
  public String getRequest(int datatype) {
    long since = 0;
    long to = 0 ;
    if (datatype == super.GET_MOREDATA_TYPE)
      to = (mListWpostItems[mListWpostItems.length -1]).getId();
    return "{ \"username\":\"" + username + "\", \"password\":\""
    + password + "\" , \"ownerName\":\"" + wuser.getUsername()
    + "\" , \"since\":\"" + since + "\" , \"to\":\"" + to
    + "\"}";
  }

  @Override
  protected Boolean getClickable() {
    return false;
  }

  @Override
  public void openUserProfileFromActivity(WUser wuser) {
    // TODO Auto-generated method stub
    
  }

  @Override
  public Fragment getFragment() {
    return this;
  }





}




Java Source Code List

it.uniba.socialcde4android.activity.HomeActivity.java
it.uniba.socialcde4android.activity.LoginActivity.java
it.uniba.socialcde4android.activity.RegistrationActivity.java
it.uniba.socialcde4android.activity.WebViewActivity.java
it.uniba.socialcde4android.adapters.ConfiguratedImageLoader.java
it.uniba.socialcde4android.adapters.FeaturesAdapter.java
it.uniba.socialcde4android.adapters.ServicesAdapter.java
it.uniba.socialcde4android.adapters.SquareImageView.java
it.uniba.socialcde4android.adapters.TimeLineAdapter.java
it.uniba.socialcde4android.adapters.UserAvatarsAdapter.java
it.uniba.socialcde4android.adapters.UsersAdapter.java
it.uniba.socialcde4android.config.Config.java
it.uniba.socialcde4android.costants.Consts.java
it.uniba.socialcde4android.costants.Error_consts.java
it.uniba.socialcde4android.costants.Services_id.java
it.uniba.socialcde4android.data.operation.Authorize_Operation.java
it.uniba.socialcde4android.data.operation.ChangePasswordWithPassword_Operation.java
it.uniba.socialcde4android.data.operation.GetAvailableAvatars_Operation.java
it.uniba.socialcde4android.data.operation.GetColleagueProfile_Operation.java
it.uniba.socialcde4android.data.operation.GetFeatures_Operation.java
it.uniba.socialcde4android.data.operation.GetFriends_Operation.java
it.uniba.socialcde4android.data.operation.GetHideSettings_Operation.java
it.uniba.socialcde4android.data.operation.GetOAuthData_Operation.java
it.uniba.socialcde4android.data.operation.GetUser_Operation.java
it.uniba.socialcde4android.data.operation.IsUsernameAvailable_Operation.java
it.uniba.socialcde4android.data.operation.IsWebServiceRunning_Operation.java
it.uniba.socialcde4android.data.operation.RecordService_Operation.java
it.uniba.socialcde4android.data.operation.RetrieveServices_Operation.java
it.uniba.socialcde4android.data.operation.SendTFSpost_Operation.java
it.uniba.socialcde4android.data.operation.SetActiveFeatures_Operation.java
it.uniba.socialcde4android.data.operation.SetAvatar_Operation.java
it.uniba.socialcde4android.data.operation.SetFollowed_Operation.java
it.uniba.socialcde4android.data.operation.SetHideSettings_Operation.java
it.uniba.socialcde4android.data.operation.SubscribeUser_Operation.java
it.uniba.socialcde4android.data.operation.UnregisterService_Operation.java
it.uniba.socialcde4android.data.requestmanager.SocialCDERequestFactory.java
it.uniba.socialcde4android.data.requestmanager.SocialCDERequestManager.java
it.uniba.socialcde4android.data.service.SocialCDERequestService.java
it.uniba.socialcde4android.dialogs.ChangePasswordDialog.java
it.uniba.socialcde4android.dialogs.ChooseAvatarDialog.java
it.uniba.socialcde4android.dialogs.HideUnhideDialog.java
it.uniba.socialcde4android.dialogs.NoNetworkDialog.java
it.uniba.socialcde4android.dialogs.SetServiceFeaturesDialog.java
it.uniba.socialcde4android.dialogs.TFSAuthDialog.java
it.uniba.socialcde4android.fragments.TimeLine_AbstractFragment.java
it.uniba.socialcde4android.fragments.TimeLine_Fragment.java
it.uniba.socialcde4android.fragments.WUserColleagueProfile_Fragment.java
it.uniba.socialcde4android.fragments.WUserProfile_Fragment.java
it.uniba.socialcde4android.preferences.Preferences.java
it.uniba.socialcde4android.shared.library.JsonDateDeserializer.java
it.uniba.socialcde4android.shared.library.WFeature.java
it.uniba.socialcde4android.shared.library.WHidden.java
it.uniba.socialcde4android.shared.library.WOAuthData.java
it.uniba.socialcde4android.shared.library.WPost.java
it.uniba.socialcde4android.shared.library.WService.java
it.uniba.socialcde4android.shared.library.WUser.java
it.uniba.socialcde4android.utility.ScreenUtility.java