Skip to content

Commit

Permalink
removed legacy transaction list implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
mtotschnig committed Sep 30, 2022
1 parent 72d6209 commit c635975
Show file tree
Hide file tree
Showing 20 changed files with 29 additions and 2,164 deletions.
2 changes: 0 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ along with My Expenses. If not, see <http://www.gnu.org/licenses/>.

iText from http://itextpdf.com, licensed under Affero General Public License .

StickyListHeaders from http://emilsjolander.github.io/StickyListHeaders/, licensed under Apache License, Version 2.0 .

CalculatorInput, QifParser, FolderBrowser, HomeScreenWidgets and WhereFilter inspired by https://launchpad.net/financisto , licensed under GPL v2.0 .

EventRecurrence and EventRecurrenceFormatter from the Android Open Source Project, licensed under Apache License, Version 2.0 .
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Credits
=====
*My Expenses* relies on a couple of open source libraries :

- <a href="https://github.com/emilsjolander/StickyListHeaders">StickyListHeaders</a>
- <a href="http://itextpdf.com/">Itext</a>
- <a href="https://github.com/PhilJay/MPAndroidChart">MPAndroidChart</a>
- <a href="https://github.com/MrBIMC/MaterialSeekBarPreference">MaterialSeekBarPreference</a>
Expand Down
5 changes: 0 additions & 5 deletions docs/_includes/misc_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ <h2>Licence</h2>
licenced under <a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html">GPL
v2.0</a>.
</li>
<li>Includes <a
href="http://emilsjolander.github.io/StickyListHeaders/">StickyListHeaders</a>,
licensed under <a href="http://www.apache.org/licenses/LICENSE-2.0.txt">Apache License,
Version 2.0</a>.
</li>
<li>Includes category definitions from <a href="http://www.grisbi.org">Grisbi</a>,
licensed under <a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html">GPL
v2.0</a>.
Expand Down
5 changes: 0 additions & 5 deletions docs/_includes/misc_info.html.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@
licenced under <a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html">GPL
v2.0</a>.
</li>
<li>Includes <a
href="http://emilsjolander.github.io/StickyListHeaders/">StickyListHeaders</a>,
licensed under <a href="http://www.apache.org/licenses/LICENSE-2.0.txt">Apache License,
Version 2.0</a>.
</li>
<li>Includes category definitions from <a href="http://www.grisbi.org">Grisbi</a>,
licensed under <a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html">GPL
v2.0</a>.
Expand Down
2 changes: 0 additions & 2 deletions myExpenses/proguard-project.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@

-keep enum org.totschnig.myexpenses.activity.*$HelpVariant

-keep class se.emilsjolander.stickylistheaders.StickyListHeadersListView { *; }

#Picasso
-dontwarn com.squareup.okhttp.**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ import org.totschnig.myexpenses.databinding.ActivityMainBinding
import org.totschnig.myexpenses.dialog.*
import org.totschnig.myexpenses.feature.*
import org.totschnig.myexpenses.feature.Payee
import org.totschnig.myexpenses.fragment.BaseTransactionList.KEY_FILTER
import org.totschnig.myexpenses.model.*
import org.totschnig.myexpenses.model.Account.HOME_AGGREGATE_ID
import org.totschnig.myexpenses.model.Sort.Companion.fromCommandId
Expand All @@ -76,6 +75,7 @@ import org.totschnig.myexpenses.provider.DatabaseConstants.*
import org.totschnig.myexpenses.provider.TransactionProvider
import org.totschnig.myexpenses.provider.filter.CommentCriterion
import org.totschnig.myexpenses.provider.filter.Criterion
import org.totschnig.myexpenses.provider.filter.KEY_FILTER
import org.totschnig.myexpenses.provider.filter.WhereFilter
import org.totschnig.myexpenses.sync.GenericAccountService
import org.totschnig.myexpenses.sync.GenericAccountService.Companion.requestSync
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
import org.totschnig.myexpenses.dialog.TransactionDetailFragment;
import org.totschnig.myexpenses.dialog.select.SelectFilterDialog;
import org.totschnig.myexpenses.dialog.select.SelectHiddenAccountDialogFragment;
import org.totschnig.myexpenses.fragment.TransactionList;
import org.totschnig.myexpenses.model.Account;
import org.totschnig.myexpenses.model.ContribFeature;
import org.totschnig.myexpenses.model.Grouping;
Expand Down Expand Up @@ -165,34 +164,6 @@ public void onDrawerSlide(View drawerView, float slideOffset) {
if (navigationMenuView != null) {
navigationMenuView.setVerticalScrollBarEnabled(false);
}

/*getAccountList().setAdapter(mDrawerListAdapter);
getAccountList().setAreHeadersSticky(false);
getAccountList().setOnHeaderClickListener(new StickyListHeadersListView.OnHeaderClickListener() {
@Override
public void onHeaderClick(StickyListHeadersListView l, View header, int itemPosition, long headerId, boolean currentlySticky) {
if (getAccountList().isHeaderCollapsed(headerId)) {
getAccountList().expand(headerId);
} else {
getAccountList().collapse(headerId);
}
persistCollapsedHeaderIds();
}
@Override
public boolean onHeaderLongClick(StickyListHeadersListView l, View header, int itemPosition, long headerId, boolean currentlySticky) {
return false;
}
});
getAccountList().setOnItemClickListener((parent, view, position, id) -> {
if (accountId != id) {
moveToPosition(position);
closeDrawer();
}
});
registerForContextMenu(getAccountList());
getAccountList().setFastScrollEnabled(prefHandler.getBoolean(PrefKey.ACCOUNT_LIST_FAST_SCROLL, false));
*/
updateFab();
setupFabSubMenu();
if (!isScanMode()) {
Expand Down Expand Up @@ -319,7 +290,6 @@ public boolean dispatchCommand(int command, Object tag) {
return true;
}
Intent i;
TransactionList tl = null;
if (command == R.id.BUDGET_COMMAND) {
contribFeatureRequested(ContribFeature.BUDGET, null);
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import org.totschnig.myexpenses.dialog.ConfirmationDialogFragment
import org.totschnig.myexpenses.dialog.ProgressDialogFragment
import org.totschnig.myexpenses.dialog.select.SelectSingleAccountDialogFragment
import org.totschnig.myexpenses.dialog.select.SelectSingleMethodDialogFragment
import org.totschnig.myexpenses.fragment.BaseTransactionList
import org.totschnig.myexpenses.provider.CheckTransferAccountOfSplitPartsHandler
import org.totschnig.myexpenses.provider.DatabaseConstants
import org.totschnig.myexpenses.util.safeMessage
Expand Down Expand Up @@ -72,7 +71,7 @@ class RemapHandler(val activity: BaseMyExpenses) : FragmentResultListener {
else -> throw IllegalStateException("Unexpected value: $requestKey")
}
activity.showConfirmationDialog(Bundle().apply {
putString(BaseTransactionList.KEY_COLUMN, column)
putString(KEY_COLUMN, column)
putLong(DatabaseConstants.KEY_ROWID, rowId)
putString(
ConfirmationDialogFragment.KEY_TITLE_STRING,
Expand All @@ -97,13 +96,13 @@ class RemapHandler(val activity: BaseMyExpenses) : FragmentResultListener {
getString(R.string.menu_clone_transaction)
)
putInt(ConfirmationDialogFragment.KEY_COMMAND_POSITIVE, R.id.REMAP_COMMAND)
}, BaseTransactionList.REMAP_DIALOG)
}, "dialogRemap")
}

fun remap(extras: Bundle, shouldClone: Boolean) {
with(activity) {
val checkedItemIds = selectionState.map { it.id }
val column = extras.getString(BaseTransactionList.KEY_COLUMN) ?: return
val column = extras.getString(KEY_COLUMN) ?: return
if (shouldClone) {
val progressDialog = ProgressDialogFragment.newInstance(
getString(R.string.saving), null, ProgressDialog.STYLE_HORIZONTAL, false
Expand Down Expand Up @@ -240,6 +239,7 @@ class RemapHandler(val activity: BaseMyExpenses) : FragmentResultListener {
}

companion object {
const val KEY_COLUMN = "column"
const val MAP_CATEGORY_REQUEST = "mapCategory"
const val MAP_PAYEE_REQUEST = "mapPayee"
const val MAP_METHOD_REQUEST = "mapMethod"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import androidx.activity.result.contract.ActivityResultContracts
import androidx.fragment.app.FragmentResultListener
import org.totschnig.myexpenses.ACTION_SELECT_MAPPING
import org.totschnig.myexpenses.fragment.ConfirmTagDialogFragment
import org.totschnig.myexpenses.fragment.KEY_REPLACE
import org.totschnig.myexpenses.fragment.KEY_TAG_LIST

class TagHandler(val activity: BaseMyExpenses): FragmentResultListener {
Expand Down Expand Up @@ -46,6 +45,7 @@ class TagHandler(val activity: BaseMyExpenses): FragmentResultListener {
}

companion object {
const val KEY_REPLACE = "replace"
const val CONFIRM_MAP_TAG_REQUEST = "confirmMapTag"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import butterknife.ButterKnife
import butterknife.OnClick
import org.totschnig.myexpenses.R
import org.totschnig.myexpenses.activity.ProtectedFragmentActivity
import org.totschnig.myexpenses.fragment.BaseTransactionList.COMMENT_SEPARATOR
import org.totschnig.myexpenses.model.Account
import org.totschnig.myexpenses.model.AccountType
import org.totschnig.myexpenses.model.CrStatus
Expand Down Expand Up @@ -47,6 +46,8 @@ import java.time.LocalDate
import java.time.ZoneId
import java.util.*

const val COMMENT_SEPARATOR = " / "

open class TransactionAdapter(
private val groupingOverride: Grouping?,
private val context: Context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import androidx.paging.PagingSource
import androidx.paging.compose.collectAsLazyPagingItems
import dev.burnoo.compose.rememberpreference.rememberStringSetPreference
import org.totschnig.myexpenses.R
import org.totschnig.myexpenses.fragment.BaseTransactionList
import org.totschnig.myexpenses.model.CrStatus
import org.totschnig.myexpenses.model.Grouping
import org.totschnig.myexpenses.model.Money
Expand All @@ -45,6 +44,8 @@ import org.totschnig.myexpenses.viewmodel.data.*
import org.totschnig.myexpenses.viewmodel.data.Category.Companion.NO_CATEGORY_ASSIGNED_LABEL
import kotlin.math.absoluteValue

const val COMMENT_SEPARATOR = " / "

@OptIn(ExperimentalFoundationApi::class)
@Composable
fun ComposeTransactionList(
Expand Down Expand Up @@ -227,19 +228,19 @@ fun TransactionRenderer(
transaction.label?.let { append(it) }
}
transaction.comment?.takeIf { it.isNotEmpty() }?.let {
append(BaseTransactionList.COMMENT_SEPARATOR)
append(COMMENT_SEPARATOR)
withStyle(style = SpanStyle(fontStyle = FontStyle.Italic)) {
append(it)
}
}
transaction.payee?.takeIf { it.isNotEmpty() }?.let {
append(BaseTransactionList.COMMENT_SEPARATOR)
append(COMMENT_SEPARATOR)
withStyle(style = SpanStyle(textDecoration = TextDecoration.Underline)) {
append(it)
}
}
transaction.tagList?.takeIf { it.isNotEmpty() }?.let {
append(BaseTransactionList.COMMENT_SEPARATOR)
append(COMMENT_SEPARATOR)
withStyle(style = SpanStyle(fontWeight = FontWeight.Bold)) {
append(it)
}
Expand All @@ -265,7 +266,12 @@ fun TransactionRenderer(
.conditional(transaction.crStatus == CrStatus.VOID) {
drawWithContent {
drawContent()
drawLine(Color.Red, Offset(0F, size.height/2), Offset(size.width, size.height/2), voidMarkerHeight)
drawLine(
Color.Red,
Offset(0F, size.height / 2),
Offset(size.width, size.height / 2),
voidMarkerHeight
)
}
}
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

import android.content.Context;

import androidx.annotation.Nullable;

import com.google.gson.Gson;
import com.squareup.picasso.Picasso;

import org.jetbrains.annotations.NotNull;
import org.totschnig.myexpenses.MyApplication;
import org.totschnig.myexpenses.activity.BaseActivity;
import org.totschnig.myexpenses.activity.BaseMyExpenses;
Expand All @@ -32,7 +33,6 @@
import org.totschnig.myexpenses.feature.FeatureManager;
import org.totschnig.myexpenses.feature.OcrFeature;
import org.totschnig.myexpenses.fragment.BaseSettingsFragment;
import org.totschnig.myexpenses.fragment.BaseTransactionList;
import org.totschnig.myexpenses.fragment.BudgetList;
import org.totschnig.myexpenses.fragment.CsvImportDataFragment;
import org.totschnig.myexpenses.fragment.CsvImportParseFragment;
Expand All @@ -50,7 +50,6 @@
import org.totschnig.myexpenses.model.CurrencyContext;
import org.totschnig.myexpenses.preference.PrefHandler;
import org.totschnig.myexpenses.provider.BaseTransactionProvider;
import org.totschnig.myexpenses.provider.TransactionProvider;
import org.totschnig.myexpenses.retrofit.ExchangeRateService;
import org.totschnig.myexpenses.service.AutoBackupService;
import org.totschnig.myexpenses.service.PlanExecutor;
Expand Down Expand Up @@ -89,7 +88,6 @@
import javax.inject.Named;
import javax.inject.Singleton;

import androidx.annotation.Nullable;
import dagger.BindsInstance;
import dagger.Component;
import okhttp3.OkHttpClient;
Expand Down Expand Up @@ -183,8 +181,6 @@ interface Builder {

void inject(TemplatesList templatesList);

void inject(BaseTransactionList transactionList);

void inject(TransactionListDialogFragment transactionListDialogFragment);

void inject(BaseAdHandler adHandler);
Expand Down
Loading

0 comments on commit c635975

Please sign in to comment.