diff --git a/LICENSE b/LICENSE.txt similarity index 99% rename from LICENSE rename to LICENSE.txt index 9e85851..2b9efc3 100644 --- a/LICENSE +++ b/LICENSE.txt @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index 977221d..265608b 100644 --- a/README.md +++ b/README.md @@ -1,79 +1,86 @@ # Cisco Webex Android SDK Example -This "Kitchen Sink" demo employs Cisco Webex service through [Webex Android SDK](https://github.com/webex/webex-android-sdk). It provides a developer friendly sample implementation of Webex client SDK and showcases all SDK features. It focuses on how to call and use "Webex-SDK" APIs. Developers could directly cut, paste, and use the code from this sample. It basically implements “Webex-SDK” APIs by sequence. +This *Kitchen Sink* demo employs Cisco Webex service through [Webex Android SDK](https://github.com/webex/webex-android-sdk). It provides a developer friendly sample implementation of Webex client SDK and showcases all SDK features. It focuses on how to call and use *Webex-SDK* APIs. Developers could directly cut, paste, and use the code from this sample. It basically implements *Webex-SDK* APIs by sequence. -This demo support Android device with **Android 6.0** or later +This demo support Android device with **Android 7.0** or later ## Table of Contents -- [Setup](#setup) -- [Install](#install) +- [Integration](#integration) - [Usage](#usage) +- [Note](#note) ## Screenshots 1. ScreenShot-1: Main page of Application, listing main functions of this demo. -2. ScreenShot-2: Initiate call page, contains call configuration options. -3. ScreenShot-3: Show messaing APIs with present payloads. - -## Setup - -- Install Java SE Development Kit 7u45 or later (Java 8 is OK) - - http://www.oracle.com/technetwork/java/javase/downloads/index.html - -- Android Studio 2.3 or later - - https://developer.android.com/sdk/installing/studio.html - -- Android Plugin for Gradle 3 or later - - If you upgrade your gradle plugin newer than 3.0.0, make sure to add google repository and remove retrolambda plugin in your build.gradle file: - ``` - allprojects { - repositories { - jcenter() - google() - ... - } - } - ``` - -- Select tools->Android->SDK Manager in Android Studio, and install the following packages: - * Android SDK Tools - * Android SDK Platform-Tools - * Android SDK Build-Tools (latest) - * Android 7.1.1 (latest) - * Support Repository: Android Support Repository - * Support Repository: ConstraintLayout for Android - * Support Repository: Google Repository - - -## Install - -1. Clone or download project to your computer. - ``` - git clone https://github.com/webex/webex-android-sdk-example - ``` - -2. Import project -In Android Studio,open "File" -> "Open", select project. - -3. Connect your device with debug enabled - -4. Build & Run +2. ScreenShot-2: Initiate call page. +3. ScreenShot-3: Show call controls when call is connected. +4. ScreenShot-4: Video calling screen +5. ScreenShot-5: Teams listing screen +6. ScreenShot-6: Space related option screen +7. ScreenShot-7: Space listing screen +8. ScreenShot-8: Send Message screen + +## Integration + +### Option 1 +1. Put AAR file in libs folder of your Android project +2. Open the project level Gradle file and add the following lines under the repositories tag, which is nested under allprojects. + + ``` + allprojects { + repositories { + jcenter() + google() + flatDir { dirs 'aars'} //add this line + } + } + ``` +3. Add the following dependency in module level Gradle file and press sync-now + ``` + implementation files('libs/WebexSDK.aar') + ``` +### Option 2 + + 1. Add the following repository to your top-level `build.gradle` file: + ``` + allprojects { + repositories { + jcenter() + maven { + url 'https://devhub.cisco.com/artifactory/webexsdk/' + } + } + } + ``` + 2. Add the `webex-android-sdk` library as a dependency for your app in the `build.gradle` file: + + ``` + dependencies { + implementation 'com.ciscowebex:androidsdk:3.0.0@aar' + } + ``` ## Usage -### Authorize -**Webex ID** -If you have a Webex ID (your email address), you can choose "**Webex ID**" to authorize your device. - -**Guest ID** -If you have a Guest ID (a string token), choose "**Guest ID**" in the first page, then you need to enter your App JWT token and login. +For example see [README.md](https://github.com/webex/webex-android-sdk/README.md) + +## Note + + Please update below constants in gradle.properties + ``` + CLIENT_ID="" + CLIENT_SECRET="" + REDIRECT_URI="" + ``` \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore deleted file mode 100644 index 796b96d..0000000 --- a/app/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index 59246cd..0000000 --- a/app/build.gradle +++ /dev/null @@ -1,78 +0,0 @@ -apply plugin: 'com.android.application' -apply plugin: 'org.greenrobot.greendao' - -android { - compileSdkVersion 30 - buildToolsVersion "29.0.3" - defaultConfig { - applicationId "com.ciscowebex.androidsdk.kitchensink" - minSdkVersion 24 - targetSdkVersion 30 - versionCode 1 - versionName "1.0" - testInstrumentationRunner "android.support.test.agent.AndroidJUnitRunner" - vectorDrawables.useSupportLibrary = true - - ndk { - abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64" - } - multiDexEnabled true - - buildConfigField "String", "CLIENT_ID", "\"C338457876c27e853fb5e4dc85c6087164073e1e2bf415c081b600fe654d7af60\"" - buildConfigField "String", "CLIENT_SEC", "\"0dc8b9c77c8b5597e7eef4b72c7dfaf8d5b834fdba24cf0a0b55eb85ae209b31\"" - buildConfigField "String", "REDIRECT_URL", "\"AndroidKitchenSink://response\"" - buildConfigField "String", "SCOPE", "\"spark:all\"" - } - packagingOptions { - exclude 'META-INF/DEPENDENCIES' - exclude 'META-INF/NOTICE' - exclude 'META-INF/LICENSE' - exclude 'META-INF/LICENSE.txt' - exclude 'META-INF/NOTICE.txt' - exclude 'META-INF/rxjava.properties' - } - buildTypes { - release { - minifyEnabled false - } - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - dexOptions { - preDexLibraries = false - javaMaxHeapSize "4g" - } -} - -repositories { - flatDir { - dirs 'libs' - } -} - -dependencies { - implementation('com.ciscowebex:androidsdk:2.8.0@aar', { - transitive = true - changing = true - }) - implementation 'com.android.support:appcompat-v7:27.1.0' - implementation 'com.android.support:cardview-v7:27.1.0' - implementation 'com.android.support:gridlayout-v7:27.1.0' - implementation 'com.android.support:support-annotations:27.1.0' - implementation 'com.android.support:design:27.1.0' - implementation 'com.android.support:support-v13:27.1.0' - implementation 'com.android.support:gridlayout-v7:27.1.0' - implementation 'com.android.support:design:27.1.0' - - implementation 'org.greenrobot:eventbus:3.0.0' - - - implementation 'com.android.support.constraint:constraint-layout:1.1.3' - implementation 'com.squareup.picasso:picasso:2.5.2' - implementation 'org.greenrobot:greendao:3.2.2' - implementation 'com.jakewharton:butterknife:8.8.1' - annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1' - testImplementation 'junit:junit:4.12' -} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro deleted file mode 100644 index 1547ae6..0000000 --- a/app/proguard-rules.pro +++ /dev/null @@ -1,25 +0,0 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in /Users/lm/Library/Android/sdk/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile diff --git a/app/src/androidTest/java/com/ciscowebex/androidsdk/kitchensink/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/ciscowebex/androidsdk/kitchensink/ExampleInstrumentedTest.java deleted file mode 100644 index 8c12513..0000000 --- a/app/src/androidTest/java/com/ciscowebex/androidsdk/kitchensink/ExampleInstrumentedTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.ciscowebex.androidsdk.kitchensink; - -import android.content.Context; -import android.support.test.InstrumentationRegistry; -import android.support.test.runner.AndroidJUnit4; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import static org.junit.Assert.*; - -/** - * Instrumentation test, which will execute on an Android device. - * - * @see Testing documentation - */ -@RunWith(AndroidJUnit4.class) -public class ExampleInstrumentedTest { - @Test - public void useAppContext() throws Exception { - // Context of the app under test. - Context appContext = InstrumentationRegistry.getTargetContext(); - - assertEquals("com.ciscowebex.androidsdk.webexkitchensink", appContext.getPackageName()); - } -} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml deleted file mode 100644 index 305714d..0000000 --- a/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/KitchenSinkApp.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/KitchenSinkApp.java deleted file mode 100644 index b5e6171..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/KitchenSinkApp.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink; - -import android.app.Application; - -import com.ciscowebex.androidsdk.kitchensink.models.DaoMaster; -import com.ciscowebex.androidsdk.kitchensink.models.DaoSession; - -import org.greenrobot.greendao.database.Database; - -/** - * Created on 18/09/2017. - */ - -public class KitchenSinkApp extends Application { - - private static KitchenSinkApp application; - private static DaoSession daoSession; - - @Override - public void onCreate() { - super.onCreate(); - application = this; - DaoMaster.DevOpenHelper helper = new DaoMaster.DevOpenHelper(this, "call-history-db"); - Database db = helper.getWritableDb(); - daoSession = new DaoMaster(db).newSession(); - } - - public static KitchenSinkApp getApplication() { - return application; - } - - public static DaoSession getDaoSession() { - return daoSession; - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/EventPubCallObserver.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/EventPubCallObserver.java deleted file mode 100644 index caa9355..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/EventPubCallObserver.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.actions; - -import com.ciscowebex.androidsdk.internal.reachability.BackgroundChecker; -import com.ciscowebex.androidsdk.internal.reachability.ForegroundChecker; -import com.ciscowebex.androidsdk.kitchensink.actions.events.OnCallMembershipEvent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.OnConnectEvent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.OnDisconnectEvent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.OnScheduleChangedEvent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.OnWaitingEvent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.OnMediaChangeEvent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.OnRingingEvent; -import com.ciscowebex.androidsdk.phone.Call; -import com.ciscowebex.androidsdk.phone.CallObserver; -import com.ciscowebex.androidsdk.utils.Utils; - -import org.greenrobot.eventbus.EventBus; - - -/** - * Created on 18/09/2017. - */ - -public class EventPubCallObserver implements CallObserver { - @Override - public void onRinging(Call call) { - postEvent(new OnRingingEvent(call)); - } - - @Override - public void onConnected(Call call) { - postEvent(new OnConnectEvent(call)); - } - - @Override - public void onDisconnected(CallDisconnectedEvent callDisconnectedEvent) { - postEvent(new OnDisconnectEvent(callDisconnectedEvent)); - } - - @Override - public void onMediaChanged(MediaChangedEvent mediaChangedEvent) { - postEvent(new OnMediaChangeEvent(mediaChangedEvent)); - } - - @Override - public void onCallMembershipChanged(CallMembershipChangedEvent event) { - postEvent(new OnCallMembershipEvent(event)); - } - - @Override - public void onScheduleChanged(Call call) { - postEvent(new OnScheduleChangedEvent(call)); - } - - @Override - public void onWaiting(Call call, Call.WaitReason waitReason) { - postEvent(new OnWaitingEvent(call, waitReason)); - } - - private void postEvent(Object event) { - if (ForegroundChecker.getInstance().isForeground()) { - EventBus.getDefault().post(event); - } else { - EventBus.getDefault().postSticky(event); - } - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/IAction.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/IAction.java deleted file mode 100644 index b35eb12..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/IAction.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.actions; - -/** - * Created on 19/09/2017. - */ - -public interface IAction { - void execute(); -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/WebexAgent.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/WebexAgent.java deleted file mode 100644 index d73b922..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/WebexAgent.java +++ /dev/null @@ -1,358 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.actions; - -import android.net.Uri; -import android.support.annotation.Nullable; -import android.util.Pair; -import android.view.View; - -import com.ciscowebex.androidsdk.CompletionHandler; -import com.ciscowebex.androidsdk.Result; -import com.ciscowebex.androidsdk.Webex; -import com.ciscowebex.androidsdk.kitchensink.actions.events.AnswerEvent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.DialEvent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.HangupEvent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.LoginEvent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.OnIncomingCallEvent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.RejectEvent; -import com.ciscowebex.androidsdk.membership.MembershipClient; -import com.ciscowebex.androidsdk.message.MessageClient; -import com.ciscowebex.androidsdk.message.RemoteFile; -import com.ciscowebex.androidsdk.phone.Call; -import com.ciscowebex.androidsdk.phone.CallObserver; -import com.ciscowebex.androidsdk.phone.MediaOption; -import com.ciscowebex.androidsdk.phone.Phone; -import com.ciscowebex.androidsdk.space.SpaceClient; - -import java.io.File; - -import static com.ciscowebex.androidsdk.kitchensink.actions.events.WebexAgentEvent.postEvent; - - -/** - * Created on 13/09/2017. - */ - -public class WebexAgent { - - public enum CallCap {AUDIO_ONLY, AUDIO_VIDEO} - - public enum CameraCap {FRONT, BACK, CLOSE} - - private Webex webex; - private Phone phone; - private Call activeCall; - private Call incomingCall; - private boolean isSpeakerOn = true; - private boolean isDialing = false; - - private static WebexAgent instance; - private final CallObserver callObserver = new EventPubCallObserver(); - private CallCap callCap = CallCap.AUDIO_VIDEO; - private CameraCap cameraCap = CameraCap.FRONT; - - public static WebexAgent getInstance() { - if (instance == null) { - instance = new WebexAgent(); - } - return instance; - } - - public Webex getWebex() { - return webex; - } - - public void setWebex(Webex webex) { - this.webex = webex; - //this.webex.setLogLevel(Webex.LogLevel.ALL); - } - - public Phone getPhone() { - return phone; - } - - public Call getActiveCall() { - return activeCall; - } - - public boolean getSpeakerPhoneOn() { - return isSpeakerOn; - } - - public void setSpeakerPhoneOn(boolean on) { - isSpeakerOn = on; - } - - public void setMaxBandWidth(int maxBandWidth) { - if (phone != null) { - phone.setVideoMaxBandwidth(maxBandWidth); - } - } - - public int getMaxBandWidth() { - if (phone != null) { - return phone.getVideoMaxBandwidth(); - } - return -1; - } - - public void register() { - phone = webex.phone(); - phone.register(r -> { - if (r.isSuccessful()) { - setupIncomingCallListener(); - } - new LoginEvent(r).post(); - }); - } - - private void setupIncomingCallListener() { - phone.setIncomingCallListener(call -> { - incomingCall = call; - incomingCall.setObserver(callObserver); - postEvent(new OnIncomingCallEvent(call)); - }); - } - - public void getMembership(String roomId, CompletionHandler handler) { - MembershipClient client = webex.memberships(); - client.list(roomId, null, null, 0, handler); - } - - public boolean isCallIncoming() { - return incomingCall != null && !incomingCall.getStatus().equals(Call.CallStatus.DISCONNECTED); - } - - public void setCallCapability(CallCap cap) { - callCap = cap; - } - - public CallCap getCallCapability() { - return callCap; - } - - public MessageClient getMessageClient() { - return webex.messages(); - } - - public SpaceClient getSpaceClient() { - return webex.spaces(); - } - - public MembershipClient getMembershipClient() { - return webex.memberships(); - } - - public void downloadThumbnail(RemoteFile file, File saveTo, MessageClient.ProgressHandler handler, CompletionHandler completionHandler) { - getMessageClient().downloadThumbnail(file, saveTo, handler, completionHandler); - } - - public void downloadFile(RemoteFile file, File saveTo, MessageClient.ProgressHandler handler, CompletionHandler completionHandler) { - getMessageClient().downloadFile(file, saveTo, handler, completionHandler); - } - - public void dial(String callee, View localView, View remoteView, View screenSharing, boolean isModerator, @Nullable String pin) { - isDialing = true; - phone.dial(callee, getMediaOption(localView, remoteView, screenSharing, isModerator, pin), (Result result) -> { - if (result.isSuccessful()) { - activeCall = result.getData(); - if (!isDialing || activeCall == null) { - hangup(); - } else { - activeCall.setObserver(callObserver); - } - } - isDialing = false; - new DialEvent(result).post(); - }); - } - - private MediaOption getMediaOption(View localView, View remoteView, View screenSharing, boolean isModerator, String pin) { - MediaOption mediaOption; - if (callCap.equals(CallCap.AUDIO_ONLY)) - mediaOption = MediaOption.audioOnly(); - else - mediaOption = MediaOption.audioVideoSharing(new Pair<>(localView, remoteView), screenSharing); - mediaOption.setModerator(isModerator); - mediaOption.setPin(pin); - return mediaOption; - } - - public void reject() { - incomingCall.reject(r -> new RejectEvent(r).post()); - incomingCall = null; - } - - public void hangup() { - isDialing = false; - if (activeCall != null) { - activeCall.hangup(r -> new HangupEvent(r).post()); - activeCall = null; - } - } - - public void answer(View localView, View remoteView, View screenShare, boolean isModerator, @Nullable String pin) { - if (isCallIncoming()) { - activeCall = incomingCall; - incomingCall = null; - activeCall.setObserver(callObserver); - activeCall.answer(getMediaOption(localView, remoteView, screenShare, isModerator, pin), r -> new AnswerEvent(r).post()); - } - } - - public void setVideoRenderViews(@Nullable Pair videoRenderViews) { - activeCall.setVideoRenderViews(videoRenderViews); - } - - public void startPreview(View view) { - cameraCap = getDefaultCamera(); - phone.startPreview(view); - } - - public void stopPreview() { - phone.stopPreview(); - } - - public void setFrontCamera() { - if (activeCall != null) activeCall.setFacingMode(Phone.FacingMode.USER); - } - - public void setBackCamera() { - if (activeCall != null) activeCall.setFacingMode(Phone.FacingMode.ENVIROMENT); - } - - public void setDefaultCamera(CameraCap cap) { - cameraCap = cap; - switch (cap) { - case FRONT: - phone.setDefaultFacingMode(Phone.FacingMode.USER); - break; - case BACK: - phone.setDefaultFacingMode(Phone.FacingMode.ENVIROMENT); - break; - case CLOSE: - break; - } - } - - public CameraCap getDefaultCamera() { - if (cameraCap.equals(CameraCap.CLOSE)) - return CameraCap.CLOSE; - if (phone.getDefaultFacingMode().equals(Phone.FacingMode.USER)) - return CameraCap.FRONT; - else - return CameraCap.BACK; - } - - public void sendVideo(boolean b) { - if (activeCall != null) - activeCall.setSendingVideo(b); - } - - public void sendAudio(boolean b) { - if (activeCall != null) - activeCall.setSendingAudio(b); - } - - public void receiveVideo(boolean b) { - if (activeCall != null) - activeCall.setReceivingVideo(b); - } - - public void receiveAudio(boolean b) { - if (activeCall != null) - activeCall.setReceivingAudio(b); - } - - public boolean isSendingVideo() { - if (activeCall != null) - return activeCall.isSendingVideo(); - return false; - } - - public boolean isSendingAudio() { - if (activeCall != null) - return activeCall.isSendingAudio(); - return false; - } - - public boolean isReceivingVideo() { - if (activeCall != null) - return activeCall.isReceivingVideo(); - return false; - } - - public boolean isReceivingAudio() { - if (activeCall != null) - return activeCall.isReceivingAudio(); - return false; - } - - public boolean isScreenSharing() { - if (activeCall != null) { - return activeCall.isRemoteSendingSharing(); - } - return false; - } - - public void enableAudioBNR(boolean enable) { - if (phone != null) { - phone.enableAudioBNR(enable); - } - } - - public boolean isAudioBNREnable() { - if (phone != null) { - return phone.isAudioBNREnable(); - } - return false; - } - - public void setAudioBNRMode(Phone.AudioBRNMode mode) { - if (phone != null) { - phone.setAudioBNRMode(mode); - } - } - - public Phone.AudioBRNMode getAudioBNRMode() { - if (phone != null) { - return phone.getAudioBNRMode(); - } - return null; - } - - public void setVideoStreamMode(Phone.VideoStreamMode mode) { - if (phone != null) { - phone.setVideoStreamMode(mode); - } - } - - public Phone.VideoStreamMode getVideoStreamMode() { - if (phone != null) { - return phone.getVideoStreamMode(); - } - return null; - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/commands/AddCallHistoryAction.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/commands/AddCallHistoryAction.java deleted file mode 100644 index ed23142..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/commands/AddCallHistoryAction.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.actions.commands; - -import com.ciscowebex.androidsdk.kitchensink.actions.IAction; -import com.ciscowebex.androidsdk.kitchensink.actions.WebexAgent; -import com.ciscowebex.androidsdk.kitchensink.models.CallHistory; -import com.ciscowebex.androidsdk.kitchensink.models.CallHistoryDao; -import com.ciscowebex.androidsdk.kitchensink.models.DaoSession; -import com.ciscowebex.androidsdk.people.Person; -import com.ciscowebex.androidsdk.kitchensink.KitchenSinkApp; - -import java.util.Date; -import java.util.List; - -import static com.ciscowebex.androidsdk.kitchensink.KitchenSinkApp.getApplication; - -/** - * Created on 22/09/2017. - */ - -public class AddCallHistoryAction implements IAction { - CallHistory history; - CallHistoryDao dao; - - public AddCallHistoryAction(String email, String direction) { - DaoSession daoSession = getApplication().getDaoSession(); - dao = daoSession.getCallHistoryDao(); - - history = new CallHistory(); - history.setEmail(email); - history.setDirection(direction); - history.setDate(new Date()); - } - - @Override - public void execute() { - WebexAgent agent = WebexAgent.getInstance(); - agent.getWebex().people().list(history.getEmail(), null, 1, result -> { - if (result.isSuccessful()) { - List personList = result.getData(); - if (personList.size() > 0) { - history.setPerson(personList.get(0).toString()); - dao.update(history); - } - } - }); - dao.insert(history); - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/commands/AppIdLoginAction.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/commands/AppIdLoginAction.java deleted file mode 100644 index 1d00ef4..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/commands/AppIdLoginAction.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.actions.commands; - -import com.ciscowebex.androidsdk.Webex; -import com.ciscowebex.androidsdk.auth.JWTAuthenticator; -import com.ciscowebex.androidsdk.kitchensink.KitchenSinkApp; -import com.ciscowebex.androidsdk.kitchensink.actions.IAction; -import com.ciscowebex.androidsdk.kitchensink.actions.WebexAgent; - -/** - * Created on 19/09/2017. - */ - -public class AppIdLoginAction implements IAction { - private String jwt; - - public AppIdLoginAction(String jwt) { - this.jwt = jwt; - } - - @Override - public void execute() { - JWTAuthenticator jwtAuthenticator = new JWTAuthenticator(); - Webex webex = new Webex(KitchenSinkApp.getApplication(), jwtAuthenticator); - WebexAgent.getInstance().setWebex(webex); - jwtAuthenticator.authorize(jwt); - new RegisterAction(jwtAuthenticator).execute(); - } -} \ No newline at end of file diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/commands/LogoutAction.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/commands/LogoutAction.java deleted file mode 100644 index 1c5098f..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/commands/LogoutAction.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.actions.commands; - -import com.ciscowebex.androidsdk.WebexError; -import com.ciscowebex.androidsdk.kitchensink.actions.IAction; -import com.ciscowebex.androidsdk.kitchensink.actions.WebexAgent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.LogoutEvent; - -/** - * Created on 19/09/2017. - */ - -public class LogoutAction implements IAction { - @Override - public void execute() { - WebexAgent agent = WebexAgent.getInstance(); - agent.getPhone().deregister(r -> { - if (r.isSuccessful() || (r.getError()!= null && r.getError().getErrorCode() == WebexError.ErrorCode.NETWORK_ERROR.getCode())) - agent.getWebex().getAuthenticator().deauthorize(); - new LogoutEvent(r).post(); - }); - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/commands/RegisterAction.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/commands/RegisterAction.java deleted file mode 100644 index 39a488c..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/commands/RegisterAction.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.actions.commands; - -import com.ciscowebex.androidsdk.auth.Authenticator; -import com.ciscowebex.androidsdk.kitchensink.actions.IAction; -import com.ciscowebex.androidsdk.kitchensink.actions.WebexAgent; - -/** - * Created on 26/09/2017. - */ - -public class RegisterAction implements IAction { - Authenticator authenticator; - - public RegisterAction(Authenticator auth) { - this.authenticator = auth; - } - - @Override - public void execute() { - WebexAgent.getInstance().register(); - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/commands/RequirePermissionAction.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/commands/RequirePermissionAction.java deleted file mode 100644 index 5a5705e..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/commands/RequirePermissionAction.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.actions.commands; - -import android.Manifest; -import android.app.Activity; -import android.content.pm.PackageManager; -import android.support.v4.app.ActivityCompat; -import android.support.v4.content.ContextCompat; - -import com.ciscowebex.androidsdk.kitchensink.actions.IAction; -import com.ciscowebex.androidsdk.kitchensink.actions.events.PermissionAcquiredEvent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.WebexAgentEvent; - -/** - * Created on 30/09/2017. - */ - -public class RequirePermissionAction implements IAction { - Activity activity; - - public RequirePermissionAction(Activity activity) { - this.activity = activity; - } - - @Override - public void execute() { - String[] permissions = { - Manifest.permission.READ_EXTERNAL_STORAGE, - Manifest.permission.CAMERA - }; - for (String permission : permissions) { - int permissionCheck = ContextCompat.checkSelfPermission(activity, permission); - if (permissionCheck != PackageManager.PERMISSION_GRANTED) { - ActivityCompat.requestPermissions(activity, permissions, 0); - return; - } - } - WebexAgentEvent.postEvent(new PermissionAcquiredEvent()); - } - - public static void PermissionsRequired(int requestCode, int[] grantResults) { - if (requestCode == 0) { - for (int grant : grantResults) { - if (grant != PackageManager.PERMISSION_GRANTED) { - return; - } - } - WebexAgentEvent.postEvent(new PermissionAcquiredEvent()); - } - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/commands/SearchPeopleAction.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/commands/SearchPeopleAction.java deleted file mode 100644 index 14a2b7a..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/commands/SearchPeopleAction.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.actions.commands; - -import com.ciscowebex.androidsdk.kitchensink.actions.IAction; -import com.ciscowebex.androidsdk.kitchensink.actions.WebexAgent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.SearchPersonCompleteEvent; - -/** - * Created on 19/09/2017. - */ - -public class SearchPeopleAction implements IAction { - private String email; - private String name; - - public SearchPeopleAction(String email, String name) { - this.email = email; - this.name = name; - } - - @Override - public void execute() { - WebexAgent agent = WebexAgent.getInstance(); - agent.getWebex().people().list(email, name, 10, - result -> new SearchPersonCompleteEvent(result).post()); - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/commands/SearchSpaceAction.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/commands/SearchSpaceAction.java deleted file mode 100644 index 836e705..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/commands/SearchSpaceAction.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.actions.commands; - -import com.ciscowebex.androidsdk.kitchensink.actions.IAction; -import com.ciscowebex.androidsdk.kitchensink.actions.WebexAgent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.SearchActiveSpaceCompleteEvent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.SearchSpaceCompleteEvent; -import com.ciscowebex.androidsdk.space.SpaceClient; - - -public class SearchSpaceAction implements IAction { - @Override - public void execute() { - WebexAgent agent = WebexAgent.getInstance(); - agent.getWebex().spaces().list(null, 0, null, SpaceClient.SortBy.LASTACTIVITY, result -> { - new SearchSpaceCompleteEvent(result).post(); - agent.getWebex().spaces().listWithActiveCalls(r -> - new SearchActiveSpaceCompleteEvent(r).post()); - }); - - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/commands/ToggleSpeakerAction.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/commands/ToggleSpeakerAction.java deleted file mode 100644 index 5d62646..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/commands/ToggleSpeakerAction.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.actions.commands; - -import android.bluetooth.BluetoothAdapter; -import android.content.Context; - -import com.ciscowebex.androidsdk.kitchensink.actions.IAction; -import com.ciscowebex.androidsdk.kitchensink.actions.WebexAgent; -import com.ciscowebex.androidsdk.phone.Call; -import com.ciscowebex.androidsdk.phone.internal.CallImpl; - - -/** - * Created on 19/09/2017. - */ - -public class ToggleSpeakerAction implements IAction { - private boolean on; - private Context context; - private CallImpl call; - - public ToggleSpeakerAction(Context context, CallImpl call, boolean on) { - this.context = context; - this.on = on; - this.call = call; - } - - @Override - public void execute() { - if (call != null) { - android.media.AudioManager am = (android.media.AudioManager) context.getSystemService(Context.AUDIO_SERVICE); - if (on) { - call.switchAudioOutput(Call.AudioOutputMode.SPEAKER); - } else { - if (isBluetoothHeadsetConnected()) { - call.switchAudioOutput(Call.AudioOutputMode.BLUETOOTH_HEADSET); - } else if (am.isWiredHeadsetOn()) { - call.switchAudioOutput(Call.AudioOutputMode.HEADSET); - } else { - call.switchAudioOutput(Call.AudioOutputMode.PHONE); - } - } - } - - WebexAgent.getInstance().setSpeakerPhoneOn(on); - } - - private boolean isBluetoothHeadsetConnected() { - return BluetoothAdapter.getDefaultAdapter().getProfileConnectionState(android.bluetooth.BluetoothProfile.HEADSET) - != android.bluetooth.BluetoothProfile.STATE_DISCONNECTED; - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/commands/WebexIdLoginAction.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/commands/WebexIdLoginAction.java deleted file mode 100644 index 4d031ed..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/commands/WebexIdLoginAction.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.actions.commands; - -import android.webkit.WebView; - -import com.ciscowebex.androidsdk.Webex; -import com.ciscowebex.androidsdk.auth.OAuthWebViewAuthenticator; -import com.ciscowebex.androidsdk.kitchensink.BuildConfig; -import com.ciscowebex.androidsdk.kitchensink.actions.IAction; -import com.ciscowebex.androidsdk.kitchensink.actions.WebexAgent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.LoginEvent; -import com.ciscowebex.androidsdk.kitchensink.KitchenSinkApp; - -/** - * Created on 19/09/2017. - */ - -public class WebexIdLoginAction implements IAction { - - private WebView view; - - private static final String clientId = BuildConfig.CLIENT_ID; - - private static final String clientSec = BuildConfig.CLIENT_SEC; - - private static final String redirect = BuildConfig.REDIRECT_URL; - - private static final String scope = BuildConfig.SCOPE; - - - public WebexIdLoginAction(WebView view) { - this.view = view; - } - - @Override - public void execute() { - OAuthWebViewAuthenticator oAuth2; - oAuth2 = new OAuthWebViewAuthenticator(clientId, clientSec, scope, redirect); - Webex webex = new Webex(KitchenSinkApp.getApplication(), oAuth2); - WebexAgent.getInstance().setWebex(webex); - if (oAuth2.isAuthorized()) { - new RegisterAction(oAuth2).execute(); - } else { - oAuth2.authorize(view, result -> { - if (result.isSuccessful()) { - new RegisterAction(oAuth2).execute(); - } else { - new LoginEvent(result).post(); - } - }); - } - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/AnswerEvent.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/AnswerEvent.java deleted file mode 100644 index 55eb6cc..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/AnswerEvent.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.actions.events; - -import com.ciscowebex.androidsdk.Result; - -/** - * Created on 15/09/2017. - */ -public class AnswerEvent extends WebexAgentEvent { - public AnswerEvent(Result result) { - super(result); - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/DialEvent.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/DialEvent.java deleted file mode 100644 index 8d15d5c..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/DialEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.actions.events; - -import com.ciscowebex.androidsdk.Result; - -/** - * Created on 15/09/2017. - */ - -public class DialEvent extends WebexAgentEvent { - public DialEvent(Result result) { - super(result); - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/HangupEvent.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/HangupEvent.java deleted file mode 100644 index 13cf387..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/HangupEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.actions.events; - -import com.ciscowebex.androidsdk.Result; - -/** - * Created on 15/09/2017. - */ - -public class HangupEvent extends WebexAgentEvent { - public HangupEvent(Result result) { - super(result); - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/LoginEvent.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/LoginEvent.java deleted file mode 100644 index f178e39..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/LoginEvent.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.actions.events; - - -import com.ciscowebex.androidsdk.Result; - -/** - * Created on 15/09/2017. - */ - -public class LoginEvent extends WebexAgentEvent { - - public LoginEvent(Result result) { - super(result); - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/LogoutEvent.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/LogoutEvent.java deleted file mode 100644 index ce879a4..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/LogoutEvent.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.actions.events; - -import com.ciscowebex.androidsdk.Result; - -/** - * Created on 15/09/2017. - */ - -public class LogoutEvent extends WebexAgentEvent { - - public LogoutEvent(Result result) { - super(result); - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/OnAuxStreamEvent.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/OnAuxStreamEvent.java deleted file mode 100644 index 2300a73..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/OnAuxStreamEvent.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.ciscowebex.androidsdk.kitchensink.actions.events; - -import com.ciscowebex.androidsdk.phone.MultiStreamObserver; - -/** - * Created by qimdeng on 8/10/18. - */ - -public class OnAuxStreamEvent { - public MultiStreamObserver.AuxStreamChangedEvent callEvent; - - public OnAuxStreamEvent(MultiStreamObserver.AuxStreamChangedEvent event) { - this.callEvent = event; - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/OnCallMembershipEvent.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/OnCallMembershipEvent.java deleted file mode 100644 index fb04672..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/OnCallMembershipEvent.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.ciscowebex.androidsdk.kitchensink.actions.events; - -import com.ciscowebex.androidsdk.phone.CallObserver; - -/** - * Created by qimdeng on 3/13/18. - */ - -public class OnCallMembershipEvent { - public CallObserver.CallMembershipChangedEvent callEvent; - - public OnCallMembershipEvent(CallObserver.CallMembershipChangedEvent event) { - this.callEvent = event; - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/OnConnectEvent.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/OnConnectEvent.java deleted file mode 100644 index 06abc3d..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/OnConnectEvent.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.actions.events; - -import com.ciscowebex.androidsdk.phone.Call; - -/** - * Created on 15/09/2017. - */ - -public class OnConnectEvent { - public Call call; - - public OnConnectEvent(Call call) { - this.call = call; - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/OnDisconnectEvent.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/OnDisconnectEvent.java deleted file mode 100644 index cecf648..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/OnDisconnectEvent.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.actions.events; - -import com.ciscowebex.androidsdk.phone.Call; -import com.ciscowebex.androidsdk.phone.CallObserver.CallDisconnectedEvent; - -/** - * Created on 15/09/2017. - */ - -public class OnDisconnectEvent { - CallDisconnectedEvent callEvent; - - public OnDisconnectEvent(CallDisconnectedEvent event) { - this.callEvent = event; - } - - public Call getCall() { - return callEvent != null ? callEvent.getCall() : null; - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/OnErrorEvent.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/OnErrorEvent.java deleted file mode 100644 index 00a7e10..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/OnErrorEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.actions.events; - -import com.ciscowebex.androidsdk.WebexError; - -/** - * Created on 15/09/2017. - */ - -public class OnErrorEvent { - public OnErrorEvent(WebexError e) { - - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/OnIncomingCallEvent.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/OnIncomingCallEvent.java deleted file mode 100644 index 0efa5d0..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/OnIncomingCallEvent.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.actions.events; - -import com.ciscowebex.androidsdk.phone.Call; - -/** - * Created on 15/09/2017. - */ - -public class OnIncomingCallEvent { - public Call call; - - public OnIncomingCallEvent(Call call) { - this.call = call; - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/OnMediaChangeEvent.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/OnMediaChangeEvent.java deleted file mode 100644 index 882dc70..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/OnMediaChangeEvent.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.actions.events; - -import com.ciscowebex.androidsdk.phone.CallObserver.MediaChangedEvent; - -/** - * Created on 15/09/2017. - */ - -public class OnMediaChangeEvent { - public MediaChangedEvent callEvent; - - public OnMediaChangeEvent(MediaChangedEvent event) { - this.callEvent = event; - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/OnRingingEvent.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/OnRingingEvent.java deleted file mode 100644 index 0b72cdc..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/OnRingingEvent.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.actions.events; - -import com.ciscowebex.androidsdk.phone.Call; - -/** - * Created on 15/09/2017. - */ - -public class OnRingingEvent { - public Call call; - - public OnRingingEvent(Call call) { - this.call = call; - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/OnScheduleChangedEvent.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/OnScheduleChangedEvent.java deleted file mode 100644 index 44a16b5..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/OnScheduleChangedEvent.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2016-2021 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.actions.events; - -import com.ciscowebex.androidsdk.phone.Call; - -/** - * Created on 24/09/2020. - */ - -public class OnScheduleChangedEvent { - public Call call; - - public OnScheduleChangedEvent(Call call) { - this.call = call; - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/OnWaitingEvent.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/OnWaitingEvent.java deleted file mode 100644 index 32da969..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/OnWaitingEvent.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.actions.events; - -import com.ciscowebex.androidsdk.phone.Call; - -/** - * Created on 15/09/2017. - */ - -public class OnWaitingEvent { - public Call call; - public Call.WaitReason waitReason; - - public OnWaitingEvent(Call call, Call.WaitReason waitReason) { - this.call = call; - this.waitReason = waitReason; - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/PermissionAcquiredEvent.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/PermissionAcquiredEvent.java deleted file mode 100644 index e522b67..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/PermissionAcquiredEvent.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.actions.events; - -/** - * Created on 30/09/2017. - */ - -public class PermissionAcquiredEvent { -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/RejectEvent.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/RejectEvent.java deleted file mode 100644 index e59d915..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/RejectEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.actions.events; - -import com.ciscowebex.androidsdk.Result; - -/** - * Created on 15/09/2017. - */ - -public class RejectEvent extends WebexAgentEvent { - public RejectEvent(Result result) { - super(result); - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/SearchActiveSpaceCompleteEvent.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/SearchActiveSpaceCompleteEvent.java deleted file mode 100644 index 6fe91c3..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/SearchActiveSpaceCompleteEvent.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2016-2021 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.actions.events; - -import com.ciscowebex.androidsdk.Result; - -public class SearchActiveSpaceCompleteEvent extends WebexAgentEvent { - public SearchActiveSpaceCompleteEvent(Result result) { - super(result); - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/SearchPersonCompleteEvent.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/SearchPersonCompleteEvent.java deleted file mode 100644 index 63187ac..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/SearchPersonCompleteEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.actions.events; - -import com.ciscowebex.androidsdk.Result; - -/** - * Created on 18/09/2017. - */ - -public class SearchPersonCompleteEvent extends WebexAgentEvent { - public SearchPersonCompleteEvent(Result result) { - super(result); - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/SearchSpaceCompleteEvent.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/SearchSpaceCompleteEvent.java deleted file mode 100644 index a34b9aa..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/SearchSpaceCompleteEvent.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.actions.events; - -import com.ciscowebex.androidsdk.Result; - -public class SearchSpaceCompleteEvent extends WebexAgentEvent { - public SearchSpaceCompleteEvent(Result result) { - super(result); - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/WebexAgentEvent.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/WebexAgentEvent.java deleted file mode 100644 index 1ae0b3d..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/actions/events/WebexAgentEvent.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.actions.events; - - -import com.ciscowebex.androidsdk.Result; -import com.ciscowebex.androidsdk.WebexError; - -import org.greenrobot.eventbus.EventBus; - - -/** - * Created on 15/09/2017. - */ - -public class WebexAgentEvent { - Result result; - - public WebexAgentEvent(Result result) { - this.result = result; - } - - public boolean isSuccessful() { - return result.isSuccessful(); - } - - public WebexError getError() { - return result.getError(); - } - - public Result getResult() { - return result; - } - - public static void postEvent(Object event) { - EventBus.getDefault().post(event); - } - - public void post() { - postEvent(this); - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/LauncherActivity.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/LauncherActivity.java deleted file mode 100644 index 9637490..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/LauncherActivity.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.launcher; - -import android.app.Activity; -import android.app.ActivityManager; -import android.app.Fragment; -import android.app.FragmentManager; -import android.app.NotificationManager; -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import android.widget.Switch; -import android.widget.Toast; - -import com.ciscowebex.androidsdk.kitchensink.R; -import com.ciscowebex.androidsdk.kitchensink.actions.commands.RequirePermissionAction; -import com.ciscowebex.androidsdk.kitchensink.actions.events.OnCallMembershipEvent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.OnMediaChangeEvent; -import com.ciscowebex.androidsdk.kitchensink.launcher.fragments.CallFragment; -import com.ciscowebex.androidsdk.kitchensink.launcher.fragments.LauncherFragment; -import com.ciscowebex.androidsdk.kitchensink.ui.BaseFragment; -import com.ciscowebex.androidsdk.phone.CallObserver; -import com.github.benoitdion.ln.Ln; - -import org.greenrobot.eventbus.EventBus; -import org.greenrobot.eventbus.Subscribe; -import org.greenrobot.eventbus.ThreadMode; - -import java.util.List; - - -public class LauncherActivity extends Activity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_launcher); - BaseFragment fragment = new LauncherFragment(); - replace(fragment); - EventBus.getDefault().register(this); - } - - @Override - public void onDestroy() { - super.onDestroy(); - EventBus.getDefault().unregister(this); - } - - @Override - public void onBackPressed() { - goBackStack(); - } - - public void goBackStack() { - FragmentManager manager = getFragmentManager(); - BaseFragment fm = (BaseFragment) getFragment(); - fm.onBackPressed(); - if (manager.getBackStackEntryCount() == 1) { - manager.popBackStackImmediate(); - super.onBackPressed(); - } else { - //manager.popBackStackImmediate(); - startActivity(new Intent(this, LauncherActivity.class)); - finish(); - } - } - - public void replace(BaseFragment fragment) { - fragment.replace(this, R.id.launcher); - } - - public Fragment getFragment() { - return getFragmentManager().findFragmentById(R.id.launcher); - } - - @Override - public void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - } - - @Override - public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { - RequirePermissionAction.PermissionsRequired(requestCode, grantResults); - } - - @SuppressWarnings("unused") - @Subscribe(threadMode = ThreadMode.MAIN) - public void onEventMainThread(OnMediaChangeEvent event) { - Ln.d("OnMediaChangeEvent: " + event.callEvent); - if (event.callEvent instanceof CallObserver.SendingSharingEvent) { - Ln.d("Activity SendingSharingEvent: " + ((CallObserver.SendingSharingEvent) event.callEvent).isSending()); - if (!((CallObserver.SendingSharingEvent) event.callEvent).isSending()) { - cancelNotification(); - moveToFront(); - updateSharingSwitch(false); - Toast.makeText(this, "Stop to share content", Toast.LENGTH_SHORT).show(); - } - } - } - - @SuppressWarnings("unused") - @Subscribe(threadMode = ThreadMode.MAIN) - public void onEventMainThread(OnCallMembershipEvent event) { - if (event.callEvent instanceof CallObserver.MembershipSendingSharingEvent) { - Ln.d("Activity CallMembership displayName: " + event.callEvent.getCallMembership().getDisplayName() + - " isSendingSharing: " + event.callEvent.getCallMembership().isSendingSharing()); - } - } - - protected void moveToFront() { - final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); - final List recentTasks = activityManager.getRunningTasks(Integer.MAX_VALUE); - - for (int i = 0; i < recentTasks.size(); i++) { - // bring to front - if (recentTasks.get(i).baseActivity.toShortString().indexOf("com.ciscowebex.androidsdk.kitchensink") > -1) { - activityManager.moveTaskToFront(recentTasks.get(i).id, ActivityManager.MOVE_TASK_WITH_HOME); - } - } - } - - private void cancelNotification() { - NotificationManager notifyManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE); - notifyManager.cancel(1); - } - - private void updateSharingSwitch(boolean flag) { - Switch shareSwitch = (Switch) findViewById(R.id.switchShareContent); - if (shareSwitch != null && shareSwitch.isChecked()) - shareSwitch.setChecked(flag); - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/CallFeedbackFragment.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/CallFeedbackFragment.java deleted file mode 100644 index cd11c48..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/CallFeedbackFragment.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.launcher.fragments; - - -import com.ciscowebex.androidsdk.kitchensink.R; -import com.ciscowebex.androidsdk.kitchensink.launcher.LauncherActivity; -import com.ciscowebex.androidsdk.kitchensink.ui.BaseFragment; - -import butterknife.OnClick; - -/** - * A simple {@link BaseFragment} subclass. - */ -public class CallFeedbackFragment extends BaseFragment { - - - public CallFeedbackFragment() { - // Required empty public constructor - setLayout(R.layout.fragment_call_feedback); - } - - @OnClick(R.id.sendFeedback) - public void sendFeedback() { - ((LauncherActivity) getActivity()).goBackStack(); - } - - @OnClick(R.id.cancelFeedback) - public void cancelFeedback() { - ((LauncherActivity) getActivity()).goBackStack(); - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/CallFragment.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/CallFragment.java deleted file mode 100644 index d3ff202..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/CallFragment.java +++ /dev/null @@ -1,1070 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.launcher.fragments; - - -import android.app.AlertDialog; -import android.app.AppOpsManager; -import android.app.Notification; -import android.app.NotificationChannel; -import android.app.NotificationManager; -import android.app.PendingIntent; -import android.app.PictureInPictureParams; -import android.content.ComponentName; -import android.content.Context; -import android.content.Intent; -import android.content.ServiceConnection; -import android.content.pm.PackageManager; -import android.content.res.Configuration; -import android.graphics.Rect; -import android.graphics.drawable.Drawable; -import android.net.Uri; -import android.os.Binder; -import android.os.Build; -import android.os.Bundle; -import android.os.Handler; -import android.os.IBinder; -import android.provider.Settings; -import android.support.annotation.RequiresApi; -import android.support.constraint.ConstraintLayout; -import android.support.design.widget.Snackbar; -import android.support.v4.app.NotificationCompat; -import android.support.v7.widget.RecyclerView; -import android.text.TextUtils; -import android.util.Pair; -import android.util.Rational; -import android.view.LayoutInflater; -import android.view.SurfaceView; -import android.view.View; -import android.view.ViewGroup; -import android.widget.Button; -import android.widget.EditText; -import android.widget.GridLayout; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.RadioButton; -import android.widget.Switch; -import android.widget.TextView; -import android.widget.Toast; - -import com.ciscowebex.androidsdk.WebexError; -import com.ciscowebex.androidsdk.kitchensink.R; -import com.ciscowebex.androidsdk.kitchensink.actions.WebexAgent; -import com.ciscowebex.androidsdk.kitchensink.actions.commands.AddCallHistoryAction; -import com.ciscowebex.androidsdk.kitchensink.actions.commands.RequirePermissionAction; -import com.ciscowebex.androidsdk.kitchensink.actions.commands.ToggleSpeakerAction; -import com.ciscowebex.androidsdk.kitchensink.actions.events.AnswerEvent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.DialEvent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.HangupEvent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.OnAuxStreamEvent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.OnCallMembershipEvent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.OnConnectEvent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.OnDisconnectEvent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.OnMediaChangeEvent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.OnRingingEvent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.OnWaitingEvent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.PermissionAcquiredEvent; -import com.ciscowebex.androidsdk.kitchensink.launcher.LauncherActivity; -import com.ciscowebex.androidsdk.kitchensink.service.AwakeService; -import com.ciscowebex.androidsdk.kitchensink.service.FloatWindowService; -import com.ciscowebex.androidsdk.kitchensink.ui.BaseFragment; -import com.ciscowebex.androidsdk.kitchensink.ui.FullScreenSwitcher; -import com.ciscowebex.androidsdk.kitchensink.ui.ParticipantsAdapter; -import com.ciscowebex.androidsdk.people.Person; -import com.ciscowebex.androidsdk.phone.AuxStream; -import com.ciscowebex.androidsdk.phone.CallMembership; -import com.ciscowebex.androidsdk.phone.CallObserver; -import com.ciscowebex.androidsdk.phone.MediaRenderView; -import com.ciscowebex.androidsdk.phone.MultiStreamObserver; -import com.ciscowebex.androidsdk.phone.internal.CallImpl; -import com.github.benoitdion.ln.Ln; -import com.squareup.picasso.Picasso; - -import org.greenrobot.eventbus.Subscribe; -import org.greenrobot.eventbus.ThreadMode; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.List; - -import butterknife.BindView; -import butterknife.OnCheckedChanged; -import butterknife.OnClick; - -import static com.ciscowebex.androidsdk.kitchensink.actions.events.WebexAgentEvent.postEvent; -import static com.ciscowebex.androidsdk.phone.CallObserver.RemoteSendingSharingEvent; -import static com.ciscowebex.androidsdk.phone.CallObserver.SendingSharingEvent; - -/** - * A simple {@link BaseFragment} subclass. - */ -public class CallFragment extends BaseFragment { - protected static final int MEDIA_PROJECTION_REQUEST = 2; - private static final String CALLEE = "callee"; - private static final String INCOMING_CALL = "incoming"; - private WebexAgent agent; - private FullScreenSwitcher screenSwitcher; - private boolean isConnected = false; - private HashMap mAuxStreamViewMap = new HashMap<>(); - private HashMap mIdPersonMap = new HashMap<>(); - private boolean isFloatingBind = false; - - @BindView(R.id.localView) - View localView; - - @BindView(R.id.remoteView) - View remoteView; - - @BindView(R.id.viewRemoteAvatar) - ImageView remoteAvatar; - - @BindView(R.id.screenShare) - View screenShare; - - @BindView(R.id.view_call_control) - View viewCallControl; - - @BindView(R.id.view_aux_videos_container) - View viewAuxVideosContainer; - - @BindView(R.id.view_aux_videos) - GridLayout viewAuxVideos; - - @BindView(R.id.view_participants) - RecyclerView viewParticipants; - - @BindView(R.id.buttonHangup) - Button buttonHangup; - - @BindView(R.id.buttonDTMF) - Button buttonDTMF; - - @BindView(R.id.switchLoudSpeaker) - Switch switchLoudSpeaker; - - @BindView(R.id.switchSendVideo) - Switch switchSendingVideo; - - @BindView(R.id.switchSendAudio) - Switch switchSendingAudio; - - @BindView(R.id.switchReceiveVideo) - Switch switchReceiveVideo; - - @BindView(R.id.switchReceiveAudio) - Switch switchReceiveAudio; - - @BindView(R.id.radioFrontCam) - RadioButton radioFrontCam; - - @BindView(R.id.radioBackCam) - RadioButton radioBackCam; - - @BindView(R.id.call_layout) - ConstraintLayout layout; - - @BindView(R.id.switchShareContent) - Switch switchShareContent; - - @BindView(R.id.keypad) - View keypad; - - @BindView(R.id.floatButton) - ImageView floatButton; - - @BindView(R.id.tab_callcontrol) - TextView tabCallControl; - - @BindView(R.id.tab_aux_video) - TextView tabAuxVideo; - - @BindView(R.id.tab_participants) - TextView tabParticipants; - - private ParticipantsAdapter participantsAdapter; - private Snackbar snackbar; - - // Required empty public constructor - - class AuxStreamViewHolder { - View item; - MediaRenderView mediaRenderView; - ImageView viewAvatar; - TextView textView; - - AuxStreamViewHolder(View item) { - this.item = item; - this.mediaRenderView = item.findViewById(R.id.view_video); - this.viewAvatar = item.findViewById(R.id.view_avatar); - this.textView = item.findViewById(R.id.name); - } - } - - public CallFragment() { - } - - public static CallFragment newAnswerCallInstance() { - return CallFragment.newInstance(INCOMING_CALL); - } - - public static CallFragment newInstance(String id) { - CallFragment fragment = new CallFragment(); - Bundle args = new Bundle(); - args.putInt(LAYOUT, R.layout.fragment_call); - args.putString(CALLEE, id); - fragment.setArguments(args); - return fragment; - } - - @Override - public void onStart() { - super.onStart(); - Drawable drawableCallControl = getResources().getDrawable(R.drawable.ic_file_word, null); - Drawable drawableAuxVideo = getResources().getDrawable(R.drawable.ic_file_excel, null); - Drawable drawableParticipants = getResources().getDrawable(R.drawable.ic_file_zip, null); - Rect bounds = new Rect(0, 0, 120, 120); - drawableCallControl.setBounds(bounds); - drawableAuxVideo.setBounds(bounds); - drawableParticipants.setBounds(bounds); - tabCallControl.setCompoundDrawables(null, drawableCallControl, null, null); - tabAuxVideo.setCompoundDrawables(null, drawableAuxVideo, null, null); - tabParticipants.setCompoundDrawables(null, drawableParticipants, null, null); - - agent = WebexAgent.getInstance(); - screenSwitcher = new FullScreenSwitcher(getActivity(), layout, remoteView); - updateScreenShareView(); - if (participantsAdapter == null) { - participantsAdapter = new ParticipantsAdapter(null); - participantsAdapter.setOnLetInClickListener(new ParticipantsAdapter.OnLetInClickListener() { - @Override - public void onLetInClick(ParticipantsAdapter.CallMembershipEntity entity) { - for (CallMembership callMembership : agent.getActiveCall().getMemberships()) { - if (callMembership.getPersonId().equals(entity.getPersonId())) { - agent.getActiveCall().letIn(callMembership); - break; - } - } - - } - }); - viewParticipants.setAdapter(participantsAdapter); - } - if (!isConnected) { - setViewAndChildrenEnabled(layout, false); - ((SurfaceView) localView).setZOrderMediaOverlay(true); - ((SurfaceView) screenShare).setZOrderMediaOverlay(true); - requirePermission(); - } - } - - private static void setViewAndChildrenEnabled(View view, boolean enabled) { - view.setEnabled(enabled); - if (view instanceof ViewGroup) { - ViewGroup viewGroup = (ViewGroup) view; - for (int i = 0; i < viewGroup.getChildCount(); i++) { - View child = viewGroup.getChildAt(i); - setViewAndChildrenEnabled(child, enabled); - } - } - } - - private void setupWidgetStates() { - switch (agent.getDefaultCamera()) { - case FRONT: - radioFrontCam.setChecked(true); - break; - case BACK: - radioBackCam.setChecked(true); - break; - case CLOSE: - localView.setVisibility(View.GONE); - break; - } - switchLoudSpeaker.setChecked(agent.getSpeakerPhoneOn()); - switchSendingVideo.setChecked(agent.isSendingVideo()); - switchSendingAudio.setChecked(agent.isSendingAudio()); - switchReceiveVideo.setChecked(agent.isReceivingVideo()); - switchReceiveAudio.setChecked(agent.isReceivingAudio()); - - updateScreenShareView(); - } - - private void updateScreenShareView() { - screenShare.setVisibility(agent.isScreenSharing() ? View.VISIBLE : View.INVISIBLE); - } - - private void requirePermission() { - new RequirePermissionAction(getActivity()).execute(); - } - - @SuppressWarnings("unused") - @Subscribe(threadMode = ThreadMode.MAIN) - public void onEventMainThread(PermissionAcquiredEvent event) { - makeCall(); - } - - @Override - public void onStop() { - super.onStop(); - } - - private void setButtonsEnable(boolean enable) { - buttonHangup.setEnabled(enable); - buttonDTMF.setEnabled(false); - } - - @OnClick(R.id.buttonHangup) - public void onHangup() { - agent.hangup(); - ((LauncherActivity) getActivity()).goBackStack(); - } - - @OnClick(R.id.buttonDTMF) - public void onDTMF() { - if (isConnected) - keypad.setVisibility(keypad.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE); - } - - @OnClick({R.id.digit_0, R.id.digit_1, R.id.digit_2, - R.id.digit_3, R.id.digit_4, R.id.digit_5, - R.id.digit_6, R.id.digit_7, R.id.digit_8, - R.id.digit_9, R.id.digit_hash, - R.id.digit_asterisk}) - public void sendDTMF(View view) { - if (isConnected) { - String keyPressed = (String) view.getTag(); - agent.getActiveCall().sendDTMF(keyPressed, result -> { - }); - } - } - - @OnClick(R.id.remoteView) - public void onRemoteViewClicked() { - if (remoteAvatar.getVisibility() == View.VISIBLE) return; - screenSwitcher.toggleFullScreen(); - updateFullScreenLayout(); - } - - private void updateFullScreenLayout() { - updateScreenShareView(); - ((SurfaceView) remoteView).setZOrderMediaOverlay(screenSwitcher.isFullScreen()); - localView.setVisibility(screenSwitcher.isFullScreen() ? View.GONE : View.VISIBLE); - } - - @OnCheckedChanged({R.id.switchSendVideo, R.id.switchSendAudio, - R.id.switchReceiveVideo, R.id.switchReceiveAudio, R.id.switchShareContent}) - public void onSwitchCallAbility(Switch s) { - switch (s.getId()) { - case R.id.switchSendVideo: - if (radioBackCam.isChecked()) - agent.setBackCamera(); - else { - radioFrontCam.setChecked(true); - agent.setFrontCamera(); - } - agent.sendVideo(s.isChecked()); - break; - case R.id.switchSendAudio: - agent.sendAudio(s.isChecked()); - break; - case R.id.switchReceiveVideo: - agent.receiveVideo(s.isChecked()); - break; - case R.id.switchReceiveAudio: - agent.receiveAudio(s.isChecked()); - break; - case R.id.switchShareContent: - if (s.isChecked()) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - NotificationChannel mChannel = new NotificationChannel("screen_share_notification_channel", "screen_share_notification_channel", NotificationManager.IMPORTANCE_HIGH); - NotificationManager notifyManager = (NotificationManager) getContext().getSystemService(Context.NOTIFICATION_SERVICE); - notifyManager.createNotificationChannel(mChannel); - } - Notification notification = new NotificationCompat.Builder(getActivity(), "screen_share_notification_channel") - .setSmallIcon(R.mipmap.ic_launcher) - .setContentTitle("Cisco Kitchensink") - .setContentText("Sharing screen to others") - .setTicker("Screen Sharing") - .setPriority(NotificationCompat.PRIORITY_DEFAULT) - .setDefaults(Notification.DEFAULT_SOUND) - .build(); - - agent.getActiveCall().startSharing(notification, 0xabcde, r -> { - Ln.d("startSharing result: " + r); - if (!r.isSuccessful()) { - switchShareContent.setChecked(false); - } - }); - } else - agent.getActiveCall().stopSharing(r -> { - Ln.d("stopSharing result: " + r); - }); - break; - - } - } - - @OnCheckedChanged(R.id.switchLoudSpeaker) - public void onSwitchLoudSpeakerChanged(Switch s) { - new ToggleSpeakerAction(getActivity(), (CallImpl) agent.getActiveCall(), s.isChecked()).execute(); - } - - @OnClick(R.id.radioBackCam) - public void onBackCamRadioClicked() { - agent.setBackCamera(); - } - - @OnClick(R.id.radioFrontCam) - public void onFrontCamRadioClicked() { - agent.setFrontCamera(); - } - - @OnClick({R.id.tab_callcontrol, R.id.tab_aux_video, R.id.tab_participants}) - public void onTabClick(View view) { - switch (view.getId()) { - case R.id.tab_callcontrol: - viewCallControl.setVisibility(View.VISIBLE); - viewAuxVideosContainer.setVisibility(View.GONE); - viewParticipants.setVisibility(View.GONE); - break; - case R.id.tab_aux_video: - viewCallControl.setVisibility(View.GONE); - viewAuxVideosContainer.setVisibility(View.VISIBLE); - viewParticipants.setVisibility(View.GONE); - break; - case R.id.tab_participants: - viewCallControl.setVisibility(View.GONE); - viewAuxVideosContainer.setVisibility(View.GONE); - viewParticipants.setVisibility(View.VISIBLE); - break; - default: - break; - } - } - - @OnClick(R.id.floatButton) - void showFloatingWindow() { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O - && getActivity().getPackageManager().hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE)) { - enterPicInPic(); - } else if (checkFloatPermission(getActivity())) { - startFloating(); - } else - requestSettingCanDrawOverlays(); - } - - @RequiresApi(api = Build.VERSION_CODES.O) - private void enterPicInPic() { - PictureInPictureParams.Builder builder = new PictureInPictureParams.Builder(); - Rational aspectRatio = new Rational(remoteView.getWidth(), remoteView.getHeight()); - builder.setAspectRatio(aspectRatio); - getActivity().enterPictureInPictureMode(builder.build()); - } - - @Override - public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode, Configuration newConfig) { - super.onPictureInPictureModeChanged(isInPictureInPictureMode, newConfig); - floatButton.setVisibility(isInPictureInPictureMode ? View.GONE : View.VISIBLE); - localView.setVisibility(isInPictureInPictureMode ? View.GONE : View.VISIBLE); - } - - private ServiceConnection floatingConnection = new ServiceConnection() { - @Override - public void onServiceConnected(ComponentName name, IBinder binder) { - FloatWindowService.MyBinder myBinder = (FloatWindowService.MyBinder) binder; - FloatWindowService service = myBinder.getService(); - service.setAgent(agent); - } - - @Override - public void onServiceDisconnected(ComponentName name) { - - } - }; - - private void startFloating() { - if (!isFloatingBind) { - Intent intent = new Intent(getActivity(), FloatWindowService.class); - isFloatingBind = getActivity().getApplicationContext().bindService(intent, floatingConnection, Context.BIND_AUTO_CREATE); - getActivity().moveTaskToBack(true); - } - } - - private void stopFloating() { - if (isFloatingBind) { - getActivity().getApplicationContext().unbindService(floatingConnection); - isFloatingBind = false; - new Handler().postDelayed(() -> agent.setVideoRenderViews(new Pair<>(localView, remoteView)), 500); - } - } - - @Override - public void onResume() { - super.onResume(); - stopFloating(); - } - - @Override - public void onConfigurationChanged(Configuration newConfig) { - super.onConfigurationChanged(newConfig); - screenSwitcher.updateOnRotation(); - updateScreenShareView(); - } - - @Override - public void onBackPressed() { - if (isConnected) - agent.hangup(); - } - - private void makeCall() { - String callee = getCallee(); - if (callee.isEmpty()) - return; - - if (callee.equals(INCOMING_CALL)) { - setButtonsEnable(false); - agent.answer(localView, remoteView, screenShare, false, null); - return; - } - agent.startPreview(localView); - agent.dial(callee, localView, remoteView, screenShare, false, null); - new AddCallHistoryAction(callee, "out").execute(); - setButtonsEnable(true); - } - - private String getCallee() { - Bundle bundle = getArguments(); - return bundle != null ? bundle.getString(CALLEE) : ""; - } - - private void feedback() { - BaseFragment fm = new CallFeedbackFragment(); - ((LauncherActivity) getActivity()).replace(fm); - } - - @SuppressWarnings("unused") - @Subscribe(threadMode = ThreadMode.MAIN) - public void onEventMainThread(DialEvent event) { - if (!event.isSuccessful()) { - if (event.getError() != null && event.getError().getErrorCode() == WebexError.ErrorCode.HOST_PIN_OR_MEETING_PASSWORD_REQUIRED.getCode()) { - showPasswordDialog(); - } else if (event.getError() != null && event.getError().getErrorCode() == WebexError.ErrorCode.VIEW_H264_LICENSE.getCode()) { - Toast.makeText(getActivity(), "View license, stop dial", Toast.LENGTH_SHORT).show(); - feedback(); - } else { - Toast.makeText(getActivity(), "Dial failed!", Toast.LENGTH_SHORT).show(); - feedback(); - } - } - } - - private void showPasswordDialog() { - EditText etKey = new EditText(getActivity()); - etKey.setHint("Host Key"); - EditText etPassword = new EditText(getActivity()); - etPassword.setHint("Meeting Password"); - LinearLayout layout = new LinearLayout(getActivity()); - layout.setOrientation(LinearLayout.VERTICAL); - layout.addView(etKey); - layout.addView(etPassword); - new AlertDialog.Builder(getActivity()) - .setTitle("Are you the host?") - .setMessage("If you are the host, please enter host key. Otherwise, enter the meeting password.") - .setView(layout) - .setPositiveButton("Confirm", (dialog, which) -> { - String key = etKey.getText().toString(); - String password = etPassword.getText().toString(); - if (TextUtils.isEmpty(key) && TextUtils.isEmpty(password)) { - Toast.makeText(getActivity(), "Please enter key or password.", Toast.LENGTH_SHORT).show(); - return; - } - if (!TextUtils.isEmpty(key) && !TextUtils.isEmpty(password)) { - Toast.makeText(getActivity(), "Please only enter key or password", Toast.LENGTH_SHORT).show(); - return; - } - boolean isModerator; - String PIN; - if (!TextUtils.isEmpty(key)) { - isModerator = true; - PIN = key; - } else { - isModerator = false; - PIN = password; - } - String callee = getCallee(); - if (callee.isEmpty()) - return; - if (callee.equals(INCOMING_CALL)) { - setButtonsEnable(false); - agent.answer(localView, remoteView, screenShare, isModerator, PIN); - return; - } - agent.dial(callee, localView, remoteView, screenShare, isModerator, PIN); - }) - .setNegativeButton("Cancel", (dialog, which) -> { - Toast.makeText(getActivity(), "Dial failed!", Toast.LENGTH_SHORT).show(); - feedback(); - }) - .show(); - } - - @SuppressWarnings("unused") - @Subscribe(threadMode = ThreadMode.MAIN) - public void onEventMainThread(AnswerEvent event) { - } - - @SuppressWarnings("unused") - @Subscribe(threadMode = ThreadMode.MAIN) - public void onEventMainThread(HangupEvent event) { - setButtonsEnable(false); - } - - @SuppressWarnings("unused") - @Subscribe(threadMode = ThreadMode.MAIN) - public void onEventMainThread(OnRingingEvent event) { - } - - @SuppressWarnings("unused") - @Subscribe(threadMode = ThreadMode.MAIN) - public void onEventMainThread(OnWaitingEvent event) { - String text = "Waiting in lobby:" + event.waitReason.name(); - if (snackbar != null) { - snackbar.setText(text); - } else - snackbar = Snackbar.make(layout, text, Snackbar.LENGTH_INDEFINITE); - snackbar.show(); - } - - @SuppressWarnings("unused") - @Subscribe(threadMode = ThreadMode.MAIN) - public void onEventMainThread(OnConnectEvent event) { - isConnected = true; - startAwakeService(); - floatButton.setVisibility(View.VISIBLE); - setViewAndChildrenEnabled(layout, true); - if (agent.getDefaultCamera().equals(WebexAgent.CameraCap.CLOSE)) - agent.sendVideo(false); - setupWidgetStates(); - updateParticipants(); - event.call.setMultiStreamObserver(new MultiStreamObserver() { - @Override - public void onAuxStreamChanged(AuxStreamChangedEvent event) { - postEvent(new OnAuxStreamEvent(event)); - } - - @Override - public View onAuxStreamAvailable() { - Ln.d("onAuxStreamAvailable"); - View auxStreamView = LayoutInflater.from(getActivity()).inflate(R.layout.remote_video_view, null); - AuxStreamViewHolder auxStreamViewHolder = new AuxStreamViewHolder(auxStreamView); - mAuxStreamViewMap.put(auxStreamViewHolder.mediaRenderView, auxStreamViewHolder); - return auxStreamViewHolder.mediaRenderView; - } - - @Override - public View onAuxStreamUnavailable() { - Ln.d("onAuxStreamUnavailable"); - return null; - } - }); - if (snackbar != null) - snackbar.dismiss(); - } - - private void updateParticipants() { - if (agent == null || agent.getActiveCall() == null) return; - List callMemberships = agent.getActiveCall().getMemberships(); - if (callMemberships == null) return; - Ln.d("updateParticipants: " + callMemberships.size()); - for (CallMembership membership : callMemberships) { - String personId = membership.getPersonId(); - if (/*membership.getState() != CallMembership.State.JOINED || */personId == null || personId.isEmpty() || membership.getDisplayName() == null || membership.getDisplayName().isEmpty()) - continue; - participantsAdapter.addOrUpdateItem(new ParticipantsAdapter.CallMembershipEntity(personId, membership.getDisplayName(), "", membership.isSendingAudio(), membership.isSendingVideo(), membership.getState())); - agent.getWebex().people().get(personId, r -> { - if (r == null || !r.isSuccessful() || r.getData() == null) return; - mIdPersonMap.put(personId, r.getData()); - updatePersonInfoForParticipants(personId, r.getData()); - }); - } - } - - private void updatePersonInfoForParticipants(String personId, Person person) { - participantsAdapter.updateName(personId, person.getDisplayName()); - participantsAdapter.updateAvatar(personId, person.getAvatar()); - } - - private void updatePersonInfoForActiveSpeaker(String personId, Person person) { - if (participantsAdapter.getActiveSpeaker() == null || person == null || !participantsAdapter.getActiveSpeaker().equals(personId)) - return; - String avatar = person.getAvatar(); - if (avatar == null || avatar.isEmpty()) { - remoteAvatar.setImageResource(R.drawable.google_contacts_android); - } else { - Picasso.with(getActivity()).cancelRequest(remoteAvatar); - Picasso.with(getActivity()).load(avatar).fit().into(remoteAvatar); - } - } - - private void updatePersonInfoForAuxStream(String personId, Person person, AuxStreamViewHolder auxStreamViewHolder) { - if (personId == null || personId.isEmpty() || person == null || auxStreamViewHolder == null) - return; - auxStreamViewHolder.textView.setText(person.getDisplayName()); - String avatar = person.getAvatar(); - if (avatar == null || avatar.isEmpty()) { - auxStreamViewHolder.viewAvatar.setImageResource(R.drawable.google_contacts_android); - } else { - Picasso.with(getActivity()).cancelRequest(auxStreamViewHolder.viewAvatar); - Picasso.with(getActivity()).load(avatar).fit().into(auxStreamViewHolder.viewAvatar); - } - } - - @SuppressWarnings("unused") - @Subscribe(threadMode = ThreadMode.MAIN) - public void onEventMainThread(OnDisconnectEvent event) { - isConnected = false; - if (isFloatingBind) - return; - keypad.setVisibility(View.GONE); - stopAwakeService(); - floatButton.setVisibility(View.GONE); - if (agent.getActiveCall() == null || event.getCall().equals(agent.getActiveCall())) { - mAuxStreamViewMap.clear(); - mIdPersonMap.clear(); - feedback(); - } - if (snackbar != null) - snackbar.dismiss(); - } - - @SuppressWarnings("unused") - @Subscribe(threadMode = ThreadMode.MAIN, sticky = true) - public void onEventMainThread(OnMediaChangeEvent event) { - if (event.callEvent instanceof CallObserver.RemoteSendingVideoEvent) { - Ln.d("RemoteSendingVideoEvent: " + ((CallObserver.RemoteSendingVideoEvent) event.callEvent).isSending()); - } else if (event.callEvent instanceof RemoteSendingSharingEvent) { - Ln.d("RemoteSendingSharingEvent: " + ((RemoteSendingSharingEvent) event.callEvent).isSending()); - if (((RemoteSendingSharingEvent) event.callEvent).isSending()) { - event.callEvent.getCall().setVideoRenderViews(new Pair<>(localView, screenShare)); - event.callEvent.getCall().setSharingRenderView(remoteView); - } else { - event.callEvent.getCall().setSharingRenderView(null); - event.callEvent.getCall().setVideoRenderViews(new Pair<>(localView, remoteView)); - } - updateScreenShareView(); - } else if (event.callEvent instanceof SendingSharingEvent) { - Ln.d("SendingSharingEvent: " + ((SendingSharingEvent) event.callEvent).isSending()); - if (((SendingSharingEvent) event.callEvent).isSending()) { -// sendNotification(); - backToHome(); - } - } else if (event.callEvent instanceof CallObserver.ActiveSpeakerChangedEvent) { - CallMembership membership = ((CallObserver.ActiveSpeakerChangedEvent) event.callEvent).to(); - Ln.d("ActiveSpeakerChangedEvent: " + membership); - if (membership != null && membership.getPersonId() != null && !membership.getPersonId().isEmpty()) { - String personId = membership.getPersonId(); - participantsAdapter.updateActiveSpeaker(personId); - if (membership.isSendingVideo()) { - remoteAvatar.setVisibility(View.GONE); - } else { - remoteAvatar.setVisibility(View.VISIBLE); - Person person = mIdPersonMap.get(personId); - if (person == null) { - remoteAvatar.setImageResource(R.drawable.google_contacts_android); - agent.getWebex().people().get(personId, r -> { - if (!r.isSuccessful() || r.getData() == null) return; - mIdPersonMap.put(personId, r.getData()); - updatePersonInfoForActiveSpeaker(personId, r.getData()); - }); - } else { - String avatar = person.getAvatar(); - if (avatar == null || avatar.isEmpty()) { - remoteAvatar.setImageResource(R.drawable.google_contacts_android); - } else { - Picasso.with(getActivity()).cancelRequest(remoteAvatar); - Picasso.with(getActivity()).load(avatar).fit().into(remoteAvatar); - } - } - } - } else { - remoteAvatar.setVisibility(View.VISIBLE); - remoteAvatar.setImageResource(android.R.color.darker_gray); - } - } - } - - - @SuppressWarnings("unused") - @Subscribe(threadMode = ThreadMode.MAIN) - public void onEventMainThread(OnAuxStreamEvent event) { - Ln.d("OnAuxStreamEvent: " + event.callEvent.getAuxStream()); - AuxStream auxStream = event.callEvent.getAuxStream(); - if (event.callEvent instanceof MultiStreamObserver.AuxStreamOpenedEvent) { - MultiStreamObserver.AuxStreamOpenedEvent openEvent = (MultiStreamObserver.AuxStreamOpenedEvent) event.callEvent; - if (openEvent.isSuccessful()) { - Ln.d("AuxStreamOpenedEvent successful"); - viewAuxVideos.addView(mAuxStreamViewMap.get(openEvent.getRenderView()).item); - } else { - Ln.d("AuxStreamOpenedEvent failed: " + openEvent.getError()); - mAuxStreamViewMap.remove(openEvent.getRenderView()); - } - } else if (event.callEvent instanceof MultiStreamObserver.AuxStreamClosedEvent) { - MultiStreamObserver.AuxStreamClosedEvent closeEvent = (MultiStreamObserver.AuxStreamClosedEvent) event.callEvent; - if (closeEvent.isSuccessful()) { - Ln.d("AuxStreamClosedEvent successful"); - AuxStreamViewHolder auxStreamViewHolder = mAuxStreamViewMap.get(closeEvent.getRenderView()); - mAuxStreamViewMap.remove(closeEvent.getRenderView()); - viewAuxVideos.removeView(auxStreamViewHolder.item); - } else { - Ln.d("AuxStreamClosedEvent failed: " + closeEvent.getError()); - } - } else if (event.callEvent instanceof MultiStreamObserver.AuxStreamSendingVideoEvent) { - Ln.d("AuxStreamSendingVideoEvent: " + auxStream.isSendingVideo()); - AuxStreamViewHolder auxStreamViewHolder = mAuxStreamViewMap.get(auxStream.getRenderView()); - if (auxStreamViewHolder == null) return; - if (auxStream.isSendingVideo()) { - auxStreamViewHolder.viewAvatar.setVisibility(View.GONE); - } else { - CallMembership membership = auxStream.getPerson(); - if (membership == null || membership.getPersonId() == null || membership.getPersonId().isEmpty()) - return; - String personId = membership.getPersonId(); - auxStreamViewHolder.viewAvatar.setVisibility(View.VISIBLE); - Person person = mIdPersonMap.get(personId); - if (person == null) { - auxStreamViewHolder.viewAvatar.setImageResource(R.drawable.google_contacts_android); - agent.getWebex().people().get(personId, r -> { - if (!r.isSuccessful() || r.getData() == null) return; - mIdPersonMap.put(personId, r.getData()); - updatePersonInfoForAuxStream(personId, r.getData(), auxStreamViewHolder); - }); - } else { - String avatar = person.getAvatar(); - if (avatar == null || avatar.isEmpty()) { - auxStreamViewHolder.viewAvatar.setImageResource(R.drawable.google_contacts_android); - } else { - Picasso.with(getActivity()).cancelRequest(auxStreamViewHolder.viewAvatar); - Picasso.with(getActivity()).load(avatar).fit().into(auxStreamViewHolder.viewAvatar); - } - } - } - } else if (event.callEvent instanceof MultiStreamObserver.AuxStreamPersonChangedEvent) { - Ln.d("AuxStreamPersonChangedEvent: " + auxStream.getPerson()); - AuxStreamViewHolder auxStreamViewHolder = mAuxStreamViewMap.get(auxStream.getRenderView()); - if (auxStream.getPerson() == null) { - mAuxStreamViewMap.remove(auxStream.getRenderView()); - viewAuxVideos.removeView(auxStreamViewHolder.item); - } else { - CallMembership membership = auxStream.getPerson(); - if (membership == null || membership.getPersonId() == null || membership.getPersonId().isEmpty()) - return; - String personId = membership.getPersonId(); - participantsAdapter.updateSendingAudioStatus(personId, membership.isSendingAudio()); - participantsAdapter.updateSendingVideoStatus(personId, membership.isSendingVideo()); - Person person = mIdPersonMap.get(personId); - auxStreamViewHolder.viewAvatar.setVisibility(membership.isSendingVideo() ? View.GONE : View.VISIBLE); - if (person == null) { - auxStreamViewHolder.textView.setText(membership.getDisplayName()); - auxStreamViewHolder.viewAvatar.setImageResource(R.drawable.google_contacts_android); - agent.getWebex().people().get(personId, r -> { - if (!r.isSuccessful() || r.getData() == null) return; - mIdPersonMap.put(personId, r.getData()); - updatePersonInfoForAuxStream(personId, r.getData(), auxStreamViewHolder); - }); - } else { - auxStreamViewHolder.textView.setText(person.getDisplayName()); - String avatar = person.getAvatar(); - if (avatar == null || avatar.isEmpty()) { - auxStreamViewHolder.viewAvatar.setImageResource(R.drawable.google_contacts_android); - } else { - Picasso.with(getActivity()).cancelRequest(auxStreamViewHolder.viewAvatar); - Picasso.with(getActivity()).load(avatar).fit().into(auxStreamViewHolder.viewAvatar); - } - } - } - } - } - - @SuppressWarnings("unused") - @Subscribe(threadMode = ThreadMode.MAIN) - public void onEventMainThread(OnCallMembershipEvent event) { - CallMembership membership = event.callEvent.getCallMembership(); - Ln.d("OnCallMembershipEvent: " + membership); - if (membership == null || membership.getPersonId() == null || membership.getPersonId().isEmpty()) - return; - String personId = membership.getPersonId(); - if (event.callEvent instanceof CallObserver.MembershipJoinedEvent) { - Ln.d("MembershipJoinedEvent: "); - if (membership.getState() != CallMembership.State.JOINED || personId == null || personId.isEmpty() || membership.getDisplayName() == null || membership.getDisplayName().isEmpty()) - return; - participantsAdapter.addOrUpdateItem(new ParticipantsAdapter.CallMembershipEntity(personId, membership.getDisplayName(), "", membership.isSendingAudio(), membership.isSendingVideo(), membership.getState())); - agent.getWebex().people().get(personId, r -> { - if (r == null || !r.isSuccessful() || r.getData() == null) return; - updatePersonInfoForParticipants(personId, r.getData()); - }); - } else if (event.callEvent instanceof CallObserver.MembershipLeftEvent) { - Ln.d("MembershipLeftEvent: "); - participantsAdapter.removeItem(personId); - } else if (event.callEvent instanceof CallObserver.MembershipSendingAudioEvent) { - Ln.d("MembershipSendingAudioEvent: " + membership.isSendingAudio()); - participantsAdapter.updateSendingAudioStatus(personId, membership.isSendingAudio()); - } else if (event.callEvent instanceof CallObserver.MembershipSendingVideoEvent) { - Ln.d("MembershipSendingVideoEvent: " + membership.isSendingVideo()); - participantsAdapter.updateSendingVideoStatus(personId, membership.isSendingVideo()); - if (participantsAdapter.getActiveSpeaker() != null && participantsAdapter.getActiveSpeaker().equals(personId)) { - if (membership.isSendingVideo()) { - remoteAvatar.setVisibility(View.GONE); - } else { - remoteAvatar.setVisibility(View.VISIBLE); - Person person = mIdPersonMap.get(personId); - if (person == null) { - remoteAvatar.setImageResource(R.drawable.google_contacts_android); - agent.getWebex().people().get(personId, r -> { - if (!r.isSuccessful() || r.getData() == null) return; - mIdPersonMap.put(personId, r.getData()); - updatePersonInfoForActiveSpeaker(personId, r.getData()); - }); - } else { - String avatar = person.getAvatar(); - if (avatar == null || avatar.isEmpty()) { - remoteAvatar.setImageResource(R.drawable.google_contacts_android); - } else { - Picasso.with(getActivity()).cancelRequest(remoteAvatar); - Picasso.with(getActivity()).load(avatar).fit().into(remoteAvatar); - } - } - } - } - } else if (event.callEvent instanceof CallObserver.MembershipWaitingEvent) { - Ln.d("MembershipJoinedLobbyEvent: "); - if (membership.getState() != CallMembership.State.WAITING || personId == null || personId.isEmpty() || membership.getDisplayName() == null || membership.getDisplayName().isEmpty()) - return; - participantsAdapter.addOrUpdateItem(new ParticipantsAdapter.CallMembershipEntity(personId, membership.getDisplayName(), "", membership.isSendingAudio(), membership.isSendingVideo(), membership.getState())); - agent.getWebex().people().get(personId, r -> { - if (r == null || !r.isSuccessful() || r.getData() == null) return; - Ln.d("people: " + r.getData()); - updatePersonInfoForParticipants(personId, r.getData()); - }); - } else if (event.callEvent instanceof CallObserver.MembershipAudioMutedControlledEvent) { - Ln.d("MembershipAudioMutedControlledEvent: "); - Ln.d(membership.getPersonId() + (membership.isAudioMutedControlled() ? " muted by " : " unmuted by ") + membership.audioModifiedBy()); - if (membership.audioModifiedBy() != null) { - String text = membership.getDisplayName() + (membership.isAudioMutedControlled() ? " muted" : " unmuted") + " by others"; - toast(text); - } - } - } - - private void backToHome() { - Intent intent = new Intent(Intent.ACTION_MAIN); - intent.addCategory(Intent.CATEGORY_HOME); - this.startActivity(intent); - } - - private void sendNotification() { - Intent appIntent = new Intent(getActivity(), LauncherActivity.class); - appIntent.setAction(Intent.ACTION_MAIN); - appIntent.addCategory(Intent.CATEGORY_LAUNCHER); - appIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); - PendingIntent contentIntent = PendingIntent.getActivity(getActivity(), 0, appIntent, PendingIntent.FLAG_UPDATE_CURRENT); - - NotificationManager notifyManager = (NotificationManager) getActivity().getSystemService(Context.NOTIFICATION_SERVICE); - NotificationCompat.Builder builder = new NotificationCompat.Builder(getActivity()) - .setSmallIcon(R.mipmap.ic_launcher) - .setContentTitle("Cisco Kichensink") - .setContentText("I'm sharing content") - .setContentIntent(contentIntent); - notifyManager.notify(1, builder.build()); - } - - private void startAwakeService() { - getActivity().startService(new Intent(getActivity(), AwakeService.class)); - } - - private void stopAwakeService() { - getActivity().stopService(new Intent(getActivity(), AwakeService.class)); - } - - @Override - public void onDestroy() { - stopAwakeService(); - stopFloating(); - super.onDestroy(); - } - - public static boolean checkFloatPermission(Context context) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { - try { - Class cls = Class.forName("android.content.Context"); - Field declaredField = cls.getDeclaredField("APP_OPS_SERVICE"); - declaredField.setAccessible(true); - Object obj = declaredField.get(cls); - if (!(obj instanceof String)) { - return false; - } - String str2 = (String) obj; - obj = cls.getMethod("getSystemService", String.class).invoke(context, str2); - cls = Class.forName("android.app.AppOpsManager"); - Field declaredField2 = cls.getDeclaredField("MODE_ALLOWED"); - declaredField2.setAccessible(true); - Method checkOp = cls.getMethod("checkOp", Integer.TYPE, Integer.TYPE, String.class); - int result = (Integer) checkOp.invoke(obj, 24, Binder.getCallingUid(), context.getPackageName()); - return result == declaredField2.getInt(cls); - } catch (Exception e) { - return false; - } - } else { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - AppOpsManager appOpsMgr = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE); - if (appOpsMgr == null) - return false; - int mode = appOpsMgr.checkOpNoThrow("android:system_alert_window", android.os.Process.myUid(), context - .getPackageName()); - return Settings.canDrawOverlays(context) || mode == AppOpsManager.MODE_ALLOWED || mode == AppOpsManager.MODE_IGNORED; - } else { - return Settings.canDrawOverlays(context); - } - } - } - - private void requestSettingCanDrawOverlays() { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION); - intent.setData(Uri.parse("package:" + getActivity().getPackageName())); - startActivityForResult(intent, 0x101); - } - } - - @Override - public void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - if (requestCode == 0x101) - if (checkFloatPermission(getActivity())) { - startFloating(); - } else - Toast.makeText(getActivity(), "No float window permission", Toast.LENGTH_SHORT).show(); - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/DialPagersFragment.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/DialPagersFragment.java deleted file mode 100644 index d137950..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/DialPagersFragment.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.launcher.fragments; - -import android.app.Fragment; -import android.os.Bundle; -import android.support.design.widget.TabLayout; -import android.support.v4.view.ViewPager; - -import com.ciscowebex.androidsdk.kitchensink.R; -import com.ciscowebex.androidsdk.kitchensink.launcher.fragments.pagers.DialFragment; -import com.ciscowebex.androidsdk.kitchensink.launcher.fragments.pagers.HistoryFragment; -import com.ciscowebex.androidsdk.kitchensink.launcher.fragments.pagers.PeopleFragment; -import com.ciscowebex.androidsdk.kitchensink.launcher.fragments.pagers.SpaceFragment; -import com.ciscowebex.androidsdk.kitchensink.ui.BaseFragment; -import com.ciscowebex.androidsdk.kitchensink.ui.ListPageAdapter; - -import butterknife.BindView; - -import static android.R.drawable.ic_menu_call; -import static android.R.drawable.ic_menu_myplaces; -import static android.R.drawable.ic_menu_recent_history; -import static android.R.drawable.ic_menu_search; - -public class DialPagersFragment extends BaseFragment { - - @BindView(R.id.dialViewPager) - ViewPager pager; - - @BindView(R.id.dialTabs) - TabLayout tabs; - - public DialPagersFragment() { - // Required empty public constructor - setLayout(R.layout.fragment_dial_pagers); - } - - @Override - public void onActivityCreated(Bundle saved) { - super.onActivityCreated(saved); - setupAdapter(); - tabs.setupWithViewPager(pager); - setupTabIcons(); - } - - public void gotoDialPage(String dialString) { - pager.setCurrentItem(2); - Fragment fm = ((ListPageAdapter) pager.getAdapter()).getItem(2); - ((DialFragment) fm).setDialString(dialString); - } - - private void setupAdapter() { - ListPageAdapter adapter; - adapter = new ListPageAdapter(getFragmentManager()); - adapter.add(new HistoryFragment()); - adapter.add(new PeopleFragment()); - adapter.add(new DialFragment()); - adapter.add(new SpaceFragment()); - pager.setAdapter(adapter); - } - - private void setupTabIcons() { - tabs.getTabAt(0).setIcon(ic_menu_recent_history); - tabs.getTabAt(1).setIcon(ic_menu_search); - tabs.getTabAt(2).setIcon(ic_menu_call); - tabs.getTabAt(3).setIcon(ic_menu_myplaces); - } -} \ No newline at end of file diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/FeedbackFragment.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/FeedbackFragment.java deleted file mode 100644 index 2ce7a3b..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/FeedbackFragment.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.launcher.fragments; - - -import android.content.Intent; -import android.net.Uri; -import android.view.MotionEvent; -import android.view.View; -import android.widget.EditText; -import android.widget.Spinner; -import android.widget.TextView; - -import com.ciscowebex.androidsdk.kitchensink.R; -import com.ciscowebex.androidsdk.kitchensink.ui.BaseFragment; - -import butterknife.BindView; -import butterknife.OnClick; -import butterknife.OnItemSelected; -import butterknife.OnTouch; - -/** - * A simple {@link BaseFragment} subclass. - */ -public class FeedbackFragment extends BaseFragment { - public static final int PICK_IMAGE = 1; - - @BindView(R.id.spinnerTopic) - Spinner topic; - - @BindView(R.id.imageName) - TextView imageUri; - - @BindView(R.id.comment) - EditText comment; - - Uri attachment; - - public FeedbackFragment() { - // Required empty public constructor - setLayout(R.layout.fragment_feedback); - } - - @OnItemSelected(R.id.spinnerTopic) - public void pickUpTopic(int position) { - } - - @OnTouch(R.id.pickImage) - public boolean pickUpImage(View v, MotionEvent event) { - if (event.getAction() == MotionEvent.ACTION_UP) { - Intent intent = new Intent(); - intent.setType("image/*"); - intent.setAction(Intent.ACTION_GET_CONTENT); - startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE); - } - return true; - } - - - @Override - public void onActivityResult(int requestCode, int resultCode, Intent data) { - if (requestCode == PICK_IMAGE) { - if (data == null) { - return; - } - attachment = data.getData(); - imageUri.setText(attachment.getLastPathSegment()); - } - } - - @OnClick(R.id.sendButton) - public void sendEmail() { - Intent intent = new Intent(Intent.ACTION_SENDTO); - intent.setData(Uri.parse("mailto:")); - intent.putExtra(Intent.EXTRA_EMAIL, new String[]{"devsupport@ciscospark.com"}); - intent.putExtra(Intent.EXTRA_SUBJECT, topic.getSelectedItem().toString()); - intent.putExtra(Intent.EXTRA_TEXT, comment.getText()); - if (attachment != null) - intent.putExtra(Intent.EXTRA_STREAM, attachment); - startActivity(Intent.createChooser(intent, "Pick an Email provider")); - } - -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/LauncherFragment.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/LauncherFragment.java deleted file mode 100644 index 6d2758c..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/LauncherFragment.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.launcher.fragments; - -import android.content.Intent; - -import com.ciscowebex.androidsdk.WebexError; -import com.ciscowebex.androidsdk.kitchensink.R; -import com.ciscowebex.androidsdk.kitchensink.actions.commands.LogoutAction; -import com.ciscowebex.androidsdk.kitchensink.actions.events.LogoutEvent; -import com.ciscowebex.androidsdk.kitchensink.launcher.LauncherActivity; -import com.ciscowebex.androidsdk.kitchensink.login.LoginActivity; -import com.ciscowebex.androidsdk.kitchensink.ui.BaseFragment; - -import org.greenrobot.eventbus.Subscribe; -import org.greenrobot.eventbus.ThreadMode; - -import butterknife.OnClick; - -import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP; - -/** - * A simple {@link BaseFragment} subclass. - */ -public class LauncherFragment extends BaseFragment { - - private BaseFragment setupFragment; - private BaseFragment dialFragment; - private BaseFragment waitingCallFragment; - private BaseFragment feedbackFragment; - - public LauncherFragment() { - // Required empty public constructor - setLayout(R.layout.fragment_launcher); - setupFragment = new SetupFragment(); - dialFragment = new DialPagersFragment(); - waitingCallFragment = new WaitingCallFragment(); - feedbackFragment = new FeedbackFragment(); - } - - @OnClick(R.id.buttonSetup) - public void setup() { - ((LauncherActivity) getActivity()).replace(setupFragment); - } - - @OnClick({R.id.buttonDial, R.id.buttonMessaging}) - public void dial() { - ((LauncherActivity) getActivity()).replace(dialFragment); - } - - @OnClick(R.id.buttonWaitingCall) - public void waitingCall() { - ((LauncherActivity) getActivity()).replace(waitingCallFragment); - } - - @OnClick(R.id.buttonFeedback) - public void sendFeedback() { - ((LauncherActivity) getActivity()).replace(feedbackFragment); - } - - @OnClick(R.id.buttonLogout) - public void logout() { - showBusyIndicator("Logout", "Wait for logout ..."); - new LogoutAction().execute(); - } - - @SuppressWarnings("unused") - @Subscribe(threadMode = ThreadMode.MAIN) - public void onMessageEvent(LogoutEvent event) { - dismissBusyIndicator(); - if (event.isSuccessful() || (event.getError()!= null && event.getError().getErrorCode() == WebexError.ErrorCode.NETWORK_ERROR.getCode())) { - toast("Logout success"); - Intent i = new Intent(getActivity(), LoginActivity.class); - i.setFlags(FLAG_ACTIVITY_CLEAR_TOP); - startActivity(i); - getActivity().finish(); - } else { - toast("Logout fail"); - } - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/MessageFragment.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/MessageFragment.java deleted file mode 100644 index 53070c2..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/MessageFragment.java +++ /dev/null @@ -1,865 +0,0 @@ -package com.ciscowebex.androidsdk.kitchensink.launcher.fragments; - -import android.app.Activity; -import android.app.AlertDialog; -import android.content.ContentUris; -import android.content.Context; -import android.content.Intent; -import android.database.Cursor; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.net.Uri; -import android.os.Build; -import android.os.Bundle; -import android.os.Environment; -import android.provider.DocumentsContract; -import android.provider.MediaStore; -import android.provider.OpenableColumns; -import android.support.annotation.NonNull; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; -import android.text.TextUtils; -import android.util.Pair; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.view.inputmethod.InputMethodManager; -import android.widget.Button; -import android.widget.EditText; -import android.widget.ImageButton; -import android.widget.ImageView; -import android.widget.ProgressBar; -import android.widget.TextView; - -import com.ciscowebex.androidsdk.kitchensink.R; -import com.ciscowebex.androidsdk.kitchensink.actions.WebexAgent; -import com.ciscowebex.androidsdk.kitchensink.actions.commands.RequirePermissionAction; -import com.ciscowebex.androidsdk.kitchensink.actions.events.PermissionAcquiredEvent; -import com.ciscowebex.androidsdk.kitchensink.ui.BaseFragment; -import com.ciscowebex.androidsdk.membership.Membership; -import com.ciscowebex.androidsdk.membership.MembershipClient; -import com.ciscowebex.androidsdk.message.LocalFile; -import com.ciscowebex.androidsdk.message.Mention; -import com.ciscowebex.androidsdk.message.Message; -import com.ciscowebex.androidsdk.message.MessageClient; -import com.ciscowebex.androidsdk.message.MessageObserver; -import com.ciscowebex.androidsdk.message.RemoteFile; -import com.ciscowebex.androidsdk.space.SpaceClient; -import com.ciscowebex.androidsdk.utils.MimeUtils; -import com.github.benoitdion.ln.Ln; - -import org.greenrobot.eventbus.Subscribe; -import org.greenrobot.eventbus.ThreadMode; -import org.json.JSONException; -import org.json.JSONObject; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; - -import butterknife.BindView; -import butterknife.ButterKnife; -import butterknife.OnClick; - -import static android.app.Activity.RESULT_OK; - - -public class MessageFragment extends BaseFragment { - private static final String TARGET_ID = "target_id"; - private static final int FILE_SELECT_REQUEST = 1; - - @BindView(R.id.message_text) - EditText textMessage; - - @BindView(R.id.message_view) - RecyclerView recyclerMessage; - - @BindView(R.id.message_mention) - ImageButton btnMention; - - @BindView(R.id.message_status) - TextView textStatus; - - @BindView(R.id.membership_recyclerview) - RecyclerView recyclerMembership; - - @BindView(R.id.send_button) - Button btnSend; - - MessageAdapter adapterMessage; - - MembershipAdapter adapterMembership; - - WebexAgent agent = WebexAgent.getInstance(); - - MessageClient messageClient = agent.getMessageClient(); - - MembershipClient membershipClient = agent.getMembershipClient(); - - SpaceClient spaceClient = agent.getSpaceClient(); - - ArrayList selectedFile; - - ArrayList mentionedMembershipList; - - String targetId; - - public static MessageFragment newInstance(String id) { - MessageFragment fragment = new MessageFragment(); - Bundle args = new Bundle(); - args.putInt(LAYOUT, R.layout.fragment_message); - args.putString(TARGET_ID, id); - fragment.setArguments(args); - return fragment; - } - - private String getTargetId() { - Bundle bundle = getArguments(); - return bundle != null ? bundle.getString(TARGET_ID) : null; - } - - public MessageFragment() { - // Required empty public constructor - selectedFile = new ArrayList<>(); - mentionedMembershipList = new ArrayList<>(); - } - - @Override - public void onActivityCreated(Bundle saved) { - super.onActivityCreated(saved); - recyclerMessage.setLayoutManager(new LinearLayoutManager(this.getActivity())); - adapterMessage = new MessageAdapter(this.getActivity()); - recyclerMessage.setAdapter(adapterMessage); - - messageClient.setMessageObserver(evt -> { - if (evt instanceof MessageObserver.MessageReceived) { - MessageObserver.MessageReceived event = (MessageObserver.MessageReceived) evt; - Ln.i("message: " + event.getMessage()); - Ln.i("isAllMentioned=" + event.getMessage().isAllMentioned()); - Ln.i("mentioned list :" + event.getMessage().getMentions()); - adapterMessage.mData.add(new Pair<>(event.getMessage(), false)); - adapterMessage.notifyDataSetChanged(); - textStatus.setText(""); - } else if (evt instanceof MessageObserver.MessageDeleted) { - MessageObserver.MessageDeleted event = (MessageObserver.MessageDeleted) evt; - Ln.i("message deleted " + event.getMessageId()); - } else if (evt instanceof MessageObserver.MessageEdited) { - MessageObserver.MessageEdited event = (MessageObserver.MessageEdited) evt; - String messageId = event.getMessageId(); - for (int i = 0; i < adapterMessage.mData.size(); i++) { - Message message = adapterMessage.mData.get(i).first; - if (message.getId().equals(messageId)) { - message.update(event); - adapterMessage.notifyItemChanged(i, ""); - Ln.i("message edited " + messageId); - break; - } - } - } - }); - - recyclerMembership.setLayoutManager(new LinearLayoutManager(this.getActivity())); - adapterMembership = new MembershipAdapter(this.getActivity()); - adapterMembership.mData.add("ALL"); - recyclerMembership.setAdapter(adapterMembership); - } - - @Override - public void onStart() { - super.onStart(); - recyclerMembership.setVisibility(View.GONE); - targetId = getTargetId(); - } - - private void requirePermission() { - new RequirePermissionAction(getActivity()).execute(); - } - - @Override - public void onBackPressed() { - super.onBackPressed(); - } - - private LocalFile[] generateLocalFiles() { - ArrayList arrayList = new ArrayList<>(); - if (selectedFile != null) { - for (File f : selectedFile) { - if (f.exists()) { - Ln.i("select file: " + f); - LocalFile.Thumbnail thumbnail = null; - if (MimeUtils.getContentTypeByFilename(f.getName()) == MimeUtils.ContentType.IMAGE) { - Bitmap bitmap = BitmapFactory.decodeFile(f.getAbsolutePath()); - thumbnail = new LocalFile.Thumbnail(f, null, bitmap.getWidth(), bitmap.getHeight()); - bitmap.recycle(); - } - LocalFile localFile = new LocalFile(f, null, thumbnail, v -> textStatus.setText(String.format("sending %s... %s bytes", f.getName(), v))); - arrayList.add(localFile); - } - } - } - LocalFile[] localFile = new LocalFile[arrayList.size()]; - arrayList.toArray(localFile); - return localFile; - } - - private Mention[] generateMentions() { - Mention.All mentionAll = new Mention.All(); - ArrayList mentionList = new ArrayList<>(); - for (Object o : this.mentionedMembershipList) { - if (o instanceof String) { - mentionList.add(mentionAll); - } else { - mentionList.add(new Mention.Person(((Membership) o).getPersonId())); - } - } - Mention[] mentionArray = new Mention[mentionList.size()]; - mentionList.toArray(mentionArray); - return mentionArray; - } - - private void hideSoftKeyboard() { - InputMethodManager inputMethodManager = - (InputMethodManager) getActivity().getSystemService( - Activity.INPUT_METHOD_SERVICE); - if (inputMethodManager != null && getActivity().getCurrentFocus() != null) { - inputMethodManager.hideSoftInputFromWindow( - getActivity().getCurrentFocus().getWindowToken(), 0); - } - } - - @OnClick(R.id.send_button) - public void sendMessage(View btn) { - if (!TextUtils.isEmpty(textMessage.getText()) || (selectedFile != null && !selectedFile.isEmpty())) { - btn.setEnabled(false); - messageClient.post(targetId, Message.draft(Message.Text.plain(textMessage.getText().toString())) - .addMentions(generateMentions()) - .addAttachments(generateLocalFiles()), rst -> { - Ln.e("posted:" + rst); - mentionedMembershipList.clear(); - selectedFile.clear(); - btn.setEnabled(true); - textStatus.setText("sent"); - - if (rst.isSuccessful()) { - adapterMessage.mData.add(new Pair<>(rst.getData(), true)); - adapterMessage.notifyDataSetChanged(); - } - }); - textStatus.setText("sending ..."); - textMessage.setText(""); - } - //text_mention.setVisibility(View.GONE); - textMessage.clearFocus(); - hideSoftKeyboard(); - } - - - @OnClick(R.id.message_upload_file) - public void selectFile() { - requirePermission(); - } - - @SuppressWarnings("unused") - @Subscribe(threadMode = ThreadMode.MAIN) - public void onEventMainThread(PermissionAcquiredEvent event) { - Intent intent = new Intent(); - intent.addCategory(Intent.CATEGORY_OPENABLE); - intent.setType("*/*"); - intent.setAction(Intent.ACTION_GET_CONTENT); - startActivityForResult(Intent.createChooser(intent, - "Select File"), FILE_SELECT_REQUEST); - } - - - @OnClick(R.id.message_mention) - public void mentionPeople() { - if (recyclerMembership.getVisibility() != View.VISIBLE) { - recyclerMembership.setVisibility(View.VISIBLE); - recyclerMessage.setVisibility(View.GONE); - } else { - recyclerMembership.setVisibility(View.GONE); - recyclerMessage.setVisibility(View.VISIBLE); - } - agent.getMembership(getTargetId(), result -> { - if (result.isSuccessful()) { - List list = (List) result.getData(); - adapterMembership.mData.clear(); - adapterMembership.mData.add("ALL"); - adapterMembership.mData.addAll(list); - adapterMembership.notifyDataSetChanged(); - } - }); - } - - - @Override - public void onActivityResult(int requestCode, int resultCode, Intent data) { - Ln.e("onActivityResult"); - if (resultCode == RESULT_OK) { - if (requestCode == FILE_SELECT_REQUEST) { - - Uri uri = data.getData(); - - String path = getPath(getActivity(), uri); - if (path != null) { - File selected = new File(path); - selectedFile.add(selected); - StringBuilder buffer = new StringBuilder(); - for (File f : selectedFile) { - buffer.append(" ").append(f.getName()); - } - textStatus.setText(buffer.toString()); - } - } - } - } - - class FilesAdapter extends RecyclerView.Adapter { - private final LayoutInflater mLayoutInflater; - private final Context mContext; - private ArrayList mData; - - FilesAdapter(Context context) { - mContext = context; - mLayoutInflater = LayoutInflater.from(mContext); - mData = new ArrayList<>(); - } - - @Override - public FilesAdapter.FilesViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { - return new FilesViewHolder(mLayoutInflater.inflate(R.layout.listitem_file, parent, false)); - } - - @Override - public void onBindViewHolder(FilesAdapter.FilesViewHolder holder, int position) { - RemoteFile file = mData.get(position); - holder.textFilename.setText(file.getDisplayName()); - agent.downloadThumbnail(file, null, null, (uri) -> { - holder.imageFile.setImageURI(uri.getData()); - holder.progressBarDownload.setVisibility(View.GONE); - }); - } - - @Override - public int getItemCount() { - return mData.size(); - } - - class FilesViewHolder extends RecyclerView.ViewHolder { - - @BindView(R.id.message_item_file) - ImageView imageFile; - - @BindView(R.id.message_item_file_download_progress) - ProgressBar progressBarDownload; - - @BindView(R.id.message_item_file_download) - ImageButton btnDownload; - - @BindView(R.id.message_item_load_process) - TextView textLoadProcess; - - @BindView(R.id.message_item_filename) - TextView textFilename; - - @OnClick(R.id.message_item_file_download) - public void download() { - RemoteFile file = mData.get(getAdapterPosition()); - agent.downloadFile( - file, - null, - progress -> { - textLoadProcess.setText(String.format("%s", Math.round(progress))); - }, - uri -> { - textLoadProcess.setText("complete"); - } - ); - } - - public FilesViewHolder(View itemView) { - super(itemView); - ButterKnife.bind(this, itemView); - } - } - } - - class MessageAdapter extends RecyclerView.Adapter { - private final LayoutInflater mLayoutInflater; - private final Context mContext; - private ArrayList> mData; - - MessageAdapter(Context context) { - mContext = context; - mData = new ArrayList<>(); - mLayoutInflater = LayoutInflater.from(mContext); - } - - @NonNull - @Override - public MessageViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { - return new MessageViewHolder(mLayoutInflater.inflate(R.layout.listview_message, parent, false)); - } - - @Override - public void onBindViewHolder(MessageViewHolder holder, int position) { - Message message = mData.get(position).first; - boolean isSelfSent = mData.get(position).second; - holder.textDate.setText(message.getCreated().toString()); - holder.textMessage.setText(message.getText()); - try { - JSONObject json = new JSONObject(message.toString()); - holder.textPayload.setText(json.toString(4)); - } catch (JSONException e) { - Ln.e("JSONObject parse error"); - holder.textPayload.setText(message.toString()); - } - if (message.isSelfMentioned()) { - holder.textMention.setVisibility(View.VISIBLE); - } else { - holder.textMention.setVisibility(View.GONE); - } - List list = message.getFiles(); - if (list != null && list.size() > 0) { - FilesAdapter adapter = new FilesAdapter(mContext); - holder.recyclerFiles.setLayoutManager(new LinearLayoutManager(mContext)); - holder.recyclerFiles.setAdapter(adapter); - adapter.mData.addAll(list); - adapter.notifyDataSetChanged(); - } - if (isSelfSent) { - holder.layoutMessage.setOnLongClickListener(v -> { - EditText editText = new EditText(mContext); - editText.setText(message.getText()); - editText.setSelection(message.getText().length()); - new AlertDialog.Builder(mContext).setTitle("Edit") - .setView(editText) - .setNegativeButton("Cancel", null) - .setPositiveButton("OK", (dialog, which) -> { - btnSend.setEnabled(false); - messageClient.edit(message, Message.Text.plain(editText.getText().toString()), message.getMentions().toArray(new Mention[message.getMentions().size()]), rst -> { - Ln.e("edited:" + rst); - btnSend.setEnabled(true); - textStatus.setText("edited"); - if (rst.isSuccessful()) { - message.update(rst.getData()); - adapterMessage.notifyItemChanged(position, ""); - } - }); - textStatus.setText("editing..."); - textMessage.setText(""); - }).create().show(); - return true; - }); - } - } - - @Override - public void onBindViewHolder(@NonNull MessageViewHolder holder, int position, @NonNull List payloads) { - super.onBindViewHolder(holder, position, payloads); - if (!payloads.isEmpty()) { - holder.edited.setVisibility(View.VISIBLE); - } - } - - @Override - public int getItemCount() { - return mData == null ? 0 : mData.size(); - } - - class MessageViewHolder extends RecyclerView.ViewHolder { - @BindView(R.id.messageLayout) - View layoutMessage; - - @BindView(R.id.edited) - TextView edited; - - @BindView(R.id.message_item_text) - TextView textMessage; - - @BindView(R.id.message_item_date) - TextView textDate; - - @BindView(R.id.message_item_mention) - TextView textMention; - - @BindView(R.id.message_item_list_files) - RecyclerView recyclerFiles; - - @BindView(R.id.message_item_payload) - TextView textPayload; - - @BindView(R.id.payloadLayout) - View layoutMessagePayload; - - @OnClick(R.id.expand) - public void expand() { - if (layoutMessagePayload.getVisibility() != View.VISIBLE) { - layoutMessagePayload.setVisibility(View.VISIBLE); - layoutMessage.setVisibility(View.GONE); - } else { - layoutMessagePayload.setVisibility(View.GONE); - layoutMessage.setVisibility(View.VISIBLE); - } - } - - MessageViewHolder(View view) { - super(view); - ButterKnife.bind(this, view); - } - } - } - -// // fake membership implements ALL -// private class MembershipAll extends Membership { -// -// @Override -// public String getPersonDisplayName() { -// return "ALL"; -// } -// } - - class MembershipAdapter extends RecyclerView.Adapter { - private final LayoutInflater mLayoutInflater; - private final Context mContext; - private final ArrayList mData; - - MembershipAdapter(Context context) { - mContext = context; - mData = new ArrayList<>(); - mLayoutInflater = LayoutInflater.from(mContext); - } - - - @NonNull - @Override - public MembershipViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - return new MembershipViewHolder(mLayoutInflater.inflate(R.layout.listitem_membership, parent, false)); - } - - @Override - public void onBindViewHolder(@NonNull MembershipViewHolder holder, int position) { - Object object = mData.get(position); - if (object instanceof String) { - holder.textContent.setText("ALL"); - } else if (object instanceof Membership) { - holder.textContent.setText(((Membership) object).getPersonDisplayName()); - } - } - - @Override - public int getItemCount() { - return mData != null ? mData.size() : 0; - } - - class MembershipViewHolder extends RecyclerView.ViewHolder { - - @BindView(R.id.text_content) - TextView textContent; - - @OnClick(R.id.text_content) - void onMembershipClick() { - int pos = getAdapterPosition(); - Object object = mData.get(pos); - recyclerMembership.setVisibility(View.GONE); - recyclerMessage.setVisibility(View.VISIBLE); - mentionedMembershipList.add(object); - textMessage.getText().append("@").append(object instanceof String ? ((String) object) : ((Membership) object).getPersonDisplayName()).append(" "); - } - - MembershipViewHolder(View itemView) { - super(itemView); - ButterKnife.bind(this, itemView); - } - } - } - - - /** - * helper to retrieve the path of an image URI - */ - public static String getPath(final Context context, final Uri uri) { - - // DocumentProvider - if (DocumentsContract.isDocumentUri(context, uri)) { - // ExternalStorageProvider - if (isExternalStorageDocument(uri)) { - String docId = DocumentsContract.getDocumentId(uri); - String[] split = docId.split(":"); - String fullPath = getPathFromExtSD(split); - return TextUtils.isEmpty(fullPath) ? null : fullPath; - } - // DownloadsProvider - else if (isDownloadsDocument(uri)) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - Cursor cursor = null; - try { - cursor = context.getContentResolver().query(uri, new String[]{MediaStore.MediaColumns.DISPLAY_NAME}, null, null, null); - if (cursor != null && cursor.moveToFirst()) { - String fileName = cursor.getString(0); - String path = Environment.getExternalStorageDirectory().toString() + "/Download/" + fileName; - if (!TextUtils.isEmpty(path)) { - return path; - } - } - } finally { - if (cursor != null) - cursor.close(); - } - } - String id = DocumentsContract.getDocumentId(uri); - if (!TextUtils.isEmpty(id)) { - if (id.startsWith("raw:")) { - return id.replaceFirst("raw:", ""); - } - try { - Uri contentUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.valueOf(id)); - return getDataColumn(context, contentUri, null, null); - } catch (NumberFormatException e) { - //In Android 8 and Android P the id is not a number - return uri.getPath() == null ? null : uri.getPath().replaceFirst("^/document/raw:", "").replaceFirst("^raw:", ""); - } - } - } - // MediaProvider - else if (isMediaDocument(uri)) { - String docId = DocumentsContract.getDocumentId(uri); - String[] split = docId.split(":"); - String type = split[0]; - - Uri contentUri = null; - if ("image".equals(type)) { - contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; - } else if ("video".equals(type)) { - contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI; - } else if ("audio".equals(type)) { - contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; - } - - String selection = "_id=?"; - String[] selectionArgs = new String[]{ - split[1] - }; - return getDataColumn(context, contentUri, selection, selectionArgs); - } - // GoogleDriveProvider - else if (isGoogleDriveUri(uri)) { - return getFilePath(uri, context, true); - } - } - // MediaStore (and general) - else if ("content".equalsIgnoreCase(uri.getScheme())) { - - if (isGooglePhotosUri(uri)) { - return uri.getLastPathSegment(); - } - - if (isGoogleDriveUri(uri)) { - return getFilePath(uri, context, true); - } - if (Build.VERSION.SDK_INT == Build.VERSION_CODES.N) { - return getFilePath(uri, context, false); - } else { - return getDataColumn(context, uri, null, null); - } - } - // File - else if ("file".equalsIgnoreCase(uri.getScheme())) { - return uri.getPath(); - } - return null; - } - - /** - * Get the value of the data column for this Uri. This is useful for - * MediaStore Uris, and other file-based ContentProviders. - * - * @param context The context. - * @param uri The Uri to query. - * @param selection (Optional) Filter used in the query. - * @param selectionArgs (Optional) Selection arguments used in the query. - * @return The value of the _data column, which is typically a file path. - */ - public static String getDataColumn(Context context, Uri uri, String selection, - String[] selectionArgs) { - - Cursor cursor = null; - String column = "_data"; - String[] projection = { - column - }; - try { - cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, - null); - if (cursor != null && cursor.moveToFirst()) { - final int column_index = cursor.getColumnIndexOrThrow(column); - return cursor.getString(column_index); - } - } finally { - if (cursor != null) - cursor.close(); - } - return null; - } - - /** - * Get full file path from external storage - * - * @param pathData The storage type and the relative path - */ - public static String getPathFromExtSD(String[] pathData) { - String type = pathData[0]; - String relativePath = "/" + pathData[1]; - String fullPath; - - // on my Sony devices (4.4.4 & 5.1.1), `type` is a dynamic string - // something like "71F8-2C0A", some kind of unique id per storage - // don't know any API that can get the root path of that storage based on its id. - // - // so no "primary" type, but let the check here for other devices - if ("primary".equalsIgnoreCase(type)) { - fullPath = Environment.getExternalStorageDirectory() + relativePath; - if (fileExists(fullPath)) { - return fullPath; - } - } - - // Environment.isExternalStorageRemovable() is `true` for external and internal storage - // so we cannot relay on it. - // - // instead, for each possible path, check if file exists - // we'll start with secondary storage as this could be our (physically) removable sd card - fullPath = System.getenv("SECONDARY_STORAGE") + relativePath; - if (fileExists(fullPath)) { - return fullPath; - } - fullPath = System.getenv("EXTERNAL_STORAGE") + relativePath; - if (fileExists(fullPath)) { - return fullPath; - } - return fullPath; - } - - /** - * @param uri - * @param context - * @param isDrive true if getting DriveFilePath, false if getting MediaFilePath on Android N - * @return - */ - private static String getFilePath(Uri uri, Context context, boolean isDrive) { - Cursor cursor = null; - File file = null; - InputStream inputStream = null; - FileOutputStream outputStream = null; - try { - cursor = context.getContentResolver().query(uri, null, null, null, null); - if (cursor == null) { - return null; - } - /* - * Get the column indexes of the data in the Cursor, - * * move to the first row in the Cursor, get the data, - * * and display it. - * */ - int nameIndex = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME); - cursor.moveToFirst(); - String name = (cursor.getString(nameIndex)); - if (isDrive) { - file = new File(context.getCacheDir(), name); - } else { - file = new File(context.getFilesDir(), name); - } - inputStream = context.getContentResolver().openInputStream(uri); - if (null == inputStream) { - return null; - } - outputStream = new FileOutputStream(file); - int read; - int maxBufferSize = 1 * 1024 * 1024; - int bytesAvailable = inputStream.available(); - - //int bufferSize = 1024; - int bufferSize = Math.min(bytesAvailable, maxBufferSize); - - final byte[] buffers = new byte[bufferSize]; - while ((read = inputStream.read(buffers)) != -1) { - outputStream.write(buffers, 0, read); - } - - } catch (Exception e) { - e.printStackTrace(); - } finally { - if (cursor != null) { - cursor.close(); - } - if (inputStream != null) { - try { - inputStream.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - if (outputStream != null) { - try { - outputStream.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - return file == null ? null : file.getPath(); - } - - /** - * Check if a file exists on device - * - * @param filePath The absolute file path - */ - public static boolean fileExists(String filePath) { - File file = new File(filePath); - return file.exists(); - } - - /** - * @param uri The Uri to check. - * @return Whether the Uri authority is ExternalStorageProvider. - */ - public static boolean isExternalStorageDocument(Uri uri) { - return "com.android.externalstorage.documents".equals(uri.getAuthority()); - } - - /** - * @param uri The Uri to check. - * @return Whether the Uri authority is DownloadsProvider. - */ - public static boolean isDownloadsDocument(Uri uri) { - return "com.android.providers.downloads.documents".equals(uri.getAuthority()); - } - - /** - * @param uri The Uri to check. - * @return Whether the Uri authority is MediaProvider. - */ - public static boolean isMediaDocument(Uri uri) { - return "com.android.providers.media.documents".equals(uri.getAuthority()); - } - - /** - * @param uri The Uri to check. - * @return Whether the Uri authority is Google Drive. - */ - public static boolean isGoogleDriveUri(Uri uri) { - return "com.google.android.apps.docs.storage".equals(uri.getAuthority()) || "com.google.android.apps.docs.storage.legacy".equals(uri.getAuthority()); - } - - /** - * @param uri - The Uri to check. - * @return - Whether the Uri authority is Google Photos. - */ - public static boolean isGooglePhotosUri(Uri uri) { - return "com.google.android.apps.photos.content".equals(uri.getAuthority()); - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/SetupFragment.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/SetupFragment.java deleted file mode 100644 index c326648..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/SetupFragment.java +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.launcher.fragments; - - -import android.view.View; -import android.widget.CompoundButton; -import android.widget.RadioButton; -import android.widget.Spinner; -import android.widget.Switch; - -import com.ciscowebex.androidsdk.kitchensink.R; -import com.ciscowebex.androidsdk.kitchensink.actions.WebexAgent; -import com.ciscowebex.androidsdk.kitchensink.actions.commands.RequirePermissionAction; -import com.ciscowebex.androidsdk.kitchensink.actions.commands.ToggleSpeakerAction; -import com.ciscowebex.androidsdk.kitchensink.actions.events.PermissionAcquiredEvent; -import com.ciscowebex.androidsdk.kitchensink.ui.BaseFragment; -import com.ciscowebex.androidsdk.phone.Phone; - -import org.greenrobot.eventbus.Subscribe; - -import java.util.Arrays; - -import butterknife.BindView; -import butterknife.OnCheckedChanged; -import butterknife.OnClick; -import butterknife.OnItemSelected; - -/** - * Setup fragment, {@link BaseFragment} subclass. - */ -public class SetupFragment extends BaseFragment { - - final private int BANDWIDTH[] = {177000, 384000, 768000, 2500000, 4000000}; - - private WebexAgent agent; - - @BindView(R.id.preview) - View preview; - - @BindView(R.id.audioVideoCall) - RadioButton switchAudioVideo; - - @BindView(R.id.audioCallOnly) - RadioButton switchAudioOnly; - - @BindView(R.id.composited) - RadioButton radioComposited; - - @BindView(R.id.multiStream) - RadioButton radioMultiStream; - - @BindView(R.id.setupLoudSpeaker) - Switch switchLoudSpeaker; - - @BindView(R.id.backCamera) - RadioButton radioBackCamera; - - @BindView(R.id.frontCamera) - RadioButton radioFrontCamera; - - @BindView(R.id.closePreview) - RadioButton radioClosePreview; - - @BindView(R.id.spinnerBandWidth) - Spinner maxBandwidth; - - @BindView(R.id.setupBNR) - Switch switchBNR; - - @BindView(R.id.bnr_hp) - RadioButton radioHP; - - @BindView(R.id.bnr_lp) - RadioButton radioLP; - - public SetupFragment() { - // Required empty public constructor - setLayout(R.layout.fragment_setup); - } - - @Override - public void onStart() { - super.onStart(); - agent = WebexAgent.getInstance(); - requirePermission(); - } - - private void requirePermission() { - new RequirePermissionAction(getActivity()).execute(); - } - - private void setupWidgetStates() { - // Setup loud speaker radio button - switchLoudSpeaker.setEnabled(true); - switchLoudSpeaker.setChecked(agent.getSpeakerPhoneOn()); - - // Setup Call capability radio buttons - if (agent.getCallCapability().equals(WebexAgent.CallCap.AUDIO_ONLY)) - switchAudioOnly.setChecked(true); - else - switchAudioVideo.setChecked(true); - - // Setup camera radio buttons - radioFrontCamera.setEnabled(true); - radioBackCamera.setEnabled(true); - radioClosePreview.setEnabled(true); - switch (agent.getDefaultCamera()) { - case FRONT: - radioFrontCamera.setChecked(true); - setFrontCamera(); - break; - case BACK: - radioBackCamera.setChecked(true); - setBackCamera(); - break; - case CLOSE: - radioClosePreview.setChecked(true); - break; - } - -// Setup max bandwidth - int bw = agent.getMaxBandWidth(); - int index = Arrays.binarySearch(BANDWIDTH, bw); - if (index == -1) { - // default max bandwidth 2000000 - index = 4; - } - maxBandwidth.setSelection(index); - - // Setup Audio BNR - switchBNR.setEnabled(true); - switchBNR.setChecked(agent.isAudioBNREnable()); - if (agent.getAudioBNRMode() != null) { - radioHP.setChecked(agent.getAudioBNRMode() == Phone.AudioBRNMode.HP); - radioLP.setChecked(agent.getAudioBNRMode() == Phone.AudioBRNMode.LP); - } - - // Setup multi-stream radio buttons - if (agent.getVideoStreamMode() != null) { - radioComposited.setChecked(agent.getVideoStreamMode() == Phone.VideoStreamMode.COMPOSITED); - radioMultiStream.setChecked(agent.getVideoStreamMode() == Phone.VideoStreamMode.AUXILIARY); - } - - } - - @OnClick({R.id.audioCallOnly, R.id.audioVideoCall}) - public void onSelectCallCapability(View v) { - switch (v.getId()) { - case R.id.audioCallOnly: - agent.setCallCapability(WebexAgent.CallCap.AUDIO_ONLY); - radioComposited.performClick(); - radioComposited.setEnabled(false); - radioMultiStream.setEnabled(false); - break; - case R.id.audioVideoCall: - agent.setCallCapability(WebexAgent.CallCap.AUDIO_VIDEO); - radioComposited.setEnabled(true); - radioMultiStream.setEnabled(true); - break; - } - } - - @OnClick({R.id.closePreview, R.id.frontCamera, R.id.backCamera}) - public void onSelectCamera(View v) { - switch (v.getId()) { - case R.id.frontCamera: - setFrontCamera(); - break; - case R.id.backCamera: - setBackCamera(); - break; - case R.id.closePreview: - closeCamera(); - break; - } - } - - @OnCheckedChanged(R.id.setupLoudSpeaker) - public void onSetupLoadSpeakerChanged(Switch s) { - new ToggleSpeakerAction(getActivity(), null, s.isChecked()).execute(); - } - - @OnCheckedChanged(R.id.setupBNR) - public void onSetupBNRChanged(Switch s) { - radioHP.setEnabled(s.isChecked()); - radioLP.setEnabled(s.isChecked()); - agent.enableAudioBNR(s.isChecked()); - if (s.isChecked()) { - if (agent.getAudioBNRMode() != null) { - radioHP.setChecked(agent.getAudioBNRMode() == Phone.AudioBRNMode.HP); - radioLP.setChecked(agent.getAudioBNRMode() == Phone.AudioBRNMode.LP); - } - } - } - - @OnCheckedChanged({R.id.bnr_hp, R.id.bnr_lp}) - public void onRadioBNRChanged(CompoundButton button, boolean isChecked) { - if (isChecked) { - switch (button.getId()) { - case R.id.bnr_hp: - agent.setAudioBNRMode(Phone.AudioBRNMode.HP); - break; - case R.id.bnr_lp: - agent.setAudioBNRMode(Phone.AudioBRNMode.LP); - break; - } - } - } - - @OnCheckedChanged({R.id.composited, R.id.multiStream}) - public void onRadioVideoStreamModeChanged(CompoundButton button, boolean isChecked) { - if (isChecked) { - switch (button.getId()) { - case R.id.composited: - agent.setVideoStreamMode(Phone.VideoStreamMode.COMPOSITED); - break; - case R.id.multiStream: - agent.setVideoStreamMode(Phone.VideoStreamMode.AUXILIARY); - break; - } - } - } - - private void closeCamera() { - agent.setDefaultCamera(WebexAgent.CameraCap.CLOSE); - agent.stopPreview(); - preview.setVisibility(View.GONE); - } - - private void setBackCamera() { - preview.setVisibility(View.VISIBLE); - agent.setDefaultCamera(WebexAgent.CameraCap.BACK); - agent.startPreview(preview); - } - - private void setFrontCamera() { - preview.setVisibility(View.VISIBLE); - agent.setDefaultCamera(WebexAgent.CameraCap.FRONT); - agent.startPreview(preview); - } - - @OnItemSelected(R.id.spinnerBandWidth) - public void onMaxBandWidthSpinnerSelected(Spinner spinner, int position) { - agent.setMaxBandWidth(BANDWIDTH[position]); - } - - @SuppressWarnings("unused") - @Subscribe - public void onEventMainThread(PermissionAcquiredEvent event) { - setupWidgetStates(); - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/WaitingCallFragment.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/WaitingCallFragment.java deleted file mode 100644 index 0db2d81..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/WaitingCallFragment.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.launcher.fragments; - - -import android.support.design.widget.FloatingActionButton; -import android.view.View; - -import com.ciscowebex.androidsdk.kitchensink.R; -import com.ciscowebex.androidsdk.kitchensink.actions.WebexAgent; -import com.ciscowebex.androidsdk.kitchensink.actions.commands.AddCallHistoryAction; -import com.ciscowebex.androidsdk.kitchensink.actions.events.AnswerEvent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.OnDisconnectEvent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.OnIncomingCallEvent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.OnScheduleChangedEvent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.RejectEvent; -import com.ciscowebex.androidsdk.kitchensink.launcher.LauncherActivity; -import com.ciscowebex.androidsdk.kitchensink.ui.BaseFragment; -import com.github.benoitdion.ln.Ln; - -import org.greenrobot.eventbus.Subscribe; -import org.greenrobot.eventbus.ThreadMode; - -import butterknife.BindView; -import butterknife.OnClick; - - -/** - * A simple {@link BaseFragment} subclass. - * Use the {@link WaitingCallFragment#newInstance} factory method to - * create an instance of this fragment. - */ -public class WaitingCallFragment extends BaseFragment { - - @BindView(R.id.answer) - public FloatingActionButton answerButton; - - @BindView(R.id.reject) - public FloatingActionButton rejectButton; - - public WaitingCallFragment() { - // Required empty public constructor - setLayout(R.layout.fragment_waiting_call); - } - - @OnClick(R.id.answer) - public void answerCall() { - if (WebexAgent.getInstance().isCallIncoming()) { - showButton(false); - ((LauncherActivity) getActivity()).replace(CallFragment.newAnswerCallInstance()); - } - } - - @OnClick(R.id.reject) - public void rejectCall() { - showButton(false); - WebexAgent.getInstance().reject(); - } - - @Override - public void onStart() { - super.onStart(); - if (WebexAgent.getInstance().isCallIncoming()) { - showButton(true); - } else { - showButton(false); - } - } - - @SuppressWarnings("unused") - @Subscribe(threadMode = ThreadMode.MAIN) - public void onEventMainThread(OnIncomingCallEvent event) { - showButton(true); - new AddCallHistoryAction(event.call.getFrom().getDisplayName(), "in").execute(); - } - - @SuppressWarnings("unused") - @Subscribe(threadMode = ThreadMode.MAIN) - public void onEventMainThread(OnScheduleChangedEvent event) { - Ln.d("OnScheduleChangedEvent: " + event); - } - - @SuppressWarnings("unused") - @Subscribe(threadMode = ThreadMode.MAIN) - public void onEventMainThread(AnswerEvent event) { - // if (event.isSuccessful()) - showButton(false); - } - - @SuppressWarnings("unused") - @Subscribe(threadMode = ThreadMode.MAIN) - public void onEventMainThread(RejectEvent event) { - // if (event.isSuccessful()) - showButton(false); - } - - @SuppressWarnings("unused") - @Subscribe(threadMode = ThreadMode.MAIN) - public void onEventMainThread(OnDisconnectEvent event) { - showButton(false); - } - - private void showButton(boolean show) { - int visible = show ? View.VISIBLE : View.INVISIBLE; - answerButton.setVisibility(visible); - rejectButton.setVisibility(visible); - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/pagers/DialFragment.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/pagers/DialFragment.java deleted file mode 100644 index 66514c4..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/pagers/DialFragment.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.launcher.fragments.pagers; - - -import android.text.TextUtils; -import android.widget.EditText; - -import com.ciscowebex.androidsdk.kitchensink.R; -import com.ciscowebex.androidsdk.kitchensink.launcher.LauncherActivity; -import com.ciscowebex.androidsdk.kitchensink.launcher.fragments.CallFragment; -import com.ciscowebex.androidsdk.kitchensink.launcher.fragments.MessageFragment; -import com.ciscowebex.androidsdk.kitchensink.ui.BaseFragment; - -import butterknife.BindView; -import butterknife.OnClick; - -/** - * A simple {@link BaseFragment} subclass. - */ -public class DialFragment extends BaseFragment { - - @BindView(R.id.editCallee) - public EditText callee; - - public DialFragment() { - // Required empty public constructor - setLayout(R.layout.fragment_dial); - } - - @OnClick(R.id.callButton) - public void makeCall() { - String id = callee.getText().toString(); - if (!TextUtils.isEmpty(id)) { - CallFragment fragment = CallFragment.newInstance(id); - ((LauncherActivity)getActivity()).replace(fragment); - } - } - - @OnClick(R.id.messageButton) - public void sendMessage() { - String id = callee.getText().toString(); - if (!TextUtils.isEmpty(id)) { - MessageFragment fragment = MessageFragment.newInstance(id); - ((LauncherActivity) getActivity()).replace(fragment); - } - } - - public void setDialString(String dialString) { - callee.setText(dialString); - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/pagers/HistoryFragment.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/pagers/HistoryFragment.java deleted file mode 100644 index f541148..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/pagers/HistoryFragment.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.launcher.fragments.pagers; - - -import android.app.Fragment; -import android.content.Context; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ArrayAdapter; -import android.widget.BaseAdapter; -import android.widget.ImageView; -import android.widget.ListView; -import android.widget.TextView; - -import com.ciscowebex.androidsdk.kitchensink.R; -import com.ciscowebex.androidsdk.kitchensink.launcher.LauncherActivity; -import com.ciscowebex.androidsdk.kitchensink.launcher.fragments.DialPagersFragment; -import com.ciscowebex.androidsdk.kitchensink.models.CallHistory; -import com.ciscowebex.androidsdk.kitchensink.models.CallHistoryDao; -import com.ciscowebex.androidsdk.kitchensink.models.DaoSession; -import com.ciscowebex.androidsdk.kitchensink.ui.BaseFragment; -import com.ciscowebex.androidsdk.kitchensink.ui.CircleTransform; -import com.ciscowebex.androidsdk.people.Person; -import com.google.gson.Gson; -import com.squareup.picasso.Picasso; - -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.List; - -import butterknife.BindView; -import butterknife.OnItemClick; - -import static android.R.drawable.sym_call_incoming; -import static android.R.drawable.sym_call_outgoing; -import static com.ciscowebex.androidsdk.kitchensink.KitchenSinkApp.getApplication; -import static com.ciscowebex.androidsdk.kitchensink.R.drawable.google_contacts_android; - -public class HistoryFragment extends BaseFragment { - - private CallHistoryDao dao; - - private List callList = new ArrayList<>(); - - @BindView(R.id.callhistory) - public ListView listView; - - public HistoryFragment() { - // Required empty public constructor - setLayout(R.layout.fragment_history); - } - - - @Override - public void onStart() { - super.onStart(); - DaoSession daoSession = getApplication().getDaoSession(); - dao = daoSession.getCallHistoryDao(); - PersonAdapter adapter = new PersonAdapter(getActivity(), R.layout.listview_person, callList); - listView.setAdapter(adapter); - update(); - } - - public void update() { - List list = dao.queryBuilder().orderDesc(CallHistoryDao.Properties.Date).list(); - callList.clear(); - callList.addAll(list); - ((BaseAdapter) listView.getAdapter()).notifyDataSetChanged(); - } - - @OnItemClick(R.id.callhistory) - public void historyItemClicked(int position) { - final CallHistory history = callList.get(position); - Fragment fm = ((LauncherActivity) getActivity()).getFragment(); - ((DialPagersFragment) fm).gotoDialPage(history.getEmail()); - } - - class PersonAdapter extends ArrayAdapter { - - private int resourceId; - - public PersonAdapter(Context context, int textViewResourceId, - List objects) { - super(context, textViewResourceId, objects); - resourceId = textViewResourceId; - } - - @Override - public View getView(int position, View convertView, ViewGroup parent) { - CallHistory history = getItem(position); - View view = LayoutInflater.from(getContext()).inflate(resourceId, null); - TextView name = view.findViewById(R.id.person_name); - name.setText(history.getEmail()); - TextView email = view.findViewById(R.id.person_email); - SimpleDateFormat spf = new SimpleDateFormat("MMM dd, yyyy hh:mm:ss"); - email.setText(spf.format(history.getDate())); - - ImageView image = view.findViewById(R.id.person_icon); - if (history.getPerson() != null && !history.getPerson().isEmpty()) { - Gson gson = new Gson(); - Person person = gson.fromJson(history.getPerson(), Person.class); - if (person.getAvatar() != null && !person.getAvatar().isEmpty()) { - Picasso.with(getContext()).load(person.getAvatar()).transform(new CircleTransform()).into(image); - } - } else { - image.setImageResource(google_contacts_android); - } - if (history.getDirection().equals("in")) { - ImageView icon = view.findViewById(R.id.person_call_icon); - icon.setImageResource(sym_call_incoming); - } - if (history.getDirection().equals("out")) { - ImageView icon = view.findViewById(R.id.person_call_icon); - icon.setImageResource(sym_call_outgoing); - } - return view; - } - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/pagers/PeopleFragment.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/pagers/PeopleFragment.java deleted file mode 100644 index 67cc561..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/pagers/PeopleFragment.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.launcher.fragments.pagers; - -import android.app.Fragment; -import android.content.Context; -import android.os.Bundle; -import android.text.InputType; -import android.text.TextUtils; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ArrayAdapter; -import android.widget.BaseAdapter; -import android.widget.ImageView; -import android.widget.ListView; -import android.widget.SearchView; -import android.widget.TextView; - -import com.ciscowebex.androidsdk.kitchensink.R; -import com.ciscowebex.androidsdk.kitchensink.actions.commands.SearchPeopleAction; -import com.ciscowebex.androidsdk.kitchensink.actions.events.SearchPersonCompleteEvent; -import com.ciscowebex.androidsdk.kitchensink.launcher.LauncherActivity; -import com.ciscowebex.androidsdk.kitchensink.launcher.fragments.DialPagersFragment; -import com.ciscowebex.androidsdk.kitchensink.ui.BaseFragment; -import com.ciscowebex.androidsdk.kitchensink.ui.CircleTransform; -import com.ciscowebex.androidsdk.people.Person; -import com.squareup.picasso.Picasso; - -import org.greenrobot.eventbus.Subscribe; - -import java.util.ArrayList; -import java.util.List; - -import butterknife.BindView; -import butterknife.ButterKnife; -import butterknife.OnItemClick; - -public class PeopleFragment extends BaseFragment { - - @BindView(R.id.people_list) - public ListView listView; - - @BindView(R.id.search_people) - public SearchView searchView; - - private List persons; - - public PeopleFragment() { - // Required empty public constructor - setLayout(R.layout.fragment_people); - persons = new ArrayList<>(); - } - - - @OnItemClick(R.id.people_list) - public void peopleListItemClicked(int position) { - final Person p = persons.get(position); - Fragment fm = ((LauncherActivity)getActivity()).getFragment(); - ((DialPagersFragment) fm).gotoDialPage(p.getEmails()[0]); - } - - @Override - public void onActivityCreated(Bundle saved) { - super.onActivityCreated(saved); - PersonAdapter adapter = new PersonAdapter(getActivity(), R.layout.listview_person, persons); - listView.setAdapter(adapter); - - searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { - @Override - public boolean onQueryTextSubmit(String queryString) { - resetSearchView(); - showBusyIndicator("Searching", "searching people ..."); - query(queryString); - return false; - } - - @Override - public boolean onQueryTextChange(String newText) { - return false; - } - }); - } - - private void query(String query) { - if (query.isEmpty()) return; - - if (isValidEmail(query)) { - new SearchPeopleAction(query, null).execute(); - } else { - new SearchPeopleAction(null, query).execute(); - } - } - - private void resetSearchView() { - searchView.setEnabled(false); - searchView.setIconified(true); - searchView.clearFocus(); - searchView.setInputType(InputType.TYPE_NULL); - } - - class PersonAdapter extends ArrayAdapter { - - private int resourceId; - - - public PersonAdapter(Context context, int textViewResourceId, - List objects) { - super(context, textViewResourceId, objects); - resourceId = textViewResourceId; - } - - @Override - public View getView(int position, View convertView, ViewGroup parent) { - View view = LayoutInflater.from(getContext()).inflate(resourceId, null); - ViewHolder holder = new ViewHolder(view); - - Person person = getItem(position); - - Picasso.with(getContext()).load(person.getAvatar()).transform(new CircleTransform()).into(holder.avatar); - holder.name.setText(person.getDisplayName()); - holder.email.setText(person.getEmails()[0]); - return view; - } - } - - static class ViewHolder { - @BindView(R.id.person_name) - TextView name; - - @BindView(R.id.person_email) - TextView email; - - @BindView(R.id.person_icon) - ImageView avatar; - - public ViewHolder(View view) { - ButterKnife.bind(this, view); - } - } - - @SuppressWarnings("unused") - @Subscribe - public void onEventMainThread(SearchPersonCompleteEvent event) { - dismissBusyIndicator(); - if (event.isSuccessful()) { - List result = (List) event.getResult().getData(); - persons.clear(); - persons.addAll(result); - ((BaseAdapter) listView.getAdapter()).notifyDataSetChanged(); - } - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/pagers/SpaceFragment.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/pagers/SpaceFragment.java deleted file mode 100644 index 60d72e6..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/launcher/fragments/pagers/SpaceFragment.java +++ /dev/null @@ -1,177 +0,0 @@ -package com.ciscowebex.androidsdk.kitchensink.launcher.fragments.pagers; - -import android.app.Fragment; -import android.content.Context; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ArrayAdapter; -import android.widget.BaseAdapter; -import android.widget.ImageView; -import android.widget.ListView; -import android.widget.TextView; - -import com.ciscowebex.androidsdk.kitchensink.R; -import com.ciscowebex.androidsdk.kitchensink.actions.WebexAgent; -import com.ciscowebex.androidsdk.kitchensink.actions.commands.SearchSpaceAction; -import com.ciscowebex.androidsdk.kitchensink.actions.events.SearchActiveSpaceCompleteEvent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.SearchSpaceCompleteEvent; -import com.ciscowebex.androidsdk.kitchensink.launcher.LauncherActivity; -import com.ciscowebex.androidsdk.kitchensink.launcher.fragments.DialPagersFragment; -import com.ciscowebex.androidsdk.kitchensink.ui.BaseFragment; -import com.ciscowebex.androidsdk.space.Space; -import com.ciscowebex.androidsdk.space.SpaceObserver; - -import org.greenrobot.eventbus.Subscribe; - -import java.util.ArrayList; -import java.util.List; - -import butterknife.BindView; -import butterknife.ButterKnife; -import butterknife.OnItemClick; - - -public class SpaceFragment extends BaseFragment { - - @BindView(R.id.space_list) - public ListView listView; - - private List spaceList; - - public SpaceFragment() { - // Required empty public constructor - setLayout(R.layout.fragment_space); - spaceList = new ArrayList<>(); - } - - @Override - public void onStart() { - super.onStart(); - //new SearchSpaceAction().execute(); - } - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - new SearchSpaceAction().execute(); - return super.onCreateView(inflater, container, savedInstanceState); - } - - @OnItemClick(R.id.space_list) - public void spaceListItemClicked(int position) { - final Space p = spaceList.get(position); - Fragment fm = ((LauncherActivity) getActivity()).getFragment(); - ((DialPagersFragment) fm).gotoDialPage(p.getId()); - } - - @Override - public void onActivityCreated(Bundle saved) { - super.onActivityCreated(saved); - SpaceAdapter adapter = new SpaceAdapter(getActivity(), R.layout.listview_person, spaceList); - listView.setAdapter(adapter); - setObserver(); - } - - @Override - public void onDestroy() { - super.onDestroy(); - WebexAgent webex = WebexAgent.getInstance(); - webex.getWebex().spaces().setSpaceObserver(null); - } - - class SpaceAdapter extends ArrayAdapter { - - private int resourceId; - - - public SpaceAdapter(Context context, int textViewResourceId, - List objects) { - super(context, textViewResourceId, objects); - resourceId = textViewResourceId; - } - - @Override - public View getView(int position, View convertView, ViewGroup parent) { - View view = LayoutInflater.from(getContext()).inflate(resourceId, null); - SpaceFragment.ViewHolder holder = new SpaceFragment.ViewHolder(view); - - Space space = getItem(position); - - holder.name.setText(space.getTitle()); - holder.email.setText(space.getType().toString()); - return view; - } - } - - static class ViewHolder { - @BindView(R.id.person_name) - TextView name; - - @BindView(R.id.person_email) - TextView email; - - @BindView(R.id.person_icon) - ImageView avatar; - - public ViewHolder(View view) { - ButterKnife.bind(this, view); - } - } - - @SuppressWarnings("unused") - @Subscribe - public void onEventMainThread(SearchSpaceCompleteEvent event) { - dismissBusyIndicator(); - if (event.isSuccessful()) { - List result = (List) event.getResult().getData(); - spaceList.clear(); - spaceList.addAll(result); - ((BaseAdapter) listView.getAdapter()).notifyDataSetChanged(); - } - } - - private void setObserver() { - WebexAgent webex = WebexAgent.getInstance(); - webex.getWebex().spaces().setSpaceObserver(event -> { - boolean ongoingVisible = false; - String spaceId = null; - if (event instanceof SpaceObserver.SpaceCallStarted) { - ongoingVisible = true; - spaceId = ((SpaceObserver.SpaceCallStarted) event).getSpaceId(); - } else if (event instanceof SpaceObserver.SpaceCallEnded) { - ongoingVisible = false; - spaceId = ((SpaceObserver.SpaceCallEnded) event).getSpaceId(); - } - if (spaceId != null) { - for (Space space : spaceList) { - if (spaceId.equals(space.getId())) { - int position = spaceList.indexOf(space); - View v = listView.getChildAt(position); - if (v != null) { - v.findViewById(R.id.ongoing).setVisibility(ongoingVisible ? View.VISIBLE : View.GONE); - } - } - } - } - }); - } - - @SuppressWarnings("unused") - @Subscribe - public void onEventMainThread(SearchActiveSpaceCompleteEvent event) { - if (event.isSuccessful()) { - List result = (List) event.getResult().getData(); - if (result != null && !result.isEmpty()) { - for (String spaceId : result) { - for (Space space : spaceList) { - if (spaceId.equals(space.getId())) { - int position = spaceList.indexOf(space); - listView.getChildAt(position).findViewById(R.id.ongoing).setVisibility(View.VISIBLE); - } - } - } - } - } - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/login/LoginActivity.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/login/LoginActivity.java deleted file mode 100644 index 8509cc8..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/login/LoginActivity.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.login; - -import android.app.Activity; -import android.os.Bundle; - -import com.ciscowebex.androidsdk.kitchensink.R; -import com.ciscowebex.androidsdk.kitchensink.actions.commands.RequirePermissionAction; -import com.ciscowebex.androidsdk.kitchensink.login.fragments.JwtFragment; -import com.ciscowebex.androidsdk.kitchensink.login.fragments.OAuth2Fragment; - -import butterknife.ButterKnife; -import butterknife.OnClick; - -public class LoginActivity extends Activity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - //new RequirePermissionAction(this).execute(); - setContentView(R.layout.fragment_login); - ButterKnife.bind(this); - } - - @Override - protected void onStart() { - super.onStart(); - getFragmentManager().popBackStackImmediate(); - } - - @OnClick(R.id.buttonWebex) - public void WebexLogin() { - OAuth2Fragment.newInstance().replace(this, R.id.enter_activity_layout); - } - - @OnClick(R.id.buttonJWT) - public void JwtLogin() { - JwtFragment.newInstance().replace(this, R.id.enter_activity_layout); - } - - @Override - public void onBackPressed() { - if (!getFragmentManager().popBackStackImmediate()) { - super.onBackPressed(); - } - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/login/fragments/JwtFragment.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/login/fragments/JwtFragment.java deleted file mode 100644 index 94e6d8c..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/login/fragments/JwtFragment.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.login.fragments; - - -import android.app.Fragment; -import android.content.Intent; -import android.widget.EditText; - -import com.ciscowebex.androidsdk.kitchensink.R; -import com.ciscowebex.androidsdk.kitchensink.actions.commands.AppIdLoginAction; -import com.ciscowebex.androidsdk.kitchensink.ui.BaseFragment; -import com.ciscowebex.androidsdk.kitchensink.launcher.LauncherActivity; -import com.ciscowebex.androidsdk.kitchensink.actions.events.LoginEvent; - -import org.greenrobot.eventbus.Subscribe; - -import butterknife.BindView; -import butterknife.OnClick; - -/** - * A simple {@link Fragment} subclass. - * Use the {@link JwtFragment#newInstance} factory method to - * create an instance of this fragment. - */ -public class JwtFragment extends BaseFragment { - - @BindView(R.id.editTextJWT) - public EditText editTextJwt; - - public JwtFragment() { - // Required empty public constructor - setLayout(R.layout.fragment_jwt_login); - } - - /** - * Use this factory method to create a new instance of - * this fragment using the provided parameters. - * - * @return A new instance of fragment JwtFragment. - */ - public static JwtFragment newInstance() { - return new JwtFragment(); - } - - @OnClick(R.id.buttonLogin) - public void login() { - String jwt = editTextJwt.getText().toString(); - if (!jwt.isEmpty()) { - showBusyIndicator("Login", "Waiting for login ..."); - //startLauncher(); - new AppIdLoginAction(jwt).execute(); - } - } - - @SuppressWarnings("unused") - @Subscribe - public void onEventMainThread(LoginEvent event) { - dismissBusyIndicator(); - if (event.isSuccessful()) { - toast("AppID logged in."); - startLauncher(); - } else { - toast(event.getError().toString()); - } - } - - private void startLauncher() { - startActivity(new Intent(getActivity(), LauncherActivity.class)); - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/login/fragments/OAuth2Fragment.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/login/fragments/OAuth2Fragment.java deleted file mode 100644 index e54b47c..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/login/fragments/OAuth2Fragment.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.login.fragments; - -import android.app.Fragment; -import android.content.Intent; -import android.webkit.WebView; - -import com.ciscowebex.androidsdk.kitchensink.R; -import com.ciscowebex.androidsdk.kitchensink.actions.commands.WebexIdLoginAction; -import com.ciscowebex.androidsdk.kitchensink.ui.BaseFragment; -import com.ciscowebex.androidsdk.kitchensink.launcher.LauncherActivity; -import com.ciscowebex.androidsdk.kitchensink.actions.events.LoginEvent; -import com.github.benoitdion.ln.Ln; - -import org.greenrobot.eventbus.Subscribe; - -import butterknife.BindView; - - -/** - * A simple {@link Fragment} subclass. - * Activities that contain this fragment must implement the - * to handle interaction events. - * Use the {@link OAuth2Fragment#newInstance} factory method to - * create an instance of this fragment. - */ -public class OAuth2Fragment extends BaseFragment { - - @BindView(R.id.OAuthWebView) - public WebView webView; - - public OAuth2Fragment() { - // Required empty public constructor - setLayout(R.layout.fragment_oauth2); - } - - /** - * Use this factory method to create a new instance of - * this fragment using the provided parameters. - * - * @return A new instance of fragment OAuth2Fragment. - */ - public static OAuth2Fragment newInstance() { - return new OAuth2Fragment(); - } - - @Override - public void onStart() { - super.onStart(); - authorize(); - } - - private void authorize() { - new WebexIdLoginAction(webView).execute(); - } - - @SuppressWarnings("unused") - @Subscribe - public void onEventMainThread(LoginEvent event) { - if (event.isSuccessful()) { - toast("OAuth2 logged in."); - startActivity(new Intent(getActivity(), LauncherActivity.class)); - getActivity().finish(); - } else { - toast("OAuth2 logged failed."); - Ln.e(event.getError().toString()); - authorize(); - } - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/models/CallHistory.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/models/CallHistory.java deleted file mode 100644 index a2b4cc1..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/models/CallHistory.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.models; - -import org.greenrobot.greendao.annotation.Entity; -import org.greenrobot.greendao.annotation.Generated; -import org.greenrobot.greendao.annotation.Id; - -import java.util.Date; - -@Entity -public class CallHistory { - @Id(autoincrement = true) - private Long id; - - private String email; - - private String person; - - private Date date; - - private String direction; - - @Generated(hash = 939102572) - public CallHistory(Long id, String email, String person, Date date, - String direction) { - this.id = id; - this.email = email; - this.person = person; - this.date = date; - this.direction = direction; - } - - @Generated(hash = 390849564) - public CallHistory() { - } - - public Long getId() { - return this.id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getPerson() { - return this.person; - } - - public void setPerson(String person) { - this.person = person; - } - - public Date getDate() { - return this.date; - } - - public void setDate(Date date) { - this.date = date; - } - - public String getDirection() { - return this.direction; - } - - public void setDirection(String direction) { - this.direction = direction; - } - - public String getEmail() { - return this.email; - } - - public void setEmail(String email) { - this.email = email; - } - -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/service/AwakeService.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/service/AwakeService.java deleted file mode 100644 index 6c236ad..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/service/AwakeService.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.ciscowebex.androidsdk.kitchensink.service; - -import android.app.Notification; -import android.app.NotificationChannel; -import android.app.NotificationManager; -import android.app.Service; -import android.content.Context; -import android.content.Intent; -import android.os.Build; -import android.os.IBinder; -import android.os.PowerManager; -import android.support.annotation.Nullable; -import android.support.v4.app.NotificationCompat; - -import com.ciscowebex.androidsdk.kitchensink.R; -import com.github.benoitdion.ln.Ln; - -public class AwakeService extends Service { - private PowerManager.WakeLock wl; - @Nullable - @Override - public IBinder onBind(Intent intent) { - return null; - } - - @Override - public int onStartCommand(Intent intent, int flags, int startId) { - PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); - if (null != pm){ - wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "kitchensink:AwakeServiceTag"); - wl.acquire(3000); - } - - NotificationManager notifyManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); - if (null != notifyManager) { - Notification notification; - String channelId = "Kichensink_channel_id"; - String channelName = "Kichensink_channel_name"; - String title = "Cisco Kichensink"; - String text = "Calling"; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - NotificationChannel mChannel = new NotificationChannel(channelId, channelName, NotificationManager.IMPORTANCE_HIGH); - notifyManager.createNotificationChannel(mChannel); - notification = new Notification.Builder(this, channelId) - .setContentTitle(title) - .setContentText(text) - .setOngoing(true) - .setNumber(1) - .setWhen(System.currentTimeMillis()) - .setVisibility(Notification.VISIBILITY_PUBLIC) - .setSmallIcon(R.mipmap.ic_launcher) - .build(); - } else { - NotificationCompat.Builder builder = new NotificationCompat.Builder(this, channelId) - .setSmallIcon(R.mipmap.ic_launcher) - .setContentTitle(title) - .setContentText(text) - .setOngoing(true) - .setNumber(1) - .setPriority(NotificationCompat.PRIORITY_MAX) - .setWhen(System.currentTimeMillis()) - .setVisibility(NotificationCompat.VISIBILITY_PUBLIC); - notification = builder.build(); - } - startForeground(0x101, notification); - } - return START_STICKY; - } - - @Override - public void onDestroy() { - super.onDestroy(); - if (null != wl && wl.isHeld()) - wl.release(); - stopForeground(true); - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/service/FloatWindowService.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/service/FloatWindowService.java deleted file mode 100644 index 60548f5..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/service/FloatWindowService.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.ciscowebex.androidsdk.kitchensink.service; - -import android.app.ActivityManager; -import android.app.Service; -import android.content.Context; -import android.content.Intent; -import android.os.Binder; -import android.os.Build; -import android.os.Handler; -import android.os.IBinder; -import android.support.annotation.Nullable; -import android.util.Pair; -import android.view.Gravity; -import android.view.LayoutInflater; -import android.view.MotionEvent; -import android.view.View; -import android.view.WindowManager; -import android.widget.FrameLayout; - -import com.ciscowebex.androidsdk.kitchensink.R; -import com.ciscowebex.androidsdk.kitchensink.actions.WebexAgent; -import com.ciscowebex.androidsdk.kitchensink.actions.events.OnDisconnectEvent; -import com.github.benoitdion.ln.Ln; - -import org.greenrobot.eventbus.EventBus; -import org.greenrobot.eventbus.Subscribe; -import org.greenrobot.eventbus.ThreadMode; - -import java.util.List; - -public class FloatWindowService extends Service { - private WindowManager windowManager; - private View floatingView; - private WebexAgent agent; - - @Nullable - @Override - public IBinder onBind(Intent intent) { - return new MyBinder(); - } - - public class MyBinder extends Binder { - public FloatWindowService getService() { - return FloatWindowService.this; - } - } - - @Override - public void onCreate() { - super.onCreate(); - EventBus.getDefault().register(this); - } - - public void setAgent(WebexAgent agent) { - this.agent = agent; - initWindow(); - initFloating(); - } - - private void initWindow() { - windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE); - WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - layoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; - } else { - layoutParams.type = WindowManager.LayoutParams.TYPE_PHONE; - } - layoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | - WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | - WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | - WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | - WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR | - WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH; - layoutParams.width = WindowManager.LayoutParams.WRAP_CONTENT; - layoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT; - layoutParams.gravity = Gravity.LEFT | Gravity.TOP; - layoutParams.x = windowManager.getDefaultDisplay().getWidth(); - layoutParams.y = 210; - LayoutInflater layoutInflater = LayoutInflater.from(getApplicationContext()); - floatingView = layoutInflater.inflate(R.layout.remote_video_view, null); - View remoteView = floatingView.findViewById(R.id.view_video); - View localView = floatingView.findViewById(R.id.view_video2); - windowManager.addView(floatingView, layoutParams); - new Handler().postDelayed(() -> agent.setVideoRenderViews(new Pair<>(localView, remoteView)), 500); - } - - private void initFloating() { - FrameLayout frameLayout = floatingView.findViewById(R.id.frameLayout); - frameLayout.setOnClickListener(v -> setTopApp(getApplicationContext())); - } - - @Override - public void onDestroy() { - super.onDestroy(); - if (null != windowManager && null != floatingView) - windowManager.removeView(floatingView); - EventBus.getDefault().unregister(this); - } - - @SuppressWarnings("unused") - @Subscribe - public void onEvent(OnDisconnectEvent event) { - if (isRunningForeground(getApplicationContext())) - return; - setTopApp(getApplicationContext()); - new Handler().postDelayed(() -> EventBus.getDefault().post(event), 500); - } - - public static void setTopApp(Context context) { - if (!isRunningForeground(context)) { - ActivityManager activityManager = (ActivityManager) context.getSystemService(ACTIVITY_SERVICE); - if (null == activityManager) - return; - List taskList = activityManager.getRunningTasks(100); - for (ActivityManager.RunningTaskInfo rti : taskList) { - if (rti.topActivity.getPackageName().equals(context.getPackageName())) { - activityManager.moveTaskToFront(rti.id, 0); - return; - } - } - } - } - - public static boolean isRunningForeground(Context context) { - ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); - if (null == activityManager) - return false; - List appProcessInfoList = activityManager.getRunningAppProcesses(); - for (ActivityManager.RunningAppProcessInfo appProcessInfo : appProcessInfoList) { - if (appProcessInfo.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND) { - if (appProcessInfo.processName.equals(context.getApplicationInfo().processName)) { - return true; - } - } - } - return false; - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/ui/BaseFragment.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/ui/BaseFragment.java deleted file mode 100644 index 17d9fed..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/ui/BaseFragment.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.ui; - - -import android.app.Activity; -import android.app.Fragment; -import android.app.FragmentTransaction; -import android.app.ProgressDialog; -import android.os.Bundle; -import android.text.TextUtils; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.Toast; - -import org.greenrobot.eventbus.EventBus; -import org.greenrobot.eventbus.Subscribe; - -import butterknife.ButterKnife; - -/** - * A simple {@link Fragment} subclass. - * Use the {@link BaseFragment#newInstance} factory method to - * create an instance of this fragment. - */ -public class BaseFragment extends Fragment { - - protected static final String LAYOUT = "layout"; - protected int layout; - private ProgressDialog dialog; - - public BaseFragment() { - // Required empty public constructor - } - - public String getName() { - return this.getClass().getSimpleName(); - } - - /** - * Use this factory method to create a new instance of - * this fragment using the provided parameters. - * - * @param cls: Fragment class - * @return A new instance of fragment depends on cls. - */ - public static BaseFragment newInstance(Class cls, int layout) { - BaseFragment fragment = null; - try { - fragment = (BaseFragment) cls.newInstance(); - fragment.setLayout(layout); - } catch (ReflectiveOperationException e) { - e.printStackTrace(); - } - return fragment; - } - - /** - * Use this method to set Fragment's layout - * this method is not dynamic, should call after fragment created. - * - * @param layout - */ - public void setLayout(int layout) { - Bundle args = new Bundle(); - args.putInt(LAYOUT, layout); - setArguments(args); - } - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - if (getArguments() != null) { - layout = getArguments().getInt(LAYOUT); - } - } - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View rootView = inflater.inflate(layout, container, false); - ButterKnife.bind(this, rootView); - return rootView; - } - - @Override - public void onStart() { - super.onStart(); - EventBus.getDefault().register(this); - } - - @Override - public void onStop() { - EventBus.getDefault().unregister(this); - super.onStop(); - } - - public void onBackPressed() { - - } - - /* for activity */ - public void replace(Activity activity, int resourceId) { - FragmentTransaction transaction; - transaction = activity.getFragmentManager().beginTransaction(); - transaction.replace(resourceId, this); - transaction.addToBackStack(null); - transaction.commit(); - } - - // TODO: extract progressDialog out - public void showBusyIndicator(String title, String message) { - dialog = ProgressDialog.show(getActivity(), title, message); - } - - public void dismissBusyIndicator() { - if (dialog != null && dialog.isShowing()) { - dialog.dismiss(); - dialog = null; - } - } - - public void toast(String message) { - Toast.makeText(getActivity(), message, Toast.LENGTH_LONG).show(); - } - - public static boolean isValidEmail(CharSequence target) { - return !TextUtils.isEmpty(target) && android.util.Patterns.EMAIL_ADDRESS.matcher(target).matches(); - } - - /* Only use for debug */ - @SuppressWarnings("unused") - @Subscribe - public void onEvent(Object event) { - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/ui/CircleTransform.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/ui/CircleTransform.java deleted file mode 100644 index b9c415f..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/ui/CircleTransform.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.ui; - -import android.graphics.Bitmap; -import android.graphics.BitmapShader; -import android.graphics.Canvas; -import android.graphics.Paint; - -import com.squareup.picasso.Transformation; - -/** - * Created on 17/09/2017. - */ - -public class CircleTransform implements Transformation { - @Override - public Bitmap transform(Bitmap source) { - int size = Math.min(source.getWidth(), source.getHeight()); - - int x = (source.getWidth() - size) / 2; - int y = (source.getHeight() - size) / 2; - - Bitmap squaredBitmap = Bitmap.createBitmap(source, x, y, size, size); - if (squaredBitmap != source) { - source.recycle(); - } - - Bitmap bitmap = Bitmap.createBitmap(size, size, source.getConfig()); - - Canvas canvas = new Canvas(bitmap); - Paint paint = new Paint(); - BitmapShader shader = new BitmapShader(squaredBitmap, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP); - paint.setShader(shader); - paint.setAntiAlias(true); - - float r = size / 2f; - canvas.drawCircle(r, r, r, paint); - - squaredBitmap.recycle(); - return bitmap; - } - - @Override - public String key() { - return "circle"; - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/ui/FullScreenSwitcher.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/ui/FullScreenSwitcher.java deleted file mode 100644 index 3a85a7f..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/ui/FullScreenSwitcher.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.ui; - -import android.app.ActionBar; -import android.app.Activity; -import android.support.constraint.ConstraintLayout; -import android.support.constraint.ConstraintSet; -import android.view.View; -import android.view.WindowManager; - -/** - * Created on 27/09/2017. - */ - -public class FullScreenSwitcher { - private ConstraintSet originSet = new ConstraintSet(); - private ConstraintSet fullScreenSet = new ConstraintSet(); - private ConstraintLayout layout; - private View view; - private boolean isFullScreen; - - private Activity activity; - - public FullScreenSwitcher(Activity activity, ConstraintLayout layout, View view) { - this.activity = activity; - this.layout = layout; - this.view = view; - this.isFullScreen = false; - - originSet.clone(layout); - fullScreenSet.clone(layout); - fullScreenSet.setMargin(view.getId(), ConstraintSet.START, 0); - fullScreenSet.setMargin(view.getId(), ConstraintSet.END, 0); - fullScreenSet.setMargin(view.getId(), ConstraintSet.LEFT, 0); - fullScreenSet.setMargin(view.getId(), ConstraintSet.RIGHT, 0); - fullScreenSet.setMargin(view.getId(), ConstraintSet.TOP, 0); - fullScreenSet.setMargin(view.getId(), ConstraintSet.BOTTOM, 0); - fullScreenSet.setElevation(view.getId(), 0); - fullScreenSet.connect(view.getId(), ConstraintSet.BOTTOM, ConstraintSet.PARENT_ID, ConstraintSet.BOTTOM); - } - - public void toggleFullScreen() { - isFullScreen = !isFullScreen; - if (isFullScreen) { - fullScreen(); - } else { - restore(); - } - } - - public boolean isFullScreen(){ - return isFullScreen; - } - - private void fullScreen() { - activity.getWindow().setFlags( - WindowManager.LayoutParams.FLAG_FULLSCREEN, - WindowManager.LayoutParams.FLAG_FULLSCREEN); - - ActionBar actionBar = activity.getActionBar(); - if (actionBar != null) actionBar.hide(); - updateOnRotation(); - } - - private void restore() { - activity.getWindow().clearFlags( - WindowManager.LayoutParams.FLAG_FULLSCREEN); - - ActionBar actionBar = activity.getActionBar(); - if (actionBar != null) actionBar.show(); - - originSet.applyTo(layout); - } - - public void updateOnRotation() { - if (isFullScreen) { - int width = activity.getResources().getDisplayMetrics().widthPixels; - int height = activity.getResources().getDisplayMetrics().heightPixels; - - view.bringToFront(); - fullScreenSet.constrainWidth(view.getId(), width); - fullScreenSet.constrainHeight(view.getId(), height); - fullScreenSet.applyTo(layout); - } - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/ui/ListPageAdapter.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/ui/ListPageAdapter.java deleted file mode 100644 index 94591ca..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/ui/ListPageAdapter.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2016-2017 Cisco Systems Inc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -package com.ciscowebex.androidsdk.kitchensink.ui; - - -import android.app.Fragment; -import android.app.FragmentManager; -import android.support.v13.app.FragmentPagerAdapter; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created on 16/09/2017. - */ - -public class ListPageAdapter extends FragmentPagerAdapter { - private List fragments; - - public ListPageAdapter(FragmentManager fm) { - super(fm); - this.fragments = new ArrayList<>(); - } - - @Override - public Fragment getItem(int position) { - return fragments.get(position); - } - - @Override - public int getCount() { - return fragments.size(); - } - - @Override - public CharSequence getPageTitle(int position) { - return null; - } - - public void add(T fragment) { - fragments.add(fragment); - } -} diff --git a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/ui/ParticipantsAdapter.java b/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/ui/ParticipantsAdapter.java deleted file mode 100644 index 9c41f3c..0000000 --- a/app/src/main/java/com/ciscowebex/androidsdk/kitchensink/ui/ParticipantsAdapter.java +++ /dev/null @@ -1,306 +0,0 @@ -package com.ciscowebex.androidsdk.kitchensink.ui; - -import android.support.annotation.NonNull; -import android.support.v7.widget.RecyclerView; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.Button; -import android.widget.ImageView; -import android.widget.TextView; - -import com.ciscowebex.androidsdk.kitchensink.R; -import com.ciscowebex.androidsdk.phone.CallMembership; -import com.squareup.picasso.Picasso; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - -import butterknife.BindView; -import butterknife.ButterKnife; - -public class ParticipantsAdapter extends RecyclerView.Adapter { - private List mDataSet; - private String activeSpeakerId = null; - private OnLetInClickListener onLetInClickListener; - - public interface OnLetInClickListener { - void onLetInClick(CallMembershipEntity entity); - } - - - public static class CallMembershipEntity { - private String mPersonId; - private String mName; - private String mAvatarUrl; - private boolean mSendingAudio; - private boolean mSendingVideo; - private CallMembership.State mState; - private boolean mIsHeader = false; - - private CallMembershipEntity() { - } - - public CallMembershipEntity(String personId, String name, String avatarUrl, boolean sendingAudio, boolean sendingVideo, CallMembership.State state) { - this.mPersonId = personId; - this.mName = name; - this.mAvatarUrl = avatarUrl; - this.mSendingAudio = sendingAudio; - this.mSendingVideo = sendingVideo; - this.mState = state; - } - - public String getPersonId() { - return mPersonId; - } - } - - public void setOnLetInClickListener(OnLetInClickListener onLetInClickListener) { - this.onLetInClickListener = onLetInClickListener; - } - - static class MyHeaderViewHolder extends RecyclerView.ViewHolder { - @BindView(R.id.txt_header) - TextView mHeader; - - MyHeaderViewHolder(View item) { - super(item); - ButterKnife.bind(this, item); - } - - void setHeader(String header) { - mHeader.setText(header); - } - } - - static class MyViewHolder extends RecyclerView.ViewHolder { - - @BindView(R.id.txt_name) - TextView mName; - - @BindView(R.id.txt_active_speaker) - TextView mActiveSpeaker; - - @BindView(R.id.img_avatar) - ImageView mAvatar; - - @BindView(R.id.img_audio) - ImageView mAudio; - - @BindView(R.id.img_video) - ImageView mVideo; - - @BindView(R.id.btn_let_in) - Button mLetIn; - - MyViewHolder(View item) { - super(item); - ButterKnife.bind(this, item); - } - - void setName(String name) { - mName.setText(name); - } - - void setActiveSpeaker(boolean activeSpeaker) { - mActiveSpeaker.setVisibility(activeSpeaker ? View.VISIBLE : View.GONE); - } - - void setSendingAudio(boolean sendingAudio) { - int res = sendingAudio ? android.R.drawable.presence_audio_online : android.R.drawable.presence_audio_away; - mAudio.setImageResource(res); - } - - void setSendingVideo(boolean sendingVideo) { - int res = sendingVideo ? android.R.drawable.presence_video_online : android.R.drawable.presence_video_away; - mVideo.setImageResource(res); - } - - void setAvatar(String avatarUrl) { - Picasso.with(itemView.getContext()).cancelRequest(mAvatar); - if (avatarUrl == null || avatarUrl.isEmpty()) { - mAvatar.setImageResource(R.drawable.google_contacts_android); - } else { - Picasso.with(itemView.getContext()).load(avatarUrl).fit().into(mAvatar); - } - } - } - - public ParticipantsAdapter(List data) { - mDataSet = data; - } - - @NonNull - @Override - public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - if (viewType == 1) { - View item = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_item_participant, parent, false); - MyViewHolder vh = new MyViewHolder(item); - return vh; - } else { - View item = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_item_participant_header, parent, false); - MyHeaderViewHolder vh = new MyHeaderViewHolder(item); - return vh; - } - } - - @Override - public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { - CallMembershipEntity entity = mDataSet.get(position); - if (holder instanceof MyViewHolder) { - MyViewHolder myViewHolder = (MyViewHolder) holder; - myViewHolder.setName(entity.mName); - myViewHolder.setActiveSpeaker(activeSpeakerId != null && entity.mPersonId.equals(activeSpeakerId)); - myViewHolder.setSendingAudio(entity.mSendingAudio); - myViewHolder.setSendingVideo(entity.mSendingVideo); - myViewHolder.setAvatar(entity.mAvatarUrl); - myViewHolder.mLetIn.setVisibility(entity.mState == CallMembership.State.WAITING ? View.VISIBLE : View.GONE); - if (onLetInClickListener != null) { - myViewHolder.mLetIn.setOnClickListener(v -> onLetInClickListener.onLetInClick(entity)); - } - } else if (holder instanceof MyHeaderViewHolder) { - MyHeaderViewHolder myHeaderViewHolder = (MyHeaderViewHolder) holder; - myHeaderViewHolder.setHeader(entity.mName); - } - } - - @Override - public int getItemViewType(int position) { - CallMembershipEntity entity = mDataSet.get(position); - return entity.mIsHeader ? 0 : 1; - } - - - @Override - public int getItemCount() { - return mDataSet == null ? 0 : mDataSet.size(); - } - - public boolean addOrUpdateItem(CallMembershipEntity entity) { - if (entity == null) return false; - if (mDataSet == null) { - mDataSet = new ArrayList<>(); - } - int pos = findItem(entity.mPersonId); - if (pos == -1) { - mDataSet.add(entity); - } else { - mDataSet.set(pos, entity); - } - makeData(); - notifyDataSetChanged(); - return true; - } - - private void makeData() { - CallMembership.State lastState = null; - List dataSet = new ArrayList<>(); - for (CallMembershipEntity entity: mDataSet){ - if (entity.mIsHeader) - dataSet.add(entity); - } - mDataSet.removeAll(dataSet); - Collections.sort(mDataSet, new MComparator()); - dataSet.clear(); - for (CallMembershipEntity entity : mDataSet) { - if (null == lastState) { - CallMembershipEntity e = new CallMembershipEntity(); - e.mName = entity.mState == CallMembership.State.JOINED ? "In Meeting" : entity.mState == CallMembership.State.WAITING ? "In Lobby" : "Not in Meeting"; - e.mIsHeader = true; - dataSet.add(e); - } else if (lastState != entity.mState) { - CallMembershipEntity e = new CallMembershipEntity(); - e.mName = entity.mState == CallMembership.State.JOINED ? "In Meeting" : entity.mState == CallMembership.State.WAITING ? "In Lobby" : "Not in Meeting"; - e.mIsHeader = true; - dataSet.add(e); - } - dataSet.add(entity); - lastState = entity.mState; - } - mDataSet.clear(); - mDataSet.addAll(dataSet); - } - - public boolean removeItem(String personId) { - int pos = findItem(personId); - if (pos == -1) return false; - mDataSet.remove(pos); - makeData(); - notifyDataSetChanged(); - return true; - } - - public boolean updateName(String personId, String name) { - int pos = findItem(personId); - if (pos == -1) return false; - mDataSet.get(pos).mName = name; - notifyDataSetChanged(); - return true; - } - - public boolean updateAvatar(String personId, String avatar) { - int pos = findItem(personId); - if (pos == -1) return false; - mDataSet.get(pos).mAvatarUrl = avatar; - notifyDataSetChanged(); - return true; - } - - public boolean updateSendingAudioStatus(String personId, boolean sendingAudio) { - int pos = findItem(personId); - if (pos == -1) return false; - mDataSet.get(pos).mSendingAudio = sendingAudio; - notifyDataSetChanged(); - return true; - } - - public boolean updateSendingVideoStatus(String personId, boolean sendingVideo) { - int pos = findItem(personId); - if (pos == -1) return false; - mDataSet.get(pos).mSendingVideo = sendingVideo; - notifyDataSetChanged(); - return true; - } - - public void updateActiveSpeaker(String personId) { - activeSpeakerId = personId; - notifyDataSetChanged(); - } - - public String getActiveSpeaker() { - return activeSpeakerId; - } - - private int findItem(String personId) { - if (mDataSet == null || personId == null) return -1; - int pos = -1; - for (int i = 0; i < mDataSet.size(); i++) { - if (mDataSet.get(i).mPersonId == null) - continue; - if (mDataSet.get(i).mPersonId.equals(personId)) { - pos = i; - break; - } - } - return pos; - } - - class MComparator implements Comparator { - - @Override - public int compare(CallMembershipEntity o1, CallMembershipEntity o2) { - if (o1.mState == o2.mState) - return 0; - if (o1.mState == CallMembership.State.WAITING) - return -1; - if (o2.mState == CallMembership.State.WAITING) - return 1; - if (o1.mState == CallMembership.State.JOINED) - return -1; - else - return 1; - } - } -} \ No newline at end of file diff --git a/app/src/main/res/drawable/border.xml b/app/src/main/res/drawable/border.xml deleted file mode 100644 index 6e8b2ac..0000000 --- a/app/src/main/res/drawable/border.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/google_contacts_android.png b/app/src/main/res/drawable/google_contacts_android.png deleted file mode 100644 index 224ea81..0000000 Binary files a/app/src/main/res/drawable/google_contacts_android.png and /dev/null differ diff --git a/app/src/main/res/drawable/ic_arrow_down_12_blue.xml b/app/src/main/res/drawable/ic_arrow_down_12_blue.xml deleted file mode 100644 index d3c92c3..0000000 --- a/app/src/main/res/drawable/ic_arrow_down_12_blue.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_file_excel.png b/app/src/main/res/drawable/ic_file_excel.png deleted file mode 100755 index 518aba6..0000000 Binary files a/app/src/main/res/drawable/ic_file_excel.png and /dev/null differ diff --git a/app/src/main/res/drawable/ic_file_unknown.xml b/app/src/main/res/drawable/ic_file_unknown.xml deleted file mode 100644 index b4fb866..0000000 --- a/app/src/main/res/drawable/ic_file_unknown.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_file_word.png b/app/src/main/res/drawable/ic_file_word.png deleted file mode 100755 index 4853541..0000000 Binary files a/app/src/main/res/drawable/ic_file_word.png and /dev/null differ diff --git a/app/src/main/res/drawable/ic_file_zip.png b/app/src/main/res/drawable/ic_file_zip.png deleted file mode 100755 index 915c856..0000000 Binary files a/app/src/main/res/drawable/ic_file_zip.png and /dev/null differ diff --git a/app/src/main/res/drawable/round_green.xml b/app/src/main/res/drawable/round_green.xml deleted file mode 100644 index 04fe071..0000000 --- a/app/src/main/res/drawable/round_green.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/round_pink.xml b/app/src/main/res/drawable/round_pink.xml deleted file mode 100644 index d60758a..0000000 --- a/app/src/main/res/drawable/round_pink.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/underline.xml b/app/src/main/res/drawable/underline.xml deleted file mode 100644 index 8eb48ef..0000000 --- a/app/src/main/res/drawable/underline.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/drawable/webex.png b/app/src/main/res/drawable/webex.png deleted file mode 100644 index ec4bbfb..0000000 Binary files a/app/src/main/res/drawable/webex.png and /dev/null differ diff --git a/app/src/main/res/layout/activity_launcher.xml b/app/src/main/res/layout/activity_launcher.xml deleted file mode 100644 index 7f3367d..0000000 --- a/app/src/main/res/layout/activity_launcher.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - diff --git a/app/src/main/res/layout/fragment_call.xml b/app/src/main/res/layout/fragment_call.xml deleted file mode 100644 index ec662fa..0000000 --- a/app/src/main/res/layout/fragment_call.xml +++ /dev/null @@ -1,331 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -