Initial commit.
author£ukasz Anwajler <lukasz@anwajler.com>
Wed, 23 Feb 2011 16:44:02 +0000 (17:44 +0100)
committer£ukasz Anwajler <lukasz@anwajler.com>
Wed, 23 Feb 2011 16:44:02 +0000 (17:44 +0100)
31 files changed:
AndroidManifest.xml [new file with mode: 0644]
gen/pl/org/nowoczesnapolska/R.java [new file with mode: 0644]
lib/signpost-commonshttp4-1.2.1.1.jar [new file with mode: 0644]
lib/signpost-core-1.2.1.1.jar [new file with mode: 0644]
res/drawable-hdpi/icon.png [new file with mode: 0644]
res/drawable-ldpi/icon.png [new file with mode: 0644]
res/drawable-mdpi/icon.png [new file with mode: 0644]
res/layout/about.xml [new file with mode: 0644]
res/layout/catalogue.xml [new file with mode: 0644]
res/layout/catalogue_book.xml [new file with mode: 0644]
res/layout/catalogue_book_list_item.xml [new file with mode: 0644]
res/layout/catalogue_item_details.xml [new file with mode: 0644]
res/layout/catalogue_list_item.xml [new file with mode: 0644]
res/layout/catalogue_read_online.xml [new file with mode: 0644]
res/layout/catalogue_shelves.xml [new file with mode: 0644]
res/layout/catalogue_shelves_item.xml [new file with mode: 0644]
res/layout/catalogue_shelves_list_item.xml [new file with mode: 0644]
res/layout/settings.xml [new file with mode: 0644]
res/layout/signin.xml [new file with mode: 0644]
res/values/strings.xml [new file with mode: 0644]
src/pl/org/nowoczesnapolska/About.java [new file with mode: 0644]
src/pl/org/nowoczesnapolska/Auth.java [new file with mode: 0644]
src/pl/org/nowoczesnapolska/AuthHelper.java [new file with mode: 0644]
src/pl/org/nowoczesnapolska/Catalogue.java [new file with mode: 0644]
src/pl/org/nowoczesnapolska/CatalogueBook.java [new file with mode: 0644]
src/pl/org/nowoczesnapolska/CatalogueItem.java [new file with mode: 0644]
src/pl/org/nowoczesnapolska/CatalogueReadOnline.java [new file with mode: 0644]
src/pl/org/nowoczesnapolska/Settings.java [new file with mode: 0644]
src/pl/org/nowoczesnapolska/Shelves.java [new file with mode: 0644]
src/pl/org/nowoczesnapolska/ShelvesItem.java [new file with mode: 0644]
src/pl/org/nowoczesnapolska/SignIn.java [new file with mode: 0644]

diff --git a/AndroidManifest.xml b/AndroidManifest.xml
new file mode 100644 (file)
index 0000000..77027dd
--- /dev/null
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+      package="pl.org.nowoczesnapolska"
+      android:versionCode="1"
+      android:versionName="1.0">
+    <application android:icon="@drawable/icon" android:label="@string/app_name">
+        <activity android:name=".Catalogue"
+                  android:label="@string/app_name">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+
+        <activity android:name=".CatalogueItem"
+                  android:label="@string/app_name">
+        </activity>
+
+        <activity android:name=".CatalogueBook"
+                  android:label="@string/app_name">
+        </activity>
+
+        <activity android:name=".CatalogueReadOnline"
+                  android:label="@string/app_name"
+                  android:theme="@android:style/Theme.NoTitleBar">
+        </activity>
+
+        <activity android:name=".Shelves"
+                  android:label="@string/app_name">
+        </activity>
+
+        <activity android:name=".ShelvesItem"
+                  android:label="@string/app_name">
+        </activity>
+
+        <activity android:name=".SignIn"
+                  android:label="@string/app_name">                
+        </activity>
+               
+               <activity android:name=".Auth">
+            <intent-filter>
+                       <action android:name="android.intent.action.VIEW" />
+                       <category android:name="android.intent.category.DEFAULT" />
+                       <category android:name="android.intent.category.BROWSABLE" />
+               <data android:scheme="wl" />
+            </intent-filter>           
+               </activity>
+               
+        <activity android:name=".Settings"
+                  android:label="@string/app_name">
+        </activity>
+
+        <activity android:name=".About"
+                  android:label="@string/app_name">
+        </activity>
+
+    </application>
+    <uses-sdk android:minSdkVersion="5" />
+    <uses-permission android:name="android.permission.INTERNET" />
+</manifest>
\ No newline at end of file
diff --git a/gen/pl/org/nowoczesnapolska/R.java b/gen/pl/org/nowoczesnapolska/R.java
new file mode 100644 (file)
index 0000000..219a09b
--- /dev/null
@@ -0,0 +1,51 @@
+/* AUTO-GENERATED FILE.  DO NOT MODIFY.
+ *
+ * This class was automatically generated by the
+ * aapt tool from the resource data it found.  It
+ * should not be modified by hand.
+ */
+
+package pl.org.nowoczesnapolska;
+
+public final class R {
+    public static final class attr {
+    }
+    public static final class drawable {
+        public static final int icon=0x7f020000;
+    }
+    public static final class id {
+        public static final int ScrollView01=0x7f050000;
+        public static final int addShelf=0x7f050008;
+        public static final int catalogueBookListView=0x7f050004;
+        public static final int catalogueListView=0x7f050002;
+        public static final int catalogueSearch=0x7f050001;
+        public static final int catalogueShelvesBookListView=0x7f050009;
+        public static final int catalogueShelvesListView=0x7f050007;
+        public static final int putOnShelf=0x7f050006;
+        public static final int read_online=0x7f050003;
+        public static final int sign_in=0x7f05000a;
+        public static final int webview=0x7f050005;
+    }
+    public static final class layout {
+        public static final int about=0x7f030000;
+        public static final int catalogue=0x7f030001;
+        public static final int catalogue_book=0x7f030002;
+        public static final int catalogue_book_list_item=0x7f030003;
+        public static final int catalogue_item_details=0x7f030004;
+        public static final int catalogue_list_item=0x7f030005;
+        public static final int catalogue_read_online=0x7f030006;
+        public static final int catalogue_shelves=0x7f030007;
+        public static final int catalogue_shelves_item=0x7f030008;
+        public static final int catalogue_shelves_list_item=0x7f030009;
+        public static final int settings=0x7f03000a;
+        public static final int signin=0x7f03000b;
+    }
+    public static final class string {
+        public static final int app_name=0x7f040000;
+        public static final int menu_about=0x7f040001;
+        public static final int menu_settings=0x7f040002;
+        public static final int menu_share=0x7f040004;
+        public static final int menu_shelf=0x7f040005;
+        public static final int menu_signin=0x7f040003;
+    }
+}
diff --git a/lib/signpost-commonshttp4-1.2.1.1.jar b/lib/signpost-commonshttp4-1.2.1.1.jar
new file mode 100644 (file)
index 0000000..50e9838
Binary files /dev/null and b/lib/signpost-commonshttp4-1.2.1.1.jar differ
diff --git a/lib/signpost-core-1.2.1.1.jar b/lib/signpost-core-1.2.1.1.jar
new file mode 100644 (file)
index 0000000..59e7537
Binary files /dev/null and b/lib/signpost-core-1.2.1.1.jar differ
diff --git a/res/drawable-hdpi/icon.png b/res/drawable-hdpi/icon.png
new file mode 100644 (file)
index 0000000..89570b7
Binary files /dev/null and b/res/drawable-hdpi/icon.png differ
diff --git a/res/drawable-ldpi/icon.png b/res/drawable-ldpi/icon.png
new file mode 100644 (file)
index 0000000..5fb23c5
Binary files /dev/null and b/res/drawable-ldpi/icon.png differ
diff --git a/res/drawable-mdpi/icon.png b/res/drawable-mdpi/icon.png
new file mode 100644 (file)
index 0000000..67b83d2
Binary files /dev/null and b/res/drawable-mdpi/icon.png differ
diff --git a/res/layout/about.xml b/res/layout/about.xml
new file mode 100644 (file)
index 0000000..c2bbdf4
--- /dev/null
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    >
+
+       <ScrollView android:id="@+id/ScrollView01" android:layout_width="fill_parent" android:layout_height="wrap_content">
+               <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                   android:orientation="vertical"
+                   android:layout_width="fill_parent"
+                   android:layout_height="fill_parent"
+                   >
+
+                           <TextView
+                                       android:layout_width="fill_parent"
+                               android:layout_height="wrap_content"
+                               android:padding="10sp"
+                               android:textStyle="bold"
+                               android:textSize="16sp"
+                               android:text="About" 
+                           />
+                           
+                               <TextView
+                                       android:layout_width="fill_parent"
+                               android:layout_height="wrap_content"
+                               android:padding="10sp"
+                               android:textSize="12sp"
+                               android:text='Web library with the school obligatory readings "Wolne Lektury" (www.wolnelektury.pl) is a project carried out by Modern Poland Foundation. Wolne Lektury website works since 2007. It provides the visitors with the school readings recommended Ministerstwo Edukacji Narodowej which entered the public domain. The literary works are drawn up, annotated and available in several formats (html, epub, mp3, ogg, odt, txt and pdf). Under the Polish law, they can be read online, downloaded, cited and shared.'
+                           />
+                           
+                               <TextView
+                                       android:layout_width="fill_parent"
+                               android:layout_height="wrap_content"
+                               android:padding="10sp"
+                               android:textSize="12sp"
+                               android:text='Wolne Lektury project team comprises experienced editors and teachers so that our website content is solid and reliable. To create it, we cooperate with National Library which provides us with the best available editions of the books as well as the critical studies of the school readings, published in Digital National Library Polona. Together we try our best to make the texts of the books (our cultural legacy) available for everyone, regardless of where one is living, how much money does one have or whether one is handicapped or not. It is possible only due to the public domain concept, meaning a collection of literary works that are not copyrighted, as well as high technologies - tools that let us increase availability of the text published on the Internet.'
+                           />
+
+                               <TextView
+                                       android:layout_width="fill_parent"
+                               android:layout_height="wrap_content"
+                               android:padding="10sp"
+                               android:textSize="12sp"
+                               android:text='Wolne Lektury project is completely uncommercial and it is carried out pro publico bono. Therefore the support of the eminent personages conncted with culture and sciences is very important for us. Wolne Lektury project is held under the honorary patronage of Ministerstwo Kultury i Dziedzictwa Narodowego, Ministerstwo Edukacji Narodowej and Polish Writers Association. In the Honorary Comitee of Wolne Lektury agreed to sit Professor Maria Janion, Professor Grażyna Borkowska, Professor Przemysław Czapliński, Professor Mieczysław Dąbrowski, Professor Ewa Kraskowska, Professor Małgorzata Czermińska, Professor Jerzy Jarzębski and Professor Piotr Śliwiński.'
+                           />
+
+                               <TextView
+                                       android:layout_width="fill_parent"
+                               android:layout_height="wrap_content"
+                               android:padding="10sp"
+                               android:textSize="12sp"
+                               android:text='Digitalisation and proofreading is provided by the National Library. The website was designed by 2ia. The author of the programming language of the repository of Free Literature texts, based on the XML language is Dariusz Gałecki. Grynhoff, Woźny, Maliński office provides us with the legal service. Web hosting is provided by EO Networks company. Publishing house Korporacja Ha!Art helps us in proofreading. The logo of Wolne Lektury is a creation of PZL agency. The project is held under media patronage of: Dziennik, Elle, Tok.fm, Biblioteka Analiz, Tygodnik Powszechny, Przekrój and TVP Kultura.'
+                           />                          
+
+                           <TextView
+                                       android:layout_width="fill_parent"
+                               android:layout_height="wrap_content"
+                               android:padding="10sp"
+                               android:textStyle="bold"
+                               android:textSize="16sp"
+                               android:text="About the foundation" 
+                           />
+
+                               <TextView
+                                       android:layout_width="fill_parent"
+                               android:layout_height="wrap_content"
+                               android:padding="10sp"
+                               android:textSize="12sp"
+                               android:text='Modern Poland Foundation was established because education of children is a key to the future. One of the most important objectives that Polish education has to approach is a struggle with digital retardation. The skill in using a computer and the Internet is a kind of elemental knowledge in the age of information society. One who does not have it, is condemned to a vegetative existence on the fringes of modern world.'
+                           />  
+
+                               <TextView
+                                       android:layout_width="fill_parent"
+                               android:layout_height="wrap_content"
+                               android:padding="10sp"
+                               android:textSize="12sp"
+                               android:text='It is the reason why for seven years we have helped (and still do) the children in understanding and using the high technologies. Modern Poland Foundation wants to give a thousands of children what is the most valuable: knowledge and abilities letting them understand modern world and take advantage of its opportunities.'
+                           />  
+
+                               <TextView
+                                       android:layout_width="fill_parent"
+                               android:layout_height="wrap_content"
+                               android:padding="10sp"
+                               android:textSize="12sp"
+                               android:text='Modern Poland Fundation - apart from Wolne Lektury project - is as well coordinating Wolne Podręczniki project. It is created by a social movement of voluteering teachers. With the use of the Internet, they are writing new coursebooks for Polish pupils. Wolne Podręczniki are published openly-licensed (meaning it gives the user certain copyright freedom i.e. the books can be copied, distributed and updated without the necessity of asking the team of authors for permission). Every teacher will be able to supplement, expand and improve the coursebooks in accordance with to their own needs and experience. Thanks to the open source the price of the traditional coursebooks published in printed format will seriously decrease and the access to the electronic coursebooks will be free.'
+                           />  
+       </LinearLayout>
+    </ScrollView>
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/catalogue.xml b/res/layout/catalogue.xml
new file mode 100644 (file)
index 0000000..f3fccb2
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    >
+       <EditText
+           android:id="@+id/catalogueSearch"
+           android:orientation="vertical"
+       android:layout_width="fill_parent"
+       android:layout_height="wrap_content"
+       android:text=""
+       android:hint="Search"
+    />
+    <ListView 
+       android:id="@+id/catalogueListView"
+       android:layout_width="fill_parent"
+       android:layout_height="wrap_content"            
+    />
+</LinearLayout>
diff --git a/res/layout/catalogue_book.xml b/res/layout/catalogue_book.xml
new file mode 100644 (file)
index 0000000..cbce4bb
--- /dev/null
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    >
+    
+       <TextView
+           android:layout_width="fill_parent"
+           android:layout_height="wrap_content"
+           android:paddingLeft="10dp"
+           android:paddingTop="10dp"
+           android:textSize="14sp"
+           android:textStyle="bold"
+           android:text="Miłosz Biedrzycki">
+       </TextView>
+       <TextView
+           android:layout_width="fill_parent"
+           android:layout_height="wrap_content"
+           android:paddingLeft="10dp"
+           android:paddingTop="10dp"
+           android:textSize="16sp"
+           android:textStyle="bold"
+           android:text="Hołd (Dwa sonety)" >
+       </TextView>
+       
+       <TextView
+           android:layout_width="fill_parent"
+           android:layout_height="wrap_content"
+           android:padding="10dp"
+           android:textSize="12sp"
+           android:text='Utwór jest udostępniony na licencji Creative Commons Uznanie Autorstwa - Na Tych Samych Warunkach 3.0.PL. Na podstawie: Miłosz Biedrzycki, * ("Gwiazdka"), Fundacja "brulion", Kraków-Warszawa, 1993' >
+       </TextView>     
+       
+       <Button
+           android:layout_width="fill_parent"
+           android:layout_height="wrap_content"
+           android:padding="10dp"
+           android:textSize="14sp"
+           android:height="70sp"
+           android:text="Czytaj on-line"
+           android:id="@+id/read_online"
+           
+        />
+
+       <Button 
+           android:layout_width="fill_parent"
+           android:layout_height="wrap_content"
+           android:padding="10dp"
+           android:textSize="14sp"
+           android:height="70sp"           
+           android:text="Pobierz EPUB"     
+       />
+       
+       <Button
+           android:layout_width="fill_parent"
+           android:layout_height="wrap_content"
+           android:padding="10dp"
+           android:textSize="14sp"
+           android:height="70sp"           
+           android:text="Słuchaj audiobooka"      
+       />      
+       
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/catalogue_book_list_item.xml b/res/layout/catalogue_book_list_item.xml
new file mode 100644 (file)
index 0000000..6e24462
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:padding="10dp"
+    android:textSize="16sp" >
+</TextView>
\ No newline at end of file
diff --git a/res/layout/catalogue_item_details.xml b/res/layout/catalogue_item_details.xml
new file mode 100644 (file)
index 0000000..ded1ac5
--- /dev/null
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    >
+    
+       <TextView xmlns:android="http://schemas.android.com/apk/res/android"
+           android:layout_width="fill_parent"
+           android:layout_height="wrap_content"
+           android:layout_marginLeft="10dp"
+           android:layout_marginRight="10sp"
+           android:paddingTop="10dp"
+           android:textSize="16sp"
+           android:textStyle="bold"
+           android:text="Miłosz Biedrzycki" >
+       </TextView>
+
+       <TextView xmlns:android="http://schemas.android.com/apk/res/android"
+           android:layout_width="fill_parent"
+           android:layout_height="wrap_content"
+           android:layout_marginLeft="10dp"
+           android:layout_marginRight="10sp"
+           android:textSize="12sp"
+           android:text='Ur. 1967 rok w Koprze w Słowenii. Najważniejsze dzieła * (,,Gwiazdka", 1993), OO (,,Dwa groszki", 1994), Pył/Łyp (1997), Słońce na asfalcie (2003), 69 (2006), wygrzebane (2007), Sofostrofa i inne wiersze (2007). Jeden z czołowych poetów tzw. pokolenia brulionu. Publikował m.in. w »brulionie«, »Frondzie« i »Czasie kultury«. Wszystkie swoje wiersze udostępnia w sieci na autorskiej stronie. Tłumacz z języka słoweńskiego. Pseudonim: MLB.' >
+       </TextView>
+       
+       <TextView xmlns:android="http://schemas.android.com/apk/res/android"
+           android:layout_width="fill_parent"
+           android:layout_height="wrap_content"
+           android:paddingTop="10dp"
+           android:paddingBottom="10dp"
+           android:layout_marginLeft="10dp"
+           android:layout_marginRight="10sp"       
+           android:textSize="16sp"
+           android:textStyle="bold"
+           android:text='Lista utworów:' >
+       </TextView>     
+       
+       <ListView 
+       android:id="@+id/catalogueBookListView"
+       android:layout_width="fill_parent"
+       android:layout_height="wrap_content"            
+    />
+       
+
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/catalogue_list_item.xml b/res/layout/catalogue_list_item.xml
new file mode 100644 (file)
index 0000000..6e24462
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:padding="10dp"
+    android:textSize="16sp" >
+</TextView>
\ No newline at end of file
diff --git a/res/layout/catalogue_read_online.xml b/res/layout/catalogue_read_online.xml
new file mode 100644 (file)
index 0000000..3b80fb5
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<WebView  xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/webview"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+/>
\ No newline at end of file
diff --git a/res/layout/catalogue_shelves.xml b/res/layout/catalogue_shelves.xml
new file mode 100644 (file)
index 0000000..0051865
--- /dev/null
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    >
+
+       <TextView
+           android:layout_width="fill_parent"
+           android:layout_height="wrap_content"
+           android:paddingLeft="10dp"
+           android:paddingTop="10dp"
+           android:textSize="16sp"
+           android:textStyle="bold"
+           android:text="Półki">
+       </TextView>     
+
+       <TextView
+           android:layout_width="fill_parent"
+           android:layout_height="wrap_content"
+           android:paddingLeft="10dp"
+           android:paddingTop="10dp"
+           android:textSize="14sp"
+           android:textStyle="italic"
+           android:text="Miłosz Biedrzycki, 'Hołd na dwa sonety'">
+       </TextView>     
+
+       <Button 
+           android:layout_width="fill_parent"
+           android:layout_height="wrap_content"
+           android:padding="10dp"
+           android:textSize="14sp"
+           android:height="70sp"           
+           android:text="Dodaj na półkę"
+           android:id="@+id/putOnShelf"            
+       />
+    
+       <TextView
+           android:layout_width="fill_parent"
+           android:layout_height="wrap_content"
+           android:paddingLeft="10dp"
+           android:paddingTop="10dp"
+           android:textSize="16sp"
+           android:textStyle="bold"
+           android:text="Lista półek:">
+       </TextView>     
+
+       <ListView 
+       android:id="@+id/catalogueShelvesListView"
+       android:layout_width="fill_parent"
+       android:layout_height="wrap_content"            
+    />
+
+       <Button 
+           android:layout_width="fill_parent"
+           android:layout_height="wrap_content"
+           android:padding="10dp"
+           android:textSize="14sp"
+           android:height="70sp"
+           android:id="@+id/addShelf"      
+           android:text="Utwórz nową półkę"           
+       />
+       
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/catalogue_shelves_item.xml b/res/layout/catalogue_shelves_item.xml
new file mode 100644 (file)
index 0000000..5738be8
--- /dev/null
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    >
+
+       <TextView
+           android:layout_width="fill_parent"
+           android:layout_height="wrap_content"
+           android:paddingLeft="10dp"
+           android:paddingTop="10dp"
+           android:textSize="16sp"
+           android:textStyle="bold"
+           android:text="Półka: Moje lektury">
+       </TextView>     
+       <TextView
+           android:layout_width="fill_parent"
+           android:layout_height="wrap_content"
+           android:paddingLeft="10dp"
+           android:paddingTop="10dp"
+           android:textSize="16sp"
+           android:textStyle="bold"
+           android:text="Lista utworów:">
+       </TextView>
+       
+       <ListView 
+       android:id="@+id/catalogueShelvesBookListView"
+       android:layout_width="fill_parent"
+       android:layout_height="wrap_content"            
+    /> 
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/catalogue_shelves_list_item.xml b/res/layout/catalogue_shelves_list_item.xml
new file mode 100644 (file)
index 0000000..6e24462
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:padding="10dp"
+    android:textSize="16sp" >
+</TextView>
\ No newline at end of file
diff --git a/res/layout/settings.xml b/res/layout/settings.xml
new file mode 100644 (file)
index 0000000..295fd73
--- /dev/null
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    >
+
+    <TextView
+               android:layout_width="fill_parent"
+       android:layout_height="wrap_content"
+       android:padding="10sp"
+       android:textStyle="bold"
+       android:textSize="16sp"
+       android:text="Settings" 
+    />
+    
+    <CheckBox
+               android:layout_width="fill_parent"
+       android:layout_height="wrap_content"
+       android:checked="true"
+       android:textSize="14sp"         
+       android:hint="Stay signed in"
+       android:layout_marginRight="10sp"
+       android:layout_marginLeft="10sp"            
+    />
+
+    <CheckBox
+               android:layout_width="fill_parent"
+       android:layout_height="wrap_content"
+       android:checked="true"
+       android:textSize="14sp"         
+       android:hint="Check updates only while on WiFi"
+       android:layout_marginRight="10sp"
+       android:layout_marginLeft="10sp"            
+    />
+    
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/signin.xml b/res/layout/signin.xml
new file mode 100644 (file)
index 0000000..38a7f29
--- /dev/null
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    >
+
+    <TextView
+               android:layout_width="fill_parent"
+       android:layout_height="wrap_content"
+       android:padding="10sp"
+       android:textStyle="bold"
+       android:textSize="16sp"
+       android:text="Sign in" 
+       android:layout_marginRight="10sp" 
+    />
+
+    <TextView
+               android:layout_width="fill_parent"
+       android:layout_height="wrap_content"
+       android:layout_marginBottom="20sp"
+       android:textStyle="italic"
+       android:text="Sign up to create your own shelves, access them online and share with your friends." 
+       android:layout_marginRight="10sp"
+       android:layout_marginLeft="10sp"         
+    />
+    
+    <TextView
+               android:layout_width="fill_parent"
+       android:layout_height="wrap_content"
+       android:text="Login"
+       android:layout_marginLeft="10sp" 
+       android:layout_marginRight="10sp" 
+    />
+       
+       <EditText
+               android:layout_width="fill_parent"
+       android:layout_height="wrap_content"
+       android:hint="Login"
+       android:layout_marginLeft="10sp"        
+       android:layout_marginRight="10sp" 
+    />
+       
+    <TextView
+               android:layout_width="fill_parent"
+       android:layout_height="wrap_content"
+       android:text="Password" 
+       android:layout_marginLeft="10sp"        
+       android:layout_marginRight="10sp" 
+    />        
+
+       <EditText
+               android:layout_width="fill_parent"
+       android:layout_height="wrap_content"
+       android:hint="Password"
+       android:layout_marginLeft="10sp"        
+       android:layout_marginRight="10sp"     
+    />
+    
+    
+    <CheckBox
+               android:layout_width="fill_parent"
+       android:layout_height="wrap_content"
+       android:checked="true"
+       android:hint="Stay signed in"
+       android:layout_marginLeft="10sp"  
+       android:layout_marginRight="10sp"                  
+    />
+    
+       <Button     
+               android:layout_width="fill_parent"
+       android:layout_height="wrap_content"
+       android:text="Sign in"
+       android:height="70sp"
+       android:id="@+id/sign_in"
+       android:layout_marginTop="20sp" 
+       android:layout_marginLeft="10sp"        
+       android:layout_marginRight="10sp" 
+    />
+
+       <Button     
+               android:layout_width="fill_parent"
+       android:layout_height="wrap_content"
+       android:height="70sp"
+       android:text="No account? Sign up!"
+       android:layout_marginLeft="10sp"
+       android:layout_marginRight="10sp" 
+    />
+
+</LinearLayout>
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
new file mode 100644 (file)
index 0000000..7cb1478
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    
+    <string name="app_name">Wolne Lektury</string>
+<string name="menu_about">About</string>
+<string name="menu_settings">Settings</string>
+<string name="menu_signin">Sign In</string>
+<string name="menu_share">Share</string>
+<string name="menu_shelf">Shelves</string>
+</resources>
diff --git a/src/pl/org/nowoczesnapolska/About.java b/src/pl/org/nowoczesnapolska/About.java
new file mode 100644 (file)
index 0000000..c818270
--- /dev/null
@@ -0,0 +1,16 @@
+package pl.org.nowoczesnapolska;
+
+import android.app.Activity;
+import android.content.Context;
+import android.os.Bundle;
+
+public class About extends Activity {
+       Context ctx;
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.about);
+        
+        ctx = this;
+    }
+}
diff --git a/src/pl/org/nowoczesnapolska/Auth.java b/src/pl/org/nowoczesnapolska/Auth.java
new file mode 100644 (file)
index 0000000..0fbb0a1
--- /dev/null
@@ -0,0 +1,107 @@
+package pl.org.nowoczesnapolska;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import oauth.signpost.OAuthConsumer;
+import oauth.signpost.OAuthProvider;
+import oauth.signpost.commonshttp.CommonsHttpOAuthConsumer;
+import oauth.signpost.exception.OAuthCommunicationException;
+import oauth.signpost.exception.OAuthExpectationFailedException;
+import oauth.signpost.exception.OAuthMessageSignerException;
+import oauth.signpost.exception.OAuthNotAuthorizedException;
+
+import org.apache.http.Header;
+import org.apache.http.HeaderIterator;
+import org.apache.http.HttpRequest;
+import org.apache.http.HttpResponse;
+import org.apache.http.ProtocolVersion;
+import org.apache.http.RequestLine;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.params.HttpParams;
+
+import android.app.Activity;
+import android.net.Uri;
+import android.util.Log;
+
+public class Auth extends Activity {
+       private AuthHelper aHelper;
+       /* OAuth */
+       private OAuthConsumer mConsumer;
+       private OAuthProvider mProvider;
+       private String mCallbackUrl;
+       private String authURL;
+       private String apiURL = "http://192.168.148.129/api/";  
+       
+       @Override
+       public void onResume(){
+        super.onResume();
+        aHelper = new AuthHelper();
+        
+               String[] token = getVerifier();
+               if (token != null){
+                       try {
+                               Log.d("resume", "token0: "+token[0]);
+                               Log.d("resume", "token1: "+token[1]);
+                               
+                               String accessToken[] = AuthHelper.getAccessToken(token[1]);
+
+                               Log.d("resume", "token0: " + accessToken[0]);
+                               Log.d("resume", "token1: " + accessToken[1]);                           
+                               mConsumer = new CommonsHttpOAuthConsumer(accessToken[0], accessToken[1]);
+                               
+                               final URL url = new URL(apiURL+"tags/abc.json");
+                               Log.d("url", "token1: "+url.toString());
+                               
+                               HttpGet request = new HttpGet(url.toURI());
+                               mConsumer.sign(request);
+                               
+                               Log.d("url", "podpisany req");                          
+                               
+                               HttpClient httpClient = new DefaultHttpClient();
+                               HttpResponse response = httpClient.execute(request);
+                               
+                               
+                       } catch (OAuthMessageSignerException e) {
+                               // TODO Auto-generated catch block
+                               e.printStackTrace();
+                       } catch (OAuthNotAuthorizedException e) {
+                               // TODO Auto-generated catch block
+                               e.printStackTrace();
+                       } catch (OAuthExpectationFailedException e) {
+                               // TODO Auto-generated catch block
+                               e.printStackTrace();
+                       } catch (OAuthCommunicationException e) {
+                               // TODO Auto-generated catch block
+                               e.printStackTrace();
+                       } catch (MalformedURLException e) {
+                               // TODO Auto-generated catch block
+                               e.printStackTrace();
+                       } catch (IOException e) {
+                               // TODO Auto-generated catch block
+                               e.printStackTrace();
+                       } catch (URISyntaxException e) {
+                               // TODO Auto-generated catch block
+                               e.printStackTrace();
+                       }       
+               }
+       }
+       
+       private String[] getVerifier() {
+               // extract the token if it exists
+               Uri uri = this.getIntent().getData();
+               if (uri == null) {
+                       Log.d("resume", "beforetoken null");
+                       return null;
+               }
+
+               String token = uri.getQueryParameter("oauth_token");
+               String verifier = uri.getQueryParameter("oauth_verifier");
+               Log.d("resume", "token+verifier");
+               return new String[] { token, verifier };
+       }       
+}
diff --git a/src/pl/org/nowoczesnapolska/AuthHelper.java b/src/pl/org/nowoczesnapolska/AuthHelper.java
new file mode 100644 (file)
index 0000000..d531c62
--- /dev/null
@@ -0,0 +1,55 @@
+package pl.org.nowoczesnapolska;
+
+import java.io.UnsupportedEncodingException;
+
+import oauth.signpost.OAuth;
+import oauth.signpost.OAuthConsumer;
+import oauth.signpost.OAuthProvider;
+import oauth.signpost.commonshttp.CommonsHttpOAuthConsumer;
+import oauth.signpost.commonshttp.CommonsHttpOAuthProvider;
+import oauth.signpost.exception.OAuthCommunicationException;
+import oauth.signpost.exception.OAuthExpectationFailedException;
+import oauth.signpost.exception.OAuthMessageSignerException;
+import oauth.signpost.exception.OAuthNotAuthorizedException;
+import android.util.Log;
+
+public class AuthHelper {
+
+       
+       /* OAuth */
+       private static OAuthConsumer mConsumer;
+       private static OAuthProvider mProvider;
+       private static String mCallbackUrl;
+       private static String apiURL = "http://192.168.148.129/api/";
+
+       public static void OAuthHelper(String consumerKey, String consumerSecret, String callbackUrl)
+       throws UnsupportedEncodingException {
+               mConsumer = new CommonsHttpOAuthConsumer(consumerKey, consumerSecret);
+               mProvider = new CommonsHttpOAuthProvider(
+                               apiURL+"oauth/request_token/",
+                               apiURL+"oauth/access_token/",
+                               apiURL+"oauth/authorize/");
+               mProvider.setOAuth10a(true);
+               mCallbackUrl = (callbackUrl == null ? OAuth.OUT_OF_BAND : callbackUrl);
+       }    
+
+
+       public static String getRequestToken()
+       throws OAuthMessageSignerException, OAuthNotAuthorizedException,
+       OAuthExpectationFailedException, OAuthCommunicationException {
+               String authUrl = mProvider.retrieveRequestToken(mConsumer, mCallbackUrl);
+               return authUrl;
+       }
+
+       public static String[] getAccessToken(String verifier)
+       throws OAuthMessageSignerException, OAuthNotAuthorizedException,
+       OAuthExpectationFailedException, OAuthCommunicationException {
+               Log.d("resume", "beforetoken");
+               mProvider.retrieveAccessToken(mConsumer, verifier);
+               return new String[] {
+                               mConsumer.getToken(), mConsumer.getTokenSecret()
+               };
+       }
+       
+       
+}
diff --git a/src/pl/org/nowoczesnapolska/Catalogue.java b/src/pl/org/nowoczesnapolska/Catalogue.java
new file mode 100644 (file)
index 0000000..cbf329b
--- /dev/null
@@ -0,0 +1,182 @@
+package pl.org.nowoczesnapolska;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.ArrayAdapter;
+import android.widget.EditText;
+import android.widget.ListView;
+
+public class Catalogue extends Activity {
+       static final private int MENU_SIGNIN = Menu.FIRST;
+       static final private int MENU_SETTINGS = Menu.FIRST+1;  
+       static final private int MENU_ABOUT = Menu.FIRST+2;
+       
+       static final String[] AUTHORS = new String[] {
+               "Władysław Anczyc",
+               "Hans Christian Andersen",
+               "Adam Asnyk",
+               "Autor nieznany",
+               "Honoré de Balzac",
+               "Michał Bałucki",
+               "Charles Baudelaire",
+               "Władysław Bełza",
+               "Miłosz Biedrzycki",
+               "August Bielowski",
+               "George Gordon Byron",
+               "Joseph Conrad",
+               "Anton Czechow",
+               "Józef Czechowicz",
+               "Daniel Defoe",
+               "Casimir Delavigne",
+               "Antonina Domańska",
+               "Alojzy Feliński",
+               "Aleksander Fredro",
+               "Johann Wolfgang von Goethe",
+               "Bruno Jasieński",
+               "Franciszek Karpiński",
+               "Jan Kasprowicz",
+               "Rudyard Kipling",
+               "Jan Kochanowski",
+               "Maria Konopnicka",
+               "Franciszek Kowalski",
+               "Ignacy Krasicki",
+               "Zygmunt Krasiński",
+               "Teofil Lenartowicz",
+               "Bolesław Leśmian",
+               "Adam Mickiewicz",
+               "Molière",
+               "Jan Andrzej Morsztyn",
+               "Julian Ursyn Niemcewicz",
+               "Cyprian Kamil Norwid",
+               "Artur Oppman",
+               "Eliza Orzeszkowa",
+               "Edgar Allan Poe",
+               "Wincenty Pol",
+               "Ludwik Ksawery Pomian-Łubiński",
+               "Bolesław Prus",
+               "Kazimierz Przerwa-Tetmajer",
+               "Władysław Stanisław Reymont",
+               "Mikołaj Sęp Szarzyński",
+               "William Shakespeare",
+               "Henryk Sienkiewicz",
+               "Juliusz Słowacki",
+               "Sofokles",
+               "Rajnold Suchodolski",
+               "Wacław Święcicki",
+               "Władysław Tarnowski",
+               "Stanisław Ignacy Witkiewicz",
+               "Stefan Witwicki",
+               "Józef Wybicki",
+               "Stanisław Wyspiański",
+               "Gabriela Zapolska",
+               "Stefan Żeromski"
+         };
+       Context ctx;
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.catalogue);
+        
+        ctx = this;
+        final ListView lv = (ListView) findViewById(R.id.catalogueListView);
+        final EditText search = (EditText) findViewById(R.id.catalogueSearch);
+        
+        lv.setAdapter(new ArrayAdapter<String>(this, R.layout.catalogue_list_item, AUTHORS));        
+        lv.setTextFilterEnabled(true);
+
+        lv.setOnItemClickListener(new OnItemClickListener() {
+               @Override
+               public void onItemClick(AdapterView<?> parent, View view,
+              int position, long id) {
+                       startActivity(new Intent(ctx, CatalogueItem.class));
+               }
+        });
+        
+        search.addTextChangedListener(new TextWatcher() {
+                       
+                       @Override
+                       public void onTextChanged(CharSequence s, int start, int before, int count) {
+                               lv.setFilterText(s.toString()); 
+                       }
+                       
+                       @Override
+                       public void beforeTextChanged(CharSequence s, int start, int count,
+                                       int after) {
+                               // TODO Auto-generated method stub
+                               
+                       }
+                       
+                       @Override
+                       public void afterTextChanged(Editable s) {
+                               // TODO Auto-generated method stub
+                               
+                       }
+               });        
+    }
+    
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+       super.onCreateOptionsMenu(menu);
+
+       int groupId;
+       int menuItemId;
+       int menuItemOrder;
+       int menuItemText;
+
+       // settings
+       groupId = 0;
+       menuItemId = MENU_SIGNIN;
+       menuItemOrder = Menu.NONE;
+       menuItemText = R.string.menu_signin;            
+       
+       menu.add(groupId, menuItemId,
+                       menuItemOrder, menuItemText);
+       
+       // settings
+       groupId = 0;
+       menuItemId = MENU_SETTINGS;
+       menuItemOrder = Menu.NONE;
+       menuItemText = R.string.menu_settings;          
+       
+       menu.add(groupId, menuItemId,
+                       menuItemOrder, menuItemText);           
+       
+       // about
+       groupId = 0;
+       menuItemId = MENU_ABOUT;
+       menuItemOrder = Menu.NONE;
+       menuItemText = R.string.menu_about;
+       
+       menu.add(groupId, menuItemId,
+                       menuItemOrder, menuItemText);
+               
+       return true;
+    }
+    
+    public boolean onOptionsItemSelected(MenuItem item) {
+       super.onOptionsItemSelected(item);
+       switch (item.getItemId()) {
+               case (MENU_SIGNIN):
+                       startActivity(new Intent(ctx, SignIn.class));
+                       return true;
+               case (MENU_SETTINGS):
+                       startActivity(new Intent(ctx, Settings.class));
+                       return true;
+               case (MENU_ABOUT):
+                       startActivity(new Intent(ctx, About.class));
+                       return true;                    
+       }
+
+       return false;           
+    }
+    
+}
\ No newline at end of file
diff --git a/src/pl/org/nowoczesnapolska/CatalogueBook.java b/src/pl/org/nowoczesnapolska/CatalogueBook.java
new file mode 100644 (file)
index 0000000..ae3cba6
--- /dev/null
@@ -0,0 +1,127 @@
+package pl.org.nowoczesnapolska;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+
+public class CatalogueBook extends Activity {
+       static final private int MENU_SHARE = Menu.FIRST;
+       static final private int MENU_SHELF = Menu.FIRST+1;
+       static final private int MENU_SIGNIN = Menu.FIRST+2;
+       static final private int MENU_SETTINGS = Menu.FIRST+3;  
+       static final private int MENU_ABOUT = Menu.FIRST+4;
+       
+       Context ctx;
+       
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.catalogue_book);
+        ctx = this;
+        Button read_online = (Button) findViewById(R.id.read_online);
+        
+        read_online.setOnClickListener(new OnClickListener() {
+                       
+                       public void onClick(View v) {
+                               // TODO Auto-generated method stub
+                               startActivity(new Intent(ctx, CatalogueReadOnline.class));
+                       }
+               });    
+    }
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+       super.onCreateOptionsMenu(menu);
+
+       int groupId;
+       int menuItemId;
+       int menuItemOrder;
+       int menuItemText;
+
+       // share
+       groupId = 1;
+       menuItemId = MENU_SHARE;
+       menuItemOrder = Menu.NONE;
+       menuItemText = R.string.menu_share;     
+       
+       menu.add(groupId, menuItemId,
+                       menuItemOrder, menuItemText);
+
+       // shelf
+       groupId = 1;
+       menuItemId = MENU_SHELF;
+       menuItemOrder = Menu.NONE;
+       menuItemText = R.string.menu_shelf;     
+       
+       menu.add(groupId, menuItemId,
+                       menuItemOrder, menuItemText);           
+       
+       
+       // sign in
+       groupId = 0;
+       menuItemId = MENU_SIGNIN;
+       menuItemOrder = Menu.NONE;
+       menuItemText = R.string.menu_signin;            
+       
+       menu.add(groupId, menuItemId,
+                       menuItemOrder, menuItemText);
+       
+       // settings
+       groupId = 0;
+       menuItemId = MENU_SETTINGS;
+       menuItemOrder = Menu.NONE;
+       menuItemText = R.string.menu_settings;          
+       
+       menu.add(groupId, menuItemId,
+                       menuItemOrder, menuItemText);           
+       
+       // about
+       groupId = 0;
+       menuItemId = MENU_ABOUT;
+       menuItemOrder = Menu.NONE;
+       menuItemText = R.string.menu_about;
+       
+       menu.add(groupId, menuItemId,
+                       menuItemOrder, menuItemText);
+               
+       
+       
+       return true;
+    }    
+
+    public boolean onOptionsItemSelected(MenuItem item) {
+       
+       super.onOptionsItemSelected(item);
+       switch (item.getItemId()) {
+               case (MENU_SHARE):
+                               Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
+                               shareIntent.setType("text/plain");
+                               shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Wolne Lektury: Autor");
+                               shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Miron Miron");                         
+                               startActivity(Intent.createChooser(shareIntent, "Share this author"));  
+                       return true;
+               case (MENU_SHELF):                              
+                               startActivity(new Intent(ctx, Shelves.class));  
+                       return true;                            
+               case (MENU_SIGNIN):
+                       startActivity(new Intent(ctx, SignIn.class));
+                       return true;
+               case (MENU_SETTINGS):
+                       startActivity(new Intent(ctx, Settings.class));
+                       return true;
+               case (MENU_ABOUT):
+                       startActivity(new Intent(ctx, About.class));
+                       return true;                    
+       }                       
+
+       return false;           
+    }    
+    
+       
+}
diff --git a/src/pl/org/nowoczesnapolska/CatalogueItem.java b/src/pl/org/nowoczesnapolska/CatalogueItem.java
new file mode 100644 (file)
index 0000000..fbfa3f2
--- /dev/null
@@ -0,0 +1,128 @@
+package pl.org.nowoczesnapolska;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+
+public class CatalogueItem extends Activity {
+       static final String[] BOOKS = new String[] { 
+               "*** (Dobry wieczór, nazywam siê Mickiewicz...)",
+               "Akslop",
+               "Ho³d (Dwa sonety)",
+               "Order",
+               "Pan Tadeusz, czyli ostatni zajazd na Litwie",
+               "Po ciemku",
+               "W ciemno\9cci schodzi moja dusza"
+       };      
+       static final private int MENU_SHARE = Menu.FIRST;
+       static final private int MENU_SIGNIN = Menu.FIRST+1;
+       static final private int MENU_SETTINGS = Menu.FIRST+2;  
+       static final private int MENU_ABOUT = Menu.FIRST+3;
+       
+       Context ctx;
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.catalogue_item_details);
+        ctx = this;
+
+        final ListView lv = (ListView) findViewById(R.id.catalogueBookListView);
+        
+        lv.setAdapter(new ArrayAdapter<String>(this, R.layout.catalogue_book_list_item, BOOKS));        
+        lv.setOnItemClickListener(new OnItemClickListener() {
+               @Override
+               public void onItemClick(AdapterView<?> parent, View view,
+              int position, long id) {
+                       //String selectedItemText = ((TextView) view).getText().toString();
+                               //search.setText(selectedItemText);
+                       //lv.setFilterText(selectedItemText);
+                       startActivity(new Intent(ctx, CatalogueBook.class));
+               }
+        });        
+    }
+    
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+       super.onCreateOptionsMenu(menu);
+
+       int groupId;
+       int menuItemId;
+       int menuItemOrder;
+       int menuItemText;
+
+       // share
+       groupId = 1;
+       menuItemId = MENU_SHARE;
+       menuItemOrder = Menu.NONE;
+       menuItemText = R.string.menu_share;     
+       
+       menu.add(groupId, menuItemId,
+                       menuItemOrder, menuItemText);
+       
+       
+       // sign in
+       groupId = 0;
+       menuItemId = MENU_SIGNIN;
+       menuItemOrder = Menu.NONE;
+       menuItemText = R.string.menu_signin;            
+       
+       menu.add(groupId, menuItemId,
+                       menuItemOrder, menuItemText);
+       
+       // settings
+       groupId = 0;
+       menuItemId = MENU_SETTINGS;
+       menuItemOrder = Menu.NONE;
+       menuItemText = R.string.menu_settings;          
+       
+       menu.add(groupId, menuItemId,
+                       menuItemOrder, menuItemText);           
+       
+       // about
+       groupId = 0;
+       menuItemId = MENU_ABOUT;
+       menuItemOrder = Menu.NONE;
+       menuItemText = R.string.menu_about;
+       
+       menu.add(groupId, menuItemId,
+                       menuItemOrder, menuItemText);
+               
+       
+       
+       return true;
+    }    
+
+    public boolean onOptionsItemSelected(MenuItem item) {
+       
+       super.onOptionsItemSelected(item);
+       switch (item.getItemId()) {
+               case (MENU_SHARE):
+                               Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
+                               shareIntent.setType("text/plain");
+                               shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Wolne Lektury: Autor");
+                               shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Miron Miron");                         
+                               startActivity(Intent.createChooser(shareIntent, "Share this author"));  
+                       return true;
+               case (MENU_SIGNIN):
+                       startActivity(new Intent(ctx, SignIn.class));
+                       return true;
+               case (MENU_SETTINGS):
+                       startActivity(new Intent(ctx, Settings.class));
+                       return true;
+               case (MENU_ABOUT):
+                       startActivity(new Intent(ctx, About.class));
+                       return true;                    
+       }                       
+
+       return false;           
+    }    
+
+}
diff --git a/src/pl/org/nowoczesnapolska/CatalogueReadOnline.java b/src/pl/org/nowoczesnapolska/CatalogueReadOnline.java
new file mode 100644 (file)
index 0000000..7c7b837
--- /dev/null
@@ -0,0 +1,16 @@
+package pl.org.nowoczesnapolska;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.webkit.WebView;
+
+public class CatalogueReadOnline extends Activity {
+       public void onCreate(Bundle savedInstanceState) {
+           super.onCreate(savedInstanceState);
+           setContentView(R.layout.catalogue_read_online);
+
+           WebView mWebView = (WebView) findViewById(R.id.webview);
+           mWebView.getSettings().setJavaScriptEnabled(true);
+           mWebView.loadUrl("http://www.wolnelektury.pl/katalog/lektura/hold-dwa-sonety.html");
+       }
+}
diff --git a/src/pl/org/nowoczesnapolska/Settings.java b/src/pl/org/nowoczesnapolska/Settings.java
new file mode 100644 (file)
index 0000000..18d380d
--- /dev/null
@@ -0,0 +1,16 @@
+package pl.org.nowoczesnapolska;
+
+import android.app.Activity;
+import android.content.Context;
+import android.os.Bundle;
+
+public class Settings extends Activity {
+       Context ctx;
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.settings);
+        
+        ctx = this;
+    }
+}
diff --git a/src/pl/org/nowoczesnapolska/Shelves.java b/src/pl/org/nowoczesnapolska/Shelves.java
new file mode 100644 (file)
index 0000000..95bf961
--- /dev/null
@@ -0,0 +1,95 @@
+package pl.org.nowoczesnapolska;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.os.Bundle;
+import android.text.Editable;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.ListView;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.Toast;
+
+public class Shelves extends Activity {
+       Context ctx;
+       static final String[] SHELVES = new String[] { 
+               "Moje lektury szkolne",
+               "Do przeczytania",
+               "Ulubione",
+               "Do pracy",
+               "Na konkurs",
+       };              
+       
+       
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.catalogue_shelves);
+        ctx = this;
+        
+        final ListView lv = (ListView) findViewById(R.id.catalogueShelvesListView);
+        Button putOnShelf = (Button) findViewById(R.id.putOnShelf);
+        Button addShelf = (Button) findViewById(R.id.addShelf);
+        
+        // shelves list
+        lv.setAdapter(new ArrayAdapter<String>(this, R.layout.catalogue_shelves_list_item, SHELVES));        
+        lv.setOnItemClickListener(new OnItemClickListener() {
+               @Override
+               public void onItemClick(AdapterView<?> parent, View view,
+              int position, long id) {
+                       startActivity(new Intent(ctx, ShelvesItem.class));
+               }
+        });
+        
+        // put on shelf handler
+        putOnShelf.setOnClickListener(new OnClickListener() {
+                       
+                       @Override
+                       public void onClick(View v) {
+                               // dialog with shelves list
+                               AlertDialog.Builder builder = new AlertDialog.Builder(ctx);
+                               builder.setTitle("Choose shelf");
+                               builder.setItems(SHELVES, new DialogInterface.OnClickListener() {
+                                   public void onClick(DialogInterface dialog, int item) {
+                                       Toast.makeText(getApplicationContext(), "Book added to shelf: "+SHELVES[item], Toast.LENGTH_SHORT).show();
+                                   }
+                               });
+                               AlertDialog alert = builder.create();
+                               alert.show();
+                       }
+               });
+        
+        // add shelf handler
+        addShelf.setOnClickListener(new OnClickListener() {
+                       
+                       @Override
+                       public void onClick(View v) {
+                               final EditText input = new EditText(ctx);                               
+                               String message = "Please type shelf name.";
+                               new AlertDialog.Builder(ctx)
+                                       .setTitle("Adding shelf").setMessage(message).setView(
+                                               input)
+                                       .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
+                                                       public void onClick(DialogInterface dialog, int whichButton) {
+                                                               Editable value = input.getText();
+                                                               Toast.makeText(getApplicationContext(), "Shelf "+value+" successfully created", Toast.LENGTH_SHORT).show();
+                                                       }
+                                       })
+                                       .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
+                                               public void onClick(DialogInterface dialog, int whichButton) {
+                                                       // Do nothing.
+                                               }
+                                       })
+                                       .show();                                
+                       }
+               });
+                
+    }
+}
diff --git a/src/pl/org/nowoczesnapolska/ShelvesItem.java b/src/pl/org/nowoczesnapolska/ShelvesItem.java
new file mode 100644 (file)
index 0000000..dfacafb
--- /dev/null
@@ -0,0 +1,15 @@
+package pl.org.nowoczesnapolska;
+
+import android.app.Activity;
+import android.content.Context;
+import android.os.Bundle;
+
+public class ShelvesItem extends Activity {
+       Context ctx;
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.catalogue_shelves_item);
+        ctx = this;
+    }
+}
diff --git a/src/pl/org/nowoczesnapolska/SignIn.java b/src/pl/org/nowoczesnapolska/SignIn.java
new file mode 100644 (file)
index 0000000..811cabc
--- /dev/null
@@ -0,0 +1,55 @@
+package pl.org.nowoczesnapolska;
+
+import java.io.UnsupportedEncodingException;
+
+import oauth.signpost.OAuthConsumer;
+import oauth.signpost.OAuthProvider;
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+
+public class SignIn extends Activity {
+       Context ctx;
+       
+       /* OAuth */
+       private String authURL;
+       private String callbackUrl = "wl://callback";
+       
+       @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.signin);
+        ctx = this;
+        new AuthHelper();
+        
+        Button sign_in = (Button) findViewById(R.id.sign_in);
+        sign_in.setOnClickListener(new OnClickListener() {
+                       
+                       @Override
+                       public void onClick(View v) {
+                               // TODO Auto-generated method stub
+                               String consumerKey = "testKey";
+                               String consumerSecret = "testSecret";
+                               try {
+                                       AuthHelper.OAuthHelper(consumerKey, consumerSecret, callbackUrl);
+                               } catch (UnsupportedEncodingException e1) {
+                                       // TODO Auto-generated catch block
+                                       e1.printStackTrace();
+                               }
+
+                               try {
+                                       authURL = AuthHelper.getRequestToken();
+                                       startActivity(new Intent("android.intent.action.VIEW", Uri.parse(authURL)));
+                               } catch (Exception e) {
+                               }
+               
+                       }
+               });
+    }
+    
+}
\ No newline at end of file