Interface improved

This commit is contained in:
Sylvain Berfini 2012-09-20 11:52:32 +02:00
parent 96d19d6c14
commit a0caddeb8b
27 changed files with 129 additions and 39 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

8
res/drawable/pause.xml Normal file
View file

@ -0,0 +1,8 @@
<?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/pause_over" />
<item
android:drawable="@drawable/pause_default" />
</selector>

8
res/drawable/play.xml Normal file
View file

@ -0,0 +1,8 @@
<?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/play_over" />
<item
android:drawable="@drawable/play_default" />
</selector>

8
res/drawable/remove.xml Normal file
View file

@ -0,0 +1,8 @@
<?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/call_state_delete_over" />
<item
android:drawable="@drawable/call_state_delete_default" />
</selector>

View file

@ -31,7 +31,7 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:src="@drawable/pause_default" /> android:src="@drawable/pause" />
<Chronometer <Chronometer
android:id="@+id/callTimer" android:id="@+id/callTimer"

View file

@ -33,7 +33,7 @@
<ScrollView <ScrollView
android:id="@+id/chatScrollView" android:id="@+id/chatScrollView"
android:paddingTop="10dp" android:paddingTop="5dp"
android:layout_weight="1" android:layout_weight="1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dip"> android:layout_height="0dip">

View file

@ -8,7 +8,7 @@
<ImageView <ImageView
android:contentDescription="@string/content_description_message_status" android:contentDescription="@string/content_description_message_status"
android:id="@+id/status" android:id="@+id/status"
android:layout_gravity="center_vertical" android:layout_gravity="bottom"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:adjustViewBounds="true" /> android:adjustViewBounds="true" />

View file

@ -26,7 +26,7 @@
android:layout_height="30dp" android:layout_height="30dp"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:src="@drawable/pause_default" /> android:src="@drawable/pause" />
<Chronometer <Chronometer
android:visibility="invisible" android:visibility="invisible"

View file

@ -124,10 +124,6 @@
android:contentDescription="@string/content_description_dialer" android:contentDescription="@string/content_description_dialer"
android:scaleType="fitXY" android:scaleType="fitXY"
android:src="@drawable/dialer" /> android:src="@drawable/dialer" />
<include layout="@layout/menu_settings_button" />
<include layout="@layout/menu_about_settings_button" />
<include layout="@layout/menu_about_chat_button" /> <include layout="@layout/menu_about_chat_button" />
@ -151,6 +147,10 @@
android:visibility="gone" /> android:visibility="gone" />
</RelativeLayout> </RelativeLayout>
<include layout="@layout/menu_settings_button" />
<include layout="@layout/menu_about_settings_button" />
</LinearLayout> </LinearLayout>

View file

@ -17,9 +17,10 @@
<bool name="hide_camera_settings">false</bool> <bool name="hide_camera_settings">false</bool>
<bool name="hide_wizard">false</bool> <bool name="hide_wizard">false</bool>
<bool name="hide_accounts">false</bool> <bool name="hide_accounts">false</bool>
<bool name="useFirstLoginActivity">false</bool> <bool name="useFirstLoginActivity">true</bool>
<bool name="disable_animations">false</bool> <bool name="disable_animations">false</bool>
<bool name="show_statusbar_only_on_dialer">true</bool>
<bool name="lock_statusbar">false</bool> <bool name="lock_statusbar">false</bool>
<bool name="emoticons_in_messages">true</bool> <bool name="emoticons_in_messages">true</bool>
<bool name="only_display_username_if_unknown">true</bool> <bool name="only_display_username_if_unknown">true</bool>

View file

@ -78,9 +78,9 @@ public class AudioCallFragment extends Fragment implements OnClickListener {
ImageView conferenceState = (ImageView) conferenceHeader.findViewById(R.id.conferenceStatus); ImageView conferenceState = (ImageView) conferenceHeader.findViewById(R.id.conferenceStatus);
conferenceState.setOnClickListener(this); conferenceState.setOnClickListener(this);
if (LinphoneManager.getLc().isInConference()) { if (LinphoneManager.getLc().isInConference()) {
conferenceState.setImageResource(R.drawable.play_default); conferenceState.setImageResource(R.drawable.play);
} else { } else {
conferenceState.setImageResource(R.drawable.pause_default); conferenceState.setImageResource(R.drawable.pause);
} }
callsList.addView(conferenceHeader); callsList.addView(conferenceHeader);
@ -121,7 +121,7 @@ public class AudioCallFragment extends Fragment implements OnClickListener {
callState.setOnClickListener(this); callState.setOnClickListener(this);
if (call.getState() == State.Paused || call.getState() == State.PausedByRemote || call.getState() == State.Pausing) { if (call.getState() == State.Paused || call.getState() == State.PausedByRemote || call.getState() == State.Pausing) {
callState.setImageResource(R.drawable.pause_default); callState.setImageResource(R.drawable.pause);
isCallPaused = true; isCallPaused = true;
isInConference = false; isInConference = false;
} else if (call.getState() == State.OutgoingInit || call.getState() == State.OutgoingProgress || call.getState() == State.OutgoingRinging) { } else if (call.getState() == State.OutgoingInit || call.getState() == State.OutgoingProgress || call.getState() == State.OutgoingRinging) {
@ -130,10 +130,10 @@ public class AudioCallFragment extends Fragment implements OnClickListener {
isInConference = false; isInConference = false;
} else { } else {
if (isConferenceRunning && call.isInConference()) { if (isConferenceRunning && call.isInConference()) {
callState.setImageResource(R.drawable.call_state_delete_default); callState.setImageResource(R.drawable.remove);
isInConference = true; isInConference = true;
} else { } else {
callState.setImageResource(R.drawable.play_default); callState.setImageResource(R.drawable.play);
isInConference = false; isInConference = false;
} }
isCallPaused = false; isCallPaused = false;

View file

@ -49,6 +49,7 @@ import android.database.Cursor;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat; import android.graphics.Bitmap.CompressFormat;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.graphics.Rect;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment; import android.os.Environment;
@ -64,6 +65,7 @@ import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.ProgressBar; import android.widget.ProgressBar;
@ -161,10 +163,40 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
} }
uploadServerUri = getActivity().getResources().getString(R.string.upload_url); uploadServerUri = getActivity().getResources().getString(R.string.upload_url);
addVirtualKeyboardVisiblityListener();
return view; return view;
} }
private void addVirtualKeyboardVisiblityListener() {
view.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
Rect visibleArea = new Rect();
view.getWindowVisibleDisplayFrame(visibleArea);
int heightDiff = view.getRootView().getHeight() - (visibleArea.bottom - visibleArea.top);
if (heightDiff > 200) {
showKeyboardVisibleMode();
} else {
hideKeyboardVisibleMode();
}
}
});
}
public void showKeyboardVisibleMode() {
LinphoneActivity.instance().hideMenu(true);
contactPicture.setVisibility(View.GONE);
scrollToEnd();
}
public void hideKeyboardVisibleMode() {
LinphoneActivity.instance().hideMenu(false);
contactPicture.setVisibility(View.VISIBLE);
scrollToEnd();
}
private void invalidate() { private void invalidate() {
messagesLayout.removeAllViews(); messagesLayout.removeAllViews();
List<ChatMessage> messagesList = LinphoneActivity.instance().getChatMessages(sipUri); List<ChatMessage> messagesList = LinphoneActivity.instance().getChatMessages(sipUri);
@ -290,14 +322,12 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
public void onPause() { public void onPause() {
super.onPause(); super.onPause();
latestImageMessages = null; latestImageMessages = null;
Log.e("Deleted hashmap");
} }
@SuppressLint("UseSparseArrays") @SuppressLint("UseSparseArrays")
@Override @Override
public void onResume() { public void onResume() {
latestImageMessages = new HashMap<Integer, String>(); latestImageMessages = new HashMap<Integer, String>();
Log.e("New hashmap");
super.onResume(); super.onResume();
@ -342,7 +372,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
newId = LinphoneActivity.instance().onMessageSent(sipUri, bitmap, url); newId = LinphoneActivity.instance().onMessageSent(sipUri, bitmap, url);
} }
latestImageMessages.put(newId, url); latestImageMessages.put(newId, url);
Log.e("Add " + newId + ", " + url + " to hashmap");
displayImageMessage(newId, bitmap, String.valueOf(System.currentTimeMillis()), false, State.InProgress, messagesLayout); displayImageMessage(newId, bitmap, String.valueOf(System.currentTimeMillis()), false, State.InProgress, messagesLayout);
scrollToEnd(); scrollToEnd();

View file

@ -159,8 +159,8 @@ public class DialerFragment extends Fragment {
mAddContact.setEnabled(true); mAddContact.setEnabled(true);
mAddContact.setImageResource(R.drawable.cancel); mAddContact.setImageResource(R.drawable.cancel);
mAddContact.setOnClickListener(cancelListener); mAddContact.setOnClickListener(cancelListener);
} else {
mAddress.setText(""); mAddress.setText("");
} else {
mCall.setImageResource(R.drawable.call); mCall.setImageResource(R.drawable.call);
mAddContact.setEnabled(true); mAddContact.setEnabled(true);
mAddContact.setImageResource(R.drawable.add_contact); mAddContact.setImageResource(R.drawable.add_contact);

View file

@ -59,20 +59,20 @@ public enum FragmentsAvailable {
case DIALER: case DIALER:
return CONTACTS.isRightOf(fragment) || fragment == CONTACT || fragment == CONTACTS; return CONTACTS.isRightOf(fragment) || fragment == CONTACT || fragment == CONTACTS;
case ABOUT_INSTEAD_OF_SETTINGS:
case SETTINGS:
return DIALER.isRightOf(fragment) || fragment == DIALER;
case ACCOUNT_SETTINGS:
return SETTINGS.isRightOf(fragment) || fragment == SETTINGS;
case ABOUT_INSTEAD_OF_CHAT: case ABOUT_INSTEAD_OF_CHAT:
case CHATLIST: case CHATLIST:
return ACCOUNT_SETTINGS.isRightOf(fragment) || fragment == ACCOUNT_SETTINGS || fragment == FragmentsAvailable.ABOUT_INSTEAD_OF_SETTINGS; return DIALER.isRightOf(fragment) || fragment == DIALER;
case CHAT: case CHAT:
return CHATLIST.isRightOf(fragment) || fragment == CHATLIST; return CHATLIST.isRightOf(fragment) || fragment == CHATLIST;
case ABOUT_INSTEAD_OF_SETTINGS:
case SETTINGS:
return CHATLIST.isRightOf(fragment) || fragment == CHATLIST || fragment == FragmentsAvailable.ABOUT_INSTEAD_OF_CHAT;
case ACCOUNT_SETTINGS:
return SETTINGS.isRightOf(fragment) || fragment == SETTINGS;
default: default:
return false; return false;
} }

View file

@ -89,10 +89,11 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
private static final int callActivity = 19; private static final int callActivity = 19;
private static LinphoneActivity instance; private static LinphoneActivity instance;
private StatusFragment statusFragment; private StatusFragment statusFragment;
private TextView missedCalls, missedChats; private TextView missedCalls, missedChats;
private ImageView dialer; private ImageView dialer;
private LinearLayout menu, mark;
private RelativeLayout contacts, history, settings, chat, aboutChat, aboutSettings; private RelativeLayout contacts, history, settings, chat, aboutChat, aboutSettings;
private FragmentsAvailable currentFragment, nextFragment; private FragmentsAvailable currentFragment, nextFragment;
private Fragment dialerFragment, messageListenerFragment; private Fragment dialerFragment, messageListenerFragment;
@ -161,6 +162,9 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
} }
private void initButtons() { private void initButtons() {
menu = (LinearLayout) findViewById(R.id.menu);
mark = (LinearLayout) findViewById(R.id.mark);
history = (RelativeLayout) findViewById(R.id.history); history = (RelativeLayout) findViewById(R.id.history);
history.setOnClickListener(this); history.setOnClickListener(this);
contacts = (RelativeLayout) findViewById(R.id.contacts); contacts = (RelativeLayout) findViewById(R.id.contacts);
@ -192,6 +196,23 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
missedChats = (TextView) findViewById(R.id.missedChats); missedChats = (TextView) findViewById(R.id.missedChats);
} }
private void hideStatusBar() {
if (statusFragment == null) {
return;
}
statusFragment.getView().setVisibility(View.GONE);
findViewById(R.id.fragmentContainer).setPadding(0, 0, 0, 0);
}
private void showStatusBar() {
if (statusFragment == null) {
return;
}
statusFragment.getView().setVisibility(View.VISIBLE);
findViewById(R.id.fragmentContainer).setPadding(0, LinphoneUtils.pixelsToDpi(getResources(), 40), 0, 0);
}
private void changeCurrentFragment(FragmentsAvailable newFragmentType, Bundle extras) { private void changeCurrentFragment(FragmentsAvailable newFragmentType, Bundle extras) {
changeCurrentFragment(newFragmentType, extras, false); changeCurrentFragment(newFragmentType, extras, false);
} }
@ -263,8 +284,16 @@ 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) {
if (statusFragment != null) { if (getResources().getBoolean(R.bool.show_statusbar_only_on_dialer)) {
statusFragment.closeStatusBar(); if (newFragmentType == FragmentsAvailable.DIALER) {
showStatusBar();
} else {
hideStatusBar();
}
} else {
if (statusFragment != null) {
statusFragment.closeStatusBar();
}
} }
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
@ -291,8 +320,16 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
} }
private void changeFragmentForTablets(Fragment newFragment, FragmentsAvailable newFragmentType, boolean withoutAnimation) { private void changeFragmentForTablets(Fragment newFragment, FragmentsAvailable newFragmentType, boolean withoutAnimation) {
if (statusFragment != null) { if (getResources().getBoolean(R.bool.show_statusbar_only_on_dialer)) {
statusFragment.closeStatusBar(); if (newFragmentType == FragmentsAvailable.DIALER) {
showStatusBar();
} else {
hideStatusBar();
}
} else {
if (statusFragment != null) {
statusFragment.closeStatusBar();
}
} }
LinearLayout ll = (LinearLayout) findViewById(R.id.fragmentContainer2); LinearLayout ll = (LinearLayout) findViewById(R.id.fragmentContainer2);
@ -528,7 +565,12 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
public void updateChatFragment(ChatFragment fragment) { public void updateChatFragment(ChatFragment fragment) {
messageListenerFragment = fragment; messageListenerFragment = fragment;
// Hack to maintain ADJUST_PAN flag // Hack to maintain ADJUST_PAN flag
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
}
public void hideMenu(boolean hide) {
menu.setVisibility(hide ? View.GONE : View.VISIBLE);
mark.setVisibility(hide ? View.GONE : View.VISIBLE);
} }
public void updateStatusFragment(StatusFragment fragment) { public void updateStatusFragment(StatusFragment fragment) {
@ -756,12 +798,6 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
changeCurrentFragment(FragmentsAvailable.DIALER, null); changeCurrentFragment(FragmentsAvailable.DIALER, null);
} }
public void onRegistrationStateChanged(RegistrationState state, String message) {
if (statusFragment != null) {
statusFragment.registrationStateChanged(state);
}
}
public void startVideoActivity(LinphoneCall currentCall) { public void startVideoActivity(LinphoneCall currentCall) {
Intent intent = new Intent(this, InCallActivity.class); Intent intent = new Intent(this, InCallActivity.class);
intent.putExtra("VideoEnabled", true); intent.putExtra("VideoEnabled", true);

View file

@ -515,7 +515,7 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
mHandler.post(new Runnable() { mHandler.post(new Runnable() {
public void run() { public void run() {
if (LinphoneActivity.isInstanciated()) { if (LinphoneActivity.isInstanciated()) {
LinphoneActivity.instance().onRegistrationStateChanged(state, message); LinphoneActivity.instance().onRegistrationStateChanged(state);
} }
} }
}); });