コード例 #1
0
 private String getCategoryStoryURL(Category category, int page) {
   if (category.name.equalsIgnoreCase("home")) {
     return NameConstant.BASE_API_URL_V1
         + "getStoriesByCategory.php?categoryId=all&APIKey="
         + AppConfiguration.getInstance(context).websiteKey
         + "&page="
         + page;
   }
   return NameConstant.BASE_API_URL_V1
       + "getStoriesByCategory.php?categoryId="
       + category.categoryId
       + "&APIKey="
       + AppConfiguration.getInstance(context).websiteKey
       + "&page="
       + page;
 }
コード例 #2
0
  public void loadMenu() {
    String url =
        NameConstant.BASE_API_URL_V1
            + "getCategoriesByApiKey.php?APIKey="
            + AppConfiguration.getInstance(context).websiteKey;
    MyRequestQueue.Instance(this).cancelPendingRequests("menu");
    new VolleyData(this) {
      @Override
      protected void VPreExecute() {
        progressBar.setVisibility(View.VISIBLE);
        itemsRecyclerView.setVisibility(View.GONE);
      }

      @Override
      protected void VResponse(JSONObject response, String tag) {
        JSONObject json = response;
        progressBar.setVisibility(View.GONE);
        itemsRecyclerView.setVisibility(View.VISIBLE);
        try {
          if (json != null) {
            try {
              JSONArray jsonCategories = json.getJSONArray("categories");
              drawer1MenuAdapter.clear();
              ArrayList<Category> menuCategories = new ArrayList<Category>();
              if (getPackageName().equalsIgnoreCase("com.applop.vidhrra")) {
                menuCategories.add(new Category("", "Pune", "home"));
              } else {
                menuCategories.add(new Category("", "Home", "home"));
              }

              if (getPackageName().equalsIgnoreCase("com.applop")) {
                menuCategories.add(new Category("", "Make App Now", "enquiry"));
              } else {
                if (!getPackageName().equalsIgnoreCase("com.applop.meeaagiapp"))
                  menuCategories.add(new Category("", "enquiry", "enquiry"));
              }

              for (int i = 0; i < jsonCategories.length(); i++) {
                menuCategories.add(new Category(jsonCategories.getJSONObject(i)));
              }
              // for getting story on home page.........only first line
              loadCategory(menuCategories.get(0), 1, false, false);
              drawer1MenuAdapter.insertCategories(menuCategories);
            } catch (Exception e) {
            }
          }
        } catch (Exception e) {
        }
      }

      @Override
      protected void VError(VolleyError error, String tag) {
        progressBar.setVisibility(View.GONE);
        itemsRecyclerView.setVisibility(View.VISIBLE);
      }
    }.getJsonObject(url, true, "menu", this);
    ;
  }
コード例 #3
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_home, menu);

    if (AppConfiguration.getInstance(this)
        .iconTheme
        .equalsIgnoreCase(NameConstant.ICON_THEME_LIGHT)) {
      IconDrawable bookIcon =
          new IconDrawable(context, Iconify.IconValue.fa_shopping_cart)
              .colorRes(R.color.white)
              .actionBarSize();
      menu.findItem(R.id.action_cart).setIcon(bookIcon);
    } else {
      IconDrawable bookIcon =
          new IconDrawable(context, Iconify.IconValue.fa_shopping_cart)
              .colorRes(R.color.black)
              .actionBarSize();
      menu.findItem(R.id.action_cart).setIcon(bookIcon);
    }
    if (AppConfiguration.getInstance(this).isCartEnable) {
      menu.findItem(R.id.action_cart).setVisible(true);
      menu.findItem(R.id.action_your_order).setVisible(true);
      menu.findItem(R.id.action_your_booking).setVisible(false);
    } else {
      menu.findItem(R.id.action_cart).setVisible(false);
      menu.findItem(R.id.action_your_order).setVisible(false);
      if (AppConfiguration.getInstance(this).isBookingEnable) {
        menu.findItem(R.id.action_your_booking).setVisible(true);
      } else {
        menu.findItem(R.id.action_your_booking).setVisible(false);
      }
    }

    return true;
  }
コード例 #4
0
  @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;
  }
コード例 #5
0
  @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();
  }
コード例 #6
0
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   int id = item.getItemId();
   switch (id) {
     case R.id.action_aboutUs:
       Intent aboutUs = new Intent(this, AboutUsActivity.class);
       startActivity(aboutUs);
       break;
     case R.id.action_your_order:
       Intent yourorder = new Intent(this, YourOrderActivity.class);
       startActivity(yourorder);
       break;
     case R.id.action_your_booking:
       Intent yourbooking = new Intent(this, YourBookingActivity.class);
       startActivity(yourbooking);
       break;
     case R.id.action_contactUs:
       Intent contactUs = new Intent(this, ContactUsActivity.class);
       startActivity(contactUs);
       break;
     case R.id.action_feedback:
       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,
           "Feedback For " + getResources().getString(R.string.app_name) + " android application");
       Helper.MobileInfo mobileInfo = new Helper.MobileInfo(context);
       Email.putExtra(
           Intent.EXTRA_TEXT,
           "\tDevice Info :\n\tModel Name : "
               + mobileInfo.getMobileName()
               + "\n\tAndroid OS Version : "
               + mobileInfo.getMobileOs()
               + "\n\tMobile Resolution : "
               + mobileInfo.getMobileResolution()
               + "\n\tManufacturer : "
               + mobileInfo.getManufacturer()
               + "\n\tApplication Version : "
               + mobileInfo.getappVersionName()
               + "\n\n");
       startActivity(Intent.createChooser(Email, "Send Feedback:"));
       break;
     case R.id.action_rateUs:
       Uri uri = Uri.parse("market://details?id=" + context.getPackageName());
       Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);
       goToMarket.addFlags(
           Intent.FLAG_ACTIVITY_NO_HISTORY
               | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
               | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
       try {
         startActivity(goToMarket);
       } catch (ActivityNotFoundException e) {
         startActivity(
             new Intent(
                 Intent.ACTION_VIEW,
                 Uri.parse(
                     "http://play.google.com/store/apps/details?id=" + context.getPackageName())));
       }
       break;
     case R.id.action_shareApp:
       String appLink =
           getResources().getString(R.string.app_name)
               + " android application: "
               + getResources().getString(R.string.app_name)
               + "\n http://play.google.com/store/apps/details?id="
               + getPackageName();
       Intent sendintent = new Intent();
       sendintent.setAction(Intent.ACTION_SEND);
       sendintent.putExtra(Intent.EXTRA_TEXT, appLink);
       sendintent.setType("text/plain");
       startActivity(sendintent);
       break;
     case R.id.action_cart:
       Intent intent = new Intent(this, CartActivity.class);
       startActivityForResult(intent, NameConstant.REQUEST_CODE_ORDER_PLACED);
       break;
   }
   return super.onOptionsItemSelected(item);
 }
コード例 #7
0
  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);
          }
        });
  }
コード例 #8
0
  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);
  }