Remove comment button from navbar

pull/14/head
Alex Baker 11 years ago
parent 1d18eb50cb
commit 557c16062b

@ -183,11 +183,6 @@ public class TagCommentsFragment extends CommentsFragment {
if(tagData != null && RemoteModel.isValidUuid(tagData.getValue(TagData.UUID))) {
Preferences.setLong(UPDATES_LAST_VIEWED + tagData.getValue(TagData.UUID), DateUtilities.now());
Activity activity = getActivity();
if (activity instanceof TaskListActivity) {
((TaskListActivity) activity).setCommentsCount(0);
}
}
}
}

@ -275,7 +275,6 @@ public class TagViewFragment extends TaskListFragment {
if (extras.getBoolean(TOKEN_START_ACTIVITY, false)) {
extras.remove(TOKEN_START_ACTIVITY);
activity.showComments();
}
}
@ -298,31 +297,10 @@ public class TagViewFragment extends TaskListFragment {
tagData.setValue(TagData.TASK_COUNT, count);
tagDataService.save(tagData);
}
updateCommentCount();
}
@Override
public void requestCommentCountUpdate() {
updateCommentCount();
}
private void updateCommentCount() {
if (tagData != null) {
long lastViewedComments = Preferences.getLong(CommentsFragment.UPDATES_LAST_VIEWED + tagData.getValue(TagData.UUID), 0);
int unreadCount = 0;
TodorooCursor<UserActivity> commentCursor = tagDataService.getUserActivityWithExtraCriteria(tagData, UserActivity.CREATED_AT.gt(lastViewedComments));
try {
unreadCount = commentCursor.getCount();
} finally {
commentCursor.close();
}
TaskListActivity tla = (TaskListActivity) getActivity();
if (tla != null) {
tla.setCommentsCount(unreadCount);
}
}
}
// --------------------------------------------------------- refresh data
@ -735,8 +713,6 @@ public class TagViewFragment extends TaskListFragment {
IntentFilter intentFilter = new IntentFilter(BROADCAST_TAG_ACTIVITY);
getActivity().registerReceiver(notifyReceiver, intentFilter);
updateCommentCount();
}
@Override

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
** Copyright (c) 2012 Todoroo Inc
**
** See the file "LICENSE" for the full license governing this code.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_pressed="true" android:drawable="@drawable/comment_blue_pressed"/>
<item android:state_focused="true" android:drawable="@drawable/comment_blue_pressed"/>
<item android:state_pressed="false" android:state_focused="false" android:drawable="@drawable/comment_blue_normal"/>
</selector>

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
** Copyright (c) 2012 Todoroo Inc
**
** See the file "LICENSE" for the full license governing this code.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_pressed="true" android:drawable="@drawable/comment_blue_alt_pressed"/>
<item android:state_focused="true" android:drawable="@drawable/comment_blue_alt_pressed"/>
<item android:state_pressed="false" android:state_focused="false" android:drawable="@drawable/comment_blue_alt_normal"/>
</selector>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 459 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 446 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 478 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 507 B

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
** Copyright (c) 2012 Todoroo Inc
**
** See the file "LICENSE" for the full license governing this code.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_pressed="true" android:drawable="@drawable/comment_blue_filled_pressed"/>
<item android:state_focused="true" android:drawable="@drawable/comment_blue_filled_pressed"/>
<item android:state_pressed="false" android:state_focused="false" android:drawable="@drawable/comment_blue_filled_normal"/>
</selector>

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
** Copyright (c) 2012 Todoroo Inc
**
** See the file "LICENSE" for the full license governing this code.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_pressed="true" android:drawable="@drawable/comment_blue_alt_filled_pressed"/>
<item android:state_focused="true" android:drawable="@drawable/comment_blue_alt_filled_pressed"/>
<item android:state_pressed="false" android:state_focused="false" android:drawable="@drawable/comment_blue_alt_filled_normal"/>
</selector>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 432 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 468 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 461 B

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
** Copyright (c) 2012 Todoroo Inc
**
** See the file "LICENSE" for the full license governing this code.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_pressed="true" android:drawable="@drawable/comment_dark_blue_pressed"/>
<item android:state_focused="true" android:drawable="@drawable/comment_dark_blue_pressed"/>
<item android:state_pressed="false" android:state_focused="false" android:drawable="@drawable/comment_dark_blue_normal"/>
</selector>

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
** Copyright (c) 2012 Todoroo Inc
**
** See the file "LICENSE" for the full license governing this code.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_pressed="true" android:drawable="@drawable/comment_dark_blue_filled_pressed"/>
<item android:state_focused="true" android:drawable="@drawable/comment_dark_blue_filled_pressed"/>
<item android:state_pressed="false" android:state_focused="false" android:drawable="@drawable/comment_dark_blue_filled_normal"/>
</selector>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 456 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 448 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 472 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 489 B

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
** Copyright (c) 2012 Todoroo Inc
**
** See the file "LICENSE" for the full license governing this code.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_pressed="true" android:drawable="@drawable/comment_red_pressed"/>
<item android:state_focused="true" android:drawable="@drawable/comment_red_pressed"/>
<item android:state_pressed="false" android:state_focused="false" android:drawable="@drawable/comment_red_normal"/>
</selector>

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
** Copyright (c) 2012 Todoroo Inc
**
** See the file "LICENSE" for the full license governing this code.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_pressed="true" android:drawable="@drawable/comment_red_filled_pressed"/>
<item android:state_focused="true" android:drawable="@drawable/comment_red_filled_pressed"/>
<item android:state_pressed="false" android:state_focused="false" android:drawable="@drawable/comment_red_filled_normal"/>
</selector>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 426 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 459 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 512 B

@ -67,13 +67,5 @@
style="@style/TextAppearance.ActionBar_ListsHeader"
android:textSize="16sp"
android:visibility="gone"/>
<Button
android:id="@+id/comments"
android:layout_width="51dip"
android:layout_height="fill_parent"
android:background="?attr/asCommentButtonImg"
android:textColor="?attr/asTextColorInverse"
android:paddingBottom="6dip"/>
</LinearLayout>

@ -35,8 +35,6 @@
<attr name="asListsDisclosure" format="reference"/>
<attr name="asAddButtonImg" format="reference" />
<attr name="asMicButtonImg" format="reference" />
<attr name="asCommentButtonImg" format="reference" />
<attr name="asFilledCommentButtonImg" format="reference" />
<attr name="asMainMenu" format="reference" />
<attr name="asPeopleMenu" format="reference" />
<attr name="asAbBackgroundColor" format="color"/>

@ -25,8 +25,6 @@
<item name="asListDividerColor">#555555</item>
<item name="asAddButtonImg">@drawable/plus_button_blue</item>
<item name="asMicButtonImg">@drawable/mic_button_blue</item>
<item name="asCommentButtonImg">@drawable/comment_blue</item>
<item name="asFilledCommentButtonImg">@drawable/comment_blue_filled</item>
<item name="asEditTextBackground">@null</item>
<item name="asEditBackground">#101010</item>
<item name="asEditRowBackground">@drawable/task_edit_background</item>
@ -103,8 +101,6 @@
<item name="asListDividerColor">#dddddd</item>
<item name="asAddButtonImg">@drawable/plus_button_red</item>
<item name="asMicButtonImg">@drawable/mic_button_red</item>
<item name="asCommentButtonImg">@drawable/comment_red</item>
<item name="asFilledCommentButtonImg">@drawable/comment_red_filled</item>
<item name="asEditRowBackground">@drawable/task_edit_background_white</item>
<item name="asWomEditRowBackground">@drawable/wom_edit_background_white</item>
<item name="asEditTabBackground">@drawable/custom_tab_indicator</item>
@ -139,8 +135,6 @@
<style name="Theme.White.Blue">
<item name="asAddButtonImg">@drawable/plus_button_dark_blue</item>
<item name="asMicButtonImg">@drawable/mic_button_dark_blue</item>
<item name="asCommentButtonImg">@drawable/comment_dark_blue</item>
<item name="asFilledCommentButtonImg">@drawable/comment_dark_blue_filled</item>
<item name="asMainMenu">@drawable/menu_button_dark_blue</item>
<item name="asPeopleMenu">@drawable/people_menu_button_dark_blue</item>
<item name="asThemeTextColor">@color/dark_blue_theme_color</item>
@ -165,8 +159,6 @@
<item name="asAddButtonImg">@drawable/plus_button_blue</item>
<item name="asMicButtonImg">@drawable/mic_button_blue</item>
<item name="asPeopleMenu">@drawable/people_menu_button_blue</item>
<item name="asCommentButtonImg">@drawable/comment_blue_alt</item>
<item name="asFilledCommentButtonImg">@drawable/comment_blue_filled_alt</item>
<item name="asMainMenu">@drawable/menu_button_blue_alt</item>
<item name="asListsDisclosure">@drawable/lists_disclosure_blue_alt</item>
<item name="asEditTabBackground">@drawable/custom_tab_indicator_alt</item>

@ -266,8 +266,6 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
private boolean showEditComments;
private int commentIcon = R.drawable.comment_dark_blue;
private int tabStyle = 0;
private boolean moreSectionHasControls;
@ -313,10 +311,6 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
showEditComments = Preferences.getBoolean(R.string.p_show_task_edit_comments, true);
TypedValue tv = new TypedValue();
getActivity().getTheme().resolveAttribute(R.attr.asCommentButtonImg, tv, false);
commentIcon = tv.data;
getActivity().setResult(Activity.RESULT_OK);
}
@ -354,10 +348,6 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
OVERRIDE_FINISH_ANIM, true);
}
}
if (activity instanceof TaskListActivity) {
((TaskListActivity) activity).setCommentsButtonVisibility(false);
}
}
private void instantiateEditNotes() {
@ -1059,7 +1049,6 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
&& model != null && model.isSaved()) {
taskService.delete(model);
}
((TaskListActivity) activity).setCommentsButtonVisibility(true);
}
}
@ -1325,7 +1314,6 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
item.setIcon(R.drawable.icn_menu_refresh_dark);
} else if (wouldShowComments && !showEditComments) {
item = menu.add(Menu.NONE, MENU_SHOW_COMMENTS_ID, Menu.NONE, R.string.TEA_menu_comments);
item.setIcon(commentIcon);
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
}
}

@ -105,7 +105,6 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
private TextView lists;
private ImageView mainMenu;
private TextView personStatus;
private Button commentsButton;
private int filterMode;
private FilterModeSpec filterModeSpec;
@ -114,7 +113,6 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
private FragmentPopover listsPopover;
private MainMenuPopover mainMenuPopover;
private boolean commentsVisible = false;
private boolean swipeEnabled = false;
@ -136,26 +134,6 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
}
};
private final OnClickListener commentsButtonClickListener = new OnClickListener() {
@Override
public void onClick(View v) {
if (fragmentLayout == LAYOUT_DOUBLE) {
View container = findViewById(R.id.taskedit_fragment_container);
if (getTaskEditFragment() != null) {
return;
}
container.setVisibility(container.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE);
commentsVisible = container.getVisibility() == View.VISIBLE;
} else {
// In this case we should be in LAYOUT_SINGLE--delegate to the task list fragment
TaskListFragment tlf = getTaskListFragment();
if (tlf != null) {
tlf.handleCommentsButtonClicked();
}
}
}
};
private final OnClickListener friendStatusClickListener = new OnClickListener() {
@Override
public void onClick(View v) {
@ -192,15 +170,10 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
lists = (TextView) actionBar.getCustomView().findViewById(R.id.list_title);
mainMenu = (ImageView) actionBar.getCustomView().findViewById(R.id.main_menu);
personStatus = (TextView) actionBar.getCustomView().findViewById(R.id.person_image);
commentsButton = (Button) actionBar.getCustomView().findViewById(R.id.comments);
if (ThemeService.getTheme() == R.style.Theme_White_Alt) {
commentsButton.setTextColor(getResources().getColor(R.color.blue_theme_color));
}
initializeFragments(actionBar);
createMainMenuPopover();
mainMenu.setOnClickListener(mainMenuClickListener);
commentsButton.setOnClickListener(commentsButtonClickListener);
personStatus.setOnClickListener(friendStatusClickListener);
Bundle extras = getIntent().getExtras();
@ -327,7 +300,6 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
if(editFragment != null && editFragment.getVisibility() == View.INVISIBLE) {
fragmentLayout = LAYOUT_TRIPLE;
actionBar.getCustomView().findViewById(R.id.comments).setVisibility(View.GONE);
} else {
fragmentLayout = LAYOUT_DOUBLE;
if (AndroidUtilities.getSdkVersion() >= 11) {
@ -417,7 +389,6 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
if (listsPopover != null) {
listsPopover.dismiss();
}
setCommentsCount(0);
if (swipeIsEnabled()) {
TaskListFragmentPager.showSwipeBetweenHelper(this);
@ -443,7 +414,6 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
int visibility = (filterModeSpec.showComments() ? View.VISIBLE : View.GONE);
if (fragmentLayout != LAYOUT_TRIPLE) {
commentsButton.setVisibility(visibility);
} else {
View container = findViewById(R.id.taskedit_fragment_container);
if (container != null) {
@ -452,10 +422,6 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
}
}
public void setCommentsButtonVisibility(boolean visible) {
commentsButton.setVisibility(visible && filterModeSpec.showComments() && fragmentLayout != LAYOUT_TRIPLE ? View.VISIBLE : View.GONE);
}
private void setListsDropdownSelected(boolean selected) {
int oldTextColor = lists.getTextColors().getDefaultColor();
int textStyle = (selected ? R.style.TextAppearance_ActionBar_ListsHeader_Selected :
@ -584,29 +550,13 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
@Override
public void onPageScrollStateChanged(int state) { /* Nothing */ }
public void setCommentsCount(int count) {
TypedValue tv = new TypedValue();
if (count > 0) {
commentsButton.setText(Integer.toString(count));
getTheme().resolveAttribute(R.attr.asFilledCommentButtonImg, tv, false);
} else {
commentsButton.setText(""); //$NON-NLS-1$
getTheme().resolveAttribute(R.attr.asCommentButtonImg, tv, false);
}
commentsButton.setBackgroundResource(tv.data);
}
public void showComments() {
commentsButton.performClick();
}
@Override
public void onBackPressed() {
// manage task edit visibility
View taskeditFragmentContainer = findViewById(R.id.taskedit_fragment_container);
if(taskeditFragmentContainer != null && taskeditFragmentContainer.getVisibility() == View.VISIBLE) {
if(fragmentLayout == LAYOUT_DOUBLE) {
boolean commentsVisible = false;
if (!commentsVisible) {
findViewById(R.id.taskedit_fragment_container).setVisibility(View.GONE);
}
@ -915,10 +865,8 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
filterModeSpec.getFilterListClass(), true, true));
if (mode == FILTER_MODE_PEOPLE) {
personStatus.setVisibility(View.VISIBLE);
commentsButton.setVisibility(View.GONE);
} else {
personStatus.setVisibility(View.GONE);
commentsButton.setVisibility(View.VISIBLE);
}
if (swipeIsEnabled()) {

@ -779,9 +779,6 @@ public class TaskListFragment extends SherlockListFragment implements OnSortSele
// Subclasses should override this
public void requestCommentCountUpdate() {
TaskListActivity activity = (TaskListActivity) getActivity();
if (activity != null) {
activity.setCommentsCount(0);
}
}
@Override

Loading…
Cancel
Save