@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;
  }
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    try {
      if (requestCode == NameConstant.REQUEST_CODE_BACK_FROM_SIGN_IN) {
        if (resultCode == RESULT_OK) {
          Helper.setDetailsInDrawerlayout(mDrawerRelativelayout, this);
        }
      }
      if (requestCode == NameConstant.REQUEST_CODE_ORDER_PLACED) {
        storyAdapter.notifyDataSetChanged();
      }
    } catch (Exception ex) {

    }
  }
  @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);
    }
    context = this;
    setContentView(R.layout.activity_enquiry_mail);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    Helper.setToolbarColor(this);
    user = User.getInstance(this);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setTitle("Enquiry");

    loadResources();
  }
 public void onSignInClick() {
   Helper.setOnSignInClickListner(this, mDrawerRelativelayout);
   mDrawerLayout.closeDrawer(mDrawerRelativelayout);
 }
  private void loadResources() {

    myTitle = (TextView) findViewById(R.id.mytitle);
    if (AppConfiguration.getInstance(this)
        .iconTheme
        .equalsIgnoreCase(NameConstant.ICON_THEME_LIGHT)) {
      myTitle.setTextColor(Color.WHITE);
    } else {
      myTitle.setTextColor(Color.BLACK);
    }
    cardview = (CardView) findViewById(R.id.cardview);
    progressBar = (ProgressBar) findViewById(R.id.progress_bar);
    storyAdapter = new StoryAdapter(stories, this);
    swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeRefreshLayout);
    swipeRefreshLayout.setOnRefreshListener(
        new SwipeRefreshLayout.OnRefreshListener() {
          @Override
          public void onRefresh() {
            loadCategory(currentCategory, 1, true, false);
          }
        });
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawer1MenuAdapter = new DrawerMenuAdapter(jsoncategories, context);
    // mDrawerRelativelayout = (RelativeLayout) findViewById(R.id.relative_left_drawer);
    // NetworkHelper.setDetailsInDrawerlayout(mDrawerRelativelayout, this);
    mDrawerRelativelayout = (RelativeLayout) findViewById(R.id.relative_left_drawer);
    mDrawerList = (RecyclerView) findViewById(R.id.left_drawer_list);
    mDrawerList.setLayoutManager(new LinearLayoutManager(context));
    mDrawerList.setAdapter(drawer1MenuAdapter);
    Helper.setDetailsInDrawerlayout(mDrawerRelativelayout, context);
    ((RelativeLayout) findViewById(R.id.upperBar))
        .setBackgroundColor(Color.parseColor(AppConfiguration.getInstance(this).bgcolor));
    // for second drawer with id itemsRecyclerView
    itemsRecyclerView = (RecyclerView) findViewById(R.id.itemsRecyclerView);
    linearLayoutManager = new LinearLayoutManager(this);
    itemsRecyclerView.setLayoutManager(linearLayoutManager);
    itemsRecyclerView.setAdapter(storyAdapter);
    itemsRecyclerView.setVisibility(View.VISIBLE);
    itemsRecyclerView.addOnScrollListener(
        new RecyclerView.OnScrollListener() {
          @Override
          public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            super.onScrolled(recyclerView, dx, dy);
            visibleItemCount = recyclerView.getChildCount();

            totalItemCount = linearLayoutManager.getItemCount();
            // firstVisibleItem =
            firstVisibleItem = linearLayoutManager.findFirstVisibleItemPosition();

            /*if (loading) {
                if (totalItemCount > previousTotal) {
                    loading = false;
                    previousTotal = totalItemCount;
                }
            }*/
            if (!isLoadingMoreData) {
              if ((totalItemCount - visibleItemCount) <= (firstVisibleItem + 1)
                  && totalItemCount > 0) {
                // End has been reached
                // Do something
                // startLoadMore();
                // current_page++;
                // loadCategory(currentCategory, current_page, false, true);
                // loading = true;
              }
            }
          }
        });
    drawer1MenuAdapter.setmyOnItemClickListener(
        new DrawerMenuAdapter.OnItemClickListener() {

          @Override
          public void onItemClick(View view, int position) {
            DrawerMenuAdapter.ViewHolder viewHolder = (DrawerMenuAdapter.ViewHolder) view.getTag();
            category = (Category) viewHolder.itemName.getTag();
            mDrawerLayout.closeDrawer(mDrawerRelativelayout);
            menuItemClicked(category);
          }
        });
    storyAdapter.setOnItemClickListener(
        new StoryAdapter.OnItemClickListener() {
          @Override
          public void OnItemCick(View view, int position) {
            openDetailPage(position);
          }
        });
  }