Hidden features for software developers. Since it is a function for developers only, it is standard that general users cannot operate it.
It's not a mast. It's just to make debugging easier, so let's start by hearing from the person who debugs. However, if there is a voice saying that it would be nice to have it, or if debugging requires man-hours for engineers, it is better to make it.
This is an item cell sample. I think it's okay for parents to enclose it in ScrollView and multiply it.
activity_debug_menu.xml
<!--abridgement-->
<!--Item Parent Name display©-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/listview_height"
android:background="@color/debug_item_parent_color"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="@dimen/listview_margin_left"
android:gravity="left"
android:text="display©"
android:textColor="@color/debug_text_color"
android:textSize="14sp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:orientation="vertical">
<!-- Item Child Name Build Ver. -->
<LinearLayout
android:id="@+id/build_info_area"
android:layout_width="match_parent"
android:layout_height="@dimen/listview_height"
android:layout_gravity="center"
android:background="@drawable/default_selector"
android:clickable="true"
android:orientation="horizontal"
android:paddingLeft="@dimen/listview_margin_left">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent">
<ImageView
android:layout_width="@dimen/listview_icon_width"
android:layout_height="@dimen/listview_icon_height"
android:layout_gravity="center"
android:layout_marginRight="@dimen/listview_icon_margin_right"
android:background="@drawable/ic_build_36dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="125dp"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginRight="10dp"
android:gravity="center"
android:text="BUILD Ver."
android:textSize="@dimen/listview_item_text_size"/>
</LinearLayout>
<!--Acquisition Ver-->
<TextView
android:id="@+id/build_info_txt"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="left|center"
android:text="Ver.X.XX.X"
android:textColor="@color/debug_text_color"
android:textSize="@dimen/listview_item_text_size"/>
</LinearLayout>
<!--Separator-->
<include layout="@layout/component_divider_wrap"/>
<!--abridgement-->
It's just a dividing line.
component_divider_wrap.xml
<merge xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/div"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="72dp"
android:layout_weight="1">
<View style="@style/divider_horizontal"/>
</LinearLayout>
</merge>
An example is described in onCreate as a sample, but it becomes difficult to read as the number of items increases, so it may be good to bind items with Butter Knife.
DebugMenuActivity.java
public class DebugMenuActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_debug_menu);
// Build Ver. Text
TextView buildInfoTxt = (TextView)findViewById(R.id.build_info_txt);
buildInfoTxt.setText("Ver. " + BuildConfig.VERSION_NAME + " " + BuildConfig.BUILD_TIMESTAMP + " " + BuildConfig.BUILD_HASH + " (" + BuildConfig.BUILD_MACHINE + ")");
// Build Ver. Area
LinearLayout buildInfoArea =(LinearLayout)findViewById(R.id.build_info_area);
buildInfoArea.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
copyClipBoard((String)buildInfoTxt.getText());
}
});
}
//Copy to clipboard
private void copyClipBoard(String copySource) {
if (copySource.equals("")) {
return;
}
//Create an Item to store in the clipboard
ClipData.Item item = new ClipData.Item(copySource);
//Creating a MIME TYPE
String[] mimeType = new String[1];
mimeType[0] = ClipDescription.MIMETYPE_TEXT_URILIST;
//Creating a ClipData object to store in the clipboard
ClipData cd = new ClipData(new ClipDescription("text_data", mimeType), item);
//Store data in clipboard
ClipboardManager cm = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
cm.setPrimaryClip(cd);
}
}
If you add a function that gives a suggestion when you tap the icon when changing the Host Name with self-satisfaction, it is surprisingly popular, or if you implement it because it is better to be able to authenticate external access, Pl will ** give me yakiniku Was ** ** Athlete engineers who like yakiniku! Let's make it: sunglasses: **
December 23rd is @ yuzu_afro's turn!
Recommended Posts