Skip to content

Commit

Permalink
update ci
Browse files Browse the repository at this point in the history
  • Loading branch information
JahidHasanCO committed Mar 24, 2023
1 parent 1c14be4 commit 0fbf203
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 136 deletions.
76 changes: 70 additions & 6 deletions .github/workflows/mainci.yml → .github/workflows/automation.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
name: Android CI & CD
on:
push:
branches: [ "master" ]
branches: [ "master" ]
pull_request:
branches: [ "master" ]
types: [opened, synchronize, reopened]
branches: [ "master" ]
types: [opened, synchronize, reopened]
workflow_dispatch:

permissions:
contents: read


jobs:

lint:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -54,7 +53,7 @@ jobs:

- name: Run Unit tests
run: bash ./gradlew test --stacktrace

- name: Upload test report
uses: actions/[email protected]
with:
Expand All @@ -79,6 +78,26 @@ jobs:
api-level: 29
script: ./gradlew connectedCheck

- name: generate report
uses: actions/upload-artifact@v3
with:
name: report
path: app/build/reports/coverage/debug


- name: Download Test Reports Folder
uses: actions/download-artifact@v3
with:
name: report
path: app/build/reports/coverage/debug

- name: Upload Test Report
uses: codecov/codecov-action@v3
with:
files: "app/build/reports/coverage/debug/report.xml"



static-code-analysis:
name: Build and analyze
needs: [unit-test]
Expand Down Expand Up @@ -110,3 +129,48 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew build sonarqube --info

package:
name: Generate APK
needs: [static-code-analysis]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Java JDK
uses: actions/[email protected]
with:
java-version: 11
distribution: 'temurin'
- name: Grant Permission to Execute
run: chmod +x gradlew
- name: Build debug APK
run: bash ./gradlew assembleDebug --stacktrace
- name: Upload APK to Github Artifacts
uses: actions/[email protected]
with:
name: app
path: app/build/outputs/apk/debug/app-debug.apk

delevery-on-telegram:
name: Send Results on Telegram
needs: [ package ]
runs-on: ubuntu-latest
steps:
- name: Download Apk Stored Artifact
uses: actions/download-artifact@v3
with:
name: app

- name: send Apk on telegram message on push
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
Hi Guys,
${{ github.actor }} created commit:
Commit message: ${{ github.event.commits[0].message }}
Repository: ${{ github.repository }}
See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}}
Created By @JahidHasanCo
document: app-debug.apk
53 changes: 0 additions & 53 deletions .github/workflows/codecov.yml

This file was deleted.

54 changes: 0 additions & 54 deletions .github/workflows/devCd.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class MainActivity : AppCompatActivity() {
focusedIndex = 2
}
_binding.genderWheelView.selectListener = {
gender = titlesOfGender[it][0]
gender = titlesOfGender[it][0]
}


Expand Down Expand Up @@ -111,14 +111,13 @@ class MainActivity : AppCompatActivity() {
_binding.startButton.alpha = 0f
Handler(Looper.getMainLooper()).postDelayed({

val intent = Intent(this,ResultActivity::class.java)
intent.putExtra("Height",height.toDouble())
intent.putExtra("Weight",weight.toDouble())
if(gender == 'M'){
intent.putExtra("Gender",0)
}
else{
intent.putExtra("Gender",1)
val intent = Intent(this, ResultActivity::class.java)
intent.putExtra("Height", height.toDouble())
intent.putExtra("Weight", weight.toDouble())
if (gender == 'M') {
intent.putExtra("Gender", 0)
} else {
intent.putExtra("Gender", 1)
}
startActivity(intent)

Expand Down Expand Up @@ -152,10 +151,14 @@ class MainActivity : AppCompatActivity() {



bodyContainer.animate().translationY(0f).alpha(1f).setDuration(500).setStartDelay(300).start()
footerContainer.animate().translationY(0f).alpha(1f).setDuration(500).setStartDelay(400).start()
heightWheel.animate().translationY(0f).alpha(1f).setDuration(500).setStartDelay(450).start()
weightRecyclerBtn.animate().translationX(0f).alpha(1f).setDuration(500).setStartDelay(500).start()
bodyContainer.animate().translationY(0f).alpha(1f).setDuration(500).setStartDelay(300)
.start()
footerContainer.animate().translationY(0f).alpha(1f).setDuration(500).setStartDelay(400)
.start()
heightWheel.animate().translationY(0f).alpha(1f).setDuration(500).setStartDelay(450)
.start()
weightRecyclerBtn.animate().translationX(0f).alpha(1f).setDuration(500)
.setStartDelay(500).start()

}
}
Expand All @@ -165,18 +168,21 @@ class MainActivity : AppCompatActivity() {
_binding.apply {

textView.animate().translationY(0f).alpha(0f).setDuration(50).setStartDelay(0).start()
bodyContainer.animate().translationY(-250f).alpha(0f).setDuration(500).setStartDelay(0).start()
footerContainer.animate().translationY(-250f).alpha(0f).setDuration(500).setStartDelay(50).start()
heightWheel.animate().translationY(-250f).alpha(0f).setDuration(500).setStartDelay(100).start()
weightRecyclerBtn.animate().translationX(-250f).alpha(0f).setDuration(500).setStartDelay(150).start()
bodyContainer.animate().translationY(-250f).alpha(0f).setDuration(500).setStartDelay(0)
.start()
footerContainer.animate().translationY(-250f).alpha(0f).setDuration(500)
.setStartDelay(50).start()
heightWheel.animate().translationY(-250f).alpha(0f).setDuration(500).setStartDelay(100)
.start()
weightRecyclerBtn.animate().translationX(-250f).alpha(0f).setDuration(500)
.setStartDelay(150).start()

}
}

override fun onBackPressed() {
if (doubleBackToExitPressedOnce) {
onBackPressedDispatcher.onBackPressed()
return
}

this.doubleBackToExitPressedOnce = true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package dev.jahidhasanco.bmicalculator.presentation.activity



import android.Manifest
import android.annotation.SuppressLint
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.widget.Toast
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ShareCompat
Expand All @@ -28,7 +26,7 @@ class ResultActivity : AppCompatActivity() {
private lateinit var binding: ActivityResultBinding
private val _binding get() = binding

private var weight: Double =1.0
private var weight: Double = 1.0
private var height: Double = 1.0
private var result: Double = 0.0
private var gender: Int = 0
Expand Down Expand Up @@ -99,10 +97,11 @@ class ResultActivity : AppCompatActivity() {
Manifest.permission.WRITE_EXTERNAL_STORAGE
) == PackageManager.PERMISSION_GRANTED

private fun backPreviousPage(){
private fun backPreviousPage() {
animationViewUp()
Handler(Looper.getMainLooper()).postDelayed({
startActivity(Intent(this, MainActivity::class.java))
finish()
}, 600)

}
Expand Down Expand Up @@ -161,7 +160,8 @@ class ResultActivity : AppCompatActivity() {
.start()
bmiText.animate().translationY(-250f).alpha(0f).setDuration(500).setStartDelay(100)
.start()
bmiTextNormal.animate().translationY(-250f).alpha(0f).setDuration(500).setStartDelay(150)
bmiTextNormal.animate().translationY(-250f).alpha(0f).setDuration(500)
.setStartDelay(150)
.start()
deleteBtn.animate().translationY(-250f).alpha(0f).setDuration(300).setStartDelay(200)
.start()
Expand Down Expand Up @@ -215,8 +215,10 @@ class ResultActivity : AppCompatActivity() {
result = ((weight / (height * height)) * 10000)
}

@Deprecated("Deprecated in Java")
override fun onBackPressed() {
backPreviousPage()
}


}

0 comments on commit 0fbf203

Please sign in to comment.