mirror of https://codeberg.org/gitnex/GitNex.git
Refactor file create/edit screen
This commit is contained in:
parent
a23c60907e
commit
f07b2e40bd
|
@ -2,15 +2,13 @@ package org.mian.gitnex.activities;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.os.Handler;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.TextView;
|
|
||||||
import androidx.activity.result.ActivityResultLauncher;
|
import androidx.activity.result.ActivityResultLauncher;
|
||||||
import androidx.activity.result.contract.ActivityResultContracts;
|
import androidx.activity.result.contract.ActivityResultContracts;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
@ -29,8 +27,7 @@ import org.mian.gitnex.clients.RetrofitClient;
|
||||||
import org.mian.gitnex.databinding.ActivityCreateFileBinding;
|
import org.mian.gitnex.databinding.ActivityCreateFileBinding;
|
||||||
import org.mian.gitnex.helpers.AlertDialogs;
|
import org.mian.gitnex.helpers.AlertDialogs;
|
||||||
import org.mian.gitnex.helpers.AppUtil;
|
import org.mian.gitnex.helpers.AppUtil;
|
||||||
import org.mian.gitnex.helpers.NetworkStatusObserver;
|
import org.mian.gitnex.helpers.SnackBar;
|
||||||
import org.mian.gitnex.helpers.Toasty;
|
|
||||||
import org.mian.gitnex.helpers.contexts.RepositoryContext;
|
import org.mian.gitnex.helpers.contexts.RepositoryContext;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
import retrofit2.Callback;
|
||||||
|
@ -72,16 +69,14 @@ public class CreateFileActivity extends BaseActivity {
|
||||||
|
|
||||||
repository = RepositoryContext.fromIntent(getIntent());
|
repository = RepositoryContext.fromIntent(getIntent());
|
||||||
|
|
||||||
TextView toolbarTitle = binding.toolbarTitle;
|
binding.topAppBar.setNavigationOnClickListener(v -> finish());
|
||||||
|
|
||||||
binding.newFileName.requestFocus();
|
MenuItem create = binding.topAppBar.getMenu().getItem(0);
|
||||||
|
MenuItem update = binding.topAppBar.getMenu().getItem(1);
|
||||||
|
MenuItem delete = binding.topAppBar.getMenu().getItem(2);
|
||||||
|
update.setVisible(false);
|
||||||
|
delete.setVisible(false);
|
||||||
|
|
||||||
InputMethodManager inputMethodManager =
|
|
||||||
(InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
|
||||||
assert inputMethodManager != null;
|
|
||||||
inputMethodManager.showSoftInput(binding.newFileName, InputMethodManager.SHOW_IMPLICIT);
|
|
||||||
|
|
||||||
binding.close.setOnClickListener(view -> finish());
|
|
||||||
binding.newFileContent.setOnTouchListener(
|
binding.newFileContent.setOnTouchListener(
|
||||||
(touchView, motionEvent) -> {
|
(touchView, motionEvent) -> {
|
||||||
touchView.getParent().requestDisallowInterceptTouchEvent(true);
|
touchView.getParent().requestDisallowInterceptTouchEvent(true);
|
||||||
|
@ -103,12 +98,13 @@ public class CreateFileActivity extends BaseActivity {
|
||||||
filePath = getIntent().getStringExtra("filePath");
|
filePath = getIntent().getStringExtra("filePath");
|
||||||
fileSha = getIntent().getStringExtra("fileSha");
|
fileSha = getIntent().getStringExtra("fileSha");
|
||||||
|
|
||||||
toolbarTitle.setText(getString(R.string.deleteGenericTitle, filePath));
|
binding.topAppBar.setTitle(getString(R.string.deleteGenericTitle, filePath));
|
||||||
|
|
||||||
binding.newFileCreate.setText(R.string.deleteFile);
|
|
||||||
|
|
||||||
binding.newFileNameLayout.setVisibility(View.GONE);
|
binding.newFileNameLayout.setVisibility(View.GONE);
|
||||||
binding.newFileContentLayout.setVisibility(View.GONE);
|
binding.newFileContentLayout.setVisibility(View.GONE);
|
||||||
|
delete.setVisible(true);
|
||||||
|
create.setVisible(false);
|
||||||
|
update.setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getIntent().getStringExtra("filePath") != null
|
if (getIntent().getStringExtra("filePath") != null
|
||||||
|
@ -118,20 +114,20 @@ public class CreateFileActivity extends BaseActivity {
|
||||||
filePath = getIntent().getStringExtra("filePath");
|
filePath = getIntent().getStringExtra("filePath");
|
||||||
fileSha = getIntent().getStringExtra("fileSha");
|
fileSha = getIntent().getStringExtra("fileSha");
|
||||||
|
|
||||||
toolbarTitle.setText(getString(R.string.editFileText, filePath));
|
binding.topAppBar.setTitle(getString(R.string.editFileText, filePath));
|
||||||
|
|
||||||
binding.newFileCreate.setText(R.string.editFile);
|
|
||||||
binding.newFileName.setText(filePath);
|
binding.newFileName.setText(filePath);
|
||||||
binding.newFileName.setEnabled(false);
|
binding.newFileName.setEnabled(false);
|
||||||
binding.newFileName.setFocusable(false);
|
binding.newFileName.setFocusable(false);
|
||||||
|
|
||||||
binding.newFileContent.setText(getIntent().getStringExtra("fileContents"));
|
binding.newFileContent.setText(getIntent().getStringExtra("fileContents"));
|
||||||
|
update.setVisible(true);
|
||||||
|
create.setVisible(false);
|
||||||
|
delete.setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
getBranches(repository.getOwner(), repository.getName());
|
getBranches(repository.getOwner(), repository.getName());
|
||||||
|
|
||||||
disableProcessButton();
|
|
||||||
|
|
||||||
binding.openCodeEditor.setOnClickListener(
|
binding.openCodeEditor.setOnClickListener(
|
||||||
v ->
|
v ->
|
||||||
launchCodeEditorActivityForResult(
|
launchCodeEditorActivityForResult(
|
||||||
|
@ -139,13 +135,23 @@ public class CreateFileActivity extends BaseActivity {
|
||||||
FilenameUtils.getExtension(
|
FilenameUtils.getExtension(
|
||||||
String.valueOf(binding.newFileName.getText()))));
|
String.valueOf(binding.newFileName.getText()))));
|
||||||
|
|
||||||
NetworkStatusObserver networkStatusObserver = NetworkStatusObserver.getInstance(ctx);
|
binding.topAppBar.setOnMenuItemClickListener(
|
||||||
networkStatusObserver.registerNetworkStatusListener(
|
menuItem -> {
|
||||||
hasNetworkConnection ->
|
int id = menuItem.getItemId();
|
||||||
runOnUiThread(
|
|
||||||
() -> binding.newFileCreate.setEnabled(hasNetworkConnection)));
|
|
||||||
|
|
||||||
binding.newFileCreate.setOnClickListener(v -> processNewFile());
|
if (id == R.id.create) {
|
||||||
|
processNewFile();
|
||||||
|
return true;
|
||||||
|
} else if (id == R.id.update) {
|
||||||
|
processNewFile();
|
||||||
|
return true;
|
||||||
|
} else if (id == R.id.delete) {
|
||||||
|
processNewFile();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return super.onOptionsItemSelected(menuItem);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void launchCodeEditorActivityForResult(String fileContent, String fileExtension) {
|
public void launchCodeEditorActivityForResult(String fileContent, String fileExtension) {
|
||||||
|
@ -175,29 +181,39 @@ public class CreateFileActivity extends BaseActivity {
|
||||||
: "";
|
: "";
|
||||||
|
|
||||||
if (!AppUtil.hasNetworkConnection(appCtx)) {
|
if (!AppUtil.hasNetworkConnection(appCtx)) {
|
||||||
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
SnackBar.error(
|
||||||
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.checkNetConnection));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((newFileName.isEmpty() || newFileContent.isEmpty())
|
if (((newFileName.isEmpty() || newFileContent.isEmpty())
|
||||||
&& fileAction != FILE_ACTION_DELETE)
|
&& fileAction != FILE_ACTION_DELETE)
|
||||||
|| newFileCommitMessage.isEmpty()) {
|
|| newFileCommitMessage.isEmpty()) {
|
||||||
Toasty.error(ctx, getString(R.string.newFileRequiredFields));
|
SnackBar.error(
|
||||||
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.newFileRequiredFields));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!AppUtil.checkStringsWithDash(newFileBranchName)) {
|
if (!AppUtil.checkStringsWithDash(newFileBranchName)) {
|
||||||
Toasty.error(ctx, getString(R.string.newFileInvalidBranchName));
|
SnackBar.error(
|
||||||
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.newFileInvalidBranchName));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newFileCommitMessage.length() > 255) {
|
if (newFileCommitMessage.length() > 255) {
|
||||||
Toasty.warning(ctx, getString(R.string.newFileCommitMessageError));
|
SnackBar.error(
|
||||||
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.newFileCommitMessageError));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
disableProcessButton();
|
|
||||||
|
|
||||||
switch (fileAction) {
|
switch (fileAction) {
|
||||||
case FILE_ACTION_CREATE:
|
case FILE_ACTION_CREATE:
|
||||||
createNewFile(
|
createNewFile(
|
||||||
|
@ -264,39 +280,40 @@ public class CreateFileActivity extends BaseActivity {
|
||||||
|
|
||||||
switch (response.code()) {
|
switch (response.code()) {
|
||||||
case 201:
|
case 201:
|
||||||
enableProcessButton();
|
SnackBar.success(
|
||||||
Toasty.success(ctx, getString(R.string.newFileSuccessMessage));
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.newFileSuccessMessage));
|
||||||
Intent result = new Intent();
|
Intent result = new Intent();
|
||||||
result.putExtra("fileModified", true);
|
result.putExtra("fileModified", true);
|
||||||
result.putExtra("fileAction", fileAction);
|
result.putExtra("fileAction", fileAction);
|
||||||
setResult(200, result);
|
setResult(200, result);
|
||||||
RepoDetailActivity.updateFABActions = true;
|
RepoDetailActivity.updateFABActions = true;
|
||||||
finish();
|
new Handler().postDelayed(() -> finish(), 3000);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 401:
|
case 401:
|
||||||
enableProcessButton();
|
|
||||||
AlertDialogs.authorizationTokenRevokedDialog(ctx);
|
AlertDialogs.authorizationTokenRevokedDialog(ctx);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 404:
|
case 404:
|
||||||
enableProcessButton();
|
SnackBar.error(
|
||||||
Toasty.warning(ctx, getString(R.string.apiNotFound));
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.apiNotFound));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
enableProcessButton();
|
SnackBar.error(
|
||||||
Toasty.error(ctx, getString(R.string.genericError));
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.genericError));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@NonNull Call<FileResponse> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<FileResponse> call, @NonNull Throwable t) {}
|
||||||
|
|
||||||
Log.e("onFailure", t.toString());
|
|
||||||
enableProcessButton();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,9 +349,9 @@ public class CreateFileActivity extends BaseActivity {
|
||||||
|
|
||||||
switch (response.code()) {
|
switch (response.code()) {
|
||||||
case 200:
|
case 200:
|
||||||
enableProcessButton();
|
SnackBar.success(
|
||||||
Toasty.info(
|
|
||||||
ctx,
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
getString(
|
getString(
|
||||||
R.string.deleteFileMessage,
|
R.string.deleteFileMessage,
|
||||||
repository.getBranchRef()));
|
repository.getBranchRef()));
|
||||||
|
@ -342,33 +359,32 @@ public class CreateFileActivity extends BaseActivity {
|
||||||
result.putExtra("fileModified", true);
|
result.putExtra("fileModified", true);
|
||||||
result.putExtra("fileAction", fileAction);
|
result.putExtra("fileAction", fileAction);
|
||||||
setResult(200, result);
|
setResult(200, result);
|
||||||
finish();
|
new Handler().postDelayed(() -> finish(), 3000);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 401:
|
case 401:
|
||||||
enableProcessButton();
|
|
||||||
AlertDialogs.authorizationTokenRevokedDialog(ctx);
|
AlertDialogs.authorizationTokenRevokedDialog(ctx);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 404:
|
case 404:
|
||||||
enableProcessButton();
|
SnackBar.error(
|
||||||
Toasty.info(ctx, getString(R.string.apiNotFound));
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.apiNotFound));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
enableProcessButton();
|
SnackBar.error(
|
||||||
Toasty.info(ctx, getString(R.string.genericError));
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.genericError));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(
|
public void onFailure(
|
||||||
@NonNull Call<FileDeleteResponse> call, @NonNull Throwable t) {
|
@NonNull Call<FileDeleteResponse> call, @NonNull Throwable t) {}
|
||||||
|
|
||||||
Log.e("onFailure", t.toString());
|
|
||||||
enableProcessButton();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,38 +422,39 @@ public class CreateFileActivity extends BaseActivity {
|
||||||
|
|
||||||
switch (response.code()) {
|
switch (response.code()) {
|
||||||
case 200:
|
case 200:
|
||||||
enableProcessButton();
|
SnackBar.success(
|
||||||
Toasty.info(ctx, getString(R.string.editFileMessage, branchName));
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.editFileMessage, branchName));
|
||||||
Intent result = new Intent();
|
Intent result = new Intent();
|
||||||
result.putExtra("fileModified", true);
|
result.putExtra("fileModified", true);
|
||||||
result.putExtra("fileAction", fileAction);
|
result.putExtra("fileAction", fileAction);
|
||||||
setResult(200, result);
|
setResult(200, result);
|
||||||
finish();
|
new Handler().postDelayed(() -> finish(), 3000);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 401:
|
case 401:
|
||||||
enableProcessButton();
|
|
||||||
AlertDialogs.authorizationTokenRevokedDialog(ctx);
|
AlertDialogs.authorizationTokenRevokedDialog(ctx);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 404:
|
case 404:
|
||||||
enableProcessButton();
|
SnackBar.error(
|
||||||
Toasty.info(ctx, getString(R.string.apiNotFound));
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.apiNotFound));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
enableProcessButton();
|
SnackBar.error(
|
||||||
Toasty.info(ctx, getString(R.string.genericError));
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.genericError));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@NonNull Call<FileResponse> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<FileResponse> call, @NonNull Throwable t) {}
|
||||||
|
|
||||||
Log.e("onFailure", t.toString());
|
|
||||||
enableProcessButton();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -468,27 +485,14 @@ public class CreateFileActivity extends BaseActivity {
|
||||||
|
|
||||||
binding.newFileBranches.setAdapter(adapter);
|
binding.newFileBranches.setAdapter(adapter);
|
||||||
binding.newFileBranches.setText(repository.getBranchRef(), false);
|
binding.newFileBranches.setText(repository.getBranchRef(), false);
|
||||||
|
|
||||||
enableProcessButton();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@NonNull Call<List<Branch>> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<List<Branch>> call, @NonNull Throwable t) {}
|
||||||
|
|
||||||
Log.e("onFailure", t.toString());
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void disableProcessButton() {
|
|
||||||
binding.newFileCreate.setEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void enableProcessButton() {
|
|
||||||
binding.newFileCreate.setEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
|
@ -12,8 +12,8 @@ import org.mian.gitnex.databinding.ActivitySettingsAppearanceBinding;
|
||||||
import org.mian.gitnex.fragments.SettingsFragment;
|
import org.mian.gitnex.fragments.SettingsFragment;
|
||||||
import org.mian.gitnex.helpers.AppUtil;
|
import org.mian.gitnex.helpers.AppUtil;
|
||||||
import org.mian.gitnex.helpers.FontsOverride;
|
import org.mian.gitnex.helpers.FontsOverride;
|
||||||
|
import org.mian.gitnex.helpers.SnackBar;
|
||||||
import org.mian.gitnex.helpers.TinyDB;
|
import org.mian.gitnex.helpers.TinyDB;
|
||||||
import org.mian.gitnex.helpers.Toasty;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author M M Arif
|
* @author M M Arif
|
||||||
|
@ -106,7 +106,10 @@ public class SettingsAppearanceActivity extends BaseActivity {
|
||||||
activitySettingsAppearanceBinding.switchCounterBadge.setOnCheckedChangeListener(
|
activitySettingsAppearanceBinding.switchCounterBadge.setOnCheckedChangeListener(
|
||||||
(buttonView, isChecked) -> {
|
(buttonView, isChecked) -> {
|
||||||
tinyDB.putBoolean("enableCounterBadges", isChecked);
|
tinyDB.putBoolean("enableCounterBadges", isChecked);
|
||||||
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
SnackBar.success(
|
||||||
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.settingsSave));
|
||||||
});
|
});
|
||||||
activitySettingsAppearanceBinding.counterBadgeFrame.setOnClickListener(
|
activitySettingsAppearanceBinding.counterBadgeFrame.setOnClickListener(
|
||||||
v ->
|
v ->
|
||||||
|
@ -120,7 +123,10 @@ public class SettingsAppearanceActivity extends BaseActivity {
|
||||||
activitySettingsAppearanceBinding.switchLabelsInListBadge.setOnCheckedChangeListener(
|
activitySettingsAppearanceBinding.switchLabelsInListBadge.setOnCheckedChangeListener(
|
||||||
(buttonView, isChecked) -> {
|
(buttonView, isChecked) -> {
|
||||||
tinyDB.putBoolean("showLabelsInList", isChecked);
|
tinyDB.putBoolean("showLabelsInList", isChecked);
|
||||||
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
SnackBar.success(
|
||||||
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.settingsSave));
|
||||||
});
|
});
|
||||||
activitySettingsAppearanceBinding.labelsInListFrame.setOnClickListener(
|
activitySettingsAppearanceBinding.labelsInListFrame.setOnClickListener(
|
||||||
v ->
|
v ->
|
||||||
|
@ -147,10 +153,10 @@ public class SettingsAppearanceActivity extends BaseActivity {
|
||||||
this.recreate();
|
this.recreate();
|
||||||
this.overridePendingTransition(0, 0);
|
this.overridePendingTransition(0, 0);
|
||||||
dialogInterfaceTheme.dismiss();
|
dialogInterfaceTheme.dismiss();
|
||||||
Toasty.success(
|
SnackBar.success(
|
||||||
appCtx,
|
ctx,
|
||||||
getResources()
|
findViewById(android.R.id.content),
|
||||||
.getString(R.string.settingsSave));
|
getString(R.string.settingsSave));
|
||||||
});
|
});
|
||||||
|
|
||||||
materialAlertDialogBuilder.create().show();
|
materialAlertDialogBuilder.create().show();
|
||||||
|
@ -184,10 +190,10 @@ public class SettingsAppearanceActivity extends BaseActivity {
|
||||||
this.recreate();
|
this.recreate();
|
||||||
this.overridePendingTransition(0, 0);
|
this.overridePendingTransition(0, 0);
|
||||||
dialogInterfaceCustomFont.dismiss();
|
dialogInterfaceCustomFont.dismiss();
|
||||||
Toasty.success(
|
SnackBar.success(
|
||||||
appCtx,
|
ctx,
|
||||||
appCtx.getResources()
|
findViewById(android.R.id.content),
|
||||||
.getString(R.string.settingsSave));
|
getString(R.string.settingsSave));
|
||||||
});
|
});
|
||||||
|
|
||||||
materialAlertDialogBuilder.create().show();
|
materialAlertDialogBuilder.create().show();
|
||||||
|
@ -216,10 +222,10 @@ public class SettingsAppearanceActivity extends BaseActivity {
|
||||||
this.recreate();
|
this.recreate();
|
||||||
this.overridePendingTransition(0, 0);
|
this.overridePendingTransition(0, 0);
|
||||||
dialogInterfaceCustomFont.dismiss();
|
dialogInterfaceCustomFont.dismiss();
|
||||||
Toasty.success(
|
SnackBar.success(
|
||||||
appCtx,
|
ctx,
|
||||||
appCtx.getResources()
|
findViewById(android.R.id.content),
|
||||||
.getString(R.string.settingsSave));
|
getString(R.string.settingsSave));
|
||||||
});
|
});
|
||||||
|
|
||||||
materialAlertDialogBuilder.create().show();
|
materialAlertDialogBuilder.create().show();
|
||||||
|
@ -255,10 +261,10 @@ public class SettingsAppearanceActivity extends BaseActivity {
|
||||||
SettingsFragment.refreshParent = true;
|
SettingsFragment.refreshParent = true;
|
||||||
this.overridePendingTransition(0, 0);
|
this.overridePendingTransition(0, 0);
|
||||||
dialogInterface.dismiss();
|
dialogInterface.dismiss();
|
||||||
Toasty.success(
|
SnackBar.success(
|
||||||
appCtx,
|
ctx,
|
||||||
getResources()
|
findViewById(android.R.id.content),
|
||||||
.getString(R.string.settingsSave));
|
getString(R.string.settingsSave));
|
||||||
this.recreate();
|
this.recreate();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -282,7 +288,10 @@ public class SettingsAppearanceActivity extends BaseActivity {
|
||||||
db.putInt("lightThemeTimeMinute", materialTimePicker.getMinute());
|
db.putInt("lightThemeTimeMinute", materialTimePicker.getMinute());
|
||||||
SettingsFragment.refreshParent = true;
|
SettingsFragment.refreshParent = true;
|
||||||
overridePendingTransition(0, 0);
|
overridePendingTransition(0, 0);
|
||||||
Toasty.success(ctx, getString(R.string.settingsSave));
|
SnackBar.success(
|
||||||
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.settingsSave));
|
||||||
recreate();
|
recreate();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -305,7 +314,10 @@ public class SettingsAppearanceActivity extends BaseActivity {
|
||||||
db.putInt("darkThemeTimeMinute", materialTimePicker.getMinute());
|
db.putInt("darkThemeTimeMinute", materialTimePicker.getMinute());
|
||||||
SettingsFragment.refreshParent = true;
|
SettingsFragment.refreshParent = true;
|
||||||
overridePendingTransition(0, 0);
|
overridePendingTransition(0, 0);
|
||||||
Toasty.success(ctx, getString(R.string.settingsSave));
|
SnackBar.success(
|
||||||
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.settingsSave));
|
||||||
recreate();
|
recreate();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
import org.mian.gitnex.R;
|
import org.mian.gitnex.R;
|
||||||
import org.mian.gitnex.databinding.ActivitySettingsCodeEditorBinding;
|
import org.mian.gitnex.databinding.ActivitySettingsCodeEditorBinding;
|
||||||
import org.mian.gitnex.fragments.SettingsFragment;
|
import org.mian.gitnex.fragments.SettingsFragment;
|
||||||
import org.mian.gitnex.helpers.Toasty;
|
import org.mian.gitnex.helpers.SnackBar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author M M Arif
|
* @author M M Arif
|
||||||
|
@ -54,10 +54,10 @@ public class SettingsCodeEditorActivity extends BaseActivity {
|
||||||
this.recreate();
|
this.recreate();
|
||||||
this.overridePendingTransition(0, 0);
|
this.overridePendingTransition(0, 0);
|
||||||
dialogInterfaceColor.dismiss();
|
dialogInterfaceColor.dismiss();
|
||||||
Toasty.success(
|
SnackBar.success(
|
||||||
appCtx,
|
ctx,
|
||||||
getResources()
|
findViewById(android.R.id.content),
|
||||||
.getString(R.string.settingsSave));
|
getString(R.string.settingsSave));
|
||||||
});
|
});
|
||||||
|
|
||||||
materialAlertDialogBuilder.create().show();
|
materialAlertDialogBuilder.create().show();
|
||||||
|
@ -88,10 +88,10 @@ public class SettingsCodeEditorActivity extends BaseActivity {
|
||||||
this.recreate();
|
this.recreate();
|
||||||
this.overridePendingTransition(0, 0);
|
this.overridePendingTransition(0, 0);
|
||||||
dialogInterfaceColor.dismiss();
|
dialogInterfaceColor.dismiss();
|
||||||
Toasty.success(
|
SnackBar.success(
|
||||||
appCtx,
|
ctx,
|
||||||
getResources()
|
findViewById(android.R.id.content),
|
||||||
.getString(R.string.settingsSave));
|
getString(R.string.settingsSave));
|
||||||
});
|
});
|
||||||
|
|
||||||
materialAlertDialogBuilder.create().show();
|
materialAlertDialogBuilder.create().show();
|
||||||
|
@ -130,10 +130,10 @@ public class SettingsCodeEditorActivity extends BaseActivity {
|
||||||
this.recreate();
|
this.recreate();
|
||||||
this.overridePendingTransition(0, 0);
|
this.overridePendingTransition(0, 0);
|
||||||
dialogInterfaceColor.dismiss();
|
dialogInterfaceColor.dismiss();
|
||||||
Toasty.success(
|
SnackBar.success(
|
||||||
appCtx,
|
ctx,
|
||||||
getResources()
|
findViewById(android.R.id.content),
|
||||||
.getString(R.string.settingsSave));
|
getString(R.string.settingsSave));
|
||||||
});
|
});
|
||||||
|
|
||||||
materialAlertDialogBuilder.create().show();
|
materialAlertDialogBuilder.create().show();
|
||||||
|
|
|
@ -7,7 +7,7 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.mian.gitnex.R;
|
import org.mian.gitnex.R;
|
||||||
import org.mian.gitnex.databinding.ActivitySettingsGeneralBinding;
|
import org.mian.gitnex.databinding.ActivitySettingsGeneralBinding;
|
||||||
import org.mian.gitnex.helpers.Toasty;
|
import org.mian.gitnex.helpers.SnackBar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author M M Arif
|
* @author M M Arif
|
||||||
|
@ -115,10 +115,10 @@ public class SettingsGeneralActivity extends BaseActivity {
|
||||||
tinyDB.putInt("homeScreenId", i);
|
tinyDB.putInt("homeScreenId", i);
|
||||||
|
|
||||||
dialogInterfaceHomeScreen.dismiss();
|
dialogInterfaceHomeScreen.dismiss();
|
||||||
Toasty.success(
|
SnackBar.success(
|
||||||
appCtx,
|
ctx,
|
||||||
getResources()
|
findViewById(android.R.id.content),
|
||||||
.getString(R.string.settingsSave));
|
getString(R.string.settingsSave));
|
||||||
});
|
});
|
||||||
|
|
||||||
materialAlertDialogBuilder.create().show();
|
materialAlertDialogBuilder.create().show();
|
||||||
|
@ -153,10 +153,10 @@ public class SettingsGeneralActivity extends BaseActivity {
|
||||||
tinyDB.putInt("defaultScreenId", i);
|
tinyDB.putInt("defaultScreenId", i);
|
||||||
|
|
||||||
dialogInterfaceHomeScreen.dismiss();
|
dialogInterfaceHomeScreen.dismiss();
|
||||||
Toasty.success(
|
SnackBar.success(
|
||||||
appCtx,
|
ctx,
|
||||||
getResources()
|
findViewById(android.R.id.content),
|
||||||
.getString(R.string.settingsSave));
|
getString(R.string.settingsSave));
|
||||||
});
|
});
|
||||||
|
|
||||||
materialAlertDialogBuilder.create().show();
|
materialAlertDialogBuilder.create().show();
|
||||||
|
@ -168,7 +168,10 @@ public class SettingsGeneralActivity extends BaseActivity {
|
||||||
viewBinding.switchTabs.setOnCheckedChangeListener(
|
viewBinding.switchTabs.setOnCheckedChangeListener(
|
||||||
(buttonView, isChecked) -> {
|
(buttonView, isChecked) -> {
|
||||||
tinyDB.putBoolean("useCustomTabs", isChecked);
|
tinyDB.putBoolean("useCustomTabs", isChecked);
|
||||||
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
SnackBar.success(
|
||||||
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.settingsSave));
|
||||||
});
|
});
|
||||||
viewBinding.customTabsFrame.setOnClickListener(
|
viewBinding.customTabsFrame.setOnClickListener(
|
||||||
v -> viewBinding.switchTabs.setChecked(!viewBinding.switchTabs.isChecked()));
|
v -> viewBinding.switchTabs.setChecked(!viewBinding.switchTabs.isChecked()));
|
||||||
|
@ -182,7 +185,10 @@ public class SettingsGeneralActivity extends BaseActivity {
|
||||||
viewBinding.commentsDeletionSwitch.setOnCheckedChangeListener(
|
viewBinding.commentsDeletionSwitch.setOnCheckedChangeListener(
|
||||||
(buttonView, isChecked) -> {
|
(buttonView, isChecked) -> {
|
||||||
tinyDB.putBoolean("draftsCommentsDeletionEnabled", isChecked);
|
tinyDB.putBoolean("draftsCommentsDeletionEnabled", isChecked);
|
||||||
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
SnackBar.success(
|
||||||
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.settingsSave));
|
||||||
});
|
});
|
||||||
viewBinding.enableDraftsCommentsDeletion.setOnClickListener(
|
viewBinding.enableDraftsCommentsDeletion.setOnClickListener(
|
||||||
v ->
|
v ->
|
||||||
|
@ -194,7 +200,10 @@ public class SettingsGeneralActivity extends BaseActivity {
|
||||||
viewBinding.crashReportsSwitch.setOnCheckedChangeListener(
|
viewBinding.crashReportsSwitch.setOnCheckedChangeListener(
|
||||||
(buttonView, isChecked) -> {
|
(buttonView, isChecked) -> {
|
||||||
tinyDB.putBoolean("crashReportingEnabled", isChecked);
|
tinyDB.putBoolean("crashReportingEnabled", isChecked);
|
||||||
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
SnackBar.success(
|
||||||
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.settingsSave));
|
||||||
});
|
});
|
||||||
viewBinding.enableSendReports.setOnClickListener(
|
viewBinding.enableSendReports.setOnClickListener(
|
||||||
v ->
|
v ->
|
||||||
|
|
|
@ -12,7 +12,7 @@ import org.mian.gitnex.R;
|
||||||
import org.mian.gitnex.databinding.ActivitySettingsNotificationsBinding;
|
import org.mian.gitnex.databinding.ActivitySettingsNotificationsBinding;
|
||||||
import org.mian.gitnex.helpers.AppUtil;
|
import org.mian.gitnex.helpers.AppUtil;
|
||||||
import org.mian.gitnex.helpers.Constants;
|
import org.mian.gitnex.helpers.Constants;
|
||||||
import org.mian.gitnex.helpers.Toasty;
|
import org.mian.gitnex.helpers.SnackBar;
|
||||||
import org.mian.gitnex.notifications.Notifications;
|
import org.mian.gitnex.notifications.Notifications;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -82,7 +82,10 @@ public class SettingsNotificationsActivity extends BaseActivity {
|
||||||
viewBinding.pollingDelayFrame);
|
viewBinding.pollingDelayFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
SnackBar.success(
|
||||||
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.settingsSave));
|
||||||
});
|
});
|
||||||
viewBinding.enableNotificationsFrame.setOnClickListener(
|
viewBinding.enableNotificationsFrame.setOnClickListener(
|
||||||
v ->
|
v ->
|
||||||
|
@ -124,10 +127,10 @@ public class SettingsNotificationsActivity extends BaseActivity {
|
||||||
R.string
|
R.string
|
||||||
.pollingDelaySelectedText),
|
.pollingDelaySelectedText),
|
||||||
numberPicker.getValue()));
|
numberPicker.getValue()));
|
||||||
Toasty.success(
|
SnackBar.success(
|
||||||
appCtx,
|
ctx,
|
||||||
getResources()
|
findViewById(android.R.id.content),
|
||||||
.getString(R.string.settingsSave));
|
getString(R.string.settingsSave));
|
||||||
});
|
});
|
||||||
|
|
||||||
materialAlertDialogBuilder.setView(numberPicker);
|
materialAlertDialogBuilder.setView(numberPicker);
|
||||||
|
@ -144,7 +147,10 @@ public class SettingsNotificationsActivity extends BaseActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
tinyDB.putBoolean("notificationsEnableLights", isChecked);
|
tinyDB.putBoolean("notificationsEnableLights", isChecked);
|
||||||
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
SnackBar.success(
|
||||||
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.settingsSave));
|
||||||
});
|
});
|
||||||
viewBinding.enableLightsFrame.setOnClickListener(
|
viewBinding.enableLightsFrame.setOnClickListener(
|
||||||
v ->
|
v ->
|
||||||
|
@ -182,7 +188,10 @@ public class SettingsNotificationsActivity extends BaseActivity {
|
||||||
viewBinding.enableVibrationMode.setOnCheckedChangeListener(
|
viewBinding.enableVibrationMode.setOnCheckedChangeListener(
|
||||||
(buttonView, isChecked) -> {
|
(buttonView, isChecked) -> {
|
||||||
tinyDB.putBoolean("notificationsEnableVibration", isChecked);
|
tinyDB.putBoolean("notificationsEnableVibration", isChecked);
|
||||||
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
SnackBar.success(
|
||||||
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.settingsSave));
|
||||||
});
|
});
|
||||||
viewBinding.enableVibrationFrame.setOnClickListener(
|
viewBinding.enableVibrationFrame.setOnClickListener(
|
||||||
v ->
|
v ->
|
||||||
|
|
|
@ -6,7 +6,6 @@ import static androidx.biometric.BiometricManager.Authenticators.DEVICE_CREDENTI
|
||||||
import android.app.KeyguardManager;
|
import android.app.KeyguardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
|
||||||
import androidx.biometric.BiometricManager;
|
import androidx.biometric.BiometricManager;
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -15,7 +14,7 @@ import org.apache.commons.io.FileUtils;
|
||||||
import org.mian.gitnex.R;
|
import org.mian.gitnex.R;
|
||||||
import org.mian.gitnex.databinding.ActivitySettingsSecurityBinding;
|
import org.mian.gitnex.databinding.ActivitySettingsSecurityBinding;
|
||||||
import org.mian.gitnex.helpers.AppUtil;
|
import org.mian.gitnex.helpers.AppUtil;
|
||||||
import org.mian.gitnex.helpers.Toasty;
|
import org.mian.gitnex.helpers.SnackBar;
|
||||||
import org.mian.gitnex.helpers.ssl.MemorizingTrustManager;
|
import org.mian.gitnex.helpers.ssl.MemorizingTrustManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -78,9 +77,10 @@ public class SettingsSecurityActivity extends BaseActivity {
|
||||||
BIOMETRIC_STRONG | DEVICE_CREDENTIAL)) {
|
BIOMETRIC_STRONG | DEVICE_CREDENTIAL)) {
|
||||||
case BiometricManager.BIOMETRIC_SUCCESS:
|
case BiometricManager.BIOMETRIC_SUCCESS:
|
||||||
tinyDB.putBoolean("biometricStatus", true);
|
tinyDB.putBoolean("biometricStatus", true);
|
||||||
Toasty.success(
|
SnackBar.success(
|
||||||
appCtx,
|
ctx,
|
||||||
getResources().getString(R.string.settingsSave));
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.settingsSave));
|
||||||
break;
|
break;
|
||||||
case BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE:
|
case BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE:
|
||||||
case BiometricManager.BIOMETRIC_ERROR_SECURITY_UPDATE_REQUIRED:
|
case BiometricManager.BIOMETRIC_ERROR_SECURITY_UPDATE_REQUIRED:
|
||||||
|
@ -89,38 +89,45 @@ public class SettingsSecurityActivity extends BaseActivity {
|
||||||
tinyDB.putBoolean("biometricStatus", false);
|
tinyDB.putBoolean("biometricStatus", false);
|
||||||
activitySettingsSecurityBinding.switchBiometric.setChecked(
|
activitySettingsSecurityBinding.switchBiometric.setChecked(
|
||||||
false);
|
false);
|
||||||
Toasty.error(
|
SnackBar.error(
|
||||||
appCtx,
|
ctx,
|
||||||
getResources()
|
findViewById(android.R.id.content),
|
||||||
.getString(R.string.biometricNotSupported));
|
getString(R.string.biometricNotSupported));
|
||||||
break;
|
break;
|
||||||
case BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE:
|
case BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE:
|
||||||
tinyDB.putBoolean("biometricStatus", false);
|
tinyDB.putBoolean("biometricStatus", false);
|
||||||
activitySettingsSecurityBinding.switchBiometric.setChecked(
|
activitySettingsSecurityBinding.switchBiometric.setChecked(
|
||||||
false);
|
false);
|
||||||
Toasty.error(
|
SnackBar.error(
|
||||||
appCtx,
|
ctx,
|
||||||
getResources()
|
findViewById(android.R.id.content),
|
||||||
.getString(R.string.biometricNotAvailable));
|
getString(R.string.biometricNotAvailable));
|
||||||
break;
|
break;
|
||||||
case BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED:
|
case BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED:
|
||||||
tinyDB.putBoolean("biometricStatus", false);
|
tinyDB.putBoolean("biometricStatus", false);
|
||||||
activitySettingsSecurityBinding.switchBiometric.setChecked(
|
activitySettingsSecurityBinding.switchBiometric.setChecked(
|
||||||
false);
|
false);
|
||||||
Toasty.info(
|
SnackBar.info(
|
||||||
appCtx,
|
ctx,
|
||||||
getResources().getString(R.string.enrollBiometric));
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.enrollBiometric));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
tinyDB.putBoolean("biometricStatus", true);
|
tinyDB.putBoolean("biometricStatus", true);
|
||||||
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
SnackBar.success(
|
||||||
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.settingsSave));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
tinyDB.putBoolean("biometricStatus", false);
|
tinyDB.putBoolean("biometricStatus", false);
|
||||||
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
SnackBar.success(
|
||||||
|
ctx,
|
||||||
|
findViewById(android.R.id.content),
|
||||||
|
getString(R.string.settingsSave));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -157,7 +164,7 @@ public class SettingsSecurityActivity extends BaseActivity {
|
||||||
this.overridePendingTransition(0, 0);
|
this.overridePendingTransition(0, 0);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
||||||
Log.e("SettingsSecurity", e.toString());
|
// Log.e("SettingsSecurity", e.toString());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -185,10 +192,10 @@ public class SettingsSecurityActivity extends BaseActivity {
|
||||||
tinyDB.putInt("cacheSizeImagesId", i);
|
tinyDB.putInt("cacheSizeImagesId", i);
|
||||||
|
|
||||||
dialogInterfaceTheme.dismiss();
|
dialogInterfaceTheme.dismiss();
|
||||||
Toasty.success(
|
SnackBar.success(
|
||||||
appCtx,
|
ctx,
|
||||||
getResources()
|
findViewById(android.R.id.content),
|
||||||
.getString(R.string.settingsSave));
|
getString(R.string.settingsSave));
|
||||||
});
|
});
|
||||||
|
|
||||||
materialAlertDialogBuilder.create().show();
|
materialAlertDialogBuilder.create().show();
|
||||||
|
@ -214,10 +221,10 @@ public class SettingsSecurityActivity extends BaseActivity {
|
||||||
tinyDB.putInt("cacheSizeId", i);
|
tinyDB.putInt("cacheSizeId", i);
|
||||||
|
|
||||||
dialogInterfaceTheme.dismiss();
|
dialogInterfaceTheme.dismiss();
|
||||||
Toasty.success(
|
SnackBar.success(
|
||||||
appCtx,
|
ctx,
|
||||||
getResources()
|
findViewById(android.R.id.content),
|
||||||
.getString(R.string.settingsSave));
|
getString(R.string.settingsSave));
|
||||||
});
|
});
|
||||||
|
|
||||||
materialAlertDialogBuilder.create().show();
|
materialAlertDialogBuilder.create().show();
|
||||||
|
|
|
@ -1,55 +1,44 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?attr/primaryBackgroundColor"
|
android:background="?attr/primaryBackgroundColor"
|
||||||
android:orientation="vertical">
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:id="@+id/appbar"
|
android:id="@+id/appBarLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:theme="@style/Widget.AppCompat.SearchView"
|
android:background="?attr/primaryBackgroundColor"
|
||||||
app:elevation="@dimen/dimen0dp">
|
android:fitsSystemWindows="true">
|
||||||
|
|
||||||
<com.google.android.material.appbar.MaterialToolbar
|
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||||
android:id="@+id/toolbar"
|
style="?attr/collapsingToolbarLayoutLargeStyle"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
|
||||||
android:background="?attr/primaryBackgroundColor">
|
android:background="?attr/primaryBackgroundColor"
|
||||||
|
app:contentScrim="?attr/primaryBackgroundColor"
|
||||||
|
android:layout_height="?attr/collapsingToolbarLayoutLargeSize">
|
||||||
|
|
||||||
<ImageView
|
<com.google.android.material.appbar.MaterialToolbar
|
||||||
android:id="@+id/close"
|
android:id="@+id/topAppBar"
|
||||||
android:layout_width="@dimen/dimen26dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/dimen26dp"
|
android:elevation="0dp"
|
||||||
android:layout_marginStart="@dimen/dimen16dp"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:layout_marginEnd="@dimen/dimen16dp"
|
app:title="@string/pageTitleNewFile"
|
||||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
app:layout_collapseMode="pin"
|
||||||
android:clickable="true"
|
app:menu="@menu/file_create_edit_menu"
|
||||||
android:contentDescription="@string/close"
|
app:navigationIcon="@drawable/ic_close" />
|
||||||
android:focusable="true"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:src="@drawable/ic_close"/>
|
|
||||||
|
|
||||||
<TextView
|
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||||
android:id="@+id/toolbarTitle"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:text="@string/pageTitleNewFile"
|
|
||||||
android:textColor="?attr/primaryTextColor"
|
|
||||||
android:textSize="@dimen/dimen20sp"/>
|
|
||||||
|
|
||||||
</com.google.android.material.appbar.MaterialToolbar>
|
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
<ScrollView
|
<androidx.core.widget.NestedScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?attr/primaryBackgroundColor">
|
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -65,7 +54,6 @@
|
||||||
android:layout_marginBottom="@dimen/dimen8dp"
|
android:layout_marginBottom="@dimen/dimen8dp"
|
||||||
android:hint="@string/newFileNameTintCopy"
|
android:hint="@string/newFileNameTintCopy"
|
||||||
android:textColorHint="?attr/hintColor"
|
android:textColorHint="?attr/hintColor"
|
||||||
app:boxBackgroundColor="?attr/inputBackgroundColor"
|
|
||||||
app:boxStrokeErrorColor="@color/darkRed"
|
app:boxStrokeErrorColor="@color/darkRed"
|
||||||
app:endIconMode="clear_text"
|
app:endIconMode="clear_text"
|
||||||
app:endIconTint="?attr/iconsColor"
|
app:endIconTint="?attr/iconsColor"
|
||||||
|
@ -95,7 +83,6 @@
|
||||||
android:layout_marginBottom="@dimen/dimen8dp"
|
android:layout_marginBottom="@dimen/dimen8dp"
|
||||||
android:hint="@string/newFileContentTintCopy"
|
android:hint="@string/newFileContentTintCopy"
|
||||||
android:textColorHint="?attr/hintColor"
|
android:textColorHint="?attr/hintColor"
|
||||||
app:boxBackgroundColor="?attr/inputBackgroundColor"
|
|
||||||
app:boxStrokeErrorColor="@color/darkRed"
|
app:boxStrokeErrorColor="@color/darkRed"
|
||||||
app:endIconMode="clear_text"
|
app:endIconMode="clear_text"
|
||||||
app:endIconTint="?attr/iconsColor"
|
app:endIconTint="?attr/iconsColor"
|
||||||
|
@ -135,7 +122,6 @@
|
||||||
android:layout_marginBottom="@dimen/dimen8dp"
|
android:layout_marginBottom="@dimen/dimen8dp"
|
||||||
android:hint="@string/newFileBranches"
|
android:hint="@string/newFileBranches"
|
||||||
android:textColorHint="?attr/hintColor"
|
android:textColorHint="?attr/hintColor"
|
||||||
app:boxBackgroundColor="?attr/inputBackgroundColor"
|
|
||||||
app:endIconTint="?attr/iconsColor"
|
app:endIconTint="?attr/iconsColor"
|
||||||
app:helperText="@string/newFileEmptyBranchMessage"
|
app:helperText="@string/newFileEmptyBranchMessage"
|
||||||
app:helperTextEnabled="true"
|
app:helperTextEnabled="true"
|
||||||
|
@ -164,7 +150,6 @@
|
||||||
android:layout_marginBottom="@dimen/dimen8dp"
|
android:layout_marginBottom="@dimen/dimen8dp"
|
||||||
android:hint="@string/newFileMessageTintCopy"
|
android:hint="@string/newFileMessageTintCopy"
|
||||||
android:textColorHint="?attr/hintColor"
|
android:textColorHint="?attr/hintColor"
|
||||||
app:boxBackgroundColor="?attr/inputBackgroundColor"
|
|
||||||
app:boxStrokeErrorColor="@color/darkRed"
|
app:boxStrokeErrorColor="@color/darkRed"
|
||||||
app:counterEnabled="true"
|
app:counterEnabled="true"
|
||||||
app:counterMaxLength="255"
|
app:counterMaxLength="255"
|
||||||
|
@ -186,17 +171,8 @@
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
|
||||||
android:id="@+id/newFileCreate"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/dimen54dp"
|
|
||||||
android:layout_marginTop="@dimen/dimen8dp"
|
|
||||||
android:text="@string/newFileButtonCopy"
|
|
||||||
android:textColor="?attr/materialCardBackgroundColor"
|
|
||||||
android:textStyle="bold"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
|
||||||
</LinearLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
|
|
|
@ -124,7 +124,6 @@
|
||||||
android:layout_marginBottom="@dimen/dimen8dp"
|
android:layout_marginBottom="@dimen/dimen8dp"
|
||||||
android:hint="@string/newIssueTitle"
|
android:hint="@string/newIssueTitle"
|
||||||
android:textColorHint="?attr/hintColor"
|
android:textColorHint="?attr/hintColor"
|
||||||
app:boxBackgroundColor="?attr/inputBackgroundColor"
|
|
||||||
app:boxStrokeErrorColor="@color/darkRed"
|
app:boxStrokeErrorColor="@color/darkRed"
|
||||||
app:endIconMode="clear_text"
|
app:endIconMode="clear_text"
|
||||||
app:endIconTint="?attr/iconsColor"
|
app:endIconTint="?attr/iconsColor"
|
||||||
|
@ -151,7 +150,6 @@
|
||||||
android:layout_marginTop="@dimen/dimen8dp"
|
android:layout_marginTop="@dimen/dimen8dp"
|
||||||
android:layout_marginBottom="@dimen/dimen8dp"
|
android:layout_marginBottom="@dimen/dimen8dp"
|
||||||
android:textColorHint="?attr/hintColor"
|
android:textColorHint="?attr/hintColor"
|
||||||
app:boxBackgroundColor="?attr/inputBackgroundColor"
|
|
||||||
app:boxStrokeErrorColor="@color/darkRed"
|
app:boxStrokeErrorColor="@color/darkRed"
|
||||||
app:hintTextColor="?attr/hintColor">
|
app:hintTextColor="?attr/hintColor">
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/create"
|
||||||
|
android:title="@string/newCreateButtonCopy"
|
||||||
|
android:orderInCategory="0"
|
||||||
|
android:contentDescription="@string/newCreateButtonCopy"
|
||||||
|
app:showAsAction="ifRoom" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/update"
|
||||||
|
android:title="@string/menuEditText"
|
||||||
|
android:orderInCategory="1"
|
||||||
|
android:contentDescription="@string/newCreateButtonCopy"
|
||||||
|
app:showAsAction="ifRoom" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/delete"
|
||||||
|
android:title="@string/menuDeleteText"
|
||||||
|
android:orderInCategory="2"
|
||||||
|
android:contentDescription="@string/menuDeleteText"
|
||||||
|
app:showAsAction="ifRoom" />
|
||||||
|
|
||||||
|
</menu>
|
Loading…
Reference in New Issue