SIP Dialer Android Studio

时间:2015-12-24 07:41:58

标签: java android android-layout android-fragments android-activity

我正在开发一款可在SIP中使用的软电话。我陷入了登录过程。什么时候我点击登录按钮3次它在我的Android设备上显示“没有响应”,点击登录按钮后我无法转到下一个片段。我附上了代码。请指导我完成开发工作应用程序的过程。

我的工作流程附在此处。

项目工作结构

enter image description here

我也在添加源代码文件。

MainActivity

package com.inlusion.view;
import android.content.Context;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.net.sip.SipException;
import android.net.sip.SipManager;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.animation.TranslateAnimation;
import android.view.inputmethod.InputMethodManager;
import android.widget.ImageButton;
import android.widget.ImageView;

import com.inlusion.controller.outgoing.CallCenter;
import com.inlusion.controller.util.RegistrarUtils;
import com.inlusion.controller.util.ToneUtils;
import com.inlusion.maiavoip.R;
import com.inlusion.model.Manager;
import com.inlusion.view.main_fragments.ViewPagerAdapter;

public class MainActivity extends FragmentActivity {
Manager managerClass;
RegistrarUtils ru;
CallCenter cc;
ToneUtils tu;

public SipManager manager;

ViewPager viewPager;
ViewPagerAdapter vpa;
ViewPager.OnPageChangeListener pagerListener;

static ImageButton dialerTabButton;
static ImageButton contactsTabButton;
static ImageButton historyTabButton;
static ImageButton settingsTabButton;

View.OnClickListener dialerButtonListener;
View.OnClickListener contactsButtonListener;
View.OnClickListener historyButtonListener;
View.OnClickListener settingsButtonListener;

ImageView activeTabIndicator;
int lastIndicatorLoc;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    tu = ToneUtils.getInstance();

    dialerTabButton = (ImageButton) findViewById(R.id.dialerTabButton);
    contactsTabButton = (ImageButton) findViewById(R.id.contactsTabButton);
    historyTabButton = (ImageButton) findViewById(R.id.historyTabButton);
    settingsTabButton = (ImageButton) findViewById(R.id.settingsTabButton);

    activeTabIndicator = (ImageView) findViewById(R.id.activeTabIndicator);
    viewPager = (ViewPager) findViewById(R.id.pager);

    vpa = new ViewPagerAdapter(getSupportFragmentManager());
    viewPager.setAdapter(vpa);
    viewPager.setOffscreenPageLimit(3);
    setPagerListener();

    ViewTreeObserver vto = dialerTabButton.getViewTreeObserver();
    vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            dialerTabButton.getViewTreeObserver().removeGlobalOnLayoutListener(this);
            int width1 = dialerTabButton.getMeasuredWidth();
            activeTabIndicator.getLayoutParams().width = width1;
        }
    });

    initTabButtonListeners();
    repaintTabIcons();
    dialerTabButton.getDrawable().mutate().setColorFilter(Color.rgb(241, 26, 143), PorterDuff.Mode.MULTIPLY);

    managerClass = new Manager(this);
    managerClass.createSipManager();
    manager = managerClass.getSipManager();
    managerClass.createRegListener();

    ru = new RegistrarUtils();

    cc = CallCenter.getInstance();
    cc.setContext(this);

    initProfile();
    initCallCenter();
    cc.run();
}

@Override
protected void onPostCreate(Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);

}

/**
 * Initializes the listeners responsible for switching pager tabs and animating the marker.
 */
public void initTabButtonListeners() {
    dialerButtonListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            tabAction(0);

        }

    };

    contactsButtonListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            tabAction(1);
        }
    };

    historyButtonListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            tabAction(2);
        }
    };

    settingsButtonListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            tabAction(3);
        }
    };

    dialerTabButton.setOnClickListener(dialerButtonListener);
    contactsTabButton.setOnClickListener(contactsButtonListener);
    historyTabButton.setOnClickListener(historyButtonListener);
    settingsTabButton.setOnClickListener(settingsButtonListener);
}

/**
 * Returns the pager marker's distance to the left edge of the device's screen in pixels.
 *
 * @param v the View from which to measure.
 * @return distance from the marker to the left edge of screen.
 */
public int getDistanceToLeftEdge(View v) {
    return v.getLeft();
}

/**
 * Animates the pager's tab marker, translates it to the correct X position on the screen.
 *
 * @param x2 the x coordinate location to which the marker should move in pixels.
 */
public void animateIndicator(int x2) {
    int x1 = getLastIndicatorLoc();
    TranslateAnimation ta = new TranslateAnimation(x1, x2, 0, 0);
    ta.setDuration(250);
    ta.setFillAfter(true);
    ta.setFillEnabled(true);
    activeTabIndicator.startAnimation(ta);
}

/**
 * Get the previous location of the pager's tab indicator.
 *
 * @return the last location (x coordinate) of the pager's tab indicator.
 */
public int getLastIndicatorLoc() {
    return lastIndicatorLoc;
}

/**
 * Resets the pager's tab icons to their original dark grey color.
 */
public void repaintTabIcons() {
    dialerTabButton.getDrawable().mutate().setColorFilter(Color.rgb(89, 90, 92), PorterDuff.Mode.MULTIPLY);
    contactsTabButton.getDrawable().mutate().setColorFilter(Color.rgb(89, 90, 92), PorterDuff.Mode.MULTIPLY);
    historyTabButton.getDrawable().mutate().setColorFilter(Color.rgb(89, 90, 92), PorterDuff.Mode.MULTIPLY);
    settingsTabButton.getDrawable().mutate().setColorFilter(Color.rgb(89, 90, 92), PorterDuff.Mode.MULTIPLY);
}

/**
 * The logic by which the pager's tab selection works.
 * Used by the pager listener.
 *
 * @param i the item of the pager to be displayed.
 */
public void tabAction(int i) {
    switch (i) {
        case 0:
            animateIndicator(getDistanceToLeftEdge(dialerTabButton));
            lastIndicatorLoc = getDistanceToLeftEdge(dialerTabButton);
            repaintTabIcons();
            dialerTabButton.getDrawable().mutate().setColorFilter(Color.rgb(241, 26, 143), PorterDuff.Mode.MULTIPLY);
            viewPager.setCurrentItem(0);
            return;
        case 1:
            animateIndicator(getDistanceToLeftEdge(contactsTabButton));
            lastIndicatorLoc = getDistanceToLeftEdge(contactsTabButton);
            repaintTabIcons();
            contactsTabButton.getDrawable().mutate().setColorFilter(Color.rgb(241, 26, 143), PorterDuff.Mode.MULTIPLY);
            viewPager.setCurrentItem(1);
            return;
        case 2:
            animateIndicator(getDistanceToLeftEdge(historyTabButton));
            lastIndicatorLoc = getDistanceToLeftEdge(historyTabButton);
            repaintTabIcons();
            historyTabButton.getDrawable().mutate().setColorFilter(Color.rgb(241, 26, 143), PorterDuff.Mode.MULTIPLY);
            viewPager.setCurrentItem(2);
            return;
        case 3:
            animateIndicator(getDistanceToLeftEdge(settingsTabButton));
            lastIndicatorLoc = getDistanceToLeftEdge(settingsTabButton);
            repaintTabIcons();
            settingsTabButton.getDrawable().mutate().setColorFilter(Color.rgb(241, 26, 143), PorterDuff.Mode.MULTIPLY);
            viewPager.setCurrentItem(3);
            return;
        default:
    }
}

/**
 * Creates and sets the pager's OnPageChangeListener.
 */
void setPagerListener() {
    pagerListener = new ViewPager.OnPageChangeListener() {
        @Override
        public void onPageScrolled(int i, float v, int i2) {
            tu.stopTone();
        }

        @Override
        public void onPageSelected(int i) {
            tu.stopTone();
            tabAction(i);
            InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(viewPager.getWindowToken(), 0);
        }


        @Override
        public void onPageScrollStateChanged(int i) {

        }
    };
    viewPager.setOnPageChangeListener(pagerListener);
}

/**
 * Opens the local user's SipProfile for communication.
 */
private void initProfile() {
    try {
        manager.open(managerClass.getActiveLocalProfile());

        ru.setManager(managerClass.getSipManager());
        ru.setProfile(managerClass.getActiveLocalProfile());
        ru.setRegListener(managerClass.getRegistrationListener());

        System.out.println("=== PROFILE IS OPEN: " + manager.isOpened(managerClass.getActiveLocalProfile().getUriString()));
    } catch (SipException sipex) {
        System.out.println("--- SIPEX IN START ACTIVITY ON CREATE");
        sipex.printStackTrace();
    }
}

/**
 * Initializes the CallCenter and sets it's parameters accordingly.
 */
private void initCallCenter() {
    cc.setLocalProfile(managerClass.getActiveLocalProfile());
    cc.setManager(managerClass.getSipManager());
}

/**
 * @return the current instance of RegistrarUtils in use by the MainActivity class.
 */
public RegistrarUtils getRu() {
    return ru;
}

}

的AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.inlusion.maiavoip">

<uses-sdk android:minSdkVersion="9" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.USE_SIP" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.CONFIGURE_SIP" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<uses-feature
    android:name="android.hardware.telephony"
    android:required="false" />
<uses-feature
    android:name="android.hardware.sip.voip"
    android:required="true" />
<uses-feature android:name="android.software.sip" />
<uses-feature android:name="android.software.voip.sip" />
<uses-feature
    android:name="android.hardware.wifi"
    android:required="true" />
<uses-feature
    android:name="android.hardware.microphone"
    android:required="true" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/_maia">
    <activity
        android:name=".StartActivity"
        android:label="@string/app_name"
        android:screenOrientation="sensorPortrait" />
    <activity
        android:name="com.inlusion.view.IncomingCallActivity"
        android:label="@string/app_name"
        android:screenOrientation="sensorPortrait" />
    <activity
        android:name="com.inlusion.view.OnCallActivity"
        android:label="@string/app_name"
        android:screenOrientation="sensorPortrait" />
    <activity
        android:name="com.inlusion.view.MainActivity"
        android:label="@string/app_name"
        android:screenOrientation="sensorPortrait"
        android:windowSoftInputMode="stateAlwaysHidden|adjustPan">

    </activity>
    <activity
        android:name="com.inlusion.view.ContactEditorActivity"
        android:label="@string/app_name"
        android:screenOrientation="sensorPortrait"
        android:windowSoftInputMode="adjustNothing" />

    <activity
        android:name="com.inlusion.view.LoadingActivity"
        android:label="@string/app_name"
        android:screenOrientation="sensorPortrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>


    <activity
        android:name="com.inlusion.view.LoginActivity"
        android:label="@string/app_name"
        android:screenOrientation="sensorPortrait"
        android:theme="@style/AppTheme"/>

</application>

LoginActivity

package com.inlusion.view;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.ScaleAnimation;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.inlusion.controller.util.RoundedImageView;
import com.inlusion.maiavoip.R;


public class LoginActivity extends Activity {

EditText usernameEditText;
EditText passwordEditText;
TextView errorTextView;
RoundedImageView startButton;
View.OnClickListener startButtonOnClickListener;
ProgressBar validation_progressBar;
Drawable originalEditText;
int clicks = 0; //for demonstration purposes;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    usernameEditText = (EditText) findViewById(R.id.usernameEditText);
    passwordEditText = (EditText) findViewById(R.id.passwordEditText);
    errorTextView = (TextView) findViewById(R.id.login_errorTextView);
    startButton = (RoundedImageView) findViewById(R.id.startImageButton);
    validation_progressBar = (ProgressBar) findViewById(R.id.validation_progressBar);
    originalEditText = passwordEditText.getBackground();
    initButtonHandlers();
}

/**
 * Creates and initializes the LoginActivity click/touch/focus handlers.
 */
void initButtonHandlers() {

    startButtonOnClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            clicks++;
            if (clicks == 1) {
                animateChecking();
            }
            if (clicks == 2) {
                errorTextView.setVisibility(View.VISIBLE);
                passwordEditText.setTextColor(getResources().getColor(R.color.maia_pink));
                showPasswordError();
            }
            if (clicks == 3) {
                animateSuccess();
            }
        }
    };

    passwordEditText.setOnFocusChangeListener(new View.OnFocusChangeListener() {

        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (hasFocus) {
                if (errorTextView.getVisibility() == View.VISIBLE) {
                    hidePasswordError();
                }
            }
        }
    });
    startButton.setOnClickListener(startButtonOnClickListener);
}

/**
 * Animates the account credential checks
 */
public void animateChecking() {
    ScaleAnimation sa1 = new ScaleAnimation(1, 0.5f, 1, 0.5f, Animation.RELATIVE_TO_SELF, (float) 0.5, Animation.RELATIVE_TO_SELF, (float) 0.5);
    sa1.setDuration(100);
    sa1.setFillAfter(true);
    sa1.setFillEnabled(true);

    final ScaleAnimation sa2 = new ScaleAnimation(0.5f, 1, 0.5f, 1, Animation.RELATIVE_TO_SELF, (float) 0.5, Animation.RELATIVE_TO_SELF, (float) 0.5);
    sa2.setDuration(100);
    sa2.setFillAfter(true);
    sa2.setFillEnabled(true);

    sa1.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {

        }

        @Override
        public void onAnimationEnd(Animation animation) {
            startButton.startAnimation(sa2);
        }

        @Override
        public void onAnimationRepeat(Animation animation) {

        }
    });

    sa2.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {
            startButton.setImageResource(R.drawable.transparency);
            validation_progressBar.setVisibility(View.VISIBLE);

        }

        @Override
        public void onAnimationEnd(Animation animation) {
            //animateSuccess();
        }

        @Override
        public void onAnimationRepeat(Animation animation) {

        }
    });

    startButton.startAnimation(sa1);
}

/**
 * Animates a successful login and transitions into the main app.
 */
public void animateSuccess() {

    final ScaleAnimation sa2 = new ScaleAnimation(1, 20, 1, 20, Animation.RELATIVE_TO_SELF, (float) 0.5, Animation.RELATIVE_TO_SELF, (float) 0.5);
    sa2.setDuration(750);
    sa2.setFillEnabled(true);
    sa2.setFillAfter(true);

    sa2.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {
            startButton.setImageResource(R.drawable.transparency);
            validation_progressBar.setVisibility(View.INVISIBLE);
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            disposeAndStart();
        }

        @Override
        public void onAnimationRepeat(Animation animation) {

        }
    });

    startButton.startAnimation(sa2);

}

/**
 * Displays an error upon unsuccessful login.
 */
public void showPasswordError() {
    startButton.setImageResource(R.drawable.power);
    passwordEditText.setBackground(getResources().getDrawable(R.drawable.erroredittext_pink));
    validation_progressBar.setVisibility(View.INVISIBLE);
    usernameEditText.requestFocus();
}

/**
 * Resets the unsuccessful login error status.
 */
public void hidePasswordError() {
    passwordEditText.setBackground(originalEditText);
    passwordEditText.setTextColor(Color.BLACK);
    errorTextView.setVisibility(View.INVISIBLE);

}

/**
 * Disposes of the LoginActivity and starts the MainActivity.
 */
public void disposeAndStart() {
    Intent mainIntent = new Intent(getApplicationContext(), MainActivity.class);
    mainIntent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    startActivity(mainIntent);
    overridePendingTransition(R.anim.entryanim, R.anim.exitanim);
    finish();
}

}

LoadingActivity

package com.inlusion.view;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.provider.MediaStore;
import android.widget.ProgressBar;

import com.inlusion.controller.util.ContactUtils;
import com.inlusion.maiavoip.R;
import com.inlusion.model.Contact;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
public class LoadingActivity extends Activity {

ContactUtils cu;

public int totalContacts;
ProgressBar progressBar;

Uri imageUri;
String name;
String number;
Bitmap bitmap;
int i = 0;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_loading);
    progressBar = (ProgressBar) findViewById(R.id.loadingProgressBar);
    progressBar.setIndeterminate(false);
    cu = ContactUtils.getInstance(this);

    Asyncer a = new Asyncer();
    a.execute();
}

/**
 * @return an int of the total number of contacts to be loaded into memory.
 */
public int getTotalContacts() {
    return totalContacts;
}

/**
 * @param totalContacts an int of the total number of contacts to be loaded.
 */
public void setTotalContacts(int totalContacts) {
    this.totalContacts = totalContacts;
}

/**
 * Asynchronously reads and loads the contacts from the device's database.
 */
class Asyncer extends AsyncTask<Void, Integer, Void> {
    @Override
    protected void onPreExecute() {
        super.onPreExecute();
    }

    @Override
    protected Void doInBackground(Void... params) {
        ArrayList list = cu.getContactList();

        Cursor phones = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, null);
        setTotalContacts(phones.getCount());
        while (phones.moveToNext()) {
            int type = phones.getInt(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.TYPE));
            String customLabel = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.LABEL));
            CharSequence phoneType = ContactsContract.CommonDataKinds.Email.getTypeLabel(getResources(), type, customLabel);

            name = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
            number = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
            String image_uri = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.PHOTO_THUMBNAIL_URI));
            try {
                if (image_uri != null) {
                    imageUri = (Uri.parse(image_uri));
                    bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), imageUri);
                } else {
                    imageUri = Uri.parse("android.resource://" + getPackageName() + "/" + R.drawable.incoming_call_caller);
                    bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), imageUri);
                }
            } catch (FileNotFoundException fofex) {
                fofex.printStackTrace();
            } catch (IOException ioex) {
                ioex.printStackTrace();
            }
            publishProgress(i);
            if (phoneType.toString().equals("Maia")) {
                i++;
                list.add(new Contact(false, bitmap, name, number));
            }
        }

        Collections.sort(list);
        cu.setContactList(list);
        phones.close();

        return null;
    }

    @Override
    protected void onProgressUpdate(Integer... progress) {
        super.onProgressUpdate(progress);
        progressBar.setProgress(i * 100 / totalContacts);
    }

    @Override
    protected void onPostExecute(Void result) {
        Context ctx = getApplicationContext();
        Intent loginIntent = new Intent(ctx, LoginActivity.class);
        loginIntent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        startActivity(loginIntent);
        overridePendingTransition(R.anim.entryanim, R.anim.exitanim);
        finish();
    }
}

1 个答案:

答案 0 :(得分:0)

这是DialerFragment

 <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:paddingLeft="0dp"
 android:paddingRight="0dp"
 android:paddingTop="0dp"
android:paddingBottom="0dp"
tools:context="com.inlusion.view.MainActivity$PlaceholderFragment">

<ImageButton
    android:background="@drawable/contact_blank_selector"
    android:layout_width="fill_parent"
    android:layout_height="60dp"
    android:padding="15dp"
    android:id="@+id/dialer_initiateCallButton"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:src="@drawable/ic_start_call"
    android:clickable="true"
    android:scaleType="fitCenter"/>

<!--DIALER KEYS START-->
<LinearLayout
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="250dp"
    android:layout_above="@+id/dialer_initiateCallButton"
    android:layout_centerHorizontal="true"
    android:id="@+id/dialerVertLinearLayout"
    android:background="@android:color/white">

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_weight="1">

        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:clickable="true"
            android:background="@drawable/dialer_num_selector"
            android:id="@+id/dialer_1">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="1"
                android:id="@+id/dialer_1_number"
                android:textSize="35dp"
                android:textAlignment="gravity"
                android:gravity="right"
                android:textColor="#F11A8F"
                android:fontFamily="sans-serif-light"
                android:layout_centerVertical="true"
                android:layout_centerHorizontal="true" />

        </RelativeLayout>

        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:clickable="true"
            android:background="@drawable/dialer_num_selector"
            android:id="@+id/dialer_2">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="abc"
                android:id="@+id/dialer_2_text"
                android:textSize="13dp"
                android:paddingBottom="5dp"
                android:paddingLeft="5dp"
                android:textAllCaps="true"
                android:fontFamily="sans-serif-thin"
                android:layout_alignBottom="@+id/dialer_2_number"
                android:layout_toRightOf="@+id/dialer_2_number"
                android:layout_toEndOf="@+id/dialer_2_number" />
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="2"
                android:id="@+id/dialer_2_number"
                android:textSize="35dp"
                android:textAlignment="gravity"
                android:gravity="right"
                android:textColor="#F11A8F"
                android:fontFamily="sans-serif-light"
                android:layout_centerVertical="true"
                android:layout_centerHorizontal="true" />
        </RelativeLayout>

        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:clickable="true"
            android:background="@drawable/dialer_num_selector"
            android:id="@+id/dialer_3">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="def"
                android:id="@+id/dialer_3_text"
                android:textSize="13dp"
                android:paddingBottom="5dp"
                android:paddingLeft="5dp"
                android:textAllCaps="true"
                android:fontFamily="sans-serif-thin"
                android:layout_alignBottom="@+id/dialer_3_number"
                android:layout_toRightOf="@+id/dialer_3_number"
                android:layout_toEndOf="@+id/dialer_3_number" />
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="3"
                android:id="@+id/dialer_3_number"
                android:textSize="35dp"
                android:textAlignment="gravity"
                android:gravity="right"
                android:textColor="#F11A8F"
                android:fontFamily="sans-serif-light"
                android:layout_centerVertical="true"
                android:layout_centerHorizontal="true" />
        </RelativeLayout>

    </LinearLayout>

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_weight="1">
        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:clickable="true"
            android:background="@drawable/dialer_num_selector"
            android:id="@+id/dialer_4">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="ghi"
                android:id="@+id/dialer_4_text"
                android:textSize="13dp"
                android:paddingBottom="5dp"
                android:paddingLeft="5dp"
                android:textAllCaps="true"
                android:fontFamily="sans-serif-thin"
                android:layout_alignBottom="@+id/dialer_4_number"
                android:layout_toRightOf="@+id/dialer_4_number"
                android:layout_toEndOf="@+id/dialer_4_number" />
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="4"
                android:id="@+id/dialer_4_number"
                android:textSize="35dp"
                android:textAlignment="gravity"
                android:gravity="right"
                android:textColor="#F11A8F"
                android:fontFamily="sans-serif-light"
                android:layout_centerVertical="true"
                android:layout_centerHorizontal="true" />
        </RelativeLayout>
        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:clickable="true"
            android:background="@drawable/dialer_num_selector"
            android:id="@+id/dialer_5">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="jkl"
                android:id="@+id/dialer_5_text"
                android:textSize="13dp"
                android:paddingBottom="5dp"
                android:paddingLeft="5dp"
                android:textAllCaps="true"
                android:fontFamily="sans-serif-thin"
                android:layout_alignBottom="@+id/dialer_5_number"
                android:layout_toRightOf="@+id/dialer_5_number"
                android:layout_toEndOf="@+id/dialer_5_number" />
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="5"
                android:id="@+id/dialer_5_number"
                android:textSize="35dp"
                android:textAlignment="gravity"
                android:gravity="right"
                android:textColor="#F11A8F"
                android:fontFamily="sans-serif-light"
                android:layout_centerVertical="true"
                android:layout_centerHorizontal="true" />
        </RelativeLayout>
        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:clickable="true"
            android:background="@drawable/dialer_num_selector"
            android:id="@+id/dialer_6">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="mno"
                android:id="@+id/dialer_6_text"
                android:textSize="13dp"
                android:paddingBottom="5dp"
                android:paddingLeft="5dp"
                android:textAllCaps="true"
                android:fontFamily="sans-serif-thin"
                android:layout_alignBottom="@+id/dialer_6_number"
                android:layout_toRightOf="@+id/dialer_6_number"
                android:layout_toEndOf="@+id/dialer_6_number" />
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="6"
                android:id="@+id/dialer_6_number"
                android:textSize="35dp"
                android:textAlignment="gravity"
                android:gravity="right"
                android:textColor="#F11A8F"
                android:fontFamily="sans-serif-light"
                android:layout_centerVertical="true"
                android:layout_centerHorizontal="true" />
        </RelativeLayout>
    </LinearLayout>

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_weight="1">
        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:clickable="true"
            android:background="@drawable/dialer_num_selector"
            android:id="@+id/dialer_7">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="pqrs"
                android:id="@+id/dialer_7_text"
                android:textSize="13dp"
                android:paddingBottom="5dp"
                android:paddingLeft="5dp"
                android:textAllCaps="true"
                android:fontFamily="sans-serif-thin"
                android:layout_alignBottom="@+id/dialer_7_number"
                android:layout_toRightOf="@+id/dialer_7_number"
                android:layout_toEndOf="@+id/dialer_7_number" />
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="7"
                android:id="@+id/dialer_7_number"
                android:textSize="35dp"
                android:textAlignment="gravity"
                android:gravity="right"
                android:textColor="#F11A8F"
                android:fontFamily="sans-serif-light"
                android:layout_centerVertical="true"
                android:layout_centerHorizontal="true" />
        </RelativeLayout>
        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:clickable="true"
            android:background="@drawable/dialer_num_selector"
            android:id="@+id/dialer_8">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="tuv"
                android:id="@+id/dialer_8_text"
                android:textSize="13dp"
                android:paddingBottom="5dp"
                android:paddingLeft="5dp"
                android:textAllCaps="true"
                android:fontFamily="sans-serif-thin"
                android:layout_alignBottom="@+id/dialer_8_number"
                android:layout_toRightOf="@+id/dialer_8_number"
                android:layout_toEndOf="@+id/dialer_8_number" />
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="8"
                android:id="@+id/dialer_8_number"
                android:textSize="35dp"
                android:textAlignment="gravity"
                android:gravity="right"
                android:textColor="#F11A8F"
                android:fontFamily="sans-serif-light"
                android:layout_centerVertical="true"
                android:layout_centerHorizontal="true" />
        </RelativeLayout>
        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:clickable="true"
            android:background="@drawable/dialer_num_selector"
            android:id="@+id/dialer_9">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="wxyz"
                android:id="@+id/dialer_9_text"
                android:textSize="13dp"
                android:paddingBottom="5dp"
                android:paddingLeft="5dp"
                android:textAllCaps="true"
                android:fontFamily="sans-serif-thin"
                android:layout_alignBottom="@+id/dialer_9_number"
                android:layout_toRightOf="@+id/dialer_9_number"
                android:layout_toEndOf="@+id/dialer_9_number" />
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="9"
                android:id="@+id/dialer_9_number"
                android:textSize="35dp"
                android:textAlignment="gravity"
                android:gravity="right"
                android:textColor="#F11A8F"
                android:fontFamily="sans-serif-light"
                android:layout_centerVertical="true"
                android:layout_centerHorizontal="true" />
        </RelativeLayout>
    </LinearLayout>

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_weight="1">

        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:clickable="true"
            android:background="@drawable/dialer_num_selector"
            android:id="@+id/dialer_star">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text=""
                android:id="@+id/dialer_star_text"
                android:textSize="13dp"
                android:paddingBottom="5dp"
                android:paddingLeft="5dp"
                android:textAllCaps="true"
                android:fontFamily="sans-serif-thin"
                android:layout_alignBottom="@+id/dialer_star_number"
                android:layout_toRightOf="@+id/dialer_star_number"
                android:layout_toEndOf="@+id/dialer_star_number" />
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="*"
                android:id="@+id/dialer_star_number"
                android:textSize="35dp"
                android:textAlignment="gravity"
                android:gravity="right"
                android:textColor="#F11A8F"
                android:fontFamily="sans-serif-light"
                android:layout_centerVertical="true"
                android:layout_centerHorizontal="true" />
        </RelativeLayout>
        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:clickable="true"
            android:background="@drawable/dialer_num_selector"
            android:id="@+id/dialer_0">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="+"
                android:id="@+id/dialer_0_text"
                android:textSize="13dp"
                android:paddingBottom="5dp"
                android:paddingLeft="5dp"
                android:textAllCaps="true"
                android:fontFamily="sans-serif-thin"
                android:layout_alignBottom="@+id/dialer_0_number"
                android:layout_toRightOf="@+id/dialer_0_number"
                android:layout_toEndOf="@+id/dialer_0_number" />
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="0"
                android:id="@+id/dialer_0_number"
                android:textSize="35dp"
                android:textAlignment="gravity"
                android:gravity="right"
                android:textColor="#F11A8F"
                android:fontFamily="sans-serif-light"
                android:layout_centerVertical="true"
                android:layout_centerHorizontal="true" />
        </RelativeLayout>
        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:clickable="true"
            android:background="@drawable/dialer_num_selector"
            android:id="@+id/dialer_pound">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text=""
                android:id="@+id/dialer_pound_text"
                android:textSize="13dp"
                android:paddingBottom="5dp"
                android:paddingLeft="5dp"
                android:textAllCaps="true"
                android:fontFamily="sans-serif-thin"
                android:layout_alignBottom="@+id/dialer_pound_number"
                android:layout_toRightOf="@+id/dialer_pound_number"
                android:layout_toEndOf="@+id/dialer_pound_number" />
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="#"
                android:id="@+id/dialer_pound_number"
                android:textSize="35dp"
                android:textAlignment="gravity"
                android:gravity="right"
                android:textColor="#F11A8F"
                android:fontFamily="sans-serif-light"
                android:layout_centerVertical="true"
                android:layout_centerHorizontal="true" />
        </RelativeLayout>
    </LinearLayout>
</LinearLayout>
<!--DIALER KEYS END-->

<ListView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/filteredUserList"
    android:layout_above="@+id/dialer_inputLinearLayout"
    android:layout_centerInParent="true"
    android:layout_alignParentTop="true"
    android:layout_alignTop="@id/dialer_inputLinearLayout"
    android:background="@color/grey_F4F4F4"/>

<LinearLayout
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="55dp"
    android:layout_above="@+id/dialerVertLinearLayout"
    android:layout_centerHorizontal="true"
    android:id="@+id/dialer_inputLinearLayout">

    <ImageButton
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:id="@+id/add_contact_button"
        android:layout_weight="1"
        android:src="@drawable/ic_dialer_add_person"
        android:background="@android:color/white"
        android:scaleType="fitCenter"
        android:paddingTop="18dp"
        android:paddingBottom="6dp"/>

    <EditText
        android:layout_width="0dp"
        android:layout_height="fill_parent"
        android:id="@+id/inputNumberEditText"
        android:text="123456"
        android:layout_weight="5"
        android:inputType="none"
        android:textCursorDrawable="@null"
        android:textSize="40dp"
        android:fontFamily="sans-serif-thin"
        android:focusable="false"
        android:textAlignment="center"
        android:background="@android:color/white"
        android:paddingLeft="5dp"
        android:paddingRight="5dp"/>

    <ImageButton
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_weight="1"
        android:src="@drawable/ic_backspace"
        android:background="@android:color/white"
        android:id="@+id/dialer_backspace"
        android:scaleType="fitCenter"
        android:paddingTop="10dp"
        android:paddingBottom="10dp"/>

</LinearLayout>