This file contains 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
Tip if you use bash just replace . zshrc with .bash_profile ? | |
Open Terminal and type in.. | |
open ~/.zshrc | |
Add the below paths | |
The path should be where your android installation is located | |
// check in your android studio the JAVA path used | |
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jbr/Contents/Home |
This file contains 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
Depdencies needed when spinning a new app from scrarch | |
// Retrofit | |
implementation 'com.squareup.retrofit2:retrofit:2.5.0' | |
implementation "com.squareup.retrofit2:converter-moshi:2.5.0" | |
implementation "com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2" | |
// Moshi | |
implementation "com.squareup.moshi:moshi:1.8.0" | |
kapt "com.squareup.moshi:moshi-kotlin-codegen:1.8.0" |
This file contains 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
#!/bin/bash | |
root_dir="" | |
find "$root_dir" -type d \( -path "*/network" -o -path "*/build" -o -path "*/backup" \) -prune -o -type f -name "*.kt" -exec grep -Hn "import com\.x\.android\.network\." {} \; |
This file contains 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
dependencies { | |
implementation 'androidx.core:core-ktx:1.6.0' | |
implementation 'androidx.appcompat:appcompat:1.3.1' | |
implementation 'com.google.android.material:material:1.4.0' | |
implementation 'androidx.constraintlayout:constraintlayout:2.0.4' | |
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' | |
implementation "androidx.fragment:fragment-ktx:1.3.6" | |
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1' |
This file contains 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
find . -name "build" -type d -exec rm -rf "{}" \; | |
rm -rf ~/.gradle/caches/ |
This file contains 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
fun requestWidgetPinning(context: Context) { | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | |
val appWidgetManager = AppWidgetManager.getInstance(context) | |
val componentName = ComponentName(context, YourAppWidget::class.java) | |
if (appWidgetManager.isRequestPinAppWidgetSupported) { | |
val pinnedWidgetCallbackIntent = Intent(context, YourAppWidget::class.java) | |
val successCallback = PendingIntent.getBroadcast( | |
context, 0, | |
pinnedWidgetCallbackIntent, 0 |
This file contains 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
private val appWidgetManager = AppWidgetManager.getInstance(context) | |
private val provider = ComponentName(context, YourAppWidget::class.java) | |
private val allWidgetIds = appWidgetManager.getAppWidgetIds(provider) | |
fun updateWigetView(type: ViewStateType) { | |
allWidgetIds.forEach { widgetId -> | |
appWidgetManager.updateAppWidget(widgetId, remoteViews) | |
} | |
} |
This file contains 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 WidgetUpdateNotifierImpl : WidgetUpdateNotifier { | |
override fun refreshWidget(context: Context) { | |
val intent = Intent(context, YourWidgetClassName::class.java) | |
intent.action = AppWidgetManager.ACTION_APPWIDGET_UPDATE | |
val componentName = ComponentName(context, YourWidgetClassName::class.java) | |
val ids: IntArray = AppWidgetManager.getInstance(context).getAppWidgetIds(componentName) | |
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, ids) | |
context.sendBroadcast(intent) | |
} |
This file contains 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
To copy all files from gcloud to your local machine | |
gsutil -m cp -r gs://bucket/xxxxx.com /Users/xxx/Documents/MyWebSite | |
Once you have uploaded the files from local to gsutil, deploy | |
gsutil rsync -r gs://xxx_bucket_name . | |
gcloud app deploy |
NewerOlder