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;