List of usage examples for android.widget TextView setEnabled
@android.view.RemotableViewMethod @Override public void setEnabled(boolean enabled)
From source file:org.travey.travey.SettingsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.fragment_settings, container, false); manager = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE); //load properties from config resource file dataConnection.delegate = this; Log.i("**************", "Creating Main Activity"); load();/*from w w w . j a v a2s . c om*/ SharedPreferences.Editor editor = myPrefs.edit(); editor.putBoolean("isNotified", false); editor.commit(); CheckBox checkBox = (CheckBox) rootView.findViewById(R.id.checkBox); checkBox.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Do something in response to checkbox final CheckBox checkBox = (CheckBox) rootView.findViewById(R.id.checkBox); if (checkBox.isChecked()) { if (!mRequestingLocationUpdates) { if (!manager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { buildAlertMessageNoGps(); } mRequestingLocationUpdates = true; mActiveCheckboxChecked = true; startLocationUpdates(); } } else { if (mRequestingLocationUpdates) { mRequestingLocationUpdates = false; mActiveCheckboxChecked = false; stopLocationUpdates(); } } } }); EditText editText = (EditText) rootView.findViewById(R.id.editText); getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); Button button = (Button) rootView.findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { /** Called when the user clicks the register button */ load(); EditText editText = (EditText) rootView.findViewById(R.id.editText); if (mRegistered && !isRegistering) { //user is deregistering CheckBox checkBox = (CheckBox) rootView.findViewById(R.id.checkBox); Button button = (Button) rootView.findViewById(R.id.button); TextView textView4 = (TextView) rootView.findViewById(R.id.textView4); TextView textView5 = (TextView) rootView.findViewById(R.id.textView5); button.setText(R.string.check_button); editText.setEnabled(true); editText.setText(""); textView4.setEnabled(true); mActiveCheckboxChecked = false; stopLocationUpdates(); checkBox.setChecked(false); checkBox.setEnabled(false); textView5.setEnabled(false); participantID = ""; myPrefs = getActivity().getSharedPreferences("myPrefs", getActivity().MODE_PRIVATE); SharedPreferences.Editor editor = myPrefs.edit(); editor.putString("participantID", participantID); editor.commit(); mRegistered = false; save(mActiveCheckboxChecked, mRequestingLocationUpdates, mRegistered); isRegistering = true; EventBus bus = EventBus.getDefault(); bus.post(new RegistrationStatusChanged("0")); } else { isRegistering = false; participantID = editText.getText().toString(); dialog = new ProgressDialog(getActivity()); dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); dialog.setMessage("Registering you as a participant"); dialog.setIndeterminate(true); dialog.setCanceledOnTouchOutside(false); dialog.show(); Log.i("**************", "Checking participant ID"); Resources res = getResources(); String RESTFUL_URL = res.getString(R.string.restful_url); String url = RESTFUL_URL + "?method=reg&format=json&pid=" + participantID; dataConnection.connect(getActivity(), url); } } }); if (mActiveCheckboxChecked) { checkBox.setChecked(true); } if (mRegistered) { editText.setText(participantID); checkBox.setEnabled(true); editText.setEnabled(false); TextView textView4 = (TextView) rootView.findViewById(R.id.textView4); TextView textView5 = (TextView) rootView.findViewById(R.id.textView5); textView4.setEnabled(false); textView5.setEnabled(true); button.setText(R.string.reset_button); } else { checkBox.setEnabled(false); } return rootView; }
From source file:com.todoroo.astrid.adapter.TaskAdapter.java
/** Helper method to adjust a tasks' appearance if the task is completed or * uncompleted.//from ww w . j a va 2 s . c om */ private void setTaskAppearance(ViewHolder viewHolder, Task task) { boolean completed = task.isCompleted(); TextView name = viewHolder.nameView; if (completed) { name.setEnabled(false); name.setPaintFlags(name.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); } else { name.setEnabled(true); name.setPaintFlags(name.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG); } name.setTextSize(fontSize); setupDueDateAndTags(viewHolder, task); float detailTextSize = Math.max(10, fontSize * 14 / 20); if (viewHolder.dueDate != null) { viewHolder.dueDate.setTextSize(detailTextSize); viewHolder.dueDate.setTypeface(null, 0); } setupCompleteBox(viewHolder); }
From source file:com.ntsync.android.sync.activities.MainActivity.java
private void initViewPeopleBtn() { TextView startBtn = (TextView) findViewById(R.id.btnPeople); Intent contactAppIntent = ContactManager.createContactAppIntent(); boolean isIntentSafe = false; if (contactAppIntent != null) { PackageManager packageManager = getPackageManager(); List<ResolveInfo> activities = packageManager.queryIntentActivities(contactAppIntent, 0); isIntentSafe = !activities.isEmpty(); Drawable icon = ContactManager.getContactAppIcon(this, contactAppIntent); startBtn.setCompoundDrawablesWithIntrinsicBounds(null, icon, null, null); }/*from ww w. j ava 2 s . com*/ startBtn.setEnabled(isIntentSafe); }
From source file:com.cmax.bodysheild.widget.PagerSlidingTabStripExtends.java
public void setAllTabTextColor(int res) { for (int i = 0; i < tabCount; i++) { View v = tabsContainer.getChildAt(i); if (v instanceof TextView) { TextView tv = (TextView) v; tv.setTextColor(res);/*from w w w . ja v a 2 s. c om*/ tv.setClickable(true); tv.setEnabled(true); tv.setFocusable(true); } } }
From source file:org.noise_planet.noisecapture.CommentActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_comment); View mainView = findViewById(R.id.mainLayout); if (mainView != null) { mainView.setOnTouchListener(new MainOnTouchListener(this)); }/*ww w . j a v a 2 s. c o m*/ // Read record activity parameter // Use last record of no parameter provided this.measurementManager = new MeasurementManager(this); Intent intent = getIntent(); // Read the last stored record List<Storage.Record> recordList = measurementManager.getRecords(); if (intent != null && intent.hasExtra(COMMENT_RECORD_ID)) { record = measurementManager.getRecord(intent.getIntExtra(COMMENT_RECORD_ID, -1)); } else { if (!recordList.isEmpty()) { record = recordList.get(0); } else { // Message for starting a record Toast.makeText(getApplicationContext(), getString(R.string.no_results), Toast.LENGTH_LONG).show(); return; } } if (record != null) { View addPhoto = findViewById(R.id.btn_add_photo); addPhoto.setOnClickListener(new OnAddPhotoClickListener(this)); View resultsBtn = findViewById(R.id.resultsBtn); resultsBtn.setOnClickListener(new OnGoToResultPage(this)); View deleteBts = findViewById(R.id.deleteBtn); deleteBts.setOnClickListener(new OnDeleteMeasurement(this)); TextView noisePartyTag = (TextView) findViewById(R.id.edit_noiseparty_tag); noisePartyTag.setEnabled(record.getUploadId().isEmpty()); noisePartyTag.setFilters(new InputFilter[] { new InputFilter.AllCaps(), new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { // [^A-Za-z0-9_] StringBuilder stringBuilder = new StringBuilder(); for (int i = start; i < end; i++) { char c = source.charAt(i); if (Character.isLetterOrDigit(c) || c == '_') { stringBuilder.append(c); } } // keep original if unchanged or return swapped chars boolean modified = (stringBuilder.length() == end - start); return modified ? null : stringBuilder.toString(); } } }); if (record.getNoisePartyTag() == null) { // Read last stored NoiseParty id for (Storage.Record recordItem : recordList) { if (recordItem.getId() != record.getId()) { if (recordItem.getNoisePartyTag() != null) { noisePartyTag.setText(recordItem.getNoisePartyTag()); } break; } } } else { noisePartyTag.setText(record.getNoisePartyTag()); } } initDrawer(record != null ? record.getId() : null); SeekBar seekBar = (SeekBar) findViewById(R.id.pleasantness_slider); // Load stored user comment // Pleasantness and tags are read only if the record has been uploaded Map<String, Storage.TagInfo> tagToIndex = new HashMap<>(Storage.TAGS_INFO.length); for (Storage.TagInfo sysTag : Storage.TAGS_INFO) { tagToIndex.put(sysTag.name, sysTag); } View thumbnail = findViewById(R.id.image_thumbnail); thumbnail.setOnClickListener(new OnImageClickListener(this)); if (record != null) { // Load selected tags for (String sysTag : measurementManager.getTags(record.getId())) { Storage.TagInfo tagInfo = tagToIndex.get(sysTag); if (tagInfo != null) { checkedTags.add(tagInfo.id); } } // Load description if (record.getDescription() != null) { TextView description = (TextView) findViewById(R.id.edit_description); description.setText(record.getDescription()); } Integer pleasantness = record.getPleasantness(); if (pleasantness != null) { seekBar.setProgress((int) (Math.round((pleasantness / 100.0) * seekBar.getMax()))); seekBar.setThumb( seekBar.getResources().getDrawable(R.drawable.seekguess_scrubber_control_normal_holo)); userInputSeekBar.set(true); } else { seekBar.setThumb( seekBar.getResources().getDrawable(R.drawable.seekguess_scrubber_control_disabled_holo)); } photo_uri = record.getPhotoUri(); // User can only update not uploaded data seekBar.setEnabled(record.getUploadId().isEmpty()); } else { // Message for starting a record Toast.makeText(getApplicationContext(), getString(R.string.no_results), Toast.LENGTH_LONG).show(); } thumbnailImageLayoutDoneObserver = new OnThumbnailImageLayoutDoneObserver(this); thumbnail.getViewTreeObserver().addOnGlobalLayoutListener(thumbnailImageLayoutDoneObserver); seekBar.setOnSeekBarChangeListener(new OnSeekBarUserInput(userInputSeekBar)); // Fill tags grid Resources r = getResources(); String[] tags = r.getStringArray(R.array.tags); // Append tags items for (Storage.TagInfo tagInfo : Storage.TAGS_INFO) { ViewGroup tagContainer = (ViewGroup) findViewById(tagInfo.location); if (tagContainer != null && tagInfo.id < tags.length) { addTag(tags[tagInfo.id], tagInfo.id, tagContainer, tagInfo.color != -1 ? r.getColor(tagInfo.color) : -1); } } }
From source file:org.cowboycoders.cyclisimo.BikeListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setVolumeControlStream(TextToSpeech.Engine.DEFAULT_STREAM); setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL); setContentView(R.layout.generic_list_select); mHandler = new Handler(); this.providerUtils = MyTracksProviderUtils.Factory.getCyclimso(this); sharedPreferences = getSharedPreferences(Constants.SETTINGS_NAME, Context.MODE_PRIVATE); listView = (ListView) findViewById(R.id.generic_list); this.setTitle( this.getString(R.string.my_tracks_app_name) + " : " + this.getString(R.string.bike_list_title)); TextView userEmptyListText = (TextView) findViewById(R.id.generic_list_empty_view); userEmptyListText.setText(R.string.bike_list_empty_message); this.cancelButton = (Button) this.findViewById(R.id.generic_list_left_button); cancelButton.setText(getString(R.string.cancel)); initCancelButton();// w w w. j a v a 2 s . c o m Button addUserButton = (Button) this.findViewById(R.id.generic_list_right_button); addUserButton.setText(getString(R.string.bike_create)); addUserButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { //TODO: make bike edit Intent intent = IntentUtils.newIntent(BikeListActivity.this, BikeEditActivity.class) .putExtra(BikeEditActivity.EXTRA_NEW_BIKE, true); intent.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT); // intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); // intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); } }); listView.setEmptyView(userEmptyListText); resourceCursorAdapter = new ResourceCursorAdapter(this, R.layout.user_list_item, null, 0) { @Override public View newView(Context context, Cursor cursor, ViewGroup parent) { View view = super.newView(context, cursor, parent); return view; } @Override public void bindView(View view, Context context, Cursor cursor) { final Bike bike = providerUtils.createBike(cursor, false); TextView userName = (TextView) view.findViewById(R.id.list_item_name); userName.setText(bike.getName()); userName.setEnabled(!isRecording()); userName.setVisibility(View.VISIBLE); view.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { boolean isRecording = recordingTrackId != PreferencesUtils.RECORDING_TRACK_ID_DEFAULT; if (isRecording) { onUnableToPerformOperation(); } else { new Thread() { public void run() { // update user first as we count on this being updated on shared change updateUser(BikeListActivity.this, bike.getId()); PreferencesUtils.setLong(BikeListActivity.this, R.string.settings_select_bike_current_selection_key, bike.getId()); } }.start(); String unformated = getString(R.string.bike_list_new_user_selected); Toast.makeText(BikeListActivity.this, String.format(unformated, bike.getName()), Toast.LENGTH_SHORT).show(); BikeListActivity.this.doFinish(); } } }); registerForContextMenu(view); } }; listView.setAdapter(resourceCursorAdapter); ApiAdapterFactory.getApiAdapter().configureListViewContextualMenu(this, listView, contextualActionModeCallback, R.menu.user_list_context_menu); getSupportLoaderManager().initLoader(0, null, new LoaderCallbacks<Cursor>() { @Override public Loader<Cursor> onCreateLoader(int arg0, Bundle arg1) { long ownerId = PreferencesUtils.getLong(BikeListActivity.this, R.string.settings_select_user_current_selection_key); String selection = BikeInfoColumns.OWNER + "=? OR " + BikeInfoColumns.SHARED + "=?"; // one true, 0 false String[] args = new String[] { Long.toString(ownerId), Integer.toString(1) }; return new CursorLoader(BikeListActivity.this, BikeInfoColumns.CONTENT_URI, PROJECTION, selection, args, "LOWER(" + BikeInfoColumns.NAME + ")"); } @Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { resourceCursorAdapter.swapCursor(cursor); } @Override public void onLoaderReset(Loader<Cursor> loader) { resourceCursorAdapter.swapCursor(null); } }); updateUI(); this.contextMenu = (ContextMenu) findViewById(R.menu.user_list_context_menu); }
From source file:org.cowboycoders.cyclisimo.UserListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setVolumeControlStream(TextToSpeech.Engine.DEFAULT_STREAM); setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL); setContentView(R.layout.generic_list_select); mHandler = new Handler(); this.providerUtils = MyTracksProviderUtils.Factory.getCyclimso(this); sharedPreferences = getSharedPreferences(Constants.SETTINGS_NAME, Context.MODE_PRIVATE); listView = (ListView) findViewById(R.id.generic_list); this.setTitle( this.getString(R.string.my_tracks_app_name) + " : " + this.getString(R.string.user_list_title)); TextView userEmptyListText = (TextView) findViewById(R.id.generic_list_empty_view); userEmptyListText.setText(R.string.user_list_empty_message); this.cancelButton = (Button) this.findViewById(R.id.generic_list_left_button); cancelButton.setText(getString(R.string.cancel)); initCancelButton();/*from w w w . ja v a2 s . c o m*/ Button addUserButton = (Button) this.findViewById(R.id.generic_list_right_button); addUserButton.setText(getString(R.string.user_create)); addUserButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = IntentUtils.newIntent(UserListActivity.this, UserEditActivity.class) .putExtra(UserEditActivity.EXTRA_NEW_USER, true); intent.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT); // intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); // intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); } }); listView.setEmptyView(userEmptyListText); resourceCursorAdapter = new ResourceCursorAdapter(this, R.layout.user_list_item, null, 0) { @Override public View newView(Context context, Cursor cursor, ViewGroup parent) { View view = super.newView(context, cursor, parent); return view; } @Override public void bindView(View view, Context context, Cursor cursor) { final User user = providerUtils.createUser(cursor, false); TextView userName = (TextView) view.findViewById(R.id.list_item_name); userName.setText(user.getName()); userName.setEnabled(!isRecording()); userName.setVisibility(View.VISIBLE); view.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { boolean isRecording = recordingTrackId != PreferencesUtils.RECORDING_TRACK_ID_DEFAULT; if (isRecording) { onUnableToPerformOperation(); } else { // new Thread() { // public void run() { // PreferencesUtils.setLong(UserListActivity.this, R.string.settings_select_user_current_selection_key, user.getId()); // } // // }.start(); // // Intent intent = IntentUtils.newIntent(UserListActivity.this, // TrackListActivity.class); // intent.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT); // intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); // intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); // startActivity(intent); // String unformated = getString(R.string.user_list_new_user_selected); // Toast.makeText(UserListActivity.this, String.format(unformated, user.getName()), Toast.LENGTH_SHORT).show(); // UserListActivity.this.finish(); getSyncSettingsTask().execute(user.getId()); } } }); registerForContextMenu(view); } }; listView.setAdapter(resourceCursorAdapter); ApiAdapterFactory.getApiAdapter().configureListViewContextualMenu(this, listView, contextualActionModeCallback, R.menu.user_list_context_menu); getSupportLoaderManager().initLoader(0, null, new LoaderCallbacks<Cursor>() { @Override public Loader<Cursor> onCreateLoader(int arg0, Bundle arg1) { return new CursorLoader(UserListActivity.this, UserInfoColumns.CONTENT_URI, PROJECTION, null, null, "LOWER(" + UserInfoColumns.NAME + ")"); } @Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { resourceCursorAdapter.swapCursor(cursor); } @Override public void onLoaderReset(Loader<Cursor> loader) { resourceCursorAdapter.swapCursor(null); } }); updateCancelButton(); this.contextMenu = (ContextMenu) findViewById(R.menu.user_list_context_menu); }
From source file:org.projectbuendia.client.ui.BaseActivity.java
/** Called when the set of troubleshooting actions changes. */ public void onEventMainThread(TroubleshootingActionsChangedEvent event) { if (event.actions.isEmpty()) { setStatusView(null);/* ww w . j a v a 2 s . co m*/ setStatusVisibility(View.GONE); return; } TroubleshootingAction troubleshootingAction = event.actions.iterator().next(); View view = getLayoutInflater().inflate(R.layout.view_status_bar_default, null); final TextView message = (TextView) view.findViewById(R.id.status_bar_default_message); final TextView action = (TextView) view.findViewById(R.id.status_bar_default_action); switch (troubleshootingAction) { case ENABLE_WIFI: message.setText(R.string.troubleshoot_wifi_disabled); action.setText(R.string.troubleshoot_wifi_disabled_action_enable); action.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { action.setEnabled(false); ((WifiManager) getSystemService(Context.WIFI_SERVICE)).setWifiEnabled(true); } }); break; case CONNECT_WIFI: message.setText(R.string.troubleshoot_wifi_disconnected); action.setText(R.string.troubleshoot_wifi_disconnected_action_connect); action.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { action.setEnabled(false); startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS)); } }); break; case CHECK_SERVER_AUTH: message.setText(R.string.troubleshoot_server_auth); action.setText(R.string.troubleshoot_server_auth_action_check); action.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { action.setEnabled(false); startActivity(new Intent(BaseActivity.this, SettingsActivity.class)); } }); break; case CHECK_SERVER_CONFIGURATION: message.setText(R.string.troubleshoot_server_address); action.setText(R.string.troubleshoot_server_address_action_check); action.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { action.setEnabled(false); startActivity(new Intent(BaseActivity.this, SettingsActivity.class)); } }); break; case CHECK_SERVER_REACHABILITY: message.setText(R.string.troubleshoot_server_unreachable); action.setText(R.string.troubleshoot_action_more_info); action.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // TODO: Display the actual server URL that couldn't be reached in // this message. This will require that injection be hooked up through to // this inner class, which may be complicated. showMoreInfoDialog(action, getString(R.string.troubleshoot_server_unreachable), getString(R.string.troubleshoot_server_unreachable_details), true); } }); break; case CHECK_SERVER_SETUP: message.setText(R.string.troubleshoot_server_unstable); action.setText(R.string.troubleshoot_action_more_info); action.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // TODO: Display the actual server URL that couldn't be reached in // this message. This will require that injection be hooked up through to // this inner class, which may be complicated. showMoreInfoDialog(action, getString(R.string.troubleshoot_server_unstable), getString(R.string.troubleshoot_server_unstable_details), false); } }); break; case CHECK_SERVER_STATUS: message.setText(R.string.troubleshoot_server_not_responding); action.setText(R.string.troubleshoot_action_more_info); action.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // TODO: Display the actual server URL that couldn't be reached in // this message. This will require that injection be hooked up through to // this inner class, which may be complicated. showMoreInfoDialog(action, getString(R.string.troubleshoot_server_not_responding), getString(R.string.troubleshoot_server_not_responding_details), false); } }); break; case CHECK_UPDATE_SERVER_REACHABILITY: message.setText(R.string.troubleshoot_update_server_unreachable); action.setText(R.string.troubleshoot_action_more_info); action.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showMoreInfoDialog(action, getString(R.string.troubleshoot_update_server_unreachable), getString(R.string.troubleshoot_update_server_unreachable_details), true); } }); break; case CHECK_UPDATE_SERVER_CONFIGURATION: message.setText(R.string.troubleshoot_update_server_misconfigured); action.setText(R.string.troubleshoot_action_more_info); action.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showMoreInfoDialog(action, getString(R.string.troubleshoot_update_server_misconfigured), getString(R.string.troubleshoot_update_server_misconfigured_details), true); } }); break; default: LOG.w("Troubleshooting action '%1$s' is unknown.", troubleshootingAction); return; } setStatusView(view); setStatusVisibility(View.VISIBLE); }
From source file:com.cssweb.android.quote.QHSCGridActivity.java
private void AddViewItem(int paramInt1, LinearLayout paramLinearLayout, int paramInt2, int paramInt3, int paramInt4, boolean paramBoolean) { TextView localTextView = new TextView(this); float f = this.mFontSize; localTextView.setTextSize(f);/*from ww w .j av a 2 s .com*/ localTextView.setGravity(Gravity.CENTER); localTextView.setFocusable(paramBoolean); localTextView.setOnClickListener(mClickListener); localTextView.setOnLongClickListener(mLongClickListener); localTextView.setOnTouchListener(this); // touch localTextView.setTag(paramInt2); localTextView.setEnabled(paramBoolean); localTextView.setSingleLine(true); Resources localResources = getResources(); Drawable localDrawable = null; if (paramInt4 == 0 && paramInt3 >= 0) {// int i1 = this.residTitleCol; int i8 = 0; localTextView.setTextColor(paramInt1); if (paramInt3 == 0) { localDrawable = localResources.getDrawable(i1); i8 = localDrawable.getIntrinsicWidth(); } else if (paramInt3 == 100) { localDrawable = localResources.getDrawable(this.residTitleScrollCol[2]); i8 = localDrawable.getIntrinsicWidth(); i8 += 20; } else if (paramInt3 == 13) { localDrawable = localResources.getDrawable(this.residTitleScrollCol[0]); i8 = localDrawable.getIntrinsicWidth(); } else if (paramInt3 % 2 == 0) { localDrawable = localResources.getDrawable(this.residTitleScrollCol[1]); i8 = localDrawable.getIntrinsicWidth(); } else { localDrawable = localResources.getDrawable(this.residTitleScrollCol[0]); i8 = localDrawable.getIntrinsicWidth(); } localTextView.setBackgroundDrawable(localDrawable); int i6 = localDrawable.getIntrinsicHeight(); localTextView.setHeight(i6 + CssSystem.getTableTitleHeight(this)); localTextView.setWidth(i8); paramLinearLayout.addView(localTextView); return; } if (paramInt4 != 0 && paramInt3 >= 0) { int i8 = 0; localTextView.setTextColor(paramInt1); if (paramInt3 == 0) { localDrawable = localResources.getDrawable(this.residCol); i8 = localDrawable.getIntrinsicWidth(); } else if (paramInt3 == 100) { localDrawable = localResources.getDrawable(this.residScrollCol[2]); localTextView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL); i8 = localDrawable.getIntrinsicWidth(); i8 += 20; } else if (paramInt3 == 13) { localDrawable = localResources.getDrawable(this.residScrollCol[0]); localTextView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL); i8 = localDrawable.getIntrinsicWidth(); } else if (paramInt3 % 2 == 0) { localDrawable = localResources.getDrawable(this.residScrollCol[1]); localTextView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL); i8 = localDrawable.getIntrinsicWidth(); } else { localDrawable = localResources.getDrawable(this.residScrollCol[0]); localTextView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL); i8 = localDrawable.getIntrinsicWidth(); } localTextView.setBackgroundDrawable(localDrawable); int i6 = localDrawable.getIntrinsicHeight(); localTextView.setHeight(i6 + rowHeight); localTextView.setWidth(i8); paramLinearLayout.addView(localTextView); return; } }
From source file:TIG055st2014.mailmaster.Activities.ComposeActivity.java
@Override protected void onStart() { super.onStart(); AppVariablesSingleton apv = AppVariablesSingleton.getInstance(); TextView sender; TextView from;// w ww . j a va 2s. c o m TextView result; /* * If message is a reply then certain fields are instantiated based on * fields from the message that is being replied to. BCC is not filled * (unless replying on one's own message) since they're supposed to be secret. */ if (apv.getIsReply()) { getActionBar().setTitle(R.string.composing_rp); result = (TextView) findViewById(R.id.totalsizeReply); sender = (TextView) findViewById(R.id.sendAccReply); sender.setText(currentAcc); sender.setEnabled(false); sender.setVisibility(View.GONE); from = (TextView) findViewById(R.id.senderReply); from.setEnabled(false); from.setVisibility(View.GONE); TextView to = (TextView) findViewById(R.id.receiveAccsReply); TextView subject = (TextView) findViewById(R.id.subjectReply); EditText cc = (EditText) findViewById(R.id.ccAccsReply); EditText bcc = ((EditText) findViewById(R.id.bccAccsReply)); to.setText(""); cc.setText(""); bcc.setText(""); try { subject.setText(apv.getReply().getSubject()); //Used if replying to email sent by yourself (basically using sent email as draft). if (apv.getFolderName(currentAcc).contains("Sent")) { Address[] tempTo = apv.getEmail().getRecipients(RecipientType.TO); if (tempTo != null) { for (Address a : tempTo) { if (to.getText().toString().equals("")) { to.setText(a.toString()); } else { to.setText(to.getText() + "," + a.toString()); } } } this.addAddresses(apv.getEmail().getRecipients(Message.RecipientType.BCC), bcc); } //Used for "normal" reply. else { to.setText(apv.getEmail().getFrom()[0].toString()); } this.addAddresses(apv.getEmail().getRecipients(Message.RecipientType.CC), cc); } catch (Exception e) { e.printStackTrace(); } } /* If not reply, app attempts to load all fields since message might be based on draft. **/ else { getActionBar().setTitle(R.string.composing); result = (TextView) findViewById(R.id.totalsize); sender = (TextView) findViewById(R.id.sendAcc); sender.setText(currentAcc); sender.setEnabled(false); sender.setVisibility(View.GONE); from = (TextView) findViewById(R.id.sender); from.setEnabled(false); from.setVisibility(View.GONE); if (apv.getFolderName(currentAcc).contains("Drafts")) { try { MailFunctionality mf = new MailFunctionality(currentAcc, accounts.getString(currentAcc, ""), (currentAcc.split("@"))[1]); EditText recipients = ((EditText) findViewById(R.id.receiveAccs)); EditText cc = ((EditText) findViewById(R.id.ccAccs)); EditText bcc = ((EditText) findViewById(R.id.bccAccs)); EditText subject = ((EditText) findViewById(R.id.subject)); if (apv.getEmail().getSubject() != null) { subject.setText(apv.getEmail().getSubject().toString()); } recipients.setText(""); cc.setText(""); bcc.setText(""); mf.getContents(this); addAddresses(apv.getEmail().getRecipients(Message.RecipientType.TO), recipients); addAddresses(apv.getEmail().getRecipients(Message.RecipientType.CC), cc); addAddresses(apv.getEmail().getRecipients(Message.RecipientType.BCC), bcc); } catch (Exception e) { e.printStackTrace(); } } } if (listView.getAdapter() == null) { listView.setAdapter(new AttachmentsAdapter(getApplicationContext(), R.layout.attachments_item, R.id.attachments_text, attachments, result)); } }