mirror of
https://github.com/SimpleMobileTools/Simple-Calculator.git
synced 2025-06-05 21:49:13 +02:00
open the app on widgets result or formula click
This commit is contained in:
@@ -48,6 +48,9 @@ public class MyWidgetProvider extends AppWidgetProvider implements Calculator {
|
|||||||
setupIntent(Constants.CLEAR, R.id.btn_clear);
|
setupIntent(Constants.CLEAR, R.id.btn_clear);
|
||||||
setupIntent(Constants.RESET, R.id.btn_reset);
|
setupIntent(Constants.RESET, R.id.btn_reset);
|
||||||
|
|
||||||
|
setupAppOpenIntent(R.id.formula);
|
||||||
|
setupAppOpenIntent(R.id.result);
|
||||||
|
|
||||||
updateWidget();
|
updateWidget();
|
||||||
super.onUpdate(context, appWidgetManager, appWidgetIds);
|
super.onUpdate(context, appWidgetManager, appWidgetIds);
|
||||||
}
|
}
|
||||||
@@ -58,6 +61,12 @@ public class MyWidgetProvider extends AppWidgetProvider implements Calculator {
|
|||||||
remoteViews.setOnClickPendingIntent(id, pendingIntent);
|
remoteViews.setOnClickPendingIntent(id, pendingIntent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setupAppOpenIntent(int id) {
|
||||||
|
final Intent intent = new Intent(cxt, MainActivity.class);
|
||||||
|
final PendingIntent pendingIntent = PendingIntent.getActivity(cxt, 0, intent, 0);
|
||||||
|
remoteViews.setOnClickPendingIntent(id, pendingIntent);
|
||||||
|
}
|
||||||
|
|
||||||
private void initVariables(Context context) {
|
private void initVariables(Context context) {
|
||||||
cxt = context;
|
cxt = context;
|
||||||
updateWidgetIds();
|
updateWidgetIds();
|
||||||
|
Reference in New Issue
Block a user