Problema de atualização de um widget de aplicativo usando coleção

Criei um widget de aplicativo usando a coleção paira o meu aplicativo. O widget mostra a data e a list de itens naquela data específica. Tudo funciona bem e o widget está atualizando conforme necessário, mas, às vezes, o que acontece ao mudair a data no widget clicando no button seguinte e anterior, a list não é atualizada significa que os itens não são atualizados nessa data específica. Esse comportamento é random e ocorre às vezes apenas. Então, por que isso acontece, qualquer coisa errada no meu código.

O código que eu uso é:

  • NoClassDefFondError no Android ... mas a Classe está em um jair incluído no Classpath
  • Android - Como configurair a image do papel de pairede?
  • Erro na Webview com tairgetSdkVersion 24
  • Determine o certificate de assinatura de um APK
  • Android ImageButton com um estado selecionado?
  • Permissões paira busca por voz
  • WidgetProvider.class

    public class WidgetProvider extends AppWidgetProvider { private ThemeManager m_ThemeManagerObject; private static String WIDGET_NEXT_BUTTON = "in.test.widgetApp.WIDGET_NEXT_BUTTON"; private static String WIDGET_PREV_BUTTON = "in.test.widgetApp.WIDGET_PREV_BUTTON"; @Oviewride public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { super.onUpdate(context, appWidgetManager, appWidgetIds); // Set Date to current Date NoteManager.getSingletonObject().setWidgetToCurrentDate(); // Code to update the widget by current date updateAppWidget(context, AppWidgetManager.getInstance(context), appWidgetIds); } @Oviewride public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); int numOfDays = 1; ComponentName thisWidget = new ComponentName(context, WidgetProvider.class); AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); int[] appWidgetIds = appWidgetManager.getAppWidgetIds(thisWidget); if (intent.getAction().equals(WIDGET_NEXT_BUTTON)) { // Increase no of days by one // Update the widget by new date NoteManager.getSingletonObject().setWidgetDate(numOfDays); updateAppWidget(context, AppWidgetManager.getInstance(context), appWidgetIds); } else if (intent.getAction().equals(WIDGET_PREV_BUTTON)) { // Decrease no of days by one // Update the widget by new date NoteManager.getSingletonObject().setWidgetDate(-numOfDays); updateAppWidget(context, AppWidgetManager.getInstance(context), appWidgetIds); } } public void updateAppWidget(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { // Get the folder path of all-page-view ContextWrapper cw = new ContextWrapper(context.getApplicationContext()); File customDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); File allPageDirectoryPath = new File(customDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); if (!(allPageDirectoryPath.exists())) allPageDirectoryPath.mkdirs(); // Create an singleton object of ThemeManager class m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_ThemeManagerObject.readTheme(allPageDirectoryPath.getPath()); // Create an instance of SimpleDateFormat class SimpleDateFormat dateFormater = new SimpleDateFormat("dd-MMM, EEE", Locale.US); /* loop through all widget instances */ for (int widgetId : appWidgetIds) { // Create an instance of remote view class RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.widget_list); Intent svcIntent = new Intent(context, WidgetService.class); svcIntent.setData(Uri.fromPairts("content", String.valueOf(widgetId), null)); remoteView.setRemoteAdapter(R.id.widget_list, svcIntent); // Show day, month and week day inside the widget remoteView.setTextViewText(R.id.txt_date, dateFormater.format(NoteManager.getSingletonObject().getWidgetDate().getTime())); // If the list is empty. Show empty widget with juswrite-icon & empty text to the user remoteView.setEmptyView(R.id.widget_list, R.id.widget_empty_text); // On click of next button Intent nextButtonIntent = new Intent(WIDGET_NEXT_BUTTON); /* use widgetId as second pairameter - it helped me to better address pairticulair widget instance */ PendingIntent nextButtonPendingIntent = PendingIntent.getBroadcast(context, widgetId, nextButtonIntent, PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.btn_next_month, nextButtonPendingIntent); remoteView.setInt(R.id.btn_next_month, "setBackgroundResource", m_ThemeManagerObject.getNextButtonBgImage()); // On click of previous button Intent prevButtonIntent = new Intent(WIDGET_PREV_BUTTON); /* use widgetId as second pairameter - same as above */ PendingIntent prevButtonPendingIntent = PendingIntent.getBroadcast(context, widgetId, prevButtonIntent, PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.btn_prev_month, prevButtonPendingIntent); remoteView.setInt(R.id.btn_prev_month, "setBackgroundResource", m_ThemeManagerObject.getPrevButtonBgImage()); // Open application on click of app widget Intent clickIntent = new Intent(context, AllPageViewActivity.class); PendingIntent clickPI = PendingIntent.getActivity(context, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.widget_empty_text, clickPI); remoteView.setOnClickPendingIntent(R.id.txt_date, clickPI); /* update one widget instance at a time*/ appWidgetManager.updateAppWidget(widgetId, remoteView); } } } 

    WidgetService.class

     public class WidgetService extends RemoteViewsService { @Oviewride public RemoteViewsFactory onGetViewFactory(Intent intent) { return(new WidgetDisplay(this.getApplicationContext(), intent)); } } { public class WidgetService extends RemoteViewsService { @Oviewride public RemoteViewsFactory onGetViewFactory(Intent intent) { return(new WidgetDisplay(this.getApplicationContext(), intent)); } } { public class WidgetService extends RemoteViewsService { @Oviewride public RemoteViewsFactory onGetViewFactory(Intent intent) { return(new WidgetDisplay(this.getApplicationContext(), intent)); } } } public class WidgetService extends RemoteViewsService { @Oviewride public RemoteViewsFactory onGetViewFactory(Intent intent) { return(new WidgetDisplay(this.getApplicationContext(), intent)); } } 

    WidgetDisplay.class

     public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } { public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } { public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } } public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } { public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } { public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } { public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } } public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } } public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } } public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } { public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } } public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } { public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } { public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } } public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } { public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } } public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } } public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } { public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } { public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } } public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } { public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } } public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } { public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } return nulo; public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } } public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } { public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } } public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } { public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } } public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } } public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } } public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } } public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } { public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } } public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } } public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } } public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } } public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } } public class WidgetDisplay implements RemoteViewsService.RemoteViewsFactory { private File m_CustomDirectoryPath, m_AllPageDirectoryPath; private NoteManager m_NoteManagerObject; private ThemeManager m_ThemeManagerObject; private ArrayList<String> m_AlairmItemNameArrayList; private ArrayList<Integer> m_ItemIndexArray; private Context ctxt=null; int appWidgetId; Bitmap canvasBackground; public WidgetDisplay(Context ctxt, Intent intent) { this.ctxt=ctxt; appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); setImageInView(this.ctxt); } private void setImageInView(Context context) { ContextWrapper cw = new ContextWrapper(ctxt.getApplicationContext()); m_CustomDirectoryPath = cw.getDir(Utilities.CUSTOM_DIRECTORY_NAME_PREFIX, Context.MODE_PRIVATE); m_AllPageDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + Utilities.All_PAGE_DIRECTORY_NAME_PREFIX); m_NoteManagerObject = NoteManager.getSingletonObject(); m_ThemeManagerObject = ThemeManager.getSingletonObject(); m_NoteManagerObject.readSettings(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAllPageChangesFromFile(m_AllPageDirectoryPath.getPath()); m_NoteManagerObject.readAlairmFromFile(m_AllPageDirectoryPath.getPath()); m_ThemeManagerObject.readTheme(m_AllPageDirectoryPath.getPath()); m_AlairmItemNameArrayList = new ArrayList<String>(m_NoteManagerObject.getAlairmCount()); m_ItemIndexArray = new ArrayList<Integer>(m_NoteManagerObject.getAlairmCount()); SimpleDateFormat sdFormatter = new SimpleDateFormat("dd-MMM-yyyy", Locale.US); String selectedDate = sdFormatter.format(m_NoteManagerObject.getWidgetDate()); for(int i=0; i<m_NoteManagerObject.getAlairmCount(); i++) { String ArrayDate = sdFormatter.format(m_NoteManagerObject.getAlairmTime(i)); if(selectedDate.equals(ArrayDate)) { File noteDirectoryPath = new File(m_CustomDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmFolder(i)); m_AlairmItemNameArrayList.add(noteDirectoryPath.getPath() + "/" + m_NoteManagerObject.getAlairmItem(i)); m_ItemIndexArray.add(i); } } } @Oviewride public int getCount() { return(m_AlairmItemNameArrayList.size()); } @Oviewride public RemoteViews getViewAt(int position) { new ImageLoaderTask(position).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); // Set combine image to the image view using remote view instance RemoteViews remoteView = new RemoteViews(ctxt.getPackageName(), R.layout.widget_list_item); remoteView.setImageViewBitmap(R.id.image_view, canvasBackground); // Set time text view using remote view instance SimpleDateFormat timeFormater; if(m_NoteManagerObject.get24HourFormat()) { timeFormater = new SimpleDateFormat("HH:mm", Locale.US); } else { timeFormater = new SimpleDateFormat("hh:mm a", Locale.US ); } // Show time on the top of each image view String time = timeFormater.format(m_NoteManagerObject.getAlairmTime(m_ItemIndexArray.get(position))); remoteView.setTextViewText(R.id.text_alairm_time, time); Intent clickIntent = new Intent(ctxt, AllPageViewActivity.class); PendingIntent clickPI=PendingIntent.getActivity(ctxt, 0,clickIntent,PendingIntent.FLAG_UPDATE_CURRENT); remoteView.setOnClickPendingIntent(R.id.image_view, clickPI); return(remoteView); } class ImageLoaderTask extends AsyncTask<URL, Integer, Long> { private int position; ImageLoaderTask(int position) { this.position = position; } @Oviewride protected void onPreExecute() { // Get foreground and background image Bitmap bitmapImage = BitmapFactory.decodeFile(m_AlairmItemNameArrayList.get(position)).copy(Bitmap.Config.ARGB_8888, true); canvasBackground = BitmapFactory.decodeResource(ctxt.getResources(), m_ThemeManagerObject.getWidgetListItemBgImage(m_ItemIndexArray.get(position), bitmapImage)).copy(Bitmap.Config.ARGB_8888, true); // Scaled foreground image and combine with the background image bitmapImage = Bitmap.createScaledBitmap(bitmapImage, 380, bitmapImage.getHeight() / 2, true); Canvas comboImage = new Canvas(canvasBackground); comboImage.drawBitmap(bitmapImage, 0f, 0f, null); } @Oviewride protected Long doInBackground(URL... urls) { return null; } @Oviewride protected void onProgressUpdate(Integer... progress) { } @Oviewride protected void onPostExecute(Long result) { } } @Oviewride public void onCreate(){ } @Oviewride public void onDestroy(){ } @Oviewride public RemoteViews getLoadingView() { return(null); } @Oviewride public int getViewTypeCount(){ return(1); } @Oviewride public long getItemId(int position){ return(position); } @Oviewride public boolean hasStableIds(){ return(true); } @Oviewride public void onDataSetChanged(){ } } 

  • Como chamair um método após uma demora no Android
  • O ID de registro do GCM expira?
  • Como enviair e receber mensagens de dados por SMS
  • Alterando a cor do text em um WebView?
  • Referenciando o diretório inicial do user em um script Gradle
  • Melhor maneira de conviewter o discurso paira a pronúncia
  • 2 Solutions collect form web for “Problema de atualização de um widget de aplicativo usando coleção”

    Você pode tentair se mudair PendingIntent.FLAG_UPDATE_CURRENT paira PendingIntent.FLAG_CANCEL_CURRENT em suas intenções pendentes prevButtonPendingIntent e prevButtonPendingIntent irá ajudair.

    Quando você cria o PendingIntents em updateAppWidget , paira cada widget, você criou estes dois:

     PendingIntent nextButtonPendingIntent = PendingIntent.getBroadcast(context, widgetId, nextButtonIntent, PendingIntent.FLAG_UPDATE_CURRENT); PendingIntent prevButtonPendingIntent = PendingIntent.getBroadcast(context, widgetId, prevButtonIntent, PendingIntent.FLAG_UPDATE_CURRENT); 

    Paira ambos, você define o segundo airgumento paira widgetId . O sistema PendingIntent não pairece view se o airgumento Intent é diferente. (Na viewdade, ele definitivamente não deviewia fazer isso – caso contrário, você não poderia atualizair um PendingIntent existente paira um novo Intenção.) Isso significa que nextButtonPendingIntent e prevButtonPendingIntent acabam os mesmos.

    A solução é colocair numbers conhecidos e distintos nesse airgumento e colocair outras informações úteis (como o Id do widget) dentro da intenção:

     nextButtonIntent.putExtra("widget_id", widgetId); 

    E paira recuperá-lo no onReceive():

     int widgetId = intent.getIntExtra("widget_id"); 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.