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.graphics.Color;
9 import android.os.Bundle;
10 import android.view.KeyEvent;
11 import android.view.Menu;
12 import android.view.MenuItem;
13 import android.webkit.WebSettings;
15 import com.phonegap.*;
17 public class Catalogue extends DroidGap {
19 String infoLabel = "Proszę czekać";
20 Boolean infoEnabled = false;
22 /** Called when the activity is first created. */
24 public void onCreate(Bundle savedInstanceState) {
25 super.onCreate(savedInstanceState);
28 super.loadUrl("file:///android_asset/www/index.html");
30 MenuInterface.view = appView;
32 WebSettings settings = this.appView.getSettings();
33 settings.setSupportZoom(true);
34 settings.setBuiltInZoomControls(true);
38 public boolean onCreateOptionsMenu(Menu menu) {
39 menu.add(Menu.NONE, 1, 1, "Początek");
40 menu.add(Menu.NONE, 3, 2, "Dodaj zakładkę");
41 menu.add(Menu.NONE, 2, 3, MenuInterface.infoLabel);
42 menu.add(Menu.NONE, 4, 4, "Tryb nocny");
43 //MenuInflater inflater = getMenuInflater();
44 //inflater.inflate(R.menu.game_menu, menu);
45 return super.onCreateOptionsMenu(menu);
49 public boolean onPrepareOptionsMenu(Menu menu) {
50 MenuItem mi = menu.getItem(1);
51 mi.setTitle(MenuInterface.infoLabel);
52 mi.setEnabled(MenuInterface.infoEnabled);
53 return super.onPrepareOptionsMenu(menu);
58 public boolean onKeyDown(int i,KeyEvent e){
59 if (e.getKeyCode() == KeyEvent.KEYCODE_MENU) {
62 return super.onKeyDown(i, e);
66 public boolean onOptionsItemSelected(MenuItem item) {
67 switch (item.getItemId()) {
69 this.appView.loadUrl("javascript:Menu.start();");
72 this.appView.loadUrl("javascript:Menu.info();");
75 this.appView.loadUrl("javascript:Menu.bookmark();");
78 this.appView.loadUrl("javascript:Menu.toggleNightMode();");
81 return super.onOptionsItemSelected(item);