/**
   * Updates the screen state (current list and other views) when the content changes.
   *
   * @see Activity#onContentChanged()
   */
  @Override
  public void onContentChanged() {
    super.onContentChanged();
    View emptyView = findViewById(android.R.id.empty);
    /* Issue 3443 - http://code.google.com/p/android/issues/detail?id=3443
     * Just use another id to find expandable list view
     *  */
    // mList = (ExpandableListView)findViewById(com.android.internal.R.id.list);
    // mList = (ExpandableListView)findViewById(org.pyload.android.client.R.id.expandable_listview);
    if (mList == null) {
      throw new RuntimeException(
          "Your content must have a ExpandableListView whose id attribute is "
              + "'ru.ponkin.R.id.expandable_listview'");
    }
    if (emptyView != null) {
      mList.setEmptyView(emptyView);
    }
    mList.setOnChildClickListener(this);
    mList.setOnGroupExpandListener(this);
    mList.setOnGroupCollapseListener(this);

    if (mFinishedStart) {
      setListAdapter(mAdapter);
    }
    mFinishedStart = true;
  }
Exemplo n.º 2
0
  private void initNav() {
    // 导航 begin
    mNavEListView = (ExpandableListView) findViewById(R.id.nav_elv);
    superAdapter = new SuperTreeViewAdapter(this, stvClickEvent);
    superAdapter.setHeight(navHeight);
    ArrayList<TreeVo> tlist = new ArrayList<TreeVo>();

    SharedPreferences settings = getSharedPreferences(Def.PREFS_NAME, 0);
    String njson = settings.getString(Def.SP_NAV_NAME, "");
    try {
      if (njson == null || "".equals(njson)) {
        new DataAsyncTask(this, false).execute("2");
      }
      if (njson == null || "".equals(njson)) {
        new DataAsyncTask(this, false).execute("2");
      }
      JSONArray jArr = new JSONArray(njson);
      tlist = SubjectDao.getArrayToTree(jArr);
    } catch (Exception e) {
      e.printStackTrace();
    }
    //
    List<SuperTreeViewAdapter.SuperTreeNode> superTreeNode = superAdapter.GetTreeNode();

    if (tlist != null && tlist.size() > 0) {
      for (int i = 0; i < tlist.size(); i++) {
        if (tlist.get(i).getParentid() == null || tlist.get(i).getParentid().equals("0")) {
          SuperTreeViewAdapter.SuperTreeNode superNode = new SuperTreeViewAdapter.SuperTreeNode();
          superNode.parent = tlist.get(i);
          for (int j = 0; j < tlist.size(); j++) {
            if (tlist.get(i).getTreeId().equals(tlist.get(j).getParentid())) {
              TreeViewAdapter.TreeNode node = new TreeViewAdapter.TreeNode();
              node.parent = tlist.get(j);
              for (int k = 0; k < tlist.size(); k++) {
                if (tlist.get(j).getTreeId().equals(tlist.get(k).getParentid())) {
                  node.childs.add(tlist.get(k));
                }
              }
              superNode.childs.add(node);
            }
          }
          superTreeNode.add(superNode);
        }
      }
    }
    superAdapter.UpdateTreeNode(superTreeNode);
    mNavEListView.setAdapter(superAdapter);
    mNavEListView.setOnGroupExpandListener(
        new OnGroupExpandListener() {
          @Override
          public void onGroupExpand(int arg0) {
            for (int i = 0; i < superAdapter.getGroupCount(); i++) {
              if (arg0 != i) {
                mNavEListView.collapseGroup(i);
              }
            }
          }
        });
    // 导航 end
  }
  public void iniListView(List<ASN> asnList) {

    mReceivingCodeDetailList = new HashMap<String, Map<String, String>>();
    mReceivingCodeList = new ArrayList<>();
    sheetListView = (ExpandableListView) findViewById(R.id.list_receiving_sheets);
    sheetListView.setItemsCanFocus(true);
    if (asnList == null) return;
    for (ASN asn : asnList) {
      mReceivingCodeList.add(asn.getCode());

      Map<String, String> detailMap = new HashMap<>();
      detailMap.put("projectCode", asn.getProject_Code());
      detailMap.put("orderDate", asn.getOrder_Date());
      detailMap.put("vendorName", asn.getVendor_Name());
      detailMap.put("applyPerson", asn.getApply_Person());
      detailMap.put("relatedBill", asn.getReleated_Bill1());
      mReceivingCodeDetailList.put(asn.getCode(), detailMap);
    }
    tmpAdapter =
        new ReceivingSheetsExpandableAdapter(this, mReceivingCodeDetailList, mReceivingCodeList);
    sheetListView.setAdapter(tmpAdapter);

    sheetListView.setOnGroupExpandListener(
        new ExpandableListView.OnGroupExpandListener() {
          @Override
          public void onGroupExpand(int groupPosition) {
            for (int i = 0; i < tmpAdapter.getGroupCount(); i++) {
              if (groupPosition != i) {
                sheetListView.collapseGroup(i);
              }
            }
          }
        });
  }
Exemplo n.º 4
0
  public void setOnGroupCollapseExpandListener(OnGroupCollapseExpandListener l) {
    mGroupCollapseExpandListener = l;

    if (mList != null) {
      mList.setOnGroupCollapseListener(l);
      mList.setOnGroupExpandListener(l);
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    this.getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_stdents);

    helpButton = (ImageView) findViewById(R.id.helpButton);
    addStudentButton = (TextView) findViewById(R.id.addStudentButton);
    className = (TextView) findViewById(R.id.className);
    studentListView = (ExpandableListView) findViewById(R.id.studentListView);

    sharedPreferences = AndroidUtils.getCommonSharedPrefs(getApplicationContext());
    userUtils = new UserUtils(ShowClassEventCompanyUsersActivity.this);
    user = userUtils.getUserFromSharedPrefs();

    Bundle bundle = getIntent().getExtras();

    int role = bundle.getInt(AppConstants.EXTRA_USER_ROLE);
    if (role == 0) {
      throw new RuntimeException("must pass role!");
    } else {
      userRole = UserRole.valueOf(role);
      setRoleBasedProperties(userRole);
    }

    int index = bundle.getInt(AppConstants.EXTRA_SELECTED_INDEX, -1);
    if (index == -1) {
      throw new RuntimeException("must pass EXTRA_SELECTED_INDEX!");
    } else {
      classEventCompany = user.getClassEventCompanyArrayList().get(index);
    }

    setAdapter();

    studentListView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {}
        });
    studentListView.setOnGroupExpandListener(
        new ExpandableListView.OnGroupExpandListener() {
          int previousGroup = -1;

          @Override
          public void onGroupExpand(int groupPosition) {
            if (groupPosition != previousGroup) studentListView.collapseGroup(previousGroup);
            previousGroup = groupPosition;
          }
        });

    addStudentButton.setOnClickListener(this);
    helpButton.setOnClickListener(this);

    className.setText(classEventCompany.getName());
  }
Exemplo n.º 6
0
  /** 三层树结构中的第二层是一个ExpandableListView */
  public View getChildView(
      int groupPosition,
      int childPosition,
      boolean isLastChild,
      View convertView,
      ViewGroup parent) {
    // 是
    final ExpandableListView treeView = getExpandableListView();
    final ThreeViewAdapter treeViewAdapter = new ThreeViewAdapter(this.parentContext, 0);
    List<ThreeViewAdapter.TreeNode> tmp =
        treeViewAdapter.GetTreeNode(); // 临时变量取得TreeViewAdapter的TreeNode集合,可为空
    final ThreeViewAdapter.TreeNode treeNode =
        (ThreeViewAdapter.TreeNode) getChild(groupPosition, childPosition);
    tmp.add(treeNode);
    treeViewAdapter.UpdateTreeNode(tmp);
    treeView.setAdapter(treeViewAdapter);

    // 关键点:取得选中的二级树形菜单的父子节点,结果返回给外部回调函数
    treeView.setOnChildClickListener(this.stvClickEvent);

    /** 关键点:第二级菜单展开时通过取得节点数来设置第三级菜单的大小 */
    treeView.setOnGroupExpandListener(
        new OnGroupExpandListener() {
          @Override
          public void onGroupExpand(int groupPosition) {

            AbsListView.LayoutParams lp =
                new AbsListView.LayoutParams(
                    ViewGroup.LayoutParams.FILL_PARENT,
                    (treeNode.childs.size() + 1) * ThreeViewAdapter.ItemHeight + 10);
            treeView.setLayoutParams(lp);
          }
        });

    /** 第二级菜单回收时设置为标准Item大小 */
    treeView.setOnGroupCollapseListener(
        new OnGroupCollapseListener() {
          @Override
          public void onGroupCollapse(int groupPosition) {

            AbsListView.LayoutParams lp =
                new AbsListView.LayoutParams(
                    ViewGroup.LayoutParams.FILL_PARENT, ThreeViewAdapter.ItemHeight);
            treeView.setLayoutParams(lp);
          }
        });
    treeView.setPadding(ThreeViewAdapter.PaddingLeft, 0, 0, 0);
    return treeView;
  }
Exemplo n.º 7
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    buildList();

    ExpandableListView expandableListView =
        (ExpandableListView) findViewById(R.id.expandableListView);
    expandableListView.setAdapter(new ExpandableAdapter(MainActivity.this, listGroup, listData));

    expandableListView.setOnChildClickListener(
        new ExpandableListView.OnChildClickListener() {
          @Override
          public boolean onChildClick(
              ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {

            Toast.makeText(
                    MainActivity.this,
                    "Grupo: " + groupPosition + "| Item: " + childPosition,
                    Toast.LENGTH_SHORT)
                .show();
            return false;
          }
        });

    expandableListView.setOnGroupExpandListener(
        new ExpandableListView.OnGroupExpandListener() {
          @Override
          public void onGroupExpand(int groupPosition) {
            Toast.makeText(
                    MainActivity.this, "Grupo (Expand): " + groupPosition, Toast.LENGTH_SHORT)
                .show();
          }
        });

    expandableListView.setOnGroupCollapseListener(
        new ExpandableListView.OnGroupCollapseListener() {
          @Override
          public void onGroupCollapse(int groupPosition) {
            Toast.makeText(
                    MainActivity.this, "Grupo (Collapse): " + groupPosition, Toast.LENGTH_SHORT)
                .show();
          }
        });

    expandableListView.setGroupIndicator(getResources().getDrawable(R.drawable.icon_group));
  }
Exemplo n.º 8
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_list_album);
    listview = (ExpandableListView) findViewById(R.id.ListAlbumView);
    metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    width = metrics.widthPixels;
    listview.setIndicatorBounds(width - GetDipsFromPixel(50), width - GetDipsFromPixel(10));
    GroupByAdapter adapter = new GroupByAdapter(this, ListSong.TYPE_ALBUMS);
    listview.setAdapter(adapter);
    listview.setOnChildClickListener(
        new OnChildClickListener() {

          @Override
          public boolean onChildClick(
              ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
            // TODO Auto-generated method stub
            MusicApplication musicapp = MusicApplication.getInstance();
            musicapp.SetNewPlaying(
                ListSong.listAlbum.get(ListSong.listAlbumName.get(groupPosition)), childPosition);
            Intent i = new Intent(ListAlbums.this, NowPlaying.class);
            startActivity(i);
            return false;
          }
        });
    listview.setOnGroupExpandListener(
        new OnGroupExpandListener() {

          @Override
          public void onGroupExpand(int groupPosition) {
            // TODO Auto-generated method stub

          }
        });
    listview.setOnGroupCollapseListener(
        new OnGroupCollapseListener() {

          @Override
          public void onGroupCollapse(int groupPosition) {
            // TODO Auto-generated method stub

          }
        });
  }
Exemplo n.º 9
0
  public void onContentChanged() {
    View emptyView = getView().findViewById(android.R.id.empty);
    mList = (ExpandableListView) getView().findViewById(android.R.id.list);
    if (mList == null) {
      throw new RuntimeException(
          "Your content must have a ExpandableListView whose id attribute is "
              + "'android.R.id.list'");
    }
    if (emptyView != null) {
      mList.setEmptyView(emptyView);
    }
    mList.setOnChildClickListener(this);
    mList.setOnGroupExpandListener(this);
    mList.setOnGroupCollapseListener(this);

    if (mFinishedStart) {
      setListAdapter(mAdapter);
    }
    mFinishedStart = true;
  }
Exemplo n.º 10
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.layout_expandable_list, null);
    mList = (ExpandableListView) v.findViewById(android.R.id.list);
    mEmptyView = (TextView) v.findViewById(android.R.id.empty);

    mList.setAdapter(mAdapter);
    mList.setOnGroupCollapseListener(mGroupCollapseExpandListener);
    mList.setOnGroupExpandListener(mGroupCollapseExpandListener);
    mList.setOnGroupClickListener(this);
    mList.setOnChildClickListener(this);

    if (mExpandAll) expandAllInternal();

    mList.setEmptyView(mEmptyView);
    mEmptyView.setText(mEmptyViewTextResId);

    return v;
  }
Exemplo n.º 11
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (!Utils.isTablet(getActivity())) setHasOptionsMenu(true);

    this.inflate = inflater;
    v = inflater.inflate(R.layout.udobra_list, null);
    listView = (ExpandableListView) v.findViewById(R.id.expandableListView);
    listView.setGroupIndicator(null);
    if (Utils.LOCALE.equals("ru")) {
      AssetsHelper assetsHelper = new AssetsHelper(getActivity());
      db = assetsHelper.getReadableDatabase();
    } else {
      DBHelper dbHelper = new DBHelper(getActivity());
      db = dbHelper.getReadableDatabase();
    }
    searchView = (android.support.v7.widget.SearchView) v.findViewById(R.id.searchV);
    searchView.setIconifiedByDefault(false);
    searchView.setOnQueryTextListener(this);
    searchView.setSubmitButtonEnabled(false);
    searchView.setQueryHint(getResources().getString(R.string.Search));

    MultiSpinner multiSpinner = (MultiSpinner) v.findViewById(R.id.filterSpinner);
    Map<Integer, String> filter = new HashMap<Integer, String>();
    filter.put(1, getResources().getString(R.string.Favorites));
    filter.put(2, getResources().getString(R.string.Added));
    multiSpinner.setItems(getResources().getString(R.string.Filter), this, filter, 1);
    fillData(0);
    listView.setOnGroupExpandListener(
        new ExpandableListView.OnGroupExpandListener() {
          @Override
          public void onGroupExpand(int groupPosition) {
            if (lastExpandedPosition != -1 && groupPosition != lastExpandedPosition) {
              listView.collapseGroup(lastExpandedPosition);
            }
            lastExpandedPosition = groupPosition;
          }
        });
    return v;
  }
Exemplo n.º 12
0
  /**
   * Provide default implementation to return a simple list view. Subclasses can override to replace
   * with their own layout. If doing so, the returned view hierarchy <em>must</em> have a ListView
   * whose id is {@link android.R.id#list android.R.id.list} and can optionally have a sibling view
   * id {@link android.R.id#empty android.R.id.empty} that is to be shown when the list is empty.
   *
   * <p>
   *
   * <p>If you are overriding this method with your own custom content, consider including the
   * standard layout {@link android.R.layout#list_content} in your layout file, so that you continue
   * to retain all of the standard behavior of ListFragment. In particular, this is currently the
   * only way to have the built-in indeterminant progress state be shown.
   */
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    FrameLayout root = new FrameLayout(getActivity());

    FrameLayout lframe = new FrameLayout(getActivity());
    lframe.setId(INTERNAL_LIST_CONTAINER_ID);

    TextView tv = new TextView(getActivity());
    tv.setId(INTERNAL_EMPTY_ID);
    tv.setGravity(Gravity.CENTER);
    lframe.addView(
        tv,
        new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));

    ExpandableListView lv = new ExpandableListView(getActivity());
    lv.setId(android.R.id.list);
    lv.setDrawSelectorOnTop(false);
    lv.setOnChildClickListener(this);
    lv.setOnGroupExpandListener(this);
    lv.setOnGroupCollapseListener(this);
    lframe.addView(
        lv,
        new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));

    root.addView(
        lframe,
        new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));

    ListView.LayoutParams lp =
        new ListView.LayoutParams(
            ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT);
    root.setLayoutParams(lp);

    return root;
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.medical_remedy_main);

    expList = getExpandableListView();
    expList.setAdapter(new MaleMedicalRemedyExpAdapterHand(this));

    expList.setOnGroupExpandListener(
        new OnGroupExpandListener() {
          public void onGroupExpand(int groupPosition) {
            Log.e("onGroupExpand", "OK" + groupPosition);
          }
        });

    expList.setOnGroupCollapseListener(
        new OnGroupCollapseListener() {
          public void onGroupCollapse(int groupPosition) {
            Log.e("onGroupCollapse", "OK" + groupPosition);
          }
        });

    expList.setOnChildClickListener(
        new OnChildClickListener() {
          public boolean onChildClick(
              ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
            // TODO Auto-generated method stub
            Log.e("OnChildClickListener", "OK");
            TextView tvchild = (TextView) v.findViewById(R.id.tvPlayerName);
            Log.e("OnChildClickListener", tvchild.getText().toString());
            Intent in = new Intent("com.MedicalRemedy.android.DISP");
            in.putExtra("title", arrGroupelements[groupPosition]);
            in.putExtra("text", arrChildelements[groupPosition][childPosition]);
            startActivity(in);
            return false;
          }
        });
  }
Exemplo n.º 14
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Firebase.setAndroidContext(this);
    Firebase firebaseRef = new Firebase("https://mioffers.firebaseIO.com/");
    setContentView(R.layout.activity_main);

    expListView = (ExpandableListView) findViewById(R.id.lvExp);
    prepareListData();
    listAdapter = new ExpandableListAdapter(this, listDataHeader, listDataChild);
    expListView.setAdapter(listAdapter);

    expListView.setOnGroupClickListener(
        new ExpandableListView.OnGroupClickListener() {

          @Override
          public boolean onGroupClick(
              ExpandableListView parent, View v, int groupPosition, long id) {
            Toast.makeText(
                    getApplicationContext(),
                    "Group Clicked " + listDataHeader.get(groupPosition),
                    Toast.LENGTH_SHORT)
                .show();
            return false;
          }
        });

    // Listview Group expanded listener
    expListView.setOnGroupExpandListener(
        new ExpandableListView.OnGroupExpandListener() {

          @Override
          public void onGroupExpand(int groupPosition) {
            Toast.makeText(
                    getApplicationContext(),
                    listDataHeader.get(groupPosition) + " Expanded",
                    Toast.LENGTH_SHORT)
                .show();
            // TextView expList = (TextView) findViewById(R.id.lblListHeader2);
            // expList.setVisibility(View.VISIBLE);
          }
        });

    // Listview Group collasped listener
    expListView.setOnGroupCollapseListener(
        new ExpandableListView.OnGroupCollapseListener() {

          @Override
          public void onGroupCollapse(int groupPosition) {
            Toast.makeText(
                    getApplicationContext(),
                    listDataHeader.get(groupPosition) + " Collapsed",
                    Toast.LENGTH_SHORT)
                .show();
            // TextView expList = (TextView) findViewById(R.id.lblListHeader2);
            // expList.setVisibility(View.GONE);

          }
        });

    // Listview on child click listener
    expListView.setOnChildClickListener(
        new ExpandableListView.OnChildClickListener() {

          @Override
          public boolean onChildClick(
              ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
            // TODO Auto-generated method stub
            Toast.makeText(
                    getApplicationContext(),
                    listDataHeader.get(groupPosition)
                        + " : "
                        + listDataChild.get(listDataHeader.get(groupPosition)).get(childPosition),
                    Toast.LENGTH_SHORT)
                .show();
            return false;
          }
        });
  }
Exemplo n.º 15
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    position = getIntent().getIntExtra("position", -1);

    // setup actionbar
    LayoutInflater inflater =
        (LayoutInflater)
            getSupportActionBar().getThemedContext().getSystemService(LAYOUT_INFLATER_SERVICE);
    View customActionBarView = inflater.inflate(R.layout.actionbar_custom, null);
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayOptions(
        ActionBar.DISPLAY_SHOW_CUSTOM,
        ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE);
    actionBar.setCustomView(
        customActionBarView,
        new ActionBar.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    Toolbar parent = (Toolbar) customActionBarView.getParent();
    parent.setContentInsetsAbsolute(0, 0);

    setContentView(R.layout.activity_ehrdetails);

    TextView title_name = (TextView) customActionBarView.findViewById(R.id.custom_title);
    title_name.setText("Detailed History");
    home = (ImageView) findViewById(R.id.home_pressed);
    home.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent i = new Intent(EHRDetails.this, SecondActivityMain.class);
            startActivity(i);
          }
        });

    back = (ImageView) findViewById(R.id.back_pressed);
    back.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            finish();
          }
        });

    ArrayList<TransactionObject> transactionObjectArrayList =
        AppControllerSearchTests.transactionObjectArrayList;

    patientname = (TextView) findViewById(R.id.personname_ehr_d);
    labname = (TextView) findViewById(R.id.lab_name_ehr_d);
    date = (TextView) findViewById(R.id.ehr_date_d);

    labIcon = (TextView) findViewById(R.id.labIcon);
    testsIcon = (TextView) findViewById(R.id.testIcon);
    patientIcon = (TextView) findViewById(R.id.profileIcon);
    dateIcon = (TextView) findViewById(R.id.dateIcon);
    downIcon = (TextView) findViewById(R.id.downIcon);
    // testname=(TextView)findViewById(R.id.test_name_ehr_d);

    Typeface font = Typeface.createFromAsset(this.getAssets(), "fontawesome-webfont.ttf");
    testsIcon.setTypeface(font);
    patientIcon.setTypeface(font);
    dateIcon.setTypeface(font);
    labIcon.setTypeface(font);
    downIcon.setTypeface(font);

    labname.setText(transactionObjectArrayList.get(position).getLab_name());
    // testname.setText(e.getTest_groups());
    date.setText(transactionObjectArrayList.get(position).getDate());
    patientname.setText(transactionObjectArrayList.get(position).getPatient_name());

    testgroupExpandablelistView = (ExpandableListView) findViewById(R.id.ehr_detail_list);
    if (transactionObjectArrayList.get(position).testGroupNameArrayList == null) {
      // TextView no=(TextView)findViewById(R.id.no_result_e);
      // no.setVisibility(View.VISIBLE);
      testgroupExpandablelistView.setVisibility(View.INVISIBLE);
    } else {
      expandableTestGroupListAdapter =
          new ExpandableTestGroupListAdapter(
              this,
              transactionObjectArrayList.get(position).getTestGroupNameArrayList(),
              transactionObjectArrayList.get(position).getHashMap());
      testgroupExpandablelistView.setAdapter(expandableTestGroupListAdapter);
    }

    testgroupExpandablelistView.setOnGroupExpandListener(
        new ExpandableListView.OnGroupExpandListener() {
          @Override
          public void onGroupExpand(int groupPosition) {
            if (lastExpandedPosition != -1 && lastExpandedPosition != groupPosition) {
              testgroupExpandablelistView.collapseGroup(lastExpandedPosition);
            }
            lastExpandedPosition = groupPosition;
          }
        });
  }
Exemplo n.º 16
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_mainforexplistview);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    getActionBar().setHomeButtonEnabled(true);

    // get the listview
    expListView = (ExpandableListView) findViewById(R.id.lvExp);

    // preparing list data
    prepareListData();

    listAdapter = new AdapterExpandable(this, listDataHeader, listDataChild);

    // setting list adapter
    expListView.setAdapter(listAdapter);

    // Listview Group click listener
    expListView.setOnGroupClickListener(
        new ExpandableListView.OnGroupClickListener() {

          @Override
          public boolean onGroupClick(
              ExpandableListView parent, View v, int groupPosition, long id) {
            // Toast.makeText(getApplicationContext(),
            // "Group Clicked " + listDataHeader.get(groupPosition),
            // Toast.LENGTH_SHORT).show();
            return false;
          }
        });

    // Listview Group expanded listener
    expListView.setOnGroupExpandListener(
        new ExpandableListView.OnGroupExpandListener() {

          @Override
          public void onGroupExpand(int groupPosition) {
            /*Toast.makeText(getApplicationContext(),
            listDataHeader.get(groupPosition) + " Expanded",
            Toast.LENGTH_SHORT).show();*/
          }
        });

    // Listview Group collasped listener
    expListView.setOnGroupCollapseListener(
        new ExpandableListView.OnGroupCollapseListener() {

          @Override
          public void onGroupCollapse(int groupPosition) {
            /*Toast.makeText(getApplicationContext(),
            listDataHeader.get(groupPosition) + " Collapsed",
            Toast.LENGTH_SHORT).show();*/

          }
        });

    expListView.setFocusable(false);
    expListView.setClickable(false);
  }
Exemplo n.º 17
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_choose_team);
    _sportType = getIntent().getExtras().getString(StaticFinalVars.SPORT_TYPE);
    _addEditTeam = (Button) findViewById(R.id.createNewTeam);
    _deleteButton = (Button) findViewById(R.id.deleteTeamButton);
    _addEditTeam.setOnTouchListener(longButtonTouchListener);
    _deleteButton.setOnTouchListener(longButtonTouchListener);

    // databases
    if (_sportType.equals("basketball")) {
      _db = new BasketballDatabaseHelper(getApplicationContext());
      findViewById(R.id.chooseTeamActivity).setBackgroundResource(R.drawable.background_basketball);
      _addEditTeam.setBackgroundResource(R.drawable.view_style_slant);
      _deleteButton.setBackgroundResource(R.drawable.view_style_slant);

    } else if (_sportType.equals("hockey")) {
      _db = new HockeyDatabaseHelper(getApplicationContext());
      findViewById(R.id.chooseTeamActivity).setBackgroundResource(R.drawable.background_hockey);
      _addEditTeam.setBackgroundResource(R.drawable.view_style_gradiant);
      _deleteButton.setBackgroundResource(R.drawable.view_style_gradiant);
    } else if (_sportType.equals("soccer")) {
      _db = new SoccerDatabaseHelper(getApplicationContext());
      findViewById(R.id.chooseTeamActivity).setBackgroundResource(R.drawable.background_soccer);
      _addEditTeam.setBackgroundResource(R.drawable.view_style_slant);
      _deleteButton.setBackgroundResource(R.drawable.view_style_slant);
    } else if (_sportType.equals("football")) {
      _db = new FootballDatabaseHelper(getApplicationContext());
      findViewById(R.id.chooseTeamActivity).setBackgroundResource(R.drawable.background_football);
      _addEditTeam.setBackgroundResource(R.drawable.view_style_slant);
      _deleteButton.setBackgroundResource(R.drawable.view_style_slant);
    } else { // should never get here anyways
      _addEditTeam.setBackgroundResource(R.drawable.view_style_slant);
      _deleteButton.setBackgroundResource(R.drawable.view_style_slant);
    }

    _teamSelectTitle = (TextView) findViewById(R.id.team_selection_title);

    // get the expandable list view
    ex_ListViewHome = (ExpandableListView) findViewById(R.id.expListViewHome);
    ex_ListViewAway = (ExpandableListView) findViewById(R.id.expListViewAway);

    // preparing list data
    prepareListData();

    // expListview Group expanded listener
    ex_ListViewHome.setOnGroupExpandListener(
        new OnGroupExpandListener() {
          public void onGroupExpand(int groupPosition) {
            /*Toast.makeText(getApplicationContext(),
            listDataHeaderHome.get(groupPosition) + " Expanded",
            Toast.LENGTH_SHORT).show();*/
          }
        });
    ex_ListViewAway.setOnGroupExpandListener(
        new OnGroupExpandListener() {
          @Override
          public void onGroupExpand(int groupPosition) {}
        });

    // List view Group collapsed listener
    ex_ListViewHome.setOnGroupCollapseListener(
        new OnGroupCollapseListener() {
          @Override
          public void onGroupCollapse(int groupPosition) {
            /*Toast.makeText(getApplicationContext(),
            listDataHeaderHome.get(groupPosition) + " Collapsed",
            Toast.LENGTH_SHORT).show();*/
          }
        });
    ex_ListViewAway.setOnGroupCollapseListener(
        new OnGroupCollapseListener() {
          @Override
          public void onGroupCollapse(int groupPosition) {}
        });

    // List view on child click listeners
    ex_ListViewHome.setOnChildClickListener(
        new OnChildClickListener() {
          @Override
          public boolean onChildClick(
              ExpandableListView parentA, View v, int groupPositionA, int childPositionA, long id) {
            /*Toast.makeText(getApplicationContext(), listDataHeaderHome.get(groupPositionA) + " : " +
            listDataChildHome.get(listDataHeaderHome.get(groupPositionA)).get(childPositionA), Toast.LENGTH_SHORT).show();
                  */
            _childHome =
                listDataChildHome.get(listDataHeaderHome.get(groupPositionA)).get(childPositionA);
            teamList = (ArrayList<Teams>) _db.getAllTeams();
            for (Teams t : teamList) { // get database
              if (t.gettname().equals(_childHome)) {
                _teams[0] = t; // set Home team
              }
            }
            if (teamList.size() < 2) { // if list of teams is less than 2 show message
              Toast.makeText(getApplicationContext(), "Create Another Team", Toast.LENGTH_SHORT)
                  .show();
              prepareListData();
              return false;
            }
            if (_setDelete) { // if set delete is true
              Teams curTeam = null;
              for (Teams t : teamList) {
                if (t.gettname().equals(_childHome)) {
                  curTeam = t;
                  break;
                }
              }
              _db.deleteTeam(curTeam.gettid()); // delete from database and refresh 	
              _setDelete = false;
              _deleteButton.setEnabled(true);
              _teamSelectTitle.setText(getResources().getString(R.string.home_team_select_title));
              prepareListData();
              return false;
            }
            if (_selectAwayTeam == true) {
              if (!_teams[1].gettname().toString().equals(_childHome)) {
                listDataHeaderHome.set(groupPositionA, _childHome);
                changeHomeListData(_childHome);
                _teamSelectTitle.setText(getResources().getString(R.string.home_team_select_title));
                _addEditTeam.setText("Create a New Team");
                _selectHomeTeam = true;
                _deleteButton.setEnabled(false);
                ex_ListViewHome.collapseGroup(groupPositionA);
                confirmTeams();
              } else {
                Toast.makeText(getApplicationContext(), "Team already Selected", Toast.LENGTH_SHORT)
                    .show();
                ex_ListViewHome.collapseGroup(groupPositionA);
                return false;
              }
            } else if (_selectAwayTeam == false) {
              listDataHeaderHome.set(groupPositionA, _childHome);
              changeHomeListData(_childHome);
              _teamSelectTitle.setText(getResources().getString(R.string.away_team_select_title));
              _addEditTeam.setText("Edit Selected Team");
              _selectHomeTeam = true;
              _deleteButton.setEnabled(false);
              ex_ListViewHome.collapseGroup(groupPositionA);
            }
            return false;
          }
        });
    ex_ListViewAway.setOnChildClickListener(
        new OnChildClickListener() {
          @Override
          public boolean onChildClick(
              ExpandableListView parentB, View v, int groupPositionB, int childPositionB, long id) {
            /*Toast.makeText(getApplicationContext(), listDataHeaderAway.get(groupPositionB) + " : " +
            listDataChildAway.get(listDataHeaderAway.get(groupPositionB)).get(childPositionB), Toast.LENGTH_SHORT).show();
                    */
            _childAway =
                listDataChildAway.get(listDataHeaderAway.get(groupPositionB)).get(childPositionB);
            teamList = (ArrayList<Teams>) _db.getAllTeams();
            for (Teams t : teamList) {
              if (t.gettname().equals(_childAway)) {
                _teams[1] = t; // set Away team
              }
            }
            if (teamList.size() < 2) {
              Toast.makeText(getApplicationContext(), "Create Another Team", Toast.LENGTH_SHORT)
                  .show();
              prepareListData();
              return false;
            }
            if (_setDelete) {
              Teams curTeam = null;
              for (Teams t : teamList) {
                if (t.gettname().equals(_childAway)) {
                  curTeam = t;
                  break;
                }
              }
              _db.deleteTeam(curTeam.gettid());
              _setDelete = false;
              _deleteButton.setEnabled(true);
              _teamSelectTitle.setText(getResources().getString(R.string.home_team_select_title));
              prepareListData();
              return false;
            }
            if (_selectHomeTeam == true) {
              if (!_teams[0].gettname().toString().equals(_childAway)) {
                listDataHeaderAway.set(groupPositionB, _childAway);
                changeAwayListData(_childAway);
                _teamSelectTitle.setText(getResources().getString(R.string.home_team_select_title));
                _addEditTeam.setText("Create a New Team");
                _selectAwayTeam = true;
                _deleteButton.setEnabled(false);
                ex_ListViewAway.collapseGroup(groupPositionB);
                confirmTeams();
              } else {
                Toast.makeText(getApplicationContext(), "Team already Selected", Toast.LENGTH_SHORT)
                    .show();
                ex_ListViewAway.collapseGroup(groupPositionB);
                return false;
              }
            } else {
              listDataHeaderAway.set(groupPositionB, _childAway);
              changeAwayListData(_childAway);
              _teamSelectTitle.setText(getResources().getString(R.string.home_team_select_title));
              _addEditTeam.setText("Edit Selected Team");
              _selectAwayTeam = true;
              _deleteButton.setEnabled(false);
              ex_ListViewAway.collapseGroup(groupPositionB);
            }
            return false;
          }
        });
  }
Exemplo n.º 18
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState, R.layout.trivialpursuit);

    expListView = (ExpandableListView) findViewById(R.id.lvExp);

    // preparing list data
    prepareListData();

    listAdapter = new ExpandableListAdapter25(this, listDataHeader, listDataChild);

    // setting list adapter
    expListView.setAdapter(listAdapter);

    expListView.setOnGroupClickListener(
        new ExpandableListView.OnGroupClickListener() {

          @Override
          public boolean onGroupClick(
              ExpandableListView parent, View v, int groupPosition, long id) {
            // Toast.makeText(getApplicationContext(),
            // "Group Clicked " + listDataHeader.get(groupPosition),
            // Toast.LENGTH_SHORT).show();
            return false;
          }
        });

    // Listview Group expanded listener
    expListView.setOnGroupExpandListener(
        new ExpandableListView.OnGroupExpandListener() {

          @Override
          public void onGroupExpand(int groupPosition) {
            /*Toast.makeText(getApplicationContext(),
            listDataHeader.get(groupPosition) + " Expanded",
            Toast.LENGTH_SHORT).show();*/
          }
        });

    // Listview Group collasped listener
    expListView.setOnGroupCollapseListener(
        new ExpandableListView.OnGroupCollapseListener() {

          @Override
          public void onGroupCollapse(int groupPosition) {
            /*Toast.makeText(getApplicationContext(),
            listDataHeader.get(groupPosition) + " Collapsed",
            Toast.LENGTH_SHORT).show();*/

          }
        });

    // Listview on child click listener
    expListView.setOnChildClickListener(
        new ExpandableListView.OnChildClickListener() {

          @Override
          public boolean onChildClick(
              ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
            // TODO Auto-generated method stub
            /*Toast.makeText(
            getApplicationContext(),
            listDataHeader.get(groupPosition)
                    + " : "
                    + listDataChild.get(
                    listDataHeader.get(groupPosition)).get(
                    childPosition), Toast.LENGTH_SHORT)
            .show();*/
            return false;
          }
        });
  }
Exemplo n.º 19
0
 @SuppressWarnings("ConstantConditions")
 public static void setEventListener(
     Object handler,
     ViewFinder finder,
     DoubleKeyValueMap<Object, Annotation, Method> value_annotation_method_map) {
   for (Object value : value_annotation_method_map.getFirstKeys()) {
     ConcurrentHashMap<Annotation, Method> annotation_method_map =
         value_annotation_method_map.get(value);
     for (Annotation annotation : annotation_method_map.keySet()) {
       try {
         Method method = annotation_method_map.get(annotation);
         if (annotation.annotationType().equals(OnClick.class)) {
           View view = finder.findViewById((Integer) value);
           if (view == null) break;
           view.setOnClickListener(new ViewCommonEventListener(handler, method));
         } else if (annotation.annotationType().equals(OnLongClick.class)) {
           View view = finder.findViewById((Integer) value);
           if (view == null) break;
           view.setOnLongClickListener(new ViewCommonEventListener(handler, method));
         } else if (annotation.annotationType().equals(OnFocusChange.class)) {
           View view = finder.findViewById((Integer) value);
           if (view == null) break;
           view.setOnFocusChangeListener(new ViewCommonEventListener(handler, method));
         } else if (annotation.annotationType().equals(OnKey.class)) {
           View view = finder.findViewById((Integer) value);
           if (view == null) break;
           view.setOnKeyListener(new ViewCommonEventListener(handler, method));
         } else if (annotation.annotationType().equals(OnTouch.class)) {
           View view = finder.findViewById((Integer) value);
           if (view == null) break;
           view.setOnTouchListener(new ViewCommonEventListener(handler, method));
         } else if (annotation.annotationType().equals(OnItemClick.class)) {
           View view = finder.findViewById((Integer) value);
           if (view == null) break;
           ((AdapterView<?>) view)
               .setOnItemClickListener(new ViewCommonEventListener(handler, method));
         } else if (annotation.annotationType().equals(OnItemLongClick.class)) {
           View view = finder.findViewById((Integer) value);
           if (view == null) break;
           ((AdapterView<?>) view)
               .setOnItemLongClickListener(new ViewCommonEventListener(handler, method));
         } else if (annotation.annotationType().equals(OnChildClick.class)) {
           View view = finder.findViewById((Integer) value);
           if (view == null) break;
           ((ExpandableListView) view)
               .setOnChildClickListener(new ViewCommonEventListener(handler, method));
         } else if (annotation.annotationType().equals(OnGroupClick.class)) {
           View view = finder.findViewById((Integer) value);
           if (view == null) break;
           ((ExpandableListView) view)
               .setOnGroupClickListener(new ViewCommonEventListener(handler, method));
         } else if (annotation.annotationType().equals(OnGroupCollapse.class)) {
           View view = finder.findViewById((Integer) value);
           if (view == null) break;
           ((ExpandableListView) view)
               .setOnGroupCollapseListener(new ViewCommonEventListener(handler, method));
         } else if (annotation.annotationType().equals(OnGroupExpand.class)) {
           View view = finder.findViewById((Integer) value);
           if (view == null) break;
           ((ExpandableListView) view)
               .setOnGroupExpandListener(new ViewCommonEventListener(handler, method));
         } else if (annotation.annotationType().equals(OnCheckedChange.class)) {
           View view = finder.findViewById((Integer) value);
           if (view == null) break;
           if (view instanceof RadioGroup) {
             ((RadioGroup) view)
                 .setOnCheckedChangeListener(new ViewCommonEventListener(handler, method));
           } else if (view instanceof CompoundButton) {
             ((CompoundButton) view)
                 .setOnCheckedChangeListener(new ViewCommonEventListener(handler, method));
           }
         } else if (annotation.annotationType().equals(OnPreferenceClick.class)) {
           Preference preference = finder.findPreference(value.toString());
           if (preference == null) break;
           preference.setOnPreferenceClickListener(new ViewCommonEventListener(handler, method));
         } else if (annotation.annotationType().equals(OnPreferenceChange.class)) {
           Preference preference = finder.findPreference(value.toString());
           if (preference == null) break;
           preference.setOnPreferenceChangeListener(new ViewCommonEventListener(handler, method));
         } else if (annotation.annotationType().equals(OnTabChange.class)) {
           View view = finder.findViewById((Integer) value);
           if (view == null) break;
           ((TabHost) view).setOnTabChangedListener(new ViewCommonEventListener(handler, method));
         } else if (annotation.annotationType().equals(OnScrollChanged.class)) {
           View view = finder.findViewById((Integer) value);
           if (view == null) break;
           view.getViewTreeObserver()
               .addOnScrollChangedListener(new ViewCommonEventListener(handler, method));
         } else if (annotation.annotationType().equals(OnScrollStateChanged.class)) {
           View view = finder.findViewById((Integer) value);
           if (view == null) break;
           Method method0 = null, method1 = null;
           ConcurrentHashMap<Annotation, Method> a_m_map = value_annotation_method_map.get(value);
           for (Annotation a : a_m_map.keySet()) {
             if (a.annotationType().equals(OnScrollStateChanged.class)) {
               method0 = a_m_map.get(a);
             } else if (a.annotationType().equals(OnScroll.class)) {
               method1 = a_m_map.get(a);
             }
           }
           ((AbsListView) view)
               .setOnScrollListener(new ViewCommonEventListener(handler, method0, method1));
         } else if (annotation.annotationType().equals(OnItemSelected.class)) {
           View view = finder.findViewById((Integer) value);
           if (view == null) break;
           Method method0 = null, method1 = null;
           ConcurrentHashMap<Annotation, Method> a_m_map = value_annotation_method_map.get(value);
           for (Annotation a : a_m_map.keySet()) {
             if (a.annotationType().equals(OnItemSelected.class)) {
               method0 = a_m_map.get(a);
             } else if (a.annotationType().equals(OnNothingSelected.class)) {
               method1 = a_m_map.get(a);
             }
           }
           ((AdapterView<?>) view)
               .setOnItemSelectedListener(new ViewCommonEventListener(handler, method0, method1));
         } else if (annotation.annotationType().equals(OnProgressChanged.class)) {
           View view = finder.findViewById((Integer) value);
           if (view == null) break;
           Method method0 = null, method1 = null, method2 = null;
           ConcurrentHashMap<Annotation, Method> a_m_map = value_annotation_method_map.get(value);
           for (Annotation a : a_m_map.keySet()) {
             if (a.annotationType().equals(OnProgressChanged.class)) {
               method0 = a_m_map.get(a);
             } else if (a.annotationType().equals(OnStartTrackingTouch.class)) {
               method1 = a_m_map.get(a);
             } else if (a.annotationType().equals(OnStopTrackingTouch.class)) {
               method2 = a_m_map.get(a);
             }
           }
           ((SeekBar) view)
               .setOnSeekBarChangeListener(
                   new ViewCommonEventListener(handler, method0, method1, method2));
         }
       } catch (Throwable e) {
         LogUtils.e(e.getMessage(), e);
       }
     }
   }
 }
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_moja_muzyka, container, false);

    // get the listview
    expListView = (ExpandableListView) rootView.findViewById(R.id.tracks);

    // query songs
    songView = (ExpandableListView) rootView.findViewById(R.id.tracks);
    songList = new ArrayList<Song>();
    getSongList();

    AsyncTask.execute(
        new Runnable() {
          @Override
          public void run() {
            //                for(int i = 0;i< songList.size();i++){
            //                    // add songs to database
            //
            // //syncSongsWithServer(songList.get(i).getTitle(),songList.get(i).getArtist(),songList.get(i).getAlbum(),general.getMD5EncryptedString(songList.get(i).getPath()));
            //                }
            try {
              syncSongsWithServer(songList);
            } catch (JSONException e) {
              general.log("MOJA MUZYKA", "error w funkcji");
            }
          }
        });

    // sort songs
    // poprawic: sortowanie rozwala click listener (listener się nie sortuje)
    //        Collections.sort(songList, new Comparator<Song>(){
    //            public int compare(Song b, Song a){
    //                return b.getTitle().compareTo(a.getTitle());
    //            }
    //        });

    SongAdapter songAdt =
        new SongAdapter(rootView.getContext(), songList, listDataHeader, listDataChild);
    songView.setAdapter(songAdt);

    // Listview Group click listener
    songView.setOnGroupClickListener(
        new OnGroupClickListener() {

          @Override
          public boolean onGroupClick(
              ExpandableListView parent, View v, int groupPosition, long id) {
            //                 Toast.makeText(getActivity().getApplicationContext(), //
            // getApplicationContext - cała apka, getActivity - tylko obecna aktywność
            //                 "Group Clicked " + listDataHeader.get(groupPosition),
            //                 Toast.LENGTH_SHORT).show();
            return false;
          }
        });

    // Listview Group expanded listener
    songView.setOnGroupExpandListener(
        new OnGroupExpandListener() {

          @Override
          public void onGroupExpand(int groupPosition) {
            //                Toast.makeText(getActivity().getApplicationContext(),
            //                        listDataHeader.get(groupPosition) + " Expanded",
            //                        Toast.LENGTH_SHORT).show();

            // hide all groups but clicked
            if (lastExpandedPosition != -1 && groupPosition != lastExpandedPosition) {
              expListView.collapseGroup(lastExpandedPosition);
            }
            lastExpandedPosition = groupPosition;
          }
        });

    // Listview Group collasped listener
    songView.setOnGroupCollapseListener(
        new OnGroupCollapseListener() {

          @Override
          public void onGroupCollapse(int groupPosition) {
            //                Toast.makeText(getActivity().getApplicationContext(),
            //                        listDataHeader.get(groupPosition) + " Collapsed",
            //                        Toast.LENGTH_SHORT).show();

          }
        });

    // Listview on child click listener
    songView.setOnChildClickListener(
        new OnChildClickListener() {

          @Override
          public boolean onChildClick(
              ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
            //                Toast.makeText(
            //                        getActivity().getApplicationContext(),
            //                        listDataHeader.get(groupPosition)
            //                                + " : "
            //                                + listDataChild.get(
            //                                listDataHeader.get(groupPosition)).get(
            //                                childPosition), Toast.LENGTH_SHORT)
            //                        .show();
            return false;
          }
        });

    return rootView;
  }
Exemplo n.º 21
0
  // 初始化未支付订单组
  private void initNoPayExpandableListView() {
    initFooterView();

    rl_tools.setVisibility(View.GONE);
    tempPosition = new ArrayList<>();
    if (null != countDownTimer) {
      countDownTimer.cancel();
      countDownTimer = null;
    }

    order_center_list.setEmptyView(null_layout);
    child = new ArrayList<>();
    child.add(new OrderDetailEntity());
    group = new ArrayList<OrdrDetail>();
    oca =
        new OrderCenterGroupAdapter(
            order_center_list, group, child, R.layout.order_group_item, handler);
    order_center_list.setAdapter(oca);
    // 禁用当前 组 点击事件(嵌套 listView 出现事件冲突)

    // 监听是否有展开的group
    order_center_list.setOnGroupExpandListener(
        new ExpandableListView.OnGroupExpandListener() {
          @Override
          public void onGroupExpand(int groupPosition) {
            for (int i = 0; i < oca.getGroupCount(); i++) {
              if (i != groupPosition && order_center_list.isGroupExpanded(groupPosition)) {
                order_center_list.collapseGroup(i);
              }
            }
          }
        });
    // 禁用当前 组 点击事件(嵌套 listView 出现事件冲突)
    order_center_list.setOnGroupClickListener(
        new ExpandableListView.OnGroupClickListener() {
          @Override
          public boolean onGroupClick(
              ExpandableListView expandableListView, View view, int groupPos, long l) {
            groupPosition = groupPos;

            boolean expanded = expandableListView.isGroupExpanded(groupPosition);

            if (!expanded) {
              // 在这加载数据,推荐使用AsycnTask之类的在另一个线程里做喽
              orderGroupDetailResult(group.get(groupPosition).getOrderIdGroup());

              return true;
            } else {
              tx_tool_right.setVisibility(View.GONE);
              order_center_list.removeFooterView(footerView);
            }
            return false;
          }
        });
    //        ajaxOrder();
    //        if(MapVo.get("ticket")==null){
    //            getNoLoginOrder();
    //        }else{
    //            checkTicket(MapVo.get("ticket") + "");
    //        }
  }
Exemplo n.º 22
0
 void initializeView(View view) {
   mListView = (ExpandableListView) view.findViewById(R.id.list);
   mListView.setOnGroupExpandListener(mGroupExpandListener);
 }
Exemplo n.º 23
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    View view = inflater.inflate(R.layout.activity_day_rate, container, false);
    explstDayRate = (ExpandableListView) view.findViewById(R.id.explstDayRate);

    prepareListData();

    listAdapter = new ExpandableListAdapter(getActivity(), listDataHeader, listDataChild);

    // setting list adapter
    explstDayRate.setAdapter(listAdapter);

    // Listview Group click listener
    explstDayRate.setOnGroupClickListener(
        new OnGroupClickListener() {

          @Override
          public boolean onGroupClick(
              ExpandableListView parent, View v, int groupPosition, long id) {
            // Toast.makeText(getApplicationContext(),
            // "Group Clicked " + listDataHeader.get(groupPosition),
            // Toast.LENGTH_SHORT).show();
            return false;
          }
        });

    // Listview Group expanded listener
    explstDayRate.setOnGroupExpandListener(
        new OnGroupExpandListener() {

          @Override
          public void onGroupExpand(int groupPosition) {
            //				Toast.makeText(getActivity().getApplicationContext(),
            //						listDataHeader.get(groupPosition) + " Expanded",
            //						Toast.LENGTH_SHORT).show();
          }
        });

    // Listview Group collasped listener
    explstDayRate.setOnGroupCollapseListener(
        new OnGroupCollapseListener() {

          @Override
          public void onGroupCollapse(int groupPosition) {
            //				Toast.makeText(getActivity().getApplicationContext(),
            //						listDataHeader.get(groupPosition) + " Collapsed",
            //						Toast.LENGTH_SHORT).show();

          }
        });

    // Listview on child click listener
    explstDayRate.setOnChildClickListener(
        new OnChildClickListener() {

          @Override
          public boolean onChildClick(
              ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
            // TODO Auto-generated method stub
            //				Toast.makeText(
            //						getActivity().getApplicationContext(),
            //						listDataHeader.get(groupPosition)
            //								+ " : "
            //								+ listDataChild.get(
            //										listDataHeader.get(groupPosition)).get(
            //										childPosition), Toast.LENGTH_SHORT)
            //						.show();
            return false;
          }
        });

    return view;
  }
Exemplo n.º 24
0
  private void prepareLists() {
    prepareListData();

    exp = (ExpandableListView) findViewById(R.id.list);

    epa = new ExpandableAdapter(this, listDataHeader, listDataChild);

    exp.setAdapter(epa);

    exp.setOnGroupClickListener(
        new OnGroupClickListener() {

          @Override
          public boolean onGroupClick(
              ExpandableListView parent, View v, int groupPosition, long id) {
            // Toast.makeText(getApplicationContext(),
            // "Group Clicked " + listDataHeader.get(groupPosition),
            // Toast.LENGTH_SHORT).show();
            return false;
          }
        });

    // Listview Group expanded listener
    exp.setOnGroupExpandListener(
        new OnGroupExpandListener() {

          @Override
          public void onGroupExpand(int groupPosition) {
            Toast.makeText(
                    getApplicationContext(),
                    listDataHeader.get(groupPosition) + " Expanded",
                    Toast.LENGTH_SHORT)
                .show();
          }
        });

    // Listview Group collasped listener
    exp.setOnGroupCollapseListener(
        new OnGroupCollapseListener() {

          @Override
          public void onGroupCollapse(int groupPosition) {
            Toast.makeText(
                    getApplicationContext(),
                    listDataHeader.get(groupPosition) + " Collapsed",
                    Toast.LENGTH_SHORT)
                .show();
          }
        });

    // Listview on child click listener
    exp.setOnChildClickListener(
        new OnChildClickListener() {

          @Override
          public boolean onChildClick(
              ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
            // TODO Auto-generated method stub

            editMenu(listDataHeader.get(groupPosition), childPosition);

            Toast.makeText(
                    getApplicationContext(),
                    listDataHeader.get(groupPosition)
                        + " : "
                        + listDataChild.get(listDataHeader.get(groupPosition)).get(childPosition),
                    Toast.LENGTH_SHORT)
                .show();
            return false;
          }
        });
  }
Exemplo n.º 25
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View rootView = inflater.inflate(R.layout.fragment_missions_extended_list, container, false);

    // get the listview
    ExpandableListView expListView =
        (ExpandableListView) rootView.findViewById(R.id.missions_extended_listview);

    // preparing list data
    prepareListData();

    ExpandableListAdapter listAdapter =
        new ExpandableListAdapter(getActivity(), listDataHeader, listDataChild);

    // setting list adapter
    expListView.setAdapter(listAdapter);

    // Listview Group click listener
    expListView.setOnGroupClickListener(
        new OnGroupClickListener() {

          @Override
          public boolean onGroupClick(
              ExpandableListView parent, View v, int groupPosition, long id) {
            // getHtml(listDataHeader.get(groupPosition).getUrl(),	groupPosition);

            return false;
          }
        });

    // Listview Group expanded listener
    expListView.setOnGroupExpandListener(
        new OnGroupExpandListener() {

          @Override
          public void onGroupExpand(int groupPosition) {}
        });

    // Listview Group collasped listener
    expListView.setOnGroupCollapseListener(
        new OnGroupCollapseListener() {

          @Override
          public void onGroupCollapse(int groupPosition) {}
        });

    // Listview on child click listener
    expListView.setOnChildClickListener(
        new OnChildClickListener() {

          @Override
          public boolean onChildClick(
              ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
            // TODO Auto-generated method stub
            String listDataHeaderName = listDataHeader.get(groupPosition).getName();
            MissionItemData missionItem = listDataChild.get(listDataHeaderName).get(childPosition);

            MissionsDetailsFragment missionsDetailNewFragment =
                MissionsDetailsFragment.newInstance(missionItem);
            getActivity()
                .getSupportFragmentManager()
                .beginTransaction()
                .replace(
                    R.id.activity_base_details_container,
                    missionsDetailNewFragment,
                    "MissionsDetailNewFragment")
                .commit();

            return false;
          }
        });

    return rootView;
  }
Exemplo n.º 26
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_home_page);
    expandableListView = (ExpandableListView) findViewById(R.id.expandable);
    locationCategory = DataProvider.getInfo();
    locationList = new ArrayList<>(locationCategory.keySet());
    locationAdapter = new LocationAdapter(this, locationCategory, locationList);
    expandableListView.setAdapter(locationAdapter);
    expandableListView.setBackgroundColor(Color.WHITE);

    expandableListView.setOnGroupExpandListener(
        new ExpandableListView.OnGroupExpandListener() {
          @Override
          public void onGroupExpand(int groupPosition) {
            Toast.makeText(
                    getBaseContext(),
                    locationList.get(groupPosition) + " is expanded",
                    Toast.LENGTH_SHORT)
                .show();
          }
        });
    expandableListView.setOnChildClickListener(
        new ExpandableListView.OnChildClickListener() {
          @Override
          public boolean onChildClick(
              ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
            String venues =
                locationCategory.get(locationList.get(groupPosition)).get(childPosition);
            switch (venues) {
              case "Seiobo":
                Intent intent = new Intent(HomePage.this, LunchPage.class);
                startActivity(intent);
                break;
              case "Noodle bar":
                Intent noodle = new Intent(HomePage.this, LunchPage.class);
                startActivity(noodle);
                break;
              case "nikai":
                Intent nikai = new Intent(HomePage.this, LunchPage.class);
                startActivity(nikai);
                break;
              case "milk bar":
                Intent milk = new Intent(HomePage.this, LunchPage.class);
                startActivity(milk);
                break;
              case "daisho":
                Intent daisho = new Intent(HomePage.this, LunchPage.class);
                startActivity(daisho);
                break;
              case "shoto":
                Intent shoto = new Intent(HomePage.this, LunchPage.class);
                startActivity(shoto);
                break;
              case "Ssam bar":
                Intent Ssam = new Intent(HomePage.this, LunchPage.class);
                startActivity(Ssam);
                break;
              case "Ko":
                Intent ko = new Intent(HomePage.this, LunchPage.class);
                startActivity(ko);
                break;
              case "Ma peche":
                Intent mapeche = new Intent(HomePage.this, LunchPage.class);
                startActivity(mapeche);
                break;
              case "Fuku":
                Intent fuku = new Intent(HomePage.this, LunchPage.class);
                startActivity(fuku);
                break;
            }

            return true;
          }
        });
    expandableListView.setOnGroupClickListener(
        new ExpandableListView.OnGroupClickListener() {
          @Override
          public boolean onGroupClick(
              ExpandableListView parent, View v, int groupPosition, long id) {

            return false;
          }
        });
  }
Exemplo n.º 27
0
  @SuppressWarnings("unchecked")
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_filter);

    Intent intent = getIntent();
    if (intent.getSerializableExtra(REQUEST_SEARCH_MODEL) == null) {
      UiUtils.makeToast(this, R.string.params_empty, true);
      finish();
      return;
    }

    mSearchModel = (SearchModel) intent.getSerializableExtra(REQUEST_SEARCH_MODEL);
    if (null != intent.getSerializableExtra(REQUEST_SEARCH_CATEGORY_MODEL)) {
      mSearchCategoryModels =
          (ArrayList<SearchCategoryModel>)
              intent.getSerializableExtra(REQUEST_SEARCH_CATEGORY_MODEL);
    }
    total_num = intent.getIntExtra(FilterCategoryActivity.TOTAL_COUNT, -1);

    mExpandableListView = (ExpandableListView) findViewById(R.id.filter_expandablelistview);
    mButtonConfirm = (Button) findViewById(R.id.filter_button_confirm);
    mButtonClear = (Button) findViewById(R.id.filter_button_clear);

    String strTitle =
        (null == mSearchModel.getCategoryName() || mSearchModel.getCategoryName().equals(""))
            ? "筛选"
            : mSearchModel.getCategoryName();
    loadNavBar(R.id.filter_navigation_bar, strTitle);

    mButtonConfirm.setOnClickListener(this);
    mButtonClear.setOnClickListener(this);
    mSearchFilterParser = new SearchFilterParser();
    mExpandableListView.setOnChildClickListener(
        new OnChildClickListener() {
          @Override
          public boolean onChildClick(
              ExpandableListView parent, View view, int groupPosition, int childPosition, long id) {
            SearchFilterOptionModel mSearchFilterOptionModel =
                (SearchFilterOptionModel) mFilterAdapter.getChild(groupPosition, childPosition);
            CheckBox box = (CheckBox) view.findViewById(R.id.filteroption_checkbox);
            boolean checked = box.isChecked();
            box.setChecked(!checked);
            mSearchFilterOptionModel.setSelect(!checked);

            mFilterAdapter.notifyDataSetChanged();
            return false;
          }
        });

    mExpandableListView.setOnGroupExpandListener(
        new OnGroupExpandListener() {
          @Override
          public void onGroupExpand(int currentGroupId) {
            for (int nId = 0; nId < mFilterAdapter.getGroupCount(); nId++) {
              if (nId != currentGroupId) {
                mExpandableListView.collapseGroup(nId);
              }
            }
          }
        });

    mHeaderView = LayoutInflater.from(this).inflate(R.layout.adapter_filter_attr_header, null);
    selectedViewContainer = (RelativeLayout) mHeaderView.findViewById(R.id.filter_select_class);
    mHasGoodView = (ImageView) mHeaderView.findViewById(R.id.filter_sale_status);
    selectedCategoryView = (TextView) mHeaderView.findViewById(R.id.filter_category_selected);
    initData();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_send_mail_without_intent);

    txt = (TextView) findViewById(R.id.txt);

    Typeface iconFont = FontManager.getTypeface(this, FontManager.FONTAWESOME);
    FontManager.markAsIconContainer(findViewById(R.id.send), iconFont);
    FontManager.markAsIconContainer(findViewById(R.id.txtMyCart), iconFont);
    FontManager.markAsIconContainer(findViewById(R.id.txtAdProduct), iconFont);

    TextView txtAddProduct = (TextView) findViewById(R.id.txtAdProduct);

    txtAddProduct.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            Intent i = new Intent(getBaseContext(), AddNewProduct.class);
            startActivity(i);
          }
        });

    TextView send = (TextView) findViewById(R.id.send);

    send.setOnClickListener(
        new View.OnClickListener() {

          public void onClick(View v) {

            // TODO Auto-generated method stub

            new Thread(
                    new Runnable() {

                      public void run() {

                        try {

                          GMailSender sender = new GMailSender("*****@*****.**", "activa4858");

                          StringBuilder mailText = new StringBuilder();

                          mailText.append("<html><body>");

                          Iterator myVeryOwnIterator = expandableListDetail.keySet().iterator();
                          while (myVeryOwnIterator.hasNext()) {
                            String key = (String) myVeryOwnIterator.next();

                            mailText.append("<div style=\"color:#0000FF;\"><h4><b>");
                            mailText.append(key);
                            mailText.append("</b></h4></div><table border=\"1\" width=\"400\" >");
                            mailText.append("<tr><th>Product</th><th>Quantity</th></tr>");

                            ArrayList<ShoppingList> lstShoppingList =
                                (ArrayList<ShoppingList>) expandableListDetail.get(key);
                            for (int i = 0; i < lstShoppingList.size(); i++) {
                              mailText.append("<tr><td width=\"300\" >");
                              mailText.append(lstShoppingList.get(i)._Name);
                              mailText.append("</td><td>");
                              mailText.append(lstShoppingList.get(i)._quantity);
                              mailText.append("</td></tr>");
                            }
                            mailText.append("</table></br>");
                          }

                          mailText.append("</body></html>");

                          sender.sendMail(
                              "My List",
                              mailText.toString(),
                              "*****@*****.**",
                              "*****@*****.**");

                        } catch (Exception e) {

                          Toast.makeText(getApplicationContext(), "Error", Toast.LENGTH_LONG)
                              .show();
                        }
                      }
                    })
                .start();
          }
        });

    DBMain db;
    db = new DBMain(context);

    try {

      db.createDB();
    } catch (IOException ioe) {

      throw new Error("Database not created....");
    }

    try {
      db.openDB();

    } catch (Exception ex) {

    }
    db.getCategory();

    expandableListView = (ExpandableListView) findViewById(R.id.expandableList);
    expandableListDetail = ExpandableListDataPump.getData();
    expandableListTitle = new ArrayList(expandableListDetail.keySet());
    adapter = new ExpandListAdapter(this, expandableListTitle, expandableListDetail);
    expandableListView.setAdapter(adapter);
    expandableListView.setOnGroupExpandListener(
        new ExpandableListView.OnGroupExpandListener() {

          @Override
          public void onGroupExpand(int groupPosition) {}
        });

    expandableListView.setOnGroupCollapseListener(
        new ExpandableListView.OnGroupCollapseListener() {

          @Override
          public void onGroupCollapse(int groupPosition) {

            ExpandableListAdapter adapter = expandableListView.getExpandableListAdapter();

            int childcount = adapter.getChildrenCount(groupPosition);
            String categoryName =
                adapter.getGroup(groupPosition).toString(); // .getGroup(groupPosition);
            // Log.d("test", groupName);
            for (int i = 0; i < childcount; i++) {

              ShoppingList lst = (ShoppingList) adapter.getChild(groupPosition, i);
              Log.d("test", lst._Name);
              Log.d("test", String.valueOf(lst._quantity));
            }

            Log.d("test", "The Child Count is" + String.valueOf(childcount));
          }
        });

    expandableListView.setOnChildClickListener(
        new ExpandableListView.OnChildClickListener() {

          @Override
          public boolean onChildClick(
              ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {

            Log.d("test", "I am in child");

            return false;
          }
        });
  }