--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/res/layout/incall.xml Sat Jan 23 13:42:20 2010 +0100
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="utf-8"?>
+<AbsoluteLayout
+android:id="@+id/top_lvl_layout"
+android:layout_width="fill_parent"
+android:layout_height="fill_parent"
+android:background="#000000"
+xmlns:android="http://schemas.android.com/apk/res/android"
+>
+
+ <FrameLayout android:id="@+id/mainFrame"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:layout_weight="1"
+ android:paddingTop="10dip"
+ android:paddingLeft="6dip"
+ android:paddingRight="6dip"
+ >
+
+ <!-- (1) inCallPanel: the main set of in-call UI elements -->
+ <RelativeLayout android:id="@+id/inCallPanel"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ >
+
+ <!-- Slide hints: if the "sliding card" feature is enabled,
+ one or the other of these is visible at any given moment
+ (see updateCardSlideHints()). -->
+
+ <!-- Slide hint and arrow *above* the main body of the card,
+ shown when the card is in the *bottom* position. -->
+ <!-- This hint's position onscreen is static: the Y value is set
+ so that the hint will be visible just above the top edge of
+ the CallCard when the CallCard is in the "bottom" position.
+ The resources here describe the portrait mode layout; see
+ InCallScreen.ConfigurationHelper.applyConfigurationToLayout()
+ for the differences in landscape mode. -->
+ <LinearLayout android:id="@+id/slideUp"
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
+ android:background="@null"
+ android:visibility="gone"
+ >
+ <TextView android:id="@+id/slideUpHint"
+ android:layout_gravity="center_horizontal"
+ android:gravity="center_horizontal"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textColor="?android:attr/textColorSecondary"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ />
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:src="@android:drawable/arrow_up_float"
+ />
+ </LinearLayout>
+
+ <!-- Slide hint and arrow *below* the main body of the card,
+ shown when the card is in the *top* position. -->
+ <!-- This hint's position onscreen is static: the Y value is set
+ so that the hint will be visible just below the bottom edge of
+ the CallCard when the CallCard is in the "top" position.
+ The resources here describe the portrait mode layout; see
+ InCallScreen.ConfigurationHelper.applyConfigurationToLayout()
+ for the differences in landscape mode. -->
+ <LinearLayout android:id="@+id/slideDown"
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentTop="true"
+ android:background="@null"
+ android:visibility="gone"
+ >
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:src="@android:drawable/arrow_down_float"
+ />
+ <TextView
+ android:id="@+id/slideDownHint"
+ android:layout_gravity="center_horizontal"
+ android:gravity="center_horizontal"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textColor="?android:attr/textColorSecondary"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ />
+ <TextView
+ android:id="@+id/stats"
+ android:layout_gravity="center_horizontal"
+ android:gravity="center_horizontal"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textColor="?android:attr/textColorSecondary"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ />
+ </LinearLayout>
+
+ </RelativeLayout> <!-- End of inCallPanel -->
+
+ </FrameLayout> <!-- End of mainFrame -->
+</AbsoluteLayout>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/com/beem/project/beem/ui/CallScreen.java Sat Jan 23 13:42:20 2010 +0100
@@ -0,0 +1,169 @@
+package com.beem.project.beem.ui;
+
+import org.sipdroid.media.RtpStreamReceiver;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.KeyguardManager;
+import android.content.ActivityNotFoundException;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.media.AudioManager;
+import android.os.Bundle;
+import android.os.SystemClock;
+import android.text.InputType;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.widget.EditText;
+
+import com.beem.project.beem.R;
+
+/*
+ * Copyright (C) 2009 The Sipdroid Open Source Project
+ *
+ * This file is part of Sipdroid (http://www.sipdroid.org)
+ *
+ * Sipdroid is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This source code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this source code; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+public class CallScreen extends Activity implements DialogInterface.OnClickListener {
+ public static final int FIRST_MENU_ID = Menu.FIRST;
+ public static final int HANG_UP_MENU_ITEM = FIRST_MENU_ID + 1;
+ public static final int HOLD_MENU_ITEM = FIRST_MENU_ID + 2;
+ public static final int MUTE_MENU_ITEM = FIRST_MENU_ID + 3;
+ public static final int VIDEO_MENU_ITEM = FIRST_MENU_ID + 5;
+ public static final int SPEAKER_MENU_ITEM = FIRST_MENU_ID + 6;
+ public static final int TRANSFER_MENU_ITEM = FIRST_MENU_ID + 7;
+
+ private static EditText transferText;
+
+ @Override
+ public void onCreate(Bundle savedInstance){
+ super.onCreate(savedInstance);
+ setContentView(R.layout.incall);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ boolean result = super.onCreateOptionsMenu(menu);
+
+ MenuItem m = menu.add(0, HOLD_MENU_ITEM, 0, "R.string.menu_hold");
+ m.setIcon(android.R.drawable.stat_sys_phone_call_on_hold);
+ m = menu.add(0, SPEAKER_MENU_ITEM, 0, "R.string.menu_speaker");
+ m.setIcon(android.R.drawable.stat_sys_speakerphone);
+ m = menu.add(0, MUTE_MENU_ITEM, 0, "R.string.menu_mute");
+ m.setIcon(android.R.drawable.stat_notify_call_mute);
+ m = menu.add(0, TRANSFER_MENU_ITEM, 0, "R.string.menu_transfer");
+ m.setIcon(android.R.drawable.ic_menu_call);
+ m = menu.add(0, VIDEO_MENU_ITEM, 0, "R.string.menu_video");
+ m.setIcon(android.R.drawable.ic_menu_camera);
+ m = menu.add(0, HANG_UP_MENU_ITEM, 0, "R.string.menu_endCall");
+// m.setIcon(android.R.drawable.stat_notify_call_end);
+
+ return result;
+ }
+
+ public void onClick(DialogInterface dialog, int which)
+ {
+ /* if (which == DialogInterface.BUTTON_POSITIVE)
+ Receiver.engine(this).transfer(transferText.getText().toString());*/
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ boolean result = super.onOptionsItemSelected(item);
+ Intent intent = null;
+
+ switch (item.getItemId()) {
+ case HANG_UP_MENU_ITEM:
+ // Receiver.engine(this).rejectcall();
+ break;
+
+ case HOLD_MENU_ITEM:
+ //Receiver.engine(this).togglehold();
+ break;
+
+ case TRANSFER_MENU_ITEM:
+ //transfer();
+ break;
+
+ case MUTE_MENU_ITEM:
+ //Receiver.engine(this).togglemute();
+ break;
+
+ case SPEAKER_MENU_ITEM:
+ //Receiver.engine(this).speaker(RtpStreamReceiver.speakermode == AudioManager.MODE_NORMAL?
+ // AudioManager.MODE_IN_CALL:AudioManager.MODE_NORMAL);
+ break;
+
+ case VIDEO_MENU_ITEM:
+ /*if (Receiver.call_state == UserAgent.UA_STATE_HOLD) Receiver.engine(this).togglehold();
+ try {
+ intent = new Intent(this, org.sipdroid.sipua.ui.VideoCamera.class);
+ startActivity(intent);
+ } catch (ActivityNotFoundException e) {
+ }*/
+ break;
+ }
+
+ return result;
+ }
+
+/* long enabletime;
+ KeyguardManager mKeyguardManager;
+ KeyguardManager.KeyguardLock mKeyguardLock;
+ boolean enabled;
+
+ void disableKeyguard() {
+ if (enabled) {
+ mKeyguardLock.disableKeyguard();
+ enabled = false;
+ enabletime = SystemClock.elapsedRealtime();
+ }
+ }
+
+ void reenableKeyguard() {
+ if (!enabled) {
+ if (SystemClock.elapsedRealtime() < enabletime + 500)
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ }
+ mKeyguardLock.reenableKeyguard();
+ enabled = true;
+ }
+ }
+
+ @Override
+ public void onStart() {
+ super.onStart();
+ if (mKeyguardManager == null) {
+ mKeyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
+ mKeyguardLock = mKeyguardManager.newKeyguardLock("Sipdroid");
+ enabled = true;
+ }
+ disableKeyguard();
+ }
+
+ @Override
+ public void onStop() {
+ super.onStop();
+ reenableKeyguard();
+ }
+ */
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/sipdroid/net/tools/GenericPool.java Sat Jan 23 13:42:20 2010 +0100
@@ -0,0 +1,31 @@
+package org.sipdroid.net.tools;
+
+public class GenericPool<E> extends ObjectPool<Object> {
+
+ public GenericPool(int size) {
+ super(size);
+ for(int i = 0; i < size; ++i) {
+ checkIn(create());
+ }
+ }
+
+ @Override
+ protected E create() {
+ return (E)new Object();
+ }
+
+ @Override
+ protected boolean validate(Object o) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public E borrowItem() {
+ return (E) super.checkOut();
+ }
+
+ public void returnItem(E o) {
+ super.checkIn(o);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/sipdroid/net/tools/ObjectPool.java Sat Jan 23 13:42:20 2010 +0100
@@ -0,0 +1,37 @@
+package org.sipdroid.net.tools;
+
+import java.util.ArrayList;
+
+public abstract class ObjectPool<E> {
+ private ArrayList<Object> locked, unlocked;
+
+ ObjectPool(int size){
+ locked = new ArrayList<Object>(size);
+ unlocked = new ArrayList<Object>(size);
+ }
+
+ public int getPoolSize() {
+ return locked.size() + unlocked.size();
+ }
+
+ abstract Object create();
+ abstract boolean validate( Object o );
+ synchronized Object checkOut(){
+ if(unlocked.size() > 0){
+ Object cur = unlocked.get(0);
+ unlocked.remove(cur);
+ locked.add(cur);
+ return(cur);
+ }
+ // no objects available, create a new one
+ Object o = create();
+ locked.add(o);
+ return(o);
+ }
+
+ synchronized void checkIn( Object o ) {
+ locked.remove( o );
+ unlocked.add(o);
+ }
+
+}