本文整理汇总了Java中com.getkeepsafe.taptargetview.TapTargetView类的典型用法代码示例。如果您正苦于以下问题:Java TapTargetView类的具体用法?Java TapTargetView怎么用?Java TapTargetView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TapTargetView类属于com.getkeepsafe.taptargetview包,在下文中一共展示了TapTargetView类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showTocOnboarding
import com.getkeepsafe.taptargetview.TapTargetView; //导入依赖的package包/类
private void showTocOnboarding() {
TabLayout pageActionTabLayout = fragment.getActivity().findViewById(R.id.page_actions_tab_layout);
TabLayout.Tab tocTab = pageActionTabLayout.getTabAt(PageActionTab.VIEW_TOC.code());
try {
Field f = tocTab.getClass().getDeclaredField("mView");
f.setAccessible(true);
View tabView = (View) f.get(tocTab);
FeedbackUtil.showTapTargetView(fragment.getActivity(), tabView, R.string.menu_show_toc,
R.string.tool_tip_toc_button, new TapTargetView.Listener() {
@Override
public void onTargetClick(TapTargetView view) {
super.onTargetClick(view);
show();
}
});
PrefsOnboardingStateMachine.getInstance().setTocTutorial();
} catch (Exception e) {
// If this fails once it will likely always fail for the same reason, so let's prevent
// the onboarding from being attempted and failing on every page view forever.
PrefsOnboardingStateMachine.getInstance().setTocTutorial();
L.w("ToC onboarding failed", e);
}
}
示例2: showTabTargetView
import com.getkeepsafe.taptargetview.TapTargetView; //导入依赖的package包/类
@Override
public void showTabTargetView() {
TapTargetView.showFor(this, TapTarget.forView(findViewById(R.id.tab_setting) , "آموزش", "روی این تب کلیک کنید تا نحوهی اضافه کردن ویجت به صفحه رو ببینید") // All options below are optional
.outerCircleColor(R.color.primary_dark) // Specify a color for the outer circle
.outerCircleAlpha(0.96f) // Specify the alpha amount for the outer circle
.targetCircleColor(R.color.low_primary) // Specify a color for the target circle
.titleTextSize(40) // Specify the size (in sp) of the title text
.descriptionTextSize(30) // Specify the size (in sp) of the description text
.dimColor(R.color.bb_tabletRightBorderDark) // If set, will dim behind the view with 30% opacity of the given color
.drawShadow(true) // Whether to draw a drop shadow or not
.tintTarget(true) // Whether to tint the target view's color
.transparentTarget(false) // Specify whether the target is transparent (displays the content underneath)
.targetRadius(60));
}
示例3: ShowFor
import com.getkeepsafe.taptargetview.TapTargetView; //导入依赖的package包/类
@ReactMethod
public void ShowFor(final int view, final ReadableMap props, final Promise promise) {
final Activity activity = this.getCurrentActivity();
final TapTarget targetView = generateTapTarget(view, props);
this.getCurrentActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
TapTargetView.showFor(activity, targetView);
}
});
}
示例4: showTapTargetView
import com.getkeepsafe.taptargetview.TapTargetView; //导入依赖的package包/类
public static void showTapTargetView(@NonNull Activity activity, @NonNull View target,
@StringRes int titleId, @StringRes int descriptionId,
@Nullable TapTargetView.Listener listener) {
final float tooltipAlpha = 0.9f;
TapTargetView.showFor(activity,
TapTarget.forView(target, activity.getString(titleId),
activity.getString(descriptionId))
.targetCircleColor(ResourceUtil.getThemedAttributeId(activity, R.attr.colorAccent))
.outerCircleColor(ResourceUtil.getThemedAttributeId(activity, R.attr.colorAccent))
.outerCircleAlpha(tooltipAlpha)
.cancelable(true)
.transparentTarget(true),
listener);
}
示例5: onCreate
import com.getkeepsafe.taptargetview.TapTargetView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ButterKnife.bind(this);
boolean isUserFirstTime = UniversalPreferences.getInstance().get("isUserFirstTime", true);
instance = this;
flashcardDb = FlashcardDb.getInstance(getApplicationContext());
trashFlashcardDb = TrashFlashcardDb.getInstance(getApplicationContext());
cardDb = CardDb.getInstance(getApplicationContext());
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction().replace(R.id.content_main, new AllSetsFragment()).commit();
getSupportActionBar().setTitle(getString(R.string.menu_all_sets));
}
if (isUserFirstTime) {
UniversalPreferences.getInstance().put("isUserFirstTime", false);
startActivity(new Intent(this, IntroActivity.class));
}
boolean userKnowsToAddSets = UniversalPreferences.getInstance().get("userKnowsToAddSets", false);
if (!userKnowsToAddSets) {
TapTargetView.showFor(this, // `this` is an Activity
TapTarget.forView(findViewById(R.id.fabAddSet), getString(R.string.create_sets), getString(R.string.lets_create_set))
// All options below are optional
.outerCircleColor(R.color.md_blue_500) // Specify a color for the outer circle
.targetCircleColor(R.color.md_white_1000) // Specify a color for the target circle
.titleTextSize(24) // Specify the size (in sp) of the title text
.titleTextColor(R.color.md_white_1000) // Specify the color of the title text
.descriptionTextSize(20) // Specify the size (in sp) of the description text
.descriptionTextColor(R.color.md_red_500) // Specify the color of the description text
.textColor(R.color.md_white_1000) // Specify a color for both the title and description text
.textTypeface(Typeface.SANS_SERIF) // Specify a typeface for the text
.dimColor(R.color.md_black_1000) // If set, will dim behind the view with 30% opacity of the given color
.drawShadow(true) // Whether to draw a drop shadow or not
.cancelable(false) // Whether tapping outside the outer circle dismisses the view
.transparentTarget(true) // Specify whether the target is transparent (displays the content underneath)
.targetRadius(40), // Specify the target radius (in dp)
new TapTargetView.Listener() { // The listener can listen for regular clicks, long clicks or cancels
@Override
public void onTargetClick(TapTargetView view) {
super.onTargetClick(view); // This call is optional
UniversalPreferences.getInstance().put("userKnowsToAddSets", true);
onClickFab();
}
});
}
}
示例6: showIconsIntro
import com.getkeepsafe.taptargetview.TapTargetView; //导入依赖的package包/类
public static void showIconsIntro(@NonNull Context context) {
if (Preferences.get(context).isTimeToShowIconsIntro()) {
AppCompatActivity activity = (AppCompatActivity) context;
Toolbar toolbar = activity.findViewById(R.id.toolbar);
if (toolbar == null) return;
new Handler().postDelayed(() -> {
try {
int primary = ColorHelper.getAttributeColor(context, R.attr.toolbar_icon);
int secondary = ColorHelper.setColorAlpha(primary, 0.7f);
Typeface title = TypefaceHelper.getMedium(context);
Typeface description = TypefaceHelper.getRegular(context);
TapTarget tapTarget = TapTarget.forToolbarMenuItem(toolbar, R.id.menu_search,
context.getResources().getString(R.string.tap_intro_icons_search),
context.getResources().getString(R.string.tap_intro_icons_search_desc))
.titleTextColorInt(primary)
.descriptionTextColorInt(secondary)
.targetCircleColorInt(primary)
.drawShadow(Preferences.get(context).isTapIntroShadowEnabled());
if (title != null) {
tapTarget.textTypeface(title);
}
//if (description != null) {
//tapTarget.descriptionTypeface(description);
//}
TapTargetView.showFor(activity, tapTarget,
new TapTargetView.Listener() {
@Override
public void onTargetDismissed(TapTargetView view, boolean userInitiated) {
super.onTargetDismissed(view, userInitiated);
Preferences.get(context).setTimeToShowIconsIntro(false);
}
});
} catch (Exception e) {
LogUtil.e(Log.getStackTraceString(e));
}
}, 100);
}
}