import{_ as e,o as s,c as o,a}from"./app.78a03919.js";const n={},l=a(`<h1 id="xposed-\u6A21\u5757\u6570\u636E\u5B58\u50A8" tabindex="-1"><a class="header-anchor" href="#xposed-\u6A21\u5757\u6570\u636E\u5B58\u50A8" aria-hidden="true">#</a> Xposed \u6A21\u5757\u6570\u636E\u5B58\u50A8</h1><blockquote><p>\u8FD9\u662F\u4E00\u4E2A\u81EA\u52A8\u5BF9\u63A5 <code>SharedPreferences</code> \u548C <code>XSharedPreferences</code> \u7684\u9AD8\u6548\u6A21\u5757\u6570\u636E\u5B58\u50A8\u89E3\u51B3\u65B9\u6848\u3002</p></blockquote><p>\u6211\u4EEC\u9700\u8981\u5B58\u50A8\u6A21\u5757\u7684\u6570\u636E\uFF0C\u4EE5\u4F9B\u5BBF\u4E3B\u8C03\u7528\uFF0C\u8FD9\u4E2A\u65F6\u5019\u4F1A\u9047\u5230\u539F\u751F <code>Sp</code> \u5B58\u50A8\u7684\u6570\u636E\u4E92\u901A\u963B\u788D\u3002</p><p>\u539F\u751F\u7684 <code>Xposed</code> \u7ED9\u6211\u4EEC\u63D0\u4F9B\u4E86\u4E00\u4E2A <code>XSharedPreferences</code> \u7528\u4E8E\u8BFB\u53D6\u6A21\u5757\u7684 <code>Sp</code> \u6570\u636E\u3002</p><h2 id="\u5728-activity-\u4E2D\u4F7F\u7528" tabindex="-1"><a class="header-anchor" href="#\u5728-activity-\u4E2D\u4F7F\u7528" aria-hidden="true">#</a> \u5728 Activity \u4E2D\u4F7F\u7528</h2><blockquote><p>\u8FD9\u91CC\u63CF\u8FF0\u4E86\u5728 <code>Activity</code> \u4E2D\u88C5\u8F7D <code>YukiHookModulePrefs</code> \u7684\u573A\u666F\u3002</p></blockquote><p>\u901A\u5E38\u60C5\u51B5\u4E0B\u6211\u4EEC\u53EF\u4EE5\u8FD9\u6837\u5728 Hook APP (\u5BBF\u4E3B) \u5185\u5BF9\u5176\u8FDB\u884C\u521D\u59CB\u5316\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:#F69D50;">XSharedPreferences</span><span style="color:#ADBAC7;">(</span><span style="color:#F69D50;">BuildConfig</span><span style="color:#ADBAC7;">.</span><span style="color:#F69D50;">APPLICATION_ID</span><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></div><p>\u6709\u6CA1\u6709\u65B9\u4FBF\u5FEB\u6377\u7684\u89E3\u51B3\u65B9\u6848\u5462\uFF0C\u6B64\u65F6\u4F60\u5C31\u53EF\u4EE5\u4F7F\u7528 <code>YukiHookAPI</code> \u7684\u6269\u5C55\u80FD\u529B\u5FEB\u901F\u5B9E\u73B0\u8FD9\u4E2A\u529F\u80FD\u3002</p><p>\u5F53\u4F60\u5728\u6A21\u5757\u4E2D\u5B58\u50A8\u6570\u636E\u7684\u65F6\u5019\uFF0C\u82E5\u5F53\u524D\u5904\u4E8E <code>Activity</code> \u5185\uFF0C\u53EF\u4EE5\u4F7F\u7528\u5982\u4E0B\u65B9\u6CD5\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:#ADBAC7;">modulePrefs.putString(</span><span style="color:#96D0FF;">&quot;test_name&quot;</span><span style="color:#ADBAC7;">, </span><span style="color:#96D0FF;">&quot;saved_value&quot;</span><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></div><p>\u5F53\u4F60\u5728 Hook APP (\u5BBF\u4E3B) \u4E2D\u8BFB\u53D6\u6570\u636E\u65F6\uFF0C\u53EF\u4EE5\u4F7F\u7528\u5982\u4E0B\u65B9\u6CD5\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;">val</span><span style="color:#ADBAC7;"> testName </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> prefs.getString(</span><span style="color:#96D0FF;">&quot;test_name&quot;</span><span style="color:#ADBAC7;">, </span><span style="color:#96D0FF;">&quot;default_value&quot;</span><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></div><p>\u4F60\u4E0D\u9700\u8981\u8003\u8651\u4F20\u5165\u6A21\u5757\u7684\u5305\u540D\u4EE5\u53CA\u4E00\u7CFB\u5217\u590D\u6742\u7684\u6743\u9650\u914D\u7F6E\uFF0C\u4E00\u5207\u90FD\u4EA4\u7ED9 <code>YukiHookModulePrefs</code> \u6765\u5904\u7406\u3002</p><p>\u82E5\u8981\u5B9E\u73B0\u5B58\u50A8\u7684\u533A\u57DF\u5212\u5206\uFF0C\u4F60\u53EF\u4EE5\u6307\u5B9A\u6BCF\u4E2A <code>prefs</code> \u6587\u4EF6\u7684\u540D\u79F0\u3002</p><p>\u5728\u6A21\u5757\u7684 <code>Activity</code> \u4E2D\u8FD9\u6837\u4F7F\u7528\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:#768390;">// \u63A8\u8350\u7528\u6CD5</span></span>
<span class="line"><span style="color:#ADBAC7;">modulePrefs(</span><span style="color:#96D0FF;">&quot;specify_file_name&quot;</span><span style="color:#ADBAC7;">).putString(</span><span style="color:#96D0FF;">&quot;test_name&quot;</span><span style="color:#ADBAC7;">, </span><span style="color:#96D0FF;">&quot;saved_value&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#768390;">// \u4E5F\u53EF\u4EE5\u8FD9\u6837\u7528</span></span>
<span class="line"><span style="color:#ADBAC7;">modulePrefs.name(</span><span style="color:#96D0FF;">&quot;specify_file_name&quot;</span><span style="color:#ADBAC7;">).putString(</span><span style="color:#96D0FF;">&quot;test_name&quot;</span><span style="color:#ADBAC7;">, </span><span style="color:#96D0FF;">&quot;saved_value&quot;</span><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></div><p>\u5728 Hook APP (\u5BBF\u4E3B) \u4E2D\u8FD9\u6837\u8BFB\u53D6\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:#768390;">// \u63A8\u8350\u7528\u6CD5</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> testName </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> prefs(</span><span style="color:#96D0FF;">&quot;specify_file_name&quot;</span><span style="color:#ADBAC7;">).getString(</span><span style="color:#96D0FF;">&quot;test_name&quot;</span><span style="color:#ADBAC7;">, </span><span style="color:#96D0FF;">&quot;default_value&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#768390;">// \u4E5F\u53EF\u4EE5\u8FD9\u6837\u7528</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> testName </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> prefs.name(</span><span style="color:#96D0FF;">&quot;specify_file_name&quot;</span><span style="color:#ADBAC7;">).getString(</span><span style="color:#96D0FF;">&quot;test_name&quot;</span><span style="color:#ADBAC7;">, </span><span style="color:#96D0FF;">&quot;default_value&quot;</span><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></div><p>\u82E5\u4F60\u7684\u9879\u76EE\u4E2D\u6709\u5927\u91CF\u7684\u56FA\u5B9A\u6570\u636E\u9700\u8981\u5B58\u50A8\u548C\u8BFB\u53D6\uFF0C\u63A8\u8350\u4F7F\u7528 <code>PrefsData</code> \u6765\u521B\u5EFA\u6A21\u677F\u3002</p><div class="custom-container tip"><p class="custom-container-title">\u5C0F\u63D0\u793A</p><p>\u66F4\u591A\u529F\u80FD\u8BF7\u53C2\u8003 <a href="../public/com/highcapable/yukihookapi/hook/xposed/prefs/YukiHookModulePrefs">YukiHookModulePrefs</a>\u3001<a href="../public/com/highcapable/yukihookapi/hook/xposed/prefs/data/PrefsData">PrefsData</a>\u3002</p></div><h2 id="\u5728-preferencefragment-\u4E2D\u4F7F\u7528" tabindex="-1"><a class="header-anchor" href="#\u5728-preferencefragment-\u4E2D\u4F7F\u7528" aria-hidden="true">#</a> \u5728 PreferenceFragment \u4E2D\u4F7F\u7528</h2><blockquote><p>\u8FD9\u91CC\u63CF\u8FF0\u4E86\u5728 <code>PreferenceFragment</code> \u4E2D\u88C5\u8F7D <code>YukiHookModulePrefs</code> \u7684\u573A\u666F\u3002</p></blockquote><p>\u82E5\u4F60\u7684\u6A21\u5757\u4F7F\u7528\u4E86 <code>PreferenceFragmentCompat</code>\uFF0C\u4F60\u73B0\u5728\u53EF\u4EE5\u5C06\u5176\u7EE7\u627F\u7C7B\u5F00\u59CB\u8FC1\u79FB\u5230 <code>ModulePreferenceFragment</code>\u3002</p><div class="custom-container danger"><p class="custom-container-title">\u7279\u522B\u6CE8\u610F</p><p>\u4F60\u5FC5\u987B\u7EE7\u627F <strong>ModulePreferenceFragment</strong> \u624D\u80FD\u5B9E\u73B0 <strong>YukiHookModulePrefs</strong> \u7684\u6A21\u5757\u5B58\u50A8\u529F\u80FD\u3002</p></div><div class="custom-container tip"><p class="custom-container-title">\u5C0F\u63D0\u793A</p><p>\u66F4\u591A\u529F\u80FD\u8BF7\u53C2\u8003 <a href="../public/com/highcapable/yukihookapi/hook/xposed/prefs/ui/ModulePreferenceFragment">ModulePreferenceFragment</a>\u3002</p></div>`,31),p=[l];function c(t,r){return s(),o("div",null,p)}const d=e(n,[["render",c],["__file","xposed-storage.html.vue"]]);export{d as default};
