Android Open Source - Amppercent7 List View Adapting






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  w w w . java2s.c o m
import java.util.Collection;
import java.util.List;

import my.amppercent.project.TabFragment;

import android.app.Activity;
import android.util.Log;
import android.view.View;
import android.widget.ListView;

/**
 * Generico adattatore per semplificare ed uniformare la visualizzazione degli
 * elementi
 * 
 * @author jack
 * 
 * @param <T>
 */
public class ListViewAdapting<T> {
  private AdapterElems<T> list;
  private ListView listview;

  public AdapterElems<T> getAdapter() {
    return this.list;
  }

  public ListViewAdapting(Activity mainview, int MainViewListId,
      AdapterElems<T> coll) {
    this.listview = (ListView) mainview.findViewById(MainViewListId);
    this.list = coll;
    if (this.listview != null) {
      this.listview
          .setTranscriptMode(ListView.TRANSCRIPT_MODE_ALWAYS_SCROLL);
      this.listview.setStackFromBottom(true);
      this.listview.setAdapter(this.list);
    } else
      Log.e("ListViewAdapting", "null listview");
  }

  public ListViewAdapting(TabFragment fragment, int MainViewListId,
      AdapterElems<T> coll) {
    View toview = fragment.getInnerView();
    this.listview = (ListView) toview.findViewById(MainViewListId);
    this.list = coll;
    if (this.listview != null) {
      this.listview
          .setTranscriptMode(ListView.TRANSCRIPT_MODE_ALWAYS_SCROLL);
      this.listview.setStackFromBottom(true);
      this.listview.setAdapter(this.list);
    } else
      Log.e("ListViewAdapting", "null listview");
  }

  public void add_and_update(T... ls) {
    this.list.addAll(ls);
    this.list.notifyDataSetChanged();
  }

  public void add_and_update(T x) {
    this.list.add(x);
    this.list.notifyDataSetChanged();
  }

  public void add_and_update(Collection<T> ls) {
    this.list.addAll(ls);
    this.list.notifyDataSetChanged();
  }

  public List<T> getList() {
    return this.list.getList();
  }

  public void refresh() {
    if (!this.list.isEmpty())
      this.list.notifyDataSetChanged();
  }

  public void clear() {
    this.list.clear();
  }

}




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