Android Open Source - ShareManager Share Utils






From Project

Back to project page ShareManager.

License

The source code is released under:

Copyright (c) 2013, Nelspike All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Red...

If you think the Android project ShareManager listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package share.manager.utils;
//  ww  w  .j a  v  a  2  s .  c o  m
import java.util.ArrayList;
import java.util.List;

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

public class ShareUtils {

  public static String createChartLink(int initMonth, int initDay,
      int initYear, int finalMonth, int finalDay, int finalYear, char period,
      String company) {

    return "a=" + initMonth + "&b=" + initDay + "&c=" + initYear + "&d="
        + finalMonth + "&e=" + finalDay + "&f=" + finalYear + "&g=" + period
        + "&s=" + company;
  }

  public static String buildSearchLink(String query) {
    return "http://d.yimg.com/autoc.finance.yahoo.com/autoc?query=" + query
        + "&callback=YAHOO.Finance.SymbolSuggest.ssCallback";
  }

  public static JSONArray remove(final int idx, final JSONArray from) {
    final List<JSONObject> objs = asList(from);
    objs.remove(idx);

    final JSONArray ja = new JSONArray();
    for (final JSONObject obj : objs) {
      ja.put(obj);
    }

    return ja;
  }

  public static List<JSONObject> asList(final JSONArray ja) {
    final int len = ja.length();
    final ArrayList<JSONObject> result = new ArrayList<JSONObject>(len);
    for (int i = 0; i < len; i++) {
      final JSONObject obj = ja.optJSONObject(i);
      if (obj != null) {
        result.add(obj);
      }
    }
    return result;
  }
}




Java Source Code List

share.manager.adapters.CompanyAdapter.java
share.manager.adapters.DialogAdapter.java
share.manager.adapters.MainPagerAdapter.java
share.manager.adapters.SharesAdapter.java
share.manager.connection.ConnectionRunnable.java
share.manager.connection.ConnectionThread.java
share.manager.fragments.MineFragment.java
share.manager.fragments.PortfolioFragment.java
share.manager.fragments.SharesFragment.java
share.manager.listeners.ShareTabListener.java
share.manager.listeners.SwipeListener.java
share.manager.stock.CompanyActivity.java
share.manager.stock.MainActivity.java
share.manager.stock.ResultsActivity.java
share.manager.stock.SettingsActivity.java
share.manager.stock.ShareManager.java
share.manager.utils.CompanyGraphicsBuilder.java
share.manager.utils.FileHandler.java
share.manager.utils.GraphType.java
share.manager.utils.RESTFunction.java
share.manager.utils.ShareUtils.java
share.manager.utils.SharesGraphicsBuilder.java