package com.kevoroid.andhackernews.ui.settings;

import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.kevoroid.andhackernews.R;
import com.kevoroid.andhackernews.ui.BaseFragment;

public class SettingsFragment extends BaseFragment {

	private ActionBar actionBar;

	public static SettingsFragment newInstance() {

		Bundle args = new Bundle();

		SettingsFragment fragment = new SettingsFragment();
		fragment.setArguments(args);
		return fragment;
	}

	@Override
	public void onCreate(@Nullable Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	}

	@Override
	public void onStart() {
		super.onStart();
		if (getActivity() != null) {
			actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
		}
		if (actionBar != null) {
			actionBar.setTitle(R.string.label_settings);
			actionBar.setDisplayHomeAsUpEnabled(true);
		}
	}

	@Nullable
	@Override
	public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
		View v = inflater.inflate(R.layout.settings_fragment, container, false);
		return v;
	}
}

@@ -64,24 +64,47 @@
 .os.Bundle;%0A
+import android.view.*;%0A
 import andro
@@ -272,122 +272,45 @@
 roid
-.view.LayoutInflater;%0Aimport android.view.View;%0Aimport android.view.ViewGroup;%0Aimport com.kevoroid.andhackernews.R
+x.preference.PreferenceFragmentCompat
 ;%0Aim
@@ -345,23 +345,9 @@
 ews.
-ui.BaseFragment
+R
 ;%0A%0Ap
@@ -387,11 +387,17 @@
 nds 
-Bas
+Preferenc
 eFra
@@ -401,16 +401,22 @@
 Fragment
+Compat
  %7B%0A%0A%09pri
@@ -666,19 +666,20 @@
 eate
-(@Nullable 
+Preferences(
 Bund
@@ -703,46 +703,197 @@
 tate
-) %7B%0A%09%09super.onCreate(savedInstanceStat
+, String rootKey) %7B%0A%09%09//setPreferencesFromResource(R.xml.preferences, rootKey); // Not using this yet cause Settings layout is empty and provided via onCreateView();%0A%09%09setHasOptionsMenu(tru
 e);%0A
@@ -1347,16 +1347,14 @@
 %7B%0A%09%09
-View v =
+return
  inf
@@ -1419,17 +1419,150 @@
 );%0A%09
-%09return v
+%7D%0A%0A%09@Override%0A%09public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) %7B%0A%09%09inflater.inflate(R.menu.overflow, menu)
 ;%0A%09%7D

refactor of settings screen to use androidx PreferenceFragmentCompat