本文整理汇总了Java中net.oschina.app.AppConfig类的典型用法代码示例。如果您正苦于以下问题:Java AppConfig类的具体用法?Java AppConfig怎么用?Java AppConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AppConfig类属于net.oschina.app包,在下文中一共展示了AppConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initView
import net.oschina.app.AppConfig; //导入依赖的package包/类
@Override
public void initView(View view) {
mTbDoubleClickExit.setOnToggleChanged(new OnToggleChanged() {
@Override
public void onToggle(boolean on) {
AppContext.set(AppConfig.KEY_DOUBLE_CLICK_EXIT, on);
}
});
view.findViewById(R.id.rl_clean_cache).setOnClickListener(this);
view.findViewById(R.id.rl_double_click_exit).setOnClickListener(this);
view.findViewById(R.id.rl_about).setOnClickListener(this);
view.findViewById(R.id.rl_check_version).setOnClickListener(this);
// view.findViewById(R.id.rl_exit).setOnClickListener(this);
view.findViewById(R.id.rl_feedback).setOnClickListener(this);
mCancel.setOnClickListener(this);
SystemConfigView.show((ViewGroup) view.findViewById(R.id.lay_linear));
}
示例2: showRefreshSuccess
import net.oschina.app.AppConfig; //导入依赖的package包/类
private void showRefreshSuccess(ResultBean<PageBean<TweetComment>> resultBean) {
mBean.setNextPageToken(resultBean.getResult().getNextPageToken());
AppConfig.getAppConfig(getActivity()).set("system_time", resultBean.getTime());
mBean.setItems(resultBean.getResult().getItems());
mAdapter.clear();
mAdapter.addAll(mBean.getItems());
mBean.setPrevPageToken(resultBean.getResult().getPrevPageToken());
mRefreshLayout.setCanLoadMore(true);
if (resultBean.getResult().getItems() == null
|| resultBean.getResult().getItems().size() < 20)
mAdapter.setState(BaseRecyclerAdapter.STATE_NO_MORE, true);
if (mAdapter.getItems().size() > 0) {
mErrorLayout.setErrorType(EmptyLayout.HIDE_LAYOUT);
mRefreshLayout.setVisibility(View.VISIBLE);
mRecyclerView.setVisibility(View.VISIBLE);
} else {
mErrorLayout.setErrorType(
isNeedEmptyView()
? EmptyLayout.NODATA
: EmptyLayout.HIDE_LAYOUT);
}
}
示例3: onBackPressed
import net.oschina.app.AppConfig; //导入依赖的package包/类
@Override
public void onBackPressed() {
for (TurnBackListener l : mTurnBackListeners) {
if (l.onTurnBack()) return;
}
boolean isDoubleClick = BaseApplication.get(AppConfig.KEY_DOUBLE_CLICK_EXIT, true);
if (isDoubleClick) {
long curTime = SystemClock.uptimeMillis();
if ((curTime - mBackPressedTime) < (3 * 1000)) {
finish();
} else {
mBackPressedTime = curTime;
Toast.makeText(this, R.string.tip_double_click_exit, Toast.LENGTH_LONG).show();
}
} else {
finish();
}
}
示例4: saveImg
import net.oschina.app.AppConfig; //导入依赖的package包/类
/**
* 保存图片
*/
private void saveImg() {
final String filePath = AppConfig.DEFAULT_SAVE_IMAGE_PATH
+ getFileName(mImageUrl);
Drawable drawable = mTouchImageView.getDrawable();
if (drawable != null && drawable instanceof BitmapDrawable) {
Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap();
try {
ImageUtils.saveImageToSD(this, filePath, bitmap, 100);
AppContext.showToastShort(getString(R.string.tip_save_image_suc));
} catch (IOException e) {
e.printStackTrace();
}
}
//Core.getKJBitmap().saveImage(this, mImageUrl, filePath);
}
示例5: setHtmlCotentSupportImagePreview
import net.oschina.app.AppConfig; //导入依赖的package包/类
public static String setHtmlCotentSupportImagePreview(String body) {
// 读取用户设置:是否加载文章图片--默认有wifi下始终加载图片
if (AppContext.get(AppConfig.KEY_LOAD_IMAGE, true)
|| TDevice.isWifiOpen()) {
// 过滤掉 img标签的width,height属性
body = body.replaceAll("(<img[^>]*?)\\s+width\\s*=\\s*\\S+", "$1");
body = body.replaceAll("(<img[^>]*?)\\s+height\\s*=\\s*\\S+", "$1");
// 添加点击图片放大支持
// 添加点击图片放大支持
body = body.replaceAll("(<img[^>]+src=\")(\\S+)\"",
"$1$2\" onClick=\"showImagePreview('$2')\"");
} else {
// 过滤掉 img标签
body = body.replaceAll("<\\s*img\\s+([^>]*)\\s*>", "");
}
// 过滤table的内部属性
body = body.replaceAll("(<table[^>]*?)\\s+border\\s*=\\s*\\S+", "$1");
body = body.replaceAll("(<table[^>]*?)\\s+cellspacing\\s*=\\s*\\S+", "$1");
body = body.replaceAll("(<table[^>]*?)\\s+cellpadding\\s*=\\s*\\S+", "$1");
return body;
}
示例6: initView
import net.oschina.app.AppConfig; //导入依赖的package包/类
private void initView()
{
imm = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
_uid = getIntent().getIntExtra("user_id", 0);
_friendid = getIntent().getIntExtra("friend_id", 0);
_friendname = getIntent().getStringExtra("friend_name");
if(_friendid > 0) tempMessageKey = AppConfig.TEMP_MESSAGE + "_" + _friendid;
mBack = (ImageView)findViewById(R.id.message_pub_back);
mPublish = (Button)findViewById(R.id.message_pub_publish);
mContent = (EditText)findViewById(R.id.message_pub_content);
mReceiver = (TextView)findViewById(R.id.message_pub_receiver);
mBack.setOnClickListener(UIHelper.finish(this));
mPublish.setOnClickListener(publishClickListener);
//编辑器添加文本监听
mContent.addTextChangedListener(UIHelper.getTextWatcher(this, tempMessageKey));
//显示临时编辑内容
UIHelper.showTempEditContent(this, mContent, tempMessageKey);
mReceiver.setText("发送留言给 "+_friendname);
}
示例7: initView
import net.oschina.app.AppConfig; //导入依赖的package包/类
private void initView()
{
imm = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
mBack = (ImageView)findViewById(R.id.question_pub_back);
mPublish = (Button)findViewById(R.id.question_pub_publish);
mTitle = (EditText)findViewById(R.id.question_pub_title);
mContent = (EditText)findViewById(R.id.question_pub_content);
mEmail = (CheckBox)findViewById(R.id.question_pub_email);
mCatalog = (Spinner)findViewById(R.id.question_pub_catalog);
mBack.setOnClickListener(UIHelper.finish(this));
mPublish.setOnClickListener(publishClickListener);
mCatalog.setOnItemSelectedListener(catalogSelectedListener);
//编辑器添加文本监听
mTitle.addTextChangedListener(UIHelper.getTextWatcher(this, AppConfig.TEMP_POST_TITLE));
mContent.addTextChangedListener(UIHelper.getTextWatcher(this, AppConfig.TEMP_POST_CONTENT));
//显示临时编辑内容
UIHelper.showTempEditContent(this, mTitle, AppConfig.TEMP_POST_TITLE);
UIHelper.showTempEditContent(this, mContent, AppConfig.TEMP_POST_CONTENT);
//显示临时选择分类
String position = ((AppContext)getApplication()).getProperty(AppConfig.TEMP_POST_CATALOG);
mCatalog.setSelection(StringUtils.toInt(position, 0));
}
示例8: initData
import net.oschina.app.AppConfig; //导入依赖的package包/类
@Override
public void initData() {
if (AppContext.get(AppConfig.KEY_DOUBLE_CLICK_EXIT, true)) {
mTbDoubleClickExit.setToggleOn();
} else {
mTbDoubleClickExit.setToggleOff();
}
calculateCacheSize();
}
示例9: setListData
import net.oschina.app.AppConfig; //导入依赖的package包/类
protected void setListData(ResultBean<PageBean<T>> resultBean) {
mBean.setNextPageToken(resultBean.getResult().getNextPageToken());
if (isRefreshing) {
AppConfig.getAppConfig(getActivity()).set("system_time", resultBean.getTime());
mBean.setItems(resultBean.getResult().getItems());
mAdapter.clear();
mAdapter.addAll(mBean.getItems());
mBean.setPrevPageToken(resultBean.getResult().getPrevPageToken());
mRefreshLayout.setCanLoadMore(true);
if (isNeedCache()) {
CacheManager.saveToJson(getActivity(), CACHE_NAME, mBean.getItems());
}
} else {
mAdapter.addAll(resultBean.getResult().getItems());
}
if (resultBean.getResult().getItems() == null
|| resultBean.getResult().getItems().size() < 20)
mAdapter.setState(BaseRecyclerAdapter.STATE_NO_MORE, true);
// mAdapter.setState(resultBean.getResult().getItems() == null
// || resultBean.getResult().getItems().size() < 20
// ? BaseRecyclerAdapter.STATE_NO_MORE
// : BaseRecyclerAdapter.STATE_LOADING, true);
if (mAdapter.getItems().size() > 0) {
mErrorLayout.setErrorType(EmptyLayout.HIDE_LAYOUT);
mRefreshLayout.setVisibility(View.VISIBLE);
mRecyclerView.setVisibility(View.VISIBLE);
} else {
mErrorLayout.setErrorType(
isNeedEmptyView()
? EmptyLayout.NODATA
: EmptyLayout.HIDE_LAYOUT);
}
}
示例10: initData
import net.oschina.app.AppConfig; //导入依赖的package包/类
@Override
public void initData() {
mReadState = OSCApplication.getReadState("sub_list");
if (mTab.getBanner() != null) {
mHeaderView = mTab.getBanner().getCatalog() == SubTab.BANNER_CATEGORY_NEWS ?
new NewsHeaderView(mContext, getImgLoader(), mTab.getBanner().getHref(), mTab.getToken() + "banner" + mTab.getType()) :
new EventHeaderView(mContext, getImgLoader(), mTab.getBanner().getHref(), mTab.getToken() + "banner" + mTab.getType());
}
super.initData();
mAdapter.setHeaderView(mHeaderView);
mAdapter.setSystemTime(AppConfig.getAppConfig(getActivity()).get("system_time"));
if (mAdapter instanceof NewsSubAdapter) {
((NewsSubAdapter) mAdapter).setTab(mTab);
}
}
示例11: checkUpdate
import net.oschina.app.AppConfig; //导入依赖的package包/类
private void checkUpdate() {
if (!AppContext.get(AppConfig.KEY_CHECK_UPDATE, true)) {
return;
}
CheckUpdateManager manager = new CheckUpdateManager(this, false);
manager.setCaller(this);
manager.checkUpdate(false);
}
示例12: showUploadBehaviorsSuccess
import net.oschina.app.AppConfig; //导入依赖的package包/类
@Override
public void showUploadBehaviorsSuccess(int index, String time) {
DBManager.getInstance()
.delete(Behavior.class, "id<=?", String.valueOf(index));
AppConfig.getAppConfig(this)
.set("upload_behavior_time", time);
}
示例13: setupWebContent
import net.oschina.app.AppConfig; //导入依赖的package包/类
private static String setupWebContent(String content, String style) {
if (TextUtils.isEmpty(content) || TextUtils.isEmpty(content.trim()))
return "";
if (AppContext.get(AppConfig.KEY_LOAD_IMAGE, true)
|| TDevice.isWifiOpen()) {
Pattern pattern = Pattern.compile("<img[^>]+src\\s*=\\s*[\"\']([^\"\']*)[\"\'](\\s*data-url\\s*=\\s*[\"\']([^\"\']*)[\"\'])*");
Matcher matcher = pattern.matcher(content);
while (matcher.find()) {
String snippet = String.format(
"<img style=\"vertical-align: bottom;\" src=\"%s\" onClick=\"javascript:mWebViewImageListener.showImagePreview('%s')\"",
matcher.group(1),
matcher.group(3) == null ? matcher.group(1) : matcher.group(3));
content = content.replace(matcher.group(0), snippet);
}
} else {
// 过滤掉 img标签
content = content.replaceAll("<\\s*img\\s+([^>]*)\\s*>", "");
}
return String.format(
"<!DOCTYPE html>"
+ "<html>"
+ "<head>"
+ "<link rel=\"stylesheet\" type=\"text/css\" href=\"file:///android_asset/css/common_new.css\">"
+ "</head>"
+ "<body>"
+ "<div class='contentstyle' id='article_id' style='%s'>"
+ "%s"
+ "</div>"
+ "</body>"
+ "</html>"
, style == null ? "" : style, content);
}
示例14: shareToSinaWeibo
import net.oschina.app.AppConfig; //导入依赖的package包/类
/**
* 分享到新浪微博
*/
private void shareToSinaWeibo(String content, final String imagePath) {
AppConfig cfgHelper = AppConfig.getAppConfig(this);
final AccessInfo access = cfgHelper.getAccessInfo();
final String shareMsg = content;
// 初始化微博
if (SinaWeiboHelper.isWeiboNull()) {
SinaWeiboHelper.initWeibo();
}
// 判断之前是否登陆过
if (access != null) {
SinaWeiboHelper.progressDialog = new ProgressDialog(this);
SinaWeiboHelper.progressDialog
.setProgressStyle(ProgressDialog.STYLE_SPINNER);
SinaWeiboHelper.progressDialog.setMessage(this
.getString(R.string.sharing));
SinaWeiboHelper.progressDialog.setCancelable(true);
SinaWeiboHelper.progressDialog.show();
new Thread() {
public void run() {
SinaWeiboHelper.setAccessToken(access.getAccessToken(),
access.getAccessSecret(), access.getExpiresIn());
SinaWeiboHelper.shareMessage(ScreenShotShare.this,
shareMsg, imagePath);
}
}.start();
} else {
SinaWeiboHelper
.authorize(ScreenShotShare.this, shareMsg, imagePath);
}
}
示例15: setListData
import net.oschina.app.AppConfig; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void setListData(ResultBean<PageBean<Tweet>> resultBean) {
if (resultBean != null) {
final PageBean<Tweet> pageBean = resultBean.getResult();
if (pageBean != null) {
final List<Tweet> items = pageBean.getItems();
final boolean isEmpty = items == null || items.size() == 0;
if (!isEmpty)
mBean.setNextPageToken(pageBean.getNextPageToken());
if (isRefreshing) {
AppConfig.getAppConfig(getActivity()).set("system_time", resultBean.getTime());
mAdapter.clear();
((BaseGeneralRecyclerAdapter) mAdapter).clearPreItems();
((BaseGeneralRecyclerAdapter) mAdapter).addItems(items);
mBean.setItems(items);
mBean.setPrevPageToken(pageBean.getPrevPageToken());
mRefreshLayout.setCanLoadMore(true);
if (isNeedCache()) {
CacheManager.saveToJson(getActivity(), CACHE_NAME, items);
}
} else {
((BaseGeneralRecyclerAdapter) mAdapter).addItems(items);
}
if (isEmpty) {
mAdapter.setState(BaseRecyclerAdapter.STATE_NO_MORE, true);
mRefreshLayout.setCanLoadMore(false);
}
}
}
if (mAdapter.getItems().size() > 0) {
mErrorLayout.setErrorType(EmptyLayout.HIDE_LAYOUT);
mRefreshLayout.setVisibility(View.VISIBLE);
mRecyclerView.setVisibility(View.VISIBLE);
} else {
mErrorLayout.setErrorType(isNeedEmptyView() ? EmptyLayout.NODATA : EmptyLayout.HIDE_LAYOUT);
}
}