Java Code Examples for com.grarak.kerneladiutor.utils.Utils#getScreenOrientation()

The following examples show how to use com.grarak.kerneladiutor.utils.Utils#getScreenOrientation() . 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: MainActivity.java    From KA27 with Apache License 2.0 6 votes vote down vote up
/**
 * A function to set Navigation Drawer Parameters
 *
 * @return the LayoutParams for the Drawer
 */
private DrawerLayout.LayoutParams getDrawerParams() {
    DrawerLayout.LayoutParams params = (DrawerLayout.LayoutParams) mScrimInsetsFrameLayout.getLayoutParams();
    int width = getResources().getDisplayMetrics().widthPixels;

    boolean tablet = Utils.isTablet(this);
    int actionBarSize = Utils.getActionBarHeight(this);
    if (Utils.getScreenOrientation(this) == Configuration.ORIENTATION_LANDSCAPE) {
        params.width = width / 2;
        if (tablet)
            params.width -= actionBarSize + (35 * getResources().getDisplayMetrics().density);
    } else params.width = tablet ? width / 2 : width - actionBarSize;

    // Allow configuration of the Navigation drawer to the right side rather than the left
    if (Utils.getBoolean("Navbar_Position_Alternate", false, this)) {
        params.gravity = Gravity.END;
    }

    return params;
}
 
Example 2
Source File: ParentFragment.java    From kernel_adiutor with Apache License 2.0 6 votes vote down vote up
@Override
public void resetTranslations() {
    parentFragment.toolbar.setBackgroundColor(Color.TRANSPARENT);
    parentFragment.viewContainerBackground.setBackgroundColor(Color.TRANSPARENT);
    parentFragment.descriptionText.setVisibility(View.GONE);

    int orientation = Utils.getScreenOrientation(getActivity());
    float density = getResources().getDisplayMetrics().density;

    float tabsPadding = orientation == Configuration.ORIENTATION_PORTRAIT ? 0 : density * 48;
    FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) parentFragment.mTabs.getLayoutParams();
    layoutParams.setMargins((int) tabsPadding, 0, (int) tabsPadding, 0);
    parentFragment.mTabs.requestLayout();

    setPaddingRecyclerview(orientation, density);
    if (onScrollListener != null) onScrollListener.reset();
    layoutManager.scrollToPositionWithOffset(0, 0);
}
 
Example 3
Source File: CPUVoltageFragment.java    From KA27 with Apache License 2.0 5 votes vote down vote up
@Override
public int getSpan() {
    int orientation = Utils.getScreenOrientation(getActivity());
    if (Utils.isTablet(getActivity()))
        return orientation == Configuration.ORIENTATION_LANDSCAPE ? 6 : 5;
    return orientation == Configuration.ORIENTATION_LANDSCAPE ? 4 : 3;
}
 
Example 4
Source File: RecyclerViewFragment.java    From KA27 with Apache License 2.0 5 votes vote down vote up
public int getSpan() {
    int orientation = Utils.getScreenOrientation(getActivity());
    if (Utils.isTV(getActivity())) return 2;
    if (Utils.isTablet(getActivity()))
        return orientation == Configuration.ORIENTATION_PORTRAIT ? 2 : 3;
    return orientation == Configuration.ORIENTATION_PORTRAIT ? 1 : 2;
}
 
Example 5
Source File: BackupFragment.java    From KA27 with Apache License 2.0 5 votes vote down vote up
@Override
public int getSpan() {
    int orientation = Utils.getScreenOrientation(getActivity());
    if (Utils.isTablet(getActivity()))
        return orientation == Configuration.ORIENTATION_LANDSCAPE ? 5 : 4;
    return orientation == Configuration.ORIENTATION_LANDSCAPE ? 3 : 2;
}
 
Example 6
Source File: ProfileFragment.java    From KA27 with Apache License 2.0 5 votes vote down vote up
@Override
public int getSpan() {
    int orientation = Utils.getScreenOrientation(getActivity());
    if (Utils.isTablet(getActivity()))
        return orientation == Configuration.ORIENTATION_LANDSCAPE ? 6 : 5;
    return orientation == Configuration.ORIENTATION_LANDSCAPE ? 4 : 3;
}
 
Example 7
Source File: CPUVoltageFragment.java    From kernel_adiutor with Apache License 2.0 5 votes vote down vote up
@Override
public int getSpan() {
    int orientation = Utils.getScreenOrientation(getActivity());
    if (Utils.isTablet(getActivity()))
        return orientation == Configuration.ORIENTATION_LANDSCAPE ? 6 : 5;
    return orientation == Configuration.ORIENTATION_LANDSCAPE ? 4 : 3;
}
 
Example 8
Source File: RecyclerViewFragment.java    From kernel_adiutor with Apache License 2.0 5 votes vote down vote up
public int getSpan() {
    int orientation = Utils.getScreenOrientation(getActivity());
    if (Utils.isTV(getActivity())) return 2;
    if (Utils.isTablet(getActivity()))
        return orientation == Configuration.ORIENTATION_PORTRAIT ? 2 : 3;
    return orientation == Configuration.ORIENTATION_PORTRAIT ? 1 : 2;
}
 
Example 9
Source File: BackupFragment.java    From kernel_adiutor with Apache License 2.0 5 votes vote down vote up
@Override
public int getSpan() {
    int orientation = Utils.getScreenOrientation(getActivity());
    if (Utils.isTablet(getActivity()))
        return orientation == Configuration.ORIENTATION_LANDSCAPE ? 5 : 4;
    return orientation == Configuration.ORIENTATION_LANDSCAPE ? 3 : 2;
}
 
Example 10
Source File: ProfileFragment.java    From kernel_adiutor with Apache License 2.0 5 votes vote down vote up
@Override
public int getSpan() {
    int orientation = Utils.getScreenOrientation(getActivity());
    if (Utils.isTablet(getActivity()))
        return orientation == Configuration.ORIENTATION_LANDSCAPE ? 6 : 5;
    return orientation == Configuration.ORIENTATION_LANDSCAPE ? 4 : 3;
}
 
Example 11
Source File: MainActivity.java    From kernel_adiutor with Apache License 2.0 5 votes vote down vote up
/**
 * A function to calculate the width of the Navigation Drawer
 * Phones and Tablets have different sizes
 *
 * @return the LayoutParams for the Drawer
 */
private DrawerLayout.LayoutParams getDrawerParams() {
    DrawerLayout.LayoutParams params = (DrawerLayout.LayoutParams) mScrimInsetsFrameLayout.getLayoutParams();
    int width = getResources().getDisplayMetrics().widthPixels;

    boolean tablet = Utils.isTablet(this);
    int actionBarSize = Utils.getActionBarHeight(this);
    if (Utils.getScreenOrientation(this) == Configuration.ORIENTATION_LANDSCAPE) {
        params.width = width / 2;
        if (tablet)
            params.width -= actionBarSize + (35 * getResources().getDisplayMetrics().density);
    } else params.width = tablet ? width / 2 : width - actionBarSize;

    return params;
}
 
Example 12
Source File: FrequencyTableFragment.java    From KA27 with Apache License 2.0 4 votes vote down vote up
@Override
public int getSpan() {
    return Utils.getScreenOrientation(getActivity()) == Configuration.ORIENTATION_PORTRAIT ? 1 : 2;
}
 
Example 13
Source File: FrequencyTableFragment.java    From kernel_adiutor with Apache License 2.0 4 votes vote down vote up
@Override
public int getSpan() {
    return Utils.getScreenOrientation(getActivity()) == Configuration.ORIENTATION_PORTRAIT ? 1 : 2;
}