Increasing usability and design of files diff. (#413)

Applying sizes.

Additional changes.

First changes.

Merge branch 'master' into diff-cleaner

Fixing formatting.

Merge branch 'master' into diff-cleaner

Final changes for working with custom themes.

Merge remote-tracking branch 'remotes/main/master' into diff-cleaner

First changes for working with custom themes.

Merge branch 'master' into diff-cleaner

Merge branch 'master' into diff-cleaner

Merge branch 'master' into diff-cleaner

Merge branch 'master' into diff-cleaner

Merge branch 'master' into diff-cleaner

Adding custom COLOR_FONT.

Even smaller cleanups.

Merge remote-tracking branch 'remotes/main/master' into diff-cleaner

Small cleanups.

Fixing bug and adding maximum line limit.

Adding option to set cursor to end and small cleanup.

First aid.

Merge branch 'master' into diff-cleaner

Merge branch 'master' into diff-cleaner

Merge branch 'master' into diff-cleaner

Few improvements.

Performance improvements and cleanups.

Minor improvements (code in order) and many bug fixes

Bug fix.

Combining cited code.

Adding code commenting option.

Renaming list_files_diffs_new to list_files_diffs

Moving ProcessBar into center

Increasing performance.

Applying size to all icons globally.

Removing another unused file.

Merge remote-tracking branch 'remotes/main/master' into diff-cleaner

Removing unused files.

Changing size of 'close'-button.

Major changes concerning design and bug fixes.

Temporary save point.

2

1

Co-authored-by: opyale <example@example.com>
Reviewed-on: https://gitea.com/gitnex/GitNex/pulls/413
Reviewed-by: 6543 <6543@noreply.gitea.io>
Reviewed-by: M M Arif <mmarif@swatian.com>
This commit is contained in:
opyale 2020-04-28 12:39:41 +00:00 committed by M M Arif
parent 7c53de363d
commit e45dc4b311
40 changed files with 496 additions and 241 deletions

View File

@ -31,23 +31,25 @@ public abstract class BaseActivity extends AppCompatActivity {
final TinyDB tinyDb = new TinyDB(getApplicationContext());
if(tinyDb.getInt("themeId") == 1) {
setTheme(R.style.AppThemeLight);
}
else if(tinyDb.getInt("themeId") == 2) {
switch(tinyDb.getInt("themeId")) {
boolean timeSetterFlag = TimeHelper.timeBetweenHours(18, 6); // 6pm to 6am
if(timeSetterFlag) {
setTheme(R.style.AppTheme);
}
else {
case 1:
setTheme(R.style.AppThemeLight);
}
break;
case 2:
if(TimeHelper.timeBetweenHours(18, 6)) { // 6pm to 6am
setTheme(R.style.AppTheme);
}
else {
setTheme(R.style.AppThemeLight);
}
break;
default:
setTheme(R.style.AppTheme);
break;
}
else {
setTheme(R.style.AppTheme);
}
String appLocale = tinyDb.getString("locale");

View File

@ -4,12 +4,11 @@ import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import org.apache.commons.io.FileUtils;
import org.mian.gitnex.R;
import org.mian.gitnex.adapters.FilesDiffAdapter;
@ -34,7 +33,7 @@ public class FileDiffActivity extends BaseActivity {
private View.OnClickListener onClickListener;
private TextView toolbar_title;
private RecyclerView mRecyclerView;
private ListView mListView;
private ProgressBar mProgressBar;
@Override
@ -60,11 +59,10 @@ public class FileDiffActivity extends BaseActivity {
ImageView closeActivity = findViewById(R.id.close);
toolbar_title = findViewById(R.id.toolbar_title);
mRecyclerView = findViewById(R.id.recyclerView);
mListView = findViewById(R.id.listView);
mProgressBar = findViewById(R.id.progress_bar);
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
mListView.setDivider(null);
toolbar_title.setText(R.string.processingText);
initCloseListener();
@ -113,18 +111,18 @@ public class FileDiffActivity extends BaseActivity {
String[] fileContents_ = level2nd[1].split("@@"); // file info / content part
String fileInfoFinal = fileContents_[0];
String fileContentsFinal = (fileContents_[1]);
StringBuilder fileContentsFinal = new StringBuilder(fileContents_[1]);
if(level2nd.length > 2) {
for (int j = 2; j < level2nd.length; j++) {
fileContentsFinal += (level2nd[j]);
fileContentsFinal.append(level2nd[j]);
}
}
String fileExtension = FileUtils.getExtension(fileNameFinal);
String fileContentsFinalWithBlankLines = fileContentsFinal.replaceAll( ".*@@.*", "" );
String fileContentsFinalWithoutBlankLines = fileContentsFinal.replaceAll( ".*@@.*(\r?\n|\r)?", "" );
String fileContentsFinalWithBlankLines = fileContentsFinal.toString().replaceAll( ".*@@.*", "" );
String fileContentsFinalWithoutBlankLines = fileContentsFinal.toString().replaceAll( ".*@@.*(\r?\n|\r)?", "" );
fileContentsFinalWithoutBlankLines = fileContentsFinalWithoutBlankLines.replaceAll( ".*\\ No newline at end of file.*(\r?\n|\r)?", "" );
fileContentsArray.add(new FileDiffView(fileNameFinal, appUtil.imageExtension(fileExtension), fileInfoFinal, fileContentsFinalWithoutBlankLines));
@ -161,8 +159,8 @@ public class FileDiffActivity extends BaseActivity {
toolbar_title.setText(getResources().getString(R.string.fileDiffViewHeaderSingle, Integer.toString(filesCount)));
}
FilesDiffAdapter adapter = new FilesDiffAdapter(fileContentsArray, getApplicationContext());
mRecyclerView.setAdapter(adapter);
FilesDiffAdapter adapter = new FilesDiffAdapter(FileDiffActivity.this, fileContentsArray);
mListView.setAdapter(adapter);
mProgressBar.setVisibility(View.GONE);

View File

@ -83,20 +83,26 @@ public class ReplyToIssueActivity extends BaseActivity {
replyButton = findViewById(R.id.replyButton);
if(getIntent().getStringExtra("commentAction") != null && getIntent().getStringExtra("commentAction").equals("edit")) {
if(getIntent().getStringExtra("commentBody") != null) {
addComment.setText(getIntent().getStringExtra("commentBody"));
if(getIntent().getBooleanExtra("cursorToEnd", false)) {
addComment.setSelection(addComment.length());
}
}
if(getIntent().getStringExtra("commentAction") != null && getIntent().getStringExtra("commentAction").equals("edit")) {
final String commentId = getIntent().getStringExtra("commentId");
toolbar_title.setText(getResources().getString(R.string.editCommentTitle));
replyButton.setText(getResources().getString(R.string.editCommentButtonText));
replyButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
disableProcessButton();
IssueActions.editIssueComment(ctx, Integer.valueOf(commentId), addComment.getText().toString());
}
replyButton.setOnClickListener(v -> {
disableProcessButton();
IssueActions.editIssueComment(ctx, Integer.parseInt(commentId), addComment.getText().toString());
});
return;

View File

@ -1,138 +1,267 @@
package org.mian.gitnex.adapters;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.graphics.Typeface;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.HorizontalScrollView;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import org.mian.gitnex.R;
import org.mian.gitnex.activities.ReplyToIssueActivity;
import org.mian.gitnex.helpers.DiffTextView;
import org.mian.gitnex.models.FileDiffView;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentSkipListMap;
/**
* Author M M Arif
* Author opyale
*/
public class FilesDiffAdapter extends RecyclerView.Adapter<FilesDiffAdapter.FilesDiffViewHolder> {
public class FilesDiffAdapter extends BaseAdapter {
private List<FileDiffView> dataList;
private Context ctx;
private static Map<Long, View> selectedViews;
private static final int MAXIMUM_LINES = 5000;
static class FilesDiffViewHolder extends RecyclerView.ViewHolder {
private static int COLOR_ADDED;
private static int COLOR_REMOVED;
private static int COLOR_NORMAL;
private static int COLOR_SELECTED;
private static int COLOR_FONT;
private TextView fileContents;
private TextView fileName;
private TextView fileInfo;
private ImageView fileImage;
private HorizontalScrollView fileContentsView;
private LinearLayout allLines;
private Context context;
private List<FileDiffView> fileDiffViews;
private FilesDiffViewHolder(View itemView) {
super(itemView);
public FilesDiffAdapter(Context context, List<FileDiffView> fileDiffViews) {
fileContents = itemView.findViewById(R.id.fileContents);
fileName = itemView.findViewById(R.id.fileName);
fileInfo = itemView.findViewById(R.id.fileInfo);
fileImage = itemView.findViewById(R.id.fileImage);
fileContentsView = itemView.findViewById(R.id.fileContentsView);
allLines = itemView.findViewById(R.id.allLinesLayout);
this.context = context;
this.fileDiffViews = fileDiffViews;
}
}
selectedViews = new ConcurrentSkipListMap<>();
public FilesDiffAdapter(List<FileDiffView> dataListMain, Context ctx) {
this.dataList = dataListMain;
this.ctx = ctx;
}
COLOR_ADDED = getColorFromAttribute(R.attr.diffAddedColor);
COLOR_REMOVED = getColorFromAttribute(R.attr.diffRemovedColor);
COLOR_NORMAL = getColorFromAttribute(R.attr.primaryBackgroundColor);
COLOR_SELECTED = getColorFromAttribute(R.attr.diffSelectedColor);
COLOR_FONT = getColorFromAttribute(R.attr.inputTextColor);
@NonNull
@Override
public FilesDiffAdapter.FilesDiffViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_files_diffs, parent, false);
return new FilesDiffAdapter.FilesDiffViewHolder(v);
}
}
@Override
public void onBindViewHolder(@NonNull FilesDiffViewHolder holder, int position) {
@Override
public int getCount() {
FileDiffView data = dataList.get(position);
return fileDiffViews.size();
}
if(data.isFileType()) {
@Override
public Object getItem(int position) {
holder.fileName.setText(data.getFileName());
return fileDiffViews.get(position);
}
holder.fileInfo.setVisibility(View.GONE);
@Override
public long getItemId(int position) {
//byte[] imageData = Base64.decode(data.getFileContents(), Base64.DEFAULT);
//Drawable imageDrawable = new BitmapDrawable(ctx.getResources(), BitmapFactory.decodeByteArray(imageData, 0, imageData.length));
//holder.fileImage.setImageDrawable(imageDrawable);
holder.fileContentsView.setVisibility(View.GONE);
return position;
}
}
else {
@SuppressLint({"ViewHolder", "InflateParams"})
@Override
public View getView(int position, View convertView, ViewGroup parent) {
String[] splitData = data.getFileContents().split("\\R");
convertView = LayoutInflater.from(context).inflate(R.layout.list_files_diffs, null, false);
for (String eachSplit : splitData) {
TextView headerFileName = convertView.findViewById(R.id.headerFileName);
TextView headerFileInfo = convertView.findViewById(R.id.headerFileInfo);
ImageView footerImage = convertView.findViewById(R.id.footerImage);
LinearLayout diffStats = convertView.findViewById(R.id.diff_stats);
LinearLayout diffLines = convertView.findViewById(R.id.diffLines);
TextView textLine = new TextView(ctx);
textLine.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
FileDiffView data = (FileDiffView) getItem(position);
headerFileName.setText(data.getFileName());
if (eachSplit.startsWith("+")) {
if(data.isFileType()) {
textLine.setText(eachSplit);
holder.allLines.addView(textLine);
diffStats.setVisibility(View.GONE);
diffLines.addView(getMessageView(context.getResources().getString(R.string.binaryFileError)));
textLine.setTextColor(ctx.getResources().getColor(R.color.colorPrimary));
textLine.setPadding(5, 5, 5, 5);
textLine.setBackgroundColor(ctx.getResources().getColor(R.color.diffAddedColor));
}
else {
}
else if (eachSplit.startsWith("-")) {
diffStats.setVisibility(View.VISIBLE);
headerFileInfo.setText(data.getFileInfo());
textLine.setText(eachSplit);
holder.allLines.addView(textLine);
String[] codeLines = getLines(data.getFileContents());
textLine.setTextColor(ctx.getResources().getColor(R.color.colorPrimary));
textLine.setPadding(5, 5, 5, 5);
textLine.setBackgroundColor(ctx.getResources().getColor(R.color.diffRemovedColor));
if(MAXIMUM_LINES > codeLines.length) {
}
else {
for(int l=0; l<codeLines.length; l++) {
if(eachSplit.length() > 0) {
textLine.setText(eachSplit);
holder.allLines.addView(textLine);
if(codeLines[l].length() > 0) {
textLine.setTextColor(ctx.getResources().getColor(R.color.colorPrimary));
textLine.setPadding(5, 5, 5, 5);
textLine.setBackgroundColor(ctx.getResources().getColor(R.color.white));
}
int uniquePosition = l + (position * MAXIMUM_LINES);
}
DiffTextView diffTextView = new DiffTextView(context);
}
diffTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 15);
diffTextView.setPadding(15, 2, 15, 2);
diffTextView.setTypeface(Typeface.createFromAsset(context.getAssets(), "fonts/sourcecodeproregular.ttf"));
diffTextView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
diffTextView.setPosition(uniquePosition);
holder.fileName.setText(data.getFileName());
if(!data.getFileInfo().equals("")) {
holder.fileInfo.setText(ctx.getResources().getString(R.string.fileDiffInfoChanges, data.getFileInfo()));
}
else {
holder.fileInfo.setVisibility(View.GONE);
}
boolean isSelected = false;
}
for(View view : selectedViews.values()) {
}
if(((DiffTextView) view).getPosition() == uniquePosition) {
@Override
public int getItemCount() {
return dataList.size();
}
diffTextView.setBackgroundColor(COLOR_SELECTED);
isSelected = true;
break;
}
}
}
if(codeLines[l].startsWith("+")) {
diffTextView.setText(codeLines[l]);
diffTextView.setTextColor(COLOR_FONT);
if(!isSelected) {
diffTextView.setInitialBackgroundColor(COLOR_ADDED);
}
}
else if(codeLines[l].startsWith("-")) {
diffTextView.setText(codeLines[l]);
diffTextView.setTextColor(COLOR_FONT);
if(!isSelected) {
diffTextView.setInitialBackgroundColor(COLOR_REMOVED);
}
}
else {
diffTextView.setText(codeLines[l]);
diffTextView.setTextColor(COLOR_FONT);
if(!isSelected) {
diffTextView.setInitialBackgroundColor(COLOR_NORMAL);
}
}
diffTextView.setOnClickListener(v -> {
if(((DiffTextView) v).getCurrentBackgroundColor() != COLOR_SELECTED) {
selectedViews.put(((DiffTextView) v).getPosition(), v);
v.setBackgroundColor(COLOR_SELECTED);
}
else {
selectedViews.remove(((DiffTextView) v).getPosition());
v.setBackgroundColor(((DiffTextView) v).getInitialBackgroundColor());
}
});
diffTextView.setOnLongClickListener(v -> {
if(((DiffTextView) v).getCurrentBackgroundColor() == COLOR_SELECTED) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("```\n");
for(View view : selectedViews.values()) {
stringBuilder.append(((DiffTextView) view).getText());
stringBuilder.append("\n");
}
stringBuilder.append("```\n\n");
selectedViews.clear();
Intent intent = new Intent(context, ReplyToIssueActivity.class);
intent.putExtra("commentBody", stringBuilder.toString());
intent.putExtra("cursorToEnd", true);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
return true;
});
diffLines.addView(diffTextView);
}
}
}
else {
diffLines.addView(getMessageView(context.getResources().getString(R.string.fileTooLarge)));
}
}
return convertView;
}
private TextView getMessageView(String message) {
TextView textView = new TextView(context);
textView.setTextColor(COLOR_FONT);
textView.setBackgroundColor(COLOR_NORMAL);
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14);
textView.setPadding(15, 15, 15, 15);
textView.setTypeface(Typeface.DEFAULT);
textView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
textView.setText(message);
return textView;
}
private String[] getLines(String content) {
return content.split("\\R");
}
private int getColorFromAttribute(int resid) {
TypedValue typedValue = new TypedValue();
context.getTheme().resolveAttribute(resid, typedValue, true);
return typedValue.data;
}
}

View File

@ -0,0 +1,64 @@
package org.mian.gitnex.helpers;
import android.content.Context;
import android.util.AttributeSet;
/**
* Author opyale
*/
public class DiffTextView extends androidx.appcompat.widget.AppCompatTextView {
private int initialBackgroundColor;
private int currentBackgroundColor;
private long position;
public DiffTextView(Context context) {
super(context);
}
public DiffTextView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public DiffTextView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public void setBackgroundColor(int color) {
currentBackgroundColor = color;
super.setBackgroundColor(color);
}
public void setInitialBackgroundColor(int initialBackgroundColor) {
setBackgroundColor(initialBackgroundColor);
this.initialBackgroundColor = initialBackgroundColor;
}
public int getInitialBackgroundColor() {
return initialBackgroundColor;
}
public int getCurrentBackgroundColor() {
return currentBackgroundColor;
}
public long getPosition() {
return position;
}
public void setPosition(int position) {
this.position = position;
}
}

View File

@ -21,8 +21,8 @@
<ImageView
android:id="@+id/close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="@dimen/close_button_size"
android:layout_height="@dimen/close_button_size"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:gravity="center_vertical"

View File

@ -23,8 +23,8 @@
<ImageView
android:id="@+id/close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="@dimen/close_button_size"
android:layout_height="@dimen/close_button_size"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:gravity="center_vertical"

View File

@ -22,8 +22,8 @@
<ImageView
android:id="@+id/close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="@dimen/close_button_size"
android:layout_height="@dimen/close_button_size"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:gravity="center_vertical"

View File

@ -22,8 +22,8 @@
<ImageView
android:id="@+id/close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="@dimen/close_button_size"
android:layout_height="@dimen/close_button_size"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:gravity="center_vertical"

View File

@ -21,8 +21,8 @@
<ImageView
android:id="@+id/close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="@dimen/close_button_size"
android:layout_height="@dimen/close_button_size"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:gravity="center_vertical"

View File

@ -22,8 +22,8 @@
<ImageView
android:id="@+id/close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="@dimen/close_button_size"
android:layout_height="@dimen/close_button_size"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:gravity="center_vertical"

View File

@ -22,8 +22,8 @@
<ImageView
android:id="@+id/close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="@dimen/close_button_size"
android:layout_height="@dimen/close_button_size"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:gravity="center_vertical"

View File

@ -21,8 +21,8 @@
<ImageView
android:id="@+id/close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="@dimen/close_button_size"
android:layout_height="@dimen/close_button_size"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:gravity="center_vertical"

View File

@ -22,8 +22,8 @@
<ImageView
android:id="@+id/close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="@dimen/close_button_size"
android:layout_height="@dimen/close_button_size"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:gravity="center_vertical"

View File

@ -22,8 +22,8 @@
<ImageView
android:id="@+id/close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="@dimen/close_button_size"
android:layout_height="@dimen/close_button_size"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:gravity="center_vertical"

View File

@ -22,8 +22,8 @@
<ImageView
android:id="@+id/close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="@dimen/close_button_size"
android:layout_height="@dimen/close_button_size"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:gravity="center_vertical"
@ -53,12 +53,11 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
<ListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/primaryBackgroundColor"
android:padding="4dp"
android:scrollbars="vertical" />
</LinearLayout>
@ -66,9 +65,10 @@
<ProgressBar
android:id="@+id/progress_bar"
style="@style/Base.Widget.AppCompat.ProgressBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:indeterminate="true"
android:visibility="gone" />
android:visibility="visible" />
</LinearLayout>

View File

@ -22,8 +22,8 @@
<ImageView
android:id="@+id/close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="@dimen/close_button_size"
android:layout_height="@dimen/close_button_size"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:gravity="center_vertical"

View File

@ -22,8 +22,8 @@
<ImageView
android:id="@+id/close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="@dimen/close_button_size"
android:layout_height="@dimen/close_button_size"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:gravity="center_vertical"

View File

@ -22,8 +22,8 @@
<ImageView
android:id="@+id/close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="@dimen/close_button_size"
android:layout_height="@dimen/close_button_size"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:gravity="center_vertical"

View File

@ -22,8 +22,8 @@
<ImageView
android:id="@+id/close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="@dimen/close_button_size"
android:layout_height="@dimen/close_button_size"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:gravity="center_vertical"

View File

@ -22,8 +22,8 @@
<ImageView
android:id="@+id/close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="@dimen/close_button_size"
android:layout_height="@dimen/close_button_size"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:gravity="center_vertical"

View File

@ -22,8 +22,8 @@
<ImageView
android:id="@+id/close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="@dimen/close_button_size"
android:layout_height="@dimen/close_button_size"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:gravity="center_vertical"

View File

@ -21,8 +21,8 @@
<ImageView
android:id="@+id/close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="@dimen/close_button_size"
android:layout_height="@dimen/close_button_size"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:gravity="center_vertical"

View File

@ -21,8 +21,8 @@
<ImageView
android:id="@+id/close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="@dimen/close_button_size"
android:layout_height="@dimen/close_button_size"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:gravity="center_vertical"

View File

@ -22,8 +22,8 @@
<ImageView
android:id="@+id/close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="@dimen/close_button_size"
android:layout_height="@dimen/close_button_size"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:gravity="center_vertical"

View File

@ -21,8 +21,8 @@
<ImageView
android:id="@+id/close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="@dimen/close_button_size"
android:layout_height="@dimen/close_button_size"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:gravity="center_vertical"

View File

@ -21,8 +21,8 @@
<ImageView
android:id="@+id/close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="@dimen/close_button_size"
android:layout_height="@dimen/close_button_size"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:gravity="center_vertical"

View File

@ -23,8 +23,8 @@
<ImageView
android:id="@+id/close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="@dimen/close_button_size"
android:layout_height="@dimen/close_button_size"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:gravity="center_vertical"

View File

@ -24,8 +24,8 @@
<ImageView
android:id="@+id/close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="@dimen/close_button_size"
android:layout_height="@dimen/close_button_size"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:gravity="center_vertical"

View File

@ -24,8 +24,8 @@
<ImageView
android:id="@+id/close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="@dimen/close_button_size"
android:layout_height="@dimen/close_button_size"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:gravity="center_vertical"

View File

@ -24,8 +24,8 @@
<ImageView
android:id="@+id/close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="@dimen/close_button_size"
android:layout_height="@dimen/close_button_size"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:gravity="center_vertical"

View File

@ -23,8 +23,8 @@
<ImageView
android:id="@+id/close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="@dimen/close_button_size"
android:layout_height="@dimen/close_button_size"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:gravity="center_vertical"

View File

@ -22,8 +22,8 @@
<ImageView
android:id="@+id/close"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_width="@dimen/close_button_size"
android:layout_height="@dimen/close_button_size"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:gravity="center_vertical"

View File

@ -1,72 +1,108 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout 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="wrap_content"
android:id="@+id/singleDiffView"
android:paddingStart="2dp"
android:paddingEnd="2dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:background="?attr/primaryBackgroundColor"
android:orientation="vertical">
<TextView
android:id="@+id/fileName"
<LinearLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?attr/primaryTextColor"
android:textSize="14sp"
android:padding="5dp"
android:background="@color/lightBlue" />
android:layout_height="match_parent"
android:background="?attr/primaryBackgroundColor"
android:orientation="vertical"
android:paddingLeft="15dp"
android:paddingTop="7dp"
android:paddingRight="15dp"
android:paddingBottom="7dp">
<TextView
android:id="@+id/fileInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?attr/primaryTextColor"
android:textSize="14sp"
android:paddingBottom="5dp"
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:background="@color/lightBlue" />
<HorizontalScrollView
android:id="@+id/fileContentsView"
android:layout_width="match_parent"
android:fillViewport="true"
android:layout_height="match_parent">
<TextView
android:id="@+id/headerFileName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="start"
android:fontFamily="monospace"
android:singleLine="true"
android:textColor="?attr/primaryTextColor"
android:textSize="16sp" />
<LinearLayout
android:id="@+id/allLinesLayout"
android:layout_width="wrap_content"
android:id="@+id/diff_stats"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:layout_width="16dp"
android:layout_height="5dp"
android:layout_marginRight="10dp"
android:background="@color/darkGreen"
android:orientation="horizontal">
<Space
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:background="@color/colorRed"
android:orientation="horizontal" />
</LinearLayout>
<TextView
android:id="@+id/headerFileInfo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="monospace"
android:textColor="?attr/primaryTextColor"
android:textSize="12sp" />
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
<TextView
android:id="@+id/fileContents"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?attr/primaryBackgroundColor"
android:textSize="14sp"
android:paddingTop="5dp"
android:paddingBottom="15dp"
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:visibility="gone"
android:background="?attr/primaryTextColor" />
<ImageView
android:id="@+id/fileImage"
<View
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="15dp"
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:contentDescription="@string/generalImgContentText"
android:visibility="gone" />
android:layout_height="1dp"
android:background="?attr/dividerColor" />
<LinearLayout
android:id="@+id/footer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/footerImage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:visibility="gone" />
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
tools:visibility="visible">
<LinearLayout
android:id="@+id/diffLines"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"/>
</HorizontalScrollView>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dividerColor" />
</LinearLayout>

View File

@ -8,6 +8,9 @@
<item name="colorAccent">@color/colorAccent</item>
<item name="android:textColorSecondary">@color/lightThemeTextColor</item>
<item name="diffAddedColor">@color/lightThemeDiffAddedColor</item>
<item name="diffRemovedColor">@color/lightThemeDiffRemovedColor</item>
<item name="diffSelectedColor">@color/lightThemeDiffSelectedColor</item>
<item name="primaryTextColor">@color/lightThemeTextColor</item>
<item name="primaryBackgroundColor">@color/lightThemeBackground</item>
<item name="inputBackgroundColor">@color/lightThemeInputBackground</item>

View File

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr name="diffAddedColor" format="reference"/>
<attr name="diffRemovedColor" format="reference"/>
<attr name="diffSelectedColor" format="reference"/>
<attr name="primaryTextColor" format="reference"/>
<attr name="primaryBackgroundColor" format="reference" />
<attr name="inputBackgroundColor" format="reference" />

View File

@ -26,11 +26,15 @@
<color name="lightGray">#b6bbbf</color>
<color name="darkGreen">#368f73</color>
<color name="lightDimGreen">#63fdd9</color>
<color name="diffRemovedColor">#ffe0e0</color>
<color name="diffAddedColor">#d6fcd6</color>
<color name="diffRemovedColor">#574343</color>
<color name="diffAddedColor">#485A4B</color>
<color name="diffSelectedColor">#434343</color>
<color name="dividerColorDark">#1d1d1d</color>
<color name="lightYellow">#efd34a</color>
<color name="lightThemeDiffRemovedColor">#FCEDED</color>
<color name="lightThemeDiffAddedColor">#EAF8ED</color>
<color name="lightThemeDiffSelectedColor">#e0e0e0</color>
<color name="lightThemeTextColor">#646565</color>
<color name="lightThemeBackground">#f9f9f9</color>
<color name="lightThemeInputBackground">#b6bbbf</color>

View File

@ -6,6 +6,7 @@
<dimen name="tooltipCornor">5dp</dimen>
<dimen name="fab_margin">16dp</dimen>
<dimen name="close_button_size">26dp</dimen>
<dimen name="fab_padding">15dp</dimen>
<dimen name="appbar_padding_top">8dp</dimen>
</resources>

View File

@ -121,6 +121,9 @@
<string name="orgCreatedError">Something went wrong, please try again</string>
<string name="orgExistsError">Organization already exists</string>
<string name="binaryFileError">Binary files are not supported yet.</string>
<string name="fileTooLarge">This file exceeds the maximum possible diff lines.</string>
<string name="processingText">Processing</string>
<string name="search">Search</string>
<string name="wip">Work in progress</string>

View File

@ -8,6 +8,9 @@
<item name="colorAccent">@color/colorAccent</item>
<item name="android:textColorSecondary">@color/colorWhite</item>
<item name="diffAddedColor">@color/diffAddedColor</item>
<item name="diffRemovedColor">@color/diffRemovedColor</item>
<item name="diffSelectedColor">@color/diffSelectedColor</item>
<item name="primaryTextColor">@color/colorWhite</item>
<item name="primaryBackgroundColor">@color/colorPrimary</item>
<item name="inputBackgroundColor">@color/inputBackground</item>
@ -31,6 +34,9 @@
<item name="colorAccent">@color/colorAccent</item>
<item name="android:textColorSecondary">@color/lightThemeTextColor</item>
<item name="diffAddedColor">@color/lightThemeDiffAddedColor</item>
<item name="diffRemovedColor">@color/lightThemeDiffRemovedColor</item>
<item name="diffSelectedColor">@color/lightThemeDiffSelectedColor</item>
<item name="primaryTextColor">@color/lightThemeTextColor</item>
<item name="primaryBackgroundColor">@color/lightThemeBackground</item>
<item name="inputBackgroundColor">@color/lightThemeInputBackground</item>