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

The following examples show how to use com.grarak.kerneladiutor.utils.Utils#isTablet() . 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: 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 3
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 4
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 5
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 6
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 7
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 8
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 9
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 10
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 11
Source File: RecyclerViewFragment.java    From KernelAdiutor with GNU General Public License v3.0 5 votes vote down vote up
public int getSpanCount() {
    Activity activity;
    if ((activity = getActivity()) != null) {
        int span = Utils.isTablet(activity) ? Utils.getOrientation(activity) ==
                Configuration.ORIENTATION_LANDSCAPE ? 3 : 2 : Utils.getOrientation(activity) ==
                Configuration.ORIENTATION_LANDSCAPE ? 2 : 1;
        if (itemsSize() != 0 && span > itemsSize()) {
            span = itemsSize();
        }
        return span;
    }
    return 1;
}
 
Example 12
Source File: BackupFragment.java    From KernelAdiutor with GNU General Public License v3.0 5 votes vote down vote up
@Override
public int getSpanCount() {
    int span = Utils.isTablet(getActivity()) ? Utils.getOrientation(getActivity()) ==
            Configuration.ORIENTATION_LANDSCAPE ? 4 : 3 : Utils.getOrientation(getActivity()) ==
            Configuration.ORIENTATION_LANDSCAPE ? 3 : 2;
    if (itemsSize() != 0 && span > itemsSize()) {
        span = itemsSize();
    }
    return span;
}
 
Example 13
Source File: ProfileFragment.java    From KernelAdiutor with GNU General Public License v3.0 5 votes vote down vote up
@Override
public int getSpanCount() {
    int span = Utils.isTablet(getActivity()) ? Utils.getOrientation(getActivity()) ==
            Configuration.ORIENTATION_LANDSCAPE ? 4 : 3 : Utils.getOrientation(getActivity()) ==
            Configuration.ORIENTATION_LANDSCAPE ? 3 : 2;
    if (itemsSize() != 0 && span > itemsSize()) {
        span = itemsSize();
    }
    return span;
}
 
Example 14
Source File: MemoryFragment.java    From KernelAdiutor with GNU General Public License v3.0 5 votes vote down vote up
@Override
public int getSpanCount() {
    int span = Utils.isTablet(getActivity()) ? Utils.getOrientation(getActivity()) ==
            Configuration.ORIENTATION_LANDSCAPE ? 5 : 4 : Utils.getOrientation(getActivity()) ==
            Configuration.ORIENTATION_LANDSCAPE ? 3 : 2;
    if (itemsSize() != 0 && span > itemsSize()) {
        span = itemsSize();
    }
    return span;
}