mirror of https://github.com/tasks/tasks
Remove CommentsActivity and TaskCommentsFragment
parent
3e16830ae8
commit
72703dafb0
@ -1,61 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2012 Todoroo Inc
|
||||
*
|
||||
* See the file "LICENSE" for the full license governing this code.
|
||||
*/
|
||||
package com.todoroo.astrid.actfm;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import com.todoroo.andlib.utility.AndroidUtilities;
|
||||
import com.todoroo.astrid.activity.AstridActivity;
|
||||
import com.todoroo.astrid.service.ThemeService;
|
||||
|
||||
import org.tasks.R;
|
||||
|
||||
public class CommentsActivity extends AstridActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
ThemeService.applyTheme(this);
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.tag_updates_activity);
|
||||
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
actionBar.setTitle(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$
|
||||
}
|
||||
|
||||
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
||||
transaction.add(R.id.comments_fragment_container, fragment, tag);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch(item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
break;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish() {
|
||||
super.finish();
|
||||
AndroidUtilities.callOverridePendingTransition(this, R.anim.slide_right_in, R.anim.slide_right_out);
|
||||
}
|
||||
}
|
@ -1,76 +0,0 @@
|
||||
package com.todoroo.astrid.actfm;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.todoroo.andlib.service.Autowired;
|
||||
import com.todoroo.andlib.utility.DateUtilities;
|
||||
import com.todoroo.astrid.dao.TaskDao;
|
||||
import com.todoroo.astrid.data.Task;
|
||||
import com.todoroo.astrid.data.UserActivity;
|
||||
import com.todoroo.astrid.service.TaskService;
|
||||
|
||||
import org.tasks.R;
|
||||
|
||||
public class TaskCommentsFragment extends CommentsFragment {
|
||||
|
||||
public static final String EXTRA_TASK = "extra_task"; //$NON-NLS-1$
|
||||
|
||||
@Autowired
|
||||
private TaskDao taskDao;
|
||||
|
||||
private Task task;
|
||||
|
||||
@Autowired
|
||||
private TaskService taskService;
|
||||
|
||||
public TaskCommentsFragment() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadModelFromIntent(Intent intent) {
|
||||
if (task == null) {
|
||||
long taskId = intent.getLongExtra(EXTRA_TASK, 0L);
|
||||
task = taskDao.fetch(taskId, Task.PROPERTIES);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasModel() {
|
||||
return task != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayout() {
|
||||
return R.layout.tag_updates_fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getModelName() {
|
||||
return task.getValue(Task.TITLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Cursor getCursor() {
|
||||
return taskService.getActivityForTask(task);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addHeaderToListView(ListView listView) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
protected UserActivity createUpdate() {
|
||||
UserActivity update = new UserActivity();
|
||||
update.setValue(UserActivity.MESSAGE, addCommentField.getText().toString());
|
||||
update.setValue(UserActivity.ACTION, UserActivity.ACTION_TASK_COMMENT);
|
||||
update.setValue(UserActivity.USER_UUID, Task.USER_ID_SELF);
|
||||
update.setValue(UserActivity.TARGET_ID, task.getUuid());
|
||||
update.setValue(UserActivity.TARGET_NAME, task.getValue(Task.TITLE));
|
||||
update.setValue(UserActivity.CREATED_AT, DateUtilities.now());
|
||||
return update;
|
||||
}
|
||||
}
|
@ -1,12 +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.
|
||||
-->
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/comments_fragment_container">
|
||||
</FrameLayout>
|
Loading…
Reference in New Issue