Improved dialer loading & numpad in call loading + no more white screen while activity is loading
This commit is contained in:
parent
45254d3261
commit
b1c8219c7b
26 changed files with 133 additions and 91 deletions
|
@ -67,8 +67,7 @@
|
|||
|
||||
<activity
|
||||
android:name=".activities.LinphoneLauncherActivity"
|
||||
android:noHistory="true"
|
||||
android:theme="@style/LinphoneLauncherStyle">
|
||||
android:noHistory="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
|
|
|
@ -23,12 +23,14 @@ import android.Manifest;
|
|||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.TextureView;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.asynclayoutinflater.view.AsyncLayoutInflater;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import org.linphone.LinphoneManager;
|
||||
|
@ -55,6 +57,7 @@ public class DialerActivity extends MainActivity implements AddressText.AddressC
|
|||
|
||||
private boolean mIsTransfer;
|
||||
private CoreListenerStub mListener;
|
||||
private boolean mInterfaceLoaded;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -63,62 +66,32 @@ public class DialerActivity extends MainActivity implements AddressText.AddressC
|
|||
return;
|
||||
}
|
||||
|
||||
mInterfaceLoaded = false;
|
||||
// Uses the fragment container layout to inflate the dialer view instead of using a fragment
|
||||
View dialerView = LayoutInflater.from(this).inflate(R.layout.dialer, null, false);
|
||||
LinearLayout fragmentContainer = findViewById(R.id.fragmentContainer);
|
||||
LinearLayout.LayoutParams params =
|
||||
new LinearLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
fragmentContainer.addView(dialerView, params);
|
||||
new AsyncLayoutInflater(this)
|
||||
.inflate(
|
||||
R.layout.dialer,
|
||||
null,
|
||||
new AsyncLayoutInflater.OnInflateFinishedListener() {
|
||||
@Override
|
||||
public void onInflateFinished(
|
||||
@NonNull View view, int resid, @Nullable ViewGroup parent) {
|
||||
LinearLayout fragmentContainer =
|
||||
findViewById(R.id.fragmentContainer);
|
||||
LinearLayout.LayoutParams params =
|
||||
new LinearLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
fragmentContainer.addView(view, params);
|
||||
initUI(view);
|
||||
mInterfaceLoaded = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (isTablet()) {
|
||||
findViewById(R.id.fragmentContainer2).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
mAddress = findViewById(R.id.address);
|
||||
mAddress.setAddressListener(this);
|
||||
|
||||
EraseButton erase = findViewById(R.id.erase);
|
||||
erase.setAddressWidget(mAddress);
|
||||
|
||||
mStartCall = findViewById(R.id.start_call);
|
||||
mStartCall.setAddressWidget(mAddress);
|
||||
|
||||
mAddCall = findViewById(R.id.add_call);
|
||||
mAddCall.setAddressWidget(mAddress);
|
||||
|
||||
mTransferCall = findViewById(R.id.transfer_call);
|
||||
mTransferCall.setAddressWidget(mAddress);
|
||||
mTransferCall.setIsTransfer(true);
|
||||
|
||||
mAddContact = findViewById(R.id.add_contact);
|
||||
mAddContact.setEnabled(false);
|
||||
mAddContact.setOnClickListener(
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(DialerActivity.this, ContactsActivity.class);
|
||||
intent.putExtra("EditOnClick", true);
|
||||
intent.putExtra("SipAddress", mAddress.getText().toString());
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
mBackToCall = findViewById(R.id.back_to_call);
|
||||
mBackToCall.setOnClickListener(
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(DialerActivity.this, CallActivity.class));
|
||||
}
|
||||
});
|
||||
|
||||
mIsTransfer = false;
|
||||
if (getIntent() != null) {
|
||||
mIsTransfer = getIntent().getBooleanExtra("Transfer", false);
|
||||
mAddress.setText(getIntent().getStringExtra("SipUri"));
|
||||
}
|
||||
|
||||
mListener =
|
||||
new CoreListenerStub() {
|
||||
@Override
|
||||
|
@ -139,7 +112,6 @@ public class DialerActivity extends MainActivity implements AddressText.AddressC
|
|||
Manifest.permission.READ_CONTACTS
|
||||
};
|
||||
|
||||
setUpNumpad(dialerView);
|
||||
handleIntentParams(getIntent());
|
||||
}
|
||||
|
||||
|
@ -160,8 +132,10 @@ public class DialerActivity extends MainActivity implements AddressText.AddressC
|
|||
core.addListener(mListener);
|
||||
}
|
||||
|
||||
updateLayout();
|
||||
enableVideoPreviewIfTablet(true);
|
||||
if (mInterfaceLoaded) {
|
||||
updateLayout();
|
||||
enableVideoPreviewIfTablet(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -175,6 +149,56 @@ public class DialerActivity extends MainActivity implements AddressText.AddressC
|
|||
super.onPause();
|
||||
}
|
||||
|
||||
private void initUI(View view) {
|
||||
mAddress = view.findViewById(R.id.address);
|
||||
mAddress.setAddressListener(this);
|
||||
|
||||
EraseButton erase = view.findViewById(R.id.erase);
|
||||
erase.setAddressWidget(mAddress);
|
||||
|
||||
mStartCall = view.findViewById(R.id.start_call);
|
||||
mStartCall.setAddressWidget(mAddress);
|
||||
|
||||
mAddCall = view.findViewById(R.id.add_call);
|
||||
mAddCall.setAddressWidget(mAddress);
|
||||
|
||||
mTransferCall = view.findViewById(R.id.transfer_call);
|
||||
mTransferCall.setAddressWidget(mAddress);
|
||||
mTransferCall.setIsTransfer(true);
|
||||
|
||||
mAddContact = view.findViewById(R.id.add_contact);
|
||||
mAddContact.setEnabled(false);
|
||||
mAddContact.setOnClickListener(
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(DialerActivity.this, ContactsActivity.class);
|
||||
intent.putExtra("EditOnClick", true);
|
||||
intent.putExtra("SipAddress", mAddress.getText().toString());
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
mBackToCall = view.findViewById(R.id.back_to_call);
|
||||
mBackToCall.setOnClickListener(
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(DialerActivity.this, CallActivity.class));
|
||||
}
|
||||
});
|
||||
|
||||
mIsTransfer = false;
|
||||
if (getIntent() != null) {
|
||||
mIsTransfer = getIntent().getBooleanExtra("Transfer", false);
|
||||
mAddress.setText(getIntent().getStringExtra("SipUri"));
|
||||
}
|
||||
|
||||
setUpNumpad(view);
|
||||
updateLayout();
|
||||
enableVideoPreviewIfTablet(true);
|
||||
}
|
||||
|
||||
private void enableVideoPreviewIfTablet(boolean enable) {
|
||||
Core core = LinphoneManager.getCore();
|
||||
TextureView preview = findViewById(R.id.video_preview);
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:background="?attr/backgroundColor">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/status"
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:background="?attr/backgroundColor">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/status"
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:background="?attr/backgroundColor">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/status"
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/topLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/backgroundColor">
|
||||
|
||||
<androidx.drawerlayout.widget.DrawerLayout
|
||||
android:id="@+id/side_menu"
|
||||
|
@ -130,9 +131,10 @@
|
|||
|
||||
</RelativeLayout>
|
||||
|
||||
<include layout="@layout/numpad"
|
||||
<ViewStub
|
||||
android:id="@+id/numpad"
|
||||
android:visibility="gone"
|
||||
android:inflatedId="@+id/numpad"
|
||||
android:layout="@layout/numpad"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/backgroundColor">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/status_fragment"
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/backgroundColor">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/status_fragment"
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/backgroundColor">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/status_fragment"
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:background="?attr/backgroundColor">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/status"
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:background="?attr/backgroundColor">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/status"
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:background="?attr/backgroundColor">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/status"
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:background="?attr/backgroundColor">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/status"
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:background="?attr/backgroundColor">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/status"
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:background="?attr/backgroundColor">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/status"
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:background="?attr/backgroundColor">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/status"
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:background="?attr/backgroundColor">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/status"
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:background="?attr/backgroundColor">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/status"
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:background="?attr/backgroundColor">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/status"
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:background="?attr/backgroundColor">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/status"
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:background="?attr/backgroundColor">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/status"
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/topLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/backgroundColor">
|
||||
|
||||
<androidx.drawerlayout.widget.DrawerLayout
|
||||
android:id="@+id/side_menu"
|
||||
|
@ -122,9 +123,10 @@
|
|||
|
||||
</RelativeLayout>
|
||||
|
||||
<include layout="@layout/numpad"
|
||||
<ViewStub
|
||||
android:id="@+id/numpad"
|
||||
android:visibility="gone"
|
||||
android:inflatedId="@+id/numpad"
|
||||
android:layout="@layout/numpad"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/topLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/backgroundColor">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/status"
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/topLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/backgroundColor">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/status"
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/backgroundColor">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/status_fragment"
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="LinphoneLauncherStyle" parent="LinphoneStyleLight">
|
||||
<!-- Prevent a white screen while app is loading -->
|
||||
<!-- http://www.tothenew.com/blog/disabling-the-preview-or-start-window-in-android/ -->
|
||||
<item name="android:windowBackground">@drawable/launch_screen</item>
|
||||
</style>
|
||||
|
||||
<style name="LinphoneStyleLight" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<!-- Disable animations between activities -->
|
||||
<item name="android:windowAnimationStyle">@null</item>
|
||||
<item name="android:windowBackground">@drawable/launch_screen</item>
|
||||
|
||||
<!-- Android theme override -->
|
||||
<item name="colorAccent">@color/primary_color</item>
|
||||
|
@ -20,7 +15,6 @@
|
|||
<item name="android:textColorHint">@color/light_grey_color</item>
|
||||
<item name="android:colorBackground">@color/white_color</item>
|
||||
<item name="android:textColorPrimaryInverse">@color/white_color</item>
|
||||
<item name="android:windowBackground">@color/white_color</item>
|
||||
|
||||
<item name="accentColor">@color/primary_color</item>
|
||||
<item name="accentColorLight30">@color/primary_light_color</item>
|
||||
|
@ -51,6 +45,7 @@
|
|||
<style name="LinphoneStyleDark" parent="Theme.AppCompat.NoActionBar">
|
||||
<!-- Disable animations between activities -->
|
||||
<item name="android:windowAnimationStyle">@null</item>
|
||||
<item name="android:windowBackground">@drawable/launch_screen</item>
|
||||
|
||||
<!-- Android theme override -->
|
||||
<item name="colorAccent">@color/primary_color</item>
|
||||
|
@ -62,7 +57,6 @@
|
|||
<item name="android:textColorHint">@color/toolbar_color</item>
|
||||
<item name="android:colorBackground">@color/dark_grey_color</item>
|
||||
<item name="android:textColorPrimaryInverse">@color/dark_grey_color</item>
|
||||
<item name="android:windowBackground">@color/dark_grey_color</item>
|
||||
|
||||
<item name="accentColor">@color/primary_color</item>
|
||||
<item name="accentColorLight30">@color/primary_light_color</item>
|
||||
|
|
Loading…
Reference in a new issue