This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String format(int n) { | |
String num = "" + n; | |
String stringNum = ""; | |
int numLength = num.length(); | |
for (int i = 0; i < numLength; i++) { | |
if ((numLength - i) % 3 == 0 && i != 0) { | |
stringNum += ","; | |
} | |
stringNum += num.charAt(i); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String toString(int n) { | |
String sign = ""; | |
String num = ""; | |
if (n == 0) { | |
return "0"; | |
} else if (n < 0) { | |
sign = "-"; | |
n = -n; | |
} | |
while (n != 0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private lateinit var binding: ActivityMainBinding | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
binding = ActivityMainBinding.inflate(layoutInflater) | |
setContentView(binding.root) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android { | |
.. | |
buildFeatures { | |
viewBinding true | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private var _binding: FragmentMainBinding? = null | |
private val binding get() = _binding!! | |
override fun onCreateView( | |
inflater: LayoutInflater, | |
container: ViewGroup?, | |
savedInstanceState: Bundle? | |
): View? { | |
_binding = FragmentMainBinding.inflate(inflater, container, false) | |
return binding.root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context=".MainActivity"> | |
<TextView | |
android:id="@+id/textView" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public final class ActivityMainBinding implements ViewBinding { | |
@NonNull | |
private final ConstraintLayout rootView; | |
@NonNull | |
public final TextView textView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@NonNull | |
public static ActivityMainBinding inflate(@NonNull LayoutInflater inflater) { | |
return inflate(inflater, null, false); | |
} | |
@NonNull | |
public static ActivityMainBinding inflate(@NonNull LayoutInflater inflater, | |
@Nullable ViewGroup parent, boolean attachToParent) { | |
View root = inflater.inflate(R.layout.activity_main, parent, false); | |
if (attachToParent) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@NonNull | |
public static ActivityMainBinding bind(@NonNull View rootView) { | |
// The body of this method is generated in a way you would not otherwise write. | |
// This is done to optimize the compiled bytecode for size and performance. | |
int id; | |
missingId: { | |
id = R.id.textView; | |
TextView textView = rootView.findViewById(id); | |
if (textView == null) { | |
break missingId; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins { | |
.. | |
id 'kotlin-parcelize' | |
} |
OlderNewer