Search in sources :

Example 1 with TableLayout

use of android.widget.TableLayout in project mounts2sd by SpazeDog.

the class FragmentTabLog method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup view = (ViewGroup) inflater.inflate(R.layout.fragment_tab_log, container, false);
    TableLayout table = (TableLayout) view.findViewById(R.id.log_table);
    if (oLogEntry == null) {
        RootFW rootfw = Root.initiate();
        FileData data = rootfw.file(getResources().getString(R.string.config_dir_tmp) + "/log.txt").read();
        if (data == null) {
            data = rootfw.file("/data/m2sd.fallback.log").read();
            if (data != null) {
                oLogEntry = data.getArray();
            }
        } else {
            oLogEntry = data.getArray();
        }
        if (oLogEntry == null || oLogEntry.length == 0) {
            oLogEntry = new String[] { "I/" + getResources().getString(R.string.log_empty) };
        }
        Root.release();
    }
    Boolean bool = false;
    Integer color1 = getResources().getColor(resolveAttr(R.attr.colorRef_logItemBackgroundFirst));
    Integer color2 = getResources().getColor(resolveAttr(R.attr.colorRef_logItemBackgroundSecond));
    for (int i = 0; i < oLogEntry.length; i++) {
        TableRow row = (TableRow) inflater.inflate(R.layout.inflate_log_item, table, false);
        String[] parts = oLogEntry[i].split("/", 2);
        ((TextView) row.getChildAt(0)).setText(parts.length > 1 ? parts[0] : "?");
        ((TextView) row.getChildAt(1)).setText(parts.length > 1 ? parts[1] : parts[0]);
        if ((bool = !bool)) {
            row.setBackgroundColor(color1);
        } else {
            row.setBackgroundColor(color2);
        }
        table.addView(row);
    }
    return (View) view;
}
Also used : ViewGroup(android.view.ViewGroup) TableRow(android.widget.TableRow) TextView(android.widget.TextView) TableLayout(android.widget.TableLayout) FileData(com.spazedog.lib.rootfw3.extenders.FileExtender.FileData) View(android.view.View) TextView(android.widget.TextView) RootFW(com.spazedog.lib.rootfw3.RootFW)

Example 2 with TableLayout

use of android.widget.TableLayout in project android_frameworks_base by ParanoidAndroid.

the class AddColumn method onCreate.

@Override
protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.add_column_in_table);
    final Button addRowButton = (Button) findViewById(R.id.add_row_button);
    addRowButton.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            final TableLayout table = (TableLayout) findViewById(R.id.table);
            final TableRow newRow = new TableRow(AddColumn.this);
            for (int i = 0; i < 4; i++) {
                final TextView view = new TextView(AddColumn.this);
                view.setText("Column " + (i + 1));
                view.setPadding(3, 3, 3, 3);
                newRow.addView(view, new TableRow.LayoutParams());
            }
            table.addView(newRow, new TableLayout.LayoutParams());
            newRow.requestLayout();
        }
    });
}
Also used : Button(android.widget.Button) TableRow(android.widget.TableRow) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View) TableLayout(android.widget.TableLayout)

Example 3 with TableLayout

use of android.widget.TableLayout in project android_frameworks_base by ResurrectionRemix.

the class AddColumn method onCreate.

@Override
protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.add_column_in_table);
    final Button addRowButton = (Button) findViewById(R.id.add_row_button);
    addRowButton.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            final TableLayout table = (TableLayout) findViewById(R.id.table);
            final TableRow newRow = new TableRow(AddColumn.this);
            for (int i = 0; i < 4; i++) {
                final TextView view = new TextView(AddColumn.this);
                view.setText("Column " + (i + 1));
                view.setPadding(3, 3, 3, 3);
                newRow.addView(view, new TableRow.LayoutParams());
            }
            table.addView(newRow, new TableLayout.LayoutParams());
            newRow.requestLayout();
        }
    });
}
Also used : Button(android.widget.Button) TableRow(android.widget.TableRow) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View) TableLayout(android.widget.TableLayout)

Example 4 with TableLayout

use of android.widget.TableLayout in project android_frameworks_base by DirtyUnicorns.

the class AddColumn method onCreate.

@Override
protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.add_column_in_table);
    final Button addRowButton = (Button) findViewById(R.id.add_row_button);
    addRowButton.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            final TableLayout table = (TableLayout) findViewById(R.id.table);
            final TableRow newRow = new TableRow(AddColumn.this);
            for (int i = 0; i < 4; i++) {
                final TextView view = new TextView(AddColumn.this);
                view.setText("Column " + (i + 1));
                view.setPadding(3, 3, 3, 3);
                newRow.addView(view, new TableRow.LayoutParams());
            }
            table.addView(newRow, new TableLayout.LayoutParams());
            newRow.requestLayout();
        }
    });
}
Also used : Button(android.widget.Button) TableRow(android.widget.TableRow) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View) TableLayout(android.widget.TableLayout)

Example 5 with TableLayout

use of android.widget.TableLayout in project platform_frameworks_base by android.

the class AddColumn method onCreate.

@Override
protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.add_column_in_table);
    final Button addRowButton = (Button) findViewById(R.id.add_row_button);
    addRowButton.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            final TableLayout table = (TableLayout) findViewById(R.id.table);
            final TableRow newRow = new TableRow(AddColumn.this);
            for (int i = 0; i < 4; i++) {
                final TextView view = new TextView(AddColumn.this);
                view.setText("Column " + (i + 1));
                view.setPadding(3, 3, 3, 3);
                newRow.addView(view, new TableRow.LayoutParams());
            }
            table.addView(newRow, new TableLayout.LayoutParams());
            newRow.requestLayout();
        }
    });
}
Also used : Button(android.widget.Button) TableRow(android.widget.TableRow) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View) TableLayout(android.widget.TableLayout)

Aggregations

TableLayout (android.widget.TableLayout)41 TableRow (android.widget.TableRow)34 TextView (android.widget.TextView)34 View (android.view.View)20 Button (android.widget.Button)10 SuppressLint (android.annotation.SuppressLint)5 ScrollView (android.widget.ScrollView)5 ArrayList (java.util.ArrayList)5 Context (android.content.Context)4 SpannableStringBuilder (android.text.SpannableStringBuilder)4 CheckBox (android.widget.CheckBox)4 ImageButton (android.widget.ImageButton)4 LinearLayout (android.widget.LinearLayout)4 AdapterView (android.widget.AdapterView)3 CompoundButton (android.widget.CompoundButton)3 ImageView (android.widget.ImageView)3 DialogInterface (android.content.DialogInterface)2 NavigationView (android.support.design.widget.NavigationView)2 AlertDialog (android.support.v7.app.AlertDialog)2 Spannable (android.text.Spannable)2