本文整理汇总了Java中com.espian.showcaseview.ShowcaseView类的典型用法代码示例。如果您正苦于以下问题:Java ShowcaseView类的具体用法?Java ShowcaseView怎么用?Java ShowcaseView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ShowcaseView类属于com.espian.showcaseview包,在下文中一共展示了ShowcaseView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showQuickstreamHint
import com.espian.showcaseview.ShowcaseView; //导入依赖的package包/类
private void showQuickstreamHint(int position) {
int firstPosition = getListView().getFirstVisiblePosition() - getListView().getHeaderViewsCount(); // This is the same as child #0
int wantedChild = position - firstPosition;
View listItem = getListView().getChildAt(wantedChild);
View icon = listItem.findViewById(R.id.icon);
ShowcaseView.ConfigOptions co = new ShowcaseView.ConfigOptions();
//can only dismiss by button click
co.hideOnClickOutside = false;
co.block = true;
co.centerText = true;
ViewTarget target = new ViewTarget(icon);
ShowcaseView showCase = ShowcaseView.insertShowcaseView(target, getActivity(),
getActivity().getString(R.string.quick_stream_hint_title), getActivity().getString(R.string.quick_stream_hint_text), co);
showCase.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.black_transparent));
showCase.show();
}
示例2: onCreateOptionsMenu
import com.espian.showcaseview.ShowcaseView; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getSupportMenuInflater().inflate(R.menu.menu, menu);
ShowcaseViews views = new ShowcaseViews(this, new ShowcaseViews.OnShowcaseAcknowledged() {
@Override
public void onShowCaseAcknowledged(ShowcaseView showcaseView) {
Toast.makeText(getApplicationContext(), R.string.dismissed_message, Toast.LENGTH_SHORT).show();
}
});
ShowcaseView.ConfigOptions options = new ShowcaseView.ConfigOptions();
options.shotType = ShowcaseView.TYPE_ONE_SHOT;
options.showcaseId = 1234;
views.addView(new ItemViewProperties(R.id.menu_item1, R.string.showcase_menu_item_one_shot_title, R.string.showcase_menu_item_one_shot_message, ShowcaseView.ITEM_SPINNER, SHOWCASE_SPINNER_SCALE, options));
ShowcaseView.ConfigOptions configOptions = new ShowcaseView.ConfigOptions();
configOptions.fadeInDuration = 700;
configOptions.fadeOutDuration = 700;
configOptions.block = true;
views.addView(new ItemViewProperties(ItemViewProperties.ID_SPINNER, R.string.showcase_spinner_title, R.string.showcase_spinner_message, ShowcaseView.ITEM_SPINNER, SHOWCASE_SPINNER_SCALE, configOptions));
views.addView(new ItemViewProperties(ItemViewProperties.ID_OVERFLOW, R.string.showcase_overflow_title, R.string.showcase_overflow_message, ShowcaseView.ITEM_ACTION_OVERFLOW, SHOWCASE_OVERFLOW_ITEM_SCALE));
views.show();
return super.onCreateOptionsMenu(menu);
}
示例3: onShowcaseViewHide
import com.espian.showcaseview.ShowcaseView; //导入依赖的package包/类
@Override
public void onShowcaseViewHide(ShowcaseView showcaseView) {
switch (mOptions.showcaseId) {
case 1:
mOptions.showcaseId = 2;
int finalPage = (int)Math.ceil((mAdapter.getCount()/2.0) - 1);
if(mAdapter.getPage() == finalPage) {
// at finalPage.
mShowcaseView = ShowcaseView.insertShowcaseView((Measuredwidth / 2), ((Measuredheight / 2) - (Measuredheight / 5)), DailyBreadActivity.this, R.string.guide_flip_title, R.string.guide_flip_message, mOptions);
mShowcaseView.animateGesture(0, 0, 0, 400);
} else {
mShowcaseView = ShowcaseView.insertShowcaseView((Measuredwidth / 2), ((Measuredheight / 2) + (Measuredheight / 4)), DailyBreadActivity.this, R.string.guide_flip_title, R.string.guide_flip_message, mOptions);
mShowcaseView.animateGesture(0, 0, 0, -400);
}
isAppGuideShown = false;
break;
case 2:
isAppGuideShown = false;
break;
}
}
示例4: calculateTextPosition
import com.espian.showcaseview.ShowcaseView; //导入依赖的package包/类
/**
* Calculates the best place to position text
*
* @param canvasW width of the screen
* @param canvasH height of the screen
*/
@Override
public void calculateTextPosition(int canvasW, int canvasH, ShowcaseView showcaseView) {
//if the width isn't much bigger than the voided area, just consider top & bottom
float spaceTop = mCalculator.getShowcaseRect().top;
float spaceBottom = canvasH - mCalculator.getShowcaseRect().bottom
- 64 * mDensityScale; //64dip considers the OK button
//float spaceLeft = voidedArea.left;
//float spaceRight = canvasW - voidedArea.right;
//TODO: currently only considers above or below showcase, deal with left or right
mBestTextPosition[0] = 24 * mDensityScale;
mBestTextPosition[1] = spaceTop > spaceBottom ? 128 * mDensityScale
: 24 * mDensityScale + mCalculator.getShowcaseRect().bottom;
mBestTextPosition[2] = canvasW - 48 * mDensityScale;
}
示例5: ShowcaseViewDialog
import com.espian.showcaseview.ShowcaseView; //导入依赖的package包/类
public ShowcaseViewDialog(Activity ctx, Target target, String title,
String msg, Gesture gesture)
{
// Construct an invisible dialog
super(ctx, R.style.ShowcaseViewDialogTheme);
ShowcaseView.ConfigOptions co = new ShowcaseView.ConfigOptions();
RelativeLayout.LayoutParams lps = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
lps.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
lps.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
co.buttonLayoutParams = lps;
// Create the ShowcaseView and directly remove is from its parent
ShowcaseView sv = ShowcaseView.insertShowcaseView(target, ctx, title,
msg, co);
((ViewGroup) sv.getParent()).removeView(sv);
sv.setOnShowcaseEventListener(new ShowcaseEventListener());
this.sv = sv;
this.gesture = gesture;
this.activity = ctx;
// Set the ShowcaseView as content
setContentView(sv);
}
示例6: getShowcasePointFromView
import com.espian.showcaseview.ShowcaseView; //导入依赖的package包/类
public static final Point getShowcasePointFromView(View view, ShowcaseView.ConfigOptions options) {
Point result = new Point();
if (options.insert == ShowcaseView.INSERT_TO_VIEW) {
result.x = view.getLeft() + view.getWidth() / 2;
result.y = view.getTop() + view.getHeight() / 2;
} else {
int[] coordinates = new int[2];
view.getLocationInWindow(coordinates);
result.x = coordinates[0] + view.getWidth() / 2;
result.y = coordinates[1] + view.getHeight() / 2;
}
return result;
}
示例7: getShowcasePointFromView
import com.espian.showcaseview.ShowcaseView; //导入依赖的package包/类
public static final Point getShowcasePointFromView(View view,
ShowcaseView.ConfigOptions options) {
Point result = new Point();
if (options.insert == ShowcaseView.INSERT_TO_VIEW) {
result.x = view.getLeft() + view.getWidth() / 2;
result.y = view.getTop() + view.getHeight() / 2;
} else {
int[] coordinates = new int[2];
view.getLocationInWindow(coordinates);
result.x = coordinates[0] + view.getWidth() / 2;
result.y = coordinates[1] + view.getHeight() / 2;
}
return result;
}
示例8: onResumeFragments
import com.espian.showcaseview.ShowcaseView; //导入依赖的package包/类
@Override
protected void onResumeFragments() {
super.onResumeFragments();
if (SettingUtils.isClickToTopTipFirstShow()) {
ViewTarget target = new ViewTarget(getClickToTopView());
ShowcaseView.insertShowcaseView(target, this, R.string.tip, R.string.click_to_top_tip);
}
}
示例9: onActivityCreated
import com.espian.showcaseview.ShowcaseView; //导入依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
//setContentView() needs to be called in the Activity first.
//That's why it has to be in onActivityCreated().
ShowcaseView.ConfigOptions co = new ShowcaseView.ConfigOptions();
co.hideOnClickOutside = true;
sv = ShowcaseView.insertShowcaseView(new ViewTarget(R.id.buttonFragments, getActivity()), getActivity(), R.string.showcase_fragment_title, R.string.showcase_fragment_message, co);
}
示例10: onCreate
import com.espian.showcaseview.ShowcaseView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sample_legacy);
findViewById(R.id.buttonLike).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(getApplicationContext(), R.string.like_message, Toast.LENGTH_SHORT).show();
}
});
mOptions.block = false;
mOptions.hideOnClickOutside = false;
mViews = new ShowcaseViews(this,
new ShowcaseViews.OnShowcaseAcknowledged() {
@Override
public void onShowCaseAcknowledged(ShowcaseView showcaseView) {
Toast.makeText(MultipleShowcaseSampleActivity.this, R.string.dismissed_message, Toast.LENGTH_SHORT).show();
}
});
mViews.addView( new ShowcaseViews.ItemViewProperties(R.id.image,
R.string.showcase_image_title,
R.string.showcase_image_message,
SHOWCASE_KITTEN_SCALE));
mViews.addView( new ShowcaseViews.ItemViewProperties(R.id.buttonLike,
R.string.showcase_like_title,
R.string.showcase_like_message,
SHOWCASE_LIKE_SCALE));
mViews.show();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
enableUp();
}
}
示例11: onCreateOptionsMenu
import com.espian.showcaseview.ShowcaseView; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getSupportMenuInflater().inflate(R.menu.menu, menu);
ActionViewTarget target = new ActionViewTarget(this, ActionViewTarget.Type.OVERFLOW);
sv = ShowcaseView.insertShowcaseView(target, this,
R.string.showcase_simple_title, R.string.showcase_simple_message, mOptions);
return super.onCreateOptionsMenu(menu);
}
示例12: onCreate
import com.espian.showcaseview.ShowcaseView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_animation);
counter = 0;
final TextView textView1 = (TextView) findViewById(R.id.textView);
final TextView textView2 = (TextView) findViewById(R.id.textView2);
final TextView textView3 = (TextView) findViewById(R.id.textView3);
showcaseView = ShowcaseView.insertShowcaseView(new ViewTarget(findViewById(R.id.textView)), this);
showcaseView.overrideButtonClick(new View.OnClickListener() {
@Override
public void onClick(View view) {
switch (counter) {
case 0:
showcaseView.setShowcase(new ViewTarget(textView2), true);
break;
case 1:
showcaseView.setShowcase(new ViewTarget(textView3), true);
break;
case 2:
showcaseView.setShowcase(ShowcaseView.NONE);
showcaseView.setText("Look ma!", "You don't always need a target to showcase");
setAlpha(0.4f, textView1, textView2, textView3);
break;
case 3:
showcaseView.hide();
setAlpha(1.0f, textView1, textView2, textView3);
break;
}
counter++;
}
});
}
示例13: onCreate
import com.espian.showcaseview.ShowcaseView; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
HardcodedListAdapter adapter = new HardcodedListAdapter(this);
listView = (ListView) findViewById(R.id.listView);
listView.setAdapter(adapter);
listView.setOnItemClickListener(this);
dimView(listView);
buttonBlocked = (Button) findViewById(R.id.buttonBlocked);
buttonBlocked.setOnClickListener(this);
ShowcaseView.ConfigOptions co = new ShowcaseView.ConfigOptions();
co.hideOnClickOutside = true;
// The following code will reposition the OK button to the left.
// RelativeLayout.LayoutParams lps = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
// lps.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
// lps.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
// int margin = ((Number) (getResources().getDisplayMetrics().density * 12)).intValue();
// lps.setMargins(margin, margin, margin, margin);
// co.buttonLayoutParams = lps;
ViewTarget target = new ViewTarget(R.id.buttonBlocked, this);
sv = ShowcaseView.insertShowcaseView(target, this, R.string.showcase_main_title, R.string.showcase_main_message, co);
sv.setOnShowcaseEventListener(this);
}
示例14: onShowcaseViewHide
import com.espian.showcaseview.ShowcaseView; //导入依赖的package包/类
@Override
public void onShowcaseViewHide(ShowcaseView showcaseView) {
if (isHoneycombOrAbove()) {
listView.setAlpha(1f);
}
buttonBlocked.setEnabled(false);
}
示例15: onResumeFragments
import com.espian.showcaseview.ShowcaseView; //导入依赖的package包/类
@Override
protected void onResumeFragments() {
super.onResumeFragments();
if (SettingUtility.isClickToTopTipFirstShow()) {
ViewTarget target = new ViewTarget(getClickToTopView());
ShowcaseView.insertShowcaseView(target, this, R.string.tip,
R.string.click_to_top_tip);
}
}