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"
|
||||
android:layout_width="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_marginLeft="@dimen/medium_margin"
|
||||
android:layout_marginTop="@dimen/medium_margin"
|
||||
@ -44,7 +44,7 @@
|
||||
android:id="@+id/imageButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:layout_gravity="right|center_vertical"
|
||||
android:layout_margin="@dimen/medium_margin"
|
||||
android:background="@drawable/transparent"
|
||||
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;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import fishrungames.bashgid.core.AlbumManager.AlbumShortData;
|
||||
|
||||
import fishrungames.networkutils.ImageManager;
|
||||
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
@ -27,7 +25,6 @@ import android.widget.ProgressBar;
|
||||
|
||||
import android.widget.TextView;
|
||||
|
||||
|
||||
public class AlbumListFragment extends Fragment
|
||||
{
|
||||
|
||||
@ -36,27 +33,27 @@ public class AlbumListFragment extends Fragment
|
||||
GridView gridView;
|
||||
|
||||
ArrayList<AlbumShortData> albumArr;
|
||||
|
||||
|
||||
ProgressBar progressBar;
|
||||
|
||||
|
||||
public AlbumListFragment()
|
||||
{
|
||||
RestoreAlbumList();
|
||||
}
|
||||
|
||||
|
||||
public AlbumListFragment(ArrayList<AlbumShortData> albumArr)
|
||||
{
|
||||
this.albumArr = albumArr;
|
||||
}
|
||||
|
||||
|
||||
@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);
|
||||
|
||||
progressBar = (ProgressBar)rootView.findViewById(R.id.progressBar);
|
||||
|
||||
|
||||
progressBar = (ProgressBar) rootView.findViewById(R.id.progressBar);
|
||||
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
|
||||
gridView = (GridView) rootView.findViewById(R.id.gridView);
|
||||
@ -78,40 +75,39 @@ public class AlbumListFragment extends Fragment
|
||||
|
||||
return rootView;
|
||||
}
|
||||
|
||||
|
||||
public void RestoreAlbumList()
|
||||
{
|
||||
albumArr = new ArrayList<AlbumShortData>();
|
||||
|
||||
|
||||
DatabaseGetAlbumListTask task = new DatabaseGetAlbumListTask();
|
||||
|
||||
task.mHandler = MainActivity.getInstance().mHandler;
|
||||
|
||||
task.execute();
|
||||
}
|
||||
|
||||
|
||||
public void SetAlbumList(ArrayList<AlbumShortData> albumArr)
|
||||
{
|
||||
progressBar.setVisibility(View.GONE);
|
||||
|
||||
this.albumArr = albumArr;
|
||||
|
||||
|
||||
listAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static class DatabaseGetAlbumListTask extends AsyncTask<String, Integer, Long>
|
||||
{
|
||||
|
||||
ArrayList<AlbumShortData> albumArr;
|
||||
|
||||
|
||||
public Handler mHandler;
|
||||
|
||||
protected Long doInBackground(String... queryArr)
|
||||
{
|
||||
|
||||
|
||||
albumArr = MainActivity.getInstance().albumDataSource.GetAllAlbumShortDataExceptHidden();
|
||||
|
||||
|
||||
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;
|
||||
|
||||
public ListAdapter(Context c) {
|
||||
public ListAdapter(Context c)
|
||||
{
|
||||
mContext = c;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
public int getCount()
|
||||
{
|
||||
return albumArr.size();
|
||||
}
|
||||
|
||||
public Object getItem(int position) {
|
||||
public Object getItem(int position)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public long getItemId(int position) {
|
||||
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) {
|
||||
|
||||
public View getView(int position, View convertView, ViewGroup parent)
|
||||
{
|
||||
|
||||
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);
|
||||
view = inflater.inflate(R.layout.video_page_list_element, null);
|
||||
|
||||
|
||||
} else {
|
||||
} else
|
||||
{
|
||||
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);
|
||||
|
||||
ImageManager.getInstance().ApplyImageToImageView(imageView, albumArr.get(position).firstImageUrl);
|
||||
|
@ -1,6 +1,5 @@
|
||||
package fishrungames.bashgid;
|
||||
|
||||
|
||||
import it.sephiroth.android.library.widget.AdapterView.OnItemClickListener;
|
||||
import it.sephiroth.android.library.widget.HListView;
|
||||
|
||||
@ -12,14 +11,11 @@ import org.osmdroid.api.IMapController;
|
||||
import org.osmdroid.util.GeoPoint;
|
||||
import org.osmdroid.views.MapView;
|
||||
|
||||
import fishrungames.bashgid.OsmMapHolderFragment.CustomItemizedOverlay;
|
||||
import fishrungames.bashgid.OsmMapHolderFragment.NoInteractionOverlay;
|
||||
import fishrungames.bashgid.core.ArticleManager;
|
||||
import fishrungames.bashgid.core.DatabaseGetAlbumTask;
|
||||
|
||||
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.PhotoManager.PhotoRecordData;
|
||||
import fishrungames.networkutils.ImageManager;
|
||||
@ -29,10 +25,9 @@ import android.content.Intent;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Typeface;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
@ -43,31 +38,28 @@ import android.view.View.OnLongClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
||||
|
||||
public class ArticleFragment extends Fragment
|
||||
{
|
||||
|
||||
|
||||
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 double geoLat;
|
||||
public double geoLon;
|
||||
|
||||
|
||||
public int albumPos;
|
||||
|
||||
|
||||
public ArticleLayoutElement(int type, String value)
|
||||
{
|
||||
this.type = type;
|
||||
@ -76,8 +68,7 @@ public class ArticleFragment extends Fragment
|
||||
this.geoLon = 0;
|
||||
this.albumPos = -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ArticleLayoutElement(double geoLat, double geoLon)
|
||||
{
|
||||
this.type = 3;
|
||||
@ -86,7 +77,7 @@ public class ArticleFragment extends Fragment
|
||||
this.geoLon = geoLon;
|
||||
this.albumPos = -1;
|
||||
}
|
||||
|
||||
|
||||
public ArticleLayoutElement(int albumPos)
|
||||
{
|
||||
this.type = 4;
|
||||
@ -96,8 +87,9 @@ public class ArticleFragment extends Fragment
|
||||
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)
|
||||
{
|
||||
@ -107,58 +99,59 @@ public class ArticleFragment extends Fragment
|
||||
@Override
|
||||
protected void draw(Canvas arg0, MapView arg1, boolean arg2)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@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)
|
||||
{
|
||||
MainActivity.getInstance().OpenMapScreen(article);
|
||||
MainActivity.getInstance().OpenMapScreen(article, MainActivity.TAG_BACK_TO_ARTICLEFRAGMENT);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
ListView listView;
|
||||
ListAdapter listAdapter;
|
||||
|
||||
|
||||
ProgressBar progressBar;
|
||||
|
||||
|
||||
String articleName;
|
||||
ArticleFullData article;
|
||||
ArrayList<ArticleLayoutElement> articleLayout = new ArrayList<ArticleLayoutElement>();
|
||||
|
||||
|
||||
public ArticleFragment()
|
||||
{
|
||||
articleName = "";
|
||||
article = null;
|
||||
}
|
||||
|
||||
|
||||
public ArticleFragment(String articleName)
|
||||
{
|
||||
this.articleName = articleName;
|
||||
RestoreArticle();
|
||||
ReloadLayout();
|
||||
}
|
||||
|
||||
|
||||
public ArticleFragment(ArticleFullData article)
|
||||
{
|
||||
this.articleName = article.name;
|
||||
this.article = article;
|
||||
ReloadLayout();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(final Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putString("articleName", articleName);
|
||||
}
|
||||
|
||||
public void onSaveInstanceState(final Bundle outState)
|
||||
{
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putString("articleName", articleName);
|
||||
}
|
||||
|
||||
public void RestoreArticle()
|
||||
{
|
||||
DatabaseGetArticleTask task = new DatabaseGetArticleTask();
|
||||
@ -167,342 +160,332 @@ public class ArticleFragment extends Fragment
|
||||
|
||||
task.execute(articleName);
|
||||
}
|
||||
|
||||
|
||||
public void ReloadLayout()
|
||||
{
|
||||
articleLayout.clear();
|
||||
|
||||
|
||||
if (article != null)
|
||||
{
|
||||
|
||||
articleLayout.add(new ArticleLayoutElement(0, article.title));
|
||||
|
||||
PhotoRecordData zeroPhoto = null;
|
||||
|
||||
if (article.albumArr.size() > 0)
|
||||
{
|
||||
if (article.albumArr.get(0).photoRecordArr.size() > 0)
|
||||
|
||||
articleLayout.add(new ArticleLayoutElement(0, article.title));
|
||||
|
||||
PhotoRecordData zeroPhoto = null;
|
||||
|
||||
if (article.albumArr.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)
|
||||
{
|
||||
articleLayout.add(new ArticleLayoutElement(2, zeroPhoto.imageUrl));
|
||||
}
|
||||
|
||||
|
||||
|
||||
articleLayout.add(new ArticleLayoutElement(1, article.content));
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
for (int i = 0; i < article.albumArr.size(); i++)
|
||||
{
|
||||
articleLayout.add(new ArticleLayoutElement(i));
|
||||
}
|
||||
|
||||
if (article.externalLink.length() > 0)
|
||||
{
|
||||
articleLayout.add(new ArticleLayoutElement(5, article.externalLink));
|
||||
}
|
||||
|
||||
|
||||
if (zeroPhoto != null)
|
||||
{
|
||||
articleLayout.add(new ArticleLayoutElement(2, zeroPhoto.imageUrl));
|
||||
}
|
||||
|
||||
articleLayout.add(new ArticleLayoutElement(1, article.content));
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
for (int i = 0; i < article.albumArr.size(); i++)
|
||||
{
|
||||
articleLayout.add(new ArticleLayoutElement(i));
|
||||
}
|
||||
|
||||
if (article.externalLink.length() > 0)
|
||||
{
|
||||
articleLayout.add(new ArticleLayoutElement(5, article.externalLink));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void SetArticle(ArticleFullData article)
|
||||
{
|
||||
progressBar.setVisibility(View.GONE);
|
||||
|
||||
|
||||
this.article = article;
|
||||
|
||||
|
||||
ReloadLayout();
|
||||
|
||||
|
||||
listAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||
{
|
||||
|
||||
if (savedInstanceState != null)
|
||||
{
|
||||
articleName = savedInstanceState.getString("articleName");
|
||||
RestoreArticle();
|
||||
ReloadLayout();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
|
||||
listView = (ListView) rootView.findViewById(R.id.listView);
|
||||
|
||||
|
||||
listAdapter = new ListAdapter(getActivity());
|
||||
|
||||
|
||||
listView.setAdapter(listAdapter);
|
||||
|
||||
return rootView;
|
||||
}
|
||||
|
||||
public class ListAdapter extends BaseAdapter {
|
||||
private Context mContext;
|
||||
|
||||
public ListAdapter(Context c) {
|
||||
mContext = c;
|
||||
}
|
||||
public class ListAdapter extends BaseAdapter
|
||||
{
|
||||
private Context mContext;
|
||||
|
||||
public int getCount() {
|
||||
return articleLayout.size();
|
||||
}
|
||||
public ListAdapter(Context c)
|
||||
{
|
||||
mContext = c;
|
||||
}
|
||||
|
||||
public Object getItem(int position) {
|
||||
return null;
|
||||
}
|
||||
public int getCount()
|
||||
{
|
||||
return articleLayout.size();
|
||||
}
|
||||
|
||||
public long getItemId(int position) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getViewTypeCount()
|
||||
{
|
||||
public Object getItem(int position)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public long getItemId(int position)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getViewTypeCount()
|
||||
{
|
||||
return 7;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position)
|
||||
{
|
||||
return articleLayout.get(position).type;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 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
|
||||
if (getItemViewType(position) == 0 || getItemViewType(position) == 1)
|
||||
{
|
||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
view = inflater.inflate(R.layout.article_text_element, null);
|
||||
}
|
||||
else if (getItemViewType(position) == 2)
|
||||
{
|
||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
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_geotag_element, null);
|
||||
}
|
||||
else if (getItemViewType(position) == 4)
|
||||
{
|
||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
view = inflater.inflate(R.layout.article_album_element, null);
|
||||
}
|
||||
else if (getItemViewType(position) == 5)
|
||||
{
|
||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
view = inflater.inflate(R.layout.article_button_element, null);
|
||||
}
|
||||
else //if (getItemViewType(position) == 6)
|
||||
{
|
||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
view = inflater.inflate(R.layout.article_phone_element, null);
|
||||
}
|
||||
} else {
|
||||
view = convertView;
|
||||
}
|
||||
|
||||
|
||||
if (getItemViewType(position) == 0)
|
||||
{
|
||||
TextView textView = (TextView) view.findViewById(R.id.dateTextView);
|
||||
|
||||
textView.setText(articleLayout.get(position).value);
|
||||
|
||||
if (article.type == ArticleManager.ARTICLE_TYPE_NEWS)
|
||||
{
|
||||
textView.setTextSize(getResources().getDimension(R.dimen.xlarge_text_size));
|
||||
}
|
||||
else
|
||||
{
|
||||
textView.setTextSize(getResources().getDimension(R.dimen.xxlarge_text_size));
|
||||
}
|
||||
|
||||
textView.setTypeface(null, Typeface.BOLD);
|
||||
textView.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||
|
||||
}
|
||||
else if (getItemViewType(position) == 1)
|
||||
{
|
||||
TextView textView = (TextView) view.findViewById(R.id.dateTextView);
|
||||
|
||||
textView.setText(articleLayout.get(position).value);
|
||||
|
||||
textView.setTextSize(getResources().getDimension(R.dimen.article_content_text_size));
|
||||
textView.setTypeface(null, Typeface.NORMAL);
|
||||
textView.setGravity(Gravity.LEFT);
|
||||
|
||||
}
|
||||
else if (getItemViewType(position) == 2)
|
||||
{
|
||||
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);
|
||||
|
||||
ImageManager.getInstance().ApplyImageToImageView(imageView, photo.imageUrl);
|
||||
|
||||
textView.setText(photo.title);
|
||||
}
|
||||
else if (getItemViewType(position) == 3)
|
||||
{
|
||||
double geoLat = articleLayout.get(position).geoLat;
|
||||
double geoLon = articleLayout.get(position).geoLon;
|
||||
|
||||
TextView addressTextView = (TextView) view.findViewById(R.id.addressTextView);
|
||||
TextView hintTextView = (TextView) view.findViewById(R.id.hintTextView);
|
||||
|
||||
if (article.address.length() > 0)
|
||||
{
|
||||
addressTextView.setText(article.address);
|
||||
addressTextView.setVisibility(View.VISIBLE);
|
||||
|
||||
hintTextView.setVisibility(View.VISIBLE);
|
||||
|
||||
final String copied_text = getResources().getString(R.string.copied_text);
|
||||
|
||||
addressTextView.setOnLongClickListener(new OnLongClickListener(){
|
||||
@Override
|
||||
public int getItemViewType(int position)
|
||||
{
|
||||
return articleLayout.get(position).type;
|
||||
|
||||
}
|
||||
|
||||
// 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
|
||||
if (getItemViewType(position) == 0 || getItemViewType(position) == 1)
|
||||
{
|
||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
view = inflater.inflate(R.layout.article_text_element, null);
|
||||
} else if (getItemViewType(position) == 2)
|
||||
{
|
||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
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_geotag_element, null);
|
||||
} else if (getItemViewType(position) == 4)
|
||||
{
|
||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
view = inflater.inflate(R.layout.article_album_element, null);
|
||||
} else if (getItemViewType(position) == 5)
|
||||
{
|
||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
view = inflater.inflate(R.layout.article_button_element, null);
|
||||
} else
|
||||
// if (getItemViewType(position) == 6)
|
||||
{
|
||||
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
view = inflater.inflate(R.layout.article_phone_element, null);
|
||||
}
|
||||
} else
|
||||
{
|
||||
view = convertView;
|
||||
}
|
||||
|
||||
if (getItemViewType(position) == 0)
|
||||
{
|
||||
TextView textView = (TextView) view.findViewById(R.id.dateTextView);
|
||||
|
||||
textView.setText(articleLayout.get(position).value);
|
||||
|
||||
if (article.type == ArticleManager.ARTICLE_TYPE_NEWS)
|
||||
{
|
||||
textView.setTextSize(getResources().getDimension(R.dimen.xlarge_text_size));
|
||||
} else
|
||||
{
|
||||
textView.setTextSize(getResources().getDimension(R.dimen.xxlarge_text_size));
|
||||
}
|
||||
|
||||
textView.setTypeface(null, Typeface.BOLD);
|
||||
textView.setGravity(Gravity.CENTER_HORIZONTAL);
|
||||
|
||||
} else if (getItemViewType(position) == 1)
|
||||
{
|
||||
TextView textView = (TextView) view.findViewById(R.id.dateTextView);
|
||||
|
||||
textView.setText(articleLayout.get(position).value);
|
||||
|
||||
textView.setTextSize(getResources().getDimension(R.dimen.article_content_text_size));
|
||||
textView.setTypeface(null, Typeface.NORMAL);
|
||||
textView.setGravity(Gravity.LEFT);
|
||||
|
||||
} else if (getItemViewType(position) == 2)
|
||||
{
|
||||
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);
|
||||
|
||||
ImageManager.getInstance().ApplyImageToImageView(imageView, photo.imageUrl);
|
||||
|
||||
textView.setText(photo.title);
|
||||
} else if (getItemViewType(position) == 3)
|
||||
{
|
||||
double geoLat = articleLayout.get(position).geoLat;
|
||||
double geoLon = articleLayout.get(position).geoLon;
|
||||
|
||||
TextView addressTextView = (TextView) view.findViewById(R.id.addressTextView);
|
||||
TextView hintTextView = (TextView) view.findViewById(R.id.hintTextView);
|
||||
|
||||
if (article.address.length() > 0)
|
||||
{
|
||||
addressTextView.setText(article.address);
|
||||
addressTextView.setVisibility(View.VISIBLE);
|
||||
|
||||
hintTextView.setVisibility(View.VISIBLE);
|
||||
|
||||
final String copied_text = getResources().getString(R.string.copied_text);
|
||||
|
||||
addressTextView.setOnLongClickListener(new OnLongClickListener()
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean onLongClick(View v)
|
||||
{
|
||||
|
||||
|
||||
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);
|
||||
clipboard.setText(article.address);
|
||||
} else {
|
||||
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);
|
||||
|
||||
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);
|
||||
clipboard.setText(article.address);
|
||||
} else
|
||||
{
|
||||
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);
|
||||
Toast toast = Toast.makeText(MainActivity.getInstance(), text, Toast.LENGTH_SHORT);
|
||||
toast.show();
|
||||
|
||||
|
||||
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);
|
||||
mapView.setMinZoomLevel(4);
|
||||
|
||||
//mapView.setBuiltInZoomControls(true);
|
||||
//mapView.setMultiTouchControls(true);
|
||||
|
||||
|
||||
IMapController mapController = mapView.getController();
|
||||
|
||||
|
||||
GeoPoint markerPoint = new GeoPoint(geoLat, geoLon);
|
||||
|
||||
mapController.setZoom(16);
|
||||
mapController.animateTo(markerPoint);
|
||||
|
||||
|
||||
ResourceProxy resourceProxy = new DefaultResourceProxyImpl(getActivity());
|
||||
NoInteractionOverlay itemizedOverlay = new NoInteractionOverlay(getResources().getDrawable(R.drawable.russia_icon), resourceProxy);
|
||||
|
||||
itemizedOverlay.addOverlayItem(markerPoint);
|
||||
|
||||
mapView.getOverlays().add(itemizedOverlay);
|
||||
|
||||
|
||||
MapOverlay mapOverlay = new MapOverlay(getActivity());
|
||||
|
||||
mapView.getOverlays().add(mapOverlay);
|
||||
|
||||
|
||||
}
|
||||
else if (getItemViewType(position) == 4)
|
||||
{
|
||||
|
||||
TextView titleTextView = (TextView) view.findViewById(R.id.titleTextView);
|
||||
|
||||
titleTextView.setText(article.albumArr.get(articleLayout.get(position).albumPos).title);
|
||||
|
||||
TextView contentTextView = (TextView) view.findViewById(R.id.contentTextView);
|
||||
|
||||
contentTextView.setText(article.albumArr.get(articleLayout.get(position).albumPos).description);
|
||||
|
||||
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(){
|
||||
});
|
||||
// editText.setKeyListener(null);
|
||||
|
||||
} else
|
||||
{
|
||||
addressTextView.setVisibility(View.GONE);
|
||||
hintTextView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
MapView mapView = (MapView) view.findViewById(R.id.mapview);
|
||||
|
||||
mapView.setMaxZoomLevel(20);
|
||||
mapView.setMinZoomLevel(4);
|
||||
|
||||
// mapView.setBuiltInZoomControls(true);
|
||||
// mapView.setMultiTouchControls(true);
|
||||
|
||||
IMapController mapController = mapView.getController();
|
||||
|
||||
GeoPoint markerPoint = new GeoPoint(geoLat, geoLon);
|
||||
|
||||
mapController.setZoom(16);
|
||||
mapController.animateTo(markerPoint);
|
||||
|
||||
ResourceProxy resourceProxy = new DefaultResourceProxyImpl(getActivity());
|
||||
NoInteractionOverlay itemizedOverlay = new NoInteractionOverlay(getResources().getDrawable(R.drawable.russia_icon), resourceProxy);
|
||||
|
||||
itemizedOverlay.addOverlayItem(markerPoint);
|
||||
|
||||
mapView.getOverlays().add(itemizedOverlay);
|
||||
|
||||
MapOverlay mapOverlay = new MapOverlay(getActivity());
|
||||
|
||||
mapView.getOverlays().add(mapOverlay);
|
||||
|
||||
} else if (getItemViewType(position) == 4)
|
||||
{
|
||||
|
||||
TextView titleTextView = (TextView) view.findViewById(R.id.titleTextView);
|
||||
|
||||
titleTextView.setText(article.albumArr.get(articleLayout.get(position).albumPos).title);
|
||||
|
||||
TextView contentTextView = (TextView) view.findViewById(R.id.contentTextView);
|
||||
|
||||
contentTextView.setText(article.albumArr.get(articleLayout.get(position).albumPos).description);
|
||||
|
||||
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
|
||||
public void onItemClick(it.sephiroth.android.library.widget.AdapterView<?> parent, View view, int innerPosition, long id)
|
||||
{
|
||||
MainActivity.getInstance().SetLastArticleName(articleName);
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
Button button = (Button) view.findViewById(R.id.button);
|
||||
|
||||
if (article.externalLinkText.length() > 0)
|
||||
{
|
||||
button.setText(article.externalLinkText);
|
||||
}
|
||||
else
|
||||
{
|
||||
button.setText(R.string.go_to_website);
|
||||
}
|
||||
|
||||
button.setOnClickListener(new OnClickListener()
|
||||
{
|
||||
|
||||
} else if (getItemViewType(position) == 5)
|
||||
{
|
||||
Button button = (Button) view.findViewById(R.id.button);
|
||||
|
||||
if (article.externalLinkText.length() > 0)
|
||||
{
|
||||
button.setText(article.externalLinkText);
|
||||
} else
|
||||
{
|
||||
button.setText(R.string.go_to_website);
|
||||
}
|
||||
|
||||
button.setOnClickListener(new OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(View v)
|
||||
{
|
||||
@ -510,19 +493,17 @@ public class ArticleFragment extends Fragment
|
||||
i.setData(Uri.parse(articleLayout.get(position).value));
|
||||
startActivity(i);
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (getItemViewType(position) == 6)
|
||||
{
|
||||
Button button = (Button) view.findViewById(R.id.button);
|
||||
|
||||
final String phone = article.phone;
|
||||
|
||||
button.setText(phone);
|
||||
|
||||
|
||||
button.setOnClickListener(new OnClickListener()
|
||||
{
|
||||
});
|
||||
} else if (getItemViewType(position) == 6)
|
||||
{
|
||||
Button button = (Button) view.findViewById(R.id.button);
|
||||
|
||||
final String phone = article.phone;
|
||||
|
||||
button.setText(phone);
|
||||
|
||||
button.setOnClickListener(new OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(View v)
|
||||
{
|
||||
@ -531,13 +512,11 @@ public class ArticleFragment extends Fragment
|
||||
intent.setData(Uri.parse(uri));
|
||||
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 android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -25,165 +24,167 @@ import android.widget.TextView;
|
||||
|
||||
public class CatalogFragment extends Fragment
|
||||
{
|
||||
|
||||
|
||||
ListView listView;
|
||||
ListAdapter listAdapter;
|
||||
ProgressBar progressBar;
|
||||
|
||||
ArrayList<JournalSemiFullData> journalList;
|
||||
|
||||
|
||||
ArrayList<JournalSemiFullData> journalList;
|
||||
|
||||
DatabaseGetJournalListTask databaseGetJournalListTask = null;
|
||||
|
||||
|
||||
public CatalogFragment()
|
||||
{
|
||||
RestoreJournalList();
|
||||
}
|
||||
|
||||
|
||||
public CatalogFragment(ArrayList<JournalSemiFullData> journalList)
|
||||
{
|
||||
this.journalList = journalList;
|
||||
}
|
||||
|
||||
@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);
|
||||
|
||||
progressBar = (ProgressBar)rootView.findViewById(R.id.progressBar);
|
||||
|
||||
|
||||
|
||||
progressBar = (ProgressBar) rootView.findViewById(R.id.progressBar);
|
||||
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
|
||||
|
||||
listView = (ListView) rootView.findViewById(R.id.listView);
|
||||
|
||||
|
||||
listAdapter = new ListAdapter(getActivity());
|
||||
|
||||
|
||||
listView.setAdapter(listAdapter);
|
||||
|
||||
|
||||
return rootView;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroyView ()
|
||||
public void onDestroyView()
|
||||
{
|
||||
|
||||
|
||||
if (databaseGetJournalListTask != null)
|
||||
{
|
||||
databaseGetJournalListTask.cancel(false);
|
||||
databaseGetJournalListTask = null;
|
||||
}
|
||||
|
||||
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
|
||||
public void RestoreJournalList()
|
||||
{
|
||||
journalList = new ArrayList<JournalSemiFullData>();
|
||||
|
||||
|
||||
databaseGetJournalListTask = new DatabaseGetJournalListTask();
|
||||
|
||||
databaseGetJournalListTask.mHandler = MainActivity.getInstance().mHandler;
|
||||
|
||||
databaseGetJournalListTask.execute();
|
||||
}
|
||||
|
||||
|
||||
public void SetJournalList(ArrayList<JournalSemiFullData> journalList)
|
||||
{
|
||||
databaseGetJournalListTask = null;
|
||||
|
||||
|
||||
progressBar.setVisibility(View.GONE);
|
||||
|
||||
|
||||
this.journalList = journalList;
|
||||
|
||||
|
||||
listAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class ListAdapter extends BaseAdapter {
|
||||
private Context mContext;
|
||||
|
||||
public ListAdapter(Context c) {
|
||||
mContext = c;
|
||||
}
|
||||
public class ListAdapter extends BaseAdapter
|
||||
{
|
||||
private Context mContext;
|
||||
|
||||
public int getCount() {
|
||||
return journalList.size();
|
||||
}
|
||||
public ListAdapter(Context c)
|
||||
{
|
||||
mContext = c;
|
||||
}
|
||||
|
||||
public Object getItem(int position) {
|
||||
return null;
|
||||
}
|
||||
public int getCount()
|
||||
{
|
||||
return journalList.size();
|
||||
}
|
||||
|
||||
public long getItemId(int position) {
|
||||
return 0;
|
||||
}
|
||||
public Object getItem(int position)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// 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.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)));
|
||||
public long getItemId(int position)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
// 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.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
|
||||
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
|
||||
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
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
|
||||
{
|
||||
/*
|
||||
if (journal.geoCategory == 1)
|
||||
{
|
||||
position = position - 1; // because there is header for geo objects
|
||||
}*/
|
||||
|
||||
MainActivity.getInstance().SetLastJournalName(journalName);
|
||||
|
||||
if (position == 0)
|
||||
{
|
||||
if (journal.geoCategory == 1)
|
||||
{
|
||||
MainActivity.getInstance().OpenMapScreen(journalName);
|
||||
MainActivity.getInstance().OpenMapScreen(journalName, MainActivity.TAG_BACK_TO_JOURNALFRAGMENT);
|
||||
}
|
||||
}
|
||||
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 fishrungames.networkutils.ImageManager;
|
||||
|
||||
import fishrungames.bashgid.core.DatabaseGetJournalListTask;
|
||||
import fishrungames.bashgid.core.DatabaseGetJournalTask;
|
||||
import fishrungames.bashgid.core.JournalManager;
|
||||
|
||||
import fishrungames.bashgid.core.JournalManager.JournalSemiFullData;
|
||||
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
@ -29,55 +26,56 @@ import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import it.sephiroth.android.library.widget.HListView;
|
||||
|
||||
public class MainPageFragment extends Fragment {
|
||||
|
||||
|
||||
public class MainPageFragment extends Fragment
|
||||
{
|
||||
|
||||
ArrayList<JournalSemiFullData> journalList = new ArrayList<JournalSemiFullData>();
|
||||
|
||||
|
||||
ListView listView;
|
||||
ListAdapter listAdapter;
|
||||
View header;
|
||||
ProgressBar progressBar;
|
||||
EditText searchEditText;
|
||||
|
||||
|
||||
JournalSemiFullData newsJournal;
|
||||
|
||||
|
||||
DatabaseGetJournalTask databaseGetJournalTask = null;
|
||||
DatabaseGetJournalListTask databaseGetJournalListTask = null;
|
||||
|
||||
|
||||
public MainPageFragment()
|
||||
{
|
||||
}
|
||||
|
||||
@SuppressLint("InflateParams")
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
||||
journalList.clear();
|
||||
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||
{
|
||||
|
||||
journalList.clear();
|
||||
|
||||
RestoreJournalList();
|
||||
|
||||
|
||||
View rootView = inflater.inflate(R.layout.fragment_main_page, container, false);
|
||||
|
||||
|
||||
listView = (ListView) rootView.findViewById(R.id.listView);
|
||||
|
||||
|
||||
listAdapter = new ListAdapter(getActivity());
|
||||
|
||||
|
||||
header = inflater.inflate(R.layout.main_page_header, null);
|
||||
|
||||
|
||||
RestoreJournal();
|
||||
MainActivity.getInstance().StartDownloadNewsTask();
|
||||
|
||||
|
||||
listView.addHeaderView(header);
|
||||
|
||||
|
||||
listView.setAdapter(listAdapter);
|
||||
|
||||
progressBar = (ProgressBar)header.findViewById(R.id.progressBar);
|
||||
|
||||
|
||||
progressBar = (ProgressBar) header.findViewById(R.id.progressBar);
|
||||
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
|
||||
|
||||
Button moreNewsButton = (Button) header.findViewById(R.id.moreNewsButton);
|
||||
|
||||
|
||||
moreNewsButton.setOnClickListener(new OnClickListener()
|
||||
{
|
||||
|
||||
@ -86,13 +84,12 @@ public class MainPageFragment extends Fragment {
|
||||
{
|
||||
MainActivity.getInstance().OpenNewsScreen();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
searchEditText = (EditText) header.findViewById(R.id.searchEditText);
|
||||
|
||||
|
||||
Button searchButton = (Button) header.findViewById(R.id.searchButton);
|
||||
|
||||
|
||||
searchButton.setOnClickListener(new OnClickListener()
|
||||
{
|
||||
|
||||
@ -102,264 +99,250 @@ public class MainPageFragment extends Fragment {
|
||||
String query = searchEditText.getText().toString();
|
||||
MainActivity.getInstance().OpenSearchScreen(query);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
return rootView;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroyView ()
|
||||
public void onDestroyView()
|
||||
{
|
||||
if (databaseGetJournalTask != null)
|
||||
{
|
||||
databaseGetJournalTask.cancel(false);
|
||||
databaseGetJournalTask = null;
|
||||
}
|
||||
|
||||
|
||||
if (databaseGetJournalListTask != null)
|
||||
{
|
||||
databaseGetJournalListTask.cancel(false);
|
||||
databaseGetJournalListTask = null;
|
||||
}
|
||||
|
||||
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
|
||||
void RestoreJournal()
|
||||
{
|
||||
newsJournal = JournalManager.CreateEmptyJournal();
|
||||
|
||||
|
||||
RefreshJournal();
|
||||
}
|
||||
|
||||
|
||||
void RefreshJournal()
|
||||
{
|
||||
if (databaseGetJournalTask != null)
|
||||
{
|
||||
databaseGetJournalTask.cancel(false);
|
||||
}
|
||||
|
||||
|
||||
databaseGetJournalTask = new DatabaseGetJournalTask();
|
||||
|
||||
databaseGetJournalTask.mHandler = MainActivity.getInstance().mHandler;
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
|
||||
|
||||
bundle.putString("journalName", "news");
|
||||
|
||||
|
||||
bundle.putInt("count", 3);
|
||||
|
||||
databaseGetJournalTask.execute(bundle);
|
||||
}
|
||||
|
||||
|
||||
public void SetJournal(JournalSemiFullData journal)
|
||||
{
|
||||
databaseGetJournalTask = null;
|
||||
|
||||
//Xperimental
|
||||
|
||||
// Xperimental
|
||||
if (journal != null)
|
||||
{
|
||||
progressBar.setVisibility(View.GONE);
|
||||
|
||||
newsJournal = journal;
|
||||
|
||||
//ImageButton news1ImageButton = (ImageButton) header.findViewById(R.id.news1ImageButton);
|
||||
//ImageButton news2ImageButton = (ImageButton) header.findViewById(R.id.news2ImageButton);
|
||||
//ImageButton news3ImageButton = (ImageButton) header.findViewById(R.id.news3ImageButton);
|
||||
|
||||
Button news1Button = (Button)header.findViewById(R.id.news1Button);
|
||||
Button news2Button = (Button)header.findViewById(R.id.news2Button);
|
||||
Button news3Button = (Button)header.findViewById(R.id.news3Button);
|
||||
|
||||
if (newsJournal.articleArr.size() > 0)
|
||||
{
|
||||
//ImageManager.getInstance().ApplyImageToImageView(news1ImageButton, newsJournal.articleArr.get(0).previewImageUrl);
|
||||
news1Button.setText(newsJournal.articleArr.get(0).title);
|
||||
|
||||
//news1ImageButton.setOnClickListener(new NewsButtonOnClickListener(newsJournal.articleArr.get(0).name));
|
||||
news1Button.setOnClickListener(new NewsButtonOnClickListener(newsJournal.articleArr.get(0).name));
|
||||
}
|
||||
else
|
||||
{
|
||||
//news1ImageButton.setImageResource(R.drawable.transparent);
|
||||
news1Button.setText(R.string.news_record_not_available);
|
||||
//news1ImageButton.setOnClickListener(null);
|
||||
news1Button.setOnClickListener(null);
|
||||
}
|
||||
|
||||
if (newsJournal.articleArr.size() > 1)
|
||||
{
|
||||
//ImageManager.getInstance().ApplyImageToImageView(news2ImageButton, newsJournal.articleArr.get(1).previewImageUrl);
|
||||
news2Button.setText(newsJournal.articleArr.get(1).title);
|
||||
//news2ImageButton.setOnClickListener(new NewsButtonOnClickListener(newsJournal.articleArr.get(1).name));
|
||||
news2Button.setOnClickListener(new NewsButtonOnClickListener(newsJournal.articleArr.get(1).name));
|
||||
}
|
||||
else
|
||||
{
|
||||
//news2ImageButton.setImageResource(R.drawable.transparent);
|
||||
news2Button.setText(R.string.news_record_not_available);
|
||||
//news2ImageButton.setOnClickListener(null);
|
||||
news2Button.setOnClickListener(null);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
progressBar.setVisibility(View.GONE);
|
||||
|
||||
newsJournal = journal;
|
||||
|
||||
Button news1Button = (Button) header.findViewById(R.id.news1Button);
|
||||
Button news2Button = (Button) header.findViewById(R.id.news2Button);
|
||||
Button news3Button = (Button) header.findViewById(R.id.news3Button);
|
||||
|
||||
if (newsJournal.articleArr.size() > 0)
|
||||
{
|
||||
|
||||
news1Button.setText(newsJournal.articleArr.get(0).title);
|
||||
|
||||
news1Button.setOnClickListener(new NewsButtonOnClickListener(newsJournal.articleArr.get(0).name));
|
||||
} else
|
||||
{
|
||||
|
||||
news1Button.setText(R.string.news_record_not_available);
|
||||
|
||||
news1Button.setOnClickListener(null);
|
||||
}
|
||||
|
||||
if (newsJournal.articleArr.size() > 1)
|
||||
{
|
||||
|
||||
news2Button.setText(newsJournal.articleArr.get(1).title);
|
||||
|
||||
news2Button.setOnClickListener(new NewsButtonOnClickListener(newsJournal.articleArr.get(1).name));
|
||||
} else
|
||||
{
|
||||
|
||||
news2Button.setText(R.string.news_record_not_available);
|
||||
news2Button.setOnClickListener(null);
|
||||
}
|
||||
|
||||
if (newsJournal.articleArr.size() > 2)
|
||||
{
|
||||
|
||||
news3Button.setText(newsJournal.articleArr.get(2).title);
|
||||
news3Button.setOnClickListener(new NewsButtonOnClickListener(newsJournal.articleArr.get(2).name));
|
||||
} else
|
||||
{
|
||||
|
||||
|
||||
|
||||
listAdapter.notifyDataSetChanged();
|
||||
|
||||
news3Button.setText(R.string.news_record_not_available);
|
||||
news3Button.setOnClickListener(null);
|
||||
}
|
||||
|
||||
listAdapter.notifyDataSetChanged();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void RefreshAdapter()
|
||||
{
|
||||
listAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
||||
public void RestoreJournalList()
|
||||
{
|
||||
journalList = new ArrayList<JournalSemiFullData>();
|
||||
|
||||
|
||||
if (databaseGetJournalListTask != null)
|
||||
{
|
||||
databaseGetJournalListTask.cancel(false);
|
||||
}
|
||||
|
||||
|
||||
databaseGetJournalListTask = new DatabaseGetJournalListTask();
|
||||
|
||||
databaseGetJournalListTask.mHandler = MainActivity.getInstance().mHandler;
|
||||
|
||||
|
||||
databaseGetJournalListTask.execute("featured");
|
||||
}
|
||||
|
||||
|
||||
public void SetJournalList(ArrayList<JournalSemiFullData> journalList)
|
||||
{
|
||||
databaseGetJournalListTask = null;
|
||||
|
||||
|
||||
progressBar.setVisibility(View.GONE);
|
||||
|
||||
|
||||
this.journalList = journalList;
|
||||
|
||||
|
||||
listAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
||||
public class ListAdapter extends BaseAdapter {
|
||||
private Context mContext;
|
||||
|
||||
public ListAdapter(Context c) {
|
||||
mContext = c;
|
||||
}
|
||||
public class ListAdapter extends BaseAdapter
|
||||
{
|
||||
private Context mContext;
|
||||
|
||||
public int getCount() {
|
||||
return journalList.size();
|
||||
}
|
||||
public ListAdapter(Context c)
|
||||
{
|
||||
mContext = c;
|
||||
}
|
||||
|
||||
public Object getItem(int position) {
|
||||
return null;
|
||||
}
|
||||
public int getCount()
|
||||
{
|
||||
return journalList.size();
|
||||
}
|
||||
|
||||
public long getItemId(int position) {
|
||||
return 0;
|
||||
}
|
||||
public Object getItem(int position)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// 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.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)));
|
||||
public long getItemId(int position)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
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);
|
||||
// create a new ImageView for each item referenced by the Adapter
|
||||
@SuppressLint("InflateParams")
|
||||
public View getView(final int position, View convertView, ViewGroup parent)
|
||||
{
|
||||
|
||||
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
|
||||
public void onClick(View v)
|
||||
{
|
||||
if (databaseGetJournalTask != null)
|
||||
{
|
||||
databaseGetJournalTask.cancel(false);
|
||||
if (databaseGetJournalTask != null)
|
||||
{
|
||||
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
|
||||
public void onClick(View v)
|
||||
{
|
||||
if (databaseGetJournalTask != null)
|
||||
{
|
||||
databaseGetJournalTask.cancel(false);
|
||||
if (databaseGetJournalTask != null)
|
||||
{
|
||||
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
|
||||
{
|
||||
|
||||
|
||||
String articleName;
|
||||
|
||||
|
||||
public NewsButtonOnClickListener(String articleName)
|
||||
{
|
||||
this.articleName = articleName;
|
||||
@ -373,12 +356,11 @@ public class MainPageFragment extends Fragment {
|
||||
databaseGetJournalTask.cancel(false);
|
||||
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;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import fishrungames.bashgid.core.AlbumManager.AlbumFullData;
|
||||
import fishrungames.bashgid.core.HtmlDownloadManager;
|
||||
import fishrungames.bashgid.core.JournalManager.JournalSemiFullData;
|
||||
|
||||
import fishrungames.bashgid.core.HtmlDownloadManager.TextFileRecord;
|
||||
import fishrungames.networkutils.ImageManager;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
@ -17,266 +13,139 @@ import android.view.View.OnClickListener;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import android.widget.TextView;
|
||||
|
||||
public class MainPageHListViewAdapters {
|
||||
|
||||
|
||||
|
||||
public static class PhotoAlbumElementAdapter extends BaseAdapter {
|
||||
|
||||
private Context mContext;
|
||||
//String albumName;
|
||||
AlbumFullData albumFullData;
|
||||
//ArrayList<TextFileRecord> localHtmlList;
|
||||
public class MainPageHListViewAdapters
|
||||
{
|
||||
|
||||
public PhotoAlbumElementAdapter(Context c, AlbumFullData albumFullData) {
|
||||
this.mContext = c;
|
||||
this.albumFullData = albumFullData;
|
||||
public static class PhotoAlbumElementAdapter extends BaseAdapter
|
||||
{
|
||||
|
||||
//localHtmlList = HtmlDownloadManager.getInstance().getGlobalHtmlList();
|
||||
}
|
||||
private Context mContext;
|
||||
|
||||
public int getCount() {
|
||||
return albumFullData.photoRecordArr.size();
|
||||
}
|
||||
AlbumFullData albumFullData;
|
||||
|
||||
public Object getItem(int position) {
|
||||
return null;
|
||||
}
|
||||
public PhotoAlbumElementAdapter(Context c, AlbumFullData albumFullData)
|
||||
{
|
||||
this.mContext = c;
|
||||
this.albumFullData = albumFullData;
|
||||
}
|
||||
|
||||
public long getItemId(int position) {
|
||||
return 0;
|
||||
}
|
||||
public int getCount()
|
||||
{
|
||||
return albumFullData.photoRecordArr.size();
|
||||
}
|
||||
|
||||
// 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.article_album_element_item, 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);
|
||||
ImageView imageView = (ImageView) view.findViewById(R.id.imageView);
|
||||
|
||||
//textView.setText(albumFullData.photoRecordArr.get(position).title);
|
||||
|
||||
//subTextView.setText("");
|
||||
|
||||
ImageManager.getInstance().ApplyImageToImageView(imageView, albumFullData.photoRecordArr.get(position).imageUrl);
|
||||
|
||||
//imageButton.setOnClickListener(new ContentButtonOnClickListener(localHtmlList.get(position)));
|
||||
|
||||
return view;
|
||||
}
|
||||
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.article_album_element_item, null);
|
||||
|
||||
} else
|
||||
{
|
||||
view = convertView;
|
||||
}
|
||||
|
||||
ImageView imageView = (ImageView) view.findViewById(R.id.imageView);
|
||||
|
||||
ImageManager.getInstance().ApplyImageToImageView(imageView, albumFullData.photoRecordArr.get(position).imageUrl);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class JournalElementAdapter extends BaseAdapter {
|
||||
|
||||
private Context mContext;
|
||||
//String albumName;
|
||||
JournalSemiFullData journal;
|
||||
//ArrayList<TextFileRecord> localHtmlList;
|
||||
|
||||
public JournalElementAdapter(Context c, JournalSemiFullData journal) {
|
||||
this.mContext = c;
|
||||
this.journal = journal;
|
||||
public static class JournalElementAdapter extends BaseAdapter
|
||||
{
|
||||
|
||||
//localHtmlList = HtmlDownloadManager.getInstance().getGlobalHtmlList();
|
||||
}
|
||||
private Context mContext;
|
||||
|
||||
public int getCount() {
|
||||
return journal.articleArr.size();
|
||||
}
|
||||
JournalSemiFullData journal;
|
||||
|
||||
public Object getItem(int position) {
|
||||
return null;
|
||||
}
|
||||
public JournalElementAdapter(Context c, JournalSemiFullData journal)
|
||||
{
|
||||
this.mContext = c;
|
||||
this.journal = journal;
|
||||
|
||||
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.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 int getCount()
|
||||
{
|
||||
return journal.articleArr.size();
|
||||
}
|
||||
|
||||
|
||||
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()
|
||||
{
|
||||
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.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
|
||||
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;
|
||||
|
||||
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
|
||||
import android.support.v7.app.ActionBar;
|
||||
@ -29,371 +28,406 @@ import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* Fragment used for managing interactions for and presentation of a navigation drawer.
|
||||
* See the <a href="https://developer.android.com/design/patterns/navigation-drawer.html#Interaction">
|
||||
* design guidelines</a> for a complete explanation of the behaviors implemented here.
|
||||
* Fragment used for managing interactions for and presentation of a navigation
|
||||
* drawer. See the <a href=
|
||||
* "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.
|
||||
*/
|
||||
private static final String STATE_SELECTED_POSITION = "selected_navigation_drawer_position";
|
||||
/**
|
||||
* Remember the position of the selected item.
|
||||
*/
|
||||
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
|
||||
* expands it. This shared preference tracks this.
|
||||
*/
|
||||
private static final String PREF_USER_LEARNED_DRAWER = "navigation_drawer_learned";
|
||||
/**
|
||||
* Per the design guidelines, you should show the drawer on launch until the
|
||||
* user manually expands it. This shared preference tracks this.
|
||||
*/
|
||||
private static final String PREF_USER_LEARNED_DRAWER = "navigation_drawer_learned";
|
||||
|
||||
/**
|
||||
* A pointer to the current callbacks instance (the Activity).
|
||||
*/
|
||||
private NavigationDrawerCallbacks mCallbacks;
|
||||
/**
|
||||
* A pointer to the current callbacks instance (the Activity).
|
||||
*/
|
||||
private NavigationDrawerCallbacks mCallbacks;
|
||||
|
||||
/**
|
||||
* Helper component that ties the action bar to the navigation drawer.
|
||||
*/
|
||||
private ActionBarDrawerToggle mDrawerToggle;
|
||||
/**
|
||||
* Helper component that ties the action bar to the navigation drawer.
|
||||
*/
|
||||
private ActionBarDrawerToggle mDrawerToggle;
|
||||
|
||||
private DrawerLayout mDrawerLayout;
|
||||
private ListView mDrawerListView;
|
||||
private View mFragmentContainerView;
|
||||
private DrawerLayout mDrawerLayout;
|
||||
private ListView mDrawerListView;
|
||||
private View mFragmentContainerView;
|
||||
|
||||
private int mCurrentSelectedPosition = 0;
|
||||
private boolean mFromSavedInstanceState;
|
||||
private boolean mUserLearnedDrawer;
|
||||
|
||||
private DrawerAdapter drawerAdapter;
|
||||
private int mCurrentSelectedPosition = 0;
|
||||
private boolean mFromSavedInstanceState;
|
||||
private boolean mUserLearnedDrawer;
|
||||
|
||||
public NavigationDrawerFragment() {
|
||||
}
|
||||
private DrawerAdapter drawerAdapter;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
public NavigationDrawerFragment()
|
||||
{
|
||||
}
|
||||
|
||||
// Read in the flag indicating whether or not the user has demonstrated awareness of the
|
||||
// drawer. See PREF_USER_LEARNED_DRAWER for details.
|
||||
//SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
||||
|
||||
//Don't need this shit
|
||||
//mUserLearnedDrawer = sp.getBoolean(PREF_USER_LEARNED_DRAWER, false);
|
||||
mUserLearnedDrawer = true;
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
mCurrentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION);
|
||||
mFromSavedInstanceState = true;
|
||||
}
|
||||
// Read in the flag indicating whether or not the user has demonstrated
|
||||
// awareness of the
|
||||
// drawer. See PREF_USER_LEARNED_DRAWER for details.
|
||||
// SharedPreferences sp =
|
||||
// PreferenceManager.getDefaultSharedPreferences(getActivity());
|
||||
|
||||
// Select either the default item (0) or the last selected item.
|
||||
selectItem(mCurrentSelectedPosition);
|
||||
|
||||
}
|
||||
// Don't need this shit
|
||||
// mUserLearnedDrawer = sp.getBoolean(PREF_USER_LEARNED_DRAWER, false);
|
||||
mUserLearnedDrawer = true;
|
||||
|
||||
@Override
|
||||
public void onActivityCreated (Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
// Indicate that this fragment would like to influence the set of actions in the action bar.
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
if (savedInstanceState != null)
|
||||
{
|
||||
mCurrentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION);
|
||||
mFromSavedInstanceState = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
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;
|
||||
}
|
||||
// Select either the default item (0) or the last selected item.
|
||||
selectItem(mCurrentSelectedPosition);
|
||||
|
||||
public boolean isDrawerOpen() {
|
||||
return mDrawerLayout != null && mDrawerLayout.isDrawerOpen(mFragmentContainerView);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void EnableDrawer()
|
||||
{
|
||||
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState)
|
||||
{
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
// Indicate that this fragment would like to influence the set of
|
||||
// actions in the action bar.
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
|
||||
ActionBar actionBar = getActionBar();
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
actionBar.setHomeButtonEnabled(true);
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, 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);
|
||||
}
|
||||
});
|
||||
|
||||
// ActionBarDrawerToggle ties together the the proper interactions
|
||||
// between the navigation drawer and the action bar app icon.
|
||||
drawerAdapter = new DrawerAdapter(getActivity());
|
||||
|
||||
mDrawerToggle = new ActionBarDrawerToggle(
|
||||
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;
|
||||
}
|
||||
mDrawerListView.setAdapter(drawerAdapter);
|
||||
|
||||
//getActivity().supportInvalidateOptionsMenu(); // calls onPrepareOptionsMenu()
|
||||
}
|
||||
mDrawerListView.setItemChecked(mCurrentSelectedPosition, true);
|
||||
return mDrawerListView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrawerOpened(View drawerView) {
|
||||
super.onDrawerOpened(drawerView);
|
||||
if (!isAdded()) {
|
||||
return;
|
||||
}
|
||||
public boolean isDrawerOpen()
|
||||
{
|
||||
return mDrawerLayout != null && mDrawerLayout.isDrawerOpen(mFragmentContainerView);
|
||||
}
|
||||
|
||||
if (!mUserLearnedDrawer) {
|
||||
// The user manually opened the drawer; store this flag to 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();
|
||||
}
|
||||
public void EnableDrawer()
|
||||
{
|
||||
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
|
||||
}
|
||||
|
||||
//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,
|
||||
// per the navigation drawer design guidelines.
|
||||
if (!mUserLearnedDrawer && !mFromSavedInstanceState) {
|
||||
mDrawerLayout.openDrawer(mFragmentContainerView);
|
||||
}
|
||||
// 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
|
||||
|
||||
// Defer code dependent on restoration of previous instance state.
|
||||
mDrawerLayout.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mDrawerToggle.syncState();
|
||||
}
|
||||
});
|
||||
ActionBar actionBar = getActionBar();
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
actionBar.setHomeButtonEnabled(true);
|
||||
|
||||
mDrawerLayout.setDrawerListener(mDrawerToggle);
|
||||
|
||||
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
|
||||
|
||||
drawerAdapter.notifyDataSetChanged();
|
||||
|
||||
}
|
||||
// ActionBarDrawerToggle ties together the the proper interactions
|
||||
// between the navigation drawer and the action bar app icon.
|
||||
|
||||
private void selectItem(int position) {
|
||||
mCurrentSelectedPosition = position;
|
||||
if (mDrawerListView != null) {
|
||||
mDrawerListView.setItemChecked(position, true);
|
||||
}
|
||||
if (mDrawerLayout != null) {
|
||||
mDrawerLayout.closeDrawer(mFragmentContainerView);
|
||||
}
|
||||
if (mCallbacks != null) {
|
||||
mCallbacks.onNavigationDrawerItemSelected(position);
|
||||
}
|
||||
}
|
||||
mDrawerToggle = new ActionBarDrawerToggle(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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
try {
|
||||
mCallbacks = (NavigationDrawerCallbacks) activity;
|
||||
} catch (ClassCastException e) {
|
||||
throw new ClassCastException("Activity must implement NavigationDrawerCallbacks.");
|
||||
}
|
||||
}
|
||||
// getActivity().supportInvalidateOptionsMenu(); // calls
|
||||
// onPrepareOptionsMenu()
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetach() {
|
||||
super.onDetach();
|
||||
mCallbacks = null;
|
||||
}
|
||||
@Override
|
||||
public void onDrawerOpened(View drawerView)
|
||||
{
|
||||
super.onDrawerOpened(drawerView);
|
||||
if (!isAdded())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putInt(STATE_SELECTED_POSITION, mCurrentSelectedPosition);
|
||||
}
|
||||
if (!mUserLearnedDrawer)
|
||||
{
|
||||
// The user manually opened the drawer; store this flag to
|
||||
// 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
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
// Forward the new configuration the drawer toggle component.
|
||||
mDrawerToggle.onConfigurationChanged(newConfig);
|
||||
}
|
||||
// getActivity().supportInvalidateOptionsMenu(); // calls
|
||||
// onPrepareOptionsMenu()
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
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.
|
||||
|
||||
showGlobalContextActionBar();
|
||||
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
|
||||
}
|
||||
// If the user hasn't 'learned' about the drawer, open it to introduce
|
||||
// them to the drawer,
|
||||
// per the navigation drawer design guidelines.
|
||||
if (!mUserLearnedDrawer && !mFromSavedInstanceState)
|
||||
{
|
||||
mDrawerLayout.openDrawer(mFragmentContainerView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
|
||||
//Xperimental -- check if we need options or not
|
||||
if (mDrawerToggle.onOptionsItemSelected(item)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (item.getItemId() == R.id.action_search) {
|
||||
// Defer code dependent on restoration of previous instance state.
|
||||
mDrawerLayout.post(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
mDrawerToggle.syncState();
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
mDrawerLayout.setDrawerListener(mDrawerToggle);
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
drawerAdapter.notifyDataSetChanged();
|
||||
|
||||
private ActionBar getActionBar() {
|
||||
return ((ActionBarActivity) getActivity()).getSupportActionBar();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
|
||||
private void selectItem(int position)
|
||||
{
|
||||
mCurrentSelectedPosition = position;
|
||||
if (mDrawerListView != null)
|
||||
{
|
||||
mDrawerListView.setItemChecked(position, true);
|
||||
}
|
||||
if (mDrawerLayout != null)
|
||||
{
|
||||
mDrawerLayout.closeDrawer(mFragmentContainerView);
|
||||
}
|
||||
if (mCallbacks != null)
|
||||
{
|
||||
mCallbacks.onNavigationDrawerItemSelected(position);
|
||||
}
|
||||
}
|
||||
|
||||
public class DrawerAdapter extends BaseAdapter {
|
||||
private Context mContext;
|
||||
@Override
|
||||
public void onAttach(Activity activity)
|
||||
{
|
||||
super.onAttach(activity);
|
||||
try
|
||||
{
|
||||
mCallbacks = (NavigationDrawerCallbacks) activity;
|
||||
} catch (ClassCastException e)
|
||||
{
|
||||
throw new ClassCastException("Activity must implement NavigationDrawerCallbacks.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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_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
|
||||
};
|
||||
@Override
|
||||
public void onDetach()
|
||||
{
|
||||
super.onDetach();
|
||||
mCallbacks = null;
|
||||
}
|
||||
|
||||
public DrawerAdapter(Context c) {
|
||||
mContext = c;
|
||||
}
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState)
|
||||
{
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putInt(STATE_SELECTED_POSITION, mCurrentSelectedPosition);
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return titles.length;
|
||||
}
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig)
|
||||
{
|
||||
super.onConfigurationChanged(newConfig);
|
||||
// Forward the new configuration the drawer toggle component.
|
||||
mDrawerToggle.onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
public Object getItem(int position) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
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) {
|
||||
return 0;
|
||||
}
|
||||
showGlobalContextActionBar();
|
||||
|
||||
// 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]);
|
||||
|
||||
if (position == 0)
|
||||
{
|
||||
LayoutParams params = imageView.getLayoutParams();
|
||||
params.width = 96;
|
||||
params.height = 96;
|
||||
imageView.setLayoutParams(params);
|
||||
|
||||
textView.setTypeface(null, Typeface.BOLD);
|
||||
}
|
||||
else
|
||||
{
|
||||
LayoutParams params = imageView.getLayoutParams();
|
||||
params.width = 48;
|
||||
params.height = 48;
|
||||
imageView.setLayoutParams(params);
|
||||
|
||||
textView.setTypeface(null, Typeface.NORMAL);
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item)
|
||||
{
|
||||
|
||||
// Xperimental -- check if we need options or not
|
||||
if (mDrawerToggle.onOptionsItemSelected(item))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (item.getItemId() == R.id.action_search)
|
||||
{
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import fishrungames.networkutils.ImageManager;
|
||||
import fishrungames.bashgid.core.ArticleManager;
|
||||
import fishrungames.bashgid.core.ArticleManager.ArticleRecordData;
|
||||
import fishrungames.bashgid.core.ArticleManager.ArticleShortData;
|
||||
import fishrungames.bashgid.core.DatabaseGetJournalTask;
|
||||
import fishrungames.bashgid.core.JournalManager;
|
||||
import fishrungames.bashgid.core.JournalManager.JournalSemiFullData;
|
||||
import fishrungames.bashgid.core.NewsManager.NewsRecord;
|
||||
|
||||
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.View.OnClickListener;
|
||||
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import android.widget.ListView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
|
||||
|
||||
public class NewsListFragment extends Fragment
|
||||
{
|
||||
|
||||
ListView listView;
|
||||
|
||||
|
||||
ListAdapter listAdapter;
|
||||
|
||||
|
||||
JournalSemiFullData journal;
|
||||
|
||||
|
||||
ProgressBar progressBar;
|
||||
|
||||
|
||||
TextView footerTextView;
|
||||
|
||||
|
||||
DatabaseGetJournalTask databaseGetJournalTask = null;
|
||||
|
||||
@SuppressLint("InflateParams") @Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
||||
|
||||
@SuppressLint("InflateParams")
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||
{
|
||||
|
||||
RestoreJournal();
|
||||
|
||||
|
||||
View rootView = inflater.inflate(R.layout.fragment_news_page, container, false);
|
||||
|
||||
|
||||
listView = (ListView) rootView.findViewById(R.id.listView);
|
||||
|
||||
|
||||
View header = inflater.inflate(R.layout.news_page_list_header, null);
|
||||
|
||||
|
||||
listView.addHeaderView(header);
|
||||
|
||||
progressBar = (ProgressBar)header.findViewById(R.id.progressBar);
|
||||
|
||||
|
||||
progressBar = (ProgressBar) header.findViewById(R.id.progressBar);
|
||||
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
|
||||
|
||||
View footer = inflater.inflate(R.layout.news_page_list_footer, null);
|
||||
|
||||
|
||||
listView.addFooterView(footer);
|
||||
|
||||
footerTextView = (TextView)footer.findViewById(R.id.footerTextView);
|
||||
|
||||
|
||||
footerTextView = (TextView) footer.findViewById(R.id.footerTextView);
|
||||
|
||||
listAdapter = new ListAdapter(getActivity());
|
||||
|
||||
|
||||
listView.setAdapter(listAdapter);
|
||||
|
||||
|
||||
listView.setOnItemClickListener(new OnItemClickListener(){
|
||||
|
||||
listView.setOnItemClickListener(new OnItemClickListener()
|
||||
{
|
||||
|
||||
@Override
|
||||
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)
|
||||
{
|
||||
footerTextView.setText(R.string.news_are_loading);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroyView ()
|
||||
public void onDestroyView()
|
||||
{
|
||||
|
||||
|
||||
if (databaseGetJournalTask != null)
|
||||
{
|
||||
databaseGetJournalTask.cancel(false);
|
||||
databaseGetJournalTask = null;
|
||||
}
|
||||
|
||||
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
|
||||
public void RefreshAdapter()
|
||||
{
|
||||
listAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
||||
void RestoreJournal()
|
||||
{
|
||||
journal = JournalManager.CreateEmptyJournal();
|
||||
|
||||
|
||||
RefreshJournal();
|
||||
}
|
||||
|
||||
|
||||
void RefreshJournal()
|
||||
{
|
||||
databaseGetJournalTask = new DatabaseGetJournalTask();
|
||||
@ -132,119 +128,106 @@ public class NewsListFragment extends Fragment
|
||||
databaseGetJournalTask.mHandler = MainActivity.getInstance().mHandler;
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
|
||||
|
||||
bundle.putString("journalName", "news");
|
||||
|
||||
|
||||
bundle.putInt("count", 20);
|
||||
|
||||
databaseGetJournalTask.execute(bundle);
|
||||
}
|
||||
|
||||
|
||||
void LoadMoreNews()
|
||||
{
|
||||
if (databaseGetJournalTask != null)
|
||||
{
|
||||
databaseGetJournalTask.cancel(false);
|
||||
}
|
||||
|
||||
|
||||
databaseGetJournalTask = new DatabaseGetJournalTask();
|
||||
|
||||
databaseGetJournalTask.mHandler = MainActivity.getInstance().mHandler;
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
|
||||
|
||||
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);
|
||||
|
||||
databaseGetJournalTask.execute(bundle);
|
||||
}
|
||||
|
||||
|
||||
public void SetJournal(JournalSemiFullData journal)
|
||||
{
|
||||
progressBar.setVisibility(View.GONE);
|
||||
|
||||
|
||||
|
||||
this.journal.articleArr.addAll(journal.articleArr);
|
||||
|
||||
|
||||
Set<ArticleShortData> articleSet = new TreeSet<ArticleShortData>(new ArticleManager.ArticleShortDataSortComparator());
|
||||
articleSet.addAll(this.journal.articleArr);
|
||||
this.journal.articleArr.clear();
|
||||
this.journal.articleArr.addAll(articleSet);
|
||||
|
||||
|
||||
Collections.sort(this.journal.articleArr, new ArticleManager.ArticleShortDataTimeSortComparator());
|
||||
|
||||
//this.journal.previewImageArr.addAll(journal.previewImageArr);
|
||||
|
||||
|
||||
|
||||
footerTextView.setText(R.string.news_load_more);
|
||||
|
||||
|
||||
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);
|
||||
AlertDialog.Builder dialog = new AlertDialog.Builder(MainActivity.getInstance());
|
||||
dialog.setTitle(item.getTitle());
|
||||
// dialog.setMessage(item.getSnippet());
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
ImageManager.getInstance().ApplyImageToImageView(image, item.getSnippet());
|
||||
@ -217,8 +216,14 @@ public class OsmMapHolderFragment extends Fragment
|
||||
{
|
||||
public void onClick(DialogInterface dialog, int id)
|
||||
{
|
||||
MainActivity.getInstance().SetLastMapFilterName(journalName);
|
||||
MainActivity.getInstance().OpenArticleScreen(mArticles.get(index), MainActivity.TAG_FROM_MAPFRAGMENT_TO_ARTICLEFRAGMENT);
|
||||
if (journalName != null && journalName.length() > 0)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
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))
|
||||
{
|
||||
titleTextView.setText(R.string.map_is_loading);
|
||||
@ -429,7 +430,7 @@ public class OsmMapHolderFragment extends Fragment
|
||||
titleTextView.setText(R.string.map_is_loaded);
|
||||
RestoreGeoJournals();
|
||||
}
|
||||
|
||||
|
||||
return rootView;
|
||||
}
|
||||
|
||||
@ -446,7 +447,6 @@ public class OsmMapHolderFragment extends Fragment
|
||||
|
||||
void RestoreJournal()
|
||||
{
|
||||
// journal = JournalManager.CreateEmptyJournal();
|
||||
|
||||
DatabaseGetJournalTask task = new DatabaseGetJournalTask();
|
||||
|
||||
|
@ -83,7 +83,7 @@ public class PhotoAlbumFragment extends Fragment
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
|
||||
{
|
||||
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;
|
||||
|
||||
//int currentPhoto;
|
||||
|
||||
public PhotoFragmentAdapter(Context context, AlbumFullData album/*, int currentPhoto*/) {
|
||||
public PhotoFragmentAdapter(Context context, AlbumFullData album) {
|
||||
this.context = context;
|
||||
this.album = album;
|
||||
//this.currentPhoto = currentPhoto;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -59,7 +57,6 @@ public class PhotoFragmentAdapter extends PagerAdapter {
|
||||
|
||||
descriptionTextView.setText(album.photoRecordArr.get(position).description);
|
||||
|
||||
|
||||
ImageView image = (ImageView) viewLayout.findViewById(R.id.image);
|
||||
|
||||
ImageManager.getInstance().ApplyImageToImageView(image, album.photoRecordArr.get(position).imageUrl);
|
||||
|
@ -1,21 +1,14 @@
|
||||
package fishrungames.bashgid;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
|
||||
import fishrungames.bashgid.core.ArticleManager;
|
||||
import fishrungames.bashgid.core.ArticleManager.ArticleShortData;
|
||||
import fishrungames.bashgid.core.DatabaseGetJournalTask;
|
||||
|
||||
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.UniversalActionWithCallback;
|
||||
import fishrungames.networkutils.interfaces.RemoveCallbackInterface;
|
||||
import fishrungames.networkutils.interfaces.UpdateAndFinishCallbackInterface;
|
||||
import fishrungames.bashgid.core.NewsSearchRunnable;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
@ -24,13 +17,13 @@ import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.Button;
|
||||
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
@ -40,28 +33,28 @@ public class SearchFragment extends Fragment
|
||||
{
|
||||
|
||||
ListView listView;
|
||||
|
||||
|
||||
ListAdapter listAdapter;
|
||||
|
||||
|
||||
TextView hintTextView;
|
||||
|
||||
|
||||
EditText searchEditText;
|
||||
|
||||
|
||||
ArrayList<ArticleShortData> searchResultArr = new ArrayList<ArticleShortData>();
|
||||
|
||||
|
||||
String journalName;
|
||||
String journalTitle;
|
||||
String query;
|
||||
|
||||
|
||||
DatabaseSearchArticleTask databaseSearchArticleTask = null;
|
||||
|
||||
|
||||
public SearchFragment()
|
||||
{
|
||||
this.journalName = "";
|
||||
this.journalTitle = "";
|
||||
this.query = "";
|
||||
this.query = "";
|
||||
}
|
||||
|
||||
|
||||
public SearchFragment(String query)
|
||||
{
|
||||
this.journalName = "";
|
||||
@ -69,258 +62,219 @@ public class SearchFragment extends Fragment
|
||||
this.journalTitle = "";
|
||||
this.query = query;
|
||||
}
|
||||
|
||||
|
||||
public SearchFragment(String journalName, String journalTitle)
|
||||
{
|
||||
this.journalName = journalName;
|
||||
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
|
||||
public void onSaveInstanceState(final Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putString("journalName", journalName);
|
||||
outState.putString("journalTitle", journalTitle);
|
||||
outState.putString("query", query);
|
||||
}
|
||||
|
||||
@SuppressLint("InflateParams") @Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
public void onSaveInstanceState(final Bundle outState)
|
||||
{
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putString("journalName", journalName);
|
||||
outState.putString("journalTitle", journalTitle);
|
||||
outState.putString("query", query);
|
||||
}
|
||||
|
||||
@SuppressLint("InflateParams")
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||
{
|
||||
|
||||
if (savedInstanceState != null)
|
||||
{
|
||||
journalName = savedInstanceState.getString("journalName");
|
||||
journalTitle = savedInstanceState.getString("journalTitle");
|
||||
query = savedInstanceState.getString("query");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
View rootView = inflater.inflate(R.layout.fragment_search_page, container, false);
|
||||
|
||||
|
||||
listView = (ListView) rootView.findViewById(R.id.listView);
|
||||
|
||||
|
||||
View header = inflater.inflate(R.layout.search_page_list_header, null);
|
||||
|
||||
|
||||
TextView addressTextView = (TextView) header.findViewById(R.id.addressTextView);
|
||||
|
||||
|
||||
|
||||
if (journalTitle == null || journalTitle.length() == 0)
|
||||
{
|
||||
addressTextView.setText(R.string.search_everywhere);
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
String search_in = this.getResources().getString(R.string.search_in);
|
||||
|
||||
|
||||
search_in = search_in.replace("%%", journalTitle);
|
||||
|
||||
|
||||
addressTextView.setText(search_in);
|
||||
}
|
||||
|
||||
|
||||
hintTextView = (TextView) header.findViewById(R.id.hintTextView);
|
||||
|
||||
|
||||
|
||||
searchEditText = (EditText) header.findViewById(R.id.editText);
|
||||
|
||||
|
||||
searchEditText.setText(query);
|
||||
|
||||
searchEditText.addTextChangedListener(new TextWatcher(){
|
||||
|
||||
public void afterTextChanged(Editable s) {
|
||||
|
||||
searchEditText.addTextChangedListener(new TextWatcher()
|
||||
{
|
||||
|
||||
public void afterTextChanged(Editable s)
|
||||
{
|
||||
|
||||
query = searchEditText.getText().toString();
|
||||
|
||||
|
||||
CallUpdateNews();
|
||||
|
||||
}
|
||||
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after){}
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count){}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after)
|
||||
{
|
||||
}
|
||||
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count)
|
||||
{
|
||||
}
|
||||
});
|
||||
|
||||
listView.addHeaderView(header);
|
||||
|
||||
|
||||
listAdapter = new ListAdapter(getActivity());
|
||||
|
||||
|
||||
listView.setAdapter(listAdapter);
|
||||
|
||||
listView.setOnItemClickListener(new OnItemClickListener(){
|
||||
|
||||
listView.setOnItemClickListener(new OnItemClickListener()
|
||||
{
|
||||
|
||||
@Override
|
||||
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();
|
||||
|
||||
|
||||
return rootView;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void SetSearchResult(ArrayList<ArticleShortData> articleArr)
|
||||
{
|
||||
searchResultArr = articleArr;
|
||||
listAdapter.notifyDataSetChanged();
|
||||
|
||||
|
||||
String searchResultCount = getResources().getString(R.string.search_result_count);
|
||||
|
||||
|
||||
searchResultCount = searchResultCount.replace("%%", Integer.toString(articleArr.size()));
|
||||
|
||||
|
||||
hintTextView.setText(searchResultCount);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class ListAdapter extends BaseAdapter {
|
||||
private Context mContext;
|
||||
|
||||
public ListAdapter(Context c) {
|
||||
mContext = c;
|
||||
}
|
||||
public class ListAdapter extends BaseAdapter
|
||||
{
|
||||
private Context mContext;
|
||||
|
||||
public int getCount() {
|
||||
return searchResultArr.size();
|
||||
}
|
||||
public ListAdapter(Context c)
|
||||
{
|
||||
mContext = c;
|
||||
}
|
||||
|
||||
public Object getItem(int position) {
|
||||
return null;
|
||||
}
|
||||
public int getCount()
|
||||
{
|
||||
return searchResultArr.size();
|
||||
}
|
||||
|
||||
public long getItemId(int position) {
|
||||
return 0;
|
||||
}
|
||||
public Object getItem(int position)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// 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.search_page_list_element, null);
|
||||
|
||||
} else {
|
||||
view = convertView;
|
||||
}
|
||||
|
||||
ImageButton imageButton = (ImageButton) view.findViewById(R.id.imageButton);
|
||||
|
||||
Button button = (Button) view.findViewById(R.id.button);
|
||||
|
||||
TextView dateTextView = (TextView) view.findViewById(R.id.dateTextView);
|
||||
|
||||
ImageManager.getInstance().ApplyImageToImageView(imageButton, searchResultArr.get(position).previewImageUrl);
|
||||
|
||||
button.setText(searchResultArr.get(position).title);
|
||||
|
||||
dateTextView.setText(NewsDataSource.iso8601Format.format(searchResultArr.get(position).dateTime));
|
||||
|
||||
|
||||
|
||||
button.setOnClickListener(new ButtonOnClickListener(searchResultArr.get(position).name, searchResultArr.get(position).type));
|
||||
|
||||
imageButton.setOnClickListener(new ButtonOnClickListener(searchResultArr.get(position).name, searchResultArr.get(position).type));
|
||||
|
||||
return view;*/
|
||||
|
||||
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.journal_element, null);
|
||||
|
||||
|
||||
} 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 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.journal_element, null);
|
||||
|
||||
} 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(MainActivity.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()
|
||||
{
|
||||
|
||||
|
||||
|
||||
if (query.length() >= 3 || Locale.getDefault() == Locale.CHINA)
|
||||
{
|
||||
if (databaseSearchArticleTask != null)
|
||||
{
|
||||
databaseSearchArticleTask.cancel(false);
|
||||
}
|
||||
|
||||
|
||||
databaseSearchArticleTask = new DatabaseSearchArticleTask();
|
||||
|
||||
databaseSearchArticleTask.mHandler = MainActivity.getInstance().mHandler;
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
|
||||
|
||||
bundle.putString("journalName", journalName);
|
||||
bundle.putString("query", query);
|
||||
|
||||
|
||||
databaseSearchArticleTask.execute(bundle);
|
||||
|
||||
|
||||
hintTextView.setText(R.string.search_is_performing);
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
searchResultArr.clear();
|
||||
listAdapter.notifyDataSetChanged();
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
@ -11,16 +10,16 @@ import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
|
||||
|
||||
public class SettingsFragment extends Fragment
|
||||
{
|
||||
|
||||
@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);
|
||||
|
||||
Button callSupportButton = (Button)rootView.findViewById(R.id.callSupportButton);
|
||||
|
||||
Button callSupportButton = (Button) rootView.findViewById(R.id.callSupportButton);
|
||||
|
||||
callSupportButton.setOnClickListener(new OnClickListener()
|
||||
{
|
||||
@ -33,11 +32,10 @@ public class SettingsFragment extends Fragment
|
||||
intent.setData(Uri.parse(uri));
|
||||
MainActivity.getInstance().startActivity(intent);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
Button visitKitapButton = (Button)rootView.findViewById(R.id.visitKitapButton);
|
||||
|
||||
Button visitKitapButton = (Button) rootView.findViewById(R.id.visitKitapButton);
|
||||
|
||||
visitKitapButton.setOnClickListener(new OnClickListener()
|
||||
{
|
||||
@ -49,8 +47,8 @@ public class SettingsFragment extends Fragment
|
||||
startActivity(i);
|
||||
}
|
||||
});
|
||||
|
||||
Button visitDeveloperButton = (Button)rootView.findViewById(R.id.visitDeveloperButton);
|
||||
|
||||
Button visitDeveloperButton = (Button) rootView.findViewById(R.id.visitDeveloperButton);
|
||||
|
||||
visitDeveloperButton.setOnClickListener(new OnClickListener()
|
||||
{
|
||||
@ -62,9 +60,8 @@ public class SettingsFragment extends Fragment
|
||||
startActivity(i);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Button visitTranslatorButton = (Button)rootView.findViewById(R.id.visitTranslatorButton);
|
||||
|
||||
Button visitTranslatorButton = (Button) rootView.findViewById(R.id.visitTranslatorButton);
|
||||
|
||||
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
|
||||
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;
|
||||
listAdapter.notifyDataSetChanged();
|
||||
//channelFullData = MainActivity.getInstance().channelDataSource.GetChannelFullData(channelName);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
package fishrungames.bashgid;
|
||||
|
||||
import fishrungames.bashgid.core.AlbumManager;
|
||||
import fishrungames.bashgid.core.DatabaseGetAlbumTask;
|
||||
|
||||
import fishrungames.bashgid.core.VideoManager;
|
||||
import fishrungames.bashgid.core.ChannelManager.ChannelFullData;
|
||||
|
||||
import fishrungames.bashgid.core.VideoManager.VideoRecordData;
|
||||
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()
|
||||
{
|
||||
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.ChannelManager.ChannelFullData;
|
||||
import fishrungames.bashgid.core.JournalManager.JournalSemiFullData;
|
||||
|
||||
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
|
||||
{
|
||||
@ -99,8 +88,6 @@ public class ArticleManager
|
||||
{
|
||||
super(recordData);
|
||||
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 fishrungames.bashgid.MainActivity;
|
||||
import fishrungames.bashgid.core.AlbumManager.AlbumFullData;
|
||||
import fishrungames.bashgid.core.AlbumManager.AlbumRecordData;
|
||||
import fishrungames.bashgid.core.PhotoManager.PhotoRecordData;
|
||||
|
||||
|
||||
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()
|
||||
{
|
||||
ChannelFullData result = new ChannelFullData(new ChannelRecordData("", "", "", 0));
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
}
|
||||
|