Ejemplo n.º 1
0
  // initialize expandable lists Home and Away teams
  public void prepareListData() {
    listDataHeaderHome = new ArrayList<String>();
    listDataHeaderAway = new ArrayList<String>();
    listDataChildHome = new HashMap<String, List<String>>();
    listDataChildAway = new HashMap<String, List<String>>();

    // Adding child heater data
    listDataHeaderHome.add("Home Team");
    listDataHeaderAway.add("Away Team");

    // Adding child data
    List<String> TeamHome = new ArrayList<String>();
    List<String> TeamAway = new ArrayList<String>();

    // Load team list
    teamList = (ArrayList<Teams>) _db.getAllTeams();
    for (Teams t : teamList) {
      TeamHome.add(t.gettname());
      TeamAway.add(t.gettname());
    }
    if (teamList.isEmpty()) _deleteButton.setEnabled(false);
    listDataChildHome.put(listDataHeaderHome.get(0), TeamHome); // Header, Child Home data
    listAdapterHome = new ExpandableListAdapter(this, listDataHeaderHome, listDataChildHome);
    ex_ListViewHome.setAdapter(listAdapterHome);
    listDataChildAway.put(listDataHeaderAway.get(0), TeamAway); // Header, Child Away data
    listAdapterAway = new ExpandableListAdapter(this, listDataHeaderAway, listDataChildAway);
    ex_ListViewAway.setAdapter(listAdapterAway);
  }
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {

    super.onActivityCreated(savedInstanceState);

    if (this.amministrazione.getCecpac() == null || this.amministrazione.getCecpac().size() == 0) {
      System.out.println("CECPAC == 0");
    } else {
      System.out.println("CECPAC == " + this.amministrazione.getCecpac().size());
    }

    if (this.amministrazione.getEmail() == null || this.amministrazione.getEmail().size() == 0) {
      System.out.println("EMAIL == 0");
    } else {
      System.out.println("Email == " + this.amministrazione.getEmail().size());
    }

    if (this.amministrazione.getPec() == null || this.amministrazione.getPec().size() == 0) {
      System.out.println("PEC == 0");
    } else {
      System.out.println("PEC == " + this.amministrazione.getPec().size());
    }

    EmailExpandAdapter emailAdapter = new EmailExpandAdapter(getActivity(), "email");
    emailAdapter.setEmails(this.amministrazione.getEmail());

    if (emailAdapter.getChildrenCount(0) == 0) {
      listEmail.setVisibility(View.GONE);
    } else {
      listEmail.setVisibility(View.VISIBLE);
      listEmail.setAdapter(emailAdapter);
    }

    EmailExpandAdapter cepacAdapter = new EmailExpandAdapter(getActivity(), "CeCPac");
    cepacAdapter.setEmails(this.amministrazione.getCecpac());

    if (emailAdapter.getChildrenCount(0) == 0) {
      listCecpac.setVisibility(View.GONE);
    } else {
      listCecpac.setVisibility(View.VISIBLE);
      listCecpac.setAdapter(cepacAdapter);
    }

    EmailExpandAdapter pecAdapter = new EmailExpandAdapter(getActivity(), "Pec");
    pecAdapter.setEmails(this.amministrazione.getPec());

    if (emailAdapter.getChildrenCount(0) == 0) {
      listPec.setVisibility(View.GONE);
    } else {
      listPec.setVisibility(View.VISIBLE);
      listPec.setAdapter(pecAdapter);
    }

    addContactButton.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {}
        });
  }
Ejemplo n.º 3
0
  @Override
  public void onClick(View v) {
    if (v.getId() == R.id.button) {
      if (expand == false) {
        view = mMap.getView();
        ResizeAnimation resizeAnimation = new ResizeAnimation(view, 1000);
        resizeAnimation.setDuration(600);
        view.startAnimation(resizeAnimation);
        expand = true;
      } else {
        ResizeAnimation resizeAnimation = new ResizeAnimation(view, 300);
        resizeAnimation.setDuration(600);
        view.startAnimation(resizeAnimation);
        expand = false;
      }
    } else if (v.getId() == R.id.machines) {
      workers.setText("Workers");
      workersClick = false;
      prepareListMachines();
      listAdapter = new Adapter(this, dataListm, listDataChildm);
      // setting list adapter
      expListView.setAdapter(listAdapter);
      if (machinesClick == false) {
        machines.setText("Refresh");
        workersClick = false;
        engineClick = false;
        machinesClick = true;
      }

    } else if (v.getId() == R.id.workers) {
      machines.setText("Machines");
      machinesClick = false;
      prepareListData();
      listAdapter = new Adapter(this, dataList, listDataChild);
      // setting list adapter
      expListView.setAdapter(listAdapter);
      if (workersClick == false) {
        workers.setText("Refresh");
        machinesClick = false;
        engineClick = false;
        workersClick = true;
      }

    } else if (v.getId() == R.id.engine) {
      Toast.makeText(MapsActivity.this, "jeszcze nie ma", Toast.LENGTH_SHORT).show();
      chart();
    }
  }
Ejemplo n.º 4
0
  @Override
  public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    ExpandableListView lv = (ExpandableListView) getView().findViewById(R.id.listview);

    // obtain the basic and extended regexp_array
    regexpb = getResources().getStringArray(R.array.regexpb_array);
    regexpe = getResources().getStringArray(R.array.regexpe_array);
    regexpp = getResources().getStringArray(R.array.regexpp_array);

    // define and activate the expandable list adapter
    SimpleExpandableListAdapter expListAdapter =
        new SimpleExpandableListAdapter(
            getActivity(),
            createGroupList(),
            R.layout.regroups,
            new String[] {"reCategory"},
            new int[] {R.id.recategory},
            createChildList(),
            R.layout.rerow,
            new String[] {"resym", "redesc"},
            new int[] {R.id.resymbol, R.id.retext});

    lv.setAdapter(expListAdapter);
  }
 /** Provide the adapter for the expandable list. */
 public void setListAdapter(ExpandableListAdapter adapter) {
   synchronized (this) {
     ensureList();
     mAdapter = adapter;
     mList.setAdapter(adapter);
   }
 }
Ejemplo n.º 6
0
 @SuppressWarnings("unchecked")
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.layout_menu_main);
   createGroupList();
   createCollection();
   Bundle bundle = getIntent().getExtras();
   o = (ArrayList<Food>) bundle.getSerializable("key");
   expListView = (ExpandableListView) findViewById(R.id.expandableListView1);
   final MyExpandableAdapter expListAdapter =
       new MyExpandableAdapter(this, groupList, foodCollection);
   expListView.setAdapter(expListAdapter);
   final HashMap<String, Food> menu = fm.getMenu();
   expListView.setOnChildClickListener(
       new OnChildClickListener() {
         public boolean onChildClick(
             ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
           o.add(menu.get(expListAdapter.getChild(groupPosition, childPosition)));
           Toast.makeText(
                   NewOrder.this,
                   menu.get(expListAdapter.getChild(groupPosition, childPosition)).toString()
                       + " Added",
                   Toast.LENGTH_SHORT)
               .show();
           return true;
         }
       });
 }
Ejemplo n.º 7
0
  @Override
  public void onActivityCreated(Bundle paramBundle) {
    super.onActivityCreated(paramBundle);

    Spinner spinner = (Spinner) getActivity().findViewById(R.id.state_rate_spinner);
    ExpandableListView ratesList = (ExpandableListView) getActivity().findViewById(R.id.lvExp);
    ratesList.setAdapter(adapter);

    spinnerAdapter =
        ArrayAdapter.createFromResource(
            getActivity(), R.array.RatesListStateNames, R.layout.spinner_layout);
    // spinnerAdapter.remove(spinnerAdapter.getItem(0));
    spinner.setAdapter(spinnerAdapter);

    spinner.setOnItemSelectedListener(
        new OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView<?> parent, View arg1, int position, long arg3) {
            CharSequence ch = (CharSequence) parent.getItemAtPosition(position);

            HashMap<String, List<Integer>> rateList =
                MainActivity.builder.getRatesForState(ch.toString());

            adapter.setData(rateList);

            adapter.notifyDataSetChanged();
          }

          @Override
          public void onNothingSelected(AdapterView<?> arg0) {
            // TODO Auto-generated method stub

          }
        });
  }
Ejemplo n.º 8
0
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    ExpandableListView listView = (ExpandableListView) getView().findViewById(R.id.lstSyncs);
    adapter = new SyncsAdapter(getActivity(), authUser.getSyncs(), authUser);
    changeWeek();
    listView.setAdapter(adapter);

    getView()
        .findViewById(R.id.btnNextWeek)
        .setOnClickListener(
            new OnClickListener() {
              @Override
              public void onClick(View v) {
                week++;
                changeWeek();
              }
            });

    getView()
        .findViewById(R.id.btnPrevWeek)
        .setOnClickListener(
            new OnClickListener() {
              @Override
              public void onClick(View v) {
                week--;
                changeWeek();
              }
            });
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_expandable_list_view);

    ImageView imageView = (ImageView) findViewById(R.id.activity_expandable_list_view_icon);
    Picasso.with(this)
        .load(getString(R.string.activity_see_all_items_image))
        .transform(new CircleTransform())
        .into(imageView);

    createData();
    mListView = (ExpandableListView) findViewById(R.id.activity_expandable_list_view);
    MyExpandableListAdapter adapter = new MyExpandableListAdapter(this, mGroups);
    mListView.setAdapter(adapter);
    mListView.setOnGroupClickListener(
        new ExpandableListView.OnGroupClickListener() {

          @Override
          public boolean onGroupClick(
              ExpandableListView parent, View v, int groupPosition, long id) {
            setListViewHeight(parent, groupPosition);
            return false;
          }
        });
  }
  /*
   * 导入联系人列表
   */
  private void addListInfo() {

    File file = getActivity().getExternalCacheDir();
    DBAccess ac = new DBAccess(getActivity());
    Log.i("开始获取好友数据", "" + currentUser);
    if (!file.equals(null) && ac.queryTable3() == true) {
      try {
        List<ContactPerson> cpList;
        cpList = ac.queryTableInfo3(currentUser);
        if (cpList.size() > 0 && cpList != null && cpList.get(0).getPrivateGroup() != null) {
          ArrayList = cpList.get(0).getPrivateGroups();
          if (cpList.get(0).getPrivateFriend() != null) {
            list = cpList.get(0).getPrivateFriends();
            Log.i("本地私人好友信息", "" + ArrayList + list);
          } else {
            networkDatabase(1);
          }
          adapter = new PrivateManagerDbAdater(getActivity(), ArrayList, list);
          expandableListView.setAdapter(adapter);

        } else {
          networkDatabase(0);
        }
      } catch (IOException e) {
        e.printStackTrace();
      } catch (ClassNotFoundException e) {
        e.printStackTrace();
      }

    } else {

      networkDatabase(2);
    }
  }
 @Override
 protected void initView() {
   super.initView();
   ExpandableListView expandableListView =
       (ExpandableListView) findViewById(R.id.elv_explandablelist);
   expandableListView.setAdapter(mAdapter);
 }
Ejemplo n.º 12
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

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

    // preparing list data
    prepareListData();
    expListView.setOnChildClickListener(
        new ExpandableListView.OnChildClickListener() {
          @Override
          public boolean onChildClick(
              ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
            if (childPosition == 0) {
              Intent intent = new Intent(MainActivity.this, Register.class);
              startActivity(intent);
              finish();
            }

            return false;
          }
        });

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

    // setting list adapter
    expListView.setAdapter(listAdapter);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    ArrayList<String> converter_streems = new ArrayList<>(Arrays.asList(clist));
    data = Dataprovider.getDataprovider();

    myadap = new myadapter(this, data, converter_streems);
    ExpandableListView listview = (ExpandableListView) findViewById(R.id.listView);
    listview.setAdapter(myadap);

    listview.setOnChildClickListener(
        new ExpandableListView.OnChildClickListener() {

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

            Intent calculate = new Intent(MainActivity.this, Units.class);
            int[] args = {groupPosition, childPosition};
            calculate.putExtra("EXTRA_VALES", args);
            startActivity(calculate);

            return true;
          }
        });
  }
Ejemplo n.º 14
0
 public MQuery adapter(ExpandableListAdapter adapter) {
   if (view instanceof ExpandableListView) {
     ExpandableListView av = (ExpandableListView) view;
     av.setAdapter(adapter);
   }
   return this;
 }
  private void init() {
    mListDataHeader = new ArrayList<>();
    mListDataChild = new HashMap<>();
    readFromMediaStoreVideo();
    readFromMediaStoreAudio();
    readInternalSourceFile();
    readExternalSourceFile();
    prepareListData();

    mDebugTitle = (TextView) mDebugLayout.findViewById(R.id.activity_main_debug_media_title);

    ExpandableListViewAdapter listAdapter =
        new ExpandableListViewAdapter(mContext, mListDataHeader, mListDataChild);
    mExpandableListView.setAdapter(listAdapter);
    mExpandableListView.setOnChildClickListener(
        new OnChildClickListener() {

          @Override
          public boolean onChildClick(
              ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
            LinearLayout layout = (LinearLayout) v;
            TextView tv = (TextView) layout.findViewById(R.id.expand_list_item);
            mDebugTitle.setText(mListDataHeader.get(groupPosition) + " / " + tv.getText());
            startMediaPlayer(
                mListDataChild
                    .get(mListDataHeader.get(groupPosition))
                    .get(childPosition)
                    .getSource(),
                mListDataHeader.get(groupPosition).startsWith("MediaStore"));
            return true;
          }
        });
  }
Ejemplo n.º 16
0
  private void loadListView() {

    Log.d(TAG, "----- loadListView ----- ");
    SharedPreferences prefs = this.getSharedPreferences("CopyistPreferences", Context.MODE_PRIVATE);
    String ensembles = prefs.getString("ensembles", null);

    listDataHeader = new ArrayList<String>();
    listDataChild = new HashMap<String, List<String>>();

    // Adding child data
    listDataHeader.add("ensembles");

    try {
      JSONArray ensemblesArray = new JSONArray(ensembles);

      ArrayList<String> ensembleItems = new ArrayList<String>();
      if (PrefsUtil.isComposer(this)) {
        ensembleItems.add("{\"name\": \"Add Ensemble...\"}");
      }
      for (int i = 0; i < ensemblesArray.length(); i++) {
        JSONObject json_data = ensemblesArray.getJSONObject(i);
        ensembleItems.add(json_data.toString());
      }
      listDataChild.put(listDataHeader.get(0), ensembleItems); // Header, Child data

      listAdapter = new ExpandableListAdapter(this, listDataHeader, listDataChild);
      listAdapter.setHeaderViewId(R.id.lblListHeader);
      ensemblesList.setAdapter(listAdapter);
    } catch (Exception e) {
      Log.d(TAG, "Error loading list view " + e.getMessage());
    }
  }
Ejemplo n.º 17
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    container.removeAllViews();
    View rootView = inflater.inflate(R.layout.fragment_grades, container, false);
    listView = (ExpandableListView) rootView.findViewById(R.id.listView);

    // Header DETAILS
    TextView fullName = (TextView) rootView.findViewById(R.id.NameAtGradesHeader);
    TextView AEM = (TextView) rootView.findViewById(R.id.aemAtGradesHeader);
    TextView totalDetails = (TextView) rootView.findViewById(R.id.totalDetails);

    fullName.setText(
        eGramFunctions.properCase(up.getSurName()) + " " + eGramFunctions.properCase(up.getName()));
    AEM.setText(up.getAEM());
    totalDetails.setText(
        getString(R.string.MOTitle)
            + up.getMO()
            + " "
            + getString(R.string.DMTitle)
            + upDB.TotalDM(ProfileID)
            + " "
            + getString(R.string.ECTSTitle)
            + up.getTotalECTS());

    createData();
    listView.setAdapter(adapter);

    return rootView;
  }
Ejemplo n.º 18
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View viewFragment = inflater.inflate(R.layout.fragment_list_cities, container, false);

    ParserXML pars = new ParserXML();

    countryExpListAdapter =
        new AdapterCountryExpList(
            this.getActivity(), pars.getCountryList(this.getActivity(), R.xml.country_city));
    expandableListView = (ExpandableListView) viewFragment.findViewById(R.id.expandable_list_view);
    expandableListView.setAdapter(countryExpListAdapter);
    expandableListView.setOnChildClickListener(this);
    try {
      onFragmentInteractionListener = (OnFragmentInteractionListener) this.getActivity();

    } catch (ClassCastException e) {
      throw new ClassCastException(
          this.getActivity().toString()
              + " The MainActivity activity must "
              + "implement OnContactSelectedListener");
    }

    // read default city id from settings and open group in expandable list
    long cityId = ((MainApplication) getActivity().getApplication()).getSettings().getCityId();
    int groupPosition = countryExpListAdapter.getGroupPositionByCityId(cityId);
    expandableListView.expandGroup(groupPosition);
    expandableListView.setSelectedGroup(groupPosition);

    return viewFragment;
  }
  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);
              }
            }
          }
        });
  }
Ejemplo n.º 20
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
  }
 private void intializeView() {
   setbtn1();
   expendDes = (ExpandableListView) findViewById(R.id.expend_des_list);
   ExpendBusinessDescriptionAdapter adapter =
       new ExpendBusinessDescriptionAdapter(this, listHeader, expend);
   expendDes.setAdapter(adapter);
 }
Ejemplo n.º 22
0
 public void setViewData() {
   expandListView.setAdapter(adapter);
   int groupCount = expandListView.getCount();
   for (int i = 0; i < groupCount; i++) {
     expandListView.expandGroup(i);
   }
   expandListView.setOnGroupClickListener(
       new ExpandableListView.OnGroupClickListener() {
         @Override
         public boolean onGroupClick(
             ExpandableListView parent, View v, int groupPosition, long id) {
           return true;
         }
       });
   expandListView.setOnChildClickListener(
       new ExpandableListView.OnChildClickListener() {
         @Override
         public boolean onChildClick(
             ExpandableListView expandableListView, View view, final int i, int i1, long l) {
           Message message = new Message();
           message.what = 0;
           message.obj = mLists.get(i);
           message.arg1 = i1;
           if (handler != null) {
             handler.sendMessage(message);
           }
           return false;
         }
       });
 }
Ejemplo n.º 23
0
 @Override
 public void onViewCreated(View view, Bundle savedInstanceState) {
   super.onViewCreated(view, savedInstanceState);
   lv = (ExpandableListView) view.findViewById(R.id.expandableListView1);
   lv.setAdapter(new ExpandableListAdapter(groups, children));
   // lv.setGroupIndicator(null);
 }
Ejemplo n.º 24
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // display the list
    loadData();

    // get reference to the ExpandableListView
    myList = (ExpandableListView) findViewById(R.id.myList);

    // create the adapter by passing your ArrayList data
    listAdapter = new MyListAdapter(MainActivity.this, brightList);

    // attach the adapter to the list
    myList.setAdapter(listAdapter);

    // textView
    txt = (EditText) findViewById(R.id.txtField);

    // expand all groups
    expandAll();

    // add TextWatcher listener
    txt.addTextChangedListener((TextWatcher) wordWatcher);

    // listener for child row click
    myList.setOnChildClickListener(myListItemClicked);

    // listener for group heading click
    myList.setOnGroupClickListener(myListGroupClicked);
  }
  View buildMultipleMapView() {
    @SuppressLint("InflateParams")
    final View countriesView = View.inflate(getActivity(), R.layout.dialog_missed_maps, null);

    final ExpandableListView listView =
        (ExpandableListView) countriesView.findViewById(R.id.items_frame);
    if (mMissingMaps.isEmpty()) {
      mCancelRoute = false;

      UiUtils.hide(listView);
      UiUtils.hide(countriesView.findViewById(R.id.divider_top));
      UiUtils.hide(countriesView.findViewById(R.id.divider_bottom));
      return countriesView;
    }

    listView.setAdapter(buildAdapter());
    listView.setChildDivider(
        new ColorDrawable(getResources().getColor(android.R.color.transparent)));

    UiUtils.waitLayout(
        listView,
        new ViewTreeObserver.OnGlobalLayoutListener() {
          @Override
          public void onGlobalLayout() {
            final int width = listView.getWidth();
            final int indicatorWidth = UiUtils.dimen(R.dimen.margin_quadruple);
            listView.setIndicatorBounds(width - indicatorWidth, width);
            if (Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN_MR2)
              listView.setIndicatorBounds(width - indicatorWidth, width);
            else listView.setIndicatorBoundsRelative(width - indicatorWidth, width);
          }
        });

    return countriesView;
  }
Ejemplo n.º 26
0
 private void initViews() {
   initTitlebar();
   mExpandLV = (ExpandableListView) findViewById(R.id.academy_elv);
   mAdapter = new AcademyAdapter();
   mExpandLV.setAdapter(mAdapter);
   mExpandLV.setOnChildClickListener(new ChildClickListener());
 }
  @Override
  protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.contact_list_filter_custom);

    mList = (ExpandableListView) findViewById(android.R.id.list);
    mList.setOnChildClickListener(this);
    mList.setHeaderDividersEnabled(true);
    mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
    mAdapter = new DisplayAdapter(this);

    final LayoutInflater inflater = getLayoutInflater();

    findViewById(R.id.btn_done).setOnClickListener(this);
    findViewById(R.id.btn_discard).setOnClickListener(this);

    mList.setOnCreateContextMenuListener(this);

    mList.setAdapter(mAdapter);

    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
      // android.R.id.home will be triggered in onOptionsItemSelected()
      actionBar.setDisplayHomeAsUpEnabled(true);
    }
  }
Ejemplo n.º 28
0
 public void appendTo(MenuActivity parentActivity) {
   this.parentActivity = parentActivity;
   if (menuList.get(parentActivity.TAG) != null) {
     return;
   }
   LayoutInflater inflater =
       (LayoutInflater) this.parentActivity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
   this.view = inflater.inflate(R.layout.slidingmenu, null);
   menu = new SlidingMenu(this.parentActivity);
   menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
   menu.setMode(SlidingMenu.LEFT);
   menu.setBehindOffset(
       (int)
           TypedValue.applyDimension(
               TypedValue.COMPLEX_UNIT_DIP,
               50,
               this.parentActivity.getResources().getDisplayMetrics()));
   menu.setFadeDegree(0.35f);
   menu.attachToActivity(this.parentActivity, SlidingMenu.SLIDING_WINDOW);
   menu.setMenu(this.view);
   menuList.put(parentActivity.TAG, menu);
   ExpandableListView menuItemList = (ExpandableListView) this.view.findViewById(R.id.slidingmenu);
   menuItemList.setAdapter(new SlidemenuAdapter(this.parentActivity));
   menuItemList.setOnItemClickListener(this);
 }
Ejemplo n.º 29
0
 @Override
 protected void onResume() {
   // TODO Auto-generated method stub
   super.onResume();
   MusicProject.getdataContent();
   GroupByAdapter adapter = new GroupByAdapter(this, ListSong.TYPE_ALBUMS);
   listview.setAdapter(adapter);
 }
Ejemplo n.º 30
0
 /**
  * 填充列表
  *
  * @param context
  * @param expandableListView
  * @param musicLists 所有音乐列表
  * @param groupLists 列表名称
  */
 public static void setListAdpter(
     Context context,
     ExpandableListView expandableListView,
     HashMap<Integer, List<MusicInfo>> musicLists,
     List<String> groupLists) {
   ExpandableListAdapter listAdapter = new ExpandableListAdapter(context, groupLists, musicLists);
   expandableListView.setAdapter(listAdapter);
 }