diff --git a/android/src/main/java/com/amanmehara/programming/android/adapters/DetailAdapter.java b/android/src/main/java/com/amanmehara/programming/android/adapters/DetailAdapter.java index f160d8e..8391128 100644 --- a/android/src/main/java/com/amanmehara/programming/android/adapters/DetailAdapter.java +++ b/android/src/main/java/com/amanmehara/programming/android/adapters/DetailAdapter.java @@ -155,7 +155,7 @@ private String withAccessToken(String url) { return url + "&access_token=" + accessToken; } - static class ViewHolder extends RecyclerView.ViewHolder { + static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { private TextView fileNameView; private WebView fileContentView; @@ -164,6 +164,20 @@ private ViewHolder(View v) { super(v); fileNameView = v.findViewById(R.id.file_name); fileContentView = v.findViewById(R.id.file_content); + v.setOnClickListener(this); + } + + @Override + public void onClick(View v) { + switch (fileContentView.getVisibility()) { + case View.GONE: + fileContentView.setVisibility(View.VISIBLE); + break; + case View.INVISIBLE: + case View.VISIBLE: + fileContentView.setVisibility(View.GONE); + break; + } } } diff --git a/android/src/main/res/layout/files_list.xml b/android/src/main/res/layout/files_list.xml index 03d6a61..65f6584 100644 --- a/android/src/main/res/layout/files_list.xml +++ b/android/src/main/res/layout/files_list.xml @@ -21,12 +21,11 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center" + android:background="?android:attr/selectableItemBackground" android:gravity="start" - android:paddingBottom="4dp" - android:paddingEnd="8dp" - android:paddingStart="8dp" + android:padding="16dp" android:textColor="@color/primary_text" - android:textSize="18sp" + android:textSize="16sp" android:fontFamily="@font/fira_sans_light" /> + android:padding="0dp" + android:visibility="gone" />