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:scaleType="fitCenter"
android:adjustViewBounds="true"
android:src="@drawable/pause_default" />
android:src="@drawable/pause" />
<Chronometer
android:id="@+id/callTimer"

View file

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

View file

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

View file

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

View file

@ -125,10 +125,6 @@
android:scaleType="fitXY"
android:src="@drawable/dialer" />
<include layout="@layout/menu_settings_button" />
<include layout="@layout/menu_about_settings_button" />
<include layout="@layout/menu_about_chat_button" />
<RelativeLayout
@ -152,6 +148,10 @@
</RelativeLayout>
<include layout="@layout/menu_settings_button" />
<include layout="@layout/menu_about_settings_button" />
</LinearLayout>
</RelativeLayout>

View file

@ -17,9 +17,10 @@
<bool name="hide_camera_settings">false</bool>
<bool name="hide_wizard">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="show_statusbar_only_on_dialer">true</bool>
<bool name="lock_statusbar">false</bool>
<bool name="emoticons_in_messages">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);
conferenceState.setOnClickListener(this);
if (LinphoneManager.getLc().isInConference()) {
conferenceState.setImageResource(R.drawable.play_default);
conferenceState.setImageResource(R.drawable.play);
} else {
conferenceState.setImageResource(R.drawable.pause_default);
conferenceState.setImageResource(R.drawable.pause);
}
callsList.addView(conferenceHeader);
@ -121,7 +121,7 @@ public class AudioCallFragment extends Fragment implements OnClickListener {
callState.setOnClickListener(this);
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;
isInConference = false;
} 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;
} else {
if (isConferenceRunning && call.isInConference()) {
callState.setImageResource(R.drawable.call_state_delete_default);
callState.setImageResource(R.drawable.remove);
isInConference = true;
} else {
callState.setImageResource(R.drawable.play_default);
callState.setImageResource(R.drawable.play);
isInConference = false;
}
isCallPaused = false;

View file

@ -49,6 +49,7 @@ import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.graphics.BitmapFactory;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
@ -64,6 +65,7 @@ import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ProgressBar;
@ -161,10 +163,40 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
}
uploadServerUri = getActivity().getResources().getString(R.string.upload_url);
addVirtualKeyboardVisiblityListener();
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() {
messagesLayout.removeAllViews();
List<ChatMessage> messagesList = LinphoneActivity.instance().getChatMessages(sipUri);
@ -290,14 +322,12 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
public void onPause() {
super.onPause();
latestImageMessages = null;
Log.e("Deleted hashmap");
}
@SuppressLint("UseSparseArrays")
@Override
public void onResume() {
latestImageMessages = new HashMap<Integer, String>();
Log.e("New hashmap");
super.onResume();
@ -342,7 +372,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
newId = LinphoneActivity.instance().onMessageSent(sipUri, bitmap, url);
}
latestImageMessages.put(newId, url);
Log.e("Add " + newId + ", " + url + " to hashmap");
displayImageMessage(newId, bitmap, String.valueOf(System.currentTimeMillis()), false, State.InProgress, messagesLayout);
scrollToEnd();

View file

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

View file

@ -59,20 +59,20 @@ public enum FragmentsAvailable {
case DIALER:
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 CHATLIST:
return ACCOUNT_SETTINGS.isRightOf(fragment) || fragment == ACCOUNT_SETTINGS || fragment == FragmentsAvailable.ABOUT_INSTEAD_OF_SETTINGS;
return DIALER.isRightOf(fragment) || fragment == DIALER;
case CHAT:
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:
return false;
}

View file

@ -93,6 +93,7 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
private StatusFragment statusFragment;
private TextView missedCalls, missedChats;
private ImageView dialer;
private LinearLayout menu, mark;
private RelativeLayout contacts, history, settings, chat, aboutChat, aboutSettings;
private FragmentsAvailable currentFragment, nextFragment;
private Fragment dialerFragment, messageListenerFragment;
@ -161,6 +162,9 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
}
private void initButtons() {
menu = (LinearLayout) findViewById(R.id.menu);
mark = (LinearLayout) findViewById(R.id.mark);
history = (RelativeLayout) findViewById(R.id.history);
history.setOnClickListener(this);
contacts = (RelativeLayout) findViewById(R.id.contacts);
@ -192,6 +196,23 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
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) {
changeCurrentFragment(newFragmentType, extras, false);
}
@ -263,8 +284,16 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
}
private void changeFragment(Fragment newFragment, FragmentsAvailable newFragmentType, boolean withoutAnimation) {
if (statusFragment != null) {
statusFragment.closeStatusBar();
if (getResources().getBoolean(R.bool.show_statusbar_only_on_dialer)) {
if (newFragmentType == FragmentsAvailable.DIALER) {
showStatusBar();
} else {
hideStatusBar();
}
} else {
if (statusFragment != null) {
statusFragment.closeStatusBar();
}
}
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
@ -291,8 +320,16 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
}
private void changeFragmentForTablets(Fragment newFragment, FragmentsAvailable newFragmentType, boolean withoutAnimation) {
if (statusFragment != null) {
statusFragment.closeStatusBar();
if (getResources().getBoolean(R.bool.show_statusbar_only_on_dialer)) {
if (newFragmentType == FragmentsAvailable.DIALER) {
showStatusBar();
} else {
hideStatusBar();
}
} else {
if (statusFragment != null) {
statusFragment.closeStatusBar();
}
}
LinearLayout ll = (LinearLayout) findViewById(R.id.fragmentContainer2);
@ -528,7 +565,12 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
public void updateChatFragment(ChatFragment fragment) {
messageListenerFragment = fragment;
// 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) {
@ -756,12 +798,6 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
changeCurrentFragment(FragmentsAvailable.DIALER, null);
}
public void onRegistrationStateChanged(RegistrationState state, String message) {
if (statusFragment != null) {
statusFragment.registrationStateChanged(state);
}
}
public void startVideoActivity(LinphoneCall currentCall) {
Intent intent = new Intent(this, InCallActivity.class);
intent.putExtra("VideoEnabled", true);

View file

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