Skip to content

Commit

Permalink
fix preference is not shown completely issue
Browse files Browse the repository at this point in the history
  • Loading branch information
zfdang committed Oct 30, 2020
1 parent 3dab9b2 commit 533f2d6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.preference.CheckBoxPreference;
import androidx.preference.EditTextPreference;
import androidx.preference.MultiSelectListPreference;
Expand Down Expand Up @@ -76,6 +78,22 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
packageManager = getActivity().getPackageManager();
}

@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = super.onCreateView(inflater, container, savedInstanceState);

// get the height of BottomNavigationView
int resourceId = getResources().getIdentifier("design_bottom_navigation_height", "dimen", getActivity().getPackageName());
int height = 147;
if (resourceId > 0) {
height = getResources().getDimensionPixelSize(resourceId);
}

// set bottom padding for the preference fragment, so that all parts could be shown properly
view.setPadding(view.getPaddingLeft(), view.getPaddingTop(), view.getPaddingRight(), view.getPaddingBottom() + height);
return view;
}

private void initPreferences() {

CheckBoxPreference notification = findPreference("skip_ad_notification");
Expand Down
5 changes: 0 additions & 5 deletions app/src/main/res/xml/touch_helper_preference.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@

</Preference>

<!-- placeholder-->
<Preference app:title=".">

</Preference>

</PreferenceCategory>

</PreferenceScreen>

0 comments on commit 533f2d6

Please sign in to comment.