open the app on widgets result or formula click
This commit is contained in:
parent
1210026631
commit
9829186618
|
@ -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();
|
||||||
|
|
Loading…
Reference in New Issue