mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 10:49:24 +02:00
About section in preferences dialog
This commit is contained in:
parent
2d6c9a686f
commit
73595033c4
6 changed files with 101 additions and 1 deletions
|
@ -651,6 +651,19 @@
|
|||
<node name="summaryOff" value="Do not show"/>
|
||||
</node>
|
||||
</node>
|
||||
<node name="about" value="About FBReader">
|
||||
<node name="summary" value="Version info, contacts"/>
|
||||
<node name="version" value="Version"/>
|
||||
<node name="site" value="Visit our website">
|
||||
<node name="url" value="http://www.fbreader.org/"/>
|
||||
</node>
|
||||
<node name="email" value="Send us an e-mail">
|
||||
<node name="url" value="mailto:contact@geometerplus.com"/>
|
||||
</node>
|
||||
<node name="twitter" value="Follow us at twitter">
|
||||
<node name="url" value="http://twitter.com/fbreader"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node name="OptionsDialog">
|
||||
<node name="tab">
|
||||
|
|
|
@ -662,6 +662,19 @@
|
|||
<node name="summaryOff" value="Не показывать"/>
|
||||
</node>
|
||||
</node>
|
||||
<node name="about" value="О программе FBReader">
|
||||
<node name="summary" value="Версия, контакты"/>
|
||||
<node name="version" value="Версия"/>
|
||||
<node name="site" value="Наш веб-сайт">
|
||||
<node name="url" value="http://www.fbreader.ru/"/>
|
||||
</node>
|
||||
<node name="email" value="Отправьте нам письмо">
|
||||
<node name="url" value="mailto:contact@geometerplus.com"/>
|
||||
</node>
|
||||
<node name="twitter" value="Читайте нас в твиттере">
|
||||
<node name="url" value="http://twitter.com/fbreader_ru"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node name="OptionsDialog">
|
||||
<node name="tab">
|
||||
|
|
|
@ -429,5 +429,15 @@ public class PreferenceActivity extends ZLPreferenceActivity {
|
|||
|
||||
final Screen tipsScreen = createPreferenceScreen("tips");
|
||||
tipsScreen.addOption(TipsManager.Instance().ShowTipsOption, "showTips");
|
||||
|
||||
final Screen aboutScreen = createPreferenceScreen("about");
|
||||
aboutScreen.addPreference(new InfoPreference(
|
||||
this,
|
||||
aboutScreen.Resource.getResource("version").getValue(),
|
||||
androidLibrary.getFullVersionName()
|
||||
));
|
||||
aboutScreen.addPreference(new UrlPreference(this, aboutScreen.Resource, "site"));
|
||||
aboutScreen.addPreference(new UrlPreference(this, aboutScreen.Resource, "email"));
|
||||
aboutScreen.addPreference(new UrlPreference(this, aboutScreen.Resource, "twitter"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright (C) 2009-2012 Geometer Plus <contact@geometerplus.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package org.geometerplus.android.fbreader.preferences;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.preference.Preference;
|
||||
|
||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||
|
||||
class UrlPreference extends Preference implements Preference.OnPreferenceClickListener {
|
||||
private final String myUrl;
|
||||
|
||||
UrlPreference(Context context, ZLResource resource, String resourceKey) {
|
||||
super(context);
|
||||
resource = resource.getResource(resourceKey);
|
||||
myUrl = resource.getResource("url").getValue();
|
||||
setTitle(resource.getValue());
|
||||
setSummary(myUrl);
|
||||
setOnPreferenceClickListener(this);
|
||||
}
|
||||
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
try {
|
||||
getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(myUrl)));
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -48,6 +48,7 @@ public abstract class ZLibrary {
|
|||
abstract public ZLResourceFile createResourceFile(ZLResourceFile parent, String name);
|
||||
|
||||
abstract public String getVersionName();
|
||||
abstract public String getFullVersionName();
|
||||
abstract public String getCurrentTimeString();
|
||||
abstract public void setScreenBrightness(int percent);
|
||||
abstract public int getScreenBrightness();
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.lang.reflect.Field;
|
|||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.res.AssetFileDescriptor;
|
||||
import android.os.Build;
|
||||
import android.telephony.TelephonyManager;
|
||||
|
@ -114,7 +115,20 @@ public final class ZLAndroidLibrary extends ZLibrary {
|
|||
@Override
|
||||
public String getVersionName() {
|
||||
try {
|
||||
return myApplication.getPackageManager().getPackageInfo(myApplication.getPackageName(), 0).versionName;
|
||||
final PackageInfo info =
|
||||
myApplication.getPackageManager().getPackageInfo(myApplication.getPackageName(), 0);
|
||||
return info.versionName;
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFullVersionName() {
|
||||
try {
|
||||
final PackageInfo info =
|
||||
myApplication.getPackageManager().getPackageInfo(myApplication.getPackageName(), 0);
|
||||
return info.versionName + " (" + info.versionCode + ")";
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue