├── .idea
├── .name
├── copyright
│ └── profiles_settings.xml
├── encodings.xml
├── vcs.xml
├── libraries
│ ├── locSDK_4_2.xml
│ ├── pinyin_2_5_0.xml
│ ├── eventbus_2_4_0.xml
│ ├── httpmime_4_2_4.xml
│ ├── android_support_v4.xml
│ ├── baidumapapi_v3_0_0.xml
│ ├── butterknife_6_1_0.xml
│ ├── avoscloud_sdk_v3_1_4.xml
│ ├── avoscloud_push_v3_1_4.xml
│ ├── prettytime_3_2_5_Final.xml
│ ├── android_async_http_1_4_6.xml
│ ├── fastjson_1_1_37_leancloud.xml
│ ├── Java_WebSocket_1_2_0_leancloud.xml
│ └── universal_image_loader_1_9_2_sources.xml
├── modules.xml
├── runConfigurations.xml
├── gradle.xml
├── compiler.xml
└── misc.xml
├── README.md
├── ic_launcher-web.png
├── libs
├── locSDK_4.2.jar
├── pinyin-2.5.0.jar
├── eventbus-2.4.0.jar
├── httpmime-4.2.4.jar
├── android-support-v4.jar
├── armeabi
│ ├── liblocSDK4d.so
│ └── libBaiduMapSDK_v3_0_0.so
├── baidumapapi_v3_0_0.jar
├── butterknife-6.1.0.jar
├── avoscloud-sdk-v3.1.4.jar
├── avoscloud-push-v3.1.4.jar
├── prettytime-3.2.5.Final.jar
├── android-async-http-1.4.6.jar
├── fastjson-1.1.37-leancloud.jar
├── Java-WebSocket-1.2.0-leancloud.jar
└── universal-image-loader-1.9.2_sources.jar
├── res
├── drawable-hdpi
│ ├── arrow.png
│ ├── join.png
│ ├── line.png
│ ├── logo.png
│ ├── male.png
│ ├── next.png
│ ├── orimg.png
│ ├── pass.png
│ ├── pass2.png
│ ├── send.png
│ ├── female.png
│ ├── forget.png
│ ├── loginbg.png
│ ├── male_un.png
│ ├── notext.png
│ ├── back_btn.png
│ ├── backicon.png
│ ├── codeicon.png
│ ├── emailtext.png
│ ├── female_un.png
│ ├── loginbtn.png
│ ├── loginicon.png
│ ├── logintext.png
│ ├── meet_end.png
│ ├── meet_start.png
│ ├── mobileicon.png
│ ├── mobiletext.png
│ ├── msg_tips.png
│ ├── pasnotext.png
│ ├── passicon.png
│ ├── registebg.png
│ ├── registebtn.png
│ ├── renotext.png
│ ├── top_bar.9.png
│ ├── voice_left.png
│ ├── welcomebg.png
│ ├── ic_launcher.png
│ ├── meet_middle.png
│ ├── passwordicon.png
│ ├── passwordtext.png
│ ├── registemail.png
│ ├── usernameicon.png
│ ├── voice_right.png
│ ├── welcomeback.png
│ ├── about_mid_bg.9.png
│ ├── about_top_bg.9.png
│ ├── chat_add_normal.png
│ ├── chat_emo_normal.png
│ ├── empty_photo.9.png
│ ├── image_load_fail.png
│ ├── registeusername.png
│ ├── base_edit_input.9.png
│ ├── chat_add_pressed.png
│ ├── chat_emo_pressed.png
│ ├── chat_menu_people.png
│ ├── chat_send_normal.png
│ ├── chat_send_pressed.png
│ ├── chat_time_block.9.png
│ ├── chat_voice_normal.png
│ ├── home_bg_bottombar.png
│ ├── new_friends_icon.png
│ ├── user_add_top_bg.9.png
│ ├── btn_logout_normal.9.png
│ ├── btn_logout_pressed.9.png
│ ├── chat_voice_pressed.png
│ ├── default_user_avatar.png
│ ├── location_default.9.png
│ ├── login_edit_normal.9.png
│ ├── search_clear_normal.png
│ ├── search_clear_pressed.png
│ ├── base_horizontal_line.9.png
│ ├── chat_add_camera_normal.png
│ ├── chat_add_camera_press.png
│ ├── chat_fail_resend_press.png
│ ├── register_bottom_arrow.png
│ ├── chat_add_location_normal.png
│ ├── chat_add_location_press.png
│ ├── chat_add_picture_normal.png
│ ├── chat_add_picture_pressed.png
│ ├── chat_fail_resend_normal.png
│ ├── base_action_bar_add_bg_normal.png
│ ├── base_action_bar_add_bg_pressed.png
│ ├── base_action_bar_true_bg_normal.png
│ ├── base_action_bar_true_bg_pressed.png
│ ├── chatting_setmode_keyboard_btn_normal.png
│ └── chatting_setmode_keyboard_btn_pressed.png
├── drawable-mdpi
│ ├── book.png
│ ├── itsbook.png
│ ├── mybook.png
│ ├── nolove.png
│ ├── twolove.png
│ ├── arrowanother.png
│ └── ic_launcher.png
├── drawable-xhdpi
│ ├── tabbar_me.png
│ ├── ic_launcher.png
│ ├── tabbar_chat.png
│ ├── chat_left_qp.9.png
│ ├── chat_right_qp.9.png
│ ├── tabbar_contacts.png
│ ├── tabbar_discover.png
│ ├── tabbar_me_active.png
│ ├── tabbar_chat_active.png
│ ├── tabbar_contacts_active.png
│ └── tabbar_discover_active.png
├── drawable-xxhdpi
│ └── ic_launcher.png
├── values
│ ├── attrs.xml
│ ├── colors.xml
│ └── dimens.xml
├── drawable
│ ├── common_btn_normal.xml
│ ├── common_btn_pressed.xml
│ ├── round_background.xml
│ ├── btn_green.xml
│ ├── btn_green_no_corner.xml
│ ├── common_btn.xml
│ ├── male_radion_button.xml
│ ├── female_radion_button.xml
│ ├── tab_textcolor.xml
│ ├── btn_keyboard.xml
│ ├── btn_logout_selector.xml
│ ├── btn_selector.xml
│ ├── button_normal_shape.xml
│ ├── btn_chat_add_selector.xml
│ ├── btn_chat_emo_selector.xml
│ ├── btn_chat_voice_selector.xml
│ ├── v2_sortlistview_sidebar_background.xml
│ ├── btn_chat_fail_resend.xml
│ ├── btn_chat_add_camera_selector.xml
│ ├── btn_chat_add_location_selector.xml
│ ├── btn_chat_add_picture_selector.xml
│ ├── base_action_bar_add_bg_selector.xml
│ ├── base_action_bar_true_bg_selector.xml
│ ├── circle_green_off.xml
│ ├── circle_green_on.xml
│ ├── btn_chat_send_selector.xml
│ └── v2_gallery_contacts_dialog_background.xml
├── menu
│ └── chat_ativity_menu.xml
├── layout
│ ├── base_header_layout.xml
│ ├── activity_welcome.xml
│ ├── base_common_header_right_btn.xml
│ ├── chat_emotion_item.xml
│ ├── base_common_header_right_image_btn.xml
│ ├── chat_emotion_gridview.xml
│ ├── contact_new_friend_activity.xml
│ ├── chat_item_time_layout.xml
│ ├── chat_item_status_layout.xml
│ ├── chat_bottom_more_layout.xml
│ ├── discover_fragment.xml
│ ├── xlistview_header.xml
│ ├── xlistview_footer.xml
│ ├── chat_item_msg_image_right.xml
│ ├── chat_bottom_add_layout.xml
│ ├── myblog.xml
│ ├── itsblog.xml
│ ├── item_user_friend.xml
│ ├── meet_item.xml
│ ├── chat_item_msg_image_left.xml
│ ├── base_common_header.xml
│ ├── chat_item_msg_text_right.xml
│ ├── contact_add_friend_item.xml
│ ├── meetinginfo_cell.xml
│ ├── chat_item_msg_text_left.xml
│ ├── contact_add_friend_activity.xml
│ ├── chat_item_msg_audio_right.xml
│ ├── chat_bottom_text_layout.xml
│ ├── chat_item_msg_location_left.xml
│ ├── chat_item_msg_audio_left.xml
│ ├── chat_item_msg_location_right.xml
│ ├── activity_meet.xml
│ ├── activity_forget.xml
│ ├── chat_layout.xml
│ ├── contact_include_new_friend.xml
│ └── contact_fragment.xml
├── anim
│ ├── push_top_in2.xml
│ ├── push_top_out2.xml
│ ├── shrink_from_top.xml
│ └── grow_from_bottom.xml
├── values-v11
│ └── styles.xml
└── values-v14
│ └── styles.xml
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .settings
└── org.eclipse.jdt.core.prefs
├── src
└── com
│ └── example
│ ├── lovetallk
│ └── service
│ │ └── listener
│ │ ├── MsgListener.java
│ │ └── StatusListener.java
│ └── lovetalk
│ ├── chat
│ ├── entity
│ │ ├── Conversation.java
│ │ ├── RoomType.java
│ │ └── MsgBuilder.java
│ └── db
│ │ └── DBHelper.java
│ ├── adapter
│ ├── EmotionPagerAdapter.java
│ ├── BasePagerAdapter.java
│ ├── EmotionGridAdapter.java
│ ├── AddFriendAdapter.java
│ ├── BaseListAdapter.java
│ ├── NewFriendAdapter.java
│ └── UserFriendAdapter.java
│ ├── util
│ ├── SimpleTextWatcher.java
│ ├── TimeUtils.java
│ ├── PixelUtil.java
│ ├── PinyinComparator.java
│ ├── Connectivity.java
│ ├── AVOSUtils.java
│ ├── Logger.java
│ ├── PathUtils.java
│ ├── MyAsyncTask.java
│ ├── CharacterParser.java
│ └── ChatUtils.java
│ ├── activity
│ ├── BaseEntryActivity.java
│ ├── BaseActivity.java
│ ├── MainActivity.java
│ ├── ForgetActivity.java
│ ├── NewFriendActivity.java
│ └── LoginActivity.java
│ ├── fragment
│ └── BaseFragment.java
│ ├── view
│ ├── ViewHolder.java
│ ├── EmotionEditText.java
│ ├── HeaderLayout.java
│ ├── PlayButton.java
│ ├── xlist
│ │ ├── XListViewFooter.java
│ │ └── XListViewHeader.java
│ └── EnLetterView.java
│ ├── receiver
│ └── FinishReceiver.java
│ ├── service
│ ├── AddRequest.java
│ ├── MsgAgent.java
│ ├── SignatureFactory.java
│ ├── CloudService.java
│ ├── PreferenceMap.java
│ └── CacheService.java
│ ├── enity
│ └── MeetingInfo.java
│ └── DemoApplication.java
├── .gitignore
├── .classpath
├── project.properties
├── .project
└── gradlew.bat
/.idea/.name:
--------------------------------------------------------------------------------
1 | LoveTalkClient
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # LoveTalkClient
2 | 社交交友app,你懂得
3 |
--------------------------------------------------------------------------------
/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/ic_launcher-web.png
--------------------------------------------------------------------------------
/libs/locSDK_4.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/libs/locSDK_4.2.jar
--------------------------------------------------------------------------------
/libs/pinyin-2.5.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/libs/pinyin-2.5.0.jar
--------------------------------------------------------------------------------
/libs/eventbus-2.4.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/libs/eventbus-2.4.0.jar
--------------------------------------------------------------------------------
/libs/httpmime-4.2.4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/libs/httpmime-4.2.4.jar
--------------------------------------------------------------------------------
/libs/android-support-v4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/libs/android-support-v4.jar
--------------------------------------------------------------------------------
/libs/armeabi/liblocSDK4d.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/libs/armeabi/liblocSDK4d.so
--------------------------------------------------------------------------------
/libs/baidumapapi_v3_0_0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/libs/baidumapapi_v3_0_0.jar
--------------------------------------------------------------------------------
/libs/butterknife-6.1.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/libs/butterknife-6.1.0.jar
--------------------------------------------------------------------------------
/res/drawable-hdpi/arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/arrow.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/join.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/join.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/line.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/line.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/logo.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/male.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/male.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/next.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/next.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/orimg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/orimg.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/pass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/pass.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/pass2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/pass2.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/send.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/send.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/book.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-mdpi/book.png
--------------------------------------------------------------------------------
/libs/avoscloud-sdk-v3.1.4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/libs/avoscloud-sdk-v3.1.4.jar
--------------------------------------------------------------------------------
/res/drawable-hdpi/female.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/female.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/forget.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/forget.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/loginbg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/loginbg.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/male_un.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/male_un.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/notext.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/notext.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/itsbook.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-mdpi/itsbook.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/mybook.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-mdpi/mybook.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/nolove.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-mdpi/nolove.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/twolove.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-mdpi/twolove.png
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/libs/avoscloud-push-v3.1.4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/libs/avoscloud-push-v3.1.4.jar
--------------------------------------------------------------------------------
/libs/prettytime-3.2.5.Final.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/libs/prettytime-3.2.5.Final.jar
--------------------------------------------------------------------------------
/res/drawable-hdpi/back_btn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/back_btn.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/backicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/backicon.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/codeicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/codeicon.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/emailtext.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/emailtext.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/female_un.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/female_un.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/loginbtn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/loginbtn.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/loginicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/loginicon.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/logintext.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/logintext.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/meet_end.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/meet_end.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/meet_start.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/meet_start.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/mobileicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/mobileicon.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/mobiletext.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/mobiletext.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/msg_tips.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/msg_tips.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/pasnotext.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/pasnotext.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/passicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/passicon.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/registebg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/registebg.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/registebtn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/registebtn.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/renotext.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/renotext.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/top_bar.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/top_bar.9.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/voice_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/voice_left.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/welcomebg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/welcomebg.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi/tabbar_me.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-xhdpi/tabbar_me.png
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/libs/android-async-http-1.4.6.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/libs/android-async-http-1.4.6.jar
--------------------------------------------------------------------------------
/libs/fastjson-1.1.37-leancloud.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/libs/fastjson-1.1.37-leancloud.jar
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/meet_middle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/meet_middle.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/passwordicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/passwordicon.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/passwordtext.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/passwordtext.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/registemail.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/registemail.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/usernameicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/usernameicon.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/voice_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/voice_right.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/welcomeback.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/welcomeback.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/arrowanother.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-mdpi/arrowanother.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi/tabbar_chat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-xhdpi/tabbar_chat.png
--------------------------------------------------------------------------------
/libs/armeabi/libBaiduMapSDK_v3_0_0.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/libs/armeabi/libBaiduMapSDK_v3_0_0.so
--------------------------------------------------------------------------------
/res/drawable-hdpi/about_mid_bg.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/about_mid_bg.9.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/about_top_bg.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/about_top_bg.9.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/chat_add_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/chat_add_normal.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/chat_emo_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/chat_emo_normal.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/empty_photo.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/empty_photo.9.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/image_load_fail.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/image_load_fail.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/registeusername.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/registeusername.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi/chat_left_qp.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-xhdpi/chat_left_qp.9.png
--------------------------------------------------------------------------------
/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/libs/Java-WebSocket-1.2.0-leancloud.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/libs/Java-WebSocket-1.2.0-leancloud.jar
--------------------------------------------------------------------------------
/res/drawable-hdpi/base_edit_input.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/base_edit_input.9.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/chat_add_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/chat_add_pressed.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/chat_emo_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/chat_emo_pressed.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/chat_menu_people.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/chat_menu_people.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/chat_send_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/chat_send_normal.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/chat_send_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/chat_send_pressed.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/chat_time_block.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/chat_time_block.9.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/chat_voice_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/chat_voice_normal.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/home_bg_bottombar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/home_bg_bottombar.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/new_friends_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/new_friends_icon.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/user_add_top_bg.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/user_add_top_bg.9.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi/chat_right_qp.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-xhdpi/chat_right_qp.9.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi/tabbar_contacts.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-xhdpi/tabbar_contacts.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi/tabbar_discover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-xhdpi/tabbar_discover.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi/tabbar_me_active.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-xhdpi/tabbar_me_active.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/btn_logout_normal.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/btn_logout_normal.9.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/btn_logout_pressed.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/btn_logout_pressed.9.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/chat_voice_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/chat_voice_pressed.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/default_user_avatar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/default_user_avatar.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/location_default.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/location_default.9.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/login_edit_normal.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/login_edit_normal.9.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/search_clear_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/search_clear_normal.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/search_clear_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/search_clear_pressed.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi/tabbar_chat_active.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-xhdpi/tabbar_chat_active.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/base_horizontal_line.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/base_horizontal_line.9.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/chat_add_camera_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/chat_add_camera_normal.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/chat_add_camera_press.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/chat_add_camera_press.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/chat_fail_resend_press.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/chat_fail_resend_press.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/register_bottom_arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/register_bottom_arrow.png
--------------------------------------------------------------------------------
/libs/universal-image-loader-1.9.2_sources.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/libs/universal-image-loader-1.9.2_sources.jar
--------------------------------------------------------------------------------
/res/drawable-hdpi/chat_add_location_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/chat_add_location_normal.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/chat_add_location_press.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/chat_add_location_press.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/chat_add_picture_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/chat_add_picture_normal.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/chat_add_picture_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/chat_add_picture_pressed.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/chat_fail_resend_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/chat_fail_resend_normal.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi/tabbar_contacts_active.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-xhdpi/tabbar_contacts_active.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi/tabbar_discover_active.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-xhdpi/tabbar_discover_active.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/base_action_bar_add_bg_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/base_action_bar_add_bg_normal.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/base_action_bar_add_bg_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/base_action_bar_add_bg_pressed.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/base_action_bar_true_bg_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/base_action_bar_true_bg_normal.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/base_action_bar_true_bg_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/base_action_bar_true_bg_pressed.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/chatting_setmode_keyboard_btn_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/chatting_setmode_keyboard_btn_normal.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/chatting_setmode_keyboard_btn_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lanixzcj/LoveTalkClient/HEAD/res/drawable-hdpi/chatting_setmode_keyboard_btn_pressed.png
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
3 | org.eclipse.jdt.core.compiler.compliance=1.6
4 | org.eclipse.jdt.core.compiler.source=1.6
5 |
--------------------------------------------------------------------------------
/src/com/example/lovetallk/service/listener/MsgListener.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetallk.service.listener;
2 |
3 | public interface MsgListener {
4 | public boolean onMessageUpdate(String otherId);// true的话 不再传递给下一个Listener
5 | }
6 |
--------------------------------------------------------------------------------
/res/drawable/common_btn_normal.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/res/drawable/common_btn_pressed.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/com/example/lovetallk/service/listener/StatusListener.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetallk.service.listener;
2 |
3 | import java.util.List;
4 |
5 | public interface StatusListener {
6 | public void onStatusOnline(List peerIds);
7 | }
8 |
--------------------------------------------------------------------------------
/.idea/libraries/locSDK_4_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/libraries/pinyin_2_5_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/libraries/eventbus_2_4_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/libraries/httpmime_4_2_4.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Apr 10 15:27:10 PDT 2013
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=http\://services.gradle.org/distributions/gradle-2.4-all.zip
7 |
--------------------------------------------------------------------------------
/.idea/libraries/android_support_v4.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/libraries/baidumapapi_v3_0_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/libraries/butterknife_6_1_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/libraries/avoscloud_sdk_v3_1_4.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/libraries/avoscloud_push_v3_1_4.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/res/drawable/round_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/chat/entity/Conversation.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.chat.entity;
2 |
3 | import com.avos.avoscloud.AVUser;
4 |
5 |
6 | /**
7 | * Created by lzw on 14-9-26.
8 | */
9 | public class Conversation {
10 | public Msg msg;
11 | public AVUser toUser;
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/.idea/libraries/prettytime_3_2_5_Final.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/res/drawable/btn_green.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/res/drawable/btn_green_no_corner.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/libraries/android_async_http_1_4_6.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/libraries/fastjson_1_1_37_leancloud.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/res/drawable/common_btn.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/libraries/Java_WebSocket_1_2_0_leancloud.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/res/drawable/male_radion_button.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/res/drawable/female_radion_button.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/res/menu/chat_ativity_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/libraries/universal_image_loader_1_9_2_sources.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/res/layout/base_header_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
--------------------------------------------------------------------------------
/res/drawable/tab_textcolor.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/res/drawable/btn_keyboard.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/res/drawable/btn_logout_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/adapter/EmotionPagerAdapter.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.adapter;
2 |
3 | import android.view.View;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * Created by lzw on 14-9-25.
9 | */
10 | public class EmotionPagerAdapter extends BasePagerAdapter {
11 |
12 | public EmotionPagerAdapter(List views) {
13 | super(views);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/res/anim/push_top_in2.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/res/anim/push_top_out2.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/res/drawable/btn_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/res/drawable/button_normal_shape.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/res/layout/activity_welcome.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/res/drawable/btn_chat_add_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/res/drawable/btn_chat_emo_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/res/drawable/btn_chat_voice_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/res/drawable/v2_sortlistview_sidebar_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/res/drawable/btn_chat_fail_resend.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/res/drawable/btn_chat_add_camera_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.ap_
4 |
5 | # Files for the Dalvik VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # Generated files
12 | bin/
13 | gen/
14 |
15 | # Gradle files
16 | .gradle/
17 | build/
18 | /*/build/
19 |
20 | # Local configuration file (sdk path, etc)
21 | local.properties
22 |
23 | # Proguard folder generated by Eclipse
24 | proguard/
25 |
26 | # Log Files
27 | *.log
28 |
--------------------------------------------------------------------------------
/res/drawable/btn_chat_add_location_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/res/drawable/btn_chat_add_picture_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/chat/entity/RoomType.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.chat.entity;
2 |
3 | /**
4 | * Created by lzw on 14/11/18.
5 | */
6 | public enum RoomType {
7 | Single(0), Group(1);
8 |
9 | int value;
10 |
11 | RoomType(int value) {
12 | this.value = value;
13 | }
14 |
15 | public int getValue() {
16 | return value;
17 | }
18 |
19 | public static RoomType fromInt(int i) {
20 | return values()[i];
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/res/drawable/base_action_bar_add_bg_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/res/drawable/base_action_bar_true_bg_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/res/drawable/circle_green_off.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/res/drawable/circle_green_on.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/res/layout/base_common_header_right_btn.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
13 |
--------------------------------------------------------------------------------
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/res/drawable/btn_chat_send_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/res/layout/chat_emotion_item.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
12 |
13 |
--------------------------------------------------------------------------------
/res/drawable/v2_gallery_contacts_dialog_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
10 |
15 |
16 |
--------------------------------------------------------------------------------
/res/anim/shrink_from_top.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
14 |
15 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/util/SimpleTextWatcher.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.util;
2 |
3 | import android.text.Editable;
4 | import android.text.TextWatcher;
5 |
6 | /**
7 | * Created by lzw on 14-10-6.
8 | */
9 | public class SimpleTextWatcher implements TextWatcher {
10 | @Override
11 | public void beforeTextChanged(CharSequence s, int start, int count, int after) {
12 |
13 | }
14 |
15 | @Override
16 | public void onTextChanged(CharSequence s, int start, int before, int count) {
17 |
18 | }
19 |
20 | @Override
21 | public void afterTextChanged(Editable s) {
22 |
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-19
15 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/res/layout/base_common_header_right_image_btn.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
16 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/activity/BaseEntryActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.activity;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 |
6 | import com.example.lovetalk.receiver.FinishReceiver;
7 |
8 |
9 | public class BaseEntryActivity extends Activity {
10 | FinishReceiver mFinishReceiver;
11 |
12 | @Override
13 | protected void onCreate(Bundle savedInstanceState) {
14 | super.onCreate(savedInstanceState);
15 | mFinishReceiver = FinishReceiver.register(this);
16 | }
17 |
18 | @Override
19 | protected void onDestroy() {
20 | super.onDestroy();
21 | unregisterReceiver(mFinishReceiver);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/res/anim/grow_from_bottom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
16 |
17 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/fragment/BaseFragment.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.fragment;
2 |
3 | import com.example.lovetalk.R;
4 | import com.example.lovetalk.view.HeaderLayout;
5 |
6 | import android.app.Activity;
7 | import android.app.Fragment;
8 | import android.content.Context;
9 | import android.os.Bundle;
10 |
11 | public class BaseFragment extends Fragment {
12 | HeaderLayout headerLayout;
13 | Context context;
14 |
15 | @Override
16 | public void onActivityCreated(Bundle savedInstanceState) {
17 | super.onActivityCreated(savedInstanceState);
18 | context = getActivity();
19 | headerLayout = (HeaderLayout) getView().findViewById(R.id.headerLayout);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/view/ViewHolder.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.view;
2 |
3 | import android.util.SparseArray;
4 | import android.view.View;
5 |
6 | /**
7 | * Created by lzw on 14-9-21.
8 | */
9 | public class ViewHolder {
10 | public static T findViewById(View view, int id) {
11 | SparseArray viewHolder = (SparseArray) view.getTag();
12 | if (viewHolder == null) {
13 | viewHolder = new SparseArray();
14 | view.setTag(viewHolder);
15 | }
16 | View childView = viewHolder.get(id);
17 | if (childView == null) {
18 | childView = view.findViewById(id);
19 | viewHolder.put(id, childView);
20 | }
21 | return (T) childView;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/res/layout/chat_emotion_gridview.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
20 |
21 |
--------------------------------------------------------------------------------
/res/layout/contact_new_friend_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
18 |
19 |
--------------------------------------------------------------------------------
/res/layout/chat_item_time_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
14 |
15 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/view/EmotionEditText.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.view;
2 |
3 | import com.example.lovetalk.util.EmotionUtils;
4 |
5 | import android.content.Context;
6 | import android.text.TextUtils;
7 | import android.util.AttributeSet;
8 | import android.widget.EditText;
9 |
10 | public class EmotionEditText extends EditText {
11 |
12 | public EmotionEditText(Context context) {
13 | super(context);
14 | }
15 |
16 | public EmotionEditText(Context context, AttributeSet attrs, int defStyle) {
17 | super(context, attrs, defStyle);
18 | }
19 |
20 | public EmotionEditText(Context context, AttributeSet attrs) {
21 | super(context, attrs);
22 | }
23 |
24 | @Override
25 | public void setText(CharSequence text, BufferType type) {
26 | if (!TextUtils.isEmpty(text)) {
27 | super.setText(EmotionUtils.replace(getContext(), text.toString()), type);
28 | } else {
29 | super.setText(text, type);
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | LoveTalk
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | com.android.ide.eclipse.adt.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/chat/db/DBHelper.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.chat.db;
2 |
3 | import android.content.Context;
4 | import android.database.sqlite.SQLiteDatabase;
5 | import android.database.sqlite.SQLiteOpenHelper;
6 |
7 | /**
8 | * Created by lzw on 14-5-28.
9 | */
10 | public class DBHelper extends SQLiteOpenHelper {
11 |
12 | public DBHelper(Context context, String name, int version) {
13 | super(context, name, null, version);
14 | }
15 |
16 | @Override
17 | public void onCreate(SQLiteDatabase db) {
18 | DBMsg.createTable(db);
19 | }
20 |
21 | @Override
22 | public void onOpen(SQLiteDatabase db) {
23 | super.onOpen(db);
24 | }
25 |
26 | @Override
27 | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
28 | switch (newVersion) {
29 | case 3:
30 | case 2:
31 | DBMsg.dropTable(db); //lazy solution
32 | DBMsg.createTable(db);
33 | case 1:
34 | break;
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/util/TimeUtils.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.util;
2 |
3 | import org.ocpsoft.prettytime.PrettyTime;
4 |
5 | import java.text.SimpleDateFormat;
6 | import java.util.Date;
7 |
8 | /**
9 | * Created by lzw on 14-6-28.
10 | */
11 | public class TimeUtils {
12 | public static PrettyTime prettyTime = new PrettyTime();
13 |
14 | public static String getDate(Date date) {
15 | SimpleDateFormat format = new SimpleDateFormat("MM-dd HH:mm");
16 | return format.format(date);
17 | }
18 |
19 | public static String millisecs2DateString(long timestamp) {
20 | long gap = System.currentTimeMillis() - timestamp;
21 | if (gap < 1000 * 60 * 60 * 24) {
22 | return prettyTime.format(new Date(timestamp));
23 | } else {
24 | return getDate(new Date(timestamp));
25 | }
26 | }
27 |
28 | public static boolean haveTimeGap(long lastTime, long time) {
29 | int gap = 1000 * 60 * 10;//10 mins
30 | return time - lastTime > gap;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/adapter/BasePagerAdapter.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.adapter;
2 |
3 | import android.support.v4.view.PagerAdapter;
4 | import android.view.View;
5 | import android.view.ViewGroup;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * Created by lzw on 14-9-25.
11 | */
12 | public class BasePagerAdapter extends PagerAdapter {
13 | List views;
14 |
15 | public BasePagerAdapter(List views) {
16 | this.views = views;
17 | }
18 |
19 | @Override
20 | public int getCount() {
21 | return views.size();
22 | }
23 |
24 | @Override
25 | public boolean isViewFromObject(View view, Object o) {
26 | return view == o;
27 | }
28 |
29 | @Override
30 | public Object instantiateItem(ViewGroup container, int position) {
31 | View view = views.get(position);
32 | container.addView(view);
33 | return view;
34 | }
35 |
36 | @Override
37 | public void destroyItem(ViewGroup container, int position, Object object) {
38 | container.removeView(views.get(position));
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/util/PixelUtil.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.util;
2 |
3 | import android.content.res.Resources;
4 |
5 | /**
6 | * 像素转换工具
7 | *
8 | * @author MarkMjw
9 | */
10 | public class PixelUtil {
11 | private static Resources resources = Resources.getSystem();
12 | private static int desityDpi = resources.getDisplayMetrics().densityDpi;
13 | private static float scaledDensity = resources.getDisplayMetrics().scaledDensity;
14 |
15 | public static int dp2px(float value) {
16 | final float scale = desityDpi;
17 | return (int) (value * (scale / 160) + 0.5f);
18 | }
19 |
20 | public static int px2dp(float value) {
21 | final float scale = desityDpi;
22 | return (int) ((value * 160) / scale + 0.5f);
23 | }
24 |
25 | public static int sp2px(float value) {
26 | float spvalue = value * scaledDensity;
27 | return (int) (spvalue + 0.5f);
28 | }
29 |
30 | public static int px2sp(float value) {
31 | final float scale = scaledDensity;
32 | return (int) (value / scale + 0.5f);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/util/PinyinComparator.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.util;
2 |
3 | import java.util.Comparator;
4 |
5 | import com.avos.avoscloud.AVUser;
6 |
7 | public class PinyinComparator implements Comparator {
8 |
9 | public int compare(AVUser o1, AVUser o2) {
10 | String o1Letters, o2Letters;
11 | o1Letters = getSortLetters(o1);
12 | o2Letters = getSortLetters(o2);
13 | if (o1Letters.equals("@") || o2Letters.equals("#")) {
14 | return -1;
15 | } else if (o1Letters.equals("#") || o2Letters.equals("@")) {
16 | return 1;
17 | } else {
18 | return o1Letters.compareTo(o2Letters);
19 | }
20 | }
21 |
22 | private String getSortLetters(AVUser user) {
23 | String username = user.getUsername();
24 | if (username != null) {
25 | String pinyin = CharacterParser.getPingYin(user.getUsername());
26 | String sortString = pinyin.substring(0, 1).toUpperCase();
27 | if (sortString.matches("[A-Z]")) {
28 | return sortString.toUpperCase();
29 | } else {
30 | return "#";
31 | }
32 | } else {
33 | return "#";
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/receiver/FinishReceiver.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.receiver;
2 |
3 | import android.app.Activity;
4 | import android.content.BroadcastReceiver;
5 | import android.content.Context;
6 | import android.content.Intent;
7 | import android.content.IntentFilter;
8 |
9 | public class FinishReceiver extends BroadcastReceiver {
10 | private static final String FINISH_ACTION = "com.example.lovetalk.finish";
11 | private Activity activity;
12 |
13 | public FinishReceiver(Activity activity) {
14 | this.activity = activity;
15 | }
16 |
17 | @Override
18 | public void onReceive(Context context, Intent intent) {
19 | if (intent != null && intent.getAction().equals(FINISH_ACTION)) {
20 | activity.finish();
21 | }
22 | }
23 |
24 | public static FinishReceiver register(Activity activity) {
25 | FinishReceiver receiver = new FinishReceiver(activity);
26 | activity.registerReceiver(receiver, new IntentFilter(
27 | FinishReceiver.FINISH_ACTION));
28 | return receiver;
29 | }
30 |
31 | public static void broadcast(Context context) {
32 | context.sendBroadcast(new Intent(FINISH_ACTION));
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/res/layout/chat_item_status_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
15 |
16 |
23 |
24 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/res/layout/chat_bottom_more_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
15 |
16 |
22 |
23 |
27 |
28 |
29 |
32 |
33 |
--------------------------------------------------------------------------------
/res/layout/discover_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
10 |
11 |
16 |
17 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/res/layout/xlistview_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
19 |
20 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/util/Connectivity.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.util;
2 |
3 | import android.content.Context;
4 | import android.net.ConnectivityManager;
5 | import android.net.NetworkInfo;
6 |
7 | /**
8 | * Created by lzw on 14/11/20.
9 | */
10 | public class Connectivity {
11 | public static NetworkInfo getNetworkInfo(Context context) {
12 | ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
13 | return cm.getActiveNetworkInfo();
14 | }
15 |
16 | public static boolean isConnected(Context context) {
17 | NetworkInfo info = getNetworkInfo(context);
18 | return isConnected(info);
19 | }
20 |
21 | public static boolean isConnected(NetworkInfo info) {
22 | return info != null && info.isConnected();
23 | }
24 |
25 | public static boolean isConnectedWifi(Context context) {
26 | NetworkInfo info = getNetworkInfo(context);
27 | return isConnected(info) && info.getType() == ConnectivityManager.TYPE_WIFI;
28 | }
29 |
30 | public static boolean isConnectedMobile(Context context) {
31 | NetworkInfo info = getNetworkInfo(context);
32 | return isConnected(info) && info.getType() == ConnectivityManager.TYPE_MOBILE;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/service/AddRequest.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.service;
2 |
3 | import com.avos.avoscloud.AVClassName;
4 | import com.avos.avoscloud.AVObject;
5 | import com.avos.avoscloud.AVUser;
6 |
7 | /**
8 | * Created by lzw on 14-9-27.
9 | */
10 | @AVClassName("AddRequest")
11 | public class AddRequest extends AVObject {
12 | public static final int STATUS_WAIT = 0;
13 | public static final int STATUS_DONE = 1;
14 |
15 | public static final String FROM_USER = "fromUser";
16 | public static final String TO_USER = "toUser";
17 | public static final String STATUS = "status";
18 | //User fromUser;
19 | //User toUser;
20 | //int status;
21 |
22 | public AddRequest() {
23 | }
24 |
25 | public AVUser getFromUser() {
26 | return getAVUser(FROM_USER, AVUser.class);
27 | }
28 |
29 | public void setFromUser(AVUser fromUser) {
30 | put(FROM_USER, fromUser);
31 | }
32 |
33 | public AVUser getToUser() {
34 | return getAVUser(TO_USER, AVUser.class);
35 | }
36 |
37 | public void setToUser(AVUser toUser) {
38 | put(TO_USER, toUser);
39 | }
40 |
41 | public int getStatus() {
42 | return getInt(STATUS);
43 | }
44 |
45 | public void setStatus(int status) {
46 | put(STATUS, status);
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #72c0f2
4 | #0000
5 | #fff
6 | #5CB98D
7 | #428666
8 | #9da0a4
9 | #4f9ef6
10 |
11 | #2C97E8
12 | #ffff
13 | #3e3e39
14 |
15 | #ffa1a1a1
16 |
17 | #f0f2f5
18 | #fff
19 |
20 | #9fa0a0
21 |
22 |
23 | #f5f5f5
24 | #f4f6f6
25 |
26 | #eceff4
27 |
28 | #f82c22
29 | #898989
30 |
31 | #000
32 | #f00
33 |
34 |
--------------------------------------------------------------------------------
/res/layout/xlistview_footer.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
19 |
20 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/util/AVOSUtils.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.util;
2 |
3 | import android.util.Log;
4 |
5 | import com.avos.avoscloud.AVMessage;
6 |
7 | import java.util.ArrayList;
8 | import java.util.Collections;
9 | import java.util.List;
10 |
11 | /**
12 | * Created by lzw on 14-9-15.
13 | */
14 | public class AVOSUtils {
15 | public static String convid(String myId, String otherId) {
16 | List ids;
17 | ids = new ArrayList();
18 | ids.add(myId);
19 | ids.add(otherId);
20 | return convid(ids);
21 | }
22 |
23 | public static String convid(List peerIds) {
24 | Collections.sort(peerIds);
25 | StringBuilder sb = new StringBuilder();
26 | for (int i = 0; i < peerIds.size(); i++) {
27 | if (i != 0) {
28 | sb.append(":");
29 | }
30 | sb.append(peerIds.get(i));
31 | }
32 | return Utils.md5(sb.toString());
33 | }
34 |
35 | public static void logAVMessage(AVMessage avMsg) {
36 | Log.d("lam", "avMsg message=" + avMsg.getMessage() + " timestamp=" + avMsg.getTimestamp() + " toPeerIds=" + avMsg.getToPeerIds
37 | () + " fromPeerId=" + avMsg.getFromPeerId() + " receiptTs=" + avMsg.getReceiptTimestamp() + " groupId=" + avMsg.getGroupId
38 | () + " isRequestReceipt=" + avMsg.isRequestReceipt());
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/adapter/EmotionGridAdapter.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.adapter;
2 |
3 | import com.example.lovetalk.R;
4 | import com.example.lovetalk.util.EmotionUtils;
5 | import com.example.lovetalk.view.ViewHolder;
6 |
7 | import android.content.Context;
8 | import android.graphics.Bitmap;
9 | import android.graphics.drawable.Drawable;
10 | import android.view.LayoutInflater;
11 | import android.view.View;
12 | import android.view.ViewGroup;
13 | import android.widget.ImageView;
14 |
15 | /**
16 | * Created by lzw on 14-9-25.
17 | */
18 | public class EmotionGridAdapter extends BaseListAdapter {
19 |
20 | public EmotionGridAdapter(Context ctx) {
21 | super(ctx);
22 | }
23 |
24 | @Override
25 | public View getView(int position, View conView, ViewGroup parent) {
26 | if (conView == null) {
27 | LayoutInflater inflater = LayoutInflater.from(ctx);
28 | conView = inflater.inflate(R.layout.chat_emotion_item, null);
29 | }
30 | ImageView emotionImageView = ViewHolder.findViewById(conView, R.id.emotionImageView);
31 | String emotion = (String) getItem(position);
32 | emotion = emotion.substring(1);
33 | Bitmap bitmap = EmotionUtils.getDrawableByName(ctx, emotion);
34 | emotionImageView.setImageBitmap(bitmap);
35 | return conView;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 5dp
4 | 50dp
5 | 45dp
6 | 3dp
7 | 200dp
8 | 5dp
9 | 80dp
10 | 60dp
11 | 50dp
12 | 30dp
13 | 30dp
14 |
15 | 60dp
16 | 1dip
17 | 48.0dip
18 | 10.0dp
19 | 16dp
20 |
21 | 18sp
22 | 100dp
23 |
24 |
25 | 22.0sp
26 | 80dp
27 | 5dp
28 | 10dp
29 | 140dp
30 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/service/MsgAgent.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.service;
2 |
3 | import com.avos.avoscloud.*;
4 | import com.example.lovetalk.chat.db.DBMsg;
5 | import com.example.lovetalk.chat.entity.Msg;
6 | import com.example.lovetalk.chat.entity.MsgBuilder;
7 | import com.example.lovetalk.chat.entity.RoomType;
8 |
9 | import java.io.IOException;
10 |
11 | /**
12 | * Created by lzw on 14/11/23.
13 | */
14 | public class MsgAgent {
15 | RoomType roomType;
16 | String toId;
17 |
18 | public MsgAgent(RoomType roomType, String toId) {
19 | this.roomType = roomType;
20 | this.toId = toId;
21 | }
22 |
23 | public interface MsgBuilderHelper {
24 | void specifyType(MsgBuilder msgBuilder);
25 | }
26 |
27 | public Msg createAndSendMsg(MsgBuilderHelper msgBuilderHelper) throws IOException, AVException {
28 | MsgBuilder builder = new MsgBuilder();
29 | builder.target(roomType, toId);
30 | msgBuilderHelper.specifyType(builder);
31 | builder.upload();
32 | Msg msg = builder.build();
33 | sendMsg(msg);
34 | DBMsg.insertMsg(msg);
35 | return msg;
36 | }
37 |
38 | public Msg sendMsg(Msg msg) {
39 | AVMessage avMsg = msg.toAVMessage();
40 | Session session = ChatService.getSession();
41 | if (roomType == RoomType.Single) {
42 | session.sendMessage(avMsg);
43 | } else {
44 | Group group = session.getGroup(toId);
45 | group.sendMessage(avMsg);
46 | }
47 | return msg;
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/res/layout/chat_item_msg_image_right.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
13 |
14 |
18 |
19 |
20 |
21 |
30 |
31 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/enity/MeetingInfo.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.enity;
2 |
3 | import android.content.Context;
4 |
5 | import com.avos.avoscloud.AVObject;
6 | import com.avos.avoscloud.AVUser;
7 |
8 | import java.util.ArrayList;
9 | import java.util.HashMap;
10 | import java.util.List;
11 |
12 | public class MeetingInfo {
13 | static List> list = new ArrayList>();
14 | Context context;
15 |
16 | public MeetingInfo(Context context) {
17 | // TODO Auto-generated constructor stub
18 | this.context = context;
19 | list = new ArrayList>();
20 | }
21 |
22 | public static void addMeeting(AVObject meetinfo) {
23 | AVUser adduser = meetinfo.getAVUser("YourUser");
24 | String username = adduser.getUsername();
25 | for (HashMap meet : list) {
26 | AVUser user = (AVUser) meet.get("user");
27 | String name = user.getUsername();
28 | if (name.equals(username)) {
29 | int times = Integer.valueOf(meet.get("times").toString());
30 | meet.put("times", times + 1);
31 | return;
32 | }
33 | }
34 |
35 | HashMap newuser = new HashMap();
36 | newuser.put("user", adduser);
37 | newuser.put("times", 1);
38 |
39 | list.add(newuser);
40 | }
41 |
42 | public static List> getList() {
43 | return list;
44 | }
45 |
46 | public static void Clear() {
47 | list.clear();
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/util/Logger.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.util;
2 |
3 | import android.util.Log;
4 |
5 | public class Logger {
6 | public static final int VERBOSE = 0;
7 | public static int level = VERBOSE;
8 | public static final int INFO = 1;
9 | public static final int DEBUG = 2;
10 | public static final int WARN = 3;
11 | public static final int ERROR = 4;
12 | public static final int NONE = 5;
13 | public static String tag = "lovetalk";
14 |
15 | private static String getDebugInfo() {
16 | Throwable stack = new Throwable().fillInStackTrace();
17 | StackTraceElement[] trace = stack.getStackTrace();
18 | int n = 2;
19 | return trace[n].getClassName() + " " + trace[n].getMethodName() + "()" + ":" + trace[n].getLineNumber() + " ";
20 | }
21 |
22 | public static void v(String s) {
23 | if (VERBOSE >= level) {
24 | Log.v(tag, getDebugInfo() + s);
25 | }
26 | }
27 |
28 | public static void i(String s) {
29 | if (INFO >= level) {
30 | Log.i(tag, getDebugInfo() + s);
31 | }
32 | }
33 |
34 | public static void w(String s) {
35 | if (WARN >= level) {
36 | Log.w(tag, getDebugInfo() + s);
37 | }
38 | }
39 |
40 | public static void e(String s) {
41 | if (ERROR >= level) {
42 | Log.e(tag, getDebugInfo() + s);
43 | }
44 | }
45 |
46 | public static void d(String s) {
47 | if (DEBUG >= level) {
48 | Log.d(tag, getDebugInfo() + s);
49 | }
50 | }
51 |
52 | }
--------------------------------------------------------------------------------
/src/com/example/lovetalk/util/PathUtils.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.util;
2 |
3 | import android.os.Environment;
4 |
5 | import java.io.File;
6 |
7 | /**
8 | * Created by lzw on 14-9-19.
9 | */
10 | public class PathUtils {
11 | public static String getSDcardDir() {
12 | return Environment.getExternalStorageDirectory().getPath() + "/";
13 | }
14 |
15 | public static String checkAndMkdirs(String dir) {
16 | File file = new File(dir);
17 | if (file.exists() == false) {
18 | file.mkdirs();
19 | }
20 | return dir;
21 | }
22 |
23 | public static String getAppPath() {
24 | String dir = getSDcardDir() + "leanchat/";
25 | return checkAndMkdirs(dir);
26 | }
27 |
28 | public static String getAvatarDir() {
29 | String dir = getAppPath() + "avatar/";
30 | return checkAndMkdirs(dir);
31 | }
32 |
33 | public static String getAvatarTmpPath() {
34 | return getAvatarDir() + "tmp";
35 | }
36 |
37 | public static String getChatFileDir() {
38 | String dir = getAppPath() + "files/";
39 | return checkAndMkdirs(dir);
40 | }
41 |
42 | public static String getChatFilePath(String id) {
43 | String dir = getChatFileDir();
44 | String path = dir + id;
45 | return path;
46 | }
47 |
48 | public static String getRecordTmpPath() {
49 | return getChatFileDir() + "tmp";
50 | }
51 |
52 | public static String getUUIDFilePath() {
53 | return getChatFilePath(Utils.myUUID());
54 | }
55 |
56 | public static String getTmpPath() {
57 | return getAppPath() + "tmp";
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/service/SignatureFactory.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.service;
2 |
3 | import com.avos.avoscloud.AVException;
4 | import com.avos.avoscloud.Signature;
5 |
6 | import java.util.ArrayList;
7 | import java.util.HashMap;
8 | import java.util.List;
9 |
10 | /**
11 | * 请配合云代码使用
12 | */
13 | public class SignatureFactory implements com.avos.avoscloud.SignatureFactory {
14 | @Override
15 | public Signature createSignature(String peerId, List watchIds) {
16 | try {
17 | HashMap map = CloudService.sign(peerId, watchIds);
18 | return createSignature(map, watchIds);
19 | } catch (AVException e) {
20 | e.printStackTrace();
21 | }
22 | return null;
23 | }
24 |
25 | Signature createSignature(HashMap params, List peerIds) {
26 | Signature s = new Signature();
27 | List copyIds = new ArrayList();
28 | copyIds.addAll(peerIds);
29 | s.setTimestamp((Integer) params.get("timestamp"));
30 | s.setNonce((String) params.get("nonce"));
31 | s.setSignature((String) params.get("signature"));
32 | s.setSignedPeerIds(copyIds);
33 | return s;
34 | }
35 |
36 | @Override
37 | public Signature createGroupSignature(String arg0, String arg1,
38 | List arg2, String arg3) {
39 | // TODO Auto-generated method stub
40 | return null;
41 | }
42 |
43 | @Override
44 | public Signature createConversationSignature(String s, String s1, List list, String s2) throws SignatureException {
45 | return null;
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/res/layout/chat_bottom_add_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
20 |
21 |
30 |
31 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/res/layout/myblog.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
21 |
22 |
29 |
30 |
37 |
38 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/res/layout/itsblog.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
21 |
22 |
29 |
30 |
37 |
38 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/res/layout/item_user_friend.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
15 |
16 |
21 |
22 |
28 |
29 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/activity/BaseActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.activity;
2 |
3 | import android.app.ActionBar;
4 | import android.content.Context;
5 | import android.content.pm.ActivityInfo;
6 | import android.os.Bundle;
7 | import android.support.v4.app.FragmentActivity;
8 | import android.view.MenuItem;
9 | import android.view.WindowManager;
10 |
11 | import com.example.lovetalk.DemoApplication;
12 | import com.example.lovetalk.util.Utils;
13 |
14 | public class BaseActivity extends FragmentActivity {
15 | Context mContext;
16 |
17 | @Override
18 | protected void onCreate(Bundle savedInstanceState) {
19 | super.onCreate(savedInstanceState);
20 | setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
21 | mContext = this;
22 | }
23 |
24 | @Override
25 | public boolean onOptionsItemSelected(MenuItem item) {
26 | switch (item.getItemId()) {
27 | case android.R.id.home:
28 | super.onBackPressed();
29 | return true;
30 | }
31 | return super.onOptionsItemSelected(item);
32 | }
33 |
34 | void hideSoftInputView() {
35 | Utils.hideSoftInputView(this);
36 | }
37 |
38 | void setSoftInputMode() {
39 | getWindow().setSoftInputMode(
40 | WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
41 | }
42 |
43 | void initActionBar() {
44 | initActionBar(null);
45 | }
46 |
47 | void initActionBar(String title) {
48 | ActionBar actionBar = getActionBar();
49 | if (title != null) {
50 | actionBar.setTitle(title);
51 | }
52 | actionBar.setDisplayUseLogoEnabled(false);
53 | actionBar.setDisplayHomeAsUpEnabled(true);
54 | }
55 |
56 | void initActionBar(int id) {
57 | initActionBar(DemoApplication.context.getString(id));
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/res/layout/meet_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
14 |
15 |
16 |
25 |
26 |
27 |
36 |
37 |
45 |
46 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/adapter/AddFriendAdapter.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.adapter;
2 |
3 | import android.content.Context;
4 | import android.view.View;
5 | import android.view.View.OnClickListener;
6 | import android.view.ViewGroup;
7 | import android.widget.Button;
8 | import android.widget.ImageView;
9 | import android.widget.TextView;
10 |
11 | import com.avos.avoscloud.AVUser;
12 | import com.example.lovetalk.R;
13 | import com.example.lovetalk.service.AddRequestService;
14 | import com.example.lovetalk.view.ViewHolder;
15 |
16 | import java.util.List;
17 |
18 | public class AddFriendAdapter extends BaseListAdapter {
19 | Context mContext;
20 |
21 | public AddFriendAdapter(Context context, List list) {
22 | super(context, list);
23 | // TODO Auto-generated constructor stub
24 | mContext = context;
25 | }
26 |
27 | @Override
28 | public View getView(int position, View conView, ViewGroup parent) {
29 | // TODO Auto-generated method stub
30 | if (conView == null) {
31 | conView = inflater.inflate(R.layout.contact_add_friend_item, null);
32 | }
33 | final AVUser user = datas.get(position);
34 | TextView nameView = ViewHolder.findViewById(conView, R.id.name);
35 | ImageView avatarView = ViewHolder.findViewById(conView, R.id.avatar);
36 | Button addBtn = ViewHolder.findViewById(conView, R.id.add);
37 | // String avatarUrl = contact.getAvatarUrl();
38 | // UserService.displayAvatar(avatarUrl, avatarView);
39 | nameView.setText(user.getUsername());
40 | addBtn.setText(R.string.add);
41 | addBtn.setOnClickListener(new OnClickListener() {
42 |
43 | @Override
44 | public void onClick(View v) {
45 | AddRequestService.createAddRequestInBackground(mContext, user);
46 | }
47 | });
48 | return conView;
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/res/layout/chat_item_msg_image_left.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
12 |
17 |
18 |
21 |
22 |
32 |
33 |
34 |
35 |
36 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/res/layout/base_common_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
16 |
17 |
27 |
28 |
29 |
37 |
38 |
47 |
--------------------------------------------------------------------------------
/res/layout/chat_item_msg_text_right.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
14 |
15 |
16 |
17 |
22 |
23 |
38 |
39 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/adapter/BaseListAdapter.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.adapter;
2 |
3 | import android.content.Context;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.BaseAdapter;
8 |
9 | import java.util.ArrayList;
10 | import java.util.List;
11 |
12 | /**
13 | * Created by lzw on 14-9-25.
14 | */
15 | public class BaseListAdapter extends BaseAdapter {
16 | Context ctx;
17 | LayoutInflater inflater;
18 | List datas = new ArrayList();
19 |
20 | public BaseListAdapter(Context ctx) {
21 | initWithContext(ctx);
22 | }
23 |
24 | public void initWithContext(Context ctx) {
25 | this.ctx = ctx;
26 | inflater = LayoutInflater.from(ctx);
27 | }
28 |
29 | public BaseListAdapter(Context ctx, List datas) {
30 | initWithContext(ctx);
31 | this.datas = datas;
32 | }
33 |
34 | public void setDatas(List datas) {
35 | this.datas = datas;
36 | }
37 |
38 |
39 | public List getDatas() {
40 | return datas;
41 | }
42 |
43 | public void addAll(List subDatas) {
44 | datas.addAll(subDatas);
45 | notifyDataSetChanged();
46 | }
47 |
48 | public void add(T object) {
49 | datas.add(object);
50 | notifyDataSetChanged();
51 | }
52 |
53 | public void remove(int position) {
54 | datas.remove(position);
55 | notifyDataSetChanged();
56 | }
57 |
58 | @Override
59 | public int getCount() {
60 | return datas.size();
61 | }
62 |
63 | @Override
64 | public Object getItem(int position) {
65 | return datas.get(position);
66 | }
67 |
68 | @Override
69 | public long getItemId(int position) {
70 | return position;
71 | }
72 |
73 | @Override
74 | public View getView(int position, View convertView, ViewGroup parent) {
75 | return null;
76 | }
77 |
78 | public void clear() {
79 | datas.clear();
80 | notifyDataSetChanged();
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/util/MyAsyncTask.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.util;
2 |
3 | import android.app.Activity;
4 | import android.app.ProgressDialog;
5 | import android.content.Context;
6 | import android.os.AsyncTask;
7 |
8 |
9 | public abstract class MyAsyncTask extends AsyncTask {
10 | ProgressDialog dialog;
11 | protected Context context;
12 | boolean openDialog = true;
13 | Exception exception;
14 |
15 | protected MyAsyncTask(Context context) {
16 | this.context = context;
17 | }
18 |
19 | protected MyAsyncTask(Context context, boolean openDialog) {
20 | this.context = context;
21 | this.openDialog = openDialog;
22 | }
23 |
24 | public MyAsyncTask setOpenDialog(boolean openDialog) {
25 | this.openDialog = openDialog;
26 | return this;
27 | }
28 |
29 | public ProgressDialog getDialog() {
30 | return dialog;
31 | }
32 |
33 | @Override
34 | protected void onPreExecute() {
35 | super.onPreExecute();
36 | if (openDialog) {
37 | dialog = Utils.showSpinnerDialog((Activity) context);
38 | }
39 | }
40 |
41 | @Override
42 | protected Void doInBackground(Void... params) {
43 | try {
44 | doInBack();
45 | } catch (Exception e) {
46 | e.printStackTrace();
47 | exception = e;
48 | }
49 | return null;
50 | }
51 |
52 | @Override
53 | protected void onPostExecute(Void aVoid) {
54 | super.onPostExecute(aVoid);
55 | if (openDialog) {
56 | if (dialog.isShowing()) {
57 | dialog.dismiss();
58 | }
59 | }
60 | onPost(exception);
61 | }
62 |
63 |
64 |
65 | protected void onPost(Exception e) {
66 | if (e != null) {
67 | e.printStackTrace();
68 | Utils.toast(e.getMessage());
69 | //Utils.toast(ctx, R.string.pleaseCheckNetwork);
70 | } else {
71 | onSucceed();
72 | }
73 | }
74 |
75 | protected abstract void doInBack() throws Exception;
76 | protected abstract void onSucceed();
77 | }
78 |
--------------------------------------------------------------------------------
/res/layout/contact_add_friend_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
20 |
21 |
30 |
31 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/res/layout/meetinginfo_cell.xml:
--------------------------------------------------------------------------------
1 |
6 |
10 |
11 |
14 |
21 |
22 |
23 |
28 |
29 |
36 |
37 |
38 |
39 |
40 |
41 |
44 |
45 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/activity/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.activity;
2 |
3 | import com.avos.avoscloud.AVException;
4 | import com.avos.avoscloud.AVObject;
5 | import com.avos.avoscloud.AVQuery;
6 | import com.avos.avoscloud.AVUser;
7 | import com.avos.avoscloud.GetCallback;
8 | import com.avos.avoscloud.SaveCallback;
9 | import com.avos.avoscloud.SignUpCallback;
10 | import com.example.lovetalk.R;
11 | import com.example.lovetalk.R.layout;
12 | import com.example.lovetalk.receiver.FinishReceiver;
13 | import com.example.lovetalk.util.Utils;
14 |
15 | import android.app.Activity;
16 | import android.content.Intent;
17 | import android.os.Bundle;
18 | import android.os.Handler;
19 | import android.os.Message;
20 | import android.util.Log;
21 | import android.view.Menu;
22 | import android.view.Window;
23 |
24 |
25 | public class MainActivity extends BaseEntryActivity {
26 | private static final int GO_MAIN_MSG = 1;
27 | private static final int GO_LOGIN_MSG = 2;
28 | public static final int DURATION = 2000;
29 |
30 | @Override
31 | protected void onCreate(Bundle savedInstanceState) {
32 | super.onCreate(savedInstanceState);
33 | requestWindowFeature(Window.FEATURE_NO_TITLE);
34 | setContentView(R.layout.activity_welcome);
35 |
36 |
37 | AVUser user = AVUser.getCurrentUser();
38 | if (user != null) {
39 | Utils.updateUserInfo();
40 | handler.sendEmptyMessageDelayed(GO_MAIN_MSG, DURATION);
41 | } else {
42 | handler.sendEmptyMessageDelayed(GO_LOGIN_MSG, DURATION);
43 | }
44 | }
45 |
46 | private Handler handler = new Handler() {
47 | @Override
48 | public void handleMessage(Message msg) {
49 | switch (msg.what) {
50 | case GO_MAIN_MSG:
51 | HomeActivity.goHomeActivity(MainActivity.this);
52 | finish();
53 | break;
54 | case GO_LOGIN_MSG:
55 | Utils.goActivity(MainActivity.this, LoginActivity.class);
56 | finish();
57 | break;
58 | }
59 | }
60 | };
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/service/CloudService.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.service;
2 |
3 | import com.avos.avoscloud.AVCloud;
4 | import com.avos.avoscloud.AVException;
5 | import com.avos.avoscloud.AVUser;
6 |
7 | import java.util.HashMap;
8 | import java.util.List;
9 | import java.util.Map;
10 | import java.util.Objects;
11 |
12 | /**
13 | * Created by lzw on 14-9-29.
14 | */
15 | public class CloudService {
16 | public static void removeFriendForBoth(AVUser toUser, AVUser fromUser) throws AVException {
17 | callCloudRelationFn(toUser, fromUser, "removeFriend");
18 | }
19 |
20 | public static void callCloudRelationFn(AVUser toUser, AVUser fromUser, String functionName) throws AVException {
21 | Map map = usersParamsMap(fromUser, toUser);
22 | Object res = AVCloud.callFunction(functionName, map);
23 | }
24 |
25 | public static Map usersParamsMap(AVUser fromUser, AVUser toUser) {
26 | Map map = new HashMap();
27 | map.put("fromUserId", fromUser.getObjectId());
28 | map.put("toUserId", toUser.getObjectId());
29 | return map;
30 | }
31 |
32 | public static void tryCreateAddRequest(AVUser toUser) throws AVException {
33 | AVUser user = AVUser.getCurrentUser();
34 | Map map = usersParamsMap(user, toUser);
35 | AVCloud.callFunction("tryCreateAddRequest", map);
36 | }
37 |
38 | public static void agreeAddRequest(String objectId) throws AVException {
39 | Map map = new HashMap();
40 | map.put("objectId", objectId);
41 | AVCloud.callFunction("agreeAddRequest", map);
42 | }
43 |
44 | public static HashMap sign(String selfId, List watchIds) throws AVException {
45 | Map map = new HashMap();
46 | map.put("self_id", selfId);
47 | map.put("watch_ids", watchIds);
48 | return (HashMap) AVCloud.callFunction("sign", map);
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/res/layout/chat_item_msg_text_left.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
14 |
15 |
20 |
21 |
29 |
30 |
33 |
34 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/res/layout/contact_add_friend_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
25 |
26 |
36 |
37 |
38 |
48 |
49 |
--------------------------------------------------------------------------------
/res/layout/chat_item_msg_audio_right.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
24 |
25 |
38 |
39 |
43 |
44 |
45 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/res/layout/chat_bottom_text_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
20 |
21 |
27 |
28 |
38 |
39 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/res/layout/chat_item_msg_location_left.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
14 |
15 |
20 |
21 |
24 |
25 |
32 |
33 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/res/layout/chat_item_msg_audio_left.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
15 |
16 |
21 |
22 |
30 |
31 |
34 |
35 |
45 |
46 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/util/CharacterParser.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.util;
2 |
3 | import net.sourceforge.pinyin4j.PinyinHelper;
4 | import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
5 | import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
6 | import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
7 | import net.sourceforge.pinyin4j.format.HanyuPinyinVCharType;
8 | import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
9 |
10 | public class CharacterParser {
11 | // 将汉字转换为全拼
12 | public static String getPingYin(String src) {
13 |
14 | char[] t1 = null;
15 | t1 = src.toCharArray();
16 | String[] t2 = new String[t1.length];
17 | HanyuPinyinOutputFormat t3 = new HanyuPinyinOutputFormat();
18 |
19 | t3.setCaseType(HanyuPinyinCaseType.LOWERCASE);
20 | t3.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
21 | t3.setVCharType(HanyuPinyinVCharType.WITH_V);
22 | String t4 = "";
23 | int t0 = t1.length;
24 | try {
25 | for (int i = 0; i < t0; i++) {
26 | // 判断是否为汉字字符
27 | if (java.lang.Character.toString(t1[i]).matches(
28 | "[\\u4E00-\\u9FA5]+")) {
29 | t2 = PinyinHelper.toHanyuPinyinStringArray(t1[i], t3);
30 | t4 += t2[0];
31 | } else
32 | t4 += java.lang.Character.toString(t1[i]);
33 | }
34 | // System.out.println(t4);
35 | return t4;
36 | } catch (BadHanyuPinyinOutputFormatCombination e1) {
37 | e1.printStackTrace();
38 | }
39 | return t4;
40 | }
41 |
42 | // 返回中文的首字母
43 | public static String getPinYinHeadChar(String str) {
44 |
45 | String convert = "";
46 | for (int j = 0; j < str.length(); j++) {
47 | char word = str.charAt(j);
48 | String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(word);
49 | if (pinyinArray != null) {
50 | convert += pinyinArray[0].charAt(0);
51 | } else {
52 | convert += word;
53 | }
54 | }
55 | return convert;
56 | }
57 |
58 | // 将字符串转移为ASCII码
59 | public static String getCnASCII(String cnStr) {
60 | StringBuffer strBuf = new StringBuffer();
61 | byte[] bGBK = cnStr.getBytes();
62 | for (int i = 0; i < bGBK.length; i++) {
63 | strBuf.append(Integer.toHexString(bGBK[i] & 0xff));
64 | }
65 | return strBuf.toString();
66 | }
67 | }
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/chat/entity/MsgBuilder.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.chat.entity;
2 |
3 | import com.avos.avoscloud.AVException;
4 | import com.avos.avoscloud.AVFile;
5 | import com.example.lovetalk.service.ChatService;
6 | import com.example.lovetalk.util.AVOSUtils;
7 | import com.example.lovetalk.util.PathUtils;
8 | import com.example.lovetalk.util.Utils;
9 |
10 | import java.io.IOException;
11 |
12 | public class MsgBuilder {
13 | Msg msg;
14 |
15 | public MsgBuilder() {
16 | msg = new Msg();
17 | }
18 |
19 | public void target(RoomType roomType, String toId) {
20 | String convid;
21 | msg.setRoomType(roomType);
22 | if (roomType == RoomType.Single) {
23 | msg.setToPeerId(toId);
24 | msg.setRequestReceipt(true);
25 | convid = AVOSUtils.convid(ChatService.getSelfId(), toId);
26 | } else {
27 | convid = toId;
28 | }
29 | msg.setConvid(convid);
30 | }
31 |
32 | public void text(String content) {
33 | msg.setType(Msg.Type.Text);
34 | msg.setContent(content);
35 | }
36 |
37 | private void file(Msg.Type type, String objectId) {
38 | msg.setType(type);
39 | msg.setObjectId(objectId);
40 | }
41 |
42 | public void image(String objectId) {
43 | file(Msg.Type.Image, objectId);
44 | }
45 |
46 | public void location(String address, double latitude, double longitude) {
47 | String content = address + "&" + latitude + "&" + longitude;
48 | msg.setContent(content);
49 | msg.setType(Msg.Type.Location);
50 | }
51 |
52 | public void audio(String objectId) {
53 | file(Msg.Type.Audio, objectId);
54 | }
55 |
56 | public Msg build() {
57 | msg.setStatus(Msg.Status.SendStart);
58 | msg.setTimestamp(System.currentTimeMillis());
59 | msg.setFromPeerId(ChatService.getSelfId());
60 | if (msg.getObjectId() == null) {
61 | msg.setObjectId(Utils.myUUID());
62 | }
63 | return msg;
64 | }
65 |
66 | public void upload() throws IOException, AVException {
67 | if (msg.getType() != Msg.Type.Audio && msg.getType() != Msg.Type.Image) {
68 | return;
69 | }
70 | String objectId = msg.getObjectId();
71 | if (objectId == null) {
72 | throw new NullPointerException("objectId mustn't be null");
73 | }
74 | String filePath = PathUtils.getChatFilePath(objectId);
75 | AVFile file = AVFile.withAbsoluteLocalPath(objectId, filePath);
76 | file.save();
77 | String url = file.getUrl();
78 | msg.setContent(url);
79 | }
80 | }
--------------------------------------------------------------------------------
/res/layout/chat_item_msg_location_right.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
14 |
15 |
16 |
17 |
22 |
23 |
24 |
36 |
37 |
49 |
50 |
51 |
52 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/DemoApplication.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk;
2 |
3 | import java.io.File;
4 | import java.util.ArrayList;
5 | import java.util.HashMap;
6 | import java.util.List;
7 | import java.util.Map;
8 |
9 | import android.app.Application;
10 | import android.content.Context;
11 |
12 | import com.avos.avoscloud.AVMessage;
13 | import com.avos.avoscloud.AVOSCloud;
14 | import com.avos.avoscloud.AVObject;
15 | import com.avos.avoscloud.AVUser;
16 | import com.baidu.mapapi.SDKInitializer;
17 | import com.example.lovetalk.service.AddRequest;
18 | import com.example.lovetalk.util.PhotoUtil;
19 | import com.nostra13.universalimageloader.core.ImageLoader;
20 | import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
21 | import com.nostra13.universalimageloader.utils.StorageUtils;
22 |
23 | public class DemoApplication extends Application {
24 | public static DemoApplication context;
25 | private static Map usersCache = new HashMap();
26 | List friends = new ArrayList();
27 |
28 | @Override
29 | public void onCreate() {
30 | // TODO Auto-generated method stub
31 | super.onCreate();
32 | context = this;
33 | AVOSCloud.initialize(this,
34 | "h1yik0j4fq0wb7759ruubwdcc7qi4bod880i1joe98jk160s",
35 | "yl8j5oyb3avv54pbjsl76no4lcnt6lq0z2jngx2dqze4b4h8");
36 | AVObject.registerSubclass(AddRequest.class);
37 | SDKInitializer.initialize(this);
38 | initImageLoader(context);
39 | }
40 |
41 | public static void initImageLoader(Context context) {
42 | File cacheDir = StorageUtils.getOwnCacheDirectory(context,
43 | "leanchat/Cache");
44 | ImageLoaderConfiguration config = PhotoUtil.getImageLoaderConfig(
45 | context, cacheDir);
46 | // Initialize ImageLoader with configuration.
47 | ImageLoader.getInstance().init(config);
48 | }
49 |
50 | public List getFriends() {
51 | return friends;
52 | }
53 |
54 | public void setFriends(List friends) {
55 | this.friends = friends;
56 | }
57 |
58 | public static AVUser lookupUser(String userId) {
59 | return usersCache.get(userId);
60 | }
61 |
62 | public static void registerUserCache(String userId, AVUser user) {
63 | usersCache.put(userId, user);
64 | }
65 |
66 | public static void registerUserCache(AVUser user) {
67 | registerUserCache(user.getObjectId(), user);
68 | }
69 |
70 | public static void registerBatchUserCache(List users) {
71 | for (AVUser user : users) {
72 | registerUserCache(user);
73 | }
74 | }
75 |
76 | }
77 |
--------------------------------------------------------------------------------
/res/layout/activity_meet.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
13 |
14 |
20 |
21 |
30 |
31 |
39 |
40 |
48 |
49 |
58 |
59 |
60 |
66 |
67 |
--------------------------------------------------------------------------------
/res/layout/activity_forget.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
14 |
15 |
23 |
24 |
32 |
33 |
38 |
39 |
48 |
49 |
50 |
51 |
59 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/res/layout/chat_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
19 |
20 |
27 |
28 |
32 |
33 |
38 |
39 |
45 |
46 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/res/layout/contact_include_new_friend.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
21 |
22 |
30 |
31 |
40 |
41 |
42 |
53 |
54 |
55 |
56 |
62 |
63 |
64 |
65 |
71 |
72 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/view/HeaderLayout.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.view;
2 |
3 | import com.example.lovetalk.R;
4 |
5 | import android.app.Activity;
6 | import android.content.Context;
7 | import android.util.AttributeSet;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.widget.*;
11 |
12 | public class HeaderLayout extends LinearLayout {
13 | LayoutInflater mInflater;
14 | RelativeLayout header;
15 | TextView titleView;
16 | LinearLayout leftContainer, rightContainer;
17 | Button backBtn;
18 |
19 | public HeaderLayout(Context context) {
20 | super(context);
21 | init();
22 | }
23 |
24 | public HeaderLayout(Context context, AttributeSet attrs) {
25 | super(context, attrs);
26 | init();
27 | }
28 |
29 | private void init() {
30 | mInflater = LayoutInflater.from(getContext());
31 | header = (RelativeLayout) mInflater.inflate(R.layout.base_common_header, null, false);
32 | titleView = (TextView) header.findViewById(R.id.titleView);
33 | leftContainer = (LinearLayout) header.findViewById(R.id.leftContainer);
34 | rightContainer = (LinearLayout) header.findViewById(R.id.rightContainer);
35 | backBtn = (Button) header.findViewById(R.id.backBtn);
36 | addView(header);
37 | }
38 |
39 | public void showTitle(int titleId) {
40 | titleView.setText(titleId);
41 | }
42 |
43 | public void showTitle(String s) {
44 | titleView.setText(s);
45 | }
46 |
47 | public void showLeftBackButton(OnClickListener listener) {
48 | showLeftBackButton(R.string.emptyStr, listener);
49 | }
50 |
51 | public void showLeftBackButton() {
52 | showLeftBackButton(null);
53 | }
54 |
55 | public void showLeftBackButton(int backTextId, OnClickListener listener) {
56 | backBtn.setVisibility(View.VISIBLE);
57 | backBtn.setText(backTextId);
58 | if (listener == null) {
59 | listener = new OnClickListener() {
60 | @Override
61 | public void onClick(View v) {
62 | ((Activity) getContext()).finish();
63 | }
64 | };
65 | }
66 | backBtn.setOnClickListener(listener);
67 | }
68 |
69 | public void showRightImageButton(int rightResId, OnClickListener listener) {
70 | View imageViewLayout = mInflater.inflate(R.layout.base_common_header_right_image_btn, null, false);
71 | ImageButton rightButton = (ImageButton) imageViewLayout.findViewById(R.id.imageBtn);
72 | rightButton.setImageResource(rightResId);
73 | rightButton.setOnClickListener(listener);
74 | rightContainer.addView(imageViewLayout);
75 | }
76 |
77 | public void showRightTextButton(int rightResId, OnClickListener listener) {
78 | View imageViewLayout = mInflater.inflate(R.layout.base_common_header_right_btn, null, false);
79 | Button rightButton = (Button) imageViewLayout.findViewById(R.id.textBtn);
80 | rightButton.setText(rightResId);
81 | rightButton.setOnClickListener(listener);
82 | rightContainer.addView(imageViewLayout);
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/view/PlayButton.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.view;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.media.MediaPlayer;
6 | import android.util.AttributeSet;
7 | import android.view.View;
8 |
9 | import com.example.lovetalk.R;
10 | import com.example.lovetalk.util.Utils;
11 |
12 | import java.io.IOException;
13 |
14 | /**
15 | * Created by lzw on 14-9-22.
16 | */
17 | public class PlayButton extends View implements View.OnClickListener {
18 | MediaPlayer mediaPlayer;
19 | String path;
20 | Context ctx;
21 | boolean prepared = false;
22 | int backResourceId;
23 |
24 | public PlayButton(Context context) {
25 | super(context);
26 | ctx = context;
27 | init();
28 | }
29 |
30 | public PlayButton(Context context, AttributeSet attrs) {
31 | super(context, attrs);
32 | ctx = context;
33 | TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.PlayBtn);
34 | boolean left = true;
35 | for (int i = 0; i < typedArray.getIndexCount(); i++) {
36 | int attr = typedArray.getIndex(i);
37 | switch (attr) {
38 | case R.styleable.PlayBtn_left:
39 | left = typedArray.getBoolean(attr, true);
40 | break;
41 | }
42 | }
43 | if (left) {
44 | backResourceId = R.drawable.voice_left;
45 | } else {
46 | backResourceId = R.drawable.voice_right;
47 | }
48 | init();
49 | }
50 |
51 | public void setPath(String path) {
52 | this.path = path;
53 | prepared = false;
54 | }
55 |
56 | public void playAudio() {
57 | if (prepared == false) {
58 | try {
59 | mediaPlayer = new MediaPlayer();
60 | mediaPlayer.setDataSource(path);
61 | mediaPlayer.prepare();
62 | mediaPlayer.start();
63 | mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
64 | @Override
65 | public void onCompletion(MediaPlayer mp) {
66 | setBackgroundResource(backResourceId);
67 | }
68 | });
69 | setBackgroundDrawable(null);
70 | prepared = true;
71 | } catch (IOException e) {
72 | e.printStackTrace();
73 | Utils.toast(e.getMessage());
74 | }
75 | } else {
76 | mediaPlayer.start();
77 | setBackgroundDrawable(null);
78 | }
79 | }
80 |
81 | private void init() {
82 | setBackgroundResource(backResourceId);
83 | setOnClickListener(this);
84 | }
85 |
86 | @Override
87 | protected void onDetachedFromWindow() {
88 | if (mediaPlayer != null) {
89 | mediaPlayer.stop();
90 | mediaPlayer.release();
91 | mediaPlayer = null;
92 | }
93 | super.onDetachedFromWindow();
94 | }
95 |
96 | @Override
97 | public void onClick(View v) {
98 | if (mediaPlayer != null && mediaPlayer.isPlaying()) {
99 | mediaPlayer.pause();
100 | setBackgroundResource(backResourceId);
101 | } else {
102 | playAudio();
103 | }
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/res/layout/contact_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
37 |
38 |
44 |
45 |
57 |
58 |
59 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/adapter/NewFriendAdapter.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.adapter;
2 |
3 | import android.content.Context;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.View.OnClickListener;
7 | import android.view.ViewGroup;
8 | import android.widget.Button;
9 | import android.widget.ImageView;
10 | import android.widget.TextView;
11 |
12 | import com.avos.avoscloud.AVException;
13 | import com.avos.avoscloud.AVFile;
14 | import com.avos.avoscloud.AVUser;
15 | import com.avos.avoscloud.SaveCallback;
16 | import com.example.lovetalk.R;
17 | import com.example.lovetalk.service.AddRequest;
18 | import com.example.lovetalk.service.AddRequestService;
19 | import com.example.lovetalk.service.UserService;
20 | import com.example.lovetalk.util.Utils;
21 | import com.example.lovetalk.view.ViewHolder;
22 |
23 | import java.util.List;
24 |
25 | public class NewFriendAdapter extends BaseListAdapter {
26 |
27 | public NewFriendAdapter(Context context, List list) {
28 | super(context, list);
29 | // TODO Auto-generated constructor stub
30 | }
31 |
32 | @Override
33 | public View getView(int position, View conView, ViewGroup parent) {
34 | // TODO Auto-generated method stub
35 | if (conView == null) {
36 | LayoutInflater mInflater = LayoutInflater.from(ctx);
37 | conView = mInflater.inflate(R.layout.contact_add_friend_item, null);
38 | }
39 | final AddRequest addRequest = datas.get(position);
40 | TextView nameView = ViewHolder.findViewById(conView, R.id.name);
41 | ImageView avatarView = ViewHolder.findViewById(conView, R.id.avatar);
42 | final Button addBtn = ViewHolder.findViewById(conView, R.id.add);
43 |
44 | String avatarUrl = getAvatarUrl(addRequest.getFromUser());
45 | UserService.displayAvatar(avatarUrl, avatarView);
46 |
47 | int status = addRequest.getStatus();
48 | if (status == AddRequest.STATUS_WAIT) {
49 | addBtn.setOnClickListener(new OnClickListener() {
50 |
51 | @Override
52 | public void onClick(View arg0) {
53 | // TODO Auto-generated method stub
54 | agreeAdd(addBtn, addRequest);
55 | }
56 | });
57 | } else if (status == AddRequest.STATUS_DONE) {
58 | toAgreedTextView(addBtn);
59 | }
60 | nameView.setText(addRequest.getFromUser().getUsername());
61 | return conView;
62 | }
63 |
64 | public String getAvatarUrl(AVUser user) {
65 | AVFile avatar = user.getAVFile("avatar");
66 | if (avatar != null) {
67 | return avatar.getUrl();
68 | } else {
69 | return null;
70 | }
71 | }
72 |
73 | public void toAgreedTextView(Button addBtn) {
74 | addBtn.setText(R.string.agreed);
75 | addBtn.setBackgroundDrawable(null);
76 | addBtn.setTextColor(Utils.getColor(R.color.base_color_text_black));
77 | addBtn.setEnabled(false);
78 | }
79 |
80 | private void agreeAdd(final Button addBtn, final AddRequest addRequest) {
81 | AddRequestService.agreeAddRequest(addRequest, new SaveCallback() {
82 | @Override
83 | public void done(AVException e) {
84 | toAgreedTextView(addBtn);
85 | }
86 | });
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/service/PreferenceMap.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.service;
2 |
3 | import android.content.Context;
4 | import android.content.SharedPreferences;
5 | import android.preference.PreferenceManager;
6 |
7 | import com.avos.avoscloud.AVGeoPoint;
8 | import com.avos.avoscloud.AVUser;
9 |
10 | public class PreferenceMap {
11 | public static final String ADD_REQUEST_N = "addRequestN";
12 | public static final String LATITUDE = "latitude";
13 | public static final String LONGITUDE = "longitude";
14 | public static final String ADDRESS = "address";
15 | public static final String NOTIFY_WHEN_NEWS = "notifyWhenNews";
16 |
17 | Context context;
18 | SharedPreferences pref;
19 | SharedPreferences.Editor editor;
20 | // int addRequestN;
21 | // String latitude;
22 | // String longitude;
23 | public static PreferenceMap currentUserPreferenceMap;
24 |
25 | public PreferenceMap(Context context, String prefName) {
26 | this.context = context;
27 | pref = context.getSharedPreferences(prefName, Context.MODE_PRIVATE);
28 | editor = pref.edit();
29 | }
30 |
31 | public static PreferenceMap getCurUserPrefDao(Context context) {
32 | if (currentUserPreferenceMap == null) {
33 | currentUserPreferenceMap = new PreferenceMap(context, AVUser.getCurrentUser().getObjectId());
34 | }
35 | return currentUserPreferenceMap;
36 | }
37 |
38 | public static PreferenceMap getMyPrefDao(Context context) {
39 | AVUser user = AVUser.getCurrentUser();
40 | if (user == null) {
41 | throw new RuntimeException("user is null");
42 | }
43 | return new PreferenceMap(context, user.getObjectId());
44 | }
45 |
46 | public int getAddRequestN() {
47 | return pref.getInt(ADD_REQUEST_N, 0);
48 | }
49 |
50 | public void setAddRequestN(int addRequestN) {
51 | editor.putInt(ADD_REQUEST_N, addRequestN).commit();
52 | }
53 |
54 | private String getLatitude() {
55 | return pref.getString(LATITUDE, null);
56 | }
57 |
58 | private void setLatitude(String latitude) {
59 | editor.putString(LATITUDE, latitude).commit();
60 | }
61 |
62 | private String getLongitude() {
63 | return pref.getString(LONGITUDE, null);
64 | }
65 |
66 | private void setLongitude(String longitude) {
67 | editor.putString(LONGITUDE, longitude).commit();
68 | }
69 |
70 | public String getAddress() {
71 | return pref.getString(ADDRESS, null);
72 | }
73 |
74 | public void setAddress(String address) {
75 | editor.putString(ADDRESS, address).commit();
76 | }
77 |
78 | public AVGeoPoint getLocation() {
79 | String latitudeStr = getLatitude();
80 | String longitudeStr = getLongitude();
81 | if (latitudeStr == null || longitudeStr == null) {
82 | return null;
83 | }
84 | double latitude = Double.parseDouble(latitudeStr);
85 | double longitude = Double.parseDouble(longitudeStr);
86 | return new AVGeoPoint(latitude, longitude);
87 | }
88 |
89 | public void setLocation(AVGeoPoint location) {
90 | if (location == null) {
91 | throw new NullPointerException("location is null");
92 | }
93 | setLatitude(location.getLatitude() + "");
94 | setLongitude(location.getLongitude() + "");
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/util/ChatUtils.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.util;
2 |
3 | import android.util.Log;
4 | import android.view.View;
5 |
6 | import com.avos.avoscloud.AVException;
7 | import com.avos.avoscloud.AVGeoPoint;
8 | import com.avos.avoscloud.AVObject;
9 | import com.avos.avoscloud.AVUser;
10 | import com.avos.avoscloud.GetCallback;
11 | import com.avos.avoscloud.SaveCallback;
12 | import com.example.lovetalk.DemoApplication;
13 | import com.example.lovetalk.adapter.BaseListAdapter;
14 | import com.example.lovetalk.service.PreferenceMap;
15 | import com.example.lovetalk.view.xlist.XListView;
16 |
17 | import java.util.List;
18 |
19 | /**
20 | * Created by lzw on 14-9-30.
21 | */
22 |
23 | public class ChatUtils {
24 | public static void handleListResult(XListView listView, BaseListAdapter adapter, List datas) {
25 | if (Utils.isListNotEmpty(datas)) {
26 | adapter.addAll(datas);
27 | if (datas.size() == 10) {
28 | listView.setPullLoadEnable(true);
29 | } else {
30 | listView.setPullLoadEnable(false);
31 | }
32 | } else {
33 | listView.setPullLoadEnable(false);
34 | if (adapter.getCount() == 0) {
35 | Utils.toast("无结果");
36 | } else {
37 | Utils.toast("加载完毕");
38 | }
39 | }
40 | }
41 |
42 | public static void updateUserInfo() {
43 | AVUser user = AVUser.getCurrentUser();
44 | if (user != null) {
45 | user.fetchInBackground("friends", new GetCallback() {
46 | @Override
47 | public void done(AVObject avObject, AVException e) {
48 | if (e == null) {
49 | AVUser avUser = (AVUser) avObject;
50 | DemoApplication.registerUserCache(avUser);
51 | }
52 | }
53 | });
54 | }
55 | }
56 |
57 | public static void updateUserLocation() {
58 | PreferenceMap preferenceMap = PreferenceMap.getCurUserPrefDao(DemoApplication.context);
59 | AVGeoPoint lastLocation = preferenceMap.getLocation();
60 | if (lastLocation != null) {
61 | final AVUser user = AVUser.getCurrentUser();
62 | final AVGeoPoint location = user.getAVGeoPoint("location");
63 | if (location == null || !Utils.doubleEqual(location.getLatitude(), lastLocation.getLatitude())
64 | || !Utils.doubleEqual(location.getLongitude(), lastLocation.getLongitude())) {
65 | user.put("location", lastLocation);
66 | user.saveInBackground(new SaveCallback() {
67 | @Override
68 | public void done(AVException e) {
69 | if (e != null) {
70 | e.printStackTrace();
71 | } else {
72 | Log.v("lan", "lastLocation save " + user.getAVGeoPoint("location"));
73 | }
74 | }
75 | });
76 | }
77 | }
78 | }
79 |
80 | public static void stopRefresh(XListView xListView) {
81 | if (xListView.getPullRefreshing()) {
82 | xListView.stopRefresh();
83 | }
84 | }
85 |
86 | public static void setUserView(View conView, AVUser user) {
87 | // ImageView avatarView = ViewHolder.findViewById(conView, R.id.avatar);
88 | // TextView nameView = ViewHolder.findViewById(conView, R.id.username);
89 | //// UserService.displayAvatar(user.getAvatarUrl(), avatarView);
90 | // nameView.setText(user.getUsername());
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/activity/ForgetActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.activity;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.view.View;
6 | import android.view.View.OnClickListener;
7 | import android.view.View.OnFocusChangeListener;
8 | import android.view.Window;
9 | import android.widget.Button;
10 | import android.widget.EditText;
11 | import android.widget.ImageView;
12 |
13 | import com.avos.avoscloud.AVException;
14 | import com.avos.avoscloud.AVUser;
15 | import com.avos.avoscloud.LogUtil.log;
16 | import com.avos.avoscloud.RequestPasswordResetCallback;
17 | import com.example.lovetalk.R;
18 | import com.example.lovetalk.util.Utils;
19 |
20 | public class ForgetActivity extends Activity implements OnClickListener, OnFocusChangeListener {
21 | private EditText mMailText;
22 | private Button mSendButton;
23 | private ImageView mBackButton;
24 |
25 | @Override
26 | protected void onCreate(Bundle savedInstanceState) {
27 | super.onCreate(savedInstanceState);
28 | requestWindowFeature(Window.FEATURE_NO_TITLE);
29 | setContentView(R.layout.activity_forget);
30 |
31 |
32 | mMailText = (EditText) findViewById(R.id.email);
33 | mBackButton = (ImageView) findViewById(R.id.back);
34 | mSendButton = (Button) findViewById(R.id.send);
35 |
36 |
37 | mSendButton.setOnClickListener(this);
38 | mBackButton.setOnClickListener(this);
39 | mMailText.setOnFocusChangeListener(this);
40 |
41 | }
42 |
43 | private boolean Mailvalidate(EditText mail) {
44 | String email = mail.getText().toString();
45 | if ("".equals(email)) {
46 | mail.setError("邮箱不能为空");
47 | return false;
48 | } else {
49 | String check = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]"
50 | + "@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";
51 | if (!email.matches(check)) {
52 | mail.setError("邮箱格式不合法");
53 | return false;
54 | }
55 | }
56 |
57 | return true;
58 | }
59 |
60 | @Override
61 | public void onClick(View v) {
62 | // TODO Auto-generated method stub
63 | switch (v.getId()) {
64 | case R.id.send:
65 | if (Mailvalidate(mMailText)) {
66 | SendMail();
67 | }
68 | break;
69 | case R.id.back:
70 | finish();
71 | break;
72 | }
73 | }
74 |
75 | private void SendMail() {
76 | String email = mMailText.getText().toString();
77 |
78 | AVUser.requestPasswordResetInBackground(email, new RequestPasswordResetCallback() {
79 |
80 | @Override
81 | public void done(AVException arg0) {
82 | // TODO Auto-generated method stub
83 | if (arg0 == null) {
84 | Utils.toast("发送成功");
85 | finish();
86 | } else {
87 | Utils.toast("发送失败:" + arg0.getMessage());
88 | log.e("lan", arg0.getMessage());
89 | }
90 | }
91 | });
92 | }
93 |
94 | @Override
95 | public void onFocusChange(View v, boolean hasFocus) {
96 | // TODO Auto-generated method stub
97 | if (hasFocus == true) {
98 | v.setBackgroundResource(R.drawable.renotext);
99 | } else {
100 | switch (v.getId()) {
101 | case R.id.email:
102 | if (isEmpty(mMailText)) {
103 | mMailText.setBackgroundResource(R.drawable.emailtext);
104 | }
105 | break;
106 | }
107 | }
108 | }
109 |
110 | boolean isEmpty(EditText et) {
111 | return "".equals(et.getText().toString());
112 | }
113 |
114 | }
--------------------------------------------------------------------------------
/src/com/example/lovetalk/view/xlist/XListViewFooter.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.view.xlist;
2 |
3 | import com.example.lovetalk.R;
4 |
5 | import android.content.Context;
6 | import android.util.AttributeSet;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.widget.LinearLayout;
10 | import android.widget.TextView;
11 |
12 | public class XListViewFooter extends LinearLayout {
13 | public final static int STATE_NORMAL = 0;
14 | public final static int STATE_READY = 1;
15 | public final static int STATE_LOADING = 2;
16 |
17 | private Context mContext;
18 |
19 | private View mContentView;
20 | private View mProgressBar;
21 | private TextView mHintView;
22 |
23 | public XListViewFooter(Context context) {
24 | super(context);
25 | initView(context);
26 | }
27 |
28 | public XListViewFooter(Context context, AttributeSet attrs) {
29 | super(context, attrs);
30 | initView(context);
31 | }
32 |
33 |
34 | public void setState(int state) {
35 | mHintView.setVisibility(View.INVISIBLE);
36 | mProgressBar.setVisibility(View.INVISIBLE);
37 | mHintView.setVisibility(View.INVISIBLE);
38 | if (state == STATE_READY) {
39 | mHintView.setVisibility(View.VISIBLE);
40 | mHintView.setText(R.string.xlistview_footer_hint_ready);
41 | } else if (state == STATE_LOADING) {
42 | mProgressBar.setVisibility(View.VISIBLE);
43 | } else {
44 | mHintView.setVisibility(View.VISIBLE);
45 | mHintView.setText(R.string.xlistview_footer_hint_normal);
46 | }
47 | }
48 |
49 | public void setBottomMargin(int height) {
50 | if (height < 0) return;
51 | LayoutParams lp = (LayoutParams) mContentView.getLayoutParams();
52 | lp.bottomMargin = height;
53 | mContentView.setLayoutParams(lp);
54 | }
55 |
56 | public int getBottomMargin() {
57 | LayoutParams lp = (LayoutParams) mContentView.getLayoutParams();
58 | return lp.bottomMargin;
59 | }
60 |
61 |
62 | /**
63 | * normal status
64 | */
65 | public void normal() {
66 | mHintView.setVisibility(View.VISIBLE);
67 | mProgressBar.setVisibility(View.GONE);
68 | }
69 |
70 |
71 | /**
72 | * loading status
73 | */
74 | public void loading() {
75 | mHintView.setVisibility(View.GONE);
76 | mProgressBar.setVisibility(View.VISIBLE);
77 | }
78 |
79 | /**
80 | * hide footer when disable pull load more
81 | */
82 | public void hide() {
83 | LayoutParams lp = (LayoutParams) mContentView.getLayoutParams();
84 | lp.height = 0;
85 | mContentView.setLayoutParams(lp);
86 | }
87 |
88 | /**
89 | * show footer
90 | */
91 | public void show() {
92 | LayoutParams lp = (LayoutParams) mContentView.getLayoutParams();
93 | lp.height = android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
94 | mContentView.setLayoutParams(lp);
95 | }
96 |
97 | private void initView(Context context) {
98 | mContext = context;
99 | LinearLayout moreView = (LinearLayout) LayoutInflater.from(mContext).inflate(R.layout.xlistview_footer, null);
100 | addView(moreView);
101 | moreView.setLayoutParams(new LayoutParams(android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT));
102 |
103 | mContentView = moreView.findViewById(R.id.xlistview_footer_content);
104 | mProgressBar = moreView.findViewById(R.id.xlistview_footer_progressbar);
105 | mHintView = (TextView) moreView.findViewById(R.id.xlistview_footer_hint_textview);
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/activity/NewFriendActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.activity;
2 |
3 | import android.app.AlertDialog;
4 | import android.content.DialogInterface;
5 | import android.os.Bundle;
6 | import android.view.View;
7 | import android.widget.AdapterView;
8 | import android.widget.AdapterView.OnItemLongClickListener;
9 | import android.widget.ListView;
10 |
11 | import com.avos.avoscloud.AVUser;
12 | import com.example.lovetalk.R;
13 | import com.example.lovetalk.adapter.NewFriendAdapter;
14 | import com.example.lovetalk.service.AddRequest;
15 | import com.example.lovetalk.service.AddRequestService;
16 | import com.example.lovetalk.service.PreferenceMap;
17 | import com.example.lovetalk.util.MyAsyncTask;
18 |
19 | import java.util.ArrayList;
20 | import java.util.List;
21 |
22 | public class NewFriendActivity extends BaseActivity implements OnItemLongClickListener {
23 | ListView listview;
24 | NewFriendAdapter adapter;
25 | List addRequests = new ArrayList();
26 |
27 | @Override
28 | protected void onCreate(Bundle savedInstanceState) {
29 | // TODO Auto-generated method stub
30 | super.onCreate(savedInstanceState);
31 | setContentView(R.layout.contact_new_friend_activity);
32 | initView();
33 | refresh();
34 | }
35 |
36 | private void refresh() {
37 | new MyAsyncTask(mContext) {
38 | List subAddRequests;
39 |
40 | @Override
41 | protected void doInBack() throws Exception {
42 | subAddRequests = AddRequestService.findAddRequests();
43 | }
44 |
45 | @Override
46 | protected void onSucceed() {
47 | AVUser user = AVUser.getCurrentUser();
48 | String id = user.getObjectId();
49 | PreferenceMap preferenceMap = new PreferenceMap(context, id);
50 | preferenceMap.setAddRequestN(subAddRequests.size());
51 | adapter.addAll(subAddRequests);
52 | }
53 |
54 | }.execute();
55 | }
56 |
57 | private void initView() {
58 | initActionBar(R.string.new_friends);
59 | listview = (ListView) findViewById(R.id.newfriendList);
60 | listview.setOnItemLongClickListener(this);
61 | adapter = new NewFriendAdapter(this, addRequests);
62 | listview.setAdapter(adapter);
63 | }
64 |
65 | @Override
66 | public boolean onItemLongClick(AdapterView> arg0, View arg1, int position,
67 | long arg3) {
68 | // TODO Auto-generated method stub
69 | AddRequest invite = (AddRequest) adapter.getItem(position);
70 | showDeleteDialog(position, invite);
71 | return true;
72 | }
73 |
74 | public void showDeleteDialog(final int position, final AddRequest addRequest) {
75 | new AlertDialog.Builder(mContext).setMessage(R.string.deleteFriendRequest)
76 | .setPositiveButton(R.string.sure, new DialogInterface.OnClickListener() {
77 | @Override
78 | public void onClick(DialogInterface dialog, int which) {
79 | deleteAddRequest(position, addRequest);
80 | }
81 | }).setNegativeButton(R.string.cancel, null).show();
82 | }
83 |
84 | private void deleteAddRequest(final int position, final AddRequest addRequest) {
85 | new MyAsyncTask(mContext) {
86 |
87 | @Override
88 | protected void doInBack() throws Exception {
89 | // TODO Auto-generated method stub
90 | addRequest.delete();
91 | }
92 |
93 | @Override
94 | protected void onSucceed() {
95 | adapter.remove(position);
96 | }
97 | }.execute();
98 |
99 | }
100 |
101 | @Override
102 | protected void onDestroy() {
103 | // TODO Auto-generated method stub
104 | super.onDestroy();
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/view/xlist/XListViewHeader.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.view.xlist;
2 |
3 | import com.example.lovetalk.R;
4 |
5 | import android.content.Context;
6 | import android.util.AttributeSet;
7 | import android.view.Gravity;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.view.animation.Animation;
11 | import android.view.animation.RotateAnimation;
12 | import android.widget.ImageView;
13 | import android.widget.LinearLayout;
14 | import android.widget.ProgressBar;
15 |
16 | public class XListViewHeader extends LinearLayout {
17 | private LinearLayout mContainer;
18 | private ImageView mArrowImageView;
19 | private ProgressBar mProgressBar;
20 | private int mState = STATE_NORMAL;
21 |
22 | private Animation mRotateUpAnim;
23 | private Animation mRotateDownAnim;
24 |
25 | private final int ROTATE_ANIM_DURATION = 180;
26 |
27 | public final static int STATE_NORMAL = 0;
28 | public final static int STATE_READY = 1;
29 | public final static int STATE_REFRESHING = 2;
30 |
31 | public XListViewHeader(Context context) {
32 | super(context);
33 | initView(context);
34 | }
35 |
36 | public XListViewHeader(Context context, AttributeSet attrs) {
37 | super(context, attrs);
38 | initView(context);
39 | }
40 |
41 | private void initView(Context context) {
42 | // 初始情况,设置下拉刷新view高度为0
43 | LayoutParams lp = new LayoutParams(
44 | android.view.ViewGroup.LayoutParams.MATCH_PARENT, 0);
45 | mContainer = (LinearLayout) LayoutInflater.from(context).inflate(
46 | R.layout.xlistview_header, null);
47 | addView(mContainer, lp);
48 | setGravity(Gravity.BOTTOM);
49 |
50 | mArrowImageView = (ImageView) findViewById(R.id.xlistview_header_arrow);
51 | mProgressBar = (ProgressBar) findViewById(R.id.xlistview_header_progressbar);
52 |
53 | mRotateUpAnim = new RotateAnimation(0.0f, -180.0f,
54 | Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
55 | 0.5f);
56 | mRotateUpAnim.setDuration(ROTATE_ANIM_DURATION);
57 | mRotateUpAnim.setFillAfter(true);
58 | mRotateDownAnim = new RotateAnimation(-180.0f, 0.0f,
59 | Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
60 | 0.5f);
61 | mRotateDownAnim.setDuration(ROTATE_ANIM_DURATION);
62 | mRotateDownAnim.setFillAfter(true);
63 | }
64 |
65 | public void setState(int state) {
66 | if (state == mState) return;
67 |
68 | if (state == STATE_REFRESHING) { // 显示进度
69 | mArrowImageView.clearAnimation();
70 | mArrowImageView.setVisibility(View.INVISIBLE);
71 | mProgressBar.setVisibility(View.VISIBLE);
72 | } else { // 显示箭头图片
73 | mArrowImageView.setVisibility(View.VISIBLE);
74 | mProgressBar.setVisibility(View.INVISIBLE);
75 | }
76 |
77 | switch (state) {
78 | case STATE_NORMAL:
79 | if (mState == STATE_READY) {
80 | mArrowImageView.startAnimation(mRotateDownAnim);
81 | }
82 | if (mState == STATE_REFRESHING) {
83 | mArrowImageView.clearAnimation();
84 | }
85 | break;
86 | case STATE_READY:
87 | if (mState != STATE_READY) {
88 | mArrowImageView.clearAnimation();
89 | mArrowImageView.startAnimation(mRotateUpAnim);
90 | }
91 | break;
92 | case STATE_REFRESHING:
93 | break;
94 | default:
95 | }
96 |
97 | mState = state;
98 | }
99 |
100 | public void setVisiableHeight(int height) {
101 | if (height < 0)
102 | height = 0;
103 | LayoutParams lp = (LayoutParams) mContainer
104 | .getLayoutParams();
105 | lp.height = height;
106 | mContainer.setLayoutParams(lp);
107 | }
108 |
109 | public int getVisiableHeight() {
110 | return mContainer.getHeight();
111 | }
112 |
113 | }
114 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/view/EnLetterView.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.view;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.graphics.Color;
6 | import android.graphics.Paint;
7 | import android.graphics.Typeface;
8 | import android.graphics.drawable.ColorDrawable;
9 | import android.util.AttributeSet;
10 | import android.view.MotionEvent;
11 | import android.view.View;
12 | import android.widget.TextView;
13 |
14 | import com.example.lovetalk.R;
15 | import com.example.lovetalk.util.PixelUtil;
16 |
17 | public class EnLetterView extends View {
18 | private OnTouchingLetterChangedListener onTouchingLetterChangedListener;
19 | public static String[] letters = {"A", "B", "C", "D", "E", "F", "G", "H",
20 | "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U",
21 | "V", "W", "X", "Y", "Z", "#"};
22 | private int choose = -1;
23 | private Paint paint = new Paint();
24 |
25 | private TextView textDialog;
26 |
27 | public void setTextView(TextView mTextDialog) {
28 | this.textDialog = mTextDialog;
29 | }
30 |
31 | public EnLetterView(Context context, AttributeSet attrs, int defStyle) {
32 | super(context, attrs, defStyle);
33 | }
34 |
35 | public EnLetterView(Context context, AttributeSet attrs) {
36 | super(context, attrs);
37 | }
38 |
39 | public EnLetterView(Context context) {
40 | super(context);
41 | }
42 |
43 | protected void onDraw(Canvas canvas) {
44 | super.onDraw(canvas);
45 | int height = getHeight();
46 | int width = getWidth();
47 | int singleHeight = height / letters.length;
48 |
49 | for (int i = 0; i < letters.length; i++) {
50 | paint.setColor(getResources().getColor(
51 | R.color.color_bottom_text_normal));
52 | paint.setTypeface(Typeface.DEFAULT_BOLD);
53 | paint.setAntiAlias(true);
54 | paint.setTextSize(PixelUtil.sp2px(12));
55 | if (i == choose) {
56 | paint.setColor(Color.parseColor("#3399ff"));
57 | paint.setFakeBoldText(true);
58 | }
59 | float xPos = width / 2 - paint.measureText(letters[i]) / 2;
60 | float yPos = singleHeight * i + singleHeight;
61 | canvas.drawText(letters[i], xPos, yPos, paint);
62 | paint.reset();
63 | }
64 |
65 | }
66 |
67 | @Override
68 | public boolean dispatchTouchEvent(MotionEvent event) {
69 | final int action = event.getAction();
70 | final float y = event.getY();
71 | final int oldChoose = choose;
72 | final OnTouchingLetterChangedListener listener = onTouchingLetterChangedListener;
73 | final int c = (int) (y / getHeight() * letters.length);
74 |
75 | switch (action) {
76 | case MotionEvent.ACTION_UP:
77 | setBackgroundDrawable(new ColorDrawable(0x00000000));
78 | choose = -1;
79 | invalidate();
80 | if (textDialog != null) {
81 | textDialog.setVisibility(View.INVISIBLE);
82 | }
83 | break;
84 |
85 | default:
86 | setBackgroundResource(R.drawable.v2_sortlistview_sidebar_background);
87 | if (oldChoose != c) {
88 | if (c >= 0 && c < letters.length) {
89 | if (listener != null) {
90 | listener.onTouchingLetterChanged(letters[c]);
91 | }
92 | if (textDialog != null) {
93 | textDialog.setText(letters[c]);
94 | textDialog.setVisibility(View.VISIBLE);
95 | }
96 |
97 | choose = c;
98 | invalidate();
99 | }
100 | }
101 |
102 | break;
103 | }
104 | return true;
105 | }
106 |
107 | public void setOnTouchingLetterChangedListener(
108 | OnTouchingLetterChangedListener onTouchingLetterChangedListener) {
109 | this.onTouchingLetterChangedListener = onTouchingLetterChangedListener;
110 | }
111 |
112 | public interface OnTouchingLetterChangedListener {
113 | public void onTouchingLetterChanged(String s);
114 | }
115 |
116 | }
117 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/service/CacheService.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.service;
2 |
3 |
4 | import com.avos.avoscloud.AVException;
5 | import com.avos.avoscloud.AVQuery;
6 | import com.avos.avoscloud.AVUser;
7 | import com.avos.avoscloud.im.v2.AVIMConversation;
8 | import com.avos.avoscloud.im.v2.callback.AVIMConversationCallback;
9 | import com.avos.avoscloud.im.v2.callback.AVIMConversationQueryCallback;
10 |
11 | import java.util.ArrayList;
12 | import java.util.Collections;
13 | import java.util.HashSet;
14 | import java.util.List;
15 | import java.util.Map;
16 | import java.util.Set;
17 | import java.util.concurrent.ConcurrentHashMap;
18 |
19 | /**
20 | * Created by lzw on 14/12/19.
21 | */
22 | public class CacheService {
23 | private static Map cachedConvs = new ConcurrentHashMap<>();
24 | private static Map cachedUsers = new ConcurrentHashMap<>();
25 | private static volatile List friendIds = new ArrayList();
26 | private static volatile String currentConversationId;
27 |
28 | public static AVUser lookupUser(String userId) {
29 | return cachedUsers.get(userId);
30 | }
31 |
32 | public static void registerUser(AVUser user) {
33 | cachedUsers.put(user.getObjectId(), user);
34 | }
35 |
36 | public static void registerUsers(List users) {
37 | for (AVUser user : users) {
38 | registerUser(user);
39 | }
40 | }
41 |
42 | public static AVIMConversation lookupConv(String convid) {
43 | return cachedConvs.get(convid);
44 | }
45 |
46 | public static void registerConvs(List convs) {
47 | for (AVIMConversation conv : convs) {
48 | registerConv(conv);
49 | }
50 | }
51 |
52 | public static void registerConv(AVIMConversation conv) {
53 | cachedConvs.put(conv.getConversationId(), conv);
54 | }
55 |
56 |
57 | public static List getFriendIds() {
58 | return friendIds;
59 | }
60 |
61 | public static AVIMConversation getCurrentConversation() {
62 | if (currentConversationId == null) {
63 | return null;
64 | } else {
65 | return lookupConv(currentConversationId);
66 | }
67 | }
68 |
69 | public static void setCurrentConversation(AVIMConversation currentConversation) {
70 | if (currentConversation != null) {
71 | registerConv(currentConversation);
72 | CacheService.currentConversationId = currentConversation.getConversationId();
73 | } else {
74 | CacheService.currentConversationId = null;
75 | }
76 | }
77 |
78 | public static void cacheUsers(List ids) throws AVException {
79 | Set uncachedIds = new HashSet();
80 | for (String id : ids) {
81 | if (lookupUser(id) == null) {
82 | uncachedIds.add(id);
83 | }
84 | }
85 | List foundUsers = findUsers(new ArrayList(uncachedIds));
86 | registerUsers(foundUsers);
87 | }
88 |
89 | public static List findUsers(List userIds) throws AVException {
90 | if (userIds.size() <= 0) {
91 | return Collections.EMPTY_LIST;
92 | }
93 | AVQuery q = AVUser.getQuery();
94 | q.whereContainedIn("objectId", userIds);
95 | q.setLimit(1000);
96 | q.setCachePolicy(AVQuery.CachePolicy.NETWORK_ELSE_CACHE);
97 | return q.find();
98 | }
99 |
100 | public static void cacheUserIfNone(String userId) throws AVException {
101 | if (lookupUser(userId) == null) {
102 | registerUser(UserService.findUser(userId));
103 | }
104 | }
105 | }
--------------------------------------------------------------------------------
/src/com/example/lovetalk/activity/LoginActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.activity;
2 |
3 | import android.os.Bundle;
4 | import android.view.View;
5 | import android.view.View.OnClickListener;
6 | import android.view.View.OnFocusChangeListener;
7 | import android.view.Window;
8 | import android.widget.EditText;
9 | import android.widget.ImageView;
10 | import android.widget.Toast;
11 |
12 | import com.avos.avoscloud.AVUser;
13 | import com.example.lovetalk.R;
14 | import com.example.lovetalk.util.MyAsyncTask;
15 | import com.example.lovetalk.util.Utils;
16 |
17 | public class LoginActivity extends BaseEntryActivity implements OnClickListener,
18 | OnFocusChangeListener {
19 | private EditText enterLogin;
20 | private EditText enterPassword;
21 | private ImageView registebtn, loginbtn, forgetbtn;
22 |
23 | @Override
24 | protected void onCreate(Bundle savedInstanceState) {
25 | super.onCreate(savedInstanceState);
26 | requestWindowFeature(Window.FEATURE_NO_TITLE);
27 | setContentView(R.layout.activity_login);
28 |
29 | enterLogin = (EditText) findViewById(R.id.enterlogin);
30 | enterPassword = (EditText) findViewById(R.id.enterpassword);
31 | registebtn = (ImageView) findViewById(R.id.registebtn);
32 | loginbtn = (ImageView) findViewById(R.id.loginbtn);
33 | forgetbtn = (ImageView) findViewById(R.id.forget);
34 |
35 | enterLogin.setOnFocusChangeListener(this);
36 | enterPassword.setOnFocusChangeListener(this);
37 | registebtn.setOnClickListener(this);
38 | loginbtn.setOnClickListener(this);
39 | forgetbtn.setOnClickListener(this);
40 | }
41 |
42 | @Override
43 | public void onClick(View v) {
44 | // TODO Auto-generated method stub
45 | switch (v.getId()) {
46 | case R.id.registebtn:
47 | Utils.goActivity(this, RegisteActivity.class);
48 | break;
49 | case R.id.loginbtn:
50 | // if (validate()) {
51 | login();
52 | // }
53 | break;
54 | case R.id.forget:
55 | Utils.goActivity(this, ForgetActivity.class);
56 | break;
57 | }
58 | }
59 |
60 | @Override
61 | public void onFocusChange(View v, boolean hasFocus) {
62 | // TODO Auto-generated method stub
63 | if (hasFocus == true) {
64 | v.setBackgroundResource(R.drawable.notext);
65 | } else {
66 | switch (v.getId()) {
67 | case R.id.enterlogin:
68 | if (isEmpty(enterLogin)) {
69 | enterLogin.setBackgroundResource(R.drawable.logintext);
70 | }
71 | break;
72 | case R.id.enterpassword:
73 | if (isEmpty(enterPassword)) {
74 | enterPassword
75 | .setBackgroundResource(R.drawable.passwordtext);
76 | }
77 | break;
78 | }
79 | }
80 | }
81 |
82 | boolean isEmpty(EditText et) {
83 | return "".equals(et.getText().toString());
84 | }
85 |
86 | // 登录方法
87 | private void login() {
88 | final String email = enterLogin.getText().toString();
89 | final String pwd = enterPassword.getText().toString();
90 |
91 | new MyAsyncTask(this) {
92 |
93 |
94 | @Override
95 | protected void doInBack() throws Exception {
96 | // TODO Auto-generated method stub
97 | AVUser.logIn(email, pwd);
98 | }
99 |
100 | @Override
101 | protected void onSucceed() {
102 | Utils.toast("登录成功");
103 | Utils.goActivity(context, HomeActivity.class);
104 | }
105 | }.execute();
106 | }
107 |
108 | // 验证方法
109 | private boolean validate() {
110 | String email = enterLogin.getText().toString();
111 | String pwd = enterPassword.getText().toString();
112 | if (email.equals("")) {
113 | Toast.makeText(getApplicationContext(), "用户名称是必填项!",
114 | Toast.LENGTH_LONG).show();
115 | return false;
116 | }
117 |
118 | if (pwd.equals("")) {
119 | Toast.makeText(getApplicationContext(), "用户密码是必填项!",
120 | Toast.LENGTH_LONG).show();
121 | return false;
122 | }
123 | return true;
124 | }
125 |
126 | }
127 |
--------------------------------------------------------------------------------
/src/com/example/lovetalk/adapter/UserFriendAdapter.java:
--------------------------------------------------------------------------------
1 | package com.example.lovetalk.adapter;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.content.Context;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.BaseAdapter;
9 | import android.widget.ImageView;
10 | import android.widget.SectionIndexer;
11 | import android.widget.TextView;
12 |
13 | import java.util.List;
14 |
15 | import com.avos.avoscloud.AVFile;
16 | import com.avos.avoscloud.AVUser;
17 | import com.example.lovetalk.R;
18 | import com.example.lovetalk.service.UserService;
19 | import com.example.lovetalk.util.CharacterParser;
20 | import com.example.lovetalk.view.ViewHolder;
21 |
22 | @SuppressLint("DefaultLocale")
23 | public class UserFriendAdapter extends BaseAdapter implements SectionIndexer {
24 | private Context context;
25 | private List data;
26 |
27 | public UserFriendAdapter(Context context, List datas) {
28 | this.context = context;
29 | this.data = datas;
30 | }
31 |
32 | public void updateListView(List list) {
33 | this.data = list;
34 | notifyDataSetChanged();
35 | }
36 |
37 | public void remove(AVUser user) {
38 | this.data.remove(user);
39 | notifyDataSetChanged();
40 | }
41 |
42 | @Override
43 | public int getCount() {
44 | return data.size();
45 | }
46 |
47 | @Override
48 | public Object getItem(int position) {
49 | return data.get(position);
50 | }
51 |
52 | @Override
53 | public long getItemId(int position) {
54 | return 0;
55 | }
56 |
57 | @Override
58 | public View getView(int position, View convertView, ViewGroup parent) {
59 | if (convertView == null) {
60 | convertView = LayoutInflater.from(context).inflate(
61 | R.layout.item_user_friend, null);
62 | }
63 | TextView alpha = ViewHolder.findViewById(convertView, R.id.alpha);
64 | TextView nameView = ViewHolder.findViewById(convertView,
65 | R.id.tv_friend_name);
66 | ImageView avatarView = ViewHolder.findViewById(convertView,
67 | R.id.img_friend_avatar);
68 |
69 | AVUser friend = data.get(position);
70 | final String name = friend.getUsername();
71 |
72 | final String avatarUrl = getAvatarUrl(friend);
73 |
74 | UserService.displayAvatar(avatarUrl, avatarView);
75 | nameView.setText(name);
76 |
77 | int section = getSectionForPosition(position);
78 | if (position == getPositionForSection(section)) {
79 | alpha.setVisibility(View.VISIBLE);
80 | alpha.setText(getSortLetters(friend));
81 | } else {
82 | alpha.setVisibility(View.GONE);
83 | }
84 |
85 | return convertView;
86 | }
87 |
88 | public int getSectionForPosition(int position) {
89 | return getSortLetters(data.get(position)).charAt(0);
90 | }
91 |
92 | public String getAvatarUrl(AVUser user) {
93 | AVFile avatar = user.getAVFile("avatar");
94 | if (avatar != null) {
95 | return avatar.getUrl();
96 | } else {
97 | return null;
98 | }
99 | }
100 |
101 | @SuppressLint("DefaultLocale")
102 | public int getPositionForSection(int section) {
103 | for (int i = 0; i < getCount(); i++) {
104 | String sortStr = getSortLetters(data.get(i));
105 | char firstChar = sortStr.toUpperCase().charAt(0);
106 | if (firstChar == section) {
107 | return i;
108 | }
109 | }
110 |
111 | return -1;
112 | }
113 |
114 | @Override
115 | public Object[] getSections() {
116 | return null;
117 | }
118 |
119 | private String getSortLetters(AVUser user) {
120 | String username = user.getUsername();
121 | if (username != null) {
122 | String pinyin = CharacterParser.getPingYin(user.getUsername());
123 | String sortString = pinyin.substring(0, 1).toUpperCase();
124 | if (sortString.matches("[A-Z]")) {
125 | return sortString.toUpperCase();
126 | } else {
127 | return "#";
128 | }
129 | } else {
130 | return "#";
131 | }
132 | }
133 | }
134 |
--------------------------------------------------------------------------------