Android Open Source - Amppercent7 Adapter I M






From Project

Back to project page Amppercent7.

License

The source code is released under:

GNU General Public License

If you think the Android project Amppercent7 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 my.amppercent.adapters;
/*from  ww w.j  av a  2  s  .  co m*/
import java.util.LinkedList;
import java.util.List;

import android.content.Context;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import my.amppercent.project.R;
import my.amppercent.remoteservice.IBinding;
import my.amppercent.remoteservice.IntentManage;

/**
 * Adattatore per la visualizzazione della lista di Intent per la
 * visualizzazione delle richieste di download
 * 
 * @author jack
 * 
 */
public class AdapterIM extends AdapterElems<IntentManage> {

  private IBinding service;

  public AdapterIM(Context context, int resource, int textViewResourceId,
      IntentManage[] objects) {
    super(context, resource, textViewResourceId, objects);
  }

  public AdapterIM(Context context, int resource, int textViewResourceId,
      List<IntentManage> objects) {
    super(context, resource, textViewResourceId, objects);
  }

  public static AdapterIM ArrayNullInit(Context context, int resource,
      int textViewResourceId, IntentManage[] objects) {
    if ((objects == null) || (objects.length == 0)) {
      return new AdapterIM(context, resource, textViewResourceId,
          new LinkedList<IntentManage>());
    } else {
      List<IntentManage> im = new LinkedList<IntentManage>();
      for (IntentManage x : objects)
        im.add(x);
      return new AdapterIM(context, resource, textViewResourceId, im);
    }
  }

  public void setService(IBinding s) {
    this.service = s;
  }

  public void remove(IntentManage x) {
    super.remove(x);
  }

  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    View row = super.getView(position, convertView, parent);
    final IntentManage im = getItem(position);
    final TextView from = (TextView) row.findViewById(R.id.To_or_From_text);
    final TextView file = (TextView) row.findViewById(R.id.File_name);
    final Button ok = (Button) row.findViewById(R.id.Download_button_file);
    final Button ko = (Button) row.findViewById(R.id.Decline_button_file);

    file.setText(im.second_argument);
    from.setText(im.first_argument);
    ok.setOnClickListener(new OnClickListener() {
      public void onClick(View v) {
        if (service != null) {
          try {
            ok.setEnabled(false);
            boolean result = service.handleFileRequest(im.connid,
                im.passwo, true, im.getId(), im.second_argument);
            if (result) {
              Log.d("result", "ok");
              ko.setEnabled(false);
            }
            im.handled = true;
            remove(im);
          } catch (Throwable e) {
          }
        }
      }
    });
    ko.setOnClickListener(new OnClickListener() {
      public void onClick(View v) {
        if (service != null) {
          try {
            ok.setEnabled(false);
            service.handleFileRequest(im.connid, im.passwo, true,
                im.getId(), im.second_argument);
            ko.setEnabled(false);
            im.handled = true;
            remove(im);
          } catch (Throwable e) {
          }
        }
      }
    });

    return row;
  }

}




Java Source Code List

my.amppercent.adapters.AdapterChat.java
my.amppercent.adapters.AdapterElems.java
my.amppercent.adapters.AdapterIM.java
my.amppercent.adapters.AdapterUStatus.java
my.amppercent.adapters.ListViewAdapting.java
my.amppercent.adapters.ListView_XUser.java
my.amppercent.chatrequest.AvailabilitySettings.java
my.amppercent.chatrequest.SelectConnActivity.java
my.amppercent.chatrequest.connActivity.java
my.amppercent.chatrequest.serverActivity.java
my.amppercent.chattables.UberChat.java
my.amppercent.chattables.XConnect.java
my.amppercent.chattables.XRoster.java
my.amppercent.chattables.myChat.java
my.amppercent.project.Amppercent4Activity.java
my.amppercent.project.DownloadManager.java
my.amppercent.project.IBindRemoteService.java
my.amppercent.project.LaunchMe.java
my.amppercent.project.PrefActive.java
my.amppercent.project.TabFragment.java
my.amppercent.project.TextEntryActivity.java
my.amppercent.remoteservice.IFMessage.java
my.amppercent.remoteservice.IntentManage.java
my.amppercent.remoteservice.XUser.java
my.amppercent.remoteservice.chatAdapter.java
my.amppercent.types.Couple.java
my.amppercent.types.State.java
my.amppercent.types.myATask.java
my.amppercent.types.myNotification.java
my.amppercent.types.myYesNoDialog.java
my.amppercent.types.newActivity.java
org.jivesoftware.smackx.filetransfer.myOutgoingFileTransfer.java