-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Android widgets, transfer balance shortcut
Transfer balance app quick shortcut Ability to select certain accounts for income/expense total on homepage Fixed budget history limit when watching selected categories New all spending summary no longer shows on wallet details page Most common transactions amount properly converted to main currency Renamed and refactored homepage section settings Home screen widgets and shortcuts (A)
- Loading branch information
1 parent
c448fe1
commit d50cc56
Showing
84 changed files
with
1,238 additions
and
675 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
budget/android/app/src/main/kotlin/com/example/budget/NetWorthPlusWidgetProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.budget.tracker_app | ||
|
||
import android.appwidget.AppWidgetManager | ||
import android.content.Context | ||
import android.content.SharedPreferences | ||
import android.graphics.BitmapFactory | ||
import android.net.Uri | ||
import android.view.View | ||
import android.widget.RemoteViews | ||
import es.antonborri.home_widget.HomeWidgetBackgroundIntent | ||
import es.antonborri.home_widget.HomeWidgetLaunchIntent | ||
import es.antonborri.home_widget.HomeWidgetProvider | ||
|
||
class NetWorthPlusWidgetProvider : HomeWidgetProvider() { | ||
|
||
override fun onUpdate(context: Context, appWidgetManager: AppWidgetManager, appWidgetIds: IntArray, widgetData: SharedPreferences) { | ||
appWidgetIds.forEach { widgetId -> | ||
|
||
val views = RemoteViews(context.packageName, R.layout.net_worth_plus_widget_layout).apply { | ||
try { | ||
setTextViewText(R.id.net_worth_amount, widgetData.getString("netWorthAmount", null) | ||
?: "0.00") | ||
|
||
setTextViewText(R.id.net_worth_transactions_number, widgetData.getString("netWorthTransactionsNumber", null) | ||
?: "0 transactions") | ||
}catch (e: Exception){} | ||
|
||
try { | ||
setInt(R.id.widget_background, "setColorFilter", android.graphics.Color.parseColor(widgetData.getString("widgetColorBackground", null) | ||
?: "#FFFFFF")); | ||
}catch (e: Exception){} | ||
|
||
try { | ||
setInt(R.id.net_worth_amount, "setTextColor", android.graphics.Color.parseColor(widgetData.getString("widgetColorText", null) | ||
?: "#FFFFFF")) | ||
setInt(R.id.net_worth_transactions_number, "setTextColor", android.graphics.Color.parseColor(widgetData.getString("widgetColorText", null) | ||
?: "#FFFFFF")) | ||
}catch (e: Exception){} | ||
|
||
try { | ||
val plusButtonIntent = HomeWidgetLaunchIntent.getActivity( | ||
context, | ||
MainActivity::class.java, | ||
Uri.parse("addTransaction")) | ||
setOnClickPendingIntent(R.id.plus_button, plusButtonIntent) | ||
|
||
val pendingIntentWithData = HomeWidgetLaunchIntent.getActivity( | ||
context, | ||
MainActivity::class.java, | ||
Uri.parse("netWorthLaunch")) | ||
setOnClickPendingIntent(R.id.widget_container, pendingIntentWithData) | ||
}catch (e: Exception){} | ||
|
||
} | ||
|
||
appWidgetManager.updateAppWidget(widgetId, views) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
budget/android/app/src/main/kotlin/com/example/budget/PlusWidgetProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.budget.tracker_app | ||
|
||
import android.appwidget.AppWidgetManager | ||
import android.content.Context | ||
import android.content.SharedPreferences | ||
import android.graphics.BitmapFactory | ||
import android.net.Uri | ||
import android.view.View | ||
import android.widget.RemoteViews | ||
import es.antonborri.home_widget.HomeWidgetBackgroundIntent | ||
import es.antonborri.home_widget.HomeWidgetLaunchIntent | ||
import es.antonborri.home_widget.HomeWidgetProvider | ||
|
||
class PlusWidgetProvider : HomeWidgetProvider() { | ||
|
||
override fun onUpdate(context: Context, appWidgetManager: AppWidgetManager, appWidgetIds: IntArray, widgetData: SharedPreferences) { | ||
appWidgetIds.forEach { widgetId -> | ||
|
||
val views = RemoteViews(context.packageName, R.layout.plus_widget_layout).apply { | ||
|
||
try { | ||
setInt(R.id.widget_background, "setColorFilter", android.graphics.Color.parseColor(widgetData.getString("widgetColorBackground", null) | ||
?: "#FFFFFF")); | ||
}catch (e: Exception){} | ||
|
||
try { | ||
setInt(R.id.plus_title, "setTextColor", android.graphics.Color.parseColor(widgetData.getString("widgetColorText", null) | ||
?: "#FFFFFF")) | ||
}catch (e: Exception){} | ||
|
||
try { | ||
val pendingIntentWithData = HomeWidgetLaunchIntent.getActivity( | ||
context, | ||
MainActivity::class.java, | ||
Uri.parse("addTransaction")) | ||
setOnClickPendingIntent(R.id.widget_container, pendingIntentWithData) | ||
}catch (e: Exception){} | ||
|
||
} | ||
|
||
appWidgetManager.updateAppWidget(widgetId, views) | ||
} | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
budget/android/app/src/main/kotlin/com/example/budget/TransferWidgetProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.budget.tracker_app | ||
|
||
import android.appwidget.AppWidgetManager | ||
import android.content.Context | ||
import android.content.SharedPreferences | ||
import android.graphics.BitmapFactory | ||
import android.net.Uri | ||
import android.view.View | ||
import android.widget.RemoteViews | ||
import es.antonborri.home_widget.HomeWidgetBackgroundIntent | ||
import es.antonborri.home_widget.HomeWidgetLaunchIntent | ||
import es.antonborri.home_widget.HomeWidgetProvider | ||
|
||
class TransferWidgetProvider : HomeWidgetProvider() { | ||
|
||
override fun onUpdate(context: Context, appWidgetManager: AppWidgetManager, appWidgetIds: IntArray, widgetData: SharedPreferences) { | ||
appWidgetIds.forEach { widgetId -> | ||
|
||
val views = RemoteViews(context.packageName, R.layout.transfer_widget_layout).apply { | ||
|
||
try { | ||
setInt(R.id.widget_background, "setColorFilter", android.graphics.Color.parseColor(widgetData.getString("widgetColorBackground", null) | ||
?: "#FFFFFF")); | ||
}catch (e: Exception){} | ||
|
||
try { | ||
setInt(R.id.transfer_image, "setColorFilter", android.graphics.Color.parseColor(widgetData.getString("widgetColorText", null) | ||
?: "#FFFFFF")); | ||
}catch (e: Exception){} | ||
|
||
try { | ||
val pendingIntentWithData = HomeWidgetLaunchIntent.getActivity( | ||
context, | ||
MainActivity::class.java, | ||
Uri.parse("transferTransaction")) | ||
setOnClickPendingIntent(R.id.widget_container, pendingIntentWithData) | ||
}catch (e: Exception){} | ||
|
||
} | ||
|
||
appWidgetManager.updateAppWidget(widgetId, views) | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<solid android:color="#80A0A0A0"/> | ||
<corners android:radius="20dp"/> | ||
</shape> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions
5
budget/android/app/src/main/res/drawable/widget_background.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<solid android:color="#FFFFFFFF"/> | ||
<corners android:radius="20dp"/> | ||
</shape> |
70 changes: 70 additions & 0 deletions
70
budget/android/app/src/main/res/layout/net_worth_plus_widget_layout.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<FrameLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:id="@+id/widget_container" | ||
android:layout_margin="6dp"> | ||
<ImageView | ||
android:id="@+id/widget_background" | ||
android:layout_width="fill_parent" | ||
android:layout_height="fill_parent" | ||
android:scaleType="fitXY" | ||
android:src="@drawable/widget_background" | ||
/> | ||
<LinearLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:orientation="horizontal" | ||
android:gravity="center_vertical" | ||
android:paddingLeft="20dp" | ||
android:paddingRight="18dp" | ||
android:paddingVertical="5dp"> | ||
<LinearLayout | ||
android:layout_width="0dp" | ||
android:layout_height="match_parent" | ||
android:gravity="center_vertical" | ||
android:layout_weight="1" | ||
android:orientation="vertical"> | ||
<TextView | ||
android:id="@+id/net_worth_amount" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="" | ||
android:gravity="start|center_vertical" | ||
android:padding="3dp" | ||
android:textSize="25sp" | ||
android:textStyle="bold" | ||
android:textColor="#000000" | ||
/> | ||
<TextView | ||
android:id="@+id/net_worth_transactions_number" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:gravity="start|center_vertical" | ||
android:padding="3dp" | ||
android:text="Tap to configure widget" | ||
android:textSize="13sp" | ||
android:textColor="#000000" | ||
/> | ||
</LinearLayout> | ||
<FrameLayout | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content"> | ||
<Button | ||
android:id="@+id/plus_button" | ||
android:layout_width="56dp" | ||
android:layout_height="56dp" | ||
android:text="+" | ||
android:textSize="28sp" | ||
android:gravity="center" | ||
android:textColor="#FFFFFF" | ||
android:textStyle="bold" | ||
android:padding="10dp" | ||
android:background="@drawable/rounded_button" | ||
/> | ||
</FrameLayout> | ||
</LinearLayout> | ||
</FrameLayout> |
Oops, something went wrong.
d50cc56
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to add widget strings to the Google Sheet that can be translated as strings in the app?