diff --git a/android-ui-kit-sample/.gitignore b/android-ui-kit-sample/.gitignore new file mode 100644 index 000000000..aa724b770 --- /dev/null +++ b/android-ui-kit-sample/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/android-ui-kit-sample/.idea/.gitignore b/android-ui-kit-sample/.idea/.gitignore new file mode 100644 index 000000000..26d33521a --- /dev/null +++ b/android-ui-kit-sample/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/android-ui-kit-sample/.idea/androidTestResultsUserPreferences.xml b/android-ui-kit-sample/.idea/androidTestResultsUserPreferences.xml new file mode 100644 index 000000000..21a3ed199 --- /dev/null +++ b/android-ui-kit-sample/.idea/androidTestResultsUserPreferences.xml @@ -0,0 +1,135 @@ + + + + + + \ No newline at end of file diff --git a/android-ui-kit-sample/.idea/compiler.xml b/android-ui-kit-sample/.idea/compiler.xml new file mode 100644 index 000000000..fb7f4a8a4 --- /dev/null +++ b/android-ui-kit-sample/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/android-ui-kit-sample/.idea/copyright/QuickBLox.xml b/android-ui-kit-sample/.idea/copyright/QuickBLox.xml new file mode 100644 index 000000000..dbbcfcfad --- /dev/null +++ b/android-ui-kit-sample/.idea/copyright/QuickBLox.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/android-ui-kit-sample/.idea/copyright/profiles_settings.xml b/android-ui-kit-sample/.idea/copyright/profiles_settings.xml new file mode 100644 index 000000000..44cd4c33f --- /dev/null +++ b/android-ui-kit-sample/.idea/copyright/profiles_settings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/android-ui-kit-sample/.idea/gradle.xml b/android-ui-kit-sample/.idea/gradle.xml new file mode 100644 index 000000000..66ff96180 --- /dev/null +++ b/android-ui-kit-sample/.idea/gradle.xml @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file diff --git a/android-ui-kit-sample/.idea/jarRepositories.xml b/android-ui-kit-sample/.idea/jarRepositories.xml new file mode 100644 index 000000000..3d1de0cc1 --- /dev/null +++ b/android-ui-kit-sample/.idea/jarRepositories.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/android-ui-kit-sample/.idea/misc.xml b/android-ui-kit-sample/.idea/misc.xml new file mode 100644 index 000000000..34f29a6bf --- /dev/null +++ b/android-ui-kit-sample/.idea/misc.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/android-ui-kit-sample/.idea/vcs.xml b/android-ui-kit-sample/.idea/vcs.xml new file mode 100644 index 000000000..6c0b86358 --- /dev/null +++ b/android-ui-kit-sample/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/android-ui-kit-sample/README.md b/android-ui-kit-sample/README.md new file mode 100644 index 000000000..4cfb54ece --- /dev/null +++ b/android-ui-kit-sample/README.md @@ -0,0 +1,316 @@ +# Overview + +The QuickBlox UIKit for Android is a comprehensive user interface kit specifically designed for building chat applications. It provides a collection of pre-built components, modules, and utilities that simplify the process of creating chat applications. + +The main goal of the QuickBlox UIKit for Android is to offer developers a streamlined and efficient way to implement chat functionality within their Android applications. + +The QuickBlox UIKit for Android offers modules that encapsulate complex chat functionalities, such as dialogs and chat management and real-time updates. These modules provide a simplified interface for integrating chat features into applications without the need for extensive knowledge of the underlying protocols or server-side infrastructure. + +# Features + +QuickBlox UIKit for Android provides next functionality: +- List of dialogs +- Create dialog(Private or Group) +- Dialog screen +- Send text, image, video, audio, file messages +- Dialog info screen +- List, invite, remove members + +# Send your first message + +The QuickBlox UIKit for Android comprises a collection of pre-assembled UI components that enable effortless creation of an in-app chat equipped with all the necessary messaging functionalities. Our development kit encompasses light and dark themes, colors, and various other features. These components can be personalized to fashion an engaging messaging interface that reflects your brand's distinct identity. + +The QuickBlox UIKit fully supports both private and group dialogs. To initiate the process of sending a message from the ground up using Java or Kotlin, please refer to the instructions provided in the guide below. + +## Requirements + +The minimum requirements for QuickBlox UIKit for Android are: +- Android 5.0 (API level 21) or higher +- Java 8 or higher +- Android Gradle plugin 4.0.1 or higher + +## Before you begin + +Register a new account following [this link](https://admin.quickblox.com/signup). Type in your email and password to sign in. You can also sign in with your Google or Github accounts. +Create the app clicking New app button. +Configure the app. Type in the information about your organization into corresponding fields and click Add button. +Go to Dashboard => YOUR_APP => Overview section and copy your Application ID, Authorization Key, Authorization Secret, and Account Key . + +## Install QuickBlox UIKit + +There are several ways to install to QuickBlox UIKit from: +- Repository +- Local source + +### Install QuickBlox UIKit from repository +To install QuickBlox UIKit to your app, import QuickBlox UIKit and QuickBlox SDK dependencies via build.gradle file. +Include reference to SDK repository in your **project-level build.gradle** file at the root directory or to **settings.gradle** file. Specify the URL of QuickBlox repository where the files are stored. Following this URL, gradle finds SDK artifacts. + +``` +repositories { + maven { + url "https://github.com/QuickBlox/android-ui-kit-releases/raw/master/" + } + maven { + url "https://github.com/QuickBlox/quickblox-android-sdk-releases/raw/master/" + } +} +``` + +Then need to add implementation of QuickBlox UIKit and QuickBlox SDK to dependencies in your module-level(App) **build.gradle** file. + +``` +dependencies { + implementation "com.quickblox:android-ui-kit:0.1.1" + + implementation 'com.quickblox:quickblox-android-sdk-messages:4.1.1' + implementation 'com.quickblox:quickblox-android-sdk-chat:4.1.1' + implementation 'com.quickblox:quickblox-android-sdk-content:4.1.1' +} +``` + +### Install QuickBlox UIKit from local source +To connect QuickBlox SDK to your app, import QuickBlox SDK dependencies via build.gradle file. +Include reference to SDK repository in your **project-level build.gradle** file at the root directory or to **settings.gradle** file. Specify the URL of QuickBlox repository where the files are stored. Following this URL, gradle finds SDK artifacts. + +``` +repositories { + google() + mavenCentral() + maven { + url "https://github.com/QuickBlox/quickblox-android-sdk-releases/raw/master/" + } +} +``` + +Then need to download the QuickBlox UIKit from the GitHub repository at [this link](https://github.com/QuickBlox/android-ui-kit) to include UIKit locally in your project. + +Specify the path of the UIKit project in **settings.gradle** file. + +``` +include ':ui-kit' +project(':ui-kit').projectDir = new File('YourPath/android-ui-kit/ui-kit') +``` + +Also, need to add implementation of UIKit project to dependencies in your module-level(App) **build.gradle** file. + +``` +dependencies { + implementation project(':ui-kit') +} +``` + +## Init QuickBlox SDK + +To init QuickBlox SDK you need to pass Application ID, Authorization Key, Authorization Secret, and Account Key to the init() method. +How to get credentials is described in the [Before you begin](#before-you-begin) section. +``` +private const val APPLICATION_ID = "67895" +private const val AUTH_KEY = "lkjdueksu7392kj" +private const val AUTH_SECRET = "BTFsj7Rtt27DAmT" +private const val ACCOUNT_KEY = "9yvTe17TmjNPqDoYtfqp" + +QBSDK.init(applicationContext, APPLICATION_ID, AUTH_KEY, AUTH_SECRET, ACCOUNT_KEY) +``` + +## Authentication and start QuickBlox UIKit + +Before sending your first message you need to authenticate users in the QuickBlox system. You can read more about different ways of authentication by [this link](https://docs.quickblox.com/docs/android-authentication). +In our example we show how to authenticate user with login and password. +After successfully sign-in, you need to initialize the QuickBlox UIKit by invoke **init(applicationContext)** method of the **QuickBloxUiKit** and start Dialogs screen by invoke **show()** method of the **DialogActivity**. + +``` +val user = QBUser() +user.login = "userlogin" +user.password = "userpassword" + +QBUsers.signIn(user).performAsync(object : QBEntityCallback { + override fun onSuccess(user: QBUser?, bundle: Bundle?) { + // init Quickblox UIKit + QuickBloxUiKit.init(applicationContext) + // show Dialogs screen + DialogsActivity.show(context) + } + + override fun onError(exception: QBResponseException?) { + // handle exception + } +}) +``` + +# Customization + +The QuickBlox UIKit for Android allows you to create your own unique view of the UIKit. + +## Default themes + +The QuickBlox UIKit for Android has 2 built in themes: DarkUiKitTheme and LightUiKitTheme. +Default theme for UIKit is LightUiKitTheme. +To set theme you need to call QuickBloxUiKit.setTheme() method with chosen theme. +This method must be called before starting screens. + +``` +QuickBloxUiKit.setTheme(DarkUiKitTheme()) +``` + +## Use your own theme + +There are two options how you can create your own theme: +- Customize current theme +- Create your own theme + +To customize the current theme you just need to get it and set the color that you need. + +``` +QuickBloxUiKit.getTheme().setMainBackgroundColor("#FFFFFF") +``` + +Or you can create your own theme. To do this you need to create a new class that implements the UiKitTheme interface. + +``` +class CustomUiKitTheme : UiKitTheme { + private var mainBackgroundColor: String = "#FFFFFF" + private var statusBarColor: String = "#E4E6E8" + private var mainElementsColor: String = "#3978FC" + private var secondaryBackgroundColor: String = "#E7EFFF" + private var mainTextColor: String = "#0B121B" + private var disabledElementsColor: String = "#BCC1C5" + private var secondaryTextColor: String = "#636D78" + private var secondaryElementsColor: String = "#202F3E" + private var dividerColor: String = "#E7EFFF" + private var incomingMessageColor: String = "#E4E6E8" + private var outgoingMessageColor: String = "#E7EFFF" + private var inputBackgroundColor: String = "#E4E6E8" + private var tertiaryElementsColor: String = "#636D78" + private var errorColor: String = "#FF766E" +​ + override fun getMainBackgroundColor(): Int { + return parseColorToIntFrom(mainBackgroundColor) + } +​ + override fun setMainBackgroundColor(colorString: String) { + mainBackgroundColor = colorString + } +​ + override fun getStatusBarColor(): Int { + return parseColorToIntFrom(statusBarColor) + } +​ + override fun setStatusBarColor(colorString: String) { + statusBarColor = colorString + } +​ + override fun getMainElementsColor(): Int { + return parseColorToIntFrom(mainElementsColor) + } +​ + override fun setMainElementsColor(colorString: String) { + mainElementsColor = colorString + } +​ + override fun getSecondaryBackgroundColor(): Int { + return parseColorToIntFrom(secondaryBackgroundColor) + } +​ + override fun setSecondaryBackgroundColor(colorString: String) { + secondaryBackgroundColor = colorString + } +​ + override fun setDisabledElementsColor(colorString: String) { + disabledElementsColor = colorString + } +​ + override fun getDisabledElementsColor(): Int { + return parseColorToIntFrom(disabledElementsColor) + } +​ + override fun getMainTextColor(): Int { + return parseColorToIntFrom(mainTextColor) + } +​ + override fun setMainTextColor(colorString: String) { + mainTextColor = colorString + } +​ + override fun setSecondaryTextColor(colorString: String) { + secondaryTextColor = colorString + } +​ + override fun getSecondaryTextColor(): Int { + return parseColorToIntFrom(secondaryTextColor) + } +​ + override fun setSecondaryElementsColor(colorString: String) { + secondaryElementsColor = colorString + } +​ + override fun getIncomingMessageColor(): Int { + return parseColorToIntFrom(incomingMessageColor) + } +​ + override fun setIncomingMessageColor(colorString: String) { + incomingMessageColor = colorString + } +​ + override fun getOutgoingMessageColor(): Int { + return parseColorToIntFrom(outgoingMessageColor) + } +​ + override fun setOutgoingMessageColor(colorString: String) { + outgoingMessageColor = colorString + } +​ + override fun getDividerColor(): Int { + return parseColorToIntFrom(dividerColor) + } +​ + override fun setDividerColor(colorString: String) { + dividerColor = colorString + } +​ + override fun getInputBackgroundColor(): Int { + return parseColorToIntFrom(inputBackgroundColor) + } +​ + override fun setInputBackgroundColor(colorString: String) { + inputBackgroundColor = colorString + } +​ + override fun getTertiaryElementsColor(): Int { + return parseColorToIntFrom(tertiaryElementsColor) + } +​ + override fun setTertiaryElementsColor(colorString: String) { + tertiaryElementsColor = colorString + } +​ + override fun getSecondaryElementsColor(): Int { + return parseColorToIntFrom(secondaryElementsColor) + } +​ + override fun getErrorColor(): Int { + return parseColorToIntFrom(errorColor) + } +​ + override fun setErrorColor(colorString: String) { + errorColor = colorString + } +​ + override fun parseColorToIntFrom(colorString: String): Int { + try { + return Color.parseColor(colorString) + } catch (exception: IllegalArgumentException) { + throw Exception(exception.message.toString()) + } catch (exception: NumberFormatException) { + throw Exception(exception.message.toString()) + } + } +} + +``` + +To use your own theme you just need to set it. This method must be called before starting screens. + +``` +QuickBloxUiKit.setTheme(CustomUiKitTheme()) +``` \ No newline at end of file diff --git a/android-ui-kit-sample/app/build.gradle b/android-ui-kit-sample/app/build.gradle new file mode 100644 index 000000000..7a25fbe61 --- /dev/null +++ b/android-ui-kit-sample/app/build.gradle @@ -0,0 +1,54 @@ +plugins { + id 'com.android.application' + id 'org.jetbrains.kotlin.android' + id 'kotlin-kapt' +} + +android { + compileSdk 33 + + defaultConfig { + applicationId "com.example.android_ui_kit_sample" + minSdk 21 + targetSdk 33 + versionCode 1 + versionName "1.0.0" + } + + buildTypes { + release { + minifyEnabled true + + consumerProguardFiles 'proguard-rules.pro' + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = '1.8' + } + kapt { + correctErrorTypes true + } + buildFeatures { + viewBinding true + } +} + +dependencies { + implementation "com.quickblox:android-ui-kit:0.1.1" + + implementation 'com.quickblox:quickblox-android-sdk-messages:4.1.1' + implementation 'com.quickblox:quickblox-android-sdk-chat:4.1.1' + implementation 'com.quickblox:quickblox-android-sdk-content:4.1.1' + + implementation 'androidx.core:core-ktx:1.10.1' + implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'com.google.android.material:material:1.9.0' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + implementation 'androidx.activity:activity-ktx:1.7.1' +} \ No newline at end of file diff --git a/android-ui-kit-sample/app/proguard-rules.pro b/android-ui-kit-sample/app/proguard-rules.pro new file mode 100644 index 000000000..7541811fe --- /dev/null +++ b/android-ui-kit-sample/app/proguard-rules.pro @@ -0,0 +1,45 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting 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 *; +#} +#-dontusemixedcaseclassnames +#-dontskipnonpubliclibraryclasses +#-verbose + +# Gson uses generic type information stored in a class file when working with fields. Proguard +# removes such information by default, so configure it to keep all of it. +-keepattributes EnclosingMethod +-keepattributes InnerClasses +-keepattributes Signature +-keepattributes Exceptions + +# GSON @Expose annotation +-keepattributes *Annotation* + +# Quickblox sdk +-keep class com.quickblox.** { *; } + +# Smack xmpp library +-keep class org.jxmpp.** { *; } +-keep class org.jivesoftware.** { *; } +-dontwarn org.jivesoftware.** + +# Glide +-keep class com.bumptech.** { *; } + +# Google gms +-keep class com.google.android.gms.** { *; } + +# Json +-keep class org.json.** { *; } \ No newline at end of file diff --git a/android-ui-kit-sample/app/src/main/AndroidManifest.xml b/android-ui-kit-sample/app/src/main/AndroidManifest.xml new file mode 100644 index 000000000..a5ba8134a --- /dev/null +++ b/android-ui-kit-sample/app/src/main/AndroidManifest.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/android-ui-kit-sample/app/src/main/java/com/example/android_ui_kit_sample/App.kt b/android-ui-kit-sample/app/src/main/java/com/example/android_ui_kit_sample/App.kt new file mode 100644 index 000000000..64c81126f --- /dev/null +++ b/android-ui-kit-sample/app/src/main/java/com/example/android_ui_kit_sample/App.kt @@ -0,0 +1,40 @@ +/* + * Created by Injoit on 17.5.2023. + * Copyright © 2023 Quickblox. All rights reserved. + * + */ +package com.example.android_ui_kit_sample + +import android.app.Application +import com.quickblox.QBSDK +import com.quickblox.chat.QBChatService + +// app credentials +private const val APPLICATION_ID = "" +private const val AUTH_KEY = "" +private const val AUTH_SECRET = "" +private const val ACCOUNT_KEY = "" + +class App : Application() { + override fun onCreate() { + super.onCreate() + checkQBCredentials() + initQBSdk() + setChatConfiguration() + } + + private fun checkQBCredentials() { + if (APPLICATION_ID.isEmpty() || AUTH_KEY.isEmpty() || AUTH_SECRET.isEmpty() || ACCOUNT_KEY.isEmpty()) { + throw AssertionError(getString(R.string.error_qb_credentials_empty)) + } + } + + private fun initQBSdk() { + QBSDK.init(applicationContext, APPLICATION_ID, AUTH_KEY, AUTH_SECRET, ACCOUNT_KEY) + } + + private fun setChatConfiguration() { + QBChatService.setDebugEnabled(true) + QBChatService.setDefaultPacketReplyTimeout(10000) + } +} \ No newline at end of file diff --git a/android-ui-kit-sample/app/src/main/java/com/example/android_ui_kit_sample/LoginActivity.kt b/android-ui-kit-sample/app/src/main/java/com/example/android_ui_kit_sample/LoginActivity.kt new file mode 100644 index 000000000..6176a8516 --- /dev/null +++ b/android-ui-kit-sample/app/src/main/java/com/example/android_ui_kit_sample/LoginActivity.kt @@ -0,0 +1,74 @@ +/* + * Created by Injoit on 17.5.2023. + * Copyright © 2023 Quickblox. All rights reserved. + * + */ +package com.example.android_ui_kit_sample + +import android.content.Context +import android.os.Bundle +import android.view.View +import android.view.inputmethod.InputMethodManager +import android.widget.Toast +import androidx.appcompat.app.AppCompatActivity +import com.example.android_ui_kit_sample.databinding.ActivityLoginBinding +import com.quickblox.android_ui_kit.QuickBloxUiKit +import com.quickblox.android_ui_kit.presentation.screens.dialogs.DialogsActivity +import com.quickblox.android_ui_kit.presentation.theme.DarkUiKitTheme +import com.quickblox.android_ui_kit.presentation.theme.UiKitTheme +import com.quickblox.core.QBEntityCallback +import com.quickblox.core.exception.QBResponseException +import com.quickblox.users.QBUsers +import com.quickblox.users.model.QBUser + +class LoginActivity : AppCompatActivity() { + private lateinit var binding: ActivityLoginBinding + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + binding = ActivityLoginBinding.inflate(layoutInflater) + setContentView(binding.root) + + setThemeQBUiKit(DarkUiKitTheme()) + + binding.btnLogin.setOnClickListener { + hideKeyboard(it) + + val user = buildUser() + QBUsers.signIn(user).performAsync(object : QBEntityCallback { + override fun onSuccess(user: QBUser?, bundle: Bundle?) { + initAndShowQBUiKit() + } + + override fun onError(exception: QBResponseException) { + Toast.makeText(this@LoginActivity, exception.message, Toast.LENGTH_LONG).show() + } + }) + } + } + + private fun setThemeQBUiKit(theme: UiKitTheme) { + QuickBloxUiKit.setTheme(theme) + } + + private fun buildUser(): QBUser { + val user = QBUser() + user.login = binding.etLogin.text.toString().trim() + user.password = binding.etPassword.text.toString().trim() + return user + } + + private fun initAndShowQBUiKit() { + QuickBloxUiKit.init(applicationContext) + DialogsActivity.show(this) + } + + private fun hideKeyboard(view: View?) { + view?.post { + view.context + view.clearFocus() + val imm = view.context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager + imm.hideSoftInputFromWindow(view.windowToken, 0) + } + } +} \ No newline at end of file diff --git a/android-ui-kit-sample/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/android-ui-kit-sample/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 000000000..2b068d114 --- /dev/null +++ b/android-ui-kit-sample/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/android-ui-kit-sample/app/src/main/res/drawable/bg_login_button.xml b/android-ui-kit-sample/app/src/main/res/drawable/bg_login_button.xml new file mode 100644 index 000000000..385018d19 --- /dev/null +++ b/android-ui-kit-sample/app/src/main/res/drawable/bg_login_button.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/android-ui-kit-sample/app/src/main/res/drawable/ic_launcher_background.xml b/android-ui-kit-sample/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 000000000..07d5da9cb --- /dev/null +++ b/android-ui-kit-sample/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android-ui-kit-sample/app/src/main/res/drawable/login_background_button_active.xml b/android-ui-kit-sample/app/src/main/res/drawable/login_background_button_active.xml new file mode 100644 index 000000000..31f40f1ce --- /dev/null +++ b/android-ui-kit-sample/app/src/main/res/drawable/login_background_button_active.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/android-ui-kit-sample/app/src/main/res/drawable/login_background_button_inactive.xml b/android-ui-kit-sample/app/src/main/res/drawable/login_background_button_inactive.xml new file mode 100644 index 000000000..04ba84dd1 --- /dev/null +++ b/android-ui-kit-sample/app/src/main/res/drawable/login_background_button_inactive.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/android-ui-kit-sample/app/src/main/res/drawable/login_background_field.xml b/android-ui-kit-sample/app/src/main/res/drawable/login_background_field.xml new file mode 100644 index 000000000..fb1549f20 --- /dev/null +++ b/android-ui-kit-sample/app/src/main/res/drawable/login_background_field.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/android-ui-kit-sample/app/src/main/res/layout/activity_login.xml b/android-ui-kit-sample/app/src/main/res/layout/activity_login.xml new file mode 100644 index 000000000..51d2d4bc5 --- /dev/null +++ b/android-ui-kit-sample/app/src/main/res/layout/activity_login.xml @@ -0,0 +1,167 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android-ui-kit-sample/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android-ui-kit-sample/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 000000000..a06ec7670 Binary files /dev/null and b/android-ui-kit-sample/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android-ui-kit-sample/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/android-ui-kit-sample/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png new file mode 100644 index 000000000..b98204c5a Binary files /dev/null and b/android-ui-kit-sample/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png differ diff --git a/android-ui-kit-sample/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/android-ui-kit-sample/app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 000000000..ce80a6fb4 Binary files /dev/null and b/android-ui-kit-sample/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/android-ui-kit-sample/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android-ui-kit-sample/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 000000000..13322154c Binary files /dev/null and b/android-ui-kit-sample/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/android-ui-kit-sample/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/android-ui-kit-sample/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png new file mode 100644 index 000000000..136ae0fdd Binary files /dev/null and b/android-ui-kit-sample/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png differ diff --git a/android-ui-kit-sample/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/android-ui-kit-sample/app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 000000000..8d1ddcfe8 Binary files /dev/null and b/android-ui-kit-sample/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/android-ui-kit-sample/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android-ui-kit-sample/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 000000000..63ffd00dd Binary files /dev/null and b/android-ui-kit-sample/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/android-ui-kit-sample/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/android-ui-kit-sample/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png new file mode 100644 index 000000000..02c106519 Binary files /dev/null and b/android-ui-kit-sample/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png differ diff --git a/android-ui-kit-sample/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/android-ui-kit-sample/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 000000000..1e040d39a Binary files /dev/null and b/android-ui-kit-sample/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/android-ui-kit-sample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android-ui-kit-sample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..7d8b2ad08 Binary files /dev/null and b/android-ui-kit-sample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/android-ui-kit-sample/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/android-ui-kit-sample/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png new file mode 100644 index 000000000..37ab022a8 Binary files /dev/null and b/android-ui-kit-sample/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png differ diff --git a/android-ui-kit-sample/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/android-ui-kit-sample/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 000000000..fd13a2798 Binary files /dev/null and b/android-ui-kit-sample/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/android-ui-kit-sample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android-ui-kit-sample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 000000000..ccab1b287 Binary files /dev/null and b/android-ui-kit-sample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/android-ui-kit-sample/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/android-ui-kit-sample/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png new file mode 100644 index 000000000..d82265abf Binary files /dev/null and b/android-ui-kit-sample/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png differ diff --git a/android-ui-kit-sample/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/android-ui-kit-sample/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 000000000..5e14babb8 Binary files /dev/null and b/android-ui-kit-sample/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/android-ui-kit-sample/app/src/main/res/values-night/themes.xml b/android-ui-kit-sample/app/src/main/res/values-night/themes.xml new file mode 100644 index 000000000..4a2a7496e --- /dev/null +++ b/android-ui-kit-sample/app/src/main/res/values-night/themes.xml @@ -0,0 +1,22 @@ + + + + + + \ No newline at end of file diff --git a/android-ui-kit-sample/app/src/main/res/values/colors.xml b/android-ui-kit-sample/app/src/main/res/values/colors.xml new file mode 100644 index 000000000..c3c461e1d --- /dev/null +++ b/android-ui-kit-sample/app/src/main/res/values/colors.xml @@ -0,0 +1,16 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + + #F4F6F9 + #3978FC + #333333 + #99A9C6 + #99A9C6 + \ No newline at end of file diff --git a/android-ui-kit-sample/app/src/main/res/values/strings.xml b/android-ui-kit-sample/app/src/main/res/values/strings.xml new file mode 100644 index 000000000..9a43fc471 --- /dev/null +++ b/android-ui-kit-sample/app/src/main/res/values/strings.xml @@ -0,0 +1,15 @@ + + android-ui-kit-sample + + Credentials are wrong or empty. You have to set: + Application ID, Authentification Key, Authentification Secret, Account Key in constants in App.java + and you have to set Sender ID in the string resources to launch application. + If you haven\'t them you can register new account and application at https://admin.quickblox.com + then put Application credentials from Overview page + Account key from https://admin.quickblox.com/account/settings + + + Enter to ui-kit + Enter your login and \ndisplay name + Login + Password + \ No newline at end of file diff --git a/android-ui-kit-sample/app/src/main/res/values/themes.xml b/android-ui-kit-sample/app/src/main/res/values/themes.xml new file mode 100644 index 000000000..773bedd39 --- /dev/null +++ b/android-ui-kit-sample/app/src/main/res/values/themes.xml @@ -0,0 +1,22 @@ + + + + + + \ No newline at end of file diff --git a/android-ui-kit-sample/app/src/main/res/xml/backup_rules.xml b/android-ui-kit-sample/app/src/main/res/xml/backup_rules.xml new file mode 100644 index 000000000..fa0f996d2 --- /dev/null +++ b/android-ui-kit-sample/app/src/main/res/xml/backup_rules.xml @@ -0,0 +1,13 @@ + + + + \ No newline at end of file diff --git a/android-ui-kit-sample/app/src/main/res/xml/data_extraction_rules.xml b/android-ui-kit-sample/app/src/main/res/xml/data_extraction_rules.xml new file mode 100644 index 000000000..7da4b02dc --- /dev/null +++ b/android-ui-kit-sample/app/src/main/res/xml/data_extraction_rules.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/android-ui-kit-sample/build.gradle b/android-ui-kit-sample/build.gradle new file mode 100644 index 000000000..9209c661d --- /dev/null +++ b/android-ui-kit-sample/build.gradle @@ -0,0 +1,10 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +plugins { + id 'com.android.application' version '7.4.1' apply false + id 'com.android.library' version '7.4.1' apply false + id 'org.jetbrains.kotlin.android' version '1.8.21' apply false +} + +task clean(type: Delete) { + delete rootProject.buildDir +} \ No newline at end of file diff --git a/android-ui-kit-sample/gradle.properties b/android-ui-kit-sample/gradle.properties new file mode 100644 index 000000000..571f6dd38 --- /dev/null +++ b/android-ui-kit-sample/gradle.properties @@ -0,0 +1,24 @@ +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app"s APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +android.enableJetifier=true +# Kotlin code style for this project: "official" or "obsolete": +kotlin.code.style=official +# Enables namespacing of each library's R class so that its R class includes only the +# resources declared in the library itself and none from the library's dependencies, +# thereby reducing the size of the R class for that library +android.nonTransitiveRClass=true \ No newline at end of file diff --git a/android-ui-kit-sample/gradle/wrapper/gradle-wrapper.jar b/android-ui-kit-sample/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000..e708b1c02 Binary files /dev/null and b/android-ui-kit-sample/gradle/wrapper/gradle-wrapper.jar differ diff --git a/android-ui-kit-sample/gradle/wrapper/gradle-wrapper.properties b/android-ui-kit-sample/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000..f3038f5aa --- /dev/null +++ b/android-ui-kit-sample/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Apr 28 19:29:36 CEST 2023 +distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip +distributionPath=wrapper/dists +zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/android-ui-kit-sample/gradlew b/android-ui-kit-sample/gradlew new file mode 100755 index 000000000..4f906e0c8 --- /dev/null +++ b/android-ui-kit-sample/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/android-ui-kit-sample/gradlew.bat b/android-ui-kit-sample/gradlew.bat new file mode 100644 index 000000000..ac1b06f93 --- /dev/null +++ b/android-ui-kit-sample/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/android-ui-kit-sample/settings.gradle b/android-ui-kit-sample/settings.gradle new file mode 100644 index 000000000..bde48a44e --- /dev/null +++ b/android-ui-kit-sample/settings.gradle @@ -0,0 +1,22 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + maven { + url "https://github.com/QuickBlox/quickblox-android-sdk-releases/raw/master/" + } + maven { + url "https://github.com/QuickBlox/android-ui-kit-releases/raw/master/" + } + } +} +rootProject.name = "android-ui-kit-sample" +include ':app'