• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java RTToolbar类的典型用法和代码示例

java 3次浏览

本文整理汇总了Java中com.onegravity.rteditor.RTToolbar的典型用法代码示例。如果您正苦于以下问题:Java RTToolbar类的具体用法?Java RTToolbar怎么用?Java RTToolbar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

RTToolbar类属于com.onegravity.rteditor包,在下文中一共展示了RTToolbar类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onCreate

点赞 2

import com.onegravity.rteditor.RTToolbar; //导入依赖的package包/类
@Override
public void onCreate(Bundle bundle){
    super.onCreate(bundle);

    // required by RTEditor, if removed, activity will not be able to start
    // MUST be placed before setContentView
    setTheme(R.style.RTE_ThemeLight);

    setContentView(R.layout.activity_edit);

    // create RTManager
    RTApi rtApi = new RTApi(this, new RTProxyImpl(this), new RTMediaFactoryImpl(this, true));
    rtManager = new RTManager(rtApi, bundle);

    // register toolbar
    ViewGroup toolbarContainer = (ViewGroup) findViewById(R.id.rte_toolbar_container);
    RTToolbar rtToolbar = (RTToolbar) findViewById(R.id.rte_toolbar);
    if (rtToolbar != null) {
        rtManager.registerToolbar(toolbarContainer, rtToolbar);
    }

    // register editor & set text
    rtEditText = (RTEditText) findViewById(R.id.rtEditText);
    rtManager.registerEditor(rtEditText, true);
    rtEditText.setRichTextEditing(true, getHtmlContent());

    // title bar
    etSubject = (EditText) findViewById(R.id.subject);

        // version check for the deprecation of Html.fromHtml
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
        etSubject.setText(Html.fromHtml(getSubject(), Html.FROM_HTML_MODE_LEGACY));
    } else {
        etSubject.setText(Html.fromHtml(getSubject()));
    }

    etSubject.setHint(getSubjectHint()); /*abs*/

    // action bar
    actionBar = getSupportActionBar();
    if(actionBar != null) {
        actionBar.setTitle(R.string.title_activity_edit);
        // setDisplayHomeAsUpEnabled(true) enables the back arrow button on the ActionBar
        actionBar.setDisplayHomeAsUpEnabled(true);
    } else {
        log("actionBar is null!");
    }

}
 

开发者ID:thenewpotato,
项目名称:Blogg,
代码行数:50,
代码来源:BaseEditActivity.java

示例2: onCreate

点赞 2

import com.onegravity.rteditor.RTToolbar; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    // read parameters
    String subject = null;
    String message = null;
    String signature = null;
    if (savedInstanceState == null) {
        Intent intent = getIntent();
        subject = getStringExtra(intent, PARAM_SUBJECT);
        message = getStringExtra(intent, PARAM_MESSAGE);
        signature = getStringExtra(intent, PARAM_SIGNATURE);
        mUseDarkTheme = intent.getBooleanExtra(PARAM_DARK_THEME, false);
        mSplitToolbar = intent.getBooleanExtra(PARAM_SPLIT_TOOLBAR, false);
    } else {
        subject = savedInstanceState.getString(PARAM_SUBJECT, "");
        mUseDarkTheme = savedInstanceState.getBoolean(PARAM_DARK_THEME, false);
        mSplitToolbar = savedInstanceState.getBoolean(PARAM_SPLIT_TOOLBAR, false);
    }

    // set theme
    setTheme(mUseDarkTheme ? R.style.ThemeDark : R.style.ThemeLight);

    super.onCreate(savedInstanceState);

    // set layout
    setContentView(mSplitToolbar ? R.layout.rte_demo_2 : R.layout.rte_demo_1);

    setTitle(R.string.title_activity);

    // initialize rich text manager
    RTApi rtApi = new RTApi(this, new RTProxyImpl(this), new RTMediaFactoryImpl(this, true));
    mRTManager = new RTManager(rtApi, savedInstanceState);

    ViewGroup toolbarContainer = (ViewGroup) findViewById(R.id.rte_toolbar_container);

    // register toolbar 0 (if it exists)
    RTToolbar rtToolbar0 = (RTToolbar) findViewById(R.id.rte_toolbar);
    if (rtToolbar0 != null) {
        mRTManager.registerToolbar(toolbarContainer, rtToolbar0);
    }

    // register toolbar 1 (if it exists)
    RTToolbar rtToolbar1 = (RTToolbar) findViewById(R.id.rte_toolbar_character);
    if (rtToolbar1 != null) {
        mRTManager.registerToolbar(toolbarContainer, rtToolbar1);
    }

    // register toolbar 2 (if it exists)
    RTToolbar rtToolbar2 = (RTToolbar) findViewById(R.id.rte_toolbar_paragraph);
    if (rtToolbar2 != null) {
        mRTManager.registerToolbar(toolbarContainer, rtToolbar2);
    }

    // set subject
    mSubjectField = (EditText) findViewById(R.id.subject);
    mSubjectField.setText(subject);

    // register message editor
    mRTMessageField = (RTEditText) findViewById(R.id.rtEditText_1);
    mRTManager.registerEditor(mRTMessageField, true);
    if (message != null) {
        mRTMessageField.setRichTextEditing(true, message);
    }

    // register signature editor
    mRTSignatureField = (RTEditText) findViewById(R.id.rtEditText_2);
    mRTManager.registerEditor(mRTSignatureField, true);
    if (signature != null) {
        mRTSignatureField.setRichTextEditing(true, signature);
    }

    mRTMessageField.requestFocus();
}
 

开发者ID:Ronak-LM,
项目名称:memoir,
代码行数:74,
代码来源:RTEditorActivity.java

示例3: onCreateView

点赞 2

import com.onegravity.rteditor.RTToolbar; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Bundle args = getArguments();
    String subject = args.getString("subject");
    String message = args.getString("message");
    String signature = args.getString("signature");
    boolean splitToolbar = args.getBoolean("splitToolbar");

    View view = inflater.inflate(splitToolbar ? R.layout.rte_demo_2 : R.layout.rte_demo_1, null);

    // create RTManager
    RTApi rtApi = new RTApi(getActivity(), new RTProxyImpl(getActivity()), new RTMediaFactoryImpl(getActivity(), true));
    mRTManager = new RTManager(rtApi, savedInstanceState);

    ViewGroup toolbarContainer = (ViewGroup) view.findViewById(R.id.rte_toolbar_container);

    // register toolbar 0 (if it exists)
    RTToolbar rtToolbar0 = (RTToolbar) view.findViewById(R.id.rte_toolbar);
    if (rtToolbar0 != null) {
        mRTManager.registerToolbar(toolbarContainer, rtToolbar0);
    }

    // register toolbar 1 (if it exists)
    RTToolbar rtToolbar1 = (RTToolbar) view.findViewById(R.id.rte_toolbar_character);
    if (rtToolbar1 != null) {
        mRTManager.registerToolbar(toolbarContainer, rtToolbar1);
    }

    // register toolbar 2 (if it exists)
    RTToolbar rtToolbar2 = (RTToolbar) view.findViewById(R.id.rte_toolbar_paragraph);
    if (rtToolbar2 != null) {
        mRTManager.registerToolbar(toolbarContainer, rtToolbar2);
    }

    // set subject
    mSubjectField = (EditText) view.findViewById(R.id.subject);
    mSubjectField.setText(subject);

    // register message editor
    mRTMessageField = (RTEditText) view.findViewById(R.id.rtEditText_1);
    mRTManager.registerEditor(mRTMessageField, true);
    if (message != null) {
        mRTMessageField.setRichTextEditing(true, message);
    }

    // register signature editor
    mRTSignatureField = (RTEditText) view.findViewById(R.id.rtEditText_2);
    mRTManager.registerEditor(mRTSignatureField, true);
    if (signature != null) {
        mRTSignatureField.setRichTextEditing(true, signature);
    }

    return view;
}
 

开发者ID:Ronak-LM,
项目名称:memoir,
代码行数:55,
代码来源:RTEditorFragment.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)