├── .gitignore ├── .idea ├── .name ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── chs │ │ └── organizationlevel │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── chs │ │ │ └── organizationlevel │ │ │ ├── MainActivity.java │ │ │ ├── adapter │ │ │ └── MyAdapter.java │ │ │ ├── bean │ │ │ └── MyEntity.java │ │ │ └── wedgit │ │ │ └── MyLinearLayout.java │ └── res │ │ ├── layout │ │ ├── activity_main.xml │ │ ├── item_expandable_child.xml │ │ └── item_expandable_parent.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ ├── arrow_down.png │ │ ├── arrow_up.png │ │ ├── ic_launcher.png │ │ ├── organization_bg_blue.png │ │ ├── organization_bg_gray.png │ │ ├── organization_bg_yellow.png │ │ └── photo_default.png │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── chs │ └── organizationlevel │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── org.gif └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | OrganizationLevel -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | 47 | C:\Users\chs\AppData\Roaming\Subversion 48 | 49 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OrganizationLevel 2 | 可实现无限层级组织机构 3 | 4 | 项目中用到的 按照自己的想法做了一个 大家有好的想法来交流一下 5 | 6 | ![](https://github.com/caoweiaaa/OrganizationLevel/blob/master/org.gif) 7 | 8 | 当级数超过屏幕宽度时候可以滑动 9 | 项目要求第一个不跟着滑动 所以写死一个TextView 10 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.2" 6 | 7 | defaultConfig { 8 | applicationId "com.chs.organizationlevel" 9 | minSdkVersion 15 10 | targetSdkVersion 23 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(include: ['*.jar'], dir: 'libs') 24 | testCompile 'junit:junit:4.12' 25 | compile 'com.android.support:appcompat-v7:23.1.1' 26 | compile 'com.google.code.gson:gson:2.5' 27 | } 28 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in D:\AndroidTools\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/chs/organizationlevel/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.chs.organizationlevel; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/chs/organizationlevel/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.chs.organizationlevel; 2 | 3 | import android.content.Intent; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.os.Bundle; 6 | import android.view.Gravity; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.ExpandableListView; 10 | import android.widget.LinearLayout; 11 | import android.widget.TextView; 12 | 13 | import com.chs.organizationlevel.adapter.MyAdapter; 14 | import com.chs.organizationlevel.bean.MyEntity; 15 | import com.chs.organizationlevel.wedgit.MyLinearLayout; 16 | import com.google.gson.Gson; 17 | 18 | import java.util.ArrayList; 19 | import java.util.List; 20 | 21 | public class MainActivity extends AppCompatActivity { 22 | 23 | private ExpandableListView expandableListView; 24 | private MyLinearLayout ll_department; 25 | private List mData; 26 | private List> mAllDatas = new ArrayList<>(); 27 | private LinearLayout ll_organization; 28 | private TextView tv_organization; 29 | 30 | private MyAdapter adapter; 31 | 32 | @Override 33 | protected void onCreate(Bundle savedInstanceState) { 34 | super.onCreate(savedInstanceState); 35 | setContentView(R.layout.activity_main); 36 | initView(); 37 | initData(); 38 | initEvent(); 39 | } 40 | 41 | private void initEvent() { 42 | expandableListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() { 43 | @Override 44 | public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) { 45 | if (mData.get(groupPosition).getList().size() != 0) { //如果有下级组 46 | ll_organization.setVisibility(View.VISIBLE); 47 | adapter.setData(mData.get(groupPosition).getList()); 48 | adapter.notifyDataSetChanged(); 49 | ll_department.addView(getTextView(mData.get(groupPosition).getName())); 50 | 51 | mData = mData.get(groupPosition).getList(); 52 | mAllDatas.add(mData); 53 | //关闭所有展开的 54 | for (int i = 0; i < mData.size(); i++) { 55 | expandableListView.collapseGroup(i); 56 | } 57 | return true; 58 | } else { 59 | //如果没有下级组 控制箭头的上 先变动 60 | mData.get(groupPosition).setIsExpand(!mData.get(groupPosition).isExpand()); 61 | adapter.notifyDataSetChanged(); 62 | return false; 63 | } 64 | } 65 | }); 66 | expandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() { 67 | @Override 68 | public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { 69 | Toast.makeText(MainActivity.this,"groupPosition: "+groupPosition+" childPosition: "+childPosition,Toast.LENGTH_SHORT).show(); 70 | return true; 71 | } 72 | }); 73 | ll_department.setOnItemClickListener(new MyLinearLayout.OnItemClickListener() { 74 | @Override 75 | public void onItemClick(int position) { 76 | if ((position + 2) < mAllDatas.size()) { 77 | ll_department.removeView(position); 78 | adapter.setData(mAllDatas.get(position + 1)); 79 | adapter.notifyDataSetChanged(); 80 | mData = mAllDatas.get(position + 1); 81 | 82 | //删除点击的地方以后的数据 83 | int count = mAllDatas.size(); 84 | int x = 0; 85 | for (int i = 0; i < count; i++) { 86 | if (i > position + 1) { 87 | mAllDatas.remove(i - x); 88 | x++; 89 | } 90 | } 91 | // 将所有的展开的关闭 92 | for (int i = 0; i < mData.size(); i++) { 93 | expandableListView.collapseGroup(i); 94 | } 95 | } 96 | } 97 | }); 98 | 99 | tv_organization.setOnClickListener(new View.OnClickListener() { 100 | @Override 101 | public void onClick(View v) { 102 | ll_department.removeAllViews(); 103 | ll_organization.setVisibility(View.GONE); 104 | adapter.setData(mAllDatas.get(0)); 105 | adapter.notifyDataSetChanged(); 106 | mData = mAllDatas.get(0); 107 | 108 | int count = mAllDatas.size(); 109 | int x = 0; 110 | //清除掉从第0个开始的以后的所有数据 111 | for (int i = 0; i < count; i++) { 112 | if (i > 0) { 113 | mAllDatas.remove(i - x); 114 | x++; 115 | } 116 | } 117 | for (int i = 0; i < mData.size(); i++) { 118 | expandableListView.collapseGroup(i); 119 | } 120 | } 121 | }); 122 | } 123 | 124 | private void initData() { 125 | // String json = getString(R.string.json); 126 | String json = "{\"returncode\":0,\"data\":[{\"id\":\"2\",\"sort\":\"0\",\"pid\":\"0\",\"ppath\":\"-2-\",\"name\":\"总部组\",\"is_show\":\"1\",\"del_user\":\"0\",\"del_time\":\"0\",\"del_state\":\"1\",\"user_list\":[{\"id\":\"1\",\"shops_id\":\"4\",\"user_id\":\"2\",\"out_userid\":\"2\",\"directory_id\":\"2\",\"name\":\"张老大\",\"name_short\":\"yjt\",\"role_name\":\"管理员\",\"role_id\":\"1\",\"head\":\"http:\\/\\/api.51bxt.com\\/file\\/4\\/head\\/2.jpg\",\"email\":\"\",\"subgroup\":\"3\",\"subgroup_name\":\"\",\"gender\":\"1\",\"mobile\":\"1234\",\"del_state\":\"1\",\"del_user\":\"0\",\"del_time\":\"0\"}],\"list\":[]},{\"id\":\"3\",\"sort\":\"0\",\"pid\":\"0\",\"ppath\":\"-3-\",\"name\":\"第一级\",\"is_show\":\"1\",\"del_user\":\"0\",\"del_time\":\"0\",\"del_state\":\"1\",\"user_list\":[{\"id\":\"7\",\"shops_id\":\"4\",\"user_id\":\"15\",\"out_userid\":\"62\",\"directory_id\":\"3\",\"name\":\"小海\",\"name_short\":\"xh\",\"role_name\":\"维修员\",\"role_id\":\"2\",\"head\":\"http:\\/\\/api.51bxt.com\\/file\\/4\\/head\\/62.jpg\",\"email\":\"\",\"subgroup\":\"22172\",\"subgroup_name\":\"暖通组\",\"gender\":\"1\",\"mobile\":\"1234\",\"del_state\":\"1\",\"del_user\":\"0\",\"del_time\":\"0\"},{\"id\":\"18\",\"shops_id\":\"4\",\"user_id\":\"35\",\"out_userid\":\"101\",\"directory_id\":\"3\",\"name\":\"追梦\",\"name_short\":\"zm\",\"role_name\":\"运营部报修\",\"role_id\":\"5\",\"head\":\"http:\\/\\/api.51bxt.com\\/file\\/4\\/head\\/101.jpg\",\"email\":\"\",\"subgroup\":\"0\",\"subgroup_name\":\"\",\"gender\":\"1\",\"mobile\":\"1234\",\"del_state\":\"1\",\"del_user\":\"0\",\"del_time\":\"0\"}],\"list\":[{\"id\":\"9\",\"sort\":\"0\",\"pid\":\"3\",\"ppath\":\"-3-9-\",\"name\":\"第二级\",\"is_show\":\"1\",\"del_user\":\"0\",\"del_time\":\"0\",\"del_state\":\"1\",\"user_list\":[{\"id\":\"5\",\"shops_id\":\"4\",\"user_id\":\"7\",\"out_userid\":\"48\",\"directory_id\":\"9\",\"name\":\"哈来\",\"name_short\":\"yl\",\"role_name\":\"维修员\",\"role_id\":\"2\",\"head\":\"\",\"email\":\"\",\"subgroup\":\"22173\",\"subgroup_name\":\"保洁组\",\"gender\":\"1\",\"mobile\":\"18210829859\",\"del_state\":\"1\",\"del_user\":\"0\",\"del_time\":\"0\"},{\"id\":\"4\",\"shops_id\":\"4\",\"user_id\":\"6\",\"out_userid\":\"66\",\"directory_id\":\"9\",\"name\":\"王老扬\",\"name_short\":\"gly\",\"role_name\":\"维修员\",\"role_id\":\"2\",\"head\":\"http:\\/\\/api.51bxt.com\\/file\\/4\\/head\\/66.jpg\",\"email\":\"\",\"subgroup\":\"22170\",\"subgroup_name\":\"特种设备组\",\"gender\":\"1\",\"mobile\":\"1234\",\"del_state\":\"1\",\"del_user\":\"0\",\"del_time\":\"0\"}],\"list\":[{\"id\":\"13\",\"sort\":\"0\",\"pid\":\"9\",\"ppath\":\"-3-9-13-\",\"name\":\"第三级1\",\"is_show\":\"1\",\"del_user\":\"0\",\"del_time\":\"0\",\"del_state\":\"1\",\"user_list\":[{\"id\":\"15\",\"shops_id\":\"4\",\"user_id\":\"34\",\"out_userid\":\"99\",\"directory_id\":\"13\",\"name\":\"老高\",\"name_short\":\"lg\",\"role_name\":\"维修员\",\"role_id\":\"2\",\"head\":\"\",\"email\":\"\",\"subgroup\":\"22172\",\"subgroup_name\":\"暖通组\",\"gender\":\"1\",\"mobile\":\"43562\",\"del_state\":\"1\",\"del_user\":\"0\",\"del_time\":\"0\"}],\"list\":[{\"id\":\"14\",\"sort\":\"0\",\"pid\":\"13\",\"ppath\":\"-3-9-13-14-\",\"name\":\"第四层1\",\"is_show\":\"1\",\"del_user\":\"0\",\"del_time\":\"0\",\"del_state\":\"1\",\"user_list\":[{\"id\":\"14\",\"shops_id\":\"4\",\"user_id\":\"33\",\"out_userid\":\"96\",\"directory_id\":\"14\",\"name\":\"巴恩斯\",\"name_short\":\"bes\",\"role_name\":\"维修员\",\"role_id\":\"2\",\"head\":\"http:\\/\\/api.51bxt.com\\/file\\/4\\/head\\/96.jpg\",\"email\":\"\",\"subgroup\":\"22173\",\"subgroup_name\":\"保洁组\",\"gender\":\"1\",\"mobile\":\"34567\",\"del_state\":\"1\",\"del_user\":\"0\",\"del_time\":\"0\"}],\"list\":[]}]}]},{\"id\":\"10\",\"sort\":\"0\",\"pid\":\"3\",\"ppath\":\"-3-10-\",\"name\":\"第二级\",\"is_show\":\"1\",\"del_user\":\"0\",\"del_time\":\"0\",\"del_state\":\"1\",\"user_list\":[{\"id\":\"8\",\"shops_id\":\"4\",\"user_id\":\"20\",\"out_userid\":\"87\",\"directory_id\":\"10\",\"name\":\"伊戈达拉\",\"name_short\":\"ygdl\",\"role_name\":\"维修员\",\"role_id\":\"2\",\"head\":\"http:\\/\\/api.51bxt.com\\/file\\/4\\/head\\/87.jpg\",\"email\":\"\",\"subgroup\":\"22171\",\"subgroup_name\":\"综修组\",\"gender\":\"1\",\"mobile\":\"5477436\",\"del_state\":\"1\",\"del_user\":\"0\",\"del_time\":\"0\"},{\"id\":\"9\",\"shops_id\":\"4\",\"user_id\":\"16\",\"out_userid\":\"80\",\"directory_id\":\"10\",\"name\":\"枫叶\",\"name_short\":\"fy\",\"role_name\":\"维修员\",\"role_id\":\"2\",\"head\":\"\",\"email\":\"\",\"subgroup\":\"22172\",\"subgroup_name\":\"暖通组\",\"gender\":\"1\",\"mobile\":\"3542256\",\"del_state\":\"1\",\"del_user\":\"0\",\"del_time\":\"0\"}],\"list\":[]}]},{\"id\":\"8\",\"sort\":\"0\",\"pid\":\"0\",\"ppath\":\"-8-\",\"name\":\"第一级\",\"is_show\":\"1\",\"del_user\":\"0\",\"del_time\":\"0\",\"del_state\":\"1\",\"user_list\":[{\"id\":\"6\",\"shops_id\":\"4\",\"user_id\":\"13\",\"out_userid\":\"83\",\"directory_id\":\"8\",\"name\":\"送老二员\",\"name_short\":\"mwxy\",\"role_name\":\"维修员\",\"role_id\":\"2\",\"head\":\"http:\\/\\/api.51bxt.com\\/file\\/4\\/head\\/83.jpg\",\"email\":\"\",\"subgroup\":\"22170\",\"subgroup_name\":\"特种设备组\",\"gender\":\"1\",\"mobile\":\"18583875010\",\"del_state\":\"1\",\"del_user\":\"0\",\"del_time\":\"0\"}],\"list\":[{\"id\":\"11\",\"sort\":\"0\",\"pid\":\"8\",\"ppath\":\"-8-11-\",\"name\":\"第二级\",\"is_show\":\"1\",\"del_user\":\"0\",\"del_time\":\"0\",\"del_state\":\"1\",\"user_list\":[{\"id\":\"10\",\"shops_id\":\"4\",\"user_id\":\"27\",\"out_userid\":\"92\",\"directory_id\":\"11\",\"name\":\"李老三\",\"name_short\":\"yxg\",\"role_name\":\"运营部报修\",\"role_id\":\"5\",\"head\":\"http:\\/\\/api.51bxt.com\\/file\\/4\\/head\\/92.jpg\",\"email\":\"\",\"subgroup\":\"0\",\"subgroup_name\":\"\",\"gender\":\"1\",\"mobile\":\"214534\",\"del_state\":\"1\",\"del_user\":\"0\",\"del_time\":\"0\"},{\"id\":\"11\",\"shops_id\":\"4\",\"user_id\":\"25\",\"out_userid\":\"91\",\"directory_id\":\"11\",\"name\":\"大S\",\"name_short\":\"dS\",\"role_name\":\"维修员\",\"role_id\":\"2\",\"head\":\"\",\"email\":\"\",\"subgroup\":\"22170\",\"subgroup_name\":\"特种设备组\",\"gender\":\"1\",\"mobile\":\"134214\",\"del_state\":\"1\",\"del_user\":\"0\",\"del_time\":\"0\"}],\"list\":[]},{\"id\":\"12\",\"sort\":\"0\",\"pid\":\"8\",\"ppath\":\"-8-12-\",\"name\":\"第二级\",\"is_show\":\"1\",\"del_user\":\"0\",\"del_time\":\"0\",\"del_state\":\"1\",\"user_list\":[{\"id\":\"12\",\"shops_id\":\"4\",\"user_id\":\"26\",\"out_userid\":\"53\",\"directory_id\":\"12\",\"name\":\"小丸子\",\"name_short\":\"c\",\"role_name\":\"运营部报修\",\"role_id\":\"5\",\"head\":\"\",\"email\":\"\",\"subgroup\":\"0\",\"subgroup_name\":\"\",\"gender\":\"1\",\"mobile\":\"2345334\",\"del_state\":\"1\",\"del_user\":\"0\",\"del_time\":\"0\"},{\"id\":\"13\",\"shops_id\":\"4\",\"user_id\":\"28\",\"out_userid\":\"27\",\"directory_id\":\"12\",\"name\":\"测试\",\"name_short\":\"cs\",\"role_name\":\"运营部报修\",\"role_id\":\"5\",\"head\":\"http:\\/\\/api.51bxt.com\\/file\\/4\\/head\\/27.jpg\",\"email\":\"\",\"subgroup\":\"0\",\"subgroup_name\":\"\",\"gender\":\"1\",\"mobile\":\"23454523\",\"del_state\":\"1\",\"del_user\":\"0\",\"del_time\":\"0\"}],\"list\":[]}]}]}"; 127 | Gson gson = new Gson(); 128 | MyEntity entity = gson.fromJson(json,MyEntity.class); 129 | mData = entity.getData();//最外层的数据 130 | mAllDatas.add(mData);//将数据放入到总的存贮数据的list中 131 | adapter = new MyAdapter(this, entity.getData()); 132 | expandableListView.setAdapter(adapter); 133 | expandableListView.setGroupIndicator(null); 134 | } 135 | 136 | private void initView() { 137 | expandableListView = (ExpandableListView) findViewById(R.id.expendable_list); 138 | ll_department = (MyLinearLayout) findViewById(R.id.ll_department); 139 | ll_organization = (LinearLayout) findViewById(R.id.ll_organization); 140 | tv_organization = (TextView) findViewById(R.id.tv_organization); 141 | } 142 | private TextView getTextView(String title) { 143 | TextView textView = new TextView(this); 144 | ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); 145 | textView.setPadding(40, 20, 20, 20); 146 | textView.setText(title); 147 | textView.setTextSize(17); 148 | textView.setLayoutParams(params); 149 | textView.setGravity(Gravity.CENTER); 150 | return textView; 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /app/src/main/java/com/chs/organizationlevel/adapter/MyAdapter.java: -------------------------------------------------------------------------------- 1 | package com.chs.organizationlevel.adapter; 2 | 3 | import android.content.Context; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.BaseExpandableListAdapter; 8 | import android.widget.ImageView; 9 | import android.widget.TextView; 10 | 11 | import com.chs.organizationlevel.R; 12 | import com.chs.organizationlevel.bean.MyEntity; 13 | 14 | import java.util.List; 15 | 16 | /** 17 | * 作者:chs on 2015/12/31 11:32 18 | * 邮箱:657083984@qq.com 19 | * 通讯录的适配器 20 | */ 21 | public class MyAdapter extends BaseExpandableListAdapter { 22 | private Context mContext; 23 | private List mGroupData; 24 | private LayoutInflater inflater; 25 | 26 | public MyAdapter(Context context, List groupData) { 27 | this.mContext = context; 28 | this.mGroupData = groupData; 29 | this.inflater = LayoutInflater.from(context); 30 | } 31 | 32 | public void setData(List data) { 33 | if (data != null && data.size() > 0) { 34 | this.mGroupData = data; 35 | } 36 | } 37 | 38 | @Override 39 | public int getGroupCount() { 40 | return mGroupData.size(); 41 | } 42 | 43 | @Override 44 | public int getChildrenCount(int groupPosition) { 45 | return mGroupData.get(groupPosition).getUser_list().size(); 46 | } 47 | 48 | @Override 49 | public Object getGroup(int groupPosition) { 50 | return mGroupData.get(groupPosition); 51 | } 52 | 53 | @Override 54 | public Object getChild(int groupPosition, int childPosition) { 55 | return mGroupData.get(groupPosition).getUser_list().get(childPosition); 56 | } 57 | 58 | @Override 59 | public long getGroupId(int groupPosition) { 60 | return groupPosition; 61 | } 62 | 63 | @Override 64 | public long getChildId(int groupPosition, int childPosition) { 65 | return childPosition; 66 | } 67 | 68 | @Override 69 | public boolean hasStableIds() { 70 | return false; 71 | } 72 | 73 | @Override 74 | public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { 75 | GroupHolder groupHolder = null; 76 | if (convertView == null) { 77 | groupHolder = new GroupHolder(); 78 | convertView = inflater.inflate(R.layout.item_expandable_parent, null); 79 | groupHolder.iv_arrow = (ImageView) convertView.findViewById(R.id.iv_arrow); 80 | groupHolder.tv_department = (TextView) convertView.findViewById(R.id.tv_department); 81 | groupHolder.tv_department_num = (TextView) convertView.findViewById(R.id.tv_department_num); 82 | convertView.setTag(groupHolder); 83 | } else { 84 | groupHolder = (GroupHolder) convertView.getTag(); 85 | } 86 | groupHolder.tv_department.setText(mGroupData.get(groupPosition).getName()); 87 | int userCount = mGroupData.get(groupPosition).getUser_list().size(); 88 | // int groupCount = mGroupData.get(groupPosition).getList().size(); 89 | groupHolder.tv_department_num.setText("(" + userCount + ")"); 90 | if (mGroupData.get(groupPosition).isExpand()) { 91 | groupHolder.iv_arrow.setImageResource(R.mipmap.arrow_up); 92 | } else { 93 | groupHolder.iv_arrow.setImageResource(R.mipmap.arrow_down); 94 | } 95 | return convertView; 96 | } 97 | 98 | 99 | @Override 100 | public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { 101 | ChildHolder childHolder = null; 102 | if (convertView == null) { 103 | childHolder = new ChildHolder(); 104 | convertView = inflater.inflate(R.layout.item_expandable_child, null); 105 | childHolder.iv_dead_img = (ImageView) convertView.findViewById(R.id.iv_head_img); 106 | childHolder.tv_name = (TextView) convertView.findViewById(R.id.tv_name); 107 | childHolder.tv_position = (TextView) convertView.findViewById(R.id.tv_position); 108 | convertView.setTag(childHolder); 109 | } else { 110 | childHolder = (ChildHolder) convertView.getTag(); 111 | } 112 | final MyEntity.DataEntity.UserListEntity entity = mGroupData.get(groupPosition).getUser_list().get(childPosition); 113 | return convertView; 114 | } 115 | 116 | @Override 117 | public boolean isChildSelectable(int groupPosition, int childPosition) { 118 | return true; 119 | } 120 | 121 | class GroupHolder { 122 | public TextView tv_department; 123 | public TextView tv_department_num; 124 | private ImageView iv_arrow; 125 | } 126 | 127 | class ChildHolder { 128 | public ImageView iv_dead_img; 129 | public TextView tv_name; 130 | public TextView tv_position; 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /app/src/main/java/com/chs/organizationlevel/bean/MyEntity.java: -------------------------------------------------------------------------------- 1 | package com.chs.organizationlevel.bean; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * 作者:chs on 2015/12/31 11:50 7 | * 邮箱:657083984@qq.com 8 | */ 9 | public class MyEntity { 10 | 11 | 12 | private int returncode; 13 | 14 | private List data; 15 | 16 | public void setReturncode(int returncode) { 17 | this.returncode = returncode; 18 | } 19 | 20 | public void setData(List data) { 21 | this.data = data; 22 | } 23 | 24 | public int getReturncode() { 25 | return returncode; 26 | } 27 | 28 | public List getData() { 29 | return data; 30 | } 31 | 32 | public static class DataEntity { 33 | private String id; 34 | private String sort; 35 | private String pid; 36 | private String ppath; 37 | private String name; 38 | private String is_show; 39 | private String del_user; 40 | private String del_time; 41 | private String del_state; 42 | private boolean isExpand = false; 43 | 44 | public boolean isExpand() { 45 | return isExpand; 46 | } 47 | 48 | public void setIsExpand(boolean isExpand) { 49 | this.isExpand = isExpand; 50 | } 51 | 52 | private List user_list; 53 | private List list; 54 | 55 | public void setId(String id) { 56 | this.id = id; 57 | } 58 | 59 | public void setSort(String sort) { 60 | this.sort = sort; 61 | } 62 | 63 | public void setPid(String pid) { 64 | this.pid = pid; 65 | } 66 | 67 | public void setPpath(String ppath) { 68 | this.ppath = ppath; 69 | } 70 | 71 | public void setName(String name) { 72 | this.name = name; 73 | } 74 | 75 | public void setIs_show(String is_show) { 76 | this.is_show = is_show; 77 | } 78 | 79 | public void setDel_user(String del_user) { 80 | this.del_user = del_user; 81 | } 82 | 83 | public void setDel_time(String del_time) { 84 | this.del_time = del_time; 85 | } 86 | 87 | public void setDel_state(String del_state) { 88 | this.del_state = del_state; 89 | } 90 | 91 | public void setUser_list(List user_list) { 92 | this.user_list = user_list; 93 | } 94 | 95 | public void setList(List list) { 96 | this.list = list; 97 | } 98 | 99 | public String getId() { 100 | return id; 101 | } 102 | 103 | public String getSort() { 104 | return sort; 105 | } 106 | 107 | public String getPid() { 108 | return pid; 109 | } 110 | 111 | public String getPpath() { 112 | return ppath; 113 | } 114 | 115 | public String getName() { 116 | return name; 117 | } 118 | 119 | public String getIs_show() { 120 | return is_show; 121 | } 122 | 123 | public String getDel_user() { 124 | return del_user; 125 | } 126 | 127 | public String getDel_time() { 128 | return del_time; 129 | } 130 | 131 | public String getDel_state() { 132 | return del_state; 133 | } 134 | 135 | public List getUser_list() { 136 | return user_list; 137 | } 138 | 139 | public List getList() { 140 | return list; 141 | } 142 | 143 | public static class UserListEntity { 144 | private String id; 145 | private String user_id; 146 | private String shops_id; 147 | private String out_userid; 148 | private String directory_id; 149 | private String name; 150 | private String role_name; 151 | private String role_id; 152 | private String head; 153 | private Object email; 154 | private String subgroup; 155 | private Object subgroup_name; 156 | private String gender; 157 | private String mobile; 158 | private String del_state; 159 | private String del_user; 160 | private String del_time; 161 | 162 | public void setId(String id) { 163 | this.id = id; 164 | } 165 | 166 | public String getUser_id() { 167 | return user_id; 168 | } 169 | 170 | public void setUser_id(String user_id) { 171 | this.user_id = user_id; 172 | } 173 | 174 | public void setShops_id(String shops_id) { 175 | this.shops_id = shops_id; 176 | } 177 | 178 | public void setOut_userid(String out_userid) { 179 | this.out_userid = out_userid; 180 | } 181 | 182 | public void setDirectory_id(String directory_id) { 183 | this.directory_id = directory_id; 184 | } 185 | 186 | public void setName(String name) { 187 | this.name = name; 188 | } 189 | 190 | public void setRole_name(String role_name) { 191 | this.role_name = role_name; 192 | } 193 | 194 | public void setRole_id(String role_id) { 195 | this.role_id = role_id; 196 | } 197 | 198 | public void setHead(String head) { 199 | this.head = head; 200 | } 201 | 202 | public void setEmail(Object email) { 203 | this.email = email; 204 | } 205 | 206 | public void setSubgroup(String subgroup) { 207 | this.subgroup = subgroup; 208 | } 209 | 210 | public void setSubgroup_name(Object subgroup_name) { 211 | this.subgroup_name = subgroup_name; 212 | } 213 | 214 | public void setGender(String gender) { 215 | this.gender = gender; 216 | } 217 | 218 | public void setMobile(String mobile) { 219 | this.mobile = mobile; 220 | } 221 | 222 | public void setDel_state(String del_state) { 223 | this.del_state = del_state; 224 | } 225 | 226 | public void setDel_user(String del_user) { 227 | this.del_user = del_user; 228 | } 229 | 230 | public void setDel_time(String del_time) { 231 | this.del_time = del_time; 232 | } 233 | 234 | public String getId() { 235 | return id; 236 | } 237 | 238 | public String getShops_id() { 239 | return shops_id; 240 | } 241 | 242 | public String getOut_userid() { 243 | return out_userid; 244 | } 245 | 246 | public String getDirectory_id() { 247 | return directory_id; 248 | } 249 | 250 | public String getName() { 251 | return name; 252 | } 253 | 254 | public String getRole_name() { 255 | return role_name; 256 | } 257 | 258 | public String getRole_id() { 259 | return role_id; 260 | } 261 | 262 | public String getHead() { 263 | return head; 264 | } 265 | 266 | public Object getEmail() { 267 | return email; 268 | } 269 | 270 | public String getSubgroup() { 271 | return subgroup; 272 | } 273 | 274 | public Object getSubgroup_name() { 275 | return subgroup_name; 276 | } 277 | 278 | public String getGender() { 279 | return gender; 280 | } 281 | 282 | public String getMobile() { 283 | return mobile; 284 | } 285 | 286 | public String getDel_state() { 287 | return del_state; 288 | } 289 | 290 | public String getDel_user() { 291 | return del_user; 292 | } 293 | 294 | public String getDel_time() { 295 | return del_time; 296 | } 297 | } 298 | } 299 | } 300 | -------------------------------------------------------------------------------- /app/src/main/java/com/chs/organizationlevel/wedgit/MyLinearLayout.java: -------------------------------------------------------------------------------- 1 | package com.chs.organizationlevel.wedgit; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.View; 6 | import android.widget.LinearLayout; 7 | 8 | import com.chs.organizationlevel.R; 9 | 10 | /** 11 | * 作者:chs on 2015/12/31 15:24 12 | * 邮箱:657083984@qq.com 13 | */ 14 | public class MyLinearLayout extends LinearLayout { 15 | private Context mContext; 16 | private OnItemClickListener onItemClickListener; 17 | public MyLinearLayout(Context context) { 18 | super(context); 19 | mContext = context; 20 | } 21 | 22 | public MyLinearLayout(Context context, AttributeSet attrs) { 23 | super(context, attrs); 24 | mContext = context; 25 | } 26 | public interface OnItemClickListener{ 27 | void onItemClick(int position); 28 | } 29 | 30 | public void setOnItemClickListener(OnItemClickListener onItemClickListener) { 31 | this.onItemClickListener = onItemClickListener; 32 | } 33 | 34 | @Override 35 | protected void onLayout(boolean changed, int l, int t, int r, int b) { 36 | super.onLayout(changed, l, t, r, b); 37 | final int count = getChildCount(); 38 | for(int i = 0;i0){ 41 | LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.MATCH_PARENT); 42 | layoutParams.setMargins(-40, 0, 0, 0); 43 | view.setLayoutParams(layoutParams); 44 | } 45 | if((count-i)==1){ 46 | view.setBackgroundResource(R.mipmap.organization_bg_blue); 47 | }else { 48 | view.setBackgroundResource(R.mipmap.organization_bg_gray); 49 | } 50 | final int finalI = i; 51 | view.setOnClickListener(new OnClickListener() { 52 | @Override 53 | public void onClick(View v) { 54 | if(count>1&&(count-finalI)!=1){ 55 | onItemClickListener.onItemClick(finalI); 56 | } 57 | } 58 | }); 59 | } 60 | } 61 | public void removeView(int position){ 62 | int count = getChildCount(); 63 | int x = 0; 64 | for(int i = 0;iposition){ 67 | view = getChildAt(i-x); 68 | removeView(view); 69 | x++; 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 13 | 14 | 27 | 28 | 32 | 33 | 37 | 38 | 39 | 43 | 44 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_expandable_child.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 19 | 29 | 39 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_expandable_parent.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 18 | 28 | 36 | 37 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chsmy/OrganizationLevel/ade7d61ed1cf19d20779444f906f0737d553d57f/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chsmy/OrganizationLevel/ade7d61ed1cf19d20779444f906f0737d553d57f/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chsmy/OrganizationLevel/ade7d61ed1cf19d20779444f906f0737d553d57f/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/arrow_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chsmy/OrganizationLevel/ade7d61ed1cf19d20779444f906f0737d553d57f/app/src/main/res/mipmap-xxhdpi/arrow_down.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/arrow_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chsmy/OrganizationLevel/ade7d61ed1cf19d20779444f906f0737d553d57f/app/src/main/res/mipmap-xxhdpi/arrow_up.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chsmy/OrganizationLevel/ade7d61ed1cf19d20779444f906f0737d553d57f/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/organization_bg_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chsmy/OrganizationLevel/ade7d61ed1cf19d20779444f906f0737d553d57f/app/src/main/res/mipmap-xxhdpi/organization_bg_blue.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/organization_bg_gray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chsmy/OrganizationLevel/ade7d61ed1cf19d20779444f906f0737d553d57f/app/src/main/res/mipmap-xxhdpi/organization_bg_gray.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/organization_bg_yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chsmy/OrganizationLevel/ade7d61ed1cf19d20779444f906f0737d553d57f/app/src/main/res/mipmap-xxhdpi/organization_bg_yellow.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/photo_default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chsmy/OrganizationLevel/ade7d61ed1cf19d20779444f906f0737d553d57f/app/src/main/res/mipmap-xxhdpi/photo_default.png -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | #919191 8 | #000000 9 | #ffffffff 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | OrganizationLevel 3 | {"returncode":0,"data":[{"id":"2","sort":"0","pid":"0","ppath":"-2-","name":"总部组","is_show":"1","del_user":"0","del_time":"0","del_state":"1","user_list":[{"id":"1","shops_id":"4","user_id":"2","out_userid":"2","directory_id":"2","name":"张老大","name_short":"yjt","role_name":"管理员","role_id":"1","head":"http:\/\/api.51bxt.com\/file\/4\/head\/2.jpg","email":"","subgroup":"3","subgroup_name":"","gender":"1","mobile":"1234","del_state":"1","del_user":"0","del_time":"0"}],"list":[]},{"id":"3","sort":"0","pid":"0","ppath":"-3-","name":"第一级","is_show":"1","del_user":"0","del_time":"0","del_state":"1","user_list":[{"id":"7","shops_id":"4","user_id":"15","out_userid":"62","directory_id":"3","name":"小海","name_short":"xh","role_name":"维修员","role_id":"2","head":"http:\/\/api.51bxt.com\/file\/4\/head\/62.jpg","email":"","subgroup":"22172","subgroup_name":"暖通组","gender":"1","mobile":"1234","del_state":"1","del_user":"0","del_time":"0"},{"id":"18","shops_id":"4","user_id":"35","out_userid":"101","directory_id":"3","name":"追梦","name_short":"zm","role_name":"运营部报修","role_id":"5","head":"http:\/\/api.51bxt.com\/file\/4\/head\/101.jpg","email":"","subgroup":"0","subgroup_name":"","gender":"1","mobile":"1234","del_state":"1","del_user":"0","del_time":"0"}],"list":[{"id":"9","sort":"0","pid":"3","ppath":"-3-9-","name":"第二级","is_show":"1","del_user":"0","del_time":"0","del_state":"1","user_list":[{"id":"5","shops_id":"4","user_id":"7","out_userid":"48","directory_id":"9","name":"哈来","name_short":"yl","role_name":"维修员","role_id":"2","head":"","email":"","subgroup":"22173","subgroup_name":"保洁组","gender":"1","mobile":"18210829859","del_state":"1","del_user":"0","del_time":"0"},{"id":"4","shops_id":"4","user_id":"6","out_userid":"66","directory_id":"9","name":"王老扬","name_short":"gly","role_name":"维修员","role_id":"2","head":"http:\/\/api.51bxt.com\/file\/4\/head\/66.jpg","email":"","subgroup":"22170","subgroup_name":"特种设备组","gender":"1","mobile":"1234","del_state":"1","del_user":"0","del_time":"0"}],"list":[{"id":"13","sort":"0","pid":"9","ppath":"-3-9-13-","name":"第三级1","is_show":"1","del_user":"0","del_time":"0","del_state":"1","user_list":[{"id":"15","shops_id":"4","user_id":"34","out_userid":"99","directory_id":"13","name":"老高","name_short":"lg","role_name":"维修员","role_id":"2","head":"","email":"","subgroup":"22172","subgroup_name":"暖通组","gender":"1","mobile":"43562","del_state":"1","del_user":"0","del_time":"0"}],"list":[{"id":"14","sort":"0","pid":"13","ppath":"-3-9-13-14-","name":"第四层1","is_show":"1","del_user":"0","del_time":"0","del_state":"1","user_list":[{"id":"14","shops_id":"4","user_id":"33","out_userid":"96","directory_id":"14","name":"巴恩斯","name_short":"bes","role_name":"维修员","role_id":"2","head":"http:\/\/api.51bxt.com\/file\/4\/head\/96.jpg","email":"","subgroup":"22173","subgroup_name":"保洁组","gender":"1","mobile":"34567","del_state":"1","del_user":"0","del_time":"0"}],"list":[]}]}]},{"id":"10","sort":"0","pid":"3","ppath":"-3-10-","name":"第二级","is_show":"1","del_user":"0","del_time":"0","del_state":"1","user_list":[{"id":"8","shops_id":"4","user_id":"20","out_userid":"87","directory_id":"10","name":"伊戈达拉","name_short":"ygdl","role_name":"维修员","role_id":"2","head":"http:\/\/api.51bxt.com\/file\/4\/head\/87.jpg","email":"","subgroup":"22171","subgroup_name":"综修组","gender":"1","mobile":"5477436","del_state":"1","del_user":"0","del_time":"0"},{"id":"9","shops_id":"4","user_id":"16","out_userid":"80","directory_id":"10","name":"枫叶","name_short":"fy","role_name":"维修员","role_id":"2","head":"","email":"","subgroup":"22172","subgroup_name":"暖通组","gender":"1","mobile":"3542256","del_state":"1","del_user":"0","del_time":"0"}],"list":[]}]},{"id":"8","sort":"0","pid":"0","ppath":"-8-","name":"第一级","is_show":"1","del_user":"0","del_time":"0","del_state":"1","user_list":[{"id":"6","shops_id":"4","user_id":"13","out_userid":"83","directory_id":"8","name":"送老二员","name_short":"mwxy","role_name":"维修员","role_id":"2","head":"http:\/\/api.51bxt.com\/file\/4\/head\/83.jpg","email":"","subgroup":"22170","subgroup_name":"特种设备组","gender":"1","mobile":"18583875010","del_state":"1","del_user":"0","del_time":"0"}],"list":[{"id":"11","sort":"0","pid":"8","ppath":"-8-11-","name":"第二级","is_show":"1","del_user":"0","del_time":"0","del_state":"1","user_list":[{"id":"10","shops_id":"4","user_id":"27","out_userid":"92","directory_id":"11","name":"李老三","name_short":"yxg","role_name":"运营部报修","role_id":"5","head":"http:\/\/api.51bxt.com\/file\/4\/head\/92.jpg","email":"","subgroup":"0","subgroup_name":"","gender":"1","mobile":"214534","del_state":"1","del_user":"0","del_time":"0"},{"id":"11","shops_id":"4","user_id":"25","out_userid":"91","directory_id":"11","name":"大S","name_short":"dS","role_name":"维修员","role_id":"2","head":"","email":"","subgroup":"22170","subgroup_name":"特种设备组","gender":"1","mobile":"134214","del_state":"1","del_user":"0","del_time":"0"}],"list":[]},{"id":"12","sort":"0","pid":"8","ppath":"-8-12-","name":"第二级","is_show":"1","del_user":"0","del_time":"0","del_state":"1","user_list":[{"id":"12","shops_id":"4","user_id":"26","out_userid":"53","directory_id":"12","name":"小丸子","name_short":"c","role_name":"运营部报修","role_id":"5","head":"","email":"","subgroup":"0","subgroup_name":"","gender":"1","mobile":"2345334","del_state":"1","del_user":"0","del_time":"0"},{"id":"13","shops_id":"4","user_id":"28","out_userid":"27","directory_id":"12","name":"测试","name_short":"cs","role_name":"运营部报修","role_id":"5","head":"http:\/\/api.51bxt.com\/file\/4\/head\/27.jpg","email":"","subgroup":"0","subgroup_name":"","gender":"1","mobile":"23454523","del_state":"1","del_user":"0","del_time":"0"}],"list":[]}]}]} 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/test/java/com/chs/organizationlevel/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.chs.organizationlevel; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:1.5.0' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | jcenter() 18 | } 19 | } 20 | 21 | task clean(type: Delete) { 22 | delete rootProject.buildDir 23 | } 24 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chsmy/OrganizationLevel/ade7d61ed1cf19d20779444f906f0737d553d57f/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Oct 21 11:34:03 PDT 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /org.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chsmy/OrganizationLevel/ade7d61ed1cf19d20779444f906f0737d553d57f/org.gif -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------