open the app on widgets result or formula click

This commit is contained in:
tibbi 2016-06-04 14:04:21 +02:00
parent 1210026631
commit 9829186618
1 changed files with 9 additions and 0 deletions

View File

@ -48,6 +48,9 @@ public class MyWidgetProvider extends AppWidgetProvider implements Calculator {
setupIntent(Constants.CLEAR, R.id.btn_clear);
setupIntent(Constants.RESET, R.id.btn_reset);
setupAppOpenIntent(R.id.formula);
setupAppOpenIntent(R.id.result);
updateWidget();
super.onUpdate(context, appWidgetManager, appWidgetIds);
}
@ -58,6 +61,12 @@ public class MyWidgetProvider extends AppWidgetProvider implements Calculator {
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) {
cxt = context;
updateWidgetIds();