本文整理汇总了Java中org.androidannotations.annotations.sharedpreferences.Pref类的典型用法代码示例。如果您正苦于以下问题:Java Pref类的具体用法?Java Pref怎么用?Java Pref使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Pref类属于org.androidannotations.annotations.sharedpreferences包,在下文中一共展示了Pref类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onReceive
import org.androidannotations.annotations.sharedpreferences.Pref; //导入依赖的package包/类
@Override
public void onReceive(final Context context, Intent intent) {
// Gets the intent, check if it matches our secret code
if (Intent.ACTION_NEW_OUTGOING_CALL.equals(intent.getAction()) &&
intent.getExtras() != null) {
Intent launcher = new Intent(context, MainActivity_.class);
//These flags are added to make the new mainActivity in the home stack.
//i.e. back button returns to home not dialer.
launcher.addFlags(IntentCompat.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK | IntentCompat.FLAG_ACTIVITY_TASK_ON_HOME);
String phoneNumber = intent.getExtras().getString(android.content.Intent.EXTRA_PHONE_NUMBER);
if (Pref.OpenPIN().exists())
if (("*#" + Pref.OpenPIN().get()).equals(phoneNumber))
// Launch the main app!!
launchActivity(context, launcher);
}
}
示例2: showTutorial
import org.androidannotations.annotations.sharedpreferences.Pref; //导入依赖的package包/类
void showTutorial() {
if ((adapter.getCount() > 0) && (Pref.showVaultLongPressRenameTutorial().get())) {
final View mView =
context.getLayoutInflater().inflate(R.layout.vault_item_tutorial, mLinearView, false);
TextView mInstructions = (TextView) mView.findViewById(R.id.Tutorial__instruction);
if (mInstructions != null)
mInstructions.setText(R.string.Tutorial__long_click_to_rename);
mLinearView.addView(mView, 0);
mView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
mLinearView.removeView(mView);
Pref.edit()
.showVaultLongPressRenameTutorial()
.put(false)
.apply();
return true;
}
});
return; //Show only one tutorial at a time. Don't overload users!!
}
}