Skip to content

Instantly share code, notes, and snippets.

👓
Doing Android stuff

Mitch Tabian mitchtabian

👓
Doing Android stuff
Block or report user

Report or block mitchtabian

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View MainActivity.java
private boolean checkMapServices(){
if(isServicesOK()){
if(isMapsEnabled()){
return true;
}
}
return false;
}
private void buildAlertMessageNoGps() {
View SaveAccountProperties.kt
fun saveAccountProperties(authToken: AuthToken, accountProperties: AccountProperties): LiveData<DataState<AccountViewState>> {
return object: NetworkBoundResource<GenericResponse, Any, AccountViewState>(
sessionManager.isConnectedToTheInternet(),
true,
false
){
// not applicable
override suspend fun createCacheRequestAndReturn() {
View GetAccountProperties.kt
fun getAccountProperties(authToken: AuthToken): LiveData<DataState<AccountViewState>> {
return object: NetworkBoundResource<AccountProperties, AccountProperties, AccountViewState>(
sessionManager.isConnectedToTheInternet(),
true,
true
){
// if network is down, view the cache and return
override suspend fun createCacheRequestAndReturn() {
withContext(Dispatchers.Main){
View AccountRepository.kt
class AccountRepository
@Inject
constructor(
val openApiMainService: OpenApiMainService,
val accountPropertiesDao: AccountPropertiesDao,
val sessionManager: SessionManager
)
{
private val TAG: String = "AppDebug"
@mitchtabian
mitchtabian / code_changes.html
Created Oct 1, 2019
Code changes for lecture: "Main Package Fragments and Layouts"
View code_changes.html
<p>There's a ton of code changes in this video. Here are links to all the classes that are changed in case you need to double-check your work.</p>
<p>
<ul>
<li><a href="https://github.com/mitchtabian/Open-API-Android-App/blob/Main-Package-Fragments-and-Layouts/app/src/main/java/com/codingwithmitch/openapi/ui/main/blog/BaseBlogFragment.kt" target="_blank" rel="nofollow">BaseBlogFragment</a></li>
<li><a href="https://github.com/mitchtabian/Open-API-Android-App/blob/Main-Package-Fragments-and-Layouts/app/src/main/java/com/codingwithmitch/openapi/ui/main/blog/BlogFragment.kt" target="_blank" rel="nofollow">BlogFragment</a></li>
<li><a href="https://github.com/mitchtabian/Open-API-Android-App/blob/Main-Package-Fragments-and-Layouts/app/src/main/res/layout/fragment_blog.xml" target="_blank" rel="nofollow">fragment_blog.xml</a></li>
<li><a href="https://github.com/mitchtabian/Open-API-Android-App/blob/Main-Package-Fragments-and-Layouts/app/src/main/java/com/codingwithmitch/openapi/ui/main/blog/ViewBlogFragment.kt" t
View ListAdapterTemplate.kt
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME}#end
import androidx.recyclerview.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.AsyncListDiffer
import androidx.recyclerview.widget.DiffUtil
#parse("File Header.java")
View settings.ini
[settings]
DEBUG=True
SECRET_KEY=y#bz$z0prv)@bie(@3wa@=--ana7%%k!hvo)b-3d4#0mnhh0pi6
AWS_ACCESS_KEY_ID=M5YCPZP3QT36OWMMZS23
AWS_SECRET_ACCESS_KEY=5Npq/S/7tX2IqBl51p3QEAMJuuGvHuFH4680Cl59M3s
AWS_STORAGE_BUCKET_NAME=open-api-space
AWS_S3_ENDPOINT_URL=https://nyc3.digitaloceanspaces.com
AWS_LOCATION=open-api-static
View settings.py
INSTALLED_APPS = [
# My apps
'personal',
'account',
'blog',
# django apps
'django.contrib.admin',
View FitToScreen.java
public void fitToScreen(){
mSaveScale = 1;
float scale;
Drawable drawable = getDrawable();
if (drawable == null || drawable.getIntrinsicWidth() == 0
|| drawable.getIntrinsicHeight() == 0)
return;
int bmWidth = drawable.getIntrinsicWidth();
int bmHeight = drawable.getIntrinsicHeight();
View AppComponent.kt
package com.codingwithmitch.openapi.di
import android.app.Application
import com.codingwithmitch.openapi.BaseApplication
import dagger.BindsInstance
import dagger.Component
import dagger.android.AndroidInjectionModule
import dagger.android.AndroidInjector
import javax.inject.Singleton
You can’t perform that action at this time.