Renamed TagUpdatesActivity to general purpose CommentsActivity for both tag and task comment fragments

pull/14/head
Sam Bosley 13 years ago
parent 0b9f54295e
commit eae50fdae1

@ -402,7 +402,7 @@
<activity android:name="com.todoroo.astrid.actfm.TagSettingsActivityTablet" <activity android:name="com.todoroo.astrid.actfm.TagSettingsActivityTablet"
android:windowSoftInputMode="stateHidden" android:windowSoftInputMode="stateHidden"
android:theme="@style/Theme.Dialog"/> android:theme="@style/Theme.Dialog"/>
<activity android:name="com.todoroo.astrid.actfm.TagUpdatesActivity" <activity android:name="com.todoroo.astrid.actfm.CommentsActivity"
android:windowSoftInputMode="stateHidden"/> android:windowSoftInputMode="stateHidden"/>
<receiver android:name="com.timsu.astrid.C2DMReceiver" permission="com.google.android.c2dm.permission.SEND"> <receiver android:name="com.timsu.astrid.C2DMReceiver" permission="com.google.android.c2dm.permission.SEND">
<!-- Receive the actual message --> <!-- Receive the actual message -->

@ -7,6 +7,9 @@ package com.todoroo.astrid.actfm;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.ActionBar; import android.support.v4.app.ActionBar;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.MenuItem; import android.support.v4.view.MenuItem;
import android.widget.TextView; import android.widget.TextView;
@ -15,7 +18,7 @@ import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.astrid.activity.AstridActivity; import com.todoroo.astrid.activity.AstridActivity;
import com.todoroo.astrid.service.ThemeService; import com.todoroo.astrid.service.ThemeService;
public class TagUpdatesActivity extends AstridActivity { public class CommentsActivity extends AstridActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
ThemeService.applyTheme(this); ThemeService.applyTheme(this);
@ -29,6 +32,21 @@ public class TagUpdatesActivity extends AstridActivity {
actionBar.setDisplayShowCustomEnabled(true); actionBar.setDisplayShowCustomEnabled(true);
actionBar.setCustomView(R.layout.header_title_view); actionBar.setCustomView(R.layout.header_title_view);
((TextView) actionBar.getCustomView().findViewById(R.id.title)).setText(R.string.TAd_contextEditTask); ((TextView) actionBar.getCustomView().findViewById(R.id.title)).setText(R.string.TAd_contextEditTask);
Fragment fragment;
String tag;
if (getIntent().getExtras().containsKey(TaskCommentsFragment.EXTRA_TASK)) {
fragment = new TaskCommentsFragment();
tag = "taskupdates_fragment"; //$NON-NLS-1$
} else {
fragment = new TagCommentsFragment();
tag = "tagupdates_fragment"; //$NON-NLS-1$
}
FragmentManager manager = getSupportFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
transaction.add(R.id.comments_fragment_container, fragment, tag);
transaction.commit();
} }
@Override @Override

@ -138,7 +138,7 @@ public abstract class CommentsFragment extends ListFragment {
} }
protected void setUpUpdateList() { protected void setUpUpdateList() {
if (getActivity() instanceof TagUpdatesActivity) { if (getActivity() instanceof CommentsActivity) {
ActionBar ab = ((AstridActivity) getActivity()).getSupportActionBar(); ActionBar ab = ((AstridActivity) getActivity()).getSupportActionBar();
String title = hasModel() ? getString(R.string.tag_updates_title, getModelName()) String title = hasModel() ? getString(R.string.tag_updates_title, getModelName())
: getString(R.string.TLA_all_activity); : getString(R.string.TLA_all_activity);
@ -248,7 +248,7 @@ public abstract class CommentsFragment extends ListFragment {
listView.setVisibility(View.VISIBLE); listView.setVisibility(View.VISIBLE);
} }
if (getActivity() instanceof TagUpdatesActivity) if (getActivity() instanceof CommentsActivity)
setLastViewed(); setLastViewed();
} }

@ -40,7 +40,7 @@ public class TagCommentsFragment extends CommentsFragment {
} }
public TagCommentsFragment(TagData tagData) { public TagCommentsFragment(TagData tagData) {
super(); this();
this.tagData = tagData; this.tagData = tagData;
} }
@ -125,6 +125,7 @@ public class TagCommentsFragment extends CommentsFragment {
return update; return update;
} }
@Override
protected String commentAddStatistic() { protected String commentAddStatistic() {
return StatisticsConstants.ACTFM_TAG_COMMENT; return StatisticsConstants.ACTFM_TAG_COMMENT;
} }

@ -8,11 +8,5 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:id="@+id/tag_updates_fragment_container"> android:id="@+id/comments_fragment_container">
<fragment
android:name="com.todoroo.astrid.actfm.TagUpdatesFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:tag="tagupdates_fragment">
</fragment>
</FrameLayout> </FrameLayout>

@ -67,7 +67,7 @@ import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.Preferences; import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.actfm.ActFmLoginActivity; import com.todoroo.astrid.actfm.ActFmLoginActivity;
import com.todoroo.astrid.actfm.TagSettingsActivity; import com.todoroo.astrid.actfm.TagSettingsActivity;
import com.todoroo.astrid.actfm.TagUpdatesActivity; import com.todoroo.astrid.actfm.CommentsActivity;
import com.todoroo.astrid.actfm.TagViewFragment; import com.todoroo.astrid.actfm.TagViewFragment;
import com.todoroo.astrid.actfm.sync.ActFmPreferenceService; import com.todoroo.astrid.actfm.sync.ActFmPreferenceService;
import com.todoroo.astrid.activity.SortSelectionActivity.OnSortSelectedListener; import com.todoroo.astrid.activity.SortSelectionActivity.OnSortSelectedListener;
@ -1093,7 +1093,7 @@ public class TaskListFragment extends ListFragment implements OnScrollListener,
* Comments button in action bar was clicked * Comments button in action bar was clicked
*/ */
protected void handleCommentsButtonClicked() { protected void handleCommentsButtonClicked() {
Intent intent = new Intent(getActivity(), TagUpdatesActivity.class); Intent intent = new Intent(getActivity(), CommentsActivity.class);
intent.putExtra(TagViewFragment.EXTRA_TAG_DATA, getActiveTagData()); intent.putExtra(TagViewFragment.EXTRA_TAG_DATA, getActiveTagData());
startActivity(intent); startActivity(intent);
AndroidUtilities.callOverridePendingTransition(getActivity(), R.anim.slide_left_in, R.anim.slide_left_out); AndroidUtilities.callOverridePendingTransition(getActivity(), R.anim.slide_left_in, R.anim.slide_left_out);

Loading…
Cancel
Save