Java Code Examples for android.widget.CheckBox

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project Android-automation, under directory /Tmts_Java/src/com/taobao/tmts/framework/.

Source file: Tmts.java

  18 
vote

/** 
 * Return a  {@link TmtsCheckBox} by the given name.
 * @param name String name of view id, the string after @+id/ defined in layout files.
 * @return {@link TmtsCheckBox} with the given name.
 * @throws Exception Exception
 */
TmtsCheckBox getTmtsCheckBox(String name) throws Exception {
  Log.i(LOG_TAG,"getTmtsCheckBox: " + name);
  CheckBox checkBox=(CheckBox)getView(name,CheckBox.class);
  printLog(checkBox,name,"getTmtsCheckBox");
  TmtsCheckBox tmtsCheckBox=new TmtsCheckBox(inst,checkBox);
  return tmtsCheckBox;
}
 

Example 2

From project android-joedayz, under directory /Proyectos/GreenDroid/src/greendroid/widget/.

Source file: SegmentedBar.java

  18 
vote

public void onClick(View v){
  final CheckBox segment=(CheckBox)getChildSegmentAt(mCheckedSegment);
  if (mSegmentIndex == mCheckedSegment && !segment.isChecked()) {
    segment.setChecked(true);
  }
 else {
    notifyListener(mSegmentIndex,true);
  }
}
 

Example 3

From project android-vpn-settings, under directory /src/com/android/settings/vpn/.

Source file: AuthenticationActor.java

  18 
vote

public void connect(Dialog d){
  TextView usernameView=(TextView)d.findViewById(R.id.username_value);
  TextView passwordView=(TextView)d.findViewById(R.id.password_value);
  CheckBox saveUsername=(CheckBox)d.findViewById(R.id.save_username);
  try {
    setSavedUsername(saveUsername.isChecked() ? usernameView.getText().toString() : "");
  }
 catch (  IOException e) {
    Log.e(TAG,"setSavedUsername()",e);
  }
  connect(usernameView.getText().toString(),passwordView.getText().toString());
  passwordView.setText("");
}
 

Example 4

From project android_aosp_packages_apps_Settings, under directory /src/com/android/settings/vpn/.

Source file: AuthenticationActor.java

  18 
vote

public void connect(Dialog d){
  TextView usernameView=(TextView)d.findViewById(R.id.username_value);
  TextView passwordView=(TextView)d.findViewById(R.id.password_value);
  CheckBox saveUsername=(CheckBox)d.findViewById(R.id.save_username);
  try {
    setSavedUsername(saveUsername.isChecked() ? usernameView.getText().toString() : "");
  }
 catch (  IOException e) {
    Log.e(TAG,"setSavedUsername()",e);
  }
  connect(usernameView.getText().toString(),passwordView.getText().toString());
  passwordView.setText("");
}
 

Example 5

From project android_packages_apps_FileManager, under directory /src/org/openintents/filemanager/.

Source file: FileManagerActivity.java

  18 
vote

/** 
 * @since 2011-09-30
 */
private void showWarningDialog(){
  LayoutInflater li=LayoutInflater.from(this);
  View warningView=li.inflate(R.layout.dialog_warning,null);
  final CheckBox showWarningAgain=(CheckBox)warningView.findViewById(R.id.showagaincheckbox);
  showWarningAgain.setChecked(PreferenceActivity.getShowAllWarning(FileManagerActivity.this));
  new AlertDialog.Builder(this).setView(warningView).setTitle(getString(R.string.title_warning_some_may_not_work)).setMessage(getString(R.string.warning_some_may_not_work,mContextText)).setIcon(android.R.drawable.ic_dialog_alert).setPositiveButton(android.R.string.ok,new OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
      PreferenceActivity.setShowAllWarning(FileManagerActivity.this,showWarningAgain.isChecked());
      showMoreCommandsDialog();
    }
  }
).create().show();
}
 

Example 6

From project android_packages_apps_phone, under directory /src/com/android/phone/.

Source file: SipCallOptionHandler.java

  18 
vote

private void addMakeDefaultCheckBox(Dialog dialog){
  LayoutInflater inflater=(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View view=inflater.inflate(com.android.internal.R.layout.always_use_checkbox,null);
  CheckBox makePrimaryCheckBox=(CheckBox)view.findViewById(com.android.internal.R.id.alwaysUse);
  makePrimaryCheckBox.setText(R.string.remember_my_choice);
  makePrimaryCheckBox.setOnCheckedChangeListener(this);
  mUnsetPriamryHint=(TextView)view.findViewById(com.android.internal.R.id.clearDefaultHint);
  mUnsetPriamryHint.setText(R.string.reset_my_choice_hint);
  mUnsetPriamryHint.setVisibility(View.GONE);
  ((AlertDialog)dialog).setView(view);
}
 

Example 7

From project apps-for-android, under directory /SpriteMethodTest/src/com/android/spritemethodtest/.

Source file: SpriteMethodTest.java

  18 
vote

/** 
 * Passes preferences about the test via its intent. 
 */
protected void initializeIntent(Intent i){
  final CheckBox checkBox=(CheckBox)findViewById(R.id.animateSprites);
  final boolean animate=checkBox.isChecked();
  final EditText editText=(EditText)findViewById(R.id.spriteCount);
  final String spriteCountText=editText.getText().toString();
  final int stringCount=Integer.parseInt(spriteCountText);
  i.putExtra("animate",animate);
  i.putExtra("spriteCount",stringCount);
}
 

Example 8

From project Bitcoin-Wallet-for-Android, under directory /wallet/src/de/schildbach/wallet/ui/.

Source file: WalletActivity.java

  18 
vote

private void prepareExportKeysDialog(final Dialog dialog){
  final AlertDialog alertDialog=(AlertDialog)dialog;
  final EditText passwordView=(EditText)alertDialog.findViewById(R.id.wallet_export_keys_password);
  passwordView.setText(null);
  final DialogButtonEnablerListener dialogButtonEnabler=new DialogButtonEnablerListener(passwordView,alertDialog);
  dialogButtonEnabler.handle();
  passwordView.addTextChangedListener(dialogButtonEnabler);
  final CheckBox showView=(CheckBox)alertDialog.findViewById(R.id.wallet_export_keys_show);
  showView.setOnCheckedChangeListener(new ShowPasswordCheckListener(passwordView));
}
 

Example 9

From project BombusLime, under directory /src/org/bombusim/lime/activity/.

Source file: EditContactActivity.java

  18 
vote

private boolean addGroup(String group){
  if (groups.containsKey(group))   return false;
  CheckBox ng=new CheckBox(this);
  ng.setText(group);
  groups.put(group,ng);
  return true;
}
 

Example 10

From project Book-Catalogue, under directory /src/com/eleybourn/bookcatalogue/.

Source file: Fields.java

  18 
vote

public void set(Field field,String s){
  CheckBox v=(CheckBox)field.getView();
  try {
    s=field.format(s);
    Integer i=Integer.parseInt(s);
    v.setChecked(i != 0);
  }
 catch (  Exception e) {
    s=s.toLowerCase();
    v.setChecked(s.equals("t") || s.equals("true"));
  }
}
 

Example 11

From project CineShowTime-Android, under directory /Libraries/GreenDroid/src/greendroid/widget/.

Source file: SegmentedBar.java

  18 
vote

public void onClick(View v){
  final CheckBox segment=(CheckBox)getChildSegmentAt(mCheckedSegment);
  if (mSegmentIndex == mCheckedSegment && !segment.isChecked()) {
    segment.setChecked(true);
  }
 else {
    notifyListener(mSegmentIndex,true);
  }
}
 

Example 12

From project cw-omnibus, under directory /WidgetCatalog/DatePicker/src/com/commonsware/android/wc/datepick/.

Source file: DatePickerDemoActivity.java

  18 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  CheckBox cb=(CheckBox)findViewById(R.id.showCalendar);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    cb.setOnCheckedChangeListener(this);
  }
 else {
    cb.setVisibility(View.GONE);
  }
  GregorianCalendar now=new GregorianCalendar();
  picker=(DatePicker)findViewById(R.id.picker);
  picker.init(now.get(Calendar.YEAR),now.get(Calendar.MONTH),now.get(Calendar.DAY_OF_MONTH),this);
}
 

Example 13

From project dccsched, under directory /src/com/underhilllabs/dccsched/ui/.

Source file: SessionsActivity.java

  18 
vote

/** 
 * {@inheritDoc} 
 */
@Override public void bindView(View view,Context context,Cursor cursor){
  ((TextView)view.findViewById(R.id.session_title)).setText(cursor.getString(SearchQuery.TITLE));
  final String snippet=cursor.getString(SearchQuery.SEARCH_SNIPPET);
  final Spannable styledSnippet=buildStyledSnippet(snippet);
  ((TextView)view.findViewById(R.id.session_subtitle)).setText(styledSnippet);
  final boolean starred=cursor.getInt(SearchQuery.STARRED) != 0;
  final CheckBox starButton=(CheckBox)view.findViewById(R.id.star_button);
  starButton.setVisibility(starred ? View.VISIBLE : View.INVISIBLE);
  starButton.setChecked(starred);
}
 

Example 14

From project DeskSMS, under directory /DeskSMS/src/com/koushikdutta/desktopsms/.

Source file: ListItem.java

  18 
vote

void onClickInternal(View view){
  if (CheckboxVisible) {
    CheckBox cb=(CheckBox)view.findViewById(R.id.checkbox);
    cb.setChecked(!cb.isChecked());
  }
}
 

Example 15

From project dungbeetle, under directory /src/edu/stanford/mobisocial/dungbeetle/feed/view/.

Source file: FilterView.java

  18 
vote

@Override public View getView(int position,View convertView,ViewGroup parent){
  View v=super.getView(position,convertView,parent);
  v.setTag(position);
  String p=getItem(position);
  CheckBox checkbox=(CheckBox)v.findViewById(R.id.checkbox);
  checkbox.setChecked(((Filterable)mContext).getFilterCheckboxes()[position]);
  checkbox.setOnCheckedChangeListener(this);
  return v;
}
 

Example 16

From project eoit, under directory /EOIT/src/fr/eoit/activity/fragment/actionview/.

Source file: FavoriteActionView.java

  18 
vote

public FavoriteActionView(Context context,int itemId,boolean active){
  super(context);
  LayoutInflater.from(getContext()).inflate(R.layout.favorite_actionview,this);
  CheckBox favoriteTb=(CheckBox)findViewById(R.id.FAVORITE_ITEM);
  favoriteTb.setChecked(active);
  favoriteTb.setOnCheckedChangeListener(new FavoriteOnCheckedChangeListener(itemId,context));
}
 

Example 17

From project filemanager, under directory /FileManager/src/org/openintents/filemanager/util/.

Source file: MenuUtils.java

  18 
vote

/** 
 * Call this to show the dialog that informs the user about possibly broken options in the "More" dialog.
 * @param context The context that will be used for this dialog.
 * @param holder A {@link FileHolder} containing the file to act upon.
 */
private static void showWarningDialog(final FileHolder holder,final Context context){
  LayoutInflater li=LayoutInflater.from(context);
  View warningView=li.inflate(R.layout.dialog_warning,null);
  final CheckBox showWarningAgain=(CheckBox)warningView.findViewById(R.id.showagaincheckbox);
  showWarningAgain.setChecked(PreferenceActivity.getShowAllWarning(context));
  new AlertDialog.Builder(context).setView(warningView).setTitle(context.getString(R.string.title_warning_some_may_not_work)).setMessage(context.getString(R.string.warning_some_may_not_work)).setIcon(android.R.drawable.ic_dialog_alert).setPositiveButton(android.R.string.ok,new OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
      PreferenceActivity.setShowAllWarning(context,showWarningAgain.isChecked());
      showMoreCommandsDialog(holder,context);
    }
  }
).create().show();
}
 

Example 18

From project GeekAlarm, under directory /android/src/com/geek_alarm/android/adapters/.

Source file: AlarmPreferenceAdapter.java

  18 
vote

private void setUpCheckbox(View convertView,AlarmPreference preference){
  CheckBox checkBox=(CheckBox)convertView.findViewById(R.id.enabled_checkbox);
  EnableStateListener checkBoxListener=new EnableStateListener(preference);
  checkBox.setOnCheckedChangeListener(checkBoxListener);
  checkBox.setChecked(preference.isEnabled());
}
 

Example 19

From project GnucashMobile, under directory /GnucashMobile/src/org/gnucash/android/ui/transactions/.

Source file: TransactionsListFragment.java

  18 
vote

@Override public void onListItemClick(ListView l,View v,int position,long id){
  super.onListItemClick(l,v,position,id);
  if (mInEditMode) {
    CheckBox checkbox=(CheckBox)v.findViewById(R.id.checkbox);
    checkbox.setChecked(!checkbox.isChecked());
    return;
  }
  mTransactionEditListener.editTransaction(id);
}
 

Example 20

From project GreenDroid, under directory /GreenDroid/src/greendroid/widget/.

Source file: SegmentedBar.java

  18 
vote

public void onClick(View v){
  final CheckBox segment=(CheckBox)getChildSegmentAt(mCheckedSegment);
  if (mSegmentIndex == mCheckedSegment && !segment.isChecked()) {
    segment.setChecked(true);
  }
 else {
    notifyListener(mSegmentIndex,true);
  }
}
 

Example 21

From project iosched_1, under directory /src/com/google/android/apps/iosched/ui/.

Source file: SessionsActivity.java

  18 
vote

/** 
 * {@inheritDoc} 
 */
@Override public void bindView(View view,Context context,Cursor cursor){
  ((TextView)view.findViewById(R.id.session_title)).setText(cursor.getString(SearchQuery.TITLE));
  final String snippet=cursor.getString(SearchQuery.SEARCH_SNIPPET);
  final Spannable styledSnippet=buildStyledSnippet(snippet);
  ((TextView)view.findViewById(R.id.session_subtitle)).setText(styledSnippet);
  final boolean starred=cursor.getInt(SearchQuery.STARRED) != 0;
  final CheckBox starButton=(CheckBox)view.findViewById(R.id.star_button);
  starButton.setVisibility(starred ? View.VISIBLE : View.INVISIBLE);
  starButton.setChecked(starred);
}
 

Example 22

From project keepassdroid, under directory /src/com/keepassdroid/.

Source file: PasswordActivity.java

  18 
vote

private void retrieveSettings(){
  String defaultFilename=prefs.getString(KEY_DEFAULT_FILENAME,"");
  if (mFileName.length() > 0 && mFileName.equals(defaultFilename)) {
    CheckBox checkbox=(CheckBox)findViewById(R.id.default_database);
    checkbox.setChecked(true);
  }
}
 

Example 23

From project liquidroid, under directory /src/liqui/droid/activity/.

Source file: AreaListSelect.java

  18 
vote

@Override public void bindView(View view,Context context,Cursor c){
  Integer areaId=c.getInt(c.getColumnIndex(DB.Area.COLUMN_ID));
  String areaName=c.getString(c.getColumnIndex(DB.Area.COLUMN_NAME));
  TextView tvSummary=(TextView)view.findViewById(R.id.tv_title);
  CheckBox cbSelected=(CheckBox)view.findViewById(R.id.cb_selected);
  Uri uri=dbUri(DBProvider.MEMBERSHIP_CONTENT_URI);
  boolean isMember=!isResultEmpty(uri,"member_id = ? AND area_id = ?",new String[]{getMemberId(),String.valueOf(areaId)},null);
  tvSummary.setText(areaName);
  cbSelected.setOnCheckedChangeListener(null);
  cbSelected.setChecked(isMember);
  cbSelected.setOnCheckedChangeListener(this);
  cbSelected.setTag(areaId);
}
 

Example 24

From project NineOldAndroids, under directory /sample/src/com/jakewharton/nineoldandroids/sample/droidflakes/.

Source file: Droidflakes.java

  18 
vote

static void setup(final Droidflakes activity){
  CheckBox accelerated=(CheckBox)activity.findViewById(R.id.accelerated);
  accelerated.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
    @Override public void onCheckedChanged(    CompoundButton buttonView,    boolean isChecked){
      activity.flakeView.setLayerType(isChecked ? View.LAYER_TYPE_NONE : View.LAYER_TYPE_SOFTWARE,null);
    }
  }
);
}
 

Example 25

From project OpenAndroidWeather, under directory /OpenAndroidWeather/src/no/firestorm/ui/.

Source file: Settings.java

  18 
vote

private void setDownloadOnlyOnWifi(){
  final CheckBox checkbox=(CheckBox)findViewById(R.id.only_download_on_wifi);
  final boolean checked=WeatherNotificationSettings.getDownloadOnlyOnWifi(Settings.this);
  checkbox.setChecked(checked);
  checkbox.setOnCheckedChangeListener(new OnCheckedChangeListener(){
    @Override public void onCheckedChanged(    CompoundButton buttonView,    boolean isChecked){
      WeatherNotificationSettings.setDownloadOnlyOnWifi(Settings.this,isChecked);
    }
  }
);
}
 

Example 26

From project openpomo, under directory /src/it/unibz/pomodroid/.

Source file: Preferences.java

  18 
vote

/** 
 * Updates all the EditText fields with already stored data
 */
private void fillEditTexts(User user){
  EditText aetPomodoroLength=(EditText)findViewById(R.id.aetPomodoroLength);
  Integer pomodoroMinutesDuration=user.getPomodoroMinutesDuration();
  aetPomodoroLength.setText(pomodoroMinutesDuration.toString());
  CheckBox acbAdvancedUser=(CheckBox)findViewById(R.id.acbAdvancedUser);
  acbAdvancedUser.setChecked(super.getUser().isAdvanced());
  CheckBox acbQuickActivityInsert=(CheckBox)findViewById(R.id.acbQuickActivityInsert);
  acbQuickActivityInsert.setChecked(super.getUser().isQuickInsertActivity());
  CheckBox acbVibrate=(CheckBox)findViewById(R.id.acbVibrate);
  acbVibrate.setChecked(user.isVibration());
  CheckBox acbDimLight=(CheckBox)findViewById(R.id.acbDimLight);
  acbDimLight.setChecked(user.isDimLight());
}
 

Example 27

From project packages_apps_Phone_1, under directory /src/com/android/phone/.

Source file: SipCallOptionHandler.java

  18 
vote

private void addMakeDefaultCheckBox(Dialog dialog){
  LayoutInflater inflater=(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View view=inflater.inflate(com.android.internal.R.layout.always_use_checkbox,null);
  CheckBox makePrimaryCheckBox=(CheckBox)view.findViewById(com.android.internal.R.id.alwaysUse);
  makePrimaryCheckBox.setText(R.string.remember_my_choice);
  makePrimaryCheckBox.setOnCheckedChangeListener(this);
  mUnsetPriamryHint=(TextView)view.findViewById(com.android.internal.R.id.clearDefaultHint);
  mUnsetPriamryHint.setText(R.string.reset_my_choice_hint);
  mUnsetPriamryHint.setVisibility(View.GONE);
  ((AlertDialog)dialog).setView(view);
}
 

Example 28

From project platform_packages_apps_contacts, under directory /src/com/android/contacts/list/.

Source file: CustomContactListFilterActivity.java

  18 
vote

/** 
 * Handle any clicks on  {@link ExpandableListAdapter} children, whichusually mean toggling its visible state.
 */
@Override public boolean onChildClick(ExpandableListView parent,View view,int groupPosition,int childPosition,long id){
  final CheckBox checkbox=(CheckBox)view.findViewById(android.R.id.checkbox);
  final AccountDisplay account=(AccountDisplay)mAdapter.getGroup(groupPosition);
  final GroupDelta child=(GroupDelta)mAdapter.getChild(groupPosition,childPosition);
  if (child != null) {
    checkbox.toggle();
    child.putVisible(checkbox.isChecked());
  }
 else {
    this.openContextMenu(view);
  }
  return true;
}
 

Example 29

From project platform_packages_apps_CytownPhone, under directory /src/com/android/phone/.

Source file: SipCallOptionHandler.java

  18 
vote

private void addMakeDefaultCheckBox(Dialog dialog){
  LayoutInflater inflater=(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View view=inflater.inflate(com.android.internal.R.layout.always_use_checkbox,null);
  CheckBox makePrimaryCheckBox=(CheckBox)view.findViewById(com.android.internal.R.id.alwaysUse);
  makePrimaryCheckBox.setText(R.string.remember_my_choice);
  makePrimaryCheckBox.setOnCheckedChangeListener(this);
  mUnsetPriamryHint=(TextView)view.findViewById(com.android.internal.R.id.clearDefaultHint);
  mUnsetPriamryHint.setText(R.string.reset_my_choice_hint);
  mUnsetPriamryHint.setVisibility(View.GONE);
  ((AlertDialog)dialog).setView(view);
}
 

Example 30

From project platform_packages_apps_phone, under directory /src/com/android/phone/.

Source file: SipCallOptionHandler.java

  18 
vote

private void addMakeDefaultCheckBox(Dialog dialog){
  LayoutInflater inflater=(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View view=inflater.inflate(com.android.internal.R.layout.always_use_checkbox,null);
  CheckBox makePrimaryCheckBox=(CheckBox)view.findViewById(com.android.internal.R.id.alwaysUse);
  makePrimaryCheckBox.setText(R.string.remember_my_choice);
  makePrimaryCheckBox.setOnCheckedChangeListener(this);
  mUnsetPriamryHint=(TextView)view.findViewById(com.android.internal.R.id.clearDefaultHint);
  mUnsetPriamryHint.setText(R.string.reset_my_choice_hint);
  mUnsetPriamryHint.setVisibility(View.GONE);
  ((AlertDialog)dialog).setView(view);
}
 

Example 31

From project Android-FFXIEQ, under directory /ffxieq/src/com/github/kanata3249/ffxieq/android/.

Source file: FFXIEQActivity.java

  17 
vote

@Override public void onStop(){
{
    Button btn;
    btn=(Button)findViewById(R.id.Save);
    if (btn != null) {
      btn.setOnClickListener(null);
    }
  }
{
    CheckBox cb;
    cb=(CheckBox)findViewById(R.id.Compare);
    if (cb != null) {
      cb.setOnCheckedChangeListener(null);
    }
  }
{
    CharacterSelectorView cs;
    cs=(CharacterSelectorView)findViewById(R.id.CharacterSelector);
    if (cs != null) {
      cs.setOnItemSelectedListener(null);
    }
    cs=(CharacterSelectorView)findViewById(R.id.CharacterSelectorToCompare);
    if (cs != null) {
      cs.setOnItemSelectedListener(null);
    }
  }
  super.onStop();
}
 

Example 32

From project android-rackspacecloud, under directory /src/com/rackspacecloud/android/.

Source file: AddAccountActivity.java

  17 
vote

private void setUpCheckBox(){
  final CheckBox show_clear=(CheckBox)findViewById(R.id.show_clear);
  show_clear.setChecked(!isHidden);
  show_clear.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      if (((CheckBox)v).isChecked()) {
        passwordText.setTransformationMethod(new SingleLineTransformationMethod());
        isHidden=false;
      }
 else {
        passwordText.setTransformationMethod(new PasswordTransformationMethod());
        isHidden=true;
      }
      passwordText.requestFocus();
    }
  }
);
}
 

Example 33

From project AndroidLab, under directory /src/src/de/tubs/ibr/android/ldap/auth/.

Source file: AddServer.java

  17 
vote

/** 
 * Creates a new  {@code ServerInstance} structure from the providedinformation.
 * @return The created {@code ServerInstance} structure.
 * @throws NumberFormatException If the port number is not an integer.
 */
private ServerInstance createInstance() throws NumberFormatException {
  final EditText idField=(EditText)findViewById(R.id.layout_define_server_field_id);
  final String serverID=idField.getText().toString();
  final EditText hostField=(EditText)findViewById(R.id.layout_define_server_field_host);
  host=hostField.getText().toString();
  final EditText portField=(EditText)findViewById(R.id.layout_define_server_field_port);
  port=Integer.parseInt(portField.getText().toString());
  useSSL=false;
  useStartTLS=false;
  final Spinner secSpinner=(Spinner)findViewById(R.id.layout_define_server_spinner_security);
switch (secSpinner.getSelectedItemPosition()) {
case 1:
    useSSL=true;
  break;
case 2:
useStartTLS=true;
break;
default :
break;
}
final EditText bindDNField=(EditText)findViewById(R.id.layout_define_server_field_bind_dn);
bindDN=bindDNField.getText().toString();
final EditText bindPWField=(EditText)findViewById(R.id.layout_define_server_field_bind_pw);
bindPW=bindPWField.getText().toString();
final EditText baseField=(EditText)findViewById(R.id.layout_define_server_field_base);
baseDN=baseField.getText().toString();
final EditText filterField=(EditText)findViewById(R.id.layout_define_server_field_filter);
filter=filterField.getText().toString();
final CheckBox importCheck=(CheckBox)findViewById(R.id.layout_define_server_importManual);
manualImport=!importCheck.isChecked();
return new ServerInstance(serverID,host,port,useSSL,useStartTLS,bindDN,bindPW,baseDN,filter,manualImport);
}
 

Example 34

From project AnySoftKeyboard, under directory /src/com/anysoftkeyboard/ui/.

Source file: MainForm.java

  17 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main_fragment);
  mSelectedTabBottomDrawable=getResources().getDrawable(R.drawable.selected_tab);
  mSelectedTabBottomDrawable.setBounds(0,0,getWindowManager().getDefaultDisplay().getWidth(),getResources().getDimensionPixelOffset(R.dimen.selected_tab_drawable_height));
  mPager=(ViewFlipper)findViewById(R.id.main_pager);
  findViewById(R.id.main_tab_text_1).setOnClickListener(this);
  findViewById(R.id.main_tab_text_2).setOnClickListener(this);
  findViewById(R.id.main_tab_text_3).setOnClickListener(this);
  findViewById(R.id.goto_tips_form).setOnClickListener(this);
  findViewById(R.id.goto_changelog_button).setOnClickListener(this);
  findViewById(R.id.goto_howto_form).setOnClickListener(this);
  CheckBox showTipsNotifications=(CheckBox)findViewById(R.id.show_tips_next_time);
  showTipsNotifications.setChecked(AnyApplication.getConfig().getShowTipsNotification());
  showTipsNotifications.setOnClickListener(this);
  CheckBox showVersionNotifications=(CheckBox)findViewById(R.id.show_notifications_next_time);
  showVersionNotifications.setChecked(AnyApplication.getConfig().getShowVersionNotification());
  showVersionNotifications.setOnClickListener(this);
  setSelectedTab(0);
}
 

Example 35

From project beintoo-android-sdk, under directory /BeintooSDK/src/com/beintoo/activities/alliances/.

Source file: UserAllianceAdapter.java

  17 
vote

public CustomAdapterView(Context context,final ListItem l){
  super(context);
  this.setOrientation(LinearLayout.HORIZONTAL);
  this.setGravity(Gravity.CENTER_VERTICAL);
  this.setPadding((int)(ratio * 10),(int)(ratio * 10),0,(int)(ratio * 10));
  TextView left=new TextView(context);
  left.setGravity(Gravity.CENTER_VERTICAL);
  LinearLayout.LayoutParams params=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT);
  params.weight=1;
  left.setLayoutParams(params);
  left.setGravity(Gravity.LEFT);
  left.setTextColor(Color.parseColor("#787A77"));
  left.setText(l.leftText);
  addView(left);
  if (l.rightText != null) {
    TextView right=new TextView(context);
    right.setGravity(Gravity.RIGHT);
    right.setPadding(0,0,(int)(ratio * 10),0);
    right.setTextColor(Color.parseColor("#787A77"));
    right.setText(l.rightText);
    addView(right);
  }
  if (l.showCheck) {
    CheckBox cb=new CheckBox(context);
    cb.setGravity(Gravity.RIGHT);
    cb.setLayoutParams(new LinearLayout.LayoutParams(40,40));
    cb.setOnCheckedChangeListener(new OnCheckedChangeListener(){
      @Override public void onCheckedChanged(      CompoundButton buttonView,      boolean isChecked){
        l.isChecked=true;
      }
    }
);
    if (l.isChecked)     cb.setChecked(true);
    addView(cb);
  }
}
 

Example 36

From project Birthdays, under directory /src/com/rexmenpara/birthdays/.

Source file: BirthdaysActivity.java

  17 
vote

@Override protected void onListItemClick(ListView l,View v,int position,long id){
  TextView rowId=(TextView)v.findViewById(R.id.rowId);
  CheckBox reminder=(CheckBox)v.findViewById(R.id.chkReminder);
  TextView birthday=(TextView)v.findViewById(R.id.txtBirthday);
  if (this.currentMode == BirthdayArrayAdapter.MODE_VIEW) {
    Bundle args=new Bundle();
    args.putString("birthday",String.valueOf(birthday.getText()));
    args.putBoolean("reminder",reminder.isChecked());
    args.putString("rowId",String.valueOf(rowId.getText()));
    showEditDialog(args);
  }
 else {
    reminder.toggle();
    ImageView imgView=(ImageView)v.findViewById(R.id.syncIcon);
    if (reminder.isChecked()) {
      imgView.setVisibility(View.VISIBLE);
    }
 else {
      imgView.setVisibility(View.INVISIBLE);
    }
    db.open();
    db.updateEntryFromEdit(Long.parseLong(String.valueOf(rowId.getText())),String.valueOf(birthday.getText()),reminder.isChecked() ? 1 : 0);
    db.close();
  }
}
 

Example 37

From project bookmarktodesktop-android-application, under directory /src/be/vbsteven/bmtodesk/.

Source file: RegistrationActivity.java

  17 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  setTheme(android.R.style.Theme_Light_NoTitleBar);
  super.onCreate(savedInstanceState);
  setContentView(R.layout.registration);
  handler=new Handler();
  button=(Button)findViewById(R.id.but_create);
  button.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      register();
    }
  }
);
  button=(Button)findViewById(R.id.but_login);
  button.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      checkLogin();
    }
  }
);
  CheckBox cb=(CheckBox)findViewById(R.id.cb_password);
  cb.setOnCheckedChangeListener(new OnCheckedChangeListener(){
    @Override public void onCheckedChanged(    CompoundButton buttonView,    boolean isChecked){
      EditText password=(EditText)findViewById(R.id.et_password);
      if (isChecked) {
        password.setTransformationMethod(null);
      }
 else {
        password.setTransformationMethod(new PasswordTransformationMethod());
      }
    }
  }
);
}
 

Example 38

From project convertcsv, under directory /ConvertCSV/src/org/openintents/convertcsv/common/.

Source file: ConvertCsvBaseActivity.java

  17 
vote

@Override protected Dialog onCreateDialog(int id){
switch (id) {
case DIALOG_ID_WARN_OVERWRITE:
    LayoutInflater inflater=LayoutInflater.from(this);
  View view=inflater.inflate(R.layout.file_exists,null);
final CheckBox cb=(CheckBox)view.findViewById(R.id.dont_ask_again);
return new AlertDialog.Builder(this).setView(view).setPositiveButton(android.R.string.yes,new OnClickListener(){
public void onClick(DialogInterface dialog,int which){
  saveBooleanPreference(PreferenceActivity.PREFS_ASK_IF_FILE_EXISTS,!cb.isChecked());
  finish();
}
}
).setNegativeButton(android.R.string.no,new OnClickListener(){
public void onClick(DialogInterface dialog,int which){
}
}
).create();
case DIALOG_ID_WARN_RESTORE_POLICY:
return new AlertDialog.Builder(this).setTitle(R.string.warn_restore_policy_title).setMessage(R.string.warn_restore_policy).setPositiveButton(android.R.string.yes,new OnClickListener(){
public void onClick(DialogInterface dialog,int which){
startImportPostCheck();
}
}
).setNegativeButton(android.R.string.no,null).create();
case DIALOG_ID_NO_FILE_MANAGER_AVAILABLE:
return new DownloadOIAppDialog(this,DownloadOIAppDialog.OI_FILEMANAGER);
}
return super.onCreateDialog(id);
}
 

Example 39

From project creamed_glacier_app_settings, under directory /src/com/android/settings/bluetooth/.

Source file: BluetoothPairingDialog.java

  17 
vote

private View createPinEntryView(String deviceName){
  View view=getLayoutInflater().inflate(R.layout.bluetooth_pin_entry,null);
  TextView messageView=(TextView)view.findViewById(R.id.message);
  TextView messageView2=(TextView)view.findViewById(R.id.message_below_pin);
  CheckBox alphanumericPin=(CheckBox)view.findViewById(R.id.alphanumeric_pin);
  mPairingView=(EditText)view.findViewById(R.id.text);
  mPairingView.addTextChangedListener(this);
  alphanumericPin.setOnCheckedChangeListener(this);
  int messageId1;
  int messageId2;
  int maxLength;
switch (mType) {
case BluetoothDevice.PAIRING_VARIANT_PIN:
    messageId1=R.string.bluetooth_enter_pin_msg;
  messageId2=R.string.bluetooth_enter_pin_other_device;
maxLength=BLUETOOTH_PIN_MAX_LENGTH;
break;
case BluetoothDevice.PAIRING_VARIANT_PASSKEY:
messageId1=R.string.bluetooth_enter_passkey_msg;
messageId2=R.string.bluetooth_enter_passkey_other_device;
maxLength=BLUETOOTH_PASSKEY_MAX_LENGTH;
alphanumericPin.setVisibility(View.GONE);
break;
default :
Log.e(TAG,"Incorrect pairing type for createPinEntryView: " + mType);
return null;
}
String messageText=getString(messageId1,deviceName);
messageView.setText(Html.fromHtml(messageText));
messageView2.setText(messageId2);
mPairingView.setInputType(InputType.TYPE_CLASS_NUMBER);
mPairingView.setFilters(new InputFilter[]{new LengthFilter(maxLength)});
return view;
}
 

Example 40

From project DownloadProvider, under directory /src/com/mozillaonline/providers/downloads/ui/.

Source file: DownloadAdapter.java

  17 
vote

public void bindView(View convertView){
  if (!(convertView instanceof DownloadItem)) {
    return;
  }
  long downloadId=mCursor.getLong(mIdColumnId);
  ((DownloadItem)convertView).setDownloadId(downloadId);
  retrieveAndSetIcon(convertView);
  String title=mCursor.getString(mTitleColumnId);
  long totalBytes=mCursor.getLong(mTotalBytesColumnId);
  long currentBytes=mCursor.getLong(mCurrentBytesColumnId);
  int status=mCursor.getInt(mStatusColumnId);
  if (title.length() == 0) {
    title=mResources.getString(R.string.missing_title);
  }
  setTextForView(convertView,R.id.download_title,title);
  int progress=getProgressValue(totalBytes,currentBytes);
  boolean indeterminate=status == DownloadManager.STATUS_PENDING;
  ProgressBar progressBar=(ProgressBar)convertView.findViewById(R.id.download_progress);
  progressBar.setIndeterminate(indeterminate);
  if (!indeterminate) {
    progressBar.setProgress(progress);
  }
  if (status == DownloadManager.STATUS_FAILED || status == DownloadManager.STATUS_SUCCESSFUL) {
    progressBar.setVisibility(View.GONE);
  }
 else {
    progressBar.setVisibility(View.VISIBLE);
  }
  setTextForView(convertView,R.id.size_text,getSizeText(totalBytes));
  setTextForView(convertView,R.id.status_text,mResources.getString(getStatusStringId(status)));
  setTextForView(convertView,R.id.last_modified_date,getDateString());
  CheckBox checkBox=(CheckBox)convertView.findViewById(R.id.download_checkbox);
  checkBox.setChecked(mDownloadSelectionListener.isDownloadSelected(downloadId));
}
 

Example 41

From project facebook-android-sdk, under directory /examples/Hackbook/src/com/facebook/android/.

Source file: PermissionsDialog.java

  17 
vote

@Override public View getView(final int position,View convertView,ViewGroup parent){
  View hView=convertView;
  CheckBox checkbox;
  if (hView == null) {
    hView=mInflater.inflate(R.layout.permission_item,null);
    checkbox=(CheckBox)hView.findViewById(R.id.permission_checkbox);
    hView.setTag(checkbox);
  }
 else {
    checkbox=(CheckBox)hView.getTag();
  }
  checkbox.setText(this.permissions[position]);
  checkbox.setId(position);
  if (Utility.currentPermissions.containsKey(this.permissions[position]) && Utility.currentPermissions.get(this.permissions[position]).equals("1")) {
    checkbox.setTextColor(Color.GREEN);
    checkbox.setChecked(true);
    checkbox.setEnabled(false);
    checkbox.setOnCheckedChangeListener(null);
  }
 else {
    checkbox.setTextColor(Color.WHITE);
    checkbox.setChecked(this.isChecked[position]);
    checkbox.setEnabled(true);
    checkbox.setOnCheckedChangeListener(new OnCheckedChangeListener(){
      @Override public void onCheckedChanged(      CompoundButton button,      boolean checked){
        isChecked[button.getId()]=checked;
        if (checked) {
          reqPermVector.add(button.getText().toString());
        }
 else         if (reqPermVector.contains(button.getText())) {
          reqPermVector.remove(button.getText());
        }
      }
    }
);
  }
  return hView;
}
 

Example 42

From project Funf-Ohmage, under directory /src/edu/mit/media/funf/funfohmage/.

Source file: MainActivity.java

  17 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  context=this;
  datasource=new SensorDataSource(this);
  datasource.open();
  CheckBox enabledCheckbox=(CheckBox)findViewById(R.id.enabledCheckbox);
  enabledCheckbox.setChecked(MainPipeline.isEnabled(context));
  enabledCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener(){
    @Override public void onCheckedChanged(    CompoundButton buttonView,    boolean isChecked){
      Intent archiveIntent=new Intent(context,MainPipeline.class);
      String action=isChecked ? MainPipeline.ACTION_ENABLE : MainPipeline.ACTION_DISABLE;
      archiveIntent.setAction(action);
      startService(archiveIntent);
    }
  }
);
  MainPipeline.getSystemPrefs(this).registerOnSharedPreferenceChangeListener(this);
  updatedbCount();
  Button scanNowButton=(Button)findViewById(R.id.scanNowButton);
  scanNowButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      Intent runOnceIntent=new Intent(context,MainPipeline.class);
      runOnceIntent.setAction(MainPipeline.ACTION_RUN_ONCE);
      runOnceIntent.putExtra(MainPipeline.RUN_ONCE_PROBE_NAME,WifiProbe.class.getName());
      startService(runOnceIntent);
      runOnceIntent.putExtra(MainPipeline.RUN_ONCE_PROBE_NAME,LocationProbe.class.getName());
      startService(runOnceIntent);
      runOnceIntent.putExtra(MainPipeline.RUN_ONCE_PROBE_NAME,AccelerometerSensorProbe.class.getName());
      startService(runOnceIntent);
    }
  }
);
  SharedPreferencesHelper prefs=new SharedPreferencesHelper(this);
}
 

Example 43

From project Gaggle, under directory /src/com/geeksville/info/.

Source file: InfoListView.java

  17 
vote

/** 
 * Click the checkbox for included items, and place the infofields in the docks
 * @see android.widget.ArrayAdapter#getView(int,android.view.View,android.view.ViewGroup)
 */
@Override public View getView(int position,View convertView,ViewGroup parent){
  View row;
  if (convertView != null)   row=convertView;
 else   row=inflater.inflate(rowLayoutId,null);
  try {
    InfoDock dock=(InfoDock)row.findViewById(R.id.info);
    String name=(String)getItem(position);
    boolean isChecked=checkedNames.contains(name);
    dock.setInfoField(name);
    boolean isValid=dock.isEnabled();
    if (!isValid)     checkedNames.remove(name);
    CheckBox checkbox=(CheckBox)row.findViewById(R.id.checkbox);
    checkbox.setEnabled(isValid);
    checkbox.setChecked(isValid && isChecked);
    checkbox.setVisibility(isShowCheckmarks() ? VISIBLE : GONE);
    checkbox.setTag(name);
    checkbox.setOnCheckedChangeListener(this);
  }
 catch (  ClassCastException ex) {
    Log.w(TAG,"Ignoring " + ex.getMessage());
  }
  return row;
}
 

Example 44

From project gast-lib, under directory /app/src/jjil/app/barcodereader/.

Source file: BarcodeReaderActivity.java

  17 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.image_barcode);
  TextView tvBarcode=(TextView)findViewById(R.id.textView1);
  CheckBox ckSuccess=(CheckBox)findViewById(R.id.checkBox1);
  CrosshairOverlay co=(CrosshairOverlay)findViewById(R.id.crosshairoverlay1);
  int numberOfCameras=Camera.getNumberOfCameras();
  mPreview=(Preview)findViewById(R.id.preview1);
  mReadBarcode=new ReadBarcode(0.5d,tvBarcode,ckSuccess,co);
  CameraInfo cameraInfo=new CameraInfo();
  for (int i=0; i < numberOfCameras; i++) {
    Camera.getCameraInfo(i,cameraInfo);
    if (cameraInfo.facing == CameraInfo.CAMERA_FACING_BACK) {
      mDefaultCameraId=i;
    }
  }
  mCameraCurrentlyLocked=mDefaultCameraId;
}
 

Example 45

From project gobandroid, under directory /src/org/ligi/gobandroid_hd/ui/.

Source file: UndoWithVariationDialog.java

  17 
vote

public UndoWithVariationDialog(Context context){
  super(context);
  setTitle(R.string.keep_variant_);
  setIconResource(R.drawable.help);
  setContentView(R.layout.dialog_keep_variant);
  setIsSmallDialog();
  final CheckBox prevent_cb=(CheckBox)findViewById(R.id.keep_variant_session_cb);
class OnYesClick implements OnClickListener {
    @Override public void onClick(    DialogInterface dialog,    int which){
      getApp().getGame().undo(true);
      if (prevent_cb.isChecked())       getApp().getInteractionScope().ask_variant_session=false;
      dialog.dismiss();
    }
  }
class OnNoClick implements OnClickListener {
    @Override public void onClick(    DialogInterface dialog,    int which){
      getApp().getGame().undo(false);
      if (prevent_cb.isChecked())       getApp().getInteractionScope().ask_variant_session=false;
      dialog.dismiss();
    }
  }
  setPositiveButton(R.string.yes,new OnYesClick());
  setNegativeButton(R.string.no,new OnNoClick());
}
 

Example 46

From project jamendo-android, under directory /src/com/teleca/jamendo/activity/.

Source file: SplashscreenActivity.java

  17 
vote

final void showTutorial(){
  boolean showTutorial=PreferenceManager.getDefaultSharedPreferences(this).getBoolean(FIRST_RUN_PREFERENCE,true);
  if (showTutorial) {
    final TutorialDialog dlg=new TutorialDialog(this);
    dlg.setOnDismissListener(new DialogInterface.OnDismissListener(){
      @Override public void onDismiss(      DialogInterface dialog){
        CheckBox cb=(CheckBox)dlg.findViewById(R.id.toggleFirstRun);
        if (cb != null && cb.isChecked()) {
          SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(SplashscreenActivity.this);
          prefs.edit().putBoolean(FIRST_RUN_PREFERENCE,false).commit();
        }
        endAnimationHandler.removeCallbacks(endAnimationRunnable);
        endAnimationHandler.postDelayed(endAnimationRunnable,2000);
      }
    }
);
    dlg.show();
  }
 else {
    endAnimationHandler.removeCallbacks(endAnimationRunnable);
    endAnimationHandler.postDelayed(endAnimationRunnable,1500);
  }
}
 

Example 47

From project Juggernaut_SystemUI, under directory /src/com/android/systemui/usb/.

Source file: UsbResolverActivity.java

  17 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  Intent intent=getIntent();
  Parcelable targetParcelable=intent.getParcelableExtra(Intent.EXTRA_INTENT);
  if (!(targetParcelable instanceof Intent)) {
    Log.w("UsbResolverActivity","Target is not an intent: " + targetParcelable);
    finish();
    return;
  }
  Intent target=(Intent)targetParcelable;
  ArrayList<ResolveInfo> rList=intent.getParcelableArrayListExtra(EXTRA_RESOLVE_INFOS);
  CharSequence title=getResources().getText(com.android.internal.R.string.chooseUsbActivity);
  super.onCreate(savedInstanceState,target,title,null,rList,true);
  CheckBox alwaysUse=(CheckBox)findViewById(com.android.internal.R.id.alwaysUse);
  if (alwaysUse != null) {
    alwaysUse.setText(R.string.always_use_accessory);
  }
  mAccessory=(UsbAccessory)target.getParcelableExtra(UsbManager.EXTRA_ACCESSORY);
  if (mAccessory == null) {
    Log.e(TAG,"accessory is null");
    finish();
    return;
  }
  mDisconnectedReceiver=new UsbDisconnectedReceiver(this,mAccessory);
}
 

Example 48

From project mixare, under directory /src/org/mixare/.

Source file: MainActivity.java

  17 
vote

/** 
 * Shows a dialog
 */
public void showDialog(){
  final AlertDialog.Builder dialog=new AlertDialog.Builder(this);
  dialog.setTitle(R.string.launch_plugins);
  dialog.setMessage(R.string.plugin_message);
  final CheckBox checkBox=new CheckBox(ctx);
  checkBox.setText(R.string.remember_this_decision);
  dialog.setView(checkBox);
  dialog.setPositiveButton(R.string.yes,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface d,    int whichButton){
      processCheckbox(true,checkBox);
      startActivity(new Intent(ctx,PluginLoaderActivity.class));
      finish();
    }
  }
);
  dialog.setNegativeButton(R.string.no,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface d,    int whichButton){
      processCheckbox(true,checkBox);
      startActivity(new Intent(ctx,MixView.class));
      finish();
    }
  }
);
  dialog.show();
}
 

Example 49

From project mobilis, under directory /MobilisXHunt/MobilisXHunt_Android_Emulation/MobilisXHunt_Android_EmulationStarter/src/de/tudresden/inf/rn/mobilis/android/xhunt/teststarter/.

Source file: MainActivity.java

  17 
vote

public void click(View view){
  Bundle settings=new Bundle();
  Boolean isMisterX=false;
  String userName="";
  CheckBox checkMisterX=(CheckBox)findViewById(R.id.checkMisterX);
  isMisterX=checkMisterX.isChecked();
  EditText editUser=(EditText)findViewById(R.id.editUsername);
  userName=editUser.getText().toString();
  if (isMisterX) {
    EditText editNumberCount=(EditText)findViewById(R.id.editPlayerCount);
    Log.d(TAG,editNumberCount.getText().toString());
    Integer playerCount=Integer.parseInt(editNumberCount.getText().toString());
    Log.d(TAG,playerCount.toString());
    settings.putInt("playerCount",playerCount);
  }
  settings.putString("userName",userName);
  settings.putBoolean("isMisterX",isMisterX);
  Log.d(TAG,"start XHunt-Test");
  this.startInstrumentation(testComponent,null,settings);
}
 

Example 50

From project MyExpenses, under directory /src/org/totschnig/myexpenses/.

Source file: MethodEdit.java

  17 
vote

/** 
 * populates the input field either from the database or with default value for currency (from Locale)
 */
private void populateFields(){
  Bundle extras=getIntent().getExtras();
  long rowId=extras != null ? extras.getLong(ExpensesDbAdapter.KEY_ROWID) : 0;
  if (rowId != 0) {
    try {
      mMethod=PaymentMethod.getInstanceFromDb(rowId);
    }
 catch (    DataObjectNotFoundException e) {
      e.printStackTrace();
      setResult(RESULT_CANCELED);
      finish();
    }
    setTitle(R.string.menu_edit_method);
    mLabelText.setText(mMethod.getDisplayLabel(this));
    mPaymentType=mMethod.getPaymentType();
    mTypeButton.setText(mTypes[mPaymentType + 1]);
    if (mMethod.predef != null) {
      mLabelText.setEnabled(false);
    }
  }
 else {
    mMethod=new PaymentMethod();
    setTitle(R.string.menu_insert_method);
  }
  TableRow tr;
  TextView tv;
  CheckBox cb;
  for (  Account.Type accountType : Account.Type.values()) {
    tr=new TableRow(this);
    tv=new TextView(this);
    tv.setText(accountType.getDisplayName(this));
    cb=new CheckBox(this);
    cb.setTag(accountType);
    cb.setChecked(mMethod.isValidForAccountType(accountType));
    tr.addView(tv);
    tr.addView(cb);
    mTable.addView(tr);
  }
}
 

Example 51

From project Notes, under directory /src/net/micode/notes/ui/.

Source file: NoteEditActivity.java

  17 
vote

private View getListItem(String item,int index){
  View view=LayoutInflater.from(this).inflate(R.layout.note_edit_list_item,null);
  final NoteEditText edit=(NoteEditText)view.findViewById(R.id.et_edit_text);
  edit.setTextAppearance(this,TextAppearanceResources.getTexAppearanceResource(mFontSizeId));
  CheckBox cb=((CheckBox)view.findViewById(R.id.cb_edit_item));
  cb.setOnCheckedChangeListener(new OnCheckedChangeListener(){
    public void onCheckedChanged(    CompoundButton buttonView,    boolean isChecked){
      if (isChecked) {
        edit.setPaintFlags(edit.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
      }
 else {
        edit.setPaintFlags(Paint.ANTI_ALIAS_FLAG | Paint.DEV_KERN_TEXT_FLAG);
      }
    }
  }
);
  if (item.startsWith(TAG_CHECKED)) {
    cb.setChecked(true);
    edit.setPaintFlags(edit.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
    item=item.substring(TAG_CHECKED.length(),item.length()).trim();
  }
 else   if (item.startsWith(TAG_UNCHECKED)) {
    cb.setChecked(false);
    edit.setPaintFlags(Paint.ANTI_ALIAS_FLAG | Paint.DEV_KERN_TEXT_FLAG);
    item=item.substring(TAG_UNCHECKED.length(),item.length()).trim();
  }
  edit.setOnTextViewChangeListener(this);
  edit.setIndex(index);
  edit.setText(getHighlightQueryResult(item,mUserQuery));
  return view;
}
 

Example 52

From project nuxeo-android, under directory /nuxeo-android-connector/src/main/java/org/nuxeo/android/layout/widgets/.

Source file: CheckBoxWidgetWrapper.java

  17 
vote

@Override public View buildView(LayoutContext context,LayoutMode mode,Document doc,List<String> attributeNames,WidgetDefinition widgetDef){
  super.buildView(context,mode,doc,attributeNames,widgetDef);
  Context ctx=context.getActivity();
  checkbox=new CheckBox(ctx);
  return checkbox;
}
 

Example 53

From project ohmagePhone, under directory /src/org/ohmage/triggers/types/location/.

Source file: LocTrigMapsActivity.java

  17 
vote

private void showHelpDialog(){
  Dialog dialog=new Dialog(this);
  dialog.setContentView(R.layout.trigger_loc_maps_tips);
  dialog.setTitle(R.string.trigger_loc_defining_locations);
  dialog.setOwnerActivity(this);
  dialog.show();
  WebView webView=(WebView)dialog.findViewById(R.id.web_view);
  webView.loadUrl("file:///android_asset/trigger_loc_maps_help.html");
  CheckBox checkBox=(CheckBox)dialog.findViewById(R.id.check_do_not_show);
  checkBox.setChecked(shouldSkipToolTip());
  checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
    @Override public void onCheckedChanged(    CompoundButton buttonView,    boolean isChecked){
      SharedPreferences pref=LocTrigMapsActivity.this.getSharedPreferences(TOOL_TIP_PREF_NAME,Context.MODE_PRIVATE);
      SharedPreferences.Editor editor=pref.edit();
      editor.putBoolean(KEY_TOOL_TIP_DO_NT_SHOW,isChecked);
      editor.commit();
    }
  }
);
  Button button=(Button)dialog.findViewById(R.id.button_close);
  button.setTag(dialog);
  button.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      Object tag=v.getTag();
      if (tag != null && tag instanceof Dialog) {
        ((Dialog)tag).dismiss();
      }
    }
  }
);
}
 

Example 54

From project Ohmage_Phone, under directory /src/org/ohmage/triggers/types/location/.

Source file: LocTrigMapsActivity.java

  17 
vote

private void showHelpDialog(){
  Dialog dialog=new Dialog(this);
  dialog.setContentView(R.layout.trigger_loc_maps_tips);
  dialog.setTitle("Defining locations");
  dialog.setOwnerActivity(this);
  dialog.show();
  WebView webView=(WebView)dialog.findViewById(R.id.web_view);
  webView.loadUrl("file:///android_asset/trigger_loc_maps_help.html");
  CheckBox checkBox=(CheckBox)dialog.findViewById(R.id.check_do_not_show);
  checkBox.setChecked(shouldSkipToolTip());
  checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
    @Override public void onCheckedChanged(    CompoundButton buttonView,    boolean isChecked){
      SharedPreferences pref=LocTrigMapsActivity.this.getSharedPreferences(TOOL_TIP_PREF_NAME,Context.MODE_PRIVATE);
      SharedPreferences.Editor editor=pref.edit();
      editor.putBoolean(KEY_TOOL_TIP_DO_NT_SHOW,isChecked);
      editor.commit();
    }
  }
);
  Button button=(Button)dialog.findViewById(R.id.button_close);
  button.setTag(dialog);
  button.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      Object tag=v.getTag();
      if (tag != null && tag instanceof Dialog) {
        ((Dialog)tag).dismiss();
      }
    }
  }
);
}
 

Example 55

From project OneMoreDream, under directory /src/com/dixheure/.

Source file: AlarmClock.java

  17 
vote

public void bindView(View view,Context context,Cursor cursor){
  final Alarm alarm=new Alarm(cursor);
  CheckBox onButton=(CheckBox)view.findViewById(R.id.alarmButton);
  onButton.setChecked(alarm.enabled);
  onButton.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      boolean isChecked=((CheckBox)v).isChecked();
      Alarms.enableAlarm(AlarmClock.this,alarm.id,isChecked);
      if (isChecked) {
        SetAlarm.popAlarmSetToast(AlarmClock.this,alarm.hour,alarm.minutes,alarm.daysOfWeek);
      }
    }
  }
);
  DigitalClock digitalClock=(DigitalClock)view.findViewById(R.id.digitalClock);
  final Calendar c=Calendar.getInstance();
  c.set(Calendar.HOUR_OF_DAY,alarm.hour);
  c.set(Calendar.MINUTE,alarm.minutes);
  digitalClock.updateTime(c);
  TextView daysOfWeekView=(TextView)digitalClock.findViewById(R.id.daysOfWeek);
  final String daysOfWeekStr=alarm.daysOfWeek.toString(AlarmClock.this,false);
  if (daysOfWeekStr != null && daysOfWeekStr.length() != 0) {
    daysOfWeekView.setText(daysOfWeekStr);
    daysOfWeekView.setVisibility(View.VISIBLE);
  }
 else {
    daysOfWeekView.setVisibility(View.GONE);
  }
  TextView labelView=(TextView)digitalClock.findViewById(R.id.label);
  if (alarm.label != null && alarm.label.length() != 0) {
    labelView.setText(alarm.label);
    labelView.setVisibility(View.VISIBLE);
  }
 else {
    labelView.setVisibility(View.GONE);
  }
}
 

Example 56

From project Orweb, under directory /src/info/guardianproject/browser/.

Source file: SiteListAdapter.java

  17 
vote

public View getView(int position,View convertView,android.view.ViewGroup parent){
  View row=convertView;
  if (row == null) {
    LayoutInflater inflater=LayoutInflater.from(mContext);
    row=inflater.inflate(R.layout.sitelist_item,null);
  }
  CheckBox c=(CheckBox)row.findViewById(R.id.siteCheckbox);
  String site=getItem(position);
  if (mCookieManager.setCookieForDomain(site)) {
    c.setChecked(true);
  }
 else {
    c.setChecked(false);
  }
  c.setText(site);
  c.setTag(site);
  c.setOnCheckedChangeListener(this);
  return row;
}
 

Example 57

From project packages_apps_Calendar, under directory /src/com/android/calendar/selectcalendars/.

Source file: SelectCalendarsSyncAdapter.java

  17 
vote

@Override public View getView(int position,View convertView,ViewGroup parent){
  if (position >= mRowCount) {
    return null;
  }
  String name=mData[position].displayName;
  boolean selected=mData[position].synced;
  int color=Utils.getDisplayColorFromColor(mData[position].color);
  View view;
  if (convertView == null) {
    view=mInflater.inflate(LAYOUT,parent,false);
  }
 else {
    view=convertView;
  }
  view.setTag(mData[position]);
  CheckBox cb=(CheckBox)view.findViewById(R.id.sync);
  cb.setChecked(selected);
  if (selected) {
    setText(view,R.id.status,mSyncedString);
  }
 else {
    setText(view,R.id.status,mNotSyncedString);
  }
  View colorView=view.findViewById(R.id.color);
  colorView.setBackgroundColor(color);
  setText(view,R.id.calendar,name);
  return view;
}
 

Example 58

From project platform_packages_apps_alarmclock, under directory /src/com/android/alarmclock/.

Source file: AlarmClock.java

  17 
vote

public void bindView(View view,Context context,Cursor cursor){
  final Alarm alarm=new Alarm(cursor);
  CheckBox onButton=(CheckBox)view.findViewById(R.id.alarmButton);
  onButton.setChecked(alarm.enabled);
  onButton.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      boolean isChecked=((CheckBox)v).isChecked();
      Alarms.enableAlarm(AlarmClock.this,alarm.id,isChecked);
      if (isChecked) {
        SetAlarm.popAlarmSetToast(AlarmClock.this,alarm.hour,alarm.minutes,alarm.daysOfWeek);
      }
    }
  }
);
  DigitalClock digitalClock=(DigitalClock)view.findViewById(R.id.digitalClock);
  final Calendar c=Calendar.getInstance();
  c.set(Calendar.HOUR_OF_DAY,alarm.hour);
  c.set(Calendar.MINUTE,alarm.minutes);
  digitalClock.updateTime(c);
  TextView daysOfWeekView=(TextView)digitalClock.findViewById(R.id.daysOfWeek);
  final String daysOfWeekStr=alarm.daysOfWeek.toString(AlarmClock.this,false);
  if (daysOfWeekStr != null && daysOfWeekStr.length() != 0) {
    daysOfWeekView.setText(daysOfWeekStr);
    daysOfWeekView.setVisibility(View.VISIBLE);
  }
 else {
    daysOfWeekView.setVisibility(View.GONE);
  }
  TextView labelView=(TextView)digitalClock.findViewById(R.id.label);
  if (alarm.label != null && alarm.label.length() != 0) {
    labelView.setText(alarm.label);
    labelView.setVisibility(View.VISIBLE);
  }
 else {
    labelView.setVisibility(View.GONE);
  }
}
 

Example 59

From project platform_packages_apps_calendar, under directory /src/com/android/calendar/selectcalendars/.

Source file: SelectCalendarsSyncAdapter.java

  17 
vote

@Override public View getView(int position,View convertView,ViewGroup parent){
  if (position >= mRowCount) {
    return null;
  }
  String name=mData[position].displayName;
  boolean selected=mData[position].synced;
  int color=Utils.getDisplayColorFromColor(mData[position].color);
  View view;
  if (convertView == null) {
    view=mInflater.inflate(LAYOUT,parent,false);
  }
 else {
    view=convertView;
  }
  view.setTag(mData[position]);
  CheckBox cb=(CheckBox)view.findViewById(R.id.sync);
  cb.setChecked(selected);
  if (selected) {
    setText(view,R.id.status,mSyncedString);
  }
 else {
    setText(view,R.id.status,mNotSyncedString);
  }
  View colorView=view.findViewById(R.id.color);
  colorView.setBackgroundColor(color);
  setText(view,R.id.calendar,name);
  return view;
}
 

Example 60

From project platform_packages_apps_mms, under directory /src/com/android/mms/ui/.

Source file: ConversationList.java

  17 
vote

/** 
 * Build and show the proper delete thread dialog. The UI is slightly different depending on whether there are locked messages in the thread(s) and whether we're deleting single/multiple threads or all threads.
 * @param listener gets called when the delete button is pressed
 * @param threadIds the thread IDs to be deleted (pass null for all threads)
 * @param hasLockedMessages whether the thread(s) contain locked messages
 * @param context used to load the various UI elements
 */
public static void confirmDeleteThreadDialog(final DeleteThreadListener listener,Collection<Long> threadIds,boolean hasLockedMessages,Context context){
  View contents=View.inflate(context,R.layout.delete_thread_dialog_view,null);
  TextView msg=(TextView)contents.findViewById(R.id.message);
  if (threadIds == null) {
    msg.setText(R.string.confirm_delete_all_conversations);
  }
 else {
    int cnt=threadIds.size();
    msg.setText(context.getResources().getQuantityString(R.plurals.confirm_delete_conversation,cnt,cnt));
  }
  final CheckBox checkbox=(CheckBox)contents.findViewById(R.id.delete_locked);
  if (!hasLockedMessages) {
    checkbox.setVisibility(View.GONE);
  }
 else {
    listener.setDeleteLockedMessage(checkbox.isChecked());
    checkbox.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View v){
        listener.setDeleteLockedMessage(checkbox.isChecked());
      }
    }
);
  }
  AlertDialog.Builder builder=new AlertDialog.Builder(context);
  builder.setTitle(R.string.confirm_dialog_title).setIconAttribute(android.R.attr.alertDialogIcon).setCancelable(true).setPositiveButton(R.string.delete,listener).setNegativeButton(R.string.no,null).setView(contents).show();
}
 

Example 61

From project platform_packages_apps_settings, under directory /src/com/android/settings/bluetooth/.

Source file: BluetoothPairingDialog.java

  17 
vote

private View createPinEntryView(String deviceName){
  View view=getLayoutInflater().inflate(R.layout.bluetooth_pin_entry,null);
  TextView messageView=(TextView)view.findViewById(R.id.message);
  TextView messageView2=(TextView)view.findViewById(R.id.message_below_pin);
  CheckBox alphanumericPin=(CheckBox)view.findViewById(R.id.alphanumeric_pin);
  mPairingView=(EditText)view.findViewById(R.id.text);
  mPairingView.addTextChangedListener(this);
  alphanumericPin.setOnCheckedChangeListener(this);
  int messageId1;
  int messageId2;
  int maxLength;
switch (mType) {
case BluetoothDevice.PAIRING_VARIANT_PIN:
    messageId1=R.string.bluetooth_enter_pin_msg;
  messageId2=R.string.bluetooth_enter_pin_other_device;
maxLength=BLUETOOTH_PIN_MAX_LENGTH;
break;
case BluetoothDevice.PAIRING_VARIANT_PASSKEY:
messageId1=R.string.bluetooth_enter_passkey_msg;
messageId2=R.string.bluetooth_enter_passkey_other_device;
maxLength=BLUETOOTH_PASSKEY_MAX_LENGTH;
alphanumericPin.setVisibility(View.GONE);
break;
default :
Log.e(TAG,"Incorrect pairing type for createPinEntryView: " + mType);
return null;
}
String messageText=getString(messageId1,deviceName);
messageView.setText(Html.fromHtml(messageText));
messageView2.setText(messageId2);
mPairingView.setInputType(InputType.TYPE_CLASS_NUMBER);
mPairingView.setFilters(new InputFilter[]{new LengthFilter(maxLength)});
return view;
}
 

Example 62

From project ActionBarSherlock, under directory /samples/fragments/src/com/actionbarsherlock/sample/fragments/.

Source file: FragmentMenuSupport.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  setTheme(SampleList.THEME);
  super.onCreate(savedInstanceState);
  setContentView(R.layout.fragment_menu);
  FragmentManager fm=getSupportFragmentManager();
  FragmentTransaction ft=fm.beginTransaction();
  mFragment1=fm.findFragmentByTag("f1");
  if (mFragment1 == null) {
    mFragment1=new MenuFragment();
    ft.add(mFragment1,"f1");
  }
  mFragment2=fm.findFragmentByTag("f2");
  if (mFragment2 == null) {
    mFragment2=new Menu2Fragment();
    ft.add(mFragment2,"f2");
  }
  ft.commit();
  mCheckBox1=(CheckBox)findViewById(R.id.menu1);
  mCheckBox1.setOnClickListener(mClickListener);
  mCheckBox2=(CheckBox)findViewById(R.id.menu2);
  mCheckBox2.setOnClickListener(mClickListener);
  updateFragmentVisibility();
}
 

Example 63

From project aksunai, under directory /src/org/androidnerds/app/aksunai/ui/.

Source file: ServerDetail.java

  15 
vote

private void loadServerData(Long id){
  mTitle=(EditText)findViewById(R.id.detail_title);
  mAddress=(EditText)findViewById(R.id.detail_address);
  mUsername=(EditText)findViewById(R.id.detail_username);
  mNickname=(EditText)findViewById(R.id.detail_nick);
  mPassword=(EditText)findViewById(R.id.detail_password);
  mPort=(EditText)findViewById(R.id.detail_port);
  mRealName=(EditText)findViewById(R.id.detail_real_name);
  mAutojoin=(EditText)findViewById(R.id.detail_autojoin);
  mAutoconnect=(CheckBox)findViewById(R.id.detail_autoconnect);
  ServerDbAdapter db=new ServerDbAdapter(this);
  Cursor c=db.getItem(id.longValue());
  while (c.moveToNext()) {
    mTitle.setText(c.getString(1));
    mAddress.setText(c.getString(2));
    mUsername.setText(c.getString(3));
    mNickname.setText(c.getString(4));
    mPassword.setText(c.getString(5));
    mPort.setText(c.getString(6));
    mRealName.setText(c.getString(7));
    if (c.getString(8) != null) {
      mAutojoin.setText(c.getString(8));
    }
    if (c.getInt(9) == 1) {
      mAutoconnect.setChecked(true);
    }
 else {
      mAutoconnect.setChecked(false);
    }
  }
  db.release();
}
 

Example 64

From project and-bible, under directory /AndBible/src/net/bible/android/view/activity/speak/.

Source file: Speak.java

  15 
vote

/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Log.i(TAG,"Displaying Search view");
  setContentView(R.layout.speak);
  speakControl=ControlFactory.getInstance().getSpeakControl();
  numPagesToSpeakDefinitions=speakControl.getNumPagesToSpeakDefinitions();
  for (  NumPagesToSpeakDefinition defn : numPagesToSpeakDefinitions) {
    RadioButton numChaptersCheckBox=(RadioButton)findViewById(defn.getRadioButtonId());
    numChaptersCheckBox.setText(defn.getPrompt());
  }
  mQueueCheckBox=(CheckBox)findViewById(R.id.queue);
  mRepeatCheckBox=(CheckBox)findViewById(R.id.repeat);
  mQueueCheckBox.setChecked(true);
  mRepeatCheckBox.setChecked(false);
  Log.d(TAG,"Finished displaying Speak view");
}
 

Example 65

From project andlytics, under directory /src/com/github/andlyticsproject/.

Source file: ChartActivity.java

  15 
vote

@Override protected List<View> getExtraConfig(){
  LinearLayout ll=(LinearLayout)getLayoutInflater().inflate(R.layout.chart_extra_config,null);
  checkSmooth=(CheckBox)ll.findViewById(R.id.chart_config_checkbox_smooth);
  if (smoothEnabled) {
    checkSmooth.setChecked(true);
  }
  checkSmooth.setOnCheckedChangeListener(new OnCheckedChangeListener(){
    @Override public void onCheckedChanged(    CompoundButton buttonView,    boolean isChecked){
      if (isChecked) {
        smoothEnabled=true;
        executeLoadDataDefault();
        Preferences.saveSmooth(true,ChartActivity.this);
      }
 else {
        smoothEnabled=false;
        executeLoadDataDefault();
        Preferences.saveSmooth(false,ChartActivity.this);
      }
    }
  }
);
  List<View> ret=new ArrayList<View>();
  ret.add(ll);
  return ret;
}
 

Example 66

From project android-bankdroid, under directory /src/com/liato/bankdroid/appwidget/.

Source file: WidgetConfigureActivity.java

  15 
vote

public void onResume(){
  super.onResume();
  setContentView(R.layout.main);
  this.setTitle(this.getString(R.string.choose_an_account));
  setResult(RESULT_CANCELED);
  ((View)findViewById(R.id.layMainMenu)).setVisibility(View.GONE);
  Intent intent=getIntent();
  Bundle extras=intent.getExtras();
  if (extras != null) {
    mAppWidgetId=extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID,AppWidgetManager.INVALID_APPWIDGET_ID);
  }
  if (mAppWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) {
    finish();
  }
  ListView lv=(ListView)findViewById(R.id.lstAccountsList);
  lv.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      if (adapter.getItemViewType(position) != AccountsAdapter.VIEWTYPE_ACCOUNT)       return;
      final Context context=WidgetConfigureActivity.this;
      Account account=(Account)parent.getItemAtPosition(position);
      Bank bank=account.getBank();
      WidgetConfigureActivity.setAccountBankId(context,mAppWidgetId,account.getId(),bank.getDbId());
      SharedPreferences.Editor prefs=context.getSharedPreferences("widget_prefs",0).edit();
      prefs.putBoolean("transperant_background" + mAppWidgetId,((CheckBox)findViewById(R.id.chkTransperantBackground)).isChecked());
      prefs.commit();
      AppWidgetManager appWidgetManager=AppWidgetManager.getInstance(context);
      BankdroidWidgetProvider.updateAppWidget(context,appWidgetManager,mAppWidgetId,account);
      Intent resultValue=new Intent();
      resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,mAppWidgetId);
      setResult(RESULT_OK,resultValue);
      finish();
    }
  }
);
  refreshView();
}
 

Example 67

From project android-tether, under directory /src/og/android/tether/.

Source file: ConnectActivity.java

  15 
vote

@Override public void onPause(){
  Log.d(TAG,"onPause()");
  if (((TetherApplication)getApplication()).FBManager != null)   ((TetherApplication)getApplication()).FBManager.destroyDialog();
  mPrefsEdit.putString("post_message",mPostEditor.getText().toString());
  if (((CheckBox)findViewById(R.id.autoPostCheck)).isChecked())   mPrefsEdit.putBoolean("auto_post",true);
  mPrefsEdit.commit();
  super.onPause();
}
 

Example 68

From project android-xbmcremote, under directory /src/org/xbmc/android/remote/presentation/controller/.

Source file: HostPreference.java

  15 
vote

@Override protected View onCreateDialogView(){
  final ViewGroup parent=(ViewGroup)super.onCreateDialogView();
  mNameView=(EditText)parent.findViewById(R.id.pref_name);
  mHostView=(EditText)parent.findViewById(R.id.pref_host);
  mHostView.setOnFocusChangeListener(new OnFocusChangeListener(){
    Handler handler=new Handler(){
      public void handleMessage(      android.os.Message message){
        if (message.getData().containsKey(MacAddressResolver.MESSAGE_MAC_ADDRESS)) {
          String mac=message.getData().getString(MacAddressResolver.MESSAGE_MAC_ADDRESS);
          if (!mac.equals("")) {
            mMacAddrView.setText(mac);
            Toast toast=Toast.makeText(getContext(),"Updated MAC for host: " + mHostView.getText().toString() + "\nto: "+ mac,Toast.LENGTH_SHORT);
            toast.show();
          }
        }
      }
    }
;
    public void onFocusChange(    View v,    boolean hasFocus){
      if (hasFocus)       return;
      if (mMacAddrView.getText().toString().equals(""))       handler.post(new MacAddressResolver(mHostView.getText().toString(),handler));
    }
  }
);
  mPortView=(EditText)parent.findViewById(R.id.pref_port);
  mUserView=(EditText)parent.findViewById(R.id.pref_user);
  mPassView=(EditText)parent.findViewById(R.id.pref_pass);
  mEsPortView=(EditText)parent.findViewById(R.id.pref_eventserver_port);
  mTimeoutView=(EditText)parent.findViewById(R.id.pref_timeout);
  mMacAddrView=(EditText)parent.findViewById(R.id.pref_mac_addr);
  mAccPointView=(EditText)parent.findViewById(R.id.pref_access_point);
  mWifiOnlyView=(CheckBox)parent.findViewById(R.id.pref_wifi_only);
  mWolPortView=(EditText)parent.findViewById(R.id.pref_wol_port);
  mWolWaitView=(EditText)parent.findViewById(R.id.pref_wol_wait);
  return parent;
}
 

Example 69

From project android_packages_apps_Superuser, under directory /src/com/noshufou/android/su/.

Source file: InfoFragment.java

  15 
vote

@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.fragment_info,container,false);
  mSuperuserVersion=(TextView)view.findViewById(R.id.superuser_version);
  mEliteInstalled=(TextView)view.findViewById(R.id.elite_installed);
  mGetEliteLabel=(TextView)view.findViewById(R.id.get_elite_label);
  mSuVersion=(TextView)view.findViewById(R.id.su_version);
  mSuDetailsRow=view.findViewById(R.id.su_details_row);
  mSuDetailsMode=(TextView)view.findViewById(R.id.su_details_mode);
  mSuDetailsOwner=(TextView)view.findViewById(R.id.su_details_owner);
  mSuDetailsFile=(TextView)view.findViewById(R.id.su_details_file);
  mSuWarning=(TextView)view.findViewById(R.id.su_warning);
  mOutdatedNotification=(CheckBox)view.findViewById(R.id.outdated_notification);
  mOutdatedNotification.setOnCheckedChangeListener(this);
  mSuOptionsRow=view.findViewById(R.id.su_options_row);
  mTempUnroot=(CheckBox)view.findViewById(R.id.temp_unroot);
  mTempUnroot.setOnClickListener(this);
  mOtaSurvival=(CheckBox)view.findViewById(R.id.ota_survival);
  mOtaSurvival.setOnClickListener(this);
  view.findViewById(R.id.display_changelog).setOnClickListener(this);
  mGetElite=view.findViewById(R.id.get_elite);
  mGetElite.setOnClickListener(this);
  mBinaryUpdater=view.findViewById(R.id.binary_updater);
  mBinaryUpdater.setOnClickListener(this);
  new UpdateInfo().execute();
  return view;
}
 

Example 70

From project android_packages_apps_Tag, under directory /src/com/android/apps/tag/.

Source file: MyTagList.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.my_tag_activity);
  if (savedInstanceState != null) {
    mTagIdInEdit=savedInstanceState.getLong(BUNDLE_KEY_TAG_ID_IN_EDIT,-1);
  }
  mEnabled=(CheckBox)findViewById(R.id.toggle_enabled_checkbox);
  mEnabled.setChecked(false);
  findViewById(R.id.toggle_enabled_target).setOnClickListener(this);
  mActiveTagDetails=findViewById(R.id.active_tag_details);
  mSelectActiveTagAnchor=findViewById(R.id.choose_my_tag);
  findViewById(R.id.active_tag).setOnClickListener(this);
  updateActiveTagView(null);
  mActiveTagId=getPreferences(Context.MODE_PRIVATE).getLong(PREF_KEY_ACTIVE_TAG,-1);
  mAdapter=new TagAdapter(this);
  mList=(ListView)findViewById(android.R.id.list);
  mList.setAdapter(mAdapter);
  mList.setOnItemClickListener(this);
  findViewById(R.id.add_tag).setOnClickListener(this);
  mList.setEmptyView(null);
  new TagLoaderTask().execute((Void[])null);
  if (!Build.TYPE.equalsIgnoreCase("user")) {
    mWriteSupport=true;
  }
  registerForContextMenu(mList);
  if (getIntent().hasExtra(EditTagActivity.EXTRA_RESULT_MSG)) {
    NdefMessage msg=(NdefMessage)Preconditions.checkNotNull(getIntent().getParcelableExtra(EditTagActivity.EXTRA_RESULT_MSG));
    saveNewMessage(msg);
  }
}
 

Example 71

From project BF3-Battlelog, under directory /src/com/ninetwozero/battlelog/activity/platoon/.

Source file: PlatoonInviteActivity.java

  15 
vote

public void onListItemClick(ListView lv,View v,int pos,long id){
  if (mSelectedIds[pos].equals(0)) {
    mSelectedIds[pos]=id;
    ((CheckBox)v.findViewById(R.id.checkbox)).setChecked(true);
  }
 else {
    mSelectedIds[pos]=0;
    ((CheckBox)v.findViewById(R.id.checkbox)).setChecked(false);
  }
}
 

Example 72

From project callmeter, under directory /src/de/ub0r/android/callmeter/widget/.

Source file: StatsAppWidgetConfigure.java

  15 
vote

/** 
 * {@inheritDoc}
 */
@Override public void onCreate(final Bundle savedInstanceState){
  Utils.setLocale(this);
  super.onCreate(savedInstanceState);
  this.setTitle(R.string.widget_config_);
  this.setContentView(R.layout.stats_appwidget_config);
  this.spinner=(Spinner)this.findViewById(R.id.spinner);
  this.cbHideName=(CheckBox)this.findViewById(R.id.hide_name);
  this.cbHideName.setOnCheckedChangeListener(new OnCheckedChangeListener(){
    @Override public void onCheckedChanged(    final CompoundButton buttonView,    final boolean isChecked){
      StatsAppWidgetConfigure.this.cbShowShortname.setEnabled(!isChecked);
    }
  }
);
  this.cbShowShortname=(CheckBox)this.findViewById(R.id.shortname);
  this.cbShowShortname.setOnCheckedChangeListener(this);
  this.cbShowCost=(CheckBox)this.findViewById(R.id.cost);
  this.cbShowBillp=(CheckBox)this.findViewById(R.id.pbillp);
  this.cbShowIcon=(CheckBox)this.findViewById(R.id.show_icon);
  this.cbSmallWidget=(CheckBox)this.findViewById(R.id.small_widget);
  this.etPlanTextSize=(EditText)this.findViewById(R.id.widget_plan_textsize);
  this.etStatsTextSize=(EditText)this.findViewById(R.id.widget_stats_textsize);
  this.btnTextColor=(Button)this.findViewById(R.id.textcolor);
  this.btnBgColor=(Button)this.findViewById(R.id.bgcolor);
  this.vTextColor=this.findViewById(R.id.textcolorfield);
  this.vBgColor=this.findViewById(R.id.bgcolorfield);
  this.sbBgTransparency=(SeekBar)this.findViewById(R.id.bgtransparency);
  this.setAdapter();
  this.findViewById(R.id.ok).setOnClickListener(this);
  this.findViewById(R.id.cancel).setOnClickListener(this);
  this.btnTextColor.setOnClickListener(this);
  this.btnBgColor.setOnClickListener(this);
  this.sbBgTransparency.setOnSeekBarChangeListener(this);
  this.setTextColor(DEFAULT_TEXTCOLOR);
  this.setBgColor(DEFAULT_BGCOLOR,false);
}
 

Example 73

From project cmsandroid, under directory /src/com/zia/freshdocs/activity/.

Source file: HostPreferenceActivity.java

  15 
vote

protected void editServer(String id){
  CMISPreferencesManager prefsMgr=CMISPreferencesManager.getInstance();
  _currentHost=prefsMgr.getPreferences(this,id);
  if (_currentHost != null) {
    ((EditText)findViewById(R.id.hostname_edittext)).setText((String)_currentHost.getHostname());
    ((EditText)findViewById(R.id.username_edittext)).setText((String)_currentHost.getUsername());
    ((EditText)findViewById(R.id.password_edittext)).setText((String)_currentHost.getPassword());
    ((EditText)findViewById(R.id.webapp_root)).setText((String)_currentHost.getWebappRoot());
    ((EditText)findViewById(R.id.port_edittext)).setText(Integer.toString((int)_currentHost.getPort()));
    ((CheckBox)findViewById(R.id.ssl)).setChecked(_currentHost.isSSL());
    ((CheckBox)findViewById(R.id.hidden_files)).setChecked(_currentHost.isShowHidden());
  }
}
 

Example 74

From project Cura, under directory /src/com/cura/syslog/.

Source file: SysLogActivity.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.syslog);
  Bundle extras=getIntent().getExtras();
  if (extras != null)   user=(User)extras.get("user");
  doBindService();
  initSpinners();
  sysLogButton=(Button)findViewById(R.id.sysLogButton);
  sysLogButton.setOnClickListener(this);
  sysLogSaveButton=(Button)findViewById(R.id.sysLogSaveLogsButton);
  sysLogSaveButton.setOnClickListener(this);
  checkBox=(CheckBox)findViewById(R.id.EnableLineNumber);
  checkBox.setOnClickListener(this);
  checkBox.setChecked(false);
  lineNumbers=(EditText)findViewById(R.id.LinesNumber);
  lineNumbers.setEnabled(false);
  syslogDir=new File("/sdcard/Cura/Syslog");
  mNotificationManager=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
}
 

Example 75

From project cw-android, under directory /Basic/CheckBox/src/com/commonsware/android/checkbox/.

Source file: CheckBoxDemo.java

  15 
vote

@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  setContentView(R.layout.main);
  cb=(CheckBox)findViewById(R.id.check);
  cb.setOnCheckedChangeListener(this);
}
 

Example 76

From project Diktofon, under directory /app/src/kaljurand_at_gmail_dot_com/diktofon/adapter/.

Source file: TagSelectorAdapter.java

  15 
vote

public View getView(final int position,View convertView,ViewGroup parent){
  ViewHolder holder;
  if (convertView == null) {
    convertView=mInflater.inflate(R.layout.list_item_edittag,null);
    holder=new ViewHolder();
    holder.list_item_edittag_title=(TextView)convertView.findViewById(R.id.list_item_edittag_title);
    holder.list_item_edittag_state=(CheckBox)convertView.findViewById(R.id.list_item_edittag_state);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  final String tag=mTags.get(position);
  holder.list_item_edittag_title.setText(tag);
  holder.list_item_edittag_state.setChecked(mSelectedTags.contains(tag));
  holder.list_item_edittag_state.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      if (((CheckBox)v).isChecked()) {
        mSelectedTags.add(tag);
      }
 else {
        mSelectedTags.remove(tag);
      }
    }
  }
);
  return convertView;
}
 

Example 77

From project dreamDroid, under directory /src/net/reichholf/dreamdroid/fragment/.

Source file: ProfileEditFragment.java

  15 
vote

@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.profile_edit,container,false);
  mProfile=(EditText)view.findViewById(R.id.EditTextProfile);
  mHost=(EditText)view.findViewById(R.id.EditTextHost);
  mStreamHost=(EditText)view.findViewById(R.id.EditTextStreamHost);
  mPort=(EditText)view.findViewById(R.id.EditTextPort);
  mStreamPort=(EditText)view.findViewById(R.id.EditTextStreamPort);
  mFilePort=(EditText)view.findViewById(R.id.EditTextFilePort);
  mSsl=(CheckBox)view.findViewById(R.id.CheckBoxSsl);
  mLogin=(CheckBox)view.findViewById(R.id.CheckBoxLogin);
  mUser=(EditText)view.findViewById(R.id.EditTextUser);
  mPass=(EditText)view.findViewById(R.id.EditTextPass);
  mSimpleRemote=(CheckBox)view.findViewById(R.id.CheckBoxSimpleRemote);
  mLayoutLogin=(LinearLayout)view.findViewById(R.id.LinearLayoutLogin);
  if (Intent.ACTION_EDIT.equals(getArguments().getString("action"))) {
    mCurrentProfile=(Profile)getArguments().getSerializable("profile");
    if (mCurrentProfile == null)     mCurrentProfile=new Profile();
    assignProfile();
  }
  onIsLoginChanged(mLogin.isChecked());
  mLogin.setOnCheckedChangeListener(new OnCheckedChangeListener(){
    @Override public void onCheckedChanged(    CompoundButton checkbox,    boolean checked){
      onIsLoginChanged(checked);
    }
  }
);
  mSsl.setOnCheckedChangeListener(new OnCheckedChangeListener(){
    @Override public void onCheckedChanged(    CompoundButton checkbox,    boolean checked){
      onSslChanged(checked);
    }
  }
);
  return view;
}
 

Example 78

From project droid-comic-viewer, under directory /src/net/robotmedia/acv/ui/settings/.

Source file: BrightnessPreference.java

  15 
vote

@Override protected View onCreateDialogView(){
  LayoutInflater inflater=(LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  RelativeLayout layout=(RelativeLayout)inflater.inflate(R.layout.brightness_preference,null);
  mSeekBar=(SeekBar)layout.findViewById(R.id.brightness_seekbar);
  mSeekBar.setOnSeekBarChangeListener(this);
  mCheckBox=(CheckBox)layout.findViewById(R.id.brightness_checkbox);
  mCheckBox.setOnCheckedChangeListener(this);
  if (shouldPersist()) {
    mValue=getPersistedInt(mDefault);
  }
  if (mValue < 0) {
    mCheckBox.setChecked(true);
    mSeekBar.setEnabled(false);
  }
 else {
    mCheckBox.setChecked(false);
    mSeekBar.setEnabled(true);
    mSeekBar.setProgress(mValue);
  }
  return layout;
}
 

Example 79

From project evodroid, under directory /src/com/sonorth/evodroid/.

Source file: ViewComments.java

  15 
vote

CheckBox getBulkCheck(){
  if (bulkCheck == null) {
    bulkCheck=(CheckBox)row.findViewById(R.id.bulkCheck);
  }
  return (bulkCheck);
}
 

Example 80

From project fauxclock, under directory /src/com/teamkang/fauxclock/factories/.

Source file: CpuFactory.java

  15 
vote

public void onClick(View v){
switch (v.getId()) {
case R.id.set_on_boot:
    boolean checked=((CheckBox)v).isChecked();
  cpu.getEditor().putBoolean("load_on_startup",checked).apply();
Log.e(TAG,"set load on startup to be: " + checked);
break;
case R.id.screen_off_profile:
boolean checked1=((CheckBox)v).isChecked();
cpu.getEditor().putBoolean("use_screen_off_profile",checked1).apply();
if (checked1) {
((OCApplication)mContext.getApplicationContext()).registerScreenReceiver();
cpuLayoutScreenOff.setVisibility(View.VISIBLE);
cpu.setMaxFreq(cpu.getMaxFreqSet());
cpu.setMinFreq(cpu.getMinFreqSet());
}
 else {
cpuLayoutScreenOff.setVisibility(View.GONE);
((OCApplication)mContext.getApplicationContext()).unregisterScreenRecever();
}
break;
case R.id.ping_cpu_1:
boolean checked2=((CheckBox)v).isChecked();
cpu.getEditor().putBoolean("ping_cpu_1",checked2).apply();
break;
}
}
 

Example 81

From project finch, under directory /libs/JakeWharton-ActionBarSherlock-2eabf25/samples/fragments/src/com/actionbarsherlock/sample/fragments/.

Source file: FragmentMenuSupport.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  setTheme(SampleList.THEME);
  super.onCreate(savedInstanceState);
  setContentView(R.layout.fragment_menu);
  FragmentManager fm=getSupportFragmentManager();
  FragmentTransaction ft=fm.beginTransaction();
  mFragment1=fm.findFragmentByTag("f1");
  if (mFragment1 == null) {
    mFragment1=new MenuFragment();
    ft.add(mFragment1,"f1");
  }
  mFragment2=fm.findFragmentByTag("f2");
  if (mFragment2 == null) {
    mFragment2=new Menu2Fragment();
    ft.add(mFragment2,"f2");
  }
  ft.commit();
  mCheckBox1=(CheckBox)findViewById(R.id.menu1);
  mCheckBox1.setOnClickListener(mClickListener);
  mCheckBox2=(CheckBox)findViewById(R.id.menu2);
  mCheckBox2.setOnClickListener(mClickListener);
  updateFragmentVisibility();
}
 

Example 82

From project Hawksword, under directory /src/com/bw/hawksword/ocr/.

Source file: WordViewActivity.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.wordview);
  wordData=((HawkswordApplication)getApplication()).wordData;
  wordText=(TextView)findViewById(R.id.textShowWord);
  bundle=getIntent().getExtras();
  lookupWord=bundle.getString("lookup");
  wordText.setText(lookupWord);
  checkHistory=(CheckBox)findViewById(R.id.checkBoxHistory);
  checkHistory.setChecked(true);
  checkHistory.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      if (checkHistory.isChecked())       wordData.insertHistory(lookupWord,new Date(),0);
 else       wordData.delete(lookupWord);
    }
  }
);
}
 

Example 83

From project ignition, under directory /ignition-support/ignition-support-samples/src/com/github/ignition/samples/support/.

Source file: IgnitedHttpSampleActivity.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.ignited_http_sample);
  statusText=(TextView)findViewById(R.id.ignitedhttp_status);
  useCache=(CheckBox)findViewById(R.id.ignitedhttp_chk_use_cache);
  useCache.setOnCheckedChangeListener(new OnCheckedChangeListener(){
    @Override public void onCheckedChanged(    CompoundButton buttonView,    boolean isChecked){
      enableCache(isChecked);
      updateCacheStatus();
    }
  }
);
  http=new IgnitedHttp(this);
  enableCache(useCache.isChecked());
}
 

Example 84

From project k-9, under directory /src/com/fsck/k9/activity/setup/.

Source file: AccountSetupOptions.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.account_setup_options);
  mCheckFrequencyView=(Spinner)findViewById(R.id.account_check_frequency);
  mDisplayCountView=(Spinner)findViewById(R.id.account_display_count);
  mNotifyView=(CheckBox)findViewById(R.id.account_notify);
  mNotifySyncView=(CheckBox)findViewById(R.id.account_notify_sync);
  mPushEnable=(CheckBox)findViewById(R.id.account_enable_push);
  findViewById(R.id.next).setOnClickListener(this);
  SpinnerOption checkFrequencies[]={new SpinnerOption(-1,getString(R.string.account_setup_options_mail_check_frequency_never)),new SpinnerOption(1,getString(R.string.account_setup_options_mail_check_frequency_1min)),new SpinnerOption(5,getString(R.string.account_setup_options_mail_check_frequency_5min)),new SpinnerOption(10,getString(R.string.account_setup_options_mail_check_frequency_10min)),new SpinnerOption(15,getString(R.string.account_setup_options_mail_check_frequency_15min)),new SpinnerOption(30,getString(R.string.account_setup_options_mail_check_frequency_30min)),new SpinnerOption(60,getString(R.string.account_setup_options_mail_check_frequency_1hour)),new SpinnerOption(120,getString(R.string.account_setup_options_mail_check_frequency_2hour)),new SpinnerOption(180,getString(R.string.account_setup_options_mail_check_frequency_3hour)),new SpinnerOption(360,getString(R.string.account_setup_options_mail_check_frequency_6hour)),new SpinnerOption(720,getString(R.string.account_setup_options_mail_check_frequency_12hour)),new SpinnerOption(1440,getString(R.string.account_setup_options_mail_check_frequency_24hour))};
  ArrayAdapter<SpinnerOption> checkFrequenciesAdapter=new ArrayAdapter<SpinnerOption>(this,android.R.layout.simple_spinner_item,checkFrequencies);
  checkFrequenciesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  mCheckFrequencyView.setAdapter(checkFrequenciesAdapter);
  SpinnerOption displayCounts[]={new SpinnerOption(10,getString(R.string.account_setup_options_mail_display_count_10)),new SpinnerOption(25,getString(R.string.account_setup_options_mail_display_count_25)),new SpinnerOption(50,getString(R.string.account_setup_options_mail_display_count_50)),new SpinnerOption(100,getString(R.string.account_setup_options_mail_display_count_100)),new SpinnerOption(250,getString(R.string.account_setup_options_mail_display_count_250)),new SpinnerOption(500,getString(R.string.account_setup_options_mail_display_count_500)),new SpinnerOption(1000,getString(R.string.account_setup_options_mail_display_count_1000))};
  ArrayAdapter<SpinnerOption> displayCountsAdapter=new ArrayAdapter<SpinnerOption>(this,android.R.layout.simple_spinner_item,displayCounts);
  displayCountsAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  mDisplayCountView.setAdapter(displayCountsAdapter);
  String accountUuid=getIntent().getStringExtra(EXTRA_ACCOUNT);
  mAccount=Preferences.getPreferences(this).getAccount(accountUuid);
  mNotifyView.setChecked(mAccount.isNotifyNewMail());
  mNotifySyncView.setChecked(mAccount.isShowOngoing());
  SpinnerOption.setSpinnerOptionValue(mCheckFrequencyView,mAccount.getAutomaticCheckIntervalMinutes());
  SpinnerOption.setSpinnerOptionValue(mDisplayCountView,mAccount.getDisplayCount());
  boolean isPushCapable=false;
  try {
    Store store=mAccount.getRemoteStore();
    isPushCapable=store.isPushCapable();
  }
 catch (  Exception e) {
    Log.e(K9.LOG_TAG,"Could not get remote store",e);
  }
  if (!isPushCapable) {
    mPushEnable.setVisibility(View.GONE);
  }
 else {
    mPushEnable.setChecked(true);
  }
}
 

Example 85

From project ListViewTipsAndTricks, under directory /src/com/cyrilmottier/android/listviewtipsandtricks/.

Source file: AccessoriesListActivity.java

  15 
vote

@Override public View getView(int position,View convertView,ViewGroup parent){
  AccessoriesViewHolder holder=null;
  if (convertView == null) {
    convertView=getLayoutInflater().inflate(R.layout.accessories_item,parent,false);
    holder=new AccessoriesViewHolder();
    holder.star=(CheckBox)convertView.findViewById(R.id.btn_star);
    holder.content=(TextView)convertView.findViewById(R.id.content);
    ((Button)convertView.findViewById(R.id.btn_buy)).setOnClickListener(mBuyButtonClickListener);
    convertView.setTag(holder);
  }
 else {
    holder=(AccessoriesViewHolder)convertView.getTag();
  }
  holder.star.setOnCheckedChangeListener(null);
  holder.star.setChecked(mStarStates[position]);
  holder.star.setOnCheckedChangeListener(mStarCheckedChanceChangeListener);
  holder.content.setText(CHEESES[position]);
  return convertView;
}
 

Example 86

From project LitHub, under directory /LitHub-Android/src/us/lithub/ui/activity/.

Source file: Settings.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_settings);
  chkBackgroundSync=(CheckBox)findViewById(R.id.chkBackgroundSync);
  chkBackgroundSync.setChecked(Util.isBackgroundSyncEnabled(this));
}
 

Example 87

From project locale-calendar-plugin, under directory /plugin/src/main/java/org/acm/steidinger/calendar/localePlugin/.

Source file: CalendarAdapter.java

  15 
vote

public View getView(int index,View view,ViewGroup viewGroup){
  CalendarEntry entry=entries.get(index);
  if (view == null) {
    LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    view=inflater.inflate(R.layout.preview_entry,null);
  }
  String date=dateFormat.format(entry.begin);
  if (!entry.allDay) {
    date+=" " + timeFormat.format(entry.begin) + " - "+ timeFormat.format(entry.end);
  }
 else {
    String endDate=dateFormat.format(entry.end);
    if (!endDate.equals(date)) {
      date+=" - " + endDate;
    }
  }
  ((TextView)view.findViewById(R.id.preview_date)).setText(date);
  ((TextView)view.findViewById(R.id.preview_title)).setText(entry.title);
  ((TextView)view.findViewById(R.id.preview_location)).setText(entry.location);
  String status;
switch (entry.status) {
case 1:
    status=context.getString(R.string.status_free);
  break;
case 0:
status=context.getString(R.string.status_busy);
break;
default :
status="" + entry.status;
}
((TextView)view.findViewById(R.id.preview_status)).setText(status);
((CheckBox)view.findViewById(R.id.preview_match)).setChecked(conditions.matches(entry));
return view;
}
 

Example 88

From project Locast-Android, under directory /src/edu/mit/mobile/android/locast/ver2/casts/.

Source file: CastDetail.java

  15 
vote

@Override public void onLoadFinished(Loader<Cursor> loader,Cursor c){
switch (loader.getId()) {
case LOADER_CAST:
    mCastsOverlay.swapCursor(c);
  if (c.moveToFirst()) {
    ((TextView)findViewById(R.id.title)).setText(c.getString(c.getColumnIndex(Cast._TITLE)));
    ((TextView)findViewById(R.id.author)).setText(c.getString(c.getColumnIndex(Cast._AUTHOR)));
    ((TextView)findViewById(R.id.description)).setText(c.getString(c.getColumnIndex(Cast._DESCRIPTION)));
    ((CheckBox)findViewById(R.id.favorite)).setChecked(c.getInt(c.getColumnIndex(Cast._FAVORITED)) != 0);
    setPointerFromCursor(c);
  }
break;
case LOADER_CAST_MEDIA:
mCastMedia.swapCursor(c);
if (mFirstLoad && c.getCount() == 0) {
LocastSyncService.startExpeditedAutomaticSync(this,mCastMediaUri);
}
mFirstLoad=false;
break;
}
}
 

Example 89

From project maven-android-plugin-samples, under directory /support4demos/src/com/example/android/supportv4/app/.

Source file: FragmentMenuSupport.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.fragment_menu);
  FragmentManager fm=getSupportFragmentManager();
  FragmentTransaction ft=fm.beginTransaction();
  mFragment1=fm.findFragmentByTag("f1");
  if (mFragment1 == null) {
    mFragment1=new MenuFragment();
    ft.add(mFragment1,"f1");
  }
  mFragment2=fm.findFragmentByTag("f2");
  if (mFragment2 == null) {
    mFragment2=new Menu2Fragment();
    ft.add(mFragment2,"f2");
  }
  ft.commit();
  mCheckBox1=(CheckBox)findViewById(R.id.menu1);
  mCheckBox1.setOnClickListener(mClickListener);
  mCheckBox2=(CheckBox)findViewById(R.id.menu2);
  mCheckBox2.setOnClickListener(mClickListener);
  updateFragmentVisibility();
}
 

Example 90

From project MIT-Mobile-for-Android, under directory /src/edu/mit/mitmobile2/libraries/.

Source file: LibraryLoans.java

  15 
vote

@Override public void updateView(LoanListItem item,View view){
  Log.d(TAG,"update view " + item.getIndex());
  loanTitleTV=(TextView)view.findViewById(R.id.loanTitleTV);
  if (!item.getTitle().equalsIgnoreCase("")) {
    loanTitleTV.setText(item.getTitle());
  }
 else {
    loanTitleTV.setVisibility(View.GONE);
  }
  loanAuthorTV=(TextView)view.findViewById(R.id.loanAuthorTV);
  if (!item.getAuthor().equalsIgnoreCase("") || !item.getYear().equalsIgnoreCase("")) {
    loanAuthorTV.setText(item.getYear() + "; " + item.getAuthor());
  }
 else {
    loanAuthorTV.setVisibility(View.GONE);
  }
  loanStatusTV=(TextView)view.findViewById(R.id.loanStatusTV);
  loanStatusTV.setText(Html.fromHtml(item.getDueText()));
  if (item.isOverdue() || item.isLongOverdue()) {
    loanStatusTV.setTextColor(Color.RED);
  }
 else {
    loanStatusTV.setTextColor(R.color.contents_text);
  }
  cb=(CheckBox)view.findViewById(R.id.renewBookCheckbox);
  cb.setTag(item.getIndex());
  if (((LoanListItem)loanData.getLoans().get(item.getIndex())).isRenewBook()) {
    cb.setChecked(true);
  }
 else {
    cb.setChecked(false);
  }
  Log.d(TAG,"update view - loan mode = " + LibraryLoans.getMode());
  if (LibraryLoans.getMode() == LibraryLoans.RENEW_MODE) {
    cb.setVisibility(View.VISIBLE);
  }
 else {
    cb.setVisibility(View.GONE);
  }
}
 

Example 91

From project mWater-Android-App, under directory /android/src/co/mwater/clientapp/ui/.

Source file: ChlorineRecordActivity.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.chlorine_results_activity);
  presentBox=(CheckBox)findViewById(R.id.present);
  mgPerLSpinner=(Spinner)findViewById(R.id.mgPerLSpinner);
  mgPerLCustom=(TextView)findViewById(R.id.mgPerLCustom);
  presentBox.setOnCheckedChangeListener(new OnCheckedChangeListener(){
    public void onCheckedChanged(    CompoundButton buttonView,    boolean isChecked){
      mgPerLSpinner.setVisibility(isChecked ? TextView.VISIBLE : TextView.INVISIBLE);
      mgPerLCustom.setVisibility(isChecked && mgPerLSpinner.getSelectedItemPosition() == 6 ? TextView.VISIBLE : TextView.INVISIBLE);
      findViewById(R.id.concentration_label).setVisibility(isChecked ? TextView.VISIBLE : TextView.INVISIBLE);
    }
  }
);
  mgPerLSpinner.setOnItemSelectedListener(new OnItemSelectedListener(){
    public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      updateCustomField();
    }
    public void onNothingSelected(    AdapterView<?> parent){
      updateCustomField();
    }
  }
);
}
 

Example 92

From project nantes-mobi-parkings, under directory /android/src/main/java/fr/ippon/android/opendata/android/.

Source file: ParkingCursorAdapter.java

  15 
vote

/** 
 * {@inheritDoc}
 */
@Override public View newView(final Context context,final Cursor cursor,final ViewGroup parent){
  final LayoutInflater inflater=LayoutInflater.from(context);
  View view=inflater.inflate(R.layout.item_parking,parent,false);
  ParkingViewHolder holder=new ParkingViewHolder();
  holder.star=(CheckBox)view.findViewById(R.id.btn_star);
  holder.star.setOnCheckedChangeListener(starChangeListener);
  holder.star.setTag(holder);
  holder.name=(TextView)view.findViewById(R.id.parking_name);
  holder.places=(TextView)view.findViewById(R.id.parking_places);
  holder.distance=(TextView)view.findViewById(R.id.parking_distance);
  holder.item=view.findViewById(R.id.item_info);
  holder.item.setOnClickListener(toMapClickListener);
  holder.item.setTag(holder);
  view.setTag(holder);
  return view;
}
 

Example 93

From project NFCShopping, under directory /nfc updater client/NFCUpdater/src/scut/bgooo/updater/ui/.

Source file: NFCWriterActivity.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.writer);
  mAdapter=NfcAdapter.getDefaultAdapter(this);
  Intent intent=getIntent();
  barCode=intent.getStringExtra("Barcode");
  barCodeType=intent.getStringExtra("Type");
  mPendingIntent=PendingIntent.getActivity(this,0,new Intent(this,getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP),0);
  IntentFilter ndef=new IntentFilter(NfcAdapter.ACTION_TECH_DISCOVERED);
  try {
    ndef.addDataType("*/*");
  }
 catch (  MalformedMimeTypeException e) {
    throw new RuntimeException("fail",e);
  }
  mFilters=new IntentFilter[]{ndef};
  mTechLists=new String[][]{new String[]{MifareClassic.class.getName()}};
  btCommit=(Button)findViewById(R.id.btCommit);
  btCancel=(Button)findViewById(R.id.btCancel);
  tvTitle=(TextView)findViewById(R.id.tvTitle);
  tvBarcode=(TextView)findViewById(R.id.tvBarcode);
  tvBarcode.setText(barCode);
  tvType=(TextView)findViewById(R.id.tvType);
  tvType.setText(barCodeType);
  cbIsConnecting=(CheckBox)findViewById(R.id.cbIsConnecting);
  cbIsConnecting.setClickable(false);
  btCommit.setOnClickListener(onclickListener);
  Log.d(TAG,"Create");
  checkRunnable=new RunCheck(this);
}
 

Example 94

From project NotePad, under directory /NotePad/src/org/openintents/notepad/dialog/.

Source file: ThemeDialog.java

  15 
vote

private void init(){
  setInverseBackgroundForced(true);
  LayoutInflater inflate=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  inflate=inflate.cloneInContext(new ContextThemeWrapper(mContext,android.R.style.Theme_Light));
  final View view=inflate.inflate(R.layout.dialog_theme_settings,null);
  setView(view);
  mListView=(ListView)view.findViewById(R.id.list1);
  mListView.setCacheColorHint(0);
  mListView.setItemsCanFocus(false);
  mListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
  Button b=new Button(mContext);
  b.setText(R.string.get_more_themes);
  b.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      Intent i=new Intent(mContext,PreferenceActivity.class);
      i.putExtra(PreferenceActivity.EXTRA_SHOW_GET_ADD_ONS,true);
      mContext.startActivity(i);
      pressCancel();
      dismiss();
    }
  }
);
  LinearLayout ll=new LinearLayout(mContext);
  LayoutParams lp=new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
  ll.setPadding(20,10,20,10);
  ll.addView(b,lp);
  ll.setGravity(Gravity.CENTER);
  mListView.addFooterView(ll);
  mCheckBox=(CheckBox)view.findViewById(R.id.check1);
  setTitle(R.string.theme_pick);
  setButton(Dialog.BUTTON_POSITIVE,mContext.getText(R.string.ok),this);
  setButton(Dialog.BUTTON_NEGATIVE,mContext.getText(R.string.cancel),this);
  setOnCancelListener(this);
  prepareDialog();
}
 

Example 95

From project onebusaway-android, under directory /src/com/joulespersecond/seattlebusbot/.

Source file: ReportTripProblemFragment.java

  15 
vote

@Override public void onViewCreated(View view,Bundle savedInstanceState){
  Bundle args=getArguments();
  final TextView tripName=(TextView)view.findViewById(R.id.trip_name);
  tripName.setText(MyTextUtils.toTitleCase(args.getString(TRIP_NAME)));
  final int tripArray=R.array.report_trip_problem_code_bus;
  mCodeView=(Spinner)view.findViewById(R.id.report_problem_code);
  ArrayAdapter<?> adapter=ArrayAdapter.createFromResource(getActivity(),tripArray,android.R.layout.simple_spinner_item);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  mCodeView.setAdapter(adapter);
  mUserComment=(TextView)view.findViewById(R.id.report_problem_comment);
  mUserOnVehicle=(CheckBox)view.findViewById(R.id.report_problem_onvehicle);
  final View label=view.findViewById(R.id.report_problem_uservehicle_label);
  mUserVehicle=(TextView)view.findViewById(R.id.report_problem_uservehicle);
  label.setEnabled(false);
  mUserVehicle.setEnabled(false);
  mUserOnVehicle.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      boolean checked=mUserOnVehicle.isChecked();
      label.setEnabled(checked);
      mUserVehicle.setEnabled(checked);
    }
  }
);
  if (savedInstanceState != null) {
    int position=savedInstanceState.getInt(CODE);
    mCodeView.setSelection(position);
    CharSequence comment=savedInstanceState.getCharSequence(USER_COMMENT);
    mUserComment.setText(comment);
    boolean onVehicle=savedInstanceState.getBoolean(USER_ON_VEHICLE);
    mUserOnVehicle.setChecked(onVehicle);
    CharSequence num=savedInstanceState.getCharSequence(USER_VEHICLE_NUM);
    mUserVehicle.setText(num);
    mUserVehicle.setEnabled(onVehicle);
  }
}
 

Example 96

From project OpenBike, under directory /src/fr/openbike/android/ui/.

Source file: StationDetails.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.station_details_layout);
  mActivityHelper=new ActivityHelper(this);
  mActivityHelper.setupActionBar(getString(R.string.station_details));
  mSharedPreferences=PreferenceManager.getDefaultSharedPreferences(this);
  mName=(TextView)findViewById(R.id.name);
  mFavorite=(CheckBox)findViewById(R.id.favorite);
  mDistance=(TextView)findViewById(R.id.distance);
  mCreditCard=(TextView)findViewById(R.id.cc);
  mSpecial=(TextView)findViewById(R.id.special);
  mAddress=(TextView)findViewById(R.id.address);
  mNavigate=(Button)findViewById(R.id.navigate);
  mGoogleMaps=(Button)findViewById(R.id.show_google_maps);
  mShowMap=(Button)findViewById(R.id.show_map);
  mGoogleMaps.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View arg0){
      startMaps();
    }
  }
);
  mNavigate.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View arg0){
      startNavigation();
    }
  }
);
  mShowMap.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View arg0){
      showOnMap(mStation.getString(mStation.getColumnIndex(BaseColumns._ID)));
    }
  }
);
}
 

Example 97

From project OpenComm, under directory /sipvoip/src/org/hsc/sip/ua/config/ui/.

Source file: ProxyRegistration.java

  15 
vote

@Override protected void onCreate(Bundle icicle){
  super.onCreate(icicle);
  this.setContentView(R.layout.proxy_registration);
  background_image_view=(ImageView)findViewById(R.id.background_image);
  if (background_image_view != null) {
    background_image_view.setImageResource(R.drawable.options_backend);
  }
  m_DomainOrRealm=(EditText)findViewById(R.id.txt_nw_opts_domain_realm);
  m_UseOutboundProxy=(CheckBox)findViewById(R.id.chk_nw_opts_use_proxy);
  m_ProxyHost=(EditText)findViewById(R.id.txt_nw_opts_proxy_address);
  m_RegisterOnStart=(CheckBox)findViewById(R.id.chk_nw_opts_reg_on_start);
  m_SuggExpiryTime=(EditText)findViewById(R.id.txt_nw_opts_sugg_exp_time);
  m_Registrar=(EditText)findViewById(R.id.txt_nw_opts_registrar);
  Intent intent=this.getIntent();
  String lDomain=intent.getStringExtra("Domain");
  if (lDomain.contains(":-1")) {
    lDomain=lDomain.substring(0,lDomain.indexOf(":-1"));
  }
 else   if (lDomain.contains(":0")) {
    lDomain=lDomain.substring(0,lDomain.indexOf(":0"));
  }
  m_DomainOrRealm.setText(lDomain);
  m_UseOutboundProxy.setChecked((intent.getBooleanExtra("UseOutboundProxy",true)));
  String proxy=intent.getStringExtra("ProxyHost");
  if (intent.getIntExtra("ProxyPort",0) > 0) {
    proxy+=(":" + intent.getIntExtra("ProxyPort",0));
  }
  m_ProxyHost.setText(proxy);
  m_RegisterOnStart.setChecked((intent.getBooleanExtra("RegisterOnStart",true)));
  short lSuggestedExpiryTime=intent.getShortExtra("SuggestedExpTime",(short)0);
  if (lSuggestedExpiryTime < 0) {
    lSuggestedExpiryTime=3600;
  }
  m_SuggExpiryTime.setText(Short.toString(lSuggestedExpiryTime));
  String registrar=intent.getStringExtra("RegistrarHost");
  if (intent.getIntExtra("RegistrarPort",0) > 0) {
    registrar+=(":" + intent.getIntExtra("RegistrarPort",0));
  }
  m_Registrar.setText(registrar);
}
 

Example 98

From project OpenComm_andr, under directory /sipvoip/src/org/hsc/sip/ua/config/ui/.

Source file: ProxyRegistration.java

  15 
vote

@Override protected void onCreate(Bundle icicle){
  super.onCreate(icicle);
  this.setContentView(R.layout.proxy_registration);
  background_image_view=(ImageView)findViewById(R.id.background_image);
  if (background_image_view != null) {
    background_image_view.setImageResource(R.drawable.options_backend);
  }
  m_DomainOrRealm=(EditText)findViewById(R.id.txt_nw_opts_domain_realm);
  m_UseOutboundProxy=(CheckBox)findViewById(R.id.chk_nw_opts_use_proxy);
  m_ProxyHost=(EditText)findViewById(R.id.txt_nw_opts_proxy_address);
  m_RegisterOnStart=(CheckBox)findViewById(R.id.chk_nw_opts_reg_on_start);
  m_SuggExpiryTime=(EditText)findViewById(R.id.txt_nw_opts_sugg_exp_time);
  m_Registrar=(EditText)findViewById(R.id.txt_nw_opts_registrar);
  Intent intent=this.getIntent();
  String lDomain=intent.getStringExtra("Domain");
  if (lDomain.contains(":-1")) {
    lDomain=lDomain.substring(0,lDomain.indexOf(":-1"));
  }
 else   if (lDomain.contains(":0")) {
    lDomain=lDomain.substring(0,lDomain.indexOf(":0"));
  }
  m_DomainOrRealm.setText(lDomain);
  m_UseOutboundProxy.setChecked((intent.getBooleanExtra("UseOutboundProxy",true)));
  String proxy=intent.getStringExtra("ProxyHost");
  if (intent.getIntExtra("ProxyPort",0) > 0) {
    proxy+=(":" + intent.getIntExtra("ProxyPort",0));
  }
  m_ProxyHost.setText(proxy);
  m_RegisterOnStart.setChecked((intent.getBooleanExtra("RegisterOnStart",true)));
  short lSuggestedExpiryTime=intent.getShortExtra("SuggestedExpTime",(short)0);
  if (lSuggestedExpiryTime < 0) {
    lSuggestedExpiryTime=3600;
  }
  m_SuggExpiryTime.setText(Short.toString(lSuggestedExpiryTime));
  String registrar=intent.getStringExtra("RegistrarHost");
  if (intent.getIntExtra("RegistrarPort",0) > 0) {
    registrar+=(":" + intent.getIntExtra("RegistrarPort",0));
  }
  m_Registrar.setText(registrar);
}
 

Example 99

From project platform_packages_apps_browser, under directory /src/com/android/browser/.

Source file: GeolocationPermissionsPrompt.java

  15 
vote

private void init(){
  mMessage=(TextView)findViewById(R.id.message);
  mShareButton=(Button)findViewById(R.id.share_button);
  mDontShareButton=(Button)findViewById(R.id.dont_share_button);
  mRemember=(CheckBox)findViewById(R.id.remember);
  mShareButton.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      handleButtonClick(true);
    }
  }
);
  mDontShareButton.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      handleButtonClick(false);
    }
  }
);
}