Skip to content

Commit

Permalink
chore: Release v1.1.0 (#380)
Browse files Browse the repository at this point in the history
chore: Release v1.1.0
  • Loading branch information
iamareebjamal authored Jun 16, 2019
2 parents 39bba2f + 1ceba28 commit c438b11
Show file tree
Hide file tree
Showing 82 changed files with 1,179 additions and 504 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ build/

# Local configuration
local.properties
gradle.properties

# IntelliJ
*.iml
Expand Down
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
# Badge Magic
<img height="200px" src="./docs/images/app_icon.png" align="right" />

Magically Create Symbols and Text on LED Name Badges using Bluetooth
# Badge Magic [![Build Status](https://travis-ci.org/fossasia/badge-magic-android.svg?branch=development)](https://travis-ci.org/fossasia/badge-magic-android) [![Join the chat at https://gitter.im/fossasia/badge-magic](https://badges.gitter.im/fossasia/badge-magic.svg)](https://gitter.im/fossasia/badge-magic?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

[![Build Status](https://travis-ci.org/fossasia/badge-magic-android.svg?branch=development)](https://travis-ci.org/fossasia/badge-magic-android)
[![Join the chat at https://gitter.im/fossasia/badge-magic](https://badges.gitter.im/fossasia/badge-magic.svg)](https://gitter.im/fossasia/badge-magic?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
**Magically Create Symbols and Text on LED Name Badges using Bluetooth**

The Badge Magic Android app lets you create scrolling symbols and text on LED name badges through Bluetooth. The app provides options to portray names, clipart and simple animations on LED badges. For the data transfer from the smartphone to the LED badge we use Bluetooth. The project is based on the work of [Nilhcem](https://github.com/Nilhcem).

<img height="200px" src="https://user-images.githubusercontent.com/11988517/56077705-ee242a00-5dfc-11e9-943c-06fe7e13a57e.png" />
<table align='right'>
<tr>
<a href='https://play.google.com/store/apps/details?id=org.fossasia.badgemagic'><img align='center' height='55' src='./docs/images/google_play_badge.png'></a>
</tr>
<tr>
<a href='https://f-droid.org/en/packages/org.fossasia.badgemagic/'><img align='center' alt='Get it on F-Droid' src='./docs/images/fdroid_badge.png' height="55"/></a>
</tr>
</table>

## Download

Expand Down
21 changes: 12 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ android {
applicationId 'org.fossasia.badgemagic'
minSdkVersion versions.minSdk
targetSdkVersion versions.targetSdk
versionCode 2
versionName '1.0.1'
versionCode 3
versionName '1.1.0'
vectorDrawables.useSupportLibrary = true
}

Expand All @@ -35,6 +35,7 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding.enabled= true
}

spotless {
Expand All @@ -47,6 +48,8 @@ spotless {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${versions.kotlin_version}"

kapt "androidx.databinding:compiler:3.2.0-alpha11"

//Moshi
implementation "com.squareup.moshi:moshi-kotlin:${versions.moshi_version}"
kapt "com.squareup.moshi:moshi-kotlin-codegen:${versions.moshi_version}"
Expand All @@ -55,16 +58,16 @@ dependencies {
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.16'

//Android X Libraries
implementation 'androidx.appcompat:appcompat:1.1.0-alpha05'
implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha05'
implementation 'androidx.appcompat:appcompat:1.1.0-beta01'
implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha06'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
//First Party Lifecycle Library
implementation "androidx.lifecycle:lifecycle-extensions:${versions.lifecycle}"
kapt "androidx.lifecycle:lifecycle-compiler:${versions.lifecycle}"

// Koin AndroidX
implementation "org.koin:koin-androidx-viewmodel:${versions.koin_version}"

//Material Design
implementation 'com.google.android.material:material:1.1.0-alpha06'
implementation 'com.google.android.material:material:1.1.0-alpha07'

//Timber
implementation 'com.jakewharton.timber:timber:4.7.1'
Expand All @@ -74,7 +77,7 @@ dependencies {
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
testImplementation 'com.nhaarman:mockito-kotlin-kt1.1:1.5.0'
testImplementation 'org.amshove.kluent:kluent:1.49'
testImplementation 'org.amshove.kluent:kluent:1.50'

// Leak Canary
debugImplementation "com.squareup.leakcanary:leakcanary-android:${versions.leak_canary}"
Expand Down
8 changes: 6 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

<uses-feature android:name="android.hardware.bluetooth_le" />

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

<uses-feature android:name="android.hardware.location.gps" />
Expand All @@ -15,15 +16,17 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<application
android:name=".ui.App"
android:name=".BadgeMagicApp"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".ui.DrawActivity" android:screenOrientation="landscape">
</activity>
<activity
android:name=".ui.drawer.DrawerActivity"
android:name=".ui.DrawerActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustNothing">
Expand All @@ -45,6 +48,7 @@
android:name="android.app.shortcuts"
android:resource="@xml/shortcuts" />
</activity>

<provider
android:name="androidx.core.content.FileProvider"
android:authorities="@string/file_provider_authority"
Expand Down
54 changes: 54 additions & 0 deletions app/src/main/java/org/fossasia/badgemagic/BadgeMagicApp.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package org.fossasia.badgemagic

import android.app.Application
import android.content.Context
import android.content.res.Configuration
import org.fossasia.badgemagic.di.singletonModules
import org.fossasia.badgemagic.di.utilModules
import org.fossasia.badgemagic.di.viewModelModules
import org.fossasia.badgemagic.util.LocaleManager
import org.koin.android.ext.koin.androidContext
import org.koin.android.ext.koin.androidLogger
import org.koin.core.context.startKoin
import timber.log.Timber

class BadgeMagicApp : Application() {

companion object {
@JvmStatic
var appContext: Context? = null
private set
}

override fun onCreate() {
super.onCreate()
appContext = applicationContext

startKoin {
androidLogger()
androidContext(applicationContext)
modules(listOf(
singletonModules,
utilModules,
viewModelModules
))
}

initLogger()
}

private fun initLogger() {
if (BuildConfig.DEBUG) {
Timber.plant(Timber.DebugTree())
}
}

override fun attachBaseContext(base: Context?) {
super.attachBaseContext(LocaleManager.setLocale(base))
}

override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
LocaleManager.setLocale(this)
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.fossasia.badgemagic.adapter

import android.graphics.Color
import android.graphics.drawable.BitmapDrawable
import android.view.View
import android.widget.ImageView
Expand All @@ -9,20 +8,16 @@ import androidx.recyclerview.widget.RecyclerView
import org.fossasia.badgemagic.R
import org.fossasia.badgemagic.data.DrawableInfo
import org.fossasia.badgemagic.util.ImageUtils
import org.fossasia.badgemagic.util.Resource

class DrawableItemHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {

private val card: LinearLayout = itemView.findViewById(R.id.card)
private val image: ImageView = itemView.findViewById(R.id.image)
var listener: OnDrawableSelected? = null
private val resource = Resource()

fun bind(drawableInfo: DrawableInfo) {
image.setImageBitmap(ImageUtils.trim((drawableInfo.image as BitmapDrawable).bitmap, 100))

image.setColorFilter(resource.getColor(android.R.color.black)
?: Color.parseColor("#000000"))
image.setColorFilter(itemView.context.resources.getColor(android.R.color.black))

card.setOnClickListener {
listener?.onSelected(drawableInfo)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,45 +1,38 @@
package org.fossasia.badgemagic.adapter

import android.graphics.Color
import android.view.View
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import org.fossasia.badgemagic.R
import org.fossasia.badgemagic.data.ModeInfo
import org.fossasia.badgemagic.util.Resource
import pl.droidsonroids.gif.GifDrawable

class ModeItemHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {

private val card: LinearLayout = itemView.findViewById(R.id.card)
private val image: ImageView = itemView.findViewById(R.id.image)
private val title: TextView = itemView.findViewById(R.id.title_tile)
private val resourceHelper = Resource()
var listener: OnModeSelected? = null

fun bind(ModeInfo: ModeInfo, modeSelectedPosition: Int, itemPosition: Int) {
val resources = resourceHelper.getResources()
val resources = itemView.context.resources
if (resources != null)
image.setImageDrawable(GifDrawable(resources, ModeInfo.drawableID))

title.text = ModeInfo.mode.toString().toLowerCase().capitalize()

when (itemPosition == modeSelectedPosition) {
true -> {
card.background = resourceHelper.getDrawable(R.color.colorAccent)
title.setTextColor(resourceHelper.getColor(android.R.color.white)
?: Color.parseColor("#000000"))
image.setColorFilter(resourceHelper.getColor(android.R.color.white)
?: Color.parseColor("#000000"))
card.background = itemView.context.resources.getDrawable(R.color.colorAccent)
title.setTextColor(itemView.context.resources.getColor(android.R.color.white))
image.setColorFilter(itemView.context.resources.getColor(android.R.color.white))
}
false -> {
card.background = resourceHelper.getDrawable(android.R.color.transparent)
title.setTextColor(resourceHelper.getColor(android.R.color.black)
?: Color.parseColor("#00000000"))
image.setColorFilter(resourceHelper.getColor(android.R.color.black)
?: Color.parseColor("#00000000"))
card.background = itemView.context.resources.getDrawable(android.R.color.transparent)
title.setTextColor(itemView.context.resources.getColor(android.R.color.black))
image.setColorFilter(itemView.context.resources.getColor(android.R.color.black))
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package org.fossasia.badgemagic.bindings

import android.widget.ImageView
import androidx.databinding.BindingAdapter
import androidx.databinding.ObservableBoolean
import androidx.databinding.ObservableField
import org.fossasia.badgemagic.R
import org.fossasia.badgemagic.data.draw_layout.DrawMode
import org.fossasia.badgemagic.ui.custom.DrawBadgeLayout

@BindingAdapter("drawState")
fun setBadgeDrawState(badge: DrawBadgeLayout, drawModeState: ObservableField<DrawMode>) {
drawModeState.get()?.let { badge.changeDrawState(it) }
}

@BindingAdapter("resetState")
fun resetDrawBadge(badge: DrawBadgeLayout, isEnabled: ObservableBoolean) {
badge.resetCheckList()
}

@BindingAdapter("changeColor")
fun changeColorState(imageView: ImageView, isEnabled: ObservableBoolean) {
imageView.setColorFilter(
if (isEnabled.get())
imageView.context.resources.getColor(R.color.colorAccent)
else
imageView.context.resources.getColor(android.R.color.black)
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package org.fossasia.badgemagic.bindings

import android.view.View
import android.widget.AdapterView
import android.widget.ArrayAdapter
import androidx.appcompat.widget.AppCompatSpinner
import androidx.databinding.BindingAdapter
import org.fossasia.badgemagic.viewmodels.SettingsViewModel

@BindingAdapter("createAdapterFrom")
fun setSpinnerAdapter(spinner: AppCompatSpinner, viewModel: SettingsViewModel) {
val list: MutableList<String> = viewModel.languageList.get() ?: mutableListOf()
spinner.adapter = ArrayAdapter<String>(spinner.context, android.R.layout.simple_spinner_dropdown_item, list)
spinner.setSelection(viewModel.getSelectedSpinnerLanguage(), false)
spinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
override fun onNothingSelected(parent: AdapterView<*>?) {
}

override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
viewModel.setSelectedSpinnerLangauge(position)
}
}
}
8 changes: 8 additions & 0 deletions app/src/main/java/org/fossasia/badgemagic/data/Language.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.fossasia.badgemagic.data

import java.util.Locale

enum class Language(val locale: Locale) {
ENGLISH(Locale.ENGLISH),
CHINESE(Locale.CHINA),
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ class GattClient {

val characteristic = bluetoothGatt?.getService(SERVICE_UUID)?.getCharacteristic(CHARACTERISTIC_UUID)
characteristic?.value = data
bluetoothGatt?.writeCharacteristic(characteristic)
if (characteristic != null)
bluetoothGatt?.writeCharacteristic(characteristic)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.fossasia.badgemagic.data.draw_layout

enum class DrawMode(val mode: Int) {
NOTHING(0),
DRAW(1),
ERASE(2)
}
Loading

0 comments on commit c438b11

Please sign in to comment.