Exemplo n.º 1
0
 public void Special__gen(Xow_wiki wikii, Xoa_page pagei, Xoa_url url, Xoa_ttl ttl) {
   Xowe_wiki wiki = (Xowe_wiki) wikii;
   Xoae_page page = (Xoae_page) pagei;
   Xoa_app app = wiki.App();
   Dbui_tbl_itm__bmk ui_tbl =
       Dbui_tbl_itm__bmk.get_or_new(app, app.User().User_db_mgr().Bmk_mgr().Tbl__itm());
   page.Html_data().Head_mgr().Itm__dbui().Init(app).Enabled_y_();
   Bry_bfr bfr = wiki.Utl__bfr_mkr().Get_m001();
   ui_tbl.Select(bfr, Xoud_bmk_mgr.Owner_root);
   page.Db().Html().Html_bry_(bfr.To_bry_and_rls());
 }
Exemplo n.º 2
0
  @Override
  public Xobc_xodir_dir[] Get_dirs(Xoa_app app) {
    Ordered_hash hash = Ordered_hash_.New();

    // add default app dir
    String default_data_dir = context.getApplicationInfo().dataDir + "/";
    String selected =
        app.User()
            .User_db_mgr()
            .Cfg()
            .Get_app_str_or(Xobc_xodir_cfg.Key__selected_dir, default_data_dir);
    Xobc_xodir_dir itm =
        new Xobc_xodir_dir(
            String_.Eq(selected, default_data_dir), false, Bry_.new_u8(default_data_dir));
    hash.Add(default_data_dir, itm);

    // add "guessed" external dirs
    Sdcard_detection_strategy[] strategy_ary =
        new Sdcard_detection_strategy[] {
          new Strategy__storage_dir(-1),
          new Strategy__envvar__external_storage(-1),
          new Strategy__envvar__secondary_storage(
              -1) // NOTE: needed for BLU-STUDIO C 5+5 LTE; DATE: 2016-06-28
        };
    int len = strategy_ary.length;
    String root_rhs = Sdcard_detection_mgr.Get_root_rhs() + "/";
    for (int i = 0; i < len; ++i) {
      Sdcard_detection_strategy strategy = strategy_ary[i];
      String[] dir_strs = strategy.Get_dirs(context);
      for (String dir_str : dir_strs) {
        if (dir_str == null) continue;
        dir_str += root_rhs;
        if (hash.Has(dir_str)) continue;
        File dir = new File(dir_str);
        if (!dir.exists())
          continue; // dir doesn't exist; don't bother trying to create b/c permission won't be
                    // available at 4.4+
        if (!Sdcard_detection_mgr.Dir_is_writeable(dir)) continue;
        itm = new Xobc_xodir_dir(String_.Eq(selected, dir_str), false, Bry_.new_u8(dir_str));
        hash.Add(dir_str, itm);
      }
    }

    // add custom dir
    String custom =
        app.User()
            .User_db_mgr()
            .Cfg()
            .Get_app_str_or(Xobc_xodir_cfg.Key__custom_dir, "(choose your own folder)");
    itm = new Xobc_xodir_dir(String_.Eq(selected, custom), true, Bry_.new_u8(custom));
    hash.Add(custom, itm);
    return (Xobc_xodir_dir[]) hash.To_ary(Xobc_xodir_dir.class);
  }
Exemplo n.º 3
0
  public void Evt_lang_changed(Xol_lang_itm lang) {
    // add special pages by old manual method; DEPRECATED
    hash.Clear();
    hash.Add_str_obj(Xow_special_meta_.Ttl__search, page_search);
    hash.Add_str_obj(Xow_special_meta_.Ttl__all_pages, page_allpages);
    hash.Add_str_obj("prefixindex", page_allpages);
    hash.Add_bry_obj(Xou_history_mgr.Ttl_name, page_history);
    hash.Add_str_obj(Xow_special_meta_.Ttl__page_history, page_history2);
    hash.Add_str_obj(Xow_special_meta_.Ttl__nearby, page_nearby);
    hash.Add_str_obj(Xow_special_meta_.Ttl__my_language, page_mylanguage);
    hash.Add_str_obj(Xow_special_meta_.Ttl__item_by_title, page_itemByTitle);
    hash.Add_str_obj(Xow_special_meta_.Ttl__statistics, page_statistics);
    hash.Add_str_obj(Xow_special_meta_.Ttl__move_page, page_movePage);
    hash.Add_str_obj(Xow_special_meta_.Ttl__system_data, page_system_data);
    hash.Add_str_obj(Xow_special_meta_.Ttl__default_tab, page_default_tab);
    hash.Add_str_obj(Xow_special_meta_.Ttl__popup_history, page_popup_history);
    hash.Add_str_obj(Xow_special_meta_.Ttl__bookmarks, page_bmk);
    hash.Add_str_obj(Xow_special_meta_.Ttl__diag, page_diag);

    // add app's Special_regy to hash table; needed for case insensitivity by wiki's lang; EX:
    // Special:rANDom; NOTE: needs to go before lang aliases
    Xoa_special_regy special_regy = app.Special_regy();
    int len = special_regy.Len();
    for (int i = 0; i < len; ++i) {
      Xow_special_page proto = special_regy.Get_at(i);
      Xow_special_meta proto_meta = proto.Special__meta();
      hash.Add_if_dupe_use_1st(proto_meta.Key_bry(), proto);
      for (byte[] alias : proto_meta.Aliases()) hash.Add_if_dupe_use_1st(alias, proto);
    }

    // add lang's special aliases to hash table; EX: Special:Recherche
    Xol_specials_mgr lang_mgr = lang.Specials_mgr();
    len = lang_mgr.Len();
    for (int i = 0; i < len; ++i) {
      Xol_specials_itm lang_itm = lang_mgr.Get_at(i);
      Xow_special_page page = (Xow_special_page) hash.Get_by_bry(lang_itm.Special());
      if (page == null)
        continue; // NOTE: ignore specials that are not in XOWA; EX: Special:ChangeEmail
      for (byte[] alias : lang_itm.Aliases()) hash.Add_if_dupe_use_1st(alias, page);
    }
  }
Exemplo n.º 4
0
 private void Core_db__assert() {
   if (core_db == null) core_db = new Site_core_db(app.Fsys_mgr().Cfg_site_meta_fil());
 }