Android Open Source - MultiWork Slide Expandable List View






From Project

Back to project page MultiWork.

License

The source code is released under:

Copyright (c) 2013, Torti Andr?s Fernando All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions a...

If you think the Android project MultiWork 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.tjerkw.slideexpandable.library;
//from   w ww .  j  a v  a2s.  co  m
import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.content.Context;

/**
 * Simple subclass of listview which does nothing more than wrap
 * any ListAdapter in a SlideExpandalbeListAdapter
 */
class SlideExpandableListView extends ListView {
  private SlideExpandableListAdapter adapter;

  public SlideExpandableListView(Context context) {
    super(context);
  }

  public SlideExpandableListView(Context context, AttributeSet attrs) {
    super(context, attrs);
  }

  public SlideExpandableListView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
  }

  /**
   * Collapses the currently open view.
   *
   * @return true if a view was collapsed, false if there was no open view.
   */
  public boolean collapse() {
    if(adapter!=null) {
      return adapter.collapseLastOpen();
    }
    return false;
  }

  public void setAdapter(ListAdapter adapter) {
    this.adapter = new SlideExpandableListAdapter(adapter);
    super.setAdapter(this.adapter);
  }

  /**
   * Registers a OnItemClickListener for this listview which will
   * expand the item by default. Any other OnItemClickListener will be overriden.
   *
   * To undo call setOnItemClickListener(null)
   *
   * Important: This method call setOnItemClickListener, so the value will be reset
   */
  public void enableExpandOnItemClick() {
    this.setOnItemClickListener(new OnItemClickListener() {
      @Override
      public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
        SlideExpandableListAdapter adapter = (SlideExpandableListAdapter)getAdapter();
        adapter.getExpandToggleButton(view).performClick();
      }
    });
  }

  @Override
  public Parcelable onSaveInstanceState() {
    return adapter.onSaveInstanceState(super.onSaveInstanceState());
  }

  @Override
  public void onRestoreInstanceState(Parcelable state) {
    if(!(state instanceof AbstractSlideExpandableListAdapter.SavedState)) {
      super.onRestoreInstanceState(state);
      return;
    }

    AbstractSlideExpandableListAdapter.SavedState ss = (AbstractSlideExpandableListAdapter.SavedState)state;
    super.onRestoreInstanceState(ss.getSuperState());

    adapter.onRestoreInstanceState(ss);
  }
}




Java Source Code List

com.bluetoothutils.andres.BTSingleSynchTransfer.java
com.bluetoothutils.andres.BluetoothHelper.java
com.bluetoothutils.andres.DeviceScanner.java
com.bluetoothutils.andres.OnBluetoothConnected.java
com.bluetoothutils.andres.OnDeviceSelected.java
com.bluetoothutils.andres.OnNewBluetoothDataReceived.java
com.frecuencimeter.andres.FrecView.java
com.frecuencimeter.andres.Frecuencia.java
com.multiwork.andres.ApplicationContext.java
com.multiwork.andres.LCView.java
com.multiwork.andres.MainMenu.java
com.multiwork.andres.MainPrefs.java
com.multiwork.andres.MenuListAdapter.java
com.protocolanalyzer.andres.AnalyzerExpandableAdapter.java
com.protocolanalyzer.andres.CRC16.java
com.protocolanalyzer.andres.LogicAnalizerPrefsFragment.java
com.protocolanalyzer.andres.LogicAnalizerPrefs.java
com.protocolanalyzer.andres.LogicAnalyzerActivity.java
com.protocolanalyzer.andres.LogicAnalyzerChartFragment.java
com.protocolanalyzer.andres.LogicAnalyzerListFragment.java
com.protocolanalyzer.andres.OnActionBarClickListener.java
com.protocolanalyzer.andres.OnDataClearedListener.java
com.protocolanalyzer.andres.OnDataDecodedListener.java
com.roboticarm.andres.BrazoRobot.java
com.roboticarm.andres.JoystickView.java
com.roboticarm.andres.Joystick.java
com.tjerkw.slideexpandable.library.AbstractSlideExpandableListAdapter.java
com.tjerkw.slideexpandable.library.ActionSlideExpandableListView.java
com.tjerkw.slideexpandable.library.ExpandCollapseAnimation.java
com.tjerkw.slideexpandable.library.SlideExpandableListAdapter.java
com.tjerkw.slideexpandable.library.SlideExpandableListView.java
com.tjerkw.slideexpandable.library.WrapperListAdapterImpl.java
com.utils.andres.ConflictChecker.java
com.utils.andres.Dependency.java
com.utils.andres.Pair.java