Commit 35be41a0 authored by Xinghaoxiang's avatar Xinghaoxiang

coding

parent ed97effc
......@@ -6,7 +6,7 @@
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:icon="@mipmap/zhiban"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
......@@ -14,7 +14,7 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<!--<category android:name="android.intent.category.LAUNCHER" />-->
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
......
......@@ -52,10 +52,29 @@ public class DutyChangePeopleAdapter extends BaseAdapter {
viewHolder = (ViewHolder) convertView.getTag();
}
viewHolder.username.setText(allPersonBeen.get(position).getUserName());
viewHolder.changePeoplePy.setText(allPersonBeen.get(position).getFirstWord());
if (position == 0) {
viewHolder.changePeoplePy.setVisibility(View.VISIBLE);
} else {
if (allPersonBeen.get(position).getFirstWord()
.equals(allPersonBeen.get(position - 1).getFirstWord())) {
allPersonBeen.get(position).setShow(false);
if (!allPersonBeen.get(position).isShow()) {
viewHolder.changePeoplePy.setVisibility(View.GONE);
} else {
viewHolder.changePeoplePy.setVisibility(View.VISIBLE);
}
}
}
return convertView;
}
static class ViewHolder {
@BindView(R.id.change_people_py)
TextView changePeoplePy;
@BindView(R.id.username)
TextView username;
......
......@@ -42,7 +42,7 @@ public class ZhibanTableAdapter extends BaseAdapter {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder = null;
if (viewHolder == null) {
if (convertView == null) {
convertView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.item_zhiban_table, parent, false);
viewHolder = new ViewHolder(convertView);
......
......@@ -12,6 +12,24 @@ public class AllPersonBean implements Comparable<AllPersonBean>{
private String userId;
private String userName;
private String namePy;
private String firstWord;
private boolean isShow = true;
public boolean isShow() {
return isShow;
}
public void setShow(boolean show) {
isShow = show;
}
public String getFirstWord() {
return firstWord;
}
public void setFirstWord(String firstWord) {
this.firstWord = firstWord;
}
public String getNamePy() {
return namePy;
......@@ -21,6 +39,7 @@ public class AllPersonBean implements Comparable<AllPersonBean>{
this.userId = userId;
this.userName = userName;
this.namePy = PinYin.getPinYin(userName);
this.firstWord = PinYin.getFirstWord(userName);
}
public String getUserId() {
......@@ -39,7 +58,6 @@ public class AllPersonBean implements Comparable<AllPersonBean>{
this.userName = userName;
}
@Override
public int compareTo(@NonNull AllPersonBean o) {
return this.getNamePy().compareTo(o.getNamePy());
......
......@@ -6,8 +6,8 @@ package cn.bsl.bxbg.zhiban.utils;
public interface Constant {
String HOST = "http://zjk.haomo-studio.com/zhangjiakouOA/";
String USER_ID = "12";
String USER_NAME = "部门负责人";
String USER_ID = "11";
String USER_NAME = "科员";
String BASE_URL="http://haomo-tech.com:8077/hbOA/";
// 获取全部人员
String URL_GET_ALL_PEOPLE1 = BASE_URL + "roleManagerController.do?method=searchDeptTree";
......
......@@ -23,4 +23,11 @@ public class PinYin {
}
return sb.toString().toLowerCase(Locale.US);
}
private static final String TAG = "PinYin";
public static String getFirstWord(String input) {
String pinYin = getPinYin(input);
char[] chars = pinYin.toCharArray();
return String.valueOf(chars[0]).toUpperCase(Locale.US);
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp">
<TextView
android:id="@+id/change_people_py"
android:layout_width="match_parent"
android:layout_height="36dp"
android:text="A"
android:gravity="center_vertical"
android:textSize="18sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="#fff"
android:padding="10dp"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/change_people"
/>
android:src="@drawable/change_people" />
<TextView
android:id="@+id/username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="张三"
android:textSize="18sp"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
/>
android:text="张三"
android:textSize="18sp" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment