Java Code Examples for com.socks.library.KLog#i()

The following examples show how to use com.socks.library.KLog#i() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GalleryPhotoView.java    From star-zone-android with Apache License 2.0 6 votes vote down vote up
void animaClip(Rect clipFrom, Rect clipTo) {
    this.clipFrom = new RectF(clipFrom);
    this.clipTo = new RectF(clipTo);
    KLog.i("clip", "clipFrom  >>>  " + clipFrom.toShortString());
    KLog.i("clip", "clipTo  >>>  " + clipTo.toShortString());

    if (!clipFrom.isEmpty() && !clipTo.isEmpty()) {
        //算出裁剪比率
        float dx = Math.min(1.0f, clipTo.width() * 1.0f / clipFrom.width() * 1.0f);
        float dy = Math.min(1.0f, clipTo.height() * 1.0f / clipFrom.height() * 1.0f);
        //因为scroller是对起始值和终点值之间的数值影响,所以减去1,如果为0,意味着不裁剪,因为目标值比开始值大,而画布无法再扩大了,所以忽略
        dx = dx - 1;
        dy = dy - 1;
        //从1开始,乘以1w保证精度
        clipScroller.startScroll((int) (0 * PRECISION), (int) (0 * PRECISION), (int) (dx * PRECISION), (int) (dy * PRECISION), ANIMA_DURATION);
    }
}
 
Example 2
Source File: MultiImageMomentsVH.java    From star-zone-android with Apache License 2.0 5 votes vote down vote up
@Override
        public void onBindData(int position, @NonNull ImageView convertView) {
            int width = convertView.getWidth();
            int height = convertView.getHeight();
            String imageUrl = datas.get(position);
            // 去掉缩略图的url的获取
            // 例如 http://resources.appjishu.com/star-sign/463490676928020480.jpg!/fxfn/540x303
//            if (width > 0 && height > 0) {
//                imageUrl = BmobUrlUtil.getThumbImageUrl(imageUrl, width, height);
//            } else {
//                imageUrl = BmobUrlUtil.getThumbImageUrl(imageUrl, 25);
//            }
            KLog.i("处理的url  >>>  " + imageUrl);
            ImageLoadMnanger.INSTANCE.loadImage(convertView, imageUrl);
        }
 
Example 3
Source File: PhotoSelectActivity.java    From star-zone-android with Apache License 2.0 5 votes vote down vote up
private void initFrag() {
    if (gridFragement == null) {
        KLog.i(TAG, "maxCount = " + maxCount);
        gridFragement = PhotoGridFragement.newInstance(maxCount);
    }
    if (albumFragement == null) {
        albumFragement = new PhotoAlbumFragement();
    }
    changeFragment(currentFragment, gridFragement, false);
}
 
Example 4
Source File: MainActivity.java    From KLog with Apache License 2.0 5 votes vote down vote up
public void logWithMsg(View view) {
    KLog.v(LOG_MSG);
    KLog.d(LOG_MSG);
    KLog.i(LOG_MSG);
    KLog.w(LOG_MSG);
    KLog.e(LOG_MSG);
    KLog.a(LOG_MSG);
}
 
Example 5
Source File: GalleryPhotoView.java    From star-zone-android with Apache License 2.0 5 votes vote down vote up
/**
 * 获取view的大小
 *
 * @return
 */
public Rect getViewBounds() {
    Rect result = new Rect();
    getGlobalVisibleRect(result, globalOffset);
    KLog.i(result.toShortString());
    return result;
}
 
Example 6
Source File: GalleryPhotoView.java    From star-zone-android with Apache License 2.0 5 votes vote down vote up
@Override
public void draw(Canvas canvas) {
    if (clipBounds != null) {
        canvas.clipRect(clipBounds);
        KLog.i("clip", "clipBounds  >>  " + clipBounds.toShortString());
        clipBounds = null;
    }
    super.draw(canvas);
}
 
Example 7
Source File: MainActivity.java    From KLog with Apache License 2.0 5 votes vote down vote up
public void log(View view) {
    KLog.v();
    KLog.d();
    KLog.i();
    KLog.w();
    KLog.e();
    KLog.a();
}
 
Example 8
Source File: OkHttpUtil.java    From ZZShow with Apache License 2.0 5 votes vote down vote up
@Override
public Response intercept(Chain chain) throws IOException {
    Request request = chain.request();
    long t1 = System.nanoTime();
    KLog.i(String.format("Sending request %s on %s%n%s",request.url(),chain.connection(),request.headers()));
    Response response = chain.proceed(request);
    long t2 = System.nanoTime();
    KLog.i(String.format(Locale.getDefault(),"Received response for %s in %.1fms%n%s",
            response.request().url(),(t2 - t1)/1e6d,response.headers()));
    return response;
}
 
Example 9
Source File: DotIndicator.java    From star-zone-android with Apache License 2.0 5 votes vote down vote up
public DotIndicator init(Context context, int dotNum) {
    setOrientation(HORIZONTAL);
    setGravity(Gravity.CENTER);
    this.mDotsNum = dotNum == 0 ? DEFAULT_DOT_NUM : dotNum;
    buildDotView(context);
    if (mDotsNum <= 1) {
        setVisibility(GONE);
    } else {
        setVisibility(VISIBLE);
    }
    setCurrentSelection(0);
    KLog.i(TAG, "new instance");
    return this;
}
 
Example 10
Source File: UIHelper.java    From star-zone-android with Apache License 2.0 5 votes vote down vote up
/**
 * 显示软键盘
 */
public static void showInputMethod(View view) {
    if (view == null) return;
    if (view instanceof EditText) view.requestFocus();
    InputMethodManager imm = (InputMethodManager) view.getContext()
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imm != null) {
        boolean success = imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
        KLog.i("showSoftKeyboard", " isSuccess   >>>   " + success);
    }
}
 
Example 11
Source File: BaseActivity.java    From star-zone-android with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    KLog.i("当前打开 :  " + this.getClass().getSimpleName());
    if (mPermissionHelper == null) {
        mPermissionHelper = new PermissionHelper(this);
    }
    ARouter.getInstance().inject(this);
    onHandleIntent(getIntent());
}
 
Example 12
Source File: MainActivity.java    From KLog with Apache License 2.0 5 votes vote down vote up
public void logWithTag(View view) {
    KLog.v(TAG, LOG_MSG);
    KLog.d(TAG, LOG_MSG);
    KLog.i(TAG, LOG_MSG);
    KLog.w(TAG, LOG_MSG);
    KLog.e(TAG, LOG_MSG);
    KLog.a(TAG, LOG_MSG);
}
 
Example 13
Source File: CompressTaskHelper.java    From star-zone-android with Apache License 2.0 5 votes vote down vote up
private String compressOnSize(String originalImagePath, long fileSize, CompressOption option) {
    long sizeInKB = fileSize >> 10;
    KLog.i(TAG, "压缩前的文件大小  >>  " + FileUtil.fileLengthFormat(fileSize) + "\n当前设置最大文件大小  >>  " + option.sizeTarget + "kb");
    if (option.sizeTarget >= sizeInKB) {
        KLog.i(TAG, "小于理论大小,放弃压缩");
        FileUtil.moveFile(originalImagePath, option.saveCompressImagePath);
        return option.saveCompressImagePath;
    }
    boolean success = BitmapUtil.compressBmpToFile(BitmapUtil.loadBitmap(mContext, originalImagePath),
            new File(option.saveCompressImagePath),
            option.sizeTarget,
            option.suffix);
    return success ? option.saveCompressImagePath : null;
}
 
Example 14
Source File: CompressTaskHelper.java    From star-zone-android with Apache License 2.0 5 votes vote down vote up
private String compressOnScale(String imagePath, int[] imageSize, CompressOption option) throws Exception {
    KLog.i(TAG, "压缩前分辨率  >>  【" + imageSize[0] + "x" + imageSize[1] + "】");
    Bitmap bp = BitmapUtil.loadBitmap(mContext, option.originalImagePath, option.maxWidth, option.maxHeight);
    boolean save = BitmapUtil.saveBitmap(option.saveCompressImagePath, bp, option.suffix);
    bp.recycle();
    int[] resultSize = BitmapUtil.getImageSize(option.saveCompressImagePath);
    KLog.i(TAG, "压缩后分辨率  >>  【" + resultSize[0] + "x" + resultSize[1] + "】");
    return save ? option.saveCompressImagePath : null;
}
 
Example 15
Source File: MainActivity.java    From KLog with Apache License 2.0 5 votes vote down vote up
public void logWithNull(View view) {
    KLog.v(null);
    KLog.d(null);
    KLog.i(null);
    KLog.w(null);
    KLog.e(null);
    KLog.a(null);
}
 
Example 16
Source File: CompressTaskHelper.java    From star-zone-android with Apache License 2.0 5 votes vote down vote up
@Override
public void start() {
    if (data == null) {
        callError("配置为空");
        return;
    }
    CompressOption option = data;
    int[] imageSize = BitmapUtil.getImageSize(option.originalImagePath);
    if (imageSize[0] <= -1 || imageSize[1] <= -1) {
        callError(">>>>>无法获取图片大小<<<<<");
        return;
    }
    File imageFile = new File(option.originalImagePath);
    if (!imageFile.exists()) {
        callError("图片不存在。。。退出");
        return;
    }
    long fileSize = 0;
    try {
        fileSize = FileUtil.getFileSize(new File(option.originalImagePath));
        KLog.i(TAG, "文件路径  >>>  " + option.originalImagePath + "\n文件大小  >>>  " + FileUtil.fileLengthFormat(fileSize));
    } catch (Exception e) {
        e.printStackTrace();
    }

    if (fileSize <= 0 && option.compressType != CompressManager.SCALE) {
        callError("获取图片文件大小失败。。。。");
        return;
    }

    startTask(imageSize, fileSize, option);
}
 
Example 17
Source File: PermissionHelper.java    From star-zone-android with Apache License 2.0 5 votes vote down vote up
private void log(String desc, Permission... permissions) {
    String logText = null;
    if (permissions != null) {
        for (Permission permission : permissions) {
            logText = permission.permission + "(" + permission.desc + ")" + "\n";
        }
    }
    KLog.i(TAG, desc + logText);
}
 
Example 18
Source File: PermissionHelper.java    From star-zone-android with Apache License 2.0 5 votes vote down vote up
private void log(String desc, List<String> data) {
    String logText = null;
    if (!ToolUtil.isListEmpty(data)) {
        for (String datum : data) {
            logText = datum + "\n";
        }
    }
    KLog.i(TAG, desc + logText);
}
 
Example 19
Source File: AppFileHelper.java    From star-zone-android with Apache License 2.0 4 votes vote down vote up
private static void checkAndMakeDir(File file) {
    if (!file.exists()) {
        boolean result = file.mkdirs();
        KLog.i(TAG, "mkdirs  >>>  " + file.getAbsolutePath() + "  success  >>  " + result);
    }
}
 
Example 20
Source File: AppFileHelper.java    From star-zone-android with Apache License 2.0 4 votes vote down vote up
private static void initStroagePathInternal() {
    if (TextUtils.isEmpty(storagePath)) {
        //M开始用的filePorider
        if (!OVERM) {
            storagePath = FileUtil.getStoragePath(AppContext.getAppContext(), false);
        }
        if (TextUtils.isEmpty(storagePath)) {
            //没有路径就使用getExternalStorageDirectory
            storagePath = Environment.getExternalStorageDirectory().getAbsolutePath();
            if (TextUtils.isEmpty(storagePath)) {
                //依然没法创建路径则使用私有的
                storagePath = AppContext.getAppContext().getFilesDir().getAbsolutePath();
            }
        }
    }

    storagePath = FileUtil.checkFileSeparator(storagePath);
    KLog.i(TAG, "storagepath  >>  " + storagePath);

    File rootDir = new File(storagePath.concat(ROOT_PATH));
    checkAndMakeDir(rootDir);

    File dataDir = new File(storagePath.concat(DATA_PATH));
    checkAndMakeDir(dataDir);

    File cacheDir = new File(storagePath.concat(CACHE_PATH));
    checkAndMakeDir(cacheDir);

    File picDir = new File(storagePath.concat(PIC_PATH));
    checkAndMakeDir(picDir);

    File cameraDir = new File(storagePath.concat(CAMERA_PATH));
    checkAndMakeDir(cameraDir);

    File logDir = new File(storagePath.concat(LOG_PATH));
    checkAndMakeDir(logDir);

    File downLoadDir = new File(storagePath.concat(DOWNLOAD_PATH));
    checkAndMakeDir(downLoadDir);

    File tempDir = new File(storagePath.concat(TEMP_PATH));
    checkAndMakeDir(tempDir);
}