Search in sources :

Example 1 with CheckedTextView

use of android.widget.CheckedTextView in project xLog by elvishew.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    tagView = (TextView) findViewById(R.id.tag);
    tagView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            showChangeTagDialog();
        }
    });
    levelView = (Spinner) findViewById(R.id.level);
    threadInfo = (CheckedTextView) findViewById(R.id.thread_info);
    threadInfo.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            threadInfo.toggle();
        }
    });
    stackTraceInfo = (CheckedTextView) findViewById(R.id.stack_trace_info);
    stackTraceInfo.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            stackTraceInfo.toggle();
            setEnabledStateOnViews(stackTraceDepthContainer, stackTraceInfo.isChecked());
        }
    });
    stackTraceDepthContainer = findViewById(R.id.stack_trace_depth_container);
    setEnabledStateOnViews(stackTraceDepthContainer, false);
    stackTraceDepth = (Spinner) stackTraceDepthContainer.findViewById(R.id.stack_trace_depth);
    border = (CheckedTextView) findViewById(R.id.border);
    border.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            border.toggle();
        }
    });
    // Setup print button.
    findViewById(R.id.print).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            printLog();
        }
    });
    // Setup view printer.
    RecyclerView logContainer = (RecyclerView) findViewById(R.id.log_container);
    viewPrinter = new RecyclerViewPrinter(logContainer);
    // Print welcome message.
    XLog.printers(viewPrinter).i("XLog is ready.\nPrint your log now!");
    // Check permission.
    hasPermission = hasPermission();
    if (!hasPermission) {
        if (shouldShowRequestPermissionRationale()) {
            showPermissionRequestDialog(false);
        } else {
            requestPermission();
        }
    }
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) CheckedTextView(android.widget.CheckedTextView) Toolbar(android.support.v7.widget.Toolbar)

Example 2 with CheckedTextView

use of android.widget.CheckedTextView in project MyDiary by erttyy8821.

the class ReleaseNoteDialogFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    this.getDialog().setCanceledOnTouchOutside(false);
    View rootView = inflater.inflate(R.layout.dialog_fragment_release_note, container);
    RL_release_note = (RelativeLayout) rootView.findViewById(R.id.RL_release_note);
    RL_release_note.setBackgroundColor(ThemeManager.getInstance().getThemeMainColor(getActivity()));
    TV_release_note_text = (TextView) rootView.findViewById(R.id.TV_release_note_text);
    TV_release_note_text.setText(getString(R.string.release_note));
    CTV_release_note_knew = (CheckedTextView) rootView.findViewById(R.id.CTV_release_note_knew);
    CTV_release_note_knew.setOnClickListener(this);
    But_release_note_ok = (MyDiaryButton) rootView.findViewById(R.id.But_release_note_ok);
    But_release_note_ok.setOnClickListener(this);
    return rootView;
}
Also used : TextView(android.widget.TextView) CheckedTextView(android.widget.CheckedTextView) View(android.view.View)

Example 3 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 4 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 5 with CheckedTextView

use of android.widget.CheckedTextView in project ExoPlayer by google.

the class TrackSelectionHelper method buildView.

@SuppressLint("InflateParams")
private View buildView(Context context) {
    LayoutInflater inflater = LayoutInflater.from(context);
    View view = inflater.inflate(R.layout.track_selection_dialog, null);
    ViewGroup root = (ViewGroup) view.findViewById(R.id.root);
    TypedArray attributeArray = context.getTheme().obtainStyledAttributes(new int[] { android.R.attr.selectableItemBackground });
    int selectableItemBackgroundResourceId = attributeArray.getResourceId(0, 0);
    attributeArray.recycle();
    // View for disabling the renderer.
    disableView = (CheckedTextView) inflater.inflate(android.R.layout.simple_list_item_single_choice, root, false);
    disableView.setBackgroundResource(selectableItemBackgroundResourceId);
    disableView.setText(R.string.selection_disabled);
    disableView.setFocusable(true);
    disableView.setOnClickListener(this);
    root.addView(disableView);
    // View for clearing the override to allow the selector to use its default selection logic.
    defaultView = (CheckedTextView) inflater.inflate(android.R.layout.simple_list_item_single_choice, root, false);
    defaultView.setBackgroundResource(selectableItemBackgroundResourceId);
    defaultView.setText(R.string.selection_default);
    defaultView.setFocusable(true);
    defaultView.setOnClickListener(this);
    root.addView(inflater.inflate(R.layout.list_divider, root, false));
    root.addView(defaultView);
    // Per-track views.
    boolean haveSupportedTracks = false;
    boolean haveAdaptiveTracks = false;
    trackViews = new CheckedTextView[trackGroups.length][];
    for (int groupIndex = 0; groupIndex < trackGroups.length; groupIndex++) {
        TrackGroup group = trackGroups.get(groupIndex);
        boolean groupIsAdaptive = trackGroupsAdaptive[groupIndex];
        haveAdaptiveTracks |= groupIsAdaptive;
        trackViews[groupIndex] = new CheckedTextView[group.length];
        for (int trackIndex = 0; trackIndex < group.length; trackIndex++) {
            if (trackIndex == 0) {
                root.addView(inflater.inflate(R.layout.list_divider, root, false));
            }
            int trackViewLayoutId = groupIsAdaptive ? android.R.layout.simple_list_item_multiple_choice : android.R.layout.simple_list_item_single_choice;
            CheckedTextView trackView = (CheckedTextView) inflater.inflate(trackViewLayoutId, root, false);
            trackView.setBackgroundResource(selectableItemBackgroundResourceId);
            trackView.setText(buildTrackName(group.getFormat(trackIndex)));
            if (trackInfo.getTrackFormatSupport(rendererIndex, groupIndex, trackIndex) == RendererCapabilities.FORMAT_HANDLED) {
                trackView.setFocusable(true);
                trackView.setTag(Pair.create(groupIndex, trackIndex));
                trackView.setOnClickListener(this);
                haveSupportedTracks = true;
            } else {
                trackView.setFocusable(false);
                trackView.setEnabled(false);
            }
            trackViews[groupIndex][trackIndex] = trackView;
            root.addView(trackView);
        }
    }
    if (!haveSupportedTracks) {
        // Indicate that the default selection will be nothing.
        defaultView.setText(R.string.selection_default_none);
    } else if (haveAdaptiveTracks) {
        // View for using random adaptation.
        enableRandomAdaptationView = (CheckedTextView) inflater.inflate(android.R.layout.simple_list_item_multiple_choice, root, false);
        enableRandomAdaptationView.setBackgroundResource(selectableItemBackgroundResourceId);
        enableRandomAdaptationView.setText(R.string.enable_random_adaptation);
        enableRandomAdaptationView.setOnClickListener(this);
        root.addView(inflater.inflate(R.layout.list_divider, root, false));
        root.addView(enableRandomAdaptationView);
    }
    updateViews();
    return view;
}
Also used : ViewGroup(android.view.ViewGroup) TrackGroup(com.google.android.exoplayer2.source.TrackGroup) CheckedTextView(android.widget.CheckedTextView) LayoutInflater(android.view.LayoutInflater) TypedArray(android.content.res.TypedArray) View(android.view.View) CheckedTextView(android.widget.CheckedTextView) SuppressLint(android.annotation.SuppressLint) SuppressLint(android.annotation.SuppressLint)

Aggregations

CheckedTextView (android.widget.CheckedTextView)24 View (android.view.View)16 TextView (android.widget.TextView)9 ListView (android.widget.ListView)6 AdapterView (android.widget.AdapterView)5 LayoutInflater (android.view.LayoutInflater)4 ArrayAdapter (android.widget.ArrayAdapter)3 SuppressLint (android.annotation.SuppressLint)2 Context (android.content.Context)2 DialogInterface (android.content.DialogInterface)2 TypedArray (android.content.res.TypedArray)2 Button (android.widget.Button)2 ImageView (android.widget.ImageView)2 GraphView (com.jjoe64.graphview.GraphView)2 Account (android.accounts.Account)1 Intent (android.content.Intent)1 ColorStateList (android.content.res.ColorStateList)1 Resources (android.content.res.Resources)1 Nullable (android.support.annotation.Nullable)1 RecyclerView (android.support.v7.widget.RecyclerView)1