List of usage examples for android.widget RelativeLayout setLayoutTransition
public void setLayoutTransition(LayoutTransition transition)
From source file:org.eyeseetea.malariacare.LoginActivity.java
private void initProgressBar() { bar = (CircularProgressBar) findViewById(R.id.progress_bar_circular); float progressBarStrokeWidth = getResources().getDimensionPixelSize(R.dimen.progressbar_stroke_width); bar.setIndeterminateDrawable(new CircularProgressDrawable.Builder(this) .color(ContextCompat.getColor(this, R.color.color_primary_default)) .style(CircularProgressDrawable.STYLE_ROUNDED).strokeWidth(progressBarStrokeWidth).rotationSpeed(1f) .sweepSpeed(1f).build());//from w w w. j a v a 2 s .co m onPostAnimationListener = new OnPostAnimationListener(); /* adding transition animations to root layout */ if (isGreaterThanOrJellyBean()) { layoutTransition = new LayoutTransition(); layoutTransition.enableTransitionType(LayoutTransition.CHANGING); layoutTransition.addTransitionListener(onPostAnimationListener); RelativeLayout loginLayoutContent = (RelativeLayout) findViewById( org.hisp.dhis.client.sdk.ui.R.id.layout_content); loginLayoutContent.setLayoutTransition(layoutTransition); } else { layoutTransitionSlideIn = AnimationUtils.loadAnimation(this, org.hisp.dhis.client.sdk.ui.R.anim.in_up); layoutTransitionSlideOut = AnimationUtils.loadAnimation(this, org.hisp.dhis.client.sdk.ui.R.anim.out_down); layoutTransitionSlideIn.setAnimationListener(onPostAnimationListener); layoutTransitionSlideOut.setAnimationListener(onPostAnimationListener); } }
From source file:br.ufrgs.ufrgsmapas.libs.SearchBox.java
/** * Create a searchbox with params and a style * @param context Context//w w w .jav a 2s .c o m * @param attrs Attributes * @param defStyle Style */ public SearchBox(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); inflate(context, R.layout.searchbox, this); this.searchOpen = false; this.isMic = true; this.materialMenu = (MaterialMenuView) findViewById(R.id.material_menu_button); this.logo = (TextView) findViewById(R.id.logo); this.search = (EditText) findViewById(R.id.search); this.results = (ListView) findViewById(R.id.results); this.context = context; this.pb = (ProgressBar) findViewById(R.id.pb); this.mic = (ImageView) findViewById(R.id.mic); this.drawerLogo = (ImageView) findViewById(R.id.drawer_logo); mCollator = Collator.getInstance(new Locale("pt", "BR")); mCollator.setStrength(Collator.PRIMARY); materialMenu.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (searchOpen) { toggleSearch(); } else { if (menuListener != null) menuListener.onMenuClick(); } } }); resultList = new ArrayList<SearchResult>(); results.setAdapter(new SearchAdapter(context, resultList)); animate = true; isVoiceRecognitionIntentSupported = isIntentAvailable(context, new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH)); logo.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { toggleSearch(); } }); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { RelativeLayout searchRoot = (RelativeLayout) findViewById(R.id.search_root); LayoutTransition lt = new LayoutTransition(); lt.setDuration(100); searchRoot.setLayoutTransition(lt); } searchables = new ArrayList<SearchResult>(); search.setOnEditorActionListener(new OnEditorActionListener() { public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_SEARCH) { search(getSearchText()); return true; } return false; } }); search.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_ENTER) { if (TextUtils.isEmpty(getSearchText())) { toggleSearch(); } else { search(getSearchText()); } return true; } return false; } }); logoText = "Logo"; micStateChanged(); mic.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (voiceRecognitionListener != null) { voiceRecognitionListener.onClick(); } else { micClick(); } } }); }