Sliding status bar + better incall options

This commit is contained in:
Sylvain Berfini 2012-07-18 13:03:37 +02:00
parent 0d9a0c1fb3
commit 8a84b10332
29 changed files with 1598 additions and 389 deletions

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/options_add_over_alt" />
<item android:state_enabled="false"
android:drawable="@drawable/options_add_disabled_alt" />
<item
android:drawable="@drawable/options_add_default_alt" />
</selector>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/options_over_alt" />
<item android:state_enabled="false"
android:drawable="@drawable/options_disabled_alt" />
<item android:state_selected="true"
android:drawable="@drawable/options_selected_alt" />
<item
android:drawable="@drawable/options_default_alt" />
</selector>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -1,24 +1,25 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/fragmentContainer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" > android:paddingTop="20dp"
android:orientation="horizontal" />
<fragment android:name="org.linphone.StatusFragment" <fragment android:name="org.linphone.StatusFragment"
android:id="@+id/status" android:id="@+id/status"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<RelativeLayout </FrameLayout>
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1">
<LinearLayout
android:id="@+id/fragmentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" />
<ImageView <ImageView
android:id="@+id/switchCamera" android:id="@+id/switchCamera"
@ -101,7 +102,7 @@
android:visibility="gone" android:visibility="gone"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="75dp" android:layout_height="75dp"
android:src="@drawable/options_add_call" android:src="@drawable/options_add_call_alt"
android:scaleType="fitXY" android:scaleType="fitXY"
android:layout_weight="0.25" /> android:layout_weight="0.25" />
@ -182,10 +183,9 @@
android:src="@drawable/dialer_alt" android:src="@drawable/dialer_alt"
android:scaleType="fitXY" android:scaleType="fitXY"
android:layout_weight="0.3"/> android:layout_weight="0.3"/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
</LinearLayout>

View file

@ -1,35 +1,27 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" > android:layout_height="match_parent">
<!-- <ImageView <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:id="@+id/tutorial"/> --> android:layout_alignParentTop="true">
<LinearLayout <LinearLayout
android:id="@+id/fragmentContainer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:weightSum="6" android:paddingTop="20dp"
android:orientation="vertical"> android:paddingBottom="75dp"
android:orientation="horizontal" />
<fragment android:name="org.linphone.StatusFragment" <fragment android:name="org.linphone.StatusFragment"
android:id="@+id/status" android:id="@+id/status"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
</FrameLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/fragmentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="75dp"
android:orientation="horizontal" />
<LinearLayout <LinearLayout
android:id="@+id/menu" android:id="@+id/menu"
@ -120,8 +112,4 @@
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
</LinearLayout>
</FrameLayout>

View file

@ -1,8 +1,42 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout
xmlns:linphone="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<org.linphone.ui.SlidingDrawer
android:id="@+id/statusBar"
linphone:direction="topToBottom"
android:layout_width="fill_parent"
android:layout_height="80dp"
linphone:handle="@+id/handle"
linphone:content="@+id/content">
<RelativeLayout
android:id="@id/content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="horizontal" > android:background="@android:color/black">
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/menu_exit" />
</RelativeLayout>
<RelativeLayout
android:id="@id/handle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="match_parent"
android:layout_height="20dp"
android:scaleType="fitXY"
android:src="@drawable/statebar_background"/>
<TextView <TextView
android:id="@+id/statusText" android:id="@+id/statusText"
@ -23,7 +57,7 @@
android:contentDescription="@string/content_description_call_quality" android:contentDescription="@string/content_description_call_quality"
android:id="@+id/callQuality" android:id="@+id/callQuality"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="17dp" android:layout_height="20dp"
android:src="@drawable/call_quality_indicator_0" android:src="@drawable/call_quality_indicator_0"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:visibility="gone" /> android:visibility="gone" />
@ -32,9 +66,13 @@
android:contentDescription="@string/content_description_encryption" android:contentDescription="@string/content_description_encryption"
android:id="@+id/encryption" android:id="@+id/encryption"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="17dp" android:layout_height="20dp"
android:src="@drawable/security_pending" android:src="@drawable/security_pending"
android:visibility="gone" android:visibility="gone"
android:layout_alignParentRight="true" /> android:layout_alignParentRight="true" />
</RelativeLayout>
</org.linphone.ui.SlidingDrawer>
</RelativeLayout> </RelativeLayout>

15
res/values/attrs.xml Normal file
View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr name="direction">
<enum name="rightToLeft" value="0" />
<enum name="bottomToTop" value="1" />
<enum name="leftToRight" value="2" />
<enum name="topToBottom" value="3" />
</attr>
<declare-styleable name="SlidingDrawer">
<attr name="handle" format="reference" />
<attr name="content" format="reference" />
<attr name="direction" />
</declare-styleable>
</resources>

View file

@ -11,6 +11,7 @@
<bool name="hide_accounts">false</bool> <bool name="hide_accounts">false</bool>
<bool name="useFirstLoginActivity">false</bool> <bool name="useFirstLoginActivity">false</bool>
<bool name="disable_animations">false</bool> <bool name="disable_animations">false</bool>
<bool name="lock_statusbar">false</bool>
<bool name="only_display_username_if_unknown">true</bool> <bool name="only_display_username_if_unknown">true</bool>
<bool name="show_full_remote_address_on_incoming_call">true</bool> <bool name="show_full_remote_address_on_incoming_call">true</bool>
<bool name="display_messages_time">true</bool> <!-- Used to show the time of each message arrival --> <bool name="display_messages_time">true</bool> <!-- Used to show the time of each message arrival -->

View file

@ -436,30 +436,13 @@ public class InCallActivity extends FragmentActivity implements
private void hideOrDisplayCallOptions() { private void hideOrDisplayCallOptions() {
if (addCall.getVisibility() == View.VISIBLE) { if (addCall.getVisibility() == View.VISIBLE) {
options.setImageResource(R.drawable.options);
if (getResources().getBoolean(R.bool.disable_animations)) { if (getResources().getBoolean(R.bool.disable_animations)) {
transfer.setVisibility(View.GONE); transfer.setVisibility(View.GONE);
addCall.setVisibility(View.GONE); addCall.setVisibility(View.GONE);
} else { } else {
final Animation animAddCall = AnimationUtils.loadAnimation(this, R.anim.slide_out_top_to_bottom); Animation anim = AnimationUtils.loadAnimation(this, R.anim.slide_out_left_to_right);
animAddCall.setAnimationListener(new AnimationListener() { anim.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
addCall.setVisibility(View.GONE);
}
});
Animation animTransfer = AnimationUtils.loadAnimation(this, R.anim.slide_out_top_to_bottom);
animTransfer.setAnimationListener(new AnimationListener() {
@Override @Override
public void onAnimationStart(Animation animation) { public void onAnimationStart(Animation animation) {
@ -473,21 +456,23 @@ public class InCallActivity extends FragmentActivity implements
@Override @Override
public void onAnimationEnd(Animation animation) { public void onAnimationEnd(Animation animation) {
transfer.setVisibility(View.GONE); transfer.setVisibility(View.GONE);
addCall.startAnimation(animAddCall); addCall.setVisibility(View.GONE);
} }
}); });
transfer.startAnimation(animTransfer); transfer.startAnimation(anim);
addCall.startAnimation(anim);
} }
} else { } else {
if (getResources().getBoolean(R.bool.disable_animations)) { if (getResources().getBoolean(R.bool.disable_animations)) {
transfer.setVisibility(View.VISIBLE); transfer.setVisibility(View.VISIBLE);
addCall.setVisibility(View.VISIBLE); addCall.setVisibility(View.VISIBLE);
options.setImageResource(R.drawable.options_alt);
} else { } else {
final Animation animTransfer = AnimationUtils.loadAnimation(this, R.anim.slide_in_bottom_to_top); Animation anim = AnimationUtils.loadAnimation(this, R.anim.slide_in_right_to_left);
animTransfer.setAnimationListener(new AnimationListener() { anim.setAnimationListener(new AnimationListener() {
@Override @Override
public void onAnimationStart(Animation animation) { public void onAnimationStart(Animation animation) {
transfer.setVisibility(View.VISIBLE);
} }
@Override @Override
@ -497,27 +482,13 @@ public class InCallActivity extends FragmentActivity implements
@Override @Override
public void onAnimationEnd(Animation animation) { public void onAnimationEnd(Animation animation) {
} options.setImageResource(R.drawable.options_alt);
}); transfer.setVisibility(View.VISIBLE);
Animation animAddCall = AnimationUtils.loadAnimation(this, R.anim.slide_in_bottom_to_top);
animAddCall.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
addCall.setVisibility(View.VISIBLE); addCall.setVisibility(View.VISIBLE);
} }
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
transfer.startAnimation(animTransfer);
}
}); });
addCall.startAnimation(animAddCall); transfer.startAnimation(anim);
addCall.startAnimation(anim);
} }
} }
} }

View file

@ -206,7 +206,6 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
private void changeFragment(Fragment newFragment, FragmentsAvailable newFragmentType, boolean withoutAnimation) { private void changeFragment(Fragment newFragment, FragmentsAvailable newFragmentType, boolean withoutAnimation) {
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
if (currentFragment.shouldAddToBackStack()) {
if (!withoutAnimation && !getResources().getBoolean(R.bool.disable_animations) && currentFragment.shouldAnimate()) { if (!withoutAnimation && !getResources().getBoolean(R.bool.disable_animations) && currentFragment.shouldAnimate()) {
if (newFragmentType.isRightOf(currentFragment)) { if (newFragmentType.isRightOf(currentFragment)) {
transaction.setCustomAnimations(R.anim.slide_in_right_to_left, R.anim.slide_out_right_to_left, R.anim.slide_in_left_to_right, R.anim.slide_out_left_to_right); transaction.setCustomAnimations(R.anim.slide_in_right_to_left, R.anim.slide_out_right_to_left, R.anim.slide_in_left_to_right, R.anim.slide_out_left_to_right);
@ -214,16 +213,13 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
transaction.setCustomAnimations(R.anim.slide_in_left_to_right, R.anim.slide_out_left_to_right, R.anim.slide_in_right_to_left, R.anim.slide_out_right_to_left); transaction.setCustomAnimations(R.anim.slide_in_left_to_right, R.anim.slide_out_left_to_right, R.anim.slide_in_right_to_left, R.anim.slide_out_right_to_left);
} }
} }
getSupportFragmentManager().popBackStack(newFragmentType.toString(), FragmentManager.POP_BACK_STACK_INCLUSIVE);
transaction.addToBackStack(newFragmentType.toString());
}
else {
try { try {
getSupportFragmentManager().popBackStack("Add to back stack", FragmentManager.POP_BACK_STACK_INCLUSIVE); getSupportFragmentManager().popBackStack(newFragmentType.toString(), FragmentManager.POP_BACK_STACK_INCLUSIVE);
} catch (java.lang.IllegalStateException e) { } catch (java.lang.IllegalStateException e) {
} }
}
transaction.addToBackStack(newFragmentType.toString());
transaction.replace(R.id.fragmentContainer, newFragment); transaction.replace(R.id.fragmentContainer, newFragment);
transaction.commitAllowingStateLoss(); transaction.commitAllowingStateLoss();
@ -658,6 +654,9 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
return true; return true;
} }
} }
if (keyCode == KeyEvent.KEYCODE_MENU && statusFragment != null) {
statusFragment.openOrCloseStatusBar();
}
return super.onKeyDown(keyCode, event); return super.onKeyDown(keyCode, event);
} }
} }

View file

@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
import org.linphone.core.LinphoneCall; import org.linphone.core.LinphoneCall;
import org.linphone.core.LinphoneCore.MediaEncryption; import org.linphone.core.LinphoneCore.MediaEncryption;
import org.linphone.core.LinphoneCore.RegistrationState; import org.linphone.core.LinphoneCore.RegistrationState;
import org.linphone.ui.SlidingDrawer;
import android.app.Activity; import android.app.Activity;
import android.os.Bundle; import android.os.Bundle;
@ -40,6 +41,7 @@ public class StatusFragment extends Fragment {
private Handler refreshHandler = new Handler(); private Handler refreshHandler = new Handler();
private TextView statusText; private TextView statusText;
private ImageView statusLed, callQuality, encryption; private ImageView statusLed, callQuality, encryption;
private SlidingDrawer drawer;
private Runnable mCallQualityUpdater; private Runnable mCallQualityUpdater;
private boolean isInCall, isAttached = false; private boolean isInCall, isAttached = false;
@ -54,6 +56,8 @@ public class StatusFragment extends Fragment {
callQuality = (ImageView) view.findViewById(R.id.callQuality); callQuality = (ImageView) view.findViewById(R.id.callQuality);
encryption = (ImageView) view.findViewById(R.id.encryption); encryption = (ImageView) view.findViewById(R.id.encryption);
drawer = (SlidingDrawer) view.findViewById(R.id.statusBar);
return view; return view;
} }
@ -84,6 +88,18 @@ public class StatusFragment extends Fragment {
isAttached = false; isAttached = false;
} }
public void openOrCloseStatusBar() {
if (getResources().getBoolean(R.bool.lock_statusbar)) {
return;
}
if (getResources().getBoolean(R.bool.disable_animations)) {
drawer.toggle();
} else {
drawer.animateToggle();
}
}
public void registrationStateChanged(final RegistrationState state) { public void registrationStateChanged(final RegistrationState state) {
if (!isAttached) if (!isAttached)
return; return;
@ -173,6 +189,14 @@ public class StatusFragment extends Fragment {
// We are obviously connected // We are obviously connected
statusLed.setImageResource(R.drawable.led_connected); statusLed.setImageResource(R.drawable.led_connected);
statusText.setText(getString(R.string.status_connected)); statusText.setText(getString(R.string.status_connected));
if (drawer != null) {
drawer.lock();
}
} else {
if (drawer != null && !getResources().getBoolean(R.bool.lock_statusbar)) {
drawer.unlock();
}
} }
} }

File diff suppressed because it is too large Load diff