use of com.eveningoutpost.dexdrip.UtilityModels.JamorhamShowcaseDrawer in project xDrip by NightscoutFoundation.
the class StatsActivity method showStartupInfo.
private void showStartupInfo() {
// if (swipeInfoNotNeeded) {
// //show info only if user didn't swipe already.
// return;
// }
final boolean oneshot = true;
final int option = Home.SHOWCASE_STATISTICS;
if ((oneshot) && (ShotStateStore.hasShot(option)))
return;
// This could do with being in a utility static method also used in Home
final int size1 = 50;
final int size2 = 20;
final String title = "Swipe for Different Reports";
final String message = "Swipe left and right to see different report tabs.\n\nChoose time period for Today, Yesterday, 7 Days etc.\n\nFull screen mode, print colors and Sharing are supported from the butttons and 3 dot menu.";
final ViewTarget target = new ViewTarget(R.id.button_stats_7d, this);
final Activity activity = this;
JoH.runOnUiThreadDelayed(new Runnable() {
@Override
public void run() {
final ShowcaseView myShowcase = new ShowcaseView.Builder(activity).setTarget(target).setStyle(R.style.CustomShowcaseTheme2).setContentTitle(title).setContentText("\n" + message).setShowcaseDrawer(new JamorhamShowcaseDrawer(getResources(), getTheme(), size1, size2)).singleShot(oneshot ? option : -1).build();
myShowcase.setBackgroundColor(Color.TRANSPARENT);
myShowcase.show();
}
}, 3000);
// TextView tv = new TextView(this);
// tv.setText("Swipe left/right to switch between reports!");
// tv.setTextColor(Color.GREEN);
// tv.setTextSize(25);
// for (int i = 0; i < 2; i++) {
// Show toast twice the "long" period
// Toast toast = new Toast(getApplicationContext());
// toast.setView(tv);
// toast.setGravity(Gravity.CENTER, 0, 0);
// toast.show();
// }
}
use of com.eveningoutpost.dexdrip.UtilityModels.JamorhamShowcaseDrawer in project xDrip by NightscoutFoundation.
the class MegaStatus method startupInfo.
private void startupInfo() {
final boolean oneshot = true;
final int option = Home.SHOWCASE_MEGASTATUS;
if ((oneshot) && (ShotStateStore.hasShot(option)))
return;
// This could do with being in a utility static method also used in Home
final int size1 = 300;
final int size2 = 130;
final String title = "Swipe for Different Pages";
final String message = "Swipe left and right to see different status tabs.\n\n";
final ViewTarget target = new ViewTarget(R.id.pager_title_strip, this);
final Activity activity = this;
JoH.runOnUiThreadDelayed(new Runnable() {
@Override
public void run() {
final ShowcaseView myShowcase = new ShowcaseView.Builder(activity).setTarget(target).setStyle(R.style.CustomShowcaseTheme2).setContentTitle(title).setContentText("\n" + message).setShowcaseDrawer(new JamorhamShowcaseDrawer(getResources(), getTheme(), size1, size2, 255)).singleShot(oneshot ? option : -1).build();
myShowcase.setBackgroundColor(Color.TRANSPARENT);
myShowcase.show();
}
}, 1500);
}
use of com.eveningoutpost.dexdrip.UtilityModels.JamorhamShowcaseDrawer in project xDrip by NightscoutFoundation.
the class LanguageAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(final MyViewHolder holder, int position) {
final LanguageItem languageItem = languageList.get(position);
holder.position = position;
holder.english_text.setText(languageItem.english_text);
holder.local_text.setText(languageItem.local_text.replace("\n", " ^ "));
holder.id_text.setText(languageItem.item_name);
if (languageItem.customized) {
holder.local_text.setTextColor(Color.parseColor("#d6a5a7"));
holder.elementUndo.setVisibility(View.VISIBLE);
// optimize with flag
if (!showcased_undo) {
if (JoH.ratelimit("language-showcase", 2)) {
if (!ShotStateStore.hasShot(LanguageEditor.SHOWCASE_LANGUAGE_ELEMENT_UNDO)) {
ShowcaseView myShowcase = new ShowcaseView.Builder((Activity) context).setTarget(new ViewTarget(holder.elementUndo)).setStyle(R.style.CustomShowcaseTheme2).setContentTitle(// always in english
"Item Undo Button").setContentText(// always in english
"\n" + "You can Undo a single change by Long-pressing the Undo button.").setShowcaseDrawer(new JamorhamShowcaseDrawer(context.getResources(), context.getTheme(), 90, 14)).singleShot(LanguageEditor.oneshot ? LanguageEditor.SHOWCASE_LANGUAGE_ELEMENT_UNDO : -1).build();
myShowcase.setBackgroundColor(Color.TRANSPARENT);
myShowcase.show();
showcased_undo = true;
} else {
showcased_undo = true;
}
}
}
} else {
holder.local_text.setTextColor(Color.parseColor("#a5d6a7"));
holder.elementUndo.setVisibility(View.INVISIBLE);
}
if (languageItem.english_text.equals(languageItem.local_text)) {
holder.id_text.setText(holder.id_text.getText() + " NEW");
}
if (!showcased_newline) {
if (LanguageEditor.last_filter.length() == 0) {
if (holder.local_text.getText().toString().contains(" ^ ")) {
if (JoH.ratelimit("language-showcase", 2)) {
if (!ShotStateStore.hasShot(LanguageEditor.SHOWCASE_LANGUAGE_ELEMENT_NEWLINE)) {
ShowcaseView myShowcase = new ShowcaseView.Builder((Activity) context).setTarget(new ViewTarget(holder.local_text)).setStyle(R.style.CustomShowcaseTheme2).setContentTitle(// always in english
"Line break and other Symbols").setContentText(// always in english
"\n" + "Symbols like ^ are used internally for advancing to a new line.\n\nPlease be careful to preserve these exactly and also respect other symbols you find like : which may affect the user interface if removed.").setShowcaseDrawer(new JamorhamShowcaseDrawer(context.getResources(), context.getTheme(), 90, 50)).singleShot(LanguageEditor.oneshot ? LanguageEditor.SHOWCASE_LANGUAGE_ELEMENT_NEWLINE : -1).build();
myShowcase.setBackgroundColor(Color.TRANSPARENT);
myShowcase.show();
showcased_newline = true;
} else {
showcased_newline = true;
}
}
}
}
}
}
use of com.eveningoutpost.dexdrip.UtilityModels.JamorhamShowcaseDrawer in project xDrip by NightscoutFoundation.
the class Mdns method startupInfo.
// showcase info
private static void startupInfo(Context context) {
if (MegaStatus.runnableView == null)
return;
if (JoH.quietratelimit("mdns-showcase", 60)) {
final boolean oneshot = true;
final int option = Home.SHOWCASE_MDNS;
if ((oneshot) && (ShotStateStore.hasShot(option)))
return;
// This could do with being in a utility static method also used in Home
final int size1 = 200;
final int size2 = 70;
final String title = "Tap to add or remove";
final String message = "Devices discovered on the local network can be added or removed as collectors by tapping on them.";
final ViewTarget target = new ViewTarget(MegaStatus.runnableView);
final Activity activity = (Activity) context;
JoH.runOnUiThreadDelayed(new Runnable() {
@Override
public void run() {
final ShowcaseView myShowcase = new ShowcaseView.Builder(activity).setTarget(target).setStyle(R.style.CustomShowcaseTheme2).setContentTitle(title).setContentText("\n" + message).setShowcaseDrawer(new JamorhamShowcaseDrawer(activity.getResources(), activity.getTheme(), size1, size2, 255)).singleShot(oneshot ? option : -1).build();
myShowcase.setBackgroundColor(Color.TRANSPARENT);
myShowcase.setShouldCentreText(false);
myShowcase.setBlocksTouches(true);
myShowcase.show();
}
}, 10);
}
}
use of com.eveningoutpost.dexdrip.UtilityModels.JamorhamShowcaseDrawer in project xDrip-plus by jamorham.
the class LanguageEditor method showcasemenu.
private synchronized void showcasemenu(final int option) {
if ((myShowcase != null) && (myShowcase.isShowing()))
return;
if (ShotStateStore.hasShot(option))
return;
if (!JoH.ratelimit("language-showcase", 2))
return;
try {
ToolbarActionItemTarget target = null;
ViewTarget viewtarget = null;
String title = "";
String message = "";
switch(option) {
case SHOWCASE_LANGUAGE_INTRO:
target = new ToolbarActionItemTarget(toolbar, R.id.action_language_search);
// these messages always appear in english only
title = "Search and Submit Translations";
message = "You can help crowd-source better translations for xDrip+\n\nSimply find and edit the text, click ✔ or ➡ on your keyboard to save. Match as closely as possible the English version (including preserving punctuation symbols and capitalisation) and then use Save button to Upload your suggested changes.\n\nIt is not yet possible to preview your changes in the App, but if accepted they will appear in future updates.";
break;
case SHOWCASE_LANGUAGE_ELEMENT_UNDO:
// done inside the adapter
break;
}
// seems a bit excessive just to delay the lookup of the view to avoid it failing sometimes
final ToolbarActionItemTarget finaltarget = target;
final ViewTarget finalviewtarget = viewtarget;
final String finalmessage = message;
final String finaltitle = title;
final Activity finalactivity = this;
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
if ((finaltarget != null) || (finalviewtarget != null)) {
myShowcase = new ShowcaseView.Builder(finalactivity).setTarget((finaltarget != null) ? finaltarget : finalviewtarget).setStyle(R.style.CustomShowcaseTheme2).setContentTitle(finaltitle).setContentText("\n" + finalmessage).setShowcaseDrawer(new JamorhamShowcaseDrawer(getResources(), getTheme(), 90, 14)).singleShot(oneshot ? option : -1).build();
myShowcase.setBackgroundColor(Color.TRANSPARENT);
myShowcase.show();
}
}
}, 100);
} catch (Exception e) {
Log.e(TAG, "Exception in showcase: " + e.toString());
}
}
Aggregations