app/src/main/java/io/github/jokoframework/activity/CountryActivity.java
public class CountryActivity extends Activity {

    private static final String LOG_TAG = "COUNTRYACTIVITY";

    public static List<Country> countryList;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_country);

        final TableLayout tableLayout = findViewById(R.id.tableLayout);
        final MaterialButton button = findViewById(R.id.show_countries);

        findViewById(R.id.volver2).setOnClickListener(v -> {
            Intent backHome = new Intent(CountryActivity.this, HomeActivity.class);
            startActivity(backHome);
            finish();
            overridePendingTransition(R.anim.left_to_right, R.anim.right_to_left);
        });

        //Clearing old records from database
        //CountryDatabase.getAppDataBase(this).countryDao().deleteAll();

        // Show all country from database
        tableLayout.removeAllViews();

        if (countryList.size() == 0){
            View tableRow = LayoutInflater.from(CountryActivity.this).inflate(R.layout.table_item, null, false);
            TextView countryName = tableRow.findViewById(R.id.countryName);
            countryName.setText("Sin paises.");
            tableLayout.addView(tableRow);
        } else {
            for (int i = 0; i < countryList.size(); i++) {
                View tableRow = LayoutInflater.from(CountryActivity.this).inflate(R.layout.table_item, null, false);
                TextView cID = tableRow.findViewById(R.id.cid);
                TextView countryName = tableRow.findViewById(R.id.countryName);
                TextView countryCode = tableRow.findViewById(R.id.countryCode);

                cID.setText(String.valueOf(countryList.get(i).getCid()));
                countryName.setText(countryList.get(i).getCountryName());
                countryCode.setText(countryList.get(i).getCountryCode());
                tableLayout.addView(tableRow);
            }
        }

        button.setOnClickListener(v -> {
            try {
                Intent mServiceIntent = new Intent(getBaseContext(), io.github.jokoframework.service.CountryHelper.class);
                getBaseContext().startService(mServiceIntent);
                Utils.showToast(getBaseContext(), "Actualizando lista...");
            } catch (RuntimeException e) {
                Utils.showToast(getBaseContext(), "Fallo de CountryHelper");
                Toast.makeText(getBaseContext(), getBaseContext().getString(R.string.no_network_connection), Toast.LENGTH_SHORT).show();
                Log.e(LOG_TAG, getBaseContext().getString(R.string.no_network_connection), e);
            }

            tableLayout.removeAllViews();

            if (countryList.size() == 0){
                View tableRow = LayoutInflater.from(CountryActivity.this).inflate(R.layout.table_item, null, false);
                TextView countryName = tableRow.findViewById(R.id.countryName);
                countryName.setText("Sin paises.");
                tableLayout.addView(tableRow);
            } else {
                for (int i = 0; i < countryList.size(); i++) {
                    View tableRow = LayoutInflater.from(CountryActivity.this).inflate(R.layout.table_item, null, false);
                    TextView cID = tableRow.findViewById(R.id.cid);
                    TextView countryName = tableRow.findViewById(R.id.countryName);
                    TextView countryCode = tableRow.findViewById(R.id.countryCode);

                    cID.setText(String.valueOf(countryList.get(i).getCid()));
                    countryName.setText(countryList.get(i).getCountryName());
                    countryCode.setText(countryList.get(i).getCountryCode());
                    tableLayout.addView(tableRow);
                }
            }
        });
    }

    @Override
    protected void onDestroy() {
        CountryDatabase.destroyInstance();
        super.onDestroy();
    }
}
mboehaolib/src/main/java/io/github/jokoframework/mboehaolib/util/Utils.java
public class Utils {
    private static final String LOG_TAG = Utils.class.getName();

    private static Random random = new Random();

    private Utils() {
        Utils.random.setSeed(System.currentTimeMillis());
    }

    public static void throwToast(String msg, Context context) {
        Toast toast = Toast.makeText(context, msg, Toast.LENGTH_SHORT);
        toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
        toast.setDuration(Toast.LENGTH_SHORT);
        toast.show();
    }

    public static void showStickyMessage(Activity activity, String message, Style style) {
        showMessage(activity, message, style, Configuration.DURATION_INFINITE, Boolean.TRUE);
    }

    public static void showStickyMessage(Activity activity, String message) {
        showInfoMessage(activity, message, Configuration.DURATION_INFINITE, Boolean.TRUE);
    }

    public static void showMessage(Activity activity, String message, Style style, Integer duration, Boolean sticky) {
        final Configuration configuration = new Configuration.Builder()
                .setDuration(duration)
                .build();
        final Crouton crouton = Crouton.makeText(activity, message, style)
                .setConfiguration(configuration);
        if (sticky) {
            crouton.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Crouton.hide(crouton);
                }
            });
        }
        crouton.show();
    }

    public static void showInfoMessage(final Activity activity, final String message,
                                       final Integer duration, final Boolean sticky) {
        if (activity != null) {
            activity.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    final Configuration configuration = new Configuration.Builder()
                            .setDuration(duration)
                            .build();
                    // Define custom styles for crouton
                    Style style = new Style.Builder().build();
                    // Display notice with custom style and configuration
                    final Crouton crouton = Crouton.makeText(activity, message, style)
                            .setConfiguration(configuration);
                    if (sticky) {
                        crouton.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                Crouton.hide(crouton);
                            }
                        });
                    }
                    crouton.show();
                }
            });
        }
    }

    public static boolean isValidPassword(String password) {
        return password.length() >= Constants.PASSWORD_MIN_LENGTH;
    }

    public static String getPrefs(Context context, String id) {
        if (context != null) {
            SharedPreferences prefs = getSharedPreferences(context);
            return prefs.getString(id, "");
        } else {
            Log.e(LOG_TAG, "Se intentó guardar una preferencia con el context null. getPrefs)");
            return "";
        }
    }

    public static Boolean getBooleanPrefs(Context context, String id) {
        if (context != null) {
            SharedPreferences prefs = getSharedPreferences(context);
            return prefs.getBoolean(id, false);
        } else {
            Log.e(LOG_TAG, "Se intentó guardar una preferencia con el context null. getBooleanPrefs)");
            return false;
        }
    }

    //BEGIN-IGNORE-SONARQUBE
    private static SharedPreferences getSharedPreferences(Context context) {
        // afeltes - 2017-01-23
        //Para revisar con más cuidado, no sabemos si antes del mboehaolib se usaba el "id" para algo
        return context.getSharedPreferences("SimplePref", Context.MODE_MULTI_PROCESS);
    }
    //BEGIN-IGNORE-SONARQUBE

    public static boolean getBoolPrefs(Context context, String id) {
        if (context != null) {
            SharedPreferences prefs = getSharedPreferences(context);
            return prefs.getBoolean(id, false);
        } else {
            Log.e(LOG_TAG, "Se intentó guardar una preferencia con el context null. getBoolPrefs)");
            return false;
        }
    }

    public static int getIntPrefs(Context context, String id) {
        if (context != null) {
            SharedPreferences prefs = getSharedPreferences(context);
            return prefs.getInt(id, 0);
        } else {
            Log.e(LOG_TAG, "Se intentó guardar una preferencia con el context null. getInt)");
            return 0;
        }
    }

    public static long getLongPrefs(Context context, String id) {
        if (context != null) {
            SharedPreferences prefs = getSharedPreferences(context);
            long myLongValue = 0;
            return prefs.getLong(id, myLongValue);
        } else {
            Log.e(LOG_TAG, "Se intentó guardar una preferencia con el context null. getLong)");
            return 0L;
        }
    }

    public static void addPrefs(Context context, String id, String value) {
        if (context != null) {
            SharedPreferences prefs = getSharedPreferences(context);
            SharedPreferences.Editor edit = prefs.edit();
            edit.putString(id, value);
            edit.commit();
        } else {
            Log.e(LOG_TAG, "El Context que se desea utilizar es nulo. addPrefs(..String)");
        }
    }

    public static void addPrefs(Context context, String id, Boolean value) {
        if (context != null) {
            SharedPreferences prefs = getSharedPreferences(context);
            SharedPreferences.Editor edit = prefs.edit();
            edit.putBoolean(id, value);
            edit.commit();
        } else {
            Log.e(LOG_TAG, "El Context que se desea utilizar es nulo. addPrefs(..Boolean)");
        }
    }

    public static void addPrefs(Context context, String id, long value) {
        if (context != null) {
            SharedPreferences prefs = getSharedPreferences(context);
            SharedPreferences.Editor edit = prefs.edit();
            edit.putLong(id, value);
            edit.commit();
        } else {
            Log.e(LOG_TAG, "Se intentó guardar una preferencia con el context null. addPrefs(... long)");
        }
    }


    public static boolean isNetworkAvailable(Activity activity) {
        return isNetworkAvailable((Context) activity);
    }

    public static String getShareableImageName(String suffix) {
        return String.format("mboehao-linechart-%s-%s.png", StringUtils.isBlank(suffix) ? "test" : suffix, Utils.getFormattedDate(new Date()));
    }

    public static String getFormattedDate(Date savedAt) {
        SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yy");
        return sdf.format(savedAt);
    }

    public static boolean isNetworkAvailable(Context context) {
        boolean isNetworkAvailable = false;
        if (context != null) {
            ConnectivityManager connectivityManager
                    = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
            NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
            isNetworkAvailable = activeNetworkInfo != null && activeNetworkInfo.isConnected();
        }
        return isNetworkAvailable;
    }

    public static boolean isParseSessionActive() {
        return false;
    }

    public static File getShareImagesFolder() {
        return new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM) + "/Mboehao/");
    }

    public static void showToast(final Context context, final String message) {
        if (context != null) {
            Handler handler = new Handler(Looper.getMainLooper());
            handler.post(new Runnable() {
                @Override
                public void run() {
                    Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
                }
            });
        }
    }

    public static void sleep(long time) {
        try {
            Thread.sleep(time);
        } catch (InterruptedException e) {
            Log.e(LOG_TAG, "Error durmiendo thread", e);
        }
    }
}
app/src/main/java/io/github/jokoframework/activity/LineChartActivity.java
public class LineChartActivity extends Activity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_linechart);

        ImageView backButton = findViewById(R.id.backButton2);

        backButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                backToHome();
            }
        });

        //Points to be in the graph...
        List<FloatDataPair> data = new ArrayList<>();
        data.add(new FloatDataPair(0f,15000f));
        data.add(new FloatDataPair(0.1f,17500f));
        data.add(new FloatDataPair(0.2f,16500f));
        data.add(new FloatDataPair(0.3f,18500f));
        data.add(new FloatDataPair(0.4f,20500f));

        // The Chart whe are gonna use...
        LineChart lineChart = findViewById(R.id.line_chart);

        //Configs...
        Description desc = new Description();
        desc.setText(getString(R.string.chart_description));
        desc.setTextColor(R.color.white);
        lineChart.setMarker(new MyMarkView(this));
        lineChart.setDrawMarkers(true);
        lineChart.setDescription(desc);
        lineChart.setBackgroundColor(getResources().getColor(R.color.white));
        lineChart.animateX(3000);
        lineChart.setHighlightPerDragEnabled(false);
        lineChart.setHighlightPerTapEnabled(true);

        //More configs to Axis representation...
        setFormatAxis(lineChart);

        // insertion of the entries ...
        dataChartInsertion(data, lineChart,this); // data introduccio & styling,others...

    }

    public void dataChartInsertion(List<FloatDataPair> dataObjects, LineChart chart, Context context){
        List<Entry> entries = new ArrayList<>();

        for (FloatDataPair data : dataObjects) {
            entries.add(new Entry(data.getX(), data.getY()));// The constructer gives you the chance to add a Drawable icon...
        }

        LineDataSet dataSet = new LineDataSet(entries, "Testing Chart");// add entries to dataset
        dataSet.setColors(new int[] { R.color.group_divider_color, R.color.colorPrimary}, context);
        dataSet.setHighlightEnabled(true);
        dataSet.setCircleColors(new int[] {R.color.group_divider_color},context);
        dataSet.setCircleRadius(0.4f);
        dataSet.setAxisDependency(YAxis.AxisDependency.RIGHT);
        dataSet.setLineWidth(0.5f);
        List<Integer> colorText = new ArrayList();
        colorText.add(R.color.progress_bar);
        dataSet.setValueTextColors(colorText);


        List<ILineDataSet> dataSets = new ArrayList<>(); // if it must be more than 1 dataset...
        dataSets.add(dataSet);

        LineData lineData = new LineData(dataSets);

        chart.setData(lineData);
        chart.invalidate(); // refresh, could be a sync button...
    }

    public void setFormatAxis(LineChart mLineChart){
        // Eje X...
        XAxis xAxis = mLineChart.getXAxis();
        xAxis.setDrawAxisLine(true);
        xAxis.setDrawGridLines(false);

        // Eje Y...
        //Right
        YAxis yAxisR = mLineChart.getAxisRight();
        yAxisR.setDrawAxisLine(false);
        yAxisR.setDrawGridLines(false);
        yAxisR.setDrawLabels(false);
        //Left
        YAxis yAxisL = mLineChart.getAxisLeft();
        yAxisL.setDrawAxisLine(true);
        yAxisL.setDrawGridLines(false);

        mLineChart.setDrawGridBackground(false);
    }

    private void backToHome() {
        Intent intent = new Intent(this, HomeActivity.class);
        startActivity(intent);
        finish();
        overridePendingTransition(R.anim.left_to_right, R.anim.right_to_left);
    }

}
app/src/main/java/io/github/jokoframework/otp/OtpActivity.java
public class OtpActivity extends Activity{
    private TokenAdapter mTokenAdapter;
    public static final String ACTION_IMAGE_SAVED = "io.github.jokoframework.otp.ACTION_IMAGE_SAVED";
    RefreshListBroadcastReceiver receiver = new RefreshListBroadcastReceiver();

    private class RefreshListBroadcastReceiver extends BroadcastReceiver {
        @Override
        public void onReceive(Context context, Intent intent) {
            mTokenAdapter.notifyDataSetChanged();
        }
    }

    @RequiresApi(api = Build.VERSION_CODES.M)
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_otp);

        findViewById(R.id.scanImage).setOnClickListener(v -> tryOpenCamera());

        findViewById(R.id.back1).setOnClickListener(v -> {
            Intent intent = new Intent(OtpActivity.this, HomeActivity.class);
            startActivity(intent);
            finish();
            overridePendingTransition(R.anim.left_to_right, R.anim.right_to_left);
        });

        mTokenAdapter = new TokenAdapter(this);
        registerReceiver(receiver, new IntentFilter(ACTION_IMAGE_SAVED));
        ((GridView) findViewById(R.id.grid)).setAdapter(mTokenAdapter);

        // Don't permit screenshots since these might contain OTP codes.
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);

        DataSetObserver mDataSetObserver = new DataSetObserver() {
            @Override
            public void onChanged() {
                super.onChanged();
                if (mTokenAdapter.getCount() == 0)
                    findViewById(android.R.id.empty).setVisibility(View.VISIBLE);
                else
                    findViewById(android.R.id.empty).setVisibility(View.GONE);
            }
        };
        mTokenAdapter.registerDataSetObserver(mDataSetObserver);
    }

    @Override
    protected void onResume() {
        super.onResume();
        mTokenAdapter.notifyDataSetChanged();
    }

    @Override
    protected void onPause() {
        super.onPause();
        mTokenAdapter.notifyDataSetChanged();
    }

    @RequiresApi(api = Build.VERSION_CODES.M)
    private void tryOpenCamera() {
        if (checkSelfPermission(Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
            int PERMISSIONS_REQUEST_CAMERA = 1;
            requestPermissions(new String[]{Manifest.permission.CAMERA}, PERMISSIONS_REQUEST_CAMERA);
        }
        else {
            // permission is already granted
            openCamera();
        }
    }

    private void openCamera() {
        startActivity(new Intent(this, ScanActivity.class));
        overridePendingTransition(R.anim.fadein, R.anim.fadeout);
    }
}
app/src/main/java/io/github/jokoframework/activity/LogOutActivity.java
public class LogOutActivity extends BaseActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Intent login = new Intent(this, LoginActivity.class);
        doLogout(login);
    }

    private void doLogout(Intent intent) {
        if(getApp().getUserData() != null) {
            getApp().getUserData().logout();
        }
        startActivity(intent);
        finish();
    }
}
app/src/main/java/io/github/jokoframework/activity/HorizontalBarChartActivity.java
public class HorizontalBarChartActivity extends Activity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_horizontalbarchart);

        ImageView backButton = findViewById(R.id.backButton4);

        backButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                backToHome();
            }
        });

        //Points to be in the graph...
        List<FloatDataPair> data = new ArrayList<>();

        data.add(new FloatDataPair(0,110f));
        data.add(new FloatDataPair(1,70f));
        data.add(new FloatDataPair(2,300f));
        data.add(new FloatDataPair(3,220f));
        data.add(new FloatDataPair(4,350f));

        // The Chart whe are gonna use...
        HorizontalBarChart horizontalBarChart = findViewById(R.id.horizontalbar_chart);
        //Configs...
        Description desc = new Description();
        desc.setText(getString(R.string.chart_description));
        desc.setTextColor(R.color.white);
        horizontalBarChart.setDescription(desc);
        horizontalBarChart.setBackgroundColor(getResources().getColor(R.color.white));
        horizontalBarChart.setMarker(new MyDialogMarkView(this)); // se puede hacer varias clases de Marks, segun graficos o topicos...
        horizontalBarChart.setScaleEnabled(true);
        horizontalBarChart.animateXY(2000,2000);

        //More configs to Axis representation...
        setFormatAxis(horizontalBarChart);

        // insertion of the entries ...
        dataChartInsertion(data, horizontalBarChart); // data introduccio & styling,others...

    }

    public void dataChartInsertion(List<FloatDataPair> dataObjects, HorizontalBarChart chart){

        List<BarEntry> entries = new ArrayList<>();

        for (FloatDataPair data : dataObjects) {
            entries.add(new BarEntry(data.getXi(), data.getY()));// The constructer gives you the chance to add a Drawable icon...
        }

        BarDataSet dataSet = new BarDataSet(entries, "Testing HorizontalBarChart");
        // add entries to dataset
        dataSet.setColors(new int[]{getResources().getColor(R.color.background_drawer_group),
                getResources().getColor(R.color.colorAccent),
                getResources().getColor(R.color.colorPrimary),
                getResources().getColor(R.color.black),
                getResources().getColor(R.color.drawer_text)});
        dataSet.setHighlightEnabled(true);
        dataSet.setValueTextColor(getResources().getColor(R.color.progress_bar));

        List<IBarDataSet> dataSets = new ArrayList<>(); // if it must be more than 1 dataset...
        dataSets.add(dataSet);

        BarData barData = new BarData(dataSet);
        barData.setBarWidth(0.9f); // set custom bar width
        chart.setData(barData);

        chart.invalidate(); // refresh, could be a sync button...
    }

    private void setFormatAxis(HorizontalBarChart hbarChart){
        String[] labels = new String[] {"08/2017","09/2017","10/2017","11/2017","12/2017"};

        class LabelFormatter implements IAxisValueFormatter {
            private final String[] mLabels;

            public LabelFormatter(String[] labels) {
                mLabels = labels;
            }

            @Override
            public String getFormattedValue(float value, AxisBase axis) {
                return mLabels[(int) value];
            }

        }

        // Eje X...
        XAxis xAxis = hbarChart.getXAxis();
        xAxis.setDrawAxisLine(true);
        xAxis.setDrawGridLines(false);
        xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
        xAxis.setValueFormatter(new LabelFormatter(labels));

        // Eje Y...
        //Right
        YAxis yAxisR = hbarChart.getAxisRight();
        yAxisR.setDrawAxisLine(true);
        yAxisR.setDrawGridLines(false);
        yAxisR.setDrawLabels(true);
        //Left
        YAxis yAxisL = hbarChart.getAxisLeft();
        yAxisL.setDrawAxisLine(true);
        yAxisL.setDrawGridLines(false);

        hbarChart.setDrawGridBackground(false);
        hbarChart.setFitBars(true); // make the x-axis fit exactly all bars

    }

    private void backToHome() {
        Intent intent = new Intent(this, HomeActivity.class);
        startActivity(intent);
        finish();
        overridePendingTransition(R.anim.left_to_right, R.anim.right_to_left);
    }
}
app/src/main/java/io/github/jokoframework/activity/ChangePasswordActivity.java
public class ChangePasswordActivity extends Activity {

    private static final String LOG_TAG = ChangePasswordActivity.class.getSimpleName();

    private Activity self;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        self = this;
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_options);

        final EditText currentPasswordEdit = findViewById(R.id.EditTextCurrentPassword);
        final EditText password1 = findViewById(R.id.EditText_Pwd1);
        final EditText password2 = findViewById(R.id.EditText_Pwd2);
        final TextView error = findViewById(R.id.TextView_PwdProblem);

        password2.addTextChangedListener(new TextWatcher() {
            public void afterTextChanged(Editable s) {
                checkNewPasswords(password1, password2, error);
            }

            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
                //not needed...
            }

            public void onTextChanged(CharSequence s, int start, int before, int count) {
                //not needed...
            }
        });

        password1.addTextChangedListener(new TextWatcher() {
            public void afterTextChanged(Editable s) {
                if (password2.getText() != null && StringUtils.isNotBlank(password2.getText().toString())) {
                    checkNewPasswords(password1, password2, error);
                }
            }

            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
                //not needed...
            }

            public void onTextChanged(CharSequence s, int start, int before, int count) {
                //not needed...
            }
        });

        View acceptButton = findViewById(R.id.save_change_password);
        View refusetButton = findViewById(R.id.cancel_change_password);

        acceptButton.setOnClickListener(view -> {
            String currentStoredPassword = SecurityUtils.decrypt(Utils.getPrefs(self, Constants.USER_PREFS_PW));
            Log.d(LOG_TAG, "Guardando contraseña");
            if (currentPasswordEdit.getText() != null) {
                String currentPassword = currentPasswordEdit.getText().toString();
                if (StringUtils.isBlank(currentPassword) || !currentPassword.equals(currentStoredPassword)) { // No es doble comprobante de que esta vacia la currentPassword.?
                    showCurrentPasswordWarning(error, currentPasswordEdit);
                } else {
                    String strPassword1 = password1.getText().toString();
                    final String strPassword2 = password2.getText().toString();
                    if (strPassword1.equals(strPassword2)) {
                        doChangePassword(strPassword2, error, currentPasswordEdit);
                    }
                }
            } else {
                showCurrentPasswordWarning(error, currentPasswordEdit);
            }
        });

        refusetButton.setOnClickListener(view -> {
            Log.d(LOG_TAG, "No se guarda la contraseña");
            Intent intent = new Intent(self, HomeActivity.class);
            startActivity(intent);
        });
    }

    protected void checkNewPasswords(EditText password1, EditText password2, TextView error) {
        String strPass1 = password1.getText().toString();
        String strPass2 = password2.getText().toString();
        if (strPass1.equals(strPass2)
                && strPass1.trim().length() >= Constants.MIN_PASSWORD_LENGTH) {
            error.setText(R.string.settings_pwd_equal);
        } else {
            if (strPass1.trim().length() >= Constants.MIN_PASSWORD_LENGTH) {
                error.setText(R.string.settings_pwd_not_equal);
            } else {
                error.setText(R.string.settings_pwd_too_short);
            }
        }
    }

    protected void doChangePassword(final String strPassword2, TextView error, EditText currentPasswodEdit) {
        error.setText(null);
        currentPasswodEdit.setBackgroundColor(Color.GREEN);
        currentPasswodEdit.requestFocus();
    }

    protected void showCurrentPasswordWarning(TextView error, EditText currentPasswodEdit) {
        error.setText(R.string.current_password_warning);
        currentPasswodEdit.setBackgroundColor(getResources().getColor(R.color.warningColor));
        currentPasswodEdit.requestFocus();
    }

}
app/src/main/java/io/github/jokoframework/activity/AboutActivity.java
public class AboutActivity extends Activity implements ImageView.OnClickListener {

    private final int NUM_CLICKS_REQUIRED = 6;

    //List treated circularly to track last NUM_CLICKS_REQUIRED number of clicks
    private long[] clickTimestamps = new long[NUM_CLICKS_REQUIRED];
    private int oldestIndex = 0;
    private int nextIndex = 0;
    //-------------------------------------------------------------------------------------//

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        initilizeUI();
    }

    private void initilizeUI() {
        setContentView(R.layout.activity_about);

        findViewById(R.id.volver).setOnClickListener(v -> {
            Intent intent = new Intent(AboutActivity.this, HomeActivity.class);
            startActivity(intent);
            finish();
            overridePendingTransition(R.anim.left_to_right, R.anim.right_to_left);
        });

        TextView tv = findViewById(R.id.version_number);
        tv.setText(getString( R.string.version_name));
        ImageView jokoAbout = findViewById(R.id.imageViewHelp);
        jokoAbout.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        long timeMillis = (new Date()).getTime();
        // If we have at least the min number of clicks on record
        if (nextIndex == (NUM_CLICKS_REQUIRED - 1) || oldestIndex > 0) {
            // Check that all required clicks were in required time
            int diff = (int) (timeMillis - clickTimestamps[oldestIndex]);
            //------- Instrumentation to handle number of clicks on default medication switch --------//
            //Require X clicks in Y seconds to trigger secret action
            double SECONDS_FOR_CLICKS = 2;
            if (diff < SECONDS_FOR_CLICKS * 1000) {
                // if accomplish then...
                showAlertDialog(this,"Easter-Egg!!",getString(R.string.easter_egg_msg));
            }
            oldestIndex++;
        }
        // If not done, record click time, and bump indices
        clickTimestamps[nextIndex] = timeMillis;
        nextIndex++;
        if (nextIndex == NUM_CLICKS_REQUIRED) {
            nextIndex = 0;
        }
        if (oldestIndex == NUM_CLICKS_REQUIRED) {
            oldestIndex = 0;
        }
    }

    private void showAlertDialog(Context mContext, String mTitle, String mBody){
        MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(mContext);
        builder.setCancelable(true);

        if(mTitle.length()>0)
            builder.setTitle(mTitle);
        if(mBody.length()>0)
            builder.setTitle(mBody);

        builder.setPositiveButton("OK", (dialog, which) -> dialog.dismiss());
        builder.create().show();
    }

}
app/src/main/java/io/github/jokoframework/activity/BarChartActivity.java
public class BarChartActivity extends Activity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_barchart);

        ImageView backButton = findViewById(R.id.backButton3);

        backButton.setOnClickListener(v -> backToHome());

        //Points to be in the graph...
        List<FloatDataPair> data = new ArrayList<>();
        data.add(new FloatDataPair(0,150f));
        data.add(new FloatDataPair(1,130f));
        data.add(new FloatDataPair(2,200f));
        data.add(new FloatDataPair(3,300f));
        data.add(new FloatDataPair(4,473f));

        // The Chart whe are gonna use...
        BarChart barChart = findViewById(R.id.bar_chart);
//        //Configs...
        Description desc = new Description();
        desc.setText(getString(R.string.chart_description));
        desc.setTextColor(R.color.white);
        barChart.setDescription(desc);
        barChart.setBackgroundColor(getResources().getColor(R.color.white));
        barChart.setDrawGridBackground(false);
        barChart.setMarker(new MyMarkView(this));
        barChart.setScaleEnabled(true);
        barChart.animateXY(2000,2000);

//        //More configs to Axis representation...
        setFormatAxis(barChart);

        // insertion of the entries ...
        dataChartInsertion(data, barChart); // data introduccio & styling,others...

    }

    public void dataChartInsertion(List<FloatDataPair> dataObjects, BarChart chart){

        List<BarEntry> entries = new ArrayList<>();

        for (FloatDataPair data : dataObjects) {
            entries.add(new BarEntry(data.getXi(), data.getY()));// The constructer gives you the chance to add a Drawable icon...
        }

        BarDataSet dataSet = new BarDataSet(entries, "Testing BarChart");
        // add entries to dataset
        dataSet.setColors(getResources().getColor(R.color.background_drawer_group),
                getResources().getColor(R.color.colorAccent),
                getResources().getColor(R.color.colorPrimary),
                getResources().getColor(R.color.black),
                getResources().getColor(R.color.drawer_text));
        dataSet.setHighlightEnabled(true);
        dataSet.setValueTextColor(getResources().getColor(R.color.progress_bar));

        List<IBarDataSet> dataSets = new ArrayList<>(); // if it must be more than 1 dataset...
        dataSets.add(dataSet);

        BarData barData = new BarData(dataSet);
        barData.setBarWidth(0.9f); // set custom bar width
        chart.setData(barData);

        chart.invalidate(); // refresh, could be a sync button...
    }

    private void setFormatAxis(BarChart mbarChart){
        String[] labels = new String[] {"08/2017","09/2017","10/2017","11/2017","12/2017"};

        class LabelFormatter implements IAxisValueFormatter {
            private final String[] mLabels;

            public LabelFormatter(String[] labels) {
                mLabels = labels;
            }

            @Override
            public String getFormattedValue(float value, AxisBase axis) {
                return mLabels[(int) value];
            }
        }

        // Eje X...
        XAxis xAxis = mbarChart.getXAxis();
        xAxis.setDrawAxisLine(true);
        xAxis.setDrawGridLines(false);
        xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
        xAxis.setValueFormatter(new LabelFormatter(labels));

        // Eje Y...
        //Right
        YAxis yAxisR = mbarChart.getAxisRight();
        yAxisR.setDrawAxisLine(false);
        yAxisR.setDrawGridLines(false);
        yAxisR.setDrawLabels(false);
        //Left
        YAxis yAxisL = mbarChart.getAxisLeft();
        yAxisL.setDrawAxisLine(true);
        yAxisL.setDrawGridLines(false);


        mbarChart.setDrawGridBackground(false);
        mbarChart.setFitBars(true); // make the x-axis fit exactly all bars

    }

    private void backToHome() {
        Intent intent = new Intent(this, HomeActivity.class);
        startActivity(intent);
        finish();
        overridePendingTransition(R.anim.left_to_right, R.anim.right_to_left);
    }
}
mboehaolib/src/main/java/io/github/jokoframework/mboehaolib/pojo/Event.java
public class Event implements Serializable {

    private static final long serialVersionUID = 1L;

    private Long id;
    private String description;
    private Integer resourceIconId;
    private Integer iconMenu;

    public Event(Long id) {
        this.id = id;
    }
    private Class activity;

    public Class getActivity() {
        return activity;
    }

    public void setActivity(Class activity) {
        this.activity = activity;
    }

    public Event(int idSelected) {
        setId(Long.valueOf(idSelected));
    }

    public Integer getIconMenu() {
        return iconMenu;
    }

    public void setIconMenu(Integer iconMenu) {
        this.iconMenu = iconMenu;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Integer getResourceIconId() {
        return resourceIconId;
    }

    public void setResourceIconId(Integer resourceIconId) {
        this.resourceIconId = resourceIconId;
    }

    @Override
    public String toString() {
        return "Event{" +
                "id=" + id +
                ", description='" + description + '\'' +
                ", resourceIconId=" + resourceIconId +
                ", iconMenu=" + iconMenu +
                '}';
    }
}
mboehaolib/src/main/java/io/github/jokoframework/mboehaolib/constants/Constants.java
public class Constants {

    public static final long CRON_INTERVAL = (60 * 60 * 1000);
    public static final long FIRST_TIME = (12 * 1000);


    public static final double DATABASE_VERSION = 1.0;
    public static final String DATABASE_NAME = String.format("mboehao-v%s.db", DATABASE_VERSION);
    public static final int VERSION_CODE = 33;

    /**
     * Constantes de tiempos comúnmente utilizadas, en milisegundos
     */
    public static final long ONE_SECOND = 1000L;
    public static final long ONE_MINUTE = ONE_SECOND * 60L;
    public static final long ONE_HOUR = ONE_MINUTE * 60L;
    public static final long ONE_DAY = ONE_HOUR * 24L;

    public static final Map<String, String> errors = new HashMap<>();


    /**
     * Si tiene este valor, quiere decir que no hay al menos 4 muestras de dailyTests disponibles
     * para calcular el promedio. Cambiamos a este valor, debido a una incompatibilidad con el cliente
     * iOS que no soportaba el Double.MIN_VALUE
     */
    public static final double HD_VERTICAL_RESOLUTION = 1280;
    public static final double TABLET_VERTICAL_RESOLUTION = 1920;
    public static final double HVGA_VERTICAL_RESOLUTION = 480;


    //Miscelaneos
    public static final String DATE_TIME_FORMAT_ISO_8601 = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";

    public static final String API_URL = "/joko/api";

    // Para pruebas en servidores de Testing
    public static final String SERVER_NAME = "testing.sodep.com.py";
    public static final String SERVER_PORT = "443";
    public static final String BASE_URL = "https://" + SERVER_NAME + ":" + SERVER_PORT;

    //Firebase Configuration...
    public static final String SENDER_ID = "1037867417276";
    public static final String CURRENT_MBOEHAO_VERSION = "1.0";
    public static Integer msgId = 0;

    public static final String FACEBOOK_PROFILE_DATA = "FACEBOOK_PROFILE_INFO";


    public static final String FROM_BACKGROUND_SERVICE = "FROM_BACKGROUND_SERVICE";
    public static final String APP_NEWS = "appNews";
    public static final String USER_PREFERENCE_APP_NEWS = "_appNews";
    public static final String USER_PREFERENCE_APP_NEWS_SHOWED_TIME = "_appNewsShowed";


    public static final String PREF_USER_LEARNED_DRAWER = "navigation_drawer_learned";

    public static final String HEADER_AUTH = "X-JOKO-AUTH";
    public static final String HEADER_VERSION = "X-JOKO-SECURITY-VERSION";

    public static final String KEY_REFRESH_TOKEN = "REFRESH_TOKEN";
    public static final String KEY_EXPIRATION = "EXPIRATION_TOKEN";
    public static final String KEY_USERNAME = "USERNAME";
    public static final String KEY_ACTIVE = "ACTIVE";
    public static final String KEY_FIRST_NAME = "FIRSTNAME";
    public static final String KEY_SURNAME = "SURNAME";
    public static final String KEY_CLIENT_REFERENCE_NUMBER = "CLIENT_REFERENCE_NUMBER";
    public static final String KEY_REMEMBER_ME = "REMEMBER_ME";
    public static final String KEY_SHOW_TAG_MESSAGE = "SHOW_TAG_MESSAGE";
    public static final String KEY_USER_ID = "USER_ID";
    public static final String USER_PREFS_USER = "U";
    public static final String USER_PREFS_PW = "P";

    //Referentes al parse
    public static final String PARSE_PARAMETER = "Parameter";
    public static final String PARSE_PARAMETER_DESCRIPTION = "description";
    public static final String PARSE_PARAMETER_VALUE = "value";
    public static final String PARSE_CLASS_REMOTE_LOG = "RemoteLog";
    public static final String PARSE_ATTRIBUTE_LEVEL = "level";
    public static final String IMAGE_PNG = "image/png";
    public static final String PARSE_ATTRIBUTE_LOG_TAG = "logTag";
    public static final String PARSE_ATTRIBUTE_MESSAGE = "message";
    public static final String PARSE_ATTRIBUTE_OBJECT_ID = "objectId";
    public static final String PARSE_ATTRIBUTE_SAVED_AT = "savedAt";
    public static final String PARSE_ATTRIBUTE_STACKTRACE = "stackTrace";
    public static final String PARSE_ATTRIBUTE_APP_VERSION = "appVersion";
    public static final String PARSE_ATTRIBUTE_USERNAME = "username";
    public static final String PARSE_ATTRIBUTE_USER_AS_USERNAME = "user";
    public static final int PASSWORD_MIN_LENGTH = 4;
    public static final int MIN_PASSWORD_LENGTH = 8;
    public static final String HTML_SCALED_FONT_SIZE = "3";
    public static final String SHARED_MBOEHAO_PREF = "MboehaoPref";
    public static final int NOTIFICATION_ID = 13;
    public static final String SIMBOLO_GUARANI = "Gs. ";
    public static final String CURRENCY_SYMBOL = Constants.SIMBOLO_GUARANI;
    public static final String SECRET = "0Twrt564w1rb56GhIJa3ur53VjYF2wkewegwernglkmergECfIZcLzT1MGYNO4hia_HsoVxpU7vp0sFNix3_JgK4ZHEwrthL3dmaTIrIMkdI2u3wethwQ1AvHPoU58X2H3w0Kf";
    public static final int SECONDS_TO_REFRESH = 3600; // 1 hora
    public static final int SECONDS_TO_RESET = 300; // 5 minutos
    public static final String PREFERENCE_ATTRIBUTE_NOTIFICATION_CHECKED = "preference_attribute_notification_checked";
    public static final String LOGIN_PROVIDER_FACEBOOK = "FACEBOOK";
    public static final String LOGIN_PROVIDER = "loginProvider";
    public static final String ACCESS_TOKEN = "accessToken";
    public static final String PREFERENCES_ATTRIBUTES = "prefereces_attributes";
    public static final String DEVICE_TYPE = "ANDROID";

    private Constants() {
         /*Porque los constructores no tienen que tener instancias...
         Y menos esta clase de constantes...*/
    }

    //Startup Result
    public enum StartUpKeys {
        LOGGED,
        EXPIRED,
        NOT_LOGGED,
        LOGGED_ELSEWHERE,
        LOGIN_ERROR,
        LOGIN_ERROR_MSG
    }


}
app/src/main/java/io/github/jokoframework/adapter/CustomExpandableListAdapter.java
public class CustomExpandableListAdapter extends BaseExpandableListAdapter{


    public static final String LOG_TAG = CustomExpandableListAdapter.class.getSimpleName();

    private LayoutInflater mLayoutInflater;

    private List<EventParent> mEventParents;

    public CustomExpandableListAdapter(Context context, List<EventParent> eventParents) {
        Context mContext = context;
        mEventParents = eventParents;
        mLayoutInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }

    @Override
    public Object getChild(int groupPosition, int childPosition) {
        return mEventParents.get(groupPosition).getEvents().get(childPosition);
    }

    @Override
    public long getChildId(int listPosition, int expandedListPosition) {
        return expandedListPosition;
    }

    @Override
    public View getChildView(int listPosition, final int expandedListPosition,
                             boolean isLastChild, View converterView, ViewGroup parent) {

        final Event event = (Event) getChild(listPosition, expandedListPosition);
        View currentConvertView = converterView;
        if (event == null) {
            //Acá el event siempre es null
            Log.d(LOG_TAG, String.format("EVENT NULL position: %s", expandedListPosition));
        } else {
            if (currentConvertView == null) {
                currentConvertView = mLayoutInflater.inflate(R.layout.drawer_item_child, null);
            }

            TextView expandedListTextView = (TextView) currentConvertView
                    .findViewById(R.id.drawerText);
            expandedListTextView.setText(event.getDescription());

            ImageView imageView = (ImageView) currentConvertView.findViewById(R.id.imageViewSideMenu);
            imageView.setImageResource(event.getIconMenu());
        }

        return currentConvertView;
    }


    @Override
    public int getChildrenCount(int groupPosition) {
        return mEventParents.get(groupPosition).getEvents().size();
    }

    @Override
    public Object getGroup(int listPosition) {
        return mEventParents.get(listPosition);
    }

    @Override
    public int getGroupCount() {
        return mEventParents.size();
    }

    @Override
    public long getGroupId(int listPosition) {
        return listPosition;
    }

    @Override
    public View getGroupView(int listPosition, boolean isExpanded,
                             View converterView, ViewGroup parent) {
        EventParent eventParent = (EventParent) getGroup(listPosition);
        View currentConvertView;
        // Performance wise, this should not be commented,
        // but for now we avoid a weird bug of reordering of
        // the menu items
        // http://stackoverflow.com/questions/26530049/expandablelistview-reorganizes-children-views-order-on-every-group-expand
        if (eventParent.getEvent() != null) {
            // Menu drawer item with image and no childs
            Event e = eventParent.getEvent();
            currentConvertView = mLayoutInflater.inflate(R.layout.drawer_item_parent, null);
            TextView txtTitle = (TextView) currentConvertView.findViewById(R.id.drawerText);
            txtTitle.setText(e.getDescription());
        } else {
            currentConvertView = mLayoutInflater.inflate(R.layout.drawer_group, null);
            TextView listTitleTextView = (TextView) currentConvertView
                    .findViewById(R.id.listTitle);
            listTitleTextView.setText(eventParent.getTitle());

        }

        return currentConvertView;
    }


    @Override
    public boolean hasStableIds() {
        return false;
    }

    @Override
    public boolean isChildSelectable(int listPosition, int expandedListPosition) {
        return true;
    }


}
mboehaolib/src/main/java/io/github/jokoframework/mboehaolib/pojo/EventParent.java
public class EventParent {


    private String title;

    private List<Event> events;

    private String iconId;

    private Event event;

    public EventParent(String title, List<Event> events) {
        this.title = title;
        this.events = events;
    }

    public EventParent(Event event) {
        this.title = event.getDescription();
        this.events = new ArrayList<>();
        this.event = event;
    }

    public String getTitle() {
        return this.title;
    }

    public List<Event> getEvents() {
        return this.events;
    }

    public String getIconId() {
        return this.iconId;
    }

    public Event getEvent() {
        return this.event;
    }
}
app/src/main/java/io/github/jokoframework/activity/MultipleLineChartActivity.java
public class MultipleLineChartActivity extends Activity {

    private static final String LOG_TAG = MultipleLineChartActivity.class.getSimpleName();
    private Spinner mSpinner;
    private LineChart mlineChart;
    private HashMap<String, List<FloatDataPair>> mMultipleChartData;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_multiplelinechart);

        ImageView backButton = findViewById(R.id.backButton5);

        backButton.setOnClickListener(v -> backToHome());

        // The Chart whe are gonna use...
        mlineChart = findViewById(R.id.multiple_line_chart);
        mSpinner = findViewById(R.id.content_chooser_spinner);
        mMultipleChartData = new HashMap<>();
        loadMultipleChartData();
        initializeSpinner();
        initializeChart();
        displayDialog();
    }

    private void loadMultipleChartData() {
        List<String> contentLabels = Arrays.asList(getResources().getStringArray(
                R.array.test_label_array));

        List<FloatDataPair> data1 = getFloatDataPairs();
        List<FloatDataPair> data2 = getFloatDataPairs();
        Utils.sleep(100);
        List<FloatDataPair> data3 = getFloatDataPairs();
        Utils.sleep(100);
        List<FloatDataPair> data4 = getFloatDataPairs();
        Utils.sleep(100);
        List<FloatDataPair> data5 = getFloatDataPairs();
        Utils.sleep(100);
        List<FloatDataPair> data6 = getFloatDataPairs();
        Utils.sleep(100);

        mMultipleChartData.put(contentLabels.get(0), data1);
        mMultipleChartData.put(contentLabels.get(1), data2);
        mMultipleChartData.put(contentLabels.get(2), data3);
        mMultipleChartData.put(contentLabels.get(3), data4);
        mMultipleChartData.put(contentLabels.get(4), data5);
        mMultipleChartData.put(contentLabels.get(5), data6);
    }

    private List<FloatDataPair> getFloatDataPairs() {
        Random random = new Random(System.currentTimeMillis());
        //Points to be in the graph...
        List<FloatDataPair> data = new ArrayList<>();
        data.add(new FloatDataPair(0f,Float.valueOf(random.nextInt(20000))));
        data.add(new FloatDataPair(0.1f,Float.valueOf((random.nextInt(20000)))));
        data.add(new FloatDataPair(0.2f,Float.valueOf((random.nextInt(20000)))));
        data.add(new FloatDataPair(0.3f,Float.valueOf((random.nextInt(20000)))));
        data.add(new FloatDataPair(0.4f,Float.valueOf((random.nextInt(20000)))));
        return data;
    }

    private void initializeSpinner() {
        List<String> contentLabels = Arrays.asList(getResources().getStringArray(
                R.array.test_label_array));

        ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, contentLabels);
        mSpinner.setAdapter(adapter);
        mSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
            @Override
            public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
                graphChart(position);
            }

            @Override
            public void onNothingSelected(AdapterView<?> parentView) {
                // your code here
            }
        });
    }

    private void initializeChart() {

        //Configs...
        mlineChart.setMarker(new MyMarkView(this));
        mlineChart.setDrawMarkers(true);
        mlineChart.setBackgroundColor(getResources().getColor(R.color.white));
        mlineChart.animateX(3000);
        mlineChart.setHighlightPerDragEnabled(false);
        mlineChart.setHighlightPerTapEnabled(true);

        //More configs to Axis representation...
        setFormatAxis(mlineChart);
    }

    private void displayDialog() {
        List<String> contentLabels = Arrays.asList(getResources().getStringArray(
                R.array.test_label_array));

        ContentChooserDialog mSpinnerDialog = new ContentChooserDialog(this, contentLabels,
                new ContentChooserDialog.DialogListener() {
                    public void cancelled() {
                        // do your code here
                        Log.d(LOG_TAG, "No content selected");
                    }

                    public void ready(int idSelected) {
                        graphChart(idSelected);
                        mSpinner.setSelection(idSelected);
                    }
                });
        mSpinnerDialog.show();
    }

    private void graphChart(int id) {
        String label = (String) mMultipleChartData.keySet().toArray()[id];
        List<FloatDataPair> data = mMultipleChartData.get(label);

        //Configs...
        Description desc = new Description();
        desc.setText(label);
        mlineChart.setDescription(desc);
        // insertion of the entries ...
        assert data != null;
        dataChartInsertion(data, mlineChart,this); // data introduccio & styling,others...
    }

    public void dataChartInsertion(List<FloatDataPair> dataObjects, LineChart chart, Context context){
        List<Entry> entries = new ArrayList<>();

        for (FloatDataPair data : dataObjects) {
            entries.add(new Entry(data.getX(), data.getY()));// The constructer gives you the chance to add a Drawable icon...
        }

        LineDataSet dataSet = new LineDataSet(entries, "Testing Chart");// add entries to dataset
        dataSet.setColors(new int[] { R.color.group_divider_color, R.color.colorPrimary}, context);
        dataSet.setHighlightEnabled(true);
        dataSet.setCircleColors(new int[] {R.color.group_divider_color},context);
        dataSet.setCircleRadius(0.4f);
        dataSet.setAxisDependency(YAxis.AxisDependency.RIGHT);
        dataSet.setLineWidth(0.5f);
        List<Integer> colorText = new ArrayList();
        colorText.add(R.color.progress_bar);
        dataSet.setValueTextColors(colorText);

        List<ILineDataSet> dataSets = new ArrayList<>(); // if it must be more than 1 dataset...
        dataSets.add(dataSet);

        LineData lineData = new LineData(dataSets);

        chart.setData(lineData);
        chart.invalidate(); // refresh, could be a sync button...
    }

    public void setFormatAxis(LineChart mLineChart){
        // Eje X...
        XAxis xAxis = mLineChart.getXAxis();
        xAxis.setDrawAxisLine(true);
        xAxis.setDrawGridLines(false);

        // Eje Y...
        //Right
        YAxis yAxisR = mLineChart.getAxisRight();
        yAxisR.setDrawAxisLine(false);
        yAxisR.setDrawGridLines(false);
        yAxisR.setDrawLabels(false);
        //Left
        YAxis yAxisL = mLineChart.getAxisLeft();
        yAxisL.setDrawAxisLine(true);
        yAxisL.setDrawGridLines(false);

        mLineChart.setDrawGridBackground(false);
    }

    private void backToHome() {
        Intent intent = new Intent(this, HomeActivity.class);
        startActivity(intent);
        finish();
        overridePendingTransition(R.anim.left_to_right, R.anim.right_to_left);
    }
}


Question: package io.github.jokoframework.fragment;
import android.app.ActionBar;
import android.app.Activity;
import android.app.Fragment;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ExpandableListView;
import android.widget.ListView;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.appcompat.app.ActionBarDrawerToggle;
import io.github.jokoframework.R;
import io.github.jokoframework.activity.AboutActivity;
import io.github.jokoframework.activity.BarChartActivity;
import io.github.jokoframework.activity.ChangePasswordActivity;
import io.github.jokoframework.activity.CountryActivity;
import io.github.jokoframework.activity.HorizontalBarChartActivity;
import io.github.jokoframework.activity.LineChartActivity;
import io.github.jokoframework.activity.LogOutActivity;
import io.github.jokoframework.activity.MultipleLineChartActivity;
import io.github.jokoframework.adapter.CustomExpandableListAdapter;
import io.github.jokoframework.mboehaolib.constants.Constants;
import io.github.jokoframework.mboehaolib.pojo.Event;
import io.github.jokoframework.mboehaolib.pojo.EventParent;
import io.github.jokoframework.mboehaolib.util.Utils;
import io.github.jokoframework.otp.OtpActivity;


/**
 * Created by joaquin on 23/08/17.
 *
 * @author joaquin
 * @author afeltes
 */

public class NavigationDrawerFragment extends Fragment {

    private static final String EVENTS = "events";
    private static final String LOG_TAG = NavigationDrawerCallbacks.class.getSimpleName();

    private static final long MENU_ID_IMAGE1 = 1L;
    private static final long MENU_ID_IMAGE2 = 2L;
    private static final long MENU_ID_IMAGE3 = 3L;
    private static final long MENU_ID_IMAGE4 = 4L;
    private static final long MENU_ID_LOGOUT = 5L;
    private static final long MENU_ID_HELP = 6L;

    //OTP//
    private static final long MENU_ID_OTP = 7L;

    private static final long MENU_ID_CHANGEPASS = 8L;
    private static final long MENU_ID_COUNTRIES = 9L;

    /**
     * A pointer to the current callbacks instance (the Activity).
     */
    private NavigationDrawerCallbacks mCallbacks;

    /**
     * Helper component that ties the action bar to the navigation drawer.
     */
    private ActionBarDrawerToggle mDrawerToggle;
    private DrawerLayout mDrawerLayout;
    private ListView mDrawerListView;
    private View mFragmentContainerView;
    public View header;
    private boolean mFromSavedInstanceState;
    private boolean mUserLearnedDrawer;
    private List<Event> mEvents;
    private List<EventParent> mEventParents;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // Read in the flag indicating whether or not the user has demonstrated awareness of the
        // drawer. See PREF_USER_LEARNED_DRAWER for details.
        SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
        mUserLearnedDrawer = sp.getBoolean(Constants.PREF_USER_LEARNED_DRAWER, false);

        if (savedInstanceState != null) { // if activity existed before, then...
            mFromSavedInstanceState = true;
            mEvents = (List<Event>) savedInstanceState.getSerializable(EVENTS);
        }

        mEventParents = new ArrayList<>();
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        // Indicate that this fragment would like to influence the set of actions in the action bar.
        setHasOptionsMenu(true);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        mDrawerListView = (ListView) inflater.inflate(R.layout.fragment_navigation_drawer, container, false);
        header = getSideMenuHeader(inflater, container);
        mDrawerListView.addHeaderView(header);
        initializeEvents();
        addDrawerItems();
        return mDrawerListView;
    }

    private void addDrawerItems() {
        CustomExpandableListAdapter adapter = new CustomExpandableListAdapter(this.getActivity(), mEventParents);

        ExpandableListView mExpandableListView = mDrawerListView.findViewById(R.id.menuList);
        mExpandableListView.setAdapter(adapter);

        // Expandir todos los grupos por default...
        for (int i = 0; i < adapter.getGroupCount(); i++) {
            mExpandableListView.expandGroup(i);
        }

        mExpandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
            @Override
            public boolean onChildClick(ExpandableListView parent, View v,
                                        int groupPosition, int childPosition, long id) {
                // Se maneja el evento por hijo...
                selectGroupItem(groupPosition, childPosition);
                return false;
            }
        });

        mExpandableListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
            @Override
            public boolean onGroupClick(ExpandableListView expandableListView, View view, int groupPosition, long id) {
                int childrenCount = expandableListView.getExpandableListAdapter().getChildrenCount(groupPosition);
                // Solo es es un grupo sin hijos
                // va a tener una accion asociada
                if (childrenCount == 0) {
                    selectGroupItem(groupPosition, null);
                }
                return false;
            }
        });
    }

    private View getSideMenuHeader(LayoutInflater inflater, ViewGroup container) {

        View header = inflater.inflate(R.layout.side_menu_header, container, false);
        //Implementa la cabecera del menu...
        TextView welcomeString = (TextView) header.findViewById(R.id.personalize_welcome);

Answer:         if (Utils.getPrefs(getActivity(), Constants.FACEBOOK_PROFILE_DATA) == null) {