Coder Social home page Coder Social logo

mnzxingcode's Introduction

ZXingCodeDemo

功能:

1:生成二维码(带Logo)
2:二维码扫描
3:相册中选取图片
4:开启闪光灯
5:历史记录(需要自己实现:ActivityForResult)

截图:

image image

如何添加

Gradle添加:

1.在Project的build.gradle中添加仓库地址

	allprojects {
		repositories {
			...
			maven { url "https://jitpack.io" }
		}
	}

2.在Module目录下的build.gradle中添加依赖

	dependencies {
	     compile 'com.github.maning0303:MNZXingCode:V1.0.5'
	}

源码添加:

直接拷贝整个module:libraryzxing,然后关联到你的项目就可以使用

使用方法:

        1.跳转:
            Intent intent = new Intent(MainActivity.this, CaptureActivity.class);
            //是不是显示历史记录按钮
            intent.putExtra(ZXingConstants.ScanIsShowHistory,true);
            startActivityForResult(intent, ZXingConstants.ScanRequestCode);
        
        2.获取结果:
           @Override
           protected void onActivityResult(int requestCode, int resultCode, Intent data) {
               super.onActivityResult(requestCode, resultCode, data);
               if (data == null) {
                   return;
               }
               if (resultCode == ZXingConstants.ScanRequltCode) {
                   /**
                    * 拿到解析完成的字符串
                    */
                   String result = data.getStringExtra(ZXingConstants.ScanResult);
                   textView.setText(result);
               } else if (resultCode == ZXingConstants.ScanHistoryResultCode) {
                   /**
                    * 历史记录
                    */
                   //自己实现历史页面
                   startActivity(new Intent(MainActivity.this, HistoryActivity.class));
               }
           }
            
        3:生成二维码:
        	Bitmap qrImage = ZXingUtils.createQRImage("xxxxxx");
        	Bitmap qrImage = ZXingUtils.createQRCodeWithLogo("xxxxxx", logoBitmap);

关于代码:

部分代码采用:  [BGAQRCode-Android](https://github.com/bingoogolapple/BGAQRCode-Android)
感谢所有开源的人;

推荐:

Name Describe
GankMM (Material Design & MVP & Retrofit + OKHttp & RecyclerView ...)Gank.io Android客户端:每天一张美女图片,一个视频短片,若干Android,iOS等程序干货,周一到周五每天更新,数据全部由 干货集中营 提供,持续更新。
MNUpdateAPK Android APK 版本更新的下载和安装,适配7.0,简单方便。
MNImageBrowser 交互特效的图片浏览框架,微信向下滑动动态关闭
MNCalendar 简单的日历控件练习,水平方向日历支持手势滑动切换,跳转月份;垂直方向日历选取区间范围。
MClearEditText 带有删除功能的EditText
MNCrashMonitor Debug监听程序崩溃日志,展示崩溃日志列表,方便自己平时调试。
MNProgressHUD MNProgressHUD是对常用的自定义弹框封装,加载ProgressDialog,状态显示的StatusDialog和自定义Toast,支持背景颜色,圆角,边框和文字的自定义。
MNXUtilsDB xUtils3 数据库模块单独抽取出来,方便使用。
MNVideoPlayer SurfaceView + MediaPlayer 实现的视频播放器,支持横竖屏切换,手势快进快退、调节音量,亮度等。------代码简单,新手可以看一看。
MNZXingCode 快速集成二维码扫描和生成二维码
MNChangeSkin Android夜间模式,通过Theme实现
SwitcherView 垂直滚动的广告栏文字展示。
MNPasswordEditText 类似微信支付宝的密码输入框。
MNSwipeToLoadDemo 利用SwipeToLoadLayout实现的各种下拉刷新效果(饿了吗,京东,百度外卖,美团外卖,天猫下拉刷新等)。

mnzxingcode's People

Contributors

maning0303 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.