Android Open Source - amanaje Row Contact Adapter






From Project

Back to project page amanaje.

License

The source code is released under:

Apache License

If you think the Android project amanaje 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.amanaje.view.adapters;
//from   ww  w  .j  a v  a 2s .c  o m
import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageButton;
import android.widget.ListAdapter;
import android.widget.TextView;

import com.amanaje.R;
import com.amanaje.activities.ContactDetailActivity;
import com.amanaje.activities.NewSmsActivity;
import com.amanaje.entities.ConfigEntity;

public class RowContactAdapter extends BaseAdapter implements ListAdapter { 

  private ArrayList<String> list = new ArrayList<String>(); 
  private Context context = null;
  private List<ConfigEntity> cfgContactEntityLst = null;



  public RowContactAdapter(ArrayList<String> list, Context context, List<ConfigEntity> cfgContactEntityLst) { 
    this.list = list; 
    this.context = context; 
    this.cfgContactEntityLst = cfgContactEntityLst;
  } 

  @Override
  public int getCount() { 
    return list.size(); 
  } 

  @Override
  public Object getItem(int pos) { 
    return list.get(pos); 
  } 

  @Override
  public long getItemId(int pos) { 
    return pos;
    //just return 0 if your list items do not have an Id variable.
  } 

  @Override
  public View getView(final int position, View convertView, ViewGroup parent) {
    View view = convertView;
    if (view == null) {
      LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
      view = inflater.inflate(R.layout.rowcontact, null);
    } 

    //Handle TextView and display string from your list
    TextView listItemText = (TextView)view.findViewById(R.id.list_item_string); 
    listItemText.setText(list.get(position)); 


    ImageButton settings = (ImageButton)view.findViewById(R.id.settings);


    settings.setOnClickListener(new View.OnClickListener(){
      @Override
      public void onClick(View v) { 
        ConfigEntity element = cfgContactEntityLst.get(position);

        Intent i = new Intent(context, ContactDetailActivity.class);
        i.putExtra("nick", element.getNick());
        i.putExtra("fileName", element.getConfigFileName());
        i.putExtra("number", element.getNumber());
        i.putExtra("pubkey", element.getPublicKey());
        i.putExtra("aKey1", element.getActivationKey1());
        i.putExtra("aKey2", element.getActivationKey2());
        i.putExtra("seed", element.getSeed());
        i.putExtra("thisContactFileName", element.getConfigFileName());
        context.startActivity(i);
      }
    });
    
    
    ImageButton send = (ImageButton)view.findViewById(R.id.send);


    send.setOnClickListener(new View.OnClickListener(){
      @Override
      public void onClick(View v) { 
        ConfigEntity element = cfgContactEntityLst.get(position);
        Intent i = new Intent(context, NewSmsActivity.class);
        i.putExtra("nick", element.getNick());
        i.putExtra("number", element.getNumber());
        i.putExtra("pubkey", element.getPublicKey());
        i.putExtra("seed", element.getSeed());
        context.startActivity(i);
      }
    });

    return view; 
  } 
}




Java Source Code List

com.amanaje.activities.ContactDetailActivity.java
com.amanaje.activities.MainActivity.java
com.amanaje.activities.MessageActivity.java
com.amanaje.activities.NewSmsActivity.java
com.amanaje.activities.PrivContactsActivity.java
com.amanaje.activities.SettingsActivity.java
com.amanaje.activities.package-info.java
com.amanaje.asynctasks.AsyncTaskManager.java
com.amanaje.asynctasks.package-info.java
com.amanaje.commons.ActivityHelper.java
com.amanaje.commons.AppException.java
com.amanaje.commons.AppMessages.java
com.amanaje.commons.Constants.java
com.amanaje.commons.StaticObj.java
com.amanaje.commons.Utils.java
com.amanaje.commons.package-info.java
com.amanaje.crypto.CryptoUtils.java
com.amanaje.crypto.TotpImpl.java
com.amanaje.crypto.package-info.java
com.amanaje.entities.ConfigEntity.java
com.amanaje.entities.CryptoAlgoEntity.java
com.amanaje.entities.OpenPgpEntity.java
com.amanaje.entities.SmsEntity.java
com.amanaje.entities.package-info.java
com.amanaje.view.adapters.RowContactAdapter.java
com.amanaje.view.adapters.StableArrayAdapter.java
com.amanaje.view.adapters.package-info.java
org.jdamico.bc.openpgp.utils.PgpHelper.java
org.jdamico.bc.openpgp.utils.RSAKeyPairGenerator.java
org.jdamico.bc.openpgp.utils.package-info.java