Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
com.1gravity:android-rteditor-materialdialog
Advanced tools
Android RTEditor is a rich text editor component used as drop-in for EditText
The Android RTEditor is a rich text editor component for Android that can be used as a drop in for EditText.
The editor offers the following character formatting options:
It also supports the following paragraph formatting:
####RTEditText is the EditText drop in component. Add it to your layout like you would EditText:
<com.onegravity.rteditor.RTEditText
android:id="@+id/rtEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionDone|flagNoEnterAction"
android:inputType="textMultiLine|textAutoCorrect|textCapSentences" />
In code you would typically use methods to set and get the text content:
RTEditText.setRichTextEditing(true, "My content");
RTEditText.getText(RTFormat.HTML)
####RTToolbar is an interface for the toolbar used to apply text and paragraph formatting and other features listed above. The actual RTToolbar implementation is in a separate module and is a scrollable ribbon but alternative implementations aren't too hard to realize (popup, action buttons, floating buttons...). The toolbar implementation is easy to integrate into your layout:
<include android:id="@+id/rte_toolbar_container" layout="@layout/rte_toolbar" />
or if you want to have two ribbons for character and paragraph formatting:
<LinearLayout
android:id="@+id/rte_toolbar_container"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/rte_toolbar_character" />
<include layout="@layout/rte_toolbar_paragraph" />
</LinearLayout>
In code you'd typically not interact with the toolbar (see RTManager below for the one exception).
####RTManager is the glue that holds the rich text editors (RTEditText), the toolbar and your app together. Each rich text editor and each toolbar needs to be registered with the RTManager before they are functional. Multiple editors and multiple toolbars can be registered. The RTManager is instantiated by your app in code usually in the onCreate passing in an RTApi object that gives the rich text editor access to its context (your app). A typical initialization process looks like this:
// create RTManager
RTApi rtApi = new RTApi(this, new RTProxyImpl(this), new RTMediaFactoryImpl(this, true));
RTManager rtManager = new RTManager(rtApi, savedInstanceState);
// register toolbar
ViewGroup toolbarContainer = (ViewGroup) findViewById(R.id.rte_toolbar_container);
HorizontalRTToolbar rtToolbar = (HorizontalRTToolbar) findViewById(R.id.rte_toolbar);
if (rtToolbar != null) {
rtManager.registerToolbar(toolbarContainer, rtToolbar);
}
// register editor & set text
RTEditText rtEditText = (RTEditText) findViewById(R.id.rtEditText);
rtManager.registerEditor(rtEditText, true);
rtEditText.setRichTextEditing(true, message);
To retrieve the edited text in html format you'd do:
String text = rtEditText.getText(RTFormat.HTML);
The RTManager also needs to be called in onSaveInstanceState and in onDestroy:
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
mRTManager.onSaveInstanceState(outState);
outState.putBoolean("mUseDarkTheme", mUseDarkTheme);
outState.putBoolean("mSplitToolbar", mSplitToolbar);
}
@Override
public void onDestroy() {
super.onDestroy();
mRTManager.onDestroy(isFinishing());
}
The isSaved parameter passed into RTManager.onDestroy(boolean) is important. If it's true then media files inserted into the text (images at the moment) will remain untouched. If the parameter is false (text content is dismissed), media files will be deleted. Note that the rich text editor copies the original file to a dedicated area according to the MediaFactory configuration, meaning the original will remain untouched.
The project consists of five different modules:
The demo app can also be found on Google Play: Demo App
If you have an issues with this library, please open a issue here: https://github.com/1gravity/Android-RTEditor/issues and provide enough information to reproduce it reliably. The following information needs to be provided or the issue will be closed without any further notice:
Copyright 2015 Emanuel Moecklin
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
FAQs
Android RTEditor is a rich text editor component used as drop-in for EditText
We found that com.1gravity:android-rteditor-materialdialog demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.