本文整理汇总了Java中com.orhanobut.hawk.Hawk.put方法的典型用法代码示例。如果您正苦于以下问题:Java Hawk.put方法的具体用法?Java Hawk.put怎么用?Java Hawk.put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.orhanobut.hawk.Hawk
的用法示例。
在下文中一共展示了Hawk.put方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupDialog
import com.orhanobut.hawk.Hawk; //导入方法依赖的package包/类
@SuppressLint("RestrictedApi")
@Override
public void setupDialog(Dialog dialog, int style) {
super.setupDialog(dialog, style);
mContentView = View.inflate(getContext(), R.layout.changelog_dialog_content, null);
dialog.setContentView(mContentView);
unbinder = ButterKnife.bind(this, mContentView);
Hawk.put("WHATS_NEW_VERSION", BuildConfig.VERSION_CODE);
mCancel.setVisibility(View.GONE);
mTitle.setText(R.string.changelog);
mMessage.setText(getString(R.string.changelog_detail));
mListener = new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
View parent = (View) mContentView.getParent();
BottomSheetBehavior behavior = BottomSheetBehavior.from(parent);
behavior.setPeekHeight(mContentView.getMeasuredHeight());
CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) ((View) mContentView.getParent()).getLayoutParams();
layoutParams.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL;
removeGlobalLayoutListener();
}
};
mContentView.getViewTreeObserver().addOnGlobalLayoutListener(mListener);
}
示例2: onCreate
import com.orhanobut.hawk.Hawk; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
Hawk.init(this).build();
SQLiteDatabase.loadLibs(this);
int times = Hawk.get(PREF_TIMES, 0) + 1;
Log.d(TAG, "Psss! Let me tell a secret: you opened this app " + times + " times.");
Hawk.put(PREF_TIMES, times);
}
示例3: onViewClicked
import com.orhanobut.hawk.Hawk; //导入方法依赖的package包/类
@OnClick({R.id.custom_api_key_close, R.id.custom_api_key_save_btn})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.custom_api_key_close:
supportFinishAfterTransition();
break;
case R.id.custom_api_key_save_btn:
String appId = mCustomApiKeyEditText.getText().toString().trim();
String secret = mCustomApiSecretEditText.getText().toString().trim();
if (TextUtils.isEmpty(appId) || TextUtils.isEmpty(secret)) {
Hawk.delete("CUSTOM_UNSPLASH_APP_ID");
Hawk.delete("CUSTOM_UNSPLASH_SECRET");
Toast.makeText(getApplicationContext(), getString(R.string.not_filled), Toast.LENGTH_LONG).show();
} else {
Hawk.put("CUSTOM_UNSPLASH_APP_ID", appId);
Hawk.put("CUSTOM_UNSPLASH_SECRET", secret);
Toast.makeText(getApplicationContext(), getString(R.string.filled_out), Toast.LENGTH_LONG).show();
}
mCustomApiKeySaveBtn.postDelayed(new Runnable() {
@Override
public void run() {
supportFinishAfterTransition();
}
}, 80);
break;
}
}
示例4: addCoinToList
import com.orhanobut.hawk.Hawk; //导入方法依赖的package包/类
private void addCoinToList(String symbol) {
ArrayList<String> coins = Hawk.get(USER_COIN_LIST, new ArrayList<String>());
if (!coins.contains(symbol)) {
coins.add(symbol);
}
Hawk.put(USER_COIN_LIST, coins);
}
示例5: deleteCoinFromList
import com.orhanobut.hawk.Hawk; //导入方法依赖的package包/类
private void deleteCoinFromList(String symbol) {
ArrayList<String> coins = Hawk.get(USER_COIN_LIST, new ArrayList<String>());
if (coins.contains(symbol)) {
coins.remove(symbol);
Hawk.put(USER_COIN_LIST, coins);
}
}
示例6: layout1
import com.orhanobut.hawk.Hawk; //导入方法依赖的package包/类
private void layout1() {
String name11 = getString(R.string.name_11);
String name12 = getString(R.string.name_12);
Log.i(TAG, name11);
Log.i(TAG, name12);
Hawk.put(Constant.LAYOUT, "格局1");
Hawk.put(Constant.NAME1, name11);
Hawk.put(Constant.NAME2, name12);
}
示例7: layout2
import com.orhanobut.hawk.Hawk; //导入方法依赖的package包/类
private void layout2() {
String name_21 = getString(R.string.name_21);
String name_22 = getString(R.string.name_22);
Log.i(TAG, name_21);
Log.i(TAG, name_22);
Hawk.put(Constant.LAYOUT, "格局2");
Hawk.put(Constant.NAME1, name_21);
Hawk.put(Constant.NAME2, name_22);
}
示例8: layout3
import com.orhanobut.hawk.Hawk; //导入方法依赖的package包/类
private void layout3() {
String name_31 = getString(R.string.name_31);
String name_32 = getString(R.string.name_32);
Log.i(TAG, name_31);
Log.i(TAG, name_32);
Hawk.put(Constant.LAYOUT, "格局3");
Hawk.put(Constant.NAME1, name_31);
Hawk.put(Constant.NAME2, name_32);
}
示例9: layout4
import com.orhanobut.hawk.Hawk; //导入方法依赖的package包/类
private void layout4() {
String name_41 = getString(R.string.name_41);
String name_42 = getString(R.string.name_42);
Log.i(TAG, name_41);
Log.i(TAG, name_42);
Hawk.put(Constant.LAYOUT, "格局4");
Hawk.put(Constant.NAME1, name_41);
Hawk.put(Constant.NAME2, name_42);
}
示例10: isLastCrash
import com.orhanobut.hawk.Hawk; //导入方法依赖的package包/类
public static boolean isLastCrash(boolean clearState) {
Boolean b = Hawk.get(RCrashHandler.KEY_IS_CRASH, false);
if (b && clearState) {
Hawk.put(RCrashHandler.KEY_IS_CRASH, false);
}
return b;
}
示例11: saveToSDCard
import com.orhanobut.hawk.Hawk; //导入方法依赖的package包/类
private void saveToSDCard(Throwable ex) throws Exception {
String saveFolder = Environment.getExternalStorageDirectory().getAbsoluteFile() +
File.separator + Root.APP_FOLDER + File.separator + DEFAULT_LOG_DIR;
File folder = new File(saveFolder);
if (!folder.exists()) {
if (!folder.mkdirs()) {
return;
}
}
String dataTime = getDataTime("yyyy-MM-dd_HH-mm-ss-SSS");
File file = new File(saveFolder, dataTime + FILE_NAME_SUFFIX);
Hawk.put(KEY_IS_CRASH, true);//异常退出
Hawk.put(KEY_CRASH_FILE, file.getAbsolutePath());//异常文件
Hawk.put(KEY_CRASH_MESSAGE, ex.getMessage());
PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(file)));
// 导出发生异常的时间
pw.println(dataTime);
pw.println(UILayoutImpl.LAYOUT_INFO);
// 导出手机信息
dumpPhoneInfo(pw);
pw.println();
// 导出异常的调用栈信息
ex.printStackTrace(pw);
pw.close();
}
示例12: onClick
import com.orhanobut.hawk.Hawk; //导入方法依赖的package包/类
@Override
public void onClick(SwitchButton switchButton, final int position) {
boolean state = false;
if (AccountInfo.getInstance().getState() != null) {
state = AccountInfo.getInstance().getState();
}
if (state == true) {
mType = 2;
mList1.setVisibility(View.VISIBLE);
showDialog();
Hawk.put(dataValues[position], true);
}
// Log.e("TAG","state-->"+state);
switchButton.setOnToggleChanged(new SwitchButton.OnToggleChanged() {
@Override
public void onToggle(boolean on) {
if (on) {
mType = 2;
mList1.setVisibility(View.VISIBLE);
showDialog();
AccountInfo.getInstance().saveState(true);
} else {
mType = 1;
mList1.setVisibility(View.GONE);
AccountInfo.getInstance().saveState(false);
}
}
});
NotDistrubed notDistrubed = new NotDistrubed(mType, time);
EventBus.getDefault().post(notDistrubed);
}
示例13: logout
import com.orhanobut.hawk.Hawk; //导入方法依赖的package包/类
public static void logout() {
Hawk.delete("ME_PROFILE");
Hawk.delete("ACCESS_TOKEN");
Hawk.put("IS_AUTHORIZED", false);
Hawk.put("IS_SELF", false);
}
示例14: setBaseTheme
import com.orhanobut.hawk.Hawk; //导入方法依赖的package包/类
public void setBaseTheme(Theme baseTheme) {
this.baseTheme = baseTheme;
Hawk.put(context.getString(R.string.preference_base_theme), getBaseTheme().getValue());
}
示例15: toggle
import com.orhanobut.hawk.Hawk; //导入方法依赖的package包/类
public boolean toggle() {
Hawk.put(preferenceKey, !isChecked());
boolean checked = isChecked();
toggle.setChecked(checked);
return checked;
}