Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Barashkov committed Jul 23, 2021
2 parents eca0d6d + 42e70d9 commit bead5f0
Show file tree
Hide file tree
Showing 17 changed files with 452 additions and 174 deletions.
53 changes: 33 additions & 20 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://jitpack.io' }
}

Expand All @@ -9,13 +9,16 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

def financierPropertiesFile = rootProject.file("./Keys/financier.properties")
def financierProperties = new Properties()

financierProperties.load(new FileInputStream(financierPropertiesFile))

android {
buildFeatures {
dataBinding true
// viewBinding true
}
compileSdkVersion 30
buildToolsVersion '29.0.3'

flavorDimensions "channel"
productFlavors {
Expand All @@ -30,12 +33,21 @@ android {
}
}

signingConfigs {
release {
storeFile file(financierProperties['storeFile'])
storePassword financierProperties['storePassword']
keyAlias financierProperties['keyAlias']
keyPassword financierProperties['keyPassword']
}
}

defaultConfig {
applicationId "com.handydev.financier"
minSdkVersion 21
targetSdkVersion 30
versionCode 215
versionName "2.0.15"
targetSdkVersion 29
versionCode 216
versionName "2.0.16"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
javaCompileOptions {
Expand All @@ -50,6 +62,7 @@ android {
buildTypes {
release {
minifyEnabled false
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
applicationVariants.all { variant ->
variant.outputs.all { output ->
Expand Down Expand Up @@ -114,25 +127,25 @@ def eventbus_version = '3.2.0'

dependencies {
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.multidex:multidex:2.0.1'
implementation "androidx.constraintlayout:constraintlayout:2.0.4"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
implementation "androidx.viewpager2:viewpager2:1.0.0"
kapt "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"

//googledrive
googleplayImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1'
googleplayImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
googleplayImplementation 'com.google.android.gms:play-services-auth:19.0.0'
googleplayImplementation 'com.google.android.gms:play-services-auth:19.2.0'
googleplayImplementation 'com.google.http-client:google-http-client-gson:1.26.0'
googleplayImplementation 'com.google.api-client:google-api-client-android:1.26.0'
googleplayImplementation 'com.google.apis:google-api-services-drive:v3-rev136-1.25.0'
//googledrive misc
googleplayImplementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.0-rc1'
googleplayImplementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
googleplayImplementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
googleplayImplementation ('androidx.work:work-runtime-ktx:2.4.0'){
googleplayImplementation ('androidx.work:work-runtime-ktx:2.5.0'){
//Needed due to a transitive dependency clash with the google api client dep
exclude group: 'com.google.guava', module:'listenablefuture'
}
Expand All @@ -141,14 +154,14 @@ dependencies {
//untied - SAME AS ABOVE
untiedImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1'
untiedImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
untiedImplementation 'com.google.android.gms:play-services-auth:19.0.0'
untiedImplementation 'com.google.android.gms:play-services-auth:19.2.0'
untiedImplementation 'com.google.http-client:google-http-client-gson:1.26.0'
untiedImplementation 'com.google.api-client:google-api-client-android:1.26.0'
untiedImplementation 'com.google.apis:google-api-services-drive:v3-rev136-1.25.0'
//googledrive misc
untiedImplementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.0-rc01'
untiedImplementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
untiedImplementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
untiedImplementation ('androidx.work:work-runtime-ktx:2.4.0'){
untiedImplementation ('androidx.work:work-runtime-ktx:2.5.0'){
//Needed due to a transitive dependency clash with the google api client dep
exclude group: 'com.google.guava', module:'listenablefuture'
}
Expand All @@ -162,26 +175,26 @@ dependencies {
implementation 'net.sf.trove4j:trove4j:3.0.3'

implementation 'com.dropbox.core:dropbox-core-sdk:3.1.3'
implementation 'com.squareup.okhttp3:okhttp:3.14.9'
implementation 'com.squareup.okio:okio:1.17.5'
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
implementation 'com.squareup.okio:okio:2.8.0'
implementation "org.greenrobot:eventbus:$eventbus_version"
kapt "org.greenrobot:eventbus-annotation-processor:$eventbus_version"
implementation 'com.wdullaer:materialdatetimepicker:3.6.4'
implementation 'commons-io:commons-io:2.5'
implementation 'commons-io:commons-io:2.6'
implementation 'com.mtramin:rxfingerprint:2.2.1'
implementation 'io.reactivex.rxjava2:rxjava:2.2.19'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'org.reactivestreams:reactive-streams:1.0.3'
implementation 'com.mlsdev.rximagepicker:library:2.1.5'
implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'com.google.android.material:material:1.4.0'

implementation fileTree(include: '**/*.jar', dir: 'libs')

testImplementation 'junit:junit:4.13.1'
testImplementation 'androidx.test:core:1.3.0'
testImplementation 'androidx.test:core:1.4.0'
testImplementation 'org.robolectric:robolectric:4.4'
implementation "androidx.core:core-ktx:+"
implementation "androidx.core:core-ktx:1.6.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
android:normalScreens="true"
android:resizeable="true"
android:smallScreens="true" />

<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/assets/whatsnew.htm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
</head>
<body>

<p><b>2.0.16</b></p>
<p>
[*]Crash fixed when going back from Add Category screen.<br/>
[*]Duplicate categories in Category selector fixed.<br/>
[*]Fix Backup not working on Android 11.<br/>
[*]Ukrainian locale improved.<br/>
[*]Updated third party libraries.<br/>
</p>

<p><b>2.0.15</b></p>
<p>
[*]Crash fixed. <br/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ abstract class MyEntitySelector<T : MyEntity, A : AbstractActivity?> internal co
}
}

fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent) {
if (resultCode == Activity.RESULT_OK && requestCode == actBtnId) {
fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
if (resultCode == Activity.RESULT_OK && requestCode == actBtnId && data != null) {
onNewEntity(data)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
package com.handydev.financier.activity;

import android.Manifest;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Environment;

import androidx.core.content.ContextCompat;

import static android.os.Build.VERSION.SDK_INT;

public class RequestPermission {

public static boolean isRequestingPermission(Context context, String permission) {
Expand All @@ -15,6 +20,11 @@ public static boolean isRequestingPermission(Context context, String permission)
}

public static boolean checkPermission(Context ctx, String permission) {
/*if(SDK_INT >= 30) {
if(permission.equals(Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
return Environment.isExternalStorageManager();
}
}*/
return ContextCompat.checkSelfPermission(ctx, permission) == PackageManager.PERMISSION_GRANTED;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
package com.handydev.financier.activity;

import android.Manifest;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;

import androidx.activity.result.ActivityResult;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.appcompat.widget.SwitchCompat;

import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
Expand All @@ -23,6 +33,9 @@
import com.handydev.financier.R;
import com.handydev.financier.utils.MyPreferences;

import static android.os.Build.VERSION.SDK_INT;
import static android.provider.Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION;

@EActivity(R.layout.activity_request_permissions)
public class RequestPermissionActivity extends AppCompatActivity {

Expand Down Expand Up @@ -53,11 +66,28 @@ public class RequestPermissionActivity extends AppCompatActivity {
@ViewById(R.id.toggleSms)
SwitchCompat toggleSms;

ActivityResultLauncher<Intent> activityResultLauncher;

@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(MyPreferences.switchLocale(base));
}

/* @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(SDK_INT >= 30) {
activityResultLauncher = registerForActivityResult(
new ActivityResultContracts.StartActivityForResult(),
new ActivityResultCallback<ActivityResult>() {
@Override
public void onActivityResult(ActivityResult result) {
checkAllFilesPermission();
}
});
}
}*/

@AfterViews
public void initViews() {
checkPermissions();
Expand All @@ -66,8 +96,16 @@ public void initViews() {
}
}

private void checkAllFilesPermission() {
enableToggle(!Environment.isExternalStorageManager(), toggleWriteStorage, toggleWriteStorageWrap);
}

private void checkPermissions() {
disableToggleIfGranted(Manifest.permission.WRITE_EXTERNAL_STORAGE, toggleWriteStorage, toggleWriteStorageWrap);
//if(SDK_INT >= 30) {
// checkAllFilesPermission();
//} else {
disableToggleIfGranted(Manifest.permission.WRITE_EXTERNAL_STORAGE, toggleWriteStorage, toggleWriteStorageWrap);
//}
disableToggleIfGranted(Manifest.permission.GET_ACCOUNTS, toggleGetAccounts, toggleGetAccountsWrap);
disableToggleIfGranted(Manifest.permission.CAMERA, toggleCamera, toggleCameraWrap);
if(!BuildConfig.FLAVOR.equals("googleplay")) {
Expand All @@ -77,17 +115,26 @@ private void checkPermissions() {

private void disableToggleIfGranted(String permission, CompoundButton toggleButton, ViewGroup wrapLayout) {
if (isGranted(permission)) {
toggleButton.setChecked(true);
toggleButton.setEnabled(false);
wrapLayout.setBackgroundResource(0);
enableToggle(false, toggleButton, wrapLayout);
} else if (permission.equals(requestedPermission)) {
wrapLayout.setBackgroundResource(R.drawable.highlight_border);
}
}

private void enableToggle(Boolean enable, CompoundButton toggleButton, ViewGroup wrapLayout) {
toggleButton.setChecked(!enable);
toggleButton.setEnabled(enable);
wrapLayout.setBackgroundResource(0);
}

@Click(R.id.toggleWriteStorage)
public void onGrantWriteStorage() {
requestPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, toggleWriteStorage);
/*if(SDK_INT >= 30){
Intent intent = new Intent(ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION, Uri.parse("package:" + BuildConfig.APPLICATION_ID));
activityResultLauncher.launch(intent);
} else {*/
requestPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, toggleWriteStorage);
//}
}

@Click(R.id.toggleGetAccounts)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -630,15 +630,6 @@ open class DatabaseAdapter(context: Context?) : MyEntityManager(context) {
}
}
return CategoryTree.createFromCache(categories)
/*val c: Cursor = when {
excludingTreeId > 0 -> {
getCategoriesWithoutSubtree(excludingTreeId, includeNoCategory)
}
else -> {
getCategories(includeNoCategory)
}
}
return CategoryTree.createFromCursor<Category>(c) { obj: Cursor? -> formCursor(c) }*/
}

fun getCategoriesTree(includeNoCategory: Boolean): CategoryTree<Category> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ class BudgetListFragment: AbstractListFragment(R.layout.budget_list) {
override fun internalOnCreate(savedInstanceState: Bundle?) {
super.internalOnCreate(savedInstanceState)
val totalText = view?.findViewById<TextView>(R.id.total)
totalText?.setOnClickListener { view: View? -> showTotals() }
bFilter = view?.findViewById<ImageButton>(R.id.bFilter)
bFilter!!.setOnClickListener { v: View? ->
totalText?.setOnClickListener { showTotals() }
bFilter = view?.findViewById(R.id.bFilter)
bFilter!!.setOnClickListener {
val intent = Intent(activity!!, DateFilterActivity::class.java)
filter.toIntent(intent)
startActivityForResult(intent, FILTER_BUDGET_REQUEST)
Expand Down Expand Up @@ -183,7 +183,7 @@ class BudgetListFragment: AbstractListFragment(R.layout.budget_list) {
val recur = RecurUtils.createFromExtraString(b.recur)
AlertDialog.Builder(activity!!)
.setMessage(if (recur.interval === RecurInterval.NO_RECUR) R.string.delete_budget_confirm else R.string.delete_budget_recurring_confirm)
.setPositiveButton(R.string.yes) { arg0, arg1 ->
.setPositiveButton(R.string.yes) { _, _ ->
db!!.deleteBudget(id)
recreateCursor()
}
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/com/handydev/financier/model/Category.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ package com.handydev.financier.model

import android.database.Cursor
import com.handydev.financier.db.CategoriesCache
import com.handydev.financier.db.DatabaseAdapter
import com.handydev.financier.db.DatabaseHelper.CategoryViewColumns
import javax.persistence.Column
import javax.persistence.Entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ open class CategoryEntity<T : CategoryEntity<T>> : MyEntity() {
if (children == null) {
children = CategoryTree()
}
if(children?.any { it.id == category.id } == true) {
return
}
category.parent = this as T
category.type = type
children!!.add(category)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,6 @@ class CategoryTree<T : CategoryEntity<T>> : Iterable<T> {
if(category.title == Category.noCategory().title) {
return
}
if(level > 10) {
Log.d("f", "f")
}
addCategoryIfNeeded(category, parent)
var children = categoriesList.filter { it.left >= category.left && it.right <= category.right && it.id != category.id }
for(child in children) {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--Generated by crowdin.net-->
<resources xmlns:xliff="http://schemas.android.com/apk/res-auto">
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="accounts">Konten</string>
<string name="blotter">Protokoll</string>
<string name="currencies">Währungen</string>
Expand Down
Loading

0 comments on commit bead5f0

Please sign in to comment.