<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Roger Colque Calcina on Medium]]></title>
        <description><![CDATA[Stories by Roger Colque Calcina on Medium]]></description>
        <link>https://medium.com/@rogercolque?source=rss-3a1c54d08125------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*5ekmubwNtkaGIWIh.</url>
            <title>Stories by Roger Colque Calcina on Medium</title>
            <link>https://medium.com/@rogercolque?source=rss-3a1c54d08125------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 23:55:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rogercolque/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Web api with Google Sheet + AppScript]]></title>
            <link>https://rogercolque.medium.com/web-api-with-google-sheet-appscript-edae551ba8da?source=rss-3a1c54d08125------2</link>
            <guid isPermaLink="false">https://medium.com/p/edae551ba8da</guid>
            <category><![CDATA[webapi]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[app-script]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[google-sheets]]></category>
            <dc:creator><![CDATA[Roger Colque Calcina]]></dc:creator>
            <pubDate>Mon, 26 Oct 2020 19:58:30 GMT</pubDate>
            <atom:updated>2022-05-31T17:33:19.064Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*Xt9fFwPitesjZhX2tsId8A.png" /></figure><p>Google Sheets — AppScript</p><p>With Google spreadsheets we can perform operations such as Insert / Update / Delete / <strong>Read</strong> using <em>Google </em><a href="https://script.google.com/"><em>AppScript</em></a><em> </em>. And it can be used as our backend.</p><h3>Google spreadsheet settings:</h3><ol><li>Login to your Google account</li><li>Create a new spreadsheet CLICK_ <a href="https://docs.google.com/spreadsheets/">HERE</a> .</li><li>When you create a spreadsheet you will see the id in the url as highlighted in the following image</li></ol><p>Copy the url of your google sheet.</p><p>As above, you can see that I have highlighted part of the url. You can copy the shared url as you realize or just the url <strong><em>.</em></strong></p><p>4. As in the image below, go to <strong>Tools → Script Editor.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/0*HmZUqdo0SgYw9X2_.png" /></figure><h3>Google AppScript Settings:</h3><ol><li>Then you will see the following screen.</li></ol><p>Here in this editor , we have to write the code that act as a web API and will intereact GoogleSheets.</p><p>2. Below is the AppScript that you should write to the above file and save it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d2e089bfdaaf92da2c61b18661ee648b/href">https://medium.com/media/d2e089bfdaaf92da2c61b18661ee648b/href</a></iframe><p>3. Select from tab, <strong>Publish → Deploy as web app</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/60/0*ycqb5RelAxaIxdNO" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/0*GyYgPV17EH-Rv57S.png" /></figure><p>4. You will see a window like this, just make sure to select ‘Run the application’ as ‘Me’ and ‘Who has access to the application’ as ‘Anyone, even anonymous’. Every time you perform an update you must choose a new one</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/58/0*_ReWOn2mTvsdYgjH" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/463/0*gPPd8hBq3hG_QyA2.png" /></figure><p>Authorization is required. Just check the permissions. Then select your Google account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/467/0*8aZNBP1IjAt8CN0_.png" /></figure><p>You will see a screen, just expand ‘Advanced’ and click on ‘Go to YOUR_PROJECT_NAME (insecure)’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/0*x5wlZ_fejyqHwTA7.png" /></figure><p>Allow these permissions and voila!<br>Finally, you will get a window like this with the URL of the web application. Copy that web url for reference. We will use this URL to make HTTP GET requests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/60/0*xEQLhR10X1RDDX1M" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/0*Lvk94EXdnHUahNOP.png" /></figure><p>Copy the url plus the function that we declare:<br>WEB_APP_URL_SCRIPT / exec? Action = getItems<br><strong>URLs:</strong><br><strong>1. Web Api:</strong> <a href="https://script.google.com/macros/s/AKfycby01lKNm94FHYORH3_c-lHK35r4zOoZiF8_tOD-QhfujBglDiE/exec?action=getItems">https://script.google.com/macros/s/AKfycby01lKNm94FHYORH3_c-lHK35r4zOoZiF8_tOD-QhfujBcglDiE</a><br><strong>2. Example Published</strong> <a href="https://rogergcc.github.io/specials_menu/">:</a></p><p><a href="https://dailyspecialsmenu.netlify.app/">https://dailyspecialsmenu.netlify.app/</a></p><p><a href="https://github.com/rogergcc/specials_menu.git">https://github.com/rogergcc/specials_menu.git</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=edae551ba8da" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Webservices en minutos con Google Sheet como fuente de datos]]></title>
            <link>https://rogercolque.medium.com/webservices-en-minutos-con-google-sheet-como-fuente-de-datos-99bd5e19405?source=rss-3a1c54d08125------2</link>
            <guid isPermaLink="false">https://medium.com/p/99bd5e19405</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[app-script]]></category>
            <category><![CDATA[google-sheets]]></category>
            <category><![CDATA[webapi]]></category>
            <dc:creator><![CDATA[Roger Colque Calcina]]></dc:creator>
            <pubDate>Tue, 25 Aug 2020 00:23:37 GMT</pubDate>
            <atom:updated>2022-05-31T17:32:28.134Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xt9fFwPitesjZhX2tsId8A.png" /></figure><h3>Web api con Google Sheet + AppScript</h3><p>Google Sheets — AppScript</p><p>La hoja de cálculo de Google podemos realizar varias operaciones como Insertar / Actualizar / Eliminar / <strong>Leer </strong>usando Google <a href="https://script.google.com/">AppScript</a> . Y puede ser usada como nuestro fuente de datos backend.</p><h3>Configuración de la hoja de cálculo de Google:</h3><ol><li>Inicie sesión en su cuenta de Google</li><li>Crea una nueva hoja de cálculo CLICK_<a href="https://docs.google.com/spreadsheets/">AQUÍ</a> .</li><li>Cuando cree una hoja de cálculo, verá la identificación en la URL como se resalta en la siguiente imagen</li></ol><p>Copie la url de su hoja google sheet.</p><p>Como arriba, puede ver que he resaltado parte de la URL. Puede copiar la url compartida como lo realize o solo la url<strong><em>.</em></strong></p><p>4. Como en la imagen de abajo, vaya a <strong>Herramientas → Editor de secuencias de comandos.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*vYf73i0udwpIVeuavbpg8A.png" /></figure><h3>Configuración de Google AppScript:</h3><ol><li>Después del paso anterior, verá la siguiente pantalla.</li></ol><p>Aquí, en este editor, tenemos que escribir el codigo que actuará como una API web y que se comunicará con las hojas de Google.</p><p>2. A continuación se muestra el AppScript que debe escribir en el archivo anterior y guardarlo.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8e0dd5739705e1c497db620fe4c01aa9/href">https://medium.com/media/8e0dd5739705e1c497db620fe4c01aa9/href</a></iframe><p>3. Select from tab, <strong>Publish → Deploy as web app</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/1*68DVGsy4oRi3mWTptvLq5A.png" /></figure><p>4. Verá una ventana como esta, solo asegúrese de seleccionar ‘Ejecutar la aplicación’ como ’ Yo’ y ‘Quién tiene acceso a la aplicación’ como ’ Cualquiera, incluso anónimo’. Cada vez q realize una actualizacion se debe elegir nuevo</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/463/1*LcLtlzKNuZUr6VozWMS8kQ.png" /></figure><p>Se requiere autorización. Solo revisa los permisos. Luego seleccione su cuenta de Google.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*ElciD3Gmi0UpBSQtVzNhIw.png" /></figure><p>Verá una pantalla, simplemente expanda ‘Avanzado’ y haga clic en ’ Ir a YOUR_PROJECT_NAME (inseguro)’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*Vq274CSs2GPYv6vCXqRacg.png" /></figure><p>¡Permita estos permisos y listo!<br>Finalmente, obtendrá una ventana como esta con la URL de la aplicación web. Copie esa URL web como referencia. Usaremos esta URL para realizar solicitudes HTTP GET.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*hTVhu4Z4eubuThjMpxreNw.png" /></figure><p>Copiamos la url mas la funcion q declaramos:<br>WEB_APP_URL_SCRIPT/exec?action=getItems<br><strong>URLs:</strong><br>Web Api: <a href="https://script.google.com/macros/s/AKfycby01lKNm94FHYORH3_c-lHK35r4zOoZiF8_tOD-QhfujBglDiE/exec?action=getItems">https://script.google.com/macros/s/AKfycby01lKNm94FHYORH3_c-lHK35r4zOoZiF8_tOD-QhfujBglDiE/exec?action=getItems</a><br>Ejemplo Publicado<br> <a href="https://dailyspecialsmenu.netlify.app/">https://dailyspecialsmenu.netlify.app/</a></p><p><a href="https://github.com/rogergcc/specials_menu.git">https://github.com/rogergcc/specials_menu.git</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99bd5e19405" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Storage data offline in Android — sharepreferences]]></title>
            <link>https://rogercolque.medium.com/storage-data-offline-in-android-sharepreferences-39fd34a0b7ff?source=rss-3a1c54d08125------2</link>
            <guid isPermaLink="false">https://medium.com/p/39fd34a0b7ff</guid>
            <category><![CDATA[sharedpreferences]]></category>
            <category><![CDATA[offline]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[androiddev]]></category>
            <dc:creator><![CDATA[Roger Colque Calcina]]></dc:creator>
            <pubDate>Sat, 02 Nov 2019 04:18:14 GMT</pubDate>
            <atom:updated>2020-05-07T00:14:50.247Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="collection" src="https://cdn-images-1.medium.com/max/1024/0*HxsrjF22xxH0nOt0" /><figcaption>Photo by <a href="https://unsplash.com/@bright?utm_source=medium&amp;utm_medium=referral">Karen Vardazaryan</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Save you collections offline in android — sharepreferences</h3><h4>Save your favorites collections / bookmarks offline in Android App.</h4><p><a href="https://github.com/rogergcc/SharedPreferenceFavorites">rogergcc/SharedPreferenceFavorites</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*X_Pe-ccFkZAJ_J0No1Pkhw.jpeg" /></figure><p>This is my First story and i want to share a way to storage data in android app.</p><p>We are gonna use sharepreferences to save data offline. You could use for example to save Favorites list or Bookmarkers.</p><h4><strong>Sharepreferences</strong>:</h4><p>save user preferencenes in the app. Like session of user and call values in some part of the app.</p><p><strong>This time use it for save collections data. Using the same model class if this model for a webservices with retrofit or volley.</strong></p><p>Previous knowledge: Gson, Sharepreferences, POO</p><pre>implementation &#39;com.google.code.gson:gson:2.8.6&#39;<br><br>implementation &#39;com.android.volley:volley:1.1.1&#39;<br><br>implementation &#39;com.github.bumptech.glide:glide:4.3.1&#39;</pre><p><strong>API Documentation</strong> <a href="https://rickandmortyapi.com/"><em>https://rickandmortyapi.com/</em></a></p><p>API endpoint <a href="https://rickandmortyapi.com/api/character/"><em>https://rickandmortyapi.com/api/character/</em></a></p><h4><strong>Dependencies</strong>:</h4><ul><li><strong>Gson: </strong>we help us for deserializate objects.</li><li><strong>Volley</strong>: HTTP library that makes networking for Android apps</li><li><strong>Glide</strong>: Media management and image loading framework for Android</li></ul><h4>Loading favorites data method in Fragment</h4><p><a href="https://github.com/rogergcc/SharedPreferenceFavorites/blob/master/app/src/main/java/com/rogergcc/sharedpreferencefavorites/fragments/RickAndMortyFragment.java">RickAndMortyFragment.java</a></p><pre>private void loadFavoritesData() {<br>    MySharedPreference sharedPreference = new MySharedPreference(getContext());<br>    String productsFromCart = sharedPreference.retrieveFavorites();<br>    Type type = new TypeToken&lt;ArrayList&lt;RickMorty&gt;&gt;() {<br>    }.getType();<br><br>    mFavoritesList = new Gson().fromJson(productsFromCart, type);<br>    if (mFavoritesList == null) {<br>        mFavoritesList = new ArrayList&lt;&gt;();<br>    }<br>}</pre><h3>Adapter</h3><p><a href="https://github.com/rogergcc/SharedPreferenceFavorites/blob/master/app/src/main/java/com/rogergcc/sharedpreferencefavorites/adapters/RickAndMortyRecyclerViewAdapter.java">RickAndMortyRecyclerViewAdapter.java</a></p><h4>Constructor</h4><p>we have to pass Two Arguments (Two lists): Compare the <strong>Lists </strong>to identify and paint objects that are <em>already favorites</em>.</p><ul><li>The <strong>list</strong> <strong>of favorites items</strong>(sharepreferences): for compare with the webservices List.</li><li>The <strong>list from the webservices</strong></li></ul><pre>public RickAndMortyRecyclerViewAdapter(List&lt;RickMorty&gt; mFavorites, List&lt;RickMorty&gt; items) {<br>    this.mFavoritesList = mFavorites;<br>    this.mValues = items;<br><br>}</pre><h4>Check if a object already exists</h4><p><strong>We have before Override the method in the <em>Class RickMorty:</em></strong><em> compare objects with unique value (</em>getId).</p><pre>@Override()<br>public boolean equals(Object other) {<br>    // This is unavoidable, since equals() must accept an Object and not something more derived<br>    if (other instanceof RickMorty) {<br>        // Note that I use equals() here too, otherwise, again, we will check for referential equality.<br>        // Using equals() here allows the Model class to implement it&#39;s own version of equality, rather than<br>        // us always checking for referential equality.<br>        RickMorty otherProduct = (RickMorty) other;<br>        return otherProduct.getId()==(this.getId());<br>    }<br><br>    return false;<br>}</pre><p>then in the Adapter</p><pre>public static boolean checkAvailability(List&lt;RickMorty&gt; rickMortyList, RickMorty rickMorty) {<br>    for (RickMorty p : rickMortyList) {<br>        if (p.equals(rickMorty)) {<br>            return true;<br>        }<br>    }<br><br>    return false;<br>}</pre><p>In Adapter <strong>onBindViewHolder</strong></p><pre>if (mFavList.size()!=0){<br>    boolean itemExists = <strong><em>checkAvailability</em></strong>(mFavList,mProductObject.get(position));<br><br>    if (itemExists){<br>        viewHolder.select_favorito.setColorFilter(ContextCompat.<em>getColor</em>(context,<br>                R.color.<em>colorRedPrimary</em>));<br><br>    }else{<br>        viewHolder.select_favorito.clearColorFilter();<br>    }<br>}</pre><pre>viewHolder.select_favorito.setOnClickListener(new View.OnClickListener() {<br>    int button01pos = 0;<br><br>    @Override<br>    public void onClick(View v) {<br>        GsonBuilder builder = new GsonBuilder();<br>        Gson gson = builder.create();<br><br>        sharedPreference = new MySharedPreference(context);<br>        if (viewHolder.select_favorito.getColorFilter() != null) {<br>            viewHolder.select_favorito.clearColorFilter();<br>            mFavList.remove(mProductObject.get(position));<br><br>            String addNuevoItem = gson.toJson(mFavList);<br><br>            sharedPreference.addProductToTheCart(addNuevoItem);<br>        } else {<br>            viewHolder.select_favorito.setColorFilter(ContextCompat.<em>getColor</em>(context,<br>                    R.color.<em>colorRedPrimary</em>));<br>            mFavList.add(mProductObject.get(position));<br><br>            String addNuevoItem = gson.toJson(mFavList);<br>            sharedPreference.addProductToTheCart(addNuevoItem);<br><br>        }<br><br><br>    }<br>});</pre><pre>public static boolean <strong>checkAvailability</strong>(List&lt;Foto&gt; stock, Foto product) {<br>    for (Foto p : stock) {<br>        if (p.equals(product)) {<br>            return true;<br>        }<br>    }<br><br>    return false;<br>}</pre><h4>Complete Adapter class</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9f5c03d66b7f1b3c27d659b6c35221dd/href">https://medium.com/media/9f5c03d66b7f1b3c27d659b6c35221dd/href</a></iframe><p>useful links</p><h4><a href="https://www.youtube.com/watch?v=jcliHGR3CHo">https://www.youtube.com/watch?v=jcliHGR3CHo</a></h4><p><a href="https://www.codingdemos.com/android-recyclerview-example/">https://www.codingdemos.com/android-recyclerview-example/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=39fd34a0b7ff" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>