List of usage examples for android.widget ViewFlipper setDisplayedChild
@android.view.RemotableViewMethod public void setDisplayedChild(int whichChild)
From source file:Main.java
public static void FlipperShowIndex(Context context, ViewFlipper viewf, int index, int[] anmiArray) { if (viewf.getChildCount() != anmiArray.length / 2) return;/*from w w w .j a v a 2 s .co m*/ if (viewf.getDisplayedChild() != index) { viewf.setInAnimation(context, anmiArray[2 * index]); viewf.setOutAnimation(context, anmiArray[2 * index + 1]); viewf.setDisplayedChild(index); } }
From source file:com.parse.favourama.ACTLoginSelf.java
public void flipToLogIn(View view) { ViewFlipper vf = (ViewFlipper) findViewById(R.id.viewFlipper); vf.setDisplayedChild(0); alertMsg.setText(""); findViewById(R.id.ava_state_container).setVisibility(View.GONE); }
From source file:com.parse.favourama.ACTLoginSelf.java
public void waitForVerify() { ViewFlipper viewFlipper = (ViewFlipper) findViewById(R.id.forget_password_flipper); viewFlipper.setDisplayedChild(2); }
From source file:com.parse.favourama.ACTLoginSelf.java
public void onClickForgetPasswordDisplay(View view) { ViewFlipper viewFlipper = (ViewFlipper) findViewById(R.id.forget_password_flipper); viewFlipper.setDisplayedChild(1); alertMsg.setText(""); }
From source file:com.parse.favourama.ACTLoginSelf.java
public void flipTwiceToLogIn(View view) { ViewFlipper viewFlipper = (ViewFlipper) findViewById(R.id.forget_password_flipper); viewFlipper.setDisplayedChild(0); ViewFlipper vf = (ViewFlipper) findViewById(R.id.viewFlipper); vf.setDisplayedChild(0);//from w w w . j ava 2 s . c o m alertMsg.setText(""); findViewById(R.id.ava_state_container).setVisibility(View.GONE); }
From source file:eu.e43.impeller.activity.MainActivity.java
public void hideOverlay(OverlayController controller) { if (m_overlayController == controller) { ViewFlipper flipper = (ViewFlipper) findViewById(R.id.overlay_flipper); flipper.setDisplayedChild(0); flipper.removeViewAt(1);/*from w w w .jav a 2 s. co m*/ m_overlayController = null; setUiFlags(); } }
From source file:eu.e43.impeller.activity.MainActivity.java
public void showOverlay(OverlayController controller, View overlay) { if (m_overlayController != null) { evictOverlay();/* www . j av a 2s . c o m*/ } ViewFlipper flipper = (ViewFlipper) findViewById(R.id.overlay_flipper); flipper.addView(overlay); flipper.setDisplayedChild(1); m_overlayController = controller; setUiFlags(); }
From source file:com.example.linhdq.test.documents.creation.visualisation.LayoutQuestionDialog.java
@NonNull @Override/*from w w w . ja va 2 s . c o m*/ public Dialog onCreateDialog(Bundle savedInstanceState) { final Context context = getContext(); mLayout = null; Pair<String, String> language = PreferencesUtils.getOCRLanguage(context); final InstallStatus installStatus = OcrLanguageDataStore.isLanguageInstalled(language.first, context); if (!installStatus.isInstalled()) { final String defaultLanguage = context.getString(R.string.default_ocr_language); final String defaultLanguageDisplay = context.getString(R.string.default_ocr_display_language); language = Pair.create(defaultLanguage, defaultLanguageDisplay); } mLanguage = language.first; AlertDialog.Builder builder; builder = new AlertDialog.Builder(context); builder.setCancelable(false); View layout = View.inflate(context, R.layout.dialog_layout_question, null); builder.setView(layout); final ViewFlipper titleViewFlipper = (ViewFlipper) layout.findViewById(R.id.layout_title); final ImageView columnLayout = (ImageView) layout.findViewById(R.id.column_layout); final ImageView pageLayout = (ImageView) layout.findViewById(R.id.page_layout); final ImageSwitcher fairy = (ImageSwitcher) layout.findViewById(R.id.fairy_layout); fairy.setFactory(new ViewSwitcher.ViewFactory() { public View makeView() { return new ImageView(context); } }); fairy.setImageResource(R.drawable.fairy_looks_center); fairy.setInAnimation(context, android.R.anim.fade_in); fairy.setOutAnimation(context, android.R.anim.fade_out); final int color = context.getResources().getColor(R.color.progress_color); final PorterDuffColorFilter colorFilter = new PorterDuffColorFilter(color, PorterDuff.Mode.LIGHTEN); columnLayout.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mLayout != LayoutKind.COMPLEX) { fairy.setImageResource(R.drawable.fairy_looks_left); titleViewFlipper.setDisplayedChild(2); columnLayout.setColorFilter(colorFilter); pageLayout.clearColorFilter(); mLayout = LayoutKind.COMPLEX; } } }); pageLayout.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mLayout != LayoutKind.SIMPLE) { mLayout = LayoutKind.SIMPLE; titleViewFlipper.setDisplayedChild(1); fairy.setImageResource(R.drawable.fairy_looks_right); pageLayout.setColorFilter(colorFilter); columnLayout.clearColorFilter(); } } }); final Spinner langButton = (Spinner) layout.findViewById(R.id.button_language); List<OcrLanguage> installedLanguages = OcrLanguageDataStore.getInstalledOCRLanguages(context); // actual values uses by tesseract final ArrayAdapter<OcrLanguage> adapter = new ArrayAdapter<>(context, R.layout.item_spinner_language, installedLanguages); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); langButton.setAdapter(adapter); for (int i = 0; i < installedLanguages.size(); i++) { OcrLanguage lang = installedLanguages.get(i); if (lang.getValue().equals(language.first)) { langButton.setSelection(i, false); break; } } langButton.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { final OcrLanguage item = adapter.getItem(position); mLanguage = item.getValue(); PreferencesUtils.saveOCRLanguage(context, item); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); builder.setPositiveButton(R.string.start_scan, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { if (mLayout == null) { mLayout = LayoutKind.SIMPLE; } LayoutChoseListener listener = (LayoutChoseListener) getActivity(); listener.onLayoutChosen(mLayout, mLanguage); dialog.dismiss(); } }); builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { getActivity().finish(); dialog.dismiss(); } }); return builder.create(); }
From source file:com.renard.ocr.documents.creation.visualisation.LayoutQuestionDialog.java
@NonNull @Override/*from ww w. j av a2 s . c o m*/ public Dialog onCreateDialog(Bundle savedInstanceState) { getAnalytics().sendScreenView(SCREEN_NAME); final Context context = getContext(); mLayout = null; Pair<String, String> language = PreferencesUtils.getOCRLanguage(context); final OcrLanguage.InstallStatus installStatus = OcrLanguageDataStore.isLanguageInstalled(language.first, context); if (!installStatus.isInstalled()) { final String defaultLanguage = context.getString(R.string.default_ocr_language); final String defaultLanguageDisplay = context.getString(R.string.default_ocr_display_language); language = Pair.create(defaultLanguage, defaultLanguageDisplay); } mLanguage = language.first; AlertDialog.Builder builder; builder = new AlertDialog.Builder(context); builder.setCancelable(false); View layout = View.inflate(context, R.layout.dialog_layout_question, null); builder.setView(layout); final ViewFlipper titleViewFlipper = (ViewFlipper) layout.findViewById(R.id.layout_title); final ImageView columnLayout = (ImageView) layout.findViewById(R.id.column_layout); final ImageView pageLayout = (ImageView) layout.findViewById(R.id.page_layout); final ImageSwitcher fairy = (ImageSwitcher) layout.findViewById(R.id.fairy_layout); fairy.setFactory(new ViewSwitcher.ViewFactory() { public View makeView() { return new ImageView(context); } }); fairy.setImageResource(R.drawable.fairy_looks_center); fairy.setInAnimation(context, android.R.anim.fade_in); fairy.setOutAnimation(context, android.R.anim.fade_out); final int color = context.getResources().getColor(R.color.progress_color); final PorterDuffColorFilter colorFilter = new PorterDuffColorFilter(color, PorterDuff.Mode.LIGHTEN); columnLayout.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mLayout != LayoutKind.COMPLEX) { fairy.setImageResource(R.drawable.fairy_looks_left); titleViewFlipper.setDisplayedChild(2); columnLayout.setColorFilter(colorFilter); pageLayout.clearColorFilter(); mLayout = LayoutKind.COMPLEX; } } }); pageLayout.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mLayout != LayoutKind.SIMPLE) { mLayout = LayoutKind.SIMPLE; titleViewFlipper.setDisplayedChild(1); fairy.setImageResource(R.drawable.fairy_looks_right); pageLayout.setColorFilter(colorFilter); columnLayout.clearColorFilter(); } } }); final Spinner langButton = (Spinner) layout.findViewById(R.id.button_language); List<OcrLanguage> installedLanguages = OcrLanguageDataStore.getInstalledOCRLanguages(context); // actual values uses by tesseract final ArrayAdapter<OcrLanguage> adapter = new ArrayAdapter<>(context, R.layout.language_spinner_item, installedLanguages); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); langButton.setAdapter(adapter); for (int i = 0; i < installedLanguages.size(); i++) { OcrLanguage lang = installedLanguages.get(i); if (lang.getValue().equals(language.first)) { langButton.setSelection(i, false); break; } } langButton.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { final OcrLanguage item = adapter.getItem(position); mLanguage = item.getValue(); PreferencesUtils.saveOCRLanguage(context, item); getAnalytics().sendOcrLanguageChanged(item); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); builder.setPositiveButton(R.string.start_scan, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { if (mLayout == null) { mLayout = LayoutKind.SIMPLE; } LayoutChoseListener listener = (LayoutChoseListener) getActivity(); listener.onLayoutChosen(mLayout, mLanguage); getAnalytics().sendOcrStarted(mLanguage, mLayout); dialog.dismiss(); } }); builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { getActivity().finish(); dialog.dismiss(); getAnalytics().sendLayoutDialogCancelled(); } }); return builder.create(); }