起步软件技术论坛
搜索
 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 2301|回复: 9

[结贴] 修改了插件里面的java文件怎么让他重新编译生效

[复制链接]

4

主题

13

帖子

45

积分

新手上路

Rank: 1

积分
45
QQ
发表于 2015-12-4 17:03:01 | 显示全部楼层 |阅读模式
我重新打包冒失还是程序功能没改变
发表于 2015-12-4 17:28:38 | 显示全部楼层
打包进去应该自动生效的!
如果你会android开发,可以打印点测试数据调试看看,
qq:1912779713
WeX5教程--WeX5下载
回复 支持 反对

使用道具 举报

4

主题

13

帖子

45

积分

新手上路

Rank: 1

积分
45
QQ
 楼主| 发表于 2015-12-4 18:10:05 | 显示全部楼层
liangyongfei 发表于 2015-12-4 17:28
打包进去应该自动生效的!
如果你会android开发,可以打印点测试数据调试看看, ...
  1. /*
  2. * Copyright (C) 2008 ZXing authors
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. *      http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */

  16. package com.google.zxing.client.android;

  17. import com.google.zxing.ResultPoint;
  18. import com.google.zxing.client.android.camera.CameraManager;

  19. import android.content.Context;
  20. import android.content.res.Resources;
  21. import android.graphics.Bitmap;
  22. import android.graphics.Canvas;
  23. import android.graphics.Paint;
  24. import android.graphics.Rect;
  25. import android.util.AttributeSet;
  26. import android.view.View;
  27. import com.google.zxing.FakeR;

  28. import java.util.ArrayList;
  29. import java.util.List;

  30. /**
  31. * This view is overlaid on top of the camera preview. It adds the viewfinder rectangle and partial
  32. * transparency outside it, as well as the laser scanner animation and result points.
  33. *
  34. * @author dswitkin@google.com (Daniel Switkin)
  35. */
  36. public final class ViewfinderView extends View {

  37.   private static final int[] SCANNER_ALPHA = {0, 64, 128, 192, 255, 192, 128, 64};
  38.   private static final long ANIMATION_DELAY = 80L;
  39.   private static final int CURRENT_POINT_OPACITY = 0xA0;
  40.   private static final int MAX_RESULT_POINTS = 20;
  41.   private static final int POINT_SIZE = 6;

  42.   private CameraManager cameraManager;
  43.   private final Paint paint;
  44.   private Bitmap resultBitmap;
  45.   private final int maskColor;
  46.   private final int resultColor;
  47.   private final int laserColor;
  48.   private final int resultPointColor;
  49.   private int scannerAlpha;
  50.   private List<ResultPoint> possibleResultPoints;
  51.   private List<ResultPoint> lastPossibleResultPoints;

  52.   private static FakeR fakeR;
  53.   boolean isFirst;
  54.   private int slideTop;

  55.   // This constructor is used when the class is built from an XML resource.
  56.   public ViewfinderView(Context context, AttributeSet attrs) {
  57.     super(context, attrs);

  58.         fakeR = new FakeR(context);

  59.     // Initialize these once for performance rather than calling them every time in onDraw().
  60.     paint = new Paint(Paint.ANTI_ALIAS_FLAG);
  61.     Resources resources = getResources();
  62.     maskColor = resources.getColor(fakeR.getId("color", "viewfinder_mask"));
  63.     resultColor = resources.getColor(fakeR.getId("color", "result_view"));
  64.     laserColor = resources.getColor(fakeR.getId("color", "viewfinder_laser"));
  65.     resultPointColor = resources.getColor(fakeR.getId("color", "possible_result_points"));
  66.     scannerAlpha = 0;
  67.     possibleResultPoints = new ArrayList<ResultPoint>(5);
  68.     lastPossibleResultPoints = null;
  69.   }

  70.   public void setCameraManager(CameraManager cameraManager) {
  71.     this.cameraManager = cameraManager;
  72.   }

  73.   @Override
  74.   public void onDraw(Canvas canvas) {
  75.     if (cameraManager == null) {
  76.       return; // not ready yet, early draw before done configuring
  77.     }
  78.     Rect frame = cameraManager.getFramingRect();
  79.     if (frame == null) {
  80.       return;
  81.     }
  82.         //初始化中间线滑动的最上边和最下边  
  83.     if(!isFirst){  
  84.             isFirst = true;  
  85.             slideTop = frame.top;  
  86.     }  
  87.     int width = canvas.getWidth();
  88.     int height = canvas.getHeight();

  89.     // Draw the exterior (i.e. outside the framing rect) darkened
  90.     paint.setColor(resultBitmap != null ? resultColor : maskColor);
  91.     canvas.drawRect(0, 0, width, frame.top, paint);
  92.     canvas.drawRect(0, frame.top, frame.left, frame.bottom + 1, paint);
  93.     canvas.drawRect(frame.right + 1, frame.top, width, frame.bottom + 1, paint);
  94.     canvas.drawRect(0, frame.bottom + 1, width, height, paint);

  95.     if (resultBitmap != null) {
  96.       // Draw the opaque result bitmap over the scanning rectangle
  97.       paint.setAlpha(CURRENT_POINT_OPACITY);
  98.       canvas.drawBitmap(resultBitmap, null, frame, paint);
  99.     } else {

  100.       /* Draw a red "laser scanner" line through the middle to show decoding is active
  101.       paint.setColor(laserColor);
  102.       paint.setAlpha(SCANNER_ALPHA[scannerAlpha]);
  103.       scannerAlpha = (scannerAlpha + 1) % SCANNER_ALPHA.length;
  104.       int middle = frame.height() / 2 + frame.top;
  105.       canvas.drawRect(frame.left + 2, middle - 1, frame.right - 1, middle + 2, paint);*/
  106.           //绘制中间的线,每次刷新界面,中间的线往下移动SPEEN_DISTANCE  
  107.            paint.setColor(laserColor);
  108.        slideTop += 5;  
  109.        if(slideTop >= frame.bottom){  
  110.                 slideTop = frame.top;  
  111.        }  
  112.       canvas.drawRect(frame.left+2, slideTop , frame.right-1 ,slideTop+3, paint);  
  113.               
  114.       
  115.       Rect previewFrame = cameraManager.getFramingRectInPreview();
  116.       float scaleX = frame.width() / (float) previewFrame.width();
  117.       float scaleY = frame.height() / (float) previewFrame.height();

  118.       List<ResultPoint> currentPossible = possibleResultPoints;
  119.       List<ResultPoint> currentLast = lastPossibleResultPoints;
  120.       int frameLeft = frame.left;
  121.       int frameTop = frame.top;
  122.       if (currentPossible.isEmpty()) {
  123.         lastPossibleResultPoints = null;
  124.       } else {
  125.         possibleResultPoints = new ArrayList<ResultPoint>(5);
  126.         lastPossibleResultPoints = currentPossible;
  127.         paint.setAlpha(CURRENT_POINT_OPACITY);
  128.         paint.setColor(resultPointColor);
  129.         synchronized (currentPossible) {
  130.           for (ResultPoint point : currentPossible) {
  131.             canvas.drawCircle(frameLeft + (int) (point.getX() * scaleX),
  132.                               frameTop + (int) (point.getY() * scaleY),
  133.                               POINT_SIZE, paint);
  134.           }
  135.         }
  136.       }
  137.       if (currentLast != null) {
  138.         paint.setAlpha(CURRENT_POINT_OPACITY / 2);
  139.         paint.setColor(resultPointColor);
  140.         synchronized (currentLast) {
  141.           float radius = POINT_SIZE / 2.0f;
  142.           for (ResultPoint point : currentLast) {
  143.             canvas.drawCircle(frameLeft + (int) (point.getX() * scaleX),
  144.                               frameTop + (int) (point.getY() * scaleY),
  145.                               radius, paint);
  146.           }
  147.         }
  148.       }

  149.       // Request another update at the animation interval, but only repaint the laser line,
  150.       // not the entire viewfinder mask.
  151.       postInvalidateDelayed(ANIMATION_DELAY,
  152.                             frame.left - POINT_SIZE,
  153.                             frame.top - POINT_SIZE,
  154.                             frame.right + POINT_SIZE,
  155.                             frame.bottom + POINT_SIZE);
  156.     }
  157.   }

  158.   public void drawViewfinder() {
  159.     Bitmap resultBitmap = this.resultBitmap;
  160.     this.resultBitmap = null;
  161.     if (resultBitmap != null) {
  162.       resultBitmap.recycle();
  163.     }
  164.     invalidate();
  165.   }

  166.   /**
  167.    * Draw a bitmap with the result points highlighted instead of the live scanning display.
  168.    *
  169.    * @param barcode An image of the decoded barcode.
  170.    */
  171.   public void drawResultBitmap(Bitmap barcode) {
  172.     resultBitmap = barcode;
  173.     invalidate();
  174.   }

  175.   public void addPossibleResultPoint(ResultPoint point) {
  176.     List<ResultPoint> points = possibleResultPoints;
  177.     synchronized (points) {
  178.       points.add(point);
  179.       int size = points.size();
  180.       if (size > MAX_RESULT_POINTS) {
  181.         // trim it
  182.         points.subList(0, size - MAX_RESULT_POINTS / 2).clear();
  183.       }
  184.     }
  185.   }

  186. }
复制代码

QQ图片20151204180803.png
回复 支持 反对

使用道具 举报

4

主题

13

帖子

45

积分

新手上路

Rank: 1

积分
45
QQ
 楼主| 发表于 2015-12-4 18:10:39 | 显示全部楼层
文件我改动的位置也贴图了
回复 支持 反对

使用道具 举报

4

主题

13

帖子

45

积分

新手上路

Rank: 1

积分
45
QQ
 楼主| 发表于 2015-12-4 18:11:28 | 显示全部楼层
从新打包 app还是保留原来的样式
回复 支持 反对

使用道具 举报

4

主题

13

帖子

45

积分

新手上路

Rank: 1

积分
45
QQ
 楼主| 发表于 2015-12-4 18:13:13 | 显示全部楼层
中文注视的地方是我修改的
回复 支持 反对

使用道具 举报

4

主题

13

帖子

45

积分

新手上路

Rank: 1

积分
45
QQ
 楼主| 发表于 2015-12-4 18:14:39 | 显示全部楼层
@liangshaohua
回复 支持 反对

使用道具 举报

4

主题

13

帖子

45

积分

新手上路

Rank: 1

积分
45
QQ
 楼主| 发表于 2015-12-4 19:22:53 | 显示全部楼层
@liangyongfei
回复 支持 反对

使用道具 举报

31

主题

1856

帖子

3070

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
3070
发表于 2015-12-7 09:39:53 | 显示全部楼层
插件修改了,重新打包就会应用了,你看一下你自己Native的工程下
build/src
有没有修改过的代码了

这里说的是3.2.1, 如果是早期版本,改了插件,需要修改打包服务器的,否则不生效。
回复 支持 反对

使用道具 举报

发表于 2015-12-7 09:40:39 | 显示全部楼层

java文件在打包时会自己编译的!
最好你自己调试看看吧!
http://bbs.wex5.com/forum.php?mo ... 9&pid=165181392
qq:1912779713
WeX5教程--WeX5下载
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|X3技术论坛|Justep Inc.    

GMT+8, 2024-5-3 04:39 , Processed in 0.104684 second(s), 26 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表