This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package aayushsharma.me.app | |
import android.app.Activity | |
import android.content.Intent | |
import android.os.Bundle | |
import android.util.Log | |
import androidx.annotation.NonNull | |
import io.flutter.embedding.android.FlutterActivity | |
import io.flutter.embedding.engine.FlutterEngine | |
import io.flutter.plugin.common.MethodChannel |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:math'; | |
import 'dart:ui'; | |
import 'package:flutter/material.dart'; | |
class GateOpenPageTransition extends StatefulWidget { | |
const GateOpenPageTransition({ | |
super.key, | |
required this.child, | |
this.backgroundColor = Colors.white, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"relation": ["delegate_permission/common.handle_all_urls"], | |
"target": { | |
"namespace": "android_app", | |
"package_name": "com.example.app", | |
"sha256_cert_fingerprints": | |
[ | |
"SHA-256-1", | |
"SHA-256-2" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ListViewAppWidgetProvider : HomeWidgetProvider() { | |
... | |
/// Capture the intent, replace current view with a loader and trigger WorkRequest | |
override fun onReceive(context: Context?, intent: Intent?) { | |
super.onReceive(context, intent) | |
val action = intent?.action | |
if (action == "com.example.listview_app_widget.refresh") { | |
val appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID) | |
val loader = RemoteViews(context!!.packageName, R.layout.listview_widget_loader) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<vector android:height="24dp" android:tint="#000000" | |
android:viewportHeight="24" android:viewportWidth="24" | |
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> | |
<path android:fillColor="@android:color/white" android:pathData="M17.65,6.35C16.2,4.9 14.21,4 12,4c-4.42,0 -7.99,3.58 -7.99,8s3.57,8 7.99,8c3.73,0 6.84,-2.55 7.73,-6h-2.08c-0.82,2.33 -3.04,4 -5.65,4 -3.31,0 -6,-2.69 -6,-6s2.69,-6 6,-6c1.66,0 3.14,0.69 4.22,1.78L13,11h7V4l-2.35,2.35z"/> | |
</vector> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:id="@android:id/background" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:orientation="vertical" | |
android:padding="8dp" | |
android:layout_centerVertical="true" | |
android:background="@android:color/white"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ListViewRemoteViewsFactory(private val context: Context, private val intent: Intent?) : RemoteViewsService.RemoteViewsFactory{ | |
private var articles: List<NewsArticle>? = null | |
private var articleImages: List<Bitmap?> = ArrayList() | |
override fun onCreate() { | |
val articlesJson: String? = intent?.extras?.getString("ARTICLES_JSON","") | |
if(articlesJson != null) { | |
... | |
// Load images | |
LoadImagesTask().execute(articles) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ListViewRemoteViewsFactory(private val context: Context, private val intent: Intent?) : RemoteViewsService.RemoteViewsFactory{ | |
private var articleImages: List<Bitmap?> = ArrayList() | |
... | |
private inner class LoadImagesTask : AsyncTask<List<NewsArticle>, Void, List<Bitmap?>>() { | |
override fun doInBackground(vararg params: List<NewsArticle>): List<Bitmap?> { | |
return params[0].map { article -> | |
try { | |
Glide.with(context) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ListViewRemoteViewsFactory(private val context: Context, private val intent: Intent?) : RemoteViewsService.RemoteViewsFactory{ | |
private var articles: List<NewsArticle>? = null | |
override fun onCreate() { | |
val articlesJson: String? = intent?.extras?.getString("ARTICLES_JSON","") | |
if(articlesJson != null) { | |
val articleListType = object : TypeToken<List<NewsArticle>>() {}.type | |
val data: List<NewsArticle> = Gson().fromJson(articlesJson, articleListType) | |
articles = data | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ListViewAppWidgetProvider : HomeWidgetProvider() { | |
override fun onUpdate( | |
context: Context, | |
appWidgetManager: AppWidgetManager, | |
appWidgetIds: IntArray, | |
widgetData: SharedPreferences | |
) { | |
// Attempts to get the data from shared preferences | |
val data = HomeWidgetPlugin.getData(context).getString("NEWS_ARTICLES_DATA","") | |
appWidgetIds.forEach { id -> |
NewerOlder