PreferenceFragment.java
5.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
package android.support.v4.preference;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.preference.Preference;
import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;
import android.support.v4.app.Fragment;
import android.support.v4.preferencefragment.R.layout;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnKeyListener;
import android.view.ViewGroup;
import android.widget.ListView;
public abstract class PreferenceFragment
extends Fragment
{
private PreferenceManager a;
private ListView b;
private boolean c;
private boolean d;
private Handler e = new Handler()
{
public final void handleMessage(Message paramAnonymousMessage)
{
switch (paramAnonymousMessage.what)
{
default:
return;
}
PreferenceFragment.a(PreferenceFragment.this);
}
};
private final Runnable f = new Runnable()
{
public final void run()
{
PreferenceFragment.b(PreferenceFragment.this).focusableViewAvailable(PreferenceFragment.b(PreferenceFragment.this));
}
};
private View.OnKeyListener g = new View.OnKeyListener()
{
public final boolean onKey(View paramAnonymousView, int paramAnonymousInt, KeyEvent paramAnonymousKeyEvent)
{
if ((PreferenceFragment.b(PreferenceFragment.this).getSelectedItem() instanceof Preference)) {
PreferenceFragment.b(PreferenceFragment.this).getSelectedView();
}
return false;
}
};
private void a()
{
PreferenceScreen localPreferenceScreen = getPreferenceScreen();
if (localPreferenceScreen != null) {
localPreferenceScreen.bind(getListView());
}
}
public void addPreferencesFromResource(int paramInt)
{
if (this.a == null) {
throw new RuntimeException("This should be called after super.onCreate.");
}
setPreferenceScreen(PreferenceManagerCompat.a(this.a, getActivity(), paramInt, getPreferenceScreen()));
}
public Preference findPreference(CharSequence paramCharSequence)
{
if (this.a == null) {
return null;
}
return this.a.findPreference(paramCharSequence);
}
public ListView getListView()
{
if (this.b == null)
{
View localView = getView();
if (localView == null) {
throw new IllegalStateException("Content view not yet created");
}
localView = localView.findViewById(16908298);
if (!(localView instanceof ListView)) {
throw new RuntimeException("Content has view with id attribute 'android.R.id.list' that is not a ListView class");
}
this.b = ((ListView)localView);
if (this.b == null) {
throw new RuntimeException("Your content must have a ListView whose id attribute is 'android.R.id.list'");
}
this.b.setOnKeyListener(this.g);
this.e.post(this.f);
}
return this.b;
}
public PreferenceManager getPreferenceManager()
{
return this.a;
}
public PreferenceScreen getPreferenceScreen()
{
return PreferenceManagerCompat.a(this.a);
}
public void onActivityCreated(Bundle paramBundle)
{
super.onActivityCreated(paramBundle);
if (this.c) {
a();
}
this.d = true;
if (paramBundle != null)
{
paramBundle = paramBundle.getBundle("android:preferences");
if (paramBundle != null)
{
PreferenceScreen localPreferenceScreen = getPreferenceScreen();
if (localPreferenceScreen != null) {
localPreferenceScreen.restoreHierarchyState(paramBundle);
}
}
}
}
public void onActivityResult(int paramInt1, int paramInt2, Intent paramIntent)
{
super.onActivityResult(paramInt1, paramInt2, paramIntent);
PreferenceManagerCompat.a(this.a, paramInt1, paramInt2, paramIntent);
}
public void onCreate(Bundle paramBundle)
{
super.onCreate(paramBundle);
this.a = PreferenceManagerCompat.a(getActivity());
PreferenceManagerCompat.a();
}
public View onCreateView(LayoutInflater paramLayoutInflater, ViewGroup paramViewGroup, Bundle paramBundle)
{
return paramLayoutInflater.inflate(R.layout.preference_list_fragment, paramViewGroup, false);
}
public void onDestroy()
{
super.onDestroy();
PreferenceManagerCompat.b(this.a);
}
public void onDestroyView()
{
this.b = null;
this.e.removeCallbacks(this.f);
this.e.removeMessages(1);
super.onDestroyView();
}
public void onSaveInstanceState(Bundle paramBundle)
{
super.onSaveInstanceState(paramBundle);
PreferenceScreen localPreferenceScreen = getPreferenceScreen();
if (localPreferenceScreen != null)
{
Bundle localBundle = new Bundle();
localPreferenceScreen.saveHierarchyState(localBundle);
paramBundle.putBundle("android:preferences", localBundle);
}
}
public void setPreferenceScreen(PreferenceScreen paramPreferenceScreen)
{
if ((PreferenceManagerCompat.a(this.a, paramPreferenceScreen)) && (paramPreferenceScreen != null))
{
this.c = true;
if ((this.d) && (!this.e.hasMessages(1))) {
this.e.obtainMessage(1).sendToTarget();
}
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/v4/preference/PreferenceFragment.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/