• Stars
    star
    278
  • Rank 148,454 (Top 3 %)
  • Language
    Java
  • Created almost 8 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

WavaSideBar+仿通讯录+字母导航栏+中英文搜索+拼音转换

WaveSideBar

WavaSideBar——一个自带中英文对应排序和检索功能的字母导航栏 ##效果图

⊙开源不易,希望给个star或者fork奖励

⊙拥抱开源:https://github.com/nanchen2251/

特点

1、支持手势滑动导航栏
2、支持自定义设置偏移量和颜色
3、支持设置字母导航栏设置位置
4、支持自动匹配中英文
5、支持拼音和中文搜索

使用方法

1、添加依赖

2017年1月5日后仓库转移到jitpack,添加依赖方式为:

Step 1. Add it in your root build.gradle at the end of repositories:
allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}
Step 2. Add the dependency
dependencies {
	        compile 'com.github.nanchen2251:WaveSideBar:1.0.6'
	}

2、在xml文件里面使用

  <!--搜索框-->
  <com.nanchen.wavesidebar.SearchEditText
        android:id="@+id/main_search"
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:layout_marginLeft="15dp"
        android:layout_marginRight="15dp"
        android:layout_marginTop="5dp"
        android:background="@drawable/search_edit_bg"
        android:drawableLeft="@mipmap/icon_search"
        android:drawablePadding="5dp"
        android:drawableStart="@mipmap/icon_search"
        android:gravity="center_vertical"
        android:hint="@string/search"
        android:imeOptions="actionSearch"
        android:maxLines="1"
        android:padding="5dp"
        android:textSize="16sp"
        app:drawableDel="@mipmap/edit_delete"/>
	
	
  <!--字母导航栏-->
  <com.nanchen.wavesidebar.WaveSideBarView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:padding="8dp"
        android:id="@+id/main_side_bar"
        app:sidebar_text_color="@color/colorAccent"
        app:sidebar_lazy_respond="false"/>

3、在Activity里面使用

    mWaveSideBarView = (WaveSideBarView) findViewById(R.id.main_side_bar);
    mWaveSideBarView.setOnSelectIndexItemListener(new OnSelectIndexItemListener() {
        @Override
        public void onSelectIndexItem(String letter) {
            for (int i=0; i<mContactModels.size(); i++) {
                if (mContactModels.get(i).getIndex().equals(letter)) {
                    ((LinearLayoutManager) mRecyclerView.getLayoutManager()).scrollToPositionWithOffset(i, 0);
                    return;
                }
            }
        }
    });
    
    // 搜索按钮相关
        mSearchEditText = (SearchEditText) findViewById(R.id.main_search);
        mSearchEditText.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {

            }

            @Override
            public void afterTextChanged(Editable s) {
	        //You can do something in there
                mShowModels.clear();
                for (ContactModel model : mContactModels) {
                    String str = Trans2PinYinUtil.trans2PinYin(model.getName());
                    if (str.contains(s.toString())|| model.getName().contains(s.toString())) {
                        mShowModels.add(model);
                    }
                }
                mAdapter.notifyDataSetChanged();
            }
        });

4、自动匹配中英文

FirstLetterUtil.getFirstLetter(name);

5、中文转换成拼音

Trans2PinYinUtil.trans2PinYin(String name);

具体请下载查看示例代码

属性一览

Attributes Format Default Description
sidebar_text_color color Color.GRAY Text color.
sidebar_max_offset dimension 80dp Offset of the selected item.
sidebar_position enum {right, left} right Be placed on left or right in the view.
sidebar_text_alignment enum {center, left, right} center Alignment of items.
sidebar_lazy_respond boolean false If true, the listener will not be called until the finger up. If false, the listener will be called when the finger down, move and up.

该项目参考了:

关于作者

   南尘
   四川成都
   其它开源
   博客园

Licenses

 Copyright 2019 nanchen(刘世麟)

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.

More Repositories

1

RxJava2Examples

🔥RxJava2 Examples —— 这可能是从 RxJava1 跳到 RxJava2(学习 RxJava2 )最好的例子 Demo:https://github.com/nanchen2251/RxJava2Examples
Java
2,847
star
2

CompressHelper

🔥 压缩文件,压缩图片,压缩Bitmap,Compress, CompressImage, CompressFile, CompressBitmap:https://github.com/nanchen2251/AiYaCompressHelper
Java
2,490
star
3

AiYaGirl

🔥 爱吖妹纸(含 Kotlin 分支版本)——Retrofit + RxJava + MVP 架构 APP 体验代码家的干货集中营 Gank.io,福利多多,不容错过
Kotlin
1,103
star
4

BankCardUtils

根据银行卡号 获取 银行卡类型、银行名称和银行编码 自动格式化银行卡号、手机号、身份证号输入的工具类
Java
887
star
5

StudyForAndroid

🔥 Study + Android + 学习资源 + 百科全书 + 持续更新干货
Java
662
star
6

AiYaSchoolPush

『停止维护』Android 毕业设计 —— OkHttp封装 + PHP + XAMPP + Retrofit 封装 + RxJava + MVC + 文档的成品 APP:https://github.com/nanchen2251/AiYaSchoolPush
Java
584
star
7

ScreenRecordHelper

🔥Android screen record helper, Android 屏幕录制 https://github.com/nanchen2251/ScreenRecordHelper
Kotlin
515
star
8

PinView

PIN 码专用输入控件,https://github.com/nanchen2251/PinView
Java
274
star
9

AppManager

🔥 An elegant exit application and restart mechanism management.
Java
272
star
10

AiYaScanner

🔥 zxing and zbar combined with scan code. 只为真正的 zxing zbar 结合二维码扫描:https://github.com/nanchen2251/AiYaScanner
Java
216
star
11

CoordinatorAppBarDemo

Coordinator+AppBarLayout+design设计的demo
Java
164
star
12

CheerBanner

CheerBanner:不止是图片,这是一款支持任意控件轮播的Banner控件,支持触摸暂停,任意定义高度。
Java
157
star
13

RetrofitRxUtil

🔥 Retrofit + RxJava + 封装
Java
155
star
14

Blogs

nanchen 的技术博客集锦:https://github.com/nanchen2251/Blogs
49
star
15

StepBarView

一款流程步骤进度条
Java
44
star
16

CalendarView

CalendarView,自带农历的日历控件
Java
25
star
17

CameraView

CameraView,自定义相机View,自动聚焦,支持自定义UI
Java
23
star
18

TitleBar

一个可随意设置的标题栏view
Java
12
star
19

MyCalendarViewDemo

自定义日历控件,包含左右滑动,农历和公历双显示等。
Java
11
star
20

NCSwitchMultiButton-Android

A SwitchButton support Multiple,https://github.com/nanchen2251/NCSwitchMultiButton-Android
Kotlin
10
star
21

pullToRefreshDemo

第三方控件实现上拉加载和下拉刷新效果
Java
8
star
22

DateTestDemo

一个自定义时间picker,一个仿QQ发送消息~
Java
8
star
23

RealmDemo

一个可以替代sqlite的数据库
Java
7
star
24

CropImageDemo

圆形图片裁剪
Java
6
star
25

CommonAdapterRecyclerDemo

一个万能的RecyclerView的适配器
Java
6
star
26

MyCalendarViewNewDemo

一个支持公历和农历双显示,支持左右滑动和点击事件的自定义日历控件。
Java
6
star
27

CroutonDemo

一个随意定位的Toast开源库
Java
6
star
28

retrofitDemo

retrofit网络加载框架
Java
6
star
29

databinding

databinding
Java
4
star
30

CommonAdapterListViewDemo

一个万能的CommonAdaper适配器
Java
4
star
31

ReceiverDemo

接听系统广播,实时刷新UI状态
Java
3
star
32

NCProcessView-Android

A ProcessView for Android https://github.com/nanchen2251/NCProcessView-Android
Kotlin
3
star
33

nanchen2251

2
star
34

GarbageSort

垃圾分类
Kotlin
2
star
35

designNavigation-and-tabLayout

navigation 和 tablayout 联合实现的仿qq效果
Java
2
star
36

EventbusDemo

EventBus
Java
2
star
37

CustomViewDemo

自定义View从入门到精通
Java
1
star
38

VolleyTestDemo

用Velloy打造二次开发框架
Java
1
star
39

ImageLoaderDemo

使用ImageLoader进行简单的图片缓存和网络加载
Java
1
star
40

flutter_study

1
star
41

nanchen2251.github.io

HTML
1
star
42

CoordinatorLayout

CoordinatorLayout赋予子控件的魔力
Java
1
star
43

phpAndroidDemo

用php生成API接口给android端访问,附android和php源码
Java
1
star