Browse Source

Minor refactoring

pull/61/merge
Ezerous 6 years ago
parent
commit
e697b8edb5
No known key found for this signature in database GPG Key ID: 262B2954BBA319E3
  1. 2
      app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.java
  2. 23
      app/src/main/java/gr/thmmy/mthmmy/activities/bookmarks/TopicBookmarksFragment.java
  3. 3
      app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java
  4. 2
      app/src/main/res/values/strings.xml

2
app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.java

@ -94,7 +94,7 @@ public class BoardActivity extends BaseActivity implements BoardAdapter.OnLoadMo
getSupportActionBar().setDisplayShowHomeEnabled(true);
}
thisPageBookmark = new Bookmark(boardTitle, ThmmyPage.getBoardId(boardUrl), false);
thisPageBookmark = new Bookmark(boardTitle, "b" + ThmmyPage.getBoardId(boardUrl), true);
setBoardBookmark(findViewById(R.id.bookmark));
createDrawer();

23
app/src/main/java/gr/thmmy/mthmmy/activities/bookmarks/TopicBookmarksFragment.java

@ -20,13 +20,18 @@ import java.util.ArrayList;
import gr.thmmy.mthmmy.R;
import gr.thmmy.mthmmy.model.Bookmark;
/**
* A {@link Fragment} subclass.
* Use the {@link TopicBookmarksFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class TopicBookmarksFragment extends Fragment {
protected static final String ARG_SECTION_NUMBER = "SECTION_NUMBER";
protected static final String ARG_TOPIC_BOOKMARKS = "BOARD_BOOKMARKS";
protected static final String ARG_TOPIC_BOOKMARKS = "TOPIC_BOOKMARKS";
public static final String INTERACTION_CLICK_TOPIC_BOOKMARK = "CLICK_BOARD_BOOKMARK";
public static final String INTERACTION_CLICK_TOPIC_BOOKMARK = "CLICK_TOPIC_BOOKMARK";
public static final String INTERACTION_TOGGLE_TOPIC_NOTIFICATION = "TOGGLE_TOPIC_NOTIFICATION";
public static final String INTERACTION_REMOVE_TOPIC_BOOKMARK = "REMOVE_BOARD_BOOKMARK";
public static final String INTERACTION_REMOVE_TOPIC_BOOKMARK = "REMOVE_TOPIC_BOOKMARK";
ArrayList<Bookmark> topicBookmarks = null;
@ -43,11 +48,11 @@ public class TopicBookmarksFragment extends Fragment {
*
* @return A new instance of fragment Forum.
*/
public static TopicBookmarksFragment newInstance(int sectionNumber, String boardBookmarks) {
public static TopicBookmarksFragment newInstance(int sectionNumber, String topicBookmarks) {
TopicBookmarksFragment fragment = new TopicBookmarksFragment();
Bundle args = new Bundle();
args.putInt(ARG_SECTION_NUMBER, sectionNumber);
args.putString(ARG_TOPIC_BOOKMARKS, boardBookmarks);
args.putString(ARG_TOPIC_BOOKMARKS, topicBookmarks);
fragment.setArguments(args);
return fragment;
}
@ -56,9 +61,9 @@ public class TopicBookmarksFragment extends Fragment {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
String bundledBoardBookmarks = getArguments().getString(ARG_TOPIC_BOOKMARKS);
if (bundledBoardBookmarks != null) {
topicBookmarks = Bookmark.arrayFromString(bundledBoardBookmarks);
String bundledTopicBookmarks = getArguments().getString(ARG_TOPIC_BOOKMARKS);
if (bundledTopicBookmarks != null) {
topicBookmarks = Bookmark.arrayFromString(bundledTopicBookmarks);
}
}
@ -78,7 +83,7 @@ public class TopicBookmarksFragment extends Fragment {
Bundle savedInstanceState) {
// Inflates the layout for this fragment
final View rootView = layoutInflater.inflate(R.layout.fragment_bookmarks, container, false);
//bookmarks_board_container
//bookmarks_topic_container
final LinearLayout bookmarksLinearView = rootView.findViewById(R.id.bookmarks_container);
if(this.topicBookmarks != null && !this.topicBookmarks.isEmpty()) {

3
app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java

@ -635,7 +635,8 @@ public abstract class BaseActivity extends AppCompatActivity {
FirebaseMessaging.getInstance().unsubscribeFromTopic(bookmark.getId());
return boardsBookmarked.get(bookmark.findIndex(boardsBookmarked)).isNotificationsEnabled();
}
} else
Timber.w("No bookmark match exists!");
return false;
}
//-------------------------------------------BOOKMARKS END------------------------------------------

2
app/src/main/res/values/strings.xml

@ -14,7 +14,7 @@
<string name="info">Info</string>
<string name="ok">OK</string>
<string name="cancel">Cancel</string>
<string name="user_agreement_dialog_text">"To use mTHMMY you have to agree to our Privacy Policy by choosing one of the buttons below. Choose \"Yes, I want to help\", if you consent to the collection of anonymized data that will help us improve the app. Otherwise, choose \"Nope, leave me alone\". You can change your preferences any time through the app's Settings.</string>
<string name="user_agreement_dialog_text">"To use mTHMMY you have to agree to our Privacy Policy by choosing one of the options below. Choose \"Yes, I want to help\", if you consent to the collection of anonymized data that will help us improve the app. Otherwise, choose \"Nope, leave me alone\". You can change your preferences any time through the app's Settings.</string>
<!--Login Activity-->
<string name="thmmy_img_description">thmmy.gr</string>

Loading…
Cancel
Save