Fixed search-function for filterscreen and made the fragment-accessors for

convencience.
pull/14/head
Arne Jans 13 years ago
parent c1c6199082
commit ac3a18fa48

@ -37,6 +37,24 @@ public class AstridWrapperActivity extends FragmentActivity
*/ */
protected boolean mMultipleFragments = false; protected boolean mMultipleFragments = false;
protected FilterListActivity getFilterListFragment() {
FilterListActivity frag = (FilterListActivity) getSupportFragmentManager()
.findFragmentById(R.id.filterlist_fragment);
if (frag == null || !frag.isInLayout())
return null;
return frag;
}
protected TaskListActivity getTaskListFragment() {
TaskListActivity frag = (TaskListActivity) getSupportFragmentManager()
.findFragmentById(R.id.tasklist_fragment);
if (frag == null || !frag.isInLayout())
return null;
return frag;
}
/* (non-Javadoc) /* (non-Javadoc)
* @see android.support.v4.app.FragmentActivity#onCreate(android.os.Bundle) * @see android.support.v4.app.FragmentActivity#onCreate(android.os.Bundle)
*/ */
@ -45,6 +63,19 @@ public class AstridWrapperActivity extends FragmentActivity
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
} }
/* (non-Javadoc)
* @see android.app.Activity#onNewIntent(android.content.Intent)
*/
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
FilterListActivity frag = getFilterListFragment();
if (frag != null) {
// forwarding for search-requests
frag.onNewIntent(intent);
}
}
/** /**
* Handles items being clicked from the filterlist-fragment. Return true if item is handled. * Handles items being clicked from the filterlist-fragment. Return true if item is handled.
*/ */

@ -26,9 +26,8 @@ public class FilterListWrapperActivity extends AstridWrapperActivity {
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
Fragment frag = (Fragment) getSupportFragmentManager() Fragment frag = getTaskListFragment();
.findFragmentById(R.id.tasklist_fragment); if (frag != null) {
if (frag != null && frag.isInLayout()) {
mMultipleFragments = true; mMultipleFragments = true;
} else { } else {
mMultipleFragments = false; mMultipleFragments = false;
@ -37,9 +36,8 @@ public class FilterListWrapperActivity extends AstridWrapperActivity {
@Override @Override
public void setTitle(CharSequence title) { public void setTitle(CharSequence title) {
Fragment frag = (Fragment) getSupportFragmentManager() Fragment frag = getTaskListFragment();
.findFragmentById(R.id.tasklist_fragment); if (frag != null)
if (frag != null && frag.isInLayout())
((TextView)frag.getView().findViewById(R.id.listLabel)).setText(title); ((TextView)frag.getView().findViewById(R.id.listLabel)).setText(title);
// update the actionbar-title // update the actionbar-title
getSupportActionBar().setTitle(title); getSupportActionBar().setTitle(title);

@ -25,9 +25,8 @@ public class TaskListWrapperActivity extends AstridWrapperActivity {
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
Fragment frag = (Fragment) getSupportFragmentManager() Fragment frag = getFilterListFragment();
.findFragmentById(R.id.filterlist_fragment); if (frag != null) {
if (frag != null && frag.isInLayout()) {
mMultipleFragments = true; mMultipleFragments = true;
} else { } else {
mMultipleFragments = false; mMultipleFragments = false;
@ -36,9 +35,8 @@ public class TaskListWrapperActivity extends AstridWrapperActivity {
@Override @Override
public void setTitle(CharSequence title) { public void setTitle(CharSequence title) {
Fragment frag = (Fragment) getSupportFragmentManager() Fragment frag = getTaskListFragment();
.findFragmentById(R.id.tasklist_fragment); if (frag != null)
if (frag != null && frag.isInLayout())
((TextView)frag.getView().findViewById(R.id.listLabel)).setText(title); ((TextView)frag.getView().findViewById(R.id.listLabel)).setText(title);
// update the actionbar-title // update the actionbar-title
getSupportActionBar().setTitle(title); getSupportActionBar().setTitle(title);

Loading…
Cancel
Save