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
| public class MyAsyncTask extends AsyncTask<Void, Void, Cursor> { | |
| @Override | |
| protected Cursor doInBackground(Void... params) { | |
| DatabaseHelper helper = new DatabaseHelper(MainActivity.this); | |
| return helper.getReadableDatabase().rawQuery("SELECT * FROM myTable", null); | |
| } | |
| @Override |
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 se.marteinn.ui; | |
| import android.content.Context; | |
| import android.util.AttributeSet; | |
| import android.view.View; | |
| import android.widget.ScrollView; | |
| /** | |
| * Triggers a event when scrolling reaches bottom. |
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
| /* | |
| * Copyright (C) 2014 Antonio Leiva Gordillo. | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
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
| /* | |
| * Author: Felipe Herranz ([email protected]) | |
| * Contributors:Francesco Verheye ([email protected]) | |
| * Israel Dominguez ([email protected]) | |
| */ | |
| import java.util.ArrayList; | |
| import java.util.List; | |
| import java.util.concurrent.atomic.AtomicBoolean; | |
| import android.os.Handler; |
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"?> | |
| <resources> | |
| <!-- google's material design colours from | |
| http://www.google.com/design/spec/style/color.html#color-ui-color-palette --> | |
| <!--reds--> | |
| <color name="md_red_50">#FFEBEE</color> | |
| <color name="md_red_100">#FFCDD2</color> | |
| <color name="md_red_200">#EF9A9A</color> |
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
| public class BaseActivity extends AppCompatActivity | |
| { | |
| public DrawerLayout drawerLayout; | |
| public ListView drawerList; | |
| private ActionBarDrawerToggle drawerToggle; | |
| protected void onCreate(Bundle savedInstanceState) | |
| { | |
| // R.id.drawer_layout should be in every activity with exactly the same id. | |
| drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); |
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
| /** | |
| * An enhanced {@code CheckBox} that differentiates between user clicks and | |
| * programmatic clicks. In particular, the {@code OnCheckedChangeListener} is | |
| * <strong>not</strong> triggered when the state of the checkbox is changed | |
| * programmatically. | |
| * | |
| */ | |
| public class EnhancedCheckBox extends CheckBox implements ProgrammaticallyCheckable{ | |
| private CompoundButton.OnCheckedChangeListener mListener = null; | |
| public EnhancedCheckBox(Context 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
| public static boolean is(Context context) { | |
| try { | |
| ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); | |
| if (cm.getNetworkInfo(ConnectivityManager.TYPE_WIFI).isConnected()) { | |
| return true; | |
| } else if(cm.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).isConnected()){ | |
| return true; | |
| } else { | |
| return false; | |
| } |
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 android.content.Context; | |
| import android.content.res.TypedArray; | |
| import android.graphics.Canvas; | |
| import android.graphics.Rect; | |
| import android.graphics.drawable.Drawable; | |
| import android.support.v7.widget.LinearLayoutManager; | |
| import android.support.v7.widget.RecyclerView; | |
| import android.util.AttributeSet; | |
| import android.view.View; |