Java Code Examples for com.orhanobut.logger.Logger

The following examples show how to use com.orhanobut.logger.Logger. These examples are extracted from open source projects. 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 Project: SmartChart   Source File: SelectDateDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void setDays(int year, int month) {

        int day = 31;
        if (month == 4 || month == 6 || month == 9 || month == 11) {
            day = 30;
        } else if (month == 2) {
            if (isLeapYear(year)) {
                day = 29;
            } else {
                day = 28;
            }
        }

        dayData.clear();

        for (int i = 0; i < day; i++) {
            dayData.add((i + 1) + "");
        }

        Logger.i("ChooseDateDialog:setDays:>>>>>" + dayData.toString());
    }
 
Example 2
Source Project: Meteorite   Source File: MainActivity.java    License: Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
    // Handle navigation view item clicks here.
    int id = item.getItemId();
    if (id == R.id.nav_home) {
    } else if (id == R.id.nav_about) {
        tv_content.setText("about");
        AboutActivity.start(this);
    } else if (id == R.id.nav_login) {
        WebActivity.loadUrl(this, "https://github.com/login", "登录GitHub");
    } else if (id == R.id.nav_set) {
        tv_content.setText("set");
    } else if (id == R.id.nav_comments) {
        FeedBackActivity.start(this);
    } else if (id == R.id.nav_logout) {
        finish();
    }
    Logger.d(tv_content.getText().toString());
    DrawerLayout drawer = findViewById(R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);
    return true;
}
 
Example 3
Source Project: imsdk-android   Source File: IdentitySelectActivity.java    License: MIT License 6 votes vote down vote up
private void showSelect() {
    mAnonymousData = null;
    cacheIdentity = getIntent().getIntExtra(now_identity_type, 0);
    if (cacheIdentity == REAL_NAME) {
        identity_anonymous.setTextColor(getResources().getColor(R.color.send_no));
        identity_real.setTextColor(getResources().getColor(R.color.atom_ui_new_like_select));

    } else {
        try {
            identity_anonymous.setTextColor(getResources().getColor(R.color.atom_ui_new_like_select));
            identity_real.setTextColor(getResources().getColor(R.color.send_no));
            if (getIntent().hasExtra(ANONYMOUS_DATA)) {
                mAnonymousData = (AnonymousData) getIntent().getSerializableExtra(ANONYMOUS_DATA);
                anonymous_real_name.setText(getString(R.string.atom_ui_nickname) + ":" + mAnonymousData.getData().getAnonymous());
            }


        } catch (Exception e) {
            Logger.i("初始化花名出错");
        }

    }
}
 
Example 4
Source Project: imsdk-android   Source File: PictureSelectorAdapter.java    License: MIT License 6 votes vote down vote up
public void releaseDraweeView(){
    if(draweeViewList != null && draweeViewList.size() > 0){
        for (Map.Entry<String, SimpleDraweeView> entry : draweeViewList.entrySet()) {
            if(entry.getValue() != null && entry.getValue().getController() != null){
                if(entry.getValue() != null){
                    if(entry.getValue().getController() != null){
                        entry.getValue().getController().onDetach();
                    }
                    entry.getValue().setImageDrawable(null);
                    Logger.i("release cache");
                }
            }
        }
        draweeViewList.clear();
    }
    selectedImages.clear();
}
 
Example 5
Source Project: AFBaseLibrary   Source File: AFCertificateUtil.java    License: Apache License 2.0 6 votes vote down vote up
private static InputStream[] getCertificatesByAssert(Context context, String... certificateNames) {
    if (context == null) {
        Logger.d("context is empty");
        return null;
    }
    if (certificateNames == null) {
        Logger.d("certificate is empty");
        return null;
    }

    AssetManager assets = context.getAssets();
    InputStream[] certificates = new InputStream[certificateNames.length];
    for (int i = 0; i < certificateNames.length; i++) {
        String certificateName = certificateNames[i];
        try {
            certificates[i] = assets.open(certificateName);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    return certificates;
}
 
Example 6
Source Project: imsdk-android   Source File: WorkWorldBrowersingFragment.java    License: MIT License 6 votes vote down vote up
public boolean onTouch(View v, MotionEvent event) {
    switch (event.getAction()) {
        case MotionEvent.ACTION_DOWN:
            isLongClick = false;
            isDraged = false;
            mx = 0;
            my = 0;
            x = event.getX();
            y = event.getY();
            break;
        case MotionEvent.ACTION_MOVE:
            mx = (int) (event.getRawX() - x);
            my = (int) (event.getRawY() - 50 - y);
            if(mx > 10 || my > 10){
                isDraged = true;
            }
            break;
        case MotionEvent.ACTION_UP:
            if(mx < 10 && my < 10 && !isLongClick && !isDraged){
                Logger.i("点击退出图片浏览GalleryFragment");
                getActivity().finish();
            }
            break;
    }
    return false;
}
 
Example 7
Source Project: Easer   Source File: AbstractSlot.java    License: GNU General Public License v3.0 6 votes vote down vote up
/**
 * Change the satisfaction state of the current slot.
 * It will notify the corresponding {@link ryey.easer.core.Lotus} (by emitting {@link android.content.Intent} with {@link #notifyLotusData} as data) iif the satisfaction state is changed.
 *
 * This method sets the {@link #satisfied} variable.
 */
protected synchronized void changeSatisfiedState(boolean newSatisfiedState, Bundle dynamics) {
    if (satisfied != null) {
        if (persistent && satisfied && !newSatisfiedState) {
            Logger.v("prevent from resetting a persistent slot back to unsatisfied");
            return;
        }
        if (!retriggerable && (satisfied == newSatisfiedState)) {
            Logger.v("satisfied state is already %s", newSatisfiedState);
            return;
        }
    }
    satisfied = newSatisfiedState;
    //FIXME: remove the explicit use of core package (Lotus)
    Intent notifyLotusIntent = satisfied
            ? Lotus.NotifyIntentPrototype.obtainPositiveIntent(notifyLotusData)
            : Lotus.NotifyIntentPrototype.obtainNegativeIntent(notifyLotusData);
    notifyLotusIntent.putExtra(Lotus.EXTRA_DYNAMICS_PROPERTIES, dynamics);
    context.sendBroadcast(notifyLotusIntent);
    Logger.d("finished changeSatisfiedState to %s", newSatisfiedState);
}
 
Example 8
Source Project: nongbeer-mvp-android-demo   Source File: HttpLogger.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void log( String message ){
    final String logName = "OkHttp";
    if( !message.startsWith( "{" ) ){
        Log.d( logName, message );
        return;
    }
    try{
        String prettyPrintJson = new GsonBuilder()
                .setPrettyPrinting()
                .create()
                .toJson( new JsonParser().parse( message ) );
        Logger.init().methodCount( 1 ).hideThreadInfo();
        Logger.t( logName ).json( prettyPrintJson );
    }catch( JsonSyntaxException m ){
        Log.e( TAG, "html header parse failed" );
        m.printStackTrace();
        Log.e( logName, message );
    }
}
 
Example 9
Source Project: PlayTogether   Source File: InviteBll.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 通过一个objectid获得一个invitation
 *
 * @param invitationId
 * @return
 */
public Observable<Invitation> getInvitationById(final String invitationId)
{
	return Observable.create(new Observable.OnSubscribe<Invitation>()
	{
		@Override
		public void call(Subscriber<? super Invitation> subscriber)
		{
			AVQuery<Invitation> query = AVObject.getQuery(Invitation.class);
			query.include(Invitation.FIELD_ACCEPT_INVITE_USERS);
			query.include(Invitation.FIELD_PIC);
			query.include(Invitation.FIELD_AUTHOR);
			try
			{
				Invitation invitation = query.get(invitationId);
				subscriber.onNext(invitation);
			} catch (AVException e)
			{
				Logger.e(e, "失败");
				e.printStackTrace();
				subscriber.onError(e);
			}
		}
	});
}
 
Example 10
Source Project: AndroidBleManager   Source File: BluetoothConnectManager.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void onDeviceDisconnect(final BluetoothGatt gatt, int errorState) {
    //is bluetooth enable
    //可以不关闭,以便重用,因为在连接connect的时候可以快速连接
    if (!checkIsSamsung() || !mBluetoothUtils.isBluetoothIsEnable()){//三星手机断开后直接连接
        Logger.e( "Disconnected from GATT server address:"+gatt.getDevice().getAddress());
        close(gatt.getDevice().getAddress()); //防止出现status 133
    }else {
        updateConnectStateListener(gatt.getDevice().getAddress(), ConnectState.NORMAL);
    }

    //if disconnect by hand, so not run reconnect device
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            reconnectDevice(gatt.getDevice().getAddress()); //如果设备断开则指定时间后尝试重新连接,重新连接
        }
    });
}
 
Example 11
Source Project: v9porn   Source File: AppApiHelper.java    License: MIT License 6 votes vote down vote up
@Override
public Observable<List<V9PornItem>> loadPorn9VideoIndex(boolean cleanCache) {
    Observable<String> indexPhpObservable = v9PornServiceApi.porn9VideoIndexPhp(HeaderUtils.getIndexHeader(addressHelper));
    return cacheProviders.getIndexPhp(indexPhpObservable, new EvictProvider(cleanCache))
            .map(responseBodyReply -> {
                switch (responseBodyReply.getSource()) {
                    case CLOUD:
                        Logger.t(TAG).d("数据来自:网络");
                        break;
                    case MEMORY:
                        Logger.t(TAG).d("数据来自:内存");
                        break;
                    case PERSISTENCE:
                        Logger.t(TAG).d("数据来自:磁盘缓存");
                        break;
                    default:
                        break;
                }
                return responseBodyReply.getData();
            })
            .map(ParseV9PronVideo::parseIndex);
}
 
Example 12
Source Project: PlayTogether   Source File: MyApplication.java    License: Apache License 2.0 6 votes vote down vote up
@Override
    public void onCreate() {
        super.onCreate();
        setTheme(R.style.SplashTheme);
//        BlockCanary.install(this, new AppBlockCanaryContext()).start();
        initLeanCloud();
        initChat();
        mApplicationComponent = DaggerApplicationComponent.builder()
                .apiModule(new ApiModule())
                .bllModule(new BllModule())
                .applicationModule(new ApplicationModule(this))
                .build();
        //leancloud所需要的参数
        initBean();
        initLeanCloud();
        //初始化log
        Logger.init("cat")
                .methodCount(2)
                .hideThreadInfo();
        initPicasso();

    }
 
Example 13
Source Project: v9porn   Source File: DownloadManager.java    License: MIT License 6 votes vote down vote up
public int startDownload(String url, final String path, boolean isDownloadNeedWifi, boolean isForceReDownload) {
    Logger.t(TAG).d("url::" + url);
    Logger.t(TAG).d("path::" + path);
    Logger.t(TAG).d("isDownloadNeedWifi::" + isDownloadNeedWifi);
    Logger.t(TAG).d("isForceReDownload::" + isForceReDownload);
    int id = FileDownloader.getImpl().create(url)
            .setPath(path)
            .setListener(lis)
            .setWifiRequired(isDownloadNeedWifi)
            .setAutoRetryTimes(3)
            .setForceReDownload(isForceReDownload)
            .asInQueueTask()
            .enqueue();
    FileDownloader.getImpl().start(lis, false);
    return id;
}
 
Example 14
Source Project: FlyWoo   Source File: PictureFolderVu.java    License: Apache License 2.0 6 votes vote down vote up
public void setData(final List<PictureFolderEntity> list) {
    adapter = new PictureFolderAdapter(context, list);
    mListView.setAdapter(adapter);
    mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Logger.i("setOnItemClickListener:" + position);
          //  BusProvider.getInstance().post(new ShowImageListEvent(list.get(position).images));
         //   EventBus.getDefault().post();
            if(mListView.getAdapter() instanceof PictureFolderAdapter) { //如果是文件夹
                setPictureList(list.get(position).images);
            }else {//如果是图片,点击返回
                mListView.setAdapter(adapter);
            }
        }
    });
}
 
Example 15
Source Project: v9porn   Source File: PictureAdapter.java    License: MIT License 6 votes vote down vote up
@Override
public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
    FrameLayout view = (FrameLayout) object;
    for (int i = 0; i < view.getChildCount(); i++) {
        View childView = view.getChildAt(i);
        if (childView instanceof PhotoView) {
            childView.setOnClickListener(null);
            childView.setOnLongClickListener(null);
            GlideApp.with(container).clear(childView);
            view.removeViewAt(i);
            Logger.t(TAG).d("clean photoView");
        }
    }
    container.removeView(view);
    Logger.t(TAG).d("destroyItem");
}
 
Example 16
Source Project: landlord_client   Source File: ConnectionManagerImpl.java    License: Apache License 2.0 6 votes vote down vote up
public ConnectionManagerImpl(ConnectionInfo remoteInfo, ConnectionInfo localInfo) {
    super(remoteInfo, localInfo);
    isConnectionPermitted = true;
    isDisconnecting = false;
    String ip = "";
    String port = "";
    if (remoteInfo != null) {
        ip = remoteInfo.getIp();
        port = remoteInfo.getPort() + "";
    }
    Logger.d("block connection init with:" + ip + ":" + port);
    if (localInfo != null) {
        Logger.d("binding local addr:" + localInfo.getIp() + " port:" + localInfo.getPort());
    }
    s = new Semaphore(1);
}
 
Example 17
Source Project: AndroidStarter   Source File: ApplicationAndroidStarter.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    sSharedApplication = this;

    Logger.init(TAG)
            .logLevel(LogLevel.FULL);

    buildComponent();

    mComponentApplication.inject(this);
    merlin.bind();

    final StrictMode.ThreadPolicy loStrictModeThreadPolicy = new StrictMode.ThreadPolicy.Builder()
            .detectAll()
            .penaltyDeath()
            .build();
    StrictMode.setThreadPolicy(loStrictModeThreadPolicy);
}
 
Example 18
Source Project: v9porn   Source File: DownloadManager.java    License: MIT License 6 votes vote down vote up
public int startDownload(String url, final String path, boolean isDownloadNeedWifi, boolean isForceReDownload) {
    Logger.t(TAG).d("url::" + url);
    Logger.t(TAG).d("path::" + path);
    Logger.t(TAG).d("isDownloadNeedWifi::" + isDownloadNeedWifi);
    Logger.t(TAG).d("isForceReDownload::" + isForceReDownload);
    int id = FileDownloader.getImpl().create(url)
            .setPath(path)
            .setListener(lis)
            .setWifiRequired(isDownloadNeedWifi)
            .setAutoRetryTimes(3)
            .setForceReDownload(isForceReDownload)
            .asInQueueTask()
            .enqueue();
    FileDownloader.getImpl().start(lis, false);
    return id;
}
 
Example 19
Source Project: GankApp   Source File: ImageImproveService.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * 预解码图片并将抓到的图片尺寸保存至数据库
 *
 * @param realm   Realm 实例
 * @param image 图片
 * @return 是否保存成功
 */
private boolean saveToDb(Realm realm, Image image) {
    realm.beginTransaction();
    try {
        Point size = new Point();
        loadImageForSize(image.getUrl(),size);
        image.setHeight(size.y);
        image.setWidth(size.x);
        realm.copyToRealmOrUpdate(image);
    } catch (IOException e) {
        Logger.d("Failed to fetch image");
        realm.cancelTransaction();
        return false;
    }
    realm.commitTransaction();
    return true;
}
 
Example 20
Source Project: POCenter   Source File: SearchActivity.java    License: MIT License 5 votes vote down vote up
@Override
public void setData(List<ProjectBean> data) {
    if (CollectionUtils.isEmpty(data)) {
        showEmpty();
    } else {
        showContent();
    }
    searchAdapter.setNewData(data);
    bind.rv.scrollToPosition(0);

    Logger.d("set data");
    loadDataComplete();
}
 
Example 21
Source Project: AndroidBleManager   Source File: BluetoothConnectManager.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * close bluetooth, release resource
 * @param address
 */
public boolean close(String address) {
    if (!isEmpty(address) && gattMap.containsKey(address)){
        Logger.w("close gatt server " + address);
        BluetoothGatt mBluetoothGatt = gattMap.get(address);
        mBluetoothGatt.close();
        gattMap.remove(address);
        updateConnectStateListener(address, ConnectState.NORMAL);
        return true;
    }
    return false;
}
 
Example 22
Source Project: landlord_client   Source File: HallFragment.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void init() {
    Gson gson = new Gson();
    //牌桌窗口
    hallAdapter = new HallAdapter(context);
    rvTables.setLayoutManager(new GridLayoutManager(context, 2));
    rvTables.addItemDecoration(new DividerItemDecoration(context, DividerItemDecoration.HORIZONTAL));
    hallAdapter.setOnItemClickListener(((tableNum) -> {
        Logger.i("进入房间,房间号:%d", tableNum);
        SharedPreferencesUtil.saveTableNum(tableNum);
        EnterTableRequest enterTableRequest = new EnterTableRequest(SharedPreferencesUtil.getUsername(), tableNum);
        App.getApp().getAgent().send(new JsonReq(15, gson.toJson(enterTableRequest).getBytes(StandardCharsets.UTF_8)));
    }));
    rvTables.setAdapter(hallAdapter);
    //TextView滑动条
    tvMessage.setMovementMethod(ScrollingMovementMethod.getInstance());
    //聊天窗口
    addDisposable(
            RxView.clicks(btnSend)
                    .throttleFirst(1, TimeUnit.SECONDS)
                    .subscribe(o -> {
                        if(!etSend.getText().toString().equals("")) {
                            ChatMsgRequest chatMsgRequest = new ChatMsgRequest(1,
                                    SharedPreferencesUtil.getUsername(), etSend.getText().toString(), -1);
                            App.getApp().getAgent().send(new JsonReq(12, gson.toJson(chatMsgRequest).getBytes(StandardCharsets.UTF_8)));
                        }
                    }),
            RxView.clicks(btnRefresh)
                    .throttleFirst(5, TimeUnit.SECONDS)
                    .subscribe(o -> {
                        InitHallRequest initHallRequest = new InitHallRequest();
                        App.getApp().getAgent().send(new JsonReq(19, gson.toJson(initHallRequest).getBytes(StandardCharsets.UTF_8)));
                    })
    );
}
 
Example 23
Source Project: imsdk-android   Source File: PbChatActivity.java    License: MIT License 5 votes vote down vote up
void showCamera() {
//        Intent intent = new Intent(this, ImageClipActivity.class);
//        intent.putExtra(ImageClipActivity.KEY_CLIP_ENABLE, false);
//        File file = new File(MyDiskCache.getDirectory(),
//                UUID.randomUUID().toString() + ".jpg");
//        intent.putExtra(ImageClipActivity.KEY_CAMERA_PATH, Uri.fromFile(file));
//        startActivityForResult(intent, ACTIVITY_GET_CAMERA_IMAGE);
        Logger.i("相机拍照");
        //自定义相机 带录制视频版本
        startActivityForResult(new Intent(this, CameraActivity.class), ACTIVITY_GET_CAMERA_IMAGE);
        //新版图片选择器
//        Intent intent = new Intent(this, ImageGridActivity.class);
//        intent.putExtra(ImageGridActivity.EXTRAS_TAKE_PICKERS, true); // 是否是直接打开相机
//        startActivityForResult(intent, ACTIVITY_GET_CAMERA_IMAGE);
    }
 
Example 24
Source Project: Pigeon   Source File: PigeonApplication.java    License: MIT License 5 votes vote down vote up
private void initSophix() {
    String appVersion;
    try {
        appVersion = this.getPackageManager().getPackageInfo(this.getPackageName(), 0).versionName;
    } catch (Exception e) {
        appVersion = "1.0.0";
    }

    SophixManager.getInstance().setContext(this)
            .setAppVersion(appVersion)
            .setAesKey(null)
            .setEnableDebug(false)
            .setPatchLoadStatusStub(new PatchLoadStatusListener() {
                @Override
                public void onLoad(final int mode, final int code, final String info, final int handlePatchVersion) {
                    // 补丁加载回调通知
                    if (code == PatchStatus.CODE_LOAD_SUCCESS) {
                        // 表明补丁加载成功
                        ToastUtils.showToast(getApplicationContext(),"补丁加载成功");
                    } else if (code == PatchStatus.CODE_LOAD_RELAUNCH) {
                        // 表明新补丁生效需要重启. 开发者可提示用户或者强制重启;
                        // 建议: 用户可以监听进入后台事件, 然后调用killProcessSafely自杀,以此加快应用补丁,详见1.3.2.3
                        ToastUtils.showToast(getApplicationContext(),"新补丁生效需要重启");
                        SophixManager.getInstance().killProcessSafely();
                    } else {
                        // 其它错误信息, 查看PatchStatus类说明
                        Logger.e("SophixErrorCode:"+code);
                    }
                }
            }).initialize();
    SophixManager.getInstance().queryAndLoadNewPatch();
}
 
Example 25
Source Project: imsdk-android   Source File: WorkWorldAtShowFragment.java    License: MIT License 5 votes vote down vote up
public void refresh() {
    Logger.i("进行了一次刷新");
    if (workWorldNoticeAdapter != null) {
        workWorldNoticeAdapter.setEnableLoadMore(false);//这里的作用是防止下拉刷新的时候还可以上拉加载
    }

    if (workWorldAtShowPresenter != null) {
        workWorldAtShowPresenter.startRefresh();
    }


}
 
Example 26
Source Project: imsdk-android   Source File: QimRNBModule.java    License: MIT License 5 votes vote down vote up
/**
 * 获取用户二维码
 *
 * @param userId
 * @param callback
 */
@ReactMethod
public void getUserQRCode(String userId, Callback callback) {
    Logger.i("RNModule:获取用户二维码:" + userId);
    String imageBase64 = QRUtil.generateQRBase64(Constants.Config.QR_SCHEMA + "://user?id=" + userId);
    WritableNativeMap map = new WritableNativeMap();
    map.putString("qrCode", imageBase64);
    callback.invoke(map);
}
 
Example 27
Source Project: imsdk-android   Source File: MzPushReceiver.java    License: MIT License 5 votes vote down vote up
@Override
    public void onRegisterStatus(Context context, RegisterStatus registerStatus) {
        if(registerStatus != null) {
            Logger.i("注册meizu push onRegisterStatus registerStatus=%s", registerStatus.toString());
//            QPushClient.setAlias(context, PhoneInfoUtils.getUniqueID());
            HttpUtil.registPush(registerStatus.getPushId(), QTPushConfiguration.getPlatName());
        }else {
            Logger.i("注册meizu push onRegisterStatus 失败");
        }
    }
 
Example 28
Source Project: imsdk-android   Source File: DailyNoteEditorActivity.java    License: MIT License 5 votes vote down vote up
/**
     * 单纯上传并图片
     *
     * @param filePath
     */
    public void uploadImage(String filePath) {
        final File origalFile = new File(filePath);
        final UploadImageRequest request = new UploadImageRequest();
        request.filePath = origalFile.getPath();
        request.FileType = UploadImageRequest.IMAGE;
//        request.id = message.getId();
        request.progressRequestListener = new ProgressRequestListener() {
            @Override
            public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
//                callback.updataProgress((int) (bytesWritten * 100 / contentLength), done);
            }
        };
        request.requestComplete = new IUploadRequestComplete() {
            @Override
            public void onRequestComplete(String id, final UploadImageResult result) {

                if (result != null && !TextUtils.isEmpty(result.httpUrl)) {
                    Logger.i("上传图片成功  msg url = " + result.httpUrl);
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            editor.insertImage(QtalkNavicationService.getInstance().getInnerFiltHttpHost() + "/" + result.httpUrl, "图片");
                        }
                    });
                } else {
                    Logger.i("上传图片失败 ");

                }
            }

            @Override
            public void onError(String msg) {
                Logger.i("上传图片失败  msg url = " + msg);
            }

        };

        CommonUploader.getInstance().setUploadImageRequest(request);
    }
 
Example 29
Source Project: RxTools-master   Source File: ActivityZipEncrypt.java    License: Apache License 2.0 5 votes vote down vote up
@OnClick({R.id.btn_create_folder, R.id.btn_zip})
public void onViewClicked(View view) {
    switch (view.getId()) {
        case R.id.btn_create_folder:
            fileDir = new File(RxFileTool.getRootPath().getAbsolutePath() + File.separator + "RxTools");
            if (!fileDir.exists()) {
                fileDir.mkdirs();
            }
            mTvState.setText("文件夹 RxTools 创建成功,文件夹位于在根目录");
            break;
        case R.id.btn_zip:
            File fileZip = new File(RxFileTool.getRootPath().getAbsolutePath() + File.separator + "RxTools.zip");
            if (fileZip.exists()) {
                RxFileTool.deleteFile(fileZip);
                Logger.d("导出文件已存在,将之删除");
            }

            if (fileDir != null) {
                if (fileDir.exists()) {
                    String result = RxZipTool.zipEncrypt(fileDir.getAbsolutePath(), fileZip.getAbsolutePath(), true, "123456");
                    mTvState.setText("压缩并加密成功,路径" + result);
                } else {
                    RxToast.error("导出的文件不存在");
                }
            } else {
                RxToast.error("导出的文件不存在");
            }
            break;
    }
}
 
Example 30
Source Project: Easer   Source File: EHService.java    License: GNU General Public License v3.0 5 votes vote down vote up
private void mSetTriggers() {
    final String TAG = "[EHService:mSetTriggers] ";
    Logger.v(TAG + "setting triggers");
    ScriptDataStorage storage = new ScriptDataStorage(this);
    logicGraph = storage.getLogicGraph();
    for (LogicGraph.LogicNode node : logicGraph.initialNodes()) {
        Logger.v(TAG + "setting trigger for <%s>", node.id);
        if (node.active) {
            activate(node);
            Logger.v(TAG + "trigger for script node <%s> is set", node.id);
        }
    }
    Logger.d(TAG + "triggers have been set");
}