<file_sep>package ir.droidhub.mobilebazz.adpter;

import android.widget.Filter;

import ir.droidhub.mobilebazz.sql.obj.MyObj;

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

/**
 * Created by MI3 on 4/29/2016.
 */

class DogsFilter extends Filter {

    private AutoCompleteDogsAdapter adapter;
    private List<MyObj> originalList;
    private List<MyObj> filteredList;

    DogsFilter(AutoCompleteDogsAdapter adapter, List<MyObj> originalList) {
        super();
        this.adapter = adapter;
        this.originalList = originalList;
        this.filteredList = new ArrayList<>();
    }

    @Override
    protected FilterResults performFiltering(CharSequence constraint) {
        filteredList.clear();
        final FilterResults results = new Filter.FilterResults();

        if (constraint == null || constraint.length() == 0) {
            filteredList.addAll(originalList);
        } else {
            final String filterPattern = constraint.toString().toLowerCase().trim();

            // Your filtering logic goes in here
            for (final MyObj myObj : originalList) {
//                if (MyObj.title.toLowerCase().contains(filterPattern)) {
                    filteredList.add(myObj);
//                }
            }
        }
        results.values = filteredList;
        results.count = filteredList.size();
        return results;
    }

    @Override
    protected void publishResults(CharSequence constraint, FilterResults results) {
        adapter.filteredDogs.clear();
        adapter.filteredDogs.addAll((List<MyObj>) results.values);
        adapter.notifyDataSetChanged();
    }
}<file_sep>package ir.droidhub.mobilebazz.cntdb;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class SqlBaseCnt {

    public static String DB_PATH;
    public static String DB_NAME = "content.db";


    //Table h_post
    public static final String TBL_NAME_H_POST = "h_post";

    public static final String TBL_H_POST_POST_ID = "post_id";
    public static final String TBL_H_POST_POST_AUTHOR = "post_author";
    public static final String TBL_H_POST_POST_DATE = "post_date";
    public static final String TBL_H_POST_POST_CONTENT = "post_content";
    public static final String TBL_H_POST_POST_TITLE = "post_title";
    public static final String TBL_H_POST_COMMENT_COUNT = "comment_count";
    public static final String TBL_H_POST_COMMENT_STATUS = "comment_status";
    public static final String TBL_H_POST_POST_PIC = "post_pic";


    //Table h_post_cat
    public static final String TBL_NAME_H_POST_CAT = "h_post_cat";

    public static final String TBL_H_POST_CAT_POST_ID = "post_id";
    public static final String TBL_H_POST_CAT_TERM_TAXONOMY_ID = "term_taxonomy_id";


    //Table h_comment
    public static final String TBL_NAME_H_COMMENT = "h_comment";

    public static final String TBL_H_COMMENT_POST_ID = "comment_id";
    public static final String TBL_H_COMMENT_COMMENT_POST_ID = "comment_post_id";
    public static final String TBL_H_COMMENT_COMMENT_AUTHOR = "comment_author";
    public static final String TBL_H_COMMENT_COMMENT_DATE = "comment_date";
    public static final String TBL_H_COMMENT_COMMENT_CONTENT = "comment_content";
    public static final String TBL_H_COMMENT_COMMENT_PARENT = "comment_parent";


    //Table h_cats
    public static final String TBL_NAME_H_CATS = "h_cats";

    public static final String TBL_H_CATS_TERM_TAXONOMY_ID = "term_id";
    public static final String TBL_H_CATS_NAME = "name";
    public static final String TBL_H_CATS_PARENT = "parent";
    public static final String TBL_H_CATS_COUNT = "count";
    public static final String TBL_H_CATS_DESCRIPTION = "description";

    //Table h_appost
    public static final String TBL_NAME_H_APPOST = "h_appost";

    public static final String TBL_H_APPOST_POST_ID = "post_id";
    public static final String TBL_H_APPOST_POST_AUTHOR = "post_author";
    public static final String TBL_H_APPOST_POST_DATE = "post_date";
    public static final String TBL_H_APPOST_POST_CONTENT = "post_content";
    public static final String TBL_H_APPOST_POST_TITLE = "post_title";
    public static final String TBL_H_APPOST_COMMENT_COUNT = "comment_count";
    public static final String TBL_H_APPOST_COMMENT_STATUS = "comment_status";
    public static final String TBL_H_APPOST_POST_PIC = "post_pic";
    public static final String TBL_H_APPOST_POST_ORDER= "post_order";
    public static final String TBL_H_APPOST_POST_MENU= "menu";

    Context mycontext;

    public SqlBaseCnt(Context context) {
        mycontext = context;
    }

    public void createDataBase() throws IOException {
        boolean dbExist = checkDataBase();

        if (dbExist) {
            // do nothing - database already exist
        } else {
            // By calling this method and empty database will be created into
            // the default system path
            // of your application so we are gonna be able to overwrite that
            // database with our database.
            try {
                copyDataBase();
            } catch (IOException e) {
                throw new Error("Error copying database");
            }
        }
    }

    // ////////////////////////////////////////////////////////////////////////////////////////////////
    public boolean checkDataBase() {
        SQLiteDatabase checkDB = null;
        try {
            DB_PATH = "/data/data/" + mycontext.getApplicationContext().getPackageName() + "/";
//            Log.i("Place", "Path:" + DB_PATH);
            String myPath = DB_PATH  + DB_NAME;
            checkDB = SQLiteDatabase.openDatabase(myPath, null,SQLiteDatabase.OPEN_READWRITE);
        } catch (SQLiteException e) {
            // database does't exist yet.
        }
        if (checkDB != null) {
            checkDB.close();
        }
        return checkDB != null ? true : false;
    }

    // ////////////////////////////////////////////////////////////////////////////////////////////////
    private void copyDataBase() throws IOException {
        // Open your local db as the input stream

        InputStream myInput = mycontext.getAssets().open(DB_NAME);
        // Path to the just created empty db

        String outFileName = DB_PATH + DB_NAME;
        // Open the empty db as the output stream

        OutputStream myOutput = new FileOutputStream(outFileName);
        // transfer bytes from the inputfile to the outputfile

        byte[] buffer = new byte[1024];
        int length;
        while ((length = myInput.read(buffer)) > 0) {
            myOutput.write(buffer, 0, length);
        }
        // Close the streams
        myOutput.flush();
        myOutput.close();
        myInput.close();
//        Log.i("Place", "Copy Succ!!!");

    }
}
<file_sep>package ir.droidhub.mobilebazz.pref;

import java.util.HashSet;
import java.util.Set;

import android.content.Context;

public class Pref {
	
    private static final String PREF="pref";


    public static final String PREFS_SEARCH_HISTORY = "SearchHistory";
	
	Context context;
	public Pref(Context context) {
		// TODO Auto-generated constructor stub
		this.context = context;
	}
	
	
	public static Set<String> GetLastSearch(Context context){
        return  context.getSharedPreferences(PREF,Context.MODE_PRIVATE)
                .getStringSet(PREFS_SEARCH_HISTORY, new HashSet<String>());

    }

    public static void SetLastSearch(Set<String> value,Context context){
        context.getSharedPreferences(PREF,Context.MODE_PRIVATE)
                .edit().putStringSet(PREFS_SEARCH_HISTORY,value).apply();

    }


    public static boolean getIsSetPermission(Context context){
        return  context.getSharedPreferences(PREF,Context.MODE_PRIVATE)
                .getBoolean(PREFS_SEARCH_HISTORY, false);

    }

    public static void setIsSetPermission(boolean value,Context context){
        context.getSharedPreferences(PREF,Context.MODE_PRIVATE)
                .edit().putBoolean(PREFS_SEARCH_HISTORY,value).apply();

    }

    
    }
<file_sep>package ir.droidhub.mobilebazz;


import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.design.widget.TextInputLayout;
import android.support.v4.view.ViewPager;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;


import ir.droidhub.mobilebazz.api.LinkMaker;
import ir.droidhub.mobilebazz.api.Parse;
import ir.droidhub.mobilebazz.adpter.AdpComment;
import ir.droidhub.mobilebazz.adpter.AdpFragmentPager;
import ir.droidhub.mobilebazz.adpter.FragmentCreator;
import ir.droidhub.mobilebazz.api.GetSetting;
import ir.droidhub.mobilebazz.api.HTMLBuilder;
import ir.droidhub.mobilebazz.api.Net;
import ir.droidhub.mobilebazz.api.view.ExtensiblePageIndicator;
import ir.droidhub.mobilebazz.api.view.HamiWebView;
import ir.droidhub.mobilebazz.api.web.AsyncDataNet;
import ir.droidhub.mobilebazz.cntdb.ObjAppPost;
import ir.droidhub.mobilebazz.cntdb.ObjComment;
import ir.droidhub.mobilebazz.cntdb.ObjPost;
import ir.droidhub.mobilebazz.cntdb.SqlBaseCnt;
import ir.droidhub.mobilebazz.cntdb.SqlSourceCnt;

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

public class v extends AppCompatActivity {


    private HamiWebView webView;
    private TextView Title, PostTitle;
    private GetSetting getSetting;


    //ActionBar
    private LinearLayout headerPost, mainLayout;
    private Toolbar toolbar;
    private Context context;
    private Typeface FontApp, Iconfont;
    private ActionBar actionBar;

    private String typePost;


    private ObjPost post, nPost, NotifPost;
    private ObjAppPost appPost;


    private ViewPager pager;
    private AdpFragmentPager adpPager;
    private ExtensiblePageIndicator ViewPagerIndicator;

    private List<String> images;

    private int CommentChecker;




    private static int NEWCOMMENT = 0; // if send new comment: parent is zero(0)
    private static int COMMENT_COUNT = 100;
    private static final String CommentStatusKey = "open";

    //Main
    ListView commentList;
    TextView PostCat, PostDate, PostAuthor, SendNewComment, CommentTitle;
    AdpComment adpComment;
    LinearLayout LayoutTitleCommentList;
    DrawerLayout drawerLayout;
    List<ObjComment> lstComment = new ArrayList<>();
    private String myTitle;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        setContentView(R.layout.act_view);


        if (getIntent() != null && (getIntent().getFlags() &  // Releated to Open post from notification
                Intent.FLAG_ACTIVITY_REORDER_TO_FRONT) != 0) {
            finish();
            return;
        }


        context = v.this;
        getSetting = new GetSetting(context);


        FontApp = getSetting.getFontApp();
        Iconfont = Typeface.createFromAsset(getAssets(), "font/fontawesome-webfont.ttf");


        int postID = getIntent().getExtras().getInt("id"); //get Selected Post Id//
        typePost = getIntent().getExtras().getString("parentList"); //get parent//
        int CommentCount = getIntent().getExtras().getInt("commentCount"); //get commentCount//


        Findview();
        ActionBar();



        adpComment = new AdpComment(context, R.layout.list_comment, lstComment);
        commentList.setAdapter(adpComment);


        if (typePost.equals("mainPost"))
            showPost(postID, CommentCount);
        else if (typePost.equals("appPost"))
            showAppost(postID, CommentCount);
        else if (typePost.equals("notification"))
            gNotifPost(postID);


        myTitle = PostTitle.getText().toString();


        Listener(postID);

    }


    private void Listener(final int postId) {

        SendNewComment.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                if (Net.Is(context))
                    NewComment(postId);
                else
                    OfflineSnackBar();

            }
        });



    }

    private int headerGallery(String url_content) {

        images = HTMLBuilder.GetGallery(url_content);  //get image tag


        adpPager = new AdpFragmentPager(getSupportFragmentManager());


        FragmentCreator fmc = new FragmentCreator();


        for (int i = 0; i < images.size(); i++)
            adpPager.addFragment(fmc.newInstance(android.R.color.transparent,
                    images.get(i), images, PostTitle.getText().toString()) );



        pager.setAdapter(adpPager);
        ViewPagerIndicator.initViewPager(pager);

        if (images.size() < 2)
            ViewPagerIndicator.setVisibility(View.GONE);

        if (images.size() == 0)
            pager.setVisibility(View.GONE);


        return images.size();

    }


    private void showNotifPost() {


        if (nPost == null)
            return;

        CheckComment(nPost.getPost_id(), nPost.getComment_count() , nPost.getComment_status());


        PostCat.setText(getResources().getString(R.string.category) + getCategory(nPost.getPost_id()));
        PostTitle.setText(nPost.getPost_title());
        PostDate.setText(getSetting.date(nPost.getPost_date()));
        PostAuthor.setText(getResources().getString(R.string.author) +
                nPost.getPost_author());


        int img = headerGallery(nPost.getPost_content());


        PostTitle.setText(nPost.getPost_title());



        String str = HTMLBuilder.getHtmlForShow(nPost, img);
        WebSettings settings = webView.getSettings();
        settings.setJavaScriptEnabled(true);
        settings.setDomStorageEnabled(true);
        settings.setDefaultTextEncodingName("utf-8");
        webView.setHorizontalScrollBarEnabled(false);
        webView.setVerticalScrollBarEnabled(false);
        webView.setWebViewClient(new MyWebViewClient());
        webView.loadDataWithBaseURL("", str, "text/html", "utf-8", "");
    }


    private void showPost(int PostId, int commentCount) {

        post = gPost(PostId);


        if (post == null)
            return;

        CheckComment(PostId, commentCount, post.getComment_status());


        PostCat.setText(getResources().getString(R.string.category) + " : " + getCategory(PostId));
        PostTitle.setText(post.getPost_title());
        PostDate.setText(getSetting.date(post.getPost_date()));
        PostAuthor.setText(getResources().getString(R.string.author) + post.getPost_author());


        int img = headerGallery(post.getPost_content());


        PostTitle.setText(post.getPost_title());

        String str = HTMLBuilder.getHtmlForShow(post, img);


        WebSettings settings = webView.getSettings();
        settings.setJavaScriptEnabled(true);
        settings.setDomStorageEnabled(true);
        settings.setDefaultTextEncodingName("utf-8");
        webView.setHorizontalScrollBarEnabled(false);
        webView.setVerticalScrollBarEnabled(false);


        webView.setWebViewClient(new MyWebViewClient());
        webView.loadDataWithBaseURL("", str, "text/html", "utf-8", "");


    }


    private ObjPost gPost(int PostId) {

        List<ObjPost> Post;

        SqlSourceCnt db = new SqlSourceCnt(context);
        db.open();
        Post = db.GetPost(SqlBaseCnt.TBL_H_POST_CAT_POST_ID + "=" + PostId);
        db.close();

        if (Post.size() > 0)
            return Post.get(0);
        else return null;
    }


    private void showAppost(int PostId, int commentCount) {

        appPost = gAppPost(PostId);


        if (appPost == null)
            return;

        CheckComment(PostId, commentCount, appPost.getComment_status());


        PostCat.setText(getResources().getString(R.string.category) + getCategory(PostId));
        PostTitle.setText(appPost.getPost_title());
        PostDate.setText(getSetting.date(appPost.getPost_date()));
        PostAuthor.setText(getResources().getString(R.string.author) +
                appPost.getPost_author());


        int img = headerGallery(appPost.getPost_content());


        PostTitle.setText(appPost.getPost_title());

        String str = HTMLBuilder.getHtmlForShow(appPost, img);

        WebSettings settings = webView.getSettings();
        settings.setJavaScriptEnabled(true);
        settings.setDomStorageEnabled(true);
        settings.setDefaultTextEncodingName("utf-8");
        webView.setHorizontalScrollBarEnabled(false);
        webView.setVerticalScrollBarEnabled(false);
        webView.setWebViewClient(new MyWebViewClient());

        webView.loadDataWithBaseURL("", str, "text/html", "utf-8", "");


    }

    private ObjAppPost gAppPost(int PostId) {

        List<ObjAppPost> appPost;

        SqlSourceCnt db = new SqlSourceCnt(context);
        db.open();
        appPost = db.GetAppPost(SqlBaseCnt.TBL_H_APPOST_POST_ID + "='" + PostId + "'");
        db.close();

        if (appPost.size() > 0)
            return appPost.get(0);
        else
            return null;
    }

    private class MyWebViewClient extends WebViewClient {



        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {

            if (url.indexOf(".png") > 0 || url.indexOf(".jpg") > 0) {


                Intent gallery_intent = new Intent(context, g.class);
                gallery_intent.putStringArrayListExtra("images", (ArrayList<String>) images);
                startActivity(gallery_intent);

                return true;
            }


            if (Net.Is(context)) {

                Intent browser = new Intent(context, b.class);
                browser.putExtra("post_url", url);
                startActivity(browser);
                return true;
            } else OfflineSnackBar();


            return true;

        }

        @Override
        public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
        }

        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            super.onPageStarted(view, url, favicon);
        }


        @Override
        public void onLoadResource(WebView view, String url) {
            super.onLoadResource(view, url);
        }


    }

    @SuppressLint("NewApi")
    public void ActionBar() {

        actionBar = getSupportActionBar();
        actionBar.setDisplayShowHomeEnabled(false);
        actionBar.setDisplayShowCustomEnabled(true);
        actionBar.setDisplayShowTitleEnabled(false);

        View v = getLayoutInflater().inflate(R.layout.actionbar_actview, null);

        actionBar.setCustomView(v);

        toolbar = (Toolbar) v.getParent();
        toolbar.setContentInsetsAbsolute(0, 0);

        Title = (TextView) v.findViewById(R.id.textView_title_actionbar_actview);
        Title.setText(getSetting.getActionBarTitle());//Set Text Of Title
        Title.setTypeface(FontApp);
        Title.setTextSize(15);
        //Set Color of Title Action Bar
        Title.setTextColor(Color.parseColor(getSetting.getActionBarTextColor()));


        //Set Color of Action Bar/////
        v.setBackgroundColor(Color.parseColor(getSetting.getActionBarColorBackground()));
        actionBar.setBackgroundDrawable(new
                ColorDrawable(Color.parseColor(getSetting.getActionBarColorBackground())));
        //Set Color of Action Bar/////


    }


    private void Findview() {


        commentList = (ListView) findViewById(R.id.listView_comment);


        // Adding Layout for Header of Listview
        LayoutInflater inflater = getLayoutInflater();
        ViewGroup header = (ViewGroup) inflater.inflate(R.layout.act_view_header, commentList, false);
        commentList.addHeaderView(header, null, true);


        pager = (ViewPager) header.findViewById(R.id.view_pager_actview);
        ViewPagerIndicator = (ExtensiblePageIndicator) header.findViewById(R.id.flexibleIndicator);

        webView = (HamiWebView) header.findViewById(R.id.webView_post_content);
        PostTitle = (TextView) header.findViewById(R.id.textview_post_title);

        PostTitle.setTextColor(Color.parseColor(getSetting.getHeaderTextColor()));
        headerPost = (LinearLayout) header.findViewById(R.id.linearLayout_post_header);
        headerPost.setBackgroundColor(Color.parseColor(getSetting.getHeaderBackground()));
        mainLayout = (LinearLayout) header.findViewById(R.id.linearlayout_actView);

        PostDate = (TextView) header.findViewById(R.id.textView_post_date);
        PostCat = (TextView) header.findViewById(R.id.textView_post_cat);
        PostAuthor = (TextView) header.findViewById(R.id.textView_post_author);

        CommentTitle = (TextView) header.findViewById(R.id.textview_listcomment_title);
        SendNewComment = (TextView) header.findViewById(R.id.textView_listcomment_titleSendNewComment);
        LayoutTitleCommentList = (LinearLayout) findViewById(R.id.LinearLayout_listcomment_newComment);
        drawerLayout = (DrawerLayout) findViewById(R.id.actView_drawer_layout_post);

        PostCat.setTypeface(FontApp);
        PostTitle.setTypeface(FontApp);
        PostDate.setTypeface(FontApp);
        PostAuthor.setTypeface(FontApp);
        CommentTitle.setTypeface(FontApp);
        SendNewComment.setTypeface(FontApp);

        // Reading & replacing data from database(AppSetting)
        drawerLayout.setBackgroundColor(Color.parseColor(getSetting.getMainColorBackground()));
        PostTitle.setTextColor(Color.parseColor(getSetting.getHeaderTextColor()));
        headerPost = (LinearLayout) header.findViewById(R.id.linearLayout_post_header);
        headerPost.setBackgroundColor(Color.parseColor(getSetting.getHeaderBackground()));
        LayoutTitleCommentList.setBackgroundColor(Color.parseColor(getSetting.getHeaderBackground()));
        SendNewComment.setTextColor(Color.parseColor(getSetting.getHeaderTextColor()));
        CommentTitle.setTextColor(Color.parseColor(getSetting.getHeaderTextColor()));
        commentList.setBackgroundColor(Color.TRANSPARENT);


        SendNewComment.setText(getResources().getString(R.string.sendNewComment));
        CommentTitle.setText(getResources().getString(R.string.comments));

    }


    @Override
    protected void onDestroy() {
        webView.destroy();
        super.onDestroy();
    }

    private ObjPost gNotifPost(final int postId) {

        AsyncDataNet AsyncPost = new AsyncDataNet(context, LinkMaker.getNotifPost(postId));

        AsyncPost.setonDone(new AsyncDataNet.onComplete() {
            @Override
            public void onDone(String result, int token) {

                try {
                    nPost = Parse.getNotifPost(result);

                    showNotifPost();

                } catch (Exception e) {
                    e.printStackTrace();
                }
            }


            @Override
            public void onError(Exception e, int token) {

                OfflineSnackBar();

            }
        });
        AsyncPost.execute();

        return NotifPost;
    }


    private void OfflineSnackBar() {


        Snackbar e_snackBar = Snackbar.make(findViewById(R.id.actView_drawer_layout_post),
                getResources().getString(R.string.offline_mode)
                , Snackbar.LENGTH_LONG);

        TextView tv = (TextView)
                (e_snackBar.getView()).findViewById(android.support.design.R.id.snackbar_text);

        tv.setTypeface(FontApp);


        e_snackBar.show();

    }

    private String getCategory(int PostId) {
        List<String> mycat;
        String category = "";

        SqlSourceCnt db = new SqlSourceCnt(context);
        db.open();
        mycat = db.GetCatName(PostId);
        db.close();

        if (mycat.size() == 0)
            PostCat.setVisibility(View.INVISIBLE);
        else
            for (int i = 0; i < mycat.size(); i++) {
                category += mycat.get(i);
                if (i < mycat.size() - 1)
                    category += ",";
            }
        return category;
    }


    private void NewComment(final int PostId) {


        final Dialog sendComment = new Dialog(context);
        sendComment.requestWindowFeature(Window.FEATURE_NO_TITLE);
        sendComment.setContentView(R.layout.dlg_comment);
        sendComment.setCancelable(false);
        final Button send = (Button) sendComment.findViewById(R.id.button_comment_send);
        final Button cancel = (Button) sendComment.findViewById(R.id.button_comment_cancel);

        final EditText name = (EditText) sendComment.findViewById(R.id.editText_comment_dialog_name);
        TextInputLayout lName = (TextInputLayout) sendComment.findViewById(R.id.input_layout_name);
        final EditText email = (EditText) sendComment.findViewById(R.id.editText_comment_dialog_email);
        TextInputLayout lImail = (TextInputLayout) sendComment.findViewById(R.id.input_layout_email);
        final EditText message = (EditText) sendComment.findViewById(R.id.editText_comment_dialog_commentContent);
        TextInputLayout lMessage = (TextInputLayout) sendComment.findViewById(R.id.input_layout_textLongMessage);
        final TextView title = (TextView) sendComment.findViewById(R.id.textView_dlg_title);


        title.setText(getResources().getString(R.string.sendNewComment));
        title.setTypeface(FontApp);

        send.setTypeface(FontApp);
        cancel.setTypeface(FontApp);

        name.setTypeface(FontApp);
        email.setTypeface(FontApp);
        message.setTypeface(FontApp);

        lName.setTypeface(FontApp);
        lImail.setTypeface(FontApp);
        lMessage.setTypeface(FontApp);


        cancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                sendComment.dismiss();
            }
        });

        send.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                String mName, mEmail, mMessage;
                mName = name.getText().toString();
                mEmail = email.getText().toString();
                mMessage = message.getText().toString();

                if (mName.length() < 3)
                    Toast.makeText(context, getResources().getString(R.string.incorrectName), Toast.LENGTH_SHORT).show();
                else if (!checkEmail(mEmail))
                    Toast.makeText(context, getResources().getString(R.string.incorrectEmail), Toast.LENGTH_SHORT).show();
                else if (mMessage.length() < 3)
                    Toast.makeText(context, getResources().getString(R.string.incorrectText), Toast.LENGTH_SHORT).show();
                else {

                    String url = LinkMaker.sendCommentLINK(PostId, mName, mEmail, "url", mMessage, NEWCOMMENT, 0, "", "");
                    AsyncDataNet AsyncSendComment = new AsyncDataNet(context, url);


                    AsyncSendComment.setonDone(new AsyncDataNet.onComplete() {
                        @Override
                        public void onDone(String result, int token) {
                            int mResult = 0;
                            try {
                                mResult = Parse.SendComment(result);
                            } catch (Exception e) {
                            }
                            if (mResult == 1)
                                Toast.makeText(context, getResources().getString(R.string.sendSuccessfully), Toast.LENGTH_SHORT).show();
                            else
                                Toast.makeText(context, getResources().getString(R.string.sendError), Toast.LENGTH_SHORT).show();
                        }

                        @Override
                        public void onError(Exception e, int token) {
                            sendComment.dismiss();
                            OfflineSnackBar();
                        }
                    });
                    AsyncSendComment.execute();
                    sendComment.dismiss();
                }
            }
        });

        sendComment.show();
    }

    private void CheckComment(int PostId, int CommentCount, String CommentStatus) {

        if (Net.Is(context) && CommentCount > 0 && (getSetting.getIsShowComment()))
            GetMyComment(PostId);



        if (!getSetting.getIsSetComment()) {

            SendNewComment.setVisibility(View.INVISIBLE);

            if (CommentCount > 0)
                LayoutTitleCommentList.setVisibility(View.VISIBLE);
            else
                LayoutTitleCommentList.setVisibility(View.INVISIBLE);
        } else {
            if (CommentStatus.toLowerCase().equals(CommentStatusKey.toLowerCase())) {
                // check comment status
                SendNewComment.setVisibility(View.VISIBLE);
                LayoutTitleCommentList.setVisibility(View.VISIBLE);

            } else {
                SendNewComment.setVisibility(View.INVISIBLE);

                if (CommentCount > 0)
                    LayoutTitleCommentList.setVisibility(View.VISIBLE);
                else
                    LayoutTitleCommentList.setVisibility(View.INVISIBLE);
            }

        }


    }


    public void GetMyComment(final int PostId) {

        int lastCount = lstComment.size();


        AsyncDataNet AsyncComment = new AsyncDataNet(context,
                LinkMaker.getCommentLINK(COMMENT_COUNT, lastCount, PostId));

        AsyncComment.setonDone(new AsyncDataNet.onComplete() {
            @Override
            public void onDone(String result, int token) {
                try {

                    lstComment.addAll(Parse.getCommentPost(result, PostId));

                    CommentChecker = Parse.getCommentPost(result, PostId).size();

                    SqlSourceCnt db = new SqlSourceCnt(context);
                    db.open();
                    db.UpdateComment(lstComment); // reforming data
                    db.close();
                    adpComment = new AdpComment(context, R.layout.list_comment, getCommentOfflin(PostId));
                    commentList.setAdapter(adpComment);

                } catch (Exception e) {
                    e.printStackTrace();
                }

            }

            @Override
            public void onError(Exception e, int token) {

                OfflineSnackBar();
            }
        });
        AsyncComment.execute();

    }


    private List<ObjComment> getCommentOfflin(int PostId) {
        List<ObjComment> lst = new ArrayList<>();
        SqlSourceCnt db = new SqlSourceCnt(context);
        db.open();
        lst.addAll(db.GetComment(SqlBaseCnt.TBL_H_COMMENT_COMMENT_POST_ID + "=" + PostId));
        db.close();

        return lst;
    }


    private boolean checkEmail(String email) {   // Email Verification
        int length = email.length();
        if (length < 4)
            return false;
        else
            for (int i = 0; i < length; i++) {
                if (String.valueOf(email.charAt(i)).equals("@")) {
                    return true;
                }
            }
        return false;
    }

}
<file_sep>package ir.droidhub.mobilebazz.api.web;

import android.content.ContentValues;


public class CData {

	//Properties
		int		id;
		String	url;
		String	local;
	
	//Statics
		public static final String[] COL={SqlBase.CD_ID, SqlBase.CD_URL, SqlBase.CD_LOCAL};
	public CData() {
		// TODO Auto-generated constructor stub
	}
	public CData(int id,String url,String local) {
		setId(id);
		setLocal(local);
		setUrl(url);
	}
		
	//Setters
		public void setId(int id) {
			this.id = id;
		}
		public void setLocal(String local) {
			this.local = local;
		}
		public void setUrl(String url) {
			this.url = url;
		}
	//Getters
		public int getId() {
			return id;
		}
		public String getLocal() {
			return local;
		}
		public String getUrl() {
			return url;
		}
		public ContentValues getCV(){
			ContentValues cv=new ContentValues();
			cv.put(SqlBase.CD_URL, getUrl());
			cv.put(SqlBase.CD_LOCAL, getLocal());
			return cv;
		}
}
<file_sep>package ir.droidhub.mobilebazz.adpter;

/**
 * Created by MI3 on 4/28/2016.
 */

import android.content.Context;
import android.graphics.Typeface;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import ir.droidhub.mobilebazz.api.GetFont;
import ir.droidhub.mobilebazz.R;
import ir.droidhub.mobilebazz.api.cash_pic.ImageLoader;
import ir.droidhub.mobilebazz.sql.obj.MyObj;

import java.util.List;


public class AdpBest extends RecyclerView.Adapter<AdpBest.viewholder> {

    private List<MyObj> lst;
    static Context context;
    private static Typeface fontApp;
    private ImageLoader imageLoader;


    public AdpBest(Context context, List<MyObj> lst){
        this.lst = lst;
        AdpBest.context = context;
        GetFont f = new GetFont(context);
        imageLoader=new ImageLoader(context);

    }


    static class viewholder extends RecyclerView.ViewHolder {


        TextView title;
        ImageView img;


        viewholder(View itemView) {
            super(itemView);
            title = (TextView) itemView.findViewById(R.id.list_best_title);
            img = (ImageView) itemView.findViewById(R.id.list_best_img);
            // Color Header Text

            title.setTypeface(fontApp);

        }
    }

    @Override
    public viewholder onCreateViewHolder(ViewGroup parent, int viewType) {
        View v = LayoutInflater.from(context).inflate(R.layout.list_best, parent, false);

        return new viewholder(v);

    }

    @Override
    public void onBindViewHolder(viewholder view, int position) {



        imageLoader.DisplayImageNoAnim(lst.get(position).getLst(), view.img);


        view.title.setText(lst.get(position).getTitle());



    }


    @Override
    public void onAttachedToRecyclerView(RecyclerView recyclerView) {
        super.onAttachedToRecyclerView(recyclerView);
    }

    @Override
    public int getItemCount() {
        return lst.size();
    }
}
<file_sep>package ir.droidhub.mobilebazz.adpter;

import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Filter;
import android.widget.ImageView;
import android.widget.TextView;

import ir.droidhub.mobilebazz.ActShow;
import ir.droidhub.mobilebazz.R;
import ir.droidhub.mobilebazz.api.cash_pic.ImageLoader;
import ir.droidhub.mobilebazz.sql.obj.MyObj;

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

/**
 * Created by MI3 on 4/29/2016.
 */

public class AutoCompleteDogsAdapter extends ArrayAdapter<MyObj> {

    private final List<MyObj> dogs;
    Context context;
    public List<MyObj> filteredDogs = new ArrayList<>();
    ImageLoader imageLoader;
    ViewHolder view;
    LayoutInflater inflater;




    public AutoCompleteDogsAdapter(Context context, List<MyObj> dogs) {
        super(context, 0, dogs);
        this.dogs = dogs;
        this.context = context;
        imageLoader=new ImageLoader(context);
        inflater = (LayoutInflater) context.getSystemService(context.LAYOUT_INFLATER_SERVICE);

    }

    @Override
    public int getCount() {
        return filteredDogs.size();
    }

    @Override
    public Filter getFilter() {
        return new DogsFilter(this, dogs);
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        // Get the data item from filtered list.
        if(convertView==null){

            convertView = inflater.inflate(R.layout.list_search_suggests,  parent, false);
            view = new ViewHolder();

//             MyObj dog = filteredDogs.get(position);

            view.tvName = (TextView) convertView.findViewById(R.id.search_title);
            view.ivIcon = (ImageView) convertView.findViewById(R.id.search_img);
            convertView.setTag(view);
        }
        else
            view = (ViewHolder) convertView.getTag();

        view.tvName.setText(dogs.get(position).getTitle());

        imageLoader.DisplayImageNoAnim(dogs.get(position).getLst(),view.ivIcon);

        convertView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {


                context.startActivity(new Intent(context , ActShow.class).putExtra("name" , dogs.get(position).getTitle()));
            }
        });


        return convertView;

    }

    static class ViewHolder {
        TextView tvName;
        ImageView ivIcon;
    }
}<file_sep>package ir.droidhub.mobilebazz.sql.obj;

public class Company3 {
	
	String ItemOne , Title , ItemTwo;

	public Company3( String ItemOne ,String Title ,String ItemTwo) {
		this.ItemOne = ItemOne;
		this.Title = Title;
		this.ItemTwo = ItemTwo;
	}


	public String GetItemName() {

		return this.ItemOne;
	}
	
	public String GetTitle() {

		return this.Title;
	}
	
	public String GetItemTwo() {

		return this.ItemTwo;
	}


}
<file_sep>package ir.droidhub.mobilebazz;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;

import ir.droidhub.mobilebazz.api.GetSetting;


public class b extends AppCompatActivity {


    private ProgressBar progressBar;
    private WebView browser;
    private Typeface FontApp, Iconfont;
    private Context context;
    private GetSetting getSetting;
    private TextView title, close;
    private LinearLayout actionBar;
    private SwipeRefreshLayout swipeLayout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

        setContentView(R.layout.act_browser);

        context = b.this;
        getSetting = new GetSetting(context);


        findView();


        browser.loadUrl(getIntent().getExtras().getString("post_url"));
        browser.setWebViewClient(new MyWebViewClient());

        listener();

    }

    private void listener() {

        browser.setWebChromeClient(new WebChromeClient() {

            @SuppressLint("NewApi")
            public void onProgressChanged(WebView view, int progress) {

                if (progress < 100 && progressBar.getVisibility() == ProgressBar.GONE) {
                    progressBar.setVisibility(ProgressBar.VISIBLE);
                    swipeLayout.setRefreshing(false);
                }

                progressBar.setProgress(progress);
                if (progress == 100) {
                    title.setText(view.getTitle());
                    progressBar.setVisibility(ProgressBar.GONE);
                    swipeLayout.setRefreshing(false);
                }
            }
        });


        close.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(context, v.class
                ).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));

            }
        });


        swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {
                swipeLayout.setRefreshing(true);
                browser.loadUrl(browser.getUrl());

            }
        });

    }

    private void findView() {

        FontApp = getSetting.getFontApp();
        Iconfont = Typeface.createFromAsset(getAssets(), "font/fontawesome-webfont.ttf");


        actionBar = (LinearLayout) findViewById(R.id.linearlayout_actBrowser);
        actionBar.setBackgroundColor(Color.parseColor(getSetting.getActionBarColorBackground()));
        progressBar = (ProgressBar) findViewById(R.id.progress_loader);
        browser = (WebView) findViewById(R.id.actWebview);
        WebSettings webSettings = browser.getSettings();
        webSettings.setJavaScriptEnabled(true);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            webSettings.setDisplayZoomControls(false);
        }

        webSettings.setBuiltInZoomControls(true);
        webSettings.setDomStorageEnabled(true);


        title = (TextView) findViewById(R.id.textview_Actbrowser_Title);
        title.setTypeface(FontApp);
        close = (TextView) findViewById(R.id.textview_Actbrowser_close);
        close.setTypeface(Iconfont);

        close.setText(R.string.fa_times);

        close.setTextColor(Color.parseColor(getSetting.getActionBarTextColor()));
        title.setTextColor(Color.parseColor(getSetting.getActionBarTextColor()));


        swipeLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_container);

        swipeLayout.setColorSchemeResources(
                android.R.color.holo_blue_dark,
                android.R.color.holo_green_dark,
                android.R.color.holo_orange_dark,
                android.R.color.holo_red_dark);


    }

    @Override
    protected void onDestroy() {
        browser.getSettings().setBuiltInZoomControls(true);
        browser.destroy();
        super.onDestroy();
    }

    @Override
    public void onBackPressed() {
        if (browser.canGoBack()) {
            browser.goBack();
        } else {
            super.onBackPressed();
        }
    }

    private class MyWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {

            view.loadUrl(url);
            return true;
        }


        @Override
        public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
        }

        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            super.onPageStarted(view, url, favicon);
        }
    }

}
<file_sep>package ir.droidhub.mobilebazz.sql.obj;

public class Company {
	
	String name;
	int picname;

	public Company( String name ,int picname) {
		this.name = name;
		this.picname = picname;
	}


	public String GetName() {

		return this.name;
	}
	
	public int GetPicName() {

		return this.picname;
	}


}
<file_sep>package ir.droidhub.mobilebazz;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.graphics.Typeface;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.RequiresApi;
import android.support.design.widget.Snackbar;
import android.support.v4.view.GravityCompat;
import android.support.v4.view.ScrollingView;
import android.support.v4.widget.DrawerLayout;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.CardView;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewTreeObserver;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AutoCompleteTextView;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;

import ir.droidhub.mobilebazz.adpter.AdpBest;
import ir.droidhub.mobilebazz.adpter.AutoCompleteDogsAdapter;
import ir.droidhub.mobilebazz.api.Exit;
import ir.droidhub.mobilebazz.api.GetFont;
import ir.droidhub.mobilebazz.api.RecyclerItemClickListener;
import ir.droidhub.mobilebazz.api.RubyService;
import ir.droidhub.mobilebazz.api.SearchArrowDrawable;
import ir.droidhub.mobilebazz.api.URLs;
import ir.droidhub.mobilebazz.api.s;
import ir.droidhub.mobilebazz.api.viewPager_autoScroll.CustomPagerAdp;
import ir.droidhub.mobilebazz.sql.Jsons;
import ir.droidhub.mobilebazz.sql.SQLbase;
import ir.droidhub.mobilebazz.sql.SQLsource;

import com.activeandroid.ActiveAndroid;
import com.activeandroid.query.Select;
import com.google.android.gms.analytics.HitBuilders;
import com.google.android.gms.analytics.Tracker;
import com.orangegangsters.github.swipyrefreshlayout.library.SwipyRefreshLayout;
import com.orangegangsters.github.swipyrefreshlayout.library.SwipyRefreshLayoutDirection;

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

import ir.droidhub.mobilebazz.adpter.AdpDrawerList;
import ir.droidhub.mobilebazz.api.GridSpacingItemDecoration;
import ir.droidhub.mobilebazz.api.viewPager_autoScroll.AutoScrollViewPager;
import ir.droidhub.mobilebazz.sql.obj.MyObj;
import ir.droidhub.mobilebazz.sql.obj.ObjDrawer;
import ir.droidhub.mobilebazz.sql.obj.ObjMobile;
import ir.droidhub.mobilebazz.sql.obj.ObjSoc;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

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


public class ActMain extends Activity implements DrawerLayout.DrawerListener {
    public static final String BASELINK_PHONES = "http://droidhub.ir/phones/";
    public static final String BASELINK_COMPANY = "http://droidhub.ir/company/";
    private static final String TAG = "MOBILEBAZZ";
    private static boolean Loading = true;
    private static int sizeChecker = 10;
    private static int COUNT_POST = 40;
    private static int pageCount = 0;
    private int count_scroller;


    //    private RelativeLayout blog_layout;
//    private List<ObjPost> listBlog = new ArrayList<>();
//    private List<ObjPost> listBlog_tmp = new ArrayList<>();
    private Snackbar snackBar;
    Context context;
    RecyclerView soc, mobile;
    LinearLayoutManager layout_mobile, layout_soc;
    private DrawerLayout mDrawerLayout;


    List<MyObj> mList = new ArrayList<>();
    List<MyObj> cList = new ArrayList<>();

    List<ObjDrawer> lst_drawer = new ArrayList<ObjDrawer>();


    AutoScrollViewPager Slider;
    CustomPagerAdp sliderAdp;

    TextView mobile_best, mobile_cat, cpu_best, cpu_cat;
    List<ObjMobile> mobile_suggests = new ArrayList<>();
    List<ObjSoc> cpu_suggests = new ArrayList<>();
    List<MyObj> suggest_list = new ArrayList<>();
    ProgressBar search_pb;

    List<ObjSoc> lst_cpu;

    String[] cpu_company = {"allwinner_icon",
            "exynos_icon",
            "hisilicon_icon",
            "intel_icon",
            "mediatek_icon",
            "nvidia_icon",
            "qualcomm_icon",
            "rockchip_icon"};

    AdpBest adpBest_mobile, adpBest_cpu;

    AutoCompleteDogsAdapter adpSuggest;

    private ImageView close_search, clear_search;
    private CardView search_cardView;
    private AutoCompleteTextView search_input;
    private SwipyRefreshLayout swipeRefreshLayout;
    private ProgressBar best_mobs_progress;
    //    private TextView title_blog;
//    private RecyclerView blog;
//    private LinearLayoutManager layout_blog;
//    private AdpBlog adpBlog;
    Typeface fontApp;

    private Tracker mTracker;

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

        mTracker.setScreenName("Image~" + "Mobilebazz_MainActivity");
        mTracker.send(new HitBuilders.ScreenViewBuilder().build());

    }

    private boolean checkWriteExternalPermission() {
        PackageManager pm = context.getPackageManager();
        int hasPerm = pm.checkPermission(
                android.Manifest.permission.WRITE_EXTERNAL_STORAGE,
                context.getPackageName());
        return hasPerm != PackageManager.PERMISSION_GRANTED;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        ActiveAndroid.initialize(this);

        setContentView(R.layout.main);
        context = ActMain.this;
        if ( (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) && checkWriteExternalPermission() )
                startActivity(new Intent(this, ActPermission.class));

        mTracker = ((s) getApplication()).getDefaultTracker();
        fontApp = new GetFont(context).yekan;
        findViewsById();
        drawerList();
        showSearchBar();
        slider();
        prepareSearchList();
        loadBestMobs();
        loadBestCPUs();
        listener();
    }

    private void prepareSearchList() {
        suggest_list = new ArrayList<MyObj>();
        adpSuggest = new AutoCompleteDogsAdapter(context, suggest_list);
        search_input.setAdapter(adpSuggest);

    }

    private void loadBestCPUs() {

        lst_cpu = new ArrayList<>();
        SQLsource db = new SQLsource(context);
        db.open();
        lst_cpu.addAll(db.GetSoc(SQLbase.TBL_SOC, SQLbase.TBL_fav + "=" + 1));
//        lst_mobile.addAll(db.GetMob(SQLbase.TBL_Mobile, SQLbase.TBL_MOBILE_cache_image + "=" + 1));
        db.close();


        for (int i = 0; i < lst_cpu.size(); i++)
            cList.add(new MyObj(BASELINK_COMPANY + String.valueOf(cpu_company[lst_cpu.get(i).GetCompany()]) + ".png",
                    lst_cpu.get(i).GetNameModel()));
        adpBest_cpu = new AdpBest(context, cList);
        soc.setAdapter(adpBest_cpu);
    }

    private void loadBestMobs() {
        best_mobs_progress.setVisibility(View.VISIBLE);
        Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(URLs.BASE_URL).addConverterFactory(GsonConverterFactory.create())
                .build();
        RubyService rubyService = retrofit.create(RubyService.class);
        Call<List<ObjMobile>> mobs = rubyService.listMobs();

        mobs.enqueue(new Callback<List<ObjMobile>>() {
            @Override
            public void onResponse(Call<List<ObjMobile>> call, Response<List<ObjMobile>> response) {
                Log.i(TAG, "onResponse2: " + call.request().headers());
                Log.i(TAG, "onResponse3: " + call.request().tag());
                Log.i(TAG, "onResponse4: " + call.request().isHttps());
                Log.i(TAG, "onResponse5: " + response.raw().toString());

                Jsons jsons = new Select().from(Jsons.class).where("id = ?", 1).executeSingle();

                if (jsons != null) {
                    Log.i(TAG, "onResponse: Json before exists");
                } else {
                    Log.i(TAG, "onResponse: Json created");
                    new Jsons(Mobile2Json(response.body())).save();
                }
                showBestMobs(response.body());
            }

            @Override
            public void onFailure(Call<List<ObjMobile>> call, Throwable t) {
                Log.i(TAG, "onFailure: getMessage" + t.getMessage());
                Log.i(TAG, "onFailure: getCause" + t.getCause());

                Jsons jsons = new Select().from(Jsons.class).where("id = ?", 1).executeSingle();
                if (jsons != null) {
                    Log.i(TAG, "onResponse: Json exists");
                    try {
                        ArrayList<ObjMobile> ls = new ArrayList<ObjMobile>();
                        ls.addAll(getMobs(jsons.getContent()));
                        showBestMobs(ls);
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                } else {
                    Log.i(TAG, "onResponse: Json not exists");
                }
            }
        });

    }

    private void showBestMobs(List<ObjMobile> body) {

        for (int i = 0; i < body.size(); i++) {
            mList.add(new MyObj(BASELINK_PHONES + String.valueOf(
                    body.get(i).GetImage()), body.get(i).GetTitle()));
        }
        adpBest_mobile = new AdpBest(context, mList);
        mobile.setAdapter(adpBest_mobile);
        swipeRefreshLayout.setRefreshing(false);
        best_mobs_progress.setVisibility(View.INVISIBLE);
    }

    public static List<ObjMobile> getMobs(String jsonData) throws JSONException {
        List<ObjMobile> lst = new ArrayList<>();

        if (jsonData.equals("null"))
            return lst;


        JSONArray jArr = new JSONArray(jsonData);

        for (int i = 0; i < jArr.length(); i++) {
            JSONObject obj = jArr.getJSONObject(i);

            lst.add(new ObjMobile(obj.getInt("id"), obj.getString("title"), obj.getString("category"), obj.getString("image"),
                    obj.getString("twognetwork"), obj.getString("threegnetwork"), obj.getString("fourgnetwork"),
                    obj.getString("sim"), obj.getString("announced"), obj.getString("status"), obj.getString("dimensions"),
                    obj.getString("weight"), "obj.getString(\"_type\")", obj.getString("size"), obj.getString("multitouch"),
                    obj.getString("protection"), obj.getString("alerttypes"), obj.getString("loudspeaker"), obj.getString("jack")
                    , obj.getString("cardslot"), obj.getString("phonebook"), obj.getString("callrecords"), obj.getString("internal")
                    , obj.getString("gprs"), obj.getString("edge"), obj.getString("speed"), obj.getString("wlan")
                    , obj.getString("bluetooth"), obj.getString("nfc"), obj.getString("infraredport"), obj.getString("usb")
                    , "obj.getString(\"primary\")", obj.getString("features"), obj.getString("video"), obj.getString("secondary")
                    , obj.getString("os"), obj.getString("chipset"), obj.getString("cpu"), obj.getString("gpu")
                    , obj.getString("sensors"), obj.getString("messaging"), obj.getString("browser"), obj.getString("radio")
                    , obj.getString("games"), obj.getString("clock"), obj.getString("alarm"), obj.getString("gps")
                    , obj.getString("java"), obj.getString("colors"), "obj.getString(\"battrey\")", obj.getString("standby")
                    , obj.getString("talktime"), obj.getString("bodyfeatures"), obj.getString("otherfeatures"), obj.getString("price"), obj.getString("cache_image")));
        }
        return lst;
    }

    private String Mobile2Json(List<ObjMobile> body) {
        JSONArray jsonArray = new JSONArray();
        for (int i = 0; i < body.size(); i++) {

            JSONObject object = new JSONObject();
            try {
                object.put("id", body.get(i).GetId());
                object.put("title", body.get(i).GetTitle());
                object.put("category", body.get(i).GetCategory());
                object.put("image", body.get(i).GetImage());
                object.put("twognetwork", body.get(i).GetTwognetwork());
                object.put("threegnetwork", body.get(i).GetThreegnetwork());
                object.put("fourgnetwork", body.get(i).GetFourgnetwork());
                object.put("sim", body.get(i).GetSime());
                object.put("announced", body.get(i).GetAnnounced());
                object.put("status", body.get(i).GetStatus());
                object.put("dimensions", body.get(i).GetDimensions());
                object.put("weight", body.get(i).GetWeight());
                object.put("_type", body.get(i).GetType());
                object.put("size", body.get(i).GetSize());
                object.put("multitouch", body.get(i).GetMultitouch());
                object.put("protection", body.get(i).GetProtection());
                object.put("alerttypes", body.get(i).GetAlerttypes());
                object.put("loudspeaker", body.get(i).GetLoudspeaker());
                object.put("jack", body.get(i).GetJack());
                object.put("cardslot", body.get(i).GetCardslot());
                object.put("phonebook", body.get(i).GetPhonebook());
                object.put("callrecords", body.get(i).GetCallrecords());
                object.put("internal", body.get(i).GetInternal());
                object.put("gprs", body.get(i).GetGprs());
                object.put("edge", body.get(i).GetEdge());
                object.put("speed", body.get(i).GetSpeed());
                object.put("wlan", body.get(i).GetWlan());
                object.put("bluetooth", body.get(i).GetBluetooth());
                object.put("nfc", body.get(i).GetNfc());
                object.put("infraredport", body.get(i).GetInfraredport());
                object.put("usb", body.get(i).GetUsb());
                object.put("primary", body.get(i).GetPrimary());
                object.put("features", body.get(i).GetFeatures());
                object.put("video", body.get(i).GetVideo());
                object.put("secondary", body.get(i).GetSecondary());
                object.put("os", body.get(i).GetOs());
                object.put("chipset", body.get(i).GetChipset());
                object.put("cpu", body.get(i).GetCpu());
                object.put("gpu", body.get(i).GetGpu());
                object.put("sensors", body.get(i).GetSensors());
                object.put("messaging", body.get(i).GetMessaging());
                object.put("browser", body.get(i).GetBrowser());
                object.put("radio", body.get(i).GetRadio());
                object.put("games", body.get(i).GetGames());
                object.put("clock", body.get(i).GetClock());
                object.put("alarm", body.get(i).GetAlarm());
                object.put("gps", body.get(i).GetGps());
                object.put("java", body.get(i).GetJava());
                object.put("colors", body.get(i).GetColors());
                object.put("battrey", body.get(i).GetBattrey());
                object.put("standby", body.get(i).GetStandby());
                object.put("talktime", body.get(i).GetTalktime());
                object.put("bodyfeatures", body.get(i).GetBodyfeatures());
                object.put("otherfeatures", body.get(i).GetOtherfeatures());
                object.put("price", body.get(i).GetPrice());
                object.put("cache_image", body.get(i).GetCache_image());

            } catch (JSONException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            Log.i(TAG, "Mobile2Json: " + object.toString());
            jsonArray.put(object);
        }
        return jsonArray.toString();
    }

    private void drawerList() {

        mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
        ListView mDrawerList = (ListView) findViewById(R.id.left_drawer);
        mDrawerLayout.setDrawerListener(this);

        String[] titles = context.getResources().getStringArray(R.array.option);
        lst_drawer.add(new ObjDrawer(titles[1], R.string.material_share));
        lst_drawer.add(new ObjDrawer(titles[2], R.string.material_send_comment));
        lst_drawer.add(new ObjDrawer(titles[3], R.string.material_about_us));
        lst_drawer.add(new ObjDrawer(titles[4], R.string.material_exit));


        AdpDrawerList adpDrawerList = new AdpDrawerList(context, R.layout.list_drawer, lst_drawer);
        mDrawerList.setAdapter(adpDrawerList);
        mDrawerList.setOnItemClickListener(new DrawerItemClickListener());


    }


    private void slider() {

        List<ObjMobile> lst = new ArrayList<>();
        List<MyObj> images = new ArrayList<>();
        SQLsource db = new SQLsource(context);
        db.open();

        Random r = new Random();
        int i1 = r.nextInt(9 - 1) + 1;

        lst.addAll(db.GetMob(SQLbase.TBL_Mobile, SQLbase.TBL_MOBILE_title +
                " Like '%" + i1 + "%'"));
        db.close();

        for (int i = 0; i < lst.size(); i++)
            images.add(new MyObj(BASELINK_PHONES + lst.get(i).GetImage(), lst.get(i).GetTitle()));

        sliderAdp = new CustomPagerAdp(context, images);
        Slider.setAdapter(sliderAdp);
        Slider.setAutoScrollDurationFactor(5); // set change pic time
        Slider.setInterval(5000); // set show time
        Slider.startAutoScroll();

    }

    @Override
    public void onDrawerSlide(View drawerView, float slideOffset) {

    }

    @Override
    public void onDrawerOpened(View drawerView) {
        setArrow();
    }

    @Override
    public void onDrawerClosed(View drawerView) {
        setHamburger();
    }

    @Override
    public void onDrawerStateChanged(int newState) {
    }

    private class DrawerItemClickListener implements OnItemClickListener {

        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
            mDrawerLayout.closeDrawer(GravityCompat.END);
            if (position == 0) {

                ApplicationInfo app = getApplicationContext().getApplicationInfo();
                String filePath = app.sourceDir;
                Intent sharingIntent = new Intent(Intent.ACTION_SEND);
                sharingIntent.setType("*/*");
                sharingIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(filePath)));
                startActivity(Intent.createChooser(sharingIntent, "ارسال " + getResources().getString(R.string.app_name) + " با"));


            } else if (position == 1) {

                startActivity(new Intent(Intent.ACTION_EDIT,
                        Uri.parse("http://cafebazaar.ir/app/" + getBaseContext().getPackageName() + "/?l=fa")));


            } else if (position == 2) {

                Intent about = new Intent(getBaseContext(), ActAbout.class);
                startActivity(about);

            } else if (position == 3) {

                Exit();

            }

        }
    }

    private void Exit() {

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
            this.finishAffinity();
        else
            finish();

    }


    private void listener() {
        final ScrollView sw = (ScrollView) findViewById(R.id.scrollView_main);
        sw.setSmoothScrollingEnabled(true);
        sw.getViewTreeObserver().addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() {
            @Override
            public void onScrollChanged() {
                int scrollY = sw.getScrollY(); // For ScrollView
                int scrollX = sw.getScrollX(); // For HorizontalScrollView
                // DO SOMETHING WITH THE SCROLL COORDINATES

                if(sw.getTop()==scrollY){
                    // reaches the top end
                    swipeRefreshLayout.setEnabled(true);
                    Log.i(TAG, "onScrollChange: Reach to TOP");
                }else {
                    swipeRefreshLayout.setEnabled(false);
                }

            }
        });

        swipeRefreshLayout.setOnRefreshListener(new SwipyRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh(SwipyRefreshLayoutDirection direction) {
                loadBestMobs();
            }
        });

//        listBlog = new ArrayList<>();
//        adpBlog = new AdpBlog(context, listBlog);
//        blog.setAdapter(adpBlog);


//        if (Net.Is(context) && listBlog.size() == 0)
//            GetPost(LinkMaker.getPostLINK(COUNT_POST, listBlog.size()));


       /* blog.setOnScrollListener(new RecyclerView.OnScrollListener() {
            @Override
            public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
                super.onScrollStateChanged(recyclerView, newState);

                int threshold = 1;

                int lastItemVisable = 1;

                count_scroller = adpBlog.getItemCount();
                lastItemVisable = layout_blog.findLastVisibleItemPosition();

                if (newState == 0) {             // Checking for rich to end of recyclerView

                    if (lastItemVisable >= count_scroller - threshold
                            && pageCount < 2) {

                        // For checking Scroll And Show Loading .
                        if ((COUNT_POST - sizeChecker == 0) && !Loading) {//internet

                            Loading = true;
                            GetPost(LinkMaker.getPostLINK(COUNT_POST, listBlog.size()));
                        }
                    }
                }
            }


            @Override
            public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
                super.onScrolled(recyclerView, dx, dy);
            }


        });


        blog.addOnItemTouchListener(
                new RecyclerItemClickListener(context, new
                        RecyclerItemClickListener.OnItemClickListener() {
                            @Override
                            public void onItemClick(View view, int position) {

                                Intent intent = new Intent(context, v.class);

                                intent.putExtra("id", listBlog.get(position).getPost_id());
                                intent.putExtra("parentList", "mainPost");
                                intent.putExtra("commentCount", listBlog.get(position).getComment_count());

                                startActivity(intent);

                            }
                        })
        );*/

        search_input.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(final CharSequence s, int start, int before, int count) {


                getSuggestList(s.toString());

            }

            @Override
            public void afterTextChanged(final Editable s) {
                clear_search.setVisibility(View.VISIBLE);
                if (s.length() <= 0) {
                    setHamburger();
                    flg = true;
                } else if (flg) {
                    setArrow();
                    flg = false;
                }

            }

        });


        clear_search.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                search_input.setText("");

            }
        });

        close_search.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(final View v) {

                if (mIsSearchArrowHamburgerState == SearchArrowDrawable.STATE_HAMBURGER) {
                    mDrawerLayout.openDrawer(GravityCompat.END);
                    setArrow();
                } else if (mIsSearchArrowHamburgerState == SearchArrowDrawable.STATE_ARROW) {
                    mDrawerLayout.closeDrawer(GravityCompat.END);
                    setHamburger();
                    search_input.setText("");
                }

            }
        });

        cpu_cat.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {

                Intent cat = new Intent(context, ActCat.class);
                cat.putExtra("key", 1);
                startActivity(cat);
            }
        });

        mobile_cat.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {

                Intent cat = new Intent(context, ActCat.class);
                cat.putExtra("key", 2);
                startActivity(cat);

            }
        });


        soc.addOnItemTouchListener(new RecyclerItemClickListener(context, new RecyclerItemClickListener.OnItemClickListener() {
            @Override
            public void onItemClick(View view, int position) {

                startActivity(new Intent(context, ActShow.class).putExtra("name", cList.get(position).getTitle()));

            }
        }));

        mobile.addOnItemTouchListener(new RecyclerItemClickListener(context, new RecyclerItemClickListener.OnItemClickListener() {
            @Override
            public void onItemClick(View view, int position) {

                startActivity(new Intent(context, ActShow.class).putExtra("name", mList.get(position).getTitle()));

            }
        }));


    }

    boolean flg = true;

    private void hideSearchBar() {
        search_cardView.animate().translationY(-search_cardView.getHeight()).setInterpolator(new AccelerateInterpolator(2));
        //        search_cardView.setVisibility(View.INVISIBLE);

    }

    private void showSearchBar() {
        search_cardView.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2));
        search_cardView.setVisibility(View.VISIBLE);
    }


    private void getSuggestList(final String s) {

        search_pb.setVisibility(View.VISIBLE);

        mobile_suggests = new ArrayList<>();
        cpu_suggests = new ArrayList<>();

        suggest_list = new ArrayList<>();


        final SQLsource db = new SQLsource(context);
        db.open();
        mobile_suggests.addAll(db.GetMob(SQLbase.TBL_Mobile, SQLbase.TBL_MOBILE_title +
                " Like '%" + s + "%'"));

        cpu_suggests.addAll(db.GetSoc(SQLbase.TBL_SOC, SQLbase.TBL_name + " Like '%"
                + s + "%' or " + SQLbase.TBL_nameModel +
                " Like '%" + s + "%'"));
        db.close();

        for (int i = 0; i < mobile_suggests.size(); i++)
            suggest_list.add(new MyObj(BASELINK_PHONES + String.valueOf(mobile_suggests.get(i).GetImage()),
                    mobile_suggests.get(i).GetTitle()));

        for (int i = 0; i < cpu_suggests.size(); i++)
            suggest_list.add(new MyObj(BASELINK_COMPANY + String.valueOf(cpu_company[cpu_suggests.get(i).GetCompany()]) + ".png",
                    cpu_suggests.get(i).GetNameModel()));

        search_pb.setVisibility(View.INVISIBLE);

        search_input.setAdapter(new AutoCompleteDogsAdapter(context, suggest_list));

    }

    private int mAnimationDuration = 300;
    private SearchArrowDrawable mSearchArrow;
    private float mIsSearchArrowHamburgerState = SearchArrowDrawable.STATE_HAMBURGER;

    private void setArrow() {
        mSearchArrow.setVerticalMirror(false);
        mSearchArrow.animate(SearchArrowDrawable.STATE_ARROW, mAnimationDuration);
        mIsSearchArrowHamburgerState = SearchArrowDrawable.STATE_ARROW;

    }

    private void setHamburger() {
        mSearchArrow.setVerticalMirror(true);
        mSearchArrow.animate(SearchArrowDrawable.STATE_HAMBURGER, mAnimationDuration);
        mIsSearchArrowHamburgerState = SearchArrowDrawable.STATE_HAMBURGER;
    }

    private void findViewsById() {
        best_mobs_progress = (ProgressBar) findViewById(R.id.progress_recyclerview_main_mobile);
        best_mobs_progress.setVisibility(View.INVISIBLE);
        swipeRefreshLayout = (SwipyRefreshLayout) findViewById(R.id.swipe_container);
//        blog_layout = (RelativeLayout)findViewsById(R.id.relativelayout_blog);
        RelativeLayout main = (RelativeLayout) findViewById(R.id.main_layout);
        main.setBackgroundColor(getResources().getColor(R.color.maincolor));
        search_pb = (ProgressBar) findViewById(R.id.search_progressbar);
        search_pb.setVisibility(View.INVISIBLE);

        GetFont f = new GetFont(context);


        search_input = (AutoCompleteTextView) findViewById(R.id.search_input);
        search_input.setTypeface(f.yekan);

        search_cardView = (CardView) this.findViewById(R.id.card_search);

        search_cardView.setVisibility(View.INVISIBLE);

        close_search = (ImageView) this.findViewById(R.id.iv_bottom_search);
        mSearchArrow = new SearchArrowDrawable(context);
        close_search.setImageDrawable(mSearchArrow);

        clear_search = (ImageView) this.findViewById(R.id.iv_bottom_clear);
        clear_search.setVisibility(View.INVISIBLE);


        Slider = (AutoScrollViewPager) findViewById(R.id.viewpager_slider);
        mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
        soc = (RecyclerView) findViewById(R.id.recyclerview_main_soc);
        mobile = (RecyclerView) findViewById(R.id.recyclerview_main_mobile);
//        blog = (RecyclerView) findViewsById(R.id.recyclerview_main_blog);


        mobile_best = (TextView) findViewById(R.id.textview_mobile_best);
        mobile_cat = (TextView) findViewById(R.id.textview_mobile_cat);

        cpu_best = (TextView) findViewById(R.id.textview_cpu_best);
        cpu_cat = (TextView) findViewById(R.id.textview_cpu_cat);
//        title_blog = (TextView) findViewsById(R.id.textview_blog_title);


//        title_blog.setTypeface(f.yekan);
        mobile_best.setTypeface(f.yekan);
        mobile_cat.setTypeface(f.yekan);
        cpu_best.setTypeface(f.yekan);
        cpu_cat.setTypeface(f.yekan);

        layout_mobile = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
        layout_soc = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
//        layout_blog = new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false);


        soc.addItemDecoration(new GridSpacingItemDecoration(10));
        mobile.addItemDecoration(new GridSpacingItemDecoration(10));
//        blog.addItemDecoration(new GridSpacingItemDecoration(10));


//        blog.setLayoutManager(layout_blog);
        soc.setLayoutManager(layout_soc);
        mobile.setLayoutManager(layout_mobile);
    }



 /*   private void GetPost(String getLinkPost) {
        snackBar = Snackbar.make(findViewsById(R.id.drawer_layout),
                getResources().getString(R.string.loading)
                , Snackbar.LENGTH_INDEFINITE);

        TextView tv = (TextView) (snackBar.getView()).findViewsById(android.support.design.R.id.snackbar_text);
        tv.setTypeface(fontApp);

        snackBar.show();


        AsyncDataNet AsyncPost = new AsyncDataNet(context, getLinkPost);

        AsyncPost.setonDone(new AsyncDataNet.onComplete() {
            @Override
            public void onDone(String result, int token) {
                try {

//                    listBlog_tmp.clear();
//                    listBlog_tmp.addAll(Parse.getPost(result));  // Convert Jsons To List
//                    sizeChecker = listBlog_tmp.size(); // For checking Scroll And Show Loading .
//                    listBlog.addAll(listBlog_tmp);

//                    Thread thread = new Thread(new Runnable() {
//                        @Override
//                        public void run() {
//
//                            SqlSourceCnt db = new SqlSourceCnt(context);
//                            db.open();
//                            db.UpdatePost(listBlog_tmp); // reforming data
//                            db.close();
//                            Loading = false;
//                            snackBar.dismiss();
//
//                            ActMain.this.runOnUiThread(new Runnable() {
//                                @Override
//                                public void run() {
//
//                                    adpBlog.notifyDataSetChanged();
//
//
//
//                                    if(adpBlog.getItemCount()==0) {
//                                        blog_layout.setVisibility(View.GONE);
//                                    }
//
//
//
//                                }
//                            });
//
//                        }
//                    });
//                    thread.start();


                } catch (Exception e) {
                    e.printStackTrace();

                }

            }

            @Override
            public void onError(Exception e, int token) {

                OfflineError();
                OfflinePost();
                snackBar.dismiss();

                Loading = true;
            }

        });
        AsyncPost.execute();
    }
*/

    private void OfflineError() {


        Snackbar e_snackBar = Snackbar.make(findViewById(R.id.drawer_layout),
                getResources().getString(R.string.offline_mode)
                , Snackbar.LENGTH_LONG);

        TextView txt_snackbar = (TextView) (e_snackBar.getView()).findViewById(android.support.design.R.id.snackbar_text);
        txt_snackbar.setTypeface(fontApp);

        e_snackBar.show();

    }

//    private void OfflinePost() {
//
//        listBlog = new ArrayList<>();
//
//
//        SqlSourceCnt db = new SqlSourceCnt(context);
//        db.open();
//        listBlog.addAll(db.GetPost(""));
//        db.close();
//
//        adpBlog.notifyDataSetChanged();
//
//        if(adpBlog.getItemCount()==0) {
//            blog_layout.setVisibility(View.GONE);
//        }
//
//    }

    @Override
    public void onBackPressed() {
        if (mDrawerLayout.isDrawerOpen(GravityCompat.END))
            mDrawerLayout.closeDrawer(GravityCompat.END);
        else Exit.exitSnack(context, findViewById(R.id.drawer_layout), fontApp);

    }

}
<file_sep>package ir.droidhub.mobilebazz.api;

import android.content.Context;
import android.graphics.Typeface;

import ir.droidhub.mobilebazz.appdb.ObjSetting;
import ir.droidhub.mobilebazz.appdb.SqlBaseApp;
import ir.droidhub.mobilebazz.appdb.SqlSourceApp;
import ir.droidhub.mobilebazz.cntdb.ObjPost;


public class GetSetting {

    private static final String MainColorBackground = "CLR_MBG";

    private static final String ActionBarTitle = "TXT_ACTT";
    private static final String ActionBarColorBackground = "CLR_ACTBG";
    private static final String ActionBarTextColor = "CLR_ACTTX";

    private static final String HeaderBackground = "CLR_LISTHBG";
    private static final String HeaderTextColor = "CLR_LISTHTX";

    private static final String SummryBackground = "CLR_LISTSBG";
    private static final String SummryTextColor = "CLR_LISTSTX";

    private static final String FooterBackground = "CLR_LISTFBG";
    private static final String FooterTextColor = "CLR_LISTFTX";


    private static final String isSetComment = "BOL_SETCOM";
    private static final String isShowComment = "BOL_SHOWCOM";

    private static final String CollectionData = "BOL_STA";
    private static final String TypeShowDate = "NUM_CALTYPE";
    public static final String LastVersion = "TXT_LASTANDRVER";

    private static final String SplashTime = "NUM_SPLASHT";

    private static final String RightMenuTitle = "TXT_MNRTI";
    private static final String RightMenuIcon = "TXT_MNRIC";

    private static final String LeftMenuSubject = "NUM_MNLTYPE";
    private static final String LeftMenuTitle = "TXT_MNLTI";
    private static final String LeftMenuIcon = "TXT_MNLIC";

    private static final String TypeShowList = "NUM_LVT";

    private static final String IconSearchLocation = "NUM_SRCHP";

    private static final String IconSearch = "NUM_SRCHIC";


    private static final String IconSearchColor = "CLR_SRCHIC";

    private static final String FontApp = "NUM_FMAIN";


    public static final String YES = "YES";


    static Context context;
    static ObjSetting lst;

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


    public String getFooterBackground() {

        SqlSourceApp db = new SqlSourceApp(context);
        db.open();
        lst = db.getSetting(SqlBaseApp.TBL_NAME_H_SETTINGS,
                SqlBaseApp.TBL_column_name + " = " + "'" + FooterBackground + "'").get(0);

        db.close();

        return lst.getValue();

    }


    public String getMainColorBackground() {


        SqlSourceApp db = new SqlSourceApp(context);
        db.open();

        lst = db.getSetting(SqlBaseApp.TBL_NAME_H_SETTINGS,
                SqlBaseApp.TBL_column_name + " = " + "'" + MainColorBackground + "'").get(0);

        db.close();

        return lst.getValue();

    }

    public String getActionBarTitle() {

        SqlSourceApp db = new SqlSourceApp(GetSetting.context);
        db.open();
        lst = db.getSetting(SqlBaseApp.TBL_NAME_H_SETTINGS,
                SqlBaseApp.TBL_column_name + " = " + "'" + ActionBarTitle + "'").get(0);

        db.close();

        return lst.getValue();


    }

    public String getActionBarColorBackground() {

        SqlSourceApp db = new SqlSourceApp(context);
        db.open();
        lst = db.getSetting(SqlBaseApp.TBL_NAME_H_SETTINGS,
                SqlBaseApp.TBL_column_name + " = " + "'" + ActionBarColorBackground + "'").get(0);

        db.close();

        return lst.getValue();


    }

    public String getActionBarTextColor() {

        SqlSourceApp db = new SqlSourceApp(context);
        db.open();
        lst = db.getSetting(SqlBaseApp.TBL_NAME_H_SETTINGS,
                SqlBaseApp.TBL_column_name + " = " + "'" + ActionBarTextColor + "'").get(0);

        db.close();

        return lst.getValue();


    }

    public String getHeaderBackground() {

        SqlSourceApp db = new SqlSourceApp(context);
        db.open();
        lst = db.getSetting(SqlBaseApp.TBL_NAME_H_SETTINGS,
                SqlBaseApp.TBL_column_name + " = " + "'" + HeaderBackground + "'").get(0);

        db.close();

        return lst.getValue();


    }

    public String getHeaderTextColor() {


        SqlSourceApp db = new SqlSourceApp(context);
        db.open();
        lst = db.getSetting(SqlBaseApp.TBL_NAME_H_SETTINGS,
                SqlBaseApp.TBL_column_name + " = " + "'" + HeaderTextColor + "'").get(0);

        db.close();

        return lst.getValue();


    }

    public String getSummryBackground() {


        SqlSourceApp db = new SqlSourceApp(context);
        db.open();
        lst = db.getSetting(SqlBaseApp.TBL_NAME_H_SETTINGS,
                SqlBaseApp.TBL_column_name + " = " + "'" + SummryBackground + "'").get(0);

        db.close();

        return lst.getValue();


    }

    public String getSummryTextColor() {

        SqlSourceApp db = new SqlSourceApp(context);
        db.open();
        lst = db.getSetting(SqlBaseApp.TBL_NAME_H_SETTINGS,
                SqlBaseApp.TBL_column_name + " = " + "'" + SummryTextColor + "'").get(0);

        db.close();

        return lst.getValue();


    }

    public String getFooterTextColor() {

        SqlSourceApp db = new SqlSourceApp(context);
        db.open();
        lst = db.getSetting(SqlBaseApp.TBL_NAME_H_SETTINGS,
                SqlBaseApp.TBL_column_name + " = " + "'" + FooterTextColor + "'").get(0);

        db.close();

        return lst.getValue();


    }

    public boolean getIsSetComment() {

        SqlSourceApp db = new SqlSourceApp(context);
        db.open();
        lst = db.getSetting(SqlBaseApp.TBL_NAME_H_SETTINGS,
                SqlBaseApp.TBL_column_name + " = " + "'" + isSetComment + "'").get(0);

        db.close();

        if(lst.getValue().equals(YES))
            return true;

        return false;


    }

    public boolean getIsShowComment() {

        SqlSourceApp db = new SqlSourceApp(context);
        db.open();
        lst = db.getSetting(SqlBaseApp.TBL_NAME_H_SETTINGS,
                SqlBaseApp.TBL_column_name + " = " + "'" + isShowComment + "'").get(0);
        db.close();

        if (lst.getValue().equals(YES))
            return true;

        return false;
    }


    public boolean getCollectionData() {

        SqlSourceApp db = new SqlSourceApp(context);
        db.open();
        lst = db.getSetting(SqlBaseApp.TBL_NAME_H_SETTINGS,
                SqlBaseApp.TBL_column_name + " = " + "'" + CollectionData + "'").get(0);

        db.close();

        if(lst.getValue().equals(YES))
            return true;


        return false;


    }

    public String getTypeShowDate() {


        SqlSourceApp db = new SqlSourceApp(context);
        db.open();
        lst = db.getSetting(SqlBaseApp.TBL_NAME_H_SETTINGS,
                SqlBaseApp.TBL_column_name + " = " + "'" + TypeShowDate + "'").get(0);

        db.close();

        return lst.getValue();


    }

    public String getLastVersion() {

        SqlSourceApp db = new SqlSourceApp(context);
        db.open();
        lst = db.getSetting(SqlBaseApp.TBL_NAME_H_SETTINGS,
                SqlBaseApp.TBL_column_name + " = " + "'" + LastVersion + "'").get(0);

        db.close();

        return lst.getValue();


    }


    public String getSplashTime() {

        SqlSourceApp db = new SqlSourceApp(context);
        db.open();
        lst = db.getSetting(SqlBaseApp.TBL_NAME_H_SETTINGS,
                SqlBaseApp.TBL_column_name + " = " + "'" + SplashTime + "'").get(0);

        db.close();

        return lst.getValue();


    }

    public String getRightMenuTitle() {

        SqlSourceApp db = new SqlSourceApp(context);
        db.open();
        lst = db.getSetting(SqlBaseApp.TBL_NAME_H_SETTINGS,
                SqlBaseApp.TBL_column_name + " = " + "'" + RightMenuTitle + "'").get(0);

        db.close();

        return lst.getValue();


    }


    public String getRightMenuIcon() {

        SqlSourceApp db = new SqlSourceApp(context);
        db.open();
        lst = db.getSetting(SqlBaseApp.TBL_NAME_H_SETTINGS,
                SqlBaseApp.TBL_column_name + " = " + "'" + RightMenuIcon + "'").get(0);

        db.close();

        return lst.getValue();


    }

    public int getLeftMenuSubject() {

        SqlSourceApp db = new SqlSourceApp(context);
        db.open();
        lst = db.getSetting(SqlBaseApp.TBL_NAME_H_SETTINGS,
                SqlBaseApp.TBL_column_name + " = " + "'" + LeftMenuSubject + "'").get(0);

        db.close();

        return Integer.parseInt(lst.getValue());


    }

    public String getLeftMenuTitle() {

        SqlSourceApp db = new SqlSourceApp(context);
        db.open();
        lst = db.getSetting(SqlBaseApp.TBL_NAME_H_SETTINGS,
                SqlBaseApp.TBL_column_name + " = " + "'" + LeftMenuTitle + "'").get(0);

        db.close();

        return lst.getValue();


    }

    public String getLeftMenuIcon() {


        SqlSourceApp db = new SqlSourceApp(context);
        db.open();
        lst = db.getSetting(SqlBaseApp.TBL_NAME_H_SETTINGS,
                SqlBaseApp.TBL_column_name + " = " + "'" + LeftMenuIcon + "'").get(0);

        db.close();

        return lst.getValue();

    }

    public String getTypeShowList() {

        SqlSourceApp db = new SqlSourceApp(context);
        db.open();
        lst = db.getSetting(SqlBaseApp.TBL_NAME_H_SETTINGS,
                SqlBaseApp.TBL_column_name + " = " + "'" + TypeShowList + "'").get(0);

        db.close();

        return lst.getValue();

    }

    public String getIconSearchLocation() {

        SqlSourceApp db = new SqlSourceApp(context);
        db.open();
        lst = db.getSetting(SqlBaseApp.TBL_NAME_H_SETTINGS,
                SqlBaseApp.TBL_column_name + " = " + "'" + IconSearchLocation + "'").get(0);

        db.close();


        return lst.getValue();


    }

    public String getIconSearch() {

        SqlSourceApp db = new SqlSourceApp(context);
        db.open();
        lst = db.getSetting(SqlBaseApp.TBL_NAME_H_SETTINGS,
                SqlBaseApp.TBL_column_name + " = " + "'" + IconSearch + "'").get(0);

        db.close();

        return lst.getValue();

    }

    public String getIconSearchColor() {

        SqlSourceApp db = new SqlSourceApp(context);
        db.open();
        lst = db.getSetting(SqlBaseApp.TBL_NAME_H_SETTINGS,
                SqlBaseApp.TBL_column_name + " = " + "'" + IconSearchColor + "'").get(0);

        db.close();

        return lst.getValue();


    }


    public Typeface getFontApp() {


                return Typeface.createFromAsset(context.getAssets(), "font/koodak.ttf");

    }


    public String date(String date) {


        switch (Integer.parseInt(getTypeShowDate())) {

            case 1: {
                return ObjPost.getShortDate(date);
            }

            case 2: {

                return ObjPost.getDate_Gregorain(date);
            }

            case 3: {
                return ObjPost.getDate_BeforeTime(date, context);
            }

        }

        return "";
    }

}

<file_sep>package ir.droidhub.mobilebazz.api.web;

import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

public class SqlSource {
	//Variables
		SQLiteDatabase				db;
		Context						mycontext;
		
	public SqlSource(Context context) {
		mycontext=context;
	}	
	
	public void open(){
		db=new SqlBase(mycontext).getWritableDatabase();
	}
		
	public void close(){
		db.close();
	}
	
	public CData getCData(String url){
		CData cd=null;
		Cursor crs=db.query(SqlBase.TABLE_CDATA, CData.COL,
				SqlBase.CD_URL+" like '"+url+"'", null, null, "", "");
		crs.moveToFirst();
		if (!crs.isAfterLast())
			cd=new CData(crs.getInt(0), crs.getString(1), crs.getString(2));
		return cd;
	}
	
	public void cData(CData cdata){
		db.insert(SqlBase.TABLE_CDATA, null, cdata.getCV());
	}

}
<file_sep>package ir.droidhub.mobilebazz.adpter;

import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import ir.droidhub.mobilebazz.R;
import ir.droidhub.mobilebazz.api.GetSetting;
import ir.droidhub.mobilebazz.api.view.TouchImageView;
import com.squareup.picasso.Picasso;

/**
 * Created by Ali on 4/3/2016.
 */
@SuppressLint("ValidFragment")
public class FragmentPagerZoomer extends Fragment {

    private static final String ARG_SECTION_NUMBER = "section-icon";
    private Context context;

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

    public FragmentPagerZoomer newInstance(String icon) {

        FragmentPagerZoomer fragment = new FragmentPagerZoomer(context);

        Bundle args = new Bundle();
        args.putString(ARG_SECTION_NUMBER, icon);
        fragment.setArguments(args);

        return fragment;
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_main_zoom, container, false);

        TouchImageView image = (TouchImageView)
                rootView.findViewById(R.id.iv_icon_zoom);
        GetSetting getSetting = new GetSetting(context);

        image.setBackgroundColor(Color.parseColor(getSetting.getMainColorBackground()));

        Picasso.with(rootView.getContext()).load(getArguments().getString(ARG_SECTION_NUMBER)).into(image);

        return rootView;
    }

}
<file_sep>package ir.droidhub.mobilebazz.adpter;

import android.content.Context;
import android.graphics.Color;
import android.graphics.Typeface;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import ir.droidhub.mobilebazz.api.GetFont;
import ir.droidhub.mobilebazz.api.HTMLBuilder;
import ir.droidhub.mobilebazz.R;
import ir.droidhub.mobilebazz.api.GetSetting;
import ir.droidhub.mobilebazz.api.cash_pic.ImageLoader;
import ir.droidhub.mobilebazz.cntdb.ObjPost;
import ir.droidhub.mobilebazz.cntdb.SqlSourceCnt;


import java.util.List;


class AdpBlog extends RecyclerView.Adapter<AdpBlog.viewholder> {
    private List<ObjPost> lst;
    static Context context;
    private static Typeface FontApp;
    private static GetSetting getSetting;
    private ImageLoader imageLoader;

    public AdpBlog(Context context, List<ObjPost> lst){
        this.lst = lst;
        AdpBlog.context = context;
        getSetting = new GetSetting(context);
        FontApp = new GetFont(context).yekan;
        imageLoader=new ImageLoader(context);
        Typeface iconfont = Typeface.createFromAsset(context.getAssets(), "font/fontawesome-webfont.ttf");
    }


    static class viewholder extends RecyclerView.ViewHolder {

        TextView PostTitle, PostDate, PostContent, PostCategory;
        ImageView img_content;
        LinearLayout background;


        viewholder(View itemView) {
            super(itemView);


            PostDate = (TextView) itemView.findViewById(R.id.list_post_four_date);
            PostTitle = (TextView) itemView.findViewById(R.id.list_post_four_title);
            PostCategory = (TextView) itemView.findViewById(R.id.list_post_four_cat);
            img_content = (ImageView) itemView.findViewById(R.id.list_post_four_img);
            PostContent = (TextView) itemView.findViewById(R.id.list_post_four_content);
            background = (LinearLayout) itemView.findViewById(R.id.list_post_four_background);


            // Color Background
            background.setBackgroundColor(Color.parseColor(getSetting.getSummryBackground()));


            // Color Title
            PostTitle.setTextColor(Color.parseColor(getSetting.getSummryTextColor()));


            // Color Text Summry
            PostContent.setTextColor(Color.parseColor(getSetting.getFooterTextColor()));


            // Color Text Header
            PostCategory.setTextColor(Color.parseColor(getSetting.getHeaderTextColor()));
            PostDate.setTextColor(Color.parseColor(getSetting.getHeaderTextColor()));


            PostTitle.setTypeface(FontApp);
            PostDate.setTypeface(FontApp);
            PostCategory.setTypeface(FontApp);
            PostContent.setTypeface(FontApp);



        }
    }


    @Override
    public viewholder onCreateViewHolder(ViewGroup parent, int viewType) {
        View v = LayoutInflater.from(context).inflate(R.layout.list_blog, parent, false);

        return new viewholder(v);

    }

    @Override
    public void onBindViewHolder(viewholder view, int position) {


        view.PostDate.setText(getSetting.date(lst.get(position).getPost_date()));


        String txt_html = HTMLBuilder.getTextForList(lst.get(position));


        if (txt_html.equals("")) {
            view.PostContent.setVisibility(View.GONE);
        } else {
            view.PostContent.setVisibility(View.VISIBLE);
            view.PostContent.setText(txt_html);
        }

        String indexImg = HTMLBuilder.getIndexImage(lst.get(position));

        if (indexImg.equals("")) {
            view.img_content.setVisibility(View.GONE);
        } else {
            view.img_content.setVisibility(View.VISIBLE);
            imageLoader.DisplayImage(indexImg,view.img_content);
        }

        view.PostTitle.setText(lst.get(position).getPost_title());


        view.PostCategory.setText(getCategory(
                lst.get(position).getPost_id(), context, view.PostCategory));


    }


    @Override
    public void onAttachedToRecyclerView(RecyclerView recyclerView) {
        super.onAttachedToRecyclerView(recyclerView);
    }

    @Override
    public int getItemCount() {
        return lst.size();
    }



    private String getCategory(int PostId, Context ctx, TextView PostCat) {
        List<String> mycat;
        String category = "";

        SqlSourceCnt db = new SqlSourceCnt(ctx);
        db.open();
        mycat = db.GetCatName(PostId);
        db.close();

        if (mycat.size() == 0)
            PostCat.setVisibility(View.INVISIBLE);
        else
            for (int i = 0; i < mycat.size(); i++) {
                category += mycat.get(i);
                if (i < mycat.size() - 1)
                    category += ",";
            }
        return category;
    }



}



<file_sep>package ir.droidhub.mobilebazz.sql;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.util.Log;

public class SQLbase {

	public static String DB_PATH;
	public static String DB_NAME = "cpu";

	
	//Table
	public static final String TBL_SOC = "soc";
	public static final String TBL_Mobile = "phones";


	// Content
	public static final String TBL_id = "_id";
	public static final String TBL_name = "name";
	public static final String TBL_nameModel = "name_model";
	public static final String TBL_dateRelease = "date_release";
	public static final String TBL_cpuCore = "cpu_core";
	public static final String TBL_architecture = "architecture";
	public static final String TBL_versionArchitecture = "version_architecture";
	public static final String TBL_sizeArchitecture= "size_architecture";
	public static final String TBL_frequence = "frequence";
	public static final String TBL_cacheMemory = "cache_memory";
	public static final String TBL_typeRam = "type_ram";
	public static final String TBL_freqRam = "freq_ram";
	public static final String TBL_graphic = "graphic";
	public static final String TBL_numberCoreGraphic = "number_core_graphic";
	public static final String TBL_FreqGraphic = "freq_graphic";
	public static final String TBL_powerProcessingGraphic = "power_processing_graphic";
	public static final String TBL_fav = "fav";
	public static final String TBL_company = "company";
	
	
	// Content mobile
	public static final String TBL_MOBILE_id = "_id";
	public static final String TBL_MOBILE_title = "title";
	public static final String TBL_MOBILE_category = "category";
	public static final String TBL_MOBILE_image = "image";
	public static final String TBL_MOBILE_2gnetwork = "twognetwork";
	public static final String TBL_MOBILE_3gnetwork = "threegnetwork";
	public static final String TBL_MOBILE_4gnetwork = "fourgnetwork";
	public static final String TBL_MOBILE_sim= "sim";
	public static final String TBL_MOBILE_announced = "announced";
	public static final String TBL_MOBILE_status = "status";
	public static final String TBL_MOBILE_dimensions = "dimensions";
	public static final String TBL_MOBILE_weight = "weight";
	public static final String TBL_MOBILE_type = "type";
	public static final String TBL_MOBILE_size = "size";
	public static final String TBL_MOBILE_multitouch = "multitouch";
	public static final String TBL_MOBILE_protection = "protection";
	public static final String TBL_MOBILE_alerttypes = "alerttypes";
	public static final String TBL_MOBILE_loudspeaker = "loudspeaker";
	public static final String TBL_MOBILE_jak = "jack";
	public static final String TBL_MOBILE_cardslot = "cardslot";
	public static final String TBL_MOBILE_phonebook = "phonebook";
	public static final String TBL_MOBILE_callrecords = "callrecords";
	public static final String TBL_MOBILE_internal = "internal";
	public static final String TBL_MOBILE_gprs = "gprs";
	public static final String TBL_MOBILE_edge = "edge";
	public static final String TBL_MOBILE_speed = "speed";
	public static final String TBL_MOBILE_wlan = "wlan";
	public static final String TBL_MOBILE_bluetooth = "bluetooth";
	public static final String TBL_MOBILE_nfc = "nfc";
	public static final String TBL_MOBILE_infraredport = "infraredport";
	public static final String TBL_MOBILE_usb = "usb";
	public static final String TBL_MOBILE_primary = "_primary";
	public static final String TBL_MOBILE_features = "features";
	public static final String TBL_MOBILE_video = "video";
	public static final String TBL_MOBILE_secondary = "secondary";
	public static final String TBL_MOBILE_os = "os";
	public static final String TBL_MOBILE_chipset = "chipset";
	public static final String TBL_MOBILE_cpu = "cpu";
	public static final String TBL_MOBILE_gpu = "gpu";
	public static final String TBL_MOBILE_sensors = "sensors";
	public static final String TBL_MOBILE_messaging = "messaging";
	public static final String TBL_MOBILE_browser = "browser";
	public static final String TBL_MOBILE_radio = "radio";
	public static final String TBL_MOBILE_games = "games";
	public static final String TBL_MOBILE_clock = "clock";
	public static final String TBL_MOBILE_alarm = "alarm";
	public static final String TBL_MOBILE_gps = "gps";
	public static final String TBL_MOBILE_java = "java";
	public static final String TBL_MOBILE_colors = "colors";
	public static final String TBL_MOBILE_battrey = "battery";
	public static final String TBL_MOBILE_standby = "standby";
	public static final String TBL_MOBILE_talktime = "talktime";
	public static final String TBL_MOBILE_bodyfeatures = "bodyfeatures";
	public static final String TBL_MOBILE_otherfeatures = "otherfeatures";
	public static final String TBL_MOBILE_price = "price";
	public static final String TBL_MOBILE_cache_image = "cache_image";
	

	Context myContext;

	public SQLbase(Context context) {
		myContext = context;
	}

	public void createDataBase() throws IOException {
		boolean dbExist = checkDataBase();

		if (dbExist) {
			// do nothing - database already exist
		} else {
			// By calling this method and empty database will be created into
			// the default system path
			// of your application so we are gonna be able to overwrite that
			// database with our database.
			try {
				copyDataBase();
			} catch (IOException e) {
				throw new Error("Error copying database");
			}
		}
	}

	// ////////////////////////////////////////////////////////////////////////////////////////////////
	public boolean checkDataBase() {
		SQLiteDatabase checkDB = null;
		try {
			DB_PATH = "/data/data/" + myContext.getApplicationContext().getPackageName() + "/";
			Log.i("Place", "Path:" + DB_PATH);
			String myPath = DB_PATH  + DB_NAME;
			checkDB = SQLiteDatabase.openDatabase(myPath, null,SQLiteDatabase.OPEN_READWRITE);
		} catch (SQLiteException e) {
			// database does't exist yet.
		}
		if (checkDB != null) {
			checkDB.close();
		}
		return checkDB != null ? true : false;
	}

	// ////////////////////////////////////////////////////////////////////////////////////////////////
	private void copyDataBase() throws IOException {
		// Open your local db as the input stream

		InputStream myInput = myContext.getAssets().open(DB_NAME);
		// Path to the just created empty db

		String outFileName = DB_PATH + DB_NAME;
		// Open the empty db as the output stream

		OutputStream myOutput = new FileOutputStream(outFileName);
		// transfer bytes from the inputfile to the outputfile

		byte[] buffer = new byte[1024];
		int length;
		while ((length = myInput.read(buffer)) > 0) {
			myOutput.write(buffer, 0, length);
		}
		// Close the streams
		myOutput.flush();
		myOutput.close();
		myInput.close();
		Log.i("Place", "Copy Succ!!!");

	}
}
<file_sep>include ':app', 'circualreveal-release', 'fab', ':permission'
<file_sep>package ir.droidhub.mobilebazz;

import android.content.Context;
import android.content.pm.ActivityInfo;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.graphics.Palette;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ImageView;

//import ir.droidhub.fab.TextDrawer;

import ir.droidhub.mobilebazz.adpter.AdpShow;
import ir.droidhub.mobilebazz.api.GetFont;
import ir.droidhub.mobilebazz.sql.SQLbase;
import ir.droidhub.mobilebazz.sql.SQLsource;
import ir.droidhub.mobilebazz.sql.obj.MyObj;
import ir.droidhub.mobilebazz.sql.obj.ObjMobile;
import ir.droidhub.mobilebazz.sql.obj.ObjSoc;
import com.squareup.picasso.Callback;
import com.squareup.picasso.Picasso;

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

import static ir.droidhub.mobilebazz.ActMain.BASELINK_COMPANY;
import static ir.droidhub.mobilebazz.ActMain.BASELINK_PHONES;


/**
 * Created by <NAME> on 4/29/2016.
 */
public class ActShow extends AppCompatActivity {


    private static final String TAG = "MOBILEBAZZ";
    private String[] cpu_company = {"allwinner_icon",
            "exynos_icon",
            "hisilicon_icon",
            "intel_icon",
            "mediatek_icon",
            "nvidia_icon",
            "qualcomm_icon",
            "rockchip_icon"};


    private CollapsingToolbarLayout collapsingLayout;


    private ObjMobile mobile;
    private ObjSoc cpu;

    private Context context;
    private ImageView image;



    List<MyObj> myobj = new ArrayList<>();
    private RecyclerView list;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        setContentView(R.layout.act_product);
        context = ActShow.this;
        findview();

        String name = getIntent().getExtras().getString("name");


        SQLsource db = new SQLsource(context);
        db.open();

        if          (db.GetMob(SQLbase.TBL_Mobile, SQLbase.TBL_MOBILE_title + "='" + name + "'").size() > 0)
            mobile = db.GetMob(SQLbase.TBL_Mobile, SQLbase.TBL_MOBILE_title + "='" + name + "'").get(0);
        else if  (db.GetSoc(SQLbase.TBL_SOC, SQLbase.TBL_nameModel + "='" + name + "'").size() > 0)
            cpu = db.GetSoc(SQLbase.TBL_SOC, SQLbase.TBL_nameModel + "='" + name + "'").get(0);
        db.close();



        if (mobile != null) {

            collapsingLayout.setTitle(mobile.GetTitle());


            Picasso.with(this).load(
                    BASELINK_PHONES +String.valueOf(mobile.GetImage())
            ).into(image, new Callback() {
                @Override
                public void onSuccess() {
                    Bitmap bitmap = ((BitmapDrawable) image.getDrawable()).getBitmap();
                    Palette.from(bitmap).generate(new Palette.PaletteAsyncListener() {
                        public void onGenerated(Palette palette) {
                        }
                    });
                }

                @Override
                public void onError() {

                }
            });


            String [] title_mobile = {"نام","تاریخ عرضه ","وزن","ابعاد","اندازه صفحه نمایش",
                    "نوع صفحه نمایش","محافظ صفحه نمایش","حافظه داخلی و رم","حافظه جانبی","وای فای","2G","3G","4G","بلوتوث","NFC"
                    ,"USB","دوربین پشت","امکانات  دوربین","ضبط ویدئو","دوربین جلو","سیستم عامل",
                    "چیپ ست","پردازنده","گرافیک","سنسورها","GPS","باطری","حداکثر زمان اماده به کار",
                    "حداکثر زمان مکالمه"};
            String[] items_mobile = {mobile.GetTitle(),mobile.GetAnnounced(),mobile.GetWeight(),mobile.GetDimensions(),
                    mobile.GetSize(),
            mobile.GetType(),mobile.GetProtection(),mobile.GetInternal(),mobile.GetCardslot(),mobile.GetWlan(),
                    mobile.GetTwognetwork(),mobile.GetThreegnetwork(),mobile.GetFourgnetwork(),mobile.GetBluetooth(),
                    mobile.GetNfc(),mobile.GetUsb(),mobile.GetPrimary(),mobile.GetVideo(),mobile.GetFeatures(),
                    mobile.GetSecondary(),mobile.GetOs(),mobile.GetCpu(),mobile.GetGpu(),mobile.GetSensors(),mobile.GetGps(),
            mobile.GetBattrey(),mobile.GetStandby(),mobile.GetCallrecords()};

            for(int i=0;i<items_mobile.length;i++)
                myobj.add(new MyObj(items_mobile[i],title_mobile[i]));



        } else if (cpu != null) {

            collapsingLayout.setTitle(cpu.GetName());

            Picasso.with(this).load(
                    BASELINK_COMPANY + String.valueOf(cpu_company[cpu.GetCompany()]) + ".png"
            ).into(image, new Callback() {
                @Override
                public void onSuccess() {
                    Bitmap bitmap = ((BitmapDrawable) image.getDrawable()).getBitmap();
                    Palette.from(bitmap).generate(new Palette.PaletteAsyncListener() {
                        public void onGenerated(Palette palette) {
                        }
                    });
                }

                @Override
                public void onError() {

                }
            });

            String[] items_cpu={cpu.GetName(),cpu.GetNameModel(),
                    cpu.GetDateRelease(),cpu.GetCpuCore(),cpu.GetArchitecture(),
                    cpu.GetVersionArchitecture(),cpu.GetSizeArchitecture(),
                    cpu.GetFrequence(),cpu.GetCacheMemory(),cpu.GetTypeRam(),
                    cpu.GetFreqRam(),cpu.GetGraphic(),cpu.GetNumberCoreGraphic(),
                    cpu.GetFreqGraphic(),cpu.GetPowerProcessingGraphic()+" GigaFlaps"};

            String[] title_cpu ={  "نام",                 "نام مدل",        "تاریخ عرضه",        "تعداد هسته های cpu",      "نوع معماری",
                    "ورژن معماری", "سایز معماری", "فرکانس",           "کش حافظه",  "نوع رم",
                    "فرکانس رم",             "گرافیک",          "تعداد هسته های گرافیکی", "فرکانس گرافیک",   "توان پردازشی گرافیک"};



                 for(int i=0;i<items_cpu.length;i++)
                     myobj.add(new MyObj(items_cpu[i],title_cpu[i]));
        }


        AdpShow adpShow = new AdpShow(context , myobj);
        list.setAdapter(adpShow);
    }

    private void findview() {

        GetFont getFont = new GetFont(context);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_product);
        setSupportActionBar(toolbar);

//        TextDrawer textDrawer = new TextDrawer(context);
//        textDrawer.setTypeface(getFont.material);
//        textDrawer.setTextColor(getResources().getColor(R.color.white));
//        textDrawer.setText(getResources().getString(R.string.material_back));
//        textDrawer.setTextSize(25);
//
//        toolbar.setNavigationIcon(textDrawer);

        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                onBackPressed();
            }
        });


        collapsingLayout = (CollapsingToolbarLayout)
                findViewById(R.id.collapsing_toolbar_product);

        collapsingLayout.setBackgroundColor(getResources().getColor(R.color.white));
        collapsingLayout.setExpandedTitleColor(getResources().getColor(R.color.transparent));
        collapsingLayout.setCollapsedTitleTextColor(getResources().getColor(R.color.white));


        image = (ImageView) findViewById(R.id.image_product);
        list = (RecyclerView) findViewById(R.id.recyclerview_product);
        list.setHasFixedSize(true);
        LinearLayoutManager lm=new LinearLayoutManager(context,LinearLayoutManager.VERTICAL,false);

        list.setLayoutManager(lm);
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent motionEvent) {
        try {
            return super.dispatchTouchEvent(motionEvent);
        } catch (NullPointerException e) {
            return false;
        }
    }



}
<file_sep>package ir.droidhub.mobilebazz.adpter;

import android.content.Context;
import android.graphics.Typeface;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;


import ir.droidhub.mobilebazz.R;

import ir.droidhub.mobilebazz.api.GetFont;
import ir.droidhub.mobilebazz.api.cash_pic.ImageLoader;
import ir.droidhub.mobilebazz.sql.obj.MyObj;

import java.util.List;


public class AdpCat extends RecyclerView.Adapter<AdpCat.viewholder> {

    private List<MyObj> lst;
    static Context context;
    private static Typeface FontApp;
    private ImageLoader imageLoader;


    public AdpCat(Context context, List<MyObj> lst){
        this.lst = lst;
        AdpCat.context = context;
        imageLoader=new ImageLoader(context);
        GetFont f = new GetFont(context);

    }


    static class viewholder extends RecyclerView.ViewHolder {


//        TextView PostTitle;
        ImageView img;


        viewholder(View itemView) {
            super(itemView);
//            PostTitle = (TextView) itemView.findViewById(R.id.list_cat_title);
            img = (ImageView) itemView.findViewById(R.id.list_cat_img);
            // Color Header Text

//            PostTitle.setTypeface(FontApp);

        }
    }

    @Override
    public viewholder onCreateViewHolder(ViewGroup parent, int viewType) {
        View v = LayoutInflater.from(context).inflate(R.layout.list_cat, parent, false);

        return new viewholder(v);

    }

    @Override
    public void onBindViewHolder(viewholder view, int position) {



        imageLoader.DisplayImageNoAnim(lst.get(position).getLst(), view.img);
//            view.PostTitle.setText(lst.get(position).getTitle());

    }


    @Override
    public void onAttachedToRecyclerView(RecyclerView recyclerView) {
        super.onAttachedToRecyclerView(recyclerView);
    }

    @Override
    public int getItemCount() {
        return lst.size();
    }
}
<file_sep>package ir.droidhub.mobilebazz.api;

import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ScrollView;

/**
 * Created by Ali on 4/30/2016.
 */
public abstract class HidingScrollListener implements ScrollView.OnScrollChangeListener {
    private static final int HIDE_THRESHOLD = 20;
    private int scrolledDistance = 0;
    private boolean controlsVisible = true;

    @Override
    public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {


        if (scrolledDistance > HIDE_THRESHOLD && controlsVisible) {
            onHide();
            controlsVisible = false;
            scrolledDistance = 0;
        } else if (scrolledDistance < -HIDE_THRESHOLD && !controlsVisible) {
            onShow();
            controlsVisible = true;
            scrolledDistance = 0;
        }

        if((controlsVisible && scrollY>0) || (!controlsVisible && scrollY<0)) {
            scrolledDistance += scrollY;
        }


    }

////        @Override
//    public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
//        super.onScrollChange(recyclerView, dx, dy);
//
//        if (scrolledDistance > HIDE_THRESHOLD && controlsVisible) {
//            onHide();
//            controlsVisible = false;
//            scrolledDistance = 0;
//        } else if (scrolledDistance < -HIDE_THRESHOLD && !controlsVisible) {
//            onShow();
//            controlsVisible = true;
//            scrolledDistance = 0;
//        }
//
//        if((controlsVisible && dy>0) || (!controlsVisible && dy<0)) {
//            scrolledDistance += dy;
//        }
//    }

    public abstract void onHide();
    public abstract void onShow();

}<file_sep>package ir.droidhub.mobilebazz.appdb;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

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

public class SqlSourceApp {
	SqlBaseApp base;
    SQLiteDatabase db;
    Context mycontext;
    
	public SqlSourceApp(Context context) {
		base = new SqlBaseApp(context);
		mycontext = context;
	}

	public void open() {
		try {
			base.createDataBase();
		} catch (IOException e) {
			e.printStackTrace();
		}
		db = SQLiteDatabase.openDatabase(SqlBaseApp.DB_PATH + SqlBaseApp.DB_NAME,null,
				                                    SQLiteDatabase.OPEN_READWRITE);
	}
	
	public void close() {
		db.close();
	}

     public List<ObjSetting> getSetting(String tbl_name, String where) {


                 String[] col_ind = {SqlBaseApp.TBL_column_name ,
									SqlBaseApp.TBL_column_value ,
									SqlBaseApp.TBL_column_time};

		 List<ObjSetting> lst = new ArrayList<ObjSetting>();

		Cursor cursor = db.query(tbl_name, col_ind , where , null, null,
				                                  null, null);

		cursor.moveToFirst();

		while (!cursor.isAfterLast()) {
			lst.add(new ObjSetting( cursor.getString(0), cursor.getString(1) , cursor.getInt(2)));
			cursor.moveToNext();
		}


		 if (!cursor.isClosed())
	    	cursor.close();

		return lst;
	}

	public void UpdateAppSettings(List<ObjSetting> lst){

		db.delete(SqlBaseApp.TBL_NAME_H_SETTINGS, "", null);
		ContentValues cv = new ContentValues();

		for(int i=0 ; i<lst.size() ; i++) {

			cv.put(SqlBaseApp.TBL_column_name, lst.get(i).getName());
			cv.put(SqlBaseApp.TBL_column_value, lst.get(i).getValue());
			cv.put(SqlBaseApp.TBL_column_time, lst.get(i).getTime());
			db.insert(SqlBaseApp.TBL_NAME_H_SETTINGS, null, cv);
		}

	}
}
<file_sep>package ir.droidhub.mobilebazz.adpter;

import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Typeface;
import android.support.annotation.NonNull;
import android.support.design.widget.TextInputLayout;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;


import ir.droidhub.mobilebazz.api.LinkMaker;
import ir.droidhub.mobilebazz.api.Net;
import ir.droidhub.mobilebazz.api.Parse;
import ir.droidhub.mobilebazz.R;
import ir.droidhub.mobilebazz.api.GetSetting;
import ir.droidhub.mobilebazz.api.web.AsyncDataNet;
import ir.droidhub.mobilebazz.cntdb.ObjComment;
import ir.droidhub.mobilebazz.cntdb.SqlBaseCnt;
import ir.droidhub.mobilebazz.cntdb.SqlSourceCnt;

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

public class AdpComment extends ArrayAdapter<ObjComment> {

    Context context;
    private List<ObjComment> lst;
    private LayoutInflater inflater;
    ViewHolder view;
    private Typeface FontApp, Iconfont;

    private GetSetting getSetting;

    public AdpComment(Context context, int resource, List<ObjComment> lst) {
        super(context, resource, lst);

        this.context = context;
        getSetting = new GetSetting(context);
        this.lst = lst;

        inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        FontApp = getSetting.getFontApp();
        Iconfont = Typeface.createFromAsset(context.getAssets(), "font/fontawesome-webfont.ttf");

    }

    @NonNull
    @Override
    public View getView(final int position, View convertView, @NonNull ViewGroup parent) {

        if (convertView == null) {

            convertView = inflater.inflate(R.layout.list_comment, null);
            view = new ViewHolder();

            view.author = (TextView) convertView.findViewById(R.id.textView_comment_author);
            view.date = (TextView) convertView.findViewById(R.id.textView_comment_date);
            view.content = (TextView) convertView.findViewById(R.id.textView_CommentContent);
            view.replayContent = (TextView) convertView.findViewById(R.id.textView_ReplayCommentContent);
            view.replayIcon = (TextView) convertView.findViewById(R.id.textView_replayIcon);

            view.author.setTypeface(FontApp);
            view.date.setTypeface(FontApp);
            view.content.setTypeface(FontApp);
            view.replayContent.setTypeface(FontApp);
            view.replayIcon.setTypeface(Iconfont);

            view.replayIcon.setText(context.getResources().getString(R.string.fa_reply));

            view.replayContent.setTextColor(Color.parseColor(getSetting.getActionBarColorBackground()));
            view.content.setTextColor(Color.parseColor(getSetting.getSummryTextColor()));





            if (getSetting.getIsSetComment()) {
                view.replayIcon.setVisibility(View.VISIBLE);
            } else {
                view.replayIcon.setVisibility(View.INVISIBLE);
            }


            convertView.setTag(view);


        } else
            view = (ViewHolder) convertView.getTag();


        view.author.setText(lst.get(position).getComment_author());

        view.date.setText(getSetting.date(lst.get(position).getComment_date()));

        view.content.setText(lst.get(position).getComment_content());


        int myparent;
        if (lst.get(position).getComment_parent() == 0) {
            view.replayContent.setVisibility(View.GONE);
            view.content.setText(lst.get(position).getComment_content());
            myparent = 0;
        } else {

            myparent = lst.get(position).getComment_parent();

            SqlSourceCnt db = new SqlSourceCnt(context);
            db.open();
            List<ObjComment> question = new ArrayList<>();
            question.addAll(db.GetComment(SqlBaseCnt.TBL_H_COMMENT_POST_ID + "='" + myparent + "'"));
            db.close();


            if (question.size() > 0) {

                String contentReplay = getWords(question.get(0).getComment_content());
                lst.get(position).replay = context.getResources().getString(R.string.ansTo) + " : " +
                        question.get(0).getComment_author() + "\n" + contentReplay;

                view.replayContent.setVisibility(View.VISIBLE);
                view.replayContent.setText(lst.get(position).replay);

            } else {

                lst.get(position).replay = context.getResources().getString(R.string.textRemoved) + "\n";

                view.replayContent.setVisibility(View.VISIBLE);
                view.replayContent.setText(lst.get(position).replay);
            }
        }


        view.replayIcon.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                if (Net.Is(context))
                    NewRepalyComment(lst.get(position).getComment_post_id(), position);


            }
        });


        return convertView;
    }

    private static class ViewHolder {
        TextView author, date, content, replayContent, replayIcon;
    }

    private String getWords(String Statement) {
        String str = "";

        String spt = " ";

        String[] split = Statement.split(spt);


        for (int i = 0; i < split.length; i++) {
            str += split[i] + " ";
            if (i == 5)
                return str + "...";
        }
        return str;
    }

    private void NewRepalyComment(final int postID, final int parent) {


        final int CommentParent = lst.get(parent).getComment_id();

        final Dialog sendComment = new Dialog(context);

        sendComment.requestWindowFeature(Window.FEATURE_NO_TITLE); //before
        sendComment.setContentView(R.layout.dlg_comment);
        sendComment.setCancelable(false);
        final Button send = (Button) sendComment.findViewById(R.id.button_comment_send);
        final Button cancel = (Button) sendComment.findViewById(R.id.button_comment_cancel);

        final EditText name = (EditText) sendComment.findViewById(R.id.editText_comment_dialog_name);
        TextInputLayout lName = (TextInputLayout) sendComment.findViewById(R.id.input_layout_name);
        final EditText email = (EditText) sendComment.findViewById(R.id.editText_comment_dialog_email);
        TextInputLayout lImail = (TextInputLayout) sendComment.findViewById(R.id.input_layout_email);
        final EditText message = (EditText) sendComment.findViewById(R.id.editText_comment_dialog_commentContent);
        TextInputLayout lMessage = (TextInputLayout) sendComment.findViewById(R.id.input_layout_textLongMessage);

        final TextView title = (TextView) sendComment.findViewById(R.id.textView_dlg_title);
        title.setText(context.getResources().getString(R.string.ansTo) + " : " + lst.get(parent).getComment_author());
        title.setTypeface(FontApp);

        sendComment.setTitle(": " + title);

        lName.setTypeface(FontApp);
        lImail.setTypeface(FontApp);
        lMessage.setTypeface(FontApp);


        send.setTypeface(FontApp);
        cancel.setTypeface(FontApp);

        name.setTypeface(FontApp);
        email.setTypeface(FontApp);
        message.setTypeface(FontApp);

        cancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                sendComment.dismiss();
            }
        });

        send.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String mName, mEmail, mMessage;
                mName = name.getText().toString();
                mEmail = email.getText().toString();
                mMessage = message.getText().toString();


                if (mName.length() < 3)
                    Toast.makeText(context, context.getResources().getString(R.string.incorrectName), Toast.LENGTH_SHORT).show();
                else if (!checkEmail(mEmail))
                    Toast.makeText(context, context.getResources().getString(R.string.incorrectEmail), Toast.LENGTH_SHORT).show();
                else if (mMessage.length() < 3)
                    Toast.makeText(context, context.getResources().getString(R.string.incorrectText), Toast.LENGTH_SHORT).show();

                String url = LinkMaker.sendCommentLINK(postID, mName, mEmail, "url", mMessage, CommentParent, 0, "", "");
                AsyncDataNet AsyncSendComment = new AsyncDataNet(context, url);
                AsyncSendComment.setonDone(new AsyncDataNet.onComplete() {
                    @Override
                    public void onDone(String result, int token) {
                        int mResult = 0;
                        try {
                            mResult = Parse.SendComment(result);
                        } catch (Exception e) {
                        }
                        if (mResult == 1)
                            Toast.makeText(context, context.getResources().getString(R.string.sendSuccessfully), Toast.LENGTH_SHORT).show();
                        else
                            Toast.makeText(context, context.getResources().getString(R.string.sendError), Toast.LENGTH_SHORT).show();
                    }

                    @Override
                    public void onError(Exception e, int token) {
                        Toast.makeText(context, context.getResources().getString(R.string.ErrorConnection), Toast.LENGTH_SHORT).show();
                    }
                });
                AsyncSendComment.execute();
                sendComment.dismiss();

            }
        });

        sendComment.show();
    }

    private boolean checkEmail(String email) {  // Email Verification
        int length = email.length();
        Log.i("0", "length" + length);
        if (length < 4)
            return false;
        else
            for (int i = 0; i < length; i++) {
                if (String.valueOf(email.charAt(i)).equals("@")) {
                    Log.i("0", "char" + i + " = " + email.charAt(i));
                    return true;
                }
            }
        return false;
    }


}
<file_sep>package ir.droidhub.mobilebazz.cntdb;

public class ObjPostCat {

    public int post_id;
    public int term_taxonomy_id;

    public ObjPostCat(int post_id, int term_taxonomy_id){

        this.post_id = post_id;
        this.term_taxonomy_id = term_taxonomy_id;
    }

   public int getPost_id(){return this.post_id;}
    public int getTerm_taxonomy_id(){return this.term_taxonomy_id;}

}
