Java Code Examples for hugo.weaving.DebugLog

The following examples show how to use hugo.weaving.DebugLog. 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: Meteorite   Source File: SubPresenter.java    License: 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 Project: android-hpe   Source File: CameraConnectionFragment.java    License: 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 3
Source Project: android-hpe   Source File: CameraConnectionFragment.java    License: 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 4
Source Project: android-hpe   Source File: MainActivity.java    License: 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 5
Source Project: amiibo   Source File: FileManager.java    License: 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 6
Source Project: amiibo   Source File: FileManager.java    License: 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 7
Source Project: FilterMenu   Source File: MainActivity.java    License: 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 Project: Mover   Source File: BasicAccountAuthenticator.java    License: 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 9
Source Project: Protein   Source File: MainActivity.java    License: Apache License 2.0 5 votes vote down vote up
@DebugLog
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    FirebaseCrashUtils.log("MainActivity created");
    setContentView(R.layout.activity_main);

    mainPresenter = new MainPresenter((MainView) findViewById(R.id.main_view));
    mainPresenter.start();
}
 
Example 10
Source Project: Protein   Source File: ProteinApp.java    License: Apache License 2.0 5 votes vote down vote up
@DebugLog
@Override
public void onCreate() {
    super.onCreate();
    ServiceGenerator.init(this);
    if (BuildConfig.DEBUG) {
        Stetho.initializeWithDefaults(this);
    }
    initAccessToken();
    ButterKnife.setDebug(BuildConfig.DEBUG);
    refWatcher = installLeakCanary();
}
 
Example 11
Source Project: Mover   Source File: BasicAccountAuthenticator.java    License: 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 12
Source Project: GameOfLife   Source File: RatingHelper.java    License: 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 13
Source Project: amiibo   Source File: FileManager.java    License: 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 14
Source Project: AndroidStarter   Source File: FragmentRepoList.java    License: Apache License 2.0 5 votes vote down vote up
@DebugLog
@Override
public void showLoading(final boolean pbPullToRefresh) {
    if (!pbPullToRefresh) {
        mSwitcher.showProgressView();
    }
}
 
Example 15
Source Project: amiibo   Source File: DriveFragment.java    License: 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 16
Source Project: AndroidStarter   Source File: FragmentRepoList.java    License: 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 17
Source Project: overpasser   Source File: PoiInfoWindowAdapter.java    License: 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 18
Source Project: AndroidStarter   Source File: AbstractQuery.java    License: Apache License 2.0 5 votes vote down vote up
@DebugLog
@Override
public void onAdded() {
    if (BuildConfig.DEBUG && DEBUG) {
        Logger.t(TAG).d("");
    }
}
 
Example 19
Source Project: amiibo   Source File: DriveFragment.java    License: GNU General Public License v2.0 5 votes vote down vote up
@DebugLog
public boolean onResult(final int requestCode, final int resultCode, final Intent data) {
    switch (requestCode) {
        case RESOLVE_CONNECTION_REQUEST_CODE:
            if (resultCode == Activity.RESULT_OK) {
                mGoogleApiClient.connect();
                return true;
            }
            break;
    }
    return false;
}
 
Example 20
Source Project: GameOfLife   Source File: AutomatonView.java    License: MIT License 5 votes vote down vote up
@DebugLog
private void waitForThreadToDie() {
    while (true) {
        try {
            thread.join();
            break;

        } catch (InterruptedException e) {
        }
    }
}
 
Example 21
Source Project: android-hpe   Source File: CameraConnectionFragment.java    License: 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 22
Source Project: GameOfLife   Source File: AutomatonView.java    License: 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 23
Source Project: AndroidStarterAlt   Source File: PresenterRepoList.java    License: 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 24
Source Project: AndroidStarterAlt   Source File: ControllerRepoList.java    License: 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 25
Source Project: Mover   Source File: BasicAccountAuthenticator.java    License: 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 26
Source Project: amiibo   Source File: SyncService.java    License: 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 27
Source Project: Mover   Source File: CategoryFragment.java    License: 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 28
Source Project: RecyclerViewSyncDemo   Source File: TabFragment.java    License: 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 29
Source Project: amiibo   Source File: FileManager.java    License: 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 30
Source Project: Mover   Source File: CategoryFragment.java    License: 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);
    }
}