set up back button + cleaning

This commit is contained in:
Vladislav Khorev 2015-07-03 00:17:32 +00:00
parent ce6cace53b
commit 2345ed733c
119 changed files with 2217 additions and 5207 deletions

View File

@ -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>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View File

@ -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>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

View File

@ -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>

View File

@ -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>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

View File

@ -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>

View File

@ -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>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

View File

@ -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>

View File

@ -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>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

View File

@ -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>

View File

@ -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>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View File

@ -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>

View File

@ -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>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

View File

@ -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>

View File

@ -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>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

View File

@ -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>

View File

@ -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>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

View File

@ -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>

View File

@ -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>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

View File

@ -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>

View File

@ -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>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

View File

@ -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>

View File

@ -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>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

View File

@ -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>

View File

@ -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>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

View File

@ -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>

View File

@ -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>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

View File

@ -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>

View File

@ -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>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

View File

@ -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>

View File

@ -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>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -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>

View File

@ -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>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 328 B

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -32,7 +32,7 @@
style="?android:attr/borderlessButtonStyle" style="?android:attr/borderlessButtonStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="right" android:layout_gravity="right|center_vertical"
android:layout_marginBottom="@dimen/medium_margin" android:layout_marginBottom="@dimen/medium_margin"
android:layout_marginLeft="@dimen/medium_margin" android:layout_marginLeft="@dimen/medium_margin"
android:layout_marginTop="@dimen/medium_margin" android:layout_marginTop="@dimen/medium_margin"
@ -44,7 +44,7 @@
android:id="@+id/imageButton" android:id="@+id/imageButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="right" android:layout_gravity="right|center_vertical"
android:layout_margin="@dimen/medium_margin" android:layout_margin="@dimen/medium_margin"
android:background="@drawable/transparent" android:background="@drawable/transparent"
android:src="@drawable/see_more_small" /> android:src="@drawable/see_more_small" />

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -1,13 +1,11 @@
package fishrungames.bashgid; package fishrungames.bashgid;
import java.util.ArrayList; import java.util.ArrayList;
import fishrungames.bashgid.core.AlbumManager.AlbumShortData; import fishrungames.bashgid.core.AlbumManager.AlbumShortData;
import fishrungames.networkutils.ImageManager; import fishrungames.networkutils.ImageManager;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.os.AsyncTask; import android.os.AsyncTask;
@ -27,7 +25,6 @@ import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
public class AlbumListFragment extends Fragment public class AlbumListFragment extends Fragment
{ {
@ -49,13 +46,13 @@ public class AlbumListFragment extends Fragment
this.albumArr = albumArr; this.albumArr = albumArr;
} }
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View rootView = inflater.inflate(R.layout.fragment_video_page, container, false); View rootView = inflater.inflate(R.layout.fragment_video_page, container, false);
progressBar = (ProgressBar)rootView.findViewById(R.id.progressBar); progressBar = (ProgressBar) rootView.findViewById(R.id.progressBar);
progressBar.setVisibility(View.VISIBLE); progressBar.setVisibility(View.VISIBLE);
@ -99,7 +96,6 @@ public class AlbumListFragment extends Fragment
listAdapter.notifyDataSetChanged(); listAdapter.notifyDataSetChanged();
} }
public static class DatabaseGetAlbumListTask extends AsyncTask<String, Integer, Long> public static class DatabaseGetAlbumListTask extends AsyncTask<String, Integer, Long>
{ {
@ -131,43 +127,47 @@ public class AlbumListFragment extends Fragment
} }
} }
public class ListAdapter extends BaseAdapter
{
public class ListAdapter extends BaseAdapter {
private Context mContext; private Context mContext;
public ListAdapter(Context c) { public ListAdapter(Context c)
{
mContext = c; mContext = c;
} }
public int getCount() { public int getCount()
{
return albumArr.size(); return albumArr.size();
} }
public Object getItem(int position) { public Object getItem(int position)
{
return null; return null;
} }
public long getItemId(int position) { public long getItemId(int position)
{
return 0; return 0;
} }
// create a new ImageView for each item referenced by the Adapter // create a new ImageView for each item referenced by the Adapter
@SuppressLint("InflateParams") @SuppressLint("InflateParams")
public View getView(int position, View convertView, ViewGroup parent) { public View getView(int position, View convertView, ViewGroup parent)
{
View view; View view;
if (convertView == null) { // if it's not recycled, initialize some attributes if (convertView == null)
{ // if it's not recycled, initialize some attributes
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.video_page_list_element, null); view = inflater.inflate(R.layout.video_page_list_element, null);
} else
} else { {
view = convertView; view = convertView;
} }
ImageView imageView = (ImageView)view.findViewById(R.id.imageView); ImageView imageView = (ImageView) view.findViewById(R.id.imageView);
TextView nameTextView = (TextView) view.findViewById(R.id.nameTextView); TextView nameTextView = (TextView) view.findViewById(R.id.nameTextView);
ImageManager.getInstance().ApplyImageToImageView(imageView, albumArr.get(position).firstImageUrl); ImageManager.getInstance().ApplyImageToImageView(imageView, albumArr.get(position).firstImageUrl);

View File

@ -1,6 +1,5 @@
package fishrungames.bashgid; package fishrungames.bashgid;
import it.sephiroth.android.library.widget.AdapterView.OnItemClickListener; import it.sephiroth.android.library.widget.AdapterView.OnItemClickListener;
import it.sephiroth.android.library.widget.HListView; import it.sephiroth.android.library.widget.HListView;
@ -12,14 +11,11 @@ import org.osmdroid.api.IMapController;
import org.osmdroid.util.GeoPoint; import org.osmdroid.util.GeoPoint;
import org.osmdroid.views.MapView; import org.osmdroid.views.MapView;
import fishrungames.bashgid.OsmMapHolderFragment.CustomItemizedOverlay;
import fishrungames.bashgid.OsmMapHolderFragment.NoInteractionOverlay; import fishrungames.bashgid.OsmMapHolderFragment.NoInteractionOverlay;
import fishrungames.bashgid.core.ArticleManager; import fishrungames.bashgid.core.ArticleManager;
import fishrungames.bashgid.core.DatabaseGetAlbumTask;
import fishrungames.bashgid.core.DatabaseGetArticleTask; import fishrungames.bashgid.core.DatabaseGetArticleTask;
import fishrungames.bashgid.core.LocationHolder;
import fishrungames.bashgid.core.AlbumManager.AlbumFullData;
import fishrungames.bashgid.core.AlbumManager.AlbumShortData;
import fishrungames.bashgid.core.ArticleManager.ArticleFullData; import fishrungames.bashgid.core.ArticleManager.ArticleFullData;
import fishrungames.bashgid.core.PhotoManager.PhotoRecordData; import fishrungames.bashgid.core.PhotoManager.PhotoRecordData;
import fishrungames.networkutils.ImageManager; import fishrungames.networkutils.ImageManager;
@ -29,10 +25,9 @@ import android.content.Intent;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.net.Uri; import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.view.Gravity; import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -43,26 +38,23 @@ import android.view.View.OnLongClickListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.BaseAdapter; import android.widget.BaseAdapter;
import android.widget.AdapterView;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.ListView; import android.widget.ListView;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
public class ArticleFragment extends Fragment public class ArticleFragment extends Fragment
{ {
public static class ArticleLayoutElement public static class ArticleLayoutElement
{ {
public int type; //0 title; 1 text; 2 photo; 3 geotag; 4 photo_album; 5 button 6 phone public int type; // 0 title; 1 text; 2 photo; 3 geotag; 4 photo_album; 5
// button 6 phone
public String value; public String value;
public double geoLat; public double geoLat;
public double geoLon; public double geoLon;
@ -77,7 +69,6 @@ public class ArticleFragment extends Fragment
this.albumPos = -1; this.albumPos = -1;
} }
public ArticleLayoutElement(double geoLat, double geoLon) public ArticleLayoutElement(double geoLat, double geoLon)
{ {
this.type = 3; this.type = 3;
@ -97,7 +88,8 @@ public class ArticleFragment extends Fragment
} }
} }
public class MapOverlay extends org.osmdroid.views.overlay.Overlay { public class MapOverlay extends org.osmdroid.views.overlay.Overlay
{
public MapOverlay(Context ctx) public MapOverlay(Context ctx)
{ {
@ -111,19 +103,19 @@ public class ArticleFragment extends Fragment
} }
@Override @Override
public boolean onTouchEvent(final MotionEvent event, final MapView mapView) { public boolean onTouchEvent(final MotionEvent event, final MapView mapView)
{
MainActivity.getInstance().SetLastArticleName(articleName);
if (event.getAction() == MotionEvent.ACTION_UP) if (event.getAction() == MotionEvent.ACTION_UP)
{ {
MainActivity.getInstance().OpenMapScreen(article); MainActivity.getInstance().OpenMapScreen(article, MainActivity.TAG_BACK_TO_ARTICLEFRAGMENT);
} }
return true; return true;
} }
} }
ListView listView; ListView listView;
ListAdapter listAdapter; ListAdapter listAdapter;
@ -154,7 +146,8 @@ public class ArticleFragment extends Fragment
} }
@Override @Override
public void onSaveInstanceState(final Bundle outState) { public void onSaveInstanceState(final Bundle outState)
{
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
outState.putString("articleName", articleName); outState.putString("articleName", articleName);
} }
@ -168,7 +161,6 @@ public class ArticleFragment extends Fragment
task.execute(articleName); task.execute(articleName);
} }
public void ReloadLayout() public void ReloadLayout()
{ {
articleLayout.clear(); articleLayout.clear();
@ -194,8 +186,6 @@ public class ArticleFragment extends Fragment
articleLayout.add(new ArticleLayoutElement(2, zeroPhoto.imageUrl)); articleLayout.add(new ArticleLayoutElement(2, zeroPhoto.imageUrl));
} }
articleLayout.add(new ArticleLayoutElement(1, article.content)); articleLayout.add(new ArticleLayoutElement(1, article.content));
if (article.phone.length() > 0) if (article.phone.length() > 0)
@ -233,11 +223,12 @@ public class ArticleFragment extends Fragment
listAdapter.notifyDataSetChanged(); listAdapter.notifyDataSetChanged();
} }
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
if (savedInstanceState != null) { if (savedInstanceState != null)
{
articleName = savedInstanceState.getString("articleName"); articleName = savedInstanceState.getString("articleName");
RestoreArticle(); RestoreArticle();
ReloadLayout(); ReloadLayout();
@ -245,11 +236,10 @@ public class ArticleFragment extends Fragment
View rootView = inflater.inflate(R.layout.fragment_article_page, container, false); View rootView = inflater.inflate(R.layout.fragment_article_page, container, false);
progressBar = (ProgressBar)rootView.findViewById(R.id.progressBar); progressBar = (ProgressBar) rootView.findViewById(R.id.progressBar);
progressBar.setVisibility(View.VISIBLE); progressBar.setVisibility(View.VISIBLE);
listView = (ListView) rootView.findViewById(R.id.listView); listView = (ListView) rootView.findViewById(R.id.listView);
listAdapter = new ListAdapter(getActivity()); listAdapter = new ListAdapter(getActivity());
@ -259,22 +249,27 @@ public class ArticleFragment extends Fragment
return rootView; return rootView;
} }
public class ListAdapter extends BaseAdapter { public class ListAdapter extends BaseAdapter
{
private Context mContext; private Context mContext;
public ListAdapter(Context c) { public ListAdapter(Context c)
{
mContext = c; mContext = c;
} }
public int getCount() { public int getCount()
{
return articleLayout.size(); return articleLayout.size();
} }
public Object getItem(int position) { public Object getItem(int position)
{
return null; return null;
} }
public long getItemId(int position) { public long getItemId(int position)
{
return 0; return 0;
} }
@ -291,49 +286,45 @@ public class ArticleFragment extends Fragment
} }
// create a new ImageView for each item referenced by the Adapter // create a new ImageView for each item referenced by the Adapter
@SuppressLint("InflateParams") @SuppressLint("InflateParams")
public View getView(final int position, View convertView, ViewGroup parent) { public View getView(final int position, View convertView, ViewGroup parent)
{
View view; View view;
if (convertView == null) { // if it's not recycled, initialize some attributes if (convertView == null)
{ // if it's not recycled, initialize some attributes
if (getItemViewType(position) == 0 || getItemViewType(position) == 1) if (getItemViewType(position) == 0 || getItemViewType(position) == 1)
{ {
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.article_text_element, null); view = inflater.inflate(R.layout.article_text_element, null);
} } else if (getItemViewType(position) == 2)
else if (getItemViewType(position) == 2)
{ {
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.article_photo_element, null); view = inflater.inflate(R.layout.article_photo_element, null);
} } else if (getItemViewType(position) == 3)
else if (getItemViewType(position) == 3)
{ {
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.article_geotag_element, null); view = inflater.inflate(R.layout.article_geotag_element, null);
} } else if (getItemViewType(position) == 4)
else if (getItemViewType(position) == 4)
{ {
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.article_album_element, null); view = inflater.inflate(R.layout.article_album_element, null);
} } else if (getItemViewType(position) == 5)
else if (getItemViewType(position) == 5)
{ {
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.article_button_element, null); view = inflater.inflate(R.layout.article_button_element, null);
} } else
else //if (getItemViewType(position) == 6) // if (getItemViewType(position) == 6)
{ {
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.article_phone_element, null); view = inflater.inflate(R.layout.article_phone_element, null);
} }
} else { } else
{
view = convertView; view = convertView;
} }
if (getItemViewType(position) == 0) if (getItemViewType(position) == 0)
{ {
TextView textView = (TextView) view.findViewById(R.id.dateTextView); TextView textView = (TextView) view.findViewById(R.id.dateTextView);
@ -343,8 +334,7 @@ public class ArticleFragment extends Fragment
if (article.type == ArticleManager.ARTICLE_TYPE_NEWS) if (article.type == ArticleManager.ARTICLE_TYPE_NEWS)
{ {
textView.setTextSize(getResources().getDimension(R.dimen.xlarge_text_size)); textView.setTextSize(getResources().getDimension(R.dimen.xlarge_text_size));
} } else
else
{ {
textView.setTextSize(getResources().getDimension(R.dimen.xxlarge_text_size)); textView.setTextSize(getResources().getDimension(R.dimen.xxlarge_text_size));
} }
@ -352,8 +342,7 @@ public class ArticleFragment extends Fragment
textView.setTypeface(null, Typeface.BOLD); textView.setTypeface(null, Typeface.BOLD);
textView.setGravity(Gravity.CENTER_HORIZONTAL); textView.setGravity(Gravity.CENTER_HORIZONTAL);
} } else if (getItemViewType(position) == 1)
else if (getItemViewType(position) == 1)
{ {
TextView textView = (TextView) view.findViewById(R.id.dateTextView); TextView textView = (TextView) view.findViewById(R.id.dateTextView);
@ -363,8 +352,7 @@ public class ArticleFragment extends Fragment
textView.setTypeface(null, Typeface.NORMAL); textView.setTypeface(null, Typeface.NORMAL);
textView.setGravity(Gravity.LEFT); textView.setGravity(Gravity.LEFT);
} } else if (getItemViewType(position) == 2)
else if (getItemViewType(position) == 2)
{ {
TextView textView = (TextView) view.findViewById(R.id.dateTextView); TextView textView = (TextView) view.findViewById(R.id.dateTextView);
ImageView imageView = (ImageView) view.findViewById(R.id.imageView); ImageView imageView = (ImageView) view.findViewById(R.id.imageView);
@ -374,8 +362,7 @@ public class ArticleFragment extends Fragment
ImageManager.getInstance().ApplyImageToImageView(imageView, photo.imageUrl); ImageManager.getInstance().ApplyImageToImageView(imageView, photo.imageUrl);
textView.setText(photo.title); textView.setText(photo.title);
} } else if (getItemViewType(position) == 3)
else if (getItemViewType(position) == 3)
{ {
double geoLat = articleLayout.get(position).geoLat; double geoLat = articleLayout.get(position).geoLat;
double geoLon = articleLayout.get(position).geoLon; double geoLon = articleLayout.get(position).geoLon;
@ -392,18 +379,22 @@ public class ArticleFragment extends Fragment
final String copied_text = getResources().getString(R.string.copied_text); final String copied_text = getResources().getString(R.string.copied_text);
addressTextView.setOnLongClickListener(new OnLongClickListener(){ addressTextView.setOnLongClickListener(new OnLongClickListener()
{
@Override @Override
public boolean onLongClick(View v) public boolean onLongClick(View v)
{ {
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB)
if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) { {
android.text.ClipboardManager clipboard = (android.text.ClipboardManager) MainActivity.getInstance().getSystemService(Context.CLIPBOARD_SERVICE); android.text.ClipboardManager clipboard = (android.text.ClipboardManager) MainActivity.getInstance().getSystemService(
Context.CLIPBOARD_SERVICE);
clipboard.setText(article.address); clipboard.setText(article.address);
} else { } else
android.content.ClipboardManager clipboard = (android.content.ClipboardManager) MainActivity.getInstance().getSystemService(Context.CLIPBOARD_SERVICE); {
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); android.content.ClipData clip = android.content.ClipData.newPlainText(copied_text, article.address);
clipboard.setPrimaryClip(clip); clipboard.setPrimaryClip(clip);
} }
@ -416,10 +407,9 @@ public class ArticleFragment extends Fragment
} }
}); });
//editText.setKeyListener(null); // editText.setKeyListener(null);
} } else
else
{ {
addressTextView.setVisibility(View.GONE); addressTextView.setVisibility(View.GONE);
hintTextView.setVisibility(View.GONE); hintTextView.setVisibility(View.GONE);
@ -427,23 +417,19 @@ public class ArticleFragment extends Fragment
MapView mapView = (MapView) view.findViewById(R.id.mapview); MapView mapView = (MapView) view.findViewById(R.id.mapview);
mapView.setMaxZoomLevel(20); mapView.setMaxZoomLevel(20);
mapView.setMinZoomLevel(4); mapView.setMinZoomLevel(4);
//mapView.setBuiltInZoomControls(true); // mapView.setBuiltInZoomControls(true);
//mapView.setMultiTouchControls(true); // mapView.setMultiTouchControls(true);
IMapController mapController = mapView.getController(); IMapController mapController = mapView.getController();
GeoPoint markerPoint = new GeoPoint(geoLat, geoLon); GeoPoint markerPoint = new GeoPoint(geoLat, geoLon);
mapController.setZoom(16); mapController.setZoom(16);
mapController.animateTo(markerPoint); mapController.animateTo(markerPoint);
ResourceProxy resourceProxy = new DefaultResourceProxyImpl(getActivity()); ResourceProxy resourceProxy = new DefaultResourceProxyImpl(getActivity());
NoInteractionOverlay itemizedOverlay = new NoInteractionOverlay(getResources().getDrawable(R.drawable.russia_icon), resourceProxy); NoInteractionOverlay itemizedOverlay = new NoInteractionOverlay(getResources().getDrawable(R.drawable.russia_icon), resourceProxy);
@ -451,14 +437,11 @@ public class ArticleFragment extends Fragment
mapView.getOverlays().add(itemizedOverlay); mapView.getOverlays().add(itemizedOverlay);
MapOverlay mapOverlay = new MapOverlay(getActivity()); MapOverlay mapOverlay = new MapOverlay(getActivity());
mapView.getOverlays().add(mapOverlay); mapView.getOverlays().add(mapOverlay);
} else if (getItemViewType(position) == 4)
}
else if (getItemViewType(position) == 4)
{ {
TextView titleTextView = (TextView) view.findViewById(R.id.titleTextView); TextView titleTextView = (TextView) view.findViewById(R.id.titleTextView);
@ -471,9 +454,11 @@ public class ArticleFragment extends Fragment
HListView hListView = (HListView) view.findViewById(R.id.hListView); HListView hListView = (HListView) view.findViewById(R.id.hListView);
hListView.setAdapter(new MainPageHListViewAdapters.PhotoAlbumElementAdapter(getActivity(), article.albumArr.get(articleLayout.get(position).albumPos))); hListView.setAdapter(new MainPageHListViewAdapters.PhotoAlbumElementAdapter(getActivity(),
article.albumArr.get(articleLayout.get(position).albumPos)));
hListView.setOnItemClickListener(new OnItemClickListener(){ hListView.setOnItemClickListener(new OnItemClickListener()
{
@Override @Override
public void onItemClick(it.sephiroth.android.library.widget.AdapterView<?> parent, View view, int innerPosition, long id) public void onItemClick(it.sephiroth.android.library.widget.AdapterView<?> parent, View view, int innerPosition, long id)
@ -482,21 +467,19 @@ public class ArticleFragment extends Fragment
String albumName = article.albumArr.get(articleLayout.get(position).albumPos).name; String albumName = article.albumArr.get(articleLayout.get(position).albumPos).name;
MainActivity.getInstance().OpenPhotoScreen(albumName, innerPosition, MainActivity.TAG_FROM_ARTICLEFRAGMENT_TO_PHOTOFRAGMENT); MainActivity.getInstance().OpenPhotoScreen(albumName, innerPosition, MainActivity.TAG_BACK_TO_ARTICLEFRAGMENT);
} }
}); });
} } else if (getItemViewType(position) == 5)
else if (getItemViewType(position) == 5)
{ {
Button button = (Button) view.findViewById(R.id.button); Button button = (Button) view.findViewById(R.id.button);
if (article.externalLinkText.length() > 0) if (article.externalLinkText.length() > 0)
{ {
button.setText(article.externalLinkText); button.setText(article.externalLinkText);
} } else
else
{ {
button.setText(R.string.go_to_website); button.setText(R.string.go_to_website);
} }
@ -511,8 +494,7 @@ public class ArticleFragment extends Fragment
startActivity(i); startActivity(i);
} }
}); });
} } else if (getItemViewType(position) == 6)
else if (getItemViewType(position) == 6)
{ {
Button button = (Button) view.findViewById(R.id.button); Button button = (Button) view.findViewById(R.id.button);
@ -520,7 +502,6 @@ public class ArticleFragment extends Fragment
button.setText(phone); button.setText(phone);
button.setOnClickListener(new OnClickListener() button.setOnClickListener(new OnClickListener()
{ {
@Override @Override
@ -534,8 +515,6 @@ public class ArticleFragment extends Fragment
}); });
} }
return view; return view;
} }

View File

@ -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;
}
}

View File

@ -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;
}
}
}

View File

@ -7,10 +7,9 @@ import fishrungames.bashgid.core.DatabaseGetJournalListTask;
import fishrungames.bashgid.core.JournalManager.JournalSemiFullData; import fishrungames.bashgid.core.JournalManager.JournalSemiFullData;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -45,12 +44,12 @@ public class CatalogFragment extends Fragment
} }
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View rootView = inflater.inflate(R.layout.fragment_catalog_page, container, false); View rootView = inflater.inflate(R.layout.fragment_catalog_page, container, false);
progressBar = (ProgressBar)rootView.findViewById(R.id.progressBar); progressBar = (ProgressBar) rootView.findViewById(R.id.progressBar);
progressBar.setVisibility(View.VISIBLE); progressBar.setVisibility(View.VISIBLE);
@ -64,7 +63,7 @@ public class CatalogFragment extends Fragment
} }
@Override @Override
public void onDestroyView () public void onDestroyView()
{ {
if (databaseGetJournalListTask != null) if (databaseGetJournalListTask != null)
@ -98,40 +97,44 @@ public class CatalogFragment extends Fragment
listAdapter.notifyDataSetChanged(); listAdapter.notifyDataSetChanged();
} }
public class ListAdapter extends BaseAdapter
{
public class ListAdapter extends BaseAdapter {
private Context mContext; private Context mContext;
public ListAdapter(Context c) { public ListAdapter(Context c)
{
mContext = c; mContext = c;
} }
public int getCount() { public int getCount()
{
return journalList.size(); return journalList.size();
} }
public Object getItem(int position) { public Object getItem(int position)
{
return null; return null;
} }
public long getItemId(int position) { public long getItemId(int position)
{
return 0; return 0;
} }
// create a new ImageView for each item referenced by the Adapter // create a new ImageView for each item referenced by the Adapter
@SuppressLint("InflateParams") @SuppressLint("InflateParams")
public View getView(final int position, View convertView, ViewGroup parent) { public View getView(final int position, View convertView, ViewGroup parent)
{
View view; View view;
if (convertView == null) { // if it's not recycled, initialize some attributes if (convertView == null)
{ // if it's not recycled, initialize some attributes
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.main_page_list_element, null); view = inflater.inflate(R.layout.main_page_list_element, null);
} else
} else { {
view = convertView; view = convertView;
} }
@ -153,13 +156,11 @@ public class CatalogFragment extends Fragment
descriptionTextView.setText(journalList.get(position).description); descriptionTextView.setText(journalList.get(position).description);
descriptionTextView.setVisibility(View.VISIBLE); descriptionTextView.setVisibility(View.VISIBLE);
} } else
else
{ {
descriptionTextView.setVisibility(View.GONE); descriptionTextView.setVisibility(View.GONE);
} }
button.setText(R.string.see_all); button.setText(R.string.see_all);
button.setOnClickListener(new OnClickListener() button.setOnClickListener(new OnClickListener()
@ -167,7 +168,7 @@ public class CatalogFragment extends Fragment
@Override @Override
public void onClick(View v) public void onClick(View v)
{ {
MainActivity.getInstance().OpenJournalScreen(journalList.get(position).name, MainActivity.TAG_FROM_CATALOGFRAGMENT_TO_JOURNALFRAGMENT); MainActivity.getInstance().OpenJournalScreen(journalList.get(position).name, MainActivity.TAG_BACK_TO_CATALOGFRAGMENT);
} }
}); });
@ -177,7 +178,7 @@ public class CatalogFragment extends Fragment
@Override @Override
public void onClick(View v) public void onClick(View v)
{ {
MainActivity.getInstance().OpenJournalScreen(journalList.get(position).name, MainActivity.TAG_FROM_CATALOGFRAGMENT_TO_JOURNALFRAGMENT); MainActivity.getInstance().OpenJournalScreen(journalList.get(position).name, MainActivity.TAG_BACK_TO_CATALOGFRAGMENT);
} }
}); });

View File

@ -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;
}
}

View File

@ -97,24 +97,19 @@ public class JournalFragment extends Fragment
@Override @Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{ {
/* MainActivity.getInstance().SetLastJournalName(journalName);
if (journal.geoCategory == 1)
{
position = position - 1; // because there is header for geo objects
}*/
if (position == 0) if (position == 0)
{ {
if (journal.geoCategory == 1) if (journal.geoCategory == 1)
{ {
MainActivity.getInstance().OpenMapScreen(journalName); MainActivity.getInstance().OpenMapScreen(journalName, MainActivity.TAG_BACK_TO_JOURNALFRAGMENT);
} }
} }
else else
{ {
MainActivity.getInstance().OpenArticleScreen(journal.articleArr.get(position-1).name, MainActivity.TAG_TO_MAINFRAGMENT); MainActivity.getInstance().OpenArticleScreen(journal.articleArr.get(position-1).name, MainActivity.TAG_BACK_TO_JOURNALFRAGMENT);
} }
} }
}); });

View File

@ -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;
}
}
}

View File

@ -1,10 +1,10 @@
package fishrungames.bashgid; package fishrungames.bashgid;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Locale; import java.util.Locale;
import fishrungames.bashgid.core.AlbumManager.AlbumFullData; import fishrungames.bashgid.core.AlbumManager.AlbumFullData;
import fishrungames.bashgid.core.AlbumManager.AlbumShortData; import fishrungames.bashgid.core.AlbumManager.AlbumShortData;
import fishrungames.bashgid.core.ArticleManager.ArticleFullData; import fishrungames.bashgid.core.ArticleManager.ArticleFullData;
@ -22,7 +22,6 @@ import fishrungames.bashgid.core.db.ArticleDataSource;
import fishrungames.bashgid.core.db.BashgidSqliteHelper; import fishrungames.bashgid.core.db.BashgidSqliteHelper;
import fishrungames.bashgid.core.db.ChannelDataSource; import fishrungames.bashgid.core.db.ChannelDataSource;
import fishrungames.bashgid.core.db.JournalDataSource; import fishrungames.bashgid.core.db.JournalDataSource;
import fishrungames.bashgid.core.db.NewsDataSource;
import fishrungames.bashgid.core.db.PhotoDataSource; import fishrungames.bashgid.core.db.PhotoDataSource;
import fishrungames.bashgid.core.db.TranslationDataSource; import fishrungames.bashgid.core.db.TranslationDataSource;
import fishrungames.bashgid.core.db.VideoDataSource; import fishrungames.bashgid.core.db.VideoDataSource;
@ -33,7 +32,6 @@ import fishrungames.networkutils.ImageManager;
import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBarActivity;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Configuration; import android.content.res.Configuration;
@ -42,12 +40,6 @@ import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.os.Message; import android.os.Message;
//import android.support.v4.view.MenuCompat;
//import android.support.v4.view.MenuItemCompat;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
@ -60,21 +52,25 @@ import android.support.v4.widget.DrawerLayout;
public class MainActivity extends ActionBarActivity implements NavigationDrawerFragment.NavigationDrawerCallbacks public class MainActivity extends ActionBarActivity implements NavigationDrawerFragment.NavigationDrawerCallbacks
{ {
public static final String TAG_FROM_MAINFRAGMENT_TO_NEWSRECORDFRAGMENT = "TAG_FROM_MAINFRAGMENT_TO_NEWSRECORDFRAGMENT"; public static final String TAG_BACK_TO_MAINFRAGMENT = "TAG_BACK_TO_MAINFRAGMENT";
public static final String TAG_FROM_SEARCHFRAGMENT_TO_NEWSRECORDFRAGMENT = "TAG_FROM_SEARCHFRAGMENT_TO_NEWSRECORDFRAGMENT"; public static final String TAG_BACK_TO_CATALOGFRAGMENT = "TAG_BACK_TO_CATALOGFRAGMENT";
public static final String TAG_FROM_VIDEOLISTFRAGMENT_TO_VIDEORECORDFRAGMENT = "TAG_FROM_VIDEOLISTFRAGMENT_TO_VIDEORECORDFRAGMENT"; public static final String TAG_BACK_TO_ALBUMLISTFRAGMENT = "TAG_BACK_TO_ALBUMLISTFRAGMENT";
public static final String TAG_BACK_TO_JOURNALFRAGMENT = "TAG_BACK_TO_JOURNALFRAGMENT";
public static final String TAG_BACK_TO_ARTICLEFRAGMENT = "TAG_BACK_TO_ARTICLEFRAGMENT";
public static final String TAG_BACK_TO_ALBUMFRAGMENT = "TAG_BACK_TO_ALBUMFRAGMENT";
public static final String TAG_BACK_TO_CHANNELFRAGMENT = "TAG_BACK_TO_CHANNELFRAGMENT";
public static final String TAG_BACK_TO_SEARCHFRAGMENT = "TAG_BACK_TO_SEARCHFRAGMENT";
public static final String TAG_BACK_TO_MAPFRAGMENT = "TAG_BACK_TO_MAPFRAGMENT";
public static final String TAG_BACK_TO_NEWSLISTFRAGMENT = "TAG_BACK_TO_NEWSLISTFRAGMENT";
public static final String TAG_FROM_PHOTOLISTFRAGMENT_TO_PHOTOFRAGMENT = "TAG_FROM_PHOTOLISTFRAGMENT_TO_PHOTOFRAGMENT";
public static final String TAG_FROM_ARTICLEFRAGMENT_TO_PHOTOFRAGMENT = "TAG_FROM_ARTICLEFRAGMENT_TO_PHOTOFRAGMENT";
public static final String TAG_FROM_MAPFRAGMENT_TO_ARTICLEFRAGMENT = "TAG_FROM_MAPFRAGMENT_TO_ARTICLEFRAGMENT";
public static final String TAG_FROM_CATALOGFRAGMENT_TO_ARTICLEFRAGMENT = "TAG_FROM_CATALOGFRAGMENT_TO_ARTICLEFRAGMENT";
public static final String TAG_FROM_CATALOGFRAGMENT_TO_JOURNALFRAGMENT = "TAG_FROM_CATALOGFRAGMENT_TO_JOURNALFRAGMENT";
public static final String TAG_TO_WELCOMEFRAGMENT = "WelcomeFragment";
public static final String TAG_TO_SEARCHFRAGMENT = "SearchFragment";
public static final String TAG_TO_MAINFRAGMENT = "MainFragment";
public static final String TAG_TO_MAPFRAGMENT = "MapFragment";
public static final String PREFS_MAIN = "PREFS_MAIN"; public static final String PREFS_MAIN = "PREFS_MAIN";
@ -113,8 +109,6 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
MainPageFragment mainPageFragment = null; MainPageFragment mainPageFragment = null;
NewsListFragment newsListFragment = null; NewsListFragment newsListFragment = null;
@ -139,7 +133,6 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
public BashgidSqliteHelper dbHelper = null; public BashgidSqliteHelper dbHelper = null;
public NewsDataSource newsDataSource = null;
public PhotoDataSource photoDataSource = null; public PhotoDataSource photoDataSource = null;
public AlbumDataSource albumDataSource = null; public AlbumDataSource albumDataSource = null;
public ArticleDataSource articleDataSource = null; public ArticleDataSource articleDataSource = null;
@ -151,6 +144,8 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
public TranslationDataSource translationDataSource = null; public TranslationDataSource translationDataSource = null;
public static final SimpleDateFormat iso8601Format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US);
public Handler mHandler; public Handler mHandler;
@Override @Override
@ -166,15 +161,13 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
ImageManager.getInstance().alwaysUpdateImagesWithoutHash = false; ImageManager.getInstance().alwaysUpdateImagesWithoutHash = false;
getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, new WelcomeFragment(), TAG_TO_WELCOMEFRAGMENT).commit(); getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, new WelcomeFragment(), null).commit();
instance = this; instance = this;
ContextHolder.setContext(instance); ContextHolder.setContext(instance);
dbHelper = new BashgidSqliteHelper(this); dbHelper = new BashgidSqliteHelper(this);
newsDataSource = new NewsDataSource(this, dbHelper);
photoDataSource = new PhotoDataSource(this, dbHelper); photoDataSource = new PhotoDataSource(this, dbHelper);
albumDataSource = new AlbumDataSource(this, dbHelper); albumDataSource = new AlbumDataSource(this, dbHelper);
@ -189,7 +182,6 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
translationDataSource = new TranslationDataSource(this, dbHelper); translationDataSource = new TranslationDataSource(this, dbHelper);
mHandler = new Handler(Looper.getMainLooper()) mHandler = new Handler(Looper.getMainLooper())
{ {
@Override @Override
@ -212,7 +204,7 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
break; break;
case DATABASE_GET_ALBUM_STATE_UPDATE: case DATABASE_GET_ALBUM_STATE_UPDATE:
case DATABASE_GET_ALBUM_STATE_FINISHED: case DATABASE_GET_ALBUM_STATE_FINISHED:
UpdateOnAlbumLoaded((AlbumFullData)inputMessage.obj); UpdateOnAlbumLoaded((AlbumFullData) inputMessage.obj);
break; break;
case DATABASE_GET_ALBUM_LIST_STATE_UPDATE: case DATABASE_GET_ALBUM_LIST_STATE_UPDATE:
case DATABASE_GET_ALBUM_LIST_STATE_FINISHED: case DATABASE_GET_ALBUM_LIST_STATE_FINISHED:
@ -223,20 +215,20 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
break; break;
case DATABASE_GET_ARTICLE_STATE_UPDATE: case DATABASE_GET_ARTICLE_STATE_UPDATE:
case DATABASE_GET_ARTICLE_STATE_FINISHED: case DATABASE_GET_ARTICLE_STATE_FINISHED:
UpdateOnArticleLoaded((ArticleFullData)inputMessage.obj); UpdateOnArticleLoaded((ArticleFullData) inputMessage.obj);
break; break;
case DATABASE_GET_JOURNAL_STATE_UPDATE: case DATABASE_GET_JOURNAL_STATE_UPDATE:
case DATABASE_GET_JOURNAL_STATE_FINISHED: case DATABASE_GET_JOURNAL_STATE_FINISHED:
UpdateOnJournalLoaded((JournalSemiFullData)inputMessage.obj); UpdateOnJournalLoaded((JournalSemiFullData) inputMessage.obj);
break; break;
case DATABASE_GET_CHANNEL_STATE_UPDATE: case DATABASE_GET_CHANNEL_STATE_UPDATE:
case DATABASE_GET_CHANNEL_STATE_FINISHED: case DATABASE_GET_CHANNEL_STATE_FINISHED:
UpdateOnChannelLoaded((ChannelFullData)inputMessage.obj); UpdateOnChannelLoaded((ChannelFullData) inputMessage.obj);
break; break;
case DATABASE_GET_VIDEO_STATE_UPDATE: case DATABASE_GET_VIDEO_STATE_UPDATE:
case DATABASE_GET_VIDEO_STATE_FINISHED: case DATABASE_GET_VIDEO_STATE_FINISHED:
UpdateOnVideoLoaded((VideoRecordData)inputMessage.obj); UpdateOnVideoLoaded((VideoRecordData) inputMessage.obj);
break; break;
case DATABASE_GET_JOURNAL_LIST_STATE_UPDATE: case DATABASE_GET_JOURNAL_LIST_STATE_UPDATE:
@ -244,7 +236,6 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
UpdateOnJournalListLoaded((ArrayList<JournalSemiFullData>) inputMessage.obj); UpdateOnJournalListLoaded((ArrayList<JournalSemiFullData>) inputMessage.obj);
break; break;
case DATABASE_SEARCH_ARTICLE_STATE_UPDATE: case DATABASE_SEARCH_ARTICLE_STATE_UPDATE:
case DATABASE_SEARCH_ARTICLE_STATE_FINISHED: case DATABASE_SEARCH_ARTICLE_STATE_FINISHED:
UpdateOnArticleSearchPerformed((ArrayList<ArticleShortData>) inputMessage.obj); UpdateOnArticleSearchPerformed((ArrayList<ArticleShortData>) inputMessage.obj);
@ -262,87 +253,6 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
}; };
/*
albumDataSource.CreateNewAlbum(new AlbumRecordData("TEST", "Vk Photos", "Wow"));
Date articleTestDate = new Date();
Date articleTestDate2 = new Date();
try
{
articleTestDate = ArticleManager.iso8601Format.parse("2015-05-30 9:00:00");
articleTestDate2 = ArticleManager.iso8601Format.parse("2015-05-30 9:30:00");
} catch (ParseException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
AlbumManager.DownloadAndAddPhotoToAlbum(new PhotoRecordData(
"Lilia",
"Lilia photo",
"http://pp.vk.me/c622725/v622725384/3290f/hfnoyPHe5y8.jpg",
"",
0,
0), "TEST");
AlbumManager.DownloadAndAddPhotoToAlbum(new PhotoRecordData(
"Vlad 2",
"Vlad's photo",
"http://pp.vk.me/c623226/v623226718/2af84/NeEYYIlnR-I.jpg",
"",
0,
0
), "TEST");
articleDataSource.CreateNewArticle(new ArticleRecordData(
"TESTART",
0,
"Photos",
"Wow 2 photos",
54.779610,
56.032101,
"http://www.yandex.ru/",
articleTestDate
));
articleDataSource.AddAlbumToArticle("TEST", "TESTART");
//AlbumManager.AddExistingArticleToJournal("TESTART", "news");
AlbumManager.AddExistingArticleToJournal("TESTART", "map");
AlbumManager.AddExistingArticleToJournal("TESTART", "investor");
AlbumManager.AddNewVideoToChannel(new VideoRecordData(
VideoManager.VIDEO_TYPE_YOUTUBE,
"http://www.youtube.com/watch?v=dQw4w9WgXcQ",
"Rickroll",
"Mega Rickroll",
"http://img.youtube.com/vi/dQw4w9WgXcQ/0.jpg",
""), "main");
AlbumManager.AddNewArticleToJournal(new ArticleRecordData(
"testArticle2",
ArticleManager.ARTICLE_TYPE_NORMAL,
"My article",
"Wow content lol",
0,
0,
"http://fishrungames.ru",
articleTestDate2
), "investor");
//articleDataSource.AddAlbumToArticle("TEST", "testArticle2");
//articleDataSource.AddChannelToArticle("main", "testArticle2");
translationDataSource.CreateNewTranslation(new TranslationRecordData("Wow 2 photos", "Wow 2 photos", "Вау 2 фото", "哇2张照片"));
translationDataSource.CreateNewTranslation(new TranslationRecordData("Rickroll", "Rickroll", "Рикролл", "笑话"));
*/
DownloadDatabase(); DownloadDatabase();
} }
@ -353,7 +263,7 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
} }
public void DownloadImageArr(String [] imageUrlArr) public void DownloadImageArr(String[] imageUrlArr)
{ {
Bundle innerQuery = new Bundle(); Bundle innerQuery = new Bundle();
@ -367,7 +277,7 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
task.execute(innerQuery); task.execute(innerQuery);
} }
public void DownloadImageArr(String [] imageUrlArr, String [] imageHashArr) public void DownloadImageArr(String[] imageUrlArr, String[] imageHashArr)
{ {
Bundle innerQuery = new Bundle(); Bundle innerQuery = new Bundle();
@ -384,13 +294,13 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
public void DownloadImage(String imageUrl) public void DownloadImage(String imageUrl)
{ {
this.DownloadImageArr(new String []{imageUrl}); this.DownloadImageArr(new String[] { imageUrl });
} }
public void DownloadImage(String imageUrl, String imageHash) public void DownloadImage(String imageUrl, String imageHash)
{ {
this.DownloadImageArr(new String []{imageUrl}, new String []{imageHash}); this.DownloadImageArr(new String[] { imageUrl }, new String[] { imageHash });
} }
public void DownloadDatabase() public void DownloadDatabase()
@ -421,7 +331,7 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
searchFragment = null; searchFragment = null;
catalogFragment = null; catalogFragment = null;
InputMethodManager imm = (InputMethodManager)this.getSystemService(Context.INPUT_METHOD_SERVICE); InputMethodManager imm = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(getWindow().getDecorView().getWindowToken(), 0); imm.hideSoftInputFromWindow(getWindow().getDecorView().getWindowToken(), 0);
} }
@ -512,7 +422,6 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
} }
} }
public void UpdateOnJournalLoaded(JournalSemiFullData journal) public void UpdateOnJournalLoaded(JournalSemiFullData journal)
{ {
if (journalFragment != null) if (journalFragment != null)
@ -537,9 +446,6 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
} }
public void UpdateOnChannelLoaded(ChannelFullData channel) public void UpdateOnChannelLoaded(ChannelFullData channel)
{ {
@ -549,7 +455,6 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
} }
} }
public void UpdateOnVideoLoaded(VideoRecordData video) public void UpdateOnVideoLoaded(VideoRecordData video)
{ {
@ -574,7 +479,6 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
} }
public void UpdateOnGeoJournalListLoaded(ArrayList<JournalRecordData> journalList) public void UpdateOnGeoJournalListLoaded(ArrayList<JournalRecordData> journalList)
{ {
@ -585,8 +489,6 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
} }
public void UpdateOnArticleSearchPerformed(ArrayList<ArticleShortData> articleArr) public void UpdateOnArticleSearchPerformed(ArrayList<ArticleShortData> articleArr)
{ {
@ -596,7 +498,6 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
} }
} }
public void OnSearchPressed() public void OnSearchPressed()
{ {
if (searchFragment != null) if (searchFragment != null)
@ -609,8 +510,7 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
if (journalFragment.journal == null) if (journalFragment.journal == null)
{ {
OpenSearchScreen(journalFragment.journalName, ""); OpenSearchScreen(journalFragment.journalName, "");
} } else
else
{ {
OpenSearchScreen(journalFragment.journalName, journalFragment.journal.title); OpenSearchScreen(journalFragment.journalName, journalFragment.journal.title);
} }
@ -627,7 +527,6 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
OpenSearchScreen(); OpenSearchScreen();
} }
public void OnSelectEnglish(View view) public void OnSelectEnglish(View view)
{ {
Locale.setDefault(Locale.US); Locale.setDefault(Locale.US);
@ -669,12 +568,6 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
OpenMainScreen(); OpenMainScreen();
} }
public void OnSelectSemiDetails(Integer pos)
{
// getSupportFragmentManager().beginTransaction().add(R.id.fragment_container,
// new SemiDetailsFragment()).addToBackStack(null).commit();
}
public void OpenMainScreen() public void OpenMainScreen()
{ {
ClearAllFragmentLinks(); ClearAllFragmentLinks();
@ -694,7 +587,7 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
newsListFragment = new NewsListFragment(); newsListFragment = new NewsListFragment();
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, newsListFragment).commit(); getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, newsListFragment, TAG_BACK_TO_MAINFRAGMENT).commit();
mNavigationDrawerFragment.EnableDrawer(); mNavigationDrawerFragment.EnableDrawer();
@ -707,7 +600,7 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
catalogFragment = new CatalogFragment(); catalogFragment = new CatalogFragment();
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, catalogFragment).commit(); getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, catalogFragment, TAG_BACK_TO_MAINFRAGMENT).commit();
mNavigationDrawerFragment.EnableDrawer(); mNavigationDrawerFragment.EnableDrawer();
@ -740,7 +633,7 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
searchFragment = new SearchFragment(); searchFragment = new SearchFragment();
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, searchFragment, TAG_TO_MAINFRAGMENT).commit(); getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, searchFragment, TAG_BACK_TO_MAINFRAGMENT).commit();
mNavigationDrawerFragment.EnableDrawer(); mNavigationDrawerFragment.EnableDrawer();
} }
@ -751,7 +644,7 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
searchFragment = new SearchFragment(query); searchFragment = new SearchFragment(query);
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, searchFragment, TAG_TO_MAINFRAGMENT).commit(); getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, searchFragment, TAG_BACK_TO_MAINFRAGMENT).commit();
mNavigationDrawerFragment.EnableDrawer(); mNavigationDrawerFragment.EnableDrawer();
} }
@ -762,51 +655,49 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
searchFragment = new SearchFragment(journalName, journalTitle); searchFragment = new SearchFragment(journalName, journalTitle);
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, searchFragment, TAG_TO_MAINFRAGMENT).commit(); getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, searchFragment, TAG_BACK_TO_MAINFRAGMENT).commit();
mNavigationDrawerFragment.EnableDrawer(); mNavigationDrawerFragment.EnableDrawer();
} }
public void OpenMapScreen(String filter) public void OpenSearchScreen(String query, String journalName, String journalTitle)
{
ClearAllFragmentLinks();
searchFragment = new SearchFragment(query, journalName, journalTitle);
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, searchFragment, TAG_BACK_TO_MAINFRAGMENT).commit();
mNavigationDrawerFragment.EnableDrawer();
}
public void OpenMapScreen(String filter, String tag)
{ {
ClearAllFragmentLinks(); ClearAllFragmentLinks();
mapHolderFragment = new OsmMapHolderFragment(0, filter); mapHolderFragment = new OsmMapHolderFragment(0, filter);
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, mapHolderFragment, TAG_TO_MAINFRAGMENT).commit(); getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, mapHolderFragment, tag).commit();
mNavigationDrawerFragment.EnableDrawer(); mNavigationDrawerFragment.EnableDrawer();
} }
/* public void OpenMapScreen(ArticleFullData articleFullData, String tag)
public void OpenMapScreenByArticleName(String articleName)
{
ClearAllFragmentLinks();
mapHolderFragment = new OsmMapHolderFragment(1, articleName);
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, mapHolderFragment, TAG_TO_MAINFRAGMENT).commit();
mNavigationDrawerFragment.EnableDrawer();
}*/
public void OpenMapScreen(ArticleFullData articleFullData)
{ {
ClearAllFragmentLinks(); ClearAllFragmentLinks();
mapHolderFragment = new OsmMapHolderFragment(articleFullData); mapHolderFragment = new OsmMapHolderFragment(articleFullData);
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, mapHolderFragment, TAG_TO_MAINFRAGMENT).commit(); getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, mapHolderFragment, tag).commit();
mNavigationDrawerFragment.EnableDrawer(); mNavigationDrawerFragment.EnableDrawer();
} }
public void OpenPhotoAlbumListScreen() public void OpenPhotoAlbumListScreen()
{ {
ClearAllFragmentLinks(); ClearAllFragmentLinks();
albumListFragment = new AlbumListFragment(); albumListFragment = new AlbumListFragment();
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, albumListFragment, TAG_TO_MAINFRAGMENT).commit(); getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, albumListFragment, TAG_BACK_TO_MAINFRAGMENT).commit();
mNavigationDrawerFragment.EnableDrawer(); mNavigationDrawerFragment.EnableDrawer();
} }
@ -817,12 +708,11 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
photoAlbumFragment = new PhotoAlbumFragment(albumName); photoAlbumFragment = new PhotoAlbumFragment(albumName);
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, photoAlbumFragment, TAG_TO_MAINFRAGMENT).commit(); getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, photoAlbumFragment, TAG_BACK_TO_ALBUMLISTFRAGMENT).commit();
mNavigationDrawerFragment.EnableDrawer(); mNavigationDrawerFragment.EnableDrawer();
} }
public void OpenPhotoScreen(String albumName, int position, String tag) public void OpenPhotoScreen(String albumName, int position, String tag)
{ {
ClearAllFragmentLinks(); ClearAllFragmentLinks();
@ -857,20 +747,18 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
mNavigationDrawerFragment.EnableDrawer(); mNavigationDrawerFragment.EnableDrawer();
} }
public void OpenVideoListScreen(String channelName) public void OpenVideoListScreen(String channelName)
{ {
ClearAllFragmentLinks(); ClearAllFragmentLinks();
videoListFragment = new VideoListFragment(channelName); videoListFragment = new VideoListFragment(channelName);
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, videoListFragment, TAG_TO_MAINFRAGMENT).commit(); getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, videoListFragment, TAG_BACK_TO_MAINFRAGMENT).commit();
mNavigationDrawerFragment.EnableDrawer(); mNavigationDrawerFragment.EnableDrawer();
} }
public void OpenVideoRecordScreen(VideoRecordData video, String tag) public void OpenVideoRecordScreen(VideoRecordData video)
{ {
// Xperimental -- addToBackStack provoke error "Class not found". Need // Xperimental -- addToBackStack provoke error "Class not found". Need
// to resolve somehow! // to resolve somehow!
@ -883,7 +771,7 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
videoRecordFragment = new VideoRecordFragment(video); videoRecordFragment = new VideoRecordFragment(video);
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, videoRecordFragment, tag).commit(); getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, videoRecordFragment, TAG_BACK_TO_CHANNELFRAGMENT).commit();
mNavigationDrawerFragment.EnableDrawer(); mNavigationDrawerFragment.EnableDrawer();
} }
@ -896,7 +784,6 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
} }
} }
@Override @Override
public void onAttachFragment(Fragment fragment) public void onAttachFragment(Fragment fragment)
{ {
@ -953,31 +840,22 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
{ {
OpenNewsScreen(); OpenNewsScreen();
} } else if (position == 3)
else if (position == 3)
{ {
OpenCatalogScreen(); OpenCatalogScreen();
} else if (position == 4) } else if (position == 4)
{ {
OpenMapScreen("map"); OpenMapScreen("map", MainActivity.TAG_BACK_TO_MAINFRAGMENT);
} else if (position == 5) } else if (position == 5)
{ {
OpenVideoListScreen("main"); OpenVideoListScreen("main");
} else if (position == 6) } else if (position == 6)
{ {
OpenPhotoAlbumListScreen(); OpenPhotoAlbumListScreen();
} } else if (position == 7)
/*
else if (position == 7)
{ {
//OpenBooksScreen(); OpenJournalScreen("investor", MainActivity.TAG_BACK_TO_MAINFRAGMENT);
OpenJournalScreen("books", MainActivity.TAG_TO_MAINFRAGMENT); } else if (position == 8)
}*/
else if (position == 7)
{
OpenJournalScreen("investor", MainActivity.TAG_TO_MAINFRAGMENT);
}
else if (position == 8)
{ {
OpenSettingsScreen(); OpenSettingsScreen();
} }
@ -987,90 +865,65 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
public void onBackPressed() public void onBackPressed()
{ {
if (getSupportFragmentManager().findFragmentByTag(TAG_FROM_MAINFRAGMENT_TO_NEWSRECORDFRAGMENT) != null)
{
OpenMainScreen();
if (getSupportFragmentManager().findFragmentByTag(TAG_BACK_TO_MAPFRAGMENT) != null)
{
OpenMapScreen(GetLastMapFilterName(), TAG_BACK_TO_MAINFRAGMENT);
return; return;
} }
if (getSupportFragmentManager().findFragmentByTag(TAG_FROM_VIDEOLISTFRAGMENT_TO_VIDEORECORDFRAGMENT) != null) if (getSupportFragmentManager().findFragmentByTag(TAG_BACK_TO_NEWSLISTFRAGMENT) != null)
{ {
OpenVideoListScreen("main"); OpenNewsScreen();
return; return;
} }
if (getSupportFragmentManager().findFragmentByTag(TAG_FROM_SEARCHFRAGMENT_TO_NEWSRECORDFRAGMENT) != null) if (getSupportFragmentManager().findFragmentByTag(TAG_BACK_TO_SEARCHFRAGMENT) != null)
{ {
OpenSearchScreen(); OpenSearchScreen(GetLastSearchQuery(), GetLastJournalName(), GetLastJournalTitle());
return; return;
} }
if (getSupportFragmentManager().findFragmentByTag(TAG_FROM_PHOTOLISTFRAGMENT_TO_PHOTOFRAGMENT) != null) if (getSupportFragmentManager().findFragmentByTag(TAG_BACK_TO_JOURNALFRAGMENT) != null)
{
OpenJournalScreen(GetLastJournalName(), TAG_BACK_TO_MAINFRAGMENT);
return;
}
if (getSupportFragmentManager().findFragmentByTag(TAG_BACK_TO_ARTICLEFRAGMENT) != null)
{
OpenArticleScreen(GetLastArticleName(), TAG_BACK_TO_MAINFRAGMENT);
return;
}
if (getSupportFragmentManager().findFragmentByTag(TAG_BACK_TO_ALBUMFRAGMENT) != null)
{ {
OpenPhotoAlbumScreen(GetLastAlbumName()); OpenPhotoAlbumScreen(GetLastAlbumName());
return; return;
} }
if (getSupportFragmentManager().findFragmentByTag(TAG_FROM_ARTICLEFRAGMENT_TO_PHOTOFRAGMENT) != null) if (getSupportFragmentManager().findFragmentByTag(TAG_BACK_TO_CHANNELFRAGMENT) != null)
{ {
OpenArticleScreen(GetLastArticleName(), TAG_TO_MAINFRAGMENT); OpenVideoListScreen(GetLastChannelName());
return;
}
if (getSupportFragmentManager().findFragmentByTag(TAG_FROM_MAPFRAGMENT_TO_ARTICLEFRAGMENT) != null)
{
OpenMapScreen(GetLastMapFilterName());
return; return;
} }
if (getSupportFragmentManager().findFragmentByTag(TAG_FROM_CATALOGFRAGMENT_TO_ARTICLEFRAGMENT) != null) if (getSupportFragmentManager().findFragmentByTag(TAG_BACK_TO_CATALOGFRAGMENT) != null)
{ {
OpenCatalogScreen(); OpenCatalogScreen();
return; return;
} }
if (getSupportFragmentManager().findFragmentByTag(TAG_FROM_CATALOGFRAGMENT_TO_JOURNALFRAGMENT) != null) if (getSupportFragmentManager().findFragmentByTag(TAG_BACK_TO_MAINFRAGMENT) != null)
{
OpenCatalogScreen();
return;
}
if (getSupportFragmentManager().findFragmentByTag(TAG_TO_SEARCHFRAGMENT) != null)
{ {
OpenMainScreen(); OpenMainScreen();
return; return;
} }
if (getSupportFragmentManager().findFragmentByTag(TAG_TO_MAINFRAGMENT) != null)
{
OpenMainScreen();
return;
}
if (getSupportFragmentManager().findFragmentByTag(TAG_TO_MAPFRAGMENT) != null)
{
OpenMapScreen("map");
return;
}
super.onBackPressed(); super.onBackPressed();
/*
* AddToBackStack is falling. Here is workaround
* if(getSupportFragmentManager().getBackStackEntryCount() != 0) {
* getSupportFragmentManager().popBackStack(); } else {
* super.onBackPressed(); }
*/
} }
public void SetLastAlbumName(String lastAlbumName) public void SetLastAlbumName(String lastAlbumName)
@ -1088,6 +941,21 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
return settings.getString("lastAlbumName", ""); return settings.getString("lastAlbumName", "");
} }
public void SetLastChannelName(String lastChannelName)
{
SharedPreferences settings = MainActivity.getInstance().getSharedPreferences(PREFS_MAIN, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putString("lastChannelName", lastChannelName);
editor.commit();
}
public String GetLastChannelName()
{
SharedPreferences settings = MainActivity.getInstance().getSharedPreferences(PREFS_MAIN, 0);
return settings.getString("lastChannelName", "");
}
public void SetLastArticleName(String lastArticleName) public void SetLastArticleName(String lastArticleName)
{ {
SharedPreferences settings = MainActivity.getInstance().getSharedPreferences(PREFS_MAIN, 0); SharedPreferences settings = MainActivity.getInstance().getSharedPreferences(PREFS_MAIN, 0);
@ -1103,6 +971,55 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
return settings.getString("lastArticleName", ""); return settings.getString("lastArticleName", "");
} }
public void SetLastJournalName(String lastJournalName)
{
SharedPreferences settings = MainActivity.getInstance().getSharedPreferences(PREFS_MAIN, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putString("lastJournalName", lastJournalName);
editor.commit();
}
public String GetLastJournalName()
{
SharedPreferences settings = MainActivity.getInstance().getSharedPreferences(PREFS_MAIN, 0);
return settings.getString("lastJournalName", "");
}
public void SetLastJournalTitle(String lastJournalTitle)
{
SharedPreferences settings = MainActivity.getInstance().getSharedPreferences(PREFS_MAIN, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putString("lastJournalTitle", lastJournalTitle);
editor.commit();
}
public String GetLastJournalTitle()
{
SharedPreferences settings = MainActivity.getInstance().getSharedPreferences(PREFS_MAIN, 0);
return settings.getString("lastJournalTitle", "");
}
public void SetLastSearchQuery(String searchQuery)
{
SharedPreferences settings = MainActivity.getInstance().getSharedPreferences(PREFS_MAIN, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putString("searchQuery", searchQuery);
editor.commit();
}
public String GetLastSearchQuery()
{
SharedPreferences settings = MainActivity.getInstance().getSharedPreferences(PREFS_MAIN, 0);
return settings.getString("searchQuery", "");
}
public void SetLastMapFilterName(String lastMapFilterName) public void SetLastMapFilterName(String lastMapFilterName)
{ {
SharedPreferences settings = MainActivity.getInstance().getSharedPreferences(PREFS_MAIN, 0); SharedPreferences settings = MainActivity.getInstance().getSharedPreferences(PREFS_MAIN, 0);
@ -1131,5 +1048,4 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF
super.onPause(); super.onPause();
} }
} }

View File

@ -2,15 +2,12 @@ package fishrungames.bashgid;
import java.util.ArrayList; import java.util.ArrayList;
import fishrungames.networkutils.ImageManager;
import fishrungames.bashgid.core.DatabaseGetJournalListTask; import fishrungames.bashgid.core.DatabaseGetJournalListTask;
import fishrungames.bashgid.core.DatabaseGetJournalTask; import fishrungames.bashgid.core.DatabaseGetJournalTask;
import fishrungames.bashgid.core.JournalManager; import fishrungames.bashgid.core.JournalManager;
import fishrungames.bashgid.core.JournalManager.JournalSemiFullData; import fishrungames.bashgid.core.JournalManager.JournalSemiFullData;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
@ -29,8 +26,8 @@ import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import it.sephiroth.android.library.widget.HListView; import it.sephiroth.android.library.widget.HListView;
public class MainPageFragment extends Fragment { public class MainPageFragment extends Fragment
{
ArrayList<JournalSemiFullData> journalList = new ArrayList<JournalSemiFullData>(); ArrayList<JournalSemiFullData> journalList = new ArrayList<JournalSemiFullData>();
@ -51,7 +48,8 @@ public class MainPageFragment extends Fragment {
@SuppressLint("InflateParams") @SuppressLint("InflateParams")
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
journalList.clear(); journalList.clear();
@ -72,7 +70,7 @@ public class MainPageFragment extends Fragment {
listView.setAdapter(listAdapter); listView.setAdapter(listAdapter);
progressBar = (ProgressBar)header.findViewById(R.id.progressBar); progressBar = (ProgressBar) header.findViewById(R.id.progressBar);
progressBar.setVisibility(View.VISIBLE); progressBar.setVisibility(View.VISIBLE);
@ -86,8 +84,7 @@ public class MainPageFragment extends Fragment {
{ {
MainActivity.getInstance().OpenNewsScreen(); MainActivity.getInstance().OpenNewsScreen();
} }
} });
);
searchEditText = (EditText) header.findViewById(R.id.searchEditText); searchEditText = (EditText) header.findViewById(R.id.searchEditText);
@ -102,14 +99,13 @@ public class MainPageFragment extends Fragment {
String query = searchEditText.getText().toString(); String query = searchEditText.getText().toString();
MainActivity.getInstance().OpenSearchScreen(query); MainActivity.getInstance().OpenSearchScreen(query);
} }
} });
);
return rootView; return rootView;
} }
@Override @Override
public void onDestroyView () public void onDestroyView()
{ {
if (databaseGetJournalTask != null) if (databaseGetJournalTask != null)
{ {
@ -126,7 +122,6 @@ public class MainPageFragment extends Fragment {
super.onDestroyView(); super.onDestroyView();
} }
void RestoreJournal() void RestoreJournal()
{ {
newsJournal = JournalManager.CreateEmptyJournal(); newsJournal = JournalManager.CreateEmptyJournal();
@ -158,69 +153,56 @@ public class MainPageFragment extends Fragment {
{ {
databaseGetJournalTask = null; databaseGetJournalTask = null;
//Xperimental // Xperimental
if (journal != null) if (journal != null)
{ {
progressBar.setVisibility(View.GONE); progressBar.setVisibility(View.GONE);
newsJournal = journal; newsJournal = journal;
//ImageButton news1ImageButton = (ImageButton) header.findViewById(R.id.news1ImageButton); Button news1Button = (Button) header.findViewById(R.id.news1Button);
//ImageButton news2ImageButton = (ImageButton) header.findViewById(R.id.news2ImageButton); Button news2Button = (Button) header.findViewById(R.id.news2Button);
//ImageButton news3ImageButton = (ImageButton) header.findViewById(R.id.news3ImageButton); Button news3Button = (Button) header.findViewById(R.id.news3Button);
Button news1Button = (Button)header.findViewById(R.id.news1Button);
Button news2Button = (Button)header.findViewById(R.id.news2Button);
Button news3Button = (Button)header.findViewById(R.id.news3Button);
if (newsJournal.articleArr.size() > 0) if (newsJournal.articleArr.size() > 0)
{ {
//ImageManager.getInstance().ApplyImageToImageView(news1ImageButton, newsJournal.articleArr.get(0).previewImageUrl);
news1Button.setText(newsJournal.articleArr.get(0).title); 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)); news1Button.setOnClickListener(new NewsButtonOnClickListener(newsJournal.articleArr.get(0).name));
} } else
else
{ {
//news1ImageButton.setImageResource(R.drawable.transparent);
news1Button.setText(R.string.news_record_not_available); news1Button.setText(R.string.news_record_not_available);
//news1ImageButton.setOnClickListener(null);
news1Button.setOnClickListener(null); news1Button.setOnClickListener(null);
} }
if (newsJournal.articleArr.size() > 1) if (newsJournal.articleArr.size() > 1)
{ {
//ImageManager.getInstance().ApplyImageToImageView(news2ImageButton, newsJournal.articleArr.get(1).previewImageUrl);
news2Button.setText(newsJournal.articleArr.get(1).title); 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)); news2Button.setOnClickListener(new NewsButtonOnClickListener(newsJournal.articleArr.get(1).name));
} } else
else
{ {
//news2ImageButton.setImageResource(R.drawable.transparent);
news2Button.setText(R.string.news_record_not_available); news2Button.setText(R.string.news_record_not_available);
//news2ImageButton.setOnClickListener(null);
news2Button.setOnClickListener(null); news2Button.setOnClickListener(null);
} }
if (newsJournal.articleArr.size() > 2) if (newsJournal.articleArr.size() > 2)
{ {
//ImageManager.getInstance().ApplyImageToImageView(news3ImageButton, newsJournal.articleArr.get(2).previewImageUrl);
news3Button.setText(newsJournal.articleArr.get(2).title); 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)); news3Button.setOnClickListener(new NewsButtonOnClickListener(newsJournal.articleArr.get(2).name));
} } else
else
{ {
//news3ImageButton.setImageResource(R.drawable.transparent);
news3Button.setText(R.string.news_record_not_available); news3Button.setText(R.string.news_record_not_available);
//news3ImageButton.setOnClickListener(null);
news3Button.setOnClickListener(null); news3Button.setOnClickListener(null);
} }
listAdapter.notifyDataSetChanged(); listAdapter.notifyDataSetChanged();
} }
@ -259,38 +241,44 @@ public class MainPageFragment extends Fragment {
listAdapter.notifyDataSetChanged(); listAdapter.notifyDataSetChanged();
} }
public class ListAdapter extends BaseAdapter
public class ListAdapter extends BaseAdapter { {
private Context mContext; private Context mContext;
public ListAdapter(Context c) { public ListAdapter(Context c)
{
mContext = c; mContext = c;
} }
public int getCount() { public int getCount()
{
return journalList.size(); return journalList.size();
} }
public Object getItem(int position) { public Object getItem(int position)
{
return null; return null;
} }
public long getItemId(int position) { public long getItemId(int position)
{
return 0; return 0;
} }
// create a new ImageView for each item referenced by the Adapter // create a new ImageView for each item referenced by the Adapter
@SuppressLint("InflateParams") @SuppressLint("InflateParams")
public View getView(final int position, View convertView, ViewGroup parent) { public View getView(final int position, View convertView, ViewGroup parent)
{
View view; View view;
if (convertView == null) { // if it's not recycled, initialize some attributes if (convertView == null)
{ // if it's not recycled, initialize some attributes
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.main_page_list_element, null); view = inflater.inflate(R.layout.main_page_list_element, null);
} else
} else { {
view = convertView; view = convertView;
} }
@ -312,14 +300,11 @@ public class MainPageFragment extends Fragment {
descriptionTextView.setText(journalList.get(position).description); descriptionTextView.setText(journalList.get(position).description);
descriptionTextView.setVisibility(View.VISIBLE); descriptionTextView.setVisibility(View.VISIBLE);
} } else
else
{ {
descriptionTextView.setVisibility(View.GONE); descriptionTextView.setVisibility(View.GONE);
} }
button.setText(R.string.see_all); button.setText(R.string.see_all);
button.setOnClickListener(new OnClickListener() button.setOnClickListener(new OnClickListener()
@ -331,7 +316,7 @@ public class MainPageFragment extends Fragment {
{ {
databaseGetJournalTask.cancel(false); databaseGetJournalTask.cancel(false);
} }
MainActivity.getInstance().OpenJournalScreen(journalList.get(position).name, MainActivity.TAG_TO_MAINFRAGMENT); MainActivity.getInstance().OpenJournalScreen(journalList.get(position).name, MainActivity.TAG_BACK_TO_MAINFRAGMENT);
} }
}); });
@ -344,17 +329,15 @@ public class MainPageFragment extends Fragment {
{ {
databaseGetJournalTask.cancel(false); databaseGetJournalTask.cancel(false);
} }
MainActivity.getInstance().OpenJournalScreen(journalList.get(position).name, MainActivity.TAG_TO_MAINFRAGMENT); MainActivity.getInstance().OpenJournalScreen(journalList.get(position).name, MainActivity.TAG_BACK_TO_MAINFRAGMENT);
} }
}); });
return view; return view;
} }
} }
public class NewsButtonOnClickListener implements OnClickListener public class NewsButtonOnClickListener implements OnClickListener
{ {
@ -373,9 +356,8 @@ public class MainPageFragment extends Fragment {
databaseGetJournalTask.cancel(false); databaseGetJournalTask.cancel(false);
databaseGetJournalTask = null; databaseGetJournalTask = null;
} }
//MainActivity.getInstance().OpenNewsRecordScreen(articleName, MainActivity.TAG_FROM_MAINFRAGMENT_TO_NEWSRECORDFRAGMENT);
MainActivity.getInstance().OpenArticleScreen(articleName, MainActivity.TAG_TO_MAINFRAGMENT);
MainActivity.getInstance().OpenArticleScreen(articleName, MainActivity.TAG_BACK_TO_MAINFRAGMENT);
} }

View File

@ -1,12 +1,8 @@
package fishrungames.bashgid; package fishrungames.bashgid;
import java.util.ArrayList;
import fishrungames.bashgid.core.AlbumManager.AlbumFullData; import fishrungames.bashgid.core.AlbumManager.AlbumFullData;
import fishrungames.bashgid.core.HtmlDownloadManager;
import fishrungames.bashgid.core.JournalManager.JournalSemiFullData; import fishrungames.bashgid.core.JournalManager.JournalSemiFullData;
import fishrungames.bashgid.core.HtmlDownloadManager.TextFileRecord;
import fishrungames.networkutils.ImageManager; import fishrungames.networkutils.ImageManager;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
@ -17,111 +13,107 @@ import android.view.View.OnClickListener;
import android.widget.BaseAdapter; import android.widget.BaseAdapter;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
public class MainPageHListViewAdapters { public class MainPageHListViewAdapters
{
public static class PhotoAlbumElementAdapter extends BaseAdapter
{
public static class PhotoAlbumElementAdapter extends BaseAdapter {
private Context mContext; private Context mContext;
//String albumName;
AlbumFullData albumFullData;
//ArrayList<TextFileRecord> localHtmlList;
public PhotoAlbumElementAdapter(Context c, AlbumFullData albumFullData) { AlbumFullData albumFullData;
public PhotoAlbumElementAdapter(Context c, AlbumFullData albumFullData)
{
this.mContext = c; this.mContext = c;
this.albumFullData = albumFullData; this.albumFullData = albumFullData;
//localHtmlList = HtmlDownloadManager.getInstance().getGlobalHtmlList();
} }
public int getCount() { public int getCount()
{
return albumFullData.photoRecordArr.size(); return albumFullData.photoRecordArr.size();
} }
public Object getItem(int position) { public Object getItem(int position)
{
return null; return null;
} }
public long getItemId(int position) { public long getItemId(int position)
{
return 0; return 0;
} }
// create a new ImageView for each item referenced by the Adapter // create a new ImageView for each item referenced by the Adapter
@SuppressLint("InflateParams") @SuppressLint("InflateParams")
public View getView(int position, View convertView, ViewGroup parent) { public View getView(int position, View convertView, ViewGroup parent)
{
View view; View view;
if (convertView == null) { // if it's not recycled, initialize some attributes if (convertView == null)
{ // if it's not recycled, initialize some attributes
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.article_album_element_item, null); view = inflater.inflate(R.layout.article_album_element_item, null);
} else
} else { {
view = convertView; 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); 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); ImageManager.getInstance().ApplyImageToImageView(imageView, albumFullData.photoRecordArr.get(position).imageUrl);
//imageButton.setOnClickListener(new ContentButtonOnClickListener(localHtmlList.get(position)));
return view; return view;
} }
} }
public static class JournalElementAdapter extends BaseAdapter { public static class JournalElementAdapter extends BaseAdapter
{
private Context mContext; private Context mContext;
//String albumName;
JournalSemiFullData journal;
//ArrayList<TextFileRecord> localHtmlList;
public JournalElementAdapter(Context c, JournalSemiFullData journal) { JournalSemiFullData journal;
public JournalElementAdapter(Context c, JournalSemiFullData journal)
{
this.mContext = c; this.mContext = c;
this.journal = journal; this.journal = journal;
//localHtmlList = HtmlDownloadManager.getInstance().getGlobalHtmlList();
} }
public int getCount() { public int getCount()
{
return journal.articleArr.size(); return journal.articleArr.size();
} }
public Object getItem(int position) { public Object getItem(int position)
{
return null; return null;
} }
public long getItemId(int position) { public long getItemId(int position)
{
return 0; return 0;
} }
// create a new ImageView for each item referenced by the Adapter // create a new ImageView for each item referenced by the Adapter
@SuppressLint("InflateParams") @SuppressLint("InflateParams")
public View getView(final int position, View convertView, ViewGroup parent) { public View getView(final int position, View convertView, ViewGroup parent)
{
View view; View view;
if (convertView == null) { // if it's not recycled, initialize some attributes if (convertView == null)
{ // if it's not recycled, initialize some attributes
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.simple_hview_list_element, null); view = inflater.inflate(R.layout.simple_hview_list_element, null);
} else
} else { {
view = convertView; view = convertView;
} }
@ -131,7 +123,6 @@ public static class JournalElementAdapter extends BaseAdapter {
ImageButton imageButton = (ImageButton) view.findViewById(R.id.imageButton); ImageButton imageButton = (ImageButton) view.findViewById(R.id.imageButton);
textView.setText(journal.articleArr.get(position).title); textView.setText(journal.articleArr.get(position).title);
subTextView.setText(journal.articleArr.get(position).dateTime.toString()); subTextView.setText(journal.articleArr.get(position).dateTime.toString());
@ -146,7 +137,8 @@ public static class JournalElementAdapter extends BaseAdapter {
@Override @Override
public void onClick(View v) public void onClick(View v)
{ {
MainActivity.getInstance().OpenArticleScreen(journal.articleArr.get(position).name, MainActivity.TAG_FROM_CATALOGFRAGMENT_TO_ARTICLEFRAGMENT); MainActivity.getInstance().OpenArticleScreen(journal.articleArr.get(position).name,
MainActivity.TAG_BACK_TO_MAINFRAGMENT);
} }
}); });
@ -156,127 +148,4 @@ public static class JournalElementAdapter extends BaseAdapter {
} }
/*
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;
}
}*/
} }

View File

@ -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);
}
});
}
}

View File

@ -1,6 +1,5 @@
package fishrungames.bashgid; package fishrungames.bashgid;
import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBar;
@ -29,11 +28,14 @@ import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
/** /**
* Fragment used for managing interactions for and presentation of a navigation drawer. * Fragment used for managing interactions for and presentation of a navigation
* See the <a href="https://developer.android.com/design/patterns/navigation-drawer.html#Interaction"> * drawer. See the <a href=
* design guidelines</a> for a complete explanation of the behaviors implemented here. * "https://developer.android.com/design/patterns/navigation-drawer.html#Interaction"
* > design guidelines</a> for a complete explanation of the behaviors
* implemented here.
*/ */
public class NavigationDrawerFragment extends Fragment { public class NavigationDrawerFragment extends Fragment
{
/** /**
* Remember the position of the selected item. * Remember the position of the selected item.
@ -41,8 +43,8 @@ public class NavigationDrawerFragment extends Fragment {
private static final String STATE_SELECTED_POSITION = "selected_navigation_drawer_position"; private static final String STATE_SELECTED_POSITION = "selected_navigation_drawer_position";
/** /**
* Per the design guidelines, you should show the drawer on launch until the user manually * Per the design guidelines, you should show the drawer on launch until the
* expands it. This shared preference tracks this. * user manually expands it. This shared preference tracks this.
*/ */
private static final String PREF_USER_LEARNED_DRAWER = "navigation_drawer_learned"; private static final String PREF_USER_LEARNED_DRAWER = "navigation_drawer_learned";
@ -66,22 +68,27 @@ public class NavigationDrawerFragment extends Fragment {
private DrawerAdapter drawerAdapter; private DrawerAdapter drawerAdapter;
public NavigationDrawerFragment() { public NavigationDrawerFragment()
{
} }
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
// Read in the flag indicating whether or not the user has demonstrated awareness of the // Read in the flag indicating whether or not the user has demonstrated
// awareness of the
// drawer. See PREF_USER_LEARNED_DRAWER for details. // drawer. See PREF_USER_LEARNED_DRAWER for details.
//SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity()); // SharedPreferences sp =
// PreferenceManager.getDefaultSharedPreferences(getActivity());
//Don't need this shit // Don't need this shit
//mUserLearnedDrawer = sp.getBoolean(PREF_USER_LEARNED_DRAWER, false); // mUserLearnedDrawer = sp.getBoolean(PREF_USER_LEARNED_DRAWER, false);
mUserLearnedDrawer = true; mUserLearnedDrawer = true;
if (savedInstanceState != null) { if (savedInstanceState != null)
{
mCurrentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION); mCurrentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION);
mFromSavedInstanceState = true; mFromSavedInstanceState = true;
} }
@ -92,25 +99,27 @@ public class NavigationDrawerFragment extends Fragment {
} }
@Override @Override
public void onActivityCreated (Bundle savedInstanceState) { public void onActivityCreated(Bundle savedInstanceState)
{
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
// Indicate that this fragment would like to influence the set of actions in the action bar. // Indicate that this fragment would like to influence the set of
// actions in the action bar.
setHasOptionsMenu(true); setHasOptionsMenu(true);
} }
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
Bundle savedInstanceState) { {
mDrawerListView = (ListView) inflater.inflate( mDrawerListView = (ListView) inflater.inflate(R.layout.fragment_navigation_drawer, container, false);
R.layout.fragment_navigation_drawer, container, false); mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener()
mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { {
@Override @Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{
selectItem(position); selectItem(position);
} }
}); });
drawerAdapter = new DrawerAdapter(getActivity()); drawerAdapter = new DrawerAdapter(getActivity());
mDrawerListView.setAdapter(drawerAdapter); mDrawerListView.setAdapter(drawerAdapter);
@ -119,29 +128,32 @@ public class NavigationDrawerFragment extends Fragment {
return mDrawerListView; return mDrawerListView;
} }
public boolean isDrawerOpen() { public boolean isDrawerOpen()
{
return mDrawerLayout != null && mDrawerLayout.isDrawerOpen(mFragmentContainerView); return mDrawerLayout != null && mDrawerLayout.isDrawerOpen(mFragmentContainerView);
} }
public void EnableDrawer() public void EnableDrawer()
{ {
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED); mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
} }
/** /**
* Users of this fragment must call this method to set up the navigation drawer interactions. * 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 fragmentId
* @param drawerLayout The DrawerLayout containing this fragment's UI. * 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) { public void setUp(int fragmentId, DrawerLayout drawerLayout)
{
mFragmentContainerView = getActivity().findViewById(fragmentId); mFragmentContainerView = getActivity().findViewById(fragmentId);
mDrawerLayout = drawerLayout; mDrawerLayout = drawerLayout;
// set a custom shadow that overlays the main content when the drawer
// set a custom shadow that overlays the main content when the drawer opens // opens
mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
// set up the drawer's list view with items and click listener // set up the drawer's list view with items and click listener
@ -152,52 +164,69 @@ public class NavigationDrawerFragment extends Fragment {
// ActionBarDrawerToggle ties together the the proper interactions // ActionBarDrawerToggle ties together the the proper interactions
// between the navigation drawer and the action bar app icon. // between the navigation drawer and the action bar app icon.
mDrawerToggle = new ActionBarDrawerToggle( mDrawerToggle = new ActionBarDrawerToggle(getActivity(), /* host Activity */
getActivity(), /* host Activity */
mDrawerLayout, /* DrawerLayout object */ mDrawerLayout, /* DrawerLayout object */
R.string.navigation_drawer_open, /* "open drawer" description for accessibility */ R.string.navigation_drawer_open, /*
R.string.navigation_drawer_close /* "close drawer" description for accessibility */ * "open drawer" description for
) { * accessibility
*/
R.string.navigation_drawer_close /*
* "close drawer" description for
* accessibility
*/
)
{
@Override @Override
public void onDrawerClosed(View drawerView) { public void onDrawerClosed(View drawerView)
{
super.onDrawerClosed(drawerView); super.onDrawerClosed(drawerView);
if (!isAdded()) { if (!isAdded())
{
return; return;
} }
//getActivity().supportInvalidateOptionsMenu(); // calls onPrepareOptionsMenu() // getActivity().supportInvalidateOptionsMenu(); // calls
// onPrepareOptionsMenu()
} }
@Override @Override
public void onDrawerOpened(View drawerView) { public void onDrawerOpened(View drawerView)
{
super.onDrawerOpened(drawerView); super.onDrawerOpened(drawerView);
if (!isAdded()) { if (!isAdded())
{
return; return;
} }
if (!mUserLearnedDrawer) { if (!mUserLearnedDrawer)
// The user manually opened the drawer; store this flag to prevent auto-showing {
// The user manually opened the drawer; store this flag to
// prevent auto-showing
// the navigation drawer automatically in the future. // the navigation drawer automatically in the future.
mUserLearnedDrawer = true; mUserLearnedDrawer = true;
SharedPreferences sp = PreferenceManager SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
.getDefaultSharedPreferences(getActivity());
sp.edit().putBoolean(PREF_USER_LEARNED_DRAWER, true).commit(); sp.edit().putBoolean(PREF_USER_LEARNED_DRAWER, true).commit();
} }
//getActivity().supportInvalidateOptionsMenu(); // calls onPrepareOptionsMenu() // getActivity().supportInvalidateOptionsMenu(); // calls
// onPrepareOptionsMenu()
} }
}; };
// If the user hasn't 'learned' about the drawer, open it to introduce them to the drawer, // If the user hasn't 'learned' about the drawer, open it to introduce
// them to the drawer,
// per the navigation drawer design guidelines. // per the navigation drawer design guidelines.
if (!mUserLearnedDrawer && !mFromSavedInstanceState) { if (!mUserLearnedDrawer && !mFromSavedInstanceState)
{
mDrawerLayout.openDrawer(mFragmentContainerView); mDrawerLayout.openDrawer(mFragmentContainerView);
} }
// Defer code dependent on restoration of previous instance state. // Defer code dependent on restoration of previous instance state.
mDrawerLayout.post(new Runnable() { mDrawerLayout.post(new Runnable()
{
@Override @Override
public void run() { public void run()
{
mDrawerToggle.syncState(); mDrawerToggle.syncState();
} }
}); });
@ -210,52 +239,65 @@ public class NavigationDrawerFragment extends Fragment {
} }
private void selectItem(int position) { private void selectItem(int position)
{
mCurrentSelectedPosition = position; mCurrentSelectedPosition = position;
if (mDrawerListView != null) { if (mDrawerListView != null)
{
mDrawerListView.setItemChecked(position, true); mDrawerListView.setItemChecked(position, true);
} }
if (mDrawerLayout != null) { if (mDrawerLayout != null)
{
mDrawerLayout.closeDrawer(mFragmentContainerView); mDrawerLayout.closeDrawer(mFragmentContainerView);
} }
if (mCallbacks != null) { if (mCallbacks != null)
{
mCallbacks.onNavigationDrawerItemSelected(position); mCallbacks.onNavigationDrawerItemSelected(position);
} }
} }
@Override @Override
public void onAttach(Activity activity) { public void onAttach(Activity activity)
{
super.onAttach(activity); super.onAttach(activity);
try { try
{
mCallbacks = (NavigationDrawerCallbacks) activity; mCallbacks = (NavigationDrawerCallbacks) activity;
} catch (ClassCastException e) { } catch (ClassCastException e)
{
throw new ClassCastException("Activity must implement NavigationDrawerCallbacks."); throw new ClassCastException("Activity must implement NavigationDrawerCallbacks.");
} }
} }
@Override @Override
public void onDetach() { public void onDetach()
{
super.onDetach(); super.onDetach();
mCallbacks = null; mCallbacks = null;
} }
@Override @Override
public void onSaveInstanceState(Bundle outState) { public void onSaveInstanceState(Bundle outState)
{
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
outState.putInt(STATE_SELECTED_POSITION, mCurrentSelectedPosition); outState.putInt(STATE_SELECTED_POSITION, mCurrentSelectedPosition);
} }
@Override @Override
public void onConfigurationChanged(Configuration newConfig) { public void onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);
// Forward the new configuration the drawer toggle component. // Forward the new configuration the drawer toggle component.
mDrawerToggle.onConfigurationChanged(newConfig); mDrawerToggle.onConfigurationChanged(newConfig);
} }
@Override @Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { 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. // 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(); showGlobalContextActionBar();
@ -264,14 +306,17 @@ public class NavigationDrawerFragment extends Fragment {
} }
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item)
{
//Xperimental -- check if we need options or not // Xperimental -- check if we need options or not
if (mDrawerToggle.onOptionsItemSelected(item)) { if (mDrawerToggle.onOptionsItemSelected(item))
{
return true; return true;
} }
if (item.getItemId() == R.id.action_search) { if (item.getItemId() == R.id.action_search)
{
return true; return true;
} }
@ -280,89 +325,77 @@ public class NavigationDrawerFragment extends Fragment {
} }
/** /**
* Per the navigation drawer design guidelines, updates the action bar to show the global app * Per the navigation drawer design guidelines, updates the action bar to
* 'context', rather than just what's in the current screen. * show the global app 'context', rather than just what's in the current
* screen.
*/ */
private void showGlobalContextActionBar() { private void showGlobalContextActionBar()
{
ActionBar actionBar = getActionBar(); ActionBar actionBar = getActionBar();
actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayShowTitleEnabled(true);
//actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); // actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
actionBar.setTitle(R.string.app_name); actionBar.setTitle(R.string.app_name);
} }
private ActionBar getActionBar() { private ActionBar getActionBar()
{
return ((ActionBarActivity) getActivity()).getSupportActionBar(); return ((ActionBarActivity) getActivity()).getSupportActionBar();
} }
/** /**
* Callbacks interface that all activities using this fragment must implement. * Callbacks interface that all activities using this fragment must
* implement.
*/ */
public static interface NavigationDrawerCallbacks { public static interface NavigationDrawerCallbacks
{
/** /**
* Called when an item in the navigation drawer is selected. * Called when an item in the navigation drawer is selected.
*/ */
void onNavigationDrawerItemSelected(int position); void onNavigationDrawerItemSelected(int position);
} }
public class DrawerAdapter extends BaseAdapter
{
public class DrawerAdapter extends BaseAdapter {
private Context mContext; 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 [] titles = { final int[] iconIds = { R.drawable.drawer_bashgid_logo, R.drawable.drawer_agenda, R.drawable.drawer_news, R.drawable.drawer_bookmark,
R.string.drawer_header, R.drawable.drawer_pushpin, R.drawable.drawer_tv, R.drawable.drawer_photography, R.drawable.drawer_id, R.drawable.drawer_gear };
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 = { public DrawerAdapter(Context c)
R.drawable.drawer_bashgid_logo, {
R.drawable.drawer_agenda,
R.drawable.drawer_news,
R.drawable.drawer_bookmark,
R.drawable.drawer_pushpin,
R.drawable.drawer_tv,
R.drawable.drawer_photography,
//R.drawable.drawer_books,
R.drawable.drawer_id,
R.drawable.drawer_gear
};
public DrawerAdapter(Context c) {
mContext = c; mContext = c;
} }
public int getCount() { public int getCount()
{
return titles.length; return titles.length;
} }
public Object getItem(int position) { public Object getItem(int position)
{
return null; return null;
} }
public long getItemId(int position) { public long getItemId(int position)
{
return 0; return 0;
} }
// create a new ImageView for each item referenced by the Adapter // create a new ImageView for each item referenced by the Adapter
public View getView(int position, View convertView, ViewGroup parent) { public View getView(int position, View convertView, ViewGroup parent)
{
View view; View view;
if (convertView == null) { // if it's not recycled, initialize some attributes if (convertView == null)
{ // if it's not recycled, initialize some attributes
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.drawer_list_element, null); view = inflater.inflate(R.layout.drawer_list_element, null);
} else
} else { {
view = convertView; view = convertView;
} }
@ -374,20 +407,21 @@ public class NavigationDrawerFragment extends Fragment {
imageView.setImageResource(iconIds[position]); imageView.setImageResource(iconIds[position]);
int drawerImageSize = (int) mContext.getResources().getDimension(R.dimen.drawer_image_size);
if (position == 0) if (position == 0)
{ {
LayoutParams params = imageView.getLayoutParams(); LayoutParams params = imageView.getLayoutParams();
params.width = 96; params.width = drawerImageSize * 2;
params.height = 96; params.height = drawerImageSize * 2;
imageView.setLayoutParams(params); imageView.setLayoutParams(params);
textView.setTypeface(null, Typeface.BOLD); textView.setTypeface(null, Typeface.BOLD);
} } else
else
{ {
LayoutParams params = imageView.getLayoutParams(); LayoutParams params = imageView.getLayoutParams();
params.width = 48; params.width = drawerImageSize;
params.height = 48; params.height = drawerImageSize;
imageView.setLayoutParams(params); imageView.setLayoutParams(params);
textView.setTypeface(null, Typeface.NORMAL); textView.setTypeface(null, Typeface.NORMAL);

View File

@ -1,38 +1,33 @@
package fishrungames.bashgid; package fishrungames.bashgid;
import java.util.Collections; import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set; import java.util.Set;
import java.util.TreeSet; import java.util.TreeSet;
import fishrungames.networkutils.ImageManager;
import fishrungames.bashgid.core.ArticleManager; import fishrungames.bashgid.core.ArticleManager;
import fishrungames.bashgid.core.ArticleManager.ArticleRecordData;
import fishrungames.bashgid.core.ArticleManager.ArticleShortData; import fishrungames.bashgid.core.ArticleManager.ArticleShortData;
import fishrungames.bashgid.core.DatabaseGetJournalTask; import fishrungames.bashgid.core.DatabaseGetJournalTask;
import fishrungames.bashgid.core.JournalManager; import fishrungames.bashgid.core.JournalManager;
import fishrungames.bashgid.core.JournalManager.JournalSemiFullData; import fishrungames.bashgid.core.JournalManager.JournalSemiFullData;
import fishrungames.bashgid.core.NewsManager.NewsRecord;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.BaseAdapter; import android.widget.BaseAdapter;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.ListView; import android.widget.ListView;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemClickListener;
public class NewsListFragment extends Fragment public class NewsListFragment extends Fragment
{ {
@ -48,8 +43,10 @@ public class NewsListFragment extends Fragment
DatabaseGetJournalTask databaseGetJournalTask = null; DatabaseGetJournalTask databaseGetJournalTask = null;
@SuppressLint("InflateParams") @Override @SuppressLint("InflateParams")
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
RestoreJournal(); RestoreJournal();
@ -61,36 +58,35 @@ public class NewsListFragment extends Fragment
listView.addHeaderView(header); listView.addHeaderView(header);
progressBar = (ProgressBar)header.findViewById(R.id.progressBar); progressBar = (ProgressBar) header.findViewById(R.id.progressBar);
progressBar.setVisibility(View.VISIBLE); progressBar.setVisibility(View.VISIBLE);
View footer = inflater.inflate(R.layout.news_page_list_footer, null); View footer = inflater.inflate(R.layout.news_page_list_footer, null);
listView.addFooterView(footer); listView.addFooterView(footer);
footerTextView = (TextView)footer.findViewById(R.id.footerTextView); footerTextView = (TextView) footer.findViewById(R.id.footerTextView);
listAdapter = new ListAdapter(getActivity()); listAdapter = new ListAdapter(getActivity());
listView.setAdapter(listAdapter); listView.setAdapter(listAdapter);
listView.setOnItemClickListener(new OnItemClickListener()
listView.setOnItemClickListener(new OnItemClickListener(){ {
@Override @Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{ {
//Add position + 1, because first element of list is always title // Add position + 1, because first element of list is always
// title
if (position == journal.articleArr.size() + 1) if (position == journal.articleArr.size() + 1)
{ {
footerTextView.setText(R.string.news_are_loading); footerTextView.setText(R.string.news_are_loading);
LoadMoreNews(); LoadMoreNews();
} } else if (position > 0)
else if (position > 0)
{ {
MainActivity.getInstance().OpenArticleScreen(journal.articleArr.get(position-1).name, MainActivity.TAG_TO_MAINFRAGMENT); MainActivity.getInstance().OpenArticleScreen(journal.articleArr.get(position - 1).name, MainActivity.TAG_BACK_TO_NEWSLISTFRAGMENT);
} }
} }
@ -101,7 +97,7 @@ public class NewsListFragment extends Fragment
} }
@Override @Override
public void onDestroyView () public void onDestroyView()
{ {
if (databaseGetJournalTask != null) if (databaseGetJournalTask != null)
@ -155,7 +151,7 @@ public class NewsListFragment extends Fragment
bundle.putString("journalName", "news"); bundle.putString("journalName", "news");
bundle.putString("startAfterArticleName", journal.articleArr.get(journal.articleArr.size()-1).name); bundle.putString("startAfterArticleName", journal.articleArr.get(journal.articleArr.size() - 1).name);
bundle.putInt("count", 10); bundle.putInt("count", 10);
@ -166,7 +162,6 @@ public class NewsListFragment extends Fragment
{ {
progressBar.setVisibility(View.GONE); progressBar.setVisibility(View.GONE);
this.journal.articleArr.addAll(journal.articleArr); this.journal.articleArr.addAll(journal.articleArr);
Set<ArticleShortData> articleSet = new TreeSet<ArticleShortData>(new ArticleManager.ArticleShortDataSortComparator()); Set<ArticleShortData> articleSet = new TreeSet<ArticleShortData>(new ArticleManager.ArticleShortDataSortComparator());
@ -176,75 +171,63 @@ public class NewsListFragment extends Fragment
Collections.sort(this.journal.articleArr, new ArticleManager.ArticleShortDataTimeSortComparator()); Collections.sort(this.journal.articleArr, new ArticleManager.ArticleShortDataTimeSortComparator());
//this.journal.previewImageArr.addAll(journal.previewImageArr);
footerTextView.setText(R.string.news_load_more); footerTextView.setText(R.string.news_load_more);
listAdapter.notifyDataSetChanged(); listAdapter.notifyDataSetChanged();
} }
public class ListAdapter extends BaseAdapter
public class ListAdapter extends BaseAdapter { {
private Context mContext; private Context mContext;
public ListAdapter(Context c) { public ListAdapter(Context c)
{
mContext = c; mContext = c;
} }
public int getCount() { public int getCount()
{
return journal.articleArr.size(); return journal.articleArr.size();
} }
public Object getItem(int position) { public Object getItem(int position)
{
return null; return null;
} }
public long getItemId(int position) { public long getItemId(int position)
{
return 0; return 0;
} }
// create a new ImageView for each item referenced by the Adapter // create a new ImageView for each item referenced by the Adapter
@SuppressLint("InflateParams") @SuppressLint("InflateParams")
public View getView(int position, View convertView, ViewGroup parent) { public View getView(int position, View convertView, ViewGroup parent)
{
View view; View view;
if (convertView == null) { // if it's not recycled, initialize some attributes if (convertView == null)
{ // if it's not recycled, initialize some attributes
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.news_page_list_element, null); view = inflater.inflate(R.layout.news_page_list_element, null);
} else
} else { {
view = convertView; view = convertView;
} }
TextView titleTextView = (TextView)view.findViewById(R.id.titleTextView); TextView titleTextView = (TextView) view.findViewById(R.id.titleTextView);
titleTextView.setText(journal.articleArr.get(position).title); titleTextView.setText(journal.articleArr.get(position).title);
TextView dateTextView = (TextView)view.findViewById(R.id.dateTextView); TextView dateTextView = (TextView) view.findViewById(R.id.dateTextView);
dateTextView.setText(journal.articleArr.get(position).dateTime.toString()); 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; return view;
} }
} }
} }

View File

@ -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);
}
}

View File

@ -128,7 +128,6 @@ public class OsmMapHolderFragment extends Fragment
DetailsOverlayItem item = mOverlayItems.get(index); DetailsOverlayItem item = mOverlayItems.get(index);
AlertDialog.Builder dialog = new AlertDialog.Builder(MainActivity.getInstance()); AlertDialog.Builder dialog = new AlertDialog.Builder(MainActivity.getInstance());
dialog.setTitle(item.getTitle()); dialog.setTitle(item.getTitle());
// dialog.setMessage(item.getSnippet());
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
@ -216,9 +215,15 @@ public class OsmMapHolderFragment extends Fragment
dialog.setPositiveButton(R.string.dialog_open, new DialogInterface.OnClickListener() dialog.setPositiveButton(R.string.dialog_open, new DialogInterface.OnClickListener()
{ {
public void onClick(DialogInterface dialog, int id) public void onClick(DialogInterface dialog, int id)
{
if (journalName != null && journalName.length() > 0)
{ {
MainActivity.getInstance().SetLastMapFilterName(journalName); MainActivity.getInstance().SetLastMapFilterName(journalName);
MainActivity.getInstance().OpenArticleScreen(mArticles.get(index), MainActivity.TAG_FROM_MAPFRAGMENT_TO_ARTICLEFRAGMENT); MainActivity.getInstance().OpenArticleScreen(mArticles.get(index), MainActivity.TAG_BACK_TO_MAPFRAGMENT);
} else
{
MainActivity.getInstance().OpenArticleScreen(mArticles.get(index), MainActivity.TAG_BACK_TO_MAINFRAGMENT);
}
} }
}); });
@ -347,8 +352,6 @@ public class OsmMapHolderFragment extends Fragment
outState.putInt("filterType", filterType); outState.putInt("filterType", filterType);
} }
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{ {
@ -414,10 +417,8 @@ public class OsmMapHolderFragment extends Fragment
{ {
} }
}); });
if ((filterType == 0 && journal == null) || (filterType == 1 && article == null)) if ((filterType == 0 && journal == null) || (filterType == 1 && article == null))
{ {
titleTextView.setText(R.string.map_is_loading); titleTextView.setText(R.string.map_is_loading);
@ -446,7 +447,6 @@ public class OsmMapHolderFragment extends Fragment
void RestoreJournal() void RestoreJournal()
{ {
// journal = JournalManager.CreateEmptyJournal();
DatabaseGetJournalTask task = new DatabaseGetJournalTask(); DatabaseGetJournalTask task = new DatabaseGetJournalTask();

View File

@ -83,7 +83,7 @@ public class PhotoAlbumFragment extends Fragment
public void onItemClick(AdapterView<?> parent, View view, int position, long id) public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{ {
MainActivity.getInstance().SetLastAlbumName(albumName); MainActivity.getInstance().SetLastAlbumName(albumName);
MainActivity.getInstance().OpenPhotoScreen(album, position, MainActivity.TAG_FROM_PHOTOLISTFRAGMENT_TO_PHOTOFRAGMENT); MainActivity.getInstance().OpenPhotoScreen(album, position, MainActivity.TAG_BACK_TO_ALBUMFRAGMENT);
} }

View File

@ -23,12 +23,10 @@ public class PhotoFragmentAdapter extends PagerAdapter {
AlbumFullData album; AlbumFullData album;
//int currentPhoto;
public PhotoFragmentAdapter(Context context, AlbumFullData album/*, int currentPhoto*/) { public PhotoFragmentAdapter(Context context, AlbumFullData album) {
this.context = context; this.context = context;
this.album = album; this.album = album;
//this.currentPhoto = currentPhoto;
} }
@Override @Override
@ -59,7 +57,6 @@ public class PhotoFragmentAdapter extends PagerAdapter {
descriptionTextView.setText(album.photoRecordArr.get(position).description); descriptionTextView.setText(album.photoRecordArr.get(position).description);
ImageView image = (ImageView) viewLayout.findViewById(R.id.image); ImageView image = (ImageView) viewLayout.findViewById(R.id.image);
ImageManager.getInstance().ApplyImageToImageView(image, album.photoRecordArr.get(position).imageUrl); ImageManager.getInstance().ApplyImageToImageView(image, album.photoRecordArr.get(position).imageUrl);

View File

@ -1,21 +1,14 @@
package fishrungames.bashgid; package fishrungames.bashgid;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Locale; import java.util.Locale;
import fishrungames.bashgid.core.ArticleManager;
import fishrungames.bashgid.core.ArticleManager.ArticleShortData; import fishrungames.bashgid.core.ArticleManager.ArticleShortData;
import fishrungames.bashgid.core.DatabaseGetJournalTask;
import fishrungames.bashgid.core.DatabaseSearchArticleTask; import fishrungames.bashgid.core.DatabaseSearchArticleTask;
import fishrungames.bashgid.core.NewsManager;
import fishrungames.bashgid.core.NewsManager.NewsRecord;
import fishrungames.bashgid.core.db.NewsDataSource;
import fishrungames.networkutils.ImageManager; import fishrungames.networkutils.ImageManager;
import fishrungames.networkutils.UniversalActionWithCallback;
import fishrungames.networkutils.interfaces.RemoveCallbackInterface;
import fishrungames.networkutils.interfaces.UpdateAndFinishCallbackInterface;
import fishrungames.bashgid.core.NewsSearchRunnable;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
@ -24,13 +17,13 @@ import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.BaseAdapter; import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
@ -77,18 +70,29 @@ public class SearchFragment extends Fragment
this.query = ""; this.query = "";
} }
public SearchFragment(String query, String journalName, String journalTitle)
{
this.journalName = journalName;
this.journalTitle = journalTitle;
this.query = query;
}
@Override @Override
public void onSaveInstanceState(final Bundle outState) { public void onSaveInstanceState(final Bundle outState)
{
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
outState.putString("journalName", journalName); outState.putString("journalName", journalName);
outState.putString("journalTitle", journalTitle); outState.putString("journalTitle", journalTitle);
outState.putString("query", query); outState.putString("query", query);
} }
@SuppressLint("InflateParams") @Override @SuppressLint("InflateParams")
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
if (savedInstanceState != null) { if (savedInstanceState != null)
{
journalName = savedInstanceState.getString("journalName"); journalName = savedInstanceState.getString("journalName");
journalTitle = savedInstanceState.getString("journalTitle"); journalTitle = savedInstanceState.getString("journalTitle");
query = savedInstanceState.getString("query"); query = savedInstanceState.getString("query");
@ -103,12 +107,10 @@ public class SearchFragment extends Fragment
TextView addressTextView = (TextView) header.findViewById(R.id.addressTextView); TextView addressTextView = (TextView) header.findViewById(R.id.addressTextView);
if (journalTitle == null || journalTitle.length() == 0) if (journalTitle == null || journalTitle.length() == 0)
{ {
addressTextView.setText(R.string.search_everywhere); addressTextView.setText(R.string.search_everywhere);
} } else
else
{ {
String search_in = this.getResources().getString(R.string.search_in); String search_in = this.getResources().getString(R.string.search_in);
@ -119,14 +121,15 @@ public class SearchFragment extends Fragment
hintTextView = (TextView) header.findViewById(R.id.hintTextView); hintTextView = (TextView) header.findViewById(R.id.hintTextView);
searchEditText = (EditText) header.findViewById(R.id.editText); searchEditText = (EditText) header.findViewById(R.id.editText);
searchEditText.setText(query); searchEditText.setText(query);
searchEditText.addTextChangedListener(new TextWatcher(){ searchEditText.addTextChangedListener(new TextWatcher()
{
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s)
{
query = searchEditText.getText().toString(); query = searchEditText.getText().toString();
@ -134,8 +137,13 @@ public class SearchFragment extends Fragment
} }
public void beforeTextChanged(CharSequence s, int start, int count, int after){} public void beforeTextChanged(CharSequence s, int start, int count, int after)
public void onTextChanged(CharSequence s, int start, int before, int count){} {
}
public void onTextChanged(CharSequence s, int start, int before, int count)
{
}
}); });
listView.addHeaderView(header); listView.addHeaderView(header);
@ -144,12 +152,18 @@ public class SearchFragment extends Fragment
listView.setAdapter(listAdapter); listView.setAdapter(listAdapter);
listView.setOnItemClickListener(new OnItemClickListener(){ listView.setOnItemClickListener(new OnItemClickListener()
{
@Override @Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{ {
MainActivity.getInstance().OpenArticleScreen(searchResultArr.get(position-1).name, MainActivity.TAG_TO_MAINFRAGMENT);
MainActivity.getInstance().SetLastJournalName(journalName);
MainActivity.getInstance().SetLastJournalTitle(journalTitle);
MainActivity.getInstance().SetLastSearchQuery(query);
MainActivity.getInstance().OpenArticleScreen(searchResultArr.get(position - 1).name, MainActivity.TAG_BACK_TO_SEARCHFRAGMENT);
} }
}); });
@ -158,7 +172,6 @@ public class SearchFragment extends Fragment
return rootView; return rootView;
} }
public void SetSearchResult(ArrayList<ArticleShortData> articleArr) public void SetSearchResult(ArrayList<ArticleShortData> articleArr)
{ {
searchResultArr = articleArr; searchResultArr = articleArr;
@ -171,87 +184,60 @@ public class SearchFragment extends Fragment
hintTextView.setText(searchResultCount); hintTextView.setText(searchResultCount);
} }
public class ListAdapter extends BaseAdapter
{
public class ListAdapter extends BaseAdapter {
private Context mContext; private Context mContext;
public ListAdapter(Context c) { public ListAdapter(Context c)
{
mContext = c; mContext = c;
} }
public int getCount() { public int getCount()
{
return searchResultArr.size(); return searchResultArr.size();
} }
public Object getItem(int position) { public Object getItem(int position)
{
return null; return null;
} }
public long getItemId(int position) { public long getItemId(int position)
{
return 0; return 0;
} }
// create a new ImageView for each item referenced by the Adapter // create a new ImageView for each item referenced by the Adapter
@SuppressLint("InflateParams") @SuppressLint("InflateParams")
public View getView(int position, View convertView, ViewGroup parent) { public View getView(int position, View convertView, ViewGroup parent)
{
/*
View view;
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; View view;
if (convertView == null) { // if it's not recycled, initialize some attributes if (convertView == null)
{ // if it's not recycled, initialize some attributes
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.journal_element, null); view = inflater.inflate(R.layout.journal_element, null);
} else
} else { {
view = convertView; view = convertView;
} }
TextView titleTextView = (TextView)view.findViewById(R.id.titleTextView); TextView titleTextView = (TextView) view.findViewById(R.id.titleTextView);
titleTextView.setText(searchResultArr.get(position).title); titleTextView.setText(searchResultArr.get(position).title);
TextView dateTextView = (TextView)view.findViewById(R.id.dateTextView); TextView dateTextView = (TextView) view.findViewById(R.id.dateTextView);
dateTextView.setText(NewsDataSource.iso8601Format.format(searchResultArr.get(position).dateTime)); dateTextView.setText(MainActivity.iso8601Format.format(searchResultArr.get(position).dateTime));
ImageView imageView = (ImageView) view.findViewById(R.id.imageView); ImageView imageView = (ImageView) view.findViewById(R.id.imageView);
if (searchResultArr.get(position).previewImageUrl != null) if (searchResultArr.get(position).previewImageUrl != null)
{ {
ImageManager.getInstance().ApplyImageToImageView(imageView, searchResultArr.get(position).previewImageUrl); ImageManager.getInstance().ApplyImageToImageView(imageView, searchResultArr.get(position).previewImageUrl);
} } else
else
{ {
imageView.setImageResource(R.drawable.transparent); imageView.setImageResource(R.drawable.transparent);
} }
@ -260,11 +246,9 @@ public class SearchFragment extends Fragment
} }
public void CallUpdateNews() public void CallUpdateNews()
{ {
if (query.length() >= 3 || Locale.getDefault() == Locale.CHINA) if (query.length() >= 3 || Locale.getDefault() == Locale.CHINA)
{ {
if (databaseSearchArticleTask != null) if (databaseSearchArticleTask != null)
@ -284,8 +268,7 @@ public class SearchFragment extends Fragment
databaseSearchArticleTask.execute(bundle); databaseSearchArticleTask.execute(bundle);
hintTextView.setText(R.string.search_is_performing); hintTextView.setText(R.string.search_is_performing);
} } else
else
{ {
searchResultArr.clear(); searchResultArr.clear();
listAdapter.notifyDataSetChanged(); listAdapter.notifyDataSetChanged();
@ -294,33 +277,4 @@ public class SearchFragment extends Fragment
} }
} }
/*
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);
}
}*/
} }

View File

@ -1,6 +1,5 @@
package fishrungames.bashgid; package fishrungames.bashgid;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
@ -11,16 +10,16 @@ import android.view.View.OnClickListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Button; import android.widget.Button;
public class SettingsFragment extends Fragment public class SettingsFragment extends Fragment
{ {
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View rootView = inflater.inflate(R.layout.fragment_settings_page, container, false); View rootView = inflater.inflate(R.layout.fragment_settings_page, container, false);
Button callSupportButton = (Button)rootView.findViewById(R.id.callSupportButton); Button callSupportButton = (Button) rootView.findViewById(R.id.callSupportButton);
callSupportButton.setOnClickListener(new OnClickListener() callSupportButton.setOnClickListener(new OnClickListener()
{ {
@ -36,8 +35,7 @@ public class SettingsFragment extends Fragment
}); });
Button visitKitapButton = (Button) rootView.findViewById(R.id.visitKitapButton);
Button visitKitapButton = (Button)rootView.findViewById(R.id.visitKitapButton);
visitKitapButton.setOnClickListener(new OnClickListener() visitKitapButton.setOnClickListener(new OnClickListener()
{ {
@ -50,7 +48,7 @@ public class SettingsFragment extends Fragment
} }
}); });
Button visitDeveloperButton = (Button)rootView.findViewById(R.id.visitDeveloperButton); Button visitDeveloperButton = (Button) rootView.findViewById(R.id.visitDeveloperButton);
visitDeveloperButton.setOnClickListener(new OnClickListener() visitDeveloperButton.setOnClickListener(new OnClickListener()
{ {
@ -63,8 +61,7 @@ public class SettingsFragment extends Fragment
} }
}); });
Button visitTranslatorButton = (Button) rootView.findViewById(R.id.visitTranslatorButton);
Button visitTranslatorButton = (Button)rootView.findViewById(R.id.visitTranslatorButton);
visitTranslatorButton.setOnClickListener(new OnClickListener() visitTranslatorButton.setOnClickListener(new OnClickListener()
{ {

View File

@ -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));
}
}

View File

@ -90,7 +90,10 @@ public class VideoListFragment extends Fragment
@Override @Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{ {
MainActivity.getInstance().OpenVideoRecordScreen(channelFullData.videoRecordArr.get(position), MainActivity.TAG_FROM_VIDEOLISTFRAGMENT_TO_VIDEORECORDFRAGMENT);
MainActivity.getInstance().SetLastChannelName(channelName);
MainActivity.getInstance().OpenVideoRecordScreen(channelFullData.videoRecordArr.get(position));
} }
}); });
@ -115,7 +118,6 @@ public class VideoListFragment extends Fragment
this.channelFullData = channelFullData; this.channelFullData = channelFullData;
listAdapter.notifyDataSetChanged(); listAdapter.notifyDataSetChanged();
//channelFullData = MainActivity.getInstance().channelDataSource.GetChannelFullData(channelName);
} }

View File

@ -1,9 +1,8 @@
package fishrungames.bashgid; package fishrungames.bashgid;
import fishrungames.bashgid.core.AlbumManager;
import fishrungames.bashgid.core.DatabaseGetAlbumTask;
import fishrungames.bashgid.core.VideoManager; import fishrungames.bashgid.core.VideoManager;
import fishrungames.bashgid.core.ChannelManager.ChannelFullData;
import fishrungames.bashgid.core.VideoManager.VideoRecordData; import fishrungames.bashgid.core.VideoManager.VideoRecordData;
import fishrungames.networkutils.ImageManager; import fishrungames.networkutils.ImageManager;

View File

@ -64,17 +64,6 @@ public class AlbumManager
} }
} }
public static class AlbumRecord extends AlbumRecordData
{
public int id;
public AlbumRecord(int id, String name, String title, String description, int hidden)
{
super(name, title, description, hidden);
this.id = id;
}
}
public static AlbumFullData CreateEmptyAlbum() public static AlbumFullData CreateEmptyAlbum()
{ {
AlbumFullData result = new AlbumFullData(new AlbumRecordData("", "", "", 1)); AlbumFullData result = new AlbumFullData(new AlbumRecordData("", "", "", 1));

View File

@ -8,7 +8,6 @@ import java.util.Locale;
import fishrungames.bashgid.core.AlbumManager.AlbumFullData; import fishrungames.bashgid.core.AlbumManager.AlbumFullData;
import fishrungames.bashgid.core.ChannelManager.ChannelFullData; import fishrungames.bashgid.core.ChannelManager.ChannelFullData;
import fishrungames.bashgid.core.JournalManager.JournalSemiFullData;
public class ArticleManager public class ArticleManager
{ {
@ -67,16 +66,6 @@ public class ArticleManager
} }
} }
public static class ArticleRecord extends ArticleRecordData
{
public int id;
public ArticleRecord(int id, ArticleRecordData recordData)
{
super(recordData);
this.id = id;
}
}
public static class ArticleFullData extends ArticleRecordData public static class ArticleFullData extends ArticleRecordData
{ {
@ -99,8 +88,6 @@ public class ArticleManager
{ {
super(recordData); super(recordData);
previewImageUrl = ""; previewImageUrl = "";
//albumArr = new ArrayList<AlbumFullData>();
//channelArr = new ArrayList<ChannelFullData>();
} }
} }

View File

@ -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);
*/
}
}

View File

@ -2,13 +2,6 @@ package fishrungames.bashgid.core;
import java.util.ArrayList; import java.util.ArrayList;
import fishrungames.bashgid.MainActivity;
import fishrungames.bashgid.core.AlbumManager.AlbumFullData;
import fishrungames.bashgid.core.AlbumManager.AlbumRecordData;
import fishrungames.bashgid.core.PhotoManager.PhotoRecordData;
public class ChannelManager public class ChannelManager
{ {
@ -49,17 +42,6 @@ public class ChannelManager
} }
public static class ChannelRecord extends ChannelRecordData
{
public int id;
public ChannelRecord(int id, String name, String title, String description, int hidden)
{
super(name, title, description, hidden);
this.id = id;
}
}
public static ChannelFullData CreateEmptyChannel() public static ChannelFullData CreateEmptyChannel()
{ {
ChannelFullData result = new ChannelFullData(new ChannelRecordData("", "", "", 0)); ChannelFullData result = new ChannelFullData(new ChannelRecordData("", "", "", 0));
@ -67,34 +49,5 @@ public class ChannelManager
return result; return result;
} }
/*
public static void DownloadAndAddPhoto(PhotoRecordData recordData)
{
MainActivity.getInstance().DownloadImage(recordData.imageUrl, recordData.imageHash);
MainActivity.getInstance().photoDataSource.AddOrReplacePhoto(recordData);
}
public static void AddExistingPhotoToAlbum(String imageUrl, String albumName)
{
if (!MainActivity.getInstance().albumDataSource.IsAlbumAlreadyExist(albumName))
{
MainActivity.getInstance().albumDataSource.CreateNewAlbum(new AlbumRecordData(albumName, albumName, ""));
}
MainActivity.getInstance().albumDataSource.AddPhotoToAlbum(imageUrl, albumName);
}
public static void DownloadAndAddPhotoToAlbum(PhotoRecordData recordData, String albumName)
{
DownloadAndAddPhoto(recordData);
AddExistingPhotoToAlbum(recordData.imageUrl, albumName);
}
*/
} }

Some files were not shown because too many files have changed in this diff Show More