set up back button + cleaning
@ -1,61 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<list>
|
|
||||||
<doc>
|
|
||||||
<url>http://www.shulgan-tash.ru/about/</url>
|
|
||||||
<baseUrl>http://www.shulgan-tash.ru</baseUrl>
|
|
||||||
<localUrl>shulgantash.html</localUrl>
|
|
||||||
<separator>ST_DIV_CLASS</separator>
|
|
||||||
<separatorValue>post-content</separatorValue>
|
|
||||||
<title>Шульганташ</title>
|
|
||||||
<topicImg>http://www.shulgan-tash.ru/wp-content/uploads/2013/07/MG_0164-FullHD.jpg</topicImg>
|
|
||||||
</doc>
|
|
||||||
<doc>
|
|
||||||
<url>http://www.bashnl.ru/o-biblioteke/</url>
|
|
||||||
<baseUrl>http://www.bashnl.ru</baseUrl>
|
|
||||||
<localUrl>bashnl.html</localUrl>
|
|
||||||
<separator>ST_ARTICLE</separator>
|
|
||||||
<separatorValue>article</separatorValue>
|
|
||||||
<title>Библиотека имени Заки Валиди</title>
|
|
||||||
<topicImg>http://upload.wikimedia.org/wikipedia/commons/f/f6/Library_Zaki-Validi.jpg</topicImg>
|
|
||||||
</doc>
|
|
||||||
<doc>
|
|
||||||
<url>http://tv-rb.ru/o-kompanii/</url>
|
|
||||||
<baseUrl>http://tv-rb.ru</baseUrl>
|
|
||||||
<localUrl>tv-rb.html</localUrl>
|
|
||||||
<separator>ST_DIV_CLASS</separator>
|
|
||||||
<separatorValue>page-main-content</separatorValue>
|
|
||||||
<title>БСТ - О компании</title>
|
|
||||||
<topicImg>http://tv-rb.ru/upload/medialibrary/4b6/4b6e96a91e32ed74ca239b0fca90d4a5.jpg</topicImg>
|
|
||||||
</doc>
|
|
||||||
|
|
||||||
<doc>
|
|
||||||
<url>http://skikandry.ru/index/recreation</url>
|
|
||||||
<baseUrl>http://skikandry.ru</baseUrl>
|
|
||||||
<localUrl>skikandry.html</localUrl>
|
|
||||||
<separator>ST_DIV_ID</separator>
|
|
||||||
<separatorValue>article</separatorValue>
|
|
||||||
<title>Кандрыкуль</title>
|
|
||||||
<topicImg>http://skikandry.ru/assets/images/photo/kandry-kul.jpg</topicImg>
|
|
||||||
</doc>
|
|
||||||
<doc>
|
|
||||||
<url>http://www.iremel.net/</url>
|
|
||||||
<baseUrl>http://www.iremel.net</baseUrl>
|
|
||||||
<localUrl>iremel.net.html</localUrl>
|
|
||||||
<separator>ST_DIV_CLASS</separator>
|
|
||||||
<separatorValue>content-all</separatorValue>
|
|
||||||
<title>Гора Иремель</title>
|
|
||||||
<topicImg>http://www.iremel.net/uploads/iremel/p1000694.jpg</topicImg>
|
|
||||||
</doc>
|
|
||||||
<doc>
|
|
||||||
<url>http://invest.bashkortostan.ru/pages/11</url>
|
|
||||||
<baseUrl>http://invest.bashkortostan.ru</baseUrl>
|
|
||||||
<localUrl>invest.bashkortostan.html</localUrl>
|
|
||||||
<separator>ST_DIV_CLASS</separator>
|
|
||||||
<separatorValue>page-content</separatorValue>
|
|
||||||
<title>Преимущества Башкортостана</title>
|
|
||||||
<topicImg>http://invest.bashkortostan.ru/uploads/picture/picture/50/normal_republic.png</topicImg>
|
|
||||||
</doc>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</list>
|
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 20 KiB |
BIN
android/res/drawable-hdpi/logo.png
Normal file
After Width: | Height: | Size: 41 KiB |
BIN
android/res/drawable-ldpi/logo.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
android/res/drawable-ldpi/see_more_small.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
android/res/drawable-mdpi/logo.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
android/res/drawable-mdpi/see_more_small.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
android/res/drawable-xhdpi/logo.png
Normal file
After Width: | Height: | Size: 41 KiB |
BIN
android/res/drawable-xxhdpi/logo.png
Normal file
After Width: | Height: | Size: 41 KiB |
@ -1,13 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:shape="rectangle" >
|
|
||||||
|
|
||||||
<corners android:radius="3dp" />
|
|
||||||
|
|
||||||
<solid android:color="#000000" />
|
|
||||||
|
|
||||||
<stroke
|
|
||||||
android:width="2px"
|
|
||||||
android:color="#ffffff" />
|
|
||||||
|
|
||||||
</shape>
|
|
Before Width: | Height: | Size: 195 B |
Before Width: | Height: | Size: 14 KiB |
@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
|
||||||
|
|
||||||
<item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/img_culture1" />
|
|
||||||
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/img_culture1_highlighted" />
|
|
||||||
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/img_culture1_highlighted" />
|
|
||||||
<item android:drawable="@drawable/img_culture1" />
|
|
||||||
|
|
||||||
</selector>
|
|
@ -1,8 +0,0 @@
|
|||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item android:drawable="@drawable/img_culture1"/>
|
|
||||||
<item>
|
|
||||||
<shape>
|
|
||||||
<solid android:color="@color/button_highlighted" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
</layer-list>
|
|
Before Width: | Height: | Size: 18 KiB |
@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
|
||||||
|
|
||||||
<item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/img_culture2" />
|
|
||||||
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/img_culture2_highlighted" />
|
|
||||||
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/img_culture2_highlighted" />
|
|
||||||
<item android:drawable="@drawable/img_culture2" />
|
|
||||||
|
|
||||||
</selector>
|
|
@ -1,8 +0,0 @@
|
|||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item android:drawable="@drawable/img_culture2"/>
|
|
||||||
<item>
|
|
||||||
<shape>
|
|
||||||
<solid android:color="@color/button_highlighted" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
</layer-list>
|
|
Before Width: | Height: | Size: 16 KiB |
@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
|
||||||
|
|
||||||
<item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/img_culture3" />
|
|
||||||
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/img_culture3_highlighted" />
|
|
||||||
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/img_culture3_highlighted" />
|
|
||||||
<item android:drawable="@drawable/img_culture3" />
|
|
||||||
|
|
||||||
</selector>
|
|
@ -1,8 +0,0 @@
|
|||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item android:drawable="@drawable/img_culture3"/>
|
|
||||||
<item>
|
|
||||||
<shape>
|
|
||||||
<solid android:color="@color/button_highlighted" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
</layer-list>
|
|
Before Width: | Height: | Size: 21 KiB |
@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
|
||||||
|
|
||||||
<item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/img_education1" />
|
|
||||||
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/img_education1_highlighted" />
|
|
||||||
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/img_education1_highlighted" />
|
|
||||||
<item android:drawable="@drawable/img_education1" />
|
|
||||||
|
|
||||||
</selector>
|
|
@ -1,8 +0,0 @@
|
|||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item android:drawable="@drawable/img_education1"/>
|
|
||||||
<item>
|
|
||||||
<shape>
|
|
||||||
<solid android:color="@color/button_highlighted" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
</layer-list>
|
|
Before Width: | Height: | Size: 12 KiB |
@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
|
||||||
|
|
||||||
<item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/img_education2" />
|
|
||||||
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/img_education2_highlighted" />
|
|
||||||
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/img_education2_highlighted" />
|
|
||||||
<item android:drawable="@drawable/img_education2" />
|
|
||||||
|
|
||||||
</selector>
|
|
@ -1,8 +0,0 @@
|
|||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item android:drawable="@drawable/img_education2"/>
|
|
||||||
<item>
|
|
||||||
<shape>
|
|
||||||
<solid android:color="@color/button_highlighted" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
</layer-list>
|
|
Before Width: | Height: | Size: 15 KiB |
@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
|
||||||
|
|
||||||
<item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/img_education3" />
|
|
||||||
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/img_education3_highlighted" />
|
|
||||||
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/img_education3_highlighted" />
|
|
||||||
<item android:drawable="@drawable/img_education3" />
|
|
||||||
|
|
||||||
</selector>
|
|
@ -1,8 +0,0 @@
|
|||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item android:drawable="@drawable/img_education3"/>
|
|
||||||
<item>
|
|
||||||
<shape>
|
|
||||||
<solid android:color="@color/button_highlighted" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
</layer-list>
|
|
Before Width: | Height: | Size: 15 KiB |
@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
|
||||||
|
|
||||||
<item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/img_for_investor1" />
|
|
||||||
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/img_for_investor1_highlighted" />
|
|
||||||
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/img_for_investor1_highlighted" />
|
|
||||||
<item android:drawable="@drawable/img_for_investor1" />
|
|
||||||
|
|
||||||
</selector>
|
|
@ -1,8 +0,0 @@
|
|||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item android:drawable="@drawable/img_for_investor1"/>
|
|
||||||
<item>
|
|
||||||
<shape>
|
|
||||||
<solid android:color="@color/button_highlighted" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
</layer-list>
|
|
Before Width: | Height: | Size: 7.0 KiB |
@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
|
||||||
|
|
||||||
<item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/img_for_investor2" />
|
|
||||||
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/img_for_investor2_highlighted" />
|
|
||||||
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/img_for_investor2_highlighted" />
|
|
||||||
<item android:drawable="@drawable/img_for_investor2" />
|
|
||||||
|
|
||||||
</selector>
|
|
@ -1,8 +0,0 @@
|
|||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item android:drawable="@drawable/img_for_investor2"/>
|
|
||||||
<item>
|
|
||||||
<shape>
|
|
||||||
<solid android:color="@color/button_highlighted" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
</layer-list>
|
|
Before Width: | Height: | Size: 11 KiB |
@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
|
||||||
|
|
||||||
<item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/img_for_investor3" />
|
|
||||||
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/img_for_investor3_highlighted" />
|
|
||||||
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/img_for_investor3_highlighted" />
|
|
||||||
<item android:drawable="@drawable/img_for_investor3" />
|
|
||||||
|
|
||||||
</selector>
|
|
@ -1,8 +0,0 @@
|
|||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item android:drawable="@drawable/img_for_investor3"/>
|
|
||||||
<item>
|
|
||||||
<shape>
|
|
||||||
<solid android:color="@color/button_highlighted" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
</layer-list>
|
|
Before Width: | Height: | Size: 14 KiB |
@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
|
||||||
|
|
||||||
<item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/img_for_investor4" />
|
|
||||||
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/img_for_investor4_highlighted" />
|
|
||||||
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/img_for_investor4_highlighted" />
|
|
||||||
<item android:drawable="@drawable/img_for_investor4" />
|
|
||||||
|
|
||||||
</selector>
|
|
@ -1,8 +0,0 @@
|
|||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item android:drawable="@drawable/img_for_investor4"/>
|
|
||||||
<item>
|
|
||||||
<shape>
|
|
||||||
<solid android:color="@color/button_highlighted" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
</layer-list>
|
|
Before Width: | Height: | Size: 15 KiB |
@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
|
||||||
|
|
||||||
<item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/img_tourist1" />
|
|
||||||
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/img_tourist1_highlighted" />
|
|
||||||
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/img_tourist1_highlighted" />
|
|
||||||
<item android:drawable="@drawable/img_tourist1" />
|
|
||||||
|
|
||||||
</selector>
|
|
@ -1,8 +0,0 @@
|
|||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item android:drawable="@drawable/img_tourist1"/>
|
|
||||||
<item>
|
|
||||||
<shape>
|
|
||||||
<solid android:color="@color/button_highlighted" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
</layer-list>
|
|
Before Width: | Height: | Size: 17 KiB |
@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
|
||||||
|
|
||||||
<item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/img_tourist2" />
|
|
||||||
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/img_tourist2_highlighted" />
|
|
||||||
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/img_tourist2_highlighted" />
|
|
||||||
<item android:drawable="@drawable/img_tourist2" />
|
|
||||||
|
|
||||||
</selector>
|
|
@ -1,8 +0,0 @@
|
|||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item android:drawable="@drawable/img_tourist2"/>
|
|
||||||
<item>
|
|
||||||
<shape>
|
|
||||||
<solid android:color="@color/button_highlighted" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
</layer-list>
|
|
Before Width: | Height: | Size: 15 KiB |
@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
|
||||||
|
|
||||||
<item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/img_tourist3" />
|
|
||||||
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/img_tourist3_highlighted" />
|
|
||||||
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/img_tourist3_highlighted" />
|
|
||||||
<item android:drawable="@drawable/img_tourist3" />
|
|
||||||
|
|
||||||
</selector>
|
|
@ -1,8 +0,0 @@
|
|||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item android:drawable="@drawable/img_tourist3"/>
|
|
||||||
<item>
|
|
||||||
<shape>
|
|
||||||
<solid android:color="@color/button_highlighted" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
</layer-list>
|
|
Before Width: | Height: | Size: 15 KiB |
@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
|
||||||
|
|
||||||
<item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/img_tourist4" />
|
|
||||||
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/img_tourist4_highlighted" />
|
|
||||||
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/img_tourist4_highlighted" />
|
|
||||||
<item android:drawable="@drawable/img_tourist4" />
|
|
||||||
|
|
||||||
</selector>
|
|
@ -1,8 +0,0 @@
|
|||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item android:drawable="@drawable/img_tourist4"/>
|
|
||||||
<item>
|
|
||||||
<shape>
|
|
||||||
<solid android:color="@color/button_highlighted" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
</layer-list>
|
|
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 1.4 KiB |
@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
|
||||||
|
|
||||||
<item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/see_more" />
|
|
||||||
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/see_more_highlighted" />
|
|
||||||
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/see_more_highlighted" />
|
|
||||||
<item android:drawable="@drawable/see_more" />
|
|
||||||
|
|
||||||
</selector>
|
|
@ -1,8 +0,0 @@
|
|||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item android:drawable="@drawable/see_more"/>
|
|
||||||
<item>
|
|
||||||
<shape>
|
|
||||||
<solid android:color="@color/button_highlighted" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
</layer-list>
|
|
Before Width: | Height: | Size: 328 B |
@ -1,38 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:id="@+id/LinearLayout1"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="6dp"
|
|
||||||
android:background="@color/bkg1"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingBottom="4dp"
|
|
||||||
android:paddingTop="4dp"
|
|
||||||
android:showDividers="middle" >
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/imageView"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="120dp"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_margin="2dp"
|
|
||||||
android:background="@color/bkg2"
|
|
||||||
android:scaleType="centerInside" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/nameTextView"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_margin="2dp"
|
|
||||||
android:text="aaa"
|
|
||||||
android:textSize="24sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/authorTextView"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="2dp" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
@ -1,28 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:id="@+id/LinearLayout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="4dp"
|
|
||||||
android:background="@color/light_grey_1"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:showDividers="middle" >
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/imageButton"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:adjustViewBounds="true"
|
|
||||||
android:contentDescription="@string/related_image"
|
|
||||||
android:maxHeight="180dp"
|
|
||||||
android:minHeight="180dp"
|
|
||||||
android:scaleType="fitXY" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/dateTextView"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
@ -1,26 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:id="@+id/linearLayout"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="4dp"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:showDividers="middle" >
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/dateTextView"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="left"
|
|
||||||
android:text="TextView"
|
|
||||||
android:textColor="@color/text_white" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/subTextView"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="left"
|
|
||||||
android:text="TextView"
|
|
||||||
android:textColor="@color/text_white" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
@ -1,62 +0,0 @@
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_margin="0dp"
|
|
||||||
android:background="@color/bkg1"
|
|
||||||
android:orientation="vertical"
|
|
||||||
tools:context="fishrungames.bashgid.MainPageFragment" >
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/imageView"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_margin="4dp"
|
|
||||||
android:contentDescription="@string/news_content_description"
|
|
||||||
android:scaleType="fitCenter"
|
|
||||||
android:src="@drawable/transparent" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/nameTextView"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:textColorHint="@color/text_black"
|
|
||||||
android:textSize="24sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/authorTextView"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/priceTextView"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/descriptionTextView"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/buyButton"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="16dp"
|
|
||||||
android:layout_marginRight="16dp"
|
|
||||||
android:text="@string/buy" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/readButton"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="16dp"
|
|
||||||
android:layout_marginRight="16dp"
|
|
||||||
android:text="@string/read" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical" >
|
|
||||||
|
|
||||||
<GridView
|
|
||||||
android:id="@+id/gridView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:horizontalSpacing="4dp"
|
|
||||||
android:numColumns="3"
|
|
||||||
android:verticalSpacing="4dp" >
|
|
||||||
|
|
||||||
</GridView>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
@ -1,17 +0,0 @@
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
|
||||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
|
||||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
|
||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
|
||||||
tools:context="fishrungames.bashgid.SettingsFragment" >
|
|
||||||
|
|
||||||
<WebView
|
|
||||||
android:id="@+id/webView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
@ -1,20 +0,0 @@
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/bkg1"
|
|
||||||
android:gravity="center_horizontal"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
|
||||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
|
||||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
|
||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
|
||||||
tools:context="fishrungames.bashgid.LinkContentFragment" >
|
|
||||||
|
|
||||||
<ListView
|
|
||||||
android:id="@+id/listView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent" >
|
|
||||||
</ListView>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
@ -1,20 +0,0 @@
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/bkg1"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingBottom="0dp"
|
|
||||||
android:paddingLeft="0dp"
|
|
||||||
android:paddingRight="0dp"
|
|
||||||
android:paddingTop="0dp"
|
|
||||||
tools:context="fishrungames.bashgid.MapHolderFragment" >
|
|
||||||
|
|
||||||
<fragment
|
|
||||||
android:id="@+id/map"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
class="com.google.android.gms.maps.SupportMapFragment" />
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
@ -1,32 +0,0 @@
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_margin="0dp"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:background="@color/bkg1"
|
|
||||||
tools:context="fishrungames.bashgid.MainPageFragment" >
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/titleTextView"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textColorHint="@color/text_black"
|
|
||||||
android:textSize="24sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/imageView"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:src="@drawable/transparent"
|
|
||||||
android:contentDescription="@string/news_content_description" />
|
|
||||||
|
|
||||||
<WebView
|
|
||||||
android:id="@+id/webView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/bkg1"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingBottom="0dp"
|
|
||||||
android:paddingLeft="0dp"
|
|
||||||
android:paddingRight="0dp"
|
|
||||||
android:paddingTop="0dp"
|
|
||||||
tools:context="fishrungames.bashgid.StreetViewHolderFragment" >
|
|
||||||
|
|
||||||
<fragment
|
|
||||||
android:name="com.google.android.gms.maps.SupportStreetViewPanoramaFragment"
|
|
||||||
android:id="@+id/streetviewpanorama"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
@ -1,32 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:id="@+id/LinearLayout1"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="4dp"
|
|
||||||
android:background="@color/bkg1"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingBottom="4dp"
|
|
||||||
android:paddingTop="4dp"
|
|
||||||
android:showDividers="middle" >
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/button"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/dateTextView"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/imageView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:adjustViewBounds="true"
|
|
||||||
android:maxHeight="200dp"
|
|
||||||
android:scaleType="fitCenter" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
@ -32,7 +32,7 @@
|
|||||||
style="?android:attr/borderlessButtonStyle"
|
style="?android:attr/borderlessButtonStyle"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="right"
|
android:layout_gravity="right|center_vertical"
|
||||||
android:layout_marginBottom="@dimen/medium_margin"
|
android:layout_marginBottom="@dimen/medium_margin"
|
||||||
android:layout_marginLeft="@dimen/medium_margin"
|
android:layout_marginLeft="@dimen/medium_margin"
|
||||||
android:layout_marginTop="@dimen/medium_margin"
|
android:layout_marginTop="@dimen/medium_margin"
|
||||||
@ -44,7 +44,7 @@
|
|||||||
android:id="@+id/imageButton"
|
android:id="@+id/imageButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="right"
|
android:layout_gravity="right|center_vertical"
|
||||||
android:layout_margin="@dimen/medium_margin"
|
android:layout_margin="@dimen/medium_margin"
|
||||||
android:background="@drawable/transparent"
|
android:background="@drawable/transparent"
|
||||||
android:src="@drawable/see_more_small" />
|
android:src="@drawable/see_more_small" />
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:id="@+id/LinearLayout2"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="4dp"
|
|
||||||
android:background="@color/light_grey_1"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:showDividers="middle" >
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical" >
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/titleTextView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="TextView"
|
|
||||||
android:textSize="20sp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/dateTextView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="TextView" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
@ -1,12 +0,0 @@
|
|||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
tools:context="fishrungames.bashgid.MainActivity" >
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/action_settings"
|
|
||||||
android:orderInCategory="100"
|
|
||||||
android:title="@string/action_settings"
|
|
||||||
app:showAsAction="never"/>
|
|
||||||
|
|
||||||
</menu>
|
|
@ -1,10 +0,0 @@
|
|||||||
<resources>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Example customization of dimensions originally defined in res/values/dimens.xml
|
|
||||||
(such as screen margins) for screens with more than 820dp of available width. This
|
|
||||||
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively).
|
|
||||||
-->
|
|
||||||
<dimen name="activity_horizontal_margin">64dp</dimen>
|
|
||||||
|
|
||||||
</resources>
|
|
@ -1,13 +1,11 @@
|
|||||||
package fishrungames.bashgid;
|
package fishrungames.bashgid;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import fishrungames.bashgid.core.AlbumManager.AlbumShortData;
|
import fishrungames.bashgid.core.AlbumManager.AlbumShortData;
|
||||||
|
|
||||||
import fishrungames.networkutils.ImageManager;
|
import fishrungames.networkutils.ImageManager;
|
||||||
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
@ -27,7 +25,6 @@ import android.widget.ProgressBar;
|
|||||||
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
|
||||||
public class AlbumListFragment extends Fragment
|
public class AlbumListFragment extends Fragment
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -36,27 +33,27 @@ public class AlbumListFragment extends Fragment
|
|||||||
GridView gridView;
|
GridView gridView;
|
||||||
|
|
||||||
ArrayList<AlbumShortData> albumArr;
|
ArrayList<AlbumShortData> albumArr;
|
||||||
|
|
||||||
ProgressBar progressBar;
|
ProgressBar progressBar;
|
||||||
|
|
||||||
public AlbumListFragment()
|
public AlbumListFragment()
|
||||||
{
|
{
|
||||||
RestoreAlbumList();
|
RestoreAlbumList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public AlbumListFragment(ArrayList<AlbumShortData> albumArr)
|
public AlbumListFragment(ArrayList<AlbumShortData> albumArr)
|
||||||
{
|
{
|
||||||
this.albumArr = albumArr;
|
this.albumArr = albumArr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||||
|
{
|
||||||
|
|
||||||
View rootView = inflater.inflate(R.layout.fragment_video_page, container, false);
|
View rootView = inflater.inflate(R.layout.fragment_video_page, container, false);
|
||||||
|
|
||||||
progressBar = (ProgressBar)rootView.findViewById(R.id.progressBar);
|
progressBar = (ProgressBar) rootView.findViewById(R.id.progressBar);
|
||||||
|
|
||||||
progressBar.setVisibility(View.VISIBLE);
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
gridView = (GridView) rootView.findViewById(R.id.gridView);
|
gridView = (GridView) rootView.findViewById(R.id.gridView);
|
||||||
@ -78,40 +75,39 @@ public class AlbumListFragment extends Fragment
|
|||||||
|
|
||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RestoreAlbumList()
|
public void RestoreAlbumList()
|
||||||
{
|
{
|
||||||
albumArr = new ArrayList<AlbumShortData>();
|
albumArr = new ArrayList<AlbumShortData>();
|
||||||
|
|
||||||
DatabaseGetAlbumListTask task = new DatabaseGetAlbumListTask();
|
DatabaseGetAlbumListTask task = new DatabaseGetAlbumListTask();
|
||||||
|
|
||||||
task.mHandler = MainActivity.getInstance().mHandler;
|
task.mHandler = MainActivity.getInstance().mHandler;
|
||||||
|
|
||||||
task.execute();
|
task.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetAlbumList(ArrayList<AlbumShortData> albumArr)
|
public void SetAlbumList(ArrayList<AlbumShortData> albumArr)
|
||||||
{
|
{
|
||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
|
|
||||||
this.albumArr = albumArr;
|
this.albumArr = albumArr;
|
||||||
|
|
||||||
listAdapter.notifyDataSetChanged();
|
listAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class DatabaseGetAlbumListTask extends AsyncTask<String, Integer, Long>
|
public static class DatabaseGetAlbumListTask extends AsyncTask<String, Integer, Long>
|
||||||
{
|
{
|
||||||
|
|
||||||
ArrayList<AlbumShortData> albumArr;
|
ArrayList<AlbumShortData> albumArr;
|
||||||
|
|
||||||
public Handler mHandler;
|
public Handler mHandler;
|
||||||
|
|
||||||
protected Long doInBackground(String... queryArr)
|
protected Long doInBackground(String... queryArr)
|
||||||
{
|
{
|
||||||
|
|
||||||
albumArr = MainActivity.getInstance().albumDataSource.GetAllAlbumShortDataExceptHidden();
|
albumArr = MainActivity.getInstance().albumDataSource.GetAllAlbumShortDataExceptHidden();
|
||||||
|
|
||||||
return (long) 0;
|
return (long) 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,43 +127,47 @@ public class AlbumListFragment extends Fragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ListAdapter extends BaseAdapter
|
||||||
|
{
|
||||||
public class ListAdapter extends BaseAdapter {
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
|
||||||
public ListAdapter(Context c) {
|
public ListAdapter(Context c)
|
||||||
|
{
|
||||||
mContext = c;
|
mContext = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCount() {
|
public int getCount()
|
||||||
|
{
|
||||||
return albumArr.size();
|
return albumArr.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getItem(int position) {
|
public Object getItem(int position)
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getItemId(int position) {
|
public long getItemId(int position)
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// create a new ImageView for each item referenced by the Adapter
|
// create a new ImageView for each item referenced by the Adapter
|
||||||
@SuppressLint("InflateParams")
|
@SuppressLint("InflateParams")
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
public View getView(int position, View convertView, ViewGroup parent)
|
||||||
|
{
|
||||||
|
|
||||||
View view;
|
View view;
|
||||||
if (convertView == null) { // if it's not recycled, initialize some attributes
|
if (convertView == null)
|
||||||
|
{ // if it's not recycled, initialize some attributes
|
||||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
view = inflater.inflate(R.layout.video_page_list_element, null);
|
view = inflater.inflate(R.layout.video_page_list_element, null);
|
||||||
|
|
||||||
|
} else
|
||||||
} else {
|
{
|
||||||
view = convertView;
|
view = convertView;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageView imageView = (ImageView)view.findViewById(R.id.imageView);
|
ImageView imageView = (ImageView) view.findViewById(R.id.imageView);
|
||||||
TextView nameTextView = (TextView) view.findViewById(R.id.nameTextView);
|
TextView nameTextView = (TextView) view.findViewById(R.id.nameTextView);
|
||||||
|
|
||||||
ImageManager.getInstance().ApplyImageToImageView(imageView, albumArr.get(position).firstImageUrl);
|
ImageManager.getInstance().ApplyImageToImageView(imageView, albumArr.get(position).firstImageUrl);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package fishrungames.bashgid;
|
package fishrungames.bashgid;
|
||||||
|
|
||||||
|
|
||||||
import it.sephiroth.android.library.widget.AdapterView.OnItemClickListener;
|
import it.sephiroth.android.library.widget.AdapterView.OnItemClickListener;
|
||||||
import it.sephiroth.android.library.widget.HListView;
|
import it.sephiroth.android.library.widget.HListView;
|
||||||
|
|
||||||
@ -12,14 +11,11 @@ import org.osmdroid.api.IMapController;
|
|||||||
import org.osmdroid.util.GeoPoint;
|
import org.osmdroid.util.GeoPoint;
|
||||||
import org.osmdroid.views.MapView;
|
import org.osmdroid.views.MapView;
|
||||||
|
|
||||||
import fishrungames.bashgid.OsmMapHolderFragment.CustomItemizedOverlay;
|
|
||||||
import fishrungames.bashgid.OsmMapHolderFragment.NoInteractionOverlay;
|
import fishrungames.bashgid.OsmMapHolderFragment.NoInteractionOverlay;
|
||||||
import fishrungames.bashgid.core.ArticleManager;
|
import fishrungames.bashgid.core.ArticleManager;
|
||||||
import fishrungames.bashgid.core.DatabaseGetAlbumTask;
|
|
||||||
import fishrungames.bashgid.core.DatabaseGetArticleTask;
|
import fishrungames.bashgid.core.DatabaseGetArticleTask;
|
||||||
import fishrungames.bashgid.core.LocationHolder;
|
|
||||||
import fishrungames.bashgid.core.AlbumManager.AlbumFullData;
|
|
||||||
import fishrungames.bashgid.core.AlbumManager.AlbumShortData;
|
|
||||||
import fishrungames.bashgid.core.ArticleManager.ArticleFullData;
|
import fishrungames.bashgid.core.ArticleManager.ArticleFullData;
|
||||||
import fishrungames.bashgid.core.PhotoManager.PhotoRecordData;
|
import fishrungames.bashgid.core.PhotoManager.PhotoRecordData;
|
||||||
import fishrungames.networkutils.ImageManager;
|
import fishrungames.networkutils.ImageManager;
|
||||||
@ -29,10 +25,9 @@ import android.content.Intent;
|
|||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.Message;
|
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@ -43,31 +38,28 @@ import android.view.View.OnLongClickListener;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.BaseAdapter;
|
import android.widget.BaseAdapter;
|
||||||
|
|
||||||
import android.widget.AdapterView;
|
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class ArticleFragment extends Fragment
|
public class ArticleFragment extends Fragment
|
||||||
{
|
{
|
||||||
|
|
||||||
public static class ArticleLayoutElement
|
public static class ArticleLayoutElement
|
||||||
{
|
{
|
||||||
public int type; //0 title; 1 text; 2 photo; 3 geotag; 4 photo_album; 5 button 6 phone
|
public int type; // 0 title; 1 text; 2 photo; 3 geotag; 4 photo_album; 5
|
||||||
|
// button 6 phone
|
||||||
public String value;
|
public String value;
|
||||||
|
|
||||||
|
|
||||||
public double geoLat;
|
public double geoLat;
|
||||||
public double geoLon;
|
public double geoLon;
|
||||||
|
|
||||||
public int albumPos;
|
public int albumPos;
|
||||||
|
|
||||||
public ArticleLayoutElement(int type, String value)
|
public ArticleLayoutElement(int type, String value)
|
||||||
{
|
{
|
||||||
this.type = type;
|
this.type = type;
|
||||||
@ -76,8 +68,7 @@ public class ArticleFragment extends Fragment
|
|||||||
this.geoLon = 0;
|
this.geoLon = 0;
|
||||||
this.albumPos = -1;
|
this.albumPos = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ArticleLayoutElement(double geoLat, double geoLon)
|
public ArticleLayoutElement(double geoLat, double geoLon)
|
||||||
{
|
{
|
||||||
this.type = 3;
|
this.type = 3;
|
||||||
@ -86,7 +77,7 @@ public class ArticleFragment extends Fragment
|
|||||||
this.geoLon = geoLon;
|
this.geoLon = geoLon;
|
||||||
this.albumPos = -1;
|
this.albumPos = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArticleLayoutElement(int albumPos)
|
public ArticleLayoutElement(int albumPos)
|
||||||
{
|
{
|
||||||
this.type = 4;
|
this.type = 4;
|
||||||
@ -96,8 +87,9 @@ public class ArticleFragment extends Fragment
|
|||||||
this.albumPos = albumPos;
|
this.albumPos = albumPos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MapOverlay extends org.osmdroid.views.overlay.Overlay {
|
public class MapOverlay extends org.osmdroid.views.overlay.Overlay
|
||||||
|
{
|
||||||
|
|
||||||
public MapOverlay(Context ctx)
|
public MapOverlay(Context ctx)
|
||||||
{
|
{
|
||||||
@ -107,58 +99,59 @@ public class ArticleFragment extends Fragment
|
|||||||
@Override
|
@Override
|
||||||
protected void draw(Canvas arg0, MapView arg1, boolean arg2)
|
protected void draw(Canvas arg0, MapView arg1, boolean arg2)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouchEvent(final MotionEvent event, final MapView mapView) {
|
public boolean onTouchEvent(final MotionEvent event, final MapView mapView)
|
||||||
|
{
|
||||||
|
MainActivity.getInstance().SetLastArticleName(articleName);
|
||||||
|
|
||||||
if (event.getAction() == MotionEvent.ACTION_UP)
|
if (event.getAction() == MotionEvent.ACTION_UP)
|
||||||
{
|
{
|
||||||
MainActivity.getInstance().OpenMapScreen(article);
|
MainActivity.getInstance().OpenMapScreen(article, MainActivity.TAG_BACK_TO_ARTICLEFRAGMENT);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ListView listView;
|
ListView listView;
|
||||||
ListAdapter listAdapter;
|
ListAdapter listAdapter;
|
||||||
|
|
||||||
ProgressBar progressBar;
|
ProgressBar progressBar;
|
||||||
|
|
||||||
String articleName;
|
String articleName;
|
||||||
ArticleFullData article;
|
ArticleFullData article;
|
||||||
ArrayList<ArticleLayoutElement> articleLayout = new ArrayList<ArticleLayoutElement>();
|
ArrayList<ArticleLayoutElement> articleLayout = new ArrayList<ArticleLayoutElement>();
|
||||||
|
|
||||||
public ArticleFragment()
|
public ArticleFragment()
|
||||||
{
|
{
|
||||||
articleName = "";
|
articleName = "";
|
||||||
article = null;
|
article = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArticleFragment(String articleName)
|
public ArticleFragment(String articleName)
|
||||||
{
|
{
|
||||||
this.articleName = articleName;
|
this.articleName = articleName;
|
||||||
RestoreArticle();
|
RestoreArticle();
|
||||||
ReloadLayout();
|
ReloadLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArticleFragment(ArticleFullData article)
|
public ArticleFragment(ArticleFullData article)
|
||||||
{
|
{
|
||||||
this.articleName = article.name;
|
this.articleName = article.name;
|
||||||
this.article = article;
|
this.article = article;
|
||||||
ReloadLayout();
|
ReloadLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSaveInstanceState(final Bundle outState) {
|
public void onSaveInstanceState(final Bundle outState)
|
||||||
super.onSaveInstanceState(outState);
|
{
|
||||||
outState.putString("articleName", articleName);
|
super.onSaveInstanceState(outState);
|
||||||
}
|
outState.putString("articleName", articleName);
|
||||||
|
}
|
||||||
|
|
||||||
public void RestoreArticle()
|
public void RestoreArticle()
|
||||||
{
|
{
|
||||||
DatabaseGetArticleTask task = new DatabaseGetArticleTask();
|
DatabaseGetArticleTask task = new DatabaseGetArticleTask();
|
||||||
@ -167,342 +160,332 @@ public class ArticleFragment extends Fragment
|
|||||||
|
|
||||||
task.execute(articleName);
|
task.execute(articleName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void ReloadLayout()
|
public void ReloadLayout()
|
||||||
{
|
{
|
||||||
articleLayout.clear();
|
articleLayout.clear();
|
||||||
|
|
||||||
if (article != null)
|
if (article != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
articleLayout.add(new ArticleLayoutElement(0, article.title));
|
articleLayout.add(new ArticleLayoutElement(0, article.title));
|
||||||
|
|
||||||
PhotoRecordData zeroPhoto = null;
|
PhotoRecordData zeroPhoto = null;
|
||||||
|
|
||||||
if (article.albumArr.size() > 0)
|
if (article.albumArr.size() > 0)
|
||||||
{
|
|
||||||
if (article.albumArr.get(0).photoRecordArr.size() > 0)
|
|
||||||
{
|
{
|
||||||
zeroPhoto = article.albumArr.get(0).photoRecordArr.get(0);
|
if (article.albumArr.get(0).photoRecordArr.size() > 0)
|
||||||
|
{
|
||||||
|
zeroPhoto = article.albumArr.get(0).photoRecordArr.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
if (zeroPhoto != null)
|
||||||
|
{
|
||||||
if (zeroPhoto != null)
|
articleLayout.add(new ArticleLayoutElement(2, zeroPhoto.imageUrl));
|
||||||
{
|
}
|
||||||
articleLayout.add(new ArticleLayoutElement(2, zeroPhoto.imageUrl));
|
|
||||||
}
|
articleLayout.add(new ArticleLayoutElement(1, article.content));
|
||||||
|
|
||||||
|
if (article.phone.length() > 0)
|
||||||
|
{
|
||||||
articleLayout.add(new ArticleLayoutElement(1, article.content));
|
articleLayout.add(new ArticleLayoutElement(6, article.phone));
|
||||||
|
|
||||||
if (article.phone.length() > 0)
|
}
|
||||||
{
|
|
||||||
articleLayout.add(new ArticleLayoutElement(6, article.phone));
|
if (article.geoLat != 0 && article.geoLon != 0)
|
||||||
|
{
|
||||||
}
|
articleLayout.add(new ArticleLayoutElement(article.geoLat, article.geoLon));
|
||||||
|
}
|
||||||
if (article.geoLat != 0 && article.geoLon != 0)
|
|
||||||
{
|
for (int i = 0; i < article.albumArr.size(); i++)
|
||||||
articleLayout.add(new ArticleLayoutElement(article.geoLat, article.geoLon));
|
{
|
||||||
}
|
articleLayout.add(new ArticleLayoutElement(i));
|
||||||
|
}
|
||||||
for (int i = 0; i < article.albumArr.size(); i++)
|
|
||||||
{
|
if (article.externalLink.length() > 0)
|
||||||
articleLayout.add(new ArticleLayoutElement(i));
|
{
|
||||||
}
|
articleLayout.add(new ArticleLayoutElement(5, article.externalLink));
|
||||||
|
}
|
||||||
if (article.externalLink.length() > 0)
|
|
||||||
{
|
|
||||||
articleLayout.add(new ArticleLayoutElement(5, article.externalLink));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetArticle(ArticleFullData article)
|
public void SetArticle(ArticleFullData article)
|
||||||
{
|
{
|
||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
|
|
||||||
this.article = article;
|
this.article = article;
|
||||||
|
|
||||||
ReloadLayout();
|
ReloadLayout();
|
||||||
|
|
||||||
listAdapter.notifyDataSetChanged();
|
listAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||||
|
{
|
||||||
if (savedInstanceState != null) {
|
|
||||||
|
if (savedInstanceState != null)
|
||||||
|
{
|
||||||
articleName = savedInstanceState.getString("articleName");
|
articleName = savedInstanceState.getString("articleName");
|
||||||
RestoreArticle();
|
RestoreArticle();
|
||||||
ReloadLayout();
|
ReloadLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
View rootView = inflater.inflate(R.layout.fragment_article_page, container, false);
|
View rootView = inflater.inflate(R.layout.fragment_article_page, container, false);
|
||||||
|
|
||||||
progressBar = (ProgressBar)rootView.findViewById(R.id.progressBar);
|
progressBar = (ProgressBar) rootView.findViewById(R.id.progressBar);
|
||||||
|
|
||||||
progressBar.setVisibility(View.VISIBLE);
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
|
||||||
listView = (ListView) rootView.findViewById(R.id.listView);
|
listView = (ListView) rootView.findViewById(R.id.listView);
|
||||||
|
|
||||||
listAdapter = new ListAdapter(getActivity());
|
listAdapter = new ListAdapter(getActivity());
|
||||||
|
|
||||||
listView.setAdapter(listAdapter);
|
listView.setAdapter(listAdapter);
|
||||||
|
|
||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ListAdapter extends BaseAdapter {
|
|
||||||
private Context mContext;
|
|
||||||
|
|
||||||
public ListAdapter(Context c) {
|
public class ListAdapter extends BaseAdapter
|
||||||
mContext = c;
|
{
|
||||||
}
|
private Context mContext;
|
||||||
|
|
||||||
public int getCount() {
|
public ListAdapter(Context c)
|
||||||
return articleLayout.size();
|
{
|
||||||
}
|
mContext = c;
|
||||||
|
}
|
||||||
|
|
||||||
public Object getItem(int position) {
|
public int getCount()
|
||||||
return null;
|
{
|
||||||
}
|
return articleLayout.size();
|
||||||
|
}
|
||||||
|
|
||||||
public long getItemId(int position) {
|
public Object getItem(int position)
|
||||||
return 0;
|
{
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public int getViewTypeCount()
|
public long getItemId(int position)
|
||||||
{
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getViewTypeCount()
|
||||||
|
{
|
||||||
return 7;
|
return 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getItemViewType(int position)
|
|
||||||
{
|
|
||||||
return articleLayout.get(position).type;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// create a new ImageView for each item referenced by the Adapter
|
@Override
|
||||||
@SuppressLint("InflateParams")
|
public int getItemViewType(int position)
|
||||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
{
|
||||||
|
return articleLayout.get(position).type;
|
||||||
|
|
||||||
View view;
|
}
|
||||||
if (convertView == null) { // if it's not recycled, initialize some attributes
|
|
||||||
if (getItemViewType(position) == 0 || getItemViewType(position) == 1)
|
// create a new ImageView for each item referenced by the Adapter
|
||||||
{
|
@SuppressLint("InflateParams")
|
||||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
public View getView(final int position, View convertView, ViewGroup parent)
|
||||||
view = inflater.inflate(R.layout.article_text_element, null);
|
{
|
||||||
}
|
|
||||||
else if (getItemViewType(position) == 2)
|
View view;
|
||||||
{
|
if (convertView == null)
|
||||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
{ // if it's not recycled, initialize some attributes
|
||||||
view = inflater.inflate(R.layout.article_photo_element, null);
|
if (getItemViewType(position) == 0 || getItemViewType(position) == 1)
|
||||||
}
|
{
|
||||||
else if (getItemViewType(position) == 3)
|
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
{
|
view = inflater.inflate(R.layout.article_text_element, null);
|
||||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
} else if (getItemViewType(position) == 2)
|
||||||
view = inflater.inflate(R.layout.article_geotag_element, null);
|
{
|
||||||
}
|
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
else if (getItemViewType(position) == 4)
|
view = inflater.inflate(R.layout.article_photo_element, null);
|
||||||
{
|
} else if (getItemViewType(position) == 3)
|
||||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
{
|
||||||
view = inflater.inflate(R.layout.article_album_element, null);
|
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
}
|
view = inflater.inflate(R.layout.article_geotag_element, null);
|
||||||
else if (getItemViewType(position) == 5)
|
} else if (getItemViewType(position) == 4)
|
||||||
{
|
{
|
||||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
view = inflater.inflate(R.layout.article_button_element, null);
|
view = inflater.inflate(R.layout.article_album_element, null);
|
||||||
}
|
} else if (getItemViewType(position) == 5)
|
||||||
else //if (getItemViewType(position) == 6)
|
{
|
||||||
{
|
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
view = inflater.inflate(R.layout.article_button_element, null);
|
||||||
view = inflater.inflate(R.layout.article_phone_element, null);
|
} else
|
||||||
}
|
// if (getItemViewType(position) == 6)
|
||||||
} else {
|
{
|
||||||
view = convertView;
|
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
}
|
view = inflater.inflate(R.layout.article_phone_element, null);
|
||||||
|
}
|
||||||
|
} else
|
||||||
if (getItemViewType(position) == 0)
|
{
|
||||||
{
|
view = convertView;
|
||||||
TextView textView = (TextView) view.findViewById(R.id.dateTextView);
|
}
|
||||||
|
|
||||||
textView.setText(articleLayout.get(position).value);
|
if (getItemViewType(position) == 0)
|
||||||
|
{
|
||||||
if (article.type == ArticleManager.ARTICLE_TYPE_NEWS)
|
TextView textView = (TextView) view.findViewById(R.id.dateTextView);
|
||||||
{
|
|
||||||
textView.setTextSize(getResources().getDimension(R.dimen.xlarge_text_size));
|
textView.setText(articleLayout.get(position).value);
|
||||||
}
|
|
||||||
else
|
if (article.type == ArticleManager.ARTICLE_TYPE_NEWS)
|
||||||
{
|
{
|
||||||
textView.setTextSize(getResources().getDimension(R.dimen.xxlarge_text_size));
|
textView.setTextSize(getResources().getDimension(R.dimen.xlarge_text_size));
|
||||||
}
|
} else
|
||||||
|
{
|
||||||
textView.setTypeface(null, Typeface.BOLD);
|
textView.setTextSize(getResources().getDimension(R.dimen.xxlarge_text_size));
|
||||||
textView.setGravity(Gravity.CENTER_HORIZONTAL);
|
}
|
||||||
|
|
||||||
}
|
textView.setTypeface(null, Typeface.BOLD);
|
||||||
else if (getItemViewType(position) == 1)
|
textView.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||||
{
|
|
||||||
TextView textView = (TextView) view.findViewById(R.id.dateTextView);
|
} else if (getItemViewType(position) == 1)
|
||||||
|
{
|
||||||
textView.setText(articleLayout.get(position).value);
|
TextView textView = (TextView) view.findViewById(R.id.dateTextView);
|
||||||
|
|
||||||
textView.setTextSize(getResources().getDimension(R.dimen.article_content_text_size));
|
textView.setText(articleLayout.get(position).value);
|
||||||
textView.setTypeface(null, Typeface.NORMAL);
|
|
||||||
textView.setGravity(Gravity.LEFT);
|
textView.setTextSize(getResources().getDimension(R.dimen.article_content_text_size));
|
||||||
|
textView.setTypeface(null, Typeface.NORMAL);
|
||||||
}
|
textView.setGravity(Gravity.LEFT);
|
||||||
else if (getItemViewType(position) == 2)
|
|
||||||
{
|
} else if (getItemViewType(position) == 2)
|
||||||
TextView textView = (TextView) view.findViewById(R.id.dateTextView);
|
{
|
||||||
ImageView imageView = (ImageView) view.findViewById(R.id.imageView);
|
TextView textView = (TextView) view.findViewById(R.id.dateTextView);
|
||||||
|
ImageView imageView = (ImageView) view.findViewById(R.id.imageView);
|
||||||
PhotoRecordData photo = MainActivity.getInstance().photoDataSource.GetPhotoByImageUrl(articleLayout.get(position).value);
|
|
||||||
|
PhotoRecordData photo = MainActivity.getInstance().photoDataSource.GetPhotoByImageUrl(articleLayout.get(position).value);
|
||||||
ImageManager.getInstance().ApplyImageToImageView(imageView, photo.imageUrl);
|
|
||||||
|
ImageManager.getInstance().ApplyImageToImageView(imageView, photo.imageUrl);
|
||||||
textView.setText(photo.title);
|
|
||||||
}
|
textView.setText(photo.title);
|
||||||
else if (getItemViewType(position) == 3)
|
} else if (getItemViewType(position) == 3)
|
||||||
{
|
{
|
||||||
double geoLat = articleLayout.get(position).geoLat;
|
double geoLat = articleLayout.get(position).geoLat;
|
||||||
double geoLon = articleLayout.get(position).geoLon;
|
double geoLon = articleLayout.get(position).geoLon;
|
||||||
|
|
||||||
TextView addressTextView = (TextView) view.findViewById(R.id.addressTextView);
|
TextView addressTextView = (TextView) view.findViewById(R.id.addressTextView);
|
||||||
TextView hintTextView = (TextView) view.findViewById(R.id.hintTextView);
|
TextView hintTextView = (TextView) view.findViewById(R.id.hintTextView);
|
||||||
|
|
||||||
if (article.address.length() > 0)
|
if (article.address.length() > 0)
|
||||||
{
|
{
|
||||||
addressTextView.setText(article.address);
|
addressTextView.setText(article.address);
|
||||||
addressTextView.setVisibility(View.VISIBLE);
|
addressTextView.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
hintTextView.setVisibility(View.VISIBLE);
|
hintTextView.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
final String copied_text = getResources().getString(R.string.copied_text);
|
final String copied_text = getResources().getString(R.string.copied_text);
|
||||||
|
|
||||||
addressTextView.setOnLongClickListener(new OnLongClickListener(){
|
addressTextView.setOnLongClickListener(new OnLongClickListener()
|
||||||
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onLongClick(View v)
|
public boolean onLongClick(View v)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB)
|
||||||
if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) {
|
{
|
||||||
android.text.ClipboardManager clipboard = (android.text.ClipboardManager) MainActivity.getInstance().getSystemService(Context.CLIPBOARD_SERVICE);
|
android.text.ClipboardManager clipboard = (android.text.ClipboardManager) MainActivity.getInstance().getSystemService(
|
||||||
clipboard.setText(article.address);
|
Context.CLIPBOARD_SERVICE);
|
||||||
} else {
|
clipboard.setText(article.address);
|
||||||
android.content.ClipboardManager clipboard = (android.content.ClipboardManager) MainActivity.getInstance().getSystemService(Context.CLIPBOARD_SERVICE);
|
} else
|
||||||
android.content.ClipData clip = android.content.ClipData.newPlainText(copied_text, article.address);
|
{
|
||||||
clipboard.setPrimaryClip(clip);
|
android.content.ClipboardManager clipboard = (android.content.ClipboardManager) MainActivity.getInstance().getSystemService(
|
||||||
|
Context.CLIPBOARD_SERVICE);
|
||||||
|
android.content.ClipData clip = android.content.ClipData.newPlainText(copied_text, article.address);
|
||||||
|
clipboard.setPrimaryClip(clip);
|
||||||
}
|
}
|
||||||
|
|
||||||
CharSequence text = getResources().getString(R.string.text_is_copied);
|
CharSequence text = getResources().getString(R.string.text_is_copied);
|
||||||
Toast toast = Toast.makeText(MainActivity.getInstance(), text, Toast.LENGTH_SHORT);
|
Toast toast = Toast.makeText(MainActivity.getInstance(), text, Toast.LENGTH_SHORT);
|
||||||
toast.show();
|
toast.show();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
|
||||||
//editText.setKeyListener(null);
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
addressTextView.setVisibility(View.GONE);
|
|
||||||
hintTextView.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
MapView mapView = (MapView) view.findViewById(R.id.mapview);
|
|
||||||
|
|
||||||
|
});
|
||||||
mapView.setMaxZoomLevel(20);
|
// editText.setKeyListener(null);
|
||||||
mapView.setMinZoomLevel(4);
|
|
||||||
|
} else
|
||||||
//mapView.setBuiltInZoomControls(true);
|
{
|
||||||
//mapView.setMultiTouchControls(true);
|
addressTextView.setVisibility(View.GONE);
|
||||||
|
hintTextView.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
IMapController mapController = mapView.getController();
|
|
||||||
|
MapView mapView = (MapView) view.findViewById(R.id.mapview);
|
||||||
|
|
||||||
GeoPoint markerPoint = new GeoPoint(geoLat, geoLon);
|
mapView.setMaxZoomLevel(20);
|
||||||
|
mapView.setMinZoomLevel(4);
|
||||||
mapController.setZoom(16);
|
|
||||||
mapController.animateTo(markerPoint);
|
// mapView.setBuiltInZoomControls(true);
|
||||||
|
// mapView.setMultiTouchControls(true);
|
||||||
|
|
||||||
ResourceProxy resourceProxy = new DefaultResourceProxyImpl(getActivity());
|
IMapController mapController = mapView.getController();
|
||||||
NoInteractionOverlay itemizedOverlay = new NoInteractionOverlay(getResources().getDrawable(R.drawable.russia_icon), resourceProxy);
|
|
||||||
|
GeoPoint markerPoint = new GeoPoint(geoLat, geoLon);
|
||||||
itemizedOverlay.addOverlayItem(markerPoint);
|
|
||||||
|
mapController.setZoom(16);
|
||||||
mapView.getOverlays().add(itemizedOverlay);
|
mapController.animateTo(markerPoint);
|
||||||
|
|
||||||
|
ResourceProxy resourceProxy = new DefaultResourceProxyImpl(getActivity());
|
||||||
MapOverlay mapOverlay = new MapOverlay(getActivity());
|
NoInteractionOverlay itemizedOverlay = new NoInteractionOverlay(getResources().getDrawable(R.drawable.russia_icon), resourceProxy);
|
||||||
|
|
||||||
mapView.getOverlays().add(mapOverlay);
|
itemizedOverlay.addOverlayItem(markerPoint);
|
||||||
|
|
||||||
|
mapView.getOverlays().add(itemizedOverlay);
|
||||||
}
|
|
||||||
else if (getItemViewType(position) == 4)
|
MapOverlay mapOverlay = new MapOverlay(getActivity());
|
||||||
{
|
|
||||||
|
mapView.getOverlays().add(mapOverlay);
|
||||||
TextView titleTextView = (TextView) view.findViewById(R.id.titleTextView);
|
|
||||||
|
} else if (getItemViewType(position) == 4)
|
||||||
titleTextView.setText(article.albumArr.get(articleLayout.get(position).albumPos).title);
|
{
|
||||||
|
|
||||||
TextView contentTextView = (TextView) view.findViewById(R.id.contentTextView);
|
TextView titleTextView = (TextView) view.findViewById(R.id.titleTextView);
|
||||||
|
|
||||||
contentTextView.setText(article.albumArr.get(articleLayout.get(position).albumPos).description);
|
titleTextView.setText(article.albumArr.get(articleLayout.get(position).albumPos).title);
|
||||||
|
|
||||||
HListView hListView = (HListView) view.findViewById(R.id.hListView);
|
TextView contentTextView = (TextView) view.findViewById(R.id.contentTextView);
|
||||||
|
|
||||||
hListView.setAdapter(new MainPageHListViewAdapters.PhotoAlbumElementAdapter(getActivity(), article.albumArr.get(articleLayout.get(position).albumPos)));
|
contentTextView.setText(article.albumArr.get(articleLayout.get(position).albumPos).description);
|
||||||
|
|
||||||
hListView.setOnItemClickListener(new OnItemClickListener(){
|
HListView hListView = (HListView) view.findViewById(R.id.hListView);
|
||||||
|
|
||||||
|
hListView.setAdapter(new MainPageHListViewAdapters.PhotoAlbumElementAdapter(getActivity(),
|
||||||
|
article.albumArr.get(articleLayout.get(position).albumPos)));
|
||||||
|
|
||||||
|
hListView.setOnItemClickListener(new OnItemClickListener()
|
||||||
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(it.sephiroth.android.library.widget.AdapterView<?> parent, View view, int innerPosition, long id)
|
public void onItemClick(it.sephiroth.android.library.widget.AdapterView<?> parent, View view, int innerPosition, long id)
|
||||||
{
|
{
|
||||||
MainActivity.getInstance().SetLastArticleName(articleName);
|
MainActivity.getInstance().SetLastArticleName(articleName);
|
||||||
|
|
||||||
String albumName = article.albumArr.get(articleLayout.get(position).albumPos).name;
|
String albumName = article.albumArr.get(articleLayout.get(position).albumPos).name;
|
||||||
|
|
||||||
MainActivity.getInstance().OpenPhotoScreen(albumName, innerPosition, MainActivity.TAG_FROM_ARTICLEFRAGMENT_TO_PHOTOFRAGMENT);
|
MainActivity.getInstance().OpenPhotoScreen(albumName, innerPosition, MainActivity.TAG_BACK_TO_ARTICLEFRAGMENT);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
} else if (getItemViewType(position) == 5)
|
||||||
else if (getItemViewType(position) == 5)
|
{
|
||||||
{
|
Button button = (Button) view.findViewById(R.id.button);
|
||||||
Button button = (Button) view.findViewById(R.id.button);
|
|
||||||
|
if (article.externalLinkText.length() > 0)
|
||||||
if (article.externalLinkText.length() > 0)
|
{
|
||||||
{
|
button.setText(article.externalLinkText);
|
||||||
button.setText(article.externalLinkText);
|
} else
|
||||||
}
|
{
|
||||||
else
|
button.setText(R.string.go_to_website);
|
||||||
{
|
}
|
||||||
button.setText(R.string.go_to_website);
|
|
||||||
}
|
button.setOnClickListener(new OnClickListener()
|
||||||
|
{
|
||||||
button.setOnClickListener(new OnClickListener()
|
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v)
|
public void onClick(View v)
|
||||||
{
|
{
|
||||||
@ -510,19 +493,17 @@ public class ArticleFragment extends Fragment
|
|||||||
i.setData(Uri.parse(articleLayout.get(position).value));
|
i.setData(Uri.parse(articleLayout.get(position).value));
|
||||||
startActivity(i);
|
startActivity(i);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
} else if (getItemViewType(position) == 6)
|
||||||
else if (getItemViewType(position) == 6)
|
{
|
||||||
{
|
Button button = (Button) view.findViewById(R.id.button);
|
||||||
Button button = (Button) view.findViewById(R.id.button);
|
|
||||||
|
final String phone = article.phone;
|
||||||
final String phone = article.phone;
|
|
||||||
|
button.setText(phone);
|
||||||
button.setText(phone);
|
|
||||||
|
button.setOnClickListener(new OnClickListener()
|
||||||
|
{
|
||||||
button.setOnClickListener(new OnClickListener()
|
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v)
|
public void onClick(View v)
|
||||||
{
|
{
|
||||||
@ -531,13 +512,11 @@ public class ArticleFragment extends Fragment
|
|||||||
intent.setData(Uri.parse(uri));
|
intent.setData(Uri.parse(uri));
|
||||||
MainActivity.getInstance().startActivity(intent);
|
MainActivity.getInstance().startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,62 +0,0 @@
|
|||||||
package fishrungames.bashgid;
|
|
||||||
|
|
||||||
|
|
||||||
import fishrungames.networkutils.ImageManager;
|
|
||||||
import fishrungames.bashgid.core.BookManager.BookRecord;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
|
|
||||||
public class BookRecordFragment extends Fragment
|
|
||||||
{
|
|
||||||
|
|
||||||
BookRecord bookRecord;
|
|
||||||
|
|
||||||
public BookRecordFragment(BookRecord bookRecord)
|
|
||||||
{
|
|
||||||
this.bookRecord = bookRecord;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
|
||||||
View rootView = inflater.inflate(R.layout.fragment_book_record_page, container, false);
|
|
||||||
|
|
||||||
TextView nameTextView = (TextView) rootView.findViewById(R.id.nameTextView);
|
|
||||||
nameTextView.setText(bookRecord.name);
|
|
||||||
|
|
||||||
TextView authorTextView = (TextView) rootView.findViewById(R.id.authorTextView);
|
|
||||||
authorTextView.setText(bookRecord.author);
|
|
||||||
|
|
||||||
TextView descriptionTextView = (TextView) rootView.findViewById(R.id.descriptionTextView);
|
|
||||||
descriptionTextView.setText(bookRecord.description);
|
|
||||||
|
|
||||||
TextView priceTextView = (TextView) rootView.findViewById(R.id.priceTextView);
|
|
||||||
priceTextView.setText(getResources().getString(R.string.price) + Integer.toString(bookRecord.price) + " " + getResources().getString(R.string.rub));
|
|
||||||
|
|
||||||
ImageView imageView = (ImageView) rootView.findViewById(R.id.imageView);
|
|
||||||
|
|
||||||
if (bookRecord.imageUrl.length() == 0)
|
|
||||||
{
|
|
||||||
imageView.setImageResource(R.drawable.no_picture);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ImageManager.getInstance().ApplyImageToImageView(imageView, bookRecord.imageUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
//ImageManager.getInstance().ApplyImageToImageView(imageView, realImageUrl);
|
|
||||||
|
|
||||||
//Button buyButton = (Button) rootView.findViewById(R.id.buyButton);
|
|
||||||
//Button readButton = (Button) rootView.findViewById(R.id.readButton);
|
|
||||||
|
|
||||||
return rootView;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,175 +0,0 @@
|
|||||||
package fishrungames.bashgid;
|
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import fishrungames.bashgid.core.BookManager;
|
|
||||||
import fishrungames.networkutils.ImageManager;
|
|
||||||
import fishrungames.networkutils.UniversalActionWithCallback;
|
|
||||||
import fishrungames.networkutils.interfaces.RemoveCallbackInterface;
|
|
||||||
import fishrungames.networkutils.interfaces.UpdateAndFinishCallbackInterface;
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.AdapterView;
|
|
||||||
import android.widget.AdapterView.OnItemClickListener;
|
|
||||||
import android.widget.BaseAdapter;
|
|
||||||
import android.widget.GridView;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
|
|
||||||
public class BooksFragment extends Fragment implements UpdateAndFinishCallbackInterface
|
|
||||||
{
|
|
||||||
|
|
||||||
ListAdapter listAdapter;
|
|
||||||
|
|
||||||
GridView gridView;
|
|
||||||
|
|
||||||
ArrayList<BookManager.BookRecord> bookRecordArr;
|
|
||||||
|
|
||||||
RemoveCallbackInterface removeCallback = null;
|
|
||||||
Object removeCallbackSynchronizer = new Object();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
|
||||||
|
|
||||||
|
|
||||||
bookRecordArr = BookManager.getInstance().getBooks();
|
|
||||||
|
|
||||||
removeCallback = UniversalActionWithCallback.PerformActionIfNotPerforming(BookManager.getInstance(), null, this, "BookManager");
|
|
||||||
|
|
||||||
|
|
||||||
View rootView = inflater.inflate(R.layout.fragment_books_page, container, false);
|
|
||||||
|
|
||||||
gridView = (GridView) rootView.findViewById(R.id.gridView);
|
|
||||||
|
|
||||||
listAdapter = new ListAdapter(getActivity());
|
|
||||||
|
|
||||||
gridView.setAdapter(listAdapter);
|
|
||||||
|
|
||||||
gridView.setOnItemClickListener(new OnItemClickListener()
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
|
|
||||||
{
|
|
||||||
MainActivity.getInstance().OpenBookRecordScreen(bookRecordArr.get(position), MainActivity.TAG_FROM_BOOKSFRAGMENT_TO_BOOKRECORDFRAGMENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
RefreshBookList();
|
|
||||||
|
|
||||||
return rootView;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDestroyView()
|
|
||||||
{
|
|
||||||
synchronized (removeCallbackSynchronizer)
|
|
||||||
{
|
|
||||||
if (removeCallback != null)
|
|
||||||
{
|
|
||||||
removeCallback.RemoveCallback();
|
|
||||||
removeCallback = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
super.onDestroyView();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RefreshBookList()
|
|
||||||
{
|
|
||||||
bookRecordArr = BookManager.getInstance().getBooks();
|
|
||||||
|
|
||||||
listAdapter.notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void OnFinished()
|
|
||||||
{
|
|
||||||
synchronized (removeCallbackSynchronizer)
|
|
||||||
{
|
|
||||||
removeCallback = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void OnUpdated(Bundle result)
|
|
||||||
{
|
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
RefreshBookList();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ListAdapter extends BaseAdapter {
|
|
||||||
private Context mContext;
|
|
||||||
|
|
||||||
public ListAdapter(Context c) {
|
|
||||||
mContext = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCount() {
|
|
||||||
return bookRecordArr.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getItem(int position) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getItemId(int position) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// create a new ImageView for each item referenced by the Adapter
|
|
||||||
@SuppressLint("InflateParams")
|
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
|
||||||
|
|
||||||
|
|
||||||
View view;
|
|
||||||
if (convertView == null) { // if it's not recycled, initialize some attributes
|
|
||||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
|
||||||
view = inflater.inflate(R.layout.books_page_list_element, null);
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
view = convertView;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImageView imageView = (ImageView)view.findViewById(R.id.imageView);
|
|
||||||
TextView nameTextView = (TextView) view.findViewById(R.id.nameTextView);
|
|
||||||
TextView authorTextView = (TextView) view.findViewById(R.id.authorTextView);
|
|
||||||
|
|
||||||
if (bookRecordArr.get(position).imageUrl.length() == 0)
|
|
||||||
{
|
|
||||||
imageView.setImageResource(R.drawable.no_picture);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ImageManager.getInstance().ApplyImageToImageView(imageView, bookRecordArr.get(position).imageUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
nameTextView.setText(bookRecordArr.get(position).name);
|
|
||||||
|
|
||||||
authorTextView.setText(bookRecordArr.get(position).author);
|
|
||||||
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -7,10 +7,9 @@ import fishrungames.bashgid.core.DatabaseGetJournalListTask;
|
|||||||
import fishrungames.bashgid.core.JournalManager.JournalSemiFullData;
|
import fishrungames.bashgid.core.JournalManager.JournalSemiFullData;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.AsyncTask;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.Message;
|
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -25,165 +24,167 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
public class CatalogFragment extends Fragment
|
public class CatalogFragment extends Fragment
|
||||||
{
|
{
|
||||||
|
|
||||||
ListView listView;
|
ListView listView;
|
||||||
ListAdapter listAdapter;
|
ListAdapter listAdapter;
|
||||||
ProgressBar progressBar;
|
ProgressBar progressBar;
|
||||||
|
|
||||||
ArrayList<JournalSemiFullData> journalList;
|
ArrayList<JournalSemiFullData> journalList;
|
||||||
|
|
||||||
DatabaseGetJournalListTask databaseGetJournalListTask = null;
|
DatabaseGetJournalListTask databaseGetJournalListTask = null;
|
||||||
|
|
||||||
public CatalogFragment()
|
public CatalogFragment()
|
||||||
{
|
{
|
||||||
RestoreJournalList();
|
RestoreJournalList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CatalogFragment(ArrayList<JournalSemiFullData> journalList)
|
public CatalogFragment(ArrayList<JournalSemiFullData> journalList)
|
||||||
{
|
{
|
||||||
this.journalList = journalList;
|
this.journalList = journalList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||||
|
{
|
||||||
|
|
||||||
View rootView = inflater.inflate(R.layout.fragment_catalog_page, container, false);
|
View rootView = inflater.inflate(R.layout.fragment_catalog_page, container, false);
|
||||||
|
|
||||||
progressBar = (ProgressBar)rootView.findViewById(R.id.progressBar);
|
progressBar = (ProgressBar) rootView.findViewById(R.id.progressBar);
|
||||||
|
|
||||||
|
|
||||||
progressBar.setVisibility(View.VISIBLE);
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
listView = (ListView) rootView.findViewById(R.id.listView);
|
listView = (ListView) rootView.findViewById(R.id.listView);
|
||||||
|
|
||||||
listAdapter = new ListAdapter(getActivity());
|
listAdapter = new ListAdapter(getActivity());
|
||||||
|
|
||||||
listView.setAdapter(listAdapter);
|
listView.setAdapter(listAdapter);
|
||||||
|
|
||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyView ()
|
public void onDestroyView()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (databaseGetJournalListTask != null)
|
if (databaseGetJournalListTask != null)
|
||||||
{
|
{
|
||||||
databaseGetJournalListTask.cancel(false);
|
databaseGetJournalListTask.cancel(false);
|
||||||
databaseGetJournalListTask = null;
|
databaseGetJournalListTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onDestroyView();
|
super.onDestroyView();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RestoreJournalList()
|
public void RestoreJournalList()
|
||||||
{
|
{
|
||||||
journalList = new ArrayList<JournalSemiFullData>();
|
journalList = new ArrayList<JournalSemiFullData>();
|
||||||
|
|
||||||
databaseGetJournalListTask = new DatabaseGetJournalListTask();
|
databaseGetJournalListTask = new DatabaseGetJournalListTask();
|
||||||
|
|
||||||
databaseGetJournalListTask.mHandler = MainActivity.getInstance().mHandler;
|
databaseGetJournalListTask.mHandler = MainActivity.getInstance().mHandler;
|
||||||
|
|
||||||
databaseGetJournalListTask.execute();
|
databaseGetJournalListTask.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetJournalList(ArrayList<JournalSemiFullData> journalList)
|
public void SetJournalList(ArrayList<JournalSemiFullData> journalList)
|
||||||
{
|
{
|
||||||
databaseGetJournalListTask = null;
|
databaseGetJournalListTask = null;
|
||||||
|
|
||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
|
|
||||||
this.journalList = journalList;
|
this.journalList = journalList;
|
||||||
|
|
||||||
listAdapter.notifyDataSetChanged();
|
listAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class ListAdapter extends BaseAdapter {
|
|
||||||
private Context mContext;
|
|
||||||
|
|
||||||
public ListAdapter(Context c) {
|
public class ListAdapter extends BaseAdapter
|
||||||
mContext = c;
|
{
|
||||||
}
|
private Context mContext;
|
||||||
|
|
||||||
public int getCount() {
|
public ListAdapter(Context c)
|
||||||
return journalList.size();
|
{
|
||||||
}
|
mContext = c;
|
||||||
|
}
|
||||||
|
|
||||||
public Object getItem(int position) {
|
public int getCount()
|
||||||
return null;
|
{
|
||||||
}
|
return journalList.size();
|
||||||
|
}
|
||||||
|
|
||||||
public long getItemId(int position) {
|
public Object getItem(int position)
|
||||||
return 0;
|
{
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// create a new ImageView for each item referenced by the Adapter
|
public long getItemId(int position)
|
||||||
@SuppressLint("InflateParams")
|
{
|
||||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
View view;
|
|
||||||
|
|
||||||
if (convertView == null) { // if it's not recycled, initialize some attributes
|
|
||||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
|
||||||
view = inflater.inflate(R.layout.main_page_list_element, null);
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
view = convertView;
|
|
||||||
}
|
|
||||||
|
|
||||||
TextView textView = (TextView) view.findViewById(R.id.dateTextView);
|
|
||||||
|
|
||||||
TextView descriptionTextView = (TextView) view.findViewById(R.id.descriptionTextView);
|
|
||||||
|
|
||||||
Button button = (Button) view.findViewById(R.id.button);
|
|
||||||
ImageButton imageButton = (ImageButton) view.findViewById(R.id.imageButton);
|
|
||||||
|
|
||||||
HListView hListView = (HListView) view.findViewById(R.id.hListView);
|
|
||||||
|
|
||||||
hListView.setAdapter(new MainPageHListViewAdapters.JournalElementAdapter(getActivity(), journalList.get(position)));
|
|
||||||
|
|
||||||
textView.setText(journalList.get(position).title);
|
// create a new ImageView for each item referenced by the Adapter
|
||||||
|
@SuppressLint("InflateParams")
|
||||||
if (journalList.get(position).description.length() > 0)
|
public View getView(final int position, View convertView, ViewGroup parent)
|
||||||
{
|
{
|
||||||
descriptionTextView.setText(journalList.get(position).description);
|
|
||||||
|
View view;
|
||||||
descriptionTextView.setVisibility(View.VISIBLE);
|
|
||||||
}
|
if (convertView == null)
|
||||||
else
|
{ // if it's not recycled, initialize some attributes
|
||||||
{
|
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
descriptionTextView.setVisibility(View.GONE);
|
view = inflater.inflate(R.layout.main_page_list_element, null);
|
||||||
}
|
|
||||||
|
} else
|
||||||
|
{
|
||||||
button.setText(R.string.see_all);
|
view = convertView;
|
||||||
|
}
|
||||||
button.setOnClickListener(new OnClickListener()
|
|
||||||
{
|
TextView textView = (TextView) view.findViewById(R.id.dateTextView);
|
||||||
|
|
||||||
|
TextView descriptionTextView = (TextView) view.findViewById(R.id.descriptionTextView);
|
||||||
|
|
||||||
|
Button button = (Button) view.findViewById(R.id.button);
|
||||||
|
ImageButton imageButton = (ImageButton) view.findViewById(R.id.imageButton);
|
||||||
|
|
||||||
|
HListView hListView = (HListView) view.findViewById(R.id.hListView);
|
||||||
|
|
||||||
|
hListView.setAdapter(new MainPageHListViewAdapters.JournalElementAdapter(getActivity(), journalList.get(position)));
|
||||||
|
|
||||||
|
textView.setText(journalList.get(position).title);
|
||||||
|
|
||||||
|
if (journalList.get(position).description.length() > 0)
|
||||||
|
{
|
||||||
|
descriptionTextView.setText(journalList.get(position).description);
|
||||||
|
|
||||||
|
descriptionTextView.setVisibility(View.VISIBLE);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
descriptionTextView.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
button.setText(R.string.see_all);
|
||||||
|
|
||||||
|
button.setOnClickListener(new OnClickListener()
|
||||||
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v)
|
public void onClick(View v)
|
||||||
{
|
{
|
||||||
MainActivity.getInstance().OpenJournalScreen(journalList.get(position).name, MainActivity.TAG_FROM_CATALOGFRAGMENT_TO_JOURNALFRAGMENT);
|
MainActivity.getInstance().OpenJournalScreen(journalList.get(position).name, MainActivity.TAG_BACK_TO_CATALOGFRAGMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
imageButton.setOnClickListener(new OnClickListener()
|
});
|
||||||
{
|
|
||||||
|
imageButton.setOnClickListener(new OnClickListener()
|
||||||
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v)
|
public void onClick(View v)
|
||||||
{
|
{
|
||||||
MainActivity.getInstance().OpenJournalScreen(journalList.get(position).name, MainActivity.TAG_FROM_CATALOGFRAGMENT_TO_JOURNALFRAGMENT);
|
MainActivity.getInstance().OpenJournalScreen(journalList.get(position).name, MainActivity.TAG_BACK_TO_CATALOGFRAGMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,27 +0,0 @@
|
|||||||
package fishrungames.bashgid;
|
|
||||||
|
|
||||||
import fishrungames.networkutils.ContextHolder;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.webkit.WebView;
|
|
||||||
|
|
||||||
public class HtmlViewerFragment extends Fragment
|
|
||||||
{
|
|
||||||
|
|
||||||
public String url = "";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
|
||||||
|
|
||||||
View rootView = inflater.inflate(R.layout.fragment_html_viewer, container, false);
|
|
||||||
|
|
||||||
WebView webView = (WebView)rootView.findViewById(R.id.webView);
|
|
||||||
|
|
||||||
webView.loadUrl("file:///" + ContextHolder.getContext().getFilesDir().getAbsolutePath() + "/" + url);
|
|
||||||
|
|
||||||
return rootView;
|
|
||||||
}
|
|
||||||
}
|
|
@ -97,24 +97,19 @@ public class JournalFragment extends Fragment
|
|||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
|
||||||
{
|
{
|
||||||
/*
|
MainActivity.getInstance().SetLastJournalName(journalName);
|
||||||
if (journal.geoCategory == 1)
|
|
||||||
{
|
|
||||||
position = position - 1; // because there is header for geo objects
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
if (position == 0)
|
if (position == 0)
|
||||||
{
|
{
|
||||||
if (journal.geoCategory == 1)
|
if (journal.geoCategory == 1)
|
||||||
{
|
{
|
||||||
MainActivity.getInstance().OpenMapScreen(journalName);
|
MainActivity.getInstance().OpenMapScreen(journalName, MainActivity.TAG_BACK_TO_JOURNALFRAGMENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
MainActivity.getInstance().OpenArticleScreen(journal.articleArr.get(position-1).name, MainActivity.TAG_TO_MAINFRAGMENT);
|
MainActivity.getInstance().OpenArticleScreen(journal.articleArr.get(position-1).name, MainActivity.TAG_BACK_TO_JOURNALFRAGMENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,161 +0,0 @@
|
|||||||
package fishrungames.bashgid;
|
|
||||||
|
|
||||||
|
|
||||||
import fishrungames.bashgid.core.HtmlDownloadManager.TextFileRecord;
|
|
||||||
|
|
||||||
import fishrungames.networkutils.ImageManager;
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.View.OnClickListener;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.BaseAdapter;
|
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.ListView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
public class LinkContentFragment extends Fragment {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public TextFileRecord contentRecord;
|
|
||||||
|
|
||||||
//String content;
|
|
||||||
|
|
||||||
View rootView;
|
|
||||||
TextView titleTextView;
|
|
||||||
ImageView imageView;
|
|
||||||
TextView textView;
|
|
||||||
Button button;
|
|
||||||
|
|
||||||
ListView listView;
|
|
||||||
|
|
||||||
ListAdapter listAdapter;
|
|
||||||
|
|
||||||
public LinkContentFragment(TextFileRecord contentRecord)
|
|
||||||
{
|
|
||||||
this.contentRecord = contentRecord;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
|
||||||
rootView = inflater.inflate(R.layout.fragment_link_content_page, container, false);
|
|
||||||
|
|
||||||
|
|
||||||
listView = (ListView) rootView.findViewById(R.id.listView);
|
|
||||||
|
|
||||||
listAdapter = new ListAdapter(getActivity());
|
|
||||||
|
|
||||||
listView.setAdapter(listAdapter);
|
|
||||||
|
|
||||||
//content = FileFunctions.ReadTextFromFile(contentRecord.localUrl + ".txt");
|
|
||||||
|
|
||||||
return rootView;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onResume()
|
|
||||||
{
|
|
||||||
super.onResume();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ListAdapter extends BaseAdapter {
|
|
||||||
private Context mContext;
|
|
||||||
|
|
||||||
public ListAdapter(Context c) {
|
|
||||||
mContext = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCount() {
|
|
||||||
return contentRecord.contentArr.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getItem(int position) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getItemId(int position) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// create a new ImageView for each item referenced by the Adapter
|
|
||||||
@SuppressLint("InflateParams")
|
|
||||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
|
||||||
|
|
||||||
View view;
|
|
||||||
if (convertView == null) { // if it's not recycled, initialize some attributes
|
|
||||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
|
||||||
view = inflater.inflate(R.layout.link_content_page_list_element, null);
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
view = convertView;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImageView imageView = (ImageView) view.findViewById(R.id.imageView);
|
|
||||||
|
|
||||||
Button button = (Button) view.findViewById(R.id.button);
|
|
||||||
|
|
||||||
TextView textView = (TextView) view.findViewById(R.id.dateTextView);
|
|
||||||
|
|
||||||
imageView.setVisibility(View.GONE);
|
|
||||||
button.setVisibility(View.GONE);
|
|
||||||
textView.setVisibility(View.GONE);
|
|
||||||
|
|
||||||
if (contentRecord.contentArr.get(position).docPartType == TextFileRecord.DocPart.DocPartType.DPT_TEXT)
|
|
||||||
{
|
|
||||||
textView.setVisibility(View.VISIBLE);
|
|
||||||
textView.setText(contentRecord.contentArr.get(position).value);
|
|
||||||
textView.setTextSize(20);
|
|
||||||
}
|
|
||||||
else if (contentRecord.contentArr.get(position).docPartType == TextFileRecord.DocPart.DocPartType.DPT_IMAGE)
|
|
||||||
{
|
|
||||||
imageView.setVisibility(View.VISIBLE);
|
|
||||||
ImageManager.getInstance().ApplyImageToImageView(imageView, contentRecord.contentArr.get(position).value);
|
|
||||||
}
|
|
||||||
else if (contentRecord.contentArr.get(position).docPartType == TextFileRecord.DocPart.DocPartType.DPT_BUTTON)
|
|
||||||
{
|
|
||||||
button.setVisibility(View.VISIBLE);
|
|
||||||
button.setText(R.string.go_to_website);
|
|
||||||
button.setOnClickListener(new OnClickListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void onClick(View v)
|
|
||||||
{
|
|
||||||
Uri uri = Uri.parse(contentRecord.contentArr.get(position).value);
|
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
ImageButton imageButton = (ImageButton) view.findViewById(R.id.imageButton);
|
|
||||||
|
|
||||||
Button button = (Button) view.findViewById(R.id.button);
|
|
||||||
|
|
||||||
TextView textView = (TextView) view.findViewById(R.id.textView);
|
|
||||||
|
|
||||||
ImageManager.getInstance().ApplyImageToImageView(imageButton, newsRecordArr.get(position).imageId);
|
|
||||||
|
|
||||||
button.setText(newsRecordArr.get(position).title);
|
|
||||||
|
|
||||||
textView.setText(NewsDataSource.iso8601Format.format(newsRecordArr.get(position).pubDate));
|
|
||||||
|
|
||||||
button.setOnClickListener(new ButtonOnClickListener(newsRecordArr.get(position)));
|
|
||||||
|
|
||||||
imageButton.setOnClickListener(new ButtonOnClickListener(newsRecordArr.get(position)));
|
|
||||||
*/
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,15 +2,12 @@ package fishrungames.bashgid;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import fishrungames.networkutils.ImageManager;
|
|
||||||
|
|
||||||
import fishrungames.bashgid.core.DatabaseGetJournalListTask;
|
import fishrungames.bashgid.core.DatabaseGetJournalListTask;
|
||||||
import fishrungames.bashgid.core.DatabaseGetJournalTask;
|
import fishrungames.bashgid.core.DatabaseGetJournalTask;
|
||||||
import fishrungames.bashgid.core.JournalManager;
|
import fishrungames.bashgid.core.JournalManager;
|
||||||
|
|
||||||
import fishrungames.bashgid.core.JournalManager.JournalSemiFullData;
|
import fishrungames.bashgid.core.JournalManager.JournalSemiFullData;
|
||||||
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -29,55 +26,56 @@ import android.widget.ProgressBar;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import it.sephiroth.android.library.widget.HListView;
|
import it.sephiroth.android.library.widget.HListView;
|
||||||
|
|
||||||
public class MainPageFragment extends Fragment {
|
public class MainPageFragment extends Fragment
|
||||||
|
{
|
||||||
|
|
||||||
ArrayList<JournalSemiFullData> journalList = new ArrayList<JournalSemiFullData>();
|
ArrayList<JournalSemiFullData> journalList = new ArrayList<JournalSemiFullData>();
|
||||||
|
|
||||||
ListView listView;
|
ListView listView;
|
||||||
ListAdapter listAdapter;
|
ListAdapter listAdapter;
|
||||||
View header;
|
View header;
|
||||||
ProgressBar progressBar;
|
ProgressBar progressBar;
|
||||||
EditText searchEditText;
|
EditText searchEditText;
|
||||||
|
|
||||||
JournalSemiFullData newsJournal;
|
JournalSemiFullData newsJournal;
|
||||||
|
|
||||||
DatabaseGetJournalTask databaseGetJournalTask = null;
|
DatabaseGetJournalTask databaseGetJournalTask = null;
|
||||||
DatabaseGetJournalListTask databaseGetJournalListTask = null;
|
DatabaseGetJournalListTask databaseGetJournalListTask = null;
|
||||||
|
|
||||||
public MainPageFragment()
|
public MainPageFragment()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("InflateParams")
|
@SuppressLint("InflateParams")
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||||
|
{
|
||||||
journalList.clear();
|
|
||||||
|
journalList.clear();
|
||||||
|
|
||||||
RestoreJournalList();
|
RestoreJournalList();
|
||||||
|
|
||||||
View rootView = inflater.inflate(R.layout.fragment_main_page, container, false);
|
View rootView = inflater.inflate(R.layout.fragment_main_page, container, false);
|
||||||
|
|
||||||
listView = (ListView) rootView.findViewById(R.id.listView);
|
listView = (ListView) rootView.findViewById(R.id.listView);
|
||||||
|
|
||||||
listAdapter = new ListAdapter(getActivity());
|
listAdapter = new ListAdapter(getActivity());
|
||||||
|
|
||||||
header = inflater.inflate(R.layout.main_page_header, null);
|
header = inflater.inflate(R.layout.main_page_header, null);
|
||||||
|
|
||||||
RestoreJournal();
|
RestoreJournal();
|
||||||
MainActivity.getInstance().StartDownloadNewsTask();
|
MainActivity.getInstance().StartDownloadNewsTask();
|
||||||
|
|
||||||
listView.addHeaderView(header);
|
listView.addHeaderView(header);
|
||||||
|
|
||||||
listView.setAdapter(listAdapter);
|
listView.setAdapter(listAdapter);
|
||||||
|
|
||||||
progressBar = (ProgressBar)header.findViewById(R.id.progressBar);
|
progressBar = (ProgressBar) header.findViewById(R.id.progressBar);
|
||||||
|
|
||||||
progressBar.setVisibility(View.VISIBLE);
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
Button moreNewsButton = (Button) header.findViewById(R.id.moreNewsButton);
|
Button moreNewsButton = (Button) header.findViewById(R.id.moreNewsButton);
|
||||||
|
|
||||||
moreNewsButton.setOnClickListener(new OnClickListener()
|
moreNewsButton.setOnClickListener(new OnClickListener()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -86,13 +84,12 @@ public class MainPageFragment extends Fragment {
|
|||||||
{
|
{
|
||||||
MainActivity.getInstance().OpenNewsScreen();
|
MainActivity.getInstance().OpenNewsScreen();
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
searchEditText = (EditText) header.findViewById(R.id.searchEditText);
|
searchEditText = (EditText) header.findViewById(R.id.searchEditText);
|
||||||
|
|
||||||
Button searchButton = (Button) header.findViewById(R.id.searchButton);
|
Button searchButton = (Button) header.findViewById(R.id.searchButton);
|
||||||
|
|
||||||
searchButton.setOnClickListener(new OnClickListener()
|
searchButton.setOnClickListener(new OnClickListener()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -102,264 +99,250 @@ public class MainPageFragment extends Fragment {
|
|||||||
String query = searchEditText.getText().toString();
|
String query = searchEditText.getText().toString();
|
||||||
MainActivity.getInstance().OpenSearchScreen(query);
|
MainActivity.getInstance().OpenSearchScreen(query);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyView ()
|
public void onDestroyView()
|
||||||
{
|
{
|
||||||
if (databaseGetJournalTask != null)
|
if (databaseGetJournalTask != null)
|
||||||
{
|
{
|
||||||
databaseGetJournalTask.cancel(false);
|
databaseGetJournalTask.cancel(false);
|
||||||
databaseGetJournalTask = null;
|
databaseGetJournalTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (databaseGetJournalListTask != null)
|
if (databaseGetJournalListTask != null)
|
||||||
{
|
{
|
||||||
databaseGetJournalListTask.cancel(false);
|
databaseGetJournalListTask.cancel(false);
|
||||||
databaseGetJournalListTask = null;
|
databaseGetJournalListTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onDestroyView();
|
super.onDestroyView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RestoreJournal()
|
void RestoreJournal()
|
||||||
{
|
{
|
||||||
newsJournal = JournalManager.CreateEmptyJournal();
|
newsJournal = JournalManager.CreateEmptyJournal();
|
||||||
|
|
||||||
RefreshJournal();
|
RefreshJournal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RefreshJournal()
|
void RefreshJournal()
|
||||||
{
|
{
|
||||||
if (databaseGetJournalTask != null)
|
if (databaseGetJournalTask != null)
|
||||||
{
|
{
|
||||||
databaseGetJournalTask.cancel(false);
|
databaseGetJournalTask.cancel(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
databaseGetJournalTask = new DatabaseGetJournalTask();
|
databaseGetJournalTask = new DatabaseGetJournalTask();
|
||||||
|
|
||||||
databaseGetJournalTask.mHandler = MainActivity.getInstance().mHandler;
|
databaseGetJournalTask.mHandler = MainActivity.getInstance().mHandler;
|
||||||
|
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
|
|
||||||
bundle.putString("journalName", "news");
|
bundle.putString("journalName", "news");
|
||||||
|
|
||||||
bundle.putInt("count", 3);
|
bundle.putInt("count", 3);
|
||||||
|
|
||||||
databaseGetJournalTask.execute(bundle);
|
databaseGetJournalTask.execute(bundle);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetJournal(JournalSemiFullData journal)
|
public void SetJournal(JournalSemiFullData journal)
|
||||||
{
|
{
|
||||||
databaseGetJournalTask = null;
|
databaseGetJournalTask = null;
|
||||||
|
|
||||||
//Xperimental
|
// Xperimental
|
||||||
if (journal != null)
|
if (journal != null)
|
||||||
{
|
{
|
||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
|
|
||||||
newsJournal = journal;
|
newsJournal = journal;
|
||||||
|
|
||||||
//ImageButton news1ImageButton = (ImageButton) header.findViewById(R.id.news1ImageButton);
|
Button news1Button = (Button) header.findViewById(R.id.news1Button);
|
||||||
//ImageButton news2ImageButton = (ImageButton) header.findViewById(R.id.news2ImageButton);
|
Button news2Button = (Button) header.findViewById(R.id.news2Button);
|
||||||
//ImageButton news3ImageButton = (ImageButton) header.findViewById(R.id.news3ImageButton);
|
Button news3Button = (Button) header.findViewById(R.id.news3Button);
|
||||||
|
|
||||||
Button news1Button = (Button)header.findViewById(R.id.news1Button);
|
if (newsJournal.articleArr.size() > 0)
|
||||||
Button news2Button = (Button)header.findViewById(R.id.news2Button);
|
{
|
||||||
Button news3Button = (Button)header.findViewById(R.id.news3Button);
|
|
||||||
|
news1Button.setText(newsJournal.articleArr.get(0).title);
|
||||||
if (newsJournal.articleArr.size() > 0)
|
|
||||||
{
|
news1Button.setOnClickListener(new NewsButtonOnClickListener(newsJournal.articleArr.get(0).name));
|
||||||
//ImageManager.getInstance().ApplyImageToImageView(news1ImageButton, newsJournal.articleArr.get(0).previewImageUrl);
|
} else
|
||||||
news1Button.setText(newsJournal.articleArr.get(0).title);
|
{
|
||||||
|
|
||||||
//news1ImageButton.setOnClickListener(new NewsButtonOnClickListener(newsJournal.articleArr.get(0).name));
|
news1Button.setText(R.string.news_record_not_available);
|
||||||
news1Button.setOnClickListener(new NewsButtonOnClickListener(newsJournal.articleArr.get(0).name));
|
|
||||||
}
|
news1Button.setOnClickListener(null);
|
||||||
else
|
}
|
||||||
{
|
|
||||||
//news1ImageButton.setImageResource(R.drawable.transparent);
|
if (newsJournal.articleArr.size() > 1)
|
||||||
news1Button.setText(R.string.news_record_not_available);
|
{
|
||||||
//news1ImageButton.setOnClickListener(null);
|
|
||||||
news1Button.setOnClickListener(null);
|
news2Button.setText(newsJournal.articleArr.get(1).title);
|
||||||
}
|
|
||||||
|
news2Button.setOnClickListener(new NewsButtonOnClickListener(newsJournal.articleArr.get(1).name));
|
||||||
if (newsJournal.articleArr.size() > 1)
|
} else
|
||||||
{
|
{
|
||||||
//ImageManager.getInstance().ApplyImageToImageView(news2ImageButton, newsJournal.articleArr.get(1).previewImageUrl);
|
|
||||||
news2Button.setText(newsJournal.articleArr.get(1).title);
|
news2Button.setText(R.string.news_record_not_available);
|
||||||
//news2ImageButton.setOnClickListener(new NewsButtonOnClickListener(newsJournal.articleArr.get(1).name));
|
news2Button.setOnClickListener(null);
|
||||||
news2Button.setOnClickListener(new NewsButtonOnClickListener(newsJournal.articleArr.get(1).name));
|
}
|
||||||
}
|
|
||||||
else
|
if (newsJournal.articleArr.size() > 2)
|
||||||
{
|
{
|
||||||
//news2ImageButton.setImageResource(R.drawable.transparent);
|
|
||||||
news2Button.setText(R.string.news_record_not_available);
|
news3Button.setText(newsJournal.articleArr.get(2).title);
|
||||||
//news2ImageButton.setOnClickListener(null);
|
news3Button.setOnClickListener(new NewsButtonOnClickListener(newsJournal.articleArr.get(2).name));
|
||||||
news2Button.setOnClickListener(null);
|
} else
|
||||||
}
|
{
|
||||||
|
|
||||||
if (newsJournal.articleArr.size() > 2)
|
|
||||||
{
|
|
||||||
//ImageManager.getInstance().ApplyImageToImageView(news3ImageButton, newsJournal.articleArr.get(2).previewImageUrl);
|
|
||||||
news3Button.setText(newsJournal.articleArr.get(2).title);
|
|
||||||
//news3ImageButton.setOnClickListener(new NewsButtonOnClickListener(newsJournal.articleArr.get(2).name));
|
|
||||||
news3Button.setOnClickListener(new NewsButtonOnClickListener(newsJournal.articleArr.get(2).name));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//news3ImageButton.setImageResource(R.drawable.transparent);
|
|
||||||
news3Button.setText(R.string.news_record_not_available);
|
|
||||||
//news3ImageButton.setOnClickListener(null);
|
|
||||||
news3Button.setOnClickListener(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
news3Button.setText(R.string.news_record_not_available);
|
||||||
|
news3Button.setOnClickListener(null);
|
||||||
listAdapter.notifyDataSetChanged();
|
}
|
||||||
|
|
||||||
|
listAdapter.notifyDataSetChanged();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RefreshAdapter()
|
public void RefreshAdapter()
|
||||||
{
|
{
|
||||||
listAdapter.notifyDataSetChanged();
|
listAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RestoreJournalList()
|
public void RestoreJournalList()
|
||||||
{
|
{
|
||||||
journalList = new ArrayList<JournalSemiFullData>();
|
journalList = new ArrayList<JournalSemiFullData>();
|
||||||
|
|
||||||
if (databaseGetJournalListTask != null)
|
if (databaseGetJournalListTask != null)
|
||||||
{
|
{
|
||||||
databaseGetJournalListTask.cancel(false);
|
databaseGetJournalListTask.cancel(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
databaseGetJournalListTask = new DatabaseGetJournalListTask();
|
databaseGetJournalListTask = new DatabaseGetJournalListTask();
|
||||||
|
|
||||||
databaseGetJournalListTask.mHandler = MainActivity.getInstance().mHandler;
|
databaseGetJournalListTask.mHandler = MainActivity.getInstance().mHandler;
|
||||||
|
|
||||||
databaseGetJournalListTask.execute("featured");
|
databaseGetJournalListTask.execute("featured");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetJournalList(ArrayList<JournalSemiFullData> journalList)
|
public void SetJournalList(ArrayList<JournalSemiFullData> journalList)
|
||||||
{
|
{
|
||||||
databaseGetJournalListTask = null;
|
databaseGetJournalListTask = null;
|
||||||
|
|
||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
|
|
||||||
this.journalList = journalList;
|
this.journalList = journalList;
|
||||||
|
|
||||||
listAdapter.notifyDataSetChanged();
|
listAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class ListAdapter extends BaseAdapter {
|
|
||||||
private Context mContext;
|
|
||||||
|
|
||||||
public ListAdapter(Context c) {
|
public class ListAdapter extends BaseAdapter
|
||||||
mContext = c;
|
{
|
||||||
}
|
private Context mContext;
|
||||||
|
|
||||||
public int getCount() {
|
public ListAdapter(Context c)
|
||||||
return journalList.size();
|
{
|
||||||
}
|
mContext = c;
|
||||||
|
}
|
||||||
|
|
||||||
public Object getItem(int position) {
|
public int getCount()
|
||||||
return null;
|
{
|
||||||
}
|
return journalList.size();
|
||||||
|
}
|
||||||
|
|
||||||
public long getItemId(int position) {
|
public Object getItem(int position)
|
||||||
return 0;
|
{
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// create a new ImageView for each item referenced by the Adapter
|
public long getItemId(int position)
|
||||||
@SuppressLint("InflateParams")
|
{
|
||||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
return 0;
|
||||||
|
}
|
||||||
View view;
|
|
||||||
|
|
||||||
if (convertView == null) { // if it's not recycled, initialize some attributes
|
|
||||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
|
||||||
view = inflater.inflate(R.layout.main_page_list_element, null);
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
view = convertView;
|
|
||||||
}
|
|
||||||
|
|
||||||
TextView textView = (TextView) view.findViewById(R.id.dateTextView);
|
|
||||||
TextView descriptionTextView = (TextView) view.findViewById(R.id.descriptionTextView);
|
|
||||||
|
|
||||||
Button button = (Button) view.findViewById(R.id.button);
|
|
||||||
|
|
||||||
ImageButton imageButton = (ImageButton) view.findViewById(R.id.imageButton);
|
|
||||||
|
|
||||||
HListView hListView = (HListView) view.findViewById(R.id.hListView);
|
|
||||||
|
|
||||||
hListView.setAdapter(new MainPageHListViewAdapters.JournalElementAdapter(getActivity(), journalList.get(position)));
|
|
||||||
|
|
||||||
textView.setText(journalList.get(position).title);
|
// create a new ImageView for each item referenced by the Adapter
|
||||||
|
@SuppressLint("InflateParams")
|
||||||
if (journalList.get(position).description.length() > 0)
|
public View getView(final int position, View convertView, ViewGroup parent)
|
||||||
{
|
{
|
||||||
descriptionTextView.setText(journalList.get(position).description);
|
|
||||||
|
|
||||||
descriptionTextView.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
descriptionTextView.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
button.setText(R.string.see_all);
|
|
||||||
|
|
||||||
button.setOnClickListener(new OnClickListener()
|
View view;
|
||||||
{
|
|
||||||
|
if (convertView == null)
|
||||||
|
{ // if it's not recycled, initialize some attributes
|
||||||
|
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
|
view = inflater.inflate(R.layout.main_page_list_element, null);
|
||||||
|
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
view = convertView;
|
||||||
|
}
|
||||||
|
|
||||||
|
TextView textView = (TextView) view.findViewById(R.id.dateTextView);
|
||||||
|
TextView descriptionTextView = (TextView) view.findViewById(R.id.descriptionTextView);
|
||||||
|
|
||||||
|
Button button = (Button) view.findViewById(R.id.button);
|
||||||
|
|
||||||
|
ImageButton imageButton = (ImageButton) view.findViewById(R.id.imageButton);
|
||||||
|
|
||||||
|
HListView hListView = (HListView) view.findViewById(R.id.hListView);
|
||||||
|
|
||||||
|
hListView.setAdapter(new MainPageHListViewAdapters.JournalElementAdapter(getActivity(), journalList.get(position)));
|
||||||
|
|
||||||
|
textView.setText(journalList.get(position).title);
|
||||||
|
|
||||||
|
if (journalList.get(position).description.length() > 0)
|
||||||
|
{
|
||||||
|
descriptionTextView.setText(journalList.get(position).description);
|
||||||
|
|
||||||
|
descriptionTextView.setVisibility(View.VISIBLE);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
descriptionTextView.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
button.setText(R.string.see_all);
|
||||||
|
|
||||||
|
button.setOnClickListener(new OnClickListener()
|
||||||
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v)
|
public void onClick(View v)
|
||||||
{
|
{
|
||||||
if (databaseGetJournalTask != null)
|
if (databaseGetJournalTask != null)
|
||||||
{
|
{
|
||||||
databaseGetJournalTask.cancel(false);
|
databaseGetJournalTask.cancel(false);
|
||||||
|
}
|
||||||
|
MainActivity.getInstance().OpenJournalScreen(journalList.get(position).name, MainActivity.TAG_BACK_TO_MAINFRAGMENT);
|
||||||
}
|
}
|
||||||
MainActivity.getInstance().OpenJournalScreen(journalList.get(position).name, MainActivity.TAG_TO_MAINFRAGMENT);
|
});
|
||||||
}
|
|
||||||
});
|
imageButton.setOnClickListener(new OnClickListener()
|
||||||
|
{
|
||||||
imageButton.setOnClickListener(new OnClickListener()
|
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v)
|
public void onClick(View v)
|
||||||
{
|
{
|
||||||
if (databaseGetJournalTask != null)
|
if (databaseGetJournalTask != null)
|
||||||
{
|
{
|
||||||
databaseGetJournalTask.cancel(false);
|
databaseGetJournalTask.cancel(false);
|
||||||
|
}
|
||||||
|
MainActivity.getInstance().OpenJournalScreen(journalList.get(position).name, MainActivity.TAG_BACK_TO_MAINFRAGMENT);
|
||||||
}
|
}
|
||||||
MainActivity.getInstance().OpenJournalScreen(journalList.get(position).name, MainActivity.TAG_TO_MAINFRAGMENT);
|
});
|
||||||
}
|
|
||||||
});
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class NewsButtonOnClickListener implements OnClickListener
|
public class NewsButtonOnClickListener implements OnClickListener
|
||||||
{
|
{
|
||||||
|
|
||||||
String articleName;
|
String articleName;
|
||||||
|
|
||||||
public NewsButtonOnClickListener(String articleName)
|
public NewsButtonOnClickListener(String articleName)
|
||||||
{
|
{
|
||||||
this.articleName = articleName;
|
this.articleName = articleName;
|
||||||
@ -373,12 +356,11 @@ public class MainPageFragment extends Fragment {
|
|||||||
databaseGetJournalTask.cancel(false);
|
databaseGetJournalTask.cancel(false);
|
||||||
databaseGetJournalTask = null;
|
databaseGetJournalTask = null;
|
||||||
}
|
}
|
||||||
//MainActivity.getInstance().OpenNewsRecordScreen(articleName, MainActivity.TAG_FROM_MAINFRAGMENT_TO_NEWSRECORDFRAGMENT);
|
|
||||||
MainActivity.getInstance().OpenArticleScreen(articleName, MainActivity.TAG_TO_MAINFRAGMENT);
|
|
||||||
|
|
||||||
|
|
||||||
|
MainActivity.getInstance().OpenArticleScreen(articleName, MainActivity.TAG_BACK_TO_MAINFRAGMENT);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
package fishrungames.bashgid;
|
package fishrungames.bashgid;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import fishrungames.bashgid.core.AlbumManager.AlbumFullData;
|
import fishrungames.bashgid.core.AlbumManager.AlbumFullData;
|
||||||
import fishrungames.bashgid.core.HtmlDownloadManager;
|
|
||||||
import fishrungames.bashgid.core.JournalManager.JournalSemiFullData;
|
import fishrungames.bashgid.core.JournalManager.JournalSemiFullData;
|
||||||
|
|
||||||
import fishrungames.bashgid.core.HtmlDownloadManager.TextFileRecord;
|
|
||||||
import fishrungames.networkutils.ImageManager;
|
import fishrungames.networkutils.ImageManager;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -17,266 +13,139 @@ import android.view.View.OnClickListener;
|
|||||||
import android.widget.BaseAdapter;
|
import android.widget.BaseAdapter;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
public class MainPageHListViewAdapters {
|
public class MainPageHListViewAdapters
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
public static class PhotoAlbumElementAdapter extends BaseAdapter {
|
|
||||||
|
|
||||||
private Context mContext;
|
|
||||||
//String albumName;
|
|
||||||
AlbumFullData albumFullData;
|
|
||||||
//ArrayList<TextFileRecord> localHtmlList;
|
|
||||||
|
|
||||||
public PhotoAlbumElementAdapter(Context c, AlbumFullData albumFullData) {
|
public static class PhotoAlbumElementAdapter extends BaseAdapter
|
||||||
this.mContext = c;
|
{
|
||||||
this.albumFullData = albumFullData;
|
|
||||||
|
|
||||||
//localHtmlList = HtmlDownloadManager.getInstance().getGlobalHtmlList();
|
private Context mContext;
|
||||||
}
|
|
||||||
|
|
||||||
public int getCount() {
|
AlbumFullData albumFullData;
|
||||||
return albumFullData.photoRecordArr.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getItem(int position) {
|
public PhotoAlbumElementAdapter(Context c, AlbumFullData albumFullData)
|
||||||
return null;
|
{
|
||||||
}
|
this.mContext = c;
|
||||||
|
this.albumFullData = albumFullData;
|
||||||
|
}
|
||||||
|
|
||||||
public long getItemId(int position) {
|
public int getCount()
|
||||||
return 0;
|
{
|
||||||
}
|
return albumFullData.photoRecordArr.size();
|
||||||
|
}
|
||||||
|
|
||||||
// create a new ImageView for each item referenced by the Adapter
|
public Object getItem(int position)
|
||||||
@SuppressLint("InflateParams")
|
{
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
View view;
|
public long getItemId(int position)
|
||||||
if (convertView == null) { // if it's not recycled, initialize some attributes
|
{
|
||||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
return 0;
|
||||||
view = inflater.inflate(R.layout.article_album_element_item, null);
|
}
|
||||||
|
|
||||||
|
// create a new ImageView for each item referenced by the Adapter
|
||||||
} else {
|
@SuppressLint("InflateParams")
|
||||||
view = convertView;
|
public View getView(int position, View convertView, ViewGroup parent)
|
||||||
}
|
{
|
||||||
|
|
||||||
//TextView textView = (TextView) view.findViewById(R.id.dateTextView);
|
View view;
|
||||||
|
if (convertView == null)
|
||||||
//TextView subTextView = (TextView) view.findViewById(R.id.subTextView);
|
{ // if it's not recycled, initialize some attributes
|
||||||
|
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
//ImageButton imageButton = (ImageButton) view.findViewById(R.id.imageButton);
|
view = inflater.inflate(R.layout.article_album_element_item, null);
|
||||||
ImageView imageView = (ImageView) view.findViewById(R.id.imageView);
|
|
||||||
|
} else
|
||||||
//textView.setText(albumFullData.photoRecordArr.get(position).title);
|
{
|
||||||
|
view = convertView;
|
||||||
//subTextView.setText("");
|
}
|
||||||
|
|
||||||
ImageManager.getInstance().ApplyImageToImageView(imageView, albumFullData.photoRecordArr.get(position).imageUrl);
|
ImageView imageView = (ImageView) view.findViewById(R.id.imageView);
|
||||||
|
|
||||||
//imageButton.setOnClickListener(new ContentButtonOnClickListener(localHtmlList.get(position)));
|
ImageManager.getInstance().ApplyImageToImageView(imageView, albumFullData.photoRecordArr.get(position).imageUrl);
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class JournalElementAdapter extends BaseAdapter {
|
|
||||||
|
|
||||||
private Context mContext;
|
|
||||||
//String albumName;
|
|
||||||
JournalSemiFullData journal;
|
|
||||||
//ArrayList<TextFileRecord> localHtmlList;
|
|
||||||
|
|
||||||
public JournalElementAdapter(Context c, JournalSemiFullData journal) {
|
public static class JournalElementAdapter extends BaseAdapter
|
||||||
this.mContext = c;
|
{
|
||||||
this.journal = journal;
|
|
||||||
|
|
||||||
//localHtmlList = HtmlDownloadManager.getInstance().getGlobalHtmlList();
|
private Context mContext;
|
||||||
}
|
|
||||||
|
|
||||||
public int getCount() {
|
JournalSemiFullData journal;
|
||||||
return journal.articleArr.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getItem(int position) {
|
public JournalElementAdapter(Context c, JournalSemiFullData journal)
|
||||||
return null;
|
{
|
||||||
}
|
this.mContext = c;
|
||||||
|
this.journal = journal;
|
||||||
|
|
||||||
public long getItemId(int position) {
|
}
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// create a new ImageView for each item referenced by the Adapter
|
public int getCount()
|
||||||
@SuppressLint("InflateParams")
|
{
|
||||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
return journal.articleArr.size();
|
||||||
|
}
|
||||||
View view;
|
|
||||||
if (convertView == null) { // if it's not recycled, initialize some attributes
|
|
||||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
|
||||||
view = inflater.inflate(R.layout.simple_hview_list_element, null);
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
view = convertView;
|
|
||||||
}
|
|
||||||
|
|
||||||
TextView textView = (TextView) view.findViewById(R.id.dateTextView);
|
|
||||||
|
|
||||||
TextView subTextView = (TextView) view.findViewById(R.id.subTextView);
|
|
||||||
|
|
||||||
ImageButton imageButton = (ImageButton) view.findViewById(R.id.imageButton);
|
|
||||||
|
|
||||||
|
public Object getItem(int position)
|
||||||
textView.setText(journal.articleArr.get(position).title);
|
{
|
||||||
|
return null;
|
||||||
subTextView.setText(journal.articleArr.get(position).dateTime.toString());
|
}
|
||||||
|
|
||||||
String imageUrl = journal.articleArr.get(position).previewImageUrl;
|
public long getItemId(int position)
|
||||||
|
{
|
||||||
ImageManager.getInstance().ApplyImageToImageView(imageButton, imageUrl);
|
return 0;
|
||||||
|
}
|
||||||
imageButton.setOnClickListener(new OnClickListener()
|
|
||||||
{
|
// create a new ImageView for each item referenced by the Adapter
|
||||||
|
@SuppressLint("InflateParams")
|
||||||
|
public View getView(final int position, View convertView, ViewGroup parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
View view;
|
||||||
|
if (convertView == null)
|
||||||
|
{ // if it's not recycled, initialize some attributes
|
||||||
|
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
|
view = inflater.inflate(R.layout.simple_hview_list_element, null);
|
||||||
|
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
view = convertView;
|
||||||
|
}
|
||||||
|
|
||||||
|
TextView textView = (TextView) view.findViewById(R.id.dateTextView);
|
||||||
|
|
||||||
|
TextView subTextView = (TextView) view.findViewById(R.id.subTextView);
|
||||||
|
|
||||||
|
ImageButton imageButton = (ImageButton) view.findViewById(R.id.imageButton);
|
||||||
|
|
||||||
|
textView.setText(journal.articleArr.get(position).title);
|
||||||
|
|
||||||
|
subTextView.setText(journal.articleArr.get(position).dateTime.toString());
|
||||||
|
|
||||||
|
String imageUrl = journal.articleArr.get(position).previewImageUrl;
|
||||||
|
|
||||||
|
ImageManager.getInstance().ApplyImageToImageView(imageButton, imageUrl);
|
||||||
|
|
||||||
|
imageButton.setOnClickListener(new OnClickListener()
|
||||||
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v)
|
public void onClick(View v)
|
||||||
{
|
{
|
||||||
MainActivity.getInstance().OpenArticleScreen(journal.articleArr.get(position).name, MainActivity.TAG_FROM_CATALOGFRAGMENT_TO_ARTICLEFRAGMENT);
|
MainActivity.getInstance().OpenArticleScreen(journal.articleArr.get(position).name,
|
||||||
|
MainActivity.TAG_BACK_TO_MAINFRAGMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
public static class SimpleElementAdapter extends BaseAdapter {
|
|
||||||
|
|
||||||
private Context mContext;
|
|
||||||
ArrayList<TextFileRecord> localHtmlList;
|
|
||||||
|
|
||||||
public SimpleElementAdapter(Context c) {
|
|
||||||
mContext = c;
|
|
||||||
|
|
||||||
localHtmlList = HtmlDownloadManager.getInstance().getGlobalHtmlList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCount() {
|
|
||||||
return localHtmlList.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getItem(int position) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getItemId(int position) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// create a new ImageView for each item referenced by the Adapter
|
|
||||||
@SuppressLint("InflateParams")
|
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
|
||||||
|
|
||||||
|
|
||||||
View view;
|
|
||||||
if (convertView == null) { // if it's not recycled, initialize some attributes
|
|
||||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
|
||||||
view = inflater.inflate(R.layout.simple_hview_list_element, null);
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
view = convertView;
|
|
||||||
}
|
|
||||||
|
|
||||||
TextView textView = (TextView) view.findViewById(R.id.dateTextView);
|
|
||||||
|
|
||||||
TextView subTextView = (TextView) view.findViewById(R.id.subTextView);
|
|
||||||
|
|
||||||
ImageButton imageButton = (ImageButton) view.findViewById(R.id.imageButton);
|
|
||||||
|
|
||||||
textView.setText(localHtmlList.get(position).title);
|
|
||||||
|
|
||||||
subTextView.setText("");
|
|
||||||
|
|
||||||
ImageManager.getInstance().ApplyImageToImageView(imageButton, localHtmlList.get(position).topicImg);
|
|
||||||
|
|
||||||
imageButton.setOnClickListener(new ContentButtonOnClickListener(localHtmlList.get(position)));
|
|
||||||
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
public static class DarkenElementAdapter extends BaseAdapter {
|
|
||||||
|
|
||||||
String [] textsArray;
|
|
||||||
String [] subTextsArray;
|
|
||||||
int [] imgIdArray;
|
|
||||||
|
|
||||||
private Context mContext;
|
|
||||||
|
|
||||||
public DarkenElementAdapter(Context c, String [] textsArray, String [] subTextsArray, int [] imgIdArray) {
|
|
||||||
mContext = c;
|
|
||||||
this.textsArray = textsArray;
|
|
||||||
this.subTextsArray = subTextsArray;
|
|
||||||
this.imgIdArray = imgIdArray;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCount() {
|
|
||||||
return textsArray.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getItem(int position) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getItemId(int position) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// create a new ImageView for each item referenced by the Adapter
|
|
||||||
@SuppressLint("InflateParams")
|
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
|
||||||
|
|
||||||
|
|
||||||
View view;
|
|
||||||
if (convertView == null) { // if it's not recycled, initialize some attributes
|
|
||||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
|
||||||
view = inflater.inflate(R.layout.darken_hview_list_element, null);
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
view = convertView;
|
|
||||||
}
|
|
||||||
|
|
||||||
TextView textView = (TextView) view.findViewById(R.id.dateTextView);
|
|
||||||
|
|
||||||
TextView subTextView = (TextView) view.findViewById(R.id.subTextView);
|
|
||||||
|
|
||||||
LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.linearLayout);
|
|
||||||
|
|
||||||
textView.setText(textsArray[position]);
|
|
||||||
|
|
||||||
subTextView.setText(subTextsArray[position]);
|
|
||||||
|
|
||||||
linearLayout.setBackgroundResource(imgIdArray[position]);
|
|
||||||
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,72 +0,0 @@
|
|||||||
package fishrungames.bashgid;
|
|
||||||
|
|
||||||
|
|
||||||
import com.google.android.gms.maps.GoogleMap;
|
|
||||||
|
|
||||||
import com.google.android.gms.maps.CameraUpdateFactory;
|
|
||||||
import com.google.android.gms.maps.GoogleMap.OnInfoWindowClickListener;
|
|
||||||
import com.google.android.gms.maps.OnMapReadyCallback;
|
|
||||||
import com.google.android.gms.maps.SupportMapFragment;
|
|
||||||
import com.google.android.gms.maps.model.LatLng;
|
|
||||||
import com.google.android.gms.maps.model.Marker;
|
|
||||||
import com.google.android.gms.maps.model.MarkerOptions;
|
|
||||||
|
|
||||||
import fishrungames.bashgid.core.LocationHolder;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
|
|
||||||
|
|
||||||
public class MapHolderFragment extends Fragment implements OnMapReadyCallback
|
|
||||||
{
|
|
||||||
|
|
||||||
GoogleMap mMap = null;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
|
||||||
|
|
||||||
View rootView = inflater.inflate(R.layout.fragment_map_page, container, false);
|
|
||||||
|
|
||||||
SupportMapFragment mapFragment = (SupportMapFragment) this.getChildFragmentManager().findFragmentById(R.id.map);
|
|
||||||
|
|
||||||
mapFragment.getMapAsync(this);
|
|
||||||
|
|
||||||
|
|
||||||
return rootView;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onMapReady(GoogleMap map)
|
|
||||||
{
|
|
||||||
mMap = map;
|
|
||||||
mMap.setMyLocationEnabled(true);
|
|
||||||
mMap.getUiSettings().setRotateGesturesEnabled(false);
|
|
||||||
|
|
||||||
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(LocationHolder.CONST_UFA_LATITUDE, LocationHolder.CONST_UFA_LONGITUDE), LocationHolder.CONST_UFA_ZOOM));
|
|
||||||
|
|
||||||
|
|
||||||
LatLng ufaPanoramas = new LatLng(LocationHolder.CONST_UFA_LATITUDE, LocationHolder.CONST_UFA_LONGITUDE);
|
|
||||||
/*Marker marker =*/ mMap.addMarker(new MarkerOptions()
|
|
||||||
.position(ufaPanoramas)
|
|
||||||
.title("Ufa")
|
|
||||||
.snippet("City center"));
|
|
||||||
|
|
||||||
|
|
||||||
mMap.setOnInfoWindowClickListener(new OnInfoWindowClickListener()
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onInfoWindowClick(Marker marker)
|
|
||||||
{
|
|
||||||
MainActivity.getInstance().OpenStreetViewScreen(LocationHolder.CONST_UFA_LATITUDE, LocationHolder.CONST_UFA_LONGITUDE);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,5 @@
|
|||||||
package fishrungames.bashgid;
|
package fishrungames.bashgid;
|
||||||
|
|
||||||
|
|
||||||
import android.support.v7.app.ActionBarActivity;
|
import android.support.v7.app.ActionBarActivity;
|
||||||
|
|
||||||
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
@ -29,371 +28,406 @@ import android.widget.ListView;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fragment used for managing interactions for and presentation of a navigation drawer.
|
* Fragment used for managing interactions for and presentation of a navigation
|
||||||
* See the <a href="https://developer.android.com/design/patterns/navigation-drawer.html#Interaction">
|
* drawer. See the <a href=
|
||||||
* design guidelines</a> for a complete explanation of the behaviors implemented here.
|
* "https://developer.android.com/design/patterns/navigation-drawer.html#Interaction"
|
||||||
|
* > design guidelines</a> for a complete explanation of the behaviors
|
||||||
|
* implemented here.
|
||||||
*/
|
*/
|
||||||
public class NavigationDrawerFragment extends Fragment {
|
public class NavigationDrawerFragment extends Fragment
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remember the position of the selected item.
|
* Remember the position of the selected item.
|
||||||
*/
|
*/
|
||||||
private static final String STATE_SELECTED_POSITION = "selected_navigation_drawer_position";
|
private static final String STATE_SELECTED_POSITION = "selected_navigation_drawer_position";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Per the design guidelines, you should show the drawer on launch until the user manually
|
* Per the design guidelines, you should show the drawer on launch until the
|
||||||
* expands it. This shared preference tracks this.
|
* user manually expands it. This shared preference tracks this.
|
||||||
*/
|
*/
|
||||||
private static final String PREF_USER_LEARNED_DRAWER = "navigation_drawer_learned";
|
private static final String PREF_USER_LEARNED_DRAWER = "navigation_drawer_learned";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A pointer to the current callbacks instance (the Activity).
|
* A pointer to the current callbacks instance (the Activity).
|
||||||
*/
|
*/
|
||||||
private NavigationDrawerCallbacks mCallbacks;
|
private NavigationDrawerCallbacks mCallbacks;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper component that ties the action bar to the navigation drawer.
|
* Helper component that ties the action bar to the navigation drawer.
|
||||||
*/
|
*/
|
||||||
private ActionBarDrawerToggle mDrawerToggle;
|
private ActionBarDrawerToggle mDrawerToggle;
|
||||||
|
|
||||||
private DrawerLayout mDrawerLayout;
|
private DrawerLayout mDrawerLayout;
|
||||||
private ListView mDrawerListView;
|
private ListView mDrawerListView;
|
||||||
private View mFragmentContainerView;
|
private View mFragmentContainerView;
|
||||||
|
|
||||||
private int mCurrentSelectedPosition = 0;
|
private int mCurrentSelectedPosition = 0;
|
||||||
private boolean mFromSavedInstanceState;
|
private boolean mFromSavedInstanceState;
|
||||||
private boolean mUserLearnedDrawer;
|
private boolean mUserLearnedDrawer;
|
||||||
|
|
||||||
private DrawerAdapter drawerAdapter;
|
|
||||||
|
|
||||||
public NavigationDrawerFragment() {
|
private DrawerAdapter drawerAdapter;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public NavigationDrawerFragment()
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
{
|
||||||
super.onCreate(savedInstanceState);
|
}
|
||||||
|
|
||||||
// Read in the flag indicating whether or not the user has demonstrated awareness of the
|
@Override
|
||||||
// drawer. See PREF_USER_LEARNED_DRAWER for details.
|
public void onCreate(Bundle savedInstanceState)
|
||||||
//SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
{
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
//Don't need this shit
|
|
||||||
//mUserLearnedDrawer = sp.getBoolean(PREF_USER_LEARNED_DRAWER, false);
|
|
||||||
mUserLearnedDrawer = true;
|
|
||||||
|
|
||||||
if (savedInstanceState != null) {
|
// Read in the flag indicating whether or not the user has demonstrated
|
||||||
mCurrentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION);
|
// awareness of the
|
||||||
mFromSavedInstanceState = true;
|
// drawer. See PREF_USER_LEARNED_DRAWER for details.
|
||||||
}
|
// SharedPreferences sp =
|
||||||
|
// PreferenceManager.getDefaultSharedPreferences(getActivity());
|
||||||
|
|
||||||
// Select either the default item (0) or the last selected item.
|
// Don't need this shit
|
||||||
selectItem(mCurrentSelectedPosition);
|
// mUserLearnedDrawer = sp.getBoolean(PREF_USER_LEARNED_DRAWER, false);
|
||||||
|
mUserLearnedDrawer = true;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
if (savedInstanceState != null)
|
||||||
public void onActivityCreated (Bundle savedInstanceState) {
|
{
|
||||||
super.onActivityCreated(savedInstanceState);
|
mCurrentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION);
|
||||||
// Indicate that this fragment would like to influence the set of actions in the action bar.
|
mFromSavedInstanceState = true;
|
||||||
setHasOptionsMenu(true);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
// Select either the default item (0) or the last selected item.
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
selectItem(mCurrentSelectedPosition);
|
||||||
Bundle savedInstanceState) {
|
|
||||||
mDrawerListView = (ListView) inflater.inflate(
|
|
||||||
R.layout.fragment_navigation_drawer, container, false);
|
|
||||||
mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
||||||
selectItem(position);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
drawerAdapter = new DrawerAdapter(getActivity());
|
|
||||||
|
|
||||||
mDrawerListView.setAdapter(drawerAdapter);
|
|
||||||
|
|
||||||
mDrawerListView.setItemChecked(mCurrentSelectedPosition, true);
|
|
||||||
return mDrawerListView;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDrawerOpen() {
|
}
|
||||||
return mDrawerLayout != null && mDrawerLayout.isDrawerOpen(mFragmentContainerView);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void EnableDrawer()
|
@Override
|
||||||
{
|
public void onActivityCreated(Bundle savedInstanceState)
|
||||||
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
|
{
|
||||||
}
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
// Indicate that this fragment would like to influence the set of
|
||||||
|
// actions in the action bar.
|
||||||
/**
|
setHasOptionsMenu(true);
|
||||||
* Users of this fragment must call this method to set up the navigation drawer interactions.
|
}
|
||||||
*
|
|
||||||
* @param fragmentId The android:id of this fragment in its activity's layout.
|
|
||||||
* @param drawerLayout The DrawerLayout containing this fragment's UI.
|
|
||||||
*/
|
|
||||||
public void setUp(int fragmentId, DrawerLayout drawerLayout) {
|
|
||||||
mFragmentContainerView = getActivity().findViewById(fragmentId);
|
|
||||||
mDrawerLayout = drawerLayout;
|
|
||||||
|
|
||||||
|
|
||||||
// set a custom shadow that overlays the main content when the drawer opens
|
|
||||||
mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
|
|
||||||
// set up the drawer's list view with items and click listener
|
|
||||||
|
|
||||||
ActionBar actionBar = getActionBar();
|
@Override
|
||||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||||
actionBar.setHomeButtonEnabled(true);
|
{
|
||||||
|
mDrawerListView = (ListView) inflater.inflate(R.layout.fragment_navigation_drawer, container, false);
|
||||||
|
mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
|
||||||
|
{
|
||||||
|
selectItem(position);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// ActionBarDrawerToggle ties together the the proper interactions
|
drawerAdapter = new DrawerAdapter(getActivity());
|
||||||
// between the navigation drawer and the action bar app icon.
|
|
||||||
|
|
||||||
mDrawerToggle = new ActionBarDrawerToggle(
|
mDrawerListView.setAdapter(drawerAdapter);
|
||||||
getActivity(), /* host Activity */
|
|
||||||
mDrawerLayout, /* DrawerLayout object */
|
|
||||||
R.string.navigation_drawer_open, /* "open drawer" description for accessibility */
|
|
||||||
R.string.navigation_drawer_close /* "close drawer" description for accessibility */
|
|
||||||
) {
|
|
||||||
@Override
|
|
||||||
public void onDrawerClosed(View drawerView) {
|
|
||||||
super.onDrawerClosed(drawerView);
|
|
||||||
if (!isAdded()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//getActivity().supportInvalidateOptionsMenu(); // calls onPrepareOptionsMenu()
|
mDrawerListView.setItemChecked(mCurrentSelectedPosition, true);
|
||||||
}
|
return mDrawerListView;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
public boolean isDrawerOpen()
|
||||||
public void onDrawerOpened(View drawerView) {
|
{
|
||||||
super.onDrawerOpened(drawerView);
|
return mDrawerLayout != null && mDrawerLayout.isDrawerOpen(mFragmentContainerView);
|
||||||
if (!isAdded()) {
|
}
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!mUserLearnedDrawer) {
|
public void EnableDrawer()
|
||||||
// The user manually opened the drawer; store this flag to prevent auto-showing
|
{
|
||||||
// the navigation drawer automatically in the future.
|
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
|
||||||
mUserLearnedDrawer = true;
|
}
|
||||||
SharedPreferences sp = PreferenceManager
|
|
||||||
.getDefaultSharedPreferences(getActivity());
|
|
||||||
sp.edit().putBoolean(PREF_USER_LEARNED_DRAWER, true).commit();
|
|
||||||
}
|
|
||||||
|
|
||||||
//getActivity().supportInvalidateOptionsMenu(); // calls onPrepareOptionsMenu()
|
/**
|
||||||
}
|
* Users of this fragment must call this method to set up the navigation
|
||||||
};
|
* drawer interactions.
|
||||||
|
*
|
||||||
|
* @param fragmentId
|
||||||
|
* The android:id of this fragment in its activity's layout.
|
||||||
|
* @param drawerLayout
|
||||||
|
* The DrawerLayout containing this fragment's UI.
|
||||||
|
*/
|
||||||
|
public void setUp(int fragmentId, DrawerLayout drawerLayout)
|
||||||
|
{
|
||||||
|
mFragmentContainerView = getActivity().findViewById(fragmentId);
|
||||||
|
mDrawerLayout = drawerLayout;
|
||||||
|
|
||||||
// If the user hasn't 'learned' about the drawer, open it to introduce them to the drawer,
|
// set a custom shadow that overlays the main content when the drawer
|
||||||
// per the navigation drawer design guidelines.
|
// opens
|
||||||
if (!mUserLearnedDrawer && !mFromSavedInstanceState) {
|
mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
|
||||||
mDrawerLayout.openDrawer(mFragmentContainerView);
|
// set up the drawer's list view with items and click listener
|
||||||
}
|
|
||||||
|
|
||||||
// Defer code dependent on restoration of previous instance state.
|
ActionBar actionBar = getActionBar();
|
||||||
mDrawerLayout.post(new Runnable() {
|
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||||
@Override
|
actionBar.setHomeButtonEnabled(true);
|
||||||
public void run() {
|
|
||||||
mDrawerToggle.syncState();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mDrawerLayout.setDrawerListener(mDrawerToggle);
|
// ActionBarDrawerToggle ties together the the proper interactions
|
||||||
|
// between the navigation drawer and the action bar app icon.
|
||||||
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
|
|
||||||
|
|
||||||
drawerAdapter.notifyDataSetChanged();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void selectItem(int position) {
|
mDrawerToggle = new ActionBarDrawerToggle(getActivity(), /* host Activity */
|
||||||
mCurrentSelectedPosition = position;
|
mDrawerLayout, /* DrawerLayout object */
|
||||||
if (mDrawerListView != null) {
|
R.string.navigation_drawer_open, /*
|
||||||
mDrawerListView.setItemChecked(position, true);
|
* "open drawer" description for
|
||||||
}
|
* accessibility
|
||||||
if (mDrawerLayout != null) {
|
*/
|
||||||
mDrawerLayout.closeDrawer(mFragmentContainerView);
|
R.string.navigation_drawer_close /*
|
||||||
}
|
* "close drawer" description for
|
||||||
if (mCallbacks != null) {
|
* accessibility
|
||||||
mCallbacks.onNavigationDrawerItemSelected(position);
|
*/
|
||||||
}
|
)
|
||||||
}
|
{
|
||||||
|
@Override
|
||||||
|
public void onDrawerClosed(View drawerView)
|
||||||
|
{
|
||||||
|
super.onDrawerClosed(drawerView);
|
||||||
|
if (!isAdded())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
// getActivity().supportInvalidateOptionsMenu(); // calls
|
||||||
public void onAttach(Activity activity) {
|
// onPrepareOptionsMenu()
|
||||||
super.onAttach(activity);
|
}
|
||||||
try {
|
|
||||||
mCallbacks = (NavigationDrawerCallbacks) activity;
|
|
||||||
} catch (ClassCastException e) {
|
|
||||||
throw new ClassCastException("Activity must implement NavigationDrawerCallbacks.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDetach() {
|
public void onDrawerOpened(View drawerView)
|
||||||
super.onDetach();
|
{
|
||||||
mCallbacks = null;
|
super.onDrawerOpened(drawerView);
|
||||||
}
|
if (!isAdded())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
if (!mUserLearnedDrawer)
|
||||||
public void onSaveInstanceState(Bundle outState) {
|
{
|
||||||
super.onSaveInstanceState(outState);
|
// The user manually opened the drawer; store this flag to
|
||||||
outState.putInt(STATE_SELECTED_POSITION, mCurrentSelectedPosition);
|
// prevent auto-showing
|
||||||
}
|
// the navigation drawer automatically in the future.
|
||||||
|
mUserLearnedDrawer = true;
|
||||||
|
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
||||||
|
sp.edit().putBoolean(PREF_USER_LEARNED_DRAWER, true).commit();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
// getActivity().supportInvalidateOptionsMenu(); // calls
|
||||||
public void onConfigurationChanged(Configuration newConfig) {
|
// onPrepareOptionsMenu()
|
||||||
super.onConfigurationChanged(newConfig);
|
}
|
||||||
// Forward the new configuration the drawer toggle component.
|
};
|
||||||
mDrawerToggle.onConfigurationChanged(newConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
// If the user hasn't 'learned' about the drawer, open it to introduce
|
||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
// them to the drawer,
|
||||||
// If the drawer is open, show the global app actions in the action bar. See also
|
// per the navigation drawer design guidelines.
|
||||||
// showGlobalContextActionBar, which controls the top-left area of the action bar.
|
if (!mUserLearnedDrawer && !mFromSavedInstanceState)
|
||||||
|
{
|
||||||
showGlobalContextActionBar();
|
mDrawerLayout.openDrawer(mFragmentContainerView);
|
||||||
|
}
|
||||||
super.onCreateOptionsMenu(menu, inflater);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
// Defer code dependent on restoration of previous instance state.
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
mDrawerLayout.post(new Runnable()
|
||||||
|
{
|
||||||
//Xperimental -- check if we need options or not
|
@Override
|
||||||
if (mDrawerToggle.onOptionsItemSelected(item)) {
|
public void run()
|
||||||
return true;
|
{
|
||||||
}
|
mDrawerToggle.syncState();
|
||||||
|
}
|
||||||
if (item.getItemId() == R.id.action_search) {
|
});
|
||||||
|
|
||||||
return true;
|
mDrawerLayout.setDrawerListener(mDrawerToggle);
|
||||||
}
|
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
drawerAdapter.notifyDataSetChanged();
|
||||||
* Per the navigation drawer design guidelines, updates the action bar to show the global app
|
|
||||||
* 'context', rather than just what's in the current screen.
|
|
||||||
*/
|
|
||||||
private void showGlobalContextActionBar() {
|
|
||||||
ActionBar actionBar = getActionBar();
|
|
||||||
actionBar.setDisplayShowTitleEnabled(true);
|
|
||||||
//actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
|
||||||
actionBar.setTitle(R.string.app_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
private ActionBar getActionBar() {
|
}
|
||||||
return ((ActionBarActivity) getActivity()).getSupportActionBar();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
private void selectItem(int position)
|
||||||
* Callbacks interface that all activities using this fragment must implement.
|
{
|
||||||
*/
|
mCurrentSelectedPosition = position;
|
||||||
public static interface NavigationDrawerCallbacks {
|
if (mDrawerListView != null)
|
||||||
/**
|
{
|
||||||
* Called when an item in the navigation drawer is selected.
|
mDrawerListView.setItemChecked(position, true);
|
||||||
*/
|
}
|
||||||
void onNavigationDrawerItemSelected(int position);
|
if (mDrawerLayout != null)
|
||||||
}
|
{
|
||||||
|
mDrawerLayout.closeDrawer(mFragmentContainerView);
|
||||||
|
}
|
||||||
|
if (mCallbacks != null)
|
||||||
|
{
|
||||||
|
mCallbacks.onNavigationDrawerItemSelected(position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class DrawerAdapter extends BaseAdapter {
|
@Override
|
||||||
private Context mContext;
|
public void onAttach(Activity activity)
|
||||||
|
{
|
||||||
|
super.onAttach(activity);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
mCallbacks = (NavigationDrawerCallbacks) activity;
|
||||||
|
} catch (ClassCastException e)
|
||||||
|
{
|
||||||
|
throw new ClassCastException("Activity must implement NavigationDrawerCallbacks.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
final int [] titles = {
|
public void onDetach()
|
||||||
R.string.drawer_header,
|
{
|
||||||
R.string.drawer_guide,
|
super.onDetach();
|
||||||
R.string.drawer_news,
|
mCallbacks = null;
|
||||||
R.string.drawer_catalogue,
|
}
|
||||||
R.string.drawer_map,
|
|
||||||
R.string.drawer_video,
|
|
||||||
R.string.drawer_photo_gallery,
|
|
||||||
//R.string.drawer_books,
|
|
||||||
R.string.drawer_for_investor,
|
|
||||||
R.string.drawer_settings
|
|
||||||
};
|
|
||||||
|
|
||||||
final int [] iconIds = {
|
|
||||||
R.drawable.drawer_bashgid_logo,
|
|
||||||
R.drawable.drawer_agenda,
|
|
||||||
R.drawable.drawer_news,
|
|
||||||
R.drawable.drawer_bookmark,
|
|
||||||
R.drawable.drawer_pushpin,
|
|
||||||
R.drawable.drawer_tv,
|
|
||||||
R.drawable.drawer_photography,
|
|
||||||
//R.drawable.drawer_books,
|
|
||||||
R.drawable.drawer_id,
|
|
||||||
R.drawable.drawer_gear
|
|
||||||
};
|
|
||||||
|
|
||||||
public DrawerAdapter(Context c) {
|
@Override
|
||||||
mContext = c;
|
public void onSaveInstanceState(Bundle outState)
|
||||||
}
|
{
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
outState.putInt(STATE_SELECTED_POSITION, mCurrentSelectedPosition);
|
||||||
|
}
|
||||||
|
|
||||||
public int getCount() {
|
@Override
|
||||||
return titles.length;
|
public void onConfigurationChanged(Configuration newConfig)
|
||||||
}
|
{
|
||||||
|
super.onConfigurationChanged(newConfig);
|
||||||
|
// Forward the new configuration the drawer toggle component.
|
||||||
|
mDrawerToggle.onConfigurationChanged(newConfig);
|
||||||
|
}
|
||||||
|
|
||||||
public Object getItem(int position) {
|
@Override
|
||||||
return null;
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater)
|
||||||
}
|
{
|
||||||
|
// If the drawer is open, show the global app actions in the action bar.
|
||||||
|
// See also
|
||||||
|
// showGlobalContextActionBar, which controls the top-left area of the
|
||||||
|
// action bar.
|
||||||
|
|
||||||
public long getItemId(int position) {
|
showGlobalContextActionBar();
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// create a new ImageView for each item referenced by the Adapter
|
super.onCreateOptionsMenu(menu, inflater);
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
|
||||||
|
}
|
||||||
|
|
||||||
View view;
|
@Override
|
||||||
if (convertView == null) { // if it's not recycled, initialize some attributes
|
public boolean onOptionsItemSelected(MenuItem item)
|
||||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
{
|
||||||
view = inflater.inflate(R.layout.drawer_list_element, null);
|
|
||||||
|
// Xperimental -- check if we need options or not
|
||||||
|
if (mDrawerToggle.onOptionsItemSelected(item))
|
||||||
} else {
|
{
|
||||||
view = convertView;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextView textView = (TextView) view.findViewById(R.id.dateTextView);
|
if (item.getItemId() == R.id.action_search)
|
||||||
|
{
|
||||||
textView.setText(titles[position]);
|
|
||||||
|
return true;
|
||||||
ImageView imageView = (ImageView) view.findViewById(R.id.imageView);
|
}
|
||||||
|
|
||||||
imageView.setImageResource(iconIds[position]);
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
if (position == 0)
|
|
||||||
{
|
/**
|
||||||
LayoutParams params = imageView.getLayoutParams();
|
* Per the navigation drawer design guidelines, updates the action bar to
|
||||||
params.width = 96;
|
* show the global app 'context', rather than just what's in the current
|
||||||
params.height = 96;
|
* screen.
|
||||||
imageView.setLayoutParams(params);
|
*/
|
||||||
|
private void showGlobalContextActionBar()
|
||||||
textView.setTypeface(null, Typeface.BOLD);
|
{
|
||||||
}
|
ActionBar actionBar = getActionBar();
|
||||||
else
|
actionBar.setDisplayShowTitleEnabled(true);
|
||||||
{
|
// actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
||||||
LayoutParams params = imageView.getLayoutParams();
|
actionBar.setTitle(R.string.app_name);
|
||||||
params.width = 48;
|
}
|
||||||
params.height = 48;
|
|
||||||
imageView.setLayoutParams(params);
|
private ActionBar getActionBar()
|
||||||
|
{
|
||||||
textView.setTypeface(null, Typeface.NORMAL);
|
return ((ActionBarActivity) getActivity()).getSupportActionBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
return view;
|
/**
|
||||||
}
|
* Callbacks interface that all activities using this fragment must
|
||||||
|
* implement.
|
||||||
|
*/
|
||||||
|
public static interface NavigationDrawerCallbacks
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Called when an item in the navigation drawer is selected.
|
||||||
|
*/
|
||||||
|
void onNavigationDrawerItemSelected(int position);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DrawerAdapter extends BaseAdapter
|
||||||
|
{
|
||||||
|
private Context mContext;
|
||||||
|
|
||||||
|
final int[] titles = { R.string.drawer_header, R.string.drawer_guide, R.string.drawer_news, R.string.drawer_catalogue, R.string.drawer_map,
|
||||||
|
R.string.drawer_video, R.string.drawer_photo_gallery, R.string.drawer_for_investor, R.string.drawer_settings };
|
||||||
|
|
||||||
|
final int[] iconIds = { R.drawable.drawer_bashgid_logo, R.drawable.drawer_agenda, R.drawable.drawer_news, R.drawable.drawer_bookmark,
|
||||||
|
R.drawable.drawer_pushpin, R.drawable.drawer_tv, R.drawable.drawer_photography, R.drawable.drawer_id, R.drawable.drawer_gear };
|
||||||
|
|
||||||
|
public DrawerAdapter(Context c)
|
||||||
|
{
|
||||||
|
mContext = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCount()
|
||||||
|
{
|
||||||
|
return titles.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getItem(int position)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getItemId(int position)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// create a new ImageView for each item referenced by the Adapter
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
View view;
|
||||||
|
if (convertView == null)
|
||||||
|
{ // if it's not recycled, initialize some attributes
|
||||||
|
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
|
view = inflater.inflate(R.layout.drawer_list_element, null);
|
||||||
|
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
view = convertView;
|
||||||
|
}
|
||||||
|
|
||||||
|
TextView textView = (TextView) view.findViewById(R.id.dateTextView);
|
||||||
|
|
||||||
|
textView.setText(titles[position]);
|
||||||
|
|
||||||
|
ImageView imageView = (ImageView) view.findViewById(R.id.imageView);
|
||||||
|
|
||||||
|
imageView.setImageResource(iconIds[position]);
|
||||||
|
|
||||||
|
int drawerImageSize = (int) mContext.getResources().getDimension(R.dimen.drawer_image_size);
|
||||||
|
|
||||||
|
if (position == 0)
|
||||||
|
{
|
||||||
|
LayoutParams params = imageView.getLayoutParams();
|
||||||
|
params.width = drawerImageSize * 2;
|
||||||
|
params.height = drawerImageSize * 2;
|
||||||
|
imageView.setLayoutParams(params);
|
||||||
|
|
||||||
|
textView.setTypeface(null, Typeface.BOLD);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
LayoutParams params = imageView.getLayoutParams();
|
||||||
|
params.width = drawerImageSize;
|
||||||
|
params.height = drawerImageSize;
|
||||||
|
imageView.setLayoutParams(params);
|
||||||
|
|
||||||
|
textView.setTypeface(null, Typeface.NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,130 +1,126 @@
|
|||||||
package fishrungames.bashgid;
|
package fishrungames.bashgid;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedHashSet;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
import fishrungames.networkutils.ImageManager;
|
|
||||||
import fishrungames.bashgid.core.ArticleManager;
|
import fishrungames.bashgid.core.ArticleManager;
|
||||||
import fishrungames.bashgid.core.ArticleManager.ArticleRecordData;
|
|
||||||
import fishrungames.bashgid.core.ArticleManager.ArticleShortData;
|
import fishrungames.bashgid.core.ArticleManager.ArticleShortData;
|
||||||
import fishrungames.bashgid.core.DatabaseGetJournalTask;
|
import fishrungames.bashgid.core.DatabaseGetJournalTask;
|
||||||
import fishrungames.bashgid.core.JournalManager;
|
import fishrungames.bashgid.core.JournalManager;
|
||||||
import fishrungames.bashgid.core.JournalManager.JournalSemiFullData;
|
import fishrungames.bashgid.core.JournalManager.JournalSemiFullData;
|
||||||
import fishrungames.bashgid.core.NewsManager.NewsRecord;
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.BaseAdapter;
|
import android.widget.BaseAdapter;
|
||||||
|
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.AdapterView.OnItemClickListener;
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
|
|
||||||
|
|
||||||
public class NewsListFragment extends Fragment
|
public class NewsListFragment extends Fragment
|
||||||
{
|
{
|
||||||
|
|
||||||
ListView listView;
|
ListView listView;
|
||||||
|
|
||||||
ListAdapter listAdapter;
|
ListAdapter listAdapter;
|
||||||
|
|
||||||
JournalSemiFullData journal;
|
JournalSemiFullData journal;
|
||||||
|
|
||||||
ProgressBar progressBar;
|
ProgressBar progressBar;
|
||||||
|
|
||||||
TextView footerTextView;
|
TextView footerTextView;
|
||||||
|
|
||||||
DatabaseGetJournalTask databaseGetJournalTask = null;
|
DatabaseGetJournalTask databaseGetJournalTask = null;
|
||||||
|
|
||||||
@SuppressLint("InflateParams") @Override
|
@SuppressLint("InflateParams")
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||||
|
{
|
||||||
|
|
||||||
RestoreJournal();
|
RestoreJournal();
|
||||||
|
|
||||||
View rootView = inflater.inflate(R.layout.fragment_news_page, container, false);
|
View rootView = inflater.inflate(R.layout.fragment_news_page, container, false);
|
||||||
|
|
||||||
listView = (ListView) rootView.findViewById(R.id.listView);
|
listView = (ListView) rootView.findViewById(R.id.listView);
|
||||||
|
|
||||||
View header = inflater.inflate(R.layout.news_page_list_header, null);
|
View header = inflater.inflate(R.layout.news_page_list_header, null);
|
||||||
|
|
||||||
listView.addHeaderView(header);
|
listView.addHeaderView(header);
|
||||||
|
|
||||||
progressBar = (ProgressBar)header.findViewById(R.id.progressBar);
|
progressBar = (ProgressBar) header.findViewById(R.id.progressBar);
|
||||||
|
|
||||||
progressBar.setVisibility(View.VISIBLE);
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
|
||||||
View footer = inflater.inflate(R.layout.news_page_list_footer, null);
|
View footer = inflater.inflate(R.layout.news_page_list_footer, null);
|
||||||
|
|
||||||
listView.addFooterView(footer);
|
listView.addFooterView(footer);
|
||||||
|
|
||||||
footerTextView = (TextView)footer.findViewById(R.id.footerTextView);
|
footerTextView = (TextView) footer.findViewById(R.id.footerTextView);
|
||||||
|
|
||||||
listAdapter = new ListAdapter(getActivity());
|
listAdapter = new ListAdapter(getActivity());
|
||||||
|
|
||||||
listView.setAdapter(listAdapter);
|
listView.setAdapter(listAdapter);
|
||||||
|
|
||||||
|
listView.setOnItemClickListener(new OnItemClickListener()
|
||||||
listView.setOnItemClickListener(new OnItemClickListener(){
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
|
||||||
{
|
{
|
||||||
//Add position + 1, because first element of list is always title
|
// Add position + 1, because first element of list is always
|
||||||
|
// title
|
||||||
if (position == journal.articleArr.size() + 1)
|
if (position == journal.articleArr.size() + 1)
|
||||||
{
|
{
|
||||||
footerTextView.setText(R.string.news_are_loading);
|
footerTextView.setText(R.string.news_are_loading);
|
||||||
LoadMoreNews();
|
LoadMoreNews();
|
||||||
}
|
} else if (position > 0)
|
||||||
else if (position > 0)
|
|
||||||
{
|
{
|
||||||
MainActivity.getInstance().OpenArticleScreen(journal.articleArr.get(position-1).name, MainActivity.TAG_TO_MAINFRAGMENT);
|
MainActivity.getInstance().OpenArticleScreen(journal.articleArr.get(position - 1).name, MainActivity.TAG_BACK_TO_NEWSLISTFRAGMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyView ()
|
public void onDestroyView()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (databaseGetJournalTask != null)
|
if (databaseGetJournalTask != null)
|
||||||
{
|
{
|
||||||
databaseGetJournalTask.cancel(false);
|
databaseGetJournalTask.cancel(false);
|
||||||
databaseGetJournalTask = null;
|
databaseGetJournalTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onDestroyView();
|
super.onDestroyView();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RefreshAdapter()
|
public void RefreshAdapter()
|
||||||
{
|
{
|
||||||
listAdapter.notifyDataSetChanged();
|
listAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RestoreJournal()
|
void RestoreJournal()
|
||||||
{
|
{
|
||||||
journal = JournalManager.CreateEmptyJournal();
|
journal = JournalManager.CreateEmptyJournal();
|
||||||
|
|
||||||
RefreshJournal();
|
RefreshJournal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RefreshJournal()
|
void RefreshJournal()
|
||||||
{
|
{
|
||||||
databaseGetJournalTask = new DatabaseGetJournalTask();
|
databaseGetJournalTask = new DatabaseGetJournalTask();
|
||||||
@ -132,119 +128,106 @@ public class NewsListFragment extends Fragment
|
|||||||
databaseGetJournalTask.mHandler = MainActivity.getInstance().mHandler;
|
databaseGetJournalTask.mHandler = MainActivity.getInstance().mHandler;
|
||||||
|
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
|
|
||||||
bundle.putString("journalName", "news");
|
bundle.putString("journalName", "news");
|
||||||
|
|
||||||
bundle.putInt("count", 20);
|
bundle.putInt("count", 20);
|
||||||
|
|
||||||
databaseGetJournalTask.execute(bundle);
|
databaseGetJournalTask.execute(bundle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadMoreNews()
|
void LoadMoreNews()
|
||||||
{
|
{
|
||||||
if (databaseGetJournalTask != null)
|
if (databaseGetJournalTask != null)
|
||||||
{
|
{
|
||||||
databaseGetJournalTask.cancel(false);
|
databaseGetJournalTask.cancel(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
databaseGetJournalTask = new DatabaseGetJournalTask();
|
databaseGetJournalTask = new DatabaseGetJournalTask();
|
||||||
|
|
||||||
databaseGetJournalTask.mHandler = MainActivity.getInstance().mHandler;
|
databaseGetJournalTask.mHandler = MainActivity.getInstance().mHandler;
|
||||||
|
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
|
|
||||||
bundle.putString("journalName", "news");
|
bundle.putString("journalName", "news");
|
||||||
|
|
||||||
bundle.putString("startAfterArticleName", journal.articleArr.get(journal.articleArr.size()-1).name);
|
bundle.putString("startAfterArticleName", journal.articleArr.get(journal.articleArr.size() - 1).name);
|
||||||
|
|
||||||
bundle.putInt("count", 10);
|
bundle.putInt("count", 10);
|
||||||
|
|
||||||
databaseGetJournalTask.execute(bundle);
|
databaseGetJournalTask.execute(bundle);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetJournal(JournalSemiFullData journal)
|
public void SetJournal(JournalSemiFullData journal)
|
||||||
{
|
{
|
||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
|
||||||
this.journal.articleArr.addAll(journal.articleArr);
|
this.journal.articleArr.addAll(journal.articleArr);
|
||||||
|
|
||||||
Set<ArticleShortData> articleSet = new TreeSet<ArticleShortData>(new ArticleManager.ArticleShortDataSortComparator());
|
Set<ArticleShortData> articleSet = new TreeSet<ArticleShortData>(new ArticleManager.ArticleShortDataSortComparator());
|
||||||
articleSet.addAll(this.journal.articleArr);
|
articleSet.addAll(this.journal.articleArr);
|
||||||
this.journal.articleArr.clear();
|
this.journal.articleArr.clear();
|
||||||
this.journal.articleArr.addAll(articleSet);
|
this.journal.articleArr.addAll(articleSet);
|
||||||
|
|
||||||
Collections.sort(this.journal.articleArr, new ArticleManager.ArticleShortDataTimeSortComparator());
|
Collections.sort(this.journal.articleArr, new ArticleManager.ArticleShortDataTimeSortComparator());
|
||||||
|
|
||||||
//this.journal.previewImageArr.addAll(journal.previewImageArr);
|
|
||||||
|
|
||||||
|
|
||||||
footerTextView.setText(R.string.news_load_more);
|
footerTextView.setText(R.string.news_load_more);
|
||||||
|
|
||||||
listAdapter.notifyDataSetChanged();
|
listAdapter.notifyDataSetChanged();
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public class ListAdapter extends BaseAdapter {
|
|
||||||
private Context mContext;
|
|
||||||
|
|
||||||
public ListAdapter(Context c) {
|
|
||||||
mContext = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCount() {
|
|
||||||
return journal.articleArr.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getItem(int position) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getItemId(int position) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// create a new ImageView for each item referenced by the Adapter
|
|
||||||
@SuppressLint("InflateParams")
|
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
|
||||||
|
|
||||||
|
|
||||||
View view;
|
|
||||||
if (convertView == null) { // if it's not recycled, initialize some attributes
|
|
||||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
|
||||||
view = inflater.inflate(R.layout.news_page_list_element, null);
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
view = convertView;
|
|
||||||
}
|
|
||||||
|
|
||||||
TextView titleTextView = (TextView)view.findViewById(R.id.titleTextView);
|
|
||||||
|
|
||||||
titleTextView.setText(journal.articleArr.get(position).title);
|
|
||||||
|
|
||||||
TextView dateTextView = (TextView)view.findViewById(R.id.dateTextView);
|
|
||||||
|
|
||||||
dateTextView.setText(journal.articleArr.get(position).dateTime.toString());
|
|
||||||
|
|
||||||
/*ImageView imageView = (ImageView) view.findViewById(R.id.imageView);
|
|
||||||
|
|
||||||
if (journal.articleArr.get(position).previewImageUrl != null)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
ImageManager.getInstance().ApplyImageToImageView(imageView, journal.articleArr.get(position).previewImageUrl);
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
imageView.setImageResource(R.drawable.transparent);
|
|
||||||
}*/
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ListAdapter extends BaseAdapter
|
||||||
|
{
|
||||||
|
private Context mContext;
|
||||||
|
|
||||||
|
public ListAdapter(Context c)
|
||||||
|
{
|
||||||
|
mContext = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCount()
|
||||||
|
{
|
||||||
|
return journal.articleArr.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getItem(int position)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getItemId(int position)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// create a new ImageView for each item referenced by the Adapter
|
||||||
|
@SuppressLint("InflateParams")
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
View view;
|
||||||
|
if (convertView == null)
|
||||||
|
{ // if it's not recycled, initialize some attributes
|
||||||
|
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
|
view = inflater.inflate(R.layout.news_page_list_element, null);
|
||||||
|
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
view = convertView;
|
||||||
|
}
|
||||||
|
|
||||||
|
TextView titleTextView = (TextView) view.findViewById(R.id.titleTextView);
|
||||||
|
|
||||||
|
titleTextView.setText(journal.articleArr.get(position).title);
|
||||||
|
|
||||||
|
TextView dateTextView = (TextView) view.findViewById(R.id.dateTextView);
|
||||||
|
|
||||||
|
dateTextView.setText(journal.articleArr.get(position).dateTime.toString());
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,70 +0,0 @@
|
|||||||
package fishrungames.bashgid;
|
|
||||||
|
|
||||||
|
|
||||||
import fishrungames.networkutils.ImageManager;
|
|
||||||
import fishrungames.bashgid.core.ArticleManager.ArticleFullData;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.webkit.WebView;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
|
|
||||||
public class NewsRecordFragment extends ArticleFragment
|
|
||||||
{
|
|
||||||
|
|
||||||
TextView titleTextView;
|
|
||||||
|
|
||||||
WebView webView;
|
|
||||||
|
|
||||||
public NewsRecordFragment()
|
|
||||||
{
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public NewsRecordFragment(String articleName)
|
|
||||||
{
|
|
||||||
super(articleName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public NewsRecordFragment(ArticleFullData article)
|
|
||||||
{
|
|
||||||
super(article);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
|
||||||
|
|
||||||
if (savedInstanceState != null) {
|
|
||||||
articleName = savedInstanceState.getString("articleName");
|
|
||||||
RestoreArticle();
|
|
||||||
}
|
|
||||||
|
|
||||||
View rootView = inflater.inflate(R.layout.fragment_news_record_page, container, false);
|
|
||||||
|
|
||||||
titleTextView = (TextView) rootView.findViewById(R.id.titleTextView);
|
|
||||||
|
|
||||||
webView = (WebView) rootView.findViewById(R.id.webView);
|
|
||||||
|
|
||||||
webView.getSettings().setJavaScriptEnabled(false);
|
|
||||||
|
|
||||||
return rootView;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void SetArticle(ArticleFullData article)
|
|
||||||
{
|
|
||||||
this.article = article;
|
|
||||||
|
|
||||||
titleTextView.setText(article.title);
|
|
||||||
|
|
||||||
String htmlCode = "<html><body>" + article.content + "</body></html>";
|
|
||||||
|
|
||||||
webView.loadDataWithBaseURL(null, htmlCode, "text/html", "UTF-8", null);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -128,7 +128,6 @@ public class OsmMapHolderFragment extends Fragment
|
|||||||
DetailsOverlayItem item = mOverlayItems.get(index);
|
DetailsOverlayItem item = mOverlayItems.get(index);
|
||||||
AlertDialog.Builder dialog = new AlertDialog.Builder(MainActivity.getInstance());
|
AlertDialog.Builder dialog = new AlertDialog.Builder(MainActivity.getInstance());
|
||||||
dialog.setTitle(item.getTitle());
|
dialog.setTitle(item.getTitle());
|
||||||
// dialog.setMessage(item.getSnippet());
|
|
||||||
|
|
||||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
|
|
||||||
@ -136,8 +135,8 @@ public class OsmMapHolderFragment extends Fragment
|
|||||||
|
|
||||||
ImageView image = (ImageView) dialogInnerView.findViewById(R.id.imageView);
|
ImageView image = (ImageView) dialogInnerView.findViewById(R.id.imageView);
|
||||||
TextView textView = (TextView) dialogInnerView.findViewById(R.id.addressTextView);
|
TextView textView = (TextView) dialogInnerView.findViewById(R.id.addressTextView);
|
||||||
TextView hintTextView = (TextView) dialogInnerView.findViewById(R.id.hintTextView);
|
TextView hintTextView = (TextView) dialogInnerView.findViewById(R.id.hintTextView);
|
||||||
|
|
||||||
Button button = (Button) dialogInnerView.findViewById(R.id.button);
|
Button button = (Button) dialogInnerView.findViewById(R.id.button);
|
||||||
|
|
||||||
ImageManager.getInstance().ApplyImageToImageView(image, item.getSnippet());
|
ImageManager.getInstance().ApplyImageToImageView(image, item.getSnippet());
|
||||||
@ -217,8 +216,14 @@ public class OsmMapHolderFragment extends Fragment
|
|||||||
{
|
{
|
||||||
public void onClick(DialogInterface dialog, int id)
|
public void onClick(DialogInterface dialog, int id)
|
||||||
{
|
{
|
||||||
MainActivity.getInstance().SetLastMapFilterName(journalName);
|
if (journalName != null && journalName.length() > 0)
|
||||||
MainActivity.getInstance().OpenArticleScreen(mArticles.get(index), MainActivity.TAG_FROM_MAPFRAGMENT_TO_ARTICLEFRAGMENT);
|
{
|
||||||
|
MainActivity.getInstance().SetLastMapFilterName(journalName);
|
||||||
|
MainActivity.getInstance().OpenArticleScreen(mArticles.get(index), MainActivity.TAG_BACK_TO_MAPFRAGMENT);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
MainActivity.getInstance().OpenArticleScreen(mArticles.get(index), MainActivity.TAG_BACK_TO_MAINFRAGMENT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -347,8 +352,6 @@ public class OsmMapHolderFragment extends Fragment
|
|||||||
outState.putInt("filterType", filterType);
|
outState.putInt("filterType", filterType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||||
{
|
{
|
||||||
@ -414,10 +417,8 @@ public class OsmMapHolderFragment extends Fragment
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
if ((filterType == 0 && journal == null) || (filterType == 1 && article == null))
|
if ((filterType == 0 && journal == null) || (filterType == 1 && article == null))
|
||||||
{
|
{
|
||||||
titleTextView.setText(R.string.map_is_loading);
|
titleTextView.setText(R.string.map_is_loading);
|
||||||
@ -429,7 +430,7 @@ public class OsmMapHolderFragment extends Fragment
|
|||||||
titleTextView.setText(R.string.map_is_loaded);
|
titleTextView.setText(R.string.map_is_loaded);
|
||||||
RestoreGeoJournals();
|
RestoreGeoJournals();
|
||||||
}
|
}
|
||||||
|
|
||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -446,7 +447,6 @@ public class OsmMapHolderFragment extends Fragment
|
|||||||
|
|
||||||
void RestoreJournal()
|
void RestoreJournal()
|
||||||
{
|
{
|
||||||
// journal = JournalManager.CreateEmptyJournal();
|
|
||||||
|
|
||||||
DatabaseGetJournalTask task = new DatabaseGetJournalTask();
|
DatabaseGetJournalTask task = new DatabaseGetJournalTask();
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ public class PhotoAlbumFragment extends Fragment
|
|||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
|
||||||
{
|
{
|
||||||
MainActivity.getInstance().SetLastAlbumName(albumName);
|
MainActivity.getInstance().SetLastAlbumName(albumName);
|
||||||
MainActivity.getInstance().OpenPhotoScreen(album, position, MainActivity.TAG_FROM_PHOTOLISTFRAGMENT_TO_PHOTOFRAGMENT);
|
MainActivity.getInstance().OpenPhotoScreen(album, position, MainActivity.TAG_BACK_TO_ALBUMFRAGMENT);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,12 +23,10 @@ public class PhotoFragmentAdapter extends PagerAdapter {
|
|||||||
|
|
||||||
AlbumFullData album;
|
AlbumFullData album;
|
||||||
|
|
||||||
//int currentPhoto;
|
|
||||||
|
|
||||||
public PhotoFragmentAdapter(Context context, AlbumFullData album/*, int currentPhoto*/) {
|
public PhotoFragmentAdapter(Context context, AlbumFullData album) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.album = album;
|
this.album = album;
|
||||||
//this.currentPhoto = currentPhoto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -59,7 +57,6 @@ public class PhotoFragmentAdapter extends PagerAdapter {
|
|||||||
|
|
||||||
descriptionTextView.setText(album.photoRecordArr.get(position).description);
|
descriptionTextView.setText(album.photoRecordArr.get(position).description);
|
||||||
|
|
||||||
|
|
||||||
ImageView image = (ImageView) viewLayout.findViewById(R.id.image);
|
ImageView image = (ImageView) viewLayout.findViewById(R.id.image);
|
||||||
|
|
||||||
ImageManager.getInstance().ApplyImageToImageView(image, album.photoRecordArr.get(position).imageUrl);
|
ImageManager.getInstance().ApplyImageToImageView(image, album.photoRecordArr.get(position).imageUrl);
|
||||||
|
@ -1,21 +1,14 @@
|
|||||||
package fishrungames.bashgid;
|
package fishrungames.bashgid;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import fishrungames.bashgid.core.ArticleManager;
|
|
||||||
import fishrungames.bashgid.core.ArticleManager.ArticleShortData;
|
import fishrungames.bashgid.core.ArticleManager.ArticleShortData;
|
||||||
import fishrungames.bashgid.core.DatabaseGetJournalTask;
|
|
||||||
import fishrungames.bashgid.core.DatabaseSearchArticleTask;
|
import fishrungames.bashgid.core.DatabaseSearchArticleTask;
|
||||||
import fishrungames.bashgid.core.NewsManager;
|
|
||||||
import fishrungames.bashgid.core.NewsManager.NewsRecord;
|
|
||||||
import fishrungames.bashgid.core.db.NewsDataSource;
|
|
||||||
import fishrungames.networkutils.ImageManager;
|
import fishrungames.networkutils.ImageManager;
|
||||||
import fishrungames.networkutils.UniversalActionWithCallback;
|
|
||||||
import fishrungames.networkutils.interfaces.RemoveCallbackInterface;
|
|
||||||
import fishrungames.networkutils.interfaces.UpdateAndFinishCallbackInterface;
|
|
||||||
import fishrungames.bashgid.core.NewsSearchRunnable;
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -24,13 +17,13 @@ import android.text.Editable;
|
|||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.BaseAdapter;
|
import android.widget.BaseAdapter;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ImageButton;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@ -40,28 +33,28 @@ public class SearchFragment extends Fragment
|
|||||||
{
|
{
|
||||||
|
|
||||||
ListView listView;
|
ListView listView;
|
||||||
|
|
||||||
ListAdapter listAdapter;
|
ListAdapter listAdapter;
|
||||||
|
|
||||||
TextView hintTextView;
|
TextView hintTextView;
|
||||||
|
|
||||||
EditText searchEditText;
|
EditText searchEditText;
|
||||||
|
|
||||||
ArrayList<ArticleShortData> searchResultArr = new ArrayList<ArticleShortData>();
|
ArrayList<ArticleShortData> searchResultArr = new ArrayList<ArticleShortData>();
|
||||||
|
|
||||||
String journalName;
|
String journalName;
|
||||||
String journalTitle;
|
String journalTitle;
|
||||||
String query;
|
String query;
|
||||||
|
|
||||||
DatabaseSearchArticleTask databaseSearchArticleTask = null;
|
DatabaseSearchArticleTask databaseSearchArticleTask = null;
|
||||||
|
|
||||||
public SearchFragment()
|
public SearchFragment()
|
||||||
{
|
{
|
||||||
this.journalName = "";
|
this.journalName = "";
|
||||||
this.journalTitle = "";
|
this.journalTitle = "";
|
||||||
this.query = "";
|
this.query = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public SearchFragment(String query)
|
public SearchFragment(String query)
|
||||||
{
|
{
|
||||||
this.journalName = "";
|
this.journalName = "";
|
||||||
@ -69,258 +62,219 @@ public class SearchFragment extends Fragment
|
|||||||
this.journalTitle = "";
|
this.journalTitle = "";
|
||||||
this.query = query;
|
this.query = query;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SearchFragment(String journalName, String journalTitle)
|
public SearchFragment(String journalName, String journalTitle)
|
||||||
{
|
{
|
||||||
this.journalName = journalName;
|
this.journalName = journalName;
|
||||||
this.journalTitle = journalTitle;
|
this.journalTitle = journalTitle;
|
||||||
this.query = "";
|
this.query = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SearchFragment(String query, String journalName, String journalTitle)
|
||||||
|
{
|
||||||
|
this.journalName = journalName;
|
||||||
|
this.journalTitle = journalTitle;
|
||||||
|
this.query = query;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSaveInstanceState(final Bundle outState) {
|
public void onSaveInstanceState(final Bundle outState)
|
||||||
super.onSaveInstanceState(outState);
|
{
|
||||||
outState.putString("journalName", journalName);
|
super.onSaveInstanceState(outState);
|
||||||
outState.putString("journalTitle", journalTitle);
|
outState.putString("journalName", journalName);
|
||||||
outState.putString("query", query);
|
outState.putString("journalTitle", journalTitle);
|
||||||
}
|
outState.putString("query", query);
|
||||||
|
}
|
||||||
@SuppressLint("InflateParams") @Override
|
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
@SuppressLint("InflateParams")
|
||||||
|
@Override
|
||||||
if (savedInstanceState != null) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (savedInstanceState != null)
|
||||||
|
{
|
||||||
journalName = savedInstanceState.getString("journalName");
|
journalName = savedInstanceState.getString("journalName");
|
||||||
journalTitle = savedInstanceState.getString("journalTitle");
|
journalTitle = savedInstanceState.getString("journalTitle");
|
||||||
query = savedInstanceState.getString("query");
|
query = savedInstanceState.getString("query");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
View rootView = inflater.inflate(R.layout.fragment_search_page, container, false);
|
View rootView = inflater.inflate(R.layout.fragment_search_page, container, false);
|
||||||
|
|
||||||
listView = (ListView) rootView.findViewById(R.id.listView);
|
listView = (ListView) rootView.findViewById(R.id.listView);
|
||||||
|
|
||||||
View header = inflater.inflate(R.layout.search_page_list_header, null);
|
View header = inflater.inflate(R.layout.search_page_list_header, null);
|
||||||
|
|
||||||
TextView addressTextView = (TextView) header.findViewById(R.id.addressTextView);
|
TextView addressTextView = (TextView) header.findViewById(R.id.addressTextView);
|
||||||
|
|
||||||
|
|
||||||
if (journalTitle == null || journalTitle.length() == 0)
|
if (journalTitle == null || journalTitle.length() == 0)
|
||||||
{
|
{
|
||||||
addressTextView.setText(R.string.search_everywhere);
|
addressTextView.setText(R.string.search_everywhere);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
{
|
{
|
||||||
String search_in = this.getResources().getString(R.string.search_in);
|
String search_in = this.getResources().getString(R.string.search_in);
|
||||||
|
|
||||||
search_in = search_in.replace("%%", journalTitle);
|
search_in = search_in.replace("%%", journalTitle);
|
||||||
|
|
||||||
addressTextView.setText(search_in);
|
addressTextView.setText(search_in);
|
||||||
}
|
}
|
||||||
|
|
||||||
hintTextView = (TextView) header.findViewById(R.id.hintTextView);
|
hintTextView = (TextView) header.findViewById(R.id.hintTextView);
|
||||||
|
|
||||||
|
|
||||||
searchEditText = (EditText) header.findViewById(R.id.editText);
|
searchEditText = (EditText) header.findViewById(R.id.editText);
|
||||||
|
|
||||||
searchEditText.setText(query);
|
searchEditText.setText(query);
|
||||||
|
|
||||||
searchEditText.addTextChangedListener(new TextWatcher(){
|
searchEditText.addTextChangedListener(new TextWatcher()
|
||||||
|
{
|
||||||
public void afterTextChanged(Editable s) {
|
|
||||||
|
public void afterTextChanged(Editable s)
|
||||||
|
{
|
||||||
|
|
||||||
query = searchEditText.getText().toString();
|
query = searchEditText.getText().toString();
|
||||||
|
|
||||||
CallUpdateNews();
|
CallUpdateNews();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after){}
|
public void beforeTextChanged(CharSequence s, int start, int count, int after)
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count){}
|
{
|
||||||
});
|
}
|
||||||
|
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
listView.addHeaderView(header);
|
listView.addHeaderView(header);
|
||||||
|
|
||||||
listAdapter = new ListAdapter(getActivity());
|
listAdapter = new ListAdapter(getActivity());
|
||||||
|
|
||||||
listView.setAdapter(listAdapter);
|
listView.setAdapter(listAdapter);
|
||||||
|
|
||||||
listView.setOnItemClickListener(new OnItemClickListener(){
|
listView.setOnItemClickListener(new OnItemClickListener()
|
||||||
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
|
||||||
{
|
{
|
||||||
MainActivity.getInstance().OpenArticleScreen(searchResultArr.get(position-1).name, MainActivity.TAG_TO_MAINFRAGMENT);
|
|
||||||
|
MainActivity.getInstance().SetLastJournalName(journalName);
|
||||||
|
MainActivity.getInstance().SetLastJournalTitle(journalTitle);
|
||||||
|
|
||||||
|
MainActivity.getInstance().SetLastSearchQuery(query);
|
||||||
|
MainActivity.getInstance().OpenArticleScreen(searchResultArr.get(position - 1).name, MainActivity.TAG_BACK_TO_SEARCHFRAGMENT);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
CallUpdateNews();
|
CallUpdateNews();
|
||||||
|
|
||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void SetSearchResult(ArrayList<ArticleShortData> articleArr)
|
public void SetSearchResult(ArrayList<ArticleShortData> articleArr)
|
||||||
{
|
{
|
||||||
searchResultArr = articleArr;
|
searchResultArr = articleArr;
|
||||||
listAdapter.notifyDataSetChanged();
|
listAdapter.notifyDataSetChanged();
|
||||||
|
|
||||||
String searchResultCount = getResources().getString(R.string.search_result_count);
|
String searchResultCount = getResources().getString(R.string.search_result_count);
|
||||||
|
|
||||||
searchResultCount = searchResultCount.replace("%%", Integer.toString(articleArr.size()));
|
searchResultCount = searchResultCount.replace("%%", Integer.toString(articleArr.size()));
|
||||||
|
|
||||||
hintTextView.setText(searchResultCount);
|
hintTextView.setText(searchResultCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class ListAdapter extends BaseAdapter {
|
|
||||||
private Context mContext;
|
|
||||||
|
|
||||||
public ListAdapter(Context c) {
|
public class ListAdapter extends BaseAdapter
|
||||||
mContext = c;
|
{
|
||||||
}
|
private Context mContext;
|
||||||
|
|
||||||
public int getCount() {
|
public ListAdapter(Context c)
|
||||||
return searchResultArr.size();
|
{
|
||||||
}
|
mContext = c;
|
||||||
|
}
|
||||||
|
|
||||||
public Object getItem(int position) {
|
public int getCount()
|
||||||
return null;
|
{
|
||||||
}
|
return searchResultArr.size();
|
||||||
|
}
|
||||||
|
|
||||||
public long getItemId(int position) {
|
public Object getItem(int position)
|
||||||
return 0;
|
{
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// create a new ImageView for each item referenced by the Adapter
|
public long getItemId(int position)
|
||||||
@SuppressLint("InflateParams")
|
{
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
// create a new ImageView for each item referenced by the Adapter
|
||||||
View view;
|
@SuppressLint("InflateParams")
|
||||||
if (convertView == null) { // if it's not recycled, initialize some attributes
|
public View getView(int position, View convertView, ViewGroup parent)
|
||||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
{
|
||||||
view = inflater.inflate(R.layout.search_page_list_element, null);
|
|
||||||
|
View view;
|
||||||
} else {
|
if (convertView == null)
|
||||||
view = convertView;
|
{ // if it's not recycled, initialize some attributes
|
||||||
}
|
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
|
view = inflater.inflate(R.layout.journal_element, null);
|
||||||
ImageButton imageButton = (ImageButton) view.findViewById(R.id.imageButton);
|
|
||||||
|
} else
|
||||||
Button button = (Button) view.findViewById(R.id.button);
|
{
|
||||||
|
view = convertView;
|
||||||
TextView dateTextView = (TextView) view.findViewById(R.id.dateTextView);
|
}
|
||||||
|
|
||||||
ImageManager.getInstance().ApplyImageToImageView(imageButton, searchResultArr.get(position).previewImageUrl);
|
TextView titleTextView = (TextView) view.findViewById(R.id.titleTextView);
|
||||||
|
|
||||||
button.setText(searchResultArr.get(position).title);
|
titleTextView.setText(searchResultArr.get(position).title);
|
||||||
|
|
||||||
dateTextView.setText(NewsDataSource.iso8601Format.format(searchResultArr.get(position).dateTime));
|
TextView dateTextView = (TextView) view.findViewById(R.id.dateTextView);
|
||||||
|
|
||||||
|
dateTextView.setText(MainActivity.iso8601Format.format(searchResultArr.get(position).dateTime));
|
||||||
|
|
||||||
button.setOnClickListener(new ButtonOnClickListener(searchResultArr.get(position).name, searchResultArr.get(position).type));
|
ImageView imageView = (ImageView) view.findViewById(R.id.imageView);
|
||||||
|
|
||||||
imageButton.setOnClickListener(new ButtonOnClickListener(searchResultArr.get(position).name, searchResultArr.get(position).type));
|
if (searchResultArr.get(position).previewImageUrl != null)
|
||||||
|
{
|
||||||
return view;*/
|
ImageManager.getInstance().ApplyImageToImageView(imageView, searchResultArr.get(position).previewImageUrl);
|
||||||
|
} else
|
||||||
View view;
|
{
|
||||||
if (convertView == null) { // if it's not recycled, initialize some attributes
|
imageView.setImageResource(R.drawable.transparent);
|
||||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
}
|
||||||
view = inflater.inflate(R.layout.journal_element, null);
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
view = convertView;
|
|
||||||
}
|
|
||||||
|
|
||||||
TextView titleTextView = (TextView)view.findViewById(R.id.titleTextView);
|
|
||||||
|
|
||||||
titleTextView.setText(searchResultArr.get(position).title);
|
|
||||||
|
|
||||||
TextView dateTextView = (TextView)view.findViewById(R.id.dateTextView);
|
|
||||||
|
|
||||||
dateTextView.setText(NewsDataSource.iso8601Format.format(searchResultArr.get(position).dateTime));
|
|
||||||
|
|
||||||
ImageView imageView = (ImageView) view.findViewById(R.id.imageView);
|
|
||||||
|
|
||||||
if (searchResultArr.get(position).previewImageUrl != null)
|
|
||||||
{
|
|
||||||
ImageManager.getInstance().ApplyImageToImageView(imageView, searchResultArr.get(position).previewImageUrl);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
imageView.setImageResource(R.drawable.transparent);
|
|
||||||
}
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void CallUpdateNews()
|
public void CallUpdateNews()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
if (query.length() >= 3 || Locale.getDefault() == Locale.CHINA)
|
if (query.length() >= 3 || Locale.getDefault() == Locale.CHINA)
|
||||||
{
|
{
|
||||||
if (databaseSearchArticleTask != null)
|
if (databaseSearchArticleTask != null)
|
||||||
{
|
{
|
||||||
databaseSearchArticleTask.cancel(false);
|
databaseSearchArticleTask.cancel(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
databaseSearchArticleTask = new DatabaseSearchArticleTask();
|
databaseSearchArticleTask = new DatabaseSearchArticleTask();
|
||||||
|
|
||||||
databaseSearchArticleTask.mHandler = MainActivity.getInstance().mHandler;
|
databaseSearchArticleTask.mHandler = MainActivity.getInstance().mHandler;
|
||||||
|
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
|
|
||||||
bundle.putString("journalName", journalName);
|
bundle.putString("journalName", journalName);
|
||||||
bundle.putString("query", query);
|
bundle.putString("query", query);
|
||||||
|
|
||||||
databaseSearchArticleTask.execute(bundle);
|
databaseSearchArticleTask.execute(bundle);
|
||||||
|
|
||||||
hintTextView.setText(R.string.search_is_performing);
|
hintTextView.setText(R.string.search_is_performing);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
{
|
{
|
||||||
searchResultArr.clear();
|
searchResultArr.clear();
|
||||||
listAdapter.notifyDataSetChanged();
|
listAdapter.notifyDataSetChanged();
|
||||||
|
|
||||||
hintTextView.setText(R.string.search_at_least_3_symbols);
|
hintTextView.setText(R.string.search_at_least_3_symbols);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
public static class ButtonOnClickListener implements OnClickListener
|
|
||||||
{
|
|
||||||
|
|
||||||
//NewsRecord newsRecord;
|
|
||||||
String articleName;
|
|
||||||
int articleType;
|
|
||||||
|
|
||||||
public ButtonOnClickListener(String articleName, int articleType)
|
|
||||||
{
|
|
||||||
this.articleName = articleName;
|
|
||||||
this.articleType = articleType;
|
|
||||||
//this.newsRecord = newsRecord;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(View v)
|
|
||||||
{
|
|
||||||
|
|
||||||
MainActivity.getInstance().OpenArticleScreen(articleName, MainActivity.TAG_TO_MAINFRAGMENT);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package fishrungames.bashgid;
|
package fishrungames.bashgid;
|
||||||
|
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -11,16 +10,16 @@ import android.view.View.OnClickListener;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
|
||||||
|
|
||||||
public class SettingsFragment extends Fragment
|
public class SettingsFragment extends Fragment
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||||
|
{
|
||||||
|
|
||||||
View rootView = inflater.inflate(R.layout.fragment_settings_page, container, false);
|
View rootView = inflater.inflate(R.layout.fragment_settings_page, container, false);
|
||||||
|
|
||||||
Button callSupportButton = (Button)rootView.findViewById(R.id.callSupportButton);
|
Button callSupportButton = (Button) rootView.findViewById(R.id.callSupportButton);
|
||||||
|
|
||||||
callSupportButton.setOnClickListener(new OnClickListener()
|
callSupportButton.setOnClickListener(new OnClickListener()
|
||||||
{
|
{
|
||||||
@ -33,11 +32,10 @@ public class SettingsFragment extends Fragment
|
|||||||
intent.setData(Uri.parse(uri));
|
intent.setData(Uri.parse(uri));
|
||||||
MainActivity.getInstance().startActivity(intent);
|
MainActivity.getInstance().startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Button visitKitapButton = (Button) rootView.findViewById(R.id.visitKitapButton);
|
||||||
Button visitKitapButton = (Button)rootView.findViewById(R.id.visitKitapButton);
|
|
||||||
|
|
||||||
visitKitapButton.setOnClickListener(new OnClickListener()
|
visitKitapButton.setOnClickListener(new OnClickListener()
|
||||||
{
|
{
|
||||||
@ -49,8 +47,8 @@ public class SettingsFragment extends Fragment
|
|||||||
startActivity(i);
|
startActivity(i);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Button visitDeveloperButton = (Button)rootView.findViewById(R.id.visitDeveloperButton);
|
Button visitDeveloperButton = (Button) rootView.findViewById(R.id.visitDeveloperButton);
|
||||||
|
|
||||||
visitDeveloperButton.setOnClickListener(new OnClickListener()
|
visitDeveloperButton.setOnClickListener(new OnClickListener()
|
||||||
{
|
{
|
||||||
@ -62,9 +60,8 @@ public class SettingsFragment extends Fragment
|
|||||||
startActivity(i);
|
startActivity(i);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Button visitTranslatorButton = (Button) rootView.findViewById(R.id.visitTranslatorButton);
|
||||||
Button visitTranslatorButton = (Button)rootView.findViewById(R.id.visitTranslatorButton);
|
|
||||||
|
|
||||||
visitTranslatorButton.setOnClickListener(new OnClickListener()
|
visitTranslatorButton.setOnClickListener(new OnClickListener()
|
||||||
{
|
{
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
package fishrungames.bashgid;
|
|
||||||
|
|
||||||
|
|
||||||
import com.google.android.gms.maps.OnStreetViewPanoramaReadyCallback;
|
|
||||||
import com.google.android.gms.maps.StreetViewPanorama;
|
|
||||||
|
|
||||||
import com.google.android.gms.maps.SupportStreetViewPanoramaFragment;
|
|
||||||
import com.google.android.gms.maps.model.LatLng;
|
|
||||||
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
|
|
||||||
|
|
||||||
public class StreetViewHolderFragment extends Fragment implements OnStreetViewPanoramaReadyCallback
|
|
||||||
{
|
|
||||||
|
|
||||||
double lat = 0;
|
|
||||||
double lon = 0;
|
|
||||||
|
|
||||||
public StreetViewHolderFragment()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public StreetViewHolderFragment(double lat, double lon)
|
|
||||||
{
|
|
||||||
this.lat = lat;
|
|
||||||
this.lon = lon;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
|
||||||
|
|
||||||
View rootView = inflater.inflate(R.layout.fragment_streetview_page, container, false);
|
|
||||||
|
|
||||||
SupportStreetViewPanoramaFragment streetViewPanoramaFragment = (SupportStreetViewPanoramaFragment) getChildFragmentManager().findFragmentById(R.id.streetviewpanorama);
|
|
||||||
|
|
||||||
streetViewPanoramaFragment.getStreetViewPanoramaAsync(this);
|
|
||||||
|
|
||||||
|
|
||||||
return rootView;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStreetViewPanoramaReady(StreetViewPanorama svp)
|
|
||||||
{
|
|
||||||
svp.setPosition(new LatLng(lat, lon));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -90,7 +90,10 @@ public class VideoListFragment extends Fragment
|
|||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
|
||||||
{
|
{
|
||||||
MainActivity.getInstance().OpenVideoRecordScreen(channelFullData.videoRecordArr.get(position), MainActivity.TAG_FROM_VIDEOLISTFRAGMENT_TO_VIDEORECORDFRAGMENT);
|
|
||||||
|
MainActivity.getInstance().SetLastChannelName(channelName);
|
||||||
|
|
||||||
|
MainActivity.getInstance().OpenVideoRecordScreen(channelFullData.videoRecordArr.get(position));
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -115,7 +118,6 @@ public class VideoListFragment extends Fragment
|
|||||||
|
|
||||||
this.channelFullData = channelFullData;
|
this.channelFullData = channelFullData;
|
||||||
listAdapter.notifyDataSetChanged();
|
listAdapter.notifyDataSetChanged();
|
||||||
//channelFullData = MainActivity.getInstance().channelDataSource.GetChannelFullData(channelName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
package fishrungames.bashgid;
|
package fishrungames.bashgid;
|
||||||
|
|
||||||
import fishrungames.bashgid.core.AlbumManager;
|
|
||||||
import fishrungames.bashgid.core.DatabaseGetAlbumTask;
|
|
||||||
import fishrungames.bashgid.core.VideoManager;
|
import fishrungames.bashgid.core.VideoManager;
|
||||||
import fishrungames.bashgid.core.ChannelManager.ChannelFullData;
|
|
||||||
import fishrungames.bashgid.core.VideoManager.VideoRecordData;
|
import fishrungames.bashgid.core.VideoManager.VideoRecordData;
|
||||||
import fishrungames.networkutils.ImageManager;
|
import fishrungames.networkutils.ImageManager;
|
||||||
|
|
||||||
|
@ -64,17 +64,6 @@ public class AlbumManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class AlbumRecord extends AlbumRecordData
|
|
||||||
{
|
|
||||||
public int id;
|
|
||||||
|
|
||||||
public AlbumRecord(int id, String name, String title, String description, int hidden)
|
|
||||||
{
|
|
||||||
super(name, title, description, hidden);
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static AlbumFullData CreateEmptyAlbum()
|
public static AlbumFullData CreateEmptyAlbum()
|
||||||
{
|
{
|
||||||
AlbumFullData result = new AlbumFullData(new AlbumRecordData("", "", "", 1));
|
AlbumFullData result = new AlbumFullData(new AlbumRecordData("", "", "", 1));
|
||||||
|
@ -8,7 +8,6 @@ import java.util.Locale;
|
|||||||
|
|
||||||
import fishrungames.bashgid.core.AlbumManager.AlbumFullData;
|
import fishrungames.bashgid.core.AlbumManager.AlbumFullData;
|
||||||
import fishrungames.bashgid.core.ChannelManager.ChannelFullData;
|
import fishrungames.bashgid.core.ChannelManager.ChannelFullData;
|
||||||
import fishrungames.bashgid.core.JournalManager.JournalSemiFullData;
|
|
||||||
|
|
||||||
public class ArticleManager
|
public class ArticleManager
|
||||||
{
|
{
|
||||||
@ -67,16 +66,6 @@ public class ArticleManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ArticleRecord extends ArticleRecordData
|
|
||||||
{
|
|
||||||
public int id;
|
|
||||||
|
|
||||||
public ArticleRecord(int id, ArticleRecordData recordData)
|
|
||||||
{
|
|
||||||
super(recordData);
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class ArticleFullData extends ArticleRecordData
|
public static class ArticleFullData extends ArticleRecordData
|
||||||
{
|
{
|
||||||
@ -99,8 +88,6 @@ public class ArticleManager
|
|||||||
{
|
{
|
||||||
super(recordData);
|
super(recordData);
|
||||||
previewImageUrl = "";
|
previewImageUrl = "";
|
||||||
//albumArr = new ArrayList<AlbumFullData>();
|
|
||||||
//channelArr = new ArrayList<ChannelFullData>();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,94 +0,0 @@
|
|||||||
package fishrungames.bashgid.core;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
|
|
||||||
import fishrungames.networkutils.ImageManager;
|
|
||||||
import fishrungames.networkutils.UpdateCallbackHolder;
|
|
||||||
import fishrungames.networkutils.interfaces.NetworkActionInterface;
|
|
||||||
|
|
||||||
|
|
||||||
public class BookManager implements NetworkActionInterface
|
|
||||||
{
|
|
||||||
|
|
||||||
public static class BookRecord
|
|
||||||
{
|
|
||||||
public String name;
|
|
||||||
public String author;
|
|
||||||
public String imageUrl;
|
|
||||||
public Integer price;
|
|
||||||
public String description;
|
|
||||||
|
|
||||||
public BookRecord(String name, String author, String imageUrl, Integer price, String description)
|
|
||||||
{
|
|
||||||
this.name = name;
|
|
||||||
this.author = author;
|
|
||||||
this.imageUrl = imageUrl;
|
|
||||||
this.price = price;
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private ArrayList<BookRecord> BookArr = new ArrayList<BookRecord>();
|
|
||||||
|
|
||||||
public static BookManager instance = null;
|
|
||||||
|
|
||||||
public static BookManager getInstance()
|
|
||||||
{
|
|
||||||
if (instance == null)
|
|
||||||
{
|
|
||||||
instance = new BookManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BookManager()
|
|
||||||
{
|
|
||||||
initBooks();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public ArrayList<BookRecord> getBooks()
|
|
||||||
{
|
|
||||||
ArrayList<BookRecord> books = new ArrayList<BookRecord>();
|
|
||||||
|
|
||||||
synchronized(BookArr)
|
|
||||||
{
|
|
||||||
books.addAll(BookArr);
|
|
||||||
}
|
|
||||||
|
|
||||||
return books;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initBooks()
|
|
||||||
{
|
|
||||||
BookArr.add(new BookRecord("Репка", "", "http://www.kitap-ufa.ru/upload/iblock/079/575.jpg", 40, "Русская народная сказка..."));
|
|
||||||
BookArr.add(new BookRecord("Уроки поэзии", "Рахматуллин С.И.", "http://www.kitap-ufa.ru/upload/iblock/6e7/012.jpg", 85, "В книгу вошли стихотворные произведения..."));
|
|
||||||
BookArr.add(new BookRecord("Новые валенки", "Калимуллина Г.К.", "http://www.kitap-ufa.ru/upload/iblock/edd/010.jpg", 75, "Детство - самая прекрасная, веселая и интересная пора в жизни человека..."));
|
|
||||||
BookArr.add(new BookRecord("В стране Урала", "Рафиков Б.З.", "", 90, "Эта книга настоящего мастера пера не оставит..."));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void InThreadAction(Bundle query, UpdateCallbackHolder callbackHolder)
|
|
||||||
{
|
|
||||||
|
|
||||||
/*
|
|
||||||
ArrayList<String> imageToDownloadList = new ArrayList<String>();
|
|
||||||
|
|
||||||
for (int i = 0; i < BookArr.size(); i++)
|
|
||||||
{
|
|
||||||
imageToDownloadList.add(BookArr.get(i).imageUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
Bundle innerQuery = new Bundle();
|
|
||||||
|
|
||||||
innerQuery.putStringArray("imageUrlArr", imageToDownloadList.toArray(new String[imageToDownloadList.size()]));
|
|
||||||
|
|
||||||
ImageManager.getInstance().InThreadAction(innerQuery, callbackHolder);
|
|
||||||
|
|
||||||
callbackHolder.OnUpdated(null);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,13 +2,6 @@ package fishrungames.bashgid.core;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
|
||||||
import fishrungames.bashgid.MainActivity;
|
|
||||||
import fishrungames.bashgid.core.AlbumManager.AlbumFullData;
|
|
||||||
import fishrungames.bashgid.core.AlbumManager.AlbumRecordData;
|
|
||||||
import fishrungames.bashgid.core.PhotoManager.PhotoRecordData;
|
|
||||||
|
|
||||||
|
|
||||||
public class ChannelManager
|
public class ChannelManager
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -49,52 +42,12 @@ public class ChannelManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class ChannelRecord extends ChannelRecordData
|
|
||||||
{
|
|
||||||
public int id;
|
|
||||||
|
|
||||||
public ChannelRecord(int id, String name, String title, String description, int hidden)
|
|
||||||
{
|
|
||||||
super(name, title, description, hidden);
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ChannelFullData CreateEmptyChannel()
|
public static ChannelFullData CreateEmptyChannel()
|
||||||
{
|
{
|
||||||
ChannelFullData result = new ChannelFullData(new ChannelRecordData("", "", "", 0));
|
ChannelFullData result = new ChannelFullData(new ChannelRecordData("", "", "", 0));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
public static void DownloadAndAddPhoto(PhotoRecordData recordData)
|
|
||||||
{
|
|
||||||
MainActivity.getInstance().DownloadImage(recordData.imageUrl, recordData.imageHash);
|
|
||||||
|
|
||||||
MainActivity.getInstance().photoDataSource.AddOrReplacePhoto(recordData);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void AddExistingPhotoToAlbum(String imageUrl, String albumName)
|
|
||||||
{
|
|
||||||
if (!MainActivity.getInstance().albumDataSource.IsAlbumAlreadyExist(albumName))
|
|
||||||
{
|
|
||||||
MainActivity.getInstance().albumDataSource.CreateNewAlbum(new AlbumRecordData(albumName, albumName, ""));
|
|
||||||
}
|
|
||||||
|
|
||||||
MainActivity.getInstance().albumDataSource.AddPhotoToAlbum(imageUrl, albumName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void DownloadAndAddPhotoToAlbum(PhotoRecordData recordData, String albumName)
|
|
||||||
{
|
|
||||||
DownloadAndAddPhoto(recordData);
|
|
||||||
|
|
||||||
AddExistingPhotoToAlbum(recordData.imageUrl, albumName);
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|