[Samsung Galaxy J5 Guides, News, & Discussion] prototype74:
Source view in Java language

Just for users and developers who wanna know how all methods, variables etc. are coded

Samsung Experience 8.5 Nougat:

SecSettings2.apk

1. SecSettings2/app/src/main/java/android/support/v7/preference/PreferenceCategory.java:

...
import android.util.AttributeSet;

public class PreferenceCategory extends PreferenceGroup {
public PreferenceCategory(Context context) {
this(context, null);
}

public PreferenceCategory(Context context, AttributeSet attributeSet) {
this(context, attributeSet, TypedArrayUtils.getAttr(context, R$attr.preferenceCategoryStyle, 16842892));
}

public PreferenceCategory(Context context, AttributeSet attributeSet, int i) {
this(context, attributeSet, i, 0);
}

public PreferenceCategory(Context context, AttributeSet attributeSet, int i, int i2) {
super(context, attributeSet, i, i2);
}

public boolean isEnabled() {
return false;
}
...

2. SecSettings2/app/src/main/java/android/support/v7/preference/R$attr.java:

public final class R$attr {
public static final int dialogPreferenceStyle = 2130772243;
public static final int dropdownPreferenceStyle = 2130772246;
public static final int preferenceCategoryStyle = 2130772238;
public static final int preferenceFragmentStyle = 2130772236;
public static final int preferenceScreenStyle = 2130772234;
public static final int preferenceStyle = 2130772239;
public static final int preferenceTheme = 2130772233;
public static final int switchPreferenceStyle = 2130772253;
}

3. SecSettings2/app/src/main/java/com/android/settings/DisplaySettings.java:

if (!NightDisplayController.isAvailable(activity)) {
this.mNightDisplayPreference = (SwitchPreference) findPreference("night_display");
this.mNightDisplayPreference.setOnPreferenceChangeListener(this);
}

4. SecSettings2/app/src/main/java/com/samsung/android/settings/display/SecDisplaySettings.java:

...
import com.android.internal.app.NightDisplayController;
import com.android.internal.app.NightDisplayController.Callback;
...
public class SecDisplaySettings extends SecSettingsPreferenceFragment implements Callback, OnPreferenceChangeListener, Indexable {
...

...
private NightDisplayController mController;
...
IEmCallback mEmCallback = new IEmCallback() {
public void onStateReceived() {
...
secDisplaySettings.onPreferenceChange(-get20, str);
secDisplaySettings.onPreferenceNightDisplayChange(-get20, str); // Belongs to SecDisplaySettings.java; we see it inside SecDisplaySettings$19.smali
...
}
};
...
private SwitchPreference mNightDisplayPreference;
...
public void onActivatedNightDisplay(boolean z) {
this.mNightDisplayPreference.setChecked(z);
}
...
public void onCreateNightDisplay(Bundle bundle) {
this.mController = new NightDisplayController(getContext());
}
...
public void onPreferenceNightDisplayChange(Preference preference, Object obj) {
if (preference == this.mNightDisplayPreference) {
Secure.putInt(getContentResolver(), "night_display_activated", ((Boolean) obj).booleanValue() ? 1 : 0);
}
}
...
public void onStartNightDisplay() {
this.mController.setListener(this);
onActivatedNightDisplay(this.mController.isActivated());
}

public void onStopNightDisplay() {
this.mController.setListener(null);
}
...
public void onCreate(Bundle bundle) {
Iterable<String> removePreferenceInOtherMode;
CharSequence string;
boolean z;
super.onCreate(bundle);
onCreateNightDisplay(bundle); //Calling onCreateNightDisplay method
Context activity = getActivity();
...
this.mNightDisplayPreference = (SwitchPreference) findPreference("night_display_activated");
if (this.mNightDisplayPreference != null) {
this.mNightDisplayPreference.setOnPreferenceChangeListener(this);
onStartNightDisplay();
}
...
}
...
public void onPause() {
super.onPause();
onStopNightDisplay();
...
}
...
public boolean onPreferenceChange(Preference preference, Object obj) {
boolean booleanValue;
int i;
int[] samsungNTTHomeDefaultBrightness;
ComponentName componentName;
ComponentName homeActivities;
onPreferenceNightDisplayChange(preference, obj); //Calls onPreferenceNightDisplayChange to set night_display_activated value to 0 or 1
String key = preference.getKey();
int parseInt;
...
}
...
}

---------------------------------------------------

Samsung Experience 9.0 Oreo:

1. SecSettings/app/src/main/java/com/samsung/android/settings/display/SecDisplaySettings.java:

...
import com.android.internal.app.NightDisplayController;
import com.android.internal.app.NightDisplayController.Callback;
...
public class SecDisplaySettings extends SettingsPreferenceFragment implements Callback, OnPreferenceChangeListener, Indexable {
...

...
private NightDisplayController mController;
...
IEmCallback mEmCallback = new IEmCallback() {
public void onStateReceived() {
...
secDisplaySettings.onPreferenceChange(-get19, str);
secDisplaySettings.onPreferenceNightDisplayChange(-get19, str); // Belongs to SecDisplaySettings.java; we see it inside SecDisplaySettings$19.smali
...
}
};
...
private SecSettingsSwitchPreference mNightDisplayPreference;
...
public void onActivatedNightDisplay(boolean z) {
this.mNightDisplayPreference.setChecked(z);
}
...
public void onCreateNightDisplay(Bundle bundle) {
this.mController = new NightDisplayController(getContext());
}
...
public void onPreferenceNightDisplayChange(Preference preference, Object obj) {
if (preference == this.mNightDisplayPreference) {
Secure.putInt(getContentResolver(), "night_display_activated", ((Boolean) obj).booleanValue() ? 1 : 0);
}
}
...
public void onStartNightDisplay() {
this.mController.setListener(this);
onActivatedNightDisplay(this.mController.isActivated());
}

public void onStopNightDisplay() {
this.mController.setListener(null);
}
...
public void onCreate(android.os.Bundle) {
Iterable<String> removePreferenceInOtherMode;
CharSequence string;
boolean z;
super.onCreate(bundle);
onCreateNightDisplay(bundle); //Calling onCreateNightDisplay method
Context activity = getActivity();
...
this.mNightDisplayPreference = (SecSettingsSwitchPreference) findPreference("night_display_activated");
if (this.mNightDisplayPreference != null) {
this.mNightDisplayPreference.setOnPreferenceChangeListener(this);
onStartNightDisplay();
}
}
...
public void onPause() {
super.onPause();
onStopNightDisplay();
...
}
...
public boolean onPreferenceChange(Preference preference, Object obj) {
boolean booleanValue;
onPreferenceNightDisplayChange(preference, obj); //Calls onPreferenceNightDisplayChange to set night_display_activated value to 0 or 1
String key = preference.getKey();
int parseInt;
...
}
...
}