hugo.weaving.DebugLog Java Examples

The following examples show how to use hugo.weaving.DebugLog. 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: SubPresenter.java    From Meteorite with Apache License 2.0 6 votes vote down vote up
@DebugLog
@Override
public void dealContent(String type, int pageIndex, int pageSize) {
    view.showLoading();
    modle.getContent(type, pageIndex, pageSize, new ICallBack<ArrayList<GankBean>>() {
        @Override
        public void onSusscess(ArrayList<GankBean> result) {
            view.onContentSuccess(result);
        }

        @Override
        public void onError() {
            view.showError();
        }
    });
    view.hideLoading();
}
 
Example #2
Source File: FileManager.java    From amiibo with GNU General Public License v2.0 6 votes vote down vote up
@DebugLog
private void createAmiiboFolder() {
    MetadataChangeSet changeSet = new MetadataChangeSet.Builder()
            .setTitle(AMIIBO_FOLDER).build();

    Drive.DriveApi.getRootFolder(_parent.getClient())
            .createFolder(_parent.getClient(), changeSet)
            .setResultCallback(new ResultCallback<DriveFolder.DriveFolderResult>() {
                @Override
                public void onResult(DriveFolder.DriveFolderResult driveFolderResult) {
                    if (driveFolderResult.getStatus().isSuccess()) {
                        app_folder_for_user = driveFolderResult.getDriveFolder();
                        listFiles();
                    } else {
                        app_folder_for_user = null;
                        _parent.onPushFinished();
                    }
                }
            });
}
 
Example #3
Source File: MainActivity.java    From android-hpe with MIT License 6 votes vote down vote up
/**
 * Checks if the app has permission to write to device storage or open camera
 * If the app does not has permission then the user will be prompted to grant permissions
 *
 * @param activity
 */
@DebugLog
private static boolean verifyPermissions(Activity activity) {
    // Check if we have write permission
    int write_permission = ActivityCompat.checkSelfPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE);
    int read_permission = ActivityCompat.checkSelfPermission(activity, Manifest.permission.READ_EXTERNAL_STORAGE);
    int camera_permission = ActivityCompat.checkSelfPermission(activity, Manifest.permission.CAMERA);

    if (write_permission != PackageManager.PERMISSION_GRANTED ||
            read_permission != PackageManager.PERMISSION_GRANTED ||
            camera_permission != PackageManager.PERMISSION_GRANTED) {
        // We don't have permission so prompt the user
        ActivityCompat.requestPermissions(
                activity,
                PERMISSIONS_REQ,
                REQUEST_CODE_PERMISSION
        );
        return false;
    } else {
        return true;
    }
}
 
Example #4
Source File: FileManager.java    From amiibo with GNU General Public License v2.0 6 votes vote down vote up
@DebugLog
public void readFileContent(final String file_name, final List<Metadata> remainings) {
    Query query = new Query.Builder()
            .addFilter(Filters.eq(SearchableField.TITLE, file_name))
            .build();

    app_folder_for_user.queryChildren(_parent.getClient(), query)
            .setResultCallback(new ResultCallback<DriveApi.MetadataBufferResult>() {
                @Override
                public void onResult(DriveApi.MetadataBufferResult metadataBufferResult) {
                    MetadataBuffer buffer = metadataBufferResult.getMetadataBuffer();
                    int count = buffer.getCount();
                    if (count > 0) {
                        readFileFromDrive(buffer, buffer.get(0).getDriveId());
                    } else {
                        _parent.onFileRead(null);
                    }

                    readFileContent(remainings);
                }
            });
}
 
Example #5
Source File: CameraConnectionFragment.java    From android-hpe with MIT License 6 votes vote down vote up
/**
 * Given {@code choices} of {@code Size}s supported by a camera, chooses the smallest one whose
 * width and height are at least as large as the respective requested values, and whose aspect
 * ratio matches with the specified value.
 *
 * @param choices     The list of sizes that the camera supports for the intended output class
 * @param width       The minimum desired width
 * @param height      The minimum desired height
 * @param aspectRatio The aspect ratio
 * @return The optimal {@code Size}, or an arbitrary one if none were big enough
 */
@SuppressLint("LongLogTag")
@DebugLog
private static Size chooseOptimalSize(
        final Size[] choices, final int width, final int height, final Size aspectRatio) {
    // Collect the supported resolutions that are at least as big as the preview Surface
    final List<Size> bigEnough = new ArrayList<Size>();
    for (final Size option : choices) {
        if (option.getHeight() >= MINIMUM_PREVIEW_SIZE && option.getWidth() >= MINIMUM_PREVIEW_SIZE) {
            Log.i(TAG, "Adding size: " + option.getWidth() + "x" + option.getHeight());
            bigEnough.add(option);
        } else {
            Log.i(TAG, "Not adding size: " + option.getWidth() + "x" + option.getHeight());
        }
    }

    // Pick the smallest of those, assuming we found any
    if (bigEnough.size() > 0) {
        final Size chosenSize = Collections.min(bigEnough, new CompareSizesByArea());
        Log.i(TAG, "Chosen size: " + chosenSize.getWidth() + "x" + chosenSize.getHeight());
        return chosenSize;
    } else {
        Log.e(TAG, "Couldn't find any suitable preview size");
        return choices[0];
    }
}
 
Example #6
Source File: CameraConnectionFragment.java    From android-hpe with MIT License 6 votes vote down vote up
/**
 * Closes the current {@link CameraDevice}.
 */
@DebugLog
private void closeCamera() {
    try {
        cameraOpenCloseLock.acquire();
        if (null != captureSession) {
            captureSession.close();
            captureSession = null;
        }
        if (null != cameraDevice) {
            cameraDevice.close();
            cameraDevice = null;
        }
        if (null != previewReader) {
            previewReader.close();
            previewReader = null;
        }
        if (null != mOnGetPreviewListener) {
            mOnGetPreviewListener.deInitialize();
        }
    } catch (final InterruptedException e) {
        throw new RuntimeException("Interrupted while trying to lock camera closing.", e);
    } finally {
        cameraOpenCloseLock.release();
    }
}
 
Example #7
Source File: MainActivity.java    From FilterMenu with Apache License 2.0 6 votes vote down vote up
@DebugLog
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    FilterMenuLayout layout1 = (FilterMenuLayout) findViewById(R.id.filter_menu1);
    attachMenu1(layout1);

    FilterMenuLayout layout2 = (FilterMenuLayout) findViewById(R.id.filter_menu2);
    attachMenu2(layout2);

    FilterMenuLayout layout3 = (FilterMenuLayout) findViewById(R.id.filter_menu3);
    attachMenu3(layout3);

    FilterMenuLayout layout4 = (FilterMenuLayout) findViewById(R.id.filter_menu4);
    attachMenu4(layout4);
}
 
Example #8
Source File: BasicAccountAuthenticator.java    From Mover with Apache License 2.0 5 votes vote down vote up
@Override
@DebugLog
public Bundle confirmCredentials(AccountAuthenticatorResponse response, Account account, Bundle options) throws NetworkErrorException {
    Intent intent = new Intent(ACTION_CONFIRM_CREDENTIALS)
            .putExtra(EXTRA_ACCOUNT, account)
            .putExtra(KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response)
            .putExtras(options);

    mExtras.clear();
    mExtras.putParcelable(KEY_INTENT, intent);
    return mExtras;
}
 
Example #9
Source File: PoiInfoWindowAdapter.java    From overpasser with Apache License 2.0 5 votes vote down vote up
@Override
@DebugLog
public View getInfoContents(Marker marker) {
    Element poi = getElement(marker);

    if (poi != null) {
        return createView(poi);

    } else {
        return null;
    }
}
 
Example #10
Source File: RatingHelper.java    From GameOfLife with MIT License 5 votes vote down vote up
@DebugLog
private Intent getViewIntent(Uri uri) {
    Intent intent = new Intent(Intent.ACTION_VIEW, uri);
    setFlags(intent);

    return intent;
}
 
Example #11
Source File: FragmentRepoList.java    From AndroidStarter with Apache License 2.0 5 votes vote down vote up
@DebugLog
@Override
public void setData(final RepoListMvp.Model poData) {
    ((RepoListMvp.ViewState) viewState).data = poData;

    SmartAdapter.items(poData.repos)
            .map(RepoEntity.class, CellRepo.class)
            .listener(FragmentRepoList.this)
            .into(mRecyclerView);
}
 
Example #12
Source File: CameraConnectionFragment.java    From android-hpe with MIT License 5 votes vote down vote up
/**
 * Configures the necessary {@link android.graphics.Matrix} transformation to `mTextureView`.
 * This method should be called after the camera preview size is determined in
 * setUpCameraOutputs and also the size of `mTextureView` is fixed.
 *
 * @param viewWidth  The width of `mTextureView`
 * @param viewHeight The height of `mTextureView`
 */
@DebugLog
private void configureTransform(final int viewWidth, final int viewHeight) {
    final Activity activity = getActivity();
    if (textureView == null || previewSize == null || activity == null) {
        return;
    }

    final int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();
    final Matrix matrix = new Matrix();
    final RectF viewRect = new RectF(0, 0, viewWidth, viewHeight);
    final RectF bufferRect = new RectF(0, 0, previewSize.getHeight(), previewSize.getWidth());
    final float centerX = viewRect.centerX();
    final float centerY = viewRect.centerY();
    if(rotation == Surface.ROTATION_90) {
        //Log.d(TAG, "Rotation is Surface.ROTATION_90");
        bufferRect.offset(centerX - bufferRect.centerX(), centerY - bufferRect.centerY());
        matrix.setRectToRect(viewRect, bufferRect, Matrix.ScaleToFit.FILL);
        final float scale =
                Math.max(
                        (float) viewHeight / previewSize.getHeight(),
                        (float) viewWidth / previewSize.getWidth());
        matrix.postScale(scale, scale, centerX, centerY);
        matrix.postRotate(-90, centerX, centerY);
    } /*else if(rotation == Surface.ROTATION_180) {
        Log.d(TAG, "Rotation is Surface.ROTATION_180");
        matrix.postRotate(180, centerX, centerY);
    } else if(rotation == Surface.ROTATION_270) {
        Log.d(TAG, "Rotation is Surface.ROTATION_270");
        bufferRect.offset(centerX - bufferRect.centerX(), centerY - bufferRect.centerY());
        matrix.setRectToRect(viewRect, bufferRect, Matrix.ScaleToFit.FILL);
        final float scale =
                Math.max(
                        (float) viewHeight / previewSize.getHeight(),
                        (float) viewWidth / previewSize.getWidth());
        matrix.postScale(scale, scale, centerX, centerY);
        matrix.postRotate(90 * (rotation - 2), centerX, centerY);
    }*/
    textureView.setTransform(matrix);
}
 
Example #13
Source File: DriveFragment.java    From amiibo with GNU General Public License v2.0 5 votes vote down vote up
@DebugLog
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
    if (connectionResult.hasResolution()) {
        try {
            connectionResult.startResolutionForResult(getActivity(),
                    RESOLVE_CONNECTION_REQUEST_CODE);
        } catch (IntentSender.SendIntentException e) {
            // Unable to resolve, message user appropriately
        }
    } else {
        GooglePlayServicesUtil
                .getErrorDialog(connectionResult.getErrorCode(), getActivity(), 0).show();
    }
}
 
Example #14
Source File: BasicAccountAuthenticator.java    From Mover with Apache License 2.0 5 votes vote down vote up
@Override
@DebugLog
public Bundle editProperties(AccountAuthenticatorResponse response, String accountType) {
    mExtras.clear();
    mExtras.putParcelable(KEY_INTENT, new Intent(ACTION_EDIT_ACCOUNT_PROPERTIES));
    return mExtras;
}
 
Example #15
Source File: AutomatonView.java    From GameOfLife with MIT License 5 votes vote down vote up
@Override
@DebugLog
public void surfaceCreated(SurfaceHolder holder) {
    if (thread == null || thread.getState() == Thread.State.TERMINATED) {
        thread = new AutomatonThread(automaton, holder, params);
        thread.start();
    }
    
    thread.setRunning(true);
}
 
Example #16
Source File: PresenterRepoList.java    From AndroidStarterAlt with Apache License 2.0 5 votes vote down vote up
@DebugLog
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventQueryGetRepos(@NonNull final QueryGetRepos.EventQueryGetReposDidFinish poEvent) {
    if (poEvent.success) {
        getRepos(poEvent.pullToRefresh);
    } else {
        final RepoListMvp.View loView = getView();
        if (isViewAttached() && loView != null) {
            loView.showError(poEvent.throwable, poEvent.pullToRefresh);
        }
    }
}
 
Example #17
Source File: FileManager.java    From amiibo with GNU General Public License v2.0 5 votes vote down vote up
@DebugLog
private void getAmiiboFolder() {
    Drive.DriveApi.getRootFolder(_parent.getClient())
            .listChildren(_parent.getClient())
            .setResultCallback(new ResultCallback<DriveApi.MetadataBufferResult>() {
                @Override
                public void onResult(DriveApi.MetadataBufferResult metadataBufferResult) {
                    boolean found = false;
                    try {
                        List<Metadata> files = new ArrayList<>();
                        MetadataBuffer buffer = metadataBufferResult.getMetadataBuffer();
                        Metadata data;

                        for (int i = 0; i < buffer.getCount(); i++) {
                            data = buffer.get(i);
                            if (data.getTitle().equals(AMIIBO_FOLDER) && data.isFolder()
                                    && !data.isTrashed()) {
                                app_folder_for_user = Drive.DriveApi
                                        .getFolder(_parent.getClient(), data.getDriveId());
                                Log.d("FileManager", data.getDriveId() + " " + data.getTitle());
                            }
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }

                    if (app_folder_for_user != null) {
                        listFiles();
                    } else {
                        createAmiiboFolder();
                    }
                }
            });
}
 
Example #18
Source File: ControllerRepoList.java    From AndroidStarterAlt with Apache License 2.0 5 votes vote down vote up
@DebugLog
@Override
public void onViewEvent(final int piActionID, final Repo poRepo, final int piPosition, final View poView) {
    if (piActionID == CellRepo.ROW_PRESSED) {
        final ControllerRepoDetail loVC = new ControllerRepoDetail(poRepo.getBaseId());
        final ControllerChangeHandler loChangeHandler = new CircularRevealChangeHandlerCompat(poView, mRecyclerView);
        final RouterTransaction loTransaction = RouterTransaction.with(loVC)
                .pushChangeHandler(loChangeHandler)
                .popChangeHandler(loChangeHandler);
        getRouter().pushController(loTransaction);
    }
}
 
Example #19
Source File: BasicAccountAuthenticator.java    From Mover with Apache License 2.0 5 votes vote down vote up
@Override
@DebugLog
public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) throws NetworkErrorException {
    mExtras.clear();

    Intent intent = new Intent(ACTION_AUTHENTICATE)
            .putExtra(KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response)
            .putExtra(KEY_ACCOUNT_TYPE, accountType)
            .putExtra(EXTRA_AUTH_TOKEN_TYPE, authTokenType)
            .putExtra(EXTRA_REQUIRED_FEATURES, requiredFeatures)
            .putExtras(options);

    mExtras.putParcelable(KEY_INTENT, intent);
    return mExtras;
}
 
Example #20
Source File: SyncService.java    From amiibo with GNU General Public License v2.0 5 votes vote down vote up
@DebugLog
public void init() {
    _state = State.STARTED;
    _file_manager.init(this);
    _file_manager.listFiles();
    checkState();
}
 
Example #21
Source File: CategoryFragment.java    From Mover with Apache License 2.0 5 votes vote down vote up
@DebugLog @Subscribe @SuppressWarnings("unused")
public void onLoadMoreItemsEvent(ScrollManager.LoadMoreItems items){
    if(isPageLoading() || !canLoadMorePages()){
        return;
    }

    mPendingJobId = mJobManager.addJob(new FetchCategoryPage(mSelectedCategory, mCurrentPageNumber + 1));
}
 
Example #22
Source File: TabFragment.java    From RecyclerViewSyncDemo with MIT License 5 votes vote down vote up
@DebugLog
@Nullable
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
    final View view = inflater.inflate(mLayoutResource, container, false);

    ButterKnife.bind(this, view);
    return view;
}
 
Example #23
Source File: FileManager.java    From amiibo with GNU General Public License v2.0 5 votes vote down vote up
@DebugLog
public void pushToDrive(List<Amiibo> amiibos) {
    if (amiibos.size() > 0) {
        Amiibo amiibo = amiibos.get(0);
        amiibos.remove(0);
        pushToDrive(amiibo, amiibos);
    } else {
        app_folder_for_user = null;
        _parent.onPushFinished();
    }
}
 
Example #24
Source File: CategoryFragment.java    From Mover with Apache License 2.0 5 votes vote down vote up
@DebugLog
public void renderMainPage(List<Video> recommends, List<Video> popular, List<Video> videos){
    mWatchMeAdapter.add(getString(R.string.section_recommendations), recommends, Math.min(recommends.size(), 3));
    mWatchMeAdapter.add(getString(R.string.section_popular), popular, Math.min(popular.size(), 3));
    mWatchMeAdapter.add(getString(R.string.section_last_added), videos, videos.size());

    if(!getScrollManager().isToolbarVisible()){
        ViewGroup toolbarWrapper = (ViewGroup) (getWatchMeActivity()).getToolbar()
                .getParent();

        getScrollManager().show(toolbarWrapper);
    }
}
 
Example #25
Source File: AutomatonView.java    From GameOfLife with MIT License 5 votes vote down vote up
@DebugLog
public void init(CellularAutomaton automaton, GameParams params) {
    this.automaton = automaton;
    this.params = params;

    SurfaceHolder surfaceHolder = getHolder();
    surfaceHolder.addCallback(this);
}
 
Example #26
Source File: CaptureService.java    From WearPay with GNU General Public License v2.0 5 votes vote down vote up
@Override
@DebugLog
public void onAccessibilityEvent(AccessibilityEvent event) {
    int eventType = event.getEventType();
    if (AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED == eventType) {
        if (WECHAT_WALLET_ACTIVITY_NAME.equals(event.getClassName())) {
            AccessibilityNodeInfo nodeInfo = getRootInActiveWindow();
            if (nodeInfo != null) {
                List<AccessibilityNodeInfo> infos = nodeInfo.findAccessibilityNodeInfosByViewId("com.tencent.mm:id/c6a");
                CharSequence text = infos.get(0).getText();
                Toast.makeText(this, text, Toast.LENGTH_SHORT).show();
            }
        }
    }
}
 
Example #27
Source File: GetCitiesImp.java    From MVPAndroidBootstrap with Apache License 2.0 5 votes vote down vote up
@Override
@Background
@DebugLog
public void getCities(Double latitude, Double longitude, Integer count, Callback callback) {
    this.callback = callback;
    try {
        List<City> cityList = cleanRepository.getCities(latitude, longitude, count);
        onItemsLoaded(cityList);
    } catch (GetCitiesException getCitiesException) {
        onError(getCitiesException);
    }
}
 
Example #28
Source File: DailyApplication.java    From Idaily with Apache License 2.0 5 votes vote down vote up
@DebugLog
@Override
public void onCreate() {
    super.onCreate();
    Logs.setIsDebug(BuildConfig.DEBUG);

    if (BuildConfig.DEBUG) {
        Timber.plant(new Timber.DebugTree());
        Timber.tag("daily");
    }

    appComponent = DaggerAppComponent.builder().appModule(new AppModule()).build();
    appComponent.inject(this);
}
 
Example #29
Source File: SimpleGridTransformer.java    From GameOfLife with MIT License 5 votes vote down vote up
@DebugLog
protected void applyNewGrid(Grid<T> grid) {
    for (int j = 0; j < grid.getSizeY(); j++) {
        for (int i = 0; i < grid.getSizeX(); i++) {
            grid.getCell(i, j).setState(stateChanges[j][i]);
        }
    }
}
 
Example #30
Source File: RatingHelper.java    From GameOfLife with MIT License 5 votes vote down vote up
@DebugLog
private String getReleasePackageName() {
    String packageName = activity.getPackageName();
    String buildType = BuildConfig.BUILD_TYPE;
    String buildTypeSuffix = "." + buildType;
    boolean notReleaseBuild = !"release".equals(buildType);

    if (notReleaseBuild && packageName.endsWith(buildTypeSuffix)) {
        packageName = packageName.replace(buildTypeSuffix, "");
    }

    return packageName;
}