From b876b7b58ea03baa68e3bf6c80470599f07b578e Mon Sep 17 00:00:00 2001 From: Vladislav Khorev Date: Wed, 8 Jul 2015 00:11:08 +0000 Subject: [PATCH] Many recent changes --- android/AndroidManifest.xml | 4 +- android/res/layout/article_text_element.xml | 3 +- android/res/layout/article_title_element.xml | 19 ++ android/res/layout/fragment_grid_page.xml | 5 +- android/res/layout/fragment_settings_page.xml | 1 + android/res/layout/fragment_welcome.xml | 217 +++++++++--------- android/res/layout/grid_page_list_element.xml | 4 +- android/res/layout/main_page_header.xml | 2 +- android/res/layout/main_page_news.xml | 2 +- android/res/layout/news_page_list_header.xml | 2 +- android/res/values-large/dimens.xml | 20 +- android/res/values-normal/dimens.xml | 18 +- android/res/values-small/dimens.xml | 18 +- android/res/values-xlarge/dimens.xml | 17 +- android/res/values/dimens.xml | 11 +- .../fishrungames/bashgid/ArticleFragment.java | 23 +- .../bashgid/BashgidApplication.java | 22 +- .../fishrungames/bashgid/CatalogFragment.java | 2 +- .../fishrungames/bashgid/MainActivity.java | 47 +++- .../bashgid/MainPageFragment.java | 4 +- .../bashgid/MainPageHListViewAdapters.java | 11 +- .../bashgid/NavigationDrawerFragment.java | 9 + .../bashgid/VideoListFragment.java | 15 -- 23 files changed, 253 insertions(+), 223 deletions(-) create mode 100644 android/res/layout/article_title_element.xml diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 3977a39..5b20c91 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="9" + android:versionName="1.08" > + android:text="TextView" + android:textSize="@dimen/article_content_text_size" /> diff --git a/android/res/layout/article_title_element.xml b/android/res/layout/article_title_element.xml new file mode 100644 index 0000000..0353ab8 --- /dev/null +++ b/android/res/layout/article_title_element.xml @@ -0,0 +1,19 @@ + + + + + + diff --git a/android/res/layout/fragment_grid_page.xml b/android/res/layout/fragment_grid_page.xml index 3f2e1cc..9cac26a 100644 --- a/android/res/layout/fragment_grid_page.xml +++ b/android/res/layout/fragment_grid_page.xml @@ -2,6 +2,9 @@ - - - - - - - - + android:src="@drawable/logo" /> + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + \ No newline at end of file diff --git a/android/res/layout/grid_page_list_element.xml b/android/res/layout/grid_page_list_element.xml index 677d2f1..a33e951 100644 --- a/android/res/layout/grid_page_list_element.xml +++ b/android/res/layout/grid_page_list_element.xml @@ -9,7 +9,7 @@ android:orientation="vertical" android:showDividers="middle" > - diff --git a/android/res/layout/main_page_header.xml b/android/res/layout/main_page_header.xml index 3cceef5..a72e42a 100644 --- a/android/res/layout/main_page_header.xml +++ b/android/res/layout/main_page_header.xml @@ -51,7 +51,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical|center_horizontal" - android:background="@drawable/transparent" + android:background="@color/button_default" android:src="@drawable/ic_action_refresh" /> diff --git a/android/res/layout/main_page_news.xml b/android/res/layout/main_page_news.xml index b29ad8f..e680516 100644 --- a/android/res/layout/main_page_news.xml +++ b/android/res/layout/main_page_news.xml @@ -27,7 +27,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical|center_horizontal" - android:background="@drawable/transparent" + android:background="@color/button_default" android:src="@drawable/ic_action_refresh" /> diff --git a/android/res/layout/news_page_list_header.xml b/android/res/layout/news_page_list_header.xml index cfe2afd..30e14dc 100644 --- a/android/res/layout/news_page_list_header.xml +++ b/android/res/layout/news_page_list_header.xml @@ -28,7 +28,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical|center_horizontal" - android:background="@drawable/transparent" + android:background="@color/button_default" android:src="@drawable/ic_action_refresh" /> diff --git a/android/res/values-large/dimens.xml b/android/res/values-large/dimens.xml index 4772fd0..6185611 100644 --- a/android/res/values-large/dimens.xml +++ b/android/res/values-large/dimens.xml @@ -27,29 +27,11 @@ 4dp - 40sp - 30sp - - 24sp - - 20sp - - 18sp - - 14sp - - - 30sp - - 20sp - - - 12dp 12dp - 240dp + 160dp 24dp diff --git a/android/res/values-normal/dimens.xml b/android/res/values-normal/dimens.xml index d940d4a..4e526b8 100644 --- a/android/res/values-normal/dimens.xml +++ b/android/res/values-normal/dimens.xml @@ -27,29 +27,13 @@ 4dp - 30sp - 24sp - - 24sp - - 20sp - - 18sp - - 14sp - - 20sp - - 14sp - - 12dp 12dp - 240dp + 160dp 24dp diff --git a/android/res/values-small/dimens.xml b/android/res/values-small/dimens.xml index 76d73af..ea2a3f4 100644 --- a/android/res/values-small/dimens.xml +++ b/android/res/values-small/dimens.xml @@ -26,27 +26,13 @@ 4dp - - 30sp - 24sp - - 24sp - - 20sp - - 18sp - - 14sp - - 20sp - - 14sp + 12dp 12dp - 240dp + 160dp 24dp diff --git a/android/res/values-xlarge/dimens.xml b/android/res/values-xlarge/dimens.xml index 4772fd0..cb5f56e 100644 --- a/android/res/values-xlarge/dimens.xml +++ b/android/res/values-xlarge/dimens.xml @@ -27,21 +27,6 @@ 4dp - 40sp - 30sp - - 24sp - - 20sp - - 18sp - - 14sp - - - 30sp - - 20sp @@ -49,7 +34,7 @@ 12dp 12dp - 240dp + 160dp 24dp diff --git a/android/res/values/dimens.xml b/android/res/values/dimens.xml index 4772fd0..d7bcb40 100644 --- a/android/res/values/dimens.xml +++ b/android/res/values/dimens.xml @@ -27,8 +27,8 @@ 4dp - 40sp - 30sp + 36sp + 24sp 24sp @@ -38,10 +38,9 @@ 14sp + 20sp - 30sp - - 20sp + 24sp @@ -49,7 +48,7 @@ 12dp 12dp - 240dp + 160dp 24dp diff --git a/android/src/fishrungames/bashgid/ArticleFragment.java b/android/src/fishrungames/bashgid/ArticleFragment.java index 7c55167..2471f68 100644 --- a/android/src/fishrungames/bashgid/ArticleFragment.java +++ b/android/src/fishrungames/bashgid/ArticleFragment.java @@ -330,11 +330,17 @@ public class ArticleFragment extends Fragment View view; if (convertView == null) { // if it's not recycled, initialize some attributes - if (getItemViewType(position) == 0 || getItemViewType(position) == 1) + if (getItemViewType(position) == 0) + { + LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view = inflater.inflate(R.layout.article_title_element, null); + } + else if (getItemViewType(position) == 1) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater.inflate(R.layout.article_text_element, null); - } else if (getItemViewType(position) == 2) + } + else if (getItemViewType(position) == 2) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater.inflate(R.layout.article_photo_element, null); @@ -366,16 +372,17 @@ public class ArticleFragment extends Fragment textView.setText(articleLayout.get(position).value); + /* if (article.type == ArticleManager.ARTICLE_TYPE_NEWS) { textView.setTextSize(getResources().getDimension(R.dimen.large_text_size)); } else { textView.setTextSize(getResources().getDimension(R.dimen.xlarge_text_size)); - } + }*/ - textView.setTypeface(null, Typeface.BOLD); - textView.setGravity(Gravity.CENTER_HORIZONTAL); + //textView.setTypeface(null, Typeface.BOLD); + //textView.setGravity(Gravity.CENTER_HORIZONTAL); } else if (getItemViewType(position) == 1) { @@ -383,9 +390,9 @@ public class ArticleFragment extends Fragment textView.setText(articleLayout.get(position).value); - textView.setTextSize(getResources().getDimension(R.dimen.article_content_text_size)); - textView.setTypeface(null, Typeface.NORMAL); - textView.setGravity(Gravity.LEFT); + //textView.setTextSize(getResources().getDimension(R.dimen.article_content_text_size)); + //textView.setTypeface(null, Typeface.NORMAL); + //textView.setGravity(Gravity.LEFT); } else if (getItemViewType(position) == 2) { diff --git a/android/src/fishrungames/bashgid/BashgidApplication.java b/android/src/fishrungames/bashgid/BashgidApplication.java index f414347..32acd57 100644 --- a/android/src/fishrungames/bashgid/BashgidApplication.java +++ b/android/src/fishrungames/bashgid/BashgidApplication.java @@ -325,11 +325,30 @@ public class BashgidApplication extends android.app.Application { } public static void DownloadDatabase() + { + + if (databaseDownloadTask == null) + { + if (MainActivity.getInstance() != null) + { + if (!MainActivity.getInstance().databaseAlreadyLoaded) + { + ForceDownloadDatabase(); + + MainActivity.getInstance().databaseAlreadyLoaded = true; + } + } + } + + + } + + public static void ForceDownloadDatabase() { if (databaseDownloadTask != null) { - return; + CancelDownloadDatabaseTask(); } databaseDownloadTask = new DatabaseDownloadTask(); @@ -520,6 +539,7 @@ public class BashgidApplication extends android.app.Application { return settings.getInt("lastLanguage", 0); } + public static String DateFormattedForLocale(Date date) { return DateUtils.formatDateTime(instance, date.getTime(), DateUtils.FORMAT_ABBREV_ALL | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_YEAR); diff --git a/android/src/fishrungames/bashgid/CatalogFragment.java b/android/src/fishrungames/bashgid/CatalogFragment.java index c58e987..e7f1034 100644 --- a/android/src/fishrungames/bashgid/CatalogFragment.java +++ b/android/src/fishrungames/bashgid/CatalogFragment.java @@ -189,7 +189,7 @@ public class CatalogFragment extends Fragment HListView hListView = (HListView) view.findViewById(R.id.hListView); - hListView.setAdapter(new MainPageHListViewAdapters.JournalElementAdapter(getActivity(), journalList.get(position))); + hListView.setAdapter(new MainPageHListViewAdapters.JournalElementAdapter(getActivity(), journalList.get(position), MainActivity.TAG_BACK_TO_CATALOGFRAGMENT)); textView.setText(journalList.get(position).title); diff --git a/android/src/fishrungames/bashgid/MainActivity.java b/android/src/fishrungames/bashgid/MainActivity.java index 4ab3b14..d86a978 100644 --- a/android/src/fishrungames/bashgid/MainActivity.java +++ b/android/src/fishrungames/bashgid/MainActivity.java @@ -79,6 +79,8 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF private int postnotedDrawerSelection = 0; + public boolean databaseAlreadyLoaded = false; + @Override protected void onCreate(Bundle savedInstanceState) { @@ -433,6 +435,11 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF public void OpenMainScreen(boolean fromSavedInstanceState) { + if (mNavigationDrawerFragment != null) + { + mNavigationDrawerFragment.selectItemWithoutCall(1); + } + ClearAllFragmentLinks(); mainPageFragment = new MainPageFragment(); @@ -447,11 +454,15 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF } mNavigationDrawerFragment.EnableDrawer(); - + } public void OpenNewsScreen(boolean fromSavedInstanceState) { + if (mNavigationDrawerFragment != null) + { + mNavigationDrawerFragment.selectItemWithoutCall(2); + } ClearAllFragmentLinks(); @@ -475,6 +486,11 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF public void OpenCatalogScreen(boolean fromSavedInstanceState) { + + if (mNavigationDrawerFragment != null) + { + mNavigationDrawerFragment.selectItemWithoutCall(3); + } ClearAllFragmentLinks(); @@ -488,6 +504,11 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF public void OpenJournalScreen(boolean fromSavedInstanceState, String journalName, String tag) { + + if (mNavigationDrawerFragment != null && journalName.equals("investor")) + { + mNavigationDrawerFragment.selectItemWithoutCall(7); + } ClearAllFragmentLinks(); @@ -500,6 +521,12 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF public void OpenSettingsScreen(boolean fromSavedInstanceState) { + + if (mNavigationDrawerFragment != null) + { + mNavigationDrawerFragment.selectItemWithoutCall(8); + } + ClearAllFragmentLinks(); @@ -562,6 +589,10 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF public void OpenMapScreen(boolean fromSavedInstanceState, String filter, String tag) { + if (mNavigationDrawerFragment != null) + { + mNavigationDrawerFragment.selectItemWithoutCall(4); + } ClearAllFragmentLinks(); mapHolderFragment = new OsmMapHolderFragment(0, filter); @@ -572,6 +603,10 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF public void OpenMapScreen(ArticleFullData articleFullData, String tag) { + if (mNavigationDrawerFragment != null) + { + mNavigationDrawerFragment.selectItemWithoutCall(4); + } ClearAllFragmentLinks(); mapHolderFragment = new OsmMapHolderFragment(articleFullData); @@ -582,6 +617,11 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF public void OpenPhotoAlbumListScreen(boolean fromSavedInstanceState) { + if (mNavigationDrawerFragment != null) + { + mNavigationDrawerFragment.selectItemWithoutCall(6); + } + ClearAllFragmentLinks(); albumListFragment = new AlbumListFragment(); @@ -638,6 +678,11 @@ public class MainActivity extends ActionBarActivity implements NavigationDrawerF public void OpenVideoListScreen(boolean fromSavedInstanceState, String channelName) { + if (mNavigationDrawerFragment != null) + { + mNavigationDrawerFragment.selectItemWithoutCall(5); + } + ClearAllFragmentLinks(); videoListFragment = new VideoListFragment(channelName); diff --git a/android/src/fishrungames/bashgid/MainPageFragment.java b/android/src/fishrungames/bashgid/MainPageFragment.java index e12dca8..9a580dc 100644 --- a/android/src/fishrungames/bashgid/MainPageFragment.java +++ b/android/src/fishrungames/bashgid/MainPageFragment.java @@ -132,7 +132,7 @@ public class MainPageFragment extends Fragment public void onClick(View v) { BashgidApplication.CancelDownloadDatabaseTask(); - BashgidApplication.DownloadDatabase(); + BashgidApplication.ForceDownloadDatabase(); } }); @@ -384,7 +384,7 @@ public class MainPageFragment extends Fragment HListView hListView = (HListView) view.findViewById(R.id.hListView); - hListView.setAdapter(new MainPageHListViewAdapters.JournalElementAdapter(getActivity(), journalList.get(position))); + hListView.setAdapter(new MainPageHListViewAdapters.JournalElementAdapter(getActivity(), journalList.get(position), MainActivity.TAG_BACK_TO_MAINFRAGMENT)); textView.setText(journalList.get(position).title); diff --git a/android/src/fishrungames/bashgid/MainPageHListViewAdapters.java b/android/src/fishrungames/bashgid/MainPageHListViewAdapters.java index 2c67545..0be185a 100644 --- a/android/src/fishrungames/bashgid/MainPageHListViewAdapters.java +++ b/android/src/fishrungames/bashgid/MainPageHListViewAdapters.java @@ -25,7 +25,7 @@ public class MainPageHListViewAdapters private Context mContext; AlbumFullData albumFullData; - + public PhotoAlbumElementAdapter(Context c, AlbumFullData albumFullData) { this.mContext = c; @@ -82,11 +82,15 @@ public class MainPageHListViewAdapters private Context mContext; JournalSemiFullData journal; + + String tag; - public JournalElementAdapter(Context c, JournalSemiFullData journal) + + public JournalElementAdapter(Context c, JournalSemiFullData journal, String tag) { this.mContext = c; this.journal = journal; + this.tag = tag; } @@ -142,8 +146,7 @@ public class MainPageHListViewAdapters @Override public void onClick(View v) { - MainActivity.getInstance().OpenArticleScreen(journal.articleArr.get(position).name, - MainActivity.TAG_BACK_TO_MAINFRAGMENT); + MainActivity.getInstance().OpenArticleScreen(journal.articleArr.get(position).name, tag); } }); diff --git a/android/src/fishrungames/bashgid/NavigationDrawerFragment.java b/android/src/fishrungames/bashgid/NavigationDrawerFragment.java index 0bb3611..8ce96e6 100644 --- a/android/src/fishrungames/bashgid/NavigationDrawerFragment.java +++ b/android/src/fishrungames/bashgid/NavigationDrawerFragment.java @@ -273,6 +273,15 @@ public class NavigationDrawerFragment extends Fragment mCallbacks.onNavigationDrawerItemSelected(position, true); } } + + public void selectItemWithoutCall(int position) + { + mCurrentSelectedPosition = position; + if (mDrawerListView != null) + { + mDrawerListView.setItemChecked(position, true); + } + } @Override public void onAttach(Activity activity) diff --git a/android/src/fishrungames/bashgid/VideoListFragment.java b/android/src/fishrungames/bashgid/VideoListFragment.java index 6f31407..52ac9e5 100644 --- a/android/src/fishrungames/bashgid/VideoListFragment.java +++ b/android/src/fishrungames/bashgid/VideoListFragment.java @@ -116,24 +116,12 @@ public class VideoListFragment extends Fragment public void OnDatabaseDonwloadProgress(Integer percent) { - /* - databaseDownloadProgressBar.setProgress(percent); - if (percent >= 100) - { - databaseDownloadProgressBar.setVisibility(View.GONE); - } - else - { - databaseDownloadProgressBar.setVisibility(View.VISIBLE); - } - */ if (databaseGetChannelTask == null || percent == 100) { RestoreChannel(); } - //SetJournalList(r.journalList); } void RestoreChannel() @@ -245,9 +233,6 @@ public class VideoListFragment extends Fragment ImageView imageView = (ImageView)view.findViewById(R.id.imageView); TextView nameTextView = (TextView) view.findViewById(R.id.nameTextView); - - //ImageManager.getInstance().ApplyImageToImageView(imageView, channelFullData.videoRecordArr.get(position).previewImageUrl); - if (channelFullData.videoRecordArr.get(position) != null) {