Small fixes

This commit is contained in:
Sylvain Berfini 2012-09-11 15:45:35 +02:00
parent 657c0d7790
commit a2c3e16158
4 changed files with 38 additions and 38 deletions

View file

@ -6,9 +6,9 @@
android:radius="25dp" />
<stroke
android:color="@color/nmissed_calls_background" />
android:color="@color/missed_calls_background" />
<solid
android:color="@color/nmissed_calls_background" />
android:color="@color/missed_calls_background" />
</shape>

View file

@ -9,7 +9,8 @@
<color name="numpad_background_bottom">#ffe4edf2</color>
<color name="numpad_background_dialer">#ffd8d8d8</color>
<color name="numpad_background_top">#ffb1bdc3</color>
<color name="nmissed_calls_background">#ffcf4c29</color>
<color name="missed_calls_background">#ffcf4c29</color>
<color name="transparent">#00000000</color>
</resources>

View file

@ -38,9 +38,7 @@ import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
@ -51,8 +49,6 @@ import android.view.animation.AnimationUtils;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
/**
* @author Sylvain Berfini
@ -640,11 +636,7 @@ public class InCallActivity extends FragmentActivity implements
}
@Override
public void onCallStateChanged(final LinphoneCall call, State state, String message) {
if (state==State.Error) {
displayCustomToast(null, message, Toast.LENGTH_LONG);
}
public void onCallStateChanged(final LinphoneCall call, State state, String message) {
if (LinphoneManager.getLc().getCallsNb() == 0) {
finish();
return;
@ -681,32 +673,6 @@ public class InCallActivity extends FragmentActivity implements
transfer.setEnabled(LinphoneManager.getLc().getCurrentCall() != null);
}
private void displayCustomToast(final String title, final String message, final int duration) {
mHandler.post(new Runnable() {
@Override
public void run() {
LayoutInflater inflater = getLayoutInflater();
View layout = inflater.inflate(R.layout.toast, (ViewGroup) findViewById(R.id.toastRoot));
TextView toastTitle = (TextView) layout.findViewById(R.id.toastTitle);
if (title == null) {
toastTitle.setVisibility(View.GONE);
} else {
toastTitle.setText(title);
}
TextView toastText = (TextView) layout.findViewById(R.id.toastMessage);
toastText.setText(message);
final Toast toast = new Toast(getApplicationContext());
toast.setGravity(Gravity.CENTER, 0, 0);
toast.setDuration(duration);
toast.setView(layout);
toast.show();
}
});
}
@Override
public void onCallEncryptionChanged(final LinphoneCall call, boolean encrypted, String authenticationToken) {

View file

@ -59,7 +59,9 @@ import android.support.v4.app.Fragment.SavedState;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.OrientationEventListener;
import android.view.View;
import android.view.View.OnClickListener;
@ -71,6 +73,7 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
/**
* @author Sylvain Berfini
@ -672,6 +675,10 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
@Override
public void onCallStateChanged(LinphoneCall call, State state, String message) {
if (state == State.Error) {
displayCustomToast(null, message, Toast.LENGTH_LONG);
}
if (state == State.IncomingReceived) {
startActivity(new Intent(this, IncomingCallActivity.class));
} else if (state == State.OutgoingInit) {
@ -687,6 +694,32 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
int missedCalls = LinphoneManager.getLc().getMissedCallsCount();
displayMissedCalls(missedCalls);
}
private void displayCustomToast(final String title, final String message, final int duration) {
mHandler.post(new Runnable() {
@Override
public void run() {
LayoutInflater inflater = getLayoutInflater();
View layout = inflater.inflate(R.layout.toast, (ViewGroup) findViewById(R.id.toastRoot));
TextView toastTitle = (TextView) layout.findViewById(R.id.toastTitle);
if (title == null) {
toastTitle.setVisibility(View.GONE);
} else {
toastTitle.setText(title);
}
TextView toastText = (TextView) layout.findViewById(R.id.toastMessage);
toastText.setText(message);
final Toast toast = new Toast(getApplicationContext());
toast.setGravity(Gravity.CENTER, 0, 0);
toast.setDuration(duration);
toast.setView(layout);
toast.show();
}
});
}
@Override
public void setAddresGoToDialerAndCall(String number, String name, Uri photo) {