《“透视”个人大数据》项目开发小记 --(三)Android APP 开发(5)数据表多级分类及多形式显示的实践
借助Android系统UI设计的灵活性,在APP数据表应用中实现了多级分类及多形式显示,使操作应用更加流畅。这里以APP中的记事薄(NoteBook)为例,做些介绍和分享。
一,分类及显示形式
在"记事薄"中,可以设置分类,显示形式有“文字列表”,“单项图列表”及“单项图列表”。可以处理“查找”,“特别显示”的特定需求。
二,程序设计及代码
NoteBook的原始数据是用JNI使用C++保存及装入。Java界面使用Fragment,为了实现分类建立了两个Java类,一个是"NoteBookData"数据类,一个"NoteBookIndex"索引类,显示及操作通过"NoteBookAdapter"类来完成。
1), "NoteBookData"数据类
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | package com.bi3eview.newstart60.local.notebook; import android.graphics.Color; import java.io.Serializable; /** * Created by bs60 on 2022.01.31 */ public class NoteBookData implements Serializable{ public static int iselectposj = - 1 ; public static int cselColor = Color.WHITE; public static int nomoralColor = Color.BLUE; public static boolean mDataChangeblv = false ; public static int mfindItem_Passwd = - 1 ; public static int mcurAppendItemIDno = 1 ; public static byte mfindItem_kind = ' ' ; public static String mWorkDatadir = "" ; public static String mItemPicTmpfile = "" ; public static String mItemPicFilePre = "" ; public static String mItemPicFileTail = "" ; public static final int PICMARKCODE = 2216 ; public static float PICITEMSIZE = 62 ; public static final String mItemAssetPicName = "notePictureEmpty.png" ; public static final byte SELFPIC_DEFAULT = ' ' ; public static final byte SELFPIC_ASSET = 'A' ; public static final byte SELFPIC_PHOTO = 'B' ; public static byte mcurItem_Selfpic = ' ' ; // ' ':default,'A':asset,'B':photo public static int mcurItem_AssetJno = - 1 ; public static String mcurItem_PhotoFilename = "" ; public final static byte ITEMKIND_CLASS = '1' ; public final static byte ITEMKIND_DATA = 'D' ; public final static byte TITLESTATUS_OPEN = 'O' ; public final static byte TITLESTATUS_CLOSE = 'C' ; public final static int FOLDERCOLOR_DKYELLOW = 0xFF888822 ; public final static int UPDATESAVEITEMDATA = 220203 ; //... public static String msel_modelName = ""; //... public static int msel_modelKeycode = 0; public final static byte ITEMDELETE_YES = 'Y' ; public final static byte ITEMDELETE_NO = ' ' ; public final static byte ITEMPIC_YES = 'Y' ; public final static byte ITEMPIC_NO = ' ' ; public final static byte ITEMMODE_LIST = 'A' ; public final static byte ITEMMODE_IMAGE = 'B' ; public final static byte ITEMMODE_2IMAGE = 'C' ; public static byte mcurItemMode = 'A' ; public static String mcustom_RaioAll = "全部" ; public static String mcustom_Col1Name = "名称" ; public static String mcustom_Col2Note = "备注" ; public static String mkeyInfo_Title = "特别提示" ; public final static int FINDITEM_ALL = 0 ; public final static int FINDITEM_COL1NAME = 1 ; public final static int FINDITEM_COL1NOTE = 2 ; public static int mcur_findItemjno = 0 ; private String strName,strNote; private int itemIDno; private int iyear; private int ipassword; private int iassetjno; private byte bDelmark; private byte bDakind,bselfPic,curStatus; private byte month; private byte weekno; // 星期一起, 范围为0-6 private byte day,hour,min,sec; // set public NoteBookData() { strName = "" ; strNote = "" ; itemIDno = 0 ; ipassword = 0 ; iassetjno = - 1 ; bselfPic = ITEMPIC_NO; bDelmark = ITEMDELETE_NO; } // set public void setItemDateTime( int icyear, byte bmonth, byte bweekno, byte bday, byte bhour, byte bmin, byte bsec) { iyear = icyear; month = bmonth; weekno = bweekno; day = bday; hour = bhour; min = bmin; sec = bsec; } public void setByteParaItem( byte dakindb, byte selfpicb, byte status) { bDakind = dakindb; bselfPic = selfpicb; curStatus = status; } public void setItemAssetJno( int iasset) { iassetjno = iasset; } public void setItemSelfpicMark( byte cbselfpic) { bselfPic = cbselfpic; } public void setItemDeleteMark( byte bdelmark) { bDelmark = bdelmark; } public void setItemName(String cName){ strName = cName; } public void setItemNote(String sNote){ this .strNote = sNote; } public void setItemIDno( int iIDno){ itemIDno = iIDno; } public void setItemPasswd( int icpasswd){ ipassword = icpasswd; } // get public String getItemName() { return strName; } public String getItemNote(){ return strNote; } public String getItemDateTime(){ String strDateTime = String.valueOf(iyear)+ "/" +String.valueOf(month)+ "/" +String.valueOf(day)+ " " + String.valueOf(hour)+ ":" +String.valueOf(min); return strDateTime; } public int getItemIDno(){ return itemIDno; } public byte getStatus(){ return curStatus;} public byte getDatakind(){ byte bretDakind = bDakind; if (bDelmark == ITEMDELETE_YES) bretDakind = ITEMKIND_DATA; return bretDakind; } public byte getSelfpic(){ return bselfPic;} public int getDateYear(){ return iyear;} public byte getDateMonth(){ return month;} public byte getDateWeekno(){ return weekno;} public byte getDateDay(){ return day;} public byte getTimeHour(){ return hour;} public byte getTimeMinute(){ return min;} public byte getTimeSecond(){ return sec;} public void switchTitleStatus(){ if (curStatus == TITLESTATUS_OPEN){ curStatus = TITLESTATUS_CLOSE; } else { curStatus = TITLESTATUS_OPEN; }; } public String getItemStrIDno(){ String strIDno = String.valueOf(itemIDno); return strIDno; } public byte getItemDelMark(){ return bDelmark;} public int getItemPasswd(){ return ipassword; } public int getItemAssetJno() { return iassetjno; } public String getItemPicFullpathName() { String strPicName = mWorkDatadir + mItemPicFilePre + String.valueOf(itemIDno) + mItemPicFileTail; return strPicName; } } |
2), "NoteBookIndex"索引类
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | package com.bi3eview.newstart60.local.notebook; import android.graphics.Color; import java.io.Serializable; /** * Created by bs60 on 2022.01.31 */ public class NoteBookIndex implements Serializable{ public static int curSelprojno = - 1 ; public static int cselColor = Color.WHITE; public static int nomoralColor = Color.BLUE; public static int titleNormalColor = Color.BLUE; public static int titleSelColor = Color.WHITE; public static int dataNormalColor = Color.BLUE; public static int dataSelColor = Color.WHITE; public final static int ITEMSELCLICK = 1 ; public final static int ITEMSELLONGCLICK = 2 ; public final static int ITEMIMAGESELCLICK = 3 ; public final static int ITEMIMAGESELLONGCLICK = 4 ; public final static int FOLDERIMGBUT_CLICK = 101 ; public final static int FOLDERIMGBUT_LONGCLICK = 102 ; public final static String ITEMTYPE_KEYTITLE = "KeyTitle" ; public final static String ITEMTYPE_KEYDATA = "KeyData" ; public final static String ITEMTYPE_TITLE = "ItemClass" ; public final static String ITEMTYPE_DATA = "ItemData" ; public final static String ITEMTYPE_LIST = "List" ; public final static String ITEMTYPE_IMAGE = "IMAGE" ; public final static String ITEMTYPE_2IMAGE = "2IMAGE" ; public final static byte ITEMKIND_KEYINFO = '2' ; public final static byte ITEMKIND_TITLE = '1' ; public final static byte ITEMKIND_DATA = 'D' ; public final static byte ITEMKIND_FIND = 'F' ; public final static byte ITEMKIND_FINDEMPTY = ' ' ; private int itemStartjno,itemNum; private int findItemPasswd; private byte itemDakdc; private byte itemStatus; private byte findItem; private byte titleMarkb; private String type = "" ; NoteBookIndex(){ itemDakdc = ' ' ; itemStatus = ' ' ; titleMarkb = ' ' ; findItem = ' ' ; findItemPasswd = - 1 ; type = "" ; } // set public void setItemStartPosj( int iposj){ itemStartjno = iposj; } public void setFindItemPasswd( int ipasswd){ findItemPasswd = ipasswd; } public void setItemNum( int inum){ itemNum = inum; } public void setItemDataKind( byte dakdc){ itemDakdc = dakdc; } public void setFindItemMark( byte findmark){ findItem = findmark; } public void setItemStatus( byte status){ itemStatus = status; } public void setItemTitlectrl( byte bTitle){ titleMarkb = bTitle; } public void setItemType(String daType){ type = daType; } // get public int getItemStartPosj(){ return itemStartjno; } public int getItemNum(){ return itemNum; } public byte getItemDataKind(){ return itemDakdc; } public byte getItemStatus(){ return itemStatus; } public String getItemType(){ return type;} public byte getFindItemMark(){ return findItem; } public int getFindItemPasswd(){ return findItemPasswd; } } |
3), "NoteBookAdapter" 类
A), 代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 | package com.bi3eview.newstart60.local.notebook; import android.content.Context; import android.graphics.Color; import android.support.v7.widget.CardView; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.bi3eview.newstart60.local.R; import com.bumptech.glide.Glide; import com.bumptech.glide.load.engine.DiskCacheStrategy; import java.util.ArrayList; /** * Created by bs60 on 2022.01.31 */ public class NoteBookAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { public final static int PRESSITEM_SHORT = 3 ; public final static int PRESSITEM_LONG = 13 ; public final static int PRESSBUTTON_SHORT = 2 ; public final static int PRESSBUTTON_LONG = 12 ; private String color[] = { "#ddaaaa" , "#2233ff" , "#FF4081" }; private final int EMPTY_VIEW = 1 ; private final int PROGRESS_VIEW = 2 ; private final int TITLE_VIEW = 3 ; private final int DATA_VIEW = 4 ; private final int DATAVIEW_LIST = 5 ; private final int DATAVIEW_IMAGE = 6 ; private final int DATAVIEW_2IMAGE = 7 ; private final int KEYINFO_VIEW = 10 ; private final int KEYINFO_DATA = 11 ; private final int MAXJN_KEYINFOREC = 20 ; private Context mContext; public ArrayList<NoteBookData> mDaItemList; public ArrayList<NoteBookKeyInfoData> mDaKeyInfoList = null ; public ArrayList<NoteBookIndex> mDataIndexLst = null ; public ArrayList<NoteBookIndex> mDataFindLst = null ; private OnAddRemoveListener listener; private OnSelClickListener selClickLister; private boolean mfindItemblv = false ; private String strTraceInfo = "" ; public NoteBookAdapter(Context context, ArrayList<NoteBookData> dataList,ArrayList<NoteBookIndex> cIndexList,ArrayList<NoteBookIndex> cFindList, NoteBookAdapter.OnSelClickListener selLister) { this .mContext = context; this .mDaItemList = dataList; this .mDataIndexLst = cIndexList; this .mDataFindLst = cFindList; this .selClickLister = selLister; mfindItemblv = false ; strTraceInfo = "" ; } public NoteBookAdapter(Context context, ArrayList<NoteBookData> dataList,ArrayList<NoteBookIndex> cIndexList,ArrayList<NoteBookIndex> cFindList,ArrayList<NoteBookKeyInfoData> cInfoList, NoteBookAdapter.OnSelClickListener selLister) { this .mContext = context; this .mDaItemList = dataList; this .mDataIndexLst = cIndexList; this .mDataFindLst = cFindList; this .mDaKeyInfoList = cInfoList; this .selClickLister = selLister; mfindItemblv = false ; strTraceInfo = "" ; } public boolean checkGetItemIfClass( int icposj) { boolean creblv = false ; if (icposj >= 0 && icposj < mDaItemList.size()){ byte curDakind = mDaItemList.get(icposj).getDatakind(); if (curDakind == NoteBookData.ITEMKIND_CLASS) creblv = true ; } return creblv; } public int checkItemIfKeyInfo( int icposj) { int iretvcd = 0 ; if (icposj >= 0 && icposj < mDataIndexLst.size()){ String strType = mDataIndexLst.get(icposj).getItemType(); if (strType == NoteBookIndex.ITEMTYPE_KEYTITLE) iretvcd = 1 ; if (strType == NoteBookIndex.ITEMTYPE_KEYDATA) iretvcd = 2 ; } return iretvcd; } public int GetSelItemKeyposj( int icposj) { int iretvcd = - 1 ; if (icposj >= 0 && icposj < mDataIndexLst.size()){ String strType = mDataIndexLst.get(icposj).getItemType(); if (strType == NoteBookIndex.ITEMTYPE_KEYDATA){ int ikj = mDataIndexLst.get(icposj).getItemStartPosj(); if (ikj >= 0 && ikj < mDaKeyInfoList.size()){ iretvcd = mDaKeyInfoList.get(ikj).getKeyInfoItemposj(); } } } return iretvcd; } public boolean deleteSelKeyItem( int icposj) { boolean cretblv = false ; if (icposj >= 0 && icposj < mDataIndexLst.size()){ String strType = mDataIndexLst.get(icposj).getItemType(); if (strType == NoteBookIndex.ITEMTYPE_KEYDATA){ int ikj = mDataIndexLst.get(icposj).getItemStartPosj(); if (ikj >= 0 && ikj < mDaKeyInfoList.size()){ mDaKeyInfoList.remove(ikj); cretblv = true ; } } } return cretblv; } public String GetItemPictureFullname( int icposj) { String strFullname = "" ; if (icposj >= 0 && icposj < mDaItemList.size()){ byte selfpic = mDaItemList.get(icposj).getSelfpic(); if (selfpic != NoteBookData.ITEMPIC_YES){ strFullname = "file:///android_asset/" +NoteBookData.mItemAssetPicName;// "notePictureEmpty.png" ; int iassetjno = mDaItemList.get(icposj).getItemAssetJno(); if (iassetjno > 99 ) iassetjno = 99 ; if (iassetjno > 0 ){ strFullname = "file:///android_asset/" + "eventtitlepic" +String.valueOf(iassetjno)+ ".png" ; } } else { strFullname = mDaItemList.get(icposj).getItemPicFullpathName(); } } return strFullname; } public int checkGetKeyInfoItem( int itemIDno) { int iretposj = - 1 ; if (mDaKeyInfoList.size() > 0 ){ for ( int jk = 0 ;jk < mDaKeyInfoList.size();jk++){ if (mDaKeyInfoList.get(jk).getKeyInfoIDno() == itemIDno){ iretposj = jk; break ; } } } return iretposj; } public boolean appendUpdateKeyInfo( boolean clearblv, boolean appendblv, int itemIDno,String strKeyInfo) { boolean cretblv = false ; if (clearblv){ mDaKeyInfoList.clear(); if (itemIDno < 0 && strKeyInfo.length() <= 0 ) return true ; } int iappendPosj = - 1 ; if (!appendblv){ if (mDaKeyInfoList.size() > 0 ){ for ( int jk = 0 ;jk < mDaKeyInfoList.size();jk++){ if (mDaKeyInfoList.get(jk).getKeyInfoIDno() == itemIDno){ iappendPosj = jk; break ; } } }; } if (iappendPosj < 0 ){ // new append item if (mDaKeyInfoList.size() >= MAXJN_KEYINFOREC){ // first in and first out; mDaKeyInfoList.remove( 0 ); }; byte statusb = ' ' ; NoteBookKeyInfoData appendItem = new NoteBookKeyInfoData(statusb,strKeyInfo,itemIDno); mDaKeyInfoList.add(appendItem); cretblv = true ; } else { if (iappendPosj >= 0 && iappendPosj < mDaKeyInfoList.size()){ byte statusb = ' ' ; mDaKeyInfoList.get(iappendPosj).updateSetItem(statusb,strKeyInfo,itemIDno); cretblv = true ; } } return cretblv; } public String getTraceInfo() { return strTraceInfo; } public String GetKeyInfoItemNote( int itemIDno) { String strKeynote = "" ; if (mDaKeyInfoList.size() > 0 ){ for ( int jk = 0 ;jk < mDaKeyInfoList.size();jk++){ if (mDaKeyInfoList.get(jk).getKeyInfoIDno() == itemIDno){ strKeynote = mDaKeyInfoList.get(jk).getKeyInfoNote(); break ; } } } return strKeynote; } public int GetKeyInfoItemNum() { return mDaKeyInfoList.size(); } public int GetItemIDno( int icposj) { int iretIDno = - 1 ; if (icposj >= 0 && icposj < mDaItemList.size()){ iretIDno = mDaItemList.get(icposj).getItemIDno(); } return iretIDno; } public int findBuildFindItemLst(String strFindItem) { int iretjn = 0 ; mfindItemblv = false ; mDataFindLst.clear(); if (mDaItemList.size() > 0 ){ int iclassPasswd = - 1 ; for ( int j = 0 ;j < mDaItemList.size();j++){ byte curDakind = mDaItemList.get(j).getDatakind(); //... byte curStatus = mDaItemList.get(j).getStatus(); byte bDelMark = mDaItemList.get(j).getItemDelMark(); if (bDelMark == NoteBookData.ITEMDELETE_YES) continue ; if (curDakind == NoteBookData.ITEMKIND_CLASS){ iclassPasswd = mDaItemList.get(j).getItemPasswd(); continue ; } String itemName = mDaItemList.get(j).getItemName(); String itemNote = mDaItemList.get(j).getItemNote(); if (NoteBookData.mcur_findItemjno == NoteBookData.FINDITEM_COL1NAME){ if (!itemName.contains(strFindItem)) continue ; } else if (NoteBookData.mcur_findItemjno == NoteBookData.FINDITEM_COL1NOTE){ if (!itemNote.contains(strFindItem)) continue ; } else { if (itemNote.contains(strFindItem) == false && itemName.contains(strFindItem) == false ) continue ;; } int icpasswd = mDaItemList.get(j).getItemPasswd(); if (iclassPasswd > 0 && icpasswd <= 0 ) icpasswd = iclassPasswd; NoteBookIndex cDaOrder = new NoteBookIndex(); cDaOrder.setItemStartPosj(j); cDaOrder.setItemNum( 1 ); cDaOrder.setFindItemMark(NoteBookIndex.ITEMKIND_FIND); cDaOrder.setFindItemPasswd(icpasswd); cDaOrder.setItemType(NoteBookIndex.ITEMTYPE_LIST); if (NoteBookData.mcurItemMode == NoteBookData.ITEMMODE_IMAGE){ cDaOrder.setItemType(NoteBookIndex.ITEMTYPE_IMAGE); } if (NoteBookData.mcurItemMode == NoteBookData.ITEMMODE_2IMAGE){ cDaOrder.setItemType(NoteBookIndex.ITEMTYPE_IMAGE); } mDataFindLst.add(cDaOrder); iretjn++; } if (iretjn > 0 ) mfindItemblv = true ; } return iretjn; } public boolean checkResetFindItem() { boolean cretblv = false ; if (mfindItemblv == true && mDataFindLst.size() > 0 ){ cretblv = true ; } if (mDataFindLst.size() > 0 ) mDataFindLst.clear(); mfindItemblv = false ; return cretblv; } public void build_IndexItemLst() { mDataIndexLst.clear(); if (mfindItemblv == true && mDataFindLst.size() > 0 ){ for ( int j = 0 ;j < mDataFindLst.size();j++){ mDataIndexLst.add(mDataFindLst.get(j)); } } // key information if (mDaKeyInfoList.size() > 0 ){ NoteBookIndex cDaOrder = new NoteBookIndex(); cDaOrder.setItemStartPosj(- 1 ); cDaOrder.setItemNum( 1 ); cDaOrder.setItemStatus(NoteBookData.TITLESTATUS_OPEN); cDaOrder.setItemType(NoteBookIndex.ITEMTYPE_KEYTITLE); mDataIndexLst.add(cDaOrder); for ( int jk = 0 ;jk < mDaKeyInfoList.size();jk++){ if (NoteBookKeyInfoData.curFolderStatus != NoteBookKeyInfoData.FOLDERSTATUS_OPEN) break ; int ikeyIDno = mDaKeyInfoList.get(jk).getKeyInfoIDno(); if (ikeyIDno <= 0 ) continue ; int itemposj = findGetItemOnIDno(ikeyIDno); if (itemposj < 0 ) continue ; mDaKeyInfoList.get(jk).SetItemposition(itemposj); NoteBookIndex cDaOrder2 = new NoteBookIndex(); cDaOrder2.setItemStartPosj(jk); cDaOrder2.setItemNum( 1 ); cDaOrder2.setItemType(NoteBookIndex.ITEMTYPE_KEYDATA); mDataIndexLst.add(cDaOrder2); }; } // build Data List if (mDaItemList.size() > 0 ){ byte itemTitle = ' ' ; byte titleStatus = ' ' ; for ( int j = 0 ;j < mDaItemList.size();j++){ byte curDakind = mDaItemList.get(j).getDatakind(); byte curStatus = mDaItemList.get(j).getStatus(); byte bDelMark = mDaItemList.get(j).getItemDelMark(); if (bDelMark != NoteBookData.ITEMDELETE_YES) { if (curDakind == NoteBookData.ITEMKIND_CLASS) { NoteBookIndex cDaOrder = new NoteBookIndex(); cDaOrder.setItemStartPosj(j); cDaOrder.setItemNum( 1 ); cDaOrder.setItemTitlectrl(curDakind); cDaOrder.setItemStatus(curStatus); cDaOrder.setItemType(NoteBookIndex.ITEMTYPE_TITLE); itemTitle = curDakind; titleStatus = curStatus; mDataIndexLst.add(cDaOrder); continue ; } if (curDakind == NoteBookData.ITEMKIND_DATA && titleStatus == NoteBookData.TITLESTATUS_CLOSE) { continue ; } } else { if (titleStatus == NoteBookData.TITLESTATUS_CLOSE) { continue ; }; } NoteBookIndex cDaOrder = new NoteBookIndex(); cDaOrder.setItemStartPosj(j); cDaOrder.setItemNum( 1 ); if (NoteBookData.mcurItemMode == NoteBookData.ITEMMODE_2IMAGE){ int inextj = j+ 1 ; if (inextj < mDaItemList.size()) { byte ctDakind = mDaItemList.get(inextj).getDatakind(); //... byte btDelMark = mDaItemList.get(inextj).getItemDelMark(); if (ctDakind == NoteBookData.ITEMKIND_DATA){ cDaOrder.setItemNum( 2 ); j++; } } } cDaOrder.setItemType(NoteBookIndex.ITEMTYPE_LIST); if (NoteBookData.mcurItemMode == NoteBookData.ITEMMODE_IMAGE){ cDaOrder.setItemType(NoteBookIndex.ITEMTYPE_IMAGE); } if (NoteBookData.mcurItemMode == NoteBookData.ITEMMODE_2IMAGE){ cDaOrder.setItemType(NoteBookIndex.ITEMTYPE_2IMAGE); } mDataIndexLst.add(cDaOrder); } } } public int getCurIndexPosj( int itemposj, int idefaultj) { int iretposj = idefaultj; if (mDataIndexLst.size() > 0 ){ for ( int j = 0 ;j < mDataIndexLst.size();j++){ int istposj = mDataIndexLst.get(j).getItemStartPosj(); if (istposj != itemposj) continue ; iretposj = j; break ; } } return iretposj; } private int findGetItemOnIDno( int icIDno) { int iretposj = - 1 ; for ( int j = 0 ;j < mDaItemList.size();j++) { byte curDakind = mDaItemList.get(j).getDatakind(); byte curStatus = mDaItemList.get(j).getStatus(); byte bDelMark = mDaItemList.get(j).getItemDelMark(); if (bDelMark == NoteBookData.ITEMDELETE_YES) continue ; if (curDakind != NoteBookData.ITEMKIND_DATA) continue ; int itemIDno = mDaItemList.get(j).getItemIDno(); if (itemIDno == icIDno){ iretposj = j; break ; } } return iretposj; } private boolean commonFolderButtonOper( int iposj) { boolean cretblv = false ; if (iposj >= 0 && iposj < mDaItemList.size()) { byte titleMark = mDaItemList.get(iposj).getDatakind(); if (titleMark == NoteBookData.ITEMKIND_CLASS){ int ipasswd = mDaItemList.get(iposj).getItemPasswd(); byte curStatus = mDaItemList.get(iposj).getStatus(); cretblv = true ; if (ipasswd < 0 || curStatus != NoteBookData.TITLESTATUS_CLOSE) { mDaItemList.get(iposj).switchTitleStatus(); } } } return cretblv; } private boolean commonIfFolderButttonOpen( int iposj) { boolean cretblv = false ; if (iposj >= 0 && iposj < mDaItemList.size()) { byte titleMark = mDaItemList.get(iposj).getDatakind(); if (titleMark == NoteBookData.ITEMKIND_CLASS){ byte bOpenStatus = mDaItemList.get(iposj).getStatus(); if (bOpenStatus == NoteBookData.TITLESTATUS_OPEN) cretblv = true ; } } return cretblv; } @Override public int getItemCount() { return mDataIndexLst.size();} public ArrayList<NoteBookIndex> getIndexList() { return mDataIndexLst; } public ArrayList<NoteBookData> getDaList() { return mDaItemList; } @Override public int getItemViewType( int position) { if (mDataIndexLst.size() == 0 ){ return EMPTY_VIEW; } else if (mDataIndexLst.get(position) == null ){ return PROGRESS_VIEW; } else if (mDataIndexLst.get(position).getItemType().equals(NoteBookIndex.ITEMTYPE_TITLE)){ return TITLE_VIEW; } else if (mDataIndexLst.get(position).getItemType().equals(NoteBookIndex.ITEMTYPE_LIST)){ return DATAVIEW_LIST; } else if (mDataIndexLst.get(position).getItemType().equals(NoteBookIndex.ITEMTYPE_IMAGE)){ return DATAVIEW_IMAGE; } else if (mDataIndexLst.get(position).getItemType().equals(NoteBookIndex.ITEMTYPE_2IMAGE)){ return DATAVIEW_2IMAGE; } else if (mDataIndexLst.get(position).getItemType().equals(NoteBookIndex.ITEMTYPE_KEYTITLE)){ return KEYINFO_VIEW; } else if (mDataIndexLst.get(position).getItemType().equals(NoteBookIndex.ITEMTYPE_KEYDATA)){ return KEYINFO_DATA; } else { return super .getItemViewType(position); } } @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view; if (viewType == PROGRESS_VIEW){ view = LayoutInflater.from(parent.getContext()).inflate(R.layout.fragmentevent_pgressbar_item, parent, false ); return new ProgressViewHolder(view); } else if (viewType == EMPTY_VIEW){ return null ; } else if (viewType == TITLE_VIEW) { view = LayoutInflater.from(parent.getContext()).inflate(R.layout.fragment_notebook_itemtitle, parent, false ); return new TitleViewHolder(view); } else if (viewType == DATAVIEW_LIST) { view = LayoutInflater.from(parent.getContext()).inflate(R.layout.fragment_notebook_itemdata, parent, false ); return new DataViewHolder(view); } else if (viewType == DATAVIEW_IMAGE) { view = LayoutInflater.from(parent.getContext()).inflate(R.layout.fragment_notebook_itemimage, parent, false ); return new ImageViewHolder(view); } else if (viewType == DATAVIEW_2IMAGE) { view = LayoutInflater.from(parent.getContext()).inflate(R.layout.fragment_notebook_item2image, parent, false ); return new Image2ViewHolder(view); } else if (viewType == KEYINFO_VIEW) { view = LayoutInflater.from(parent.getContext()).inflate(R.layout.fragment_notebook_keytitle, parent, false ); return new TitleKeyViewHolder(view); } else if (viewType == KEYINFO_DATA) { view = LayoutInflater.from(parent.getContext()).inflate(R.layout.fragment_notebook_keyimage, parent, false ); return new ImageKeyViewHolder(view); } else { view = LayoutInflater.from(parent.getContext()).inflate(R.layout.fragmenteview_slist_item, parent, false ); return null ; } } @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) { if (holder instanceof TitleViewHolder){ handle_TitleViewHolder(holder,position); } else if (holder instanceof DataViewHolder) { handle_DataViewHolder(holder, position); } else if (holder instanceof ImageViewHolder){ handle_ImageViewHolder(holder,position); } else if (holder instanceof Image2ViewHolder){ handle_Image2ViewHolder(holder,position); } else if (holder instanceof ImageKeyViewHolder){ handle_ImageKeyViewHolder(holder,position); } else if (holder instanceof TitleKeyViewHolder){ handle_TitleKeyViewHolder(holder,position); } else if (holder instanceof ProgressViewHolder){ ProgressViewHolder viewHolder = (ProgressViewHolder)holder; //... viewHolder.progressBar.setIndeterminate(true); } } private void handle_TitleViewHolder(RecyclerView.ViewHolder holder, final int icposition) { final int position = mDataIndexLst.get(icposition).getItemStartPosj(); TitleViewHolder viewHolder = (TitleViewHolder) holder; viewHolder.LLayout_folderBut.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { byte curStatus = mDaItemList.get(position).getStatus(); if (commonFolderButtonOper(position)) { int ipasswd = mDaItemList.get(position).getItemPasswd(); if (curStatus != NoteBookData.TITLESTATUS_CLOSE) ipasswd = - 1 ; selClickLister.onSelClickItem(icposition, position, ipasswd, NoteBookIndex.FOLDERIMGBUT_CLICK, "--" , v); } } }); viewHolder.LLayout_folderBut.setOnLongClickListener( new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { byte curStatus = mDaItemList.get(position).getStatus(); if (commonFolderButtonOper(position)) { int ipasswd = mDaItemList.get(position).getItemPasswd(); if (curStatus != NoteBookData.TITLESTATUS_CLOSE) ipasswd = - 1 ; selClickLister.onSelClickItem(icposition, position, ipasswd, NoteBookIndex.FOLDERIMGBUT_LONGCLICK, "--" , v); } return false ; } }); //... LLayout_folderBut viewHolder.mLayoutbut_selItem.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { NoteBookData.mfindItem_Passwd = - 1 ; NoteBookData.mfindItem_kind = NoteBookIndex.ITEMKIND_FINDEMPTY; selClickLister.onSelClickItem(icposition, - 1 , position, NoteBookIndex.ITEMSELCLICK, "--" , v); } }); viewHolder.mLayoutbut_selItem.setOnLongClickListener( new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { NoteBookData.mfindItem_Passwd = - 1 ; NoteBookData.mfindItem_kind = NoteBookIndex.ITEMKIND_FINDEMPTY; selClickLister.onSelClickItem(icposition, - 1 , position, NoteBookIndex.ITEMSELLONGCLICK, "--" , v); return false ; } }); int iColorv = NoteBookIndex.titleNormalColor; if (icposition == NoteBookIndex.curSelprojno) { viewHolder.mLayout_Item.setBackground(mContext.getResources().getDrawable(R.drawable.comsellrectframe_line)); //... iColorv = NoteBookIndex.titleSelColor; } else { viewHolder.mLayout_Item.setBackground(mContext.getResources().getDrawable(R.drawable.comsellrectframe_empty)); } //... viewHolder.mLayout_Item.setBackgroundColor(iColorv); String strName = mDaItemList.get(position).getItemName(); viewHolder.mTitleName.setText(strName); String strNote = mDaItemList.get(position).getItemNote(); viewHolder.mTitleNote.setText(strNote); if (commonIfFolderButttonOpen(position)) { viewHolder.mImgFolderBut.setImageResource(R.drawable.comvec_folderopen); } else { viewHolder.mImgFolderBut.setImageResource(R.drawable.comvec_folderclose); } viewHolder.mImgflag.setColorFilter(NoteBookData.FOLDERCOLOR_DKYELLOW); int ipasswd = mDaItemList.get(position).getItemPasswd(); if (ipasswd > 0 ){ viewHolder.mImgLock.setVisibility(View.VISIBLE); } else { viewHolder.mImgLock.setVisibility(View.INVISIBLE); } } private void handle_TitleKeyViewHolder(RecyclerView.ViewHolder holder, final int icposition) { final int keyposj = mDataIndexLst.get(icposition).getItemStartPosj(); int idaposition = - 1 ; if (keyposj >= 0 && keyposj < mDaKeyInfoList.size()){ idaposition = mDaKeyInfoList.get(keyposj).getKeyInfoItemposj(); } final int position = idaposition; // if(idaposition < 0) return; TitleKeyViewHolder viewHolder = (TitleKeyViewHolder) holder; viewHolder.LLayout_folderBut.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (NoteBookKeyInfoData.curFolderStatus != NoteBookKeyInfoData.FOLDERSTATUS_OPEN) { NoteBookKeyInfoData.curFolderStatus = NoteBookKeyInfoData.FOLDERSTATUS_OPEN; } else { NoteBookKeyInfoData.curFolderStatus = NoteBookKeyInfoData.FOLDERSTATUS_CLOSE; } int ipasswd = - 1 ; selClickLister.onSelClickItem(icposition, position, ipasswd, NoteBookIndex.FOLDERIMGBUT_CLICK, "--" , v); } }); viewHolder.LLayout_folderBut.setOnLongClickListener( new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { byte curStatus = mDaItemList.get(position).getStatus(); if (NoteBookKeyInfoData.curFolderStatus != NoteBookKeyInfoData.FOLDERSTATUS_OPEN) { NoteBookKeyInfoData.curFolderStatus = NoteBookKeyInfoData.FOLDERSTATUS_OPEN; } else { NoteBookKeyInfoData.curFolderStatus = NoteBookKeyInfoData.FOLDERSTATUS_CLOSE; } int ipasswd = - 1 ; selClickLister.onSelClickItem(icposition, position, ipasswd, NoteBookIndex.FOLDERIMGBUT_LONGCLICK, "--" , v); return false ; } }); int iColorv = NoteBookIndex.titleNormalColor; if (icposition == NoteBookIndex.curSelprojno) { viewHolder.mLayout_Item.setBackground(mContext.getResources().getDrawable(R.drawable.comsellrectframe_line)); iColorv = NoteBookIndex.titleSelColor; } else { viewHolder.mLayout_Item.setBackground(mContext.getResources().getDrawable(R.drawable.comsellrectframe_empty)); } if (NoteBookKeyInfoData.curFolderStatus == NoteBookKeyInfoData.FOLDERSTATUS_OPEN) { viewHolder.mImgFolderBut.setImageResource(R.drawable.comvec_folderopen); } else { viewHolder.mImgFolderBut.setImageResource(R.drawable.comvec_folderclose); } viewHolder.mImgflag.setColorFilter(NoteBookData.FOLDERCOLOR_DKYELLOW); viewHolder.mLayout_Item.setBackgroundColor(iColorv); viewHolder.mImgLock.setVisibility(View.INVISIBLE); viewHolder.mTitleName.setTextColor(Color.RED); viewHolder.mTitleName.setText(NoteBookData.mkeyInfo_Title); } private void handle_DataViewHolder(RecyclerView.ViewHolder holder, final int icposition) { final int position = mDataIndexLst.get(icposition).getItemStartPosj(); DataViewHolder viewHolder = (DataViewHolder) holder; viewHolder.mLayout_txtItem.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { int ifindPasswd = mDataIndexLst.get(icposition).getFindItemPasswd(); NoteBookData.mfindItem_Passwd = ifindPasswd; NoteBookData.mfindItem_kind = mDataIndexLst.get(icposition).getFindItemMark(); selClickLister.onSelClickItem(icposition, ifindPasswd, position, NoteBookIndex.ITEMSELCLICK, "--" , v); } }); viewHolder.mLayout_txtItem.setOnLongClickListener( new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { int ifindPasswd = mDataIndexLst.get(icposition).getFindItemPasswd(); NoteBookData.mfindItem_Passwd = ifindPasswd; NoteBookData.mfindItem_kind = mDataIndexLst.get(icposition).getFindItemMark(); selClickLister.onSelClickItem(icposition, ifindPasswd, position, NoteBookIndex.ITEMSELLONGCLICK, "--" , v); return false ; } }); int iColorv = NoteBookIndex.dataNormalColor; if (icposition == NoteBookIndex.curSelprojno) { viewHolder.mLayout_Item.setBackground(mContext.getResources().getDrawable(R.drawable.comsellrectframe_line)); iColorv = NoteBookIndex.dataSelColor; } else { viewHolder.mLayout_Item.setBackground(mContext.getResources().getDrawable(R.drawable.comsellrectframe_empty)); } String strName = mDaItemList.get(position).getItemName(); String strNote = mDaItemList.get(position).getItemNote(); byte bdelmark = mDaItemList.get(position).getItemDelMark(); int ipasswd = mDaItemList.get(position).getItemPasswd(); byte findmark = mDataIndexLst.get(icposition).getFindItemMark(); int ifpasswd = - 1 ; if (findmark == NoteBookIndex.ITEMKIND_FIND){ ifpasswd = mDataIndexLst.get(icposition).getFindItemPasswd(); if (ifpasswd > 0 && ipasswd <= 0 ) ipasswd = ifpasswd; } if (bdelmark == NoteBookData.ITEMDELETE_YES){ viewHolder.mImgLock.setVisibility(View.VISIBLE); viewHolder.mImgLock.setImageResource(R.drawable.comvec_delete); } else { if (ipasswd > 0 ) { viewHolder.mImgLock.setVisibility(View.VISIBLE); viewHolder.mImgLock.setImageResource(R.drawable.comvec_lock); } else { viewHolder.mImgLock.setVisibility(View.INVISIBLE); } } if (ipasswd > 0 ) { strNote = "****" ; strName = "****" ; } viewHolder.mNote.setText(strNote); viewHolder.mName.setText(strName); //...viewHolder.mKeycode.setText(strKeycode); viewHolder.mImgflag.setVisibility(View.INVISIBLE); } private void handle_ImageViewHolder(RecyclerView.ViewHolder holder, final int icposition) { final int position = mDataIndexLst.get(icposition).getItemStartPosj(); ImageViewHolder viewHolder = (ImageViewHolder) holder; viewHolder.mimg1_LLayout.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { int ifindPasswd = mDataIndexLst.get(icposition).getFindItemPasswd(); NoteBookData.mfindItem_Passwd = ifindPasswd; NoteBookData.mfindItem_kind = mDataIndexLst.get(icposition).getFindItemMark(); selClickLister.onSelClickItem(icposition, ifindPasswd, position, NoteBookIndex.ITEMIMAGESELCLICK, "--" , v); } }); viewHolder.mimg1_LLayout.setOnLongClickListener( new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { int ifindPasswd = mDataIndexLst.get(icposition).getFindItemPasswd(); NoteBookData.mfindItem_Passwd = ifindPasswd; NoteBookData.mfindItem_kind = mDataIndexLst.get(icposition).getFindItemMark(); selClickLister.onSelClickItem(icposition, ifindPasswd, position, NoteBookIndex.ITEMIMAGESELLONGCLICK, "--" , v); return false ; } }); viewHolder.mitem1_LLayout.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { int ifindPasswd = mDataIndexLst.get(icposition).getFindItemPasswd(); NoteBookData.mfindItem_Passwd = ifindPasswd; NoteBookData.mfindItem_kind = mDataIndexLst.get(icposition).getFindItemMark(); selClickLister.onSelClickItem(icposition, ifindPasswd, position, NoteBookIndex.ITEMSELCLICK, "--" , v); } }); viewHolder.mitem1_LLayout.setOnLongClickListener( new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { int ifindPasswd = mDataIndexLst.get(icposition).getFindItemPasswd(); NoteBookData.mfindItem_Passwd = ifindPasswd; NoteBookData.mfindItem_kind = mDataIndexLst.get(icposition).getFindItemMark(); selClickLister.onSelClickItem(icposition, ifindPasswd, position, NoteBookIndex.ITEMSELLONGCLICK, "--" , v); return false ; } }); int iColorv = NoteBookIndex.dataNormalColor; viewHolder.item1Image.setSelectMark( false ); if (icposition == NoteBookIndex.curSelprojno) { viewHolder.item1Image.setSelectMark( true ); //... iColorv = NoteBookIndex.dataSelColor; } String strName = mDaItemList.get(position).getItemName(); String strNote = mDaItemList.get(position).getItemNote(); String strDateTime = mDaItemList.get(position).getItemDateTime(); int ipasswd = mDaItemList.get(position).getItemPasswd(); byte findmark = mDataIndexLst.get(icposition).getFindItemMark(); int ifpasswd = - 1 ; if (findmark == NoteBookIndex.ITEMKIND_FIND){ ifpasswd = mDataIndexLst.get(icposition).getFindItemPasswd(); if (ifpasswd > 0 && ipasswd <= 0 ) ipasswd = ifpasswd; } byte bdelmark = mDaItemList.get(position).getItemDelMark(); if (bdelmark == NoteBookData.ITEMDELETE_YES){ viewHolder.item1Image.setItemDeleteMark( true ); if (ipasswd > 0 ) { strName = "******" ; strNote = "******" ; } } else { if (ipasswd > 0 ) { strName = "******" ; strNote = "******" ; viewHolder.item1Image.setItemLockMark( true ); } else { viewHolder.item1Image.setItemLockMark( false ); } } byte selfpic = mDaItemList.get(position).getSelfpic(); if (selfpic != NoteBookData.ITEMPIC_YES){ String fileUrl = "file:///android_asset/" +NoteBookData.mItemAssetPicName;// "notePictureEmpty.png" ; int iassetjno = mDaItemList.get(position).getItemAssetJno(); if (iassetjno > 99 ) iassetjno = 99 ; if (iassetjno > 0 ){ fileUrl = "file:///android_asset/" + "eventtitlepic" +String.valueOf(iassetjno)+ ".png" ; } Glide.with(mContext).load(fileUrl) .into(viewHolder.item1Image); } else { Glide.with(mContext).load(mDaItemList.get(position).getItemPicFullpathName()) .override(dpToPx(NoteBookData.PICITEMSIZE), dpToPx(NoteBookData.PICITEMSIZE)).centerCrop() .skipMemoryCache( true ) //跳过内存缓存 .diskCacheStrategy(DiskCacheStrategy.NONE) //不要在disk硬盘缓存 .into(viewHolder.item1Image); } viewHolder.mCol1_NOTE.setText(strNote); viewHolder.mCol1_NAME.setText(strName); viewHolder.mCol1_TIME.setText(strDateTime); } private void handle_ImageKeyViewHolder(RecyclerView.ViewHolder holder, final int icposition) { final int keyposj = mDataIndexLst.get(icposition).getItemStartPosj(); int idaposition = - 1 ; String strKeyInfo = "-----" ; if (keyposj >= 0 && keyposj < mDaKeyInfoList.size()){ strKeyInfo = mDaKeyInfoList.get(keyposj).getKeyInfoNote(); idaposition = mDaKeyInfoList.get(keyposj).getKeyInfoItemposj(); } final int position = idaposition; if (idaposition < 0 ) return ; ImageKeyViewHolder viewHolder = (ImageKeyViewHolder) holder; viewHolder.mimg1_LLayout.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { int ifindPasswd = mDataIndexLst.get(icposition).getFindItemPasswd(); NoteBookData.mfindItem_Passwd = ifindPasswd; NoteBookData.mfindItem_kind = mDataIndexLst.get(icposition).getFindItemMark(); String strType = mDataIndexLst.get(icposition).getItemType(); selClickLister.onSelClickItem(icposition, ifindPasswd, position, NoteBookIndex.ITEMIMAGESELCLICK, strType, v); } }); viewHolder.mimg1_LLayout.setOnLongClickListener( new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { int ifindPasswd = mDataIndexLst.get(icposition).getFindItemPasswd(); NoteBookData.mfindItem_Passwd = ifindPasswd; NoteBookData.mfindItem_kind = mDataIndexLst.get(icposition).getFindItemMark(); String strType = mDataIndexLst.get(icposition).getItemType(); selClickLister.onSelClickItem(icposition, ifindPasswd, position, NoteBookIndex.ITEMIMAGESELLONGCLICK, strType, v); return false ; } }); viewHolder.mitem1_LLayout.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { int ifindPasswd = mDataIndexLst.get(icposition).getFindItemPasswd(); NoteBookData.mfindItem_Passwd = ifindPasswd; NoteBookData.mfindItem_kind = mDataIndexLst.get(icposition).getFindItemMark(); String strType = mDataIndexLst.get(icposition).getItemType(); selClickLister.onSelClickItem(icposition, ifindPasswd, position, NoteBookIndex.ITEMSELCLICK, strType, v); } }); viewHolder.mitem1_LLayout.setOnLongClickListener( new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { int ifindPasswd = mDataIndexLst.get(icposition).getFindItemPasswd(); NoteBookData.mfindItem_Passwd = ifindPasswd; NoteBookData.mfindItem_kind = mDataIndexLst.get(icposition).getFindItemMark(); String strType = mDataIndexLst.get(icposition).getItemType(); selClickLister.onSelClickItem(icposition, ifindPasswd, position, NoteBookIndex.ITEMSELLONGCLICK, strType, v); return false ; } }); int iColorv = NoteBookIndex.dataNormalColor; viewHolder.item1Image.setSelectMark( false ); if (icposition == NoteBookIndex.curSelprojno) { viewHolder.item1Image.setSelectMark( true ); //... iColorv = NoteBookIndex.dataSelColor; } String strName = mDaItemList.get(position).getItemName(); String strNote = mDaItemList.get(position).getItemNote(); //... String strDateTime = mDaItemList.get(position).getItemDateTime(); byte selfpic = mDaItemList.get(position).getSelfpic(); if (selfpic != NoteBookData.ITEMPIC_YES){ String fileUrl = "file:///android_asset/" +NoteBookData.mItemAssetPicName;// "notePictureEmpty.png" ; int iassetjno = mDaItemList.get(position).getItemAssetJno(); if (iassetjno > 99 ) iassetjno = 99 ; if (iassetjno > 0 ){ fileUrl = "file:///android_asset/" + "eventtitlepic" +String.valueOf(iassetjno)+ ".png" ; } Glide.with(mContext).load(fileUrl) .into(viewHolder.item1Image); } else { Glide.with(mContext).load(mDaItemList.get(position).getItemPicFullpathName()) .override(dpToPx(NoteBookData.PICITEMSIZE), dpToPx(NoteBookData.PICITEMSIZE)).centerCrop() .skipMemoryCache( true ) //跳过内存缓存 .diskCacheStrategy(DiskCacheStrategy.NONE) //不要在disk硬盘缓存 .into(viewHolder.item1Image); } viewHolder.mCol1_NOTE.setText(strNote); viewHolder.mCol1_NAME.setText(strName); viewHolder.mCol1_KEYINFO.setText(strKeyInfo); } private void handle_Image2ViewHolder(RecyclerView.ViewHolder holder, final int icposition) { final int position = mDataIndexLst.get(icposition).getItemStartPosj(); final int itemNum = mDataIndexLst.get(icposition).getItemNum(); final int position2 = position+ 1 ; Image2ViewHolder viewHolder = (Image2ViewHolder) holder; viewHolder.mimg1_LLayout.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { selClickLister.onSelClickItem(icposition, 0 , position, NoteBookIndex.ITEMIMAGESELCLICK, "--" , v); } }); viewHolder.mimg1_LLayout.setOnLongClickListener( new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { selClickLister.onSelClickItem(icposition, 0 , position, NoteBookIndex.ITEMIMAGESELLONGCLICK, "--" , v); return false ; } }); viewHolder.mitem1_LLayout.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { selClickLister.onSelClickItem(icposition, 0 , position, NoteBookIndex.ITEMSELCLICK, "--" , v); } }); viewHolder.mitem1_LLayout.setOnLongClickListener( new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { selClickLister.onSelClickItem(icposition, 0 , position, NoteBookIndex.ITEMSELLONGCLICK, "--" , v); return false ; } }); int iColorv = NoteBookIndex.dataNormalColor; if (icposition == NoteBookIndex.curSelprojno) { iColorv = NoteBookIndex.dataSelColor; } if (position == NoteBookData.iselectposj) { viewHolder.item1Image.setSelectMark( true ); } else { viewHolder.item1Image.setSelectMark( false ); } String strName = mDaItemList.get(position).getItemName(); String strNote = mDaItemList.get(position).getItemNote(); //... viewHolder.cardView.setBackgroundColor(iColorv); int ipasswd = mDaItemList.get(position).getItemPasswd(); byte bdelmark = mDaItemList.get(position).getItemDelMark(); if (bdelmark == NoteBookData.ITEMDELETE_YES){ viewHolder.item1Image.setItemDeleteMark( true ); if (ipasswd > 0 ) { strName = "*******" ; strNote = "*******" ; } } else { if (ipasswd > 0 ) { strName = "*******" ; strNote = "*******" ; viewHolder.item1Image.setItemLockMark( true ); } else { viewHolder.item1Image.setItemLockMark( false ); } } byte selfpic = mDaItemList.get(position).getSelfpic(); if (selfpic != NoteBookData.ITEMPIC_YES){ String fileUrl = "file:///android_asset/" +NoteBookData.mItemAssetPicName;// "notePictureEmpty.png" ; int iassetjno = mDaItemList.get(position).getItemAssetJno(); if (iassetjno > 99 ) iassetjno = 99 ; if (iassetjno > 0 ){ fileUrl = "file:///android_asset/" + "eventtitlepic" +String.valueOf(iassetjno)+ ".png" ; } Glide.with(mContext).load(fileUrl) .into(viewHolder.item1Image); } else { Glide.with(mContext).load(mDaItemList.get(position).getItemPicFullpathName()) .override(dpToPx(NoteBookData.PICITEMSIZE), dpToPx(NoteBookData.PICITEMSIZE)).centerCrop() .skipMemoryCache( true ) //跳过内存缓存 .diskCacheStrategy(DiskCacheStrategy.NONE) //不要在disk硬盘缓存 .into(viewHolder.item1Image); } String strDateTime = mDaItemList.get(position).getItemDateTime(); viewHolder.mCol1_NOTE.setText(strNote); viewHolder.mCol1_NAME.setText(strName); viewHolder.mCol1_TIME.setText(strDateTime); viewHolder.mimg2_LLayout.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (itemNum > 1 ) { selClickLister.onSelClickItem(icposition, 0 , position2, NoteBookIndex.ITEMIMAGESELCLICK, "--" , v); } } }); viewHolder.mimg2_LLayout.setOnLongClickListener( new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { if (itemNum > 1 ) { selClickLister.onSelClickItem(icposition, 0 , position2, NoteBookIndex.ITEMIMAGESELLONGCLICK, "--" , v); } return false ; } }); viewHolder.mitem2_LLayout.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (itemNum > 1 ) { selClickLister.onSelClickItem(icposition, 0 , position2, NoteBookIndex.ITEMSELCLICK, "--" , v); } } }); viewHolder.mitem2_LLayout.setOnLongClickListener( new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { if (itemNum > 1 ) { selClickLister.onSelClickItem(icposition, 0 , position2, NoteBookIndex.ITEMSELLONGCLICK, "--" , v); } return false ; } }); if (itemNum > 1 ) { if (position2 == NoteBookData.iselectposj) { viewHolder.item2Image.setSelectMark( true ); } else { viewHolder.item2Image.setSelectMark( false ); } strName = mDaItemList.get(position2).getItemName(); strNote = mDaItemList.get(position2).getItemNote(); ipasswd = mDaItemList.get(position2).getItemPasswd(); bdelmark = mDaItemList.get(position2).getItemDelMark(); if (bdelmark == NoteBookData.ITEMDELETE_YES){ viewHolder.item2Image.setItemDeleteMark( true ); if (ipasswd > 0 ) { strName = "*******" ; strNote = "*******" ; } } else { if (ipasswd > 0 ) { strName = "*******" ; strNote = "*******" ; viewHolder.item2Image.setItemLockMark( true ); } else { viewHolder.item2Image.setItemLockMark( false ); } } selfpic = mDaItemList.get(position2).getSelfpic(); if (selfpic != NoteBookData.ITEMPIC_YES){ int iassetjno = mDaItemList.get(position2).getItemAssetJno(); String fileUrl = "file:///android_asset/" +NoteBookData.mItemAssetPicName;// "notePictureEmpty.png" ; if (iassetjno > 99 ) iassetjno = 99 ; if (iassetjno > 0 ){ fileUrl = "file:///android_asset/" + "eventtitlepic" +String.valueOf(iassetjno)+ ".png" ; } Glide.with(mContext).load(fileUrl) .into(viewHolder.item2Image); } else { Glide.with(mContext).load(mDaItemList.get(position2).getItemPicFullpathName()) .override(dpToPx(NoteBookData.PICITEMSIZE), dpToPx(NoteBookData.PICITEMSIZE)).centerCrop() .skipMemoryCache( true ) //跳过内存缓存 .diskCacheStrategy(DiskCacheStrategy.NONE) //不要在disk硬盘缓存 .into(viewHolder.item2Image); } strDateTime = mDaItemList.get(position2).getItemDateTime(); viewHolder.mCol2_NOTE.setText(strNote); viewHolder.mCol2_NAME.setText(strName); viewHolder.mCol2_TIME.setText(strDateTime); } else { viewHolder.item2Image.setSelectMark( false ); viewHolder.item2Image.setItemLockMark( false ); String fileUrl = "file:///android_asset/" + "notePictureXXX.png" ; Glide.with(mContext).load(fileUrl) .into(viewHolder.item2Image); viewHolder.mCol2_NOTE.setText( "" ); viewHolder.mCol2_NAME.setText( "" ); viewHolder.mCol2_TIME.setText( "" ); } } class TitleViewHolder extends RecyclerView.ViewHolder{ LinearLayout mLayoutbut_selItem; LinearLayout mLayout_Item; LinearLayout LLayout_folderBut; ImageView mImgFolderBut; ImageView mImgflag; ImageView mImgLock; TextView mTitleName; TextView mTitleNote; public TitleViewHolder(View itemView) { super (itemView); mLayout_Item = (LinearLayout) itemView.findViewById(R.id.Layout_titleItem); mLayoutbut_selItem = (LinearLayout) itemView.findViewById(R.id.LayoutSel_Title); LLayout_folderBut = (LinearLayout) itemView.findViewById(R.id.Layoutbut_Folder); mImgFolderBut = (ImageView) itemView.findViewById(R.id.title_folderbut); mImgflag = (ImageView) itemView.findViewById(R.id.title_icon); mImgLock = (ImageView) itemView.findViewById(R.id.title_lock); mTitleName = (TextView) itemView.findViewById(R.id.title_name); mTitleNote = (TextView) itemView.findViewById(R.id.title_note); } } class TitleKeyViewHolder extends RecyclerView.ViewHolder{ LinearLayout mLayoutbut_selItem; LinearLayout mLayout_Item; LinearLayout LLayout_folderBut; ImageView mImgFolderBut; ImageView mImgflag; ImageView mImgLock; TextView mTitleName; TextView mTitleNote; public TitleKeyViewHolder(View itemView) { super (itemView); mLayout_Item = (LinearLayout) itemView.findViewById(R.id.Layout_titleItem); mLayoutbut_selItem = (LinearLayout) itemView.findViewById(R.id.LayoutSel_Title); LLayout_folderBut = (LinearLayout) itemView.findViewById(R.id.Layoutbut_Folder); mImgFolderBut = (ImageView) itemView.findViewById(R.id.title_folderbut); mImgflag = (ImageView) itemView.findViewById(R.id.title_icon); mImgLock = (ImageView) itemView.findViewById(R.id.title_lock); mTitleName = (TextView) itemView.findViewById(R.id.title_name); mTitleNote = (TextView) itemView.findViewById(R.id.title_note); } } class DataViewHolder extends RecyclerView.ViewHolder{ LinearLayout mLayout_Item; LinearLayout mLayout_txtItem; ImageView mImgflag; TextView mName; TextView mNote; ImageView mImgLock; public DataViewHolder(View itemView) { super (itemView); mLayout_Item = (LinearLayout) itemView.findViewById(R.id.Layout_dataItem); mLayout_txtItem = (LinearLayout) itemView.findViewById(R.id.Layoutbut_txtItem); mImgflag = (ImageView) itemView.findViewById(R.id.data_kdicon); mName = (TextView) itemView.findViewById(R.id.data_name); mNote = (TextView) itemView.findViewById(R.id.item_note); mImgLock = (ImageView) itemView.findViewById(R.id.data_lock); } } class ImageViewHolder extends RecyclerView.ViewHolder{ LinearLayout mimg1_LLayout; LinearLayout mitem1_LLayout; NoteBookViewImage item1Image; TextView mCol1_Click; TextView mCol1_NAME; TextView mCol1_NOTE; TextView mCol1_TIME; private CardView cardView; public ImageViewHolder(View itemView) { super (itemView); cardView = (CardView) itemView.findViewById(R.id.cardctrl); mimg1_LLayout = (LinearLayout)itemView.findViewById(R.id.butImg1_Layout); mitem1_LLayout = (LinearLayout)itemView.findViewById(R.id.item1_Layout); item1Image = (NoteBookViewImage) itemView.findViewById(R.id.item1_imgsrc); mCol1_Click = (TextView) itemView.findViewById(R.id.click1_Prompt); mCol1_NAME = (TextView) itemView.findViewById(R.id.colum1_NAME); mCol1_NOTE = (TextView) itemView.findViewById(R.id.colum1_NOTE); //... lock1Image = (ImageView) itemView.findViewById(R.id.data1_lock); mCol1_TIME = (TextView) itemView.findViewById(R.id.colum1_Time); } } class ImageKeyViewHolder extends RecyclerView.ViewHolder{ LinearLayout mimg1_LLayout; LinearLayout mitem1_LLayout; NoteBookViewImage item1Image; TextView mCol1_Click; TextView mCol1_NAME; TextView mCol1_NOTE; TextView mCol1_KEYINFO; private CardView cardView; public ImageKeyViewHolder(View itemView) { super (itemView); cardView = (CardView) itemView.findViewById(R.id.cardctrl); mimg1_LLayout = (LinearLayout)itemView.findViewById(R.id.butImg1_Layout); mitem1_LLayout = (LinearLayout)itemView.findViewById(R.id.item1_Layout); item1Image = (NoteBookViewImage) itemView.findViewById(R.id.item1_imgsrc); mCol1_Click = (TextView) itemView.findViewById(R.id.click1_Prompt); mCol1_NAME = (TextView) itemView.findViewById(R.id.colum1_NAME); mCol1_NOTE = (TextView) itemView.findViewById(R.id.colum1_NOTE); mCol1_KEYINFO = (TextView) itemView.findViewById(R.id.colum1_KEYINFO); } } class Image2ViewHolder extends RecyclerView.ViewHolder{ LinearLayout mimg1_LLayout; LinearLayout mitem1_LLayout; NoteBookViewImage item1Image; TextView mCol1_Click; TextView mCol1_NAME; TextView mCol1_NOTE; TextView mCol1_TIME; //... ImageView lock1Image; LinearLayout mimg2_LLayout; LinearLayout mitem2_LLayout; NoteBookViewImage item2Image; TextView mCol2_Click; TextView mCol2_NAME; TextView mCol2_NOTE; TextView mCol2_TIME; //... ImageView lock2Image; private CardView cardView; public Image2ViewHolder(View itemView) { super (itemView); cardView = (CardView) itemView.findViewById(R.id.cardctrl); mimg1_LLayout = (LinearLayout)itemView.findViewById(R.id.butImg1_Layout); mitem1_LLayout = (LinearLayout)itemView.findViewById(R.id.item1_Layout); item1Image = (NoteBookViewImage) itemView.findViewById(R.id.item1_imgsrc); mCol1_Click = (TextView) itemView.findViewById(R.id.click1_Prompt); mCol1_NAME = (TextView) itemView.findViewById(R.id.colum1_NAME); mCol1_NOTE = (TextView) itemView.findViewById(R.id.colum1_NOTE); mCol1_TIME = (TextView) itemView.findViewById(R.id.colum1_Time); mimg2_LLayout = (LinearLayout)itemView.findViewById(R.id.butImg2_Layout); mitem2_LLayout = (LinearLayout)itemView.findViewById(R.id.item2_Layout); item2Image = (NoteBookViewImage) itemView.findViewById(R.id.item2_imgsrc); mCol2_Click = (TextView) itemView.findViewById(R.id.click1_Prompt); mCol2_NAME = (TextView) itemView.findViewById(R.id.colum2_NAME); mCol2_NOTE = (TextView) itemView.findViewById(R.id.colum2_NOTE); mCol2_TIME = (TextView) itemView.findViewById(R.id.colum2_Time); } } public int dpToPx( float dp){ float px = mContext.getResources().getDisplayMetrics().density; return ( int )(dp * px + 0 .5f); } class ProgressViewHolder extends RecyclerView.ViewHolder { //... ProgressBar progressBar; //... TextView textView; public ProgressViewHolder(View itemView) { super (itemView); //... progressBar = (ProgressBar) itemView.findViewById(R.id.progressBar); //... textView = (TextView) itemView.findViewById(R.id.textView); } } public interface OnAddRemoveListener{ void onAddRemoved( int iszie, String opinfo,String dataName); } public interface OnSelClickListener{ void onSelClickItem( int iposj, int ixp, int iyp, int butcd, String itemStr, View v); } } |
B), 相对应Layout
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | fragment_notebook_item2image.xml <?xml version= "1.0" encoding= "utf-8" ?> <LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android" android:id= "@+id/Layout_dataItem" android:layout_width= "match_parent" android:layout_height= "wrap_content" android:orientation= "horizontal" android:paddingTop= "@dimen/fragNoteBookItemSize_padding" android:paddingBottom= "@dimen/fragNoteBookItemSize_padding" android:weightSum= "100" android:background= "@color/fragNoteBookItemColor_cardbkg" > <LinearLayout android:gravity= "center" android:layout_width= "0dp" android:layout_weight= "2" android:layout_height= "match_parent" android:background= "@color/fragNoteBookItemColor_cardbkg" android:orientation= "horizontal" > <TextView android:layout_width= "match_parent" android:layout_height= "match_parent" android:background= "@color/fragNoteBookColor_dataBkg" /> </LinearLayout> <TextView android:layout_width= "0dp" android:layout_height= "wrap_content" android:layout_weight= "10" /> <LinearLayout android:gravity= "center" android:id= "@+id/Layoutbut_dataItem" android:layout_width= "0dp" android:layout_weight= "10" android:layout_height= "wrap_content" android:orientation= "horizontal" > <ImageView android:id= "@+id/data_kdicon" android:layout_width= "match_parent" android:layout_height= "20dp" android:layout_gravity= "center" android:layout_marginLeft= "1dp" android:layout_marginRight= "1dp" android:src= "@drawable/comvec_vadatasum" /> </LinearLayout> <LinearLayout android:gravity= "center" android:id= "@+id/Layoutbut_txtItem" android:layout_width= "0dp" android:layout_weight= "78" android:layout_height= "wrap_content" android:orientation= "horizontal" android:weightSum= "78" > <TextView android:id= "@+id/data_name" android:layout_width= "0dp" android:layout_height= "wrap_content" android:layout_weight= "34" android:gravity= "center" android:textColor= "@color/fragNoteBookItemColor_name" android:text= "" android:textSize= "@dimen/fragNoteBookItemFntsize_name" /> <TextView android:layout_width= "0dp" android:layout_height= "wrap_content" android:gravity= "center" android:layout_weight= "2" /> <TextView android:id= "@+id/item_note" android:layout_width= "0dp" android:layout_height= "wrap_content" android:layout_weight= "30" android:gravity= "center" android:textColor= "@color/fragNoteBookItemColor_note" android:text= "" android:textSize= "@dimen/fragNoteBookItemFntsize_note" /> <TextView android:layout_width= "0dp" android:layout_height= "wrap_content" android:gravity= "center" android:layout_weight= "1" /> <ImageView android:id= "@+id/data_lock" android:layout_width= "0dp" android:layout_height= "20dp" android:layout_weight= "10" android:layout_gravity= "center" android:layout_marginLeft= "1dp" android:layout_marginRight= "1dp" android:src= "@drawable/comvec_lock" /> <TextView android:layout_width= "0dp" android:layout_height= "wrap_content" android:gravity= "center" android:layout_weight= "1" /> </LinearLayout> </LinearLayout> -------------------------------------------------------------------------------------------------- fragment_notebook_itemdata <?xml version= "1.0" encoding= "utf-8" ?> <LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android" android:id= "@+id/Layout_dataItem" android:layout_width= "match_parent" android:layout_height= "wrap_content" android:orientation= "horizontal" android:paddingTop= "@dimen/fragNoteBookItemSize_padding" android:paddingBottom= "@dimen/fragNoteBookItemSize_padding" android:weightSum= "100" android:background= "@color/fragNoteBookItemColor_cardbkg" > <LinearLayout android:gravity= "center" android:layout_width= "0dp" android:layout_weight= "2" android:layout_height= "match_parent" android:background= "@color/fragNoteBookItemColor_cardbkg" android:orientation= "horizontal" > <TextView android:layout_width= "match_parent" android:layout_height= "match_parent" android:background= "@color/fragNoteBookColor_dataBkg" /> </LinearLayout> <TextView android:layout_width= "0dp" android:layout_height= "wrap_content" android:layout_weight= "10" /> <LinearLayout android:gravity= "center" android:id= "@+id/Layoutbut_dataItem" android:layout_width= "0dp" android:layout_weight= "10" android:layout_height= "wrap_content" android:orientation= "horizontal" > <ImageView android:id= "@+id/data_kdicon" android:layout_width= "match_parent" android:layout_height= "20dp" android:layout_gravity= "center" android:layout_marginLeft= "1dp" android:layout_marginRight= "1dp" android:src= "@drawable/comvec_vadatasum" /> </LinearLayout> <LinearLayout android:gravity= "center" android:id= "@+id/Layoutbut_txtItem" android:layout_width= "0dp" android:layout_weight= "78" android:layout_height= "wrap_content" android:orientation= "horizontal" android:weightSum= "78" > <TextView android:id= "@+id/data_name" android:layout_width= "0dp" android:layout_height= "wrap_content" android:layout_weight= "34" android:gravity= "center" android:textColor= "@color/fragNoteBookItemColor_name" android:text= "" android:textSize= "@dimen/fragNoteBookItemFntsize_name" /> <TextView android:layout_width= "0dp" android:layout_height= "wrap_content" android:gravity= "center" android:layout_weight= "2" /> <TextView android:id= "@+id/item_note" android:layout_width= "0dp" android:layout_height= "wrap_content" android:layout_weight= "30" android:gravity= "center" android:textColor= "@color/fragNoteBookItemColor_note" android:text= "" android:textSize= "@dimen/fragNoteBookItemFntsize_note" /> <TextView android:layout_width= "0dp" android:layout_height= "wrap_content" android:gravity= "center" android:layout_weight= "1" /> <ImageView android:id= "@+id/data_lock" android:layout_width= "0dp" android:layout_height= "20dp" android:layout_weight= "10" android:layout_gravity= "center" android:layout_marginLeft= "1dp" android:layout_marginRight= "1dp" android:src= "@drawable/comvec_lock" /> <TextView android:layout_width= "0dp" android:layout_height= "wrap_content" android:gravity= "center" android:layout_weight= "1" /> </LinearLayout> </LinearLayout> ----------------------------------------------------------------------------- fragment_notebook_itemimage <?xml version= "1.0" encoding= "utf-8" ?> <android.support.v7.widget.CardView xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:app= "http://schemas.android.com/apk/res-auto" android:layout_width= "match_parent" android:layout_height= "wrap_content" android:foreground= "?android:attr/selectableItemBackground" android:id= "@+id/cardctrl" style= "@style/card_item" app:cardBackgroundColor= "@color/fragNoteBookItemColor_cardbkg" > <LinearLayout android:layout_width= "match_parent" android:layout_height= "wrap_content" android:weightSum= "100" android:orientation= "horizontal" > <LinearLayout android:id= "@+id/butImg1_Layout" android:layout_width= "0dp" android:layout_height= "wrap_content" android:gravity= "center" android:layout_weight= "33" android:orientation= "vertical" > <com.bi3eview.newstart60.local.notebook.NoteBookViewImage android:layout_width= "@dimen/fragNoteBookItemPicsize_dpwh" android:layout_height= "@dimen/fragNoteBookItemPicsize_dpwh" android:layout_centerVertical= "true" android:layout_margin= "3dp" android:id= "@+id/item1_imgsrc" /> <TextView android:id= "@+id/click1_Prompt" android:layout_width= "match_parent" android:layout_height= "wrap_content" android:gravity= "center" android:textColor= "@color/fragNoteBookItemColor_clickTxt" android:text= "" android:textSize= "@dimen/fragNoteBookItemFntsize_click" /> </LinearLayout> <LinearLayout android:id= "@+id/item1_Layout" android:layout_width= "0dp" android:layout_height= "wrap_content" android:gravity= "center" android:layout_weight= "67" android:orientation= "vertical" > <TextView android:id= "@+id/colum1_NAME" android:layout_width= "match_parent" android:layout_height= "wrap_content" android:gravity= "center" android:textColor= "@color/fragNoteBookItemColor_name" android:text= "" android:textSize= "@dimen/fragNoteBookItemFntsize_name" /> <TextView android:id= "@+id/colum1_NOTE" android:layout_width= "match_parent" android:layout_height= "wrap_content" android:gravity= "center" android:textColor= "@color/fragNoteBookItemColor_note" android:text= "" android:textSize= "@dimen/fragNoteBookItemFntsize_note" /> <TextView android:id= "@+id/colum1_Time" android:layout_width= "match_parent" android:layout_height= "wrap_content" android:gravity= "center" android:textColor= "@color/fragNoteBookItemColor_time" android:text= "" android:textSize= "@dimen/fragNoteBookItemFntsize_time" /> </LinearLayout> </LinearLayout> </android.support.v7.widget.CardView> |
4), NoteBook Fragment
A), 代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 | package com.bi3eview.newstart60.local.notebook; import android.Manifest; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.graphics.Color; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.support.v4.app.ActivityCompat; import android.support.v4.app.Fragment; import android.support.v4.content.ContextCompat; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.text.Editable; import android.text.TextWatcher; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.PopupWindow; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import com.bi3eview.newstart60.local.COMCONST; import com.bi3eview.newstart60.local.JavaLoadCppLib.ActEventDataClass; import com.bi3eview.newstart60.local.SelfWidget.OnSelectItemListener; import com.bi3eview.newstart60.local.SelfWidget.PopupWindowCustom; import com.bi3eview.newstart60.local.SelfWidget.PopupWindowDlg; import com.bi3eview.newstart60.local.SelfWidget.popwComDlg; import com.bi3eview.newstart60.local.comModel.popwModelDlg; import com.bi3eview.newstart60.local.Activity.PictureHandleActivity; import com.bi3eview.newstart60.local.Activity.CameraPhotoSelActivity; import com.bi3eview.newstart60.local.R; import com.bi3eview.newstart60.local.SelfWidget.threeRadioImageView; import com.bi3eview.newstart60.local.SelfWidget.popwComData; import com.bi3eview.newstart60.local.fragmentEvent.task.OnItemClickListener; import com.bi3eview.newstart60.local.fragmentSimple.ICallBack; import com.bidaeview.hbs60.lib_toprightmenu.bs60PopMenu; import com.bidaeview.hbs60.lib_toprightmenu.myMenuItem; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.List; import static android.app.Activity.RESULT_OK; /** * Created by bs60 on 2022.01.31 */ public class FragmentNoteBook extends Fragment implements OnItemClickListener { Context mContext = null ; private View view; Bundle bundle = null ; RecyclerView recyclerView; SwipeRefreshLayout swipeRefreshLayout; ProgressBar progressBar; NoteBookAdapter mListAdapter; EditText m_findCtxt; private TextWatcher m_WatcherFindCtxt; boolean mForbidOperblv = false ; boolean mBackSaveOperblv = false ; boolean mitemNewblv = false ; int mClickIndexPosj = - 1 ; int mClickItemPosj = - 1 ; String mselItem_DATAKIND = "" ; int mtitle_Passwd; int mwait_OnTimeLoopNum = 0 ; int mcurAssetJno = - 1 ; int mfindItem_Passwd = - 1 ; int mrecordItemIDno = 1 ; int mwinTxtInfoColor = Color.WHITE; int mpopw_butCtrl = 0 ; int mikeyInfoCode = 0 ; //... private ImageView mimgCircleBtn; private bs60PopMenu mPopMenu; TextView mtxt_winInfo; TextView mcol1_nameTitle; TextView mcol2_noteTitle; private LinearLayout mLayout_buildModel; private LinearLayout mLayout_butMENU; private LinearLayout mLayout_butFIND; private LinearLayout mLayout_Radio; TextView mfind_radioTitle; private threeRadioImageView mfind_RadioImg; //... int mcur_Radiojno; private boolean showIcon = true ; private boolean dimBg = true ; private boolean needAnim = true ; byte mselItem_DelMarkb = ' ' ; final int COMMODEL_DLOADLSTSAVEFILE = 1 ; final int COMMODEL_CYBERITEMLST = 2 ; final int COMMODEL_TMPASSETCOPY = 3 ; final int COMMODEL_BUILDITEMLST = 4 ; final int COMMODEL_GETITEMDATA = 5 ; final int COMMODEL_CLOSEITEMLST = 6 ; final int COMMODEL_DLOADEXAMPLESAVEFILE = 7 ; final int COMMODEL_GETLSTITEMNUM = 8 ; final int COMMODEL_PARSEDATAITEM = 9 ; final int COMMODELKIND_NOTEBOOK = 100 ; boolean mwebOperblv = false ; private static final int REQUESTCODE_PICTURE = 100 ; private final int PERMISSION_REQUEST_CODE = 0x001 ; private static final String[] permissionManifest = { Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.INTERNET, }; private Thread downLoadThread; String comModelDownloadUrl = "" ; String dloadModelWebSavePathfile = "" ; // callback ICallBack callback; final int NOTEBOOK_GETLSTNUM = 1000 ; final int NOTEBOOK_DATAITEM = 1001 ; final int NOTEBOOK_BAKFILE = 1002 ; final int NOTEBOOK_APPENDITEM = 1003 ; final int NOTEBOOK_APPENDEND = 1004 ; final int NOTEBOOK_GETDATETIME = 1005 ; final int NOTEBOOK_UPDATEHEADCOLNAME = 1006 ; final int NOTEBOOK_UPDATEITEMPHOTO = 1007 ; final int NOTEBOOK_BUILDMODEL = 1008 ; final int NOTEBOOK_PARSEMODEL = 1009 ; final int NOTEBOOK_KEYINFOGETITEM = 2001 ; final int NOTEBOOK_KEYINFOUPDATE = 2002 ; final int KEYINFOCODE_SAVE = 999999 ; // Handler final int NOTEBOOK_GOHOME = 1000 ; private final int RESETREFRESH_VIEW = 1100 ; private final int TITLEFOLDERBUTTON = 1200 ; private final int ITEMSELECTCHANGE = 1300 ; private final int ITEMLONGSELECTCHANGE = 1306 ; private final int ITEMIMAGELONGSELCHANGE = 1307 ; private final int CLICKITEM_ADDCIRBUTTON = 1400 ; private final int TITLEITEMEDITPOPW = 1500 ; private final int HANDLEUPDATE_SAVEDATA = 1600 ; private final int APPENDUPDATE_NOTEBOOKITEM = 1700 ; private final int NOTEBOOKITEM_UPDATE = 1701 ; private final int NOTEBOOKITEM_DELETE = 1702 ; private final int TITLEPASSWDCHECKPOPWIN = 1800 ; private final int HANDLEDELETE_CANCEL = 1900 ; private final int POPWIN_VIEWLISTSET = 1901 ; private final int LISTSETREFRESH = 1902 ; private final int SELECTSETITEMPICTURE = 1903 ; private final int UPDATESETITEMPICTURE = 1906 ; private final int RADIOFINDUPDATESET = 2000 ; private final int HANDLEFINDITEM = 2001 ; private final int BUILDMODELPOPWIN = 2002 ; private final int BUILDMODELPROCESS = 2003 ; private final int HANDLE_SELECTMODEL = 3000 ; private final int NETOPER_PERMISSION = 3001 ; private final int WEBMODELDALST_DLOADCHK = 3002 ; private final int DOWNLOADMODELLST_SUCESS = 3003 ; private final int DOWNLOAD_FALTURE = 3004 ; private final int DLOADMODELEXAMPLE_SUCESS = 3005 ; private final int RESTOREOPERFACE = 3006 ; private final int HANDLE_DOWNLOADMODELEXAMPLE = 3007 ; private final int DLOADMODELEXAMPLEPOPWCHECK = 3008 ; private final int KEYINFORMATION_EDITSET = 4000 ; private final int KEYINFORMATION_APPEND = 4001 ; private final int KEYINFORMATION_UPDATE = 4002 ; private final int KEYINFORMATION_CLEAR = 4003 ; private final int KEYINFORMATION_DELETE = 4004 ; private Handler handler = new Handler() { public void handleMessage(Message msg) { String strInfo; int iobjVal; switch (msg.what) { case KEYINFORMATION_DELETE: processKeyInfo_Delete(); break ; case KEYINFORMATION_CLEAR: processKeyInfo_Clear(); break ; case KEYINFORMATION_APPEND: processKeyInfo_Append(); break ; case KEYINFORMATION_UPDATE: processKeyInfo_Update(); break ; case RESTOREOPERFACE: mLayout_butMENU.setVisibility(View.VISIBLE); mLayout_butFIND.setVisibility(View.VISIBLE); mLayout_Radio.setVisibility(View.VISIBLE); mtxt_winInfo.setTextColor(mwinTxtInfoColor); strInfo = (String)msg.obj; mtxt_winInfo.setText(strInfo); COMCONST.mc_ontimeTaskLockblv = false ; break ; case DLOADMODELEXAMPLE_SUCESS: parseMode_updateDataLst(); break ; case DOWNLOAD_FALTURE: mLayout_butMENU.setVisibility(View.VISIBLE); mLayout_butFIND.setVisibility(View.VISIBLE); mLayout_Radio.setVisibility(View.VISIBLE); mtxt_winInfo.setTextColor(mwinTxtInfoColor); strInfo = getResources().getString(R.string.fragNoteBookTxt_DloadFaulture); mtxt_winInfo.setText(strInfo); COMCONST.mc_ontimeTaskLockblv = false ; break ; case DLOADMODELEXAMPLEPOPWCHECK: ModelExample_popwDownloadCheck(); break ; case HANDLE_DOWNLOADMODELEXAMPLE: webModelExample_DownloadCheck(); break ; case DOWNLOADMODELLST_SUCESS: handle_DloadModelLstSucess(); break ; case WEBMODELDALST_DLOADCHK: webDataLst_DownloadCheck(); break ; case NETOPER_PERMISSION: permissionCheck(); break ; case HANDLE_SELECTMODEL: selectModel_process(); break ; case BUILDMODELPROCESS: buildModel_process(); break ; case BUILDMODELPOPWIN: popwin_BuildModel(); break ; case HANDLEFINDITEM: handle_findItem(); break ; case RADIOFINDUPDATESET: updateSetFindRadio(); break ; case UPDATESETITEMPICTURE: handle_updateSetItemPhoto(); break ; case SELECTSETITEMPICTURE: handleSelSetItemPhoto(); break ; case LISTSETREFRESH: ListSetUpdateView(); break ; case TITLEPASSWDCHECKPOPWIN: handle_TitlePasswdCheck(); break ; case APPENDUPDATE_NOTEBOOKITEM: handleAppendUpdateItem(); break ; case TITLEITEMEDITPOPW: popWin_TitleItemEdit(); break ; case KEYINFORMATION_EDITSET: mForbidOperblv = false ; popWin_KeyInfoEditSet(); break ; case CLICKITEM_ADDCIRBUTTON: CircleADDButtonMenu(NoteBookData.iselectposj); break ; case NOTEBOOK_GOHOME: callback.get_message_from_Fragment( "MainHome" ); break ; case RESETREFRESH_VIEW: swipeRefreshLayout.setRefreshing( false ); progressBar.setVisibility(View.INVISIBLE); //.GONE); break ; case TITLEFOLDERBUTTON: TitleFolderButtonOper(); break ; case ITEMSELECTCHANGE: ItemSelectChanged(); break ; case ITEMLONGSELECTCHANGE: ItemLongSelectChanged(); break ; case ITEMIMAGELONGSELCHANGE: ItemImageLongSelChanged(); break ; case NOTEBOOKITEM_UPDATE: handle_UpdateSelItem(); break ; case NOTEBOOKITEM_DELETE: handle_DeleteSelItem(); break ; case HANDLEDELETE_CANCEL: handle_cancelDeleteItem(); break ; case POPWIN_VIEWLISTSET: popwinViewListSet(); break ; } } }; public FragmentNoteBook() { // Required empty public constructor } @Override public void onCreate(Bundle savedInstanceState) { super .onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment view = inflater.inflate(R.layout.fragment_notebook, container, false ); recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView_web); swipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipeRefreshLayout); progressBar = (ProgressBar) view.findViewById(R.id.progress_bar); mtxt_winInfo = (TextView) view.findViewById(R.id.topwin_info); mcol1_nameTitle = (TextView) view.findViewById(R.id.col1_titleName); mcol1_nameTitle.setText(NoteBookData.mcustom_Col1Name); mcol2_noteTitle = (TextView) view.findViewById(R.id.col2_titleNote); mcol2_noteTitle.setText(NoteBookData.mcustom_Col2Note); mLayout_buildModel = (LinearLayout)view.findViewById(R.id.Layoutbut_winInfo); mLayout_buildModel.setOnLongClickListener( new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { handler.sendEmptyMessage(BUILDMODELPOPWIN); return true ; } }); mLayout_butMENU = (LinearLayout)view.findViewById(R.id.Layoutbut_MENU); mLayout_butMENU.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { handler.sendEmptyMessage(CLICKITEM_ADDCIRBUTTON); } }); m_findCtxt = (EditText)view.findViewById(R.id.edtTxt_find); m_WatcherFindCtxt = new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { } }; m_findCtxt.addTextChangedListener(m_WatcherFindCtxt); mLayout_butFIND = (LinearLayout)view.findViewById(R.id.Layoutbut_FIND); mLayout_butFIND.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { handler.sendEmptyMessage(HANDLEFINDITEM); } }); mLayout_Radio = (LinearLayout)view.findViewById(R.id.Layoutbut_FINDradio); mLayout_Radio.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { handler.sendEmptyMessage(RADIOFINDUPDATESET); } }); mfind_radioTitle = (TextView)view.findViewById(R.id.txtfinditem_title); mfind_RadioImg = (threeRadioImageView)view.findViewById(R.id.imgfindradio_icon); NoteBookIndex.titleNormalColor = getResources().getColor(R.color.fragNoteBookColor_titleBkg); NoteBookIndex.titleSelColor = getResources().getColor(R.color.fragNoteBookColor_selitem); NoteBookIndex.dataNormalColor = getResources().getColor(R.color.fragNoteBookItemColor_cardbkg); NoteBookIndex.dataSelColor = getResources().getColor(R.color.fragNoteBookColor_selitem); NoteBookData.PICITEMSIZE = getResources().getDimension(R.dimen.fragNoteBookItemPicsize_dptopxwh); NoteBookData.mcustom_RaioAll = getResources().getString(R.string.fragNoteBookTxt_findAll); NoteBookData.mkeyInfo_Title = getResources().getString(R.string.fragNoteBookTxt_keyInfo); NoteBookData.mcurAppendItemIDno = 1 ; mForbidOperblv = false ; mitemNewblv = false ; mBackSaveOperblv = false ; mwebOperblv = false ; mClickIndexPosj = - 1 ; mClickItemPosj = - 1 ; mselItem_DelMarkb = ' ' ; mcurAssetJno = - 1 ; mfindItem_Passwd = - 1 ; mrecordItemIDno = 1 ; mwinTxtInfoColor = Color.WHITE; m_chknum = 0 ; mselItem_DATAKIND = "" ; NoteBookData.mcur_findItemjno = NoteBookData.FINDITEM_ALL; initSetAdapter(); handler.sendEmptyMessage(NETOPER_PERMISSION); return view; } @Override public void onAttach(Context context) { super .onAttach(context); mContext = context; } @Override public void onDetach() { super .onDetach(); mContext = null ; } @Override public void onItemClick(View v, int position, boolean longblv) { if (mContext != null ) { } } private void TitleFolderButtonOper() { if (mtitle_Passwd > 0 && mClickItemPosj >= 0 ){ mListAdapter.mDaItemList.get(mClickItemPosj).switchTitleStatus(); } mtitle_Passwd = - 1 ; mClickItemPosj = - 1 ; NoteBookIndex.curSelprojno = - 1 ; mListAdapter.build_IndexItemLst(); mListAdapter.notifyDataSetChanged(); } private void ItemSelectChanged() { if ((NoteBookIndex.curSelprojno != mClickIndexPosj|| NoteBookData.iselectposj != mClickItemPosj) && mClickIndexPosj >= 0 ) { int ioldPosj = NoteBookIndex.curSelprojno; NoteBookData.iselectposj = mClickItemPosj; NoteBookIndex.curSelprojno = mClickIndexPosj; selectItemPicParaSet(); if (ioldPosj >= 0 ){ mListAdapter.notifyItemChanged(ioldPosj); } mListAdapter.notifyItemChanged(NoteBookIndex.curSelprojno); // if (mListAdapter.mDataIndexLst.get(mClickIndexPosj).getItemType().equals(NoteBookIndex.ITEMTYPE_TITLE)){ //... mLayout_butDLOAD.setVisibility(View.INVISIBLE); } else { //... mLayout_butDLOAD.setVisibility(View.VISIBLE); } int idaposj = mListAdapter.mDataIndexLst.get(mClickIndexPosj).getItemStartPosj(); String strName = mListAdapter.mDaItemList.get(idaposj).getItemName(); String strNote = mListAdapter.mDaItemList.get(idaposj).getItemNote(); mselItem_DelMarkb = mListAdapter.mDaItemList.get(idaposj).getItemDelMark(); if (mClickItemPosj >= 0 ){ mselItem_DelMarkb = mListAdapter.mDaItemList.get(mClickItemPosj).getItemDelMark(); } } mClickIndexPosj = - 1 ; mClickItemPosj = - 1 ; } private void ItemLongSelectChanged() { if (mClickIndexPosj >= 0 ) { if (NoteBookData.iselectposj != mClickItemPosj ||NoteBookIndex.curSelprojno != mClickIndexPosj ) { int ioldPosj = NoteBookIndex.curSelprojno; NoteBookData.iselectposj = mClickItemPosj; NoteBookIndex.curSelprojno = mClickIndexPosj; selectItemPicParaSet(); if (ioldPosj >= 0 ) { mListAdapter.notifyItemChanged(ioldPosj); } mListAdapter.notifyItemChanged(NoteBookIndex.curSelprojno); } // boolean cbtitleblv = false ; if (mListAdapter.mDataIndexLst.get(mClickIndexPosj).getItemType().equals(NoteBookIndex.ITEMTYPE_TITLE)){ cbtitleblv = true ; } int ipasswd = - 1 ; if (mClickItemPosj >= 0 ){ ipasswd = mListAdapter.mDaItemList.get(mClickItemPosj).getItemPasswd(); mselItem_DelMarkb = mListAdapter.mDaItemList.get(mClickItemPosj).getItemDelMark(); } mitemNewblv = false ; popwNoteBookData.mcurEditMode = popwNoteBookData.EDITMODE_VERIFY; popwNoteBookData.mdlgTitleName = getResources().getString(R.string.fragNoteBookPopw_verifyItem); if (ipasswd <= 0 || cbtitleblv == true ){ popwNoteBookData.mcurEditMode = popwNoteBookData.EDITMODE_UPDATE; popwNoteBookData.mdlgTitleName = getResources().getString(R.string.fragNoteBookPopw_editData); } handler.sendEmptyMessage(TITLEITEMEDITPOPW); } mClickIndexPosj = - 1 ; mClickItemPosj = - 1 ; mForbidOperblv = false ; } private void selectItemPicParaSet() { if (NoteBookData.iselectposj >= 0 ){ NoteBookData.mcurItem_Selfpic = ' ' ; byte bselfpic = NoteBookData.mcurItem_Selfpic = mListAdapter.mDaItemList.get(NoteBookData.iselectposj).getSelfpic(); if (bselfpic == NoteBookData.ITEMPIC_YES){ NoteBookData.mcurItem_Selfpic = NoteBookData.SELFPIC_PHOTO; NoteBookData.mcurItem_PhotoFilename = mListAdapter.mDaItemList.get(NoteBookData.iselectposj).getItemPicFullpathName(); } else { int iassetjno = mListAdapter.mDaItemList.get(NoteBookData.iselectposj).getItemAssetJno(); if (iassetjno > 0 ){ NoteBookData.mcurItem_Selfpic = NoteBookData.SELFPIC_ASSET; NoteBookData.mcurItem_AssetJno = iassetjno; } } } } private void ItemImageLongSelChanged() { if (mClickIndexPosj >= 0 ) { if (NoteBookData.iselectposj != mClickItemPosj ||NoteBookIndex.curSelprojno != mClickIndexPosj ) { int ioldPosj = NoteBookIndex.curSelprojno; NoteBookData.iselectposj = mClickItemPosj; NoteBookIndex.curSelprojno = mClickIndexPosj; selectItemPicParaSet(); if (ioldPosj >= 0 ) { mListAdapter.notifyItemChanged(ioldPosj); } mListAdapter.notifyItemChanged(NoteBookIndex.curSelprojno); } // boolean cbtitleblv = false ; if (mListAdapter.mDataIndexLst.get(mClickIndexPosj).getItemType().equals(NoteBookIndex.ITEMTYPE_TITLE)){ cbtitleblv = true ; } int ipasswd = - 1 ; if (mClickItemPosj >= 0 ){ ipasswd = mListAdapter.mDaItemList.get(mClickItemPosj).getItemPasswd(); mselItem_DelMarkb = mListAdapter.mDaItemList.get(mClickItemPosj).getItemDelMark(); } mClickIndexPosj = - 1 ; mClickItemPosj = - 1 ; mForbidOperblv = false ; mitemNewblv = false ; popwComData.mcurMenuMode = popwComData.MENUMODE_NUM1; popwComData.mMenu1_Name = getResources().getString(R.string.fragNoteBookTxt_menuSelPic); popwComDlg comDlg = new popwComDlg((Activity) mContext, "COMMENU" ); comDlg.setOnWinButtonClickListener( new popwComDlg.OnWinButtonClickListener(){ @Override public void onWindButtonClick( int butcd, String menuName) { if (butcd == popwComData.MENU1_CODE){ handler.sendEmptyMessage(SELECTSETITEMPICTURE); } } }); comDlg.showAtScreen(mLayout_butMENU,COMCONST.LocationType.PARENT_CENTER); } mClickIndexPosj = - 1 ; mClickItemPosj = - 1 ; mForbidOperblv = false ; } private void handle_UpdateSelItem() { if (NoteBookIndex.curSelprojno >= 0 && NoteBookIndex.curSelprojno < mListAdapter.mDataIndexLst.size()) { int idaposj = mListAdapter.mDataIndexLst.get(NoteBookIndex.curSelprojno).getItemStartPosj(); if (NoteBookData.iselectposj >= 0 && NoteBookData.iselectposj < mListAdapter.mDaItemList.size()){ idaposj = NoteBookData.iselectposj; } if (idaposj >= 0 && idaposj < mListAdapter.mDaItemList.size()) { byte [] tmpRbyteArr = new byte [ 288 ]; int [] daparv = new int [ 18 ]; daparv[ 1 ] = 0 ; daparv[ 2 ] = 0 ; int iretv = ActEventDataClass.JavaJNIgetSetNoteBookItem(NOTEBOOK_GETDATETIME,daparv,- 1 ,tmpRbyteArr, 280 ); if (iretv > 0 ){ int icyear = daparv[ 0 ]; byte bmonth = tmpRbyteArr[ 0 ]; byte bday = tmpRbyteArr[ 1 ]; byte bweekno = tmpRbyteArr[ 2 ]; byte bhour = tmpRbyteArr[ 3 ]; byte bmin = tmpRbyteArr[ 4 ]; byte bsec = tmpRbyteArr[ 5 ]; mListAdapter.mDaItemList.get(idaposj).setItemDateTime(icyear,bmonth,bweekno,bday,bhour,bmin,bsec); } mListAdapter.mDaItemList.get(idaposj).setItemName(popwNoteBookData.mName); mListAdapter.mDaItemList.get(idaposj).setItemNote(popwNoteBookData.mNote); mListAdapter.mDaItemList.get(idaposj).setItemPasswd(popwNoteBookData.mcurPasswdCode); NoteBookData.mDataChangeblv = true ; mListAdapter.notifyItemChanged(NoteBookIndex.curSelprojno); } } } private void popwinViewListSet() { popwNoteBookLstSet LstSetDlg = new popwNoteBookLstSet((Activity) mContext, "VIEWLST" ); LstSetDlg.setOnWinButtonClickListener( new popwNoteBookLstSet.OnWinButtonClickListener() { @Override public void onWindButtonClick( int butcd, String menuName) { if (butcd == popwNoteBookData.OPERBUTTON_YES) { handler.sendEmptyMessage(LISTSETREFRESH); } } }); LstSetDlg.showAtScreen(mLayout_butMENU,COMCONST.LocationType.LEFT_BOTTOM); } private void handle_DeleteSelItem() { if (NoteBookIndex.curSelprojno >= 0 && NoteBookIndex.curSelprojno < mListAdapter.mDataIndexLst.size()) { int idaposj = mListAdapter.mDataIndexLst.get(NoteBookIndex.curSelprojno).getItemStartPosj(); if (NoteBookData.iselectposj >= 0 && NoteBookData.iselectposj < mListAdapter.mDaItemList.size()){ idaposj = NoteBookData.iselectposj; } if (idaposj >= 0 && idaposj < mListAdapter.mDaItemList.size()) { mListAdapter.mDaItemList.get(idaposj).setItemDeleteMark(NoteBookData.ITEMDELETE_YES); NoteBookData.mDataChangeblv = true ; NoteBookIndex.curSelprojno = - 1 ; NoteBookData.iselectposj = - 1 ; mListAdapter.build_IndexItemLst(); mListAdapter.notifyDataSetChanged(); } } } private void handle_cancelDeleteItem() { if (NoteBookIndex.curSelprojno >= 0 && NoteBookIndex.curSelprojno < mListAdapter.mDataIndexLst.size()) { int idaposj = mListAdapter.mDataIndexLst.get(NoteBookIndex.curSelprojno).getItemStartPosj(); if (NoteBookData.iselectposj >= 0 && NoteBookData.iselectposj < mListAdapter.mDaItemList.size()){ idaposj = NoteBookData.iselectposj; } if (idaposj >= 0 && idaposj < mListAdapter.mDaItemList.size()) { mListAdapter.mDaItemList.get(idaposj).setItemDeleteMark(NoteBookData.ITEMDELETE_NO); NoteBookData.mDataChangeblv = true ; NoteBookIndex.curSelprojno = - 1 ; NoteBookData.iselectposj = - 1 ; mListAdapter.build_IndexItemLst(); mListAdapter.notifyDataSetChanged(); } } } private void initSetAdapter() { recyclerView.setLayoutManager( new LinearLayoutManager(mContext)); NoteBookAdapter.OnAddRemoveListener remLister = new NoteBookAdapter.OnAddRemoveListener(){ @Override public void onAddRemoved( int iszie,String opinfo,String dataName) { if (opinfo.equals( "Remove" )){ } if (opinfo.equals( "FINISH" )) { } } }; /** * 初始化swipeRefreshLayout */ swipeRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.color_03a9f4)); swipeRefreshLayout.setOnRefreshListener( new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { Message msg = new Message(); msg.what = RESETREFRESH_VIEW; msg.obj = "netpal share" ; handler.sendMessage(msg); } }); // NoteBookAdapter.OnSelClickListener selClickLister = new NoteBookAdapter.OnSelClickListener() { @Override public void onSelClickItem( int iposj, int ixp, int iyp, int butcd, String itemStr, View v) { if (butcd == NoteBookIndex.FOLDERIMGBUT_CLICK || butcd == NoteBookIndex.FOLDERIMGBUT_LONGCLICK){ if (!mForbidOperblv) { mClickIndexPosj = iposj; mClickItemPosj = ixp; mtitle_Passwd = iyp; mselItem_DATAKIND = itemStr; if (mtitle_Passwd > 0 ){ handler.sendEmptyMessage(TITLEPASSWDCHECKPOPWIN); } else { handler.sendEmptyMessage(TITLEFOLDERBUTTON); } } } if (butcd == NoteBookIndex.ITEMSELCLICK || butcd == NoteBookIndex.ITEMIMAGESELCLICK){ if (!mForbidOperblv) { mClickIndexPosj = iposj; mClickItemPosj = iyp; mfindItem_Passwd = ixp; mselItem_DATAKIND = itemStr; handler.sendEmptyMessage(ITEMSELECTCHANGE); } } if (butcd == NoteBookIndex.ITEMSELLONGCLICK){ if (!mForbidOperblv) { mClickIndexPosj = iposj; mClickItemPosj = iyp; mfindItem_Passwd = ixp; mselItem_DATAKIND = itemStr; mForbidOperblv = true ; handler.sendEmptyMessage(ITEMLONGSELECTCHANGE); } } if (butcd == NoteBookIndex.ITEMIMAGESELLONGCLICK){ if (!mForbidOperblv) { mClickIndexPosj = iposj; mClickItemPosj = iyp; mfindItem_Passwd = ixp; mForbidOperblv = true ; mselItem_DATAKIND = itemStr; if (itemStr == NoteBookIndex.ITEMTYPE_KEYDATA){ popwNoteBookData.mcurEditMode = popwNoteBookData.EDITMODE_UPDATE; popwNoteBookData.mdlgTitleName = getResources().getString(R.string.fragNoteBookPopw_editData); handler.sendEmptyMessage(KEYINFORMATION_EDITSET); } else { handler.sendEmptyMessage(ITEMIMAGELONGSELCHANGE); } } } } }; NoteBookData.iselectposj = - 1 ; ArrayList<NoteBookData> mItemLst = new ArrayList(); byte [] tmpRbyteArr = new byte [ 388 ]; int [] daparv = new int [ 18 ]; daparv[ 0 ] = 0 ; daparv[ 1 ] = 0 ; daparv[ 2 ] = 0 ; daparv[ 3 ] = 0 ; daparv[ 4 ] = 0 ; daparv[ 5 ] = 0 ; daparv[ 6 ] = 0 ; int iretItemNum = ActEventDataClass.JavaJNIgetSetNoteBookItem(NOTEBOOK_GETLSTNUM,daparv,- 1 ,tmpRbyteArr, 380 ); if (iretItemNum >= 0 ) { NoteBookData.mcurItemMode = tmpRbyteArr[ 0 ]; int icol1Namecn = daparv[ 1 ]; int iboffv = 1 ; if (icol1Namecn > 0 ) { NoteBookData.mcustom_Col1Name = new String(tmpRbyteArr, iboffv, icol1Namecn); iboffv = iboffv + icol1Namecn; mcol1_nameTitle.setText(NoteBookData.mcustom_Col1Name); } int icol2Notecn = daparv[ 2 ]; if (icol2Notecn > 0 ) { NoteBookData.mcustom_Col2Note = new String(tmpRbyteArr, iboffv, icol2Notecn); iboffv = iboffv + icol2Notecn; mcol2_noteTitle.setText(NoteBookData.mcustom_Col2Note); } int iwkdircn = daparv[ 3 ]; if (iwkdircn > 0 ) { NoteBookData.mWorkDatadir = new String(tmpRbyteArr, iboffv, iwkdircn); iboffv = iboffv + iwkdircn; } int ipiccn = daparv[ 4 ]; if (ipiccn > 0 ) { NoteBookData.mItemPicTmpfile = new String(tmpRbyteArr, iboffv, ipiccn); iboffv = iboffv + ipiccn; } int ipicPrecn = daparv[ 5 ]; if (ipicPrecn > 0 ) { NoteBookData.mItemPicFilePre = new String(tmpRbyteArr, iboffv, ipicPrecn); iboffv = iboffv + ipicPrecn; } int ipicTailcn = daparv[ 6 ]; if (ipicTailcn > 0 ) { NoteBookData.mItemPicFileTail = new String(tmpRbyteArr, iboffv, ipicTailcn); iboffv = iboffv + ipicTailcn; } } if (iretItemNum > 0 ){ for ( int jrec = 0 ;jrec < iretItemNum;jrec++){ int iretcn = ActEventDataClass.JavaJNIgetSetNoteBookItem(NOTEBOOK_DATAITEM,daparv,jrec,tmpRbyteArr, 180 ); if (iretcn < 0 ) break ; if (iretcn <= 0 ) continue ; int ioffv = 0 ; byte dakindc = tmpRbyteArr[ioffv];ioffv++; byte selfpic = tmpRbyteArr[ioffv];ioffv++; byte bassetno = tmpRbyteArr[ioffv];ioffv++; byte bmonth = tmpRbyteArr[ioffv];ioffv++; byte bday = tmpRbyteArr[ioffv];ioffv++; byte bweekno = tmpRbyteArr[ioffv];ioffv++; byte bhour = tmpRbyteArr[ioffv];ioffv++; byte bmin = tmpRbyteArr[ioffv];ioffv++; byte bsec = tmpRbyteArr[ioffv];ioffv++; int icyear = daparv[ 0 ]; int itemIDno = daparv[ 1 ]; int inamebn = daparv[ 2 ]; int inotebn = daparv[ 3 ]; int ipasswd = daparv[ 4 ]; String strName = "" ; if (inamebn > 0 && inamebn < 50 ) { strName = new String(tmpRbyteArr, ioffv, inamebn); ioffv = ioffv + inamebn; } String strNote = "" ; if (inotebn > 0 && inotebn < 120 ) { strNote = new String(tmpRbyteArr, ioffv, inotebn); ioffv = ioffv + inotebn; } NoteBookData itemdata = new NoteBookData(); itemdata.setByteParaItem(dakindc, selfpic, NoteBookData.TITLESTATUS_CLOSE); itemdata.setItemDateTime(icyear,bmonth,bweekno,bday,bhour,bmin,bsec); itemdata.setItemAssetJno(( int )bassetno); itemdata.setItemIDno(itemIDno); if (mrecordItemIDno <= itemIDno && itemIDno > 0 ) mrecordItemIDno = itemIDno+ 1 ; itemdata.setItemName(strName); itemdata.setItemNote(strNote); itemdata.setItemPasswd(ipasswd); mItemLst.add(itemdata); } } if (iretItemNum <= 0 ) { } // key information ArrayList<NoteBookKeyInfoData> mInfoItemLst = new ArrayList(); int infoItemNum = ActEventDataClass.JavaJNIgetSetNoteBookItem(NOTEBOOK_KEYINFOGETITEM,daparv,- 1 ,tmpRbyteArr, 380 ); if (infoItemNum > 0 ){ for ( int ji = 0 ;ji < infoItemNum;ji++){ int iretcn = ActEventDataClass.JavaJNIgetSetNoteBookItem(NOTEBOOK_KEYINFOGETITEM,daparv,ji,tmpRbyteArr, 180 ); if (iretcn < 0 ) break ; if (iretcn <= 0 ) continue ; int ioffv = 0 ; byte status = tmpRbyteArr[ioffv];ioffv++; int ictxtbn = daparv[ 0 ]; int itemIDno = daparv[ 1 ]; String strCtxt = "" ; if (ictxtbn > 0 && ictxtbn < 50 ) { strCtxt = new String(tmpRbyteArr, ioffv, ictxtbn); ioffv = ioffv + ictxtbn; } NoteBookKeyInfoData curInfo = new NoteBookKeyInfoData(status,strCtxt,itemIDno); mInfoItemLst.add(curInfo); } } // ArrayList<NoteBookIndex> cindexDaLst = new ArrayList(); ArrayList<NoteBookIndex> cfindDaLst = new ArrayList(); mListAdapter = new NoteBookAdapter(mContext, mItemLst,cindexDaLst,cfindDaLst,mInfoItemLst,selClickLister); mListAdapter.build_IndexItemLst(); recyclerView.setAdapter(mListAdapter); handler.sendEmptyMessage(RESETREFRESH_VIEW); } private void updateSetFindRadio() { NoteBookData.mcur_findItemjno++; if (NoteBookData.mcur_findItemjno > NoteBookData.FINDITEM_COL1NOTE) NoteBookData.mcur_findItemjno = NoteBookData.FINDITEM_ALL; mfind_RadioImg.setCurrentRadiono(NoteBookData.mcur_findItemjno); if (NoteBookData.mcur_findItemjno == NoteBookData.FINDITEM_ALL){ mfind_RadioImg.setColorFilter(Color.BLACK); mfind_radioTitle.setText(NoteBookData.mcustom_RaioAll); } if (NoteBookData.mcur_findItemjno == NoteBookData.FINDITEM_COL1NAME){ mfind_RadioImg.setColorFilter(Color.BLACK); mfind_radioTitle.setText(NoteBookData.mcustom_Col1Name); } if (NoteBookData.mcur_findItemjno == NoteBookData.FINDITEM_COL1NOTE){ mfind_RadioImg.setColorFilter(Color.BLACK); mfind_radioTitle.setText(NoteBookData.mcustom_Col2Note); } if (mListAdapter.checkResetFindItem()){ mListAdapter.build_IndexItemLst(); NoteBookIndex.curSelprojno = - 1 ; NoteBookData.iselectposj = - 1 ; mListAdapter.notifyDataSetChanged(); } } private void permissionCheck () { boolean permissionState = true ; if (Build.VERSION.SDK_INT >= 23 ) { for (String permission : permissionManifest) { if (ContextCompat.checkSelfPermission(mContext, permission) != PackageManager.PERMISSION_GRANTED) { permissionState = false ; } } if (!permissionState) { Activity activity = (Activity) mContext; ActivityCompat.requestPermissions(activity, permissionManifest, PERMISSION_REQUEST_CODE); } else { mwebOperblv = true ; } } else { mwebOperblv = true ; } } private void selectModel_process() { if (mwebOperblv){ webDataLst_DownloadCheck(); } else { COMCONST.ToastCenterImage(mContext,getResources().getString(R.string.fragNoteBookTxt_noPermission),R.drawable.comvec_err,Toast.LENGTH_LONG,Color.RED); } } private void handle_DloadModelLstSucess() { int [] ipdarv = new int [ 8 ]; byte [] RbyteArr = new byte [ 266 ]; int iretcn = ActEventDataClass.JavaJNIgetComModelLstItem(COMMODEL_BUILDITEMLST,ipdarv ,COMMODELKIND_NOTEBOOK,RbyteArr, 260 ); if (iretcn > 0 ){ popwin_selectModel(); } else { mtxt_winInfo.setText(getResources().getString(R.string.fragNoteBookTxt_modelLstErr)); mLayout_butMENU.setVisibility(View.VISIBLE); mLayout_butFIND.setVisibility(View.VISIBLE); mLayout_Radio.setVisibility(View.VISIBLE); COMCONST.mc_ontimeTaskLockblv = false ; } } private void popwin_selectModel() { mtxt_winInfo.setText( "..." ); mpopw_butCtrl = 0 ; popwModelDlg.mcurModelKind = COMMODELKIND_NOTEBOOK; popwModelDlg modelDlg = new popwModelDlg((Activity) mContext); modelDlg.setOnWinButtonClickListener( new popwModelDlg.OnWinButtonClickListener(){ @Override public void onWindButtonClick( int butcd, String menuName) { if (menuName.equals(popwModelDlg.DIMISSname)){ //... handler.sendEmptyMessage(RESTOREOPERFACE); } if (butcd == 111 ) { mpopw_butCtrl = 111 ; mwait_OnTimeLoopNum = 0 ; comModelDownloadUrl = COMCONST.msWebNotebookMdlUriHead+String.valueOf(popwModelDlg.mselModelIDno)+COMCONST.msWebNotebookMdlUriTail; handler.sendEmptyMessage(DLOADMODELEXAMPLEPOPWCHECK); // HANDLE_DOWNLOADMODELEXAMPLE); } else { if (butcd < 0 && mpopw_butCtrl == 0 ) { mwinTxtInfoColor = Color.WHITE; Message msg = new Message(); msg.what = RESTOREOPERFACE; msg.obj = "---" ; handler.sendMessage(msg); } } }; }); modelDlg.showAtScreen(mLayout_butMENU,COMCONST.LocationType.PARENT_CENTER); } private void popwin_BuildModel() { String strInfoj1 = mContext.getResources().getString(R.string.fragNoteBookTxt_buildQuery); PopupWindowDlg curDlg = new PopupWindowDlg((Activity) mContext, strInfoj1); curDlg.setOnWinButtonClickListener( new PopupWindowDlg.OnWinButtonClickListener() { @Override public void onWindButtonClick( int butcd, String menuName) { if (butcd == 9 ) { mwait_OnTimeLoopNum = 0 ; handler.sendEmptyMessage(BUILDMODELPROCESS); } } }); curDlg.showAtScreen(mLayout_butMENU, COMCONST.LocationType.PARENT_CENTER); } private void setMenuButtonVisible( boolean cvisiblv) { if (cvisiblv) { mLayout_butMENU.setVisibility(View.VISIBLE); mLayout_butFIND.setVisibility(View.VISIBLE); mLayout_Radio.setVisibility(View.VISIBLE); } else { mLayout_butMENU.setVisibility(View.INVISIBLE); mLayout_butFIND.setVisibility(View.INVISIBLE); mLayout_Radio.setVisibility(View.INVISIBLE);; } } private void handle_findItem() { String strFind = m_findCtxt.getText().toString(); if (strFind.length() > 0 ){ setMenuButtonVisible( false ); if (mListAdapter.findBuildFindItemLst(strFind) > 0 ){ mListAdapter.build_IndexItemLst(); mListAdapter.notifyDataSetChanged(); } else { COMCONST.ToastCenterImage(mContext,getResources().getString(R.string.fragNoteBookTxt_findFault),R.drawable.comvec_err,Toast.LENGTH_LONG,Color.RED); } setMenuButtonVisible( true ); } else { COMCONST.ToastCenterImage(mContext,getResources().getString(R.string.fragNoteBookTxt_findTxterr),R.drawable.comvec_err,Toast.LENGTH_LONG,Color.RED); } } private void buildModel_process() { if (mwait_OnTimeLoopNum == 0 ){ setMenuButtonVisible( false ); mwait_OnTimeLoopNum++; }; if (COMCONST.mc_ontimeTaskLockblv){ mwait_OnTimeLoopNum++; systemBusyWaitThread startWait = new systemBusyWaitThread(handler, "WAITSAVE61" ,BUILDMODELPROCESS); Thread thread = new Thread(startWait, "BusyWait61" ); thread.start(); } else { COMCONST.mc_ontimeTaskLockblv = true ; int [] daparv = new int [ 18 ]; byte [] tmpRbyteArr = new byte [ 66 ]; daparv[ 1 ] = - 1 ; int iretcn = ActEventDataClass.JavaJNIgetSetNoteBookItem(NOTEBOOK_BUILDMODEL, daparv, - 1 , tmpRbyteArr, 60 ); COMCONST.mc_ontimeTaskLockblv = false ; setMenuButtonVisible( true ); } } private void handle_updateSetItemPhoto() { if (mwait_OnTimeLoopNum == 0 ){ setMenuButtonVisible( false ); mwait_OnTimeLoopNum++; }; if (COMCONST.mc_ontimeTaskLockblv){ mwait_OnTimeLoopNum++; systemBusyWaitThread startWait = new systemBusyWaitThread(handler, "WAITSAVE61" ,UPDATESETITEMPICTURE); Thread thread = new Thread(startWait, "BusyWait61" ); thread.start(); } else { COMCONST.mc_ontimeTaskLockblv = true ; updateSetItemPhoto(); COMCONST.mc_ontimeTaskLockblv = false ; setMenuButtonVisible( true ); } } private void updateSetItemPhoto() { if (NoteBookData.iselectposj >= 0 && NoteBookIndex.curSelprojno >= 0 ){ int [] daparv = new int [ 18 ]; byte [] tmpRbyteArr = new byte [ 66 ]; if (mcurAssetJno <= 0 ){ int icItemIDno = mListAdapter.mDaItemList.get(NoteBookData.iselectposj).getItemIDno(); daparv[ 0 ] = icItemIDno; daparv[ 1 ] = - 1 ; int iretcn = ActEventDataClass.JavaJNIgetSetNoteBookItem(NOTEBOOK_UPDATEITEMPHOTO, daparv, - 1 , tmpRbyteArr, 60 ); if (iretcn > 0 ){ NoteBookData.mDataChangeblv = true ; if (icItemIDno < 0 && daparv[ 1 ] > 0 ){ mListAdapter.mDaItemList.get(NoteBookData.iselectposj).setItemIDno(daparv[ 1 ]); } mListAdapter.mDaItemList.get(NoteBookData.iselectposj).setItemSelfpicMark(NoteBookData.ITEMPIC_YES); mListAdapter.notifyItemChanged(NoteBookIndex.curSelprojno); } } else { NoteBookData.mDataChangeblv = true ; mListAdapter.mDaItemList.get(NoteBookData.iselectposj).setItemSelfpicMark(NoteBookData.ITEMPIC_NO); mListAdapter.mDaItemList.get(NoteBookData.iselectposj).setItemAssetJno(mcurAssetJno); mListAdapter.notifyItemChanged(NoteBookIndex.curSelprojno); } } } private void handleSelSetItemPhoto() { Intent intent = new Intent(mContext,CameraPhotoSelActivity. class ); intent.putExtra( "OPERCTRL" ,NoteBookData.PICMARKCODE); startActivityForResult(intent,REQUESTCODE_PICTURE); } private void ListSetUpdateView() { if (COMCONST.mc_ontimeTaskLockblv) { systemBusyWaitThread startWait2 = new systemBusyWaitThread(handler, "WAITSAVE33" ,LISTSETREFRESH); Thread thread2 = new Thread(startWait2, "BusyWait33" ); thread2.start(); } COMCONST.mc_ontimeTaskLockblv = true ; byte [] tmpRbyteArr = new byte [ 288 ]; int [] daparv = new int [ 18 ]; tmpRbyteArr[ 0 ] = NoteBookData.mcurItemMode; byte [] byteName = NoteBookData.mcustom_Col1Name.getBytes(); int iclen = byteName.length; if (iclen > 26 ) iclen = 26 ; for ( int jb = 0 ;jb < iclen;jb++) tmpRbyteArr[jb+ 1 ] = byteName[jb]; int iboffv = 1 +iclen; daparv[ 0 ] = iclen; byte [] byteNote = NoteBookData.mcustom_Col2Note.getBytes(); iclen = byteNote.length; if (iclen > 26 ) iclen = 26 ; for ( int jb = 0 ;jb < iclen;jb++) tmpRbyteArr[jb+iboffv] = byteNote[jb]; daparv[ 1 ] = iclen; int iretItemNum = ActEventDataClass.JavaJNIgetSetNoteBookItem(NOTEBOOK_UPDATEHEADCOLNAME,daparv,- 1 ,tmpRbyteArr, 280 ); mcol2_noteTitle.setText(NoteBookData.mcustom_Col2Note); mcol1_nameTitle.setText(NoteBookData.mcustom_Col1Name); mListAdapter.build_IndexItemLst(); mListAdapter.notifyDataSetChanged(); COMCONST.mc_ontimeTaskLockblv = false ; } private void handle_TitlePasswdCheck() { PopupWindowCustom popupWindow = new PopupWindowCustom(mContext); String titleInfoj = getResources().getString(R.string.common_passwordpwin); popupWindow.setLayoutIdAndInfo(R.layout.popupwindow_custom,titleInfoj, - 202202 ); popupWindow.setCurCheckPassword(PopupWindowCustom.PASSWDKIND_PUBLICDATA,String.valueOf(mtitle_Passwd)); popupWindow.setOutsideTouchable( false ); popupWindow.setAnimationStyle(R.style.PopUpWinDlg); popupWindow.setOnSelectItemListener( new OnSelectItemListener() { @Override public void selectItem(String name, int type) { if (type == 11 ){ handler.sendEmptyMessage(TITLEFOLDERBUTTON); } } }); popupWindow.setOnDismissListener( new PopupWindow.OnDismissListener() { @Override public void onDismiss() { COMCONST.mc_popWindowLockblv = false ; } }); popupWindow.showDialogWindow(mLayout_butMENU, COMCONST.LocationType.LEFT_BOTTOM); } private void handleAppendUpdateItem() { if (mClickIndexPosj < 0 || mitemNewblv == true ){ // append new item NoteBookData itemData = new NoteBookData(); byte [] tmpRbyteArr = new byte [ 288 ]; int [] daparv = new int [ 18 ]; daparv[ 1 ] = 0 ; daparv[ 2 ] = 0 ; int iretv = ActEventDataClass.JavaJNIgetSetNoteBookItem(NOTEBOOK_GETDATETIME,daparv,- 1 ,tmpRbyteArr, 280 ); if (iretv > 0 ){ int icyear = daparv[ 0 ]; byte bmonth = tmpRbyteArr[ 0 ]; byte bday = tmpRbyteArr[ 1 ]; byte bweekno = tmpRbyteArr[ 2 ]; byte bhour = tmpRbyteArr[ 3 ]; byte bmin = tmpRbyteArr[ 4 ]; byte bsec = tmpRbyteArr[ 5 ]; itemData.setItemDateTime(icyear,bmonth,bweekno,bday,bhour,bmin,bsec); } itemData.setItemIDno(mrecordItemIDno); mrecordItemIDno++; itemData.setByteParaItem(popwNoteBookData.mcurItemKind,NoteBookData.ITEMPIC_NO,NoteBookData.TITLESTATUS_CLOSE); itemData.setItemName(popwNoteBookData.mName); itemData.setItemNote(popwNoteBookData.mNote); itemData.setItemPasswd(popwNoteBookData.mcurPasswdCode); if (NoteBookData.iselectposj >= 0 && NoteBookData.iselectposj < mListAdapter.mDaItemList.size()) { mListAdapter.mDaItemList.add(NoteBookData.iselectposj + 1 , itemData); } else { mListAdapter.mDaItemList.add(itemData); } } else { ; }; mListAdapter.build_IndexItemLst(); NoteBookIndex.curSelprojno = mListAdapter.getCurIndexPosj(NoteBookData.iselectposj,NoteBookIndex.curSelprojno); mListAdapter.notifyDataSetChanged(); NoteBookData.mDataChangeblv = true ; } private void popWin_TitleItemEdit() { if (popwNoteBookData.mcurEditMode == popwNoteBookData.EDITMODE_UPDATE || popwNoteBookData.mcurEditMode == popwNoteBookData.EDITMODE_DELETE|| popwNoteBookData.mcurEditMode == popwNoteBookData.EDITMODE_VERIFY){ if (NoteBookData.iselectposj < 0 || NoteBookData.iselectposj >= mListAdapter.mDaItemList.size()){ COMCONST.ToastCenterImage(mContext,getResources().getString(R.string.fragNoteBookTxt_operErr),R.drawable.comvec_err,Toast.LENGTH_LONG,Color.RED); return ; } popwNoteBookData.mNote = mListAdapter.mDaItemList.get(NoteBookData.iselectposj).getItemNote(); popwNoteBookData.mName = mListAdapter.mDaItemList.get(NoteBookData.iselectposj).getItemName(); popwNoteBookData.mcurPasswdCode = mListAdapter.mDaItemList.get(NoteBookData.iselectposj).getItemPasswd(); } popwNoteBookEdit comEdtDlg = new popwNoteBookEdit((Activity) mContext, "NOTEBOOK" ); comEdtDlg.setOnWinButtonClickListener( new popwNoteBookEdit.OnWinButtonClickListener(){ @Override public void onWindButtonClick( int butcd, String menuName) { if (butcd == popwNoteBookData.OPERBUTTON_YES) { if (popwNoteBookData.mcurEditMode == popwNoteBookData.EDITMODE_UPDATE) { handler.sendEmptyMessage(NOTEBOOKITEM_UPDATE); } else if (popwNoteBookData.mcurEditMode == popwNoteBookData.EDITMODE_DELETE){ handler.sendEmptyMessage(NOTEBOOKITEM_DELETE); } else { handler.sendEmptyMessage(APPENDUPDATE_NOTEBOOKITEM); } } } }); comEdtDlg.showAtScreen(mLayout_butMENU,COMCONST.LocationType.LEFT_BOTTOM); // COMCONST.LocationType.PARENT_CENTER);// COMCONST.LocationType.LEFT_BOTTOM); } private void popWin_KeyInfoEditSet() { if (mikeyInfoCode == 2 ){ NoteBookData.iselectposj = mListAdapter.GetSelItemKeyposj(NoteBookIndex.curSelprojno); } if (NoteBookData.iselectposj < 0 || NoteBookData.iselectposj >= mListAdapter.mDaItemList.size()) { COMCONST.ToastCenterImage(mContext, getResources().getString(R.string.fragNoteBookTxt_operErr), R.drawable.comvec_err, Toast.LENGTH_LONG, Color.RED); return ; } popwNoteBookData.mkeyInfoClearblv = false ; popwNoteBookData.mcurKeyInfoNum = mListAdapter.GetKeyInfoItemNum(); popwNoteBookData.mcurKeyInfoIDno = mListAdapter.GetItemIDno(NoteBookData.iselectposj); popwNoteBookData.mcurKeyInfoposj = mListAdapter.checkGetKeyInfoItem(popwNoteBookData.mcurKeyInfoIDno); popwNoteBookData.mkeyInfo_Note = mListAdapter.GetKeyInfoItemNote(popwNoteBookData.mcurKeyInfoIDno); popwNoteBookData.mkeyInfo_picname = mListAdapter.GetItemPictureFullname(NoteBookData.iselectposj); popwNoteBookData.mNote = mListAdapter.mDaItemList.get(NoteBookData.iselectposj).getItemNote(); popwNoteBookData.mName = mListAdapter.mDaItemList.get(NoteBookData.iselectposj).getItemName(); popwNoteBookData.mcurPasswdCode = mListAdapter.mDaItemList.get(NoteBookData.iselectposj).getItemPasswd(); popwNoteBookData.mkeyInfo_Title = getResources().getString(R.string.fragNoteBookPopw_keyInfoTitle); popwKeyInfo comEdtDlg = new popwKeyInfo((Activity) mContext, "NOTEBOOK" ); comEdtDlg.setOnWinButtonClickListener( new popwKeyInfo.OnWinButtonClickListener(){ @Override public void onWindButtonClick( int butcd, String menuName) { if (butcd == popwNoteBookData.KEYINFO_UPDATE){ handler.sendEmptyMessage(KEYINFORMATION_UPDATE); } if (butcd == popwNoteBookData.KEYINFO_APPEND){ handler.sendEmptyMessage(KEYINFORMATION_APPEND); } if (butcd == popwNoteBookData.KEYINFO_CANCEL){ if (popwNoteBookData.mkeyInfoClearblv){ handler.sendEmptyMessage(KEYINFORMATION_CLEAR); } } } }); comEdtDlg.showAtScreen(mLayout_butMENU,COMCONST.LocationType.LEFT_BOTTOM); // COMCONST.LocationType.PARENT_CENTER);// COMCONST.LocationType.LEFT_BOTTOM); } private void CircleADDButtonMenu( int iposj) { int icolor_darkRed = getResources().getColor(R.color.pmenucolor_darkRed); int icolor_darkGreen = getResources().getColor(R.color.pmenucolor_darkGreen); int icolor_darkBlue = getResources().getColor(R.color.pmenucolor_darkBlue); int icolor_darkYellow = getResources().getColor(R.color.pmenucolor_darkYellow); int icolor_darkSky = getResources().getColor(R.color.pmenucolor_darkSky); int icolor_darkBlack = getResources().getColor(R.color.pmenucolor_darkBlack); int icolor_spec66 = getResources().getColor(R.color.pmenucolor_spec66); mPopMenu = new bs60PopMenu((Activity)mContext); final List<myMenuItem> menuItems = new ArrayList<>(); String[] menuName = getResources().getStringArray(R.array.mainshare_menu); int menuItemjn = 0 ; mikeyInfoCode = 0 ; if (mselItem_DelMarkb == NoteBookData.ITEMDELETE_NO) { mikeyInfoCode = mListAdapter.checkItemIfKeyInfo(NoteBookIndex.curSelprojno); if (iposj >= 0 ) { boolean classblv = mListAdapter.checkGetItemIfClass(iposj); if (!classblv) { menuItemjn++; menuItems.add( new myMenuItem( "000" , R.drawable.comvec_keyinfo, getResources().getString(R.string.fragNoteBookEdit_keyInfo), icolor_darkYellow)); } if (mikeyInfoCode != 1 ) { // no key title menuItemjn++; menuItems.add( new myMenuItem( "111" , R.drawable.vec_openshare_yes, getResources().getString(R.string.fragNoteBookEdit_data), icolor_darkGreen)); menuItemjn++; menuItems.add( new myMenuItem( "222" , R.drawable.comvec_delete, getResources().getString(R.string.fragPersonEdit_delete), icolor_darkRed)); } if (!classblv && mselItem_DATAKIND != NoteBookIndex.ITEMTYPE_KEYDATA) { menuItemjn++; menuItems.add( new myMenuItem( "555" , R.drawable.comvec_picture, getResources().getString(R.string.fragmentClockin_menuSelPic), icolor_darkBlack)); // 设置项目图片 } } if (mselItem_DATAKIND != NoteBookIndex.ITEMTYPE_KEYDATA) { menuItemjn++; menuItems.add( new myMenuItem( "333" , R.drawable.comvec_add, getResources().getString(R.string.fragPersonEdit_addclass), icolor_darkBlue)); menuItemjn++; menuItems.add( new myMenuItem( "444" , R.drawable.comvec_addcircle, getResources().getString(R.string.fragPersonEdit_additem), icolor_darkYellow)); } menuItemjn++; menuItems.add( new myMenuItem( "777" , R.drawable.comvec_menu, getResources().getString(R.string.fragNoteBookTxt_ListForm), icolor_darkSky)); } else { menuItemjn++; menuItems.add( new myMenuItem( "666" , R.drawable.comvec_undo, getResources().getString(R.string.fragNoteBookTxt_undelete), icolor_darkGreen)); menuItemjn++; menuItems.add( new myMenuItem( "333" , R.drawable.comvec_add, getResources().getString(R.string.fragPersonEdit_addclass), icolor_darkBlue)); menuItemjn++; menuItems.add( new myMenuItem( "444" , R.drawable.comvec_addcircle, getResources().getString(R.string.fragPersonEdit_additem), icolor_darkYellow)); menuItemjn++; menuItems.add( new myMenuItem( "777" , R.drawable.comvec_menu, getResources().getString(R.string.fragNoteBookTxt_ListForm), icolor_darkSky)); } menuItemjn++; menuItems.add( new myMenuItem( "999" , R.drawable.comshare_webcyber, getResources().getString(R.string.fragNoteBookTxt_selectModel),icolor_darkGreen)); if (menuItemjn > 0 ) { int itxtcolorv = R.color.pmenucolor_black; mPopMenu .setMenuBgColor(COMCONST.POPSUBMENUBG_COLOR) .setMenuTxtColor(itxtcolorv) .setWidth( 0 ) //默认宽度wrap_content .showIcon(showIcon) //显示菜单图标,默认为true .dimBackground(dimBg) //背景变暗,默认为true .needAnimationStyle(needAnim) //显示动画,默认为true .addMenuList(menuItems, 0 ) .setOnMenuItemClickListener( new bs60PopMenu.OnMenuItemClickListener() { @Override public void onMenuItemClick( int position, String menuName) { String menuID = menuItems.get(position).getId(); if (menuID.equals( "000" )) { // key information handler.sendEmptyMessage(KEYINFORMATION_EDITSET); } if (menuID.equals( "111" )) { // edit mitemNewblv = false ; popwNoteBookData.mcurEditMode = popwNoteBookData.EDITMODE_UPDATE; popwNoteBookData.mdlgTitleName = getResources().getString(R.string.fragNoteBookPopw_editData); if (mikeyInfoCode == 2 ) { // key data handler.sendEmptyMessage(KEYINFORMATION_EDITSET); } else { handler.sendEmptyMessage(TITLEITEMEDITPOPW); } } if (menuID.equals( "222" )) { // delete select item mitemNewblv = false ; popwNoteBookData.mcurEditMode = popwNoteBookData.EDITMODE_DELETE; popwNoteBookData.mdlgTitleName = getResources().getString(R.string.fragNoteBookPopw_deleteItem); if (mikeyInfoCode == 2 ) { // key data handler.sendEmptyMessage(KEYINFORMATION_DELETE); } else { handler.sendEmptyMessage(TITLEITEMEDITPOPW); } } if (menuID.equals( "333" )) { // append new Title mitemNewblv = true ; popwNoteBookData.mcurEditMode = popwNoteBookData.EDITMODE_NEWCLASS; popwNoteBookData.mdlgTitleName = getResources().getString(R.string.fragNoteBookPopw_newClass); popwNoteBookData.mcurItemKind = popwNoteBookData.ITEMKIND_TITLE; handler.sendEmptyMessage(TITLEITEMEDITPOPW); } if (menuID.equals( "444" )) { // append new data mitemNewblv = true ; popwNoteBookData.mcurEditMode = popwNoteBookData.EDITMODE_NEWDATA; popwNoteBookData.mdlgTitleName = getResources().getString(R.string.fragNoteBookPopw_newItem); popwNoteBookData.mcurItemKind = popwNoteBookData.ITEMKIND_DATA; handler.sendEmptyMessage(TITLEITEMEDITPOPW); } if (menuID.equals( "555" )) { // select set item picture handler.sendEmptyMessage(SELECTSETITEMPICTURE); } if (menuID.equals( "666" )) { // cancel delete item handler.sendEmptyMessage(HANDLEDELETE_CANCEL); } if (menuID.equals( "777" )) { // view List set handler.sendEmptyMessage(POPWIN_VIEWLISTSET); } if (menuID.equals( "888" )) { // build model handler.sendEmptyMessage(BUILDMODELPOPWIN); } if (menuID.equals( "999" )) { // select model mwait_OnTimeLoopNum = 0 ; handler.sendEmptyMessage(HANDLE_SELECTMODEL); } } }) .showAsDropDown(mLayout_butMENU, 10 , 0 ); } } private void processKeyInfo_Delete() { boolean cretblv = mListAdapter.deleteSelKeyItem(NoteBookIndex.curSelprojno); if (cretblv) { mListAdapter.build_IndexItemLst(); NoteBookIndex.curSelprojno = mListAdapter.getCurIndexPosj(NoteBookData.iselectposj,NoteBookIndex.curSelprojno); mListAdapter.notifyDataSetChanged(); NoteBookData.mDataChangeblv = true ; } } private void processKeyInfo_Clear() { boolean cretblv = mListAdapter.appendUpdateKeyInfo(popwNoteBookData.mkeyInfoClearblv, false ,- 1 , "" ); if (cretblv) { mListAdapter.build_IndexItemLst(); NoteBookIndex.curSelprojno = mListAdapter.getCurIndexPosj(NoteBookData.iselectposj,NoteBookIndex.curSelprojno); mListAdapter.notifyDataSetChanged(); NoteBookData.mDataChangeblv = true ; } } private void processKeyInfo_Append() { boolean cretblv = mListAdapter.appendUpdateKeyInfo(popwNoteBookData.mkeyInfoClearblv, true ,popwNoteBookData.mcurKeyInfoIDno,popwNoteBookData.mkeyInfo_curNote); popwNoteBookData.mkeyInfoClearblv = false ; if (cretblv) { mListAdapter.build_IndexItemLst(); String strTraceInfo = mListAdapter.getTraceInfo(); //xxxxxxx NoteBookIndex.curSelprojno = mListAdapter.getCurIndexPosj(NoteBookData.iselectposj,NoteBookIndex.curSelprojno); mListAdapter.notifyDataSetChanged(); NoteBookData.mDataChangeblv = true ; } } private void processKeyInfo_Update() { boolean cretblv = mListAdapter.appendUpdateKeyInfo(popwNoteBookData.mkeyInfoClearblv, false ,popwNoteBookData.mcurKeyInfoIDno,popwNoteBookData.mkeyInfo_curNote); if (cretblv) { mListAdapter.build_IndexItemLst(); NoteBookIndex.curSelprojno = mListAdapter.getCurIndexPosj(NoteBookData.iselectposj,NoteBookIndex.curSelprojno); mListAdapter.notifyDataSetChanged(); NoteBookData.mDataChangeblv = true ; } } private void saveSetUpdateData() { if (mwait_OnTimeLoopNum == 0 ){ mwait_OnTimeLoopNum++; mLayout_butMENU.setVisibility(View.INVISIBLE); mLayout_butFIND.setVisibility(View.INVISIBLE); mLayout_Radio.setVisibility(View.INVISIBLE); mtxt_winInfo.setText(getResources().getString(R.string.fragNoteBookTxt_Downloading)); } if (COMCONST.mc_ontimeTaskLockblv) { systemBusyWaitThread startWait2 = new systemBusyWaitThread(handler, "WAITSAVE33" , HANDLEUPDATE_SAVEDATA); Thread thread2 = new Thread(startWait2, "BusyWait33" ); thread2.start(); } else { COMCONST.mc_ontimeTaskLockblv = true ; mLayout_butMENU.setVisibility(View.INVISIBLE); mLayout_butFIND.setVisibility(View.INVISIBLE); mLayout_Radio.setVisibility(View.INVISIBLE); saveUpdateNoteBookData(); mLayout_butMENU.setVisibility(View.VISIBLE); mLayout_butFIND.setVisibility(View.VISIBLE); mLayout_Radio.setVisibility(View.VISIBLE); COMCONST.mc_ontimeTaskLockblv = false ; if (mBackSaveOperblv){ mBackSaveOperblv = false ; handler.sendEmptyMessage(NOTEBOOK_GOHOME); } } } private void saveUpdateNoteBookData() { int [] daparv = new int [ 18 ]; byte [] tmpRbyteArr = new byte [ 366 ]; int iStartIDno = 1 ; if (mListAdapter.mDaItemList.size() > 0 ) { for ( int ji = 0 ; ji < mListAdapter.mDaItemList.size(); ji++) { if (mListAdapter.mDaItemList.get(ji).getItemDelMark() == NoteBookData.ITEMDELETE_YES) continue ; int icIDno = mListAdapter.mDaItemList.get(ji).getItemIDno(); if (icIDno >= iStartIDno) iStartIDno = icIDno+ 1 ; } } int iretcn = ActEventDataClass.JavaJNIgetSetNoteBookItem(NOTEBOOK_BAKFILE, daparv, - 1 , tmpRbyteArr, iStartIDno); if (iretcn > 0 && mListAdapter.mDaItemList.size() > 0 ){ int itemposj = 0 ; for ( int j = 0 ;j < mListAdapter.mDaItemList.size();j++){ if (mListAdapter.mDaItemList.get(j).getItemDelMark() == NoteBookData.ITEMDELETE_YES) continue ; tmpRbyteArr[ 0 ] = mListAdapter.mDaItemList.get(j).getDatakind(); tmpRbyteArr[ 1 ] = mListAdapter.mDaItemList.get(j).getSelfpic(); tmpRbyteArr[ 2 ] = mListAdapter.mDaItemList.get(j).getDateMonth(); tmpRbyteArr[ 4 ] = mListAdapter.mDaItemList.get(j).getDateWeekno(); tmpRbyteArr[ 3 ] = mListAdapter.mDaItemList.get(j).getDateDay(); tmpRbyteArr[ 5 ] = mListAdapter.mDaItemList.get(j).getTimeHour(); tmpRbyteArr[ 6 ] = mListAdapter.mDaItemList.get(j).getTimeMinute(); tmpRbyteArr[ 7 ] = mListAdapter.mDaItemList.get(j).getTimeSecond(); int iboffv = 8 ; daparv[ 0 ] = mListAdapter.mDaItemList.get(j).getDateYear(); daparv[ 1 ] = mListAdapter.mDaItemList.get(j).getItemIDno(); String strName = mListAdapter.mDaItemList.get(j).getItemName(); byte [] byteName = strName.getBytes(); int inamebn = byteName.length; if (inamebn > 120 ) inamebn = 120 ; daparv[ 2 ] = inamebn; if (inamebn > 0 ){ for ( int jb = 0 ;jb < inamebn;jb++){ tmpRbyteArr[iboffv] = byteName[jb]; iboffv++; } } String strNote = mListAdapter.mDaItemList.get(j).getItemNote(); byte [] byteNote = strNote.getBytes(); int inotebn = byteNote.length; if (inotebn > 120 ) inotebn = 120 ; daparv[ 3 ] = inotebn; if (inotebn > 0 ){ for ( int jb = 0 ;jb < inotebn;jb++){ tmpRbyteArr[iboffv] = byteNote[jb]; iboffv++; } } daparv[ 4 ] = mListAdapter.mDaItemList.get(j).getItemPasswd(); daparv[ 5 ] = mListAdapter.mDaItemList.get(j).getItemAssetJno(); int iretv = ActEventDataClass.JavaJNIgetSetNoteBookItem(NOTEBOOK_APPENDITEM, daparv, itemposj, tmpRbyteArr, iboffv); itemposj++; if (iretv < 0 ) break ; } int iretv = ActEventDataClass.JavaJNIgetSetNoteBookItem(NOTEBOOK_APPENDEND, daparv, 0 , tmpRbyteArr, 0 ); } // key information int icurKeyInfoNum = 0 ; if (mListAdapter.mDaKeyInfoList.size() > 0 ){ for ( int jk = 0 ;jk < mListAdapter.mDaKeyInfoList.size();jk++){ daparv[ 0 ] = mListAdapter.mDaKeyInfoList.get(jk).getKeyInfoIDno(); String strKeyinfo = mListAdapter.mDaKeyInfoList.get(jk).getKeyInfoNote(); byte [] byteKeyinfo = strKeyinfo.getBytes(); int ikeyInfobn = byteKeyinfo.length; if (ikeyInfobn > 120 ) ikeyInfobn = 120 ; daparv[ 1 ] = ikeyInfobn; int iboffv = 0 ; if (ikeyInfobn > 0 ){ for ( int jb = 0 ;jb < ikeyInfobn;jb++){ tmpRbyteArr[iboffv] = byteKeyinfo[jb]; iboffv++; } } int iretv = ActEventDataClass.JavaJNIgetSetNoteBookItem(NOTEBOOK_KEYINFOUPDATE, daparv, jk, tmpRbyteArr, iboffv); if (iretv < 0 ) break ; icurKeyInfoNum++; }; } daparv[ 0 ] = icurKeyInfoNum; int iretv = ActEventDataClass.JavaJNIgetSetNoteBookItem(NOTEBOOK_KEYINFOUPDATE, daparv, KEYINFOCODE_SAVE, tmpRbyteArr, 0 ); String strInfoj = getResources().getString(R.string.fragNoteBookTxt_dataSaved); mtxt_winInfo.setText(strInfoj); NoteBookData.mDataChangeblv = false ; } private void webDataLst_DownloadCheck() { if (mwait_OnTimeLoopNum == 0 ){ mwait_OnTimeLoopNum++; mLayout_butMENU.setVisibility(View.INVISIBLE); mLayout_butFIND.setVisibility(View.INVISIBLE); mLayout_Radio.setVisibility(View.INVISIBLE); mtxt_winInfo.setTextColor(Color.BLUE); mtxt_winInfo.setText(getResources().getString(R.string.fragNoteBookTxt_Downloading)); } if (COMCONST.mc_ontimeTaskLockblv) { commonBusyWaitThread startWait = new commonBusyWaitThread(handler, "WAITSAVE61" , WEBMODELDALST_DLOADCHK, 600 ); Thread thread = new Thread(startWait, "BusyWait61" ); thread.start(); } else { COMCONST.mc_ontimeTaskLockblv = true ; int [] ipdarv = new int [ 8 ]; byte [] RbyteArr = new byte [ 266 ]; int iretcn = ActEventDataClass.JavaJNIgetComModelLstItem(COMMODEL_DLOADLSTSAVEFILE,ipdarv ,COMMODELKIND_NOTEBOOK,RbyteArr, 260 ); if (iretcn > 0 ) { dloadModelWebSavePathfile = new String(RbyteArr, 0 ,iretcn); downLoadThread = new Thread(downloadSaveModelLstRunnable); downLoadThread.start(); } else { mwinTxtInfoColor = Color.YELLOW; Message msg = new Message(); msg.what = RESTOREOPERFACE; msg.obj = "---" ; handler.sendMessage(msg); } } } private void parseMode_updateDataLst() { mtxt_winInfo.setTextColor(Color.BLUE); mtxt_winInfo.setText(getResources().getString(R.string.fragNoteBookTxt_parseModelLst)); byte [] tmpRbyteArr = new byte [ 388 ]; int [] daparv = new int [ 18 ]; int iretFileNum = ActEventDataClass.JavaJNIgetComModelLstItem(COMMODEL_PARSEDATAITEM, daparv, COMMODELKIND_NOTEBOOK, tmpRbyteArr, 380 ); if (iretFileNum < 2 ) { mwinTxtInfoColor = Color.YELLOW; Message msg = new Message(); msg.what = RESTOREOPERFACE; msg.obj = getResources().getString(R.string.fragNoteBookTxt_modelDataErr); handler.sendMessage(msg); return ; } // mListAdapter.mDaKeyInfoList.clear(); mListAdapter.mDaItemList.clear(); mrecordItemIDno = 1 ; int iretItemNum = ActEventDataClass.JavaJNIgetSetNoteBookItem(NOTEBOOK_GETLSTNUM, daparv, - 1 , tmpRbyteArr, 380 ); if (iretItemNum >= 0 ){ NoteBookData.mcurItemMode = tmpRbyteArr[ 0 ]; int icol1Namecn = daparv[ 1 ]; int iboffv = 1 ; if (icol1Namecn > 0 ) { NoteBookData.mcustom_Col1Name = new String(tmpRbyteArr, iboffv, icol1Namecn); iboffv = iboffv + icol1Namecn; mcol1_nameTitle.setText(NoteBookData.mcustom_Col1Name); } int icol2Notecn = daparv[ 2 ]; if (icol2Notecn > 0 ) { NoteBookData.mcustom_Col2Note = new String(tmpRbyteArr, iboffv, icol2Notecn); iboffv = iboffv + icol2Notecn; mcol2_noteTitle.setText(NoteBookData.mcustom_Col2Note); }; } if (iretItemNum > 0 ) { for ( int jrec = 0 ;jrec < iretItemNum;jrec++) { int iretcn = ActEventDataClass.JavaJNIgetSetNoteBookItem(NOTEBOOK_DATAITEM, daparv, jrec, tmpRbyteArr, 180 ); if (iretcn < 0 ) break ; if (iretcn <= 0 ) continue ; int ioffv = 0 ; byte dakindc = tmpRbyteArr[ioffv]; ioffv++; byte selfpic = tmpRbyteArr[ioffv]; ioffv++; byte bassetno = tmpRbyteArr[ioffv]; ioffv++; byte bmonth = tmpRbyteArr[ioffv]; ioffv++; byte bday = tmpRbyteArr[ioffv]; ioffv++; byte bweekno = tmpRbyteArr[ioffv]; ioffv++; byte bhour = tmpRbyteArr[ioffv]; ioffv++; byte bmin = tmpRbyteArr[ioffv]; ioffv++; byte bsec = tmpRbyteArr[ioffv]; ioffv++; int icyear = daparv[ 0 ]; int itemIDno = daparv[ 1 ]; int inamebn = daparv[ 2 ]; int inotebn = daparv[ 3 ]; int ipasswd = daparv[ 4 ]; String strName = "" ; if (inamebn > 0 && inamebn < 50 ) { strName = new String(tmpRbyteArr, ioffv, inamebn); ioffv = ioffv + inamebn; } String strNote = "" ; if (inotebn > 0 && inotebn < 120 ) { strNote = new String(tmpRbyteArr, ioffv, inotebn); ioffv = ioffv + inotebn; } NoteBookData itemdata = new NoteBookData(); itemdata.setByteParaItem(dakindc, selfpic, NoteBookData.TITLESTATUS_CLOSE); itemdata.setItemDateTime(icyear, bmonth, bweekno, bday, bhour, bmin, bsec); itemdata.setItemAssetJno(( int ) bassetno); itemdata.setItemIDno(itemIDno); if (mrecordItemIDno <= itemIDno && itemIDno > 0 ) mrecordItemIDno = itemIDno + 1 ; itemdata.setItemName(strName); itemdata.setItemNote(strNote); itemdata.setItemPasswd(ipasswd); mListAdapter.mDaItemList.add(itemdata); } } NoteBookIndex.curSelprojno = - 1 ; NoteBookData.iselectposj = - 1 ; mListAdapter.build_IndexItemLst(); mListAdapter.notifyDataSetChanged(); mwinTxtInfoColor = Color.WHITE; Message msg = new Message(); msg.what = RESTOREOPERFACE; msg.obj = "---" ; handler.sendMessage(msg); } private void ModelExample_popwDownloadCheck() { mpopw_butCtrl = 0 ; mtxt_winInfo.setText( "..." ); String strInfoj1 = mContext.getResources().getString(R.string.fragNoteBookPopw_modelDload); String strDlgTitle = mContext.getResources().getString(R.string.popupwin_Dlgtitle); strInfoj1 = strInfoj1 +popwModelDlg.mselModelInfo+ " ?" ; PopupWindowDlg curDlg = new PopupWindowDlg((Activity) mContext,strInfoj1,strDlgTitle,PopupWindowDlg.COMMONITEMWIN); curDlg.setOnWinButtonClickListener( new PopupWindowDlg.OnWinButtonClickListener(){ @Override public void onWindButtonClick( int butcd, String menuName) { if (butcd == 9 ) { mpopw_butCtrl = 9 ; mwait_OnTimeLoopNum = 0 ; handler.sendEmptyMessage(HANDLE_DOWNLOADMODELEXAMPLE); } else { if (mpopw_butCtrl == 0 ) { mwinTxtInfoColor = Color.WHITE; Message msg = new Message(); msg.what = RESTOREOPERFACE; msg.obj = "---" ; handler.sendMessage(msg); } } }; }); curDlg.showAtScreen(mLayout_butMENU,COMCONST.LocationType.PARENT_CENTER);; } private void webModelExample_DownloadCheck() { mtxt_winInfo.setText(getResources().getString(R.string.fragNoteBookTxt_Downloading)); int [] ipdarv = new int [ 8 ]; byte [] RbyteArr = new byte [ 366 ]; int iretcn = ActEventDataClass.JavaJNIgetComModelLstItem(COMMODEL_DLOADEXAMPLESAVEFILE,ipdarv ,COMMODELKIND_NOTEBOOK,RbyteArr, 360 ); if (iretcn > 0 ) { dloadModelWebSavePathfile = new String(RbyteArr, 0 ,iretcn); downLoadThread = new Thread(downloadComModelExampleRunnable); downLoadThread.start(); } else { mLayout_butMENU.setVisibility(View.VISIBLE); mLayout_butFIND.setVisibility(View.VISIBLE); mLayout_Radio.setVisibility(View.VISIBLE); mtxt_winInfo.setTextColor(Color.BLUE); mtxt_winInfo.setText(getResources().getString(R.string.fragNoteBookTxt_modelLstErr)); COMCONST.mc_ontimeTaskLockblv = false ; } } class commonBusyWaitThread implements Runnable { Handler mTHandler; String waitNo; int iWHATval = - 1 ; int iWaitMilliSecond = 1000 ; public commonBusyWaitThread(Handler handler, String waitName, int iWhatv, int iWaitTimems) { this .mTHandler = handler; this .waitNo = waitName; this .iWHATval = iWhatv; this .iWaitMilliSecond = iWaitTimems; if (iWaitTimems < 120 ) this .iWaitMilliSecond = iWaitTimems * 1000 ; } @Override public void run() { synchronized (waitNo) { try { Thread.sleep(iWaitMilliSecond); // 1.5 second } catch (InterruptedException e) { e.printStackTrace(); } Message msg = new Message(); msg.what = iWHATval; handler.sendMessage(msg); } } } class systemBusyWaitThread implements Runnable { Handler mTHandler; String waitNo; int iWHATval = - 1 ; int iWaitSeconds = 0 ; public systemBusyWaitThread(Handler handler,String waitName, int iWhatv) { this .mTHandler = handler; this .waitNo = waitName; this .iWHATval = iWhatv; iWaitSeconds = COMCONST.ONTIMETASKWAIT; } public systemBusyWaitThread(Handler handler,String waitName, int iWhatv, int iwaitSecNum) { this .mTHandler = handler; this .waitNo = waitName; this .iWHATval = iWhatv; if (iwaitSecNum < 120 ) { iWaitSeconds = iwaitSecNum* 1000 ; } else { iWaitSeconds = iwaitSecNum; } } @Override public void run() { synchronized (waitNo) { try { Thread.sleep(iWaitSeconds); } catch (InterruptedException e) { e.printStackTrace(); } handler.sendEmptyMessage(iWHATval); } }; } private Runnable downloadSaveModelLstRunnable = new Runnable() { @Override public void run() { boolean errorBlv = false ; try { URL url = new URL(COMCONST.msWebNotebookLst); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.connect(); int length = conn.getContentLength(); InputStream is = conn.getInputStream(); File webAddrFile = new File(dloadModelWebSavePathfile); FileOutputStream fos = new FileOutputStream(webAddrFile); int count = 0 ; byte buf[] = new byte [ 1024 ]; do { int numread = is.read(buf); count += numread; if (numread <= 0 ) { //下载完成通知安装 handler.sendEmptyMessage(DOWNLOADMODELLST_SUCESS); break ; } fos.write(buf, 0 , numread); } while ( true ); fos.close(); is.close(); } catch (MalformedURLException e) { e.printStackTrace(); errorBlv = true ; } catch (IOException e) { e.printStackTrace(); errorBlv = true ; } if (errorBlv) { handler.sendEmptyMessage(DOWNLOAD_FALTURE); } } }; private Runnable downloadComModelExampleRunnable = new Runnable() { @Override public void run() { String strInfoj1 = popwModelDlg.mselModelInfo+ " >> " +mContext.getResources().getString(R.string.fragNoteBookTxt_Downloading); mtxt_winInfo.setText(strInfoj1); boolean errorBlv = false ; try { URL url = new URL(comModelDownloadUrl); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.connect(); int length = conn.getContentLength(); InputStream is = conn.getInputStream(); File downloadSaveFile = new File(dloadModelWebSavePathfile); FileOutputStream fos = new FileOutputStream(downloadSaveFile); int count = 0 ; byte buf[] = new byte [ 1024 ]; do { int numread = is.read(buf); count += numread; if (numread <= 0 ) { //下载完成通知安装 handler.sendEmptyMessage(DLOADMODELEXAMPLE_SUCESS); break ; } fos.write(buf, 0 , numread); } while ( true ); fos.close(); is.close(); } catch (MalformedURLException e) { e.printStackTrace(); errorBlv = true ; } catch (IOException e) { e.printStackTrace(); errorBlv = true ; } if (errorBlv) { handler.sendEmptyMessage(DOWNLOAD_FALTURE); } } }; @Override public void onActivityResult( int requestCode, int resultCode, Intent data) { super .onActivityResult(requestCode, resultCode, data); if (requestCode == REQUESTCODE_PICTURE) { if (resultCode != RESULT_OK) { // m_title.setText("!= RESULT_OK");//xxxxxxx return ; } if (data != null ) { /** 取参 */ int param = data.getIntExtra( "RETVAL" , 0 ); if (param == 111 ){ mcurAssetJno = - 1 ; mwait_OnTimeLoopNum = 0 ; handler.sendEmptyMessage(UPDATESETITEMPICTURE); } else { if (param > 1000 ){ mcurAssetJno = param - 1000 ; mwait_OnTimeLoopNum = 0 ; handler.sendEmptyMessage(UPDATESETITEMPICTURE); } } } } } // 设置 接口回调 方法 public void sendMessage(ICallBack callBack){ this .callback = callBack; } //Receive message - activity to fragment public void receiveMsg( int msgcd,String msg) { if (msgcd == NoteBookData.UPDATESAVEITEMDATA) { if (NoteBookData.mDataChangeblv){ mBackSaveOperblv = true ; mwait_OnTimeLoopNum = 0 ; saveSetUpdateData(); } } } } |
B), Layout
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | <? xml version="1.0" encoding="utf-8"?> < RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/fragNoteBookColor_bkg" tools:context="com.bi3eview.newstart60.local.notebook.FragmentNoteBook"> < LinearLayout android:gravity="center" android:id="@+id/top_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="3dp" android:paddingBottom="3dp" android:layout_marginLeft="3dp" android:layout_marginRight="3dp" android:orientation="horizontal" android:weightSum="100"> < LinearLayout android:id="@+id/Layoutbut_MARK" android:layout_width="0dp" android:layout_height="36dp" android:gravity="center" android:layout_weight="10" android:orientation="horizontal"> < ImageView android:id="@+id/img_markL" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="10" android:gravity="right" android:tint="#FF555500" android:src="@drawable/comvec_ring" /> </ LinearLayout > < LinearLayout android:layout_width="0dp" android:layout_height="36dp" android:gravity="center" android:layout_weight="2" android:orientation="horizontal"> </ LinearLayout > < LinearLayout android:id="@+id/Layoutbut_winInfo" android:layout_width="0dp" android:layout_height="wrap_content" android:gravity="center" android:layout_weight="87" android:orientation="horizontal"> < TextView android:id="@+id/topwin_info" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="left" android:textColor="@color/tableheadColor1_topvtxt" android:text="" android:textSize="@dimen/timetaskbut_text" /> </ LinearLayout > < LinearLayout android:layout_width="0dp" android:layout_height="36dp" android:gravity="center" android:layout_weight="1" android:orientation="horizontal"> </ LinearLayout > </ LinearLayout > < LinearLayout android:gravity="center" android:layout_below="@+id/top_view" android:id="@+id/menubutton_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="3dp" android:paddingBottom="3dp" android:layout_marginLeft="3dp" android:layout_marginRight="3dp" android:orientation="horizontal" android:weightSum="100"> < LinearLayout android:id="@+id/Layoutbut_MENU" android:layout_width="0dp" android:layout_height="36dp" android:gravity="center" android:layout_weight="10" android:orientation="horizontal"> < ImageView android:id="@+id/imgbut_mparMENU" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="10" android:gravity="center" android:tint="#FF22dd22" android:src="@drawable/comvec_addcircle" /> </ LinearLayout > < LinearLayout android:layout_width="0dp" android:layout_height="36dp" android:gravity="center" android:layout_weight="1" android:orientation="horizontal"> </ LinearLayout > < LinearLayout android:id="@+id/Layoutbut_EDIT" android:layout_width="0dp" android:layout_height="36dp" android:gravity="left|center_vertical" android:layout_weight="31" android:orientation="horizontal"> < TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="left" android:text=" " android:textSize="12dp" /> < EditText android:text="" android:id="@+id/edtTxt_find" android:maxLength="40" android:layout_width="120dp" android:layout_height="wrap_content" android:saveEnabled="false" android:singleLine="true" android:gravity="left|center_vertical" android:textAppearance="@android:style/TextAppearance.Medium" android:textSize="@dimen/fragNoteBookFntsize_editTxt" android:textColor="@color/fragNoteBookColor_editTxt" > </ EditText > </ LinearLayout > < LinearLayout android:layout_width="0dp" android:layout_height="36dp" android:gravity="center" android:layout_weight="1" android:orientation="horizontal"> </ LinearLayout > < LinearLayout android:id="@+id/Layoutbut_FIND" android:layout_width="0dp" android:layout_height="32dp" android:gravity="center" android:layout_weight="25" android:background="@drawable/combutton_layoutbg" android:orientation="horizontal"> < ImageView android:id="@+id/imgfind_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="10" android:gravity="right" android:tint="@color/green" android:src="@drawable/comvec_query" /> < TextView android:id="@+id/txtfind_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="left" android:layout_weight="15" android:textColor="@color/fragNoteBookColor_butTxt" android:text="@string/fragNoteBookTxt_findBut" android:textSize="@dimen/fragNoteBookFntsize_butTxt" /> </ LinearLayout > < LinearLayout android:layout_width="0dp" android:layout_height="36dp" android:gravity="center" android:layout_weight="1" android:orientation="horizontal"> </ LinearLayout > < LinearLayout android:id="@+id/Layoutbut_FINDradio" android:layout_width="0dp" android:layout_height="32dp" android:gravity="center" android:layout_weight="25" android:orientation="horizontal"> < com.bi3eview.newstart60.local.SelfWidget.threeRadioImageView android:id="@+id/imgfindradio_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="10" android:gravity="right" android:tint="@color/black" android:src="@drawable/comvec_radiono" /> < TextView android:id="@+id/txtfinditem_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="left" android:layout_weight="15" android:textColor="@color/fragNoteBookColor_butTxt" android:text="@string/fragNoteBookTxt_findAll" android:textSize="@dimen/fragNoteBookFntsize_butTxt" /> </ LinearLayout > < LinearLayout android:layout_width="0dp" android:layout_height="36dp" android:gravity="center" android:layout_weight="1" android:orientation="horizontal"> </ LinearLayout > </ LinearLayout > < LinearLayout android:id="@+id/CVIEWLayout_headline" android:layout_below="@+id/menubutton_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="3dp" android:orientation="horizontal" android:background="@color/timetaskColor_cviewTitlebg" android:weightSum="100" > < TextView android:layout_width="0dp" android:layout_height="wrap_content" android:text="---" android:gravity="center" android:layout_weight="7" /> < TextView android:layout_width="0dp" android:layout_height="wrap_content" android:text="---" android:gravity="center" android:layout_weight="7" /> < TextView android:id="@+id/col1_titleName" android:layout_width="0dp" android:layout_height="25dp" android:gravity="center" android:layout_weight="35" android:textColor="@color/fragNoteBookItemColor_name" android:textSize="@dimen/timetaskCView_title" android:text="@string/fragNoteBookTxt_colName" /> < TextView android:id="@+id/col2_titleNote" android:layout_width="0dp" android:layout_height="25dp" android:gravity="center" android:layout_weight="30" android:textColor="@color/fragNoteBookItemColor_note" android:textSize="@dimen/timetaskCView_title" android:text="@string/fragNoteBookTxt_colNote" /> < TextView android:layout_width="0dp" android:layout_height="25dp" android:gravity="center" android:layout_weight="20" android:textColor="@color/cybersetColor_RecViewtitle" android:textSize="@dimen/timetaskCView_title" android:text="---" /> < TextView android:id="@+id/txtview_cyberkd" android:layout_width="0dp" android:layout_height="25dp" android:gravity="center" android:layout_weight="1" android:textColor="@color/cybersetColor_RecViewtitle" android:textSize="@dimen/timetaskCView_title" /> </ LinearLayout > < android.support.v4.widget.SwipeRefreshLayout android:layout_below="@+id/CVIEWLayout_headline" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/fragNoteBookItemColor_cardbkg" android:id="@+id/swipeRefreshLayout"> < android.support.v7.widget.RecyclerView android:id="@+id/recyclerView_web" android:background="@color/fragNoteBookItemColor_cardbkg" android:layout_width="match_parent" android:layout_height="match_parent" /> </ android.support.v4.widget.SwipeRefreshLayout > < ProgressBar android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/progress_bar" android:layout_centerInParent="true"/> </ RelativeLayout > |
胡方珍(胡芳珍)
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
· Apache Tomcat RCE漏洞复现(CVE-2025-24813)