<repo_name>deon-Mass/VST<file_sep>/app/src/main/java/cd/digitalEdge/vst/Views/Lists/Commandes.java
package cd.digitalEdge.vst.Views.Lists;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import com.androidnetworking.AndroidNetworking;
import com.androidnetworking.common.Priority;
import com.androidnetworking.error.ANError;
import com.androidnetworking.interfaces.JSONObjectRequestListener;
import com.kosalgeek.android.caching.FileCacher;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;

import cd.digitalEdge.vst.Adaptors.Adaptor_commands_list;
import cd.digitalEdge.vst.Adaptors.Adaptor_recherche_list;
import cd.digitalEdge.vst.Controllers.Config;
import cd.digitalEdge.vst.Objects.Articles;
import cd.digitalEdge.vst.Objects.Commande;
import cd.digitalEdge.vst.R;
import cd.digitalEdge.vst.Tools.Constants;
import cd.digitalEdge.vst.Tools.Preferences;
import cd.digitalEdge.vst.Views.Gerer;

public class Commandes extends AppCompatActivity {

    Context context = this;
    Adaptor_commands_list adaptor;

    ListView command_list;
    LinearLayout progress_data;

    ArrayList<Commande> COMMAMNDES = new ArrayList<>();
    FileCacher<ArrayList<Commande>> DATAS_CACHED = new FileCacher<>(context, Constants.FILE_COMMANDES);

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_commandes);
        getSupportActionBar().setTitle("Mes commandes");
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        INIT_COMPONENT();
        getData();
    }

    private void INIT_COMPONENT() {
        progress_data = findViewById(R.id.progress_data);
        command_list = findViewById(R.id.command_list);

        progress_data.setVisibility(View.GONE);
    }

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

    @Override
    public void onBackPressed() {
        Intent i  = new Intent(context, Gerer.class);
        startActivity(i);
        finish();
    }


    @Override
    public boolean onOptionsItemSelected(@NonNull MenuItem item) {
        super.onOptionsItemSelected(item);
        switch (item.getItemId()) {
            case android.R.id.home:
                // API 5+ solution
                onBackPressed();
                return true;
        }
        return true;
    }


    void getData(){
        adaptor = new Adaptor_commands_list(context);
        command_list.setAdapter(adaptor);
    }

    // TODO METHOD
    private void LoadCommands(){
        //Log.i("PRODUCT_DATAS ",Config.GET_PRODUCTS);
        progress_data.setVisibility(View.VISIBLE);
        //error404.setVisibility(View.GONE);
        COMMAMNDES.clear();
        AndroidNetworking
                .post(Config.GET_COMMAND)
                .addBodyParameter("id", Preferences.getCurrentUser(context).getId())
                .setPriority(Priority.HIGH)
                .build()
                .getAsJSONObject(new JSONObjectRequestListener() {
                    @Override
                    public void onResponse(JSONObject response) {
                        try {
                            JSONArray ar = response.getJSONArray("results");
                            //Log.e("PRODUCT_DATAS RR ", ar.toString());

                            for (int i = 0; i < ar.length(); i++) {
                                JSONObject jsonObject = ar.getJSONObject(i);
                                Commande p = new Commande();
                                p.setId(jsonObject.getString(new Commande().id));
                                COMMAMNDES.add(p);

                            }

                            DATAS_CACHED.writeCache(COMMAMNDES);

                            if (COMMAMNDES.size()<1){
                                Toast.makeText(context, "Empy", Toast.LENGTH_SHORT).show();
                                //error404.setVisibility(View.VISIBLE);
                            }else{
                                //adaptor = new Adaptor_commands_list(context, COMMAMNDES);
                                command_list.setAdapter(adaptor);
                                //error404.setVisibility(View.GONE);
                            }
                            progress_data.setVisibility(View.GONE);

                        } catch (Exception e) {
                            Log.e("PRODUCT_DATAS--XX ",e.getMessage());
                            //error404.setVisibility(View.VISIBLE);
                            LoadCache();
                        }
                    }

                    @Override
                    public void onError(ANError anError) {
                        progress_data.setVisibility(View.GONE);
                        Log.e("PRODUCT_DATAS ",anError.getMessage());
                        //error404.setVisibility(View.VISIBLE);
                        LoadCache();
                    }
                });
    }

    private void LoadCache() {
        progress_data.setVisibility(View.VISIBLE);
        try {
            if (DATAS_CACHED.getSize()<1){
                Toast.makeText(context, "Empy", Toast.LENGTH_SHORT).show();
                //error404.setVisibility(View.VISIBLE);
            }else{
                //adaptor = new Adaptor_commands_list(context, DATAS_CACHED.readCache());
                command_list.setAdapter(adaptor);
                //error404.setVisibility(View.GONE);
            }
            progress_data.setVisibility(View.GONE);
            //Log.e("CACHED_DATA", String.valueOf(DATAS_CACHED.readCache().size()));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
<file_sep>/app/src/main/java/cd/digitalEdge/vst/Views/Lists/Blog.java
package cd.digitalEdge.vst.Views.Lists;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.AbsListView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import com.androidnetworking.AndroidNetworking;
import com.androidnetworking.common.Priority;
import com.androidnetworking.error.ANError;
import com.androidnetworking.interfaces.JSONObjectRequestListener;
import com.kosalgeek.android.caching.FileCacher;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;

import cd.digitalEdge.vst.Adaptors.Adaptor_blog_list;
import cd.digitalEdge.vst.Controllers.Config;
import cd.digitalEdge.vst.MainActivity;
import cd.digitalEdge.vst.Objects.Posts;
import cd.digitalEdge.vst.Objects.Posts;
import cd.digitalEdge.vst.R;
import cd.digitalEdge.vst.Tools.Constants;
import cd.digitalEdge.vst.Tools.Preferences;
import cd.digitalEdge.vst.Tools.Tool;
import cd.digitalEdge.vst.Views.Blanks.Contacts;

public class Blog extends AppCompatActivity {

    Context context = this;
    ListView blog_list;
    LinearLayout progress_data,error404;

    Adaptor_blog_list adapter;

    ArrayList<Posts> POSTS = new ArrayList<>();
    FileCacher<ArrayList<Posts>> DATAS_CACHED = new FileCacher<>(context, Constants.FILE_POSTS);

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_blog);
        getSupportActionBar().setTitle("Suprême Blog");
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        INIT_COMPONENT();
        //getBlog();
        LoadPosts();
    }

    void INIT_COMPONENT(){
        blog_list = findViewById(R.id.blog_list);
        error404 = findViewById(R.id.error404);
        progress_data = findViewById(R.id.progress_data);

        progress_data.setVisibility(View.GONE);
        error404.setVisibility(View.GONE);
    }

    @Override
    protected void onResume() {
        super.onResume();
        blog_list.setOnScrollListener(new AbsListView.OnScrollListener() {
            @Override
            public void onScrollStateChanged(AbsListView view, int scrollState) {
                if (
                        scrollState == AbsListView.OnScrollListener.SCROLL_STATE_IDLE &&
                        (blog_list.getLastVisiblePosition() ) >= adapter.getCount()-2
                ){
                    Animation from_right = AnimationUtils.loadAnimation(context, R.anim.m_fromright);
                    Animation to_right = AnimationUtils.loadAnimation(context, R.anim.m_toleft);
                    progress_data.startAnimation(from_right);
                    progress_data.setVisibility(View.VISIBLE);
                    new Handler().postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            progress_data.startAnimation(to_right);
                            progress_data.setVisibility(View.GONE);
                        }
                    }, 2000);
                }
            }

            @Override
            public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {

            }
        });
    }

    @Override
    public void onBackPressed() {
        Intent i  = new Intent(context, MainActivity.class);
        startActivity(i);
        finish();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        super.onCreateOptionsMenu(menu);
        getMenuInflater().inflate(R.menu.blog_menu, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(@NonNull MenuItem item) {
        super.onOptionsItemSelected(item);
        switch (item.getItemId()) {
            case android.R.id.home:
                // API 5+ solution
                onBackPressed();
                return true;
            case R.id.add_post:
                break;
            case R.id.categories:
                Tool.Dialog(context, "Liste de catégoris", "Liste de catégoris");
                break;
            case R.id.refresh:
                //getBlog();
                LoadPosts();
                break;
            case R.id.contact:
                Intent i  = new Intent(context, Contacts.class);
                startActivity(i);
                finish();
                break;
        }

        return true;
    }

    // TODO METHOD
    private void LoadPosts(){
        //Log.i("BLOG_RR ",Config.GET_POST);
        progress_data.setVisibility(View.VISIBLE);
        //error404.setVisibility(View.GONE);
        POSTS.clear();
        AndroidNetworking
                .get(Config.GET_POST)
                .setPriority(Priority.HIGH)
                .build()
                .getAsJSONObject(new JSONObjectRequestListener() {
                    @Override
                    public void onResponse(JSONObject response) {
                        try {
                            JSONArray ar = response.getJSONArray("posts");
                            for (int i = 0; i < ar.length(); i++) {
                                JSONObject jsonObject = ar.getJSONObject(i);
                                Posts p = new Posts();
                                p.setId(jsonObject.getString(new Posts().id));
                                p.setAuthor_id(jsonObject.getString(new Posts().author_id));
                                p.setCategory_id(jsonObject.getString(new Posts().category_id));
                                p.setTitle(jsonObject.getString(new Posts().title));
                                p.setExcerpt(jsonObject.getString(new Posts().excerpt));
                                p.setBody(jsonObject.getString(new Posts().body));
                                p.setSlug(jsonObject.getString(new Posts().slug));
                                p.setStatus(jsonObject.getString(new Posts().status));
                                p.setCreated_at(jsonObject.getString(new Posts().created_at));
                                p.setImage(jsonObject.getString(new Posts().image));
                                p.setCategory(jsonObject.getString(new Posts().category));
                                p.setComments(jsonObject.getString(new Posts().comments));
                                POSTS.add(p);
                            }

                           DATAS_CACHED.writeCache(POSTS);

                            if (POSTS.size()<1){
                                Toast.makeText(context, "Empy", Toast.LENGTH_SHORT).show();
                                LoadCache();
                            }else{
                                adapter = new Adaptor_blog_list(context, POSTS);
                                blog_list.setAdapter(adapter);
                                error404.setVisibility(View.GONE);
                            }
                            progress_data.setVisibility(View.GONE);

                        } catch (Exception e) {
                            Log.e("BLOG_RR--XX ",e.getMessage());
                            e.printStackTrace();
                            LoadCache();
                        }
                    }

                    @Override
                    public void onError(ANError anError) {
                        progress_data.setVisibility(View.GONE);
                        Log.e("BLOG_RR nnn",anError.getMessage());
                        //error404.setVisibility(View.VISIBLE);
                        LoadCache();
                    }
                });
    }

    private void LoadCache() {
        progress_data.setVisibility(View.VISIBLE);
        try {
            if (DATAS_CACHED.getSize()<1){
                Toast.makeText(context, "Empy from cache", Toast.LENGTH_SHORT).show();
                error404.setVisibility(View.VISIBLE);
            }else{
                adapter = new Adaptor_blog_list(context, DATAS_CACHED.readCache());
                blog_list.setAdapter(adapter);
                //error404.setVisibility(View.GONE);
            }
            progress_data.setVisibility(View.GONE);
            //Log.e("CACHED_DATA", String.valueOf(DATAS_CACHED.readCache().size()));
        } catch (Exception e) {
            e.printStackTrace();
            error404.setVisibility(View.VISIBLE);
        }
    }


}
<file_sep>/app/src/main/java/cd/digitalEdge/vst/Controllers/Offline/ExecuteUpdate.java
package cd.digitalEdge.vst.Controllers.Offline;

import android.content.ContentValues;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;

public class ExecuteUpdate {
    public static long insert(Context context,ContentValues values, String table_name){
        try {
            DataBase mybase = new DataBase(context, DataBase.db_name, null, DataBase.db_version);
            SQLiteDatabase db = mybase.getWritableDatabase();
            long ret = db.insert(table_name,null, values);
            db.close();
            mybase.close();
            ////Log.i("INSERT_DONE", String.valueOf(ret));

            return 1;
        }catch (Exception e){
            e.printStackTrace();
            ////Log.e("INSERT_FAILED", e.toString());
            return 0;
        }

    }

    public static long update(
            Context context,
            String table_name,
            String Editcolumn,
            String value,
            String colonne_id,
            String id){
        try {
            DataBase mybase = new DataBase(context, DataBase.db_name, null, DataBase.db_version);
            SQLiteDatabase db = mybase.getWritableDatabase();
            //long ret = db.insertOrThrow(table_name,null, values);
            db.execSQL("UPDATE "+table_name+" SET "+Editcolumn+" = '"+value+"' WHERE "+colonne_id+" = "+id+";");
            db.close();
            mybase.close();
            //Log.i("UPDATE_DONE", "PASSED");
            return 1;
        }catch (Exception e){
            e.printStackTrace();
            //Log.e("UPDATE_ERROR", e.toString());
            return 0;
        }

    }

    public static long delete(Context context,String table_name,String colonne_id, String id){
        try {
            DataBase mybase = new DataBase(context, DataBase.db_name, null, DataBase.db_version);
            SQLiteDatabase db = mybase.getWritableDatabase();
            //long ret = db.insertOrThrow(table_name,null, values);
            db.execSQL("DELETE FROM "+table_name+" WHERE "+colonne_id+" = "+id+";");
            db.close();
            mybase.close();
            //Log.i("DELETED", "PASSED");
            return 1;
        }catch (Exception e){
            e.printStackTrace();
            //Log.e("DELETE_ERROR", e.toString());
            return 0;
        }

    }

    public static long Truncat(Context context,String table_name){
        try {
            DataBase mybase = new DataBase(context, DataBase.db_name, null, DataBase.db_version);
            SQLiteDatabase db = mybase.getWritableDatabase();
            //long ret = db.insertOrThrow(table_name,null, values);
            db.execSQL("DELETE FROM "+table_name+" ;");
            db.close();
            mybase.close();
            //Log.i("TRUNCATED", "PASSED");
            return 1;
        }catch (Exception e){
            e.printStackTrace();
            //Log.e("TRUNCAT_ERROR", e.toString());
            return 0;
        }

    }
}
<file_sep>/app/src/main/java/cd/digitalEdge/vst/Adaptors/Adaptor_favoris_list.java
package cd.digitalEdge.vst.Adaptors;

import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.PopupMenu;
import android.widget.ProgressBar;
import android.widget.TextView;

import androidx.cardview.widget.CardView;

import com.koushikdutta.ion.Ion;

import java.util.ArrayList;

import cd.digitalEdge.vst.Controllers.Config;
import cd.digitalEdge.vst.Objects.Articles;
import cd.digitalEdge.vst.R;
import cd.digitalEdge.vst.Tools.Tool;
import cd.digitalEdge.vst.Tools.Utils;
import cd.digitalEdge.vst.Views.Lists.Details_Article;

public class Adaptor_favoris_list extends BaseAdapter {

    Context context;
    ArrayList<Articles> FAVORIS;

    public Adaptor_favoris_list(Context context, ArrayList<Articles> FAVORIS) {
        this.context = context;
        this.FAVORIS = FAVORIS;
    }

    public int getCount() {
        return FAVORIS.size();
    }

    public Object getItem(int position) {
        return FAVORIS.get(position);
    }

    public long getItemId(int position) {
        return 0;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        View convertView2 = LayoutInflater.from(this.context).inflate(R.layout.model_favoris_list, null);
        CardView CARD = convertView2.findViewById(R.id.card);
        TextView title = convertView2.findViewById(R.id.title);
        TextView descripion = convertView2.findViewById(R.id.descripion);
        ImageView delete = convertView2.findViewById(R.id.delete);
        ImageView image = convertView2.findViewById(R.id.image);
        ProgressBar progress = convertView2.findViewById(R.id.progress);

        progress.setVisibility(View.GONE);


        Articles data = FAVORIS.get(position);
        title.setText(data.getName());
        descripion.setText(data.getPrice().concat(" USD"));
        String a =data.getImages().substring(1, data.getImages().length()-1);
        String[] imgs = a.split(",");
        String url = Config.ROOT_img.concat(imgs[0].substring(1,imgs[0].length()-1));

        Adaptor_recherche_list.loadImageBitmap(image,url, progress);
        //Tool.Load_Image2(context, image, url);
        /*Ion.with(context)
                .load(url)
                .withBitmap()
                .placeholder(R.drawable.unknow)
                .error(R.drawable.ic_client_blue)
                //.animateLoad(spinAnimation)
                //.animateIn(fadeInAnimation)
                .intoImageView(image);*/

        CARD.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i  = new Intent(context, Details_Article.class);
                i.putExtra("Article", data);
                i.putExtra("source", "favoris");
                context.startActivity(i);
            }
        });
        delete.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

            }
        });
        return convertView2;
    }

}
<file_sep>/app/src/main/java/cd/digitalEdge/vst/Controllers/Config_preferences.java
package cd.digitalEdge.vst.Controllers;

public class Config_preferences {
    public static String DEVISE = "DEVISE";
    public static String LAT = "LAT";
    public static String LONG = "LONG";
    public static String PAIEMENT_MODE = "PAIEMENT_MODE";
    public static String PRICE = "PRICE";
    public static String TAUX = "TAUX";
    public static String table_name = "chats";
    public static String CURRENT_USER = "currentUser";
}
<file_sep>/app/src/main/java/cd/digitalEdge/vst/Views/Paramettres.java
package cd.digitalEdge.vst.Views;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.kosalgeek.android.caching.FileCacher;

import java.io.IOException;
import java.util.ArrayList;

import cd.digitalEdge.vst.Controllers.Offline.ExecuteUpdate;
import cd.digitalEdge.vst.MainActivity;
import cd.digitalEdge.vst.Objects.Articles;
import cd.digitalEdge.vst.R;
import cd.digitalEdge.vst.Tools.Constants;
import cd.digitalEdge.vst.Views.Blanks.Contacts;

public class Paramettres extends AppCompatActivity {

    Context context = this;
    TextView clearCache,clearPanier, contact_us,about,profil;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_paramettres);
        getSupportActionBar().setTitle("Paramettres");
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        INIT_COMPONENT();
    }

    private void INIT_COMPONENT() {
        clearCache = findViewById(R.id.clearCache);
        clearPanier = findViewById(R.id.clearPanier);
        contact_us = findViewById(R.id.contact_us);
        about = findViewById(R.id.about);
        profil = findViewById(R.id.profil);
    }


    @Override
    protected void onResume() {
        super.onResume();
        clearCache.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                FileCacher<ArrayList<Articles>> data = new FileCacher<>(context, Constants.FILE_PRODUCTS);
                try {
                    if (data.clearCache() == true) Toast.makeText(context, "Cache vidé", Toast.LENGTH_SHORT).show();
                    else Toast.makeText(context, "Cache non vidé", Toast.LENGTH_SHORT).show();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        });

        clearPanier.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (ExecuteUpdate.Truncat(context, Constants.ARTICLE) == 1) Toast.makeText(context, "Panier vidé", Toast.LENGTH_SHORT).show();
                else Toast.makeText(context, "Panier Non vidé", Toast.LENGTH_SHORT).show();
            }
        });
        contact_us.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i  = new Intent(context, Contacts.class);
                startActivity(i);
                finish();
            }
        });
        about.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i  = new Intent(context, About_app.class);
                startActivity(i);
                finish();
            }
        });
        profil.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i  = new Intent(context, Gerer.class);
                startActivity(i);
                finish();
            }
        });
    }

    @Override
    public boolean onOptionsItemSelected(@NonNull MenuItem item) {
        super.onOptionsItemSelected(item);
        switch (item.getItemId()) {
            case android.R.id.home:
                // API 5+ solution
                onBackPressed();
                return true;
        }

        return true;
    }

    @Override
    public void onBackPressed() {
        //String source = getIntent().getExtras().getString("source");
        Intent i  = new Intent(context, MainActivity.class);
        startActivity(i);
        finish();
    }
}
<file_sep>/app/src/main/java/cd/digitalEdge/vst/Adaptors/Adaptor_recherche_list.java
package cd.digitalEdge.vst.Adaptors;

import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.AsyncTask;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.PopupMenu;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;

import androidx.cardview.widget.CardView;

import com.bumptech.glide.Glide;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.koushikdutta.ion.Ion;

import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Random;

import cd.digitalEdge.vst.Controllers.Config;
import cd.digitalEdge.vst.Controllers.Offline.SQLite.Sqlite_updates_methods;
import cd.digitalEdge.vst.Objects.Articles;
import cd.digitalEdge.vst.Objects.Products;
import cd.digitalEdge.vst.Objects.Products;
import cd.digitalEdge.vst.R;
import cd.digitalEdge.vst.Tools.Utils;
import cd.digitalEdge.vst.Views.Lists.Details_Article;

public class Adaptor_recherche_list extends BaseAdapter {

    Context context;
    ArrayList<Articles> DATAS;


    public Adaptor_recherche_list(Context context, ArrayList<Articles> DATAS) {
        this.context = context;
        this.DATAS = DATAS;
    }

    public int getCount() {
        return DATAS.size();
    }

    public Object getItem(int position) {
        return DATAS.get(position);
    }

    public long getItemId(int position) {
        return 0;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        View convertView2 = LayoutInflater.from(this.context).inflate(R.layout.model_articles_list2, null);
        CardView CARD = convertView2.findViewById(R.id.CARD);
        TextView name = convertView2.findViewById(R.id.name);
        TextView price = convertView2.findViewById(R.id.price);
        ImageView more = convertView2.findViewById(R.id.more);
        ImageView like = convertView2.findViewById(R.id.like);
        ImageView img = convertView2.findViewById(R.id.img);
        ProgressBar progress = convertView2.findViewById(R.id.progress);
        FloatingActionButton addToCard = convertView2.findViewById(R.id.addToCard);
        progress.setVisibility(View.GONE);
        final int[] turn = {0};

        Articles data = DATAS.get(position);

        name.setText(data.getName());
        price.setText(data.getPrice().concat(" USD"));
        String a =data.getImages().substring(1, data.getImages().length()-1);
        String[] imgs = a.split(",");
        String url = Config.ROOT_img.concat(imgs[0].substring(1,imgs[0].length()-1));
        //Log.e("TAG_IMAGE", url);
        loadImageBitmap(img, url, progress);
        /*Glide.with(context)
                .load(Uri.parse(url))
                .centerCrop()
                .placeholder(R.drawable.unknow)
                .into(img);*/

        CARD.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i  = new Intent(context, Details_Article.class);
                i.putExtra("Article", data);
                context.startActivity(i);
            }
        });
        like.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (turn[0] == 0) {
                    like.setImageResource(R.drawable.ic_favorite);
                    turn[0] =1;
                }
                else {
                    like.setImageResource(R.drawable.ic_favortie_orange);
                    turn[0] =0;
                }
            }
        });
        addToCard.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                AddToCard(context,data);
            }
        });
        more.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                PopupMenu popupMenu = new PopupMenu(context, v);
                popupMenu.getMenu().add("Ajouter à mon panier").setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
                    @Override
                    public boolean onMenuItemClick(MenuItem item) {
                        AddToCard(context,data);
                        return false;
                    }
                });
                popupMenu.getMenu().add("Ajouter aux favoris").setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
                    @Override
                    public boolean onMenuItemClick(MenuItem item) {
                        new Utils().SaveToFavoris(context, data.getId());
                        return false;
                    }
                });
                popupMenu.getMenu().add("Ajouter un avis").setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
                    @Override
                    public boolean onMenuItemClick(MenuItem item) {
                        new Utils().Noter_article(context, data.getId());
                        return false;
                    }
                });
                popupMenu.show();
            }
        });
        return convertView2;
    }

    public static void AddToCard(Context context,Articles data){
        data.setQnt("1");
        long response = Sqlite_updates_methods.insert_PRODUCT(context, data);
        if (response == 1){
            Toast.makeText(context, "Added to card", Toast.LENGTH_SHORT).show();
        }
        else if(response == 2) Toast.makeText(context, "L'article se trouve déjà dans votre panier", Toast.LENGTH_SHORT).show();
        else Toast.makeText(context, "Error while adding", Toast.LENGTH_SHORT).show();
    }

    public static void loadImageBitmap(ImageView img, String path, ProgressBar progress){
        new AsyncTask() {
            @Override
            protected void onPreExecute() {
                super.onPreExecute();
                progress.setVisibility(View.VISIBLE);
            }

            @Override
            protected Bitmap doInBackground(Object[] objects) {
                Bitmap bmp = null;
                try {
                    //URL url = new URL("https://lesupreme.shop/storage/users/November2019/MgMgAthaK3NIDNomVAxM.jpg");
                    URL url = new URL(path);
                    bmp = BitmapFactory.decodeStream(url.openConnection().getInputStream());
                } catch (IOException e) {
                    e.printStackTrace();
                }
                return bmp;
            }

            @Override
            protected void onPostExecute(Object o) {
                super.onPostExecute(o);
                img.setImageBitmap((Bitmap) o);
                progress.setVisibility(View.GONE);
            }
        }.execute();
    }

}
<file_sep>/app/src/main/java/cd/digitalEdge/vst/Views/Blanks/Add_product.java
package cd.digitalEdge.vst.Views.Blanks;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.cardview.widget.CardView;


import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;

import com.androidnetworking.AndroidNetworking;
import com.androidnetworking.common.Priority;
import com.androidnetworking.error.ANError;
import com.androidnetworking.interfaces.JSONObjectRequestListener;
import com.androidnetworking.interfaces.StringRequestListener;
import com.androidnetworking.interfaces.UploadProgressListener;
import com.google.android.material.snackbar.Snackbar;
import com.google.gson.JsonArray;
import com.koushikdutta.async.http.body.MultipartFormDataBody;
import com.theartofdev.edmodo.cropper.CropImage;
import com.theartofdev.edmodo.cropper.CropImageView;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;

import cd.digitalEdge.vst.Controllers.Config;
import cd.digitalEdge.vst.Controllers.Offline.SQLite.Sqlite_selects_methods;
import cd.digitalEdge.vst.Objects.Articles;
import cd.digitalEdge.vst.Objects.Categories;
import cd.digitalEdge.vst.Objects.Colors;
import cd.digitalEdge.vst.Objects.Etats;
import cd.digitalEdge.vst.Objects.Users;
import cd.digitalEdge.vst.R;
import cd.digitalEdge.vst.Tools.FilePath;
import cd.digitalEdge.vst.Tools.Preferences;
import cd.digitalEdge.vst.Tools.Tool;
import cd.digitalEdge.vst.Views.Gerer;
import cd.digitalEdge.vst.Views.Lists.Details_Article;
import okhttp3.internal.http.HttpHeaders;

public class Add_product extends AppCompatActivity {

    Context context = this;
    ArrayList<Categories> CAT;

    ArrayList<String> pictureChoosen = new ArrayList<>();
    ArrayList<String> pictureChoosen64 = new ArrayList<>();
    ArrayList<String> Colors = new ArrayList<>();
    ArrayList<String> Colors_id = new ArrayList<>();
    ArrayList<String> Categorie_id = new ArrayList<>();
    ArrayList<Colors> DATA_CHOOSEN = new ArrayList<>();

    Spinner couleur,etat,categories;
    TextView BTN_pickpicture,BTN_addColor, BTN_save;
    EditText nom, motcle,qnt,descripion,phone,siteweb,email,prix;
    ImageView img1,img2,img3,img4,img5;
    LinearLayout sous_color;
    ProgressBar progress;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_add_client);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setTitle("Nouveau bien");
        INIT_COMPONENT();
    }

    private void INIT_COMPONENT(){
        categories = findViewById(R.id.categories);
        couleur = findViewById(R.id.couleur);
        etat = findViewById(R.id.etat);
        img1 = findViewById(R.id.img1);
        img2 = findViewById(R.id.img2);
        img3 = findViewById(R.id.img3);
        img4 = findViewById(R.id.img4);
        img5 = findViewById(R.id.img5);
        prix = findViewById(R.id.prix);
        email = findViewById(R.id.email);
        siteweb = findViewById(R.id.siteweb);
        phone = findViewById(R.id.phone);
        qnt = findViewById(R.id.qnt);
        nom = findViewById(R.id.nom);
        motcle = findViewById(R.id.motcle);
        descripion = findViewById(R.id.descripion);
        sous_color = findViewById(R.id.sous_color);
        BTN_save = findViewById(R.id.BTN_save);
        BTN_addColor = findViewById(R.id.BTN_addColor);
        BTN_pickpicture = findViewById(R.id.BTN_pickpicture);
        progress = findViewById(R.id.progress);

        progress.setVisibility(View.GONE);
        img1.setVisibility(View.GONE);
        img2.setVisibility(View.GONE);
        img3.setVisibility(View.GONE);
        img4.setVisibility(View.GONE);
        img5.setVisibility(View.GONE);

        setEntries();
    }


    boolean CheckZone(){
        if (TextUtils.isEmpty(nom.getText().toString())){
            nom.setError("Champ obligatoire");
            return false;
        }else if (TextUtils.isEmpty(motcle.getText().toString())){
            motcle.setError("Champ obligatoire");
            return false;
        }else if (TextUtils.isEmpty(qnt.getText().toString())){
            qnt.setError("Champ obligatoire");
            return false;
        }else if (TextUtils.isEmpty(descripion.getText().toString())){
            descripion.setError("Champ obligatoire");
            return false;
        }else if (TextUtils.isEmpty(prix.getText().toString())){
            prix.setError("Champ obligatoire");
            return false;
        }else return true;
    }

    private void setEntries(){

        CAT = Sqlite_selects_methods.getall_Categorie(context);
        if (null == CAT || CAT.isEmpty()) CAT = new ArrayList<>();
        ArrayList<String> DATA0 = new ArrayList<>();
        for (Categories c: CAT) {
            DATA0.add(c.getName());
        }
        Tool.setEntries(context,categories,DATA0);

        ArrayList<Colors> COLORS = Sqlite_selects_methods.getall_Colors(context);
        if (null == COLORS || COLORS.isEmpty()) COLORS = new ArrayList<>();
        ArrayList<String> DATA = new ArrayList<>();
        for (Colors c: COLORS) {
            DATA.add(c.getName());
        }
        Tool.setEntries(context,couleur,DATA);

        ArrayList<Etats> ETAT = Sqlite_selects_methods.getall_Etat(context);
        if (null == ETAT || ETAT.isEmpty()) {
            ETAT = new ArrayList<>();
            Toast.makeText(context, "ETAT vide ou null", Toast.LENGTH_SHORT).show();
        }
        ArrayList<String> DATA2 = new ArrayList<>();
        for (Etats etats: ETAT) {
            DATA2.add(etats.getName());
        }
        Tool.setEntries(context,etat,DATA2);
    }

    @Override
    protected void onResume() {
        super.onResume();
        BTN_save.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                try {
                    //if (CheckZone()  ==  false) return;

                    for (Colors c :DATA_CHOOSEN) {
                        Colors_id.add(c.getId());
                    }

                    for (Categories c :CAT) {
                        if (c.getName().equals(categories.getSelectedItem().toString())){
                            Categorie_id.add(c.getId());
                            break;
                        }
                    }

                    JSONObject object = new JSONObject();
                    object.put("user_id", Preferences.getCurrentUser(context).getId());
                    object.put("name",nom.getText().toString());
                    object.put("keyword",motcle.getText().toString());
                    object.put("quantity",qnt.getText().toString());
                    object.put("phone",phone.getText().toString());
                    object.put("description",descripion.getText().toString());
                    object.put("website",siteweb.getText().toString());
                    object.put("email",email.getText().toString());
                    object.put("price",prix.getText().toString());
                    object.put("img",pictureChoosen64);
                    object.put("colors",Colors_id);
                    object.put("state",etat.getSelectedItem().toString());
                    object.put("category",Categorie_id);
                    Log.e("responce_Object",object.toString());

                    progress.setVisibility(View.VISIBLE);
                    AndroidNetworking
                            .post(Config.SEND_IMG)
                            .addBodyParameter("product", object.toString())
                            .setPriority(Priority.HIGH)
                            .build()
                            .getAsString(new StringRequestListener() {
                                @Override
                                public void onResponse(String response) {
                                    Log.i("responce_app ", response.toString());
                                    progress.setVisibility(View.GONE);
                                }
                                @Override
                                public void onError(ANError anError) {
                                    progress.setVisibility(View.GONE);
                                    Log.e("responce_app",anError.getMessage());
                                }
                            });


                } catch (Exception e) {
                    e.printStackTrace();
                    Log.e("responce_app--SSSSSSXX ",e.getMessage());
                }

            }
        });
        BTN_pickpicture.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                pickPicture();
            }
        });
        BTN_addColor.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                addColor_to_Panel(couleur.getSelectedItem().toString());
            }
        });
    }

    void upload(String path){
        String uploadUrl = Config.SEND_IMG;
        Log.d("responce_app",path);
        URL url = null;
        File file  = null;
        try {
            url = new URL(uploadUrl);
            URI u = new URI(path);
            file = new File(path);
            if(file.createNewFile()){
                file.createNewFile();
            }else{
                Log.e("responce_app","errrrrrrrr");
            }
            AndroidNetworking.upload(uploadUrl)
                    .addMultipartFile("image",  file)
                    .addMultipartParameter("key","value")
                    .setTag("uploadTest")
                    .setPriority(Priority.HIGH)
                    .build()
                    .setUploadProgressListener(new UploadProgressListener() {
                        @Override
                        public void onProgress(long bytesUploaded, long totalBytes) {
                            // do anything with progress
                            //Log.d("responce_app",String.valueOf(bytesUploaded));
                        }
                    })
                    .getAsJSONObject(new JSONObjectRequestListener() {
                        @Override
                        public void onResponse(JSONObject response) {
                            // do anything with response
                            Log.d("responce_app",String.valueOf(response));
                        }
                        @Override
                        public void onError(ANError error) {
                            // handle error
                            Log.e("responce_app",String.valueOf(error.getMessage()));
                            Log.e("responce_app","errorrrr");
                        }
                    });

        } catch (Exception e) {
            e.printStackTrace();
            Log.e("responce_app",e.getMessage());
        }


    }

    @Override
    public void onBackPressed() {
        Intent i  = new Intent(context, Gerer.class);
        startActivity(i);
        finish();
    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        super.onCreateOptionsMenu(menu);
        getMenuInflater().inflate(R.menu.add_client_menu, menu);
        return true;
    }
    @Override
    public boolean onOptionsItemSelected(@NonNull MenuItem item) {
        super.onOptionsItemSelected(item);
        switch (item.getItemId()) {
            case R.id.add_client_done :

                break;
            case android.R.id.home:
                // API 5+ solution
                onBackPressed();
                break;
        }
        return true;
    }

    private void addColor_to_Panel(String color){
        ArrayList<Colors> DATA = Sqlite_selects_methods.getall_Colors(context);

        View convertView = LayoutInflater.from(context).inflate(R.layout.view_color_in_form, null);
        TextView counter_badge = convertView.findViewById(R.id.counter_badge);


        for (Colors data : DATA) {

            if (data.getName().equals(color)){
                counter_badge.setText(data.getName());
                counter_badge.setBackgroundColor(Color.parseColor(data.getCodage_rvb()));

                DATA_CHOOSEN.add(data);
                sous_color.addView(convertView, 0);

            }
        }

    }

    private void setimage(){
        if (pictureChoosen.get(0) != null){
            img1.setVisibility(View.VISIBLE);
            img1.setImageURI(Uri.parse(pictureChoosen.get(0)));
        }
        if (pictureChoosen.get(1) != null){
            img2.setVisibility(View.VISIBLE);
            img2.setImageURI(Uri.parse(pictureChoosen.get(1)));
        }
        if (pictureChoosen.get(2) != null){
            img3.setVisibility(View.VISIBLE);
            img3.setImageURI(Uri.parse(pictureChoosen.get(2)));
        }
        if (pictureChoosen.get(3) != null){
            img4.setVisibility(View.VISIBLE);
            img4.setImageURI(Uri.parse(pictureChoosen.get(3)));
        }
        if (pictureChoosen.get(4) != null){
            img5.setVisibility(View.VISIBLE);
            img5.setImageURI(Uri.parse(pictureChoosen.get(4)));
        }
    }

    // TODO ;  PICTURES PICKER
    private void pickPicture() {
        CropImage.startPickImageActivity((Activity) context);
    }

    /* access modifiers changed from: 0000 */
    public void cropRequest(Uri imageuri) {
        CropImage.activity(imageuri)
                .setMultiTouchEnabled(false)
                .setAspectRatio(1, 1)
                .setFixAspectRatio(true)
                .setInitialCropWindowPaddingRatio(0.0f)
                .setGuidelines(CropImageView.Guidelines.ON)
                .setMultiTouchEnabled(true)
                .setActivityTitle("Suprême Crop")
                .start(Add_product.this);
    }

    /* access modifiers changed from: protected */
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == 200 && resultCode == -1) {
            cropRequest(CropImage.getPickImageResultUri(this.context, data));
        }
        if (requestCode == 203) {
            CropImage.ActivityResult result = CropImage.getActivityResult(data);
            if (resultCode == -1) {
                try {
                    String fil = FilePath.getPath(this, result.getUri());
                    FileInputStream fs = new FileInputStream(fil);
                    byte[] imgbyte = new byte[fs.available()];
                    int i = fs.read(imgbyte);
                    // TODO ; Conversion en base64
                    String encodedImage = Base64.encodeToString(imgbyte, Base64.DEFAULT);
                    //Log.e("responce_app",encodedImage);
                    pictureChoosen64.add(encodedImage);

                    pictureChoosen.add(fil);
                    setimage();


                    //UploadFileMethod(fil, this.progressbar, new File(fil).getName());

                } catch (Exception e) {

                    //Log.e("responce_app",e.getMessage());
                    //Tool.Dialog(this.context, "URI Error", e.getMessage());
                }
            }
        }
    }

    public void UploadFileMethod(String path, final ProgressBar p, final String filname) {
        AsyncTask execute = new AsyncTask() {
            /* access modifiers changed from: protected */
            public void onPreExecute() {
                p.setVisibility(View.VISIBLE);
                super.onPreExecute();
            }

            /* access modifiers changed from: protected */
            public Object doInBackground(Object[] params) {
                return Integer.valueOf(uploadFile(params[0].toString()));
            }

            /* access modifiers changed from: protected */
            public void onPostExecute(Object oO) {
                if (((Integer) oO).intValue() >= 0) {
                    Users u = new Users();
                    u.setId(Tool.getUserPreferences(context, new Users().id));
                    u.setAvatar(filname);
                    /*String query = Updates_queries.update_avatar_query(u);
                    Log.i("TAG_UPDATE_QUERY", query);
                    String o = new Updates().APPLY_UPDATE(context, query, progressbar);
                    if (o.length() > 5 || o.equals("-1") || o.contains("<")) {
                        Tool.Dialog(context, "Info", "Erreur lors de l'enregistrement.\nVeuillez vérifier les informations saisies ou soit votre connexion internet");
                    } else {
                        Tool.setUserPreferences(context, new Users().avatar, u.getAvatar());
                        settingUp_profil();
                        Toast.makeText(context, "Le photo de profil a été modifié avec succes", Toast.LENGTH_LONG).show();
                    }*/
                    Toast.makeText(context, "Effectué", Toast.LENGTH_LONG).show();
                } else {
                    Toast.makeText(context, "Echec du chargement du upload", Toast.LENGTH_LONG).show();
                }
                p.setVisibility(View.GONE);
                super.onPostExecute(oO);
            }
        }.execute(new Object[]{path});
    }

    public int uploadFile(String selectedFilePath) {
        int maxBufferSize;
        DataOutputStream dataOutputStream;
        byte[] buffer;
        String serverResponseMessage;
        StringBuilder sb;
        int bytesAvailable;
        String str = selectedFilePath;
        String str2 = "UPLOAD";
        String str3 = "DATA not passed";
        String lineEnd = "\r\n";
        String twoHyphens = "--";
        String boundary = "*****";
        int maxBufferSize2 = 1048576;
        File selectedFile = new File(str);
        String[] parts = str.split("/");
        String str4 = parts[parts.length - 1];
        if (!selectedFile.isFile()) {
            runOnUiThread(new Runnable() {
                public void run() {
                }
            });
            return 0;
        }
        try {
            FileInputStream fileInputStream = new FileInputStream(selectedFile);
            URL url = new URL(Config.SEND_IMG);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setDoInput(true);
            connection.setDoOutput(true);
            connection.setUseCaches(false);
            connection.setRequestMethod("POST");
            connection.setRequestProperty("Connection", "Keep-Alive");
            connection.setRequestProperty("ENCTYPE", MultipartFormDataBody.CONTENT_TYPE);
            String str5 = "Content-Type";
            StringBuilder sb3 = new StringBuilder();
            File file = selectedFile;
            try {
                sb3.append("multipart/form-data;boundary=");
                sb3.append(boundary);
                connection.setRequestProperty(str5, sb3.toString());
                connection.setRequestProperty("uploaded_file", str);
                dataOutputStream = new DataOutputStream(connection.getOutputStream());
                StringBuilder sb4 = new StringBuilder();
                sb4.append(twoHyphens);
                sb4.append(boundary);
                sb4.append(lineEnd);
                dataOutputStream.writeBytes(sb4.toString());
                StringBuilder sb5 = new StringBuilder();
                sb5.append("Content-Disposition: form-data; name=\"uploaded_file\";filename=\"");
                sb5.append(str);
                sb5.append("\"");
                sb5.append(lineEnd);
                dataOutputStream.writeBytes(sb5.toString());
                dataOutputStream.writeBytes(lineEnd);
                InputStream inn = connection.getInputStream();

                Log.e("responce_app", inn.toString());


                Log.e(str2, "DATA passed ON DATAOUTPUTSTREAM");
                int bytesAvailable2 = fileInputStream.available();
                int bufferSize = Math.min(bytesAvailable2, 1048576);
                buffer = new byte[bufferSize];
                int i = bytesAvailable2;
                int bufferSize2 = bufferSize;
                int bytesRead = fileInputStream.read(buffer, 0, bufferSize);
                while (bytesRead > 0) {
                    String[] parts2 = parts;
                    try {
                        dataOutputStream.write(buffer, 0, bufferSize2);
                        bytesAvailable = fileInputStream.available();
                        bufferSize2 = Math.min(bytesAvailable, maxBufferSize2);
                    } catch (FileNotFoundException e) {
                        e = e;
                        int i2 = maxBufferSize2;
                        String str6 = lineEnd;
                        maxBufferSize = 0;
                        e.printStackTrace();
                        runOnUiThread(new Runnable() {
                            public void run() {
                                Toast.makeText(getApplicationContext(), "File Not Found", Toast.LENGTH_LONG).show();
                            }
                        });
                        Log.e("UPLOAD1", str3);
                        return maxBufferSize;
                    } catch (Exception e) {
                        int i3 = maxBufferSize2;
                        String str7 = lineEnd;
                        maxBufferSize = 0;
                        e.printStackTrace();
                        Log.e("UPLOAD2", str3);
                        return maxBufferSize;
                    }
                    try {
                        bytesRead = fileInputStream.read(buffer, 0, bufferSize2);
                        int i5 = bytesAvailable;
                        parts = parts2;
                        maxBufferSize2 = maxBufferSize2;
                    } catch (FileNotFoundException e4) {
                        String str9 = lineEnd;
                        maxBufferSize = 0;
                        e4.printStackTrace();
                        runOnUiThread(new Runnable() {
                            public void run() {
                                Toast.makeText(getApplicationContext(), "File Not Found", Toast.LENGTH_LONG).show();
                            }
                        });
                        Log.e("UPLOAD1", str3);
                        return maxBufferSize;
                    } catch (MalformedURLException e5) {
                        String str10 = lineEnd;
                        maxBufferSize = 0;
                        e5.printStackTrace();
                        Log.e("UPLOAD2", str3);
                        return maxBufferSize;
                    } catch (IOException e6) {
                        String str11 = lineEnd;
                        maxBufferSize = 0;
                        e6.printStackTrace();
                        Log.e("UPLOAD3", str3);
                        return maxBufferSize;
                    }
                }
                String[] strArr = parts;
            } catch (FileNotFoundException e7) {
                String str12 = lineEnd;
                String[] strArr2 = parts;
                maxBufferSize = 0;
                e7.printStackTrace();
                runOnUiThread(new Runnable() {
                    public void run() {
                        Toast.makeText(getApplicationContext(), "File Not Found", Toast.LENGTH_LONG).show();
                    }
                });
                Log.e("UPLOAD1", str3);
                return maxBufferSize;
            } catch (MalformedURLException e8) {
                String str13 = lineEnd;
                String[] strArr3 = parts;
                maxBufferSize = 0;
                e8.printStackTrace();
                Log.e("UPLOAD2", str3);
                return maxBufferSize;
            } catch (IOException e9) {
                String str14 = lineEnd;
                String[] strArr4 = parts;
                maxBufferSize = 0;
                e9.printStackTrace();
                Log.e("UPLOAD3", str3);
                return maxBufferSize;
            }
            try {
                dataOutputStream.writeBytes(lineEnd);
                StringBuilder sb6 = new StringBuilder();
                sb6.append(twoHyphens);
                sb6.append(boundary);
                sb6.append(twoHyphens);
                sb6.append(lineEnd);
                dataOutputStream.writeBytes(sb6.toString());
                maxBufferSize = connection.getResponseCode();
            } catch (FileNotFoundException e10) {
                String str15 = lineEnd;
                maxBufferSize = 0;
                e10.printStackTrace();
                runOnUiThread(new Runnable() {
                    public void run() {
                        Toast.makeText(getApplicationContext(), "File Not Found", Toast.LENGTH_LONG).show();
                    }
                });
                Log.e("UPLOAD1", str3);
                return maxBufferSize;
            } catch (MalformedURLException e11) {
                String str16 = lineEnd;
                maxBufferSize = 0;
                e11.printStackTrace();
                Log.e("UPLOAD2", str3);
                return maxBufferSize;
            } catch (IOException e12) {
                String str17 = lineEnd;
                maxBufferSize = 0;
                e12.printStackTrace();
                Log.e("UPLOAD3", str3);
                return maxBufferSize;
            }
            try {
                serverResponseMessage = connection.getResponseMessage();
                byte[] bArr = buffer;
                sb = new StringBuilder();
                String str18 = lineEnd;
            } catch (FileNotFoundException e13) {
                String str19 = lineEnd;
                e13.printStackTrace();
                runOnUiThread(new Runnable() {
                    public void run() {
                        Toast.makeText(getApplicationContext(), "File Not Found", Toast.LENGTH_LONG).show();
                    }
                });
                Log.e("UPLOAD1", str3);
                return maxBufferSize;
            } catch (MalformedURLException e14) {
                String str20 = lineEnd;
                e14.printStackTrace();
                Log.e("UPLOAD2", str3);
                return maxBufferSize;
            } catch (IOException e15) {
                String str21 = lineEnd;
                e15.printStackTrace();
                Log.e("UPLOAD3", str3);
                return maxBufferSize;
            }
            try {
                sb.append("Server Response is: ");
                sb.append(serverResponseMessage);
                sb.append(": ");
                sb.append(maxBufferSize);
                Log.e(str2, sb.toString());
                if (maxBufferSize == 200) {
                    runOnUiThread(new Runnable() {
                        public void run() {
                        }
                    });
                }
                fileInputStream.close();
                dataOutputStream.flush();
                dataOutputStream.close();
            } catch (FileNotFoundException e16) {
                e16.printStackTrace();
                runOnUiThread(new Runnable() {
                    public void run() {
                        Toast.makeText(getApplicationContext(), "File Not Found", Toast.LENGTH_LONG).show();
                    }
                });
                Log.e("UPLOAD1", str3);
                return maxBufferSize;
            } catch (MalformedURLException e17) {
                e17.printStackTrace();
                Log.e("UPLOAD2", str3);
                return maxBufferSize;
            } catch (IOException e18) {
                e18.printStackTrace();
                Log.e("UPLOAD3", str3);
                return maxBufferSize;
            }
        } catch (FileNotFoundException e22) {
            String str25 = lineEnd;
            File file5 = selectedFile;
            String[] strArr8 = parts;
            maxBufferSize = 0;
            e22.printStackTrace();
            runOnUiThread(new Runnable() {
                public void run() {
                    Toast.makeText(getApplicationContext(), "File Not Found", Toast.LENGTH_LONG).show();
                }
            });
            Log.e("UPLOAD1", str3);
            return maxBufferSize;
        } catch (MalformedURLException e23) {
            String str26 = lineEnd;
            File file6 = selectedFile;
            String[] strArr9 = parts;
            maxBufferSize = 0;
            e23.printStackTrace();
            Log.e("UPLOAD2", str3);
            return maxBufferSize;
        } catch (IOException e24) {
            String str27 = lineEnd;
            File file7 = selectedFile;
            String[] strArr10 = parts;
            maxBufferSize = 0;
            e24.printStackTrace();
            Log.e("UPLOAD3", str3);
            return maxBufferSize;
        }
        return maxBufferSize;
    }




    public class Color_product{

        public String id  ="id";
        public String name  ="name";

        public String getId() {
            return id;
        }

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

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }
    }


}
<file_sep>/app/src/main/java/cd/digitalEdge/vst/Controllers/Background/MyLocationListener.java
package cd.digitalEdge.vst.Controllers.Background;

import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;


public class MyLocationListener implements LocationListener {
    Context context;

    public MyLocationListener(Context context2) {
        this.context = context2;
    }

    public void onLocationChanged(Location loc) {
        Context context2 = this.context;
        StringBuilder sb = new StringBuilder();
        sb.append("Location changed: Lat: ");
        sb.append(loc.getLatitude());
        sb.append(" Lng: ");
        sb.append(loc.getLongitude());
        Toast.makeText(context2, sb.toString(), Toast.LENGTH_LONG).show();
        StringBuilder sb2 = new StringBuilder();
        sb2.append("Longitude: ");
        sb2.append(loc.getLongitude());
        String str = "LOCATION_TAG";
        Log.v(str, sb2.toString());
        StringBuilder sb3 = new StringBuilder();
        sb3.append("Latitude: ");
        sb3.append(loc.getLatitude());
        Log.v(str, sb3.toString());
    }

    @Override
    public void onStatusChanged(String provider, int status, Bundle extras) {

    }

    @Override
    public void onProviderEnabled(String provider) {

    }

    @Override
    public void onProviderDisabled(String provider) {

    }
}
<file_sep>/app/src/main/java/cd/digitalEdge/vst/Adaptors/Slides/SlideAdapter_home.java
package cd.digitalEdge.vst.Adaptors.Slides;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.viewpager.widget.PagerAdapter;

import cd.digitalEdge.vst.Adaptors.Adaptor_recherche_list;
import cd.digitalEdge.vst.Controllers.Config;
import cd.digitalEdge.vst.R;


public class SlideAdapter_home extends PagerAdapter {
    public int[] list_color = {R.color.colorPrimary, R.color.colorPrimary, R.color.colorPrimary, R.color.colorPrimary};
    public String[] list_description = {
            "",
            "",
            "",
            ""};
    //public int[] list_images = {R.drawable.png, R.drawable.png, R.drawable.png, R.drawable.png};

    public String[] list_title = {"", "", "", ""};
    public String[] list_images = {"", "", "", ""};
    Context context;
    LayoutInflater inflater;

    public SlideAdapter_home(Context context2, String[] imgs) {
        this.context = context2;
        list_images = imgs;

        //String url = Config.ROOT_img.concat(imgs[0].substring(1,imgs[0].length()-1));
    }

    public int getCount() {
        return this.list_title.length;
    }

    public boolean isViewFromObject(View view, Object obj) {
        return view == ((RelativeLayout) obj);
    }

    public Object instantiateItem(ViewGroup container, int position) {
        this.inflater = (LayoutInflater) this.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View view = this.inflater.inflate(R.layout.intro_slide, container, false);
        RelativeLayout linearLayout = (RelativeLayout) view.findViewById(R.id.slidelinearlayout);
        TextView txt1 = (TextView) view.findViewById(R.id.slidetitle);
        TextView txt2 = (TextView) view.findViewById(R.id.slidedescription);
        TextView textView = (TextView) view.findViewById(R.id.start);
        ImageView img = (ImageView) view.findViewById(R.id.slideimg);
        ProgressBar progress = (ProgressBar) view.findViewById(R.id.progress);

        progress.setVisibility(View.GONE);

        String url = Config.ROOT_img.concat(list_images[position].substring(1,list_images[position].length()-1)); //list_images[position]

        Adaptor_recherche_list.loadImageBitmap(img, url, progress);
        //((ImageView) view.findViewById(R.id.slideimg)).setImageResource(this.);

        txt1.setText(this.list_title[position]);
        txt2.setText(this.list_description[position]);
        linearLayout.setBackgroundColor(this.list_color[position]);
        container.addView(view);
        return view;
    }

    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView((RelativeLayout) object);
    }
}
<file_sep>/app/src/main/java/cd/digitalEdge/vst/Objects/Commande.java
package cd.digitalEdge.vst.Objects;

public class Commande {

    public String id       = "id";
    public String date     = "date";
    public String price    = "price";
    public String montant  = "montant";
    public String client   = "client";

    public String getId() {
        return id;
    }

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

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public String getMontant() {
        return montant;
    }

    public void setMontant(String montant) {
        this.montant = montant;
    }

    public String getClient() {
        return client;
    }

    public void setClient(String client) {
        this.client = client;
    }
}
<file_sep>/app/src/main/java/cd/digitalEdge/vst/Adaptors/Adaptor_message_list.java
package cd.digitalEdge.vst.Adaptors;

import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.cardview.widget.CardView;

import java.util.Random;

import cd.digitalEdge.vst.R;
import cd.digitalEdge.vst.Views.Blanks.Add_product;
import cd.digitalEdge.vst.Views.Lists.Chats;
import cd.digitalEdge.vst.Views.Lists.Details_Article;

public class Adaptor_message_list extends BaseAdapter {

    Context context;

    public Adaptor_message_list(Context context) {
        this.context = context;
    }

    public int getCount() {
        return 20;
    }

    public Object getItem(int position) {
        return null;
    }

    public long getItemId(int position) {
        return 0;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        View convertView2 = LayoutInflater.from(this.context).inflate(R.layout.model_message_list, null);
        LinearLayout CARD = convertView2.findViewById(R.id.card);
        TextView index_letter = convertView2.findViewById(R.id.indx);

        index_letter.setText("MASSADI".substring(0,1));
        int r = new Random().nextInt(4);
        if (r == 1) index_letter.setBackgroundResource(R.drawable.oval_blue);
        if (r == 2) index_letter.setBackgroundResource(R.drawable.oval_red);
        if (r == 3) index_letter.setBackgroundResource(R.drawable.oval_green);
        if (r == 4) index_letter.setBackgroundResource(R.drawable.oval_gris);


        CARD.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i  = new Intent(context, Chats.class);
                context.startActivity(i);
            }
        });
        return convertView2;
    }

}<file_sep>/settings.gradle
rootProject.name='VST'
include ':app'
<file_sep>/app/src/main/java/cd/digitalEdge/vst/Views/Lists/Panier.java
package cd.digitalEdge.vst.Views.Lists;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import java.util.ArrayList;
import java.util.Timer;
import java.util.TimerTask;

import cd.digitalEdge.vst.Adaptors.Adaptor_Panier;
import cd.digitalEdge.vst.Controllers.Offline.ExecuteUpdate;
import cd.digitalEdge.vst.Controllers.Offline.SQLite.Sqlite_selects_methods;
import cd.digitalEdge.vst.MainActivity;
import cd.digitalEdge.vst.Objects.Articles;
import cd.digitalEdge.vst.R;
import cd.digitalEdge.vst.Tools.Constants;
import cd.digitalEdge.vst.Tools.Utils;
import cd.digitalEdge.vst.Views.Blanks.Checkout_command;

public class Panier extends AppCompatActivity {
    Context context = this;
    ListView panier_list;
    TextView textCartItemCount, PT,prodcount;
    LinearLayout progress_data;




    Adaptor_Panier adapter;
    ArrayList<Articles> PANIER = new ArrayList<>();
    public Handler mHandler = new Handler();
    Timer mTimer = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_panier);
        getSupportActionBar().setTitle("Mon Panier");
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        INIT_COMPONENTS();
        getdatas();
    }

    private void INIT_COMPONENTS() {
        panier_list = findViewById(R.id.panier_list);
        prodcount = findViewById(R.id.prodcount);
        progress_data = findViewById(R.id.progress_data);
        PT = findViewById(R.id.PT);

        progress_data.setVisibility(View.GONE);
    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
        this.mTimer.cancel();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        super.onCreateOptionsMenu(menu);
        getMenuInflater().inflate(R.menu.panier_menu, menu);

        final MenuItem menuItem = menu.findItem(R.id.facturation);
        View actionView = menuItem.getActionView();
        textCartItemCount = (TextView) actionView.findViewById(R.id.cart_badge);

        Timer timer = this.mTimer;
        if (timer != null) {
            timer.cancel();
        } else {
            this.mTimer = new Timer();
        }
        this.mTimer.scheduleAtFixedRate(new TimeDisplay(getApplicationContext(), 0), 0, 100);

        actionView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onOptionsItemSelected(menuItem);
            }
        });

        actionView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onOptionsItemSelected(menuItem);
            }
        });

        return true;
    }

    public class TimeDisplay extends TimerTask {
        Context context;
        int turn = 0;

        public TimeDisplay(Context context, int turn) {
            this.context = context;
            this.turn = turn;
        }

        public void run() {
            mHandler.post(new Runnable() {
                public void run() {
                    //Log.e("PANIER_SERVICES", "je tourne bien");
                    PANIER = Sqlite_selects_methods.getall_Articles(context);
                    if ( null == PANIER || PANIER.isEmpty() ){
                        PANIER = new ArrayList<>();
                        ////Log.e("DATA", "DATAS "+PANIER.size());
                        Utils.Setting_badge("0",textCartItemCount);
                    }else Utils.Setting_badge(String.valueOf(PANIER.size()),textCartItemCount);

                    prodcount.setText(String.valueOf(PANIER.size()));
                    int TOT = 0;
                    for (Articles a :PANIER) {
                        TOT += Float.parseFloat(a.getPrice()) * Float.parseFloat(a.getQnt());
                    }
                    PT.setText(String.valueOf(TOT)+" USD");
                }
            });
        }
    }

    @Override
    public boolean onOptionsItemSelected(@NonNull MenuItem item) {
        super.onOptionsItemSelected(item);
        switch (item.getItemId()) {
            case android.R.id.home:
                // API 5+ solution
                onBackPressed();
                break;
            case R.id.facturation:
                Intent i  = new Intent(context, Panier.class);
                startActivity(i);
                finish();
                break;
            case R.id.commander:
                getdatas();
                if (PANIER.size() < 1 || PANIER.isEmpty()){
                    Toast.makeText(context, "Le panier est vide, veuillez ajouter des aricles dans le papnier ", Toast.LENGTH_LONG).show();
                }else{
                    Intent ii  = new Intent(context, Checkout_command.class);
                    startActivity(ii);
                    finish();
                }

                break;
            case R.id.refresh:
                getdatas();
                break;
            case R.id.deleteAll:
                if (ExecuteUpdate.Truncat(context, Constants.ARTICLE) == 1) Toast.makeText(context, "Panier vidé", Toast.LENGTH_SHORT).show();
                else Toast.makeText(context, "Panier Non vidé", Toast.LENGTH_SHORT).show();
                getdatas();
                break;
        }

        return true;
    }

    @Override
    protected void onResume() {
        super.onResume();

    }

    @Override
    public void onBackPressed() {
        //String source = getIntent().getExtras().getString("source");
        Intent i  = new Intent(context, MainActivity.class);
        startActivity(i);
        finish();
    }

    public void getdatas(){
        Animation from_right = AnimationUtils.loadAnimation(context, R.anim.m_fromright);
        Animation to_right = AnimationUtils.loadAnimation(context, R.anim.m_toleft);
        progress_data.startAnimation(from_right);
        progress_data.setVisibility(View.VISIBLE);
        PANIER = Sqlite_selects_methods.getall_Articles(context);
        if ( null == PANIER || PANIER.isEmpty() ){
            PANIER = new ArrayList<>();
            Log.e("DATA", "DATAS "+PANIER.size());
        }
        adapter = new Adaptor_Panier(context, PANIER);
        panier_list.setAdapter(adapter);
        progress_data.startAnimation(to_right);
        progress_data.setVisibility(View.GONE);
    }

}<file_sep>/app/src/main/java/cd/digitalEdge/vst/Views/Blanks/Checkout_command.java
package cd.digitalEdge.vst.Views.Blanks;

import androidx.appcompat.app.AppCompatActivity;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ScrollView;
import android.widget.TextView;

import java.util.ArrayList;

import cd.digitalEdge.vst.Controllers.Offline.SQLite.Sqlite_selects_methods;
import cd.digitalEdge.vst.Objects.Articles;
import cd.digitalEdge.vst.R;
import cd.digitalEdge.vst.Tools.Tool;
import cd.digitalEdge.vst.Tools.Utils;
import cd.digitalEdge.vst.Views.Lists.Panier;

public class Checkout_command extends AppCompatActivity {

    Context context = this;
    TextView BTN_btn, prodcount, PT;
    ScrollView page1, page2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_checkout_command);
        getSupportActionBar().setTitle("Checkout");
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        INIT_COMPONENT();
    }

    private void INIT_COMPONENT() {
        page1 = findViewById(R.id.page1);
        page2 = findViewById(R.id.page2);
        BTN_btn = findViewById(R.id.BTN_btn);
        prodcount = findViewById(R.id.prodcount);
        PT = findViewById(R.id.PT);

        page2.setVisibility(View.GONE);
        BTN_btn.setText("Suivant");

        ArrayList<Articles> PANIER = new ArrayList<>();
        PANIER = Sqlite_selects_methods.getall_Articles(context);

        prodcount.setText(String.valueOf(PANIER.size()));
        int TOT = 0;
        for (Articles a :PANIER) {
            TOT += Float.parseFloat(a.getPrice()) * Float.parseFloat(a.getQnt());
        }
        PT.setText(String.valueOf(TOT)+" USD");


    }


    @Override
    protected void onResume() {
        super.onResume();
        BTN_btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (BTN_btn.getText().toString().equals("Suivant")){
                    BTN_btn.setText("Commander");
                    page1.setVisibility(View.GONE);
                    page2.setVisibility(View.VISIBLE);
                }else if (BTN_btn.getText().toString().equals("Commander")){
                    new AlertDialog.Builder(context)
                            .setTitle("Notice")
                            .setMessage("Vos données personnelles seront utilisées pour le traitement de votre commande, vous accompagner au cours de votre visite du site web, et pour d’autres raisons décrites dans notre politique de confidentialité.")
                            .setPositiveButton("Oui", new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    dialog.dismiss();
                                }
                            })
                            .setNegativeButton("Non", new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    dialog.dismiss();
                                }
                            }).show();
                 }
            }
        });
    }

    @Override
    public void onBackPressed() {
        Intent ii  = new Intent(context, Panier.class);
        startActivity(ii);
        finish();
    }
}
<file_sep>/app/src/main/java/cd/digitalEdge/vst/Views/Lists/Favoris.java
package cd.digitalEdge.vst.Views.Lists;

import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import com.androidnetworking.AndroidNetworking;
import com.androidnetworking.common.Priority;
import com.androidnetworking.error.ANError;
import com.androidnetworking.interfaces.JSONObjectRequestListener;
import com.kosalgeek.android.caching.FileCacher;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;

import cd.digitalEdge.vst.Adaptors.Adaptor_commands_list;
import cd.digitalEdge.vst.Adaptors.Adaptor_favoris_list;
import cd.digitalEdge.vst.Controllers.Config;
import cd.digitalEdge.vst.Objects.Articles;
import cd.digitalEdge.vst.Objects.Articles;
import cd.digitalEdge.vst.R;
import cd.digitalEdge.vst.Tools.Constants;
import cd.digitalEdge.vst.Tools.Preferences;
import cd.digitalEdge.vst.Views.Blanks.Add_product;
import cd.digitalEdge.vst.Views.Gerer;

public class Favoris extends AppCompatActivity {

    Context context = this;
    Adaptor_favoris_list adaptor;
    ListView list_favoris;
    LinearLayout progress_data, error404;
    
    ArrayList<Articles> FAVORIS = new ArrayList<>();
    FileCacher<ArrayList<Articles>> DATAS_CACHED = new FileCacher<>(context, Constants.FILE_FAVORIS);
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_favoris);
        getSupportActionBar().setTitle("Mes Favoris");
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        INIT_COMPONENT();
        //getData();
        ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo info = manager.getActiveNetworkInfo();
        if (info != null && info.isConnected()) {
            LoadFavoris();
        }else{
            LoadCache();
        }
    }

    private void INIT_COMPONENT() {
        progress_data = findViewById(R.id.progress_data);
        list_favoris = findViewById(R.id.list_favoris);
        error404 = findViewById(R.id.error404);

        progress_data.setVisibility(View.GONE);
        error404.setVisibility(View.GONE);
    }

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

    @Override
    public void onBackPressed() {
        Intent i  = new Intent(context, Gerer.class);
        startActivity(i);
        finish();
    }

    @Override
    public boolean onOptionsItemSelected(@NonNull MenuItem item) {
        super.onOptionsItemSelected(item);
        switch (item.getItemId()) {
            case android.R.id.home:
                // API 5+ solution
                onBackPressed();
                return true;
        }
        return true;
    }


        // TODO METHOD
        void getData(){
            //adaptor = new Adaptor_favoris_list(context);
            list_favoris.setAdapter(adaptor);
        }

    private void LoadFavoris(){
        //LoadCache();
        Log.i("FAVORIS_DATAS ",Config.GET_FAVORI.concat(Preferences.getCurrentUser(context).getId()));
        progress_data.setVisibility(View.VISIBLE);
        //error404.setVisibility(View.GONE);
        FAVORIS.clear();
        AndroidNetworking
                .get(Config.GET_FAVORI.concat(Preferences.getCurrentUser(context).getId()))
                .setPriority(Priority.HIGH)
                .build()
                .getAsJSONObject(new JSONObjectRequestListener() {
                    @Override
                    public void onResponse(JSONObject response) {
                        try {
                            //JSONArray ar = response.getJSONArray("results");
                            //Log.e("FAVORIS_DATAS RR ", response.toString());
                            for (int i = 0; i < response.length(); i++) {
                                JSONObject jsonObject = response.getJSONObject(String.valueOf(i+1));
                                Articles p = new Articles();
                                p.setId(jsonObject.getString(new Articles().id));
                                p.setName(jsonObject.getString(new Articles().name));
                                p.setSlug(jsonObject.getString(new Articles().slug));
                                p.setImages(jsonObject.getString(new Articles().images));
                                p.setDescription(jsonObject.getString(new Articles().description));
                                p.setPrice(jsonObject.getString(new Articles().price2));
                                p.setStock(jsonObject.getString(new Articles().stock));
                                p.setAvailability(jsonObject.getString(new Articles().availability));
                                FAVORIS.add(p);
                            }

                            DATAS_CACHED.writeCache(FAVORIS);

                            if (FAVORIS.size()<1){
                                Toast.makeText(context, "Empy", Toast.LENGTH_SHORT).show();
                                //error404.setVisibility(View.VISIBLE);
                                LoadCache();
                            }else{
                                adaptor = new Adaptor_favoris_list(context, FAVORIS);
                                list_favoris.setAdapter(adaptor);
                                //error404.setVisibility(View.GONE);
                            }
                            progress_data.setVisibility(View.GONE);

                        } catch (Exception e) {
                            //Log.e("FAVORIS_DATAS--XX ",e.getMessage());
                            //error404.setVisibility(View.VISIBLE);
                            LoadCache();
                        }
                    }

                    @Override
                    public void onError(ANError anError) {
                        progress_data.setVisibility(View.GONE);
                        Log.e("FAVORIS_DATAS ",anError.getMessage());
                        //error404.setVisibility(View.VISIBLE);
                        LoadCache();
                    }
                });
    }

    private void LoadCache() {
        progress_data.setVisibility(View.VISIBLE);
        try {
            if (DATAS_CACHED.getSize()<1){
                Toast.makeText(context, "Empy", Toast.LENGTH_SHORT).show();
                error404.setVisibility(View.VISIBLE);
            }else{
                adaptor = new Adaptor_favoris_list(context, FAVORIS);
                list_favoris.setAdapter(adaptor);
                //error404.setVisibility(View.GONE);
            }
            progress_data.setVisibility(View.GONE);
            //Log.e("CACHED_DATA", String.valueOf(DATAS_CACHED.readCache().size()));
        } catch (Exception e) {
            e.printStackTrace();
            error404.setVisibility(View.VISIBLE);
        }
    }

}
<file_sep>/app/src/main/java/cd/digitalEdge/vst/Views/Lists/Biens.java
package cd.digitalEdge.vst.Views.Lists;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.view.GravityCompat;

import com.androidnetworking.AndroidNetworking;
import com.androidnetworking.common.Priority;
import com.androidnetworking.error.ANError;
import com.androidnetworking.interfaces.JSONObjectRequestListener;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.tabs.TabItem;
import com.google.android.material.tabs.TabLayout;
import com.kosalgeek.android.caching.FileCacher;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;

import cd.digitalEdge.vst.Adaptors.Adaptor_biens_list;
import cd.digitalEdge.vst.Controllers.Config;
import cd.digitalEdge.vst.Objects.Articles;
import cd.digitalEdge.vst.R;
import cd.digitalEdge.vst.Tools.Constants;
import cd.digitalEdge.vst.Tools.Preferences;
import cd.digitalEdge.vst.Views.Blanks.Add_product;
import cd.digitalEdge.vst.Views.Gerer;

public class Biens extends AppCompatActivity {

    Context context = this;
    Adaptor_biens_list adaptor;

    ListView list_goods;
    TabItem tab_actif, tab_attente,tab_vendu;
    BottomNavigationView bottomnavigation;
    LinearLayout progress_data,error404;


    ArrayList<Articles> DATA_GOODS = new ArrayList<>();
    ArrayList<Articles> DATA_VENDU = new ArrayList<>();
    ArrayList<Articles> DATA_ATTENTE = new ArrayList<>();
    FileCacher<ArrayList<Articles>> DATAS_CACHED = new FileCacher<>(context, Constants.FILE_BIENS);
    FileCacher<ArrayList<Articles>> DATAS_CACHED_VENDU = new FileCacher<>(context, Constants.FILE_VENDU);
    FileCacher<ArrayList<Articles>> DATAS_CACHED_ATTENTE = new FileCacher<>(context, Constants.FILE_ATTENTE);

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_biens);
        getSupportActionBar().setTitle("Mes biens | Actifs");
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        INIT_COMPONENT();
        bottomnavigation.setSelectedItemId(R.id.tab_actif);
        //getdata();
        LoadBiens();
    }

    private void INIT_COMPONENT() {
        list_goods = findViewById(R.id.list_goods);
        bottomnavigation = findViewById(R.id.bottomnavigation);
        progress_data = findViewById(R.id.progress_data);
        error404 = findViewById(R.id.error404);

        progress_data.setVisibility(View.GONE);
        error404.setVisibility(View.GONE);

    }

    @Override
    protected void onResume() {
        super.onResume();
        bottomnavigation.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
            @Override
            public boolean onNavigationItemSelected(@NonNull MenuItem item) {
                Intent i  = new Intent(context, Recherche.class);
                switch (item.getItemId()){
                    case R.id.tab_actif:
                        getSupportActionBar().setTitle("Mes biens | Actifs");
                        SetDatabyViews(DATA_GOODS);
                        //Toast.makeText(context, "actif", Toast.LENGTH_SHORT).show();
                        break;
                    case R.id.tab_attente:
                        getSupportActionBar().setTitle("Mes biens | Attente");
                        SetDatabyViews(DATA_ATTENTE);
                        //Toast.makeText(context, "tab_attente", Toast.LENGTH_SHORT).show();
                        break;
                    case R.id.tab_vendu:
                        getSupportActionBar().setTitle("Mes biens | Vendus");
                        SetDatabyViews(DATA_VENDU);
                        //Toast.makeText(context, "tab_vendu", Toast.LENGTH_SHORT).show();
                        break;
                }
                return false;
            }
        });
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        super.onCreateOptionsMenu(menu);
        getMenuInflater().inflate(R.menu.biens_menu, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(@NonNull MenuItem item) {
        super.onOptionsItemSelected(item);
        switch (item.getItemId()) {
            case R.id.add_product:
                Intent i  = new Intent(context, Add_product.class);
                startActivity(i);
                finish();
                break;
            case android.R.id.home:
                // API 5+ solution
                onBackPressed();
                return true;
        }
        return true;
    }

    @Override
    public void onBackPressed() {
        Intent i  = new Intent(context, Gerer.class);
        startActivity(i);
        finish();
    }

    private void getdata(){
        //adaptor = new Adaptor_biens_list(context);
        list_goods.setAdapter(adaptor);
    }

    private void LoadBiens(){
        Log.i("GOODS_LINK ",Config.GET_GOODS.concat(Preferences.getCurrentUser(context).getId()));
        progress_data.setVisibility(View.VISIBLE);
        //error404.setVisibility(View.GONE);
        DATA_GOODS.clear();
        AndroidNetworking
                .get(Config.GET_GOODS.concat(Preferences.getCurrentUser(context).getId()))
                .setPriority(Priority.HIGH)
                .build()
                .getAsJSONObject(new JSONObjectRequestListener() {
                    @Override
                    public void onResponse(JSONObject response) {
                        Log.i("GOODS_LINK ",response.toString());
                        try {
                            JSONArray disponible = response.getJSONArray("disponible");
                            JSONArray vendus = response.getJSONArray("vendus");
                            JSONArray en_attente_validation = response.getJSONArray("en_attente_validation");
                            //Log.e("PRODUCT_DATAS RR ", ar.toString());

                            for (int i = 0; i < disponible.length(); i++) {
                                JSONObject jsonObject = disponible.getJSONObject(i);
                                Articles p = new Articles();
                                p.setId(jsonObject.getString(new Articles().id));
                                p.setName(jsonObject.getString(new Articles().name));
                                p.setSlug(jsonObject.getString(new Articles().slug));
                                p.setImages(jsonObject.getString(new Articles().images));
                                p.setDescription(jsonObject.getString(new Articles().description));
                                p.setPrice(jsonObject.getString(new Articles().price2));
                                p.setStock(jsonObject.getString(new Articles().stock));
                                p.setAvailability(jsonObject.getString(new Articles().availability));
                                DATA_GOODS.add(p);
                            }
                            DATAS_CACHED.writeCache(DATA_GOODS);

                            for (int i = 0; i < vendus.length(); i++) {
                                JSONObject jsonObject = disponible.getJSONObject(i);
                                Articles p = new Articles();
                                p.setId(jsonObject.getString(new Articles().id));
                                p.setName(jsonObject.getString(new Articles().name));
                                p.setSlug(jsonObject.getString(new Articles().slug));
                                p.setImages(jsonObject.getString(new Articles().images));
                                p.setDescription(jsonObject.getString(new Articles().description));
                                p.setPrice(jsonObject.getString(new Articles().price2));
                                p.setStock(jsonObject.getString(new Articles().stock));
                                p.setAvailability(jsonObject.getString(new Articles().availability));
                                DATA_VENDU.add(p);
                            }
                            DATAS_CACHED_VENDU.writeCache(DATA_VENDU);

                            for (int i = 0; i < en_attente_validation.length(); i++) {
                                JSONObject jsonObject = disponible.getJSONObject(i);
                                Articles p = new Articles();
                                p.setId(jsonObject.getString(new Articles().id));
                                p.setName(jsonObject.getString(new Articles().name));
                                p.setSlug(jsonObject.getString(new Articles().slug));
                                p.setImages(jsonObject.getString(new Articles().images));
                                p.setDescription(jsonObject.getString(new Articles().description));
                                p.setPrice(jsonObject.getString(new Articles().price2));
                                p.setStock(jsonObject.getString(new Articles().stock));
                                p.setAvailability(jsonObject.getString(new Articles().availability));
                                DATA_ATTENTE.add(p);
                            }
                            DATAS_CACHED_ATTENTE.writeCache(DATA_ATTENTE);

                            //TODO ;  Attache views by BootomNavigation
                            SetDatabyViews(DATA_GOODS);

                            progress_data.setVisibility(View.GONE);

                        } catch (Exception e) {
                            Log.e("GOODS_LINK--XX ",e.getMessage());
                            error404.setVisibility(View.VISIBLE);
                            LoadCache();
                        }
                    }

                    @Override
                    public void onError(ANError anError) {
                        progress_data.setVisibility(View.GONE);
                        Log.e("GOODS_LINK ",anError.getMessage());
                        error404.setVisibility(View.VISIBLE);
                        LoadCache();
                    }
                });
    }

    private void SetDatabyViews(ArrayList<Articles> DATA_GOODS) {
        if (DATA_GOODS.size()<1){
            error404.setVisibility(View.VISIBLE);
            Toast.makeText(context, "Empy", Toast.LENGTH_SHORT).show();
            LoadCache();
        }else{
            error404.setVisibility(View.GONE);
            adaptor = new Adaptor_biens_list(context, DATA_GOODS);
            list_goods.setAdapter(adaptor);
        }
    }
    private void LoadCache() {
        progress_data.setVisibility(View.VISIBLE);
        try {
            if (DATAS_CACHED.getSize()<1){
                Toast.makeText(context, "Empy", Toast.LENGTH_SHORT).show();
                //error404.setVisibility(View.VISIBLE);
            }else{
                SetDatabyViews(DATAS_CACHED.readCache());
                //error404.setVisibility(View.GONE);
            }
            progress_data.setVisibility(View.GONE);
            //Log.e("CACHED_DATA", String.valueOf(DATAS_CACHED.readCache().size()));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


}
<file_sep>/app/src/main/java/cd/digitalEdge/vst/Tools/Tool.java
package cd.digitalEdge.vst.Tools;

import android.app.AlarmManager;
import android.app.DatePickerDialog;
import android.app.DatePickerDialog.OnDateSetListener;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.TimePickerDialog;
import android.app.TimePickerDialog.OnTimeSetListener;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory;
import android.graphics.BitmapFactory.Options;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff.Mode;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.Shader.TileMode;
import android.graphics.drawable.Drawable;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.net.wifi.WifiManager;
import android.os.Build.VERSION;
import android.os.Environment;
import android.support.v4.media.session.PlaybackStateCompat;
import android.text.format.Formatter;
import android.util.Base64;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.Spinner;
import android.widget.TimePicker;
import android.widget.Toast;

import androidx.appcompat.app.AlertDialog.Builder;
import androidx.core.app.NotificationCompat;

import com.google.android.material.snackbar.Snackbar;
import com.koushikdutta.async.future.FutureCallback;
import com.koushikdutta.async.http.body.StringBody;
import com.koushikdutta.ion.Ion;
import com.koushikdutta.ion.builder.AnimateGifMode;
import com.koushikdutta.ion.builder.Builders.Any.B;
import com.koushikdutta.ion.builder.Builders.IV.F;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.nio.channels.FileChannel;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Enumeration;
import java.util.GregorianCalendar;
import java.util.Random;
import java.util.concurrent.TimeUnit;

import cd.digitalEdge.vst.Controllers.Config_preferences;
import cd.digitalEdge.vst.MainActivity;
import cd.digitalEdge.vst.Objects.Users;
import cd.digitalEdge.vst.R;
import pl.droidsonroids.gif.GifDrawable;

public class Tool {
    public static boolean Snack_Connexion(Context context, View v) {
        ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo info = manager.getActiveNetworkInfo();
        if (info == null || !info.isConnected()) {
            NetworkInfo networkInfo = info;
            Snackbar.make(v, "Vous n'êtes pas connecté", 5000).show();
            return false;
        }else return true;

    }
    public static String NUMBER_FORMAT(String number) {
        DecimalFormatSymbols symbols = new DecimalFormatSymbols();
        symbols.setGroupingSeparator(' ');
        return new DecimalFormat("#,###", symbols).format((long) Integer.parseInt(number));
    }




    public static String[] Versions() {
        return new String[]{"PETIT FOUR", "CUPCAKE", "DONUT", "ECLAIR", "FROYO", "GINGERBREAD", "HONEYCOMB", "ICE CREAM SANDWICH", "JELLY BEAN", "KITKAT", "LOLLIPOP", "MARSHMALLOW", "NOUGAT", "OREO"};
    }

    public static int[] Image_details(String uri) {
        File f = new File(uri);
        long fileSizeInKB = f.length() / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID;
        Options options = new Options();
        options.inJustDecodeBounds = true;
        BitmapFactory.decodeFile(f.getAbsolutePath(), options);
        StringBuilder sb = new StringBuilder();
        sb.append(options.outWidth);
        sb.append("x");
        sb.append(options.outHeight);
        String sb2 = sb.toString();
        return new int[]{(int) fileSizeInKB, options.outWidth, options.outHeight};
    }

    public static void viewImage(Context context, Uri uri) {
        File file = new File(String.valueOf(uri));
        Uri path = Uri.fromFile(file);
        if (!file.exists()) {
            Toast.makeText(context, "No way to find Uri", Toast.LENGTH_LONG).show();
        }
        Intent intent = new Intent();
        intent.setAction("android.intent.action.VIEW");
        intent.setDataAndType(path, "image/*");
        intent.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
        try {
            context.startActivity(intent);
        } catch (ActivityNotFoundException e) {
        }
    }

    public static void Load_Image2(Context context, final ImageView imageView, String url) {
        try {
            new GifDrawable(context.getResources(), (int) R.drawable.gif4);
            imageView.setImageResource(R.drawable.avatar);
            ((B) Ion.with(context).load(url)).withBitmap().asBitmap().setCallback(new FutureCallback<Bitmap>() {
                public void onCompleted(Exception e, Bitmap bitmap) {
                    if (bitmap == null) {
                        imageView.setImageResource(R.drawable.unknow);
                        return;
                    }
                    Bitmap circleBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Config.ARGB_8888);
                    BitmapShader shader = new BitmapShader(bitmap, TileMode.CLAMP, TileMode.CLAMP);
                    Paint paint = new Paint();
                    paint.setShader(shader);
                    new Canvas(circleBitmap).drawCircle((float) (bitmap.getWidth() / 2), (float) (bitmap.getHeight() / 2), (float) (bitmap.getWidth() / 2), paint);
                    imageView.setImageBitmap(circleBitmap);
                }
            });
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public static void Load_Image22(Context context, final ImageView imageView, String url) {
        try {
            //new GifDrawable(context.getResources(), (int) R.drawable.avatar);
            imageView.setImageResource(R.drawable.unknow);
            Ion.with(context)
                    .load(url)
                    .withBitmap()
                    .asBitmap()
                    .setCallback(new FutureCallback<Bitmap>() {
                public void onCompleted(Exception e, Bitmap bitmap) {
                    if (bitmap == null) {
                        imageView.setImageResource(R.drawable.unknow);
                        return;
                    }
                    Bitmap circleBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Config.ARGB_8888);
                    BitmapShader shader = new BitmapShader(bitmap, TileMode.CLAMP, TileMode.CLAMP);
                    Paint paint = new Paint();
                    paint.setShader(shader);
                    new Canvas(circleBitmap).drawCircle((float) (bitmap.getWidth() / 2), (float) (bitmap.getHeight() / 2), (float) (bitmap.getWidth() / 2), paint);
                    imageView.setImageBitmap(circleBitmap);
                }
            });
        } catch (Exception e) {
            Log.e("PRODUCT_DATAS--XX ",e.getMessage());
        }
    }

    public static void Load_Image(Context context, ImageView imageView, String url) {
        try {
            Ion.with(imageView)
                    .placeholder((Drawable) new GifDrawable(context.getResources(), (int) R.drawable.gif5))
                    .error((int) R.drawable.unknow)
                    .animateGif(AnimateGifMode.ANIMATE)
                    .load(url);
        } catch (IOException e) {
            Log.e("PRODUCT_DATAS--XX ",e.getMessage());
        }
    }

    public static void Dialog(Context context, String title, String mesg) {
        new Builder(context).setTitle((CharSequence) title).setMessage((CharSequence) mesg)
                .setNegativeButton((CharSequence) "D'accord", (OnClickListener) new OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
            }
        }).show();
    }

    public static Bitmap createCircleBitmap(Bitmap bitmap) {
        Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Config.ARGB_8888);
        Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
        Canvas canvas = new Canvas(output);
        Paint paint = new Paint();
        paint.setAntiAlias(true);
        int halfWidth = bitmap.getWidth() / 2;
        int halfHeight = bitmap.getHeight() / 2;
        canvas.drawCircle((float) halfWidth, (float) halfHeight, (float) Math.max(halfWidth, halfHeight), paint);
        paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
        canvas.drawBitmap(bitmap, rect, rect, paint);
        return output;
    }

    public static SharedPreferences User_Preferences(Context context) {
        if (context == null) {
            context = new MainActivity().getApplicationContext();
        }
        return context.getSharedPreferences("User_Identities", 0);
    }

    public static void userPreferences_Init(Context context) {
        Users column = new Users();
        setUserPreferences(context, Config_preferences.PAIEMENT_MODE, "NO");
        String str = "NULL";
        setUserPreferences(context, Config_preferences.PRICE, str);
        setUserPreferences(context, Config_preferences.TAUX, str);
        setUserPreferences(context, Config_preferences.DEVISE, str);
        setUserPreferences(context, Config_preferences.LAT, str);
        setUserPreferences(context, Config_preferences.LONG, str);
        String str2 = "";
        setUserPreferences(context, column.id, str2);
        setUserPreferences(context, column.name, str2);
    }

    public static void userPreferences_Set(Context context, Users u) {
        Users column = new Users();
        setUserPreferences(context, "FirstUse", "No");
        setUserPreferences(context, column.id, u.getId());
        setUserPreferences(context, column.name, u.getName());
    }

    public String GetDeviceipMobileData() {
        try {
            Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces();
            while (en.hasMoreElements()) {
                Enumeration<InetAddress> enumIpAddr = ((NetworkInterface) en.nextElement()).getInetAddresses();
                while (true) {
                    if (enumIpAddr.hasMoreElements()) {
                        InetAddress inetAddress = (InetAddress) enumIpAddr.nextElement();
                        if (!inetAddress.isLoopbackAddress()) {
                            return inetAddress.getHostAddress().toString();
                        }
                    }
                }
            }
        } catch (Exception ex) {
            Log.e("Current IP", ex.toString());
        }
        return null;
    }

    public static String GetDeviceipWiFiData(Context context) {
        return Formatter.formatIpAddress(((WifiManager) context.getSystemService(Context.WIFI_SERVICE)).getConnectionInfo().getIpAddress());
    }

    public static void setUserPreferences(Context context, String key, String values) {
        try {
            Editor editor = User_Preferences(context).edit();
            editor.putString(key, values);
            editor.apply();
        } catch (Exception e) {
            Log.e("TAG_PREFERENCES", e.getMessage());
        }
    }

    public static String getUserPreferences(Context context, String key) {
        return User_Preferences(context).getString(key, "");
    }

    public static void setEntries(Context context, Spinner spinner, ArrayList<String> DATA) {
        ArrayAdapter<String> adapter1 = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, DATA);
        adapter1.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);
        spinner.setAdapter(adapter1);
    }

    public static String Today() {
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
    }

    public static String Today2() {
        return new SimpleDateFormat("yyyy/MM/dd").format(new Date());
    }


    /**
     * Méthode pour afficher le Date picker pour selectionner une datePublication
     * @param context
     * @param start_date
     * @return
     */
    public static String Date_Picker(final Context context, final EditText start_date){

        final Calendar c = Calendar.getInstance();
        final int mYear, mMonth, mDay;

        mYear = c.get(Calendar.YEAR);
        mMonth = c.get(Calendar.MONTH);
        mDay = c.get(Calendar.DAY_OF_MONTH);

        final String[] Date = {""};

        DatePickerDialog datePickerDialog = new DatePickerDialog(context, new OnDateSetListener() {
            @Override
            public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
                String m = String.valueOf(monthOfYear + 1);
                if (m.length()<= 1){
                    m = "0"+m;
                }
                String d = String.valueOf(dayOfMonth);
                if (d.length()<= 1){
                    d = "0"+d;
                }
                String date = d+ "-" + m + "-" +year ;
                Date[0] = date;
                Log.i("TTTTTTTTTTDate", Date[0]);
                start_date.setText(date);

            }
        }, mYear, mMonth, mDay);

        datePickerDialog.show();
        Log.i("TTTTTTTTTT", Date[0]);

        return start_date.getText().toString();
    }

    public static final String md5(String s) {
        String str = "MD5";
        try {
            MessageDigest digest = MessageDigest.getInstance("MD5");
            digest.update(s.getBytes());
            byte[] messageDigest = digest.digest();
            StringBuilder hexString = new StringBuilder();
            /*for (byte aMessageDigest : messageDigest) {
                String h = Integer.toHexString(aMessageDigest & UnsignedBytes.MAX_VALUE);
                while (h.length() < 2) {
                    StringBuilder sb = new StringBuilder();
                    sb.append("0");
                    sb.append(h);
                    h = sb.toString();
                }
                hexString.append(h);
            }*/
            return hexString.toString();
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
            return "no";
        }
    }

    private static String convertToHex(byte[] data) {
        StringBuilder buf = new StringBuilder();
        for (byte b : data) {
            int halfbyte = (b >>> 4) & 0x0F;
            int two_halfs = 0;
            do {
                buf.append((0 <= halfbyte) && (halfbyte <= 9) ? (char) ('0' + halfbyte) : (char) ('a' + (halfbyte - 10)));
                halfbyte = b & 0x0F;
            } while (two_halfs++ < 1);
        }
        return buf.toString();
    }

    public static String SHA1(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
        MessageDigest md = MessageDigest.getInstance("SHA-1");
        md.update(text.getBytes("iso-8859-1"), 0, text.length());
        byte[] sha1hash = md.digest();
        return convertToHex(sha1hash);
    }
    public static final String getSha1Hex(String clearString) {
        try {
            MessageDigest messageDigest = MessageDigest.getInstance("SHA-1");
            messageDigest.update(clearString.getBytes("UTF-8"));
            byte[] bytes = messageDigest.digest();
            StringBuilder buffer = new StringBuilder();
            for (byte b : bytes) {
                //buffer.append(Integer.toString((b & UnsignedBytes.MAX_VALUE) + Ascii.NUL, 16).substring(1));
            }
            Log.e("FFFFFFFFFFFFXXX", buffer.toString());
            return buffer.toString();
        } catch (Exception ignored) {
            ignored.printStackTrace();
            Log.e("FFFFFFFFFFFFERRR", ignored.getMessage());
            return ignored.toString();
        }
    }

    public static String Time_Picker(Context context, final EditText start_date) {
        Calendar c = Calendar.getInstance();
        final String[] Date = {""};
        Context context2 = context;
        TimePickerDialog timePickerDialog = new TimePickerDialog(context2, new OnTimeSetListener() {
            public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
                String m = String.valueOf(minute);
                String str = "0";
                if (m.length() <= 1) {
                    StringBuilder sb = new StringBuilder();
                    sb.append(str);
                    sb.append(m);
                    m = sb.toString();
                }
                String d = String.valueOf(hourOfDay);
                if (d.length() <= 1) {
                    StringBuilder sb2 = new StringBuilder();
                    sb2.append(str);
                    sb2.append(d);
                    d = sb2.toString();
                }
                StringBuilder sb3 = new StringBuilder();
                sb3.append(d);
                sb3.append(":");
                sb3.append(m);
                start_date.setText(sb3.toString());
                Log.i("TTTTTTTTTTime", Date[0]);
            }
        }, c.get(Calendar.DATE) + 1, c.get(Calendar.DATE) + 1, true);
        timePickerDialog.show();
        return start_date.getText().toString();
    }

    public static boolean Expired(String end) throws ParseException {
        String str = "yyyy-MM-dd";
        SimpleDateFormat sdf1 = new SimpleDateFormat(str);
        new SimpleDateFormat(str);
        Date d1 = new Date(sdf1.parse(end).getTime());
        Date d2 = new Date(sdf1.parse(sdf1.format(new Date())).getTime());
        Log.i("SSSSSS1", sdf1.format(d1));
        Log.i("SSSSSS2", sdf1.format(d2));
        return d1.before(d2);
    }

    public static long[] Time_stay(String end) throws ParseException {
        new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
        Date d1 = new Date(sdf1.parse(end).getTime());
        Date d2 = new Date(sdf1.parse(sdf1.format(new Date())).getTime());
        StringBuilder sb = new StringBuilder();
        sb.append("PASSED_BEF ");
        sb.append(sdf1.format(d1));
        String str = "VERIFICATION22 ";
        Log.i(str, sb.toString());
        StringBuilder sb2 = new StringBuilder();
        String str2 = "PASSED ";
        sb2.append(str2);
        sb2.append(sdf1.format(d1));
        Log.i(str, sb2.toString());
        StringBuilder sb3 = new StringBuilder();
        sb3.append(str2);
        sb3.append(sdf1.format(d2));
        Log.i(str, sb3.toString());
        long intervalle = d1.getTime() - d2.getTime();
        return new long[]{TimeUnit.MILLISECONDS.toDays(intervalle), TimeUnit.MILLISECONDS.toHours(intervalle), TimeUnit.MILLISECONDS.toMinutes(intervalle) % 60};
    }

    public static String publication_Time(String start) throws ParseException {
        long intervalle;
        String dif;
        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        SimpleDateFormat sdf3 = new SimpleDateFormat("dd-MM-yyyy");
        String today = sdf1.format(new Date());
        Date d1 = new Date(sdf1.parse(start).getTime());
        Date d2 = new Date(sdf1.parse(today).getTime());
        if (d2.after(d1)) {
            intervalle = d2.getTime() - d1.getTime();
        } else {
            intervalle = d1.getTime() - d2.getTime();
        }
        StringBuilder sb = new StringBuilder();
        sb.append("START");
        sb.append(String.valueOf(start));
        String str = "PUBLISHING";
        Log.i(str, sb.toString());
        StringBuilder sb2 = new StringBuilder();
        sb2.append("TODAY");
        sb2.append(String.valueOf(today));
        Log.i(str, sb2.toString());
        long days = TimeUnit.MILLISECONDS.toDays(intervalle);
        long hours = TimeUnit.MILLISECONDS.toHours(intervalle);
        Date date = d2;
        long minutes = TimeUnit.MILLISECONDS.toMinutes(intervalle) % 60;
        String str2 = "";
        SimpleDateFormat simpleDateFormat = sdf1;
        String str3 = today;
        SimpleDateFormat sdf2 = new SimpleDateFormat("HH:mm:ss");
        String str4 = "Il y a ";
        if (hours >= 24) {
            long day2 = hours / 24;
            long hours2 = hours % 24;
            if (day2 == 1) {
                StringBuilder sb3 = new StringBuilder();
                long j = intervalle;
                sb3.append("Hier à ");
                sb3.append(sdf2.format(d1));
                dif = sb3.toString();
            } else {
                if (day2 > 30 && day2 < 35) {
                    dif = "Il y a 1 mois";
                } else if (day2 < 30) {
                    StringBuilder sb4 = new StringBuilder();
                    sb4.append(str4);
                    sb4.append(day2);
                    sb4.append(" Jours");
                    dif = sb4.toString();
                } else {
                    StringBuilder sb5 = new StringBuilder();
                    sb5.append("Depuis le ");
                    sb5.append(sdf3.format(d1));
                    dif = sb5.toString();
                }
            }
        } else {
            if (hours >= 1) {
                StringBuilder sb6 = new StringBuilder();
                sb6.append(str4);
                sb6.append(hours);
                sb6.append(" h ");
                sb6.append(minutes);
                sb6.append(" min");
                dif = sb6.toString();
            } else if (minutes < 3) {
                dif = "A l'instant";
            } else {
                StringBuilder sb7 = new StringBuilder();
                sb7.append(str4);
                sb7.append(minutes);
                sb7.append(" min ");
                dif = sb7.toString();
            }
        }
        Log.i(str, String.valueOf(dif));
        return dif;
    }

    public static int get_Age(String start) throws ParseException {
        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy");
        new Date(sdf1.parse(start).getTime());
        return Integer.parseInt(sdf1.format(new Date(new Date().getTime()))) - Integer.parseInt(start.substring(0, 4));
    }

    public static long[] online_Time(String start) throws ParseException {
        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        long intervalle = new Date(sdf1.parse(sdf1.format(new Date())).getTime()).getTime() - new Date(sdf1.parse(start).getTime()).getTime();
        Log.i("TRAINNING_TODAY", String.valueOf(intervalle));
        long days = TimeUnit.MILLISECONDS.toDays(intervalle);
        return new long[]{TimeUnit.MILLISECONDS.toHours(intervalle), TimeUnit.MILLISECONDS.toMinutes(intervalle) % 60};
    }

    public static String add_days(String start, int amount) throws ParseException {
        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date d1 = new Date(sdf1.parse(start).getTime());
        GregorianCalendar gc = new GregorianCalendar();
        Calendar c = Calendar.getInstance();
        gc.setTime(d1);
        c.setTime(sdf1.parse(start));
        gc.add(Calendar.DATE, amount);
        c.add(Calendar.DATE, amount);
        String v = sdf1.format(c.getTime());
        Date d12 = gc.getTime();
        return v;
    }

    public static String formatingDate(String origin_date) {
        String dif;
        String str = origin_date;
        String str2 = "";
        try {
            long[] date = online_Time(origin_date);
            SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            SimpleDateFormat sdf2 = new SimpleDateFormat("HH:mm:ss");
            Date d1 = new Date(sdf1.parse(str).getTime());
            String str3 = str2;
            long hours = date[0];
            long minutes = date[1];
            String str4 = "Il y a ";
            if (hours >= 24) {
                long day2 = hours / 24;
                long hours2 = hours % 24;
                if (day2 >= 30 && day2 < 45) {
                    dif = "Il y'a 1 mois";
                } else if (day2 < 30) {
                    StringBuilder sb = new StringBuilder();
                    sb.append(str4);
                    sb.append(day2);
                    sb.append(" Jours");
                    dif = sb.toString();
                } else if (day2 == 1) {
                    StringBuilder sb2 = new StringBuilder();
                    sb2.append("Hier à ");
                    sb2.append(sdf2.format(d1));
                    dif = sb2.toString();
                } else {
                    StringBuilder sb3 = new StringBuilder();
                    sb3.append("Depuis ");
                    sb3.append(str);
                    dif = sb3.toString();
                }
            } else if (hours >= 1) {
                StringBuilder sb4 = new StringBuilder();
                sb4.append(str4);
                sb4.append(hours);
                sb4.append("h ");
                sb4.append(minutes);
                sb4.append("min");
                dif = sb4.toString();
            } else if (minutes < 3) {
                dif = "A l'instant";
            } else {
                StringBuilder sb5 = new StringBuilder();
                sb5.append(str4);
                sb5.append(minutes);
                sb5.append("min ");
                dif = sb5.toString();
            }
            return dif;
        } catch (ParseException e) {
            e.printStackTrace();
            Log.i("ERRRRRRRRR", e.getMessage());
            return str2;
        }
    }

    public static int KeyCodeGen() {
        return new Random().nextInt(100000);
    }

    public static void SHARE(Context context, String message) {
        Intent intent = new Intent();
        intent.setAction("android.intent.action.SEND");
        intent.putExtra("android.intent.extra.TEXT", message);
        intent.setType(StringBody.CONTENT_TYPE);
        context.startActivity(Intent.createChooser(intent, "Partager le lien de Clinnet via :"));
    }

    public static void CALL(Context context, String phone) {
        Intent intent = new Intent("android.intent.action.DIAL");
        StringBuilder sb = new StringBuilder();
        sb.append("tel:");
        sb.append(phone);
        intent.setData(Uri.parse(sb.toString()));
        context.startActivity(intent);
    }

    public static void LAUNCH_WHATAP(Context context, String number) {
        String str = "+00 9876543210";
        StringBuilder sb = new StringBuilder();
        sb.append("https://api.whatsapp.com/send?phone=+");
        sb.append(number);
        String url = sb.toString();
        try {
            context.getPackageManager().getPackageInfo("com.whatsapp", PackageManager.GET_ACTIVITIES);
            Intent i = new Intent("android.intent.action.VIEW");
            i.setData(Uri.parse(url));
            context.startActivity(i);
        } catch (NameNotFoundException e) {
            Toast.makeText(context, "Whatsapp app not installed in your phone", Toast.LENGTH_LONG).show();
            e.printStackTrace();
        }
    }

    public static void LAUNCH_WHATAPP(Context context, String number) {
        Intent sendIntent = new Intent();
        sendIntent.setAction("android.intent.action.SEND");
        sendIntent.putExtra("android.intent.extra.TEXT", "This is my text to send.");
        sendIntent.setType(StringBody.CONTENT_TYPE);
        sendIntent.setPackage("com.whatsapp");
        context.startActivity(Intent.createChooser(sendIntent, ""));
        context.startActivity(sendIntent);
        StringBuilder sb = new StringBuilder();
        sb.append("https://api.whatsapp.com/send?phone=");
        sb.append(number);
        String url = sb.toString();
        Intent i = new Intent("android.intent.action.VIEW");
        i.setData(Uri.parse(url));
        context.startActivity(i);
    }

    public static void LAUNCH_WEB_SITE(Context context) {
        //context.startActivity(Intent.createChooser(new Intent("android.intent.action.VIEW", Uri.parse(ImagesContract.URL)), "Ouvrir via :"));
    }

    public static void Set_Alarm(Context context) {
        Intent intent = new Intent(context,null /*BroadCast.class*/);
        if (!(PendingIntent.getBroadcast(context, 0, intent, Intent.FILL_IN_ACTION) != null)) {
            Calendar calendar = Calendar.getInstance();
            PendingIntent pendingIntent = PendingIntent.getBroadcast(context.getApplicationContext(), 0, intent, 0);
            AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
            alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), pendingIntent);
            alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), 5000, pendingIntent);
        }
    }

    public static void Notify(Context context, Intent intent, String titre) {
        NotificationManager notifManager = null;
        String id = context.getString(R.string.app_name);
        String title = context.getString(R.string.app_name);
        if (0 == 0) {
            notifManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
        }
        if (VERSION.SDK_INT >= 26 && notifManager.getNotificationChannel(id) == null) {
            NotificationChannel mChannel = new NotificationChannel(id, title, NotificationManager.IMPORTANCE_HIGH);
            mChannel.enableVibration(true);
            mChannel.setVibrationPattern(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400});
            notifManager.createNotificationChannel(mChannel);
        }
        intent.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
        PendingIntent pendingIntent = PendingIntent.getActivity(context, (int) System.currentTimeMillis(), intent, Intent.FILL_IN_ACTION);
        NotificationCompat.Builder builder = new NotificationCompat.Builder(context, id);
        //builder.setContentTitle(titre).setSmallIcon(R.drawable.ic_notify).setContentText(context.getString(R.string.app_name)).setDefaults(-1).setAutoCancel(true).setContentIntent(pendingIntent).setTicker(titre).setVibrate(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400});
        notifManager.notify(0, builder.build());
    }

    public static void Camera_Picker(int n) {
        Intent camera = new Intent("android.media.action.IMAGE_CAPTURE");
        StringBuilder sb = new StringBuilder();
        sb.append(Environment.getExternalStorageDirectory().getPath());
        sb.append("/MyAppFolder/MyApp");
        sb.append(n);
        sb.append(".png");
        camera.putExtra("output", Uri.fromFile(new File(sb.toString())));
        int n2 = n + 1;
    }

    public static int Savefile(String name, String path) {
        StringBuilder sb = new StringBuilder();
        sb.append(Environment.getExternalStorageDirectory().toString());
        String str = "/Xresolu/profil/";
        sb.append(str);
        File direct = new File(sb.toString());
        StringBuilder sb2 = new StringBuilder();
        sb2.append(Environment.getExternalStorageDirectory().toString());
        sb2.append(str);
        sb2.append(name);
        sb2.append(".jpg");
        File file = new File(sb2.toString());
        if (!direct.exists()) {
            direct.mkdir();
            Log.e("SAVE_IMAGE1", "Director created");
        }
        if (file.exists()) {
            return 0;
        }
        try {
            file.createNewFile();
            Log.e("SAVE_IMAGE2", "file created");
            FileChannel src = new FileInputStream(path).getChannel();
            FileChannel dst = new FileOutputStream(file).getChannel();
            dst.transferFrom(src, 0, src.size());
            src.close();
            dst.close();
            return 1;
        } catch (IOException e) {
            Log.e("SAVE_IMAGE_ERR", e.getMessage());
            e.printStackTrace();
            return 0;
        }
    }

    public static String Blob_encode(Bitmap bmp) {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        bmp.compress(CompressFormat.JPEG, 100, baos);
        return Base64.encodeToString(baos.toByteArray(), 0);
    }
}
<file_sep>/app/src/main/java/cd/digitalEdge/vst/Views/About_app.java
package cd.digitalEdge.vst.Views;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import cd.digitalEdge.vst.R;
import cd.digitalEdge.vst.Views.Blanks.Contacts;
import cd.digitalEdge.vst.Views.Diapo.IntroActivity;

public class About_app extends AppCompatActivity {
    Context context = this;
    TextView back,tutorial;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_about_app);
        getSupportActionBar().hide();

        back = findViewById(R.id.back);
        tutorial = findViewById(R.id.tutorial);
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });
        tutorial.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i  = new Intent(context, IntroActivity.class);
                startActivity(i);
                finish();            }
        });
    }

    @Override
    public void onBackPressed() {
        Intent i  = new Intent(context, Paramettres.class);
        startActivity(i);
        finish();
    }
}
<file_sep>/app/src/main/java/cd/digitalEdge/vst/Tools/RoundedImageView.java
package cd.digitalEdge.vst.Tools;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;

import androidx.appcompat.widget.AppCompatImageView;
import androidx.core.graphics.drawable.RoundedBitmapDrawable;
import androidx.core.graphics.drawable.RoundedBitmapDrawableFactory;

public class RoundedImageView extends AppCompatImageView {
    public RoundedImageView(Context context) {
        super(context);
    }

    public RoundedImageView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public RoundedImageView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    public void setImageDrawable(Drawable drawable) {
        if (drawable != null) {
            Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap();
            RoundedBitmapDrawable rid = RoundedBitmapDrawableFactory.create(getResources(), bitmap);
            rid.setCornerRadius(((float) bitmap.getWidth()) * 0.5f);
            super.setImageDrawable(rid);
        }
    }

    public void setImageBitmap(Bitmap bitmap) {
        if (bitmap != null) {
            RoundedBitmapDrawable rid = RoundedBitmapDrawableFactory.create(getResources(), bitmap);
            rid.setCornerRadius(((float) bitmap.getWidth()) * 0.5f);
            super.setImageDrawable(rid);
        }
    }
}
<file_sep>/app/build.gradle
apply plugin: 'com.android.application'

android {
    compileSdkVersion 29

    defaultConfig {
        applicationId "cd.digitalEdge.vst"
        minSdkVersion 19
        targetSdkVersion 29
        versionCode 2
        versionName "1.0"
        multiDexEnabled true

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            multiDexKeepFile file('multidex-main-dex-list.txt')
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    allprojects {
        repositories {
            maven { url 'https://jitpack.io' }
        }
    }

}


dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'com.google.zxing:core:3.2.1'
    implementation 'com.journeyapps:zxing-android-embedded:3.5.0'
    implementation 'com.google.android.material:material:1.1.0'
    //implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.amitshekhar.android:android-networking:1.0.2'
    implementation 'com.amitshekhar.android:jackson-android-networking:1.0.2'
    implementation 'com.hbb20:ccp:2.2.0'
    implementation 'com.flaviofaria:kenburnsview:1.0.6'
    implementation 'com.koushikdutta.ion:ion:3.0.8'
    implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.18'
    /*implementation('com.lamudi.phonefield:phone-field:0.1.3@aar') {
            transitive = true
        }*/
    implementation 'de.hdodenhof:circleimageview:3.1.0'
    implementation 'com.aurelhubert:ahbottomnavigation:2.3.4'
    implementation 'it.sephiroth.android.library.bottomnavigation:bottom-navigation:3.0.0'
    implementation 'io.nlopez.smartlocation:library:3.3.3'
    implementation 'com.github.nkzawa:socket.io-client:0.6.0'
    implementation 'com.karumi:dexter:6.2.0'
    implementation 'com.google.gms:google-services:4.3.3'
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
    implementation 'com.github.AnyChart:AnyChart-Android:1.1.2'
    implementation files('libs/FileCacher.jar')
    api 'com.theartofdev.edmodo:android-image-cropper:2.8.+'
}

dependencies {
    implementation 'androidx.legacy:legacy-support-v4:+'
}


dependencies {
    implementation 'androidx.legacy:legacy-support-v4:+'
}

dependencies {
    implementation 'androidx.appcompat:appcompat:+'
    implementation 'androidx.constraintlayout:constraintlayout:+'
}

dependencies {
    implementation 'androidx.appcompat:appcompat:+'
    implementation 'androidx.constraintlayout:constraintlayout:+'
}

dependencies {
    implementation 'androidx.appcompat:appcompat:+'
    implementation 'androidx.constraintlayout:constraintlayout:+'
}

dependencies {
    implementation 'androidx.appcompat:appcompat:+'
    implementation 'androidx.constraintlayout:constraintlayout:+'
}

dependencies {
    implementation 'androidx.appcompat:appcompat:+'
    implementation 'androidx.constraintlayout:constraintlayout:+'
}

dependencies {
    implementation 'androidx.appcompat:appcompat:+'
    implementation 'androidx.constraintlayout:constraintlayout:+'
}

dependencies {
    implementation 'androidx.appcompat:appcompat:+'
    implementation 'androidx.constraintlayout:constraintlayout:+'
}

dependencies {
    implementation 'androidx.appcompat:appcompat:+'
    implementation 'androidx.constraintlayout:constraintlayout:+'
}

dependencies {
    implementation 'androidx.appcompat:appcompat:+'
    implementation 'androidx.constraintlayout:constraintlayout:+'
}

dependencies {
    implementation 'com.android.support:appcompat-v7:28.+'
    implementation 'com.android.support.constraint:constraint-layout:+'

}

dependencies {
    implementation 'com.github.bumptech.glide:glide:4.11.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
}

dependencies {
    implementation 'com.android.support:appcompat-v7:28.+'
    implementation 'com.android.support.constraint:constraint-layout:+'
}

dependencies {
    implementation 'com.android.support:appcompat-v7:28.+'
    implementation 'com.android.support.constraint:constraint-layout:+'
}

dependencies {
    implementation 'com.android.support:appcompat-v7:28.+'
    implementation 'com.android.support.constraint:constraint-layout:+'
}

dependencies {
    implementation 'com.android.support:appcompat-v7:28.+'
    implementation 'com.android.support.constraint:constraint-layout:+'
}

dependencies {
    implementation 'com.android.support:appcompat-v7:28.+'
    implementation 'com.android.support.constraint:constraint-layout:+'
}

dependencies {
    implementation 'androidx.appcompat:appcompat:+'
    implementation 'androidx.constraintlayout:constraintlayout:+'
}

dependencies {
    implementation 'androidx.appcompat:appcompat:+'
    implementation 'androidx.constraintlayout:constraintlayout:+'
}

dependencies {
    implementation 'androidx.appcompat:appcompat:+'
    implementation 'androidx.constraintlayout:constraintlayout:+'
}

dependencies {
    implementation 'androidx.appcompat:appcompat:+'
    implementation 'androidx.constraintlayout:constraintlayout:+'
}
<file_sep>/app/src/main/java/cd/digitalEdge/vst/Objects/Post_Comments.java
package cd.digitalEdge.vst.Objects;

public class Post_Comments {

    public String id            = "id";
    public String comment     = "comment";
    public String created_at         = "created_at";

    public String getId() {
        return id;
    }

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

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public String getCreated_at() {
        return created_at;
    }

    public void setCreated_at(String created_at) {
        this.created_at = created_at;
    }
}
<file_sep>/app/src/main/java/cd/digitalEdge/vst/Tools/Utils.java
package cd.digitalEdge.vst.Tools;

import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Handler;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RatingBar;
import android.widget.TextView;
import android.view.Menu;
import android.widget.Toast;

import androidx.cardview.widget.CardView;

import com.androidnetworking.AndroidNetworking;
import com.androidnetworking.common.Priority;
import com.androidnetworking.error.ANError;
import com.androidnetworking.interfaces.JSONObjectRequestListener;
import com.androidnetworking.interfaces.StringRequestListener;
import com.androidnetworking.model.Progress;
import com.anychart.core.Text;
import com.google.android.material.snackbar.Snackbar;
import com.koushikdutta.async.http.body.MultipartFormDataBody;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.Timer;
import java.util.TimerTask;

import cd.digitalEdge.vst.Controllers.Config;
import cd.digitalEdge.vst.Controllers.Config_preferences;
import cd.digitalEdge.vst.Controllers.Offline.SQLite.Sqlite_selects_methods;
import cd.digitalEdge.vst.Controllers.Online.Updates;
import cd.digitalEdge.vst.MainActivity;
import cd.digitalEdge.vst.Objects.Articles;
import cd.digitalEdge.vst.Objects.Users;
import cd.digitalEdge.vst.R;
import it.sephiroth.android.library.bottomnavigation.MenuParser;
import okhttp3.internal.http.HttpHeaders;


public class Utils {

    Timer mTimer = null;
    public static Handler mHandler = new Handler();

    public static void MonToast(Context context, String titres, String message, String type) {
        View view = LayoutInflater.from(context).inflate(R.layout.toast_auth_info, null);
        LinearLayout back = (LinearLayout) view.findViewById(R.id.back);
        TextView sous_titre = (TextView) view.findViewById(R.id.sous);
        ((TextView) view.findViewById(R.id.titre)).setText(titres);
        sous_titre.setText(message);
        if (type.equals("Danger")) {
            back.setBackgroundColor(context.getResources().getColor(R.color.red));
        } else if (type.equals("Success")) {
            back.setBackgroundColor(context.getResources().getColor(R.color.green));
        } else if (type.equals("Info")) {
            back.setBackgroundColor(context.getResources().getColor(R.color.colorPrimary));
        }
        Toast toast = Toast.makeText(context, "", Toast.LENGTH_LONG);
        toast.setGravity(48, 0, 0);
        toast.setView(view);
        toast.show();
    }

    public static String[] QNT_PICKER() {

            String[] qntVal;
            qntVal = new String[10];
            for (int i = 0; i < qntVal.length; i++) {
                qntVal[i] = String.valueOf(i);
            }
            return qntVal;

    }

    public void Noter_article(Context context, String property_id) {
        View convertView = LayoutInflater.from(context).inflate(R.layout.view_note, null);
        RatingBar note = convertView.findViewById(R.id.note);
        TextView note_prod = convertView.findViewById(R.id.note_prod);
        EditText rating_body = convertView.findViewById(R.id.rating_body);
        CheckBox recommand = convertView.findViewById(R.id.recommand);
        final String[] cote = {"0.0"};
        note.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() {
            @Override
            public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) {
                ratingBar.setRating(rating);
                note_prod.setText(String.valueOf(rating)+" /5.0");
            }
        });

        new AlertDialog.Builder(context)
                .setView(convertView)
                .setPositiveButton("Valider", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        Toast.makeText(context, "Votre note est de : "+note.getRating(), Toast.LENGTH_SHORT).show();
                        String recommaded = "";
                        if (recommand.isChecked()== true) recommaded = "Yes";
                        else recommaded = "No";
                        sendNote(
                                context,
                                property_id,
                                rating_body.getText().toString().replace("'","''").trim(),
                                recommaded,
                                String.valueOf(note.getRating())
                        );
                    }
                })
                .setNegativeButton("Annuler", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {

                    }
                }).show();

    }
    public static void Setting_badge(String count2, TextView textCartItemCount) {
        if (count2.equals("0") || count2 == null){
            textCartItemCount.setVisibility(View.GONE);
        }else{
            textCartItemCount.setVisibility(View.VISIBLE);
            textCartItemCount.setText(count2);
        }
    }

    public static class TimeDisplay extends TimerTask {
        Context context;
        int turn = 0;
        TextView textCartItemCount;
        MenuItem menuItem;

        public TimeDisplay(Context context, int turn, TextView textCartItemCount, MenuItem menuItem) {
            this.context = context;
            this.turn = turn;
            this.textCartItemCount = textCartItemCount;
            this.menuItem = menuItem;
        }

        public void run() {
            mHandler.post(new Runnable() {
                public void run() {
                    Log.e("MYSERVICE---XX", "je tourne bien");
                    int count = Check_Panier(context);
                    View actionView = menuItem.getActionView();
                    textCartItemCount = (TextView) actionView.findViewById(R.id.cart_badge);
                    if (Preferences.getUserPreferences(context, Constants.PANIER_COUNT) == null || Preferences.getUserPreferences(context, Constants.PANIER_COUNT).equals("")){
                        Utils.Setting_badge("0",textCartItemCount);
                    }else Utils.Setting_badge(String.valueOf(count),textCartItemCount);

                }
            });
        }
    }

    public static int Check_Panier(final Context context) {
        ArrayList<Articles> PANIER = new ArrayList<>();
        PANIER = Sqlite_selects_methods.getall_Articles(context);
        if ( null == PANIER || PANIER.isEmpty() ){
            PANIER = new ArrayList<>();
            //Log.e("DATA", "DATAS "+PANIER.size());
        }
        int count = PANIER.size();
        Preferences.setUserPreferences(context, Constants.PANIER_COUNT, String.valueOf(count));
        return count;
    }

    public void sendNote(Context context,String property_id,String body,String recommanded,String note ) {
        //Log.e("RATING_PARAMS ", property_id+" "+ body+" "+ recommanded+" "+ note );
        AndroidNetworking
                .post(Config.GET_PRODUCT_NOTE)
                .addBodyParameter("body", body)
                .addBodyParameter("user_id", Preferences.getCurrentUser(context).getId())
                .addBodyParameter("property_id", property_id)
                .addBodyParameter("recommend", recommanded)
                .addBodyParameter("note", note)
                .setPriority(Priority.HIGH)
                .build()
                .getAsString(new StringRequestListener() {
                    @Override
                    public void onResponse(String response) {
                        Toast.makeText(context, response, Toast.LENGTH_SHORT).show();
                        //Log.e("RATING_ERR ",response);
                    }
                    @Override
                    public void onError(ANError anError) {
                        //Log.e("RATING_ERR ",anError.getMessage());
                    }
                });
    }


    public void SaveToFavoris(Context context,String bienId ) {
        ProgressDialog p = new ProgressDialog(context);
        p.setTitle("");
        p.setMessage("Encours...");
        p.show();
        Log.e("FAVORISXXXX ", Config.SET_FAVORI.concat(Preferences.getCurrentUser(context).getId() +"/"+bienId));
        AndroidNetworking
                .post(Config.SET_FAVORI.concat(Preferences.getCurrentUser(context).getId() +"/"+bienId))
                .setPriority(Priority.HIGH)
                .build()
                .getAsString(new StringRequestListener() {
                    @Override
                    public void onResponse(String response) {
                        Toast.makeText(context, response, Toast.LENGTH_SHORT).show();
                        Log.e("RATING_ERR ",response);
                        p.dismiss();
                    }
                    @Override
                    public void onError(ANError anError) {
                        Log.e("RATING_ERR ",anError.getMessage());
                        p.dismiss();
                    }

                });
    }

}
<file_sep>/app/src/main/java/cd/digitalEdge/vst/Views/Lists/Wallet.java
package cd.digitalEdge.vst.Views.Lists;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ListView;

import com.kosalgeek.android.caching.FileCacher;

import java.util.ArrayList;

import cd.digitalEdge.vst.Adaptors.Adaptor_favoris_list;
import cd.digitalEdge.vst.Adaptors.Adaptor_wallet1_list;
import cd.digitalEdge.vst.Objects.Articles;
import cd.digitalEdge.vst.R;
import cd.digitalEdge.vst.Tools.Constants;
import cd.digitalEdge.vst.Views.Gerer;

public class Wallet extends AppCompatActivity {

    Context context = this;
    Adaptor_wallet1_list adaptor;
    ListView list_gain, list_paiement;
    LinearLayout progress_data;

    ArrayList<Articles> DATA_WALLET = new ArrayList<>();
    FileCacher<ArrayList<Articles>> DATAS_CACHED = new FileCacher<>(context, Constants.FILE_WALLET);

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_wallet);
        getSupportActionBar().setTitle("Portefeuilles");
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        INIT_COMPONENT();
        getData();
    }

    private void INIT_COMPONENT() {
        progress_data = findViewById(R.id.progress_data);
        list_paiement = findViewById(R.id.list_paiement);
        list_gain = findViewById(R.id.list_gain);

        progress_data.setVisibility(View.GONE);
    }

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


    @Override
    public void onBackPressed() {
        Intent i  = new Intent(context, Gerer.class);
        startActivity(i);
        finish();
    }
    @Override
    public boolean onOptionsItemSelected(@NonNull MenuItem item) {
        super.onOptionsItemSelected(item);
        switch (item.getItemId()) {
            case android.R.id.home:
                onBackPressed();
                return true;
        }
        return true;
    }

    // TODO METHOD
    void getData(){
        adaptor = new Adaptor_wallet1_list(context);
        list_gain.setAdapter(adaptor);
        list_paiement.setAdapter(adaptor);
    }

}
<file_sep>/app/src/main/java/cd/digitalEdge/vst/Controllers/Background/LocationServices.java
package cd.digitalEdge.vst.Controllers.Background;

import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.location.Location;
import android.location.LocationManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Handler;
import android.os.IBinder;
import android.util.Log;

import java.util.Timer;
import java.util.TimerTask;

import cd.digitalEdge.vst.Controllers.Config_preferences;
import cd.digitalEdge.vst.Tools.Tool;
import io.nlopez.smartlocation.OnLocationUpdatedListener;
import io.nlopez.smartlocation.SmartLocation;

//import io.nlopez.smartlocation.OnLocationUpdatedListener;
//import io.nlopez.smartlocation.SmartLocation;

public class LocationServices extends Service {
    public static final int notify = 2000;
    Context context = this;
    //private FusedLocationProviderClient client;
    int count = 0;
    LocationManager locationManager;
    /* access modifiers changed from: private */
    public Handler mHandler = new Handler();
    private Timer mTimer = null;

    class TimeDisplay extends TimerTask {
        TimeDisplay() {
        }

        public void run() {
            LocationServices.this.mHandler.post(new Runnable() {
                public void run() {

                    Log.e("MYLOCATION", "je tourne bien");
                    ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
                    NetworkInfo info = manager.getActiveNetworkInfo();
                    if (info != null && info.isConnected()) {
                        LocationServices.this.Mylocation();
                    }
                }
            });
        }
    }


    public IBinder onBind(Intent intent) {
        throw new UnsupportedOperationException("Not yet implemented");
    }

    public void onCreate() {
        Timer timer = this.mTimer;
        if (timer != null) {
            timer.cancel();
        } else {
            this.mTimer = new Timer();
        }
        //this.client = com.google.android.gms.location.LocationServices.getFusedLocationProviderClient(getApplicationContext());
        this.mTimer.scheduleAtFixedRate(new TimeDisplay(), 0, 2000);
    }

    public void onDestroy() {
        super.onDestroy();
        this.mTimer.cancel();
    }

    /* access modifiers changed from: 0000 */
    public void Mylocation() {
        try {
            SmartLocation.with(getApplicationContext()).location().start(new OnLocationUpdatedListener() {
                public void onLocationUpdated(Location location) {
                    if (location == null) {
                        LocationServices.this.Mylocation();
                        return;
                    }
                    StringBuilder sb = new StringBuilder();
                    sb.append(location.getLatitude());
                    sb.append(",");
                    sb.append(location.getLongitude());
                    String sb2 = sb.toString();
                    Log.e("MYLOCATION", sb2);
                    Tool.setUserPreferences(context, Config_preferences.LAT, String.valueOf(location.getLatitude()));
                    Tool.setUserPreferences(context, Config_preferences.LONG, String.valueOf(location.getLongitude()));
                }
            });
        } catch (Exception e) {
            Log.e("CodePackage.LOCATION", e.getMessage());
        }
    }
}
<file_sep>/app/src/main/java/cd/digitalEdge/vst/Views/Lists/Recherche.java
package cd.digitalEdge.vst.Views.Lists;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;

import android.app.AlertDialog;
import android.app.SearchManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.AbsListView;
import android.widget.GridView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.SearchView;
import android.widget.TextView;
import android.widget.Toast;

import com.androidnetworking.AndroidNetworking;
import com.androidnetworking.common.Priority;
import com.androidnetworking.error.ANError;
import com.androidnetworking.interfaces.JSONArrayRequestListener;
import com.androidnetworking.interfaces.JSONObjectRequestListener;
import com.androidnetworking.interfaces.OkHttpResponseAndJSONArrayRequestListener;
import com.androidnetworking.interfaces.StringRequestListener;
import com.google.android.material.navigation.NavigationView;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import com.kosalgeek.android.caching.FileCacher;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Timer;
import java.util.TimerTask;

import cd.digitalEdge.vst.Adaptors.Adaptor_recherche_list;
import cd.digitalEdge.vst.Controllers.Background.MyServices;
import cd.digitalEdge.vst.Controllers.Config;
import cd.digitalEdge.vst.Controllers.Online.Selects;
import cd.digitalEdge.vst.MainActivity;
import cd.digitalEdge.vst.Objects.Articles;
import cd.digitalEdge.vst.Objects.Products;
import cd.digitalEdge.vst.R;
import cd.digitalEdge.vst.Tools.Constants;
import cd.digitalEdge.vst.Tools.Preferences;
import cd.digitalEdge.vst.Tools.Utils;
import okhttp3.Response;
import timber.log.Timber;

public class Recherche extends AppCompatActivity {
    Context context = this;
    String SEARCH_INPUT = "";
    Adaptor_recherche_list adapter;
    MainActivity MAIN = new MainActivity();

    GridView articles_list;
    ProgressBar progressbar;

    SwipeRefreshLayout swiper;
    SearchView SEARCH;
    LinearLayout progress_data, error404;

    int turn = 0;
    boolean Connected = true;
    TextView textCartItemCount, CATEGORIE,BTN_search;
    public Handler mHandler = new Handler();
    Timer mTimer = null;

    ArrayList<Articles> DATAS = new ArrayList<>();
    ArrayList<Articles> DATAS_SEARCHED = new ArrayList<>();
    FileCacher<ArrayList<Articles>> DATAS_CACHED = new FileCacher<>(context, Constants.FILE_PRODUCTS);

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_recherche);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        AndroidNetworking.initialize(getApplicationContext());

        INIT_COMPONENT();
        ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo info = manager.getActiveNetworkInfo();
        if (info != null && info.isConnected()) {
            Connected = true;
        }else{
            Connected = false;
        }

        if (getIntent().hasExtra("TITLE")) {
            String from = getIntent().getExtras().getString("TITLE");
            //Log.e("TITLEEEEEEE", from);
            if (from.equals("V")) SEARCH_INPUT = "Vêtement";
            else if (from.equals("A")) SEARCH_INPUT = "Aliments";
            else if (from.equals("C")) SEARCH_INPUT = "Chaussures";
            else SEARCH_INPUT = from;
            if (Connected == true)getResearchedProd();
            else LoadCache();
        }
        else if(getIntent().hasExtra("SEARCH_INPUT")) {
            SEARCH_INPUT = getIntent().getExtras().getString("SEARCH_INPUT");
            if (Connected == true)getResearchedProd();
            else LoadCache();
        }else{
            SEARCH_INPUT = "Suprême store";
            if (Connected == true) Loadprod();
            else LoadCache();
        }

        getSupportActionBar().setTitle(SEARCH_INPUT);

    }

    private void INIT_COMPONENT() {
        articles_list = findViewById(R.id.articles_list);
        swiper = findViewById(R.id.swiper);
        progress_data = findViewById(R.id.progress_data);
        progressbar = findViewById(R.id.progressbar);
        error404 = findViewById(R.id.error404);

        //navigationView.setNavigationItemSelectedListener(this);

        progress_data.setVisibility(View.GONE);
        progressbar.setVisibility(View.GONE);
        error404.setVisibility(View.GONE);

    }

    @Override
    protected void onResume() {
        super.onResume();
        swiper.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {
                getResearchedProd();
            }
        });
        error404.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                getResearchedProd();
            }
        });

        articles_list.setOnScrollListener(new AbsListView.OnScrollListener() {
            @Override
            public void onScrollStateChanged(AbsListView view, int scrollState) {
                if (
                        scrollState == AbsListView.OnScrollListener.SCROLL_STATE_IDLE &&
                                (articles_list.getLastVisiblePosition() ) >= adapter.getCount()-1
                ){
                    Animation from_right = AnimationUtils.loadAnimation(context, R.anim.m_fromright);
                    Animation to_right = AnimationUtils.loadAnimation(context, R.anim.m_toleft);
                    progress_data.startAnimation(from_right);
                    progress_data.setVisibility(View.VISIBLE);
                    new Handler().postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            progress_data.startAnimation(to_right);
                            progress_data.setVisibility(View.GONE);
                        }
                    }, 2000);
                }
            }

            @Override
            public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {

            }
        });
    }

    @Override
    public void onBackPressed() {
        Intent i  = new Intent(context, MainActivity.class);
        startActivity(i);
        finish();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        this.mTimer.cancel();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        super.onCreateOptionsMenu(menu);
        getMenuInflater().inflate(R.menu.recherche_menu, menu);

        // todo setting up searchView from ActionBar
        SearchManager manager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
        SearchView search = (SearchView) menu.findItem(R.id.searchItem).getActionView();
        search.setSearchableInfo(manager.getSearchableInfo(getComponentName()));
        search.setQueryHint("Recherche Article");
        search.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
            @Override
            public boolean onQueryTextSubmit(String query) {
                SEARCH_INPUT = query;
                getResearchedProd();
                return true;
            }

            @Override
            public boolean onQueryTextChange(String newText) {
                return false;
            }
        });

        final MenuItem menuItem = menu.findItem(R.id.panier);
        View actionView = menuItem.getActionView();
        textCartItemCount = (TextView) actionView.findViewById(R.id.cart_badge);

        Timer timer = this.mTimer;
        if (timer != null) {
            timer.cancel();
        } else {
            this.mTimer = new Timer();
        }
        this.mTimer.scheduleAtFixedRate(new TimeDisplay(getApplicationContext(), 0), 0, 1000);

        actionView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onOptionsItemSelected(menuItem);
            }
        });
        return true;
    }

    public class TimeDisplay extends TimerTask {
        Context context;
        int turn = 0;

        public TimeDisplay(Context context, int turn) {
            this.context = context;
            //this.turn = turn;
        }

        public void run() {
            mHandler.post(new Runnable() {
                public void run() {
                    ////Log.e("PANIER_SERVICES", "je tourne bien");
                    new MyServices().Check_Panier(context);
                    if (Preferences.getUserPreferences(context, Constants.PANIER_COUNT) == null || Preferences.getUserPreferences(context, Constants.PANIER_COUNT).equals("")){
                        Utils.Setting_badge("0",textCartItemCount);
                    }else Utils.Setting_badge(Preferences.getUserPreferences(context, Constants.PANIER_COUNT),textCartItemCount);
                }
            });
        }
    }

    public void Setting_badge(String count2) {

    }

    @Override
    public boolean onOptionsItemSelected(@NonNull MenuItem item) {
        super.onOptionsItemSelected(item);
        switch (item.getItemId()) {
            case R.id.panier :
                Intent i  = new Intent(context, Panier.class);
                startActivity(i);
                finish();
                break;
            case android.R.id.home:
                // API 5+ solution
                onBackPressed();
                return true;
        }

        return true;
    }

    // TODO METHOD
    private void getResearchedProd(){
        //Log.i("PRODUCT_DATAS ",Config.GET_PRODUCTS);
        progress_data.setVisibility(View.VISIBLE);
        error404.setVisibility(View.GONE);
        DATAS.clear();
        AndroidNetworking
                .post(Config.GET_PRODUCT_SEARCH)
                .addBodyParameter("query", SEARCH_INPUT)
                .setPriority(Priority.LOW)
                .build()
                .getAsJSONObject(new JSONObjectRequestListener() {
                    @Override
                    public void onResponse(JSONObject response) {
                        try {
                            JSONArray ar = response.getJSONArray("results");
                            ////Log.e("PRODUCT_DATAS RR ", ar.toString());

                            for (int i = 0; i < ar.length(); i++) {
                                JSONObject jsonObject = ar.getJSONObject(i);
                                Articles p = new Articles();
                                p.setId(jsonObject.getString(new Articles().id));
                                p.setName(jsonObject.getString(new Articles().name));
                                p.setSlug(jsonObject.getString(new Articles().slug));
                                p.setImages(jsonObject.getString(new Articles().images));
                                p.setDescription(jsonObject.getString(new Articles().description));
                                p.setPrice(jsonObject.getString(new Articles().price));
                                p.setStock(jsonObject.getString(new Articles().stock));
                                p.setAvailability(jsonObject.getString(new Articles().availability));
                                p.setKeywords(jsonObject.getString(new Articles().keywords));
                                p.setUser_id(jsonObject.getString(new Articles().user_id));
                                p.setUser_name(jsonObject.getString(new Articles().user_name));
                                p.setEmail(jsonObject.getString(new Articles().email));
                                p.setCat_id(jsonObject.getString(new Articles().cat_id));
                                p.setCat_name(jsonObject.getString(new Articles().cat_name));
                                DATAS.add(p);

                            }

                            DATAS_CACHED.writeCache(DATAS);

                            if (DATAS.size()<1){
                                Toast.makeText(context, "Empy", Toast.LENGTH_SHORT).show();
                                error404.setVisibility(View.VISIBLE);
                            }else{
                                adapter = new Adaptor_recherche_list(context, DATAS);
                                articles_list.setAdapter(adapter);
                                error404.setVisibility(View.GONE);
                            }
                            progress_data.setVisibility(View.GONE);

                        } catch (Exception e) {
                            //Log.e("PRODUCT_DATAS--XX ",e.getMessage());
                            //error404.setVisibility(View.VISIBLE);
                            LoadCache();
                        }
                    }

                    @Override
                    public void onError(ANError anError) {
                        progress_data.setVisibility(View.GONE);
                        //Log.e("PRODUCT_DATAS ",anError.getMessage());
                        //error404.setVisibility(View.VISIBLE);
                        LoadCache();
                    }
                });
    }

    private void Loadprod(){
        LoadCache();
        progress_data.setVisibility(View.VISIBLE);
        error404.setVisibility(View.GONE);
        DATAS.clear();
        AndroidNetworking
                .get(Config.GET_PRODUCTS)
                .setPriority(Priority.LOW)
                .build()
                .getAsJSONObject(new JSONObjectRequestListener() {
                    @Override
                    public void onResponse(JSONObject response) {
                        try {
                            JSONArray ar = response.getJSONArray("products");
                            //Log.e("PRODUCT_DATAS RR ", ar.toString());

                            for (int i = 0; i < ar.length(); i++) {
                                JSONObject jsonObject = ar.getJSONObject(i);
                                Articles p = new Articles();
                                p.setId(jsonObject.getString(new Articles().id));
                                p.setName(jsonObject.getString(new Articles().name));
                                p.setSlug(jsonObject.getString(new Articles().slug));
                                p.setImages(jsonObject.getString(new Articles().images));
                                p.setDescription(jsonObject.getString(new Articles().description));
                                p.setPrice(jsonObject.getString(new Articles().price));
                                p.setStock(jsonObject.getString(new Articles().stock));
                                p.setAvailability(jsonObject.getString(new Articles().availability));
                                DATAS.add(p);
                            }
                            DATAS_CACHED.writeCache(DATAS);
                            if (DATAS.size()<1){
                                Toast.makeText(context, "Empy", Toast.LENGTH_SHORT).show();
                                //error404.setVisibility(View.VISIBLE);
                            }else{
                                adapter = new Adaptor_recherche_list(context, DATAS);
                                articles_list.setAdapter(adapter);
                                //error404.setVisibility(View.GONE);
                            }
                            progress_data.setVisibility(View.GONE);

                        } catch (Exception e) {
                            //Log.e("PRODUCT_DATAS--XX ",e.getMessage());
                            //error404.setVisibility(View.VISIBLE);
                        }
                    }

                    @Override
                    public void onError(ANError anError) {
                        progress_data.setVisibility(View.GONE);
                        //Log.e("PRODUCT_DATAS ",anError.getMessage());
                        error404.setVisibility(View.VISIBLE);
                    }
                });
    }

    private void LoadCache(){
        progress_data.setVisibility(View.VISIBLE);
        try {
            if (DATAS_CACHED.getSize()<1){
                Toast.makeText(context, "Empy", Toast.LENGTH_SHORT).show();
                error404.setVisibility(View.VISIBLE);
            }else{
                adapter = new Adaptor_recherche_list(context, DATAS_CACHED.readCache());
                articles_list.setAdapter(adapter);
                error404.setVisibility(View.GONE);
            }
            progress_data.setVisibility(View.GONE);
            ////Log.e("CACHED_DATA", String.valueOf(DATAS_CACHED.readCache().size()));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


}
<file_sep>/app/src/main/java/cd/digitalEdge/vst/Adaptors/Adaptor_Client_list.java
package cd.digitalEdge.vst.Adaptors;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.PopupMenu;
import android.widget.TextView;
import android.widget.Toast;

import java.util.ArrayList;
import java.util.Random;

import cd.digitalEdge.vst.Objects.Categories;
import cd.digitalEdge.vst.R;

public class Adaptor_Client_list extends BaseAdapter {

    Context context;
    ArrayList<Categories> DATAS;

    public Adaptor_Client_list(Context context, ArrayList<Categories> DATAS) {
        this.context = context;
        this.DATAS = DATAS;
    }

    public int getCount() {
        return DATAS.size();
    }

    public Object getItem(int position) {
        return DATAS.get(position);
    }

    public long getItemId(int position) {
        return 0;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        View convertView2 = LayoutInflater.from(this.context).inflate(R.layout.model_panier_item, null);
        TextView index_letter = convertView2.findViewById(R.id.index_letter);
        TextView client_name  = convertView2.findViewById(R.id.client_name);
        TextView detail  = convertView2.findViewById(R.id.detail);
        ImageView option  = convertView2.findViewById(R.id.option);

        Categories data = DATAS.get(position);

        client_name.setText(data.getName());
        //detail.setText(data.getAddress()+"\n"+ data.getPhone());

        index_letter.setText(data.getName().substring(0,1));
        int r = new Random().nextInt(4);
        if (r == 1) index_letter.setBackgroundResource(R.drawable.oval_blue);
        if (r == 2) index_letter.setBackgroundResource(R.drawable.oval_red);
        if (r == 3) index_letter.setBackgroundResource(R.drawable.oval_green);
        if (r == 4) index_letter.setBackgroundResource(R.drawable.oval_gris);

        option.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                PopupMenu popupMenu = new PopupMenu(context, v);
                popupMenu.getMenu().add("Visualiser").setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
                    @Override
                    public boolean onMenuItemClick(MenuItem item) {
                        Toast.makeText(context, "Cliecked", Toast.LENGTH_SHORT).show();
                        return false;
                    }
                });
                popupMenu.getMenu().add("Demande edition").setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
                    @Override
                    public boolean onMenuItemClick(MenuItem item) {
                        Toast.makeText(context, "Cliecked", Toast.LENGTH_SHORT).show();
                        return false;
                    }
                });

                popupMenu.show();
            }
        });

        return convertView2;
    }
}
<file_sep>/app/src/main/java/cd/digitalEdge/vst/Adaptors/Adaptor_Panier.java
package cd.digitalEdge.vst.Adaptors;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.NumberPicker;
import android.widget.PopupMenu;
import android.widget.TextView;
import android.widget.Toast;

import androidx.cardview.widget.CardView;

import com.google.android.material.floatingactionbutton.FloatingActionButton;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

import cd.digitalEdge.vst.Controllers.Config_preferences;
import cd.digitalEdge.vst.Controllers.Offline.ExecuteUpdate;
import cd.digitalEdge.vst.Controllers.Offline.SQLite.Sqlite_selects_methods;
import cd.digitalEdge.vst.Objects.Articles;
import cd.digitalEdge.vst.Objects.Categories;
import cd.digitalEdge.vst.Objects.Products;
import cd.digitalEdge.vst.R;
import cd.digitalEdge.vst.Tools.Constants;
import cd.digitalEdge.vst.Tools.Utils;
import cd.digitalEdge.vst.Views.Lists.Details_Article;
import cd.digitalEdge.vst.Views.Lists.Panier;

public class Adaptor_Panier extends BaseAdapter {

    Context context;
    ArrayList<Articles> PANIER;

    public Adaptor_Panier(Context context, ArrayList<Articles> PANIER) {
        this.context = context;
        this.PANIER = PANIER;
    }

    public void refreshEvents(ArrayList<Articles> events, Articles data) {
        ArrayList<Articles> PANIER = new ArrayList<>();
        PANIER = Sqlite_selects_methods.getall_Articles(context);
        if ( null == PANIER || PANIER.isEmpty() ){
            PANIER = new ArrayList<>();
            //Log.e("DATA", "DATAS "+PANIER.size());
        }
        this.PANIER = PANIER;
        notifyDataSetChanged();
    }

    public int getCount() {
        return PANIER.size();
    }

    public Object getItem(int position) {
        return PANIER.get(position);
    }

    public long getItemId(int position) {
        return 0;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        View convertView2 = LayoutInflater.from(this.context).inflate(R.layout.model_panier_item, null);

        ImageView option = convertView2.findViewById(R.id.option);
        CardView card = convertView2.findViewById(R.id.card);
        TextView name = convertView2.findViewById(R.id.name);
        TextView descripion = convertView2.findViewById(R.id.descripion);
        TextView price = convertView2.findViewById(R.id.price);
        TextView PT = convertView2.findViewById(R.id.PT);
        TextView pay_now = convertView2.findViewById(R.id.pay_now);
        ImageView delete_panier = convertView2.findViewById(R.id.delete_panier);
        NumberPicker qnt_picker = convertView2.findViewById(R.id.qnt_picker);

        Articles data = PANIER.get(position);

        name.setText(data.getName());
        float tot = Float.parseFloat(data.getPrice()) * Float.parseFloat(data.getQnt());

        PT.setText(
                tot + " USD"
        );
        descripion.setText(data.getSlug());
        pay_now.setText(data.getQnt());
        price.setText(data.getPrice().concat(" USD"));
        qnt_picker.setMaxValue(5);
        qnt_picker.setMinValue(1);
        qnt_picker.setDisplayedValues(Utils.QNT_PICKER());

        card.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i  = new Intent(context, Details_Article.class);
                i.putExtra("Article", data);
                i.putExtra("source", "Panier");
                context.startActivity(i);
            }
        });
        delete_panier.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (ExecuteUpdate.delete(context, Constants.ARTICLE,new Articles().id, data.getId()) == 1){
                    Toast.makeText(context, "Article deleted", Toast.LENGTH_SHORT).show();
                    refreshEvents(PANIER, data);
                }
            }
        });
        pay_now.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                View view = LayoutInflater.from(context).inflate(R.layout.view_number_picker, null);

                NumberPicker qnt_picker = view.findViewById(R.id.qnt_picker);

                qnt_picker.setMaxValue(5);
                qnt_picker.setMinValue(1);
                qnt_picker.setDisplayedValues(Utils.QNT_PICKER());

                new AlertDialog.Builder(context)
                        .setView(view)
                        .setPositiveButton("D'accord", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                if (
                                        ExecuteUpdate.update(
                                                context, Constants.ARTICLE,new Articles().qnt, String.valueOf(qnt_picker.getValue() -1),
                                                new Articles().id, data.getId()
                                        ) == 1
                                ){
                                    pay_now.setText(String.valueOf(qnt_picker.getValue() -1));
                                    Toast.makeText(context, "updated qnt", Toast.LENGTH_SHORT).show();
                                    refreshEvents(PANIER, data);
                                }
                                dialog.dismiss();
                            }
                        })
                        .setNegativeButton("Annuler", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                dialog.dismiss();
                            }
                        }).show();
            }
        });

        option.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                PopupMenu popupMenu = new PopupMenu(context, v);
                popupMenu.getMenu().add("Acheter maintenant").setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
                    @Override
                    public boolean onMenuItemClick(MenuItem item) {
                        Toast.makeText(context, "test", Toast.LENGTH_SHORT).show();
                        return true;
                    }
                });
                popupMenu.getMenu().add("Retirer du panier").setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
                    @Override
                    public boolean onMenuItemClick(MenuItem item) {
                        Toast.makeText(context, "test", Toast.LENGTH_SHORT).show();
                        return true;
                    }
                });
                popupMenu.show();
            }
        });
        return convertView2;
    }
}
<file_sep>/app/src/main/java/cd/digitalEdge/vst/Adaptors/Adaptor_commands_list.java
package cd.digitalEdge.vst.Adaptors;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import cd.digitalEdge.vst.R;

public class Adaptor_commands_list extends BaseAdapter {

    Context context;

    public Adaptor_commands_list(Context context) {
        this.context = context;
    }

    public int getCount() {
        return 20;
    }

    public Object getItem(int position) {
        return null;
    }

    public long getItemId(int position) {
        return 0;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        View convertView2 = LayoutInflater.from(this.context).inflate(R.layout.model_command_list, null);
        //CardView CARD = convertView2.findViewById(R.id.CARD);
        return convertView2;
    }

}
