Search in sources :

Example 36 with TableLayout

use of android.widget.TableLayout in project YalpStore by yeriomin.

the class DeviceInfoActivity method onNewIntent.

@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    String deviceName = intent.getStringExtra(INTENT_DEVICE_NAME);
    if (TextUtils.isEmpty(deviceName)) {
        Log.e(getClass().getSimpleName(), "No device name given");
        finish();
        return;
    }
    Properties properties = new SpoofDeviceManager(this).getProperties(deviceName);
    setTitle(properties.getProperty("UserReadableName"));
    List<String> keys = new ArrayList<>();
    for (Object key : properties.keySet()) {
        keys.add((String) key);
    }
    Collections.sort(keys);
    TableLayout table = findViewById(R.id.device_info);
    for (String key : keys) {
        addRow(table, key, ((String) properties.get(key)).replace(",", ", "));
    }
}
Also used : ArrayList(java.util.ArrayList) Properties(java.util.Properties) TableLayout(android.widget.TableLayout)

Example 37 with TableLayout

use of android.widget.TableLayout in project smoke by textbrowser.

the class Settings method populateNeighbors.

private void populateNeighbors(ArrayList<NeighborElement> arrayList) {
    if (arrayList == null)
        arrayList = m_databaseHelper.readNeighbors(s_cryptography);
    final TableLayout tableLayout = (TableLayout) findViewById(R.id.neighbors);
    if (arrayList == null || arrayList.isEmpty()) {
        tableLayout.removeAllViews();
        return;
    }
    StringBuilder stringBuilder = new StringBuilder();
    int i = 0;
    for (i = tableLayout.getChildCount() - 1; i >= 0; i--) {
        TableRow row = (TableRow) tableLayout.getChildAt(i);
        if (row == null)
            continue;
        TextView textView1 = (TextView) row.getChildAt(1);
        if (textView1 == null) {
            tableLayout.removeView(row);
            continue;
        }
        boolean found = false;
        for (NeighborElement neighborElement : arrayList) {
            stringBuilder.delete(0, stringBuilder.length());
            stringBuilder.append(neighborElement.m_remoteIpAddress);
            if (neighborElement.m_ipVersion.equals("IPv6"))
                if (!neighborElement.m_remoteScopeId.isEmpty()) {
                    stringBuilder.append("-");
                    stringBuilder.append(neighborElement.m_remoteScopeId);
                }
            stringBuilder.append(":");
            stringBuilder.append(neighborElement.m_remotePort);
            stringBuilder.append(":");
            stringBuilder.append(neighborElement.m_transport);
            if (textView1.getText().toString().contains(stringBuilder.toString())) {
                found = true;
                break;
            }
        }
        if (!found)
            tableLayout.removeView(row);
    }
    Switch switch1 = (Switch) findViewById(R.id.neighbor_details);
    i = 0;
    for (NeighborElement neighborElement : arrayList) {
        if (neighborElement == null)
            continue;
        Spinner spinner = null;
        TableRow row = null;
        TextView textView1 = null;
        int count = tableLayout.getChildCount();
        for (int j = 0; j < count; j++) {
            TableRow r = (TableRow) tableLayout.getChildAt(j);
            if (r == null)
                continue;
            TextView t = (TextView) r.getChildAt(1);
            if (t == null)
                continue;
            stringBuilder.delete(0, stringBuilder.length());
            stringBuilder.append(neighborElement.m_remoteIpAddress);
            if (neighborElement.m_ipVersion.equals("IPv6"))
                if (!neighborElement.m_remoteScopeId.isEmpty()) {
                    stringBuilder.append("-");
                    stringBuilder.append(neighborElement.m_remoteScopeId);
                }
            stringBuilder.append(":");
            stringBuilder.append(neighborElement.m_remotePort);
            stringBuilder.append(":");
            stringBuilder.append(neighborElement.m_transport);
            if (t.getText().toString().contains(stringBuilder.toString())) {
                textView1 = t;
                break;
            }
        }
        if (textView1 == null) {
            TableRow.LayoutParams layoutParams = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT);
            row = new TableRow(Settings.this);
            row.setId(neighborElement.m_oid);
            row.setLayoutParams(layoutParams);
            spinner = new Spinner(Settings.this);
            ArrayAdapter<String> arrayAdapter = null;
            String[] array = null;
            final String ipAndPort = neighborElement.m_remoteIpAddress + ":" + neighborElement.m_remotePort;
            if (neighborElement.m_transport.equals("TCP"))
                array = new String[] { "Action", "Connect", "Delete", "Disconnect", "Purge Queue", "Reset SSL/TLS Credentials" };
            else
                array = new String[] { "Action", "Connect", "Delete", "Disconnect", "Purge Queue" };
            arrayAdapter = new ArrayAdapter<>(Settings.this, android.R.layout.simple_spinner_item, array);
            spinner.setAdapter(arrayAdapter);
            spinner.setId(neighborElement.m_oid);
            spinner.setOnItemSelectedListener(new OnItemSelectedListener() {

                @Override
                public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
                    switch(position) {
                        case // Connect.
                        1:
                            m_databaseHelper.neighborControlStatus(s_cryptography, "connect", String.valueOf(parent.getId()));
                            break;
                        case // Delete.
                        2:
                            deleteNeighbor(ipAndPort, parent.getId());
                            break;
                        case // Disconnect.
                        3:
                            m_databaseHelper.neighborControlStatus(s_cryptography, "disconnect", String.valueOf(parent.getId()));
                            break;
                        case // Purge queue.
                        4:
                            m_databaseHelper.purgeNeighborQueue(String.valueOf(parent.getId()));
                            break;
                        case // Reset SSL/TLS credentials.
                        5:
                            m_databaseHelper.neighborRecordCertificate(s_cryptography, String.valueOf(parent.getId()), null);
                            m_databaseHelper.neighborControlStatus(s_cryptography, "disconnect", String.valueOf(parent.getId()));
                            break;
                        default:
                            break;
                    }
                    parent.setSelection(0);
                }

                @Override
                public void onNothingSelected(AdapterView<?> parent) {
                }
            });
            textView1 = new TextView(Settings.this);
        }
        switch(neighborElement.m_status) {
            case "connected":
                // Dark Green
                textView1.setTextColor(Color.rgb(27, 94, 32));
                break;
            case "connecting":
                // Dark Orange
                textView1.setTextColor(Color.rgb(255, 111, 0));
                break;
            default:
                // Dark Red
                textView1.setTextColor(Color.rgb(183, 28, 28));
                break;
        }
        stringBuilder.delete(0, stringBuilder.length());
        stringBuilder.append("Control: ");
        try {
            stringBuilder.append(neighborElement.m_statusControl.substring(0, 1).toUpperCase());
            stringBuilder.append(neighborElement.m_statusControl.substring(1));
        } catch (Exception exception) {
            stringBuilder.append("Disconnect");
        }
        stringBuilder.append("\n");
        stringBuilder.append("Status: ");
        try {
            stringBuilder.append(neighborElement.m_status.substring(0, 1).toUpperCase());
            stringBuilder.append(neighborElement.m_status.substring(1));
        } catch (Exception exception) {
            stringBuilder.append("Disconnected");
        }
        stringBuilder.append("\n");
        if (!neighborElement.m_error.isEmpty()) {
            stringBuilder.append("Error: ");
            stringBuilder.append(neighborElement.m_error);
            stringBuilder.append("\n");
        }
        stringBuilder.append(neighborElement.m_remoteIpAddress);
        if (neighborElement.m_ipVersion.equals("IPv6"))
            if (!neighborElement.m_remoteScopeId.isEmpty()) {
                stringBuilder.append("-");
                stringBuilder.append(neighborElement.m_remoteScopeId);
            }
        stringBuilder.append(":");
        stringBuilder.append(neighborElement.m_remotePort);
        stringBuilder.append(":");
        stringBuilder.append(neighborElement.m_transport);
        if (!neighborElement.m_localIpAddress.isEmpty() && !neighborElement.m_localPort.isEmpty()) {
            stringBuilder.append("\n");
            stringBuilder.append(neighborElement.m_localIpAddress);
            stringBuilder.append(":");
            stringBuilder.append(neighborElement.m_localPort);
        }
        stringBuilder.append("\nPassthrough: ");
        stringBuilder.append(neighborElement.m_passthrough);
        stringBuilder.append("\nProxy: ");
        if (!neighborElement.m_proxyIpAddress.isEmpty() && !neighborElement.m_proxyPort.isEmpty()) {
            stringBuilder.append(neighborElement.m_proxyIpAddress);
            stringBuilder.append(":");
            stringBuilder.append(neighborElement.m_proxyPort);
            stringBuilder.append(":");
            stringBuilder.append(neighborElement.m_proxyType);
        }
        if (switch1.isChecked()) {
            if (neighborElement.m_remoteCertificate != null && neighborElement.m_remoteCertificate.length > 0) {
                stringBuilder.append("\n");
                stringBuilder.append("Remote Certificate's Fingerprint: ");
                stringBuilder.append(Cryptography.fingerPrint(Miscellaneous.pemFormat(neighborElement.m_remoteCertificate).getBytes()));
            }
            if (!neighborElement.m_sessionCipher.isEmpty()) {
                stringBuilder.append("\n");
                stringBuilder.append("Session Cipher: ");
                stringBuilder.append(neighborElement.m_sessionCipher);
            }
        }
        stringBuilder.append("\n");
        stringBuilder.append("Temp. Queued: ");
        stringBuilder.append(neighborElement.m_echoQueueSize);
        stringBuilder.append(" / ");
        stringBuilder.append(Neighbor.MAXIMUM_QUEUED_ECHO_PACKETS);
        stringBuilder.append("\n");
        stringBuilder.append("In: ");
        stringBuilder.append(Miscellaneous.formattedDigitalInformation(neighborElement.m_bytesRead));
        stringBuilder.append("\n");
        stringBuilder.append("Out: ");
        stringBuilder.append(Miscellaneous.formattedDigitalInformation(neighborElement.m_bytesWritten));
        stringBuilder.append("\n");
        stringBuilder.append("Outbound Queued: ");
        stringBuilder.append(neighborElement.m_outboundQueued);
        stringBuilder.append("\n");
        stringBuilder.append("Uptime: ");
        try {
            long uptime = Long.parseLong(neighborElement.m_uptime);
            stringBuilder.append(String.format(Locale.getDefault(), "%d:%02d", TimeUnit.NANOSECONDS.toMinutes(uptime), TimeUnit.NANOSECONDS.toSeconds(uptime) - TimeUnit.MINUTES.toSeconds(TimeUnit.NANOSECONDS.toMinutes(uptime))));
        } catch (Exception exception) {
            stringBuilder.append("0:00");
        }
        stringBuilder.append(" Min.\n");
        textView1.setGravity(Gravity.CENTER_VERTICAL);
        textView1.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 1));
        textView1.setText(stringBuilder);
        textView1.setTypeface(Typeface.MONOSPACE);
        textView1.setWidth(TEXTVIEW_WIDTH);
        if (row != null) {
            row.addView(spinner);
            row.addView(textView1);
            tableLayout.addView(row, i);
        }
        i += 1;
    }
    arrayList.clear();
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams) SpannableStringBuilder(android.text.SpannableStringBuilder) Spinner(android.widget.Spinner) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) Switch(android.widget.Switch) TableRow(android.widget.TableRow) OnItemSelectedListener(android.widget.AdapterView.OnItemSelectedListener) TextView(android.widget.TextView) TableLayout(android.widget.TableLayout)

Example 38 with TableLayout

use of android.widget.TableLayout in project smoke by textbrowser.

the class Settings method populateParticipants.

private void populateParticipants() {
    ArrayList<SipHashIdElement> arrayList = m_databaseHelper.readSipHashIds(s_cryptography, "");
    TableLayout tableLayout = (TableLayout) findViewById(R.id.participants);
    tableLayout.removeAllViews();
    if (arrayList == null || arrayList.isEmpty())
        return;
    int i = 0;
    for (SipHashIdElement sipHashIdElement : arrayList) {
        if (sipHashIdElement == null)
            continue;
        String sipHashId = Miscellaneous.prepareSipHashId(sipHashIdElement.m_sipHashId);
        TableRow.LayoutParams layoutParams = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT);
        TableRow row = new TableRow(Settings.this);
        row.setLayoutParams(layoutParams);
        for (int j = 0; j < 3; j++) {
            TextView textView1 = new TextView(Settings.this);
            textView1.setId(sipHashIdElement.m_oid);
            switch(j) {
                case 0:
                    textView1.setGravity(Gravity.CENTER_VERTICAL);
                    textView1.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.MATCH_PARENT, 1));
                    textView1.setTag(R.id.participants, sipHashIdElement.m_name);
                    textView1.setText(sipHashIdElement.m_name);
                    break;
                case 1:
                    if (sipHashIdElement.m_epksCompleted && sipHashIdElement.m_keysSigned)
                        textView1.setCompoundDrawablesWithIntrinsicBounds(R.drawable.keys_signed, 0, 0, 0);
                    else if (sipHashIdElement.m_epksCompleted)
                        textView1.setCompoundDrawablesWithIntrinsicBounds(R.drawable.keys_not_signed, 0, 0, 0);
                    else
                        textView1.setCompoundDrawablesWithIntrinsicBounds(R.drawable.warning, 0, 0, 0);
                    textView1.setCompoundDrawablePadding(5);
                    textView1.setGravity(Gravity.CENTER_VERTICAL);
                    textView1.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 1));
                    textView1.setTag(R.id.participants, sipHashId);
                    textView1.setText(sipHashId);
                    break;
                case 2:
                    textView1.setGravity(Gravity.CENTER);
                    textView1.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.MATCH_PARENT, 1));
                    textView1.setTag(R.id.participants, sipHashId);
                    textView1.setText(String.valueOf(sipHashIdElement.m_fiascoKeys));
                    break;
                default:
                    break;
            }
            textView1.setTag(R.id.refresh_participants, sipHashIdElement.m_epksCompleted);
            registerForContextMenu(textView1);
            row.addView(textView1);
        }
        tableLayout.addView(row, i);
        i += 1;
    }
    arrayList.clear();
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams) TableRow(android.widget.TableRow) TextView(android.widget.TextView) TableLayout(android.widget.TableLayout)

Example 39 with TableLayout

use of android.widget.TableLayout in project smoke by textbrowser.

the class Miscellaneous method showSwitchDialog.

public static void showSwitchDialog(ArrayList<String> arrayList, Context context, DialogInterface.OnCancelListener cancelListener, String prompt, String title) {
    if (context == null || !(context instanceof Activity) || ((Activity) context).isFinishing())
        return;
    AlertDialog alertDialog = new AlertDialog.Builder(context).create();
    View view = null;
    if (arrayList != null && !arrayList.isEmpty()) {
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        TableLayout tableLayout = null;
        int i = 0;
        view = inflater.inflate(R.layout.participants_table, null);
        tableLayout = (TableLayout) view.findViewById(R.id.participants);
        for (String string : arrayList) {
            Switch switch1 = new Switch(context);
            switch1.setLayoutDirection(LayoutDirection.RTL);
            switch1.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 1));
            switch1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

                @Override
                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                    State.getInstance().selectSwitch(buttonView.getText().toString(), isChecked);
                }
            });
            switch1.setText(string);
            TableRow row = new TableRow(context);
            row.addView(switch1);
            tableLayout.addView(row, i);
            i += 1;
        }
    }
    alertDialog.setButton(AlertDialog.BUTTON_NEGATIVE, "Cancel", new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });
    alertDialog.setButton(AlertDialog.BUTTON_POSITIVE, "Accept", new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
        }
    });
    if (view != null)
        alertDialog.setMessage(prompt);
    else
        alertDialog.setMessage("Empty list.");
    alertDialog.setOnCancelListener(cancelListener);
    /*
							 ** We cannot wait
							 ** for a response.
							 */
    alertDialog.setTitle(title);
    if (view != null)
        alertDialog.setView(view);
    alertDialog.show();
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) Activity(android.app.Activity) View(android.view.View) TextView(android.widget.TextView) Switch(android.widget.Switch) LayoutInflater(android.view.LayoutInflater) TableRow(android.widget.TableRow) TableLayout(android.widget.TableLayout) CompoundButton(android.widget.CompoundButton)

Example 40 with TableLayout

use of android.widget.TableLayout in project EngineDriver by JMRI.

the class gamepad_test method setGamepadKeys.

// setup the appropriate keycodes for the type of gamepad that has been selected in the preferences
private void setGamepadKeys() {
    prefGamePadType = prefs.getString("prefGamePadType", getApplicationContext().getResources().getString(R.string.prefGamePadTypeDefaultValue));
    gamePadModesArray = this.getResources().getStringArray(R.array.prefGamePadTypeEntryValues);
    final List<String> gamePadModesList = new ArrayList<>(Arrays.asList(gamePadModesArray));
    gamePadModeEntriesArray = this.getResources().getStringArray(R.array.prefGamePadTypeEntries);
    final List<String> gamePadModeEntriesList = new ArrayList<>(Arrays.asList(gamePadModeEntriesArray));
    prefGamePadTypeIndex = Arrays.asList(gamePadModesArray).indexOf(prefGamePadType);
    if (prefGamePadTypeIndex < 0)
        prefGamePadTypeIndex = 0;
    Spinner spinner = findViewById(R.id.gamepad_test_mode);
    spinner.setSelection(prefGamePadTypeIndex);
    // Gamepad button Preferences
    prefGamePadButtons[0] = prefs.getString("prefGamePadButtonStart", getApplicationContext().getResources().getString(R.string.prefGamePadButtonStartDefaultValue));
    prefGamePadButtons[9] = prefs.getString("prefGamePadButtonReturn", getApplicationContext().getResources().getString(R.string.prefGamePadButtonReturnDefaultValue));
    prefGamePadButtons[1] = prefs.getString("prefGamePadButton1", getApplicationContext().getResources().getString(R.string.prefGamePadButton1DefaultValue));
    prefGamePadButtons[2] = prefs.getString("prefGamePadButton2", getApplicationContext().getResources().getString(R.string.prefGamePadButton2DefaultValue));
    prefGamePadButtons[3] = prefs.getString("prefGamePadButton3", getApplicationContext().getResources().getString(R.string.prefGamePadButton3DefaultValue));
    prefGamePadButtons[4] = prefs.getString("prefGamePadButton4", getApplicationContext().getResources().getString(R.string.prefGamePadButton4DefaultValue));
    // Gamepad DPAD Preferences
    prefGamePadButtons[5] = prefs.getString("prefGamePadButtonUp", getApplicationContext().getResources().getString(R.string.prefGamePadButtonUpDefaultValue));
    prefGamePadButtons[6] = prefs.getString("prefGamePadButtonRight", getApplicationContext().getResources().getString(R.string.prefGamePadButtonRightDefaultValue));
    prefGamePadButtons[7] = prefs.getString("prefGamePadButtonDown", getApplicationContext().getResources().getString(R.string.prefGamePadButtonDownDefaultValue));
    prefGamePadButtons[8] = prefs.getString("prefGamePadButtonLeft", getApplicationContext().getResources().getString(R.string.prefGamePadButtonLeftDefaultValue));
    // extra buttons
    prefGamePadButtons[10] = prefs.getString("prefGamePadButtonLeftShoulder", getApplicationContext().getResources().getString(R.string.prefGamePadButtonLeftTriggerDefaultValue));
    prefGamePadButtons[11] = prefs.getString("prefGamePadButtonRightShoulder", getApplicationContext().getResources().getString(R.string.prefGamePadButtonRightShoulderDefaultValue));
    prefGamePadButtons[12] = prefs.getString("prefGamePadButtonLeftTrigger", getApplicationContext().getResources().getString(R.string.prefGamePadButtonLeftTriggerDefaultValue));
    prefGamePadButtons[13] = prefs.getString("prefGamePadButtonRightTrigger", getApplicationContext().getResources().getString(R.string.prefGamePadButtonRightTriggerDefaultValue));
    bDpadUp.setSelected(false);
    bDpadDown.setSelected(false);
    bDpadLeft.setSelected(false);
    bDpadRight.setSelected(false);
    bButtonX.setSelected(false);
    bButtonY.setSelected(false);
    bButtonA.setSelected(false);
    bButtonB.setSelected(false);
    bButtonStart.setSelected(false);
    bButtonEnter.setSelected(false);
    bButtonLeftShoulder.setSelected(false);
    bButtonRightShoulder.setSelected(false);
    bButtonLeftTrigger.setSelected(false);
    bButtonRightTrigger.setSelected(false);
    // make sure the Softkeyboard is hidden
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM, WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
    int[] bGamePadKeys;
    int[] bGamePadKeysUp;
    switch(prefGamePadType) {
        case "iCade+DPAD":
        case "iCade+DPAD-rotate":
            bGamePadKeys = this.getResources().getIntArray(R.array.prefGamePadiCadePlusDpad);
            bGamePadKeysUp = this.getResources().getIntArray(R.array.prefGamePadiCadePlusDpad_UpCodes);
            break;
        case "MTK":
        case "MTK-rotate":
            bGamePadKeys = this.getResources().getIntArray(R.array.prefGamePadMTK);
            bGamePadKeysUp = bGamePadKeys;
            break;
        case "Game":
        case "Game-rotate":
            bGamePadKeys = this.getResources().getIntArray(R.array.prefGamePadGame);
            bGamePadKeysUp = bGamePadKeys;
            break;
        case "MagicseeR1B":
            bGamePadKeys = this.getResources().getIntArray(R.array.prefGamePadMagicseeR1B);
            bGamePadKeysUp = bGamePadKeys;
            break;
        case "FlydigiWee2":
            bGamePadKeys = this.getResources().getIntArray(R.array.prefGamePadFlydigiWee2);
            bGamePadKeysUp = bGamePadKeys;
            break;
        case "UtopiaC":
            bGamePadKeys = this.getResources().getIntArray(R.array.prefGamePadUtopiaC);
            bGamePadKeysUp = bGamePadKeys;
            break;
        case "Keyboard":
            bGamePadKeys = this.getResources().getIntArray(R.array.prefGamePadNoneLabels);
            bGamePadKeysUp = bGamePadKeys;
            break;
        default:
            // "iCade" or iCade-rotate
            bGamePadKeys = this.getResources().getIntArray(R.array.prefGamePadiCade);
            bGamePadKeysUp = this.getResources().getIntArray(R.array.prefGamePadiCade_UpCodes);
            break;
    }
    // now grab the keycodes and put them into the arrays that will actually be used.
    for (int i = 0; i <= 14; i++) {
        gamePadKeys[i] = bGamePadKeys[i];
        gamePadKeys_Up[i] = bGamePadKeysUp[i];
    }
    // if the preference name has "-rotate" at the end of it swap the dpad buttons around
    if (prefGamePadType.contains("-rotate")) {
        gamePadKeys[2] = bGamePadKeys[4];
        gamePadKeys[3] = bGamePadKeys[5];
        gamePadKeys[4] = bGamePadKeys[3];
        gamePadKeys[5] = bGamePadKeys[2];
        gamePadKeys_Up[2] = bGamePadKeysUp[4];
        gamePadKeys_Up[3] = bGamePadKeysUp[5];
        gamePadKeys_Up[4] = bGamePadKeysUp[3];
        gamePadKeys_Up[5] = bGamePadKeysUp[2];
    }
    LinearLayout dpad = findViewById(R.id.gamepad_dpad);
    TableLayout btns = findViewById(R.id.gamepad_buttons);
    RelativeLayout optn = findViewById(R.id.gamepad_test_optional_group);
    TableLayout extra = findViewById(R.id.gamepad_buttons_extra);
    RelativeLayout status = findViewById(R.id.gamepad_test_complete_group);
    View helpText = findViewById(R.id.gamepad_test_help);
    View helpTextKeyboard = findViewById(R.id.gamepad_test_keyboard_help);
    if (!prefGamePadType.equals("Keyboard")) {
        dpad.setVisibility(LinearLayout.VISIBLE);
        btns.setVisibility(TableLayout.VISIBLE);
        optn.setVisibility(RelativeLayout.VISIBLE);
        extra.setVisibility(TableLayout.VISIBLE);
        status.setVisibility(View.VISIBLE);
        helpText.setVisibility(View.VISIBLE);
        helpTextKeyboard.setVisibility(View.GONE);
    } else {
        dpad.setVisibility(LinearLayout.GONE);
        btns.setVisibility(TableLayout.GONE);
        optn.setVisibility(RelativeLayout.GONE);
        extra.setVisibility(TableLayout.GONE);
        status.setVisibility(TableLayout.GONE);
        helpText.setVisibility(View.GONE);
        helpTextKeyboard.setVisibility(View.VISIBLE);
    }
}
Also used : Spinner(android.widget.Spinner) ArrayList(java.util.ArrayList) RelativeLayout(android.widget.RelativeLayout) TableLayout(android.widget.TableLayout) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) SuppressLint(android.annotation.SuppressLint) LinearLayout(android.widget.LinearLayout)

Aggregations

TableLayout (android.widget.TableLayout)43 TextView (android.widget.TextView)36 TableRow (android.widget.TableRow)35 View (android.view.View)22 Button (android.widget.Button)10 SuppressLint (android.annotation.SuppressLint)6 SpannableStringBuilder (android.text.SpannableStringBuilder)5 LinearLayout (android.widget.LinearLayout)5 ScrollView (android.widget.ScrollView)5 Switch (android.widget.Switch)5 ArrayList (java.util.ArrayList)5 Context (android.content.Context)4 AdapterView (android.widget.AdapterView)4 CompoundButton (android.widget.CompoundButton)4 DialogInterface (android.content.DialogInterface)3 ImageView (android.widget.ImageView)3 NavigationView (android.support.design.widget.NavigationView)2 AlertDialog (android.support.v7.app.AlertDialog)2 StyleSpan (android.text.style.StyleSpan)2 LayoutInflater (android.view.LayoutInflater)2