Skip to content

Commit

Permalink
chore: Release v1.3.0 (#434)
Browse files Browse the repository at this point in the history
chore: Release v1.3.0
  • Loading branch information
iamareebjamal authored Jul 7, 2019
2 parents 1fc58ef + a5abd8b commit f152348
Show file tree
Hide file tree
Showing 34 changed files with 388 additions and 77 deletions.
21 changes: 10 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: android
sudo: false
jdk:
- oraclejdk8
- oraclejdk8
android:
components:
- tools
Expand All @@ -11,18 +11,17 @@ android:
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
cache:
directories:
- "${TRAVIS_BUILD_DIR}/gradle/caches/"
- "${TRAVIS_BUILD_DIR}/gradle/wrapper/dists/"
- "$HOME/.gradle/caches/"
- "$HOME/.gradle/wrapper/"
directories:
- "${TRAVIS_BUILD_DIR}/gradle/caches/"
- "${TRAVIS_BUILD_DIR}/gradle/wrapper/dists/"
- "$HOME/.gradle/caches/"
- "$HOME/.gradle/wrapper/"
install:
- echo yes | ${ANDROID_HOME}/tools/bin/sdkmanager "platforms;android-28"
- echo yes | sdkmanager "platforms;android-28"
before_script:
- bash scripts/prep-key.sh
script:
- ./gradlew spotlessCheck
- ./gradlew build --stacktrace
after_success:
- bash scripts/prep-key.sh
- 'if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then bash scripts/upload-apk.sh; fi'
before_install:
- yes | sdkmanager "platforms;android-28"
- bash scripts/upload-apk.sh
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ There are a number of devices with Bluetooth on the market. As far as we can tel

| <!-- --> | <!-- --> | <!-- --> |
|-------------|-------------|-------------|
| <img src="./docs/images/screen-1.png" width="288" /> <img src="./docs/images/screen-1-hard.png" width="288" /> | <img src="./docs/images/screen-2.png" width="288" /> <img src="./docs/images/screen-2-hard.png" width="288" /> | <img src="./docs/images/screen-3.png" width="288" /> <img src="./docs/images/screen-3-hard.png" width="288" /> |
| <img src="./fastlane/metadata/android/en-US/images/phoneScreenshots/screen-1.png" width="288" /> <img src="./docs/images/screen-1-hard.png" width="288" /> | <img src="./fastlane/metadata/android/en-US/images/phoneScreenshots/screen-2.png" width="288" /> <img src="./docs/images/screen-2-hard.png" width="288" /> | <img src="./fastlane/metadata/android/en-US/images/phoneScreenshots/screen-3.png" width="288" /> <img src="./docs/images/screen-3-hard.png" width="288" /> |
| <!-- --> | <!-- --> | <!-- --> |
| <img src="./docs/images/screen-4.png" width="288" /> <img src="./docs/images/screen-4-hard.png" width="288" /> | <img src="./docs/images/screen-5.png" width="288" /> <img src="./docs/images/screen-5-hard.png" width="288" /> | <img src="./docs/images/screen-6.png" width="288" /> <img src="./docs/images/screen-6-hard.png" width="288" /> |
| <img src="./fastlane/metadata/android/en-US/images/phoneScreenshots/screen-4.png" width="288" /> <img src="./docs/images/screen-4-hard.png" width="288" /> | <img src="./fastlane/metadata/android/en-US/images/phoneScreenshots/screen-5.png" width="288" /> <img src="./docs/images/screen-5-hard.png" width="288" /> | <img src="./fastlane/metadata/android/en-US/images/phoneScreenshots/screen-6.png" width="288" /> <img src="./docs/images/screen-6-hard.png" width="288" /> |

## Contributions Best Practices

Expand Down
38 changes: 32 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
plugins {
id "com.diffplug.gradle.spotless" version "3.23.1"
}
apply plugin: "com.github.b3er.local.properties"
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

def KEYSTORE_FILE = rootProject.file('scripts/key.jks')
def TRAVIS_BUILD = System.getenv("TRAVIS") == "true" && KEYSTORE_FILE.exists()
def LOCAL_KEY_PRESENT = project.hasProperty('SIGNING_KEY_FILE') && rootProject.file(SIGNING_KEY_FILE).exists()

androidExtensions {
experimental = true
}
Expand All @@ -18,8 +23,8 @@ android {
applicationId 'org.fossasia.badgemagic'
minSdkVersion versions.minSdk
targetSdkVersion versions.targetSdk
versionCode 4
versionName '1.2.0'
versionCode 5
versionName '1.3.0'
vectorDrawables.useSupportLibrary = true
}

Expand All @@ -28,11 +33,32 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}

signingConfigs {
if (TRAVIS_BUILD) {
release {
storeFile KEYSTORE_FILE
storePassword System.getenv("STORE_PASS")
keyAlias System.getenv("ALIAS")
keyPassword System.getenv("KEY_PASS")
}
} else if (LOCAL_KEY_PRESENT) {
release {
storeFile rootProject.file(SIGNING_KEY_FILE)
storePassword STORE_PASS
keyAlias ALIAS
keyPassword KEY_PASS
}
}
}

buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

if (LOCAL_KEY_PRESENT || TRAVIS_BUILD)
signingConfig signingConfigs.release
}
}
dataBinding.enabled= true
Expand All @@ -58,8 +84,8 @@ dependencies {
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.16'

//Android X Libraries
implementation 'androidx.appcompat:appcompat:1.1.0-beta01'
implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha06'
implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
implementation 'androidx.recyclerview:recyclerview:1.1.0-beta01'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

Expand All @@ -77,11 +103,11 @@ 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.50'
testImplementation 'org.amshove.kluent:kluent:1.51'

// Leak Canary
debugImplementation "com.squareup.leakcanary:leakcanary-android:${versions.leak_canary}"

//Display third party licenses
implementation 'de.psdev.licensesdialog:licensesdialog:2.0.0'
implementation 'de.psdev.licensesdialog:licensesdialog:2.1.0'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package org.fossasia.badgemagic.adapter

import android.graphics.Bitmap
import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.Toast
import androidx.recyclerview.widget.RecyclerView
import androidx.databinding.DataBindingUtil
import org.fossasia.badgemagic.R
import org.fossasia.badgemagic.databinding.RecyclerItemSavedClipartBinding
import org.fossasia.badgemagic.viewmodels.SavedClipartViewModel

class SavedClipartsAdapter(
private var clipartList: List<Bitmap>,
private val viewModel: SavedClipartViewModel
) : RecyclerView.Adapter<SavedClipartsViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SavedClipartsViewHolder {
val binding = DataBindingUtil.inflate<RecyclerItemSavedClipartBinding>(LayoutInflater.from(parent.context), R.layout.recycler_item_saved_clipart, parent, false)
return SavedClipartsViewHolder(binding)
}

override fun getItemCount(): Int = clipartList.size

override fun onBindViewHolder(holder: SavedClipartsViewHolder, position: Int) {
holder.bind(clipartList[position])
holder.getBindingView().setOnClickListener {
viewModel.deleteClipart(position)
Toast.makeText(it.context, "Delete Clipart Successfully", Toast.LENGTH_LONG).show()
}
}

fun setList(list: List<Bitmap>) {
clipartList = list
notifyDataSetChanged()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.fossasia.badgemagic.adapter

import android.graphics.Bitmap
import androidx.recyclerview.widget.RecyclerView
import org.fossasia.badgemagic.databinding.RecyclerItemSavedClipartBinding

class SavedClipartsViewHolder(private val binding: RecyclerItemSavedClipartBinding) : RecyclerView.ViewHolder(binding.root) {
fun bind(bitmap: Bitmap) {
binding.bitmap = bitmap
}

fun getBindingView() = binding.root
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.fossasia.badgemagic.bindings

import android.graphics.Bitmap
import androidx.databinding.BindingAdapter
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import org.fossasia.badgemagic.adapter.SavedClipartsAdapter
import org.fossasia.badgemagic.ui.custom.SquareImageView
import org.fossasia.badgemagic.util.ImageUtils

@BindingAdapter("setAdapter")
fun setSavedClipRecyclerAdapter(recyclerView: RecyclerView, adapter: SavedClipartsAdapter) {
recyclerView.layoutManager = LinearLayoutManager(recyclerView.context)
recyclerView.adapter = adapter
}

@BindingAdapter("bindImage")
fun bindImage(imageView: SquareImageView, image: Bitmap) {
imageView.setImageBitmap(ImageUtils.trim(image, 200))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package org.fossasia.badgemagic.data

import android.graphics.Bitmap

data class SavedClipart(val fileName: String, val bitmap: Bitmap)
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ class ClipArtService : KoinComponent {
tempSparseArray.append(index, it)
}
}
val drawablesInStorage = StorageUtils.getAllClips()
val drawablesInStorage = getClipsFromStorage()
drawablesInStorage.forEach {
tempSparseArray.append(++lastIndex, it)
tempSparseArray.append(++lastIndex, it.value)
}

return tempSparseArray
Expand All @@ -59,4 +59,6 @@ class ClipArtService : KoinComponent {
}

fun getClipArts(): LiveData<SparseArray<Drawable>> = clipArts

fun getClipsFromStorage() = StorageUtils.getAllClips()
}
2 changes: 2 additions & 0 deletions app/src/main/java/org/fossasia/badgemagic/di/Modules.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import org.fossasia.badgemagic.viewmodels.SettingsViewModel
import org.fossasia.badgemagic.viewmodels.DrawViewModel
import org.fossasia.badgemagic.viewmodels.DrawerViewModel
import org.fossasia.badgemagic.viewmodels.EditBadgeViewModel
import org.fossasia.badgemagic.viewmodels.SavedClipartViewModel
import org.koin.android.ext.koin.androidContext
import org.koin.androidx.viewmodel.dsl.viewModel
import org.koin.dsl.module
Expand All @@ -21,6 +22,7 @@ val viewModelModules = module {
viewModel { EditBadgeViewModel(get()) }
viewModel { DrawViewModel(get()) }
viewModel { DrawerViewModel(get()) }
viewModel { SavedClipartViewModel(get()) }
}

val singletonModules = module {
Expand Down
26 changes: 9 additions & 17 deletions app/src/main/java/org/fossasia/badgemagic/ui/DrawerActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package org.fossasia.badgemagic.ui
import android.Manifest
import android.app.Activity
import android.app.AlertDialog
import android.bluetooth.BluetoothManager
import android.content.Context
import android.content.DialogInterface
import android.content.Intent
import android.content.pm.ActivityInfo
Expand Down Expand Up @@ -33,6 +31,7 @@ import org.fossasia.badgemagic.ui.fragments.SavedBadgesFragment
import org.fossasia.badgemagic.ui.fragments.SettingsFragment
import org.fossasia.badgemagic.ui.fragments.TextArtFragment
import org.fossasia.badgemagic.ui.fragments.DrawFragment
import org.fossasia.badgemagic.ui.fragments.SavedClipartFragment
import org.fossasia.badgemagic.util.SendingUtils
import org.fossasia.badgemagic.util.StorageUtils
import org.fossasia.badgemagic.viewmodels.DrawerViewModel
Expand Down Expand Up @@ -99,12 +98,18 @@ class DrawerActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedLi
switchFragment(DrawFragment.newInstance())
showMenu?.setGroupVisible(R.id.saved_group, false)
}
R.id.saved -> {
R.id.saved_badges -> {
viewModel.swappingOrientation = false
setRotation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)
switchFragment(SavedBadgesFragment.newInstance())
showMenu?.setGroupVisible(R.id.saved_group, true)
}
R.id.saved_cliparts -> {
viewModel.swappingOrientation = false
setRotation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)
switchFragment(SavedClipartFragment.newInstance())
showMenu?.setGroupVisible(R.id.saved_group, false)
}
R.id.settings -> {
viewModel.swappingOrientation = false
setRotation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)
Expand Down Expand Up @@ -141,7 +146,7 @@ class DrawerActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedLi
"org.fossasia.badgemagic.savedBadges.shortcut" -> {
switchFragment(SavedBadgesFragment.newInstance())
showMenu?.setGroupVisible(R.id.saved_group, true)
nav_view.setCheckedItem(R.id.saved)
nav_view.setCheckedItem(R.id.saved_badges)
}
} else {
switchFragment(DrawFragment.newInstance())
Expand Down Expand Up @@ -242,14 +247,6 @@ class DrawerActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedLi
return packageManager.hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)
}

private fun disableBluetooth() {
val btManager = getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager
val btAdapter = btManager.adapter
if (btAdapter.isEnabled) {
btAdapter.disable()
}
}

private fun saveImportFile(uri: Uri?) {
if (StorageUtils.copyFileToDirectory(this, uri)) {
Toast.makeText(this, R.string.success_import_json, Toast.LENGTH_SHORT).show()
Expand Down Expand Up @@ -290,11 +287,6 @@ class DrawerActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedLi
return super.onOptionsItemSelected(item)
}

override fun onDestroy() {
disableBluetooth()
super.onDestroy()
}

override fun onBackPressed() {
val drawerLayout: DrawerLayout = findViewById(R.id.drawer_layout)
if (drawerLayout.isDrawerOpen(GravityCompat.START)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ class DrawBadgeLayout(context: Context?, attrs: AttributeSet?) : View(context, a
}
}

private fun liesWithinX(x: Float) = x < cells[0].list[0].left || x > cells[0].list[badgeWidth - 1].right
private fun liesWithinY(y: Float) = y < cells[0].list[0].top || y > cells[badgeHeight - 1].list[0].bottom
private fun liesWithinX(x: Float) = x <= cells[0].list[0].left || x >= cells[0].list[badgeWidth - 1].right
private fun liesWithinY(y: Float) = y <= cells[0].list[0].top || y >= cells[badgeHeight - 1].list[0].bottom

fun setValue(hexStrings: List<String>) {
resetCheckList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package org.fossasia.badgemagic.ui.custom
import androidx.appcompat.widget.AppCompatImageView
import android.content.Context
import android.util.AttributeSet
import kotlin.math.max

class SquareImageView : AppCompatImageView {

Expand All @@ -14,7 +15,7 @@ class SquareImageView : AppCompatImageView {

override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
val width = measuredWidth
val width = max(measuredWidth, measuredHeight)
setMeasuredDimension(width, width)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package org.fossasia.badgemagic.ui.fragments

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import org.fossasia.badgemagic.R
import org.fossasia.badgemagic.databinding.FragmentSavedClipartsBinding
import org.fossasia.badgemagic.ui.base.BaseFragment
import org.fossasia.badgemagic.viewmodels.SavedClipartViewModel
import org.koin.androidx.viewmodel.ext.android.viewModel

class SavedClipartFragment : BaseFragment() {

companion object {
@JvmStatic
fun newInstance() =
SavedClipartFragment()
}

private val viewModel by viewModel<SavedClipartViewModel>()

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val binding = DataBindingUtil.inflate<FragmentSavedClipartsBinding>(inflater, R.layout.fragment_saved_cliparts, container, false)
binding.viewModel = viewModel
return binding.root
}
}
Loading

0 comments on commit f152348

Please sign in to comment.