Skip to content

Commit f915799

Browse files
MuhammadTouseeqimac28
authored andcommitted
Initial commit
0 parents  commit f915799

File tree

124 files changed

+3326
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+3326
-0
lines changed

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 28
5+
defaultConfig {
6+
applicationId "com.pakdev.sample"
7+
minSdkVersion 19
8+
targetSdkVersion 28
9+
versionCode 1
10+
versionName "1.0"
11+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
12+
}
13+
buildTypes {
14+
release {
15+
minifyEnabled false
16+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
17+
}
18+
}
19+
}
20+
21+
dependencies {
22+
implementation fileTree(dir: 'libs', include: ['*.jar'])
23+
implementation 'androidx.appcompat:appcompat:1.1.0'
24+
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
25+
testImplementation 'junit:junit:4.12'
26+
androidTestImplementation 'androidx.test:runner:1.2.0'
27+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
28+
// implementation(name: 'sinch-android-rtc', version: '+', ext: 'aar') {
29+
// exclude group: 'com.android.support'
30+
// }
31+
32+
implementation files('libs/sinch-android-rtc-3.15.0.aar')
33+
34+
implementation 'de.hdodenhof:circleimageview:3.0.1'
35+
36+
implementation 'com.karumi:dexter:4.2.0'
37+
38+
}

app/libs/sinch-android-rtc-3.15.0.aar

15.7 MB
Binary file not shown.

app/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.pakdev.sample;
2+
3+
import android.content.Context;
4+
5+
import androidx.test.platform.app.InstrumentationRegistry;
6+
import androidx.test.ext.junit.runners.AndroidJUnit4;
7+
8+
import org.junit.Test;
9+
import org.junit.runner.RunWith;
10+
11+
import static org.junit.Assert.*;
12+
13+
/**
14+
* Instrumented test, which will execute on an Android device.
15+
*
16+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
17+
*/
18+
@RunWith(AndroidJUnit4.class)
19+
public class ExampleInstrumentedTest {
20+
@Test
21+
public void useAppContext() {
22+
// Context of the app under test.
23+
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24+
25+
assertEquals("com.pakdev.sample", appContext.getPackageName());
26+
}
27+
}

app/src/main/AndroidManifest.xml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.pakdev.sample"
4+
android:versionCode="1"
5+
android:versionName="1.0">
6+
7+
<uses-feature
8+
android:name="android.hardware.microphone"
9+
android:required="false"/>
10+
11+
<uses-permission android:name="android.permission.INTERNET"/>
12+
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
13+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
14+
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
15+
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
16+
<uses-permission android:name="android.permission.BLUETOOTH"/>
17+
<uses-permission android:name="android.permission.CAMERA"/>
18+
19+
<application
20+
android:allowBackup="true"
21+
android:icon="@drawable/icon"
22+
android:label="@string/app_name"
23+
android:theme="@style/AppTheme">
24+
25+
<activity
26+
android:name=".activity.messaging.MessagingActivity"
27+
android:label="@string/app_name"
28+
android:screenOrientation="portrait">
29+
<intent-filter>
30+
<action android:name="android.intent.action.MAIN"/>
31+
32+
<category android:name="android.intent.category.LAUNCHER"/>
33+
</intent-filter>
34+
</activity>
35+
36+
37+
<activity android:name=".video.CallScreenActivity" android:screenOrientation="portrait"/>
38+
<activity android:name="com.pakdev.sample.activity.calling.CallScreenActivity" android:screenOrientation="portrait"/>
39+
<activity android:name=".activity.calling.IncomingCallScreenActivity" android:screenOrientation="portrait"/>
40+
<activity android:name=".video.IncomingCallScreenActivity" android:screenOrientation="portrait"/>
41+
42+
</application>
43+
44+
</manifest>
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
package com.pakdev.sample.activity;
2+
3+
import android.app.Activity;
4+
import android.content.ComponentName;
5+
import android.content.Intent;
6+
import android.content.ServiceConnection;
7+
import android.os.Bundle;
8+
import android.os.IBinder;
9+
import android.content.pm.PackageManager;
10+
import android.os.Handler;
11+
import android.os.Message;
12+
import android.os.Messenger;
13+
import android.view.Window;
14+
import android.view.WindowManager;
15+
import android.widget.Toast;
16+
17+
import com.pakdev.sample.service.SinchService;
18+
19+
import androidx.core.app.ActivityCompat;
20+
21+
22+
public abstract class BaseActivity extends Activity implements ServiceConnection {
23+
24+
private SinchService.SinchServiceInterface mSinchServiceInterface;
25+
26+
@Override
27+
protected void onCreate(Bundle savedInstanceState) {
28+
super.onCreate(savedInstanceState);
29+
bindService();
30+
requestWindowFeature(Window.FEATURE_NO_TITLE);
31+
getWindow().addFlags(
32+
WindowManager.LayoutParams.FLAG_FULLSCREEN
33+
| WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
34+
| WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
35+
| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
36+
| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
37+
}
38+
39+
@Override
40+
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
41+
if (SinchService.class.getName().equals(componentName.getClassName())) {
42+
mSinchServiceInterface = (SinchService.SinchServiceInterface) iBinder;
43+
onServiceConnected();
44+
}
45+
}
46+
47+
@Override
48+
public void onServiceDisconnected(ComponentName componentName) {
49+
if (SinchService.class.getName().equals(componentName.getClassName())) {
50+
mSinchServiceInterface = null;
51+
onServiceDisconnected();
52+
}
53+
}
54+
55+
protected void onServiceConnected() {
56+
// for subclasses
57+
}
58+
59+
protected void onServiceDisconnected() {
60+
// for subclasses
61+
}
62+
63+
protected SinchService.SinchServiceInterface getSinchServiceInterface() {
64+
return mSinchServiceInterface;
65+
}
66+
67+
private Messenger messenger = new Messenger(new Handler() {
68+
@Override
69+
public void handleMessage(Message msg) {
70+
switch (msg.what) {
71+
case SinchService.MESSAGE_PERMISSIONS_NEEDED:
72+
Bundle bundle = msg.getData();
73+
String requiredPermission = bundle.getString(SinchService.REQUIRED_PERMISSION);
74+
ActivityCompat.requestPermissions(BaseActivity.this, new String[]{requiredPermission}, 0);
75+
break;
76+
}
77+
}
78+
});
79+
80+
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
81+
boolean granted = grantResults.length > 0;
82+
for (int grantResult : grantResults) {
83+
granted &= grantResult == PackageManager.PERMISSION_GRANTED;
84+
}
85+
if (granted) {
86+
Toast.makeText(this, "You may now place a call", Toast.LENGTH_LONG).show();
87+
} else {
88+
Toast.makeText(this, "This application needs permission to use your microphone and camera to function properly.", Toast.LENGTH_LONG).show();
89+
}
90+
mSinchServiceInterface.retryStartAfterPermissionGranted();
91+
}
92+
93+
private void bindService() {
94+
Intent serviceIntent = new Intent(this, SinchService.class);
95+
serviceIntent.putExtra(SinchService.MESSENGER, messenger);
96+
getApplicationContext().bindService(serviceIntent, this, BIND_AUTO_CREATE);
97+
}
98+
99+
}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
package com.pakdev.sample.activity;
2+
3+
import android.app.Activity;
4+
import android.app.ProgressDialog;
5+
import android.content.Intent;
6+
import android.os.Bundle;
7+
import android.os.Handler;
8+
import android.view.View;
9+
import android.view.View.OnClickListener;
10+
import android.widget.Button;
11+
import android.widget.EditText;
12+
import android.widget.Toast;
13+
14+
import com.pakdev.sample.R;
15+
16+
17+
public class LoginCallActivity extends Activity {
18+
19+
private Button mLoginButton;
20+
private EditText mLoginName;
21+
private ProgressDialog mSpinner;
22+
23+
24+
@Override
25+
protected void onCreate(Bundle savedInstanceState) {
26+
super.onCreate(savedInstanceState);
27+
setContentView(R.layout.login);
28+
29+
30+
31+
mLoginName = (EditText) findViewById(R.id.loginName);
32+
33+
mLoginButton = (Button) findViewById(R.id.loginButton);
34+
mLoginButton.setOnClickListener(new OnClickListener() {
35+
@Override
36+
public void onClick(View v) {
37+
loginClicked();
38+
}
39+
});
40+
}
41+
42+
43+
44+
@Override
45+
protected void onPause() {
46+
if (mSpinner != null) {
47+
mSpinner.dismiss();
48+
}
49+
super.onPause();
50+
}
51+
52+
53+
54+
private void loginClicked() {
55+
final String userName = mLoginName.getText().toString();
56+
57+
if (userName.isEmpty()) {
58+
Toast.makeText(this, "Please enter a name", Toast.LENGTH_LONG).show();
59+
return;
60+
}
61+
showSpinner();
62+
63+
new Handler().postDelayed(new Runnable() {
64+
@Override
65+
public void run() {
66+
mSpinner.dismiss();
67+
openPlaceCallActivity();
68+
69+
70+
71+
}
72+
},500)
73+
;
74+
75+
76+
}
77+
78+
private void openPlaceCallActivity() {
79+
80+
81+
// Intent mainActivity = new Intent(this, MessagingActivity.class);
82+
// mainActivity.putExtra("user",mLoginName.getText().toString()) ;
83+
// startActivity(mainActivity);
84+
}
85+
86+
private void showSpinner() {
87+
mSpinner = new ProgressDialog(this);
88+
mSpinner.setTitle("Logging in");
89+
mSpinner.setMessage("Please wait...");
90+
mSpinner.show();
91+
}
92+
}

0 commit comments

Comments
 (0)