mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-23 07:27:22 +01:00
dispatch onActivityResult() from DualpaneDelegate
Inviting didn't work because it's done by a separate activity whose onActivityResult() was dropped because DualpaneDelegate was the recipient. That now handles it by asking MainActivity to sent it to a contained Delegate. Currently will go only to the top (rightmost) one.
This commit is contained in:
parent
176820aac9
commit
aef95ae498
4 changed files with 34 additions and 5 deletions
|
@ -111,7 +111,8 @@ public class DelegateBase implements DlgClickNotify,
|
||||||
protected void onActivityResult( RequestCode requestCode, int resultCode,
|
protected void onActivityResult( RequestCode requestCode, int resultCode,
|
||||||
Intent data )
|
Intent data )
|
||||||
{
|
{
|
||||||
DbgUtils.logf( "DelegateBase.onActivityResult(): subclass responsibility!!!" );
|
DbgUtils.logf( "%s.onActivityResult(): subclass responsibility!!!",
|
||||||
|
getClass().getSimpleName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onResume()
|
protected void onResume()
|
||||||
|
|
|
@ -68,4 +68,11 @@ public class DualpaneDelegate extends DelegateBase {
|
||||||
DbgUtils.logf( "DualpaneDelegate.handleBackPressed() => %b", handled );
|
DbgUtils.logf( "DualpaneDelegate.handleBackPressed() => %b", handled );
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult( RequestCode requestCode, int resultCode, Intent data )
|
||||||
|
{
|
||||||
|
MainActivity main = (MainActivity)m_activity;
|
||||||
|
main.dispatchOnActivityResult( requestCode, resultCode, data );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,14 +185,25 @@ public class MainActivity extends XWActivity
|
||||||
*/
|
*/
|
||||||
protected boolean dispatchBackPressed()
|
protected boolean dispatchBackPressed()
|
||||||
{
|
{
|
||||||
View child = m_root.getChildAt( m_root.getChildCount() - 1 );
|
XWFragment frag = getTopFragment();
|
||||||
Fragment frag = getSupportFragmentManager()
|
|
||||||
.findFragmentById( child.getId() );
|
|
||||||
boolean handled = null != frag
|
boolean handled = null != frag
|
||||||
&&((XWFragment)frag).getDelegate().handleBackPressed();
|
&& frag.getDelegate().handleBackPressed();
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void dispatchOnActivityResult( RequestCode requestCode,
|
||||||
|
int resultCode, Intent data )
|
||||||
|
{
|
||||||
|
XWFragment frag = getTopFragment();
|
||||||
|
|
||||||
|
if ( null != frag ) {
|
||||||
|
frag.onActivityResult( requestCode.ordinal(), resultCode, data );
|
||||||
|
} else {
|
||||||
|
DbgUtils.logdf( "dispatchOnActivityResult(): can't dispatch %s",
|
||||||
|
requestCode.toString() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected Point getFragmentSize()
|
protected Point getFragmentSize()
|
||||||
{
|
{
|
||||||
Rect rect = new Rect();
|
Rect rect = new Rect();
|
||||||
|
@ -305,6 +316,14 @@ public class MainActivity extends XWActivity
|
||||||
// Dualpane mode stuff
|
// Dualpane mode stuff
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
private XWFragment getTopFragment()
|
||||||
|
{
|
||||||
|
View child = m_root.getChildAt( m_root.getChildCount() - 1 );
|
||||||
|
XWFragment frag = (XWFragment)getSupportFragmentManager()
|
||||||
|
.findFragmentById( child.getId() );
|
||||||
|
return frag;
|
||||||
|
}
|
||||||
|
|
||||||
// Walk all Fragment children and if they care notify of change.
|
// Walk all Fragment children and if they care notify of change.
|
||||||
private void tellOrientationChanged()
|
private void tellOrientationChanged()
|
||||||
{
|
{
|
||||||
|
|
|
@ -90,6 +90,8 @@ public class XWFragment extends Fragment implements Delegator {
|
||||||
@Override
|
@Override
|
||||||
public void onResume()
|
public void onResume()
|
||||||
{
|
{
|
||||||
|
DbgUtils.logdf( "%s.onResume() called",
|
||||||
|
this.getClass().getSimpleName() );
|
||||||
super.onResume();
|
super.onResume();
|
||||||
m_dlgt.onResume();
|
m_dlgt.onResume();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue