Skip to content

Commit

Permalink
Source code not shown by default.
Browse files Browse the repository at this point in the history
> Need to click on file name to see the source code.
> For improving the UI & UX.
  • Loading branch information
amanmehara committed Jan 3, 2019
1 parent 8f43c03 commit 4cd4ac0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
}
}

Expand Down
10 changes: 5 additions & 5 deletions android/src/main/res/layout/files_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@
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" />

<WebView
android:id="@+id/file_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="0dp"
android:padding="0dp" />
android:padding="0dp"
android:visibility="gone" />

</LinearLayout>

Expand Down

0 comments on commit 4cd4ac0

Please sign in to comment.