Пример #1
0
  /*
   * (non-Javadoc)
   *
   * @see android.app.Application#onCreate()
   */
  @Override
  public void onCreate() {
    Log.d(TAG, "In OnCreate");
    ACRA.init(this);

    iSelectedCity = -1;
    selectedCity = null;
    super.onCreate();
  }
Пример #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    BaseApp app = (BaseApp) getApplication();

    List<Object> modules = new ArrayList<>();
    addModules(modules);

    mActivityObjectGraph = app.getObjectGraph().plus(modules.toArray());
    if (isRequiringInject(getClass())) {
      mActivityObjectGraph.inject(this);
    }

    super.onCreate(savedInstanceState);

    if (savedInstanceState != null) {
      toRunWhenVisible = savedInstanceState.getParcelableArrayList(KEY_MESSAGE_LIST);
    }

    if (toRunWhenVisible == null) {
      toRunWhenVisible = new ArrayList<>();
    }
  }
Пример #3
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    defalut_sp = getSharedPreferences(BaseApp.config, Context.MODE_PRIVATE);

    WindowManager windowManager = getWindowManager();
    Display display = windowManager.getDefaultDisplay();
    DisplayMetrics metrics = new DisplayMetrics();
    display.getMetrics(metrics);
    Tools.M_SCREEN_WIDTH = metrics.widthPixels;
    Tools.M_SCREEN_HEIGHT = metrics.heightPixels;

    BaseApp.getInstance().addActivity(this);
    super.onCreate(savedInstanceState);
  }
Пример #4
0
  @Override
  public void run(String[] args) throws IOException {
    super.run(args);

    // Put into itemSet once all business_ids for some category (e.g. restaurant) from a file
    String businessFile = cmdLine.getOptionValue('b');
    String category = cmdLine.getOptionValue('c');

    if (itemSet.isEmpty()) {
      try {
        List<String> lines = FileUtils.readLines(new File(businessFile), "UTF-8");
        for (String line : lines) {
          Business business = gson.fromJson(line, Business.class);

          boolean isIn = false;
          for (String cate : business.categories) {
            if (category.equals(cate.toLowerCase())) {
              isIn = true;
              break;
            }
          }

          if (isIn) {
            if (!itemSet.contains(business.business_id)) {
              itemSet.add(business.business_id);
            }
          }
        }

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

    // Process data file and save result
    String dataFileName = cmdLine.getOptionValue('f');
    String result = processStream(dataFileName).toString();
    FileUtils.writeStringToFile(outFile, result, false);

    System.out.println("Processing is fininshed!");
  }
Пример #5
0
 public static void main(String[] args) throws IOException {
   BaseApp app = new YelpApp();
   app.run(args);
 }
Пример #6
0
  /*
   * (non-Javadoc)
   *
   * @see android.app.Application#onTerminate() clean up the timer on app end
   */
  @Override
  public void onTerminate() {

    super.onTerminate();
  }
Пример #7
0
 /*
  * (non-Javadoc)
  *
  * @see android.app.Application#onLowMemory()
  */
 @Override
 public void onLowMemory() {
   super.onLowMemory();
 }
Пример #8
0
 /** 回复当前界面的操作 */
 protected void onResume() {
   super.onResume();
   BaseApp.getInstance().resumeActivity(this);
 }
Пример #9
0
 @Override
 protected void onDestroy() {
   super.onDestroy();
   Tools.Log("BaseActivity�ر�");
   BaseApp.getInstance().finishActivity(this);
 }
Пример #10
0
 protected AbstractSimpleBlueService getSimpleBlueService() {
   BaseApp app = (BaseApp) getActivity().getApplication();
   return app.getSimpleBlueService();
 }