public void init(Context context) {
   try {
     if (!ImageLoader.getInstance().isInited()) { // 未初始化则初始化
       // 默认缓存路径
       String cache_path = "";
       cache_path += PreferencesUtils.getString(context, "sys_path_sd_card");
       cache_path += PreferencesUtils.getString(context, "sys_path_app_folder");
       cache_path += PreferencesUtils.getString(context, "sys_path_cache");
       File cache = new File(cache_path);
       if (!cache.exists()) cache.mkdirs();
       // --
       ImageLoaderConfiguration.Builder config_builder =
           new ImageLoaderConfiguration.Builder(context);
       config_builder.threadPoolSize(3);
       config_builder.diskCacheSize(700 * 1024 * 1024);
       config_builder.diskCache(new UnlimitedDiscCache(cache));
       config_builder.diskCacheFileNameGenerator(new Md5FileNameGenerator());
       config_builder.tasksProcessingOrder(QueueProcessingType.FIFO);
       config_builder.imageDownloader(new BaseImageDownloader(context, 5 * 1000, 30 * 1000));
       // config_builder.writeDebugLogs();
       // --
       // ImageLoader.getInstance().destroy();
       ImageLoader.getInstance().init(config_builder.build());
     }
   } catch (Exception e) {
   }
 }
Example #2
0
 private void f_action_logo_animation_end() {
   if (PreferencesUtils.getBoolean(this, "is_first_launch", true)) {
     f_action_to_activity_description();
   } else {
     if (!utils_common_tools.get_network_status(this)) {
       // ûÓÐÍøÂç,ÀëÏߵǼ
       String user_id = PreferencesUtils.getString(this, "user_id");
       String user_type = PreferencesUtils.getString(this, "user_type");
       String user_name = PreferencesUtils.getString(this, "user_name");
       String user_password = PreferencesUtils.getString(this, "user_password");
       if (user_id != null
           && user_id.length() > 0
           && user_type != null
           && user_type.length() > 0
           && user_name != null
           && user_name.length() > 0
           && user_password != null
           && user_password.length() > 0) {
         Intent intent = new Intent();
         intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
         intent.setClass(this, ActivityMain.class);
         startActivity(intent);
         finish();
       } else {
         f_action_to_auto_login();
       }
     } else {
       f_action_to_auto_login();
     }
   }
 }
Example #3
0
 private void f_action_to_auto_login() {
   try {
     app_user_login_req = new interface_app_user_login_req();
     app_user_login_req.setUser_name(PreferencesUtils.getString(this, "user_name"));
     app_user_login_req.setUser_password(PreferencesUtils.getString(this, "user_password"));
     app_user_login_req.setLogin_code(tools.get_phone_imei(this));
     new thread_common_system_user_login(handler, app_user_login_req).start();
   } catch (Exception e) {
     // TODO: handle exception
   }
 }
Example #4
0
  private void f_action_auto_login_success(
      interface_app_user_login_resp resp, interface_app_user_login_req req) {
    try {
      PreferencesUtils.putString(this, "user_id", resp.getUser_id());
      PreferencesUtils.putString(this, "user_icon", resp.getUser_icon());
      PreferencesUtils.putString(this, "user_type", resp.getUser_type());
      PreferencesUtils.putString(this, "user_name", req.getUser_name());
      PreferencesUtils.putString(this, "user_password", req.getUser_password());
      // --
      Intent intent = new Intent();

      intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
      intent.setClass(this, ActivityMain.class);
      startActivity(intent);
      finish();
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
 // 从网上或者缓存获取动态列表
 private void f_action_get_news_list() {
   try {
     page_number = page_number == 0 ? 1 : page_number;
     System.out.println("从网上或者缓存获取动态列表" + page_number);
     get_news_req = new interface_app_get_news_req();
     get_news_req.setUser_id(PreferencesUtils.getString(getActivity(), "user_id"));
     get_news_req.setPage_number(page_number);
     // --
     new thread_interaction_get_news_list(network_handler, get_news_req).start();
   } catch (Exception e) {
     // TODO: handle exception
   }
 }
Example #6
0
  private void init_folder_env() {
    try {

      String sd_path = tools.get_application_dir_path(this);
      PreferencesUtils.putString(this, global_contants.SYS_PATH_SD_CARD, sd_path);
      PreferencesUtils.putString(this, global_contants.SYS_PATH_APP_FOLDER, "/Lovebabies");
      PreferencesUtils.putString(this, global_contants.SYS_PATH_CACHE, "/cache");
      PreferencesUtils.putString(this, global_contants.SYS_PATH_TEMP, "/temp");
      PreferencesUtils.putString(this, global_contants.SYS_PATH_CRASH, "/crash");
      PreferencesUtils.putString(this, global_contants.SYS_PATH_UP, "/up");
      // --
      String app_path =
          PreferencesUtils.getString(this, global_contants.SYS_PATH_SD_CARD)
              + PreferencesUtils.getString(this, "sys_path_app_folder");
      String cache_path =
          app_path + PreferencesUtils.getString(this, global_contants.SYS_PATH_CACHE);
      String temp_path = app_path + PreferencesUtils.getString(this, global_contants.SYS_PATH_TEMP);
      String crash_path =
          app_path + PreferencesUtils.getString(this, global_contants.SYS_PATH_CRASH);
      String up_path = app_path + PreferencesUtils.getString(this, global_contants.SYS_PATH_UP);
      // --
      File folder_root = new File(app_path);
      if (!folder_root.exists()) {
        folder_root.mkdirs();
      }
      // --
      File folder_cache = new File(cache_path);
      if (!folder_cache.exists()) {
        folder_cache.mkdirs();
      }
      // --
      File folder_temp = new File(temp_path);
      if (!folder_temp.exists()) {
        folder_temp.mkdirs();
      }
      // --
      File folder_crash = new File(crash_path);
      if (!folder_crash.exists()) {
        folder_crash.mkdirs();
      }
      // --
      File up_crash = new File(up_path);
      if (!up_crash.exists()) {
        up_crash.mkdirs();
      }
    } catch (Exception e) {
      // TODO: handle exception
    }
  }