2 * This file is part of WolneLektury-Mobile, licensed under GNU Affero GPLv3 or later.
3 * Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
6 package pl.org.nowoczesnapolska.wlmobi;
8 import android.os.Bundle;
9 import android.view.KeyEvent;
10 import android.view.Menu;
11 import android.view.MenuItem;
12 import android.webkit.WebSettings;
14 import com.phonegap.*;
16 public class Catalogue extends DroidGap {
18 String infoLabel = "Proszę czekać";
19 Boolean infoEnabled = false;
21 /** Called when the activity is first created. */
23 public void onCreate(Bundle savedInstanceState) {
24 super.onCreate(savedInstanceState);
27 super.loadUrl("file:///android_asset/www/index.html");
29 MenuInterface.view = appView;
31 WebSettings settings = this.appView.getSettings();
32 settings.setSupportZoom(true);
33 settings.setBuiltInZoomControls(true);
37 public boolean onCreateOptionsMenu(Menu menu) {
38 menu.add(Menu.NONE, 1, 1, "Początek");
39 menu.add(Menu.NONE, 3, 2, "Dodaj zakładkę");
40 menu.add(Menu.NONE, 2, 3, MenuInterface.infoLabel);
41 menu.add(Menu.NONE, 4, 4, "Tryb nocny");
42 //MenuInflater inflater = getMenuInflater();
43 //inflater.inflate(R.menu.game_menu, menu);
44 return super.onCreateOptionsMenu(menu);
48 public boolean onPrepareOptionsMenu(Menu menu) {
49 MenuItem mi = menu.getItem(1);
50 mi.setTitle(MenuInterface.infoLabel);
51 mi.setEnabled(MenuInterface.infoEnabled);
52 return super.onPrepareOptionsMenu(menu);
57 public boolean onKeyDown(int i,KeyEvent e){
58 if (e.getKeyCode() == KeyEvent.KEYCODE_MENU) {
61 return super.onKeyDown(i, e);
65 public boolean onOptionsItemSelected(MenuItem item) {
66 switch (item.getItemId()) {
68 this.appView.loadUrl("javascript:Menu.start();");
71 this.appView.loadUrl("javascript:Menu.info();");
74 this.appView.loadUrl("javascript:Menu.bookmark();");
77 this.appView.loadUrl("javascript:Menu.toggleNightMode();");
80 return super.onOptionsItemSelected(item);