Skip to content

Commit

Permalink
App shortcuts and sharing via BLC (#16 and #17)
Browse files Browse the repository at this point in the history
  • Loading branch information
glodanif committed Oct 15, 2017
1 parent c8d4639 commit be542fb
Show file tree
Hide file tree
Showing 83 changed files with 526 additions and 253 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
def final VERSION_CODE = 6
def final VERSION_NAME = '1.0.0-beta1'
def final VERSION_CODE = 7
def final VERSION_NAME = '1.0.0-beta2'

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
Expand Down
19 changes: 12 additions & 7 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
tools:replace="android:allowBackup">

<activity
android:name=".activity.SplashActivity"
android:name=".ui.activity.SplashActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme">
<intent-filter>
Expand All @@ -41,34 +41,39 @@
</activity>

<activity
android:name=".activity.ConversationsActivity"
android:name=".ui.activity.ConversationsActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" />

<activity
android:name=".activity.ScanActivity"
android:name=".ui.activity.ScanActivity"
android:label="@string/scan__scan"
android:screenOrientation="portrait" />

<activity
android:name=".activity.ChatActivity"
android:name=".ui.activity.ChatActivity"
android:label="@string/chat__chat"
android:screenOrientation="portrait"
android:theme="@style/AppTheme"
android:windowSoftInputMode="adjustResize|stateHidden" />

<activity
android:name=".activity.ProfileActivity"
android:name=".ui.activity.ProfileActivity"
android:label="@string/initial_setup__initial_setup"
android:screenOrientation="portrait"
android:theme="@style/AppTheme"/>

<activity
android:name=".activity.SettingsActivity"
android:name=".ui.activity.SettingsActivity"
android:label="@string/settings__title"
android:screenOrientation="portrait" />

<service android:name=".service.BluetoothConnectionService" />
<activity
android:name=".ui.activity.ContactChooserActivity"
android:label="@string/contact_chooser__title"
android:screenOrientation="portrait" />

<service android:name=".data.service.BluetoothConnectionService" />

<meta-data
android:name="io.fabric.ApiKey"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package com.glodanif.bluetoothchat
import android.app.Activity
import android.app.Application
import com.crashlytics.android.Crashlytics
import com.glodanif.bluetoothchat.activity.ChatActivity
import com.glodanif.bluetoothchat.activity.ConversationsActivity
import com.glodanif.bluetoothchat.util.StartStopActivityLifecycleCallbacks
import com.glodanif.bluetoothchat.ui.activity.ChatActivity
import com.glodanif.bluetoothchat.ui.activity.ConversationsActivity
import com.glodanif.bluetoothchat.ui.util.StartStopActivityLifecycleCallbacks
import io.fabric.sdk.android.Fabric
import android.os.StrictMode

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.glodanif.bluetoothchat.database
package com.glodanif.bluetoothchat.data.database

import android.arch.persistence.room.Database
import android.arch.persistence.room.RoomDatabase
import android.arch.persistence.room.TypeConverters
import com.glodanif.bluetoothchat.entity.ChatMessage
import com.glodanif.bluetoothchat.entity.Conversation
import com.glodanif.bluetoothchat.data.entity.ChatMessage
import com.glodanif.bluetoothchat.data.entity.Conversation

@Database(entities = arrayOf(ChatMessage::class, Conversation::class), version = 1)
@TypeConverters(*arrayOf(Converter::class))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.glodanif.bluetoothchat.database
package com.glodanif.bluetoothchat.data.database

import android.arch.persistence.room.*
import com.glodanif.bluetoothchat.entity.Conversation
import com.glodanif.bluetoothchat.data.entity.Conversation

@Dao
interface ConversationsDao {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.glodanif.bluetoothchat.database
package com.glodanif.bluetoothchat.data.database

import android.arch.persistence.room.TypeConverter
import java.util.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.glodanif.bluetoothchat.database
package com.glodanif.bluetoothchat.data.database

import android.arch.persistence.room.Dao
import android.arch.persistence.room.Delete
import android.arch.persistence.room.Insert
import android.arch.persistence.room.Query
import com.glodanif.bluetoothchat.entity.ChatMessage
import com.glodanif.bluetoothchat.data.entity.ChatMessage
import android.arch.persistence.room.Update

@Dao
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.glodanif.bluetoothchat.database
package com.glodanif.bluetoothchat.data.database

import android.arch.persistence.room.Room
import android.content.Context
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.glodanif.bluetoothchat.entity
package com.glodanif.bluetoothchat.data.entity

import android.arch.persistence.room.Entity
import android.arch.persistence.room.PrimaryKey
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.glodanif.bluetoothchat.entity
package com.glodanif.bluetoothchat.data.entity

import android.arch.persistence.room.ColumnInfo
import android.arch.persistence.room.Entity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.glodanif.bluetoothchat.entity
package com.glodanif.bluetoothchat.data.entity

import android.support.annotation.ColorInt

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.glodanif.bluetoothchat.model
package com.glodanif.bluetoothchat.data.model

import android.content.Context
import android.content.pm.PackageManager
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.glodanif.bluetoothchat.model
package com.glodanif.bluetoothchat.data.model

import android.bluetooth.BluetoothDevice
import com.glodanif.bluetoothchat.entity.Conversation
import com.glodanif.bluetoothchat.data.entity.Conversation

interface BluetoothConnector {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.glodanif.bluetoothchat.model
package com.glodanif.bluetoothchat.data.model

import android.bluetooth.BluetoothDevice
import android.content.ComponentName
import android.content.Context
import android.content.ServiceConnection
import android.os.IBinder
import com.glodanif.bluetoothchat.entity.ChatMessage
import com.glodanif.bluetoothchat.entity.Conversation
import com.glodanif.bluetoothchat.entity.Message
import com.glodanif.bluetoothchat.service.BluetoothConnectionService
import com.glodanif.bluetoothchat.data.entity.ChatMessage
import com.glodanif.bluetoothchat.data.entity.Conversation
import com.glodanif.bluetoothchat.data.entity.Message
import com.glodanif.bluetoothchat.data.service.BluetoothConnectionService

class BluetoothConnectorImpl(private val context: Context) : BluetoothConnector {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.glodanif.bluetoothchat.model
package com.glodanif.bluetoothchat.data.model

import android.bluetooth.BluetoothDevice

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.glodanif.bluetoothchat.model
package com.glodanif.bluetoothchat.data.model

import android.bluetooth.BluetoothAdapter
import android.bluetooth.BluetoothDevice
Expand All @@ -8,7 +8,7 @@ import android.content.Intent
import android.content.IntentFilter
import android.os.Handler
import android.util.Log
import com.glodanif.bluetoothchat.model.BluetoothScanner.ScanningListener
import com.glodanif.bluetoothchat.data.model.BluetoothScanner.ScanningListener

class BluetoothScannerImpl(val context: Context) : BluetoothScanner {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.glodanif.bluetoothchat.model
package com.glodanif.bluetoothchat.data.model

import com.glodanif.bluetoothchat.entity.Conversation
import com.glodanif.bluetoothchat.data.entity.Conversation

interface ConversationsStorage {
fun getConversations(listener: (List<Conversation>) -> Unit)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.glodanif.bluetoothchat.model
package com.glodanif.bluetoothchat.data.model

import android.content.Context
import android.os.Handler
import com.glodanif.bluetoothchat.database.Storage
import com.glodanif.bluetoothchat.entity.Conversation
import com.glodanif.bluetoothchat.data.database.Storage
import com.glodanif.bluetoothchat.data.entity.Conversation
import kotlin.concurrent.thread

class ConversationsStorageImpl(context: Context) : ConversationsStorage {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.glodanif.bluetoothchat.model
package com.glodanif.bluetoothchat.data.model

import android.net.Uri

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.glodanif.bluetoothchat.model
package com.glodanif.bluetoothchat.data.model

import com.glodanif.bluetoothchat.entity.ChatMessage
import com.glodanif.bluetoothchat.data.entity.ChatMessage

interface MessagesStorage {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.glodanif.bluetoothchat.model
package com.glodanif.bluetoothchat.data.model

import android.content.Context
import android.os.Handler
import com.glodanif.bluetoothchat.database.Storage
import com.glodanif.bluetoothchat.database.MessagesDao
import com.glodanif.bluetoothchat.entity.ChatMessage
import com.glodanif.bluetoothchat.data.database.Storage
import com.glodanif.bluetoothchat.data.database.MessagesDao
import com.glodanif.bluetoothchat.data.entity.ChatMessage
import kotlin.concurrent.thread

class MessagesStorageImpl(val context: Context) : MessagesStorage {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.glodanif.bluetoothchat.model
package com.glodanif.bluetoothchat.data.model

import android.bluetooth.BluetoothDevice
import com.glodanif.bluetoothchat.entity.Conversation
import com.glodanif.bluetoothchat.data.entity.Conversation

interface OnConnectionListener {
fun onConnecting()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.glodanif.bluetoothchat.model
package com.glodanif.bluetoothchat.data.model

import com.glodanif.bluetoothchat.entity.ChatMessage
import com.glodanif.bluetoothchat.data.entity.ChatMessage

interface OnMessageListener {
fun onMessageReceived(message: ChatMessage)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.glodanif.bluetoothchat.model
package com.glodanif.bluetoothchat.data.model

interface OnPrepareListener {
fun onPrepared()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.glodanif.bluetoothchat.model
package com.glodanif.bluetoothchat.data.model

import com.glodanif.bluetoothchat.util.NotificationSettings
import com.glodanif.bluetoothchat.ui.util.NotificationSettings

interface Preferences {
fun isSoundEnabled(): Boolean
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.glodanif.bluetoothchat.model
package com.glodanif.bluetoothchat.data.model

import android.support.annotation.ColorInt

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.glodanif.bluetoothchat.model
package com.glodanif.bluetoothchat.data.model

import android.content.Context
import android.graphics.Color
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.glodanif.bluetoothchat.model
package com.glodanif.bluetoothchat.data.model

import android.bluetooth.BluetoothDevice
import com.glodanif.bluetoothchat.entity.Conversation
import com.glodanif.bluetoothchat.data.entity.Conversation

abstract class SimpleConnectionListener : OnConnectionListener {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.glodanif.bluetoothchat.model
package com.glodanif.bluetoothchat.data.model

import android.content.Context
import android.preference.PreferenceManager
import com.glodanif.bluetoothchat.util.NotificationSettings
import com.glodanif.bluetoothchat.ui.util.NotificationSettings

class UserPreferences(context: Context): Preferences {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.glodanif.bluetoothchat.service
package com.glodanif.bluetoothchat.data.service

import android.app.Service
import android.bluetooth.BluetoothAdapter
Expand All @@ -17,16 +17,16 @@ import android.util.Log
import com.glodanif.bluetoothchat.BuildConfig
import com.glodanif.bluetoothchat.ChatApplication
import com.glodanif.bluetoothchat.R
import com.glodanif.bluetoothchat.database.Storage
import com.glodanif.bluetoothchat.database.ChatDatabase
import com.glodanif.bluetoothchat.entity.ChatMessage
import com.glodanif.bluetoothchat.entity.Conversation
import com.glodanif.bluetoothchat.entity.Message
import com.glodanif.bluetoothchat.model.*
import com.glodanif.bluetoothchat.view.NotificationView
import com.glodanif.bluetoothchat.view.NotificationViewImpl
import com.glodanif.bluetoothchat.widget.ShortcutManager
import com.glodanif.bluetoothchat.widget.ShortcutManagerImpl
import com.glodanif.bluetoothchat.data.database.Storage
import com.glodanif.bluetoothchat.data.database.ChatDatabase
import com.glodanif.bluetoothchat.data.entity.ChatMessage
import com.glodanif.bluetoothchat.data.entity.Conversation
import com.glodanif.bluetoothchat.data.entity.Message
import com.glodanif.bluetoothchat.data.model.*
import com.glodanif.bluetoothchat.ui.view.NotificationView
import com.glodanif.bluetoothchat.ui.view.NotificationViewImpl
import com.glodanif.bluetoothchat.ui.widget.ShortcutManager
import com.glodanif.bluetoothchat.ui.widget.ShortcutManagerImpl
import java.io.IOException
import java.io.InputStream
import java.io.OutputStream
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,11 @@ import android.graphics.drawable.Drawable
import android.opengl.ETC1.getHeight
import android.opengl.ETC1.getWidth



fun Date.getRelativeTime(context: Context): String {

val resources = context.resources

val VIEW_FORMAT: DateFormat =
SimpleDateFormat(context.getString(R.string.general__time_format), Locale.ENGLISH)
val VIEW_FORMAT = SimpleDateFormat(context.getString(R.string.general__time_format), Locale.ENGLISH)
val SECOND_MILLIS = 1000
val MINUTE_MILLIS = 60 * SECOND_MILLIS
val HOUR_MILLIS = 60 * MINUTE_MILLIS
Expand Down
Loading

0 comments on commit be542fb

Please sign in to comment.