|
|
@ -22,6 +22,8 @@ import static gr.thmmy.mthmmy.activities.topic.TopicActivity.BUNDLE_TOPIC_TITLE; |
|
|
|
import static gr.thmmy.mthmmy.activities.topic.TopicActivity.BUNDLE_TOPIC_URL; |
|
|
|
|
|
|
|
public class BookmarkActivity extends BaseActivity { |
|
|
|
private TextView boardsTitle; |
|
|
|
private TextView topicsTitle; |
|
|
|
|
|
|
|
@Override |
|
|
|
protected void onCreate(Bundle savedInstanceState) { |
|
|
@ -43,21 +45,22 @@ public class BookmarkActivity extends BaseActivity { |
|
|
|
LinearLayout bookmarksLinearView = (LinearLayout) findViewById(R.id.bookmarks_container); |
|
|
|
LayoutInflater layoutInflater = getLayoutInflater(); |
|
|
|
|
|
|
|
TextView tmp = new TextView(this); |
|
|
|
tmp.setLayoutParams(new LinearLayout.LayoutParams( |
|
|
|
if(!getBoardsBookmarked().isEmpty()) { |
|
|
|
boardsTitle = new TextView(this); |
|
|
|
boardsTitle.setLayoutParams(new LinearLayout.LayoutParams( |
|
|
|
LinearLayout.LayoutParams.MATCH_PARENT |
|
|
|
, LinearLayout.LayoutParams.WRAP_CONTENT)); |
|
|
|
tmp.setText(getString(R.string.board_bookmarks_title)); |
|
|
|
tmp.setTypeface(tmp.getTypeface(), Typeface.BOLD); |
|
|
|
boardsTitle.setText(getString(R.string.board_bookmarks_title)); |
|
|
|
boardsTitle.setTypeface(boardsTitle.getTypeface(), Typeface.BOLD); |
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { |
|
|
|
tmp.setTextColor(getColor(R.color.primary_text)); |
|
|
|
boardsTitle.setTextColor(getColor(R.color.primary_text)); |
|
|
|
} else { |
|
|
|
//noinspection deprecation
|
|
|
|
tmp.setTextColor(getResources().getColor(R.color.primary_text)); |
|
|
|
boardsTitle.setTextColor(getResources().getColor(R.color.primary_text)); |
|
|
|
} |
|
|
|
tmp.setTextAlignment(View.TEXT_ALIGNMENT_CENTER); |
|
|
|
tmp.setTextSize(20f); |
|
|
|
bookmarksLinearView.addView(tmp); |
|
|
|
boardsTitle.setTextAlignment(View.TEXT_ALIGNMENT_CENTER); |
|
|
|
boardsTitle.setTextSize(20f); |
|
|
|
bookmarksLinearView.addView(boardsTitle); |
|
|
|
|
|
|
|
for (final Bookmark bookmarkedBoard : getBoardsBookmarked()) { |
|
|
|
if (bookmarkedBoard != null && bookmarkedBoard.getTitle() != null) { |
|
|
@ -82,27 +85,31 @@ public class BookmarkActivity extends BaseActivity { |
|
|
|
public void onClick(View view) { |
|
|
|
removeBookmark(bookmarkedBoard); |
|
|
|
row.setVisibility(View.GONE); |
|
|
|
updateTitles(); |
|
|
|
} |
|
|
|
}); |
|
|
|
bookmarksLinearView.addView(row); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
tmp = new TextView(this); |
|
|
|
tmp.setLayoutParams(new LinearLayout.LayoutParams( |
|
|
|
if(!getTopicsBookmarked().isEmpty()) { |
|
|
|
topicsTitle = new TextView(this); |
|
|
|
topicsTitle.setLayoutParams(new LinearLayout.LayoutParams( |
|
|
|
LinearLayout.LayoutParams.MATCH_PARENT |
|
|
|
, LinearLayout.LayoutParams.WRAP_CONTENT)); |
|
|
|
tmp.setText(getString(R.string.topic_bookmarks_title)); |
|
|
|
tmp.setTypeface(tmp.getTypeface(), Typeface.BOLD); |
|
|
|
topicsTitle.setText(getString(R.string.topic_bookmarks_title)); |
|
|
|
topicsTitle.setTypeface(topicsTitle.getTypeface(), Typeface.BOLD); |
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { |
|
|
|
tmp.setTextColor(getColor(R.color.primary_text)); |
|
|
|
topicsTitle.setTextColor(getColor(R.color.primary_text)); |
|
|
|
} else { |
|
|
|
//noinspection deprecation
|
|
|
|
tmp.setTextColor(getResources().getColor(R.color.primary_text)); |
|
|
|
topicsTitle.setTextColor(getResources().getColor(R.color.primary_text)); |
|
|
|
} |
|
|
|
tmp.setTextAlignment(View.TEXT_ALIGNMENT_CENTER); |
|
|
|
tmp.setTextSize(20f); |
|
|
|
bookmarksLinearView.addView(tmp); |
|
|
|
topicsTitle.setTextAlignment(View.TEXT_ALIGNMENT_CENTER); |
|
|
|
topicsTitle.setTextSize(20f); |
|
|
|
bookmarksLinearView.addView(topicsTitle); |
|
|
|
|
|
|
|
for (final Bookmark bookmarkedTopic : getTopicsBookmarked()) { |
|
|
|
if (bookmarkedTopic != null && bookmarkedTopic.getTitle() != null) { |
|
|
@ -127,16 +134,26 @@ public class BookmarkActivity extends BaseActivity { |
|
|
|
public void onClick(View view) { |
|
|
|
removeBookmark(bookmarkedTopic); |
|
|
|
row.setVisibility(View.GONE); |
|
|
|
updateTitles(); |
|
|
|
} |
|
|
|
}); |
|
|
|
bookmarksLinearView.addView(row); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
protected void onResume() { |
|
|
|
drawer.setSelection(BOOKMARKS_ID); |
|
|
|
super.onResume(); |
|
|
|
} |
|
|
|
|
|
|
|
private void updateTitles() |
|
|
|
{ |
|
|
|
if(getBoardsBookmarked().isEmpty()) |
|
|
|
boardsTitle.setVisibility(View.GONE); |
|
|
|
if(getTopicsBookmarked().isEmpty()) |
|
|
|
topicsTitle.setVisibility(View.GONE); |
|
|
|
} |
|
|
|
} |
|
|
|