List of usage examples for android.widget RelativeLayout ALIGN_PARENT_START
int ALIGN_PARENT_START
To view the source code for android.widget RelativeLayout ALIGN_PARENT_START.
Click Source Link
From source file:com.adithyaupadhya.uimodule.roundcornerprogressbar.BaseRoundCornerProgressBar.java
private void setupReverse(LinearLayout layoutProgress) { RelativeLayout.LayoutParams progressParams = (RelativeLayout.LayoutParams) layoutProgress.getLayoutParams(); removeLayoutParamsRule(progressParams); if (isReverse) { progressParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); // For support with RTL on API 17 or more if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) progressParams.addRule(RelativeLayout.ALIGN_PARENT_END); } else {//ww w .j a v a 2 s . co m progressParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); // For support with RTL on API 17 or more if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) progressParams.addRule(RelativeLayout.ALIGN_PARENT_START); } layoutProgress.setLayoutParams(progressParams); }
From source file:com.adithyaupadhya.uimodule.roundcornerprogressbar.BaseRoundCornerProgressBar.java
private void removeLayoutParamsRule(RelativeLayout.LayoutParams layoutParams) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { layoutParams.removeRule(RelativeLayout.ALIGN_PARENT_RIGHT); layoutParams.removeRule(RelativeLayout.ALIGN_PARENT_END); layoutParams.removeRule(RelativeLayout.ALIGN_PARENT_LEFT); layoutParams.removeRule(RelativeLayout.ALIGN_PARENT_START); } else {/* w w w. j a va 2s .c om*/ layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, 0); } }
From source file:com.hybris.mobile.lib.ui.view.Alert.java
/** * Set the icon on the alert/* w w w .j a v a 2s . c o m*/ * * @param context application-specific resources * @param configuration describes all device configuration information * @param mainView ViewGroup resources * @param textView alert message to be viewed message to be displayedView */ @SuppressLint("NewApi") private static void setIcon(Activity context, Configuration configuration, ViewGroup mainView, TextView textView) { ImageView imageView = (ImageView) mainView.findViewById(R.id.alert_view_icon); // Reset the current icon if (imageView != null) { mainView.removeView(imageView); } // On the textview as well textView.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); textView.setCompoundDrawablePadding(0); if (configuration.getIconResId() != -1) { imageView = new ImageView(context); imageView.setId(R.id.alert_view_icon); imageView.setImageResource(configuration.getIconResId()); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); imageView.setLayoutParams(layoutParams); switch (configuration.getIconPosition()) { case LEFT_TEXT: textView.setCompoundDrawablesWithIntrinsicBounds(configuration.getIconResId(), 0, 0, 0); textView.setCompoundDrawablePadding(10); break; case RIGHT_TEXT: textView.setCompoundDrawablesWithIntrinsicBounds(0, 0, configuration.getIconResId(), 0); textView.setCompoundDrawablePadding(10); break; case LEFT: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { layoutParams.addRule(RelativeLayout.ALIGN_PARENT_START); } layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); layoutParams.setMargins(25, 0, 0, 0); mainView.addView(imageView); // We redefine the layout params otherwise the image is not well aligned textView.setLayoutParams( new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); break; case RIGHT: default: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { layoutParams.addRule(RelativeLayout.ALIGN_PARENT_END); } layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); layoutParams.setMargins(0, 0, 25, 0); mainView.addView(imageView); // We redefine the layout params otherwise the image is not well aligned textView.setLayoutParams( new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); break; } } }
From source file:com.raspi.chatapp.ui.chatting.SendImageFragment.java
private void keyboardClosed() { if (keyboardShown) { try {//from www . ja va 2 s. c om showSystemUI(); View buttons = getActivity().findViewById(R.id.send_image_buttons); View viewPager = getActivity().findViewById(R.id.send_image_view_pager); RelativeLayout.LayoutParams viewPagerParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); viewPagerParams.addRule(RelativeLayout.ABOVE, R.id.send_image_overview); viewPagerParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); viewPagerParams.addRule(RelativeLayout.ALIGN_PARENT_START); viewPager.setLayoutParams(viewPagerParams); RelativeLayout.LayoutParams imageParams = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); imageParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); images.get(current).getImageLayout().setLayoutParams(imageParams); if (images.size() > 1) getActivity().findViewById(R.id.send_image_overview).setVisibility(View.VISIBLE); buttons.setVisibility(View.VISIBLE); } catch (Exception e) { e.printStackTrace(); } keyboardShown = false; } }
From source file:com.raspi.chatapp.ui.chatting.SendImageFragment.java
private void keyboardOpened() { if (!keyboardShown) { try {/*w w w . ja va 2s . c o m*/ View buttons = getActivity().findViewById(R.id.send_image_buttons); View viewPager = getActivity().findViewById(R.id.send_image_view_pager); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); params.addRule(RelativeLayout.ALIGN_PARENT_LEFT); params.addRule(RelativeLayout.ALIGN_PARENT_START); viewPager.setLayoutParams(params); RelativeLayout.LayoutParams imageParams = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); imageParams.addRule(RelativeLayout.ABOVE, R.id.send_image_description_layout); images.get(current).getImageLayout().setLayoutParams(imageParams); if (images.size() > 1) getActivity().findViewById(R.id.send_image_overview).setVisibility(View.GONE); buttons.setVisibility(View.GONE); hideSystemUI(); } catch (Exception e) { e.printStackTrace(); } keyboardShown = true; } }
From source file:kr.wdream.ui.Components.PasscodeView.java
private void checkFingerprint() { Activity parentActivity = (Activity) getContext(); if (Build.VERSION.SDK_INT >= 23 && parentActivity != null && UserConfig.useFingerprint && !ApplicationLoader.mainInterfacePaused) { try {/*from w ww.jav a2 s . co m*/ if (fingerprintDialog != null && fingerprintDialog.isShowing()) { return; } } catch (Exception e) { FileLog.e("tmessages", e); } try { FingerprintManagerCompat fingerprintManager = FingerprintManagerCompat .from(ApplicationLoader.applicationContext); if (fingerprintManager.isHardwareDetected() && fingerprintManager.hasEnrolledFingerprints()) { RelativeLayout relativeLayout = new RelativeLayout(getContext()); relativeLayout.setPadding(AndroidUtilities.dp(24), AndroidUtilities.dp(16), AndroidUtilities.dp(24), AndroidUtilities.dp(8)); TextView fingerprintTextView = new TextView(getContext()); fingerprintTextView.setTextColor(0xff939393); fingerprintTextView.setId(id_fingerprint_textview); fingerprintTextView.setTextAppearance(android.R.style.TextAppearance_Material_Subhead); fingerprintTextView.setText(LocaleController.getString("FingerprintInfo", kr.wdream.storyshop.R.string.FingerprintInfo)); relativeLayout.addView(fingerprintTextView); RelativeLayout.LayoutParams layoutParams = LayoutHelper .createRelative(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_START); fingerprintTextView.setLayoutParams(layoutParams); fingerprintImageView = new ImageView(getContext()); fingerprintImageView.setImageResource(kr.wdream.storyshop.R.drawable.ic_fp_40px); fingerprintImageView.setId(id_fingerprint_imageview); relativeLayout.addView(fingerprintImageView, LayoutHelper.createRelative(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, 0, 20, 0, 0, RelativeLayout.ALIGN_PARENT_START, RelativeLayout.BELOW, id_fingerprint_textview)); fingerprintStatusTextView = new TextView(getContext()); fingerprintStatusTextView.setGravity(Gravity.CENTER_VERTICAL); fingerprintStatusTextView.setText(LocaleController.getString("FingerprintHelp", kr.wdream.storyshop.R.string.FingerprintHelp)); fingerprintStatusTextView.setTextAppearance(android.R.style.TextAppearance_Material_Body1); fingerprintStatusTextView.setTextColor(0x42000000); relativeLayout.addView(fingerprintStatusTextView); layoutParams = LayoutHelper.createRelative(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT); layoutParams.setMarginStart(AndroidUtilities.dp(16)); layoutParams.addRule(RelativeLayout.ALIGN_BOTTOM, id_fingerprint_imageview); layoutParams.addRule(RelativeLayout.ALIGN_TOP, id_fingerprint_imageview); layoutParams.addRule(RelativeLayout.END_OF, id_fingerprint_imageview); fingerprintStatusTextView.setLayoutParams(layoutParams); AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); builder.setTitle(LocaleController.getString("AppName", kr.wdream.storyshop.R.string.AppName)); builder.setView(relativeLayout); builder.setNegativeButton( LocaleController.getString("Cancel", kr.wdream.storyshop.R.string.Cancel), null); builder.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { if (cancellationSignal != null) { selfCancelled = true; cancellationSignal.cancel(); cancellationSignal = null; } } }); if (fingerprintDialog != null) { try { if (fingerprintDialog.isShowing()) { fingerprintDialog.dismiss(); } } catch (Exception e) { FileLog.e("tmessages", e); } } fingerprintDialog = builder.show(); cancellationSignal = new CancellationSignal(); selfCancelled = false; fingerprintManager.authenticate(null, 0, cancellationSignal, new FingerprintManagerCompat.AuthenticationCallback() { @Override public void onAuthenticationError(int errMsgId, CharSequence errString) { if (!selfCancelled) { showFingerprintError(errString); } } @Override public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) { showFingerprintError(helpString); } @Override public void onAuthenticationFailed() { showFingerprintError(LocaleController.getString("FingerprintNotRecognized", kr.wdream.storyshop.R.string.FingerprintNotRecognized)); } @Override public void onAuthenticationSucceeded( FingerprintManagerCompat.AuthenticationResult result) { try { if (fingerprintDialog.isShowing()) { fingerprintDialog.dismiss(); } } catch (Exception e) { FileLog.e("tmessages", e); } fingerprintDialog = null; processDone(true); } }, null); } } catch (Throwable e) { //ignore } } }
From source file:ir.besteveryeverapp.ui.Components.PasscodeView.java
private void checkFingerprint() { Activity parentActivity = (Activity) getContext(); if (Build.VERSION.SDK_INT >= 23 && parentActivity != null && UserConfig.useFingerprint && !ApplicationLoader.mainInterfacePaused) { try {/*from w w w . jav a 2 s. com*/ if (fingerprintDialog != null && fingerprintDialog.isShowing()) { return; } } catch (Exception e) { FileLog.e("tmessages", e); } try { FingerprintManagerCompat fingerprintManager = FingerprintManagerCompat .from(ApplicationLoader.applicationContext); if (fingerprintManager.isHardwareDetected() && fingerprintManager.hasEnrolledFingerprints()) { RelativeLayout relativeLayout = new RelativeLayout(getContext()); relativeLayout.setPadding(AndroidUtilities.dp(24), AndroidUtilities.dp(16), AndroidUtilities.dp(24), AndroidUtilities.dp(8)); TextView fingerprintTextView = new TextView(getContext()); fingerprintTextView.setTypeface(FontManager.instance().getTypeface()); fingerprintTextView.setTextColor(0xff939393); fingerprintTextView.setId(id_fingerprint_textview); fingerprintTextView.setTextAppearance(android.R.style.TextAppearance_Material_Subhead); fingerprintTextView .setText(LocaleController.getString("FingerprintInfo", R.string.FingerprintInfo)); relativeLayout.addView(fingerprintTextView); RelativeLayout.LayoutParams layoutParams = LayoutHelper .createRelative(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_START); fingerprintTextView.setLayoutParams(layoutParams); fingerprintImageView = new ImageView(getContext()); fingerprintImageView.setImageResource(R.drawable.ic_fp_40px); fingerprintImageView.setId(id_fingerprint_imageview); relativeLayout.addView(fingerprintImageView, LayoutHelper.createRelative(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, 0, 20, 0, 0, RelativeLayout.ALIGN_PARENT_START, RelativeLayout.BELOW, id_fingerprint_textview)); fingerprintStatusTextView = new TextView(getContext()); fingerprintStatusTextView.setTypeface(FontManager.instance().getTypeface()); fingerprintStatusTextView.setGravity(Gravity.CENTER_VERTICAL); fingerprintStatusTextView .setText(LocaleController.getString("FingerprintHelp", R.string.FingerprintHelp)); fingerprintStatusTextView.setTextAppearance(android.R.style.TextAppearance_Material_Body1); fingerprintStatusTextView.setTextColor(0x42000000); relativeLayout.addView(fingerprintStatusTextView); layoutParams = LayoutHelper.createRelative(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT); layoutParams.setMarginStart(AndroidUtilities.dp(16)); layoutParams.addRule(RelativeLayout.ALIGN_BOTTOM, id_fingerprint_imageview); layoutParams.addRule(RelativeLayout.ALIGN_TOP, id_fingerprint_imageview); layoutParams.addRule(RelativeLayout.END_OF, id_fingerprint_imageview); fingerprintStatusTextView.setLayoutParams(layoutParams); AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); builder.setView(relativeLayout); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); builder.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { if (cancellationSignal != null) { selfCancelled = true; cancellationSignal.cancel(); cancellationSignal = null; } } }); if (fingerprintDialog != null) { try { if (fingerprintDialog.isShowing()) { fingerprintDialog.dismiss(); } } catch (Exception e) { FileLog.e("tmessages", e); } } fingerprintDialog = builder.show(); cancellationSignal = new CancellationSignal(); selfCancelled = false; fingerprintManager.authenticate(null, 0, cancellationSignal, new FingerprintManagerCompat.AuthenticationCallback() { @Override public void onAuthenticationError(int errMsgId, CharSequence errString) { if (!selfCancelled) { showFingerprintError(errString); } } @Override public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) { showFingerprintError(helpString); } @Override public void onAuthenticationFailed() { showFingerprintError(LocaleController.getString("FingerprintNotRecognized", R.string.FingerprintNotRecognized)); } @Override public void onAuthenticationSucceeded( FingerprintManagerCompat.AuthenticationResult result) { try { if (fingerprintDialog.isShowing()) { fingerprintDialog.dismiss(); } } catch (Exception e) { FileLog.e("tmessages", e); } fingerprintDialog = null; processDone(true); } }, null); } } catch (Throwable e) { //ignore } } }
From source file:com.goftagram.telegram.ui.Components.PasscodeView.java
private void checkFingerprint() { Activity parentActivity = (Activity) getContext(); if (Build.VERSION.SDK_INT >= 23 && parentActivity != null && UserConfig.useFingerprint && !ApplicationLoader.mainInterfacePaused) { try {/*from ww w . j a va 2s .co m*/ if (fingerprintDialog != null && fingerprintDialog.isShowing()) { return; } } catch (Exception e) { FileLog.e("tmessages", e); } try { FingerprintManagerCompat fingerprintManager = FingerprintManagerCompat .from(ApplicationLoader.applicationContext); if (fingerprintManager.isHardwareDetected() && fingerprintManager.hasEnrolledFingerprints()) { RelativeLayout relativeLayout = new RelativeLayout(getContext()); relativeLayout.setPadding(AndroidUtilities.dp(24), AndroidUtilities.dp(16), AndroidUtilities.dp(24), AndroidUtilities.dp(8)); TextView fingerprintTextView = new TextView(getContext()); fingerprintTextView.setTextColor(0xff939393); fingerprintTextView.setId(id_fingerprint_textview); fingerprintTextView.setTextAppearance(android.R.style.TextAppearance_Material_Subhead); fingerprintTextView .setText(LocaleController.getString("FingerprintInfo", R.string.FingerprintInfo)); relativeLayout.addView(fingerprintTextView); RelativeLayout.LayoutParams layoutParams = LayoutHelper .createRelative(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_START); fingerprintTextView.setLayoutParams(layoutParams); fingerprintImageView = new ImageView(getContext()); fingerprintImageView.setImageResource(R.drawable.ic_fp_40px); fingerprintImageView.setId(id_fingerprint_imageview); relativeLayout.addView(fingerprintImageView, LayoutHelper.createRelative(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, 0, 20, 0, 0, RelativeLayout.ALIGN_PARENT_START, RelativeLayout.BELOW, id_fingerprint_textview)); fingerprintStatusTextView = new TextView(getContext()); fingerprintStatusTextView.setGravity(Gravity.CENTER_VERTICAL); fingerprintStatusTextView .setText(LocaleController.getString("FingerprintHelp", R.string.FingerprintHelp)); fingerprintStatusTextView.setTextAppearance(android.R.style.TextAppearance_Material_Body1); fingerprintStatusTextView.setTextColor(0x42000000); relativeLayout.addView(fingerprintStatusTextView); layoutParams = LayoutHelper.createRelative(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT); layoutParams.setMarginStart(AndroidUtilities.dp(16)); layoutParams.addRule(RelativeLayout.ALIGN_BOTTOM, id_fingerprint_imageview); layoutParams.addRule(RelativeLayout.ALIGN_TOP, id_fingerprint_imageview); layoutParams.addRule(RelativeLayout.END_OF, id_fingerprint_imageview); fingerprintStatusTextView.setLayoutParams(layoutParams); AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); builder.setView(relativeLayout); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); builder.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { if (cancellationSignal != null) { selfCancelled = true; cancellationSignal.cancel(); cancellationSignal = null; } } }); if (fingerprintDialog != null) { try { if (fingerprintDialog.isShowing()) { fingerprintDialog.dismiss(); } } catch (Exception e) { FileLog.e("tmessages", e); } } fingerprintDialog = builder.show(); cancellationSignal = new CancellationSignal(); selfCancelled = false; fingerprintManager.authenticate(null, 0, cancellationSignal, new FingerprintManagerCompat.AuthenticationCallback() { @Override public void onAuthenticationError(int errMsgId, CharSequence errString) { if (!selfCancelled) { showFingerprintError(errString); } } @Override public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) { showFingerprintError(helpString); } @Override public void onAuthenticationFailed() { showFingerprintError(LocaleController.getString("FingerprintNotRecognized", R.string.FingerprintNotRecognized)); } @Override public void onAuthenticationSucceeded( FingerprintManagerCompat.AuthenticationResult result) { try { if (fingerprintDialog.isShowing()) { fingerprintDialog.dismiss(); } } catch (Exception e) { FileLog.e("tmessages", e); } fingerprintDialog = null; processDone(true); } }, null); } } catch (Throwable e) { //ignore } } }