Search in sources :

Example 6 with CheckedTextView

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();
        }
    });
}
Also used : EditText(android.widget.EditText) Account(android.accounts.Account) DialogInterface(android.content.DialogInterface) CheckedTextView(android.widget.CheckedTextView) Intent(android.content.Intent) View(android.view.View) AdapterView(android.widget.AdapterView) CheckedTextView(android.widget.CheckedTextView) ListView(android.widget.ListView) GoogleAuthException(com.google.android.gms.auth.GoogleAuthException) UserRecoverableAuthException(com.google.android.gms.auth.UserRecoverableAuthException) GooglePlayServicesAvailabilityException(com.google.android.gms.auth.GooglePlayServicesAvailabilityException) IOException(java.io.IOException) ListView(android.widget.ListView) Switch(android.widget.Switch) Button(android.widget.Button) AdapterView(android.widget.AdapterView)

Example 7 with CheckedTextView

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;
}
Also used : Context(android.content.Context) CheckedTextView(android.widget.CheckedTextView) LayoutInflater(android.view.LayoutInflater) TextView(android.widget.TextView) CheckedTextView(android.widget.CheckedTextView) Date(java.util.Date)

Example 8 with CheckedTextView

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;
        }
    });
}
Also used : OnGlobalLayoutListener(android.view.ViewTreeObserver.OnGlobalLayoutListener) ColorPickerView(net.margaritov.preference.colorpicker.widget.ColorPickerView) View(android.view.View) ApplyColorView(net.margaritov.preference.colorpicker.widget.ApplyColorView) TextView(android.widget.TextView) CheckedTextView(android.widget.CheckedTextView) MotionEvent(android.view.MotionEvent)

Example 9 with CheckedTextView

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);
}
Also used : ListView(android.widget.ListView) CheckedTextView(android.widget.CheckedTextView) View(android.view.View) ListView(android.widget.ListView) ArrayAdapter(android.widget.ArrayAdapter)

Example 10 with CheckedTextView

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);
            }
        }
    });
}
Also used : AnimateDismissAdapter(com.marshalchen.common.uimodule.listviewanimations.itemmanipulation.AnimateDismissAdapter) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) CheckedTextView(android.widget.CheckedTextView) AbsListView(android.widget.AbsListView) CheckedTextView(android.widget.CheckedTextView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) AbsListView(android.widget.AbsListView) ListView(android.widget.ListView) Button(android.widget.Button) OnClickListener(android.view.View.OnClickListener)

Aggregations

CheckedTextView (android.widget.CheckedTextView)26 View (android.view.View)17 TextView (android.widget.TextView)9 ListView (android.widget.ListView)6 AdapterView (android.widget.AdapterView)5 SuppressLint (android.annotation.SuppressLint)4 LayoutInflater (android.view.LayoutInflater)4 ArrayAdapter (android.widget.ArrayAdapter)3 Context (android.content.Context)2 DialogInterface (android.content.DialogInterface)2 TypedArray (android.content.res.TypedArray)2 Pair (android.util.Pair)2 ViewGroup (android.view.ViewGroup)2 Button (android.widget.Button)2 ImageView (android.widget.ImageView)2 TrackGroup (com.google.android.exoplayer2.source.TrackGroup)2 SelectionOverride (com.google.android.exoplayer2.trackselection.MappingTrackSelector.SelectionOverride)2 GraphView (com.jjoe64.graphview.GraphView)2 Account (android.accounts.Account)1 Intent (android.content.Intent)1