diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3e41652..ad69ff4 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -3,21 +3,7 @@ xmlns:tools="http://schemas.android.com/tools" package="com.example.seniorcitizensimulator"> - - - - - - - - - - - - - - + - @@ -55,5 +40,18 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/example/seniorcitizensimulator/LoginActivity.java b/app/src/main/java/com/example/seniorcitizensimulator/LoginActivity.java index b79d329..2460fcc 100644 --- a/app/src/main/java/com/example/seniorcitizensimulator/LoginActivity.java +++ b/app/src/main/java/com/example/seniorcitizensimulator/LoginActivity.java @@ -85,6 +85,7 @@ protected void onCreate(Bundle savedInstanceState) { Intent success = new Intent(LoginActivity.this, TryingActivity.class); success.putExtra("Login", file_retreive()); + success.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(success); finish(); @@ -125,7 +126,7 @@ else if(Password.getText().toString().trim().equalsIgnoreCase("")){ public void StartProcessLogin(){ //progdialog(); - String url = "https://pula.tech/connectapi/AndroidApi/login.php?emailId="+Username.getText().toString()+"&password="+Password.getText().toString(); + String url = "https://meety.se/api/AndroidApi/login.php?emailId="+Username.getText().toString()+"&password="+Password.getText().toString(); FetchFromDB asyncTask = (FetchFromDB) new FetchFromDB(url,new FetchFromDB.AsyncResponse() { @@ -161,6 +162,7 @@ public void ConvertFromJSON(String json){ Log.e("JSONARRAY", jsonArray.toString()); for (int i = 0; i < jsonArray.length(); i++) { + JSONObject obj = jsonArray.getJSONObject(i); file_write_url(obj.getString("id")); file_write_firstname(obj.getString("firstName")); diff --git a/app/src/main/java/com/example/seniorcitizensimulator/RingingActivity.java b/app/src/main/java/com/example/seniorcitizensimulator/RingingActivity.java new file mode 100644 index 0000000..7f34494 --- /dev/null +++ b/app/src/main/java/com/example/seniorcitizensimulator/RingingActivity.java @@ -0,0 +1,21 @@ +package com.example.seniorcitizensimulator; + +import androidx.appcompat.app.AppCompatActivity; + +import android.content.Intent; +import android.os.Bundle; +import android.widget.TextView; + +public class RingingActivity extends AppCompatActivity { + TextView tvName; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_ringing); + Intent intent = getIntent(); + String name = intent.getStringExtra("name"); + tvName=findViewById(R.id.tvName); + tvName.setText(name); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/seniorcitizensimulator/SkypeService.java b/app/src/main/java/com/example/seniorcitizensimulator/SkypeService.java index ea56ddc..585aafd 100644 --- a/app/src/main/java/com/example/seniorcitizensimulator/SkypeService.java +++ b/app/src/main/java/com/example/seniorcitizensimulator/SkypeService.java @@ -20,6 +20,7 @@ import android.view.WindowManager; import android.widget.Button; import android.widget.ImageButton; +import android.widget.TextView; import androidx.annotation.RequiresApi; import androidx.localbroadcastmanager.content.LocalBroadcastManager; @@ -30,34 +31,33 @@ public class SkypeService extends NotificationListenerService { - boolean mSkypeConnected; - WindowManager wm, wm_name; - View myView, myView_name; + boolean callPicked=false; + WindowManager wm, wm_name, wm_ringing; + View myView, myView_name, myView_ringing; Thread thread; int notification=0; + int LAYOUT_FLAG; + String CallerID; public SkypeService() { } - - - @Override public void onStart(Intent intent, int startId) { Log.e("OnStart", "Service started"); - String CallerID = intent.getStringExtra("CallerID"); + CallerID = intent.getStringExtra("CallerID"); + - int LAYOUT_FLAG; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { LAYOUT_FLAG = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; } else { LAYOUT_FLAG = WindowManager.LayoutParams.TYPE_PHONE; } - WindowManager.LayoutParams params = new WindowManager.LayoutParams( + /*WindowManager.LayoutParams params = new WindowManager.LayoutParams( WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT, LAYOUT_FLAG, @@ -70,7 +70,7 @@ public void onStart(Intent intent, int startId) { wm = (WindowManager) getSystemService(WINDOW_SERVICE); LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); myView = inflater.inflate(R.layout.overlay_layout, null); - ImageButton overlay = myView.findViewById(R.id.fabHead); + Button overlay = myView.findViewById(R.id.fabHead); try { @@ -78,36 +78,11 @@ public void onStart(Intent intent, int startId) { wm.addView(myView, params); }catch (Exception exception){ + exception.getStackTrace(); + }*/ // End of one First Window Manager - } // End of one First Window Manager - - WindowManager.LayoutParams params_name = new WindowManager.LayoutParams( - WindowManager.LayoutParams.MATCH_PARENT, - WindowManager.LayoutParams.WRAP_CONTENT, - LAYOUT_FLAG, - WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE - | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL - | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH, - PixelFormat.TRANSPARENT); - - params_name.gravity = Gravity.TOP; - wm_name = (WindowManager) getSystemService(WINDOW_SERVICE); - LayoutInflater inflater_name = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); - myView_name = inflater_name.inflate(R.layout.overlay_layout_for_name, null); - Button overlay_name = myView_name.findViewById(R.id.fabHead); - overlay_name.setText("Calling "+CallerID+" ...."); - - try { - - wm_name.addView(myView_name, params_name); - - }catch (Exception exception){ - - - } - - overlay.setOnClickListener(new View.OnClickListener() { + /*overlay.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -119,6 +94,9 @@ public void onClick(View v) { if (myView_name != null) wm_name.removeView(myView_name); + if(myView_ringing!=null) + wm_ringing.removeView(myView_ringing); + } catch (Exception Ex){} @@ -129,9 +107,15 @@ public void onClick(View v) { getApplicationContext().startActivity(revert); } - }); + });*/ + threadCheckUnPickedCall(); + createRingingOverlay(); + - /*thread = new Thread() + super.onStart(intent, startId); + } + public void threadCheckUnPickedCall() { + thread = new Thread() { @Override @@ -146,42 +130,88 @@ public void run() { Thread.sleep(36000); killAppBypackage("com.skype.m2"); Intent revert = new Intent(getApplicationContext(), LoginActivity.class); - revert.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + revert.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); getApplicationContext().startActivity(revert); - try { - - if (myView != null) - wm.removeView(myView); + try + { + if (myView_ringing != null) + wm_ringing.removeView(myView_ringing); if (myView_name != null) wm_name.removeView(myView_name); - - } - catch (Exception Ex){} - - stopThread(); + catch (Exception e){e.printStackTrace();} } catch (InterruptedException e) { e.printStackTrace(); } - } } }; - thread.start();*/ + thread.start(); - super.onStart(intent, startId); } @Override public int onStartCommand(Intent intent, int flags, int startId) { + return super.onStartCommand(intent, flags, startId); + } - return super.onStartCommand(intent, flags, startId); + public void createRingingOverlay(){ + WindowManager.LayoutParams params_ringing = new WindowManager.LayoutParams( + WindowManager.LayoutParams.MATCH_PARENT, + WindowManager.LayoutParams.MATCH_PARENT, + LAYOUT_FLAG, + WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE + | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL + | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH, + PixelFormat.TRANSPARENT); + + params_ringing.gravity = Gravity.TOP; + wm_ringing = (WindowManager) getSystemService(WINDOW_SERVICE); + LayoutInflater inflater_name = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); + myView_ringing = inflater_name.inflate(R.layout.overlay_ringing, null); + Button overlay_name = myView_ringing.findViewById(R.id.fabHead); + Button overlay_endcall = myView_ringing.findViewById(R.id.fabEndBtn); + overlay_name.setText("Calling "+CallerID+".."); + + overlay_endcall.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + + try + { + if (myView != null) + wm.removeView(myView); + + if (myView_name != null) + wm_name.removeView(myView_name); + + if(myView_ringing!=null) + wm_ringing.removeView(myView_ringing); + + } + catch (Exception Ex){} + killAppBypackage("com.skype.raider"); + Log.d("TAG", "touch me"); + + Intent revert = new Intent(getApplicationContext(), LoginActivity.class); + revert.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); + getApplicationContext().startActivity(revert); + stopThread(); + } + }); + + try { + wm_ringing.addView(myView_ringing, params_ringing); + } + catch (Exception exception){ + } + } @Override @@ -189,26 +219,20 @@ public void onCreate() { super.onCreate(); Log.e("Great", "Service created"); - IntentFilter filter = new IntentFilter(); - filter.addAction("com.example.NOTIFICATION_LISTENER"); - LocalBroadcastManager.getInstance(this).registerReceiver(nlServiceReceiver, filter); - } @Override - public void onDestroy() { - super.onDestroy(); - LocalBroadcastManager.getInstance(this) - .unregisterReceiver(nlServiceReceiver); + public IBinder onBind(Intent intent) { + return super.onBind(intent); } @Override - public IBinder onBind(Intent intent) { - - return super.onBind(intent); + public void onDestroy() { + super.onDestroy(); + Log.e("CALLed","Service Stopped"); } @@ -218,14 +242,22 @@ public void onNotificationPosted(StatusBarNotification sbn) { String packageName = sbn.getPackageName(); Log.e("TAG", "onNotificationPosted " + packageName); - stopThread(); + //stopThread(); + + if(packageName != null && packageName.equals("com.skype.raider")) { + + try { + + if (myView_ringing != null){ + Log.e("TAG", "Noti Ringing Posted"); + wm_ringing.removeView(myView_ringing); + OnPickupSkype(); + } + - if(packageName != null && packageName.equals("com.skype.m2")) { + } catch (Exception Ex) { + } - Intent intent = new Intent("com.example.NOTIFICATION_LISTENER"); - intent.putExtra("connected", true); - LocalBroadcastManager.getInstance(this).sendBroadcast(intent); - notification++; } } @@ -238,63 +270,29 @@ public void onNotificationRemoved(StatusBarNotification sbn) { Log.e("TAG", "onNotificationRemoved " + packageName); - if(packageName.equals("com.skype.m2")) { - - if(notification%2 !=0) { + if(packageName.equals("com.skype.raider")) { - Log.e("Notification Value", String.valueOf(notification)); + try { + if (myView_name != null) + wm_name.removeView(myView_name); - try { - - if (myView != null) + if(myView_ringing!=null) + wm_ringing.removeView(myView_ringing); - wm.removeView(myView); - - if (myView_name != null) - wm_name.removeView(myView_name); - - } catch (Exception Ex) { - } - - Intent revert = new Intent(this, LoginActivity.class); - revert.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - this.startActivity(revert); - - Intent intent = new Intent("com.example.NOTIFICATION_LISTENER"); - intent.putExtra("connected", false); - LocalBroadcastManager.getInstance(this).sendBroadcast(intent); + } + catch (Exception e){ + e.printStackTrace(); } - } - - } - + Intent revert = new Intent(this, LoginActivity.class); + revert.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); + this.startActivity(revert); + stopThread(); + } - @Override - public StatusBarNotification[] getActiveNotifications() { - return super.getActiveNotifications(); } - BroadcastReceiver nlServiceReceiver = new BroadcastReceiver() { - @Override - public void onReceive(Context context, Intent intent) { - if(intent != null) { - boolean connected = intent.getBooleanExtra("connected", false); - Intent skypeIntent; - skypeIntent = new Intent(SyncStateContract.Constants.ACCOUNT_NAME); - if(connected && !mSkypeConnected) { - mSkypeConnected = true; - skypeIntent.putExtra("connected", true); - } else if(!connected) { - mSkypeConnected = false; - Log.d("TAG", "send broadcast disconnected"); - skypeIntent.putExtra("connected", false); - } - sendBroadcast(skypeIntent); - } - } - }; private void killAppBypackage(String packageTokill){ @@ -311,13 +309,8 @@ private void killAppBypackage(String packageTokill){ for (ApplicationInfo packageInfo : packages) { - if((packageInfo.flags & ApplicationInfo.FLAG_SYSTEM)==1) { - continue; - } - if(packageInfo.packageName.equals(myPackage)) { - continue; - } if(packageInfo.packageName.equals(packageTokill)) { + Log.e("PackageKill","Kill - "+packageTokill); mActivityManager.killBackgroundProcesses(packageInfo.packageName); } @@ -327,19 +320,67 @@ private void killAppBypackage(String packageTokill){ } - public void stopThread(){ + public void OnPickupSkype(){ + stopThread(); - try{ + try { + wm_name.removeView(myView_name); + } catch (Exception exception) { + exception.printStackTrace(); + } - thread.stop(); - thread.destroy(); - thread.interrupt(); + WindowManager.LayoutParams params_name = new WindowManager.LayoutParams( + WindowManager.LayoutParams.MATCH_PARENT, + WindowManager.LayoutParams.WRAP_CONTENT, + LAYOUT_FLAG, + WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE + | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL + | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH, + PixelFormat.TRANSPARENT); + + params_name.gravity = Gravity.TOP; + wm_name = (WindowManager) getSystemService(WINDOW_SERVICE); + LayoutInflater inflater_name = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); + myView_name = inflater_name.inflate(R.layout.overlay_layout_for_name, null); + Button overlay_name = myView_name.findViewById(R.id.fabHead); + Button overlay_endCall = myView_name.findViewById(R.id.fabEnd); + overlay_name.setText("Calling " + CallerID + " ...."); - } - catch (Exception Ex){} + wm_name.addView(myView_name, params_name); - Log.e("Thread Service Stopped", "Thanks"); + overlay_endCall.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + try { + + if (myView_name != null) + wm_name.removeView(myView_name); + + if (myView_ringing != null) + wm_ringing.removeView(myView_ringing); + + } catch (Exception Ex) { + } + killAppBypackage("com.skype.raider"); + Log.d("TAG", "touch me"); + + Intent revert = new Intent(getApplicationContext(), LoginActivity.class); + revert.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); + getApplicationContext().startActivity(revert); + + } + }); + + + } + + public void stopThread(){ + + try{ + thread.interrupt(); + } + catch (Exception e){e.printStackTrace();} } } \ No newline at end of file diff --git a/app/src/main/java/com/example/seniorcitizensimulator/SupportActivity.java b/app/src/main/java/com/example/seniorcitizensimulator/SupportActivity.java index de46b17..a0937c3 100644 --- a/app/src/main/java/com/example/seniorcitizensimulator/SupportActivity.java +++ b/app/src/main/java/com/example/seniorcitizensimulator/SupportActivity.java @@ -2,13 +2,98 @@ import androidx.appcompat.app.AppCompatActivity; +import android.content.Intent; import android.os.Bundle; +import android.provider.Settings; +import android.util.Log; +import android.view.View; +import android.widget.Button; +import android.widget.TextView; + +import org.json.JSONArray; +import org.json.JSONObject; public class SupportActivity extends AppCompatActivity { + TextView tvWebsite,tvEmail,tvSkypeId,tvPhone,tvError; + Button wifiBtn,backBtn; + //TextView tvWebsite=findViewById(R.id.tv); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_support); + tvWebsite=findViewById(R.id.tvWebsite); + tvEmail=findViewById(R.id.tvEmail); + tvSkypeId=findViewById(R.id.tvSkypeId); + tvPhone=findViewById(R.id.tvPhone); + tvError=findViewById(R.id.tvError); + wifiBtn=findViewById(R.id.wifi_settings); + backBtn=findViewById(R.id.back_button); + Intent in =getIntent(); + String error = in.getStringExtra("error"); + tvError.setText(error); + wifiBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS)); + } + }); + backBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent i = new Intent(SupportActivity.this,TryingActivity.class); + i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); + startActivity(i); + finish(); + } + }); + StartServerFile(); + + } + public void StartServerFile() + { + + String url = "https://meety.se/api/AndroidApi/supportInformation.php"; + + FetchFromDB asyncTask = (FetchFromDB) new FetchFromDB(url,new FetchFromDB.AsyncResponse() + { + @Override + public void processFinish(String output) + { + + try + { + ConvertFromJSON(output); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + }).execute(); } + private void ConvertFromJSON(String json) + { + try + { + + JSONArray jsonArray = new JSONArray(json); + for (int i = 0; i < jsonArray.length(); i++) + { + JSONObject obj = jsonArray.getJSONObject(i); + tvEmail.setText(obj.getString("email")); + tvWebsite.setText(obj.getString("website")); + tvSkypeId.setText(obj.getString("skypeId")); + tvPhone.setText(obj.getString("phone")); + } + + } + + catch (Exception e) + { + e.printStackTrace(); + } + + } + } \ No newline at end of file diff --git a/app/src/main/java/com/example/seniorcitizensimulator/TryingActivity.java b/app/src/main/java/com/example/seniorcitizensimulator/TryingActivity.java index 6c3f1a7..7a0b8a4 100644 --- a/app/src/main/java/com/example/seniorcitizensimulator/TryingActivity.java +++ b/app/src/main/java/com/example/seniorcitizensimulator/TryingActivity.java @@ -6,18 +6,22 @@ import android.annotation.SuppressLint; import android.app.ActivityManager; +import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.ActivityNotFoundException; import android.content.ComponentName; import android.content.Context; +import android.content.DialogInterface; import android.content.Intent; import android.graphics.Color; +import android.net.ConnectivityManager; import android.net.Uri; import android.net.wifi.WifiManager; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; import android.os.Handler; +import android.os.Message; import android.util.Log; import android.view.LayoutInflater; import android.view.MenuItem; @@ -30,6 +34,7 @@ import org.json.JSONArray; import org.json.JSONObject; +import java.io.FileInputStream; import java.util.ArrayList; import java.util.Timer; import java.util.TimerTask; @@ -60,7 +65,6 @@ protected void onCreate(Bundle savedInstanceState) { if(isMyServiceRunning(SkypeService.class)){ - Log.e("Service", "Running ---------"); stopService(new Intent(TryingActivity.this, SkypeService.class)); } @@ -68,16 +72,68 @@ protected void onCreate(Bundle savedInstanceState) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); Parent_linear = findViewById(R.id.parent_linear); + if(isNetworkConnected()){ + StartServerFile(); + handler.postDelayed(new Runnable() + { + @Override + public void run() + { + handler.postDelayed(UpdateTilesAsyn, 1000); - StartServerFile(); - + } + }, 60000); + } + else { + alertBox(); + } } + private final Handler handler = new Handler(){ + @Override + public void handleMessage(Message msg) + { + } + }; + private Runnable UpdateTilesAsyn = new Runnable() + { + public void run() + { + StartServerFile(); + handler.postDelayed(this, 15000); // 50 sec + } + }; + private boolean isNetworkConnected() { + ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); + + return cm.getActiveNetworkInfo() != null && cm.getActiveNetworkInfo().isConnected(); + } + public void alertBox(){ + try { + AlertDialog alertDialog = new AlertDialog.Builder(this).create(); + + alertDialog.setTitle("Info"); + alertDialog.setMessage("Internet not available, Cross check your internet connectivity and try again"); + alertDialog.setIcon(android.R.drawable.ic_dialog_alert); + alertDialog.setCancelable(false); + alertDialog.setButton("Retry", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + Intent intent = new Intent(TryingActivity.this,LoginActivity.class); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); + startActivity(intent); + finish(); + } + }); + alertDialog.show(); + } catch (Exception e) { + Log.d("TAG", "Show Dialog: " + e.getMessage()); + } + } public void StartServerFile() { - String url = "https://pula.tech/connectapi/AndroidApi/listChildUsers.php?userId=2"; + String url = "https://meety.se/api/AndroidApi/listChildUsers.php?userId="+file_retreive(); FetchFromDB asyncTask = (FetchFromDB) new FetchFromDB(url,new FetchFromDB.AsyncResponse() { @@ -618,7 +674,7 @@ else if(nameList.size() > 15 && nameList.size() < 18 && five_columns == 0 && fou } - /*thread_Start = new Thread() + /* thread_Start = new Thread() { public void run() { @@ -642,7 +698,7 @@ public void run() { } }; - thread_Start.start();*/ + thread_Start.start(); */ } @@ -656,6 +712,18 @@ private void ConvertFromJSON(String json) for (int i = 0; i < jsonArray.length(); i++) { JSONObject obj = jsonArray.getJSONObject(i); + if(i==0 && obj.getString("isEnabled").equals("0")){ + if(isMyServiceRunning(SkypeService.class)){ + stopService(new Intent(TryingActivity.this, SkypeService.class)); + } + // stopThread(); + handler.removeCallbacks(UpdateTilesAsyn); + Intent supportActivityIntent = new Intent(this,SupportActivity.class); + supportActivityIntent.putExtra("error","Account Deactivated"); + startActivity(supportActivityIntent); + + finish(); + } nameList.add(obj.getString("firstName")); colorCode.add(obj.getString("colorCode")); idArray.add(obj.getString("id")); @@ -673,32 +741,7 @@ private void ConvertFromJSON(String json) } - /*public void Toolbar(){ - - LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); - View ViewInflator; - ViewInflator = inflater.inflate(R.layout.activity_trying, null); - - toolbar = ViewInflator.findViewById(R.id.toolbarId); - toolbar.setTitle("Meety"); - Log.e("Got into Toolbar", "YEs"); - toolbar.inflateMenu(R.menu.action_bar_menu); - - toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() { - @Override - public boolean onMenuItemClick(MenuItem item) { - - if(item.getItemId()==R.id.wifi) - { - startActivity(new Intent(WifiManager.ACTION_PICK_WIFI_NETWORK)); - } - return false; - - } - }); - - }*/ @Override public void onClick(View v) { @@ -713,7 +756,6 @@ public void onClick(View v) { } else { Log.e("Clicked", String.valueOf(v.getId())); - Intent serviceIntent = new Intent(getApplicationContext(), SkypeService.class); serviceIntent.putExtra("CallerID", nameList.get(v.getId())); Log.e("Service Name", nameList.get(v.getId())); @@ -721,43 +763,23 @@ public void onClick(View v) { try { - /*Intent sky = new Intent("android.intent.action.VIEW"); - sky.setData(Uri.parse("skype:" + skypeIDList.get(v.getId()))); - startActivity(sky);*/ + Intent sky = new Intent("android.intent.action.VIEW"); + sky.setData(Uri.parse("skype:" + skypeIDList.get(v.getId())+"?call&video=true")); + startActivity(sky); + /* Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse("skype:" + skypeIDList.get(v.getId()))); - startActivity(i); + startActivity(i); */ + } catch (ActivityNotFoundException e) { Log.e("SKYPE CALL", "Skype failed", e); } - } } - /*@Override - public boolean onCreateOptionsMenu(Menu menu){ - - getMenuInflater().inflate(R.menu.action_bar_menu, menu); - return true; - - } - - @Override - public boolean onOptionsItemSelected(MenuItem item){ - - if(item.getItemId() == R.id.wifi){ - - Log.e("Yes", "Wifi has been tapped"); - - } - - return true; - - }*/ - private boolean isMyServiceRunning(Class serviceClass) { ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { @@ -767,21 +789,40 @@ private boolean isMyServiceRunning(Class serviceClass) { } return false; } - public void stopThread(){ - - try{ - + try + { thread_Start.stop(); thread_Start.destroy(); thread_Start.interrupt(); - } catch (Exception Ex){} Log.e("Thread Stopped", "Thanks"); } + private String file_retreive() + { + FileInputStream inputStream = null; + try + { + inputStream = openFileInput("UserID"); + StringBuffer fileContent = new StringBuffer(""); + byte[] buffer = new byte[1024]; + int n; + while (( n = inputStream.read(buffer)) != -1) + { + fileContent.append(new String(buffer, 0, n)); + } - } + inputStream.close(); + return fileContent.toString(); + } + catch (Exception e) + { + e.printStackTrace(); + return "error"; + } + } +} diff --git a/app/src/main/res/layout/activity_ringing.xml b/app/src/main/res/layout/activity_ringing.xml new file mode 100644 index 0000000..bb26462 --- /dev/null +++ b/app/src/main/res/layout/activity_ringing.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + +