Category : kotlin

Please suggest improvements on this code. I want to achieve is: 51.42ºN, 145.20ºW. Also it would be great if any tool is recommended or online code analysis. var formattedString = StringBuilder() if (latitude.toDouble() < 0) { formattedString.append(String.format("%.2f", (latitude.toDouble() * – 1))) formattedString.append(0x00B0.toChar()) formattedString.append("S, ") } else { formattedString.append(String.format("%.2f", latitude.toDouble())) formattedString.append(0x00B0.toChar()) formattedString.append("N, ") } if (longitude.toDouble() ..

Read more

I currently have a custom view with two buttons. The custom view layout is <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content"> <androidx.appcompat.widget.AppCompatButton android:id="@+id/noButton" android:background="@drawable/yes_no_button_unselected" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginEnd="18dp" android:layout_gravity="center" android:gravity="center" android:textAlignment="center" android:textColor="@color/colorPrimary" android:paddingStart="@dimen/button_hor_padding_med" android:paddingEnd="@dimen/button_hor_padding_med" android:paddingTop="@dimen/button_vert_padding_med" android:paddingBottom="@dimen/button_vert_padding_med" android:text="@string/button_no" android:textSize="14sp" android:maxLines="1" android:textAppearance="@style/HeaderTextViewLarge" /> <androidx.appcompat.widget.AppCompatButton android:id="@+id/yesButton" android:background="@drawable/yes_no_button_unselected" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:gravity="center" android:textAlignment="center" android:textColor="@color/colorPrimary" android:paddingStart="@dimen/button_hor_padding_med" android:paddingEnd="@dimen/button_hor_padding_med" android:paddingTop="@dimen/button_vert_padding_med" android:paddingBottom="@dimen/button_vert_padding_med" android:autoSizeTextType="uniform" ..

Read more