import{_ as s,o as e,c as n,a}from"./app.78a03919.js";const o={},l=a(`<h1 id="modulepreferencefragment-class" tabindex="-1"><a class="header-anchor" href="#modulepreferencefragment-class" aria-hidden="true">#</a> ModulePreferenceFragment <span class="symbol">- class</span></h1><div class="language-kotlin ext-kt"><pre class="shiki" style="background-color:#22272e;"><code><span class="line"><span style="color:#F47067;">abstract</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">class</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">ModulePreferenceFragment</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">:</span><span style="color:#ADBAC7;"> </span><span style="color:#6CB6FF;">PreferenceFragmentCompat</span><span style="color:#ADBAC7;">(), </span><span style="color:#F69D50;">SharedPreferences</span><span style="color:#ADBAC7;">.</span><span style="color:#F69D50;">OnSharedPreferenceChangeListener</span></span>
<span class="line"></span></code></pre></div><p><strong>\u53D8\u66F4\u8BB0\u5F55</strong></p><p><code>v1.0.78</code> <code>\u65B0\u589E</code></p><p><strong>\u529F\u80FD\u63CF\u8FF0</strong></p><blockquote><p>\u8FD9\u662F\u5BF9\u4F7F\u7528 <code>YukiHookAPI</code> Xposed \u6A21\u5757\u5B9E\u73B0\u4E2D\u7684\u4E00\u4E2A\u6269\u5C55\u529F\u80FD\u3002</p></blockquote><p>\u6B64\u7C7B\u63A5\u7BA1\u4E86 <code>PreferenceFragmentCompat</code> \u5E76\u5BF9\u5176\u5B9E\u73B0\u4E86 Sp \u5B58\u50A8\u5728 Xposed \u6A21\u5757\u4E2D\u7684\u5168\u5C40\u53EF\u8BFB\u53EF\u5199\u3002</p><p>\u5728\u4F60\u4F7F\u7528 <code>PreferenceFragmentCompat</code> \u7684\u5B9E\u4F8B\u4E2D\uFF0C\u5C06\u7EE7\u627F\u5BF9\u8C61\u6362\u6210\u6B64\u7C7B\u3002</p><p>\u7136\u540E\u8BF7\u5C06\u91CD\u5199\u65B9\u6CD5\u7531 <code>onCreatePreferences</code> \u66FF\u6362\u4E3A <code>onCreatePreferencesInModuleApp</code> \u5373\u53EF\u3002</p><p><strong>\u529F\u80FD\u793A\u4F8B</strong></p><p>\u4F7F\u7528 <code>ModulePreferenceFragment</code> \u521B\u5EFA\u4E00\u4E2A <code>PreferenceFragmentCompat</code> \u5BF9\u8C61\u3002</p><blockquote><p>\u793A\u4F8B\u5982\u4E0B</p></blockquote><div class="language-kotlin ext-kt line-numbers-mode"><pre class="shiki" style="background-color:#22272e;"><code><span class="line"><span style="color:#F47067;">class</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">SettingsFragment</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">:</span><span style="color:#ADBAC7;"> </span><span style="color:#6CB6FF;">ModulePreferenceFragment</span><span style="color:#ADBAC7;">() {</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F47067;">override</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">fun</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">onCreatePreferencesInModuleApp</span><span style="color:#ADBAC7;">(savedInstanceState</span><span style="color:#F47067;">:</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">Bundle?</span><span style="color:#ADBAC7;">, rootKey</span><span style="color:#F47067;">:</span><span style="color:#ADBAC7;"> </span><span style="color:#6CB6FF;">String?</span><span style="color:#ADBAC7;">) {</span></span>
<span class="line"><span style="color:#ADBAC7;">        setPreferencesFromResource(</span><span style="color:#F69D50;">R</span><span style="color:#ADBAC7;">.xml.settings_preferences, rootKey)</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Your code here.</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"><span style="color:#ADBAC7;">}</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>\u5176\u4F59\u7528\u6CD5\u4E0E <code>PreferenceFragmentCompat</code> \u4FDD\u6301\u4E00\u81F4\u3002</p><h2 id="oncreatepreferencesinmoduleapp-method" tabindex="-1"><a class="header-anchor" href="#oncreatepreferencesinmoduleapp-method" aria-hidden="true">#</a> onCreatePreferencesInModuleApp <span class="symbol">- method</span></h2><div class="language-kotlin ext-kt"><pre class="shiki" style="background-color:#22272e;"><code><span class="line"><span style="color:#F47067;">abstract</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">fun</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">onCreatePreferencesInModuleApp</span><span style="color:#ADBAC7;">(savedInstanceState</span><span style="color:#F47067;">:</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">Bundle?</span><span style="color:#ADBAC7;">, rootKey</span><span style="color:#F47067;">:</span><span style="color:#ADBAC7;"> </span><span style="color:#6CB6FF;">String?</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"></span></code></pre></div><p><strong>\u53D8\u66F4\u8BB0\u5F55</strong></p><p><code>v1.0.78</code> <code>\u65B0\u589E</code></p><p><strong>\u529F\u80FD\u63CF\u8FF0</strong></p><blockquote><p>\u5BF9\u63A5\u539F\u59CB\u65B9\u6CD5 <code>onCreatePreferences</code>\u3002</p></blockquote><h2 id="onsharedpreferencechanged-method" tabindex="-1"><a class="header-anchor" href="#onsharedpreferencechanged-method" aria-hidden="true">#</a> onSharedPreferenceChanged <span class="symbol">- method</span></h2><div class="language-kotlin ext-kt"><pre class="shiki" style="background-color:#22272e;"><code><span class="line"><span style="color:#F47067;">override</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">fun</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">onSharedPreferenceChanged</span><span style="color:#ADBAC7;">(sharedPreferences</span><span style="color:#F47067;">:</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">SharedPreferences?</span><span style="color:#ADBAC7;">, key</span><span style="color:#F47067;">:</span><span style="color:#ADBAC7;"> </span><span style="color:#6CB6FF;">String?</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"></span></code></pre></div><p><strong>\u53D8\u66F4\u8BB0\u5F55</strong></p><p><code>v1.0.78</code> <code>\u65B0\u589E</code></p><p><strong>\u529F\u80FD\u63CF\u8FF0</strong></p><blockquote><p>\u5B9E\u73B0\u4E86 <code>SharedPreferences.OnSharedPreferenceChangeListener</code> \u7684\u539F\u751F\u76D1\u542C\u529F\u80FD\u3002</p></blockquote><p><strong>\u529F\u80FD\u793A\u4F8B</strong></p><div class="custom-container warning"><p class="custom-container-title">\u6CE8\u610F</p><p>\u5728\u4F7F\u7528 <strong>onSharedPreferenceChanged</strong> \u65F6\u8BF7\u4FDD\u7559 super \u65B9\u6CD5\u3002</p></div><blockquote><p>\u793A\u4F8B\u5982\u4E0B</p></blockquote><div class="language-kotlin ext-kt line-numbers-mode"><pre class="shiki" style="background-color:#22272e;"><code><span class="line"><span style="color:#F47067;">class</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">SettingsFragment</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">:</span><span style="color:#ADBAC7;"> </span><span style="color:#6CB6FF;">ModulePreferenceFragment</span><span style="color:#ADBAC7;">() {</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F47067;">override</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">fun</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">onCreatePreferencesInModuleApp</span><span style="color:#ADBAC7;">(savedInstanceState</span><span style="color:#F47067;">:</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">Bundle?</span><span style="color:#ADBAC7;">, rootKey</span><span style="color:#F47067;">:</span><span style="color:#ADBAC7;"> </span><span style="color:#6CB6FF;">String?</span><span style="color:#ADBAC7;">) {</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// ...</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F47067;">override</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">fun</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">onSharedPreferenceChanged</span><span style="color:#ADBAC7;">(sharedPreferences</span><span style="color:#F47067;">:</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">SharedPreferences?</span><span style="color:#ADBAC7;">, key</span><span style="color:#F47067;">:</span><span style="color:#ADBAC7;"> </span><span style="color:#6CB6FF;">String?</span><span style="color:#ADBAC7;">) {</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#6CB6FF;">super</span><span style="color:#ADBAC7;">.onSharedPreferenceChanged(sharedPreferences, key)</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Your code here.</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"><span style="color:#ADBAC7;">}</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div>`,30),p=[l];function r(c,t){return e(),n("div",null,p)}const i=s(o,[["render",r],["__file","ModulePreferenceFragment.html.vue"]]);export{i as default};
