mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-03 17:59:33 +02:00
User-Agent has been added
git-svn-id: https://only.mawhrin.net/repos/FBReaderJ/trunk@1132 6a642e6f-84f6-412e-ac94-c4a38d5a04b0
This commit is contained in:
parent
1726668dde
commit
92ade1c905
3 changed files with 20 additions and 1 deletions
|
@ -2,7 +2,7 @@ DONE нарисовать иконку (скопирована иконка ic_m
|
|||
DONE переместить в главном меню наверх (вместо Settings)
|
||||
DONE пункт меню "delete sample"
|
||||
DONE BookDownloaderService - i18n
|
||||
* указывать HTTP-agent = "FBReader/<version>(java)" -- номер версии смотреть, как в диалоге About
|
||||
DONE указывать HTTP-agent = "FBReader/<version>(java)" -- номер версии смотреть, как в диалоге About
|
||||
* прятать Profile (прятать запрещенные каталоги)
|
||||
* при щелчке на книжку - сделать default action, и о нем спрашивать.
|
||||
|
||||
|
|
|
@ -99,4 +99,7 @@ public class ZLNetworkUtil {
|
|||
return new StringBuilder(url).append(delimiter).append(name).append('=').append(value).toString();
|
||||
}
|
||||
|
||||
public static String getUserAgent(String versionName) {
|
||||
return "FBReader/" + versionName + "(java)";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,8 +23,12 @@ import java.util.HashMap;
|
|||
|
||||
import android.app.Application;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.pm.PackageInfo;
|
||||
|
||||
import org.geometerplus.zlibrary.core.options.ZLBooleanOption;
|
||||
import org.geometerplus.zlibrary.core.sqliteconfig.ZLSQLiteConfig;
|
||||
import org.geometerplus.zlibrary.core.util.ZLNetworkUtil;
|
||||
|
||||
import org.geometerplus.zlibrary.ui.android.application.ZLAndroidApplicationWindow;
|
||||
import org.geometerplus.zlibrary.ui.android.dialogs.ZLAndroidDialogManager;
|
||||
|
@ -53,6 +57,8 @@ public class ZLAndroidApplication extends Application {
|
|||
new ZLAndroidImageManager();
|
||||
new ZLAndroidDialogManager();
|
||||
new ZLAndroidLibrary(this);
|
||||
System.err.println("FBREADER -- UserAgent = " + ZLNetworkUtil.getUserAgent(ZLAndroidApplication.Instance().getVersionName()));
|
||||
System.setProperty("http.agent", ZLNetworkUtil.getUserAgent(ZLAndroidApplication.Instance().getVersionName()));
|
||||
}
|
||||
|
||||
public void onTerminate() {
|
||||
|
@ -72,4 +78,14 @@ public class ZLAndroidApplication extends Application {
|
|||
}
|
||||
|
||||
private final HashMap myData = new HashMap();
|
||||
|
||||
public String getVersionName() {
|
||||
try {
|
||||
ComponentName comp = new ComponentName(this, this.getClass());
|
||||
PackageInfo pinfo = getPackageManager().getPackageInfo(comp.getPackageName(), 0);
|
||||
return pinfo.versionName;
|
||||
} catch (android.content.pm.PackageManager.NameNotFoundException ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue