@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (AppConfiguration.getInstance(this)
        .iconTheme
        .equalsIgnoreCase(NameConstant.ICON_THEME_LIGHT)) {
      setTheme(R.style.AppTheme);
    } else {
      setTheme(R.style.AppThemeLight);
    }
    setContentView(R.layout.activity_drawer);

    context = this;
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    if (getPackageName().equalsIgnoreCase("com.applop")) {
      if (User.getInstance(this).loginType.equalsIgnoreCase("")) {
        Intent intent = new Intent(context, SignInActivity.class);
        startActivityForResult(intent, NameConstant.REQUEST_CODE_BACK_FROM_SIGN_IN);
      }
    }
    Helper.setToolbarColor(this);
    storyAdapter = new StoryAdapter(stories, this);
    loadResources();
    setSideDrawer();
    try {
      String categoryName = "Application";
      String label = "Opened";
      String action = "Opened";
      AnalyticsHelper.trackEvent(categoryName, action, label, this);
    } catch (Exception e) {
      e.printStackTrace();
    }
    try {
      String pageviews = "Home Page";
      AnalyticsHelper.trackPageView(pageviews, this);
    } catch (Exception e) {
      e.printStackTrace();
    }
    setads();
    // show alert if exist
    String alertMessage = getIntent().getStringExtra("alert_message");
    if (alertMessage != null)
      if (!alertMessage.equalsIgnoreCase("")) Helper.showAlertFeedNotification(this, alertMessage);
    return;
  }
  // for loading page on click of button in navigation drawer list
  public void loadCategory(
      Category category, final int page, boolean isRefreshing, final boolean isLoadingMore) {
    if (category == null) {
      itemsRecyclerView.setVisibility(View.INVISIBLE);
      return;
    }
    try {
      String pageviews =
          "Category Page with Category(" + category.categoryId + ") : " + category.name;
      AnalyticsHelper.trackPageView(pageviews, this);
    } catch (Exception e) {
      e.printStackTrace();
    }
    try {
      String categoryName = "Category";
      String label = "Opened";
      String action = "Category(" + category.categoryId + ") : " + category.name;
      AnalyticsHelper.trackEvent(categoryName, action, label, this);
    } catch (Exception e) {
      e.printStackTrace();
    }
    myTitle.setText(category.name);
    currentCategory = category;
    current_page = page;
    final Context context = this;
    String URL = getCategoryStoryURL(category, page); // 1
    MyRequestQueue.Instance(this).cancelPendingRequests("stories");
    new VolleyData(this) {

      @Override
      protected void VPreExecute() {
        if (!isLoadingMore) {
          progressBar.setVisibility(View.VISIBLE);
          itemsRecyclerView.setVisibility(View.GONE);
          storyAdapter.clear();
          storyAdapter.notifyDataSetChanged();
        }
      }

      @Override
      protected void VResponse(JSONObject response, String tag) {
        swipeRefreshLayout.setRefreshing(false);
        endLoadMore();
        JSONObject json = response;
        try {
          if (json != null) {
            try {
              progressBar.setVisibility(View.GONE);
              JSONArray jsonStories = json.getJSONArray("stories");

              ArrayList<Story> stories = new ArrayList<Story>();
              for (int i = 0; i < jsonStories.length(); i++) {
                Story story = new Story(context, jsonStories.getJSONObject(i));
                // if (!IsStoryAlreadyAdded(story)){
                stories.add(story);
                // }
              }
              itemsRecyclerView.setAdapter(storyAdapter);
              itemsRecyclerView.setVisibility(View.VISIBLE);
              storyAdapter.insertStories(stories);
            } catch (Exception e) {
              Toast.makeText(getApplicationContext(), "" + e, Toast.LENGTH_LONG).show();
            }
          }
        } catch (Exception e) {
          Toast.makeText(getApplicationContext(), "" + e, Toast.LENGTH_LONG).show();
        }
      }

      @Override
      protected void VError(VolleyError error, String tag) {
        swipeRefreshLayout.setRefreshing(false);
        endLoadMore();
        progressBar.setVisibility(View.GONE);
        itemsRecyclerView.setVisibility(View.VISIBLE);
      }
    }.getJsonObject(URL, true, "stories", this);
  }
  public void sendMail(View v) {
    try {
      String categoryName = "Product";
      String action = "/Product (" + item.postId + ")" + ": " + item.title;
      String label = "Enquired";
      AnalyticsHelper.trackEvent(categoryName, action, label, this);
    } catch (Exception e) {
      e.printStackTrace();
    }
    if (name.getText().toString().equalsIgnoreCase("")) {
      Toast.makeText(this, "Please enter your name", Toast.LENGTH_LONG).show();
      return;
    }
    if (number.getText().toString().equalsIgnoreCase("")) {
      Toast.makeText(this, "Please enter your phone number", Toast.LENGTH_LONG).show();
      return;
    }
    if (number.getText().toString().length() != 10) {
      Toast.makeText(this, "Please enter 10 digit phone number", Toast.LENGTH_LONG).show();
      return;
    }
    if (message.getText().toString().equalsIgnoreCase("")) {
      Toast.makeText(this, "Please enter your message", Toast.LENGTH_LONG).show();
      return;
    }
    if (item == null) {
      Toast.makeText(this, "Error Please Try Again", Toast.LENGTH_LONG).show();
      return;
    }
    Intent Email = new Intent(Intent.ACTION_SEND);
    Email.setType("text/email");
    Email.putExtra(Intent.EXTRA_EMAIL, new String[] {AppConfiguration.getInstance(this).email});
    Email.putExtra(Intent.EXTRA_SUBJECT, "Enquiry For : " + item.title);
    Email.putExtra(
        Intent.EXTRA_TEXT,
        "Name : "
            + name.getText().toString()
            + "\n\nAddress : "
            + address.getText().toString()
            + "\n\nPhone no. : "
            + number.getText().toString()
            + "\n\nMessage : "
            + message.getText().toString());
    // startActivity(Intent.createChooser(Email, "Send enquiry_icon:"));
    final HashMap<String, String> params = new HashMap<String, String>();
    if (user.loginType.equalsIgnoreCase("")) {
      Intent intent = new Intent(this, SignInActivity.class);
      startActivityForResult(intent, NameConstant.REQUEST_CODE_BACK_FROM_SIGN_IN);
      return;
    }
    params.put("email", user.email);
    params.put("name", user.name);
    params.put("address", address.getText().toString());
    params.put("phoneNumber", number.getText().toString());
    params.put("packageName", getPackageName());
    params.put("photoLink", user.imageUrl);
    User.setUser(
        this,
        user.email,
        user.name,
        user.loginType,
        user.bitmap,
        user.imageUrl,
        address.getText().toString(),
        number.getText().toString(),
        "",
        "");
    final ProgressDialog progressDialog = new ProgressDialog(context);
    new VolleyData(this) {
      @Override
      protected void VPreExecute() {
        progressDialog.setTitle("Sending");
        progressDialog.show();
      }

      @Override
      protected void VResponse(JSONObject response, String tag) {
        final HashMap<String, String> paramsBooking = new HashMap<String, String>();
        paramsBooking.put("userEmail", user.email);
        paramsBooking.put("packageName", getPackageName());
        paramsBooking.put("storyId", item.postId);
        paramsBooking.put("msg", message.getText().toString());
        new VolleyData(context) {
          @Override
          protected void VPreExecute() {}

          @Override
          protected void VResponse(JSONObject response, String tag) {
            progressDialog.hide();
            try {
              if (response.getBoolean("status")) {
                Toast.makeText(EnquiryMailActivity.this, "Enquired Successfully", Toast.LENGTH_LONG)
                    .show();
                onBackPressed();
              } else {
                Toast.makeText(
                        EnquiryMailActivity.this, "Error : Please try again", Toast.LENGTH_LONG)
                    .show();
              }
            } catch (Exception ex) {
              Toast.makeText(
                      EnquiryMailActivity.this, "Error : Please try again", Toast.LENGTH_LONG)
                  .show();
            }
          }

          @Override
          protected void VError(VolleyError error, String tag) {
            progressDialog.hide();
            Toast.makeText(EnquiryMailActivity.this, "Error : Please try again", Toast.LENGTH_LONG)
                .show();
          }
        }.getPOSTJsonObject(
            "http://applop.biz/merchant/api/submitEnquiry.php", "post_user", paramsBooking);
      }

      @Override
      protected void VError(VolleyError error, String tag) {
        progressDialog.hide();
      }
    }.getPOSTJsonObject("http://applop.biz/merchant/api/submitUserTable.php", "post_user", params);
  }