use of android.widget.CheckedTextView in project PushSms by koush.
the class MyActivity method onCreate.
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
accounts = getSharedPreferences("accounts", MODE_PRIVATE);
settings = getSharedPreferences("settings", MODE_PRIVATE);
ListView lv = (ListView) findViewById(R.id.list);
View header = getLayoutInflater().inflate(R.layout.header, null);
lv.addHeaderView(header);
lv.setAdapter(accountAdapter = new AccountAdapter());
final Switch toggle = (Switch) header.findViewById(R.id.toggle);
toggle.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
settings.edit().putBoolean("enabled", toggle.isChecked()).commit();
}
});
toggle.setChecked(settings.getBoolean("enabled", true));
final Button phoneNumber = (Button) header.findViewById(R.id.phone_number);
phoneNumber.setText(getNumber());
phoneNumber.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final EditText input = new EditText(MyActivity.this);
new AlertDialog.Builder(MyActivity.this).setTitle(R.string.phone_number).setView(input).setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
settings.edit().putString("phone_number", input.getText().toString()).commit();
phoneNumber.setText(getNumber());
}
}).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
// Do nothing.
}
}).show();
}
});
for (Account account : AccountManager.get(this).getAccountsByType("com.google")) {
accountAdapter.add(account);
}
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
CheckedTextView tv = (CheckedTextView) view.findViewById(android.R.id.text1);
Account account = accountAdapter.getItem((int) id);
if (tv.isChecked()) {
accounts.edit().putBoolean(account.name, false).commit();
tv.toggle();
reregister();
return;
}
login(account.name);
}
});
startService(new Intent(this, MiddlewareService.class));
Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread() {
@Override
public void run() {
try {
GoogleCloudMessaging.getInstance(MyActivity.this).unregister();
} catch (Exception e) {
}
}
}.start();
}
});
}
use of android.widget.CheckedTextView in project GT by Tencent.
the class LogFileAdapter method getView.
@Override
public View getView(int position, View view, ViewGroup parent) {
Context context = parent.getContext();
if (view == null) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(resId, parent, false);
}
CheckedTextView text1 = (CheckedTextView) view.findViewById(android.R.id.text1);
TextView text2 = (TextView) view.findViewById(android.R.id.text2);
CharSequence filename = objects.get(position);
text1.setText(filename);
if (multiMode) {
text1.setChecked(checkedItems[position]);
} else {
text1.setChecked(checked == position);
}
Date lastModified = SaveLogHelper.getLastModifiedDate(filename.toString());
text2.setText(GTUtils.getGpsSaveTime(lastModified));
return view;
}
use of android.widget.CheckedTextView in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ColorPickerFragment method setUpHelpScreen.
private void setUpHelpScreen() {
mShowHelpScreen = getShowHelpScreen();
mCheckShowHelpScreen = (CheckedTextView) mColorPickerView.findViewById(R.id.color_picker_check_show_help_screen);
mCheckShowHelpScreen.setChecked(!mShowHelpScreen);
mCheckShowHelpScreen.setOnClickListener(this);
mCloseHelpScreen = (Button) mColorPickerView.findViewById(R.id.color_picker_help_button_ok);
mCloseHelpScreen.setOnClickListener(this);
mHelpScreen.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
mHelpScreenHeight = mHelpScreen.getHeight();
mHelpScreen.getViewTreeObserver().removeOnGlobalLayoutListener(this);
if (!mHelpScreenVisible) {
mHelpScreen.setTranslationY(mFavoritesLayoutHeight);
mHelpScreen.setAlpha(0f);
mHelpScreen.setVisibility(View.GONE);
}
}
});
mHelpScreen.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return true;
}
});
}
use of android.widget.CheckedTextView in project nucleus by konmik.
the class MainActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
check1 = (CheckedTextView) findViewById(R.id.check1);
check2 = (CheckedTextView) findViewById(R.id.check2);
check1.setText(MainPresenter.NAME_1);
check2.setText(MainPresenter.NAME_2);
check1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getPresenter().request(MainPresenter.NAME_1);
}
});
check2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getPresenter().request(MainPresenter.NAME_2);
}
});
ListView listView = (ListView) findViewById(R.id.listView);
listView.setAdapter(adapter = new ArrayAdapter<>(this, R.layout.item));
if (savedInstanceState == null)
getPresenter().request(MainPresenter.DEFAULT_NAME);
}
use of android.widget.CheckedTextView in project UltimateAndroid by cymcsg.
the class AnimateDismissActivity method onCreate.
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.list_anim_activity_animateremoval);
mSelectedPositions = new ArrayList<Integer>();
ListView listView = (ListView) findViewById(R.id.activity_animateremoval_listview);
mAdapter = new MyListAdapter(ListAnimationListActivity.getItems());
final AnimateDismissAdapter animateDismissAdapter = new AnimateDismissAdapter(mAdapter, new MyOnDismissCallback());
animateDismissAdapter.setAbsListView(listView);
listView.setAdapter(animateDismissAdapter);
Button button = (Button) findViewById(R.id.activity_animateremoval_button);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(final View v) {
animateDismissAdapter.animateDismiss(mSelectedPositions);
mSelectedPositions.clear();
}
});
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(final AdapterView<?> parent, final View view, final int position, final long id) {
CheckedTextView tv = (CheckedTextView) view;
tv.toggle();
if (tv.isChecked()) {
mSelectedPositions.add(position);
} else {
mSelectedPositions.remove((Integer) position);
}
}
});
}
Aggregations