|
|
@@ -62,8 +62,8 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
private Context ct;
|
|
|
private String TAG = "CompanyContactsActivity";
|
|
|
|
|
|
- public static final int LIST_LEFT_MODE = 0;
|
|
|
- public static final int LIST_RIGHT_MODE = 1;
|
|
|
+ // public static final int LIST_LEFT_MODE = 0;
|
|
|
+// public static final int LIST_RIGHT_MODE = 1;
|
|
|
//关键变量
|
|
|
public static ArrayList<String> tabTitle = new ArrayList<String>(); // 标题
|
|
|
public static Map<String, Object> keystore = new LinkedHashMap<>(); // 标题
|
|
|
@@ -217,7 +217,7 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
|
|
|
@Override
|
|
|
public void run() {
|
|
|
- hscrollview.smoothScrollTo(500, 0);
|
|
|
+ hscrollview.smoothScrollTo(5500, 0);
|
|
|
}
|
|
|
}, 10);
|
|
|
// 解析同时有联系人和部门的数据
|
|
|
@@ -229,17 +229,29 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
"or_subof=? and whichsys=?", or_id_sqlite, master);
|
|
|
//hrorgs_left = LoadGroupData(hrorgs_left);//常用组
|
|
|
adapter = new DetailItemAdapter(ct, hrorgs_left);
|
|
|
- adapter.setMode(LIST_LEFT_MODE);
|
|
|
+ if (!StringUtils.isEmpty(next_or_id)) {
|
|
|
+ adapter.setSelectOrId(Integer.valueOf(next_or_id));
|
|
|
+ adapter.setMode(LIST_TOP_MODE);
|
|
|
+ } else {
|
|
|
+ adapter.setMode(LIST_LEFT_MODE);
|
|
|
+ }
|
|
|
|
|
|
listview.setAdapter(adapter);
|
|
|
// ViewUtil.setListViewHeightBasedOnChildren(listview);
|
|
|
// 得到左边栏数据之后,左边栏第一项,默认加载右边栏数据;
|
|
|
if (hrorgs_left.getHrorgs().size() > 0) {
|
|
|
- String or_id = String.valueOf(hrorgs_left.getHrorgs().get(0).getOr_id());
|
|
|
- String or_name = hrorgs_left.getHrorgs().get(0).getOr_name();
|
|
|
- keystore.put(or_name, or_id);
|
|
|
- tabTitle = parseHashMap(keystore, or_name);
|
|
|
- LoadLeafHrorgFromServer(or_id, LOAD_SUCCESS_LEAFHRORG_RIGHT);
|
|
|
+ if (!StringUtils.isEmpty(next_or_id)) {
|
|
|
+ keystore.put(next_or_name, next_or_id);
|
|
|
+ tabTitle = parseHashMap(keystore, next_or_name);
|
|
|
+ LoadLeafHrorgFromServer(next_or_id, LOAD_SUCCESS_LEAFHRORG_RIGHT);
|
|
|
+ } else {
|
|
|
+ //默认加载第一条数据
|
|
|
+ String or_id = String.valueOf(hrorgs_left.getHrorgs().get(0).getOr_id());
|
|
|
+ String or_name = hrorgs_left.getHrorgs().get(0).getOr_name();
|
|
|
+ keystore.put(or_name, or_id);
|
|
|
+ tabTitle = parseHashMap(keystore, or_name);
|
|
|
+ LoadLeafHrorgFromServer(or_id, LOAD_SUCCESS_LEAFHRORG_RIGHT);
|
|
|
+ }
|
|
|
} else {
|
|
|
if (madapter != null) {
|
|
|
madapter.getEmployees().clear();
|
|
|
@@ -261,7 +273,8 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
new Handler().postDelayed(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
- hscrollview.smoothScrollTo(500, 0);
|
|
|
+
|
|
|
+ hscrollview.smoothScrollTo(5500, 0);
|
|
|
}
|
|
|
}, 10);
|
|
|
//Log.i(TAG,"tabtitle:"+tabTitle.toString());
|
|
|
@@ -290,7 +303,7 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
|
|
|
@Override
|
|
|
public void run() {
|
|
|
- hscrollview.smoothScrollTo(500, 0);
|
|
|
+ hscrollview.smoothScrollTo(5500, 0);
|
|
|
}
|
|
|
}, 10);
|
|
|
master = CommonUtil.getSharedPreferences(ct, "erp_master");
|
|
|
@@ -415,7 +428,7 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
|
|
|
private String next_or_id;//记录下级标题栏的or_id 解决顶部导航栏点击选择问题
|
|
|
private String next_or_name;//记录下级标题栏的or_id 解决顶部导航栏点击选择问题
|
|
|
-
|
|
|
+
|
|
|
public void initListener() {
|
|
|
//横向导航监听
|
|
|
rg_nav_content.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
|
|
@@ -425,6 +438,26 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
RadioButton button = (RadioButton) rg_nav_content.getChildAt(checkedId);
|
|
|
String key = button.getText().toString();
|
|
|
String or_id = keystore.get(key).toString();
|
|
|
+ next_or_id = or_id;
|
|
|
+ next_or_name = key;
|
|
|
+ /**@注释:取父一级菜单 */
|
|
|
+ int parent = 0;
|
|
|
+ for (int i = 0; i < tabTitle.size(); i++) {
|
|
|
+ if (key.equals(tabTitle.get(i))) {
|
|
|
+ parent = i - 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (parent < 0) {
|
|
|
+ parent = 0;
|
|
|
+ next_or_id = null;
|
|
|
+ next_or_name = null;
|
|
|
+ }
|
|
|
+ key = tabTitle.get(parent);
|
|
|
+ or_id = keystore.get(key).toString();
|
|
|
+ /**@注释:取父一级菜单 */
|
|
|
+
|
|
|
+ Log.i(TAG, "key:" + key);
|
|
|
+ Log.i(TAG, "or_id:" + or_id);
|
|
|
tabTitle = parseHashMap(keystore, key);
|
|
|
if ("root".equals(or_id)) {
|
|
|
LoadRootHrorgFromServer();
|
|
|
@@ -432,8 +465,8 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
LoadLeafHrorgFromServer(or_id, LOAD_SUCCESS_LEAFHRORG);
|
|
|
}
|
|
|
hscrollview.smoothScrollTo(
|
|
|
- (checkedId > 1 ? rg_nav_content.getChildAt(checkedId).getLeft() : 0)
|
|
|
- - rg_nav_content.getChildAt(2).getLeft(),
|
|
|
+ (checkedId > 1 ? ((RadioButton) rg_nav_content.getChildAt(checkedId)).getLeft() : 0)
|
|
|
+ - ((RadioButton) rg_nav_content.getChildAt(2)).getLeft(),
|
|
|
0);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
@@ -447,6 +480,9 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
|
|
|
@Override
|
|
|
public void onItemClick(AdapterView<?> arg0, View view, int position, long arg3) {
|
|
|
+ if (adapter != null) {
|
|
|
+ adapter.setMode(LIST_LEFT_MODE);
|
|
|
+ }
|
|
|
DetailItemAdapter.ModelItem item = (DetailItemAdapter.ModelItem) view.getTag();
|
|
|
String or_id = String.valueOf(item.or_id); // 是叶子节点的给予提示
|
|
|
String or_name = item.tv_name.getText().toString();
|
|
|
@@ -770,6 +806,11 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public static final int LIST_LEFT_MODE = 0;
|
|
|
+ public static final int LIST_TOP_MODE = 2;
|
|
|
+ public static final int LIST_RIGHT_MODE = 1;
|
|
|
+
|
|
|
/**
|
|
|
* @注释:右边listView适配器
|
|
|
*/
|
|
|
@@ -779,6 +820,7 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
private List<Hrorgs.HrorgItem> lists;
|
|
|
private List<Hrorgs.Employee> employees;
|
|
|
private int selectPosition;
|
|
|
+ private int selectOrId;
|
|
|
private int typeMode = LIST_RIGHT_MODE;
|
|
|
|
|
|
|
|
|
@@ -835,6 +877,14 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ public int getSelectOrId() {
|
|
|
+ return selectOrId;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setSelectOrId(int selectOrId) {
|
|
|
+ this.selectOrId = selectOrId;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public long getItemId(int position) {
|
|
|
return position;
|
|
|
@@ -907,7 +957,18 @@ public class CompanyContactsActivity extends BaseActivity {
|
|
|
}
|
|
|
item.iv_enter.setVisibility(View.GONE);
|
|
|
} else {
|
|
|
- convertView.setBackgroundColor(Color.parseColor("#f3f3f3"));
|
|
|
+ if (typeMode == LIST_TOP_MODE) {
|
|
|
+ if (item.or_id == selectOrId) {
|
|
|
+ Log.i(TAG, "or_id相等。。。。");
|
|
|
+ // convertView.setBackgroundResource(R.drawable.tongcheng_all_bg01);
|
|
|
+ convertView.setBackgroundColor(Color.parseColor("#f3f3f3"));
|
|
|
+ } else {
|
|
|
+ convertView.setBackgroundColor(Color.parseColor("#ffffff"));
|
|
|
+ }
|
|
|
+ item.iv_enter.setVisibility(View.GONE);
|
|
|
+ } else {
|
|
|
+ convertView.setBackgroundColor(Color.parseColor("#FFFFFF"));
|
|
|
+ }
|
|
|
}
|
|
|
return convertView;
|
|
|
}
|