Skip to content

Commit

Permalink
Merge branch 'master' into PE-491
Browse files Browse the repository at this point in the history
# Conflicts:
#	photoeditor/src/main/java/ja/burhanrashid52/photoeditor/DrawingView.kt
#	photoeditor/src/main/java/ja/burhanrashid52/photoeditor/shape/ShapeBuilder.kt
  • Loading branch information
wasky committed Jan 17, 2023
2 parents 1e01b0b + b781103 commit 20c91e2
Show file tree
Hide file tree
Showing 22 changed files with 298 additions and 213 deletions.
19 changes: 14 additions & 5 deletions .github/workflows/app_build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,25 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: set up JDK 1.8
- name: set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 17
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
- name: Build with Gradle
run: ./gradlew build

unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: set up JDK 1.8
- name: set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 17
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
- name: Run unit tests
run: ./gradlew test --stacktrace

Expand All @@ -36,7 +40,12 @@ jobs:
steps:
- name: checkout
uses: actions/checkout@v2

- name: set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
- name: run ui tests
uses: reactivecircus/android-emulator-runner@v2
with:
Expand Down
2 changes: 2 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
namespace 'com.burhanrashid52.photoediting'
compileSdkVersion 31

defaultConfig {
applicationId "com.burhanrashid52.photoediting"
minSdkVersion 14
Expand Down
10 changes: 5 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.burhanrashid52.photoediting">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="28" />
<uses-permission android:name="android.permission.INTERNET" />

Expand All @@ -22,9 +22,9 @@
tools:replace="android:allowBackup">
<activity
android:name="com.burhanrashid52.photoediting.EditImageActivity"
android:exported="true"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:exported="true">
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ class EditImageActivity : BaseActivity(), OnPhotoEditorListener, View.OnClickLis
mTxtCurrentTool.setText(R.string.label_brush)
}

override fun onShapePicked(shapeType: ShapeType?) {
override fun onShapePicked(shapeType: ShapeType) {
mPhotoEditor.setShape(mShapeBuilder.withShapeType(shapeType))
}

Expand Down Expand Up @@ -393,11 +393,11 @@ class EditImageActivity : BaseActivity(), OnPhotoEditorListener, View.OnClickLis
builder.create().show()
}

override fun onFilterSelected(photoFilter: PhotoFilter?) {
override fun onFilterSelected(photoFilter: PhotoFilter) {
mPhotoEditor.setFilterEffect(photoFilter)
}

override fun onToolSelected(toolType: ToolType?) {
override fun onToolSelected(toolType: ToolType) {
when (toolType) {
ToolType.SHAPE -> {
mPhotoEditor.setBrushDrawingMode(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import android.view.View
import android.view.ViewGroup
import android.widget.RadioGroup
import android.widget.SeekBar
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import ja.burhanrashid52.photoeditor.shape.ShapeType
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.burhanrashid52.photoediting.ColorPickerAdapter.OnColorPickerClickListener
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import ja.burhanrashid52.photoeditor.shape.ShapeType

class ShapeBSFragment : BottomSheetDialogFragment(), SeekBar.OnSeekBarChangeListener {
private var mProperties: Properties? = null
Expand All @@ -19,7 +19,7 @@ class ShapeBSFragment : BottomSheetDialogFragment(), SeekBar.OnSeekBarChangeList
fun onColorChanged(colorCode: Int)
fun onOpacityChanged(opacity: Int)
fun onShapeSizeChanged(shapeSize: Int)
fun onShapePicked(shapeType: ShapeType?)
fun onShapePicked(shapeType: ShapeType)
}

override fun onCreateView(
Expand All @@ -39,7 +39,7 @@ class ShapeBSFragment : BottomSheetDialogFragment(), SeekBar.OnSeekBarChangeList

// shape picker
shapeGroup.setOnCheckedChangeListener { _: RadioGroup?, checkedId: Int ->
when(checkedId) {
when (checkedId) {
R.id.lineRadioButton -> {
mProperties!!.onShapePicked(ShapeType.Line)
}
Expand All @@ -60,11 +60,13 @@ class ShapeBSFragment : BottomSheetDialogFragment(), SeekBar.OnSeekBarChangeList
sbOpacity.setOnSeekBarChangeListener(this)
sbBrushSize.setOnSeekBarChangeListener(this)

val activity = requireActivity()

// TODO(lucianocheng): Move layoutManager to a xml file.
val layoutManager = LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL, false)
rvColor.layoutManager = layoutManager
rvColor.setHasFixedSize(true)
val colorPickerAdapter = ColorPickerAdapter(activity!!)
val colorPickerAdapter = ColorPickerAdapter(activity)
colorPickerAdapter.setOnColorPickerClickListener(object : OnColorPickerClickListener {
override fun onColorPickerClickListener(colorCode: Int) {
if (mProperties != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@ import android.view.ViewGroup
import android.view.inputmethod.InputMethodManager
import android.widget.EditText
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.LinearLayoutManager
import com.burhanrashid52.photoediting.ColorPickerAdapter.OnColorPickerClickListener
import kotlin.jvm.JvmOverloads
import androidx.appcompat.app.AppCompatActivity
import androidx.annotation.ColorInt
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.fragment.app.DialogFragment
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.burhanrashid52.photoediting.ColorPickerAdapter.OnColorPickerClickListener

/**
* Created by Burhanuddin Rashid on 1/16/2018.
Expand Down Expand Up @@ -56,9 +55,12 @@ class TextEditorDialogFragment : DialogFragment() {

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

val activity = requireActivity()

mAddTextEditText = view.findViewById(R.id.add_text_edit_text)
mInputMethodManager =
activity!!.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
activity.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
mAddTextDoneTextView = view.findViewById(R.id.add_text_done_tv)

//Setup the color picker for text color
Expand All @@ -67,7 +69,7 @@ class TextEditorDialogFragment : DialogFragment() {
val layoutManager = LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL, false)
addTextColorPickerRecyclerView.layoutManager = layoutManager
addTextColorPickerRecyclerView.setHasFixedSize(true)
val colorPickerAdapter = ColorPickerAdapter(activity!!)
val colorPickerAdapter = ColorPickerAdapter(activity)

//This listener will change the text color when clicked on any color from picker
colorPickerAdapter.setOnColorPickerClickListener(object : OnColorPickerClickListener {
Expand All @@ -76,9 +78,13 @@ class TextEditorDialogFragment : DialogFragment() {
mAddTextEditText!!.setTextColor(colorCode)
}
})

addTextColorPickerRecyclerView.adapter = colorPickerAdapter
mAddTextEditText!!.setText(arguments!!.getString(EXTRA_INPUT_TEXT))
mColorCode = arguments!!.getInt(EXTRA_COLOR_CODE)

val arguments = requireArguments()

mAddTextEditText!!.setText(arguments.getString(EXTRA_INPUT_TEXT))
mColorCode = arguments.getInt(EXTRA_COLOR_CODE)
mAddTextEditText!!.setTextColor(mColorCode)
mInputMethodManager!!.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ package com.burhanrashid52.photoediting.filters
import ja.burhanrashid52.photoeditor.PhotoFilter

interface FilterListener {
fun onFilterSelected(photoFilter: PhotoFilter?)
fun onFilterSelected(photoFilter: PhotoFilter)
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class EditingToolsAdapter(private val mOnItemSelected: OnItemSelected) :
private val mToolList: MutableList<ToolModel> = ArrayList()

interface OnItemSelected {
fun onToolSelected(toolType: ToolType?)
fun onToolSelected(toolType: ToolType)
}

internal inner class ToolModel(
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
apply plugin: 'io.codearte.nexus-staging'

buildscript {
ext.kotlin_version = '1.5.31'
ext.kotlin_version = '1.6.21'

repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
classpath 'com.android.tools.build:gradle:7.4.0'
classpath "com.github.dcendents:android-maven-gradle-plugin:2.0"
classpath 'io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.22.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Sat Mar 13 07:08:20 IST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
Loading

0 comments on commit 20c91e2

Please sign in to comment.