diff --git a/jni/sflphone b/jni/sflphone index 68ff480db511284bfd33e55071b2d7f78590a1f2..7555ee13defb4bbe20acba09cddf51ea512dd5ed 160000 --- a/jni/sflphone +++ b/jni/sflphone @@ -1 +1 @@ -Subproject commit 68ff480db511284bfd33e55071b2d7f78590a1f2 +Subproject commit 7555ee13defb4bbe20acba09cddf51ea512dd5ed diff --git a/src/com/savoirfairelinux/sflphone/client/ButtonSectionFragment.java b/src/com/savoirfairelinux/sflphone/client/ButtonSectionFragment.java index faa03cd1072a752cf758f10f6008480e45e4851d..a1bf70f4416b3845fb6e8a1daa39046fdb318bb1 100644 --- a/src/com/savoirfairelinux/sflphone/client/ButtonSectionFragment.java +++ b/src/com/savoirfairelinux/sflphone/client/ButtonSectionFragment.java @@ -2,8 +2,6 @@ package com.savoirfairelinux.sflphone.client; import android.app.Fragment; import android.os.Bundle; -import android.os.Handler; -import android.os.Message; import android.util.Log; import android.view.InflateException; import android.view.LayoutInflater; @@ -16,12 +14,9 @@ import com.savoirfairelinux.sflphone.R; public class ButtonSectionFragment extends Fragment { - //private SFLPhoneHome myButtonSectionFragment; static final String TAG = "ButtonSectionFragment"; - public TextView callVoidText, NewDataText, DataStringText; + private TextView callVoidText, NewDataText, DataStringText; Button buttonCallVoid, buttonGetNewData, buttonGetDataString; - Handler callbackHandler; - ManagerImpl managerImpl; public ButtonSectionFragment() { @@ -39,12 +34,6 @@ public class ButtonSectionFragment extends Fragment public TextView getDataStringText() { return DataStringText; } - -// public ButtonSectionFragment(SFLPhoneHome sflPhoneHome) -// { -// myButtonSectionFragment = sflPhoneHome; -// setRetainInstance(true); -// } public static final String ARG_SECTION_NUMBER = "section_number"; @@ -57,17 +46,7 @@ public class ButtonSectionFragment extends Fragment view = inflater.inflate(R.layout.test_layout, parent, false); callVoidText = (TextView) view.findViewById(R.id.callVoid_text); - if (callVoidText == null) - Log.e(TAG, "callVoidText is " + callVoidText); - callbackHandler = new Handler() { - public void handlerMessage(Message msg) { - Bundle b = msg.getData(); - callVoidText.setText(b.getString("callback_string")); - Log.i(TAG, "handlerMessage: " + b.getString("callback_string")); - } - }; - managerImpl = new ManagerImpl(callbackHandler); - + NewDataText = (TextView) view.findViewById(R.id.NewData_text); buttonGetNewData = (Button) view.findViewById(R.id.buttonGetNewData); diff --git a/src/com/savoirfairelinux/sflphone/client/ManagerImpl.java b/src/com/savoirfairelinux/sflphone/client/ManagerImpl.java index 901fe97ebae8de8bc9dbe516d03f4ee035f5d439..6683582c73e3cd2709bf4a5c535a4216763cab9e 100644 --- a/src/com/savoirfairelinux/sflphone/client/ManagerImpl.java +++ b/src/com/savoirfairelinux/sflphone/client/ManagerImpl.java @@ -39,7 +39,6 @@ public class ManagerImpl { public static native void callVoid(); public static native Data getNewData(int i, String s); public static native String getDataString(Data d); - public static native String getDataString2(); public static native void setSipLogLevel(String level); public static native String getJniString(); diff --git a/src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java b/src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java index bcb04da96399236a57d5534a7c74689e2fcbf0a2..880a8eb3e04f625d84133f1ef4ac87744f662d89 100644 --- a/src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java +++ b/src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java @@ -36,6 +36,8 @@ import android.app.Fragment; import android.app.FragmentManager; import android.app.FragmentTransaction; import android.os.Bundle; +import android.os.Handler; +import android.os.Message; import android.support.v13.app.FragmentStatePagerAdapter; import android.support.v4.view.ViewPager; import android.util.Log; @@ -56,6 +58,8 @@ public class SFLPhoneHome extends Activity implements ActionBar.TabListener, OnC SectionsPagerAdapter mSectionsPagerAdapter; static final String TAG = "SFLPhoneHome"; ButtonSectionFragment buttonFragment; + Handler callbackHandler; + static ManagerImpl managerImpl; /** * The {@link ViewPager} that will host the section contents. @@ -98,6 +102,25 @@ public class SFLPhoneHome extends Activity implements ActionBar.TabListener, OnC // listener for when this tab is selected. actionBar.addTab(actionBar.newTab().setIcon(icon_res_id[i]).setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this)); } + + // FIXME + callbackHandler = new Handler() { + public void handleMessage(Message msg) { + Bundle b = msg.getData(); + TextView callVoidText; + + Log.i(TAG, "handlerMessage"); + + callVoidText = buttonFragment.getcallVoidText(); + if (callVoidText == null) + Log.e(TAG, "SFLPhoneHome: callVoidText is " + callVoidText); + callVoidText.setText(b.getString("callback_string")); + + Log.i(TAG, "handlerMessage: " + b.getString("callback_string")); + } + }; + managerImpl = new ManagerImpl(callbackHandler); + Log.i(TAG, "managerImpl created with callbackHandler " + callbackHandler); } // FIXME @@ -269,13 +292,10 @@ public class SFLPhoneHome extends Activity implements ActionBar.TabListener, OnC buttonFragment.getNewDataText().setText("getNewData(42, \"foo\") == Data(" + d.i + ", \"" + d.s + "\")"); break; case R.id.buttonGetDataString: -// Data daita = new Data(43, "bar"); -// String s = ManagerImpl.getDataString(daita); - String s = ManagerImpl.getDataString2(); - Log.i(TAG, "buttonGetDataString: getDataString2 is " + s); + Data daita = new Data(43, "bar"); + String s = ManagerImpl.getDataString(daita); if (s != "") { -// getDataStringText.setText("getDataString(Data(43, \"bar\")) == \"" + s + "\""); - buttonFragment.getDataStringText().setText("getDataString: " + s); + buttonFragment.getDataStringText().setText("getDataString(Data(43, \"bar\")) == \"" + s + "\""); } break; default: