Fetch the repository succeeded.
1.在项目根目录下的build.gradle文件中,
allprojects {
repositories {
maven {
url 'https://s01.oss.sonatype.org/content/repositories/releases/'
}
}
}
2.在entry模块的build.gradle文件中,
dependencies {
implementation('com.gitee.chinasoft_ohos:ohos-process-button:1.0.0')
......
}
在sdk6,DevEco Studio2.2 Beta1下项目可直接运行 如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件, 并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下
1.使用相关的类:
2.使用实例 初始sample的构建
public class StateSampleSlice extends Ability implements Component.ClickedListener {
private ActionProcessButton actionProcessButton;
private GenerateProcessButton generateProcessButton;
private SubmitProcessButton submitProcessButton;
@Override
protected void onStart(Intent intent) {
super.onStart(intent);
super.setUIContent(ResourceTable.Layout_state_sample_silice);
actionProcessButton = (ActionProcessButton) findComponentById(ResourceTable.Id_state_sample_action);
actionProcessButton.setMode(ActionProcessButton.Mode.ENDLESS);
generateProcessButton = (GenerateProcessButton) findComponentById(ResourceTable.Id_state_sample_generate);
submitProcessButton = (SubmitProcessButton) findComponentById(ResourceTable.Id_state_sample_submit);
findComponentById(ResourceTable.Id_error_button).setClickedListener(this);
findComponentById(ResourceTable.Id_noramal_button).setClickedListener(this);
findComponentById(ResourceTable.Id_half_button).setClickedListener(this);
findComponentById(ResourceTable.Id_success_button).setClickedListener(this);
}
@Override
public void onClick(Component component) {
switch (component.getId()) {
case ResourceTable.Id_error_button:
actionProcessButton.setProgress(-1);
generateProcessButton.setProgress(-1);
submitProcessButton.setProgress(-1);
break;
case ResourceTable.Id_noramal_button:
actionProcessButton.setProgress(0);
generateProcessButton.setProgress(0);
submitProcessButton.setProgress(0);
break;
case ResourceTable.Id_half_button:
actionProcessButton.setProgress(50);
generateProcessButton.setProgress(50);
submitProcessButton.setProgress(50);
break;
case ResourceTable.Id_success_button:
actionProcessButton.setProgress(100);
generateProcessButton.setProgress(100);
submitProcessButton.setProgress(100);
break;
}
}
@Override
protected void onBackground() {
super.onBackground();
actionProcessButton.setProgress(0);
generateProcessButton.setProgress(0);
submitProcessButton.setProgress(0);
}
}
3:相关属性的使用示例
<com.dd.processbutton.iml.ActionProcessButton
ohos:id="$+id:btnSignIn"
ohos:height="48vp"
ohos:width="match_parent"
app:pb_colorComplete="$color:green_complete"
app:pb_colorNormal="$color:blue_normal"
app:pb_colorPressed="$color:blue_pressed"
app:pb_colorProgress="$color:purple_progress"
app:pb_textComplete="$string:Success"
app:pb_textError="Error"
app:pb_textProgress="$string:Loading"
ohos:text="$string:Sign_in"
ohos:text_color="#ffffff"
/>
<com.dd.processbutton.iml.GenerateProcessButton
ohos:id="$+id:generate_process_btn"
ohos:height="48vp"
ohos:width="match_parent"
ohos:margin="16vp"
app:pb_textComplete="$string:Done"
app:pb_textError="Error"
app:pb_textProgress="$string:Uploading"
ohos:text="$string:Upload"
ohos:text_color="#ffffff"
/>
<com.dd.processbutton.iml.SubmitProcessButton
ohos:id="$+id:sub_btn_sample"
ohos:height="48vp"
ohos:width="100vp"
app:pb_textComplete="$string:Done"
app:pb_textError="Error"
app:pb_textProgress="Loading"
ohos:text="$string:Send"
ohos:text_color="#ffffff"
/>
4:通用的ProcessButton相关方法的使用说明
void setProgress(int progress); 设置按钮进度
int getProgress(); 获取按钮进度
void setMaxProgress(int mMaxProgress); 设置最大按钮进度
int getMaxProgress(); 获取最大按钮进度
void setMinProgress(int mMinProgress); 设置最小按钮进度
int getMinProgress(); 获取最小按钮进度
void setNormalText(CharSequence normalText); 设置正常状态下的Button文本
String getNormalText(); 获取正常状态下的Button文本
void setLoadingText(CharSequence loadingText); 设置loading状态下的Button文本
String getLoadingText(); 获取loading状态下的Button文本
void setCompleteText(CharSequence completeText); 设置完成后的Button文本
String getCompleteText(); 获取完成后的Button文本
void setErrorText(CharSequence errorText); 设置错误状态的Button文本
String getErrorText(); 获取错误状态的Button文本
void setProgressDrawable(ShapeElement progressDrawable); 设置加载中的Button样式
ShapeElement getCompleteDrawable(); 获取加载中的Button样式
void setCompleteDrawable(ShapeElement completeDrawable); 设置完成后的Button样式
ShapeElement getCompleteDrawable(); 获取完成后的Button样式
void setErrorDrawable(ShapeElement errorDrawable); 设置错误状态的Button样式
ShapeElement getErrorDrawable(); 获取错误状态的Button样式
5:ActionProcessButton使用示例
ActionProcessButton actionProcessButton = (ActionProcessButton) findComponentById(ResourceTable.Id_btnSignIn);
actionProcessButton.setMode(ActionProcessButton.Mode.ENDLESS);设置ActionProcessButton的loading样式为左右闪动
actionProcessButton.setMode(ActionProcessButton.Mode.PROGRESS);设置ActionProcessButton的loading样式为Progress进度样式
actionProcessButton.setColorScheme(int color1, int color2, int color3, int color4);设置ActionProcessButton的闪动样式颜色
CodeCheck代码测试无异常
CloudTest代码测试无异常
病毒安全检测通过
当前版本demo功能与原组件基本无差异
The MIT License (MIT)
Copyright (c) 2014 Danylyk Dmytro
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. Open source ecosystem
2. Collaboration, People, Software
3. Evaluation model