1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-04 02:09:35 +02:00

works predefined image selector

This commit is contained in:
Nikolay Pultsin 2014-08-26 06:47:11 +04:00
parent a1b8286a02
commit 15100ec9a2
7 changed files with 113 additions and 27 deletions

View file

@ -60,6 +60,8 @@ import org.geometerplus.android.util.DeviceType;
public class PreferenceActivity extends ZLPreferenceActivity {
private final ActivityNetworkContext myNetworkContext = new ActivityNetworkContext(this);
private final FileChooserCollection myChooserCollection = new FileChooserCollection(this, 2000);
private static final int BACKGROUND_REQUEST_CODE = 3000;
private BackgroundPreference myBackgroundPreference;
public PreferenceActivity() {
super("Preferences");
@ -77,9 +79,18 @@ public class PreferenceActivity extends ZLPreferenceActivity {
return;
}
if (resultCode == RESULT_OK) {
myChooserCollection.update(requestCode, data);
if (resultCode != RESULT_OK) {
return;
}
if (BACKGROUND_REQUEST_CODE == requestCode) {
if (myBackgroundPreference != null) {
myBackgroundPreference.update(data);
}
return;
}
myChooserCollection.update(requestCode, data);
}
@Override
@ -448,9 +459,13 @@ public class PreferenceActivity extends ZLPreferenceActivity {
final Screen colorsScreen = createPreferenceScreen("colors");
colorsScreen.addPreference(new BackgroundPreference(
this, profile, colorsScreen.Resource.getResource("background")
));
myBackgroundPreference = new BackgroundPreference(
this,
profile,
colorsScreen.Resource.getResource("background"),
BACKGROUND_REQUEST_CODE
);
colorsScreen.addPreference(myBackgroundPreference);
final WallpaperPreference wallpaperPreference = new WallpaperPreference(
this, profile, colorsScreen.Resource.getResource("background")
) {