diff --git a/AndroidManifest.xml b/AndroidManifest.xml index bcc2c826b9db07a22b8158e5cc8d7bc741cacc99..439ac6ab63fc22b72eb69e3317d516ebbca1b755 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -49,11 +49,12 @@ as that of the covered work. android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" - android:debuggable="true" > + android:debuggable="true"> <activity android:name=".client.SFLPhoneHome" android:label="@string/title_activity_sflphone_home" - android:theme="@style/AppTheme" > + android:theme="@style/AppTheme" + android:uiOptions="splitActionBarWhenNarrow"> <intent-filter> <action android:name="android.intent.action.MAIN" /> diff --git a/res/layout/activity_sflphone_home.xml b/res/layout/activity_sflphone_home.xml index d5ff7c1d0f48d77720a11d0f964072773f9c1467..21b395f8b301bef364e49e2f2b510b850a3ca468 100644 --- a/res/layout/activity_sflphone_home.xml +++ b/res/layout/activity_sflphone_home.xml @@ -36,10 +36,61 @@ as that of the covered work. android:orientation="vertical" android:gravity="center_horizontal" android:id="@+id/SFLPhoneHomeLayout"> - <android.support.v4.view.ViewPager - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/pager" + <LinearLayout + android:layout_height="wrap_content" + android:layout_weight="1" android:layout_width="match_parent" - android:layout_height="match_parent" + android:orientation="horizontal" + android:gravity="center_horizontal" + android:id="@+id/pagerLayout"> + <android.support.v4.view.ViewPager + xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/pager" + android:layout_width="match_parent" + android:layout_height="wrap_content"/> + </LinearLayout> +<!-- tools:context=".SFLPhoneHome" /> + <LinearLayout + android:layout_height="wrap_content" + android:layout_width="match_parent" + android:orientation="vertical"> +--> + <LinearLayout + android:layout_height="45dp" + android:layout_weight="1" + android:layout_width="match_parent" + android:orientation="horizontal" + android:gravity="center_horizontal" + android:id="@+id/callButtonLayout" + android:layout_below="@+id/pager"> + <ImageButton + android:id="@+id/buttonCall" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight=".5" + android:gravity="center_vertical" + android:onClick="onClick" + android:src="@drawable/ic_call" + android:background="@drawable/call_button" /> + <ImageButton + android:id="@+id/buttonHangUp" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight=".5" + android:gravity="center_vertical" + android:onClick="onClick" + android:src="@drawable/ic_hangup" + android:background="@drawable/hangup_button" /> + <ImageButton + android:id="@+id/buttonIncomingCall" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight=".5" + android:gravity="center_vertical" + android:onClick="onClick" + android:src="@drawable/ic_incomingcall" + android:background="@drawable/hangup_button" + android:drawable="@drawable/hangup_button" /> + </LinearLayout> </LinearLayout> diff --git a/res/layout/test_layout.xml b/res/layout/test_layout.xml index c6027d659dbb1e6fb39017b5e45f12c51a4cecb6..fdc35e292315f61599967d137681c6c8ddf33ab2 100644 --- a/res/layout/test_layout.xml +++ b/res/layout/test_layout.xml @@ -86,45 +86,6 @@ as that of the covered work. android:layout_below="@+id/editAccountID" android:ems="10" /> - <LinearLayout - android:layout_height="wrap_content" - android:layout_width="match_parent" - android:gravity = "center_horizontal" - android:layout_below="@+id/editTo" - android:id="@+id/callButtonLayout" - android:weightSum="1.0"> - <ImageButton - android:id="@+id/buttonCall" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight=".5" - android:gravity="center_vertical" - android:onClick="onClick" - android:src="@drawable/ic_call" - android:background="@drawable/call_button" /> - - <ImageButton - android:id="@+id/buttonHangUp" - android:layout_width="0dp" - android:layout_height="match_parent" - android:layout_weight=".5" - android:gravity="center_vertical" - android:onClick="onClick" - android:src="@drawable/ic_hangup" - android:background="@drawable/hangup_button" /> - - <ImageButton - android:id="@+id/buttonIncomingCall" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight=".5" - android:gravity="center_vertical" - android:onClick="onClick" - android:src="@drawable/ic_incomingcall" - android:background="@drawable/hangup_button" - android:drawable="@drawable/hangup_button" /> - </LinearLayout> - <TextView android:id="@+id/callVoid_text" android:layout_width="match_parent" diff --git a/src/com/savoirfairelinux/sflphone/client/ButtonSectionFragment.java b/src/com/savoirfairelinux/sflphone/client/ButtonSectionFragment.java index 74de208bfe082b7728a59a35b27ebf6780ca2fcd..076ef5f28cb28b207b9b03f39bcced9aaa98e0f5 100644 --- a/src/com/savoirfairelinux/sflphone/client/ButtonSectionFragment.java +++ b/src/com/savoirfairelinux/sflphone/client/ButtonSectionFragment.java @@ -8,7 +8,6 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; -import android.widget.ImageButton; import android.widget.TextView; import com.savoirfairelinux.sflphone.R; @@ -18,7 +17,6 @@ public class ButtonSectionFragment extends Fragment static final String TAG = "ButtonSectionFragment"; private TextView callVoidText, NewDataText, DataStringText; Button buttonCallVoid, buttonGetNewData, buttonGetDataString; - ImageButton buttonCall, buttonIncomingCall, buttonHangUp; public ButtonSectionFragment() { @@ -37,18 +35,6 @@ public class ButtonSectionFragment extends Fragment return DataStringText; } - public ImageButton getCallButton() { - return buttonCall; - } - - public ImageButton getIncomingCallButton() { - return buttonIncomingCall; - } - - public ImageButton getHangUpButton() { - return buttonHangUp; - } - public static final String ARG_SECTION_NUMBER = "section_number"; @Override @@ -66,8 +52,6 @@ public class ButtonSectionFragment extends Fragment DataStringText = (TextView) view.findViewById(R.id.DataString_text); buttonGetDataString = (Button) view.findViewById(R.id.buttonGetDataString); - buttonCall = (ImageButton) view.findViewById(R.id.buttonCall); - buttonHangUp = (ImageButton) view.findViewById(R.id.buttonHangUp); try { inflater.inflate(R.layout.test_layout, parent, false); @@ -78,4 +62,4 @@ public class ButtonSectionFragment extends Fragment return view; } -} \ No newline at end of file +} diff --git a/src/com/savoirfairelinux/sflphone/client/ManagerImpl.java b/src/com/savoirfairelinux/sflphone/client/ManagerImpl.java index ab4cb84f318e8a5390cf87e0e0e2fd05e86e9065..4a967c341b2eed541c8f560c989aec0d7e4e4311 100644 --- a/src/com/savoirfairelinux/sflphone/client/ManagerImpl.java +++ b/src/com/savoirfairelinux/sflphone/client/ManagerImpl.java @@ -51,7 +51,6 @@ public class ManagerImpl { public static void incomingCall(String accountID, String callID, String from) { Log.i(TAG, "incomingCall(" + accountID + ", " + callID + ", " + from + ")"); - buttonCall = (ImageButton) buttonSecFragment.getCallButton(); // FIXME that's ugly... uiThread.runOnUiThread(new Runnable() { @@ -60,7 +59,7 @@ public class ManagerImpl { buttonCall.startAnimation(animation); buttonCall.setImageResource(R.drawable.ic_incomingcall); } catch (Exception e) { - Log.w(TAG, "exception in runOnUiThread ", e); + Log.w(TAG, "exception in runOnUiThread ", e);; } } }); @@ -69,8 +68,8 @@ public class ManagerImpl { } // FIXME - public static void setButtonFragment(ButtonSectionFragment f) { - buttonSecFragment = f; + public static void setCallButton(ImageButton b) { + buttonCall = b; } public static void setActivity(SFLPhoneHome a) { diff --git a/src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java b/src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java index 61dc41c7e9e4e2dc0b22df3894f994ec68248ea2..fd2adf2276ea16a2c5da5aebbc9c4f220309b3d5 100644 --- a/src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java +++ b/src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java @@ -68,7 +68,6 @@ public class SFLPhoneHome extends Activity implements ActionBar.TabListener, OnC SectionsPagerAdapter mSectionsPagerAdapter; static final String TAG = "SFLPhoneHome"; private ButtonSectionFragment buttonFragment; - ImageButton buttonCall, buttonHangup; Handler callbackHandler; static ManagerImpl managerImpl; /* default callID */ @@ -76,6 +75,7 @@ public class SFLPhoneHome extends Activity implements ActionBar.TabListener, OnC static boolean callOnGoing = false; private String incomingCallID = ""; private static final int REQUEST_CODE_PREFERENCES = 1; + ImageButton buttonCall, buttonIncomingCall, buttonHangup; /** * The {@link ViewPager} that will host the section contents. @@ -94,6 +94,7 @@ public class SFLPhoneHome extends Activity implements ActionBar.TabListener, OnC final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); + // final ActionBar actionBar = getActionBar(); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.pager); @@ -135,14 +136,16 @@ public class SFLPhoneHome extends Activity implements ActionBar.TabListener, OnC Log.i(TAG, "handleMessage: " + b.getString("callback_string")); } }; + + buttonCall = (ImageButton) findViewById(R.id.buttonCall); + buttonHangup = (ImageButton) findViewById(R.id.buttonHangUp); + buttonIncomingCall = (ImageButton) findViewById(R.id.buttonIncomingCall); + ManagerImpl.setAppPath(getAppPath()); managerImpl = new ManagerImpl(callbackHandler); managerImpl.setActivity(this); + // managerImpl.setCallButton(buttonCall); Log.i(TAG, "managerImpl created with callbackHandler " + callbackHandler); - - buttonCall = (ImageButton) findViewById(R.id.buttonCall); - buttonHangup = (ImageButton) findViewById(R.id.buttonHangUp); -// buttonIncomingCall = (ImageButton) findViewById(R.id.buttonIncomingCall); } // FIXME @@ -231,10 +234,8 @@ public class SFLPhoneHome extends Activity implements ActionBar.TabListener, OnC fragment = new DummySectionFragment(); break; case 2: - buttonFragment = new ButtonSectionFragment(); - Log.i(TAG, "getItem: fragment is " + buttonFragment); - fragment = buttonFragment; - managerImpl.setButtonFragment(buttonFragment); + fragment = new ButtonSectionFragment(); + Log.i(TAG, "getItem: fragment is " + fragment); break; default: Log.e(TAG, "getItem: unknown tab position " + i); @@ -314,9 +315,6 @@ public class SFLPhoneHome extends Activity implements ActionBar.TabListener, OnC @Override public void onClick(View view) { - buttonCall = buttonFragment.getCallButton(); - buttonHangup = buttonFragment.getHangUpButton(); - switch (view.getId()) { case R.id.buttonCall: TextView textView = (TextView) findViewById(R.id.editAccountID); @@ -341,7 +339,6 @@ public class SFLPhoneHome extends Activity implements ActionBar.TabListener, OnC break; } - /* new random callID */ callID = Integer.toString(random.nextInt()); Log.d(TAG, "ManagerImpl.placeCall(" + accountID + ", " + callID + ", " + to + ");");