List of usage examples for android.text InputType TYPE_TEXT_VARIATION_SHORT_MESSAGE
int TYPE_TEXT_VARIATION_SHORT_MESSAGE
To view the source code for android.text InputType TYPE_TEXT_VARIATION_SHORT_MESSAGE.
Click Source Link
From source file:cz.maresmar.sfm.app.SfmApp.java
/** * Opens email app with log file//from w w w . ja v a 2s .c om */ public void sendFeedback(Context context) { // Shows subjects dialog AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(R.string.feedback_subject_title); builder.setMessage(R.string.feedback_subject_msg); // Set up the input final EditText input = new EditText(context); // Specify the type of input expected; this, for example, sets the input as a password, and will mask the text input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES); builder.setView(input); // Set up the buttons builder.setPositiveButton(android.R.string.ok, (dialog, which) -> sendFeedback(context, input.getText().toString())); builder.setNegativeButton(android.R.string.cancel, (dialog, which) -> dialog.cancel()); builder.show(); }
From source file:com.sim2dial.dialer.ChatFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { sipUri = getArguments().getString("SipUri"); String displayName = getArguments().getString("DisplayName"); String pictureUri = getArguments().getString("PictureUri"); view = inflater.inflate(R.layout.chat, container, false); contactName = (TextView) view.findViewById(R.id.contactName); contactPicture = (AvatarWithShadow) view.findViewById(R.id.contactPicture); sendMessage = (TextView) view.findViewById(R.id.sendMessage); sendMessage.setOnClickListener(this); message = (EditText) view.findViewById(R.id.message); if (!getActivity().getResources().getBoolean(R.bool.allow_chat_multiline)) { message.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE); message.setMaxLines(1);/*from w ww. jav a 2 s . c o m*/ } uploadLayout = (RelativeLayout) view.findViewById(R.id.uploadLayout); textLayout = (RelativeLayout) view.findViewById(R.id.messageLayout); messagesLayout = (RelativeLayout) view.findViewById(R.id.messages); messagesScrollView = (ScrollView) view.findViewById(R.id.chatScrollView); progressBar = (ProgressBar) view.findViewById(R.id.progressbar); sendImage = (TextView) view.findViewById(R.id.sendPicture); registerForContextMenu(sendImage); sendImage.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { pickImage(); } }); cancelUpload = (ImageView) view.findViewById(R.id.cancelUpload); cancelUpload.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { uploadThread.interrupt(); uploadLayout.setVisibility(View.GONE); textLayout.setVisibility(View.VISIBLE); progressBar.setProgress(0); } }); displayChat(displayName, pictureUri); LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { chatRoom = lc.createChatRoom(sipUri); } uploadServerUri = Engine.getPref().getString(getString(R.string.pref_image_sharing_server_key), getString(R.string.pref_image_sharing_server_default)); textWatcher = new TextWatcher() { public void afterTextChanged(Editable arg0) { } public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { } public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { if (message.getText().toString().equals("")) { sendMessage.setEnabled(false); } else { sendMessage.setEnabled(true); } } }; // Force hide keyboard if (LinphoneActivity.isInstanciated()) { InputMethodManager imm = (InputMethodManager) LinphoneActivity.instance() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); } // Workaround for SGS3 issue if (savedInstanceState != null) { fileToUploadPath = savedInstanceState.getString("fileToUploadPath"); imageToUpload = savedInstanceState.getParcelable("imageToUpload"); } if (fileToUploadPath != null || imageToUpload != null) { sendImage.post(new Runnable() { @Override public void run() { sendImage.showContextMenu(); } }); } return view; }
From source file:me.myatminsoe.myansms.MessageListActivity.java
@Override public final void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); final SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(this); setTheme(PreferencesActivity.getTheme(this)); Utils.setLocale(this); setContentView(R.layout.messagelist); getSupportActionBar().setDisplayHomeAsUpEnabled(true); Log.d(TAG, "onCreate()"); cbmgr = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); etText = (EditText) findViewById(R.id.text); int flags = etText.getInputType(); if (p.getBoolean(PreferencesActivity.PREFS_EDIT_SHORT_TEXT, true)) { flags |= InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE; } else {/*from ww w. j a v a 2s. co m*/ flags &= ~InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE; } etText.setInputType(flags); parseIntent(getIntent()); final ListView list = getListView(); list.setOnItemLongClickListener(this); list.setOnItemClickListener(this); View v = findViewById(R.id.send_); v.setOnClickListener(this); v.setOnLongClickListener(this); /* TextWatcher updating char count on writing. */ MyTextWatcher textWatcher = new MyTextWatcher(this, (AppCompatImageButton) findViewById(R.id.send_)); etText.addTextChangedListener(textWatcher); etText.setMaxLines(MAX_EDITTEXT_LINES); textWatcher.afterTextChanged(etText.getEditableText()); longItemClickDialog[WHICH_MARK_UNREAD] = getString(R.string.mark_unread_); longItemClickDialog[WHICH_REPLY] = getString(R.string.reply); longItemClickDialog[WHICH_FORWARD] = getString(R.string.forward_); longItemClickDialog[WHICH_COPY_TEXT] = getString(R.string.copy_text_); longItemClickDialog[WHICH_VIEW_DETAILS] = getString(R.string.view_details_); longItemClickDialog[WHICH_DELETE] = getString(R.string.delete_message_); etText.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { if (p.getString("output_convert", "true").equals("true")) { etText.setText(myat.uni2zg(etText.getText().toString())); } else { etText.setText(myat.zg2uni(etText.getText().toString())); } return true; } }); }
From source file:org.linphone.ChatFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreate(savedInstanceState); instance = this; View view = inflater.inflate(R.layout.chat, container, false); LinphoneManager.addListener(this); // Retain the fragment across configuration changes setRetainInstance(true);/*from ww w .jav a 2s .com*/ //Retrieve parameter from intent sipUri = getArguments().getString("SipUri"); displayName = getArguments().getString("DisplayName"); pictureUri = getArguments().getString("PictureUri"); //Initialize UI contactName = (TextView) view.findViewById(R.id.contactName); contactPicture = (AvatarWithShadow) view.findViewById(R.id.contactPicture); messagesList = (ListView) view.findViewById(R.id.chatMessageList); textLayout = (RelativeLayout) view.findViewById(R.id.messageLayout); progressBar = (ProgressBar) view.findViewById(R.id.progressbar); topBar = (LinearLayout) view.findViewById(R.id.topbar); sendMessage = (TextView) view.findViewById(R.id.sendMessage); sendMessage.setOnClickListener(this); remoteComposing = (TextView) view.findViewById(R.id.remoteComposing); remoteComposing.setVisibility(View.GONE); uploadLayout = (RelativeLayout) view.findViewById(R.id.uploadLayout); uploadLayout.setVisibility(View.GONE); displayChatHeader(displayName, pictureUri); //Manage multiline message = (EditText) view.findViewById(R.id.message); if (!getResources().getBoolean(R.bool.allow_chat_multiline)) { message.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE); message.setMaxLines(1); } sendImage = (TextView) view.findViewById(R.id.sendPicture); if (!getResources().getBoolean(R.bool.disable_chat_send_file)) { sendImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { pickImage(); } }); //registerForContextMenu(sendImage); } else { sendImage.setEnabled(false); } back = (TextView) view.findViewById(R.id.back); if (back != null) { back.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getActivity().finish(); } }); } cancelUpload = (ImageView) view.findViewById(R.id.cancelUpload); cancelUpload.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (currentMessageInFileTransferUploadState != null) { uploadLayout.setVisibility(View.GONE); textLayout.setVisibility(View.VISIBLE); progressBar.setProgress(0); currentMessageInFileTransferUploadState.cancelFileTransfer(); currentMessageInFileTransferUploadState = null; LinphoneManager.getInstance().setUploadPendingFileMessage(null); } } }); LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { chatRoom = lc.getOrCreateChatRoom(sipUri); //Only works if using liblinphone storage chatRoom.markAsRead(); } mListener = new LinphoneCoreListenerBase() { @Override public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) { LinphoneAddress from = cr.getPeerAddress(); if (from.asStringUriOnly().equals(sipUri)) { invalidate(); messagesList.setSelection(adapter.getCount() - 1); } } @Override public void isComposingReceived(LinphoneCore lc, LinphoneChatRoom room) { if (chatRoom != null && room != null && chatRoom.getPeerAddress().asStringUriOnly() .equals(room.getPeerAddress().asStringUriOnly())) { remoteComposing.setVisibility(chatRoom.isRemoteComposing() ? View.VISIBLE : View.GONE); } } }; textWatcher = new TextWatcher() { public void afterTextChanged(Editable arg0) { } public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { } public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { if (message.getText().toString().equals("")) { sendMessage.setEnabled(false); } else { if (chatRoom != null) chatRoom.compose(); sendMessage.setEnabled(true); } } }; // Force hide keyboard getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); return view; }
From source file:org.xingjitong.ChatFragment.java
@SuppressLint("Recycle") @SuppressWarnings("static-access") @Override/* w w w. ja v a2 s. co m*/ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { SharedPreferences share = PreferenceManager.getDefaultSharedPreferences(getActivity()); if (share.getInt(getString(R.string.setting_reg_uid), 0) == 0) { Toast.makeText(getActivity(), "!?,?!", Toast.LENGTH_LONG).show(); getActivity().getSupportFragmentManager().popBackStack(); } String displayName = getArguments().getString("DisplayName"); String pictureUri = getArguments().getString("PictureUri"); sipUri = getArguments().getString("SipUri"); sipUri = sipUri.substring(sipUri.indexOf(":") + 1, sipUri.indexOf("@")); try { LinphoneAddress address = LinphoneManager.getInstance().getLc().interpretUrl(sipUri); sipUri = address.asString(); sipUri = sipUri.replace("<", "").replace(">", ""); } catch (LinphoneCoreException e) { // TODO Auto-generated catch block e.printStackTrace(); } view = inflater.inflate(R.layout.chat, container, false); contactName = (TextView) view.findViewById(R.id.contactName); contactPicture = (AvatarWithShadow) view.findViewById(R.id.contactPicture); sendMessage = (TextView) view.findViewById(R.id.sendMessage); sendMessage.setOnClickListener(this); message = (EditText) view.findViewById(R.id.message); if (!getActivity().getResources().getBoolean(R.bool.allow_chat_multiline)) { message.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE); message.setMaxLines(1); } uploadLayout = (RelativeLayout) view.findViewById(R.id.uploadLayout); textLayout = (RelativeLayout) view.findViewById(R.id.messageLayout); messagesLayout = (RelativeLayout) view.findViewById(R.id.messages); messagesScrollView = (ScrollView) view.findViewById(R.id.chatScrollView); progressBar = (ProgressBar) view.findViewById(R.id.progressbar); sendImage = (TextView) view.findViewById(R.id.sendPicture); registerForContextMenu(sendImage); sendImage.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { pickImage(); } }); cancelUpload = (ImageView) view.findViewById(R.id.cancelUpload); cancelUpload.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { uploadThread.interrupt(); uploadLayout.setVisibility(View.GONE); textLayout.setVisibility(View.VISIBLE); progressBar.setProgress(0); } }); displayChat(displayName, pictureUri); LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); if (lc != null) { chatRoom = lc.createChatRoom(sipUri); } // SharedPreferences prefs = // PreferenceManager.getDefaultSharedPreferences(LinphoneActivity.instance()); // uploadServerUri = // prefs.getString(getString(R.string.pref_image_sharing_server_key), // getString(R.string.pref_image_sharing_server_default)); uploadServerUri = getString(R.string.pref_image_sharing_server_default); textWatcher = new TextWatcher() { public void afterTextChanged(Editable arg0) { } public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { } public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { if (message.getText().toString().equals("")) { sendMessage.setEnabled(false); } else { sendMessage.setEnabled(true); } } }; // Force hide keyboard if (LinphoneActivity.isInstanciated()) { InputMethodManager imm = (InputMethodManager) LinphoneActivity.instance() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); } // Workaround for SGS3 issue if (savedInstanceState != null) { fileToUploadPath = savedInstanceState.getString("fileToUploadPath"); imageToUpload = savedInstanceState.getParcelable("imageToUpload"); } if (fileToUploadPath != null || imageToUpload != null) { sendImage.post(new Runnable() { @Override public void run() { sendImage.showContextMenu(); } }); } return view; }
From source file:com.android.mms.quickmessage.QuickMessagePopup.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Initialise the message list and other variables mContext = this; mMessageList = new ArrayList<QuickMessage>(); mDefaultContactImage = getResources().getDrawable(R.drawable.ic_contact_picture); mNumTemplates = getTemplatesCount(); mPowerManager = (PowerManager) getSystemService(Context.POWER_SERVICE); mKeyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE); // Get the preferences SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext); mFullTimestamp = prefs.getBoolean(MessagingPreferenceActivity.FULL_TIMESTAMP, false); mCloseClosesAll = prefs.getBoolean(MessagingPreferenceActivity.QM_CLOSE_ALL_ENABLED, false); mWakeAndUnlock = prefs.getBoolean(MessagingPreferenceActivity.QM_LOCKSCREEN_ENABLED, false); mDarkTheme = prefs.getBoolean(MessagingPreferenceActivity.QM_DARK_THEME_ENABLED, false); mUnicodeStripping = prefs.getInt(MessagingPreferenceActivity.UNICODE_STRIPPING_VALUE, MessagingPreferenceActivity.UNICODE_STRIPPING_LEAVE_INTACT); mInputMethod = Integer.parseInt(prefs.getString(MessagingPreferenceActivity.INPUT_TYPE, Integer.toString(InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE))); mDarkTheme = mContext.getResources() .getConfiguration().uiThemeMode == Configuration.UI_THEME_MODE_HOLO_DARK; // Set the window features and layout requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.dialog_quickmessage); // Turn on the Options Menu invalidateOptionsMenu();/*from w w w . j a v a 2 s.com*/ // Load the views and Parse the intent to show the QuickMessage setupViews(); parseIntent(getIntent().getExtras(), false); setFinishOnTouchOutside(false); }
From source file:org.yaaic.fragment.ConversationFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_conversations, container, false); Settings settings = new Settings(getActivity()); boolean isLandscape = (getResources() .getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE); input = (EditText) view.findViewById(R.id.input); input.setOnKeyListener(inputKeyListener); pager = (ViewPager) view.findViewById(R.id.pager); pagerAdapter = new ConversationPagerAdapter(getActivity(), server); pager.setAdapter(pagerAdapter);/*from w ww . jav a 2 s . c o m*/ tabLayout = new ConversationTabLayout(container.getContext()); tabLayout.setViewPager(pager); tabLayout.setSelectedIndicatorColors(getResources().getColor(R.color.accent)); tabLayout.setDividerColors(getResources().getColor(R.color.divider)); Toolbar.LayoutParams params = new Toolbar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); params.gravity = Gravity.BOTTOM; activity.getToolbar().addView(tabLayout, params); if (server.getStatus() == Status.PRE_CONNECTING) { server.clearConversations(); pagerAdapter.clearConversations(); server.getConversation(ServerInfo.DEFAULT_NAME).setHistorySize(settings.getHistorySize()); } // Optimization : cache field lookups Collection<Conversation> mConversations = server.getConversations(); for (Conversation conversation : mConversations) { // Only scroll to new conversation if it was selected before if (conversation.getStatus() == Conversation.STATUS_SELECTED) { onNewConversation(conversation.getName()); } else { createNewConversation(conversation.getName()); } } int setInputTypeFlags = 0; setInputTypeFlags |= InputType.TYPE_TEXT_FLAG_AUTO_CORRECT; if (settings.autoCapSentences()) { setInputTypeFlags |= InputType.TYPE_TEXT_FLAG_CAP_SENTENCES; } if (isLandscape && settings.imeExtract()) { setInputTypeFlags |= InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE; } if (!settings.imeExtract()) { input.setImeOptions(input.getImeOptions() | EditorInfo.IME_FLAG_NO_EXTRACT_UI); } input.setInputType(input.getInputType() | setInputTypeFlags); ImageButton sendButton = (ImageButton) view.findViewById(R.id.send); sendButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (input.getText().length() > 0) { sendCurrentMessage(); } } }); sendButton.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { doNickCompletion(input); return true; } }); return view; }
From source file:org.yaaic.activity.ConversationActivity.java
/** * On create// ww w .ja v a 2 s . com */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); serverId = getIntent().getExtras().getInt("serverId"); server = Yaaic.getInstance().getServerById(serverId); Settings settings = new Settings(this); // Finish activity if server does not exist anymore - See #55 if (server == null) { this.finish(); } ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); setTitle(server.getTitle()); setContentView(R.layout.conversations); boolean isLandscape = (getResources() .getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE); EditText input = (EditText) findViewById(R.id.input); input.setOnKeyListener(inputKeyListener); pager = (ViewPager) findViewById(R.id.pager); pagerAdapter = new ConversationPagerAdapter(this, server); pager.setAdapter(pagerAdapter); final float density = getResources().getDisplayMetrics().density; indicator = (ConversationIndicator) findViewById(R.id.titleIndicator); indicator.setServer(server); indicator.setTypeface(Typeface.MONOSPACE); indicator.setViewPager(pager); indicator.setFooterColor(0xFF31B6E7); indicator.setFooterLineHeight(1 * density); indicator.setFooterIndicatorHeight(3 * density); indicator.setFooterIndicatorStyle(IndicatorStyle.Underline); indicator.setSelectedColor(0xFFFFFFFF); indicator.setSelectedBold(true); indicator.setBackgroundColor(0xFF181818); historySize = settings.getHistorySize(); if (server.getStatus() == Status.PRE_CONNECTING) { server.clearConversations(); pagerAdapter.clearConversations(); server.getConversation(ServerInfo.DEFAULT_NAME).setHistorySize(historySize); } float fontSize = settings.getFontSize(); indicator.setTextSize(fontSize * density); input.setTextSize(settings.getFontSize()); input.setTypeface(Typeface.MONOSPACE); // Optimization : cache field lookups Collection<Conversation> mConversations = server.getConversations(); for (Conversation conversation : mConversations) { // Only scroll to new conversation if it was selected before if (conversation.getStatus() == Conversation.STATUS_SELECTED) { onNewConversation(conversation.getName()); } else { createNewConversation(conversation.getName()); } } int setInputTypeFlags = 0; setInputTypeFlags |= InputType.TYPE_TEXT_FLAG_AUTO_CORRECT; if (settings.autoCapSentences()) { setInputTypeFlags |= InputType.TYPE_TEXT_FLAG_CAP_SENTENCES; } if (isLandscape && settings.imeExtract()) { setInputTypeFlags |= InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE; } if (!settings.imeExtract()) { input.setImeOptions(input.getImeOptions() | EditorInfo.IME_FLAG_NO_EXTRACT_UI); } input.setInputType(input.getInputType() | setInputTypeFlags); // Create a new scrollback history scrollback = new Scrollback(); }