fixed tabs
This commit is contained in:
@@ -43,7 +43,6 @@ public class MakeAutoActivity2 extends AppCompatActivity {
|
||||
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
|
||||
@Override
|
||||
public void onTabSelected(TabLayout.Tab tab) {
|
||||
// Pass tab position dynamically
|
||||
Fragment targetFragment = Tabs.newInstance(tab.getPosition());
|
||||
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
|
||||
@@ -59,6 +59,8 @@ public class Tabs extends Fragment {
|
||||
EditText ToAdd8 = view.findViewById(R.id.toAdd8);
|
||||
EditText ToAdd9 = view.findViewById(R.id.toAdd9);
|
||||
|
||||
|
||||
|
||||
EditText numOfButton = view.findViewById(R.id.numOfButton);
|
||||
View[] buttons = {
|
||||
view.findViewById(R.id.toAdd),
|
||||
@@ -80,6 +82,16 @@ public class Tabs extends Fragment {
|
||||
numOfButton.setText(String.valueOf(NumButtonOb[tabPosition]));
|
||||
}
|
||||
|
||||
valueButtonsAuto = EventsActivity.Data.getvalueButtonsAuto();
|
||||
|
||||
EditText[] toAddFields = {ToAdd, ToAdd2, ToAdd3, ToAdd4, ToAdd5, ToAdd6, ToAdd7, ToAdd8, ToAdd9};
|
||||
|
||||
for (int i = 0; i < toAddFields.length; i++) {
|
||||
int val = valueButtonsAuto[tabPosition * 9 + i];
|
||||
toAddFields[i].setText(val == 0 ? "" : String.valueOf(val));
|
||||
}
|
||||
|
||||
|
||||
numOfButton.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
@@ -107,6 +119,9 @@ public class Tabs extends Fragment {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
ToAdd.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
@@ -114,6 +129,7 @@ public class Tabs extends Fragment {
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
String input = s.toString();
|
||||
valueButtonsAuto = EventsActivity.Data.getvalueButtonsAuto();
|
||||
valueButtonsAuto[tabPosition * 9] = input.isEmpty() ? 0 : Integer.parseInt(input);
|
||||
EventsActivity.Data.setValueButtonsAuto(valueButtonsAuto);
|
||||
Log.d("score", Arrays.toString(valueButtonsAuto));
|
||||
@@ -124,6 +140,158 @@ public class Tabs extends Fragment {
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {}
|
||||
});
|
||||
|
||||
ToAdd2.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
String input = s.toString();
|
||||
valueButtonsAuto = EventsActivity.Data.getvalueButtonsAuto();
|
||||
valueButtonsAuto[tabPosition * 9 + 1] = input.isEmpty() ? 0 : Integer.parseInt(input);
|
||||
EventsActivity.Data.setValueButtonsAuto(valueButtonsAuto);
|
||||
Log.d("score", Arrays.toString(valueButtonsAuto));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {}
|
||||
});
|
||||
|
||||
ToAdd3.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
String input = s.toString();
|
||||
valueButtonsAuto = EventsActivity.Data.getvalueButtonsAuto();
|
||||
valueButtonsAuto[tabPosition * 9 + 2] = input.isEmpty() ? 0 : Integer.parseInt(input);
|
||||
EventsActivity.Data.setValueButtonsAuto(valueButtonsAuto);
|
||||
Log.d("score", Arrays.toString(valueButtonsAuto));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {}
|
||||
});
|
||||
|
||||
ToAdd4.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
String input = s.toString();
|
||||
valueButtonsAuto = EventsActivity.Data.getvalueButtonsAuto();
|
||||
valueButtonsAuto[tabPosition * 9 + 3] = input.isEmpty() ? 0 : Integer.parseInt(input);
|
||||
EventsActivity.Data.setValueButtonsAuto(valueButtonsAuto);
|
||||
Log.d("score", Arrays.toString(valueButtonsAuto));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {}
|
||||
});
|
||||
|
||||
ToAdd5.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
String input = s.toString();
|
||||
valueButtonsAuto = EventsActivity.Data.getvalueButtonsAuto();
|
||||
valueButtonsAuto[tabPosition * 9 + 4] = input.isEmpty() ? 0 : Integer.parseInt(input);
|
||||
EventsActivity.Data.setValueButtonsAuto(valueButtonsAuto);
|
||||
Log.d("score", Arrays.toString(valueButtonsAuto));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {}
|
||||
});
|
||||
|
||||
ToAdd6.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
String input = s.toString();
|
||||
valueButtonsAuto = EventsActivity.Data.getvalueButtonsAuto();
|
||||
valueButtonsAuto[tabPosition * 9 + 5] = input.isEmpty() ? 0 : Integer.parseInt(input);
|
||||
EventsActivity.Data.setValueButtonsAuto(valueButtonsAuto);
|
||||
Log.d("score", Arrays.toString(valueButtonsAuto));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {}
|
||||
});
|
||||
|
||||
ToAdd7.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
String input = s.toString();
|
||||
valueButtonsAuto = EventsActivity.Data.getvalueButtonsAuto();
|
||||
valueButtonsAuto[tabPosition * 9 + 6] = input.isEmpty() ? 0 : Integer.parseInt(input);
|
||||
EventsActivity.Data.setValueButtonsAuto(valueButtonsAuto);
|
||||
Log.d("score", Arrays.toString(valueButtonsAuto));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {}
|
||||
});
|
||||
|
||||
ToAdd8.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
String input = s.toString();
|
||||
valueButtonsAuto = EventsActivity.Data.getvalueButtonsAuto();
|
||||
valueButtonsAuto[tabPosition * 9 + 7] = input.isEmpty() ? 0 : Integer.parseInt(input);
|
||||
EventsActivity.Data.setValueButtonsAuto(valueButtonsAuto);
|
||||
Log.d("score", Arrays.toString(valueButtonsAuto));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {}
|
||||
});
|
||||
|
||||
ToAdd9.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
String input = s.toString();
|
||||
valueButtonsAuto = EventsActivity.Data.getvalueButtonsAuto();
|
||||
valueButtonsAuto[tabPosition * 9 + 8] = input.isEmpty() ? 0 : Integer.parseInt(input);
|
||||
EventsActivity.Data.setValueButtonsAuto(valueButtonsAuto);
|
||||
Log.d("score", Arrays.toString(valueButtonsAuto));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {}
|
||||
});
|
||||
return view;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
android:hint="Button 1"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="number"
|
||||
android:maxLength="1"
|
||||
android:maxLength="3"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/gray_hint"
|
||||
@@ -78,7 +78,7 @@
|
||||
android:hint="Button 2"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="number"
|
||||
android:maxLength="1"
|
||||
android:maxLength="3"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/gray_hint"
|
||||
@@ -95,7 +95,7 @@
|
||||
android:hint="Button 3"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="number"
|
||||
android:maxLength="1"
|
||||
android:maxLength="3"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/gray_hint"
|
||||
@@ -112,7 +112,7 @@
|
||||
android:hint="Button 4"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="number"
|
||||
android:maxLength="1"
|
||||
android:maxLength="3"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/gray_hint"
|
||||
@@ -129,7 +129,7 @@
|
||||
android:hint="Button 5"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="number"
|
||||
android:maxLength="1"
|
||||
android:maxLength="3"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/gray_hint"
|
||||
@@ -146,7 +146,7 @@
|
||||
android:hint="Button 6"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="number"
|
||||
android:maxLength="1"
|
||||
android:maxLength="3"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/gray_hint"
|
||||
@@ -163,7 +163,7 @@
|
||||
android:hint="Button 7"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="number"
|
||||
android:maxLength="1"
|
||||
android:maxLength="3"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/gray_hint"
|
||||
@@ -180,7 +180,7 @@
|
||||
android:hint="Button 8"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="number"
|
||||
android:maxLength="1"
|
||||
android:maxLength="3"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/gray_hint"
|
||||
@@ -197,7 +197,7 @@
|
||||
android:hint="Button 9"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="number"
|
||||
android:maxLength="1"
|
||||
android:maxLength="3"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/gray_hint"
|
||||
|
||||
Reference in New Issue
Block a user