Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
63d3c95501 | |||
f111f7f2df | |||
5807d11e8c | |||
4a9bde8731 | |||
f64e23dcc1 | |||
6a9144435e | |||
3c7b505b5b | |||
2064c40c7d | |||
65c0ecaad1 | |||
99925621f1 |
@ -1,33 +1,37 @@
|
|||||||
## # What do you want to address?
|
## # What do you want to address?
|
||||||
(This step is required; examples are shown below)
|
<!-- This step is required; examples are shown below -->
|
||||||
|
|
||||||
- [ ] Bug
|
- [ ] Bug
|
||||||
- [ ] Feature
|
- [ ] Feature
|
||||||
- [ ] Suggestion
|
- [ ] Suggestion
|
||||||
|
|
||||||
## # Describe your matter briefly
|
## # Describe your matter briefly
|
||||||
(This step is required)
|
<!-- This step is required. -->
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
##### What did you expect? <!-- Useful when addressing bugs -->
|
||||||
##### What did you expect? (Useful when addressing bugs)
|
|
||||||
---
|
---
|
||||||
_(This step is optional)_
|
<!-- This step is optional. -->
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
##### Some additional details <!-- Useful, when we are trying to reproduce a bug -->
|
||||||
##### Some additional details (Useful, when we are trying to reproduce a bug)
|
|
||||||
---
|
---
|
||||||
_(This step is optional; an example is shown below)_
|
<!-- This step is optional; an example is shown below -->
|
||||||
|
|
||||||
* The version of **Gitea** you are using:
|
* The version of **Gitea** you are using:
|
||||||
* The version of **GitNex** you are using:
|
* The version of **GitNex** you are using:
|
||||||
* Source of installation(Google play, F-droid, APK):
|
* Source of installation (Play Store, F-Droid, APK):
|
||||||
* Phone **OS** version and model:
|
* Current android version and phone model/manufacturer:
|
||||||
* The type of certificate you are using (self-signed, signed):
|
* The type of certificate your instance is using (self-signed, signed):
|
||||||
* How you used to log in (via password or token):
|
* How you used to log in (via password or token):
|
||||||
|
<br>
|
||||||
|
|
||||||
##### We would appreciate some screenshots or stacktrace's, but this is also not required.
|
##### We would appreciate some screenshots or stacktrace's, but this is also not required.
|
||||||
---
|
---
|
||||||
_(Screenshots and stacktrace's can go here)_
|
<!-- Screenshots and stacktrace's can go here. -->
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
- [ ] I carefully read the [contribution guidelines](https://codeberg.org/GitNex/GitNex/src/branch/master/CONTRIBUTING.md).
|
||||||
|
<br>
|
||||||
|
|
||||||
#### Thank you for your time.
|
#### Thank you for your time.
|
@ -1,8 +1,9 @@
|
|||||||
Please check the following:
|
### Describe what your pull request does and which issue you’re targeting
|
||||||
|
<!-- Create a new issue, if it doesn't exist yet -->
|
||||||
|
<br><br>
|
||||||
|
|
||||||
1. Make sure you are targeting the `master` branch, pull requests on release branches are only allowed for bug fixes.
|
<!-- Make sure you are targeting the master branch, pull requests on release branches are only allowed for bug fixes. -->
|
||||||
2. Read contributing guidelines: [CONTRIBUTING.md](https://gitea.com/GitNex/GitNex/src/branch/master/CONTRIBUTING.md)
|
|
||||||
3. Please follow the [Code-Standards](https://gitea.com/gitnex/GitNex/wiki/Code-Standards)
|
|
||||||
4. Describe what your pull request does and which issue you’re targeting (create one if does not exist)
|
|
||||||
|
|
||||||
**You MUST delete the content above including this line before posting, otherwise your pull request will be invalid.**
|
- [ ] I carefully read the [contribution guidelines](https://codeberg.org/GitNex/GitNex/src/branch/master/CONTRIBUTING.md).
|
||||||
|
- [ ] I'm following the code standards as defined [here](https://codeberg.org/gitnex/GitNex/wiki/Code-Standards).
|
||||||
|
- [ ] By submitting this pull request, I permit GitNex to license my work under the [GNU General Public License v3](https://codeberg.org/GitNex/GitNex/src/branch/master/LICENSE).
|
@ -2,26 +2,35 @@
|
|||||||
|
|
||||||
Please take a few minutes to read this document to make the process of contribution more easy and healthy for all involved.
|
Please take a few minutes to read this document to make the process of contribution more easy and healthy for all involved.
|
||||||
|
|
||||||
## Pull Requests
|
### General
|
||||||
Patches, enhancements, features are always welcome. The PR should focus on the scope of work and avoid many unnecessary commits. Please provide as much detail and context as possible to explain the work submitted.
|
> **Be polite and gentle while commenting or creating new issues to maintain a healthy environment in which __everyone__ is able to feel comfortable.**
|
||||||
|
<br>
|
||||||
|
|
||||||
Please ask if you are not sure about the scope of work to be submitted to avoid waste of time spent on the work.
|
### Issues and Reports
|
||||||
|
Before creating an issue please take a moment and search the repository issues(open/closed) to avoid duplicate issues either it's a bug or feature.
|
||||||
|
In case you want to submit a bug report, please provide as much details as possible to better debug the problem. The important part is how to reproduce the bug and steps to reproduce are appreciated.<br><br>
|
||||||
|
**Note:** Please contact the project directly via [email](mailto:gitnex@swatian.com) if have to share sensitive and security related details.
|
||||||
|
<br>
|
||||||
|
|
||||||
**Code Standards**
|
### Pull Requests
|
||||||
|
Patches, enhancements and features are always welcome.
|
||||||
|
The PR should focus on the scope of work and avoid many unnecessary commits.
|
||||||
|
Please provide as much detail and context as possible to explain the work submitted.
|
||||||
|
|
||||||
|
**Please ask if you are not sure about the scope of work to be submitted to avoid waste of time spent on the work.** (Submit an issue, __before__ submitting a PR)
|
||||||
|
|
||||||
|
**Code Standards**<br><br>
|
||||||
Please follow the code standards, this will help other developers to understand your code too.
|
Please follow the code standards, this will help other developers to understand your code too.
|
||||||
It also helps maintaining the code afterwards.
|
It also helps maintaining the code afterwards.
|
||||||
It is documented in the Wiki: [Code-Standards](https://codeberg.org/gitnex/GitNex/wiki/Code-Standards)
|
It is documented in the Wiki: [Code-Standards](https://codeberg.org/gitnex/GitNex/wiki/Code-Standards)
|
||||||
|
|
||||||
**How to submit a PR**
|
**How to submit a PR (Pull Request)**
|
||||||
Fork this repository. Pull the forked repository from your namespace to your local machine. Create new branch and work on the bug/feature/enhancement you would like to submit. Push it to your forked version. From there create Pull Request(PR) against **master** branch.
|
1. Fork this repository.
|
||||||
|
2. Clone the forked repository from your namespace to your local machine.
|
||||||
|
3. Create a new branch and work on your feature, enhancement or patch.
|
||||||
|
4. Push your commits to your forked version.
|
||||||
|
5. You can now create a PR using the web interface against **master** branch.
|
||||||
|
|
||||||
**IMPORTANT:** By submitting PR, you agree to allow GitNex to license your work under the same license as that used by GitNex.
|
For more information, click [here](http://makeapullrequest.com/).
|
||||||
|
|
||||||
## Issues and Reports
|
**IMPORTANT:** By submitting PR, you agree to allow GitNex to license your work under the same license as that used by GitNex.
|
||||||
*1st of please be polite and gentle while commenting or creating new issue to maintain a healthy environment.*
|
|
||||||
|
|
||||||
Before creating an issue please take a moment and search the repository issues(open/closed) to avoid duplicate issues either it's a bug or feature.
|
|
||||||
|
|
||||||
In case you want to submit a bug report, please provide as much details as possible to better debug the problem. The important part is how to reproduce the bug and steps to reproduce are appreciated.
|
|
||||||
|
|
||||||
**Note:** Please contact the project directly via email(gitnex@swatian.com) if have to share sensitive and security related details.
|
|
@ -11,7 +11,7 @@ GitNex is licensed under GPLv3 License. See the LICENSE file for the full licens
|
|||||||
## Downloads
|
## Downloads
|
||||||
[<img alt='Get it on F-droid' src='https://gitlab.com/fdroid/artwork/raw/master/badge/get-it-on.png' height="80"/>](https://f-droid.org/en/packages/org.mian.gitnex/)
|
[<img alt='Get it on F-droid' src='https://gitlab.com/fdroid/artwork/raw/master/badge/get-it-on.png' height="80"/>](https://f-droid.org/en/packages/org.mian.gitnex/)
|
||||||
[<img alt='Get it on Google Play' src='https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png' height="80"/>](https://play.google.com/store/apps/details?id=org.mian.gitnex.pro)
|
[<img alt='Get it on Google Play' src='https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png' height="80"/>](https://play.google.com/store/apps/details?id=org.mian.gitnex.pro)
|
||||||
[<img alt='Download builds and releases' src='https://codeberg.org/gitnex/GitNex/src/branch/master/assets/apk-badge.png' height="82"/>](https://cloud.swatian.com/s/DN7E5xxtaw4fRbE)
|
[<img alt='Download builds and releases' src='https://codeberg.org/gitnex/GitNex/raw/branch/master/assets/apk-badge.png' height="82"/>](https://cloud.swatian.com/s/DN7E5xxtaw4fRbE)
|
||||||
|
|
||||||
## Note about Gitea version
|
## Note about Gitea version
|
||||||
Please make sure that you are on latest stable release or later for better app experience.
|
Please make sure that you are on latest stable release or later for better app experience.
|
||||||
|
@ -6,8 +6,8 @@ android {
|
|||||||
applicationId "org.mian.gitnex"
|
applicationId "org.mian.gitnex"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
versionCode 327
|
versionCode 328
|
||||||
versionName "3.3.0-rc1"
|
versionName "3.3.0-rc2"
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
@ -89,8 +89,6 @@ public class AssigneesActions {
|
|||||||
|
|
||||||
if(assigneesList_.size() > 0) {
|
if(assigneesList_.size() > 0) {
|
||||||
|
|
||||||
dialogAssignees.show();
|
|
||||||
|
|
||||||
assigneesList.add(new Collaborators(tinyDB.getString("userFullname"), tinyDB.getString("loginUid"), tinyDB.getString("userAvatar")));
|
assigneesList.add(new Collaborators(tinyDB.getString("userFullname"), tinyDB.getString("loginUid"), tinyDB.getString("userAvatar")));
|
||||||
assigneesList.addAll(assigneesList_);
|
assigneesList.addAll(assigneesList_);
|
||||||
}
|
}
|
||||||
|
@ -84,8 +84,6 @@ public class LabelsActions {
|
|||||||
|
|
||||||
if(labelsList_.size() > 0) {
|
if(labelsList_.size() > 0) {
|
||||||
|
|
||||||
dialogLabels.show();
|
|
||||||
|
|
||||||
labelsList.addAll(labelsList_);
|
labelsList.addAll(labelsList_);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -140,14 +140,13 @@ public class AddCollaboratorToRepositoryActivity extends BaseActivity {
|
|||||||
|
|
||||||
mRecyclerView.setAdapter(adapter);
|
mRecyclerView.setAdapter(adapter);
|
||||||
noData.setVisibility(View.GONE);
|
noData.setVisibility(View.GONE);
|
||||||
mProgressBar.setVisibility(View.GONE);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
noData.setVisibility(View.VISIBLE);
|
noData.setVisibility(View.VISIBLE);
|
||||||
mProgressBar.setVisibility(View.GONE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mProgressBar.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initCloseListener() {
|
private void initCloseListener() {
|
||||||
|
@ -76,7 +76,6 @@ public class AddNewAccountActivity extends BaseActivity {
|
|||||||
if(!connToInternet) {
|
if(!connToInternet) {
|
||||||
|
|
||||||
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
@ -144,7 +143,9 @@ public class AddNewAccountActivity extends BaseActivity {
|
|||||||
GiteaVersion version = responseVersion.body();
|
GiteaVersion version = responseVersion.body();
|
||||||
|
|
||||||
assert version != null;
|
assert version != null;
|
||||||
|
|
||||||
if(!Version.valid(version.getVersion())) {
|
if(!Version.valid(version.getVersion())) {
|
||||||
|
|
||||||
Toasty.error(ctx, getResources().getString(R.string.versionUnknown));
|
Toasty.error(ctx, getResources().getString(R.string.versionUnknown));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -170,7 +171,6 @@ public class AddNewAccountActivity extends BaseActivity {
|
|||||||
});
|
});
|
||||||
|
|
||||||
alertDialogBuilder.create().show();
|
alertDialogBuilder.create().show();
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(giteaVersion.lessOrEqual(getString(R.string.versionHigh))) {
|
else if(giteaVersion.lessOrEqual(getString(R.string.versionHigh))) {
|
||||||
|
|
||||||
@ -180,7 +180,6 @@ public class AddNewAccountActivity extends BaseActivity {
|
|||||||
|
|
||||||
Toasty.warning(ctx, getResources().getString(R.string.versionUnsupportedNew));
|
Toasty.warning(ctx, getResources().getString(R.string.versionUnsupportedNew));
|
||||||
login(instanceUrl, loginToken);
|
login(instanceUrl, loginToken);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -193,7 +192,6 @@ public class AddNewAccountActivity extends BaseActivity {
|
|||||||
private void login(String instanceUrl, String loginToken) {
|
private void login(String instanceUrl, String loginToken) {
|
||||||
|
|
||||||
setupNewAccountWithToken(instanceUrl, loginToken);
|
setupNewAccountWithToken(instanceUrl, loginToken);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -81,9 +81,11 @@ public class AddNewTeamMemberActivity extends BaseActivity {
|
|||||||
closeActivity.setOnClickListener(onClickListener);
|
closeActivity.setOnClickListener(onClickListener);
|
||||||
|
|
||||||
if(getIntent().getStringExtra("teamId") != null && !Objects.requireNonNull(getIntent().getStringExtra("teamId")).equals("")) {
|
if(getIntent().getStringExtra("teamId") != null && !Objects.requireNonNull(getIntent().getStringExtra("teamId")).equals("")) {
|
||||||
|
|
||||||
teamId = getIntent().getStringExtra("teamId");
|
teamId = getIntent().getStringExtra("teamId");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
teamId = "0";
|
teamId = "0";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,9 +106,7 @@ public class AddNewTeamMemberActivity extends BaseActivity {
|
|||||||
|
|
||||||
adapter = new UserSearchForTeamMemberAdapter(dataList, ctx, Integer.parseInt(teamId));
|
adapter = new UserSearchForTeamMemberAdapter(dataList, ctx, Integer.parseInt(teamId));
|
||||||
loadUserSearchList(instanceUrl, instanceToken, addNewTeamMember.getText().toString(), loginUid, teamId);
|
loadUserSearchList(instanceUrl, instanceToken, addNewTeamMember.getText().toString(), loginUid, teamId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -141,16 +141,13 @@ public class AddNewTeamMemberActivity extends BaseActivity {
|
|||||||
dataList.addAll(response.body().getData());
|
dataList.addAll(response.body().getData());
|
||||||
mRecyclerView.setAdapter(adapter);
|
mRecyclerView.setAdapter(adapter);
|
||||||
noData.setVisibility(View.GONE);
|
noData.setVisibility(View.GONE);
|
||||||
mProgressBar.setVisibility(View.GONE);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
noData.setVisibility(View.VISIBLE);
|
noData.setVisibility(View.VISIBLE);
|
||||||
mProgressBar.setVisibility(View.GONE);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mProgressBar.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -95,14 +95,14 @@ public class AdminGetUsersActivity extends BaseActivity implements BottomSheetAd
|
|||||||
|
|
||||||
adapter = new AdminGetUsersAdapter(ctx, usersListMain);
|
adapter = new AdminGetUsersAdapter(ctx, usersListMain);
|
||||||
if(adapter.getItemCount() > 0) {
|
if(adapter.getItemCount() > 0) {
|
||||||
|
|
||||||
mRecyclerView.setVisibility(View.VISIBLE);
|
mRecyclerView.setVisibility(View.VISIBLE);
|
||||||
mRecyclerView.setAdapter(adapter);
|
mRecyclerView.setAdapter(adapter);
|
||||||
noDataUsers.setVisibility(View.GONE);
|
noDataUsers.setVisibility(View.GONE);
|
||||||
searchFilter = true;
|
searchFilter = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//adapter.notifyDataSetChanged();
|
|
||||||
//mRecyclerView.setAdapter(adapter);
|
|
||||||
mRecyclerView.setVisibility(View.GONE);
|
mRecyclerView.setVisibility(View.GONE);
|
||||||
noDataUsers.setVisibility(View.VISIBLE);
|
noDataUsers.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
@ -140,6 +140,7 @@ public class AdminGetUsersActivity extends BaseActivity implements BottomSheetAd
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onQueryTextChange(String newText) {
|
public boolean onQueryTextChange(String newText) {
|
||||||
|
|
||||||
adapter.getFilter().filter(newText);
|
adapter.getFilter().filter(newText);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -157,18 +158,21 @@ public class AdminGetUsersActivity extends BaseActivity implements BottomSheetAd
|
|||||||
|
|
||||||
int id = item.getItemId();
|
int id = item.getItemId();
|
||||||
|
|
||||||
switch (id) {
|
if(id == android.R.id.home) {
|
||||||
case android.R.id.home:
|
|
||||||
finish();
|
|
||||||
return true;
|
|
||||||
case R.id.genericMenu:
|
|
||||||
BottomSheetAdminUsersFragment bottomSheet = new BottomSheetAdminUsersFragment();
|
|
||||||
bottomSheet.show(getSupportFragmentManager(), "usersBottomSheet");
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(id == R.id.genericMenu) {
|
||||||
|
|
||||||
|
BottomSheetAdminUsersFragment bottomSheet = new BottomSheetAdminUsersFragment();
|
||||||
|
bottomSheet.show(getSupportFragmentManager(), "usersBottomSheet");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -33,46 +33,48 @@ import static org.acra.ReportField.STACK_TRACE;
|
|||||||
|
|
||||||
public abstract class BaseActivity extends AppCompatActivity {
|
public abstract class BaseActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private Context appCtx;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
||||||
appCtx = getApplicationContext();
|
Context appCtx = getApplicationContext();
|
||||||
final TinyDB tinyDb = new TinyDB(appCtx);
|
final TinyDB tinyDb = new TinyDB(appCtx);
|
||||||
|
|
||||||
switch(tinyDb.getInt("themeId")) {
|
switch(tinyDb.getInt("themeId")) {
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
|
|
||||||
setTheme(R.style.AppThemeLight);
|
setTheme(R.style.AppThemeLight);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
|
|
||||||
if(TimeHelper.timeBetweenHours(18, 6)) { // 6pm to 6am
|
if(TimeHelper.timeBetweenHours(18, 6)) { // 6pm to 6am
|
||||||
|
|
||||||
setTheme(R.style.AppTheme);
|
setTheme(R.style.AppTheme);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
setTheme(R.style.AppThemeLight);
|
setTheme(R.style.AppThemeLight);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
|
|
||||||
setTheme(R.style.AppThemeRetro);
|
setTheme(R.style.AppThemeRetro);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
|
|
||||||
if(TimeHelper.timeBetweenHours(18, 6)) { // 6pm to 6am
|
if(TimeHelper.timeBetweenHours(18, 6)) { // 6pm to 6am
|
||||||
|
|
||||||
setTheme(R.style.AppTheme);
|
setTheme(R.style.AppTheme);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
setTheme(R.style.AppThemeRetro);
|
setTheme(R.style.AppThemeRetro);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
setTheme(R.style.AppTheme);
|
setTheme(R.style.AppTheme);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String appLocale = tinyDb.getString("locale");
|
String appLocale = tinyDb.getString("locale");
|
||||||
@ -84,29 +86,30 @@ public abstract class BaseActivity extends AppCompatActivity {
|
|||||||
switch(tinyDb.getInt("customFontId", -1)) {
|
switch(tinyDb.getInt("customFontId", -1)) {
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
|
|
||||||
FontsOverride.setDefaultFont(this, "DEFAULT", "fonts/roboto.ttf");
|
FontsOverride.setDefaultFont(this, "DEFAULT", "fonts/roboto.ttf");
|
||||||
FontsOverride.setDefaultFont(this, "MONOSPACE", "fonts/roboto.ttf");
|
FontsOverride.setDefaultFont(this, "MONOSPACE", "fonts/roboto.ttf");
|
||||||
FontsOverride.setDefaultFont(this, "SERIF", "fonts/roboto.ttf");
|
FontsOverride.setDefaultFont(this, "SERIF", "fonts/roboto.ttf");
|
||||||
FontsOverride.setDefaultFont(this, "SANS_SERIF", "fonts/roboto.ttf");
|
FontsOverride.setDefaultFont(this, "SANS_SERIF", "fonts/roboto.ttf");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
|
|
||||||
FontsOverride.setDefaultFont(this, "DEFAULT", "fonts/sourcecodeproregular.ttf");
|
FontsOverride.setDefaultFont(this, "DEFAULT", "fonts/sourcecodeproregular.ttf");
|
||||||
FontsOverride.setDefaultFont(this, "MONOSPACE", "fonts/sourcecodeproregular.ttf");
|
FontsOverride.setDefaultFont(this, "MONOSPACE", "fonts/sourcecodeproregular.ttf");
|
||||||
FontsOverride.setDefaultFont(this, "SERIF", "fonts/sourcecodeproregular.ttf");
|
FontsOverride.setDefaultFont(this, "SERIF", "fonts/sourcecodeproregular.ttf");
|
||||||
FontsOverride.setDefaultFont(this, "SANS_SERIF", "fonts/sourcecodeproregular.ttf");
|
FontsOverride.setDefaultFont(this, "SANS_SERIF", "fonts/sourcecodeproregular.ttf");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
FontsOverride.setDefaultFont(this, "DEFAULT", "fonts/manroperegular.ttf");
|
FontsOverride.setDefaultFont(this, "DEFAULT", "fonts/manroperegular.ttf");
|
||||||
FontsOverride.setDefaultFont(this, "MONOSPACE", "fonts/manroperegular.ttf");
|
FontsOverride.setDefaultFont(this, "MONOSPACE", "fonts/manroperegular.ttf");
|
||||||
FontsOverride.setDefaultFont(this, "SERIF", "fonts/manroperegular.ttf");
|
FontsOverride.setDefaultFont(this, "SERIF", "fonts/manroperegular.ttf");
|
||||||
FontsOverride.setDefaultFont(this, "SANS_SERIF", "fonts/manroperegular.ttf");
|
FontsOverride.setDefaultFont(this, "SANS_SERIF", "fonts/manroperegular.ttf");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tinyDb.getInt("pollingDelayMinutes") == 0) {
|
if(tinyDb.getInt("pollingDelayMinutes") == 0) {
|
||||||
|
|
||||||
tinyDb.putInt("pollingDelayMinutes", 15);
|
tinyDb.putInt("pollingDelayMinutes", 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,26 +117,31 @@ public abstract class BaseActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
// enabling counter badges by default
|
// enabling counter badges by default
|
||||||
if(tinyDb.getString("enableCounterBadgesInit").isEmpty()) {
|
if(tinyDb.getString("enableCounterBadgesInit").isEmpty()) {
|
||||||
|
|
||||||
tinyDb.putBoolean("enableCounterBadges", true);
|
tinyDb.putBoolean("enableCounterBadges", true);
|
||||||
tinyDb.putString("enableCounterBadgesInit", "yes");
|
tinyDb.putString("enableCounterBadgesInit", "yes");
|
||||||
}
|
}
|
||||||
|
|
||||||
// enable crash reports by default
|
// enable crash reports by default
|
||||||
if(tinyDb.getString("crashReportingEnabledInit").isEmpty()) {
|
if(tinyDb.getString("crashReportingEnabledInit").isEmpty()) {
|
||||||
|
|
||||||
tinyDb.putBoolean("crashReportingEnabled", true);
|
tinyDb.putBoolean("crashReportingEnabled", true);
|
||||||
tinyDb.putString("crashReportingEnabledInit", "yes");
|
tinyDb.putString("crashReportingEnabledInit", "yes");
|
||||||
}
|
}
|
||||||
|
|
||||||
// default cache setter
|
// default cache setter
|
||||||
if(tinyDb.getString("cacheSizeStr").isEmpty()) {
|
if(tinyDb.getString("cacheSizeStr").isEmpty()) {
|
||||||
|
|
||||||
tinyDb.putString("cacheSizeStr", getResources().getString(R.string.cacheSizeDataSelectionSelectedText));
|
tinyDb.putString("cacheSizeStr", getResources().getString(R.string.cacheSizeDataSelectionSelectedText));
|
||||||
}
|
}
|
||||||
if(tinyDb.getString("cacheSizeImagesStr").isEmpty()) {
|
if(tinyDb.getString("cacheSizeImagesStr").isEmpty()) {
|
||||||
|
|
||||||
tinyDb.putString("cacheSizeImagesStr", getResources().getString(R.string.cacheSizeImagesSelectionSelectedText));
|
tinyDb.putString("cacheSizeImagesStr", getResources().getString(R.string.cacheSizeImagesSelectionSelectedText));
|
||||||
}
|
}
|
||||||
|
|
||||||
// enable comment drafts by default
|
// enable comment drafts by default
|
||||||
if(tinyDb.getString("draftsCommentsDeletionEnabledInit").isEmpty()) {
|
if(tinyDb.getString("draftsCommentsDeletionEnabledInit").isEmpty()) {
|
||||||
|
|
||||||
tinyDb.putBoolean("draftsCommentsDeletionEnabled", true);
|
tinyDb.putBoolean("draftsCommentsDeletionEnabled", true);
|
||||||
tinyDb.putString("draftsCommentsDeletionEnabledInit", "yes");
|
tinyDb.putString("draftsCommentsDeletionEnabledInit", "yes");
|
||||||
}
|
}
|
||||||
@ -145,7 +153,6 @@ public abstract class BaseActivity extends AppCompatActivity {
|
|||||||
ACRABuilder.getPluginConfigurationBuilder(MailSenderConfigurationBuilder.class).setReportAsFile(true).setMailTo(getResources().getString(R.string.appEmail)).setSubject(getResources().getString(R.string.crashReportEmailSubject, AppUtil.getAppBuildNo(getApplicationContext()))).setEnabled(true);
|
ACRABuilder.getPluginConfigurationBuilder(MailSenderConfigurationBuilder.class).setReportAsFile(true).setMailTo(getResources().getString(R.string.appEmail)).setSubject(getResources().getString(R.string.crashReportEmailSubject, AppUtil.getAppBuildNo(getApplicationContext()))).setEnabled(true);
|
||||||
ACRABuilder.getPluginConfigurationBuilder(LimiterConfigurationBuilder.class).setEnabled(true);
|
ACRABuilder.getPluginConfigurationBuilder(LimiterConfigurationBuilder.class).setEnabled(true);
|
||||||
ACRA.init(getApplication(), ACRABuilder);
|
ACRA.init(getApplication(), ACRABuilder);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,6 +96,7 @@ public class CommitsActivity extends BaseActivity {
|
|||||||
|
|
||||||
// if gitea is 1.12 or higher use the new limit (resultLimitNewGiteaInstances)
|
// if gitea is 1.12 or higher use the new limit (resultLimitNewGiteaInstances)
|
||||||
if(new Version(tinyDb.getString("giteaVersion")).higherOrEqual("1.12")) {
|
if(new Version(tinyDb.getString("giteaVersion")).higherOrEqual("1.12")) {
|
||||||
|
|
||||||
resultLimit = StaticGlobalVariables.resultLimitNewGiteaInstances;
|
resultLimit = StaticGlobalVariables.resultLimitNewGiteaInstances;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,7 +108,6 @@ public class CommitsActivity extends BaseActivity {
|
|||||||
swipeRefresh.setRefreshing(false);
|
swipeRefresh.setRefreshing(false);
|
||||||
loadInitial(Authorization.returnAuthentication(ctx, loginUid, instanceToken), repoOwner, repoName, branchName, resultLimit);
|
loadInitial(Authorization.returnAuthentication(ctx, loginUid, instanceToken), repoOwner, repoName, branchName, resultLimit);
|
||||||
adapter.notifyDataChanged();
|
adapter.notifyDataChanged();
|
||||||
|
|
||||||
}, 200));
|
}, 200));
|
||||||
|
|
||||||
adapter = new CommitsAdapter(ctx, commitsList);
|
adapter = new CommitsAdapter(ctx, commitsList);
|
||||||
@ -118,7 +118,6 @@ public class CommitsActivity extends BaseActivity {
|
|||||||
int page = (commitsList.size() + resultLimit) / resultLimit;
|
int page = (commitsList.size() + resultLimit) / resultLimit;
|
||||||
loadMore(Authorization.returnAuthentication(ctx, loginUid, instanceToken), repoOwner, repoName, page, branchName, resultLimit);
|
loadMore(Authorization.returnAuthentication(ctx, loginUid, instanceToken), repoOwner, repoName, page, branchName, resultLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
recyclerView.setHasFixedSize(true);
|
recyclerView.setHasFixedSize(true);
|
||||||
@ -127,7 +126,6 @@ public class CommitsActivity extends BaseActivity {
|
|||||||
|
|
||||||
api = AppApiService.createService(ApiInterface.class, instanceUrl, ctx);
|
api = AppApiService.createService(ApiInterface.class, instanceUrl, ctx);
|
||||||
loadInitial(Authorization.returnAuthentication(ctx, loginUid, instanceToken), repoOwner, repoName, branchName, resultLimit);
|
loadInitial(Authorization.returnAuthentication(ctx, loginUid, instanceToken), repoOwner, repoName, branchName, resultLimit);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadInitial(String token, String repoOwner, String repoName, String branchName, int resultLimit) {
|
private void loadInitial(String token, String repoOwner, String repoName, String branchName, int resultLimit) {
|
||||||
@ -148,7 +146,6 @@ public class CommitsActivity extends BaseActivity {
|
|||||||
commitsList.addAll(response.body());
|
commitsList.addAll(response.body());
|
||||||
adapter.notifyDataChanged();
|
adapter.notifyDataChanged();
|
||||||
noData.setVisibility(View.GONE);
|
noData.setVisibility(View.GONE);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
@ -164,7 +161,6 @@ public class CommitsActivity extends BaseActivity {
|
|||||||
else {
|
else {
|
||||||
|
|
||||||
Log.e(TAG, String.valueOf(response.code()));
|
Log.e(TAG, String.valueOf(response.code()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
@ -211,7 +207,6 @@ public class CommitsActivity extends BaseActivity {
|
|||||||
else {
|
else {
|
||||||
|
|
||||||
Log.e(TAG, String.valueOf(response.code()));
|
Log.e(TAG, String.valueOf(response.code()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
progressLoadMore.setVisibility(View.GONE);
|
progressLoadMore.setVisibility(View.GONE);
|
||||||
@ -255,7 +250,6 @@ public class CommitsActivity extends BaseActivity {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return super.onCreateOptionsMenu(menu);
|
return super.onCreateOptionsMenu(menu);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void filter(String text) {
|
private void filter(String text) {
|
||||||
@ -263,7 +257,9 @@ public class CommitsActivity extends BaseActivity {
|
|||||||
List<Commits> arr = new ArrayList<>();
|
List<Commits> arr = new ArrayList<>();
|
||||||
|
|
||||||
for(Commits d : commitsList) {
|
for(Commits d : commitsList) {
|
||||||
|
|
||||||
if(d.getCommit().getMessage().toLowerCase().contains(text) || d.getSha().toLowerCase().contains(text)) {
|
if(d.getCommit().getMessage().toLowerCase().contains(text) || d.getSha().toLowerCase().contains(text)) {
|
||||||
|
|
||||||
arr.add(d);
|
arr.add(d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -274,6 +270,7 @@ public class CommitsActivity extends BaseActivity {
|
|||||||
private void initCloseListener() {
|
private void initCloseListener() {
|
||||||
|
|
||||||
onClickListener = view -> {
|
onClickListener = view -> {
|
||||||
|
|
||||||
getIntent().removeExtra("branchName");
|
getIntent().removeExtra("branchName");
|
||||||
finish();
|
finish();
|
||||||
};
|
};
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
package org.mian.gitnex.activities;
|
package org.mian.gitnex.activities;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
@ -66,6 +68,7 @@ public class CreateFileActivity extends BaseActivity {
|
|||||||
return R.layout.activity_new_file;
|
return R.layout.activity_new_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
||||||
@ -101,6 +104,17 @@ public class CreateFileActivity extends BaseActivity {
|
|||||||
|
|
||||||
newFileCreate = findViewById(R.id.newFileCreate);
|
newFileCreate = findViewById(R.id.newFileCreate);
|
||||||
|
|
||||||
|
newFileContent.setOnTouchListener((touchView, motionEvent) -> {
|
||||||
|
|
||||||
|
touchView.getParent().requestDisallowInterceptTouchEvent(true);
|
||||||
|
|
||||||
|
if ((motionEvent.getAction() & MotionEvent.ACTION_UP) != 0 && (motionEvent.getActionMasked() & MotionEvent.ACTION_UP) != 0) {
|
||||||
|
|
||||||
|
touchView.getParent().requestDisallowInterceptTouchEvent(false);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
if(getIntent().getStringExtra("filePath") != null && getIntent().getIntExtra("fileAction", 1) == 1) {
|
if(getIntent().getStringExtra("filePath") != null && getIntent().getIntExtra("fileAction", 1) == 1) {
|
||||||
|
|
||||||
fileAction = getIntent().getIntExtra("fileAction", 1);
|
fileAction = getIntent().getIntExtra("fileAction", 1);
|
||||||
@ -158,7 +172,7 @@ public class CreateFileActivity extends BaseActivity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private View.OnClickListener createFileListener = v -> processNewFile();
|
private final View.OnClickListener createFileListener = v -> processNewFile();
|
||||||
|
|
||||||
private void processNewFile() {
|
private void processNewFile() {
|
||||||
|
|
||||||
@ -170,8 +184,6 @@ public class CreateFileActivity extends BaseActivity {
|
|||||||
String newFileBranchName_ = newFileBranchName.getText().toString();
|
String newFileBranchName_ = newFileBranchName.getText().toString();
|
||||||
String newFileCommitMessage_ = newFileCommitMessage.getText().toString();
|
String newFileCommitMessage_ = newFileCommitMessage.getText().toString();
|
||||||
|
|
||||||
//Branches currentBranch = (Branches) newFileBranchesSpinner.getSelectedItem();
|
|
||||||
|
|
||||||
if(!connToInternet) {
|
if(!connToInternet) {
|
||||||
|
|
||||||
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
||||||
@ -187,10 +199,12 @@ public class CreateFileActivity extends BaseActivity {
|
|||||||
if(selectedBranch.equals("No branch")) {
|
if(selectedBranch.equals("No branch")) {
|
||||||
|
|
||||||
if(newFileBranchName_.equals("")) {
|
if(newFileBranchName_.equals("")) {
|
||||||
|
|
||||||
Toasty.error(ctx, getString(R.string.newFileRequiredFieldNewBranchName));
|
Toasty.error(ctx, getString(R.string.newFileRequiredFieldNewBranchName));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
if(!appUtil.checkStringsWithDash(newFileBranchName_)) {
|
if(!appUtil.checkStringsWithDash(newFileBranchName_)) {
|
||||||
|
|
||||||
Toasty.error(ctx, getString(R.string.newFileInvalidBranchName));
|
Toasty.error(ctx, getString(R.string.newFileInvalidBranchName));
|
||||||
@ -255,7 +269,6 @@ public class CreateFileActivity extends BaseActivity {
|
|||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.success(ctx, getString(R.string.newFileSuccessMessage));
|
Toasty.success(ctx, getString(R.string.newFileSuccessMessage));
|
||||||
finish();
|
finish();
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 401) {
|
else if(response.code() == 401) {
|
||||||
|
|
||||||
@ -264,21 +277,20 @@ public class CreateFileActivity extends BaseActivity {
|
|||||||
getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||||
getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
||||||
getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
if(response.code() == 404) {
|
if(response.code() == 404) {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.warning(ctx, getString(R.string.apiNotFound));
|
Toasty.warning(ctx, getString(R.string.apiNotFound));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.error(ctx, getString(R.string.orgCreatedError));
|
Toasty.error(ctx, getString(R.string.orgCreatedError));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -295,6 +307,7 @@ public class CreateFileActivity extends BaseActivity {
|
|||||||
|
|
||||||
String branchName;
|
String branchName;
|
||||||
DeleteFile deleteFileJsonStr;
|
DeleteFile deleteFileJsonStr;
|
||||||
|
|
||||||
if(currentBranch.equals("No branch")) {
|
if(currentBranch.equals("No branch")) {
|
||||||
|
|
||||||
branchName = fileBranchName;
|
branchName = fileBranchName;
|
||||||
@ -345,9 +358,7 @@ public class CreateFileActivity extends BaseActivity {
|
|||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.info(ctx, getString(R.string.genericError));
|
Toasty.info(ctx, getString(R.string.genericError));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -364,6 +375,7 @@ public class CreateFileActivity extends BaseActivity {
|
|||||||
|
|
||||||
String branchName;
|
String branchName;
|
||||||
EditFile editFileJsonStr;
|
EditFile editFileJsonStr;
|
||||||
|
|
||||||
if(currentBranch.equals("No branch")) {
|
if(currentBranch.equals("No branch")) {
|
||||||
|
|
||||||
branchName = fileBranchName;
|
branchName = fileBranchName;
|
||||||
@ -415,9 +427,7 @@ public class CreateFileActivity extends BaseActivity {
|
|||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.info(ctx, getString(R.string.genericError));
|
Toasty.info(ctx, getString(R.string.genericError));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -443,20 +453,20 @@ public class CreateFileActivity extends BaseActivity {
|
|||||||
public void onResponse(@NonNull Call<List<Branches>> call, @NonNull retrofit2.Response<List<Branches>> response) {
|
public void onResponse(@NonNull Call<List<Branches>> call, @NonNull retrofit2.Response<List<Branches>> response) {
|
||||||
|
|
||||||
if(response.isSuccessful()) {
|
if(response.isSuccessful()) {
|
||||||
|
|
||||||
if(response.code() == 200) {
|
if(response.code() == 200) {
|
||||||
|
|
||||||
List<Branches> branchesList_ = response.body();
|
List<Branches> branchesList_ = response.body();
|
||||||
|
|
||||||
branchesList.add(new Branches("No branch"));
|
branchesList.add(new Branches("No branch"));
|
||||||
assert branchesList_ != null;
|
assert branchesList_ != null;
|
||||||
|
|
||||||
if(branchesList_.size() > 0) {
|
if(branchesList_.size() > 0) {
|
||||||
|
|
||||||
for (int i = 0; i < branchesList_.size(); i++) {
|
for (int i = 0; i < branchesList_.size(); i++) {
|
||||||
|
|
||||||
Branches data = new Branches(
|
Branches data = new Branches(branchesList_.get(i).getName());
|
||||||
branchesList_.get(i).getName()
|
|
||||||
);
|
|
||||||
branchesList.add(data);
|
branchesList.add(data);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -483,10 +493,8 @@ public class CreateFileActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package org.mian.gitnex.activities;
|
package org.mian.gitnex.activities;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.app.DatePickerDialog;
|
import android.app.DatePickerDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -7,6 +8,7 @@ import android.graphics.Color;
|
|||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
@ -79,6 +81,7 @@ public class CreateIssueActivity extends BaseActivity implements View.OnClickLis
|
|||||||
return R.layout.activity_create_issue;
|
return R.layout.activity_create_issue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
||||||
@ -113,6 +116,17 @@ public class CreateIssueActivity extends BaseActivity implements View.OnClickLis
|
|||||||
assert imm != null;
|
assert imm != null;
|
||||||
imm.showSoftInput(viewBinding.newIssueTitle, InputMethodManager.SHOW_IMPLICIT);
|
imm.showSoftInput(viewBinding.newIssueTitle, InputMethodManager.SHOW_IMPLICIT);
|
||||||
|
|
||||||
|
viewBinding.newIssueDescription.setOnTouchListener((touchView, motionEvent) -> {
|
||||||
|
|
||||||
|
touchView.getParent().requestDisallowInterceptTouchEvent(true);
|
||||||
|
|
||||||
|
if ((motionEvent.getAction() & MotionEvent.ACTION_UP) != 0 && (motionEvent.getActionMasked() & MotionEvent.ACTION_UP) != 0) {
|
||||||
|
|
||||||
|
touchView.getParent().requestDisallowInterceptTouchEvent(false);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
labelsAdapter = new LabelsListAdapter(labelsList, CreateIssueActivity.this, labelsIds);
|
labelsAdapter = new LabelsListAdapter(labelsList, CreateIssueActivity.this, labelsIds);
|
||||||
assigneesAdapter = new AssigneesListAdapter(ctx, assigneesList, CreateIssueActivity.this, assigneesListData);
|
assigneesAdapter = new AssigneesListAdapter(ctx, assigneesList, CreateIssueActivity.this, assigneesListData);
|
||||||
|
|
||||||
@ -127,13 +141,9 @@ public class CreateIssueActivity extends BaseActivity implements View.OnClickLis
|
|||||||
|
|
||||||
disableProcessButton();
|
disableProcessButton();
|
||||||
|
|
||||||
viewBinding.newIssueLabels.setOnClickListener(newIssueLabels ->
|
viewBinding.newIssueLabels.setOnClickListener(newIssueLabels -> showLabels());
|
||||||
showLabels()
|
|
||||||
);
|
|
||||||
|
|
||||||
viewBinding.newIssueAssigneesList.setOnClickListener(newIssueAssigneesList ->
|
viewBinding.newIssueAssigneesList.setOnClickListener(newIssueAssigneesList -> showAssignees());
|
||||||
showAssignees()
|
|
||||||
);
|
|
||||||
|
|
||||||
if(!connToInternet) {
|
if(!connToInternet) {
|
||||||
|
|
||||||
@ -181,10 +191,9 @@ public class CreateIssueActivity extends BaseActivity implements View.OnClickLis
|
|||||||
View view = assigneesBinding.getRoot();
|
View view = assigneesBinding.getRoot();
|
||||||
dialogAssignees.setContentView(view);
|
dialogAssignees.setContentView(view);
|
||||||
|
|
||||||
assigneesBinding.cancel.setOnClickListener(assigneesBinding_ ->
|
assigneesBinding.cancel.setOnClickListener(assigneesBinding_ -> dialogAssignees.dismiss());
|
||||||
dialogAssignees.dismiss()
|
|
||||||
);
|
|
||||||
|
|
||||||
|
dialogAssignees.show();
|
||||||
AssigneesActions.getRepositoryAssignees(ctx, instanceUrl, instanceToken, repoOwner, repoName, assigneesList, dialogAssignees, assigneesAdapter, assigneesBinding);
|
AssigneesActions.getRepositoryAssignees(ctx, instanceUrl, instanceToken, repoOwner, repoName, assigneesList, dialogAssignees, assigneesAdapter, assigneesBinding);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,10 +211,9 @@ public class CreateIssueActivity extends BaseActivity implements View.OnClickLis
|
|||||||
View view = labelsBinding.getRoot();
|
View view = labelsBinding.getRoot();
|
||||||
dialogLabels.setContentView(view);
|
dialogLabels.setContentView(view);
|
||||||
|
|
||||||
labelsBinding.cancel.setOnClickListener(labelsBinding_ ->
|
labelsBinding.cancel.setOnClickListener(labelsBinding_ -> dialogLabels.dismiss());
|
||||||
dialogLabels.dismiss()
|
|
||||||
);
|
|
||||||
|
|
||||||
|
dialogLabels.show();
|
||||||
LabelsActions.getRepositoryLabels(ctx, instanceUrl, instanceToken, repoOwner, repoName, labelsList, dialogLabels, labelsAdapter, labelsBinding);
|
LabelsActions.getRepositoryLabels(ctx, instanceUrl, instanceToken, repoOwner, repoName, labelsList, dialogLabels, labelsAdapter, labelsBinding);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,7 +229,6 @@ public class CreateIssueActivity extends BaseActivity implements View.OnClickLis
|
|||||||
|
|
||||||
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newIssueTitleForm.equals("")) {
|
if (newIssueTitleForm.equals("")) {
|
||||||
@ -241,7 +248,6 @@ public class CreateIssueActivity extends BaseActivity implements View.OnClickLis
|
|||||||
|
|
||||||
disableProcessButton();
|
disableProcessButton();
|
||||||
createNewIssueFunc(instanceUrl, instanceToken, repoOwner, repoName, loginUid, newIssueDescriptionForm, newIssueDueDateForm, milestoneId, newIssueTitleForm);
|
createNewIssueFunc(instanceUrl, instanceToken, repoOwner, repoName, loginUid, newIssueDescriptionForm, newIssueDueDateForm, milestoneId, newIssueTitleForm);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createNewIssueFunc(final String instanceUrl, final String instanceToken, String repoOwner, String repoName, String loginUid, String newIssueDescriptionForm, String newIssueDueDateForm, int newIssueMilestoneIdForm, String newIssueTitleForm) {
|
private void createNewIssueFunc(final String instanceUrl, final String instanceToken, String repoOwner, String repoName, String loginUid, String newIssueDescriptionForm, String newIssueDueDateForm, int newIssueMilestoneIdForm, String newIssueTitleForm) {
|
||||||
@ -314,13 +320,16 @@ public class CreateIssueActivity extends BaseActivity implements View.OnClickLis
|
|||||||
public void onResponse(@NonNull Call<List<Milestones>> call, @NonNull retrofit2.Response<List<Milestones>> response) {
|
public void onResponse(@NonNull Call<List<Milestones>> call, @NonNull retrofit2.Response<List<Milestones>> response) {
|
||||||
|
|
||||||
if(response.isSuccessful()) {
|
if(response.isSuccessful()) {
|
||||||
|
|
||||||
if(response.code() == 200) {
|
if(response.code() == 200) {
|
||||||
|
|
||||||
List<Milestones> milestonesList_ = response.body();
|
List<Milestones> milestonesList_ = response.body();
|
||||||
|
|
||||||
milestonesList.add(new Milestones(0,getString(R.string.issueCreatedNoMilestone)));
|
milestonesList.add(new Milestones(0,getString(R.string.issueCreatedNoMilestone)));
|
||||||
assert milestonesList_ != null;
|
assert milestonesList_ != null;
|
||||||
|
|
||||||
if(milestonesList_.size() > 0) {
|
if(milestonesList_.size() > 0) {
|
||||||
|
|
||||||
for (int i = 0; i < milestonesList_.size(); i++) {
|
for (int i = 0; i < milestonesList_.size(); i++) {
|
||||||
|
|
||||||
//Don't translate "open" is a enum
|
//Don't translate "open" is a enum
|
||||||
@ -331,7 +340,6 @@ public class CreateIssueActivity extends BaseActivity implements View.OnClickLis
|
|||||||
);
|
);
|
||||||
milestonesList.add(data);
|
milestonesList.add(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -375,9 +383,9 @@ public class CreateIssueActivity extends BaseActivity implements View.OnClickLis
|
|||||||
datePickerDialog.show();
|
datePickerDialog.show();
|
||||||
}
|
}
|
||||||
else if(v == viewBinding.createNewIssueButton) {
|
else if(v == viewBinding.createNewIssueButton) {
|
||||||
|
|
||||||
processNewIssue();
|
processNewIssue();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void disableProcessButton() {
|
private void disableProcessButton() {
|
||||||
|
@ -87,22 +87,14 @@ public class CreateLabelActivity extends BaseActivity {
|
|||||||
|
|
||||||
initCloseListener();
|
initCloseListener();
|
||||||
closeActivity.setOnClickListener(onClickListener);
|
closeActivity.setOnClickListener(onClickListener);
|
||||||
colorPicker.setOnClickListener(new View.OnClickListener() {
|
colorPicker.setOnClickListener(v -> cp.show());
|
||||||
public void onClick(View v) {
|
|
||||||
cp.show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
cp.setCallback(new ColorPickerCallback() {
|
cp.setCallback(color -> {
|
||||||
@Override
|
|
||||||
public void onColorChosen(@ColorInt int color) {
|
|
||||||
|
|
||||||
//Log.i("#Hex no alpha", String.format("#%06X", (0xFFFFFF & color)));
|
//Log.i("#Hex no alpha", String.format("#%06X", (0xFFFFFF & color)));
|
||||||
colorPicker.setBackgroundColor(color);
|
colorPicker.setBackgroundColor(color);
|
||||||
tinyDb.putString("labelColor", String.format("#%06X", (0xFFFFFF & color)));
|
tinyDb.putString("labelColor", String.format("#%06X", (0xFFFFFF & color)));
|
||||||
cp.dismiss();
|
cp.dismiss();
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if(getIntent().getStringExtra("labelAction") != null && Objects.requireNonNull(getIntent().getStringExtra("labelAction")).equals("edit")) {
|
if(getIntent().getStringExtra("labelAction") != null && Objects.requireNonNull(getIntent().getStringExtra("labelAction")).equals("edit")) {
|
||||||
@ -131,9 +123,9 @@ public class CreateLabelActivity extends BaseActivity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private View.OnClickListener createLabelListener = v -> processCreateLabel();
|
private final View.OnClickListener createLabelListener = v -> processCreateLabel();
|
||||||
|
|
||||||
private View.OnClickListener updateLabelListener = v -> processUpdateLabel();
|
private final View.OnClickListener updateLabelListener = v -> processUpdateLabel();
|
||||||
|
|
||||||
private void processUpdateLabel() {
|
private void processUpdateLabel() {
|
||||||
|
|
||||||
@ -152,9 +144,11 @@ public class CreateLabelActivity extends BaseActivity {
|
|||||||
|
|
||||||
String updateLabelColor;
|
String updateLabelColor;
|
||||||
if(tinyDb.getString("labelColor").isEmpty()) {
|
if(tinyDb.getString("labelColor").isEmpty()) {
|
||||||
|
|
||||||
updateLabelColor = tinyDb.getString("labelColorDefault");
|
updateLabelColor = tinyDb.getString("labelColorDefault");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
updateLabelColor = tinyDb.getString("labelColor");
|
updateLabelColor = tinyDb.getString("labelColor");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,21 +156,18 @@ public class CreateLabelActivity extends BaseActivity {
|
|||||||
|
|
||||||
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(updateLabelName.equals("")) {
|
if(updateLabelName.equals("")) {
|
||||||
|
|
||||||
Toasty.error(ctx, getString(R.string.labelEmptyError));
|
Toasty.error(ctx, getString(R.string.labelEmptyError));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!appUtil.checkStrings(updateLabelName)) {
|
if(!appUtil.checkStrings(updateLabelName)) {
|
||||||
|
|
||||||
Toasty.error(ctx, getString(R.string.labelNameError));
|
Toasty.error(ctx, getString(R.string.labelNameError));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
disableProcessButton();
|
disableProcessButton();
|
||||||
@ -200,10 +191,13 @@ public class CreateLabelActivity extends BaseActivity {
|
|||||||
|
|
||||||
String newLabelName = labelName.getText().toString();
|
String newLabelName = labelName.getText().toString();
|
||||||
String newLabelColor;
|
String newLabelColor;
|
||||||
|
|
||||||
if(tinyDb.getString("labelColor").isEmpty()) {
|
if(tinyDb.getString("labelColor").isEmpty()) {
|
||||||
|
|
||||||
newLabelColor = String.format("#%06X", (0xFFFFFF & ContextCompat.getColor(ctx, R.color.releasePre)));
|
newLabelColor = String.format("#%06X", (0xFFFFFF & ContextCompat.getColor(ctx, R.color.releasePre)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
newLabelColor = tinyDb.getString("labelColor");
|
newLabelColor = tinyDb.getString("labelColor");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,26 +205,22 @@ public class CreateLabelActivity extends BaseActivity {
|
|||||||
|
|
||||||
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(newLabelName.equals("")) {
|
if(newLabelName.equals("")) {
|
||||||
|
|
||||||
Toasty.error(ctx, getString(R.string.labelEmptyError));
|
Toasty.error(ctx, getString(R.string.labelEmptyError));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!appUtil.checkStrings(newLabelName)) {
|
if(!appUtil.checkStrings(newLabelName)) {
|
||||||
|
|
||||||
Toasty.error(ctx, getString(R.string.labelNameError));
|
Toasty.error(ctx, getString(R.string.labelNameError));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
disableProcessButton();
|
disableProcessButton();
|
||||||
createNewLabel(instanceUrl, instanceToken, repoOwner, repoName, newLabelName, newLabelColor, loginUid);
|
createNewLabel(instanceUrl, instanceToken, repoOwner, repoName, newLabelName, newLabelColor, loginUid);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createNewLabel(final String instanceUrl, final String instanceToken, String repoOwner, String repoName, String newLabelName, String newLabelColor, String loginUid) {
|
private void createNewLabel(final String instanceUrl, final String instanceToken, String repoOwner, String repoName, String newLabelName, String newLabelColor, String loginUid) {
|
||||||
@ -256,7 +246,6 @@ public class CreateLabelActivity extends BaseActivity {
|
|||||||
tinyDb.putString("labelColor", "");
|
tinyDb.putString("labelColor", "");
|
||||||
tinyDb.putBoolean("labelsRefresh", true);
|
tinyDb.putBoolean("labelsRefresh", true);
|
||||||
finish();
|
finish();
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 401) {
|
else if(response.code() == 401) {
|
||||||
|
|
||||||
@ -265,16 +254,13 @@ public class CreateLabelActivity extends BaseActivity {
|
|||||||
getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||||
getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
||||||
getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
tinyDb.putString("labelColor", "");
|
tinyDb.putString("labelColor", "");
|
||||||
Toasty.error(ctx, getString(R.string.labelGeneralError));
|
Toasty.error(ctx, getString(R.string.labelGeneralError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -306,6 +292,7 @@ public class CreateLabelActivity extends BaseActivity {
|
|||||||
public void onResponse(@NonNull Call<CreateLabel> call, @NonNull retrofit2.Response<CreateLabel> response) {
|
public void onResponse(@NonNull Call<CreateLabel> call, @NonNull retrofit2.Response<CreateLabel> response) {
|
||||||
|
|
||||||
if(response.isSuccessful()) {
|
if(response.isSuccessful()) {
|
||||||
|
|
||||||
if(response.code() == 200) {
|
if(response.code() == 200) {
|
||||||
|
|
||||||
Toasty.success(ctx, getString(R.string.labelUpdated));
|
Toasty.success(ctx, getString(R.string.labelUpdated));
|
||||||
@ -317,7 +304,6 @@ public class CreateLabelActivity extends BaseActivity {
|
|||||||
getIntent().removeExtra("labelTitle");
|
getIntent().removeExtra("labelTitle");
|
||||||
getIntent().removeExtra("labelColor");
|
getIntent().removeExtra("labelColor");
|
||||||
finish();
|
finish();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(response.code() == 401) {
|
else if(response.code() == 401) {
|
||||||
@ -327,7 +313,6 @@ public class CreateLabelActivity extends BaseActivity {
|
|||||||
getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||||
getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
||||||
getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
@ -335,9 +320,7 @@ public class CreateLabelActivity extends BaseActivity {
|
|||||||
tinyDb.putString("labelColor", "");
|
tinyDb.putString("labelColor", "");
|
||||||
tinyDb.putString("labelColorDefault", "");
|
tinyDb.putString("labelColorDefault", "");
|
||||||
Toasty.error(ctx, getString(R.string.labelGeneralError));
|
Toasty.error(ctx, getString(R.string.labelGeneralError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -353,15 +336,14 @@ public class CreateLabelActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initCloseListener() {
|
private void initCloseListener() {
|
||||||
onClickListener = new View.OnClickListener() {
|
|
||||||
@Override
|
onClickListener = view -> {
|
||||||
public void onClick(View view) {
|
|
||||||
getIntent().removeExtra("labelAction");
|
getIntent().removeExtra("labelAction");
|
||||||
getIntent().removeExtra("labelId");
|
getIntent().removeExtra("labelId");
|
||||||
getIntent().removeExtra("labelTitle");
|
getIntent().removeExtra("labelTitle");
|
||||||
getIntent().removeExtra("labelColor");
|
getIntent().removeExtra("labelColor");
|
||||||
finish();
|
finish();
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -380,13 +362,13 @@ public class CreateLabelActivity extends BaseActivity {
|
|||||||
public void onResponse(@NonNull Call<Labels> call, @NonNull retrofit2.Response<Labels> response) {
|
public void onResponse(@NonNull Call<Labels> call, @NonNull retrofit2.Response<Labels> response) {
|
||||||
|
|
||||||
if(response.isSuccessful()) {
|
if(response.isSuccessful()) {
|
||||||
|
|
||||||
if(response.code() == 204) {
|
if(response.code() == 204) {
|
||||||
|
|
||||||
Toasty.success(ctx, getString(R.string.labelDeleteText));
|
Toasty.success(ctx, getString(R.string.labelDeleteText));
|
||||||
LabelsViewModel.loadLabelsList(instanceUrl, instanceToken, repoOwner, repoName, ctx);
|
LabelsViewModel.loadLabelsList(instanceUrl, instanceToken, repoOwner, repoName, ctx);
|
||||||
getIntent().removeExtra("labelAction");
|
getIntent().removeExtra("labelAction");
|
||||||
getIntent().removeExtra("labelId");
|
getIntent().removeExtra("labelId");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(response.code() == 401) {
|
else if(response.code() == 401) {
|
||||||
@ -395,14 +377,11 @@ public class CreateLabelActivity extends BaseActivity {
|
|||||||
getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||||
getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
||||||
getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.error(ctx, getString(R.string.labelDeleteErrorText));
|
Toasty.error(ctx, getString(R.string.labelDeleteErrorText));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
package org.mian.gitnex.activities;
|
package org.mian.gitnex.activities;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.app.DatePickerDialog;
|
import android.app.DatePickerDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
@ -43,6 +45,7 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic
|
|||||||
return R.layout.activity_new_milestone;
|
return R.layout.activity_new_milestone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
||||||
@ -63,6 +66,17 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic
|
|||||||
assert imm != null;
|
assert imm != null;
|
||||||
imm.showSoftInput(milestoneTitle, InputMethodManager.SHOW_IMPLICIT);
|
imm.showSoftInput(milestoneTitle, InputMethodManager.SHOW_IMPLICIT);
|
||||||
|
|
||||||
|
milestoneDescription.setOnTouchListener((touchView, motionEvent) -> {
|
||||||
|
|
||||||
|
touchView.getParent().requestDisallowInterceptTouchEvent(true);
|
||||||
|
|
||||||
|
if ((motionEvent.getAction() & MotionEvent.ACTION_UP) != 0 && (motionEvent.getActionMasked() & MotionEvent.ACTION_UP) != 0) {
|
||||||
|
|
||||||
|
touchView.getParent().requestDisallowInterceptTouchEvent(false);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
initCloseListener();
|
initCloseListener();
|
||||||
closeActivity.setOnClickListener(onClickListener);
|
closeActivity.setOnClickListener(onClickListener);
|
||||||
milestoneDueDate.setOnClickListener(this);
|
milestoneDueDate.setOnClickListener(this);
|
||||||
@ -78,7 +92,7 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private View.OnClickListener createMilestoneListener = v -> processNewMilestone();
|
private final View.OnClickListener createMilestoneListener = v -> processNewMilestone();
|
||||||
|
|
||||||
private void processNewMilestone() {
|
private void processNewMilestone() {
|
||||||
|
|
||||||
@ -92,7 +106,6 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic
|
|||||||
final String instanceUrl = tinyDb.getString("instanceUrl");
|
final String instanceUrl = tinyDb.getString("instanceUrl");
|
||||||
final String loginUid = tinyDb.getString("loginUid");
|
final String loginUid = tinyDb.getString("loginUid");
|
||||||
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
|
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
|
||||||
//String appLocale = tinyDb.getString("locale");
|
|
||||||
|
|
||||||
String newMilestoneTitle = milestoneTitle.getText().toString();
|
String newMilestoneTitle = milestoneTitle.getText().toString();
|
||||||
String newMilestoneDescription = milestoneDescription.getText().toString();
|
String newMilestoneDescription = milestoneDescription.getText().toString();
|
||||||
@ -102,26 +115,25 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic
|
|||||||
|
|
||||||
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(newMilestoneTitle.equals("")) {
|
if(newMilestoneTitle.equals("")) {
|
||||||
|
|
||||||
Toasty.error(ctx, getString(R.string.milestoneNameErrorEmpty));
|
Toasty.error(ctx, getString(R.string.milestoneNameErrorEmpty));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!newMilestoneDescription.equals("")) {
|
if(!newMilestoneDescription.equals("")) {
|
||||||
|
|
||||||
if (appUtil.charactersLength(newMilestoneDescription) > 255) {
|
if (appUtil.charactersLength(newMilestoneDescription) > 255) {
|
||||||
|
|
||||||
Toasty.warning(ctx, getString(R.string.milestoneDescError));
|
Toasty.warning(ctx, getString(R.string.milestoneDescError));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String finalMilestoneDueDate = null;
|
String finalMilestoneDueDate = null;
|
||||||
|
|
||||||
if(!newMilestoneDueDate.isEmpty()) {
|
if(!newMilestoneDueDate.isEmpty()) {
|
||||||
|
|
||||||
finalMilestoneDueDate = (AppUtil.customDateCombine(AppUtil.customDateFormat(newMilestoneDueDate)));
|
finalMilestoneDueDate = (AppUtil.customDateCombine(AppUtil.customDateFormat(newMilestoneDueDate)));
|
||||||
@ -135,7 +147,6 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic
|
|||||||
|
|
||||||
disableProcessButton();
|
disableProcessButton();
|
||||||
createNewMilestone(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), repoOwner, repoName, newMilestoneTitle, newMilestoneDescription, finalMilestoneDueDate);
|
createNewMilestone(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), repoOwner, repoName, newMilestoneTitle, newMilestoneDescription, finalMilestoneDueDate);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createNewMilestone(final String instanceUrl, final String token, String repoOwner, String repoName, String newMilestoneTitle, String newMilestoneDescription, String newMilestoneDueDate) {
|
private void createNewMilestone(final String instanceUrl, final String token, String repoOwner, String repoName, String newMilestoneTitle, String newMilestoneDescription, String newMilestoneDueDate) {
|
||||||
@ -155,6 +166,7 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic
|
|||||||
public void onResponse(@NonNull Call<Milestones> call, @NonNull retrofit2.Response<Milestones> response) {
|
public void onResponse(@NonNull Call<Milestones> call, @NonNull retrofit2.Response<Milestones> response) {
|
||||||
|
|
||||||
if(response.isSuccessful()) {
|
if(response.isSuccessful()) {
|
||||||
|
|
||||||
if(response.code() == 201) {
|
if(response.code() == 201) {
|
||||||
|
|
||||||
TinyDB tinyDb = new TinyDB(appCtx);
|
TinyDB tinyDb = new TinyDB(appCtx);
|
||||||
@ -162,7 +174,6 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic
|
|||||||
Toasty.success(ctx, getString(R.string.milestoneCreated));
|
Toasty.success(ctx, getString(R.string.milestoneCreated));
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
finish();
|
finish();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(response.code() == 401) {
|
else if(response.code() == 401) {
|
||||||
@ -172,19 +183,17 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic
|
|||||||
getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||||
getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
||||||
getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.error(ctx, getString(R.string.milestoneCreatedError));
|
Toasty.error(ctx, getString(R.string.milestoneCreatedError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@NonNull Call<Milestones> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<Milestones> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
Log.e("onFailure", t.toString());
|
Log.e("onFailure", t.toString());
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
}
|
}
|
||||||
@ -203,16 +212,7 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic
|
|||||||
final int mDay = c.get(Calendar.DAY_OF_MONTH);
|
final int mDay = c.get(Calendar.DAY_OF_MONTH);
|
||||||
|
|
||||||
DatePickerDialog datePickerDialog = new DatePickerDialog(this,
|
DatePickerDialog datePickerDialog = new DatePickerDialog(this,
|
||||||
new DatePickerDialog.OnDateSetListener() {
|
(view, year, monthOfYear, dayOfMonth) -> milestoneDueDate.setText(getString(R.string.setDueDate, year, (monthOfYear + 1), dayOfMonth)), mYear, mMonth, mDay);
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDateSet(DatePicker view, int year,
|
|
||||||
int monthOfYear, int dayOfMonth) {
|
|
||||||
|
|
||||||
milestoneDueDate.setText(getString(R.string.setDueDate, year, (monthOfYear + 1), dayOfMonth));
|
|
||||||
|
|
||||||
}
|
|
||||||
}, mYear, mMonth, mDay);
|
|
||||||
datePickerDialog.show();
|
datePickerDialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,6 @@ public class CreateNewUserActivity extends BaseActivity {
|
|||||||
|
|
||||||
createUserButton.setOnClickListener(createNewUserListener);
|
createUserButton.setOnClickListener(createNewUserListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processCreateNewUser() {
|
private void processCreateNewUser() {
|
||||||
@ -94,40 +93,34 @@ public class CreateNewUserActivity extends BaseActivity {
|
|||||||
|
|
||||||
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(newFullName.equals("") || newUserName.equals("") | newUserEmail.equals("") || newUserPassword.equals("")) {
|
if(newFullName.equals("") || newUserName.equals("") | newUserEmail.equals("") || newUserPassword.equals("")) {
|
||||||
|
|
||||||
Toasty.error(ctx, getString(R.string.emptyFields));
|
Toasty.error(ctx, getString(R.string.emptyFields));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!appUtil.checkStrings(newFullName)) {
|
if(!appUtil.checkStrings(newFullName)) {
|
||||||
|
|
||||||
Toasty.error(ctx, getString(R.string.userInvalidFullName));
|
Toasty.error(ctx, getString(R.string.userInvalidFullName));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!appUtil.checkStringsWithAlphaNumeric(newUserName)) {
|
if(!appUtil.checkStringsWithAlphaNumeric(newUserName)) {
|
||||||
|
|
||||||
Toasty.error(ctx, getString(R.string.userInvalidUserName));
|
Toasty.error(ctx, getString(R.string.userInvalidUserName));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!Patterns.EMAIL_ADDRESS.matcher(newUserEmail).matches()) {
|
if(!Patterns.EMAIL_ADDRESS.matcher(newUserEmail).matches()) {
|
||||||
|
|
||||||
Toasty.error(ctx, getString(R.string.userInvalidEmail));
|
Toasty.error(ctx, getString(R.string.userInvalidEmail));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
disableProcessButton();
|
disableProcessButton();
|
||||||
createNewUser(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), newFullName, newUserName, newUserEmail, newUserPassword);
|
createNewUser(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), newFullName, newUserName, newUserEmail, newUserPassword);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createNewUser(final String instanceUrl, final String instanceToken, String newFullName, String newUserName, String newUserEmail, String newUserPassword) {
|
private void createNewUser(final String instanceUrl, final String instanceToken, String newFullName, String newUserName, String newUserEmail, String newUserPassword) {
|
||||||
@ -151,7 +144,6 @@ public class CreateNewUserActivity extends BaseActivity {
|
|||||||
Toasty.success(ctx, getString(R.string.userCreatedText));
|
Toasty.success(ctx, getString(R.string.userCreatedText));
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
finish();
|
finish();
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 401) {
|
else if(response.code() == 401) {
|
||||||
|
|
||||||
@ -160,33 +152,27 @@ public class CreateNewUserActivity extends BaseActivity {
|
|||||||
getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||||
getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
||||||
getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 403) {
|
else if(response.code() == 403) {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.error(ctx, ctx.getString(R.string.authorizeError));
|
Toasty.error(ctx, ctx.getString(R.string.authorizeError));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 404) {
|
else if(response.code() == 404) {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.warning(ctx, ctx.getString(R.string.apiNotFound));
|
Toasty.warning(ctx, ctx.getString(R.string.apiNotFound));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 422) {
|
else if(response.code() == 422) {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.warning(ctx, ctx.getString(R.string.userExistsError));
|
Toasty.warning(ctx, ctx.getString(R.string.userExistsError));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.error(ctx, getString(R.string.genericError));
|
Toasty.error(ctx, getString(R.string.genericError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -199,7 +185,7 @@ public class CreateNewUserActivity extends BaseActivity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private View.OnClickListener createNewUserListener = v -> processCreateNewUser();
|
private final View.OnClickListener createNewUserListener = v -> processCreateNewUser();
|
||||||
|
|
||||||
private void initCloseListener() {
|
private void initCloseListener() {
|
||||||
|
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
package org.mian.gitnex.activities;
|
package org.mian.gitnex.activities;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
@ -40,6 +42,7 @@ public class CreateOrganizationActivity extends BaseActivity {
|
|||||||
return R.layout.activity_new_organization;
|
return R.layout.activity_new_organization;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
||||||
@ -58,6 +61,17 @@ public class CreateOrganizationActivity extends BaseActivity {
|
|||||||
assert imm != null;
|
assert imm != null;
|
||||||
imm.showSoftInput(orgName, InputMethodManager.SHOW_IMPLICIT);
|
imm.showSoftInput(orgName, InputMethodManager.SHOW_IMPLICIT);
|
||||||
|
|
||||||
|
orgDesc.setOnTouchListener((touchView, motionEvent) -> {
|
||||||
|
|
||||||
|
touchView.getParent().requestDisallowInterceptTouchEvent(true);
|
||||||
|
|
||||||
|
if ((motionEvent.getAction() & MotionEvent.ACTION_UP) != 0 && (motionEvent.getActionMasked() & MotionEvent.ACTION_UP) != 0) {
|
||||||
|
|
||||||
|
touchView.getParent().requestDisallowInterceptTouchEvent(false);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
initCloseListener();
|
initCloseListener();
|
||||||
closeActivity.setOnClickListener(onClickListener);
|
closeActivity.setOnClickListener(onClickListener);
|
||||||
|
|
||||||
@ -75,19 +89,11 @@ public class CreateOrganizationActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initCloseListener() {
|
private void initCloseListener() {
|
||||||
onClickListener = new View.OnClickListener() {
|
|
||||||
@Override
|
onClickListener = view -> finish();
|
||||||
public void onClick(View view) {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private View.OnClickListener createOrgListener = new View.OnClickListener() {
|
private final View.OnClickListener createOrgListener = v -> processNewOrganization();
|
||||||
public void onClick(View v) {
|
|
||||||
processNewOrganization();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private void processNewOrganization() {
|
private void processNewOrganization() {
|
||||||
|
|
||||||
@ -105,33 +111,29 @@ public class CreateOrganizationActivity extends BaseActivity {
|
|||||||
|
|
||||||
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!newOrgDesc.equals("")) {
|
if(!newOrgDesc.equals("")) {
|
||||||
|
|
||||||
if (appUtil.charactersLength(newOrgDesc) > 255) {
|
if (appUtil.charactersLength(newOrgDesc) > 255) {
|
||||||
|
|
||||||
Toasty.warning(ctx, getString(R.string.orgDescError));
|
Toasty.warning(ctx, getString(R.string.orgDescError));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(newOrgName.equals("")) {
|
if(newOrgName.equals("")) {
|
||||||
|
|
||||||
Toasty.error(ctx, getString(R.string.orgNameErrorEmpty));
|
Toasty.error(ctx, getString(R.string.orgNameErrorEmpty));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(!appUtil.checkStrings(newOrgName)) {
|
else if(!appUtil.checkStrings(newOrgName)) {
|
||||||
|
|
||||||
Toasty.warning(ctx, getString(R.string.orgNameErrorInvalid));
|
Toasty.warning(ctx, getString(R.string.orgNameErrorInvalid));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
disableProcessButton();
|
disableProcessButton();
|
||||||
createNewOrganization(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), newOrgName, newOrgDesc);
|
createNewOrganization(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), newOrgName, newOrgDesc);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -157,7 +159,6 @@ public class CreateOrganizationActivity extends BaseActivity {
|
|||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.success(ctx, getString(R.string.orgCreated));
|
Toasty.success(ctx, getString(R.string.orgCreated));
|
||||||
finish();
|
finish();
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 401) {
|
else if(response.code() == 401) {
|
||||||
|
|
||||||
@ -166,37 +167,35 @@ public class CreateOrganizationActivity extends BaseActivity {
|
|||||||
getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||||
getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
||||||
getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 409) {
|
else if(response.code() == 409) {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.warning(ctx, getString(R.string.orgExistsError));
|
Toasty.warning(ctx, getString(R.string.orgExistsError));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 422) {
|
else if(response.code() == 422) {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.warning(ctx, getString(R.string.orgExistsError));
|
Toasty.warning(ctx, getString(R.string.orgExistsError));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
if(response.code() == 404) {
|
if(response.code() == 404) {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.warning(ctx, getString(R.string.apiNotFound));
|
Toasty.warning(ctx, getString(R.string.apiNotFound));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.error(ctx, getString(R.string.orgCreatedError));
|
Toasty.error(ctx, getString(R.string.orgCreatedError));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@NonNull Call<UserOrganizations> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<UserOrganizations> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
Log.e("onFailure", t.toString());
|
Log.e("onFailure", t.toString());
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package org.mian.gitnex.activities;
|
package org.mian.gitnex.activities;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.app.DatePickerDialog;
|
import android.app.DatePickerDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -7,6 +8,7 @@ import android.graphics.Color;
|
|||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
@ -73,6 +75,7 @@ public class CreatePullRequestActivity extends BaseActivity implements LabelsLis
|
|||||||
return R.layout.activity_create_pr;
|
return R.layout.activity_create_pr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
||||||
@ -94,9 +97,21 @@ public class CreatePullRequestActivity extends BaseActivity implements LabelsLis
|
|||||||
|
|
||||||
// require gitea 1.12 or higher
|
// require gitea 1.12 or higher
|
||||||
if(new Version(tinyDb.getString("giteaVersion")).higherOrEqual("1.12.0")) {
|
if(new Version(tinyDb.getString("giteaVersion")).higherOrEqual("1.12.0")) {
|
||||||
|
|
||||||
resultLimit = StaticGlobalVariables.resultLimitNewGiteaInstances;
|
resultLimit = StaticGlobalVariables.resultLimitNewGiteaInstances;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
viewBinding.prBody.setOnTouchListener((touchView, motionEvent) -> {
|
||||||
|
|
||||||
|
touchView.getParent().requestDisallowInterceptTouchEvent(true);
|
||||||
|
|
||||||
|
if ((motionEvent.getAction() & MotionEvent.ACTION_UP) != 0 && (motionEvent.getActionMasked() & MotionEvent.ACTION_UP) != 0) {
|
||||||
|
|
||||||
|
touchView.getParent().requestDisallowInterceptTouchEvent(false);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
labelsAdapter = new LabelsListAdapter(labelsList, CreatePullRequestActivity.this, labelsIds);
|
labelsAdapter = new LabelsListAdapter(labelsList, CreatePullRequestActivity.this, labelsIds);
|
||||||
|
|
||||||
ImageView closeActivity = findViewById(R.id.close);
|
ImageView closeActivity = findViewById(R.id.close);
|
||||||
@ -113,13 +128,9 @@ public class CreatePullRequestActivity extends BaseActivity implements LabelsLis
|
|||||||
getMilestones(instanceUrl, instanceToken, repoOwner, repoName, loginUid, resultLimit);
|
getMilestones(instanceUrl, instanceToken, repoOwner, repoName, loginUid, resultLimit);
|
||||||
getBranches(instanceUrl, instanceToken, repoOwner, repoName, loginUid);
|
getBranches(instanceUrl, instanceToken, repoOwner, repoName, loginUid);
|
||||||
|
|
||||||
viewBinding.prLabels.setOnClickListener(prLabels ->
|
viewBinding.prLabels.setOnClickListener(prLabels -> showLabels());
|
||||||
showLabels()
|
|
||||||
);
|
|
||||||
|
|
||||||
viewBinding.createPr.setOnClickListener(createPr ->
|
viewBinding.createPr.setOnClickListener(createPr -> processPullRequest());
|
||||||
processPullRequest()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processPullRequest() {
|
private void processPullRequest() {
|
||||||
@ -133,13 +144,16 @@ public class CreatePullRequestActivity extends BaseActivity implements LabelsLis
|
|||||||
assignees.add("");
|
assignees.add("");
|
||||||
|
|
||||||
if (labelsIds.size() == 0) {
|
if (labelsIds.size() == 0) {
|
||||||
|
|
||||||
labelsIds.add(0);
|
labelsIds.add(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dueDate.matches("")) {
|
if (dueDate.matches("")) {
|
||||||
|
|
||||||
dueDate = null;
|
dueDate = null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
dueDate = AppUtil.customDateCombine(AppUtil.customDateFormat(dueDate));
|
dueDate = AppUtil.customDateCombine(AppUtil.customDateFormat(dueDate));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,9 +174,9 @@ public class CreatePullRequestActivity extends BaseActivity implements LabelsLis
|
|||||||
Toasty.error(ctx, getString(R.string.sameBranchesError));
|
Toasty.error(ctx, getString(R.string.sameBranchesError));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
createPullRequest(prTitle, prDescription, mergeInto, pullFrom, milestoneId, dueDate, assignees);
|
createPullRequest(prTitle, prDescription, mergeInto, pullFrom, milestoneId, dueDate, assignees);
|
||||||
}
|
}
|
||||||
//Log.e("processPullRequest", String.valueOf(milestoneId));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createPullRequest(String prTitle, String prDescription, String mergeInto, String pullFrom, int milestoneId, String dueDate, List<String> assignees) {
|
private void createPullRequest(String prTitle, String prDescription, String mergeInto, String pullFrom, int milestoneId, String dueDate, List<String> assignees) {
|
||||||
@ -201,7 +215,6 @@ public class CreatePullRequestActivity extends BaseActivity implements LabelsLis
|
|||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.error(ctx, getString(R.string.genericError));
|
Toasty.error(ctx, getString(R.string.genericError));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -231,6 +244,7 @@ public class CreatePullRequestActivity extends BaseActivity implements LabelsLis
|
|||||||
dialogLabels = new Dialog(ctx, R.style.ThemeOverlay_MaterialComponents_Dialog_Alert);
|
dialogLabels = new Dialog(ctx, R.style.ThemeOverlay_MaterialComponents_Dialog_Alert);
|
||||||
|
|
||||||
if (dialogLabels.getWindow() != null) {
|
if (dialogLabels.getWindow() != null) {
|
||||||
|
|
||||||
dialogLabels.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
dialogLabels.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,10 +253,9 @@ public class CreatePullRequestActivity extends BaseActivity implements LabelsLis
|
|||||||
View view = labelsBinding.getRoot();
|
View view = labelsBinding.getRoot();
|
||||||
dialogLabels.setContentView(view);
|
dialogLabels.setContentView(view);
|
||||||
|
|
||||||
labelsBinding.cancel.setOnClickListener(editProperties ->
|
labelsBinding.cancel.setOnClickListener(editProperties -> dialogLabels.dismiss());
|
||||||
dialogLabels.dismiss()
|
|
||||||
);
|
|
||||||
|
|
||||||
|
dialogLabels.show();
|
||||||
LabelsActions.getRepositoryLabels(ctx, instanceUrl, instanceToken, repoOwner, repoName, labelsList, dialogLabels, labelsAdapter, labelsBinding);
|
LabelsActions.getRepositoryLabels(ctx, instanceUrl, instanceToken, repoOwner, repoName, labelsList, dialogLabels, labelsAdapter, labelsBinding);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,19 +272,18 @@ public class CreatePullRequestActivity extends BaseActivity implements LabelsLis
|
|||||||
public void onResponse(@NonNull Call<List<Branches>> call, @NonNull retrofit2.Response<List<Branches>> response) {
|
public void onResponse(@NonNull Call<List<Branches>> call, @NonNull retrofit2.Response<List<Branches>> response) {
|
||||||
|
|
||||||
if(response.isSuccessful()) {
|
if(response.isSuccessful()) {
|
||||||
|
|
||||||
if(response.code() == 200) {
|
if(response.code() == 200) {
|
||||||
|
|
||||||
List<Branches> branchesList_ = response.body();
|
List<Branches> branchesList_ = response.body();
|
||||||
|
|
||||||
assert branchesList_ != null;
|
assert branchesList_ != null;
|
||||||
|
|
||||||
if(branchesList_.size() > 0) {
|
if(branchesList_.size() > 0) {
|
||||||
|
|
||||||
for (int i = 0; i < branchesList_.size(); i++) {
|
for (int i = 0; i < branchesList_.size(); i++) {
|
||||||
|
|
||||||
Branches data = new Branches(
|
Branches data = new Branches(branchesList_.get(i).getName());
|
||||||
branchesList_.get(i).getName()
|
|
||||||
);
|
|
||||||
branchesList.add(data);
|
branchesList.add(data);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,7 +327,9 @@ public class CreatePullRequestActivity extends BaseActivity implements LabelsLis
|
|||||||
|
|
||||||
milestonesList.add(new Milestones(0,getString(R.string.issueCreatedNoMilestone)));
|
milestonesList.add(new Milestones(0,getString(R.string.issueCreatedNoMilestone)));
|
||||||
assert milestonesList_ != null;
|
assert milestonesList_ != null;
|
||||||
|
|
||||||
if(milestonesList_.size() > 0) {
|
if(milestonesList_.size() > 0) {
|
||||||
|
|
||||||
for (int i = 0; i < milestonesList_.size(); i++) {
|
for (int i = 0; i < milestonesList_.size(); i++) {
|
||||||
|
|
||||||
//Don't translate "open" is a enum
|
//Don't translate "open" is a enum
|
||||||
@ -326,7 +340,6 @@ public class CreatePullRequestActivity extends BaseActivity implements LabelsLis
|
|||||||
);
|
);
|
||||||
milestonesList.add(data);
|
milestonesList.add(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
package org.mian.gitnex.activities;
|
package org.mian.gitnex.activities;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
@ -59,6 +61,7 @@ public class CreateReleaseActivity extends BaseActivity {
|
|||||||
return R.layout.activity_create_release;
|
return R.layout.activity_create_release;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
||||||
@ -89,6 +92,17 @@ public class CreateReleaseActivity extends BaseActivity {
|
|||||||
assert imm != null;
|
assert imm != null;
|
||||||
imm.showSoftInput(releaseTitle, InputMethodManager.SHOW_IMPLICIT);
|
imm.showSoftInput(releaseTitle, InputMethodManager.SHOW_IMPLICIT);
|
||||||
|
|
||||||
|
releaseContent.setOnTouchListener((touchView, motionEvent) -> {
|
||||||
|
|
||||||
|
touchView.getParent().requestDisallowInterceptTouchEvent(true);
|
||||||
|
|
||||||
|
if ((motionEvent.getAction() & MotionEvent.ACTION_UP) != 0 && (motionEvent.getActionMasked() & MotionEvent.ACTION_UP) != 0) {
|
||||||
|
|
||||||
|
touchView.getParent().requestDisallowInterceptTouchEvent(false);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
initCloseListener();
|
initCloseListener();
|
||||||
closeActivity.setOnClickListener(onClickListener);
|
closeActivity.setOnClickListener(onClickListener);
|
||||||
|
|
||||||
@ -109,7 +123,7 @@ public class CreateReleaseActivity extends BaseActivity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private View.OnClickListener createReleaseListener = v -> processNewRelease();
|
private final View.OnClickListener createReleaseListener = v -> processNewRelease();
|
||||||
|
|
||||||
private void processNewRelease() {
|
private void processNewRelease() {
|
||||||
|
|
||||||
@ -126,7 +140,6 @@ public class CreateReleaseActivity extends BaseActivity {
|
|||||||
|
|
||||||
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(newReleaseTitle.equals("")) {
|
if(newReleaseTitle.equals("")) {
|
||||||
@ -149,7 +162,6 @@ public class CreateReleaseActivity extends BaseActivity {
|
|||||||
|
|
||||||
disableProcessButton();
|
disableProcessButton();
|
||||||
createNewReleaseFunc(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), repoOwner, repoName, newReleaseTagName, newReleaseTitle, newReleaseContent, selectedBranch, newReleaseType, newReleaseDraft);
|
createNewReleaseFunc(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), repoOwner, repoName, newReleaseTagName, newReleaseTitle, newReleaseContent, selectedBranch, newReleaseType, newReleaseDraft);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createNewReleaseFunc(final String instanceUrl, final String token, String repoOwner, String repoName, String newReleaseTagName, String newReleaseTitle, String newReleaseContent, String selectedBranch, boolean newReleaseType, boolean newReleaseDraft) {
|
private void createNewReleaseFunc(final String instanceUrl, final String token, String repoOwner, String repoName, String newReleaseTagName, String newReleaseTitle, String newReleaseContent, String selectedBranch, boolean newReleaseType, boolean newReleaseDraft) {
|
||||||
@ -182,27 +194,22 @@ public class CreateReleaseActivity extends BaseActivity {
|
|||||||
ctx.getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
ctx.getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||||
ctx.getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
ctx.getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
||||||
ctx.getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
ctx.getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 403) {
|
else if(response.code() == 403) {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.error(ctx, ctx.getString(R.string.authorizeError));
|
Toasty.error(ctx, ctx.getString(R.string.authorizeError));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 404) {
|
else if(response.code() == 404) {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.warning(ctx, ctx.getString(R.string.apiNotFound));
|
Toasty.warning(ctx, ctx.getString(R.string.apiNotFound));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.error(ctx, ctx.getString(R.string.genericError));
|
Toasty.error(ctx, ctx.getString(R.string.genericError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -228,6 +235,7 @@ public class CreateReleaseActivity extends BaseActivity {
|
|||||||
public void onResponse(@NonNull Call<List<Branches>> call, @NonNull retrofit2.Response<List<Branches>> response) {
|
public void onResponse(@NonNull Call<List<Branches>> call, @NonNull retrofit2.Response<List<Branches>> response) {
|
||||||
|
|
||||||
if(response.isSuccessful()) {
|
if(response.isSuccessful()) {
|
||||||
|
|
||||||
if(response.code() == 200) {
|
if(response.code() == 200) {
|
||||||
|
|
||||||
List<Branches> branchesList_ = response.body();
|
List<Branches> branchesList_ = response.body();
|
||||||
@ -256,7 +264,6 @@ public class CreateReleaseActivity extends BaseActivity {
|
|||||||
getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||||
getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
||||||
getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ public class CreateRepoActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private View.OnClickListener createRepoListener = v -> processNewRepo();
|
private final View.OnClickListener createRepoListener = v -> processNewRepo();
|
||||||
|
|
||||||
private void processNewRepo() {
|
private void processNewRepo() {
|
||||||
|
|
||||||
@ -127,6 +127,7 @@ public class CreateRepoActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!newRepoDesc.equals("")) {
|
if(!newRepoDesc.equals("")) {
|
||||||
|
|
||||||
if (appUtil.charactersLength(newRepoDesc) > 255) {
|
if (appUtil.charactersLength(newRepoDesc) > 255) {
|
||||||
|
|
||||||
Toasty.warning(ctx, getString(R.string.repoDescError));
|
Toasty.warning(ctx, getString(R.string.repoDescError));
|
||||||
@ -212,7 +213,6 @@ public class CreateRepoActivity extends BaseActivity {
|
|||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.error(ctx, getString(R.string.repoCreatedError));
|
Toasty.error(ctx, getString(R.string.repoCreatedError));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -244,6 +244,7 @@ public class CreateRepoActivity extends BaseActivity {
|
|||||||
|
|
||||||
organizationsList.add(new OrgOwner(userLogin));
|
organizationsList.add(new OrgOwner(userLogin));
|
||||||
assert organizationsList_ != null;
|
assert organizationsList_ != null;
|
||||||
|
|
||||||
if(organizationsList_.size() > 0) {
|
if(organizationsList_.size() > 0) {
|
||||||
|
|
||||||
for(int i = 0; i < organizationsList_.size(); i++) {
|
for(int i = 0; i < organizationsList_.size(); i++) {
|
||||||
@ -257,7 +258,6 @@ public class CreateRepoActivity extends BaseActivity {
|
|||||||
|
|
||||||
OrgOwner data = new OrgOwner(organizationsList_.get(i).getUsername());
|
OrgOwner data = new OrgOwner(organizationsList_.get(i).getUsername());
|
||||||
organizationsList.add(data);
|
organizationsList.add(data);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ public class CreateTeamByOrgActivity extends BaseActivity implements View.OnClic
|
|||||||
private TextView teamAccessControls;
|
private TextView teamAccessControls;
|
||||||
private TextView teamAccessControlsArray;
|
private TextView teamAccessControlsArray;
|
||||||
private Button createTeamButton;
|
private Button createTeamButton;
|
||||||
private String[] permissionList = {"Read", "Write", "Admin"};
|
private final String[] permissionList = {"Read", "Write", "Admin"};
|
||||||
public int permissionSelectedChoice = -1;
|
public int permissionSelectedChoice = -1;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -49,7 +49,7 @@ public class CreateTeamByOrgActivity extends BaseActivity implements View.OnClic
|
|||||||
return R.layout.activity_create_team_by_org;
|
return R.layout.activity_create_team_by_org;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String[] accessControlsList = new String[] {
|
private final String[] accessControlsList = new String[] {
|
||||||
"Code",
|
"Code",
|
||||||
"Issues",
|
"Issues",
|
||||||
"Pull Request",
|
"Pull Request",
|
||||||
@ -61,7 +61,7 @@ public class CreateTeamByOrgActivity extends BaseActivity implements View.OnClic
|
|||||||
|
|
||||||
private List<String> pushAccessList;
|
private List<String> pushAccessList;
|
||||||
|
|
||||||
private boolean[] selectedAccessControlsTrueFalse = new boolean[]{
|
private final boolean[] selectedAccessControlsTrueFalse = new boolean[]{
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
@ -102,12 +102,8 @@ public class CreateTeamByOrgActivity extends BaseActivity implements View.OnClic
|
|||||||
AlertDialog.Builder pBuilder = new AlertDialog.Builder(ctx);
|
AlertDialog.Builder pBuilder = new AlertDialog.Builder(ctx);
|
||||||
|
|
||||||
pBuilder.setTitle(R.string.newTeamPermission);
|
pBuilder.setTitle(R.string.newTeamPermission);
|
||||||
if(permissionSelectedChoice != -1) {
|
pBuilder.setCancelable(permissionSelectedChoice != -1);
|
||||||
pBuilder.setCancelable(true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
pBuilder.setCancelable(false);
|
|
||||||
}
|
|
||||||
pBuilder.setSingleChoiceItems(permissionList, permissionSelectedChoice, (dialogInterface, i) -> {
|
pBuilder.setSingleChoiceItems(permissionList, permissionSelectedChoice, (dialogInterface, i) -> {
|
||||||
|
|
||||||
permissionSelectedChoice = i;
|
permissionSelectedChoice = i;
|
||||||
@ -136,15 +132,12 @@ public class CreateTeamByOrgActivity extends BaseActivity implements View.OnClic
|
|||||||
}
|
}
|
||||||
|
|
||||||
dialogInterface.dismiss();
|
dialogInterface.dismiss();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
AlertDialog pDialog = pBuilder.create();
|
AlertDialog pDialog = pBuilder.create();
|
||||||
pDialog.show();
|
pDialog.show();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
teamAccessControls.setOnClickListener(v -> {
|
teamAccessControls.setOnClickListener(v -> {
|
||||||
|
|
||||||
teamAccessControls.setText("");
|
teamAccessControls.setText("");
|
||||||
@ -189,6 +182,7 @@ public class CreateTeamByOrgActivity extends BaseActivity implements View.OnClic
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(value){
|
if(value){
|
||||||
|
|
||||||
teamAccessControls.setText(getString(R.string.newTeamPermissionValues, teamAccessControls.getText(), pushAccessList.get(selectedVal)));
|
teamAccessControls.setText(getString(R.string.newTeamPermissionValues, teamAccessControls.getText(), pushAccessList.get(selectedVal)));
|
||||||
teamAccessControlsArray.setText(getString(R.string.newTeamPermissionValuesFinal, teamAccessControlsArray.getText(), repoCode));
|
teamAccessControlsArray.setText(getString(R.string.newTeamPermissionValuesFinal, teamAccessControlsArray.getText(), repoCode));
|
||||||
}
|
}
|
||||||
@ -198,15 +192,16 @@ public class CreateTeamByOrgActivity extends BaseActivity implements View.OnClic
|
|||||||
|
|
||||||
String data = String.valueOf(teamAccessControls.getText());
|
String data = String.valueOf(teamAccessControls.getText());
|
||||||
if(!data.equals("")) {
|
if(!data.equals("")) {
|
||||||
|
|
||||||
teamAccessControls.setText(data.substring(0, data.length() - 2));
|
teamAccessControls.setText(data.substring(0, data.length() - 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
String dataArray = String.valueOf(teamAccessControlsArray.getText());
|
String dataArray = String.valueOf(teamAccessControlsArray.getText());
|
||||||
|
|
||||||
if(!dataArray.equals("")) {
|
if(!dataArray.equals("")) {
|
||||||
|
|
||||||
teamAccessControlsArray.setText(dataArray.substring(0, dataArray.length() - 2));
|
teamAccessControlsArray.setText(dataArray.substring(0, dataArray.length() - 2));
|
||||||
}
|
}
|
||||||
//Log.i("orgName", String.valueOf(teamAccessControlsArray.getText()));
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
AlertDialog aDialog = aDialogBuilder.create();
|
AlertDialog aDialog = aDialogBuilder.create();
|
||||||
@ -222,14 +217,12 @@ public class CreateTeamByOrgActivity extends BaseActivity implements View.OnClic
|
|||||||
shape.setCornerRadius( 8 );
|
shape.setCornerRadius( 8 );
|
||||||
shape.setColor(getResources().getColor(R.color.hintColor));
|
shape.setColor(getResources().getColor(R.color.hintColor));
|
||||||
createTeamButton.setBackground(shape);
|
createTeamButton.setBackground(shape);
|
||||||
|
}
|
||||||
} else {
|
else {
|
||||||
|
|
||||||
createTeamButton.setEnabled(true);
|
createTeamButton.setEnabled(true);
|
||||||
createTeamButton.setOnClickListener(this);
|
createTeamButton.setOnClickListener(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processCreateTeam() {
|
private void processCreateTeam() {
|
||||||
@ -251,52 +244,49 @@ public class CreateTeamByOrgActivity extends BaseActivity implements View.OnClic
|
|||||||
|
|
||||||
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newTeamName.equals("")) {
|
if (newTeamName.equals("")) {
|
||||||
|
|
||||||
Toasty.error(ctx, getString(R.string.teamNameEmpty));
|
Toasty.error(ctx, getString(R.string.teamNameEmpty));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!appUtil.checkStringsWithAlphaNumericDashDotUnderscore(newTeamName)) {
|
if(!appUtil.checkStringsWithAlphaNumericDashDotUnderscore(newTeamName)) {
|
||||||
|
|
||||||
Toasty.warning(ctx, getString(R.string.teamNameError));
|
Toasty.warning(ctx, getString(R.string.teamNameError));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!newTeamDesc.equals("")) {
|
if(!newTeamDesc.equals("")) {
|
||||||
|
|
||||||
if(!appUtil.checkStrings(newTeamDesc)) {
|
if(!appUtil.checkStrings(newTeamDesc)) {
|
||||||
|
|
||||||
Toasty.warning(ctx, getString(R.string.teamDescError));
|
Toasty.warning(ctx, getString(R.string.teamDescError));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(newTeamDesc.length() > 100) {
|
if(newTeamDesc.length() > 100) {
|
||||||
|
|
||||||
Toasty.warning(ctx, getString(R.string.teamDescLimit));
|
Toasty.warning(ctx, getString(R.string.teamDescLimit));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newTeamPermission.equals("")) {
|
if (newTeamPermission.equals("")) {
|
||||||
|
|
||||||
Toasty.error(ctx, getString(R.string.teamPermissionEmpty));
|
Toasty.error(ctx, getString(R.string.teamPermissionEmpty));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> newTeamAccessControls_ = new ArrayList<>(Arrays.asList(newTeamAccessControls.split(",")));
|
List<String> newTeamAccessControls_ = new ArrayList<>(Arrays.asList(newTeamAccessControls.split(",")));
|
||||||
|
|
||||||
for (int i = 0; i < newTeamAccessControls_.size(); i++) {
|
for (int i = 0; i < newTeamAccessControls_.size(); i++) {
|
||||||
|
|
||||||
newTeamAccessControls_.set(i, newTeamAccessControls_.get(i).trim());
|
newTeamAccessControls_.set(i, newTeamAccessControls_.get(i).trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
createNewTeamCall(instanceUrl, instanceToken, orgName, newTeamName, newTeamDesc, newTeamPermission, newTeamAccessControls_, loginUid);
|
createNewTeamCall(instanceUrl, instanceToken, orgName, newTeamName, newTeamDesc, newTeamPermission, newTeamAccessControls_, loginUid);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createNewTeamCall(final String instanceUrl, final String instanceToken, String orgName, String newTeamName, String newTeamDesc, String newTeamPermission, List<String> newTeamAccessControls, String loginUid) {
|
private void createNewTeamCall(final String instanceUrl, final String instanceToken, String orgName, String newTeamName, String newTeamDesc, String newTeamPermission, List<String> newTeamAccessControls, String loginUid) {
|
||||||
@ -316,6 +306,7 @@ public class CreateTeamByOrgActivity extends BaseActivity implements View.OnClic
|
|||||||
public void onResponse(@NonNull Call<Teams> call, @NonNull retrofit2.Response<Teams> response2) {
|
public void onResponse(@NonNull Call<Teams> call, @NonNull retrofit2.Response<Teams> response2) {
|
||||||
|
|
||||||
if(response2.isSuccessful()) {
|
if(response2.isSuccessful()) {
|
||||||
|
|
||||||
if(response2.code() == 201) {
|
if(response2.code() == 201) {
|
||||||
|
|
||||||
TinyDB tinyDb = new TinyDB(appCtx);
|
TinyDB tinyDb = new TinyDB(appCtx);
|
||||||
@ -324,7 +315,6 @@ public class CreateTeamByOrgActivity extends BaseActivity implements View.OnClic
|
|||||||
Toasty.success(ctx, getString(R.string.teamCreated));
|
Toasty.success(ctx, getString(R.string.teamCreated));
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response2.code() == 404) {
|
else if(response2.code() == 404) {
|
||||||
|
|
||||||
@ -341,7 +331,6 @@ public class CreateTeamByOrgActivity extends BaseActivity implements View.OnClic
|
|||||||
|
|
||||||
Toasty.error(ctx, getString(R.string.teamCreatedError));
|
Toasty.error(ctx, getString(R.string.teamCreatedError));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -356,6 +345,7 @@ public class CreateTeamByOrgActivity extends BaseActivity implements View.OnClic
|
|||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
|
||||||
if(v == createTeamButton) {
|
if(v == createTeamButton) {
|
||||||
|
|
||||||
processCreateTeam();
|
processCreateTeam();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@ public class DeepLinksActivity extends BaseActivity {
|
|||||||
private TinyDB tinyDb;
|
private TinyDB tinyDb;
|
||||||
private String currentInstance;
|
private String currentInstance;
|
||||||
private String instanceToken;
|
private String instanceToken;
|
||||||
|
private boolean noAccountFound = false;
|
||||||
|
|
||||||
private Intent mainIntent;
|
private Intent mainIntent;
|
||||||
private Intent issueIntent;
|
private Intent issueIntent;
|
||||||
@ -94,15 +95,22 @@ public class DeepLinksActivity extends BaseActivity {
|
|||||||
currentInstance = userAccounts.get(i).getInstanceUrl();
|
currentInstance = userAccounts.get(i).getInstanceUrl();
|
||||||
instanceToken = userAccounts.get(i).getToken();
|
instanceToken = userAccounts.get(i).getToken();
|
||||||
|
|
||||||
if(!hostUri.contains(Objects.requireNonNull(data.getHost()))) {
|
if(hostUri.toLowerCase().contains(Objects.requireNonNull(data.getHost().toLowerCase()))) {
|
||||||
|
|
||||||
// check for valid instance
|
noAccountFound = false;
|
||||||
checkInstance(data);
|
break;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
noAccountFound = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(noAccountFound) {
|
||||||
|
|
||||||
|
checkInstance(data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// redirect to proper fragment/activity, If no action is there, show options where user to want to go like repos, profile, notifications etc
|
// redirect to proper fragment/activity, If no action is there, show options where user to want to go like repos, profile, notifications etc
|
||||||
if(data.getPathSegments().size() > 0) {
|
if(data.getPathSegments().size() > 0) {
|
||||||
|
|
||||||
@ -113,7 +121,6 @@ public class DeepLinksActivity extends BaseActivity {
|
|||||||
|
|
||||||
if(!Objects.requireNonNull(data.getLastPathSegment()).contains("issues") & StringUtils.isNumeric(data.getLastPathSegment())) {
|
if(!Objects.requireNonNull(data.getLastPathSegment()).contains("issues") & StringUtils.isNumeric(data.getLastPathSegment())) {
|
||||||
|
|
||||||
|
|
||||||
issueIntent.putExtra("issueNumber", data.getLastPathSegment());
|
issueIntent.putExtra("issueNumber", data.getLastPathSegment());
|
||||||
|
|
||||||
tinyDb.putString("issueNumber", data.getLastPathSegment());
|
tinyDb.putString("issueNumber", data.getLastPathSegment());
|
||||||
@ -222,7 +229,6 @@ public class DeepLinksActivity extends BaseActivity {
|
|||||||
viewBinding.repository.setOnClickListener(repository -> {
|
viewBinding.repository.setOnClickListener(repository -> {
|
||||||
|
|
||||||
tinyDb.putInt("defaultScreenId", 1);
|
tinyDb.putInt("defaultScreenId", 1);
|
||||||
tinyDb.putString("defaultScreenStr", getResources().getString(R.string.navRepos));
|
|
||||||
mainIntent.putExtra("launchFragmentByLinkHandler", "repos");
|
mainIntent.putExtra("launchFragmentByLinkHandler", "repos");
|
||||||
ctx.startActivity(mainIntent);
|
ctx.startActivity(mainIntent);
|
||||||
finish();
|
finish();
|
||||||
@ -231,7 +237,6 @@ public class DeepLinksActivity extends BaseActivity {
|
|||||||
viewBinding.organization.setOnClickListener(organization -> {
|
viewBinding.organization.setOnClickListener(organization -> {
|
||||||
|
|
||||||
tinyDb.putInt("defaultScreenId", 2);
|
tinyDb.putInt("defaultScreenId", 2);
|
||||||
tinyDb.putString("defaultScreenStr", getResources().getString(R.string.navOrgs));
|
|
||||||
mainIntent.putExtra("launchFragmentByLinkHandler", "org");
|
mainIntent.putExtra("launchFragmentByLinkHandler", "org");
|
||||||
ctx.startActivity(mainIntent);
|
ctx.startActivity(mainIntent);
|
||||||
finish();
|
finish();
|
||||||
@ -240,7 +245,6 @@ public class DeepLinksActivity extends BaseActivity {
|
|||||||
viewBinding.notification.setOnClickListener(notification -> {
|
viewBinding.notification.setOnClickListener(notification -> {
|
||||||
|
|
||||||
tinyDb.putInt("defaultScreenId", 3);
|
tinyDb.putInt("defaultScreenId", 3);
|
||||||
tinyDb.putString("defaultScreenStr", getResources().getString(R.string.pageTitleNotifications));
|
|
||||||
mainIntent.putExtra("launchFragmentByLinkHandler", "notification");
|
mainIntent.putExtra("launchFragmentByLinkHandler", "notification");
|
||||||
ctx.startActivity(mainIntent);
|
ctx.startActivity(mainIntent);
|
||||||
finish();
|
finish();
|
||||||
@ -249,7 +253,6 @@ public class DeepLinksActivity extends BaseActivity {
|
|||||||
viewBinding.explore.setOnClickListener(explore -> {
|
viewBinding.explore.setOnClickListener(explore -> {
|
||||||
|
|
||||||
tinyDb.putInt("defaultScreenId", 4);
|
tinyDb.putInt("defaultScreenId", 4);
|
||||||
tinyDb.putString("defaultScreenStr", getResources().getString(R.string.navExplore));
|
|
||||||
mainIntent.putExtra("launchFragmentByLinkHandler", "explore");
|
mainIntent.putExtra("launchFragmentByLinkHandler", "explore");
|
||||||
ctx.startActivity(mainIntent);
|
ctx.startActivity(mainIntent);
|
||||||
finish();
|
finish();
|
||||||
@ -258,7 +261,6 @@ public class DeepLinksActivity extends BaseActivity {
|
|||||||
viewBinding.launchApp2.setOnClickListener(launchApp2 -> {
|
viewBinding.launchApp2.setOnClickListener(launchApp2 -> {
|
||||||
|
|
||||||
tinyDb.putInt("defaultScreenId", 0);
|
tinyDb.putInt("defaultScreenId", 0);
|
||||||
tinyDb.putString("defaultScreenStr", getResources().getString(R.string.generalDeepLinkSelectedText));
|
|
||||||
ctx.startActivity(mainIntent);
|
ctx.startActivity(mainIntent);
|
||||||
finish();
|
finish();
|
||||||
});
|
});
|
||||||
@ -325,6 +327,11 @@ public class DeepLinksActivity extends BaseActivity {
|
|||||||
finish();
|
finish();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
Toasty.error(ctx, getResources().getString(R.string.versionUnknown));
|
||||||
|
finish();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -7,6 +7,7 @@ import android.os.Bundle;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
@ -72,6 +73,7 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
|
|||||||
return R.layout.activity_edit_issue;
|
return R.layout.activity_edit_issue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
||||||
@ -99,6 +101,7 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
|
|||||||
|
|
||||||
// if gitea is 1.12 or higher use the new limit
|
// if gitea is 1.12 or higher use the new limit
|
||||||
if(new Version(tinyDb.getString("giteaVersion")).higherOrEqual("1.12.0")) {
|
if(new Version(tinyDb.getString("giteaVersion")).higherOrEqual("1.12.0")) {
|
||||||
|
|
||||||
resultLimit = StaticGlobalVariables.resultLimitNewGiteaInstances;
|
resultLimit = StaticGlobalVariables.resultLimitNewGiteaInstances;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,6 +109,17 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
|
|||||||
assert imm != null;
|
assert imm != null;
|
||||||
imm.showSoftInput(editIssueTitle, InputMethodManager.SHOW_IMPLICIT);
|
imm.showSoftInput(editIssueTitle, InputMethodManager.SHOW_IMPLICIT);
|
||||||
|
|
||||||
|
editIssueDescription.setOnTouchListener((touchView, motionEvent) -> {
|
||||||
|
|
||||||
|
touchView.getParent().requestDisallowInterceptTouchEvent(true);
|
||||||
|
|
||||||
|
if ((motionEvent.getAction() & MotionEvent.ACTION_UP) != 0 && (motionEvent.getActionMasked() & MotionEvent.ACTION_UP) != 0) {
|
||||||
|
|
||||||
|
touchView.getParent().requestDisallowInterceptTouchEvent(false);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
editIssueMilestoneSpinner = findViewById(R.id.editIssueMilestoneSpinner);
|
editIssueMilestoneSpinner = findViewById(R.id.editIssueMilestoneSpinner);
|
||||||
|
|
||||||
initCloseListener();
|
initCloseListener();
|
||||||
@ -117,9 +131,11 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
|
|||||||
if(!tinyDb.getString("issueNumber").isEmpty()) {
|
if(!tinyDb.getString("issueNumber").isEmpty()) {
|
||||||
|
|
||||||
if(tinyDb.getString("issueType").equalsIgnoreCase("Pull")) {
|
if(tinyDb.getString("issueType").equalsIgnoreCase("Pull")) {
|
||||||
|
|
||||||
toolbar_title.setText(getString(R.string.editPrNavHeader, String.valueOf(issueIndex)));
|
toolbar_title.setText(getString(R.string.editPrNavHeader, String.valueOf(issueIndex)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
toolbar_title.setText(getString(R.string.editIssueNavHeader, String.valueOf(issueIndex)));
|
toolbar_title.setText(getString(R.string.editIssueNavHeader, String.valueOf(issueIndex)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -145,25 +161,25 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
|
|||||||
|
|
||||||
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (editIssueTitleForm.equals("")) {
|
if (editIssueTitleForm.equals("")) {
|
||||||
|
|
||||||
Toasty.error(ctx, getString(R.string.issueTitleEmpty));
|
Toasty.error(ctx, getString(R.string.issueTitleEmpty));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (editIssueDueDateForm.equals("")) {
|
if (editIssueDueDateForm.equals("")) {
|
||||||
|
|
||||||
editIssueDueDateForm = null;
|
editIssueDueDateForm = null;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
editIssueDueDateForm = (AppUtil.customDateCombine(AppUtil.customDateFormat(editIssueDueDateForm)));
|
editIssueDueDateForm = (AppUtil.customDateCombine(AppUtil.customDateFormat(editIssueDueDateForm)));
|
||||||
}
|
}
|
||||||
|
|
||||||
disableProcessButton();
|
disableProcessButton();
|
||||||
editIssue(instanceUrl, instanceToken, repoOwner, repoName, issueIndex, loginUid, editIssueTitleForm, editIssueDescriptionForm, editIssueDueDateForm, milestoneId);
|
editIssue(instanceUrl, instanceToken, repoOwner, repoName, issueIndex, loginUid, editIssueTitleForm, editIssueDescriptionForm, editIssueDueDateForm, milestoneId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void editIssue(String instanceUrl, String instanceToken, String repoOwner, String repoName, int issueIndex, String loginUid, String title, String description, String dueDate, int milestoneId) {
|
private void editIssue(String instanceUrl, String instanceToken, String repoOwner, String repoName, int issueIndex, String loginUid, String title, String description, String dueDate, int milestoneId) {
|
||||||
@ -194,7 +210,6 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
|
|||||||
tinyDb.putBoolean("issueEdited", true);
|
tinyDb.putBoolean("issueEdited", true);
|
||||||
tinyDb.putBoolean("resumeIssues", true);
|
tinyDb.putBoolean("resumeIssues", true);
|
||||||
finish();
|
finish();
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 401) {
|
else if(response.code() == 401) {
|
||||||
|
|
||||||
@ -203,19 +218,17 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
|
|||||||
getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||||
getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
||||||
getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.error(ctx, getString(R.string.genericError));
|
Toasty.error(ctx, getString(R.string.genericError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@NonNull Call<JsonElement> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<JsonElement> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
Log.e("onFailure", t.toString());
|
Log.e("onFailure", t.toString());
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
}
|
}
|
||||||
@ -236,9 +249,9 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
|
|||||||
DatePickerDialog datePickerDialog = new DatePickerDialog(this,
|
DatePickerDialog datePickerDialog = new DatePickerDialog(this,
|
||||||
(view, year, monthOfYear, dayOfMonth) -> editIssueDueDate.setText(getString(R.string.setDueDate, year, (monthOfYear + 1), dayOfMonth)), mYear, mMonth, mDay);
|
(view, year, monthOfYear, dayOfMonth) -> editIssueDueDate.setText(getString(R.string.setDueDate, year, (monthOfYear + 1), dayOfMonth)), mYear, mMonth, mDay);
|
||||||
datePickerDialog.show();
|
datePickerDialog.show();
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(v == editIssueButton) {
|
else if(v == editIssueButton) {
|
||||||
|
|
||||||
processEditIssue();
|
processEditIssue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,9 +332,7 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
|
|||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -354,7 +365,6 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
|
|||||||
|
|
||||||
Toasty.error(ctx, getString(R.string.genericError));
|
Toasty.error(ctx, getString(R.string.genericError));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -88,16 +88,17 @@ public class FileDiffActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getPullDiffContent(instanceUrl, repoOwner, repoName, pullIndex, instanceToken, apiCall);
|
getPullDiffContent(instanceUrl, repoOwner, repoName, pullIndex, instanceToken, apiCall);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getPullDiffContent(String instanceUrl, String owner, String repo, String pullIndex, String token, boolean apiCall) {
|
private void getPullDiffContent(String instanceUrl, String owner, String repo, String pullIndex, String token, boolean apiCall) {
|
||||||
|
|
||||||
Call<ResponseBody> call;
|
Call<ResponseBody> call;
|
||||||
if(apiCall) {
|
if(apiCall) {
|
||||||
|
|
||||||
call = RetrofitClient.getInstance(instanceUrl, ctx).getApiInterface().getPullDiffContent(token, owner, repo, pullIndex);
|
call = RetrofitClient.getInstance(instanceUrl, ctx).getApiInterface().getPullDiffContent(token, owner, repo, pullIndex);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
call = RetrofitClient.getInstance(instanceUrl, ctx).getWebInterface().getPullDiffContent(owner, repo, pullIndex);
|
call = RetrofitClient.getInstance(instanceUrl, ctx).getWebInterface().getPullDiffContent(owner, repo, pullIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,16 +110,18 @@ public class FileDiffActivity extends BaseActivity {
|
|||||||
if(response.code() == 200) {
|
if(response.code() == 200) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
assert response.body() != null;
|
assert response.body() != null;
|
||||||
|
|
||||||
AppUtil appUtil = new AppUtil();
|
|
||||||
List<FileDiffView> fileContentsArray = ParseDiff.getFileDiffViewArray(response.body().string());
|
List<FileDiffView> fileContentsArray = ParseDiff.getFileDiffViewArray(response.body().string());
|
||||||
|
|
||||||
int filesCount = fileContentsArray.size();
|
int filesCount = fileContentsArray.size();
|
||||||
if(filesCount > 1) {
|
if(filesCount > 1) {
|
||||||
|
|
||||||
toolbarTitle.setText(getResources().getString(R.string.fileDiffViewHeader, Integer.toString(filesCount)));
|
toolbarTitle.setText(getResources().getString(R.string.fileDiffViewHeader, Integer.toString(filesCount)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
toolbarTitle.setText(getResources().getString(R.string.fileDiffViewHeaderSingle, Integer.toString(filesCount)));
|
toolbarTitle.setText(getResources().getString(R.string.fileDiffViewHeaderSingle, Integer.toString(filesCount)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,34 +129,28 @@ public class FileDiffActivity extends BaseActivity {
|
|||||||
mListView.setAdapter(adapter);
|
mListView.setAdapter(adapter);
|
||||||
|
|
||||||
mProgressBar.setVisibility(View.GONE);
|
mProgressBar.setVisibility(View.GONE);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch(IOException e) {
|
catch(IOException e) {
|
||||||
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 401) {
|
else if(response.code() == 401) {
|
||||||
|
|
||||||
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle), getResources().getString(R.string.alertDialogTokenRevokedMessage), getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton), getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle), getResources().getString(R.string.alertDialogTokenRevokedMessage), getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton), getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 403) {
|
else if(response.code() == 403) {
|
||||||
|
|
||||||
Toasty.error(ctx, ctx.getString(R.string.authorizeError));
|
Toasty.error(ctx, ctx.getString(R.string.authorizeError));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 404) {
|
else if(response.code() == 404) {
|
||||||
|
|
||||||
Toasty.warning(ctx, ctx.getString(R.string.apiNotFound));
|
Toasty.warning(ctx, ctx.getString(R.string.apiNotFound));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.error(ctx, getString(R.string.labelGeneralError));
|
Toasty.error(ctx, getString(R.string.labelGeneralError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -174,5 +171,4 @@ public class FileDiffActivity extends BaseActivity {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package org.mian.gitnex.activities;
|
package org.mian.gitnex.activities;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
@ -21,9 +22,13 @@ import android.widget.ImageView;
|
|||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import androidx.activity.result.ActivityResult;
|
||||||
|
import androidx.activity.result.ActivityResultCallback;
|
||||||
|
import androidx.activity.result.ActivityResultLauncher;
|
||||||
|
import androidx.activity.result.contract.ActivityResultContracts;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
import com.github.barteksc.pdfviewer.PDFView;
|
import com.github.barteksc.pdfviewer.PDFView;
|
||||||
import com.github.barteksc.pdfviewer.util.FitPolicy;
|
import com.github.barteksc.pdfviewer.util.FitPolicy;
|
||||||
import com.github.chrisbanes.photoview.PhotoView;
|
import com.github.chrisbanes.photoview.PhotoView;
|
||||||
@ -140,18 +145,15 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
|
|||||||
singleFileName = URLDecoder.decode(singleFileName, "UTF-8");
|
singleFileName = URLDecoder.decode(singleFileName, "UTF-8");
|
||||||
singleFileName = singleFileName.replaceAll("//", "/");
|
singleFileName = singleFileName.replaceAll("//", "/");
|
||||||
singleFileName = singleFileName.startsWith("/") ? singleFileName.substring(1) : singleFileName;
|
singleFileName = singleFileName.startsWith("/") ? singleFileName.substring(1) : singleFileName;
|
||||||
|
|
||||||
}
|
}
|
||||||
catch(UnsupportedEncodingException e) {
|
catch(UnsupportedEncodingException e) {
|
||||||
|
|
||||||
Log.i("singleFileName", singleFileName);
|
Log.i("singleFileName", singleFileName);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
toolbar_title.setText(singleFileName);
|
toolbar_title.setText(singleFileName);
|
||||||
|
|
||||||
getSingleFileContents(instanceUrl, instanceToken, repoOwner, repoName, singleFileName, repoBranch);
|
getSingleFileContents(instanceUrl, instanceToken, repoOwner, repoName, singleFileName, repoBranch);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -169,6 +171,7 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
|
|||||||
String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
|
String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
|
||||||
|
|
||||||
if(tinyDb.getBoolean("fileModified")) {
|
if(tinyDb.getBoolean("fileModified")) {
|
||||||
|
|
||||||
getSingleFileContents(instanceUrl, instanceToken, repoOwner, repoName, singleFileName, repoBranch);
|
getSingleFileContents(instanceUrl, instanceToken, repoOwner, repoName, singleFileName, repoBranch);
|
||||||
tinyDb.putBoolean("fileModified", false);
|
tinyDb.putBoolean("fileModified", false);
|
||||||
}
|
}
|
||||||
@ -209,7 +212,6 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
|
|||||||
imageData = Base64.decode(response.body().getContent(), Base64.DEFAULT);
|
imageData = Base64.decode(response.body().getContent(), Base64.DEFAULT);
|
||||||
Drawable imageDrawable = new BitmapDrawable(getResources(), BitmapFactory.decodeByteArray(imageData, 0, imageData.length));
|
Drawable imageDrawable = new BitmapDrawable(getResources(), BitmapFactory.decodeByteArray(imageData, 0, imageData.length));
|
||||||
imageView.setImageDrawable(imageDrawable);
|
imageView.setImageDrawable(imageDrawable);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(appUtil.sourceCodeExtension(fileExtension)) { // file is sourcecode
|
else if(appUtil.sourceCodeExtension(fileExtension)) { // file is sourcecode
|
||||||
|
|
||||||
@ -219,27 +221,33 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
|
|||||||
singleCodeContents.setVisibility(View.VISIBLE);
|
singleCodeContents.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
switch(tinyDb.getInt("fileviewerSourceCodeThemeId")) {
|
switch(tinyDb.getInt("fileviewerSourceCodeThemeId")) {
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
|
|
||||||
singleCodeContents.setTheme(Theme.ARDUINO_LIGHT);
|
singleCodeContents.setTheme(Theme.ARDUINO_LIGHT);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
|
||||||
singleCodeContents.setTheme(Theme.GITHUB);
|
singleCodeContents.setTheme(Theme.GITHUB);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
|
|
||||||
singleCodeContents.setTheme(Theme.FAR);
|
singleCodeContents.setTheme(Theme.FAR);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
|
|
||||||
singleCodeContents.setTheme(Theme.IR_BLACK);
|
singleCodeContents.setTheme(Theme.IR_BLACK);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
|
|
||||||
singleCodeContents.setTheme(Theme.ANDROID_STUDIO);
|
singleCodeContents.setTheme(Theme.ANDROID_STUDIO);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
||||||
singleCodeContents.setTheme(Theme.MONOKAI_SUBLIME);
|
singleCodeContents.setTheme(Theme.MONOKAI_SUBLIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
singleCodeContents.setSource(appUtil.decodeBase64(response.body().getContent()));
|
singleCodeContents.setSource(appUtil.decodeBase64(response.body().getContent()));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(appUtil.pdfExtension(fileExtension)) { // file is pdf
|
else if(appUtil.pdfExtension(fileExtension)) { // file is pdf
|
||||||
|
|
||||||
@ -264,7 +272,6 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
|
|||||||
singleFileContents.setText(getResources().getString(R.string.excludeFilesInFileviewer));
|
singleFileContents.setText(getResources().getString(R.string.excludeFilesInFileviewer));
|
||||||
singleFileContents.setGravity(Gravity.CENTER);
|
singleFileContents.setGravity(Gravity.CENTER);
|
||||||
singleFileContents.setTypeface(null, Typeface.BOLD);
|
singleFileContents.setTypeface(null, Typeface.BOLD);
|
||||||
|
|
||||||
}
|
}
|
||||||
else { // file type not known - plain text view
|
else { // file type not known - plain text view
|
||||||
|
|
||||||
@ -274,37 +281,30 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
|
|||||||
singleFileContentsFrame.setVisibility(View.VISIBLE);
|
singleFileContentsFrame.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
singleFileContents.setText(appUtil.decodeBase64(response.body().getContent()));
|
singleFileContents.setText(appUtil.decodeBase64(response.body().getContent()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
singleFileContents.setText("");
|
singleFileContents.setText("");
|
||||||
mProgressBar.setVisibility(View.GONE);
|
mProgressBar.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 401) {
|
else if(response.code() == 401) {
|
||||||
|
|
||||||
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle), getResources().getString(R.string.alertDialogTokenRevokedMessage), getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton), getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle), getResources().getString(R.string.alertDialogTokenRevokedMessage), getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton), getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 403) {
|
else if(response.code() == 403) {
|
||||||
|
|
||||||
Toasty.error(ctx, ctx.getString(R.string.authorizeError));
|
Toasty.error(ctx, ctx.getString(R.string.authorizeError));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 404) {
|
else if(response.code() == 404) {
|
||||||
|
|
||||||
Toasty.warning(ctx, ctx.getString(R.string.apiNotFound));
|
Toasty.warning(ctx, ctx.getString(R.string.apiNotFound));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.error(ctx, getString(R.string.labelGeneralError));
|
Toasty.error(ctx, getString(R.string.labelGeneralError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -324,7 +324,9 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
|
|||||||
inflater.inflate(R.menu.files_view_menu, menu);
|
inflater.inflate(R.menu.files_view_menu, menu);
|
||||||
|
|
||||||
String fileExtension = FileUtils.getExtension(singleFileName);
|
String fileExtension = FileUtils.getExtension(singleFileName);
|
||||||
|
|
||||||
if(!fileExtension.equalsIgnoreCase("md")) {
|
if(!fileExtension.equalsIgnoreCase("md")) {
|
||||||
|
|
||||||
menu.getItem(0).setVisible(false);
|
menu.getItem(0).setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -336,89 +338,90 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
|
|||||||
|
|
||||||
int id = item.getItemId();
|
int id = item.getItemId();
|
||||||
|
|
||||||
switch(id) {
|
if(id == android.R.id.home) {
|
||||||
case android.R.id.home:
|
|
||||||
|
|
||||||
finish();
|
finish();
|
||||||
return true;
|
return true;
|
||||||
case R.id.genericMenu:
|
|
||||||
|
|
||||||
BottomSheetFileViewerFragment bottomSheet = new BottomSheetFileViewerFragment();
|
|
||||||
bottomSheet.show(getSupportFragmentManager(), "fileViewerBottomSheet");
|
|
||||||
return true;
|
|
||||||
case R.id.markdown:
|
|
||||||
|
|
||||||
final Markwon markwon = Markwon.builder(Objects.requireNonNull(ctx)).usePlugin(CorePlugin.create())
|
|
||||||
.usePlugin(ImagesPlugin.create(plugin -> {
|
|
||||||
plugin.addSchemeHandler(new SchemeHandler() {
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public ImageItem handle(@NonNull String raw, @NonNull Uri uri) {
|
|
||||||
|
|
||||||
final int resourceId = ctx.getResources().getIdentifier(
|
|
||||||
raw.substring("drawable://".length()),
|
|
||||||
"drawable",
|
|
||||||
ctx.getPackageName());
|
|
||||||
|
|
||||||
final Drawable drawable = ctx.getDrawable(resourceId);
|
|
||||||
|
|
||||||
assert drawable != null;
|
|
||||||
return ImageItem.withResult(drawable);
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public Collection<String> supportedSchemes() {
|
|
||||||
|
|
||||||
return Collections.singleton("drawable");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
plugin.placeholderProvider(drawable -> null);
|
|
||||||
plugin.addMediaDecoder(GifMediaDecoder.create(false));
|
|
||||||
plugin.addMediaDecoder(SvgMediaDecoder.create(ctx.getResources()));
|
|
||||||
plugin.addMediaDecoder(SvgMediaDecoder.create());
|
|
||||||
plugin.defaultMediaDecoder(DefaultMediaDecoder.create(ctx.getResources()));
|
|
||||||
plugin.defaultMediaDecoder(DefaultMediaDecoder.create());
|
|
||||||
}))
|
|
||||||
.usePlugin(new AbstractMarkwonPlugin() {
|
|
||||||
@Override
|
|
||||||
public void configureTheme(@NonNull MarkwonTheme.Builder builder) {
|
|
||||||
|
|
||||||
builder.codeTextColor(tinyDb.getInt("codeBlockColor")).codeBackgroundColor(tinyDb.getInt("codeBlockBackground"))
|
|
||||||
.linkColor(getResources().getColor(R.color.lightBlue));
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.usePlugin(TablePlugin.create(ctx))
|
|
||||||
.usePlugin(TaskListPlugin.create(ctx))
|
|
||||||
.usePlugin(HtmlPlugin.create())
|
|
||||||
.usePlugin(StrikethroughPlugin.create())
|
|
||||||
.usePlugin(LinkifyPlugin.create())
|
|
||||||
.build();
|
|
||||||
|
|
||||||
if(!tinyDb.getBoolean("enableMarkdownInFileView")) {
|
|
||||||
|
|
||||||
singleCodeContents.setVisibility(View.GONE);
|
|
||||||
singleFileContentsFrame.setVisibility(View.VISIBLE);
|
|
||||||
singleFileContents.setVisibility(View.VISIBLE);
|
|
||||||
Spanned bodyWithMD = markwon.toMarkdown(appUtil.decodeBase64(tinyDb.getString("downloadFileContents")));
|
|
||||||
markwon.setParsedMarkdown(singleFileContents, bodyWithMD);
|
|
||||||
tinyDb.putBoolean("enableMarkdownInFileView", true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
singleCodeContents.setVisibility(View.VISIBLE);
|
|
||||||
singleFileContentsFrame.setVisibility(View.GONE);
|
|
||||||
singleFileContents.setVisibility(View.GONE);
|
|
||||||
singleCodeContents.setSource(appUtil.decodeBase64(tinyDb.getString("downloadFileContents")));
|
|
||||||
tinyDb.putBoolean("enableMarkdownInFileView", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
}
|
||||||
|
else if(id == R.id.genericMenu) {
|
||||||
|
|
||||||
|
BottomSheetFileViewerFragment bottomSheet = new BottomSheetFileViewerFragment();
|
||||||
|
bottomSheet.show(getSupportFragmentManager(), "fileViewerBottomSheet");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(id == R.id.markdown) {
|
||||||
|
|
||||||
|
final Markwon markwon = Markwon.builder(Objects.requireNonNull(ctx)).usePlugin(CorePlugin.create())
|
||||||
|
.usePlugin(ImagesPlugin.create(plugin -> {
|
||||||
|
plugin.addSchemeHandler(new SchemeHandler() {
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public ImageItem handle(@NonNull String raw, @NonNull Uri uri) {
|
||||||
|
|
||||||
|
final int resourceId = ctx.getResources().getIdentifier(
|
||||||
|
raw.substring("drawable://".length()),
|
||||||
|
"drawable",
|
||||||
|
ctx.getPackageName());
|
||||||
|
|
||||||
|
final Drawable drawable = ContextCompat.getDrawable(ctx, resourceId);
|
||||||
|
|
||||||
|
assert drawable != null;
|
||||||
|
return ImageItem.withResult(drawable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public Collection<String> supportedSchemes() {
|
||||||
|
|
||||||
|
return Collections.singleton("drawable");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
plugin.placeholderProvider(drawable -> null);
|
||||||
|
plugin.addMediaDecoder(GifMediaDecoder.create(false));
|
||||||
|
plugin.addMediaDecoder(SvgMediaDecoder.create(ctx.getResources()));
|
||||||
|
plugin.addMediaDecoder(SvgMediaDecoder.create());
|
||||||
|
plugin.defaultMediaDecoder(DefaultMediaDecoder.create(ctx.getResources()));
|
||||||
|
plugin.defaultMediaDecoder(DefaultMediaDecoder.create());
|
||||||
|
}))
|
||||||
|
.usePlugin(new AbstractMarkwonPlugin() {
|
||||||
|
@Override
|
||||||
|
public void configureTheme(@NonNull MarkwonTheme.Builder builder) {
|
||||||
|
|
||||||
|
builder.codeTextColor(tinyDb.getInt("codeBlockColor")).codeBackgroundColor(tinyDb.getInt("codeBlockBackground"))
|
||||||
|
.linkColor(getResources().getColor(R.color.lightBlue));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.usePlugin(TablePlugin.create(ctx))
|
||||||
|
.usePlugin(TaskListPlugin.create(ctx))
|
||||||
|
.usePlugin(HtmlPlugin.create())
|
||||||
|
.usePlugin(StrikethroughPlugin.create())
|
||||||
|
.usePlugin(LinkifyPlugin.create())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
if(!tinyDb.getBoolean("enableMarkdownInFileView")) {
|
||||||
|
|
||||||
|
singleCodeContents.setVisibility(View.GONE);
|
||||||
|
singleFileContentsFrame.setVisibility(View.VISIBLE);
|
||||||
|
singleFileContents.setVisibility(View.VISIBLE);
|
||||||
|
Spanned bodyWithMD = markwon.toMarkdown(appUtil.decodeBase64(tinyDb.getString("downloadFileContents")));
|
||||||
|
markwon.setParsedMarkdown(singleFileContents, bodyWithMD);
|
||||||
|
tinyDb.putBoolean("enableMarkdownInFileView", true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
singleCodeContents.setVisibility(View.VISIBLE);
|
||||||
|
singleFileContentsFrame.setVisibility(View.GONE);
|
||||||
|
singleFileContents.setVisibility(View.GONE);
|
||||||
|
singleCodeContents.setSource(appUtil.decodeBase64(tinyDb.getString("downloadFileContents")));
|
||||||
|
tinyDb.putBoolean("enableMarkdownInFileView", false);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -437,10 +440,13 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
|
|||||||
intent.putExtra("fileAction", 1);
|
intent.putExtra("fileAction", 1);
|
||||||
intent.putExtra("filePath", singleFileName);
|
intent.putExtra("filePath", singleFileName);
|
||||||
intent.putExtra("fileSha", fileSha);
|
intent.putExtra("fileSha", fileSha);
|
||||||
|
|
||||||
if(!appUtil.imageExtension(fileExtension)) {
|
if(!appUtil.imageExtension(fileExtension)) {
|
||||||
|
|
||||||
intent.putExtra("fileContents", data);
|
intent.putExtra("fileContents", data);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
intent.putExtra("fileContents", "");
|
intent.putExtra("fileContents", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -455,10 +461,13 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
|
|||||||
intent.putExtra("fileAction", 2);
|
intent.putExtra("fileAction", 2);
|
||||||
intent.putExtra("filePath", singleFileName);
|
intent.putExtra("filePath", singleFileName);
|
||||||
intent.putExtra("fileSha", fileSha);
|
intent.putExtra("fileSha", fileSha);
|
||||||
|
|
||||||
if(!appUtil.imageExtension(fileExtension)) {
|
if(!appUtil.imageExtension(fileExtension)) {
|
||||||
|
|
||||||
intent.putExtra("fileContents", data);
|
intent.putExtra("fileContents", data);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
intent.putExtra("fileContents", "");
|
intent.putExtra("fileContents", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -471,8 +480,6 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
|
|||||||
|
|
||||||
if(!tinyDb.getString("downloadFileContents").isEmpty()) {
|
if(!tinyDb.getString("downloadFileContents").isEmpty()) {
|
||||||
|
|
||||||
int CREATE_REQUEST_CODE = 40;
|
|
||||||
|
|
||||||
File outputFileName = new File(tinyDb.getString("downloadFileName"));
|
File outputFileName = new File(tinyDb.getString("downloadFileName"));
|
||||||
|
|
||||||
Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
|
Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
|
||||||
@ -481,48 +488,48 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
|
|||||||
intent.setType("*/*");
|
intent.setType("*/*");
|
||||||
intent.putExtra(Intent.EXTRA_TITLE, outputFileName.getName());
|
intent.putExtra(Intent.EXTRA_TITLE, outputFileName.getName());
|
||||||
|
|
||||||
startActivityForResult(intent, CREATE_REQUEST_CODE);
|
fileDownloadActivityResultLauncher.launch(intent);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.warning(ctx, getString(R.string.waitLoadingDownloadFile));
|
Toasty.warning(ctx, getString(R.string.waitLoadingDownloadFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
ActivityResultLauncher<Intent> fileDownloadActivityResultLauncher = registerForActivityResult(
|
||||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback<ActivityResult>() {
|
||||||
|
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
@Override
|
||||||
|
public void onActivityResult(ActivityResult result) {
|
||||||
|
|
||||||
if(requestCode == 40 && resultCode == RESULT_OK) {
|
if (result.getResultCode() == Activity.RESULT_OK) {
|
||||||
|
|
||||||
try {
|
Intent data = result.getData();
|
||||||
|
|
||||||
assert data != null;
|
try {
|
||||||
Uri uri = data.getData();
|
|
||||||
|
|
||||||
assert uri != null;
|
assert data != null;
|
||||||
OutputStream outputStream = getContentResolver().openOutputStream(uri);
|
Uri uri = data.getData();
|
||||||
|
|
||||||
byte[] dataAsBytes = Base64.decode(tinyDb.getString("downloadFileContents"), 0);
|
assert uri != null;
|
||||||
|
OutputStream outputStream = getContentResolver().openOutputStream(uri);
|
||||||
|
|
||||||
assert outputStream != null;
|
byte[] dataAsBytes = Base64.decode(tinyDb.getString("downloadFileContents"), 0);
|
||||||
outputStream.write(dataAsBytes);
|
|
||||||
outputStream.close();
|
|
||||||
|
|
||||||
Toasty.success(ctx, getString(R.string.downloadFileSaved));
|
assert outputStream != null;
|
||||||
|
outputStream.write(dataAsBytes);
|
||||||
|
outputStream.close();
|
||||||
|
|
||||||
|
Toasty.success(ctx, getString(R.string.downloadFileSaved));
|
||||||
|
|
||||||
|
}
|
||||||
|
catch(IOException e) {
|
||||||
|
|
||||||
|
Log.e("errorFileDownloading", Objects.requireNonNull(e.getMessage()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch(IOException e) {
|
|
||||||
|
|
||||||
Log.e("errorFileDownloading", Objects.requireNonNull(e.getMessage()));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
|
||||||
|
|
||||||
private void initCloseListener() {
|
private void initCloseListener() {
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ import android.widget.LinearLayout;
|
|||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.ScrollView;
|
import android.widget.ScrollView;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
@ -293,6 +294,7 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
dialogAssignees.show();
|
||||||
AssigneesActions.getRepositoryAssignees(ctx, instanceUrl, instanceToken, repoOwner, repoName, assigneesList, dialogAssignees, assigneesAdapter, assigneesBinding);
|
AssigneesActions.getRepositoryAssignees(ctx, instanceUrl, instanceToken, repoOwner, repoName, assigneesList, dialogAssignees, assigneesAdapter, assigneesBinding);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,6 +331,7 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
dialogLabels.show();
|
||||||
LabelsActions.getRepositoryLabels(ctx, instanceUrl, instanceToken, repoOwner, repoName, labelsList, dialogLabels, labelsAdapter, labelsBinding);
|
LabelsActions.getRepositoryLabels(ctx, instanceUrl, instanceToken, repoOwner, repoName, labelsList, dialogLabels, labelsAdapter, labelsBinding);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -458,18 +461,21 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
|
|||||||
|
|
||||||
int id = item.getItemId();
|
int id = item.getItemId();
|
||||||
|
|
||||||
switch(id) {
|
if(id == android.R.id.home) {
|
||||||
case android.R.id.home:
|
|
||||||
finish();
|
|
||||||
return true;
|
|
||||||
case R.id.genericMenu:
|
|
||||||
BottomSheetSingleIssueFragment bottomSheet = new BottomSheetSingleIssueFragment();
|
|
||||||
bottomSheet.show(getSupportFragmentManager(), "singleIssueBottomSheet");
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(id == R.id.genericMenu) {
|
||||||
|
|
||||||
|
BottomSheetSingleIssueFragment bottomSheet = new BottomSheetSingleIssueFragment();
|
||||||
|
bottomSheet.show(getSupportFragmentManager(), "singleIssueBottomSheet");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -478,6 +484,7 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
if(tinyDb.getBoolean("commentPosted")) {
|
if(tinyDb.getBoolean("commentPosted")) {
|
||||||
|
|
||||||
viewBinding.scrollViewComments.post(() -> {
|
viewBinding.scrollViewComments.post(() -> {
|
||||||
|
|
||||||
IssueCommentsViewModel
|
IssueCommentsViewModel
|
||||||
@ -487,18 +494,17 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
|
|||||||
new Handler(Looper.getMainLooper()).postDelayed(() -> viewBinding.scrollViewComments.fullScroll(ScrollView.FOCUS_DOWN), 1000);
|
new Handler(Looper.getMainLooper()).postDelayed(() -> viewBinding.scrollViewComments.fullScroll(ScrollView.FOCUS_DOWN), 1000);
|
||||||
|
|
||||||
tinyDb.putBoolean("commentPosted", false);
|
tinyDb.putBoolean("commentPosted", false);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tinyDb.getBoolean("commentEdited")) {
|
if(tinyDb.getBoolean("commentEdited")) {
|
||||||
|
|
||||||
viewBinding.scrollViewComments.post(() -> {
|
viewBinding.scrollViewComments.post(() -> {
|
||||||
|
|
||||||
IssueCommentsViewModel
|
IssueCommentsViewModel
|
||||||
.loadIssueComments(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), repoOwner, repoName, issueIndex,
|
.loadIssueComments(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), repoOwner, repoName, issueIndex,
|
||||||
ctx);
|
ctx);
|
||||||
tinyDb.putBoolean("commentEdited", false);
|
tinyDb.putBoolean("commentEdited", false);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -512,7 +518,6 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
|
|||||||
tinyDb.putBoolean("singleIssueUpdate", false);
|
tinyDb.putBoolean("singleIssueUpdate", false);
|
||||||
|
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tinyDb.getBoolean("issueEdited")) {
|
if(tinyDb.getBoolean("issueEdited")) {
|
||||||
@ -525,9 +530,7 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
|
|||||||
tinyDb.putBoolean("issueEdited", false);
|
tinyDb.putBoolean("issueEdited", false);
|
||||||
|
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fetchDataAsync(String instanceUrl, String instanceToken, String owner, String repo, int index, String loginUid) {
|
private void fetchDataAsync(String instanceUrl, String instanceToken, String owner, String repo, int index, String loginUid) {
|
||||||
@ -540,14 +543,13 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
|
|||||||
assert issueCommentsMain != null;
|
assert issueCommentsMain != null;
|
||||||
|
|
||||||
if(issueCommentsMain.size() > 0) {
|
if(issueCommentsMain.size() > 0) {
|
||||||
|
|
||||||
viewBinding.divider.setVisibility(View.VISIBLE);
|
viewBinding.divider.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
adapter = new IssueCommentsAdapter(ctx, getSupportFragmentManager(), issueCommentsMain);
|
adapter = new IssueCommentsAdapter(ctx, getSupportFragmentManager(), issueCommentsMain);
|
||||||
viewBinding.recyclerView.setAdapter(adapter);
|
viewBinding.recyclerView.setAdapter(adapter);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getSingleIssue(String instanceUrl, String instanceToken, String repoOwner, String repoName, int issueIndex, String loginUid) {
|
private void getSingleIssue(String instanceUrl, String instanceToken, String repoOwner, String repoName, int issueIndex, String loginUid) {
|
||||||
@ -567,6 +569,7 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
|
|||||||
assert singleIssue != null;
|
assert singleIssue != null;
|
||||||
|
|
||||||
viewBinding.issuePrState.setVisibility(View.VISIBLE);
|
viewBinding.issuePrState.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
if(singleIssue.getPull_request() != null) {
|
if(singleIssue.getPull_request() != null) {
|
||||||
|
|
||||||
if(singleIssue.getPull_request().isMerged()) { // merged
|
if(singleIssue.getPull_request().isMerged()) { // merged
|
||||||
@ -598,7 +601,7 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
|
|||||||
final int resourceId = ctx.getResources()
|
final int resourceId = ctx.getResources()
|
||||||
.getIdentifier(raw.substring("drawable://".length()), "drawable", ctx.getPackageName());
|
.getIdentifier(raw.substring("drawable://".length()), "drawable", ctx.getPackageName());
|
||||||
|
|
||||||
final Drawable drawable = ctx.getDrawable(resourceId);
|
final Drawable drawable = ContextCompat.getDrawable(ctx, resourceId);
|
||||||
|
|
||||||
assert drawable != null;
|
assert drawable != null;
|
||||||
return ImageItem.withResult(drawable);
|
return ImageItem.withResult(drawable);
|
||||||
@ -651,7 +654,9 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
|
|||||||
params1.setMargins(15, 0, 0, 0);
|
params1.setMargins(15, 0, 0, 0);
|
||||||
|
|
||||||
if(singleIssue.getAssignees() != null) {
|
if(singleIssue.getAssignees() != null) {
|
||||||
|
|
||||||
viewBinding.assigneesScrollView.setVisibility(View.VISIBLE);
|
viewBinding.assigneesScrollView.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
for(int i = 0; i < singleIssue.getAssignees().size(); i++) {
|
for(int i = 0; i < singleIssue.getAssignees().size(); i++) {
|
||||||
|
|
||||||
ImageView assigneesView = new ImageView(ctx);
|
ImageView assigneesView = new ImageView(ctx);
|
||||||
@ -663,17 +668,19 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
|
|||||||
viewBinding.frameAssignees.addView(assigneesView);
|
viewBinding.frameAssignees.addView(assigneesView);
|
||||||
assigneesView.setLayoutParams(params1);
|
assigneesView.setLayoutParams(params1);
|
||||||
if(!singleIssue.getAssignees().get(i).getFull_name().equals("")) {
|
if(!singleIssue.getAssignees().get(i).getFull_name().equals("")) {
|
||||||
|
|
||||||
assigneesView.setOnClickListener(
|
assigneesView.setOnClickListener(
|
||||||
new ClickListener(getString(R.string.assignedTo, singleIssue.getAssignees().get(i).getFull_name()), ctx));
|
new ClickListener(getString(R.string.assignedTo, singleIssue.getAssignees().get(i).getFull_name()), ctx));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
assigneesView.setOnClickListener(
|
assigneesView.setOnClickListener(
|
||||||
new ClickListener(getString(R.string.assignedTo, singleIssue.getAssignees().get(i).getLogin()), ctx));
|
new ClickListener(getString(R.string.assignedTo, singleIssue.getAssignees().get(i).getLogin()), ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
viewBinding.assigneesScrollView.setVisibility(View.GONE);
|
viewBinding.assigneesScrollView.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -682,6 +689,7 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
|
|||||||
params.setMargins(0, 0, 15, 0);
|
params.setMargins(0, 0, 15, 0);
|
||||||
|
|
||||||
if(singleIssue.getLabels() != null) {
|
if(singleIssue.getLabels() != null) {
|
||||||
|
|
||||||
viewBinding.labelsScrollView.setVisibility(View.VISIBLE);
|
viewBinding.labelsScrollView.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
for(int i = 0; i < singleIssue.getLabels().size(); i++) {
|
for(int i = 0; i < singleIssue.getLabels().size(); i++) {
|
||||||
@ -705,16 +713,17 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
|
|||||||
|
|
||||||
labelsView.setImageDrawable(drawable);
|
labelsView.setImageDrawable(drawable);
|
||||||
viewBinding.frameLabels.addView(labelsView);
|
viewBinding.frameLabels.addView(labelsView);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
viewBinding.labelsScrollView.setVisibility(View.GONE);
|
viewBinding.labelsScrollView.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(singleIssue.getDue_date() != null) {
|
if(singleIssue.getDue_date() != null) {
|
||||||
|
|
||||||
if(timeFormat.equals("normal") || timeFormat.equals("pretty")) {
|
if(timeFormat.equals("normal") || timeFormat.equals("pretty")) {
|
||||||
|
|
||||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd", new Locale(locale));
|
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd", new Locale(locale));
|
||||||
String dueDate = formatter.format(singleIssue.getDue_date());
|
String dueDate = formatter.format(singleIssue.getDue_date());
|
||||||
viewBinding.issueDueDate.setText(dueDate);
|
viewBinding.issueDueDate.setText(dueDate);
|
||||||
@ -722,11 +731,11 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
|
|||||||
.setOnClickListener(new ClickListener(TimeHelper.customDateFormatForToastDateFormat(singleIssue.getDue_date()), ctx));
|
.setOnClickListener(new ClickListener(TimeHelper.customDateFormatForToastDateFormat(singleIssue.getDue_date()), ctx));
|
||||||
}
|
}
|
||||||
else if(timeFormat.equals("normal1")) {
|
else if(timeFormat.equals("normal1")) {
|
||||||
|
|
||||||
DateFormat formatter = new SimpleDateFormat("dd-MM-yyyy", new Locale(locale));
|
DateFormat formatter = new SimpleDateFormat("dd-MM-yyyy", new Locale(locale));
|
||||||
String dueDate = formatter.format(singleIssue.getDue_date());
|
String dueDate = formatter.format(singleIssue.getDue_date());
|
||||||
viewBinding.issueDueDate.setText(dueDate);
|
viewBinding.issueDueDate.setText(dueDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
@ -736,6 +745,7 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
|
|||||||
String edited;
|
String edited;
|
||||||
|
|
||||||
if(!singleIssue.getUpdated_at().equals(singleIssue.getCreated_at())) {
|
if(!singleIssue.getUpdated_at().equals(singleIssue.getCreated_at())) {
|
||||||
|
|
||||||
edited = getString(R.string.colorfulBulletSpan) + getString(R.string.modifiedText);
|
edited = getString(R.string.colorfulBulletSpan) + getString(R.string.modifiedText);
|
||||||
viewBinding.issueModified.setVisibility(View.VISIBLE);
|
viewBinding.issueModified.setVisibility(View.VISIBLE);
|
||||||
viewBinding.issueModified.setText(edited);
|
viewBinding.issueModified.setText(edited);
|
||||||
@ -743,22 +753,27 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
|
|||||||
.setOnClickListener(new ClickListener(TimeHelper.customDateFormatForToastDateFormat(singleIssue.getUpdated_at()), ctx));
|
.setOnClickListener(new ClickListener(TimeHelper.customDateFormatForToastDateFormat(singleIssue.getUpdated_at()), ctx));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
viewBinding.issueModified.setVisibility(View.INVISIBLE);
|
viewBinding.issueModified.setVisibility(View.INVISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((singleIssue.getDue_date() == null && singleIssue.getMilestone() == null) && singleIssue.getAssignees() != null) {
|
if((singleIssue.getDue_date() == null && singleIssue.getMilestone() == null) && singleIssue.getAssignees() != null) {
|
||||||
|
|
||||||
paramsDesc.setMargins(0, 35, 0, 0);
|
paramsDesc.setMargins(0, 35, 0, 0);
|
||||||
viewBinding.issueDescription.setLayoutParams(paramsDesc);
|
viewBinding.issueDescription.setLayoutParams(paramsDesc);
|
||||||
}
|
}
|
||||||
else if(singleIssue.getDue_date() == null && singleIssue.getMilestone() == null) {
|
else if(singleIssue.getDue_date() == null && singleIssue.getMilestone() == null) {
|
||||||
|
|
||||||
paramsDesc.setMargins(0, 55, 0, 0);
|
paramsDesc.setMargins(0, 55, 0, 0);
|
||||||
viewBinding.issueDescription.setLayoutParams(paramsDesc);
|
viewBinding.issueDescription.setLayoutParams(paramsDesc);
|
||||||
}
|
}
|
||||||
else if(singleIssue.getAssignees() == null) {
|
else if(singleIssue.getAssignees() == null) {
|
||||||
|
|
||||||
paramsDesc.setMargins(0, 35, 0, 0);
|
paramsDesc.setMargins(0, 35, 0, 0);
|
||||||
viewBinding.issueDescription.setLayoutParams(paramsDesc);
|
viewBinding.issueDescription.setLayoutParams(paramsDesc);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
paramsDesc.setMargins(0, 15, 0, 0);
|
paramsDesc.setMargins(0, 15, 0, 0);
|
||||||
viewBinding.issueDescription.setLayoutParams(paramsDesc);
|
viewBinding.issueDescription.setLayoutParams(paramsDesc);
|
||||||
}
|
}
|
||||||
@ -767,29 +782,33 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
|
|||||||
viewBinding.issueCreatedTime.setVisibility(View.VISIBLE);
|
viewBinding.issueCreatedTime.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
if(timeFormat.equals("pretty")) {
|
if(timeFormat.equals("pretty")) {
|
||||||
|
|
||||||
viewBinding.issueCreatedTime
|
viewBinding.issueCreatedTime
|
||||||
.setOnClickListener(new ClickListener(TimeHelper.customDateFormatForToastDateFormat(singleIssue.getCreated_at()), ctx));
|
.setOnClickListener(new ClickListener(TimeHelper.customDateFormatForToastDateFormat(singleIssue.getCreated_at()), ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(singleIssue.getMilestone() != null) {
|
if(singleIssue.getMilestone() != null) {
|
||||||
|
|
||||||
viewBinding.issueMilestone.setVisibility(View.VISIBLE);
|
viewBinding.issueMilestone.setVisibility(View.VISIBLE);
|
||||||
viewBinding.issueMilestone.setText(getString(R.string.issueMilestone, singleIssue.getMilestone().getTitle()));
|
viewBinding.issueMilestone.setText(getString(R.string.issueMilestone, singleIssue.getMilestone().getTitle()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
viewBinding.issueMilestone.setVisibility(View.GONE);
|
viewBinding.issueMilestone.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!singleIssue.getUser().getFull_name().equals("")) {
|
if(!singleIssue.getUser().getFull_name().equals("")) {
|
||||||
|
|
||||||
viewBinding.assigneeAvatar.setOnClickListener(
|
viewBinding.assigneeAvatar.setOnClickListener(
|
||||||
new ClickListener(ctx.getResources().getString(R.string.issueCreator) + singleIssue.getUser().getFull_name(), ctx));
|
new ClickListener(ctx.getResources().getString(R.string.issueCreator) + singleIssue.getUser().getFull_name(), ctx));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
viewBinding.assigneeAvatar.setOnClickListener(
|
viewBinding.assigneeAvatar.setOnClickListener(
|
||||||
new ClickListener(ctx.getResources().getString(R.string.issueCreator) + singleIssue.getUser().getLogin(), ctx));
|
new ClickListener(ctx.getResources().getString(R.string.issueCreator) + singleIssue.getUser().getLogin(), ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
viewBinding.progressBar.setVisibility(View.GONE);
|
viewBinding.progressBar.setVisibility(View.GONE);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 401) {
|
else if(response.code() == 401) {
|
||||||
|
|
||||||
@ -813,9 +832,7 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
|
|||||||
Intent mainIntent = new Intent(ctx, MainActivity.class);
|
Intent mainIntent = new Intent(ctx, MainActivity.class);
|
||||||
ctx.startActivity(mainIntent);
|
ctx.startActivity(mainIntent);
|
||||||
finish();
|
finish();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -840,21 +857,17 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt
|
|||||||
|
|
||||||
assert response.body() != null;
|
assert response.body() != null;
|
||||||
tinyDb.putBoolean("issueSubscribed", response.body().getSubscribed());
|
tinyDb.putBoolean("issueSubscribed", response.body().getSubscribed());
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
tinyDb.putBoolean("issueSubscribed", false);
|
tinyDb.putBoolean("issueSubscribed", false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@NonNull Call<WatchInfo> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<WatchInfo> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
tinyDb.putBoolean("issueSubscribed", false);
|
tinyDb.putBoolean("issueSubscribed", false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -92,6 +92,7 @@ public class LoginActivity extends BaseActivity {
|
|||||||
selectedProtocol = String.valueOf(parent.getItemAtPosition(position));
|
selectedProtocol = String.valueOf(parent.getItemAtPosition(position));
|
||||||
|
|
||||||
if(selectedProtocol.equals(String.valueOf(Protocol.HTTP))) {
|
if(selectedProtocol.equals(String.valueOf(Protocol.HTTP))) {
|
||||||
|
|
||||||
Toasty.warning(ctx, getResources().getString(R.string.protocolError));
|
Toasty.warning(ctx, getResources().getString(R.string.protocolError));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -141,9 +142,7 @@ public class LoginActivity extends BaseActivity {
|
|||||||
|
|
||||||
disableProcessButton();
|
disableProcessButton();
|
||||||
login();
|
login();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void login() {
|
private void login() {
|
||||||
@ -221,11 +220,9 @@ public class LoginActivity extends BaseActivity {
|
|||||||
Toasty.error(ctx, getResources().getString(R.string.loginTokenError));
|
Toasty.error(ctx, getResources().getString(R.string.loginTokenError));
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
versionCheck(instanceUrl.toString(), loginUid, loginPass, 123, loginToken, loginType);
|
versionCheck(instanceUrl.toString(), loginUid, loginPass, 123, loginToken, loginType);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -234,7 +231,6 @@ public class LoginActivity extends BaseActivity {
|
|||||||
Log.e("onFailure-login", e.toString());
|
Log.e("onFailure-login", e.toString());
|
||||||
Toasty.error(ctx, getResources().getString(R.string.malformedUrl));
|
Toasty.error(ctx, getResources().getString(R.string.malformedUrl));
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,7 +250,6 @@ public class LoginActivity extends BaseActivity {
|
|||||||
callVersion =
|
callVersion =
|
||||||
(loginOTP != 0) ? RetrofitClient.getInstance(instanceUrl, ctx).getApiInterface().getGiteaVersionWithOTP(credential, loginOTP) :
|
(loginOTP != 0) ? RetrofitClient.getInstance(instanceUrl, ctx).getApiInterface().getGiteaVersionWithOTP(credential, loginOTP) :
|
||||||
RetrofitClient.getInstance(instanceUrl, ctx).getApiInterface().getGiteaVersionWithBasic(credential);
|
RetrofitClient.getInstance(instanceUrl, ctx).getApiInterface().getGiteaVersionWithBasic(credential);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
callVersion.enqueue(new Callback<GiteaVersion>() {
|
callVersion.enqueue(new Callback<GiteaVersion>() {
|
||||||
@ -265,9 +260,10 @@ public class LoginActivity extends BaseActivity {
|
|||||||
if(responseVersion.code() == 200) {
|
if(responseVersion.code() == 200) {
|
||||||
|
|
||||||
GiteaVersion version = responseVersion.body();
|
GiteaVersion version = responseVersion.body();
|
||||||
|
|
||||||
assert version != null;
|
assert version != null;
|
||||||
|
|
||||||
if(!Version.valid(version.getVersion())) {
|
if(!Version.valid(version.getVersion())) {
|
||||||
|
|
||||||
Toasty.error(ctx, getResources().getString(R.string.versionUnknown));
|
Toasty.error(ctx, getResources().getString(R.string.versionUnknown));
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
return;
|
return;
|
||||||
@ -321,9 +317,11 @@ public class LoginActivity extends BaseActivity {
|
|||||||
// the setup methods then can better handle all different cases
|
// the setup methods then can better handle all different cases
|
||||||
|
|
||||||
if(loginType == LoginType.BASIC) {
|
if(loginType == LoginType.BASIC) {
|
||||||
|
|
||||||
setup(instanceUrl, loginUid, loginPass, loginOTP);
|
setup(instanceUrl, loginUid, loginPass, loginOTP);
|
||||||
}
|
}
|
||||||
else if(loginType == LoginType.TOKEN) { // Token
|
else if(loginType == LoginType.TOKEN) { // Token
|
||||||
|
|
||||||
setupUsingExistingToken(instanceUrl, loginToken);
|
setupUsingExistingToken(instanceUrl, loginToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -352,6 +350,7 @@ public class LoginActivity extends BaseActivity {
|
|||||||
switch(response.code()) {
|
switch(response.code()) {
|
||||||
|
|
||||||
case 200:
|
case 200:
|
||||||
|
|
||||||
assert userDetails != null;
|
assert userDetails != null;
|
||||||
tinyDB.putBoolean("loggedInMode", true);
|
tinyDB.putBoolean("loggedInMode", true);
|
||||||
tinyDB.putString(userDetails.getLogin() + "-token", loginToken);
|
tinyDB.putString(userDetails.getLogin() + "-token", loginToken);
|
||||||
@ -380,18 +379,16 @@ public class LoginActivity extends BaseActivity {
|
|||||||
startActivity(new Intent(LoginActivity.this, MainActivity.class));
|
startActivity(new Intent(LoginActivity.this, MainActivity.class));
|
||||||
finish();
|
finish();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 401:
|
case 401:
|
||||||
|
|
||||||
Toasty.error(ctx, getResources().getString(R.string.unauthorizedApiError));
|
Toasty.error(ctx, getResources().getString(R.string.unauthorizedApiError));
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
Toasty.error(ctx, getResources().getString(R.string.genericApiStatusError) + response.code());
|
Toasty.error(ctx, getResources().getString(R.string.genericApiStatusError) + response.code());
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -400,7 +397,6 @@ public class LoginActivity extends BaseActivity {
|
|||||||
Log.e("onFailure", t.toString());
|
Log.e("onFailure", t.toString());
|
||||||
Toasty.error(ctx, getResources().getString(R.string.genericError));
|
Toasty.error(ctx, getResources().getString(R.string.genericError));
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -431,7 +427,9 @@ public class LoginActivity extends BaseActivity {
|
|||||||
if(response.code() == 200) {
|
if(response.code() == 200) {
|
||||||
|
|
||||||
assert userTokens != null;
|
assert userTokens != null;
|
||||||
|
|
||||||
for(UserTokens t : userTokens) {
|
for(UserTokens t : userTokens) {
|
||||||
|
|
||||||
if(t.getName().equals(tokenName)) {
|
if(t.getName().equals(tokenName)) {
|
||||||
|
|
||||||
// this app had created an token on this instance before
|
// this app had created an token on this instance before
|
||||||
@ -447,6 +445,7 @@ public class LoginActivity extends BaseActivity {
|
|||||||
|
|
||||||
delcall = RetrofitClient.getInstance(instanceUrl, ctx).getApiInterface().deleteToken(credential, loginUid, t.getId());
|
delcall = RetrofitClient.getInstance(instanceUrl, ctx).getApiInterface().deleteToken(credential, loginUid, t.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
delcall.enqueue(new Callback<Void>() {
|
delcall.enqueue(new Callback<Void>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -460,7 +459,6 @@ public class LoginActivity extends BaseActivity {
|
|||||||
|
|
||||||
Toasty.error(ctx, getResources().getString(R.string.genericApiStatusError) + response.code());
|
Toasty.error(ctx, getResources().getString(R.string.genericApiStatusError) + response.code());
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,7 +468,6 @@ public class LoginActivity extends BaseActivity {
|
|||||||
Log.e("onFailure-login", t.toString());
|
Log.e("onFailure-login", t.toString());
|
||||||
Toasty.error(ctx, getResources().getString(R.string.malformedJson));
|
Toasty.error(ctx, getResources().getString(R.string.malformedJson));
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
@ -483,7 +480,6 @@ public class LoginActivity extends BaseActivity {
|
|||||||
|
|
||||||
Toasty.error(ctx, getResources().getString(R.string.genericApiStatusError) + response.code());
|
Toasty.error(ctx, getResources().getString(R.string.genericApiStatusError) + response.code());
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -493,7 +489,6 @@ public class LoginActivity extends BaseActivity {
|
|||||||
Log.e("onFailure-login", t.toString());
|
Log.e("onFailure-login", t.toString());
|
||||||
Toasty.error(ctx, getResources().getString(R.string.malformedJson));
|
Toasty.error(ctx, getResources().getString(R.string.malformedJson));
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -541,6 +536,7 @@ public class LoginActivity extends BaseActivity {
|
|||||||
switch(response.code()) {
|
switch(response.code()) {
|
||||||
|
|
||||||
case 200:
|
case 200:
|
||||||
|
|
||||||
assert userDetails != null;
|
assert userDetails != null;
|
||||||
tinyDB.remove("loginPass");
|
tinyDB.remove("loginPass");
|
||||||
tinyDB.putBoolean("loggedInMode", true);
|
tinyDB.putBoolean("loggedInMode", true);
|
||||||
@ -570,18 +566,16 @@ public class LoginActivity extends BaseActivity {
|
|||||||
startActivity(new Intent(LoginActivity.this, MainActivity.class));
|
startActivity(new Intent(LoginActivity.this, MainActivity.class));
|
||||||
finish();
|
finish();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 401:
|
case 401:
|
||||||
|
|
||||||
Toasty.error(ctx, getResources().getString(R.string.unauthorizedApiError));
|
Toasty.error(ctx, getResources().getString(R.string.unauthorizedApiError));
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
Toasty.error(ctx, getResources().getString(R.string.genericApiStatusError) + response.code());
|
Toasty.error(ctx, getResources().getString(R.string.genericApiStatusError) + response.code());
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -590,7 +584,6 @@ public class LoginActivity extends BaseActivity {
|
|||||||
Log.e("onFailure", t.toString());
|
Log.e("onFailure", t.toString());
|
||||||
Toasty.error(ctx, getResources().getString(R.string.genericError));
|
Toasty.error(ctx, getResources().getString(R.string.genericError));
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -599,7 +592,6 @@ public class LoginActivity extends BaseActivity {
|
|||||||
|
|
||||||
Toasty.error(ctx, getResources().getString(R.string.genericApiStatusError) + responseCreate.code());
|
Toasty.error(ctx, getResources().getString(R.string.genericApiStatusError) + responseCreate.code());
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -615,17 +607,21 @@ public class LoginActivity extends BaseActivity {
|
|||||||
private void loadDefaults() {
|
private void loadDefaults() {
|
||||||
|
|
||||||
if(tinyDB.getString("loginType").equals(LoginType.BASIC.name().toLowerCase())) {
|
if(tinyDB.getString("loginType").equals(LoginType.BASIC.name().toLowerCase())) {
|
||||||
|
|
||||||
loginMethod.check(R.id.loginUsernamePassword);
|
loginMethod.check(R.id.loginUsernamePassword);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
loginMethod.check(R.id.loginToken);
|
loginMethod.check(R.id.loginToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!tinyDB.getString("instanceUrlRaw").equals("")) {
|
if(!tinyDB.getString("instanceUrlRaw").equals("")) {
|
||||||
|
|
||||||
instanceUrlET.setText(tinyDB.getString("instanceUrlRaw"));
|
instanceUrlET.setText(tinyDB.getString("instanceUrlRaw"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!tinyDB.getString("loginUid").equals("")) {
|
if(!tinyDB.getString("loginUid").equals("")) {
|
||||||
|
|
||||||
loginUidET.setText(tinyDB.getString("loginUid"));
|
loginUidET.setText(tinyDB.getString("loginUid"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -636,9 +632,11 @@ public class LoginActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!tinyDB.getString("uniqueAppId").isEmpty()) {
|
if(!tinyDB.getString("uniqueAppId").isEmpty()) {
|
||||||
|
|
||||||
device_id = tinyDB.getString("uniqueAppId");
|
device_id = tinyDB.getString("uniqueAppId");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
device_id = UUID.randomUUID().toString();
|
device_id = UUID.randomUUID().toString();
|
||||||
tinyDB.putString("uniqueAppId", device_id);
|
tinyDB.putString("uniqueAppId", device_id);
|
||||||
}
|
}
|
||||||
|
@ -113,30 +113,37 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
|
|||||||
instanceToken = "token " + tinyDb.getString(loginUid + "-token");
|
instanceToken = "token " + tinyDb.getString(loginUid + "-token");
|
||||||
|
|
||||||
if(tinyDb.getString("dateFormat").isEmpty()) {
|
if(tinyDb.getString("dateFormat").isEmpty()) {
|
||||||
|
|
||||||
tinyDb.putString("dateFormat", "pretty");
|
tinyDb.putString("dateFormat", "pretty");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tinyDb.getString("codeBlockStr").isEmpty()) {
|
if(tinyDb.getString("codeBlockStr").isEmpty()) {
|
||||||
|
|
||||||
tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.colorLightGreen));
|
tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.colorLightGreen));
|
||||||
tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.black));
|
tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.black));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tinyDb.getString("enableCounterIssueBadgeInit").isEmpty()) {
|
if(tinyDb.getString("enableCounterIssueBadgeInit").isEmpty()) {
|
||||||
|
|
||||||
tinyDb.putBoolean("enableCounterIssueBadge", true);
|
tinyDb.putBoolean("enableCounterIssueBadge", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tinyDb.getString("homeScreenStr").isEmpty()) {
|
if(tinyDb.getString("homeScreenStr").isEmpty()) {
|
||||||
|
|
||||||
|
tinyDb.putString("homeScreenStr", "yes");
|
||||||
tinyDb.putInt("homeScreenId", 0);
|
tinyDb.putInt("homeScreenId", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);
|
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);
|
||||||
|
|
||||||
if(!tinyDb.getBoolean("loggedInMode")) {
|
if(!tinyDb.getBoolean("loggedInMode")) {
|
||||||
|
|
||||||
logout(this, ctx);
|
logout(this, ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tinyDb.getInt("currentActiveAccountId") <= 0) {
|
if(tinyDb.getInt("currentActiveAccountId") <= 0) {
|
||||||
|
|
||||||
AlertDialogs.forceLogoutDialog(ctx, getResources().getString(R.string.forceLogoutDialogHeader), getResources().getString(R.string.forceLogoutDialogDescription), getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
AlertDialogs.forceLogoutDialog(ctx, getResources().getString(R.string.forceLogoutDialogHeader), getResources().getString(R.string.forceLogoutDialogDescription), getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,17 +153,17 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
|
|||||||
switch(tinyDb.getInt("customFontId", -1)) {
|
switch(tinyDb.getInt("customFontId", -1)) {
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
|
|
||||||
myTypeface = Typeface.createFromAsset(getAssets(), "fonts/roboto.ttf");
|
myTypeface = Typeface.createFromAsset(getAssets(), "fonts/roboto.ttf");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
|
|
||||||
myTypeface = Typeface.createFromAsset(getAssets(), "fonts/sourcecodeproregular.ttf");
|
myTypeface = Typeface.createFromAsset(getAssets(), "fonts/sourcecodeproregular.ttf");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
myTypeface = Typeface.createFromAsset(getAssets(), "fonts/manroperegular.ttf");
|
myTypeface = Typeface.createFromAsset(getAssets(), "fonts/manroperegular.ttf");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
toolbarTitle.setTypeface(myTypeface);
|
toolbarTitle.setTypeface(myTypeface);
|
||||||
@ -166,33 +173,43 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
|
|||||||
Fragment fragmentById = fm.findFragmentById(R.id.fragment_container);
|
Fragment fragmentById = fm.findFragmentById(R.id.fragment_container);
|
||||||
|
|
||||||
if(fragmentById instanceof SettingsFragment) {
|
if(fragmentById instanceof SettingsFragment) {
|
||||||
|
|
||||||
toolbarTitle.setText(getResources().getString(R.string.pageTitleSettings));
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleSettings));
|
||||||
}
|
}
|
||||||
else if(fragmentById instanceof MyRepositoriesFragment) {
|
else if(fragmentById instanceof MyRepositoriesFragment) {
|
||||||
|
|
||||||
toolbarTitle.setText(getResources().getString(R.string.pageTitleMyRepos));
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleMyRepos));
|
||||||
}
|
}
|
||||||
else if(fragmentById instanceof StarredRepositoriesFragment) {
|
else if(fragmentById instanceof StarredRepositoriesFragment) {
|
||||||
|
|
||||||
toolbarTitle.setText(getResources().getString(R.string.pageTitleStarredRepos));
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleStarredRepos));
|
||||||
}
|
}
|
||||||
else if(fragmentById instanceof OrganizationsFragment) {
|
else if(fragmentById instanceof OrganizationsFragment) {
|
||||||
|
|
||||||
toolbarTitle.setText(getResources().getString(R.string.pageTitleOrganizations));
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleOrganizations));
|
||||||
}
|
}
|
||||||
else if(fragmentById instanceof ExploreFragment) {
|
else if(fragmentById instanceof ExploreFragment) {
|
||||||
|
|
||||||
toolbarTitle.setText(getResources().getString(R.string.pageTitleExplore));
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleExplore));
|
||||||
}
|
}
|
||||||
else if(fragmentById instanceof NotificationsFragment) {
|
else if(fragmentById instanceof NotificationsFragment) {
|
||||||
|
|
||||||
toolbarTitle.setText(R.string.pageTitleNotifications);
|
toolbarTitle.setText(R.string.pageTitleNotifications);
|
||||||
}
|
}
|
||||||
else if(fragmentById instanceof ProfileFragment) {
|
else if(fragmentById instanceof ProfileFragment) {
|
||||||
|
|
||||||
toolbarTitle.setText(getResources().getString(R.string.pageTitleProfile));
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleProfile));
|
||||||
}
|
}
|
||||||
else if(fragmentById instanceof DraftsFragment) {
|
else if(fragmentById instanceof DraftsFragment) {
|
||||||
|
|
||||||
toolbarTitle.setText(getResources().getString(R.string.titleDrafts));
|
toolbarTitle.setText(getResources().getString(R.string.titleDrafts));
|
||||||
}
|
}
|
||||||
else if(fragmentById instanceof AdministrationFragment) {
|
else if(fragmentById instanceof AdministrationFragment) {
|
||||||
|
|
||||||
toolbarTitle.setText(getResources().getString(R.string.pageTitleAdministration));
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleAdministration));
|
||||||
}
|
}
|
||||||
else if(fragmentById instanceof UserAccountsFragment) {
|
else if(fragmentById instanceof UserAccountsFragment) {
|
||||||
|
|
||||||
toolbarTitle.setText(getResources().getString(R.string.pageTitleUserAccounts));
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleUserAccounts));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,6 +238,7 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
|
|||||||
public void onDrawerSlide(@NonNull View drawerView, float slideOffset) {
|
public void onDrawerSlide(@NonNull View drawerView, float slideOffset) {
|
||||||
|
|
||||||
if(tinyDb.getBoolean("noConnection")) {
|
if(tinyDb.getBoolean("noConnection")) {
|
||||||
|
|
||||||
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
||||||
tinyDb.putBoolean("noConnection", false);
|
tinyDb.putBoolean("noConnection", false);
|
||||||
}
|
}
|
||||||
@ -253,17 +271,18 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
|
|||||||
userAccountsList.addAll(userAccounts);
|
userAccountsList.addAll(userAccounts);
|
||||||
navRecyclerViewUserAccounts.setAdapter(adapterUserAccounts);
|
navRecyclerViewUserAccounts.setAdapter(adapterUserAccounts);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
userEmail.setTypeface(myTypeface);
|
userEmail.setTypeface(myTypeface);
|
||||||
userFullName.setTypeface(myTypeface);
|
userFullName.setTypeface(myTypeface);
|
||||||
|
|
||||||
if(!userEmailNav.equals("")) {
|
if(!userEmailNav.equals("")) {
|
||||||
|
|
||||||
userEmail.setText(userEmailNav);
|
userEmail.setText(userEmailNav);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!userFullNameNav.equals("")) {
|
if(!userFullNameNav.equals("")) {
|
||||||
|
|
||||||
userFullName.setText(userFullNameNav);
|
userFullName.setText(userFullNameNav);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,14 +311,11 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
|
|||||||
.setBlurAlgorithm(new RenderScriptBlur(ctx))
|
.setBlurAlgorithm(new RenderScriptBlur(ctx))
|
||||||
.setBlurRadius(5)
|
.setBlurRadius(5)
|
||||||
.setHasFixedTransformationMatrix(false);
|
.setHasFixedTransformationMatrix(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Exception e) {}
|
public void onError(Exception e) {}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
userAvatar.setOnClickListener(v -> {
|
userAvatar.setOnClickListener(v -> {
|
||||||
@ -334,17 +350,17 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
|
|||||||
switch(launchFragment) {
|
switch(launchFragment) {
|
||||||
|
|
||||||
case "drafts":
|
case "drafts":
|
||||||
|
|
||||||
toolbarTitle.setText(getResources().getString(R.string.titleDrafts));
|
toolbarTitle.setText(getResources().getString(R.string.titleDrafts));
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new DraftsFragment()).commit();
|
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new DraftsFragment()).commit();
|
||||||
navigationView.setCheckedItem(R.id.nav_comments_draft);
|
navigationView.setCheckedItem(R.id.nav_comments_draft);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case "notifications":
|
case "notifications":
|
||||||
|
|
||||||
toolbarTitle.setText(getResources().getString(R.string.pageTitleNotifications));
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleNotifications));
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new NotificationsFragment()).commit();
|
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new NotificationsFragment()).commit();
|
||||||
navigationView.setCheckedItem(R.id.nav_notifications);
|
navigationView.setCheckedItem(R.id.nav_notifications);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -357,21 +373,22 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
|
|||||||
switch(launchFragmentByHandler) {
|
switch(launchFragmentByHandler) {
|
||||||
|
|
||||||
case "repos":
|
case "repos":
|
||||||
|
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new RepositoriesFragment()).commit();
|
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new RepositoriesFragment()).commit();
|
||||||
navigationView.setCheckedItem(R.id.nav_repositories);
|
navigationView.setCheckedItem(R.id.nav_repositories);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case "org":
|
case "org":
|
||||||
|
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new OrganizationsFragment()).commit();
|
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new OrganizationsFragment()).commit();
|
||||||
navigationView.setCheckedItem(R.id.nav_organizations);
|
navigationView.setCheckedItem(R.id.nav_organizations);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case "notification":
|
case "notification":
|
||||||
|
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new NotificationsFragment()).commit();
|
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new NotificationsFragment()).commit();
|
||||||
navigationView.setCheckedItem(R.id.nav_notifications);
|
navigationView.setCheckedItem(R.id.nav_notifications);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case "explore":
|
case "explore":
|
||||||
|
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new ExploreFragment()).commit();
|
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new ExploreFragment()).commit();
|
||||||
navigationView.setCheckedItem(R.id.nav_explore);
|
navigationView.setCheckedItem(R.id.nav_explore);
|
||||||
return;
|
return;
|
||||||
@ -391,71 +408,70 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
|
|||||||
switch(tinyDb.getInt("homeScreenId")) {
|
switch(tinyDb.getInt("homeScreenId")) {
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
|
|
||||||
toolbarTitle.setText(getResources().getString(R.string.pageTitleStarredRepos));
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleStarredRepos));
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new StarredRepositoriesFragment()).commit();
|
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new StarredRepositoriesFragment()).commit();
|
||||||
navigationView.setCheckedItem(R.id.nav_starred_repos);
|
navigationView.setCheckedItem(R.id.nav_starred_repos);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
|
|
||||||
toolbarTitle.setText(getResources().getString(R.string.pageTitleOrganizations));
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleOrganizations));
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new OrganizationsFragment()).commit();
|
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new OrganizationsFragment()).commit();
|
||||||
navigationView.setCheckedItem(R.id.nav_organizations);
|
navigationView.setCheckedItem(R.id.nav_organizations);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
|
|
||||||
toolbarTitle.setText(getResources().getString(R.string.pageTitleRepositories));
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleRepositories));
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new RepositoriesFragment()).commit();
|
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new RepositoriesFragment()).commit();
|
||||||
navigationView.setCheckedItem(R.id.nav_repositories);
|
navigationView.setCheckedItem(R.id.nav_repositories);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
|
|
||||||
toolbarTitle.setText(getResources().getString(R.string.pageTitleProfile));
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleProfile));
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new ProfileFragment()).commit();
|
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new ProfileFragment()).commit();
|
||||||
navigationView.setCheckedItem(R.id.nav_profile);
|
navigationView.setCheckedItem(R.id.nav_profile);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
|
|
||||||
toolbarTitle.setText(getResources().getString(R.string.pageTitleExplore));
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleExplore));
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new ExploreFragment()).commit();
|
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new ExploreFragment()).commit();
|
||||||
navigationView.setCheckedItem(R.id.nav_explore);
|
navigationView.setCheckedItem(R.id.nav_explore);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
|
|
||||||
toolbarTitle.setText(getResources().getString(R.string.titleDrafts));
|
toolbarTitle.setText(getResources().getString(R.string.titleDrafts));
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new DraftsFragment()).commit();
|
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new DraftsFragment()).commit();
|
||||||
navigationView.setCheckedItem(R.id.nav_comments_draft);
|
navigationView.setCheckedItem(R.id.nav_comments_draft);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7:
|
case 7:
|
||||||
|
|
||||||
toolbarTitle.setText(getResources().getString(R.string.pageTitleNotifications));
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleNotifications));
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new NotificationsFragment()).commit();
|
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new NotificationsFragment()).commit();
|
||||||
navigationView.setCheckedItem(R.id.nav_notifications);
|
navigationView.setCheckedItem(R.id.nav_notifications);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
toolbarTitle.setText(getResources().getString(R.string.pageTitleMyRepos));
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleMyRepos));
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new MyRepositoriesFragment()).commit();
|
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new MyRepositoriesFragment()).commit();
|
||||||
navigationView.setCheckedItem(R.id.nav_home);
|
navigationView.setCheckedItem(R.id.nav_home);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!connToInternet) {
|
if(!connToInternet) {
|
||||||
|
|
||||||
if(!tinyDb.getBoolean("noConnection")) {
|
if(!tinyDb.getBoolean("noConnection")) {
|
||||||
|
|
||||||
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
||||||
}
|
}
|
||||||
|
|
||||||
tinyDb.putBoolean("noConnection", true);
|
tinyDb.putBoolean("noConnection", true);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
loadUserInfo(instanceUrl, instanceToken, loginUid);
|
loadUserInfo(instanceUrl, instanceToken, loginUid);
|
||||||
giteaVersion(instanceUrl);
|
giteaVersion(instanceUrl);
|
||||||
tinyDb.putBoolean("noConnection", false);
|
tinyDb.putBoolean("noConnection", false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Changelog popup
|
// Changelog popup
|
||||||
@ -513,14 +529,15 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
|
|||||||
|
|
||||||
})
|
})
|
||||||
.setNeutralButton(R.string.cancelButton, null).show();
|
.setNeutralButton(R.string.cancelButton, null).show();
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.error(ctx, getResources().getString(R.string.genericError));
|
Toasty.error(ctx, getResources().getString(R.string.genericError));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.error(ctx, getResources().getString(R.string.genericError));
|
Toasty.error(ctx, getResources().getString(R.string.genericError));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -532,74 +549,74 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
|
|||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
|
|
||||||
if(drawer.isDrawerOpen(GravityCompat.START)) {
|
if(drawer.isDrawerOpen(GravityCompat.START)) {
|
||||||
|
|
||||||
drawer.closeDrawer(GravityCompat.START);
|
drawer.closeDrawer(GravityCompat.START);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
|
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
|
||||||
|
|
||||||
switch(menuItem.getItemId()) {
|
int id = menuItem.getItemId();
|
||||||
|
|
||||||
case R.id.nav_home:
|
if(id == R.id.nav_home) {
|
||||||
toolbarTitle.setText(getResources().getString(R.string.pageTitleMyRepos));
|
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new MyRepositoriesFragment()).commit();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case R.id.nav_organizations:
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleMyRepos));
|
||||||
toolbarTitle.setText(getResources().getString(R.string.pageTitleOrganizations));
|
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new MyRepositoriesFragment()).commit();
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new OrganizationsFragment()).commit();
|
}
|
||||||
break;
|
else if(id == R.id.nav_organizations) {
|
||||||
|
|
||||||
case R.id.nav_profile:
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleOrganizations));
|
||||||
toolbarTitle.setText(getResources().getString(R.string.pageTitleProfile));
|
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new OrganizationsFragment()).commit();
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new ProfileFragment()).commit();
|
}
|
||||||
break;
|
else if(id == R.id.nav_profile) {
|
||||||
|
|
||||||
case R.id.nav_repositories:
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleProfile));
|
||||||
toolbarTitle.setText(getResources().getString(R.string.pageTitleRepositories));
|
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new ProfileFragment()).commit();
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new RepositoriesFragment()).commit();
|
}
|
||||||
break;
|
else if(id == R.id.nav_repositories) {
|
||||||
|
|
||||||
case R.id.nav_settings:
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleRepositories));
|
||||||
toolbarTitle.setText(getResources().getString(R.string.pageTitleSettings));
|
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new RepositoriesFragment()).commit();
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new SettingsFragment()).commit();
|
}
|
||||||
break;
|
else if(id == R.id.nav_settings) {
|
||||||
|
|
||||||
case R.id.nav_logout:
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleSettings));
|
||||||
logout(this, ctx);
|
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new SettingsFragment()).commit();
|
||||||
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
|
}
|
||||||
break;
|
else if(id == R.id.nav_logout) {
|
||||||
|
|
||||||
case R.id.nav_starred_repos:
|
logout(this, ctx);
|
||||||
toolbarTitle.setText(getResources().getString(R.string.pageTitleStarredRepos));
|
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new StarredRepositoriesFragment()).commit();
|
}
|
||||||
break;
|
else if(id == R.id.nav_starred_repos) {
|
||||||
|
|
||||||
case R.id.nav_explore:
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleStarredRepos));
|
||||||
toolbarTitle.setText(getResources().getString(R.string.pageTitleExplore));
|
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new StarredRepositoriesFragment()).commit();
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new ExploreFragment()).commit();
|
}
|
||||||
break;
|
else if(id == R.id.nav_explore) {
|
||||||
|
|
||||||
case R.id.nav_notifications:
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleExplore));
|
||||||
toolbarTitle.setText(R.string.pageTitleNotifications);
|
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new ExploreFragment()).commit();
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new NotificationsFragment()).commit();
|
}
|
||||||
break;
|
else if(id == R.id.nav_notifications) {
|
||||||
|
|
||||||
case R.id.nav_comments_draft:
|
toolbarTitle.setText(R.string.pageTitleNotifications);
|
||||||
toolbarTitle.setText(getResources().getString(R.string.titleDrafts));
|
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new NotificationsFragment()).commit();
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new DraftsFragment()).commit();
|
}
|
||||||
break;
|
else if(id == R.id.nav_comments_draft) {
|
||||||
|
|
||||||
case R.id.nav_administration:
|
toolbarTitle.setText(getResources().getString(R.string.titleDrafts));
|
||||||
toolbarTitle.setText(getResources().getString(R.string.pageTitleAdministration));
|
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new DraftsFragment()).commit();
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new AdministrationFragment()).commit();
|
}
|
||||||
break;
|
else if(id == R.id.nav_administration) {
|
||||||
|
|
||||||
|
toolbarTitle.setText(getResources().getString(R.string.pageTitleAdministration));
|
||||||
|
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new AdministrationFragment()).commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
drawer.closeDrawer(GravityCompat.START);
|
drawer.closeDrawer(GravityCompat.START);
|
||||||
@ -614,7 +631,6 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
|
|||||||
//tinyDb.clear();
|
//tinyDb.clear();
|
||||||
activity.finish();
|
activity.finish();
|
||||||
ctx.startActivity(new Intent(ctx, LoginActivity.class));
|
ctx.startActivity(new Intent(ctx, LoginActivity.class));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -623,13 +639,13 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
|
|||||||
int id = item.getItemId();
|
int id = item.getItemId();
|
||||||
|
|
||||||
if(id == R.id.genericMenu) {
|
if(id == R.id.genericMenu) {
|
||||||
|
|
||||||
BottomSheetDraftsFragment bottomSheet = new BottomSheetDraftsFragment();
|
BottomSheetDraftsFragment bottomSheet = new BottomSheetDraftsFragment();
|
||||||
bottomSheet.show(getSupportFragmentManager(), "draftsBottomSheet");
|
bottomSheet.show(getSupportFragmentManager(), "draftsBottomSheet");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void giteaVersion(final String instanceUrl) {
|
private void giteaVersion(final String instanceUrl) {
|
||||||
@ -651,7 +667,6 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
|
|||||||
assert version != null;
|
assert version != null;
|
||||||
|
|
||||||
tinyDb.putString("giteaVersion", version.getVersion());
|
tinyDb.putString("giteaVersion", version.getVersion());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -660,9 +675,7 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
|
|||||||
|
|
||||||
Log.e("onFailure-version", t.toString());
|
Log.e("onFailure-version", t.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadUserInfo(String instanceUrl, String token, String loginUid) {
|
private void loadUserInfo(String instanceUrl, String token, String loginUid) {
|
||||||
@ -685,6 +698,7 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
|
|||||||
assert userDetails != null;
|
assert userDetails != null;
|
||||||
|
|
||||||
if(userDetails.getIs_admin() != null) {
|
if(userDetails.getIs_admin() != null) {
|
||||||
|
|
||||||
tinyDb.putBoolean("userIsAdmin", userDetails.getIs_admin());
|
tinyDb.putBoolean("userIsAdmin", userDetails.getIs_admin());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -692,9 +706,11 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
|
|||||||
tinyDb.putInt("userId", userDetails.getId());
|
tinyDb.putInt("userId", userDetails.getId());
|
||||||
|
|
||||||
if(!userDetails.getFullname().equals("")) {
|
if(!userDetails.getFullname().equals("")) {
|
||||||
|
|
||||||
tinyDb.putString("userFullname", userDetails.getFullname());
|
tinyDb.putString("userFullname", userDetails.getFullname());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
tinyDb.putString("userFullname", userDetails.getLogin());
|
tinyDb.putString("userFullname", userDetails.getLogin());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -702,9 +718,11 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
|
|||||||
tinyDb.putString("userAvatar", userDetails.getAvatar());
|
tinyDb.putString("userAvatar", userDetails.getAvatar());
|
||||||
|
|
||||||
if(userDetails.getLang() != null) {
|
if(userDetails.getLang() != null) {
|
||||||
|
|
||||||
tinyDb.putString("userLang", userDetails.getLang());
|
tinyDb.putString("userLang", userDetails.getLang());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
tinyDb.putString("userLang", "");
|
tinyDb.putString("userLang", "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -712,15 +730,12 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
|
|||||||
else if(response.code() == 401) {
|
else if(response.code() == 401) {
|
||||||
|
|
||||||
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle), getResources().getString(R.string.alertDialogTokenRevokedMessage), getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton), getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle), getResources().getString(R.string.alertDialogTokenRevokedMessage), getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton), getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
String toastError = getResources().getString(R.string.genericApiStatusError) + response.code();
|
String toastError = getResources().getString(R.string.genericApiStatusError) + response.code();
|
||||||
Toasty.error(ctx, toastError);
|
Toasty.error(ctx, toastError);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -96,21 +96,26 @@ public class MergePullRequestActivity extends BaseActivity {
|
|||||||
|
|
||||||
// if gitea version is greater/equal(1.12.0) than user installed version (installed.higherOrEqual(compareVer))
|
// if gitea version is greater/equal(1.12.0) than user installed version (installed.higherOrEqual(compareVer))
|
||||||
if(new Version(tinyDb.getString("giteaVersion")).higherOrEqual("1.12.0")) {
|
if(new Version(tinyDb.getString("giteaVersion")).higherOrEqual("1.12.0")) {
|
||||||
|
|
||||||
viewBinding.deleteBranch.setVisibility(View.VISIBLE);
|
viewBinding.deleteBranch.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tinyDb.getString("prMergeable").equals("false")) {
|
if(tinyDb.getString("prMergeable").equals("false")) {
|
||||||
|
|
||||||
disableProcessButton();
|
disableProcessButton();
|
||||||
viewBinding.mergeInfoDisabledMessage.setVisibility(View.VISIBLE);
|
viewBinding.mergeInfoDisabledMessage.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
viewBinding.mergeInfoDisabledMessage.setVisibility(View.GONE);
|
viewBinding.mergeInfoDisabledMessage.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tinyDb.getString("prIsFork").equals("true")) {
|
if(tinyDb.getString("prIsFork").equals("true")) {
|
||||||
|
|
||||||
viewBinding.deleteBranchForkInfo.setVisibility(View.VISIBLE);
|
viewBinding.deleteBranchForkInfo.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
viewBinding.deleteBranchForkInfo.setVisibility(View.GONE);
|
viewBinding.deleteBranchForkInfo.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,6 +139,7 @@ public class MergePullRequestActivity extends BaseActivity {
|
|||||||
mergeList.add(new MergePullRequestSpinner("rebase-merge", getResources().getString(R.string.mergeOptionRebaseCommit)));
|
mergeList.add(new MergePullRequestSpinner("rebase-merge", getResources().getString(R.string.mergeOptionRebaseCommit)));
|
||||||
// squash merge works only on gitea > v1.11.4 due to a bug
|
// squash merge works only on gitea > v1.11.4 due to a bug
|
||||||
if(new Version(tinyDb.getString("giteaVersion")).higher("1.11.4")) {
|
if(new Version(tinyDb.getString("giteaVersion")).higher("1.11.4")) {
|
||||||
|
|
||||||
mergeList.add(new MergePullRequestSpinner("squash", getResources().getString(R.string.mergeOptionSquash)));
|
mergeList.add(new MergePullRequestSpinner("squash", getResources().getString(R.string.mergeOptionSquash)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,7 +158,7 @@ public class MergePullRequestActivity extends BaseActivity {
|
|||||||
onClickListener = view -> finish();
|
onClickListener = view -> finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
private View.OnClickListener mergePullRequest = v -> processMergePullRequest();
|
private final View.OnClickListener mergePullRequest = v -> processMergePullRequest();
|
||||||
|
|
||||||
private void processMergePullRequest() {
|
private void processMergePullRequest() {
|
||||||
|
|
||||||
@ -243,6 +249,11 @@ public class MergePullRequestActivity extends BaseActivity {
|
|||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.warning(ctx, getString(R.string.mergePR404ErrorMsg));
|
Toasty.warning(ctx, getString(R.string.mergePR404ErrorMsg));
|
||||||
}
|
}
|
||||||
|
else if(response.code() == 405) {
|
||||||
|
|
||||||
|
enableProcessButton();
|
||||||
|
Toasty.warning(ctx, getString(R.string.mergeNotAllowed));;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
@ -280,7 +291,6 @@ public class MergePullRequestActivity extends BaseActivity {
|
|||||||
|
|
||||||
Log.i("deleteBranch", "Branch deleted successfully");
|
Log.i("deleteBranch", "Branch deleted successfully");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -46,9 +46,9 @@ public class OpenRepoInBrowserActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
catch(URISyntaxException e) {
|
catch(URISyntaxException e) {
|
||||||
|
|
||||||
Toasty.error(appCtx, getString(R.string.genericError));
|
Toasty.error(appCtx, getString(R.string.genericError));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -74,17 +74,17 @@ public class OrganizationDetailActivity extends BaseActivity implements BottomSh
|
|||||||
switch(tinyDb.getInt("customFontId", -1)) {
|
switch(tinyDb.getInt("customFontId", -1)) {
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
|
|
||||||
myTypeface = Typeface.createFromAsset(ctx.getAssets(), "fonts/roboto.ttf");
|
myTypeface = Typeface.createFromAsset(ctx.getAssets(), "fonts/roboto.ttf");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
|
|
||||||
myTypeface = Typeface.createFromAsset(ctx.getAssets(), "fonts/sourcecodeproregular.ttf");
|
myTypeface = Typeface.createFromAsset(ctx.getAssets(), "fonts/sourcecodeproregular.ttf");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
myTypeface = Typeface.createFromAsset(ctx.getAssets(), "fonts/manroperegular.ttf");
|
myTypeface = Typeface.createFromAsset(ctx.getAssets(), "fonts/manroperegular.ttf");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
toolbarTitle.setTypeface(myTypeface);
|
toolbarTitle.setTypeface(myTypeface);
|
||||||
@ -92,12 +92,18 @@ public class OrganizationDetailActivity extends BaseActivity implements BottomSh
|
|||||||
|
|
||||||
ViewGroup vg = (ViewGroup) tabLayout.getChildAt(0);
|
ViewGroup vg = (ViewGroup) tabLayout.getChildAt(0);
|
||||||
int tabsCount = vg.getChildCount();
|
int tabsCount = vg.getChildCount();
|
||||||
|
|
||||||
for (int j = 0; j < tabsCount; j++) {
|
for (int j = 0; j < tabsCount; j++) {
|
||||||
|
|
||||||
ViewGroup vgTab = (ViewGroup) vg.getChildAt(j);
|
ViewGroup vgTab = (ViewGroup) vg.getChildAt(j);
|
||||||
int tabChildCount = vgTab.getChildCount();
|
int tabChildCount = vgTab.getChildCount();
|
||||||
|
|
||||||
for (int i = 0; i < tabChildCount; i++) {
|
for (int i = 0; i < tabChildCount; i++) {
|
||||||
|
|
||||||
View tabViewChild = vgTab.getChildAt(i);
|
View tabViewChild = vgTab.getChildAt(i);
|
||||||
|
|
||||||
if (tabViewChild instanceof TextView) {
|
if (tabViewChild instanceof TextView) {
|
||||||
|
|
||||||
((TextView) tabViewChild).setTypeface(myTypeface);
|
((TextView) tabViewChild).setTypeface(myTypeface);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -105,7 +111,6 @@ public class OrganizationDetailActivity extends BaseActivity implements BottomSh
|
|||||||
|
|
||||||
mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
|
mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
|
||||||
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager));
|
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -122,18 +127,21 @@ public class OrganizationDetailActivity extends BaseActivity implements BottomSh
|
|||||||
|
|
||||||
int id = item.getItemId();
|
int id = item.getItemId();
|
||||||
|
|
||||||
switch (id) {
|
if(id == android.R.id.home) {
|
||||||
case android.R.id.home:
|
|
||||||
finish();
|
|
||||||
return true;
|
|
||||||
case R.id.repoMenu:
|
|
||||||
BottomSheetOrganizationFragment bottomSheet = new BottomSheetOrganizationFragment();
|
|
||||||
bottomSheet.show(getSupportFragmentManager(), "orgBottomSheet");
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(id == R.id.repoMenu) {
|
||||||
|
|
||||||
|
BottomSheetOrganizationFragment bottomSheet = new BottomSheetOrganizationFragment();
|
||||||
|
bottomSheet.show(getSupportFragmentManager(), "orgBottomSheet");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -175,25 +183,31 @@ public class OrganizationDetailActivity extends BaseActivity implements BottomSh
|
|||||||
|
|
||||||
String orgName;
|
String orgName;
|
||||||
if(getIntent().getStringExtra("orgName") != null || !Objects.equals(getIntent().getStringExtra("orgName"), "")) {
|
if(getIntent().getStringExtra("orgName") != null || !Objects.equals(getIntent().getStringExtra("orgName"), "")) {
|
||||||
|
|
||||||
orgName = getIntent().getStringExtra("orgName");
|
orgName = getIntent().getStringExtra("orgName");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
orgName = tinyDb.getString("orgName");
|
orgName = tinyDb.getString("orgName");
|
||||||
}
|
}
|
||||||
|
|
||||||
Fragment fragment = null;
|
Fragment fragment = null;
|
||||||
switch (position) {
|
switch (position) {
|
||||||
|
|
||||||
case 0: // info
|
case 0: // info
|
||||||
|
|
||||||
return OrganizationInfoFragment.newInstance(orgName);
|
return OrganizationInfoFragment.newInstance(orgName);
|
||||||
case 1: // repos
|
case 1: // repos
|
||||||
|
|
||||||
return RepositoriesByOrgFragment.newInstance(orgName);
|
return RepositoriesByOrgFragment.newInstance(orgName);
|
||||||
case 2: // teams
|
case 2: // teams
|
||||||
|
|
||||||
return TeamsByOrgFragment.newInstance(orgName);
|
return TeamsByOrgFragment.newInstance(orgName);
|
||||||
case 3: // members
|
case 3: // members
|
||||||
|
|
||||||
return MembersByOrgFragment.newInstance(orgName);
|
return MembersByOrgFragment.newInstance(orgName);
|
||||||
}
|
}
|
||||||
return fragment;
|
return fragment;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -15,6 +15,7 @@ import androidx.appcompat.widget.Toolbar;
|
|||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
import org.mian.gitnex.R;
|
import org.mian.gitnex.R;
|
||||||
import org.mian.gitnex.adapters.TeamMembersByOrgAdapter;
|
import org.mian.gitnex.adapters.TeamMembersByOrgAdapter;
|
||||||
|
import org.mian.gitnex.fragments.BottomSheetOrganizationFragment;
|
||||||
import org.mian.gitnex.fragments.BottomSheetOrganizationTeamsFragment;
|
import org.mian.gitnex.fragments.BottomSheetOrganizationTeamsFragment;
|
||||||
import org.mian.gitnex.helpers.Authorization;
|
import org.mian.gitnex.helpers.Authorization;
|
||||||
import org.mian.gitnex.helpers.TinyDB;
|
import org.mian.gitnex.helpers.TinyDB;
|
||||||
@ -66,22 +67,25 @@ public class OrganizationTeamMembersActivity extends BaseActivity implements Bot
|
|||||||
closeActivity.setOnClickListener(onClickListener);
|
closeActivity.setOnClickListener(onClickListener);
|
||||||
|
|
||||||
if(getIntent().getStringExtra("teamTitle") != null && !Objects.requireNonNull(getIntent().getStringExtra("teamTitle")).equals("")) {
|
if(getIntent().getStringExtra("teamTitle") != null && !Objects.requireNonNull(getIntent().getStringExtra("teamTitle")).equals("")) {
|
||||||
toolbarTitle.setText(getIntent().getStringExtra("teamTitle"));
|
|
||||||
|
toolbarTitle.setText(getIntent().getStringExtra("teamTitle"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
toolbarTitle.setText(R.string.orgTeamMembers);
|
|
||||||
|
toolbarTitle.setText(R.string.orgTeamMembers);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getIntent().getStringExtra("teamId") != null && !Objects.requireNonNull(getIntent().getStringExtra("teamId")).equals("")){
|
if(getIntent().getStringExtra("teamId") != null && !Objects.requireNonNull(getIntent().getStringExtra("teamId")).equals("")){
|
||||||
teamId = getIntent().getStringExtra("teamId");
|
|
||||||
|
teamId = getIntent().getStringExtra("teamId");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
teamId = "0";
|
|
||||||
|
teamId = "0";
|
||||||
}
|
}
|
||||||
|
|
||||||
assert teamId != null;
|
assert teamId != null;
|
||||||
fetchDataAsync(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), Integer.parseInt(teamId));
|
fetchDataAsync(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), Integer.parseInt(teamId));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -94,10 +98,10 @@ public class OrganizationTeamMembersActivity extends BaseActivity implements Bot
|
|||||||
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
|
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
|
||||||
|
|
||||||
if(tinyDb.getBoolean("teamActionFlag")) {
|
if(tinyDb.getBoolean("teamActionFlag")) {
|
||||||
|
|
||||||
fetchDataAsync(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), Integer.parseInt(teamId));
|
fetchDataAsync(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), Integer.parseInt(teamId));
|
||||||
tinyDb.putBoolean("teamActionFlag", false);
|
tinyDb.putBoolean("teamActionFlag", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fetchDataAsync(String instanceUrl, String instanceToken, int teamId) {
|
private void fetchDataAsync(String instanceUrl, String instanceToken, int teamId) {
|
||||||
@ -107,11 +111,14 @@ public class OrganizationTeamMembersActivity extends BaseActivity implements Bot
|
|||||||
teamMembersModel.getMembersByOrgList(instanceUrl, instanceToken, teamId, ctx).observe(this, teamMembersListMain -> {
|
teamMembersModel.getMembersByOrgList(instanceUrl, instanceToken, teamId, ctx).observe(this, teamMembersListMain -> {
|
||||||
|
|
||||||
adapter = new TeamMembersByOrgAdapter(ctx, teamMembersListMain);
|
adapter = new TeamMembersByOrgAdapter(ctx, teamMembersListMain);
|
||||||
|
|
||||||
if(adapter.getCount() > 0) {
|
if(adapter.getCount() > 0) {
|
||||||
|
|
||||||
mGridView.setAdapter(adapter);
|
mGridView.setAdapter(adapter);
|
||||||
noDataMembers.setVisibility(View.GONE);
|
noDataMembers.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
mGridView.setAdapter(adapter);
|
mGridView.setAdapter(adapter);
|
||||||
noDataMembers.setVisibility(View.VISIBLE);
|
noDataMembers.setVisibility(View.VISIBLE);
|
||||||
@ -119,7 +126,6 @@ public class OrganizationTeamMembersActivity extends BaseActivity implements Bot
|
|||||||
|
|
||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -128,7 +134,6 @@ public class OrganizationTeamMembersActivity extends BaseActivity implements Bot
|
|||||||
MenuInflater inflater = getMenuInflater();
|
MenuInflater inflater = getMenuInflater();
|
||||||
inflater.inflate(R.menu.generic_nav_dotted_menu, menu);
|
inflater.inflate(R.menu.generic_nav_dotted_menu, menu);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -136,31 +141,32 @@ public class OrganizationTeamMembersActivity extends BaseActivity implements Bot
|
|||||||
|
|
||||||
int id = item.getItemId();
|
int id = item.getItemId();
|
||||||
|
|
||||||
switch(id) {
|
if(id == android.R.id.home) {
|
||||||
case android.R.id.home:
|
|
||||||
finish();
|
|
||||||
return true;
|
|
||||||
case R.id.genericMenu:
|
|
||||||
BottomSheetOrganizationTeamsFragment bottomSheet = new BottomSheetOrganizationTeamsFragment();
|
|
||||||
bottomSheet.show(getSupportFragmentManager(), "orgTeamsBottomSheet");
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(id == R.id.genericMenu) {
|
||||||
|
|
||||||
|
BottomSheetOrganizationTeamsFragment bottomSheet = new BottomSheetOrganizationTeamsFragment();
|
||||||
|
bottomSheet.show(getSupportFragmentManager(), "orgTeamsBottomSheet");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onButtonClicked(String text) {
|
public void onButtonClicked(String text) {
|
||||||
|
|
||||||
TinyDB tinyDb = new TinyDB(appCtx);
|
|
||||||
|
|
||||||
if("newMember".equals(text)) {
|
if("newMember".equals(text)) {
|
||||||
|
|
||||||
Intent intent = new Intent(OrganizationTeamMembersActivity.this, AddNewTeamMemberActivity.class);
|
Intent intent = new Intent(OrganizationTeamMembersActivity.this, AddNewTeamMemberActivity.class);
|
||||||
intent.putExtra("teamId", teamId);
|
intent.putExtra("teamId", teamId);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initCloseListener() {
|
private void initCloseListener() {
|
||||||
|
@ -73,11 +73,7 @@ public class ProfileEmailActivity extends BaseActivity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private View.OnClickListener addEmailListener = new View.OnClickListener() {
|
private final View.OnClickListener addEmailListener = v -> processAddNewEmail();
|
||||||
public void onClick(View v) {
|
|
||||||
processAddNewEmail();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private void processAddNewEmail() {
|
private void processAddNewEmail() {
|
||||||
|
|
||||||
@ -93,27 +89,23 @@ public class ProfileEmailActivity extends BaseActivity {
|
|||||||
|
|
||||||
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(newUserEmail.equals("")) {
|
if(newUserEmail.equals("")) {
|
||||||
|
|
||||||
Toasty.error(ctx, getString(R.string.emailErrorEmpty));
|
Toasty.error(ctx, getString(R.string.emailErrorEmpty));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(!Patterns.EMAIL_ADDRESS.matcher(newUserEmail).matches()) {
|
else if(!Patterns.EMAIL_ADDRESS.matcher(newUserEmail).matches()) {
|
||||||
|
|
||||||
Toasty.warning(ctx, getString(R.string.emailErrorInvalid));
|
Toasty.warning(ctx, getString(R.string.emailErrorInvalid));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> newEmailList = new ArrayList<>(Arrays.asList(newUserEmail.split(",")));
|
List<String> newEmailList = new ArrayList<>(Arrays.asList(newUserEmail.split(",")));
|
||||||
|
|
||||||
disableProcessButton();
|
disableProcessButton();
|
||||||
addNewEmail(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), newEmailList);
|
addNewEmail(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), newEmailList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addNewEmail(final String instanceUrl, final String token, List<String> newUserEmail) {
|
private void addNewEmail(final String instanceUrl, final String token, List<String> newUserEmail) {
|
||||||
@ -139,7 +131,6 @@ public class ProfileEmailActivity extends BaseActivity {
|
|||||||
tinyDb.putBoolean("emailsRefresh", true);
|
tinyDb.putBoolean("emailsRefresh", true);
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
finish();
|
finish();
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 401) {
|
else if(response.code() == 401) {
|
||||||
|
|
||||||
@ -148,37 +139,32 @@ public class ProfileEmailActivity extends BaseActivity {
|
|||||||
getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||||
getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
||||||
getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 403) {
|
else if(response.code() == 403) {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.error(ctx, ctx.getString(R.string.authorizeError));
|
Toasty.error(ctx, ctx.getString(R.string.authorizeError));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 404) {
|
else if(response.code() == 404) {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.warning(ctx, ctx.getString(R.string.apiNotFound));
|
Toasty.warning(ctx, ctx.getString(R.string.apiNotFound));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 422) {
|
else if(response.code() == 422) {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.warning(ctx, ctx.getString(R.string.emailErrorInUse));
|
Toasty.warning(ctx, ctx.getString(R.string.emailErrorInUse));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.error(ctx, getString(R.string.labelGeneralError));
|
Toasty.error(ctx, getString(R.string.labelGeneralError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@NonNull Call<JsonElement> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<JsonElement> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
Log.e("onFailure", t.toString());
|
Log.e("onFailure", t.toString());
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
}
|
}
|
||||||
|
@ -80,6 +80,7 @@ public class ReplyToIssueActivity extends BaseActivity {
|
|||||||
imm.showSoftInput(addComment, InputMethodManager.SHOW_IMPLICIT);
|
imm.showSoftInput(addComment, InputMethodManager.SHOW_IMPLICIT);
|
||||||
|
|
||||||
if(!tinyDb.getString("issueTitle").isEmpty()) {
|
if(!tinyDb.getString("issueTitle").isEmpty()) {
|
||||||
|
|
||||||
toolbar_title.setText(tinyDb.getString("issueTitle"));
|
toolbar_title.setText(tinyDb.getString("issueTitle"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,9 +94,11 @@ public class ReplyToIssueActivity extends BaseActivity {
|
|||||||
else {
|
else {
|
||||||
|
|
||||||
if(getIntent().getStringExtra("commentBody") != null) {
|
if(getIntent().getStringExtra("commentBody") != null) {
|
||||||
|
|
||||||
draftIdOnCreate = returnDraftId(getIntent().getStringExtra("commentBody"));
|
draftIdOnCreate = returnDraftId(getIntent().getStringExtra("commentBody"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
draftIdOnCreate = returnDraftId("");
|
draftIdOnCreate = returnDraftId("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -107,6 +110,7 @@ public class ReplyToIssueActivity extends BaseActivity {
|
|||||||
addComment.setText(getIntent().getStringExtra("commentBody"));
|
addComment.setText(getIntent().getStringExtra("commentBody"));
|
||||||
|
|
||||||
if(getIntent().getBooleanExtra("cursorToEnd", false)) {
|
if(getIntent().getBooleanExtra("cursorToEnd", false)) {
|
||||||
|
|
||||||
addComment.setSelection(addComment.length());
|
addComment.setSelection(addComment.length());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -126,7 +130,6 @@ public class ReplyToIssueActivity extends BaseActivity {
|
|||||||
addComment.addTextChangedListener(new TextWatcher() {
|
addComment.addTextChangedListener(new TextWatcher() {
|
||||||
|
|
||||||
public void afterTextChanged(Editable s) {
|
public void afterTextChanged(Editable s) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
@ -148,7 +151,6 @@ public class ReplyToIssueActivity extends BaseActivity {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addComment.addTextChangedListener(new TextWatcher() {
|
addComment.addTextChangedListener(new TextWatcher() {
|
||||||
@ -217,7 +219,7 @@ public class ReplyToIssueActivity extends BaseActivity {
|
|||||||
onClickListener = view -> finish();
|
onClickListener = view -> finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
private View.OnClickListener replyToIssue = v -> processNewCommentReply();
|
private final View.OnClickListener replyToIssue = v -> processNewCommentReply();
|
||||||
|
|
||||||
private void processNewCommentReply() {
|
private void processNewCommentReply() {
|
||||||
|
|
||||||
@ -239,7 +241,6 @@ public class ReplyToIssueActivity extends BaseActivity {
|
|||||||
disableProcessButton();
|
disableProcessButton();
|
||||||
replyComment(newReplyDT);
|
replyComment(newReplyDT);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void replyComment(String newReplyDT) {
|
private void replyComment(String newReplyDT) {
|
||||||
@ -282,7 +283,6 @@ public class ReplyToIssueActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
finish();
|
finish();
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 401) {
|
else if(response.code() == 401) {
|
||||||
|
|
||||||
@ -291,15 +291,12 @@ public class ReplyToIssueActivity extends BaseActivity {
|
|||||||
getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
getResources().getString(R.string.alertDialogTokenRevokedMessage),
|
||||||
getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
|
||||||
getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.error(ctx, getString(R.string.commentError));
|
Toasty.error(ctx, getString(R.string.commentError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -319,26 +316,24 @@ public class ReplyToIssueActivity extends BaseActivity {
|
|||||||
inflater.inflate(R.menu.reply_to_issue, menu);
|
inflater.inflate(R.menu.reply_to_issue, menu);
|
||||||
|
|
||||||
return super.onCreateOptionsMenu(menu);
|
return super.onCreateOptionsMenu(menu);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
|
||||||
switch(item.getItemId()) {
|
int id = item.getItemId();
|
||||||
|
|
||||||
case R.id.replyToIssueMenu:
|
if(id == R.id.replyToIssueMenu) {
|
||||||
Intent fragmentIntent = new Intent(ReplyToIssueActivity.this, MainActivity.class);
|
|
||||||
fragmentIntent.putExtra("launchFragment", "drafts");
|
|
||||||
ReplyToIssueActivity.this.startActivity(fragmentIntent);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
|
|
||||||
|
Intent fragmentIntent = new Intent(ReplyToIssueActivity.this, MainActivity.class);
|
||||||
|
fragmentIntent.putExtra("launchFragment", "drafts");
|
||||||
|
ReplyToIssueActivity.this.startActivity(fragmentIntent);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
return true;
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void disableProcessButton() {
|
private void disableProcessButton() {
|
||||||
|
@ -126,17 +126,17 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
|||||||
switch(tinyDB.getInt("customFontId", -1)) {
|
switch(tinyDB.getInt("customFontId", -1)) {
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
|
|
||||||
myTypeface = Typeface.createFromAsset(ctx.getAssets(), "fonts/roboto.ttf");
|
myTypeface = Typeface.createFromAsset(ctx.getAssets(), "fonts/roboto.ttf");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
|
|
||||||
myTypeface = Typeface.createFromAsset(ctx.getAssets(), "fonts/sourcecodeproregular.ttf");
|
myTypeface = Typeface.createFromAsset(ctx.getAssets(), "fonts/sourcecodeproregular.ttf");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
myTypeface = Typeface.createFromAsset(ctx.getAssets(), "fonts/manroperegular.ttf");
|
myTypeface = Typeface.createFromAsset(ctx.getAssets(), "fonts/manroperegular.ttf");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
toolbarTitle.setTypeface(myTypeface);
|
toolbarTitle.setTypeface(myTypeface);
|
||||||
@ -156,6 +156,7 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
|||||||
View tabViewChild = vgTab.getChildAt(i);
|
View tabViewChild = vgTab.getChildAt(i);
|
||||||
|
|
||||||
if(tabViewChild instanceof TextView) {
|
if(tabViewChild instanceof TextView) {
|
||||||
|
|
||||||
((TextView) tabViewChild).setTypeface(myTypeface);
|
((TextView) tabViewChild).setTypeface(myTypeface);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -172,7 +173,6 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
|||||||
|
|
||||||
tabsCount--;
|
tabsCount--;
|
||||||
collaboratorTab.setVisibility(View.GONE);
|
collaboratorTab.setVisibility(View.GONE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mViewPager = findViewById(R.id.container);
|
mViewPager = findViewById(R.id.container);
|
||||||
@ -209,7 +209,6 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
|||||||
assert tabOpenIssues != null; // FIXME This should be cleaned up
|
assert tabOpenIssues != null; // FIXME This should be cleaned up
|
||||||
TextView openIssueTabView = Objects.requireNonNull(tabOpenIssues.getCustomView()).findViewById(R.id.counterBadgeIssueText);
|
TextView openIssueTabView = Objects.requireNonNull(tabOpenIssues.getCustomView()).findViewById(R.id.counterBadgeIssueText);
|
||||||
openIssueTabView.setTextColor(textColor);
|
openIssueTabView.setTextColor(textColor);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pull request count
|
// Pull request count
|
||||||
@ -220,7 +219,6 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
|||||||
assert tabOpenPulls != null; // FIXME This should be cleaned up
|
assert tabOpenPulls != null; // FIXME This should be cleaned up
|
||||||
TextView openPullTabView = Objects.requireNonNull(tabOpenPulls.getCustomView()).findViewById(R.id.counterBadgePullText);
|
TextView openPullTabView = Objects.requireNonNull(tabOpenPulls.getCustomView()).findViewById(R.id.counterBadgePullText);
|
||||||
openPullTabView.setTextColor(textColor);
|
openPullTabView.setTextColor(textColor);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Release count
|
// Release count
|
||||||
@ -233,7 +231,6 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
|||||||
assert tabOpenRelease != null; // FIXME This should be cleaned up
|
assert tabOpenRelease != null; // FIXME This should be cleaned up
|
||||||
TextView openReleaseTabView = Objects.requireNonNull(tabOpenRelease.getCustomView()).findViewById(R.id.counterBadgeReleaseText);
|
TextView openReleaseTabView = Objects.requireNonNull(tabOpenRelease.getCustomView()).findViewById(R.id.counterBadgeReleaseText);
|
||||||
openReleaseTabView.setTextColor(textColor);
|
openReleaseTabView.setTextColor(textColor);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -259,7 +256,6 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
|||||||
|
|
||||||
checkRepositoryStarStatus(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), repositoryOwner, repositoryName);
|
checkRepositoryStarStatus(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), repositoryOwner, repositoryName);
|
||||||
checkRepositoryWatchStatus(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), repositoryOwner, repositoryName);
|
checkRepositoryWatchStatus(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), repositoryOwner, repositoryName);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -271,7 +267,6 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
|||||||
|
|
||||||
getRepoInfo(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), repositoryOwner, repositoryName);
|
getRepoInfo(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), repositoryOwner, repositoryName);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -280,7 +275,6 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
|||||||
MenuInflater inflater = getMenuInflater();
|
MenuInflater inflater = getMenuInflater();
|
||||||
inflater.inflate(R.menu.repo_dotted_menu, menu);
|
inflater.inflate(R.menu.repo_dotted_menu, menu);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -337,100 +331,105 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
|||||||
switch(text) {
|
switch(text) {
|
||||||
|
|
||||||
case "label":
|
case "label":
|
||||||
|
|
||||||
startActivity(new Intent(RepoDetailActivity.this, CreateLabelActivity.class));
|
startActivity(new Intent(RepoDetailActivity.this, CreateLabelActivity.class));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "newIssue":
|
case "newIssue":
|
||||||
|
|
||||||
startActivity(new Intent(RepoDetailActivity.this, CreateIssueActivity.class));
|
startActivity(new Intent(RepoDetailActivity.this, CreateIssueActivity.class));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "newMilestone":
|
case "newMilestone":
|
||||||
|
|
||||||
startActivity(new Intent(RepoDetailActivity.this, CreateMilestoneActivity.class));
|
startActivity(new Intent(RepoDetailActivity.this, CreateMilestoneActivity.class));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "addCollaborator":
|
case "addCollaborator":
|
||||||
|
|
||||||
startActivity(new Intent(RepoDetailActivity.this, AddCollaboratorToRepositoryActivity.class));
|
startActivity(new Intent(RepoDetailActivity.this, AddCollaboratorToRepositoryActivity.class));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "chooseBranch":
|
case "chooseBranch":
|
||||||
|
|
||||||
chooseBranch();
|
chooseBranch();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "createRelease":
|
case "createRelease":
|
||||||
|
|
||||||
startActivity(new Intent(RepoDetailActivity.this, CreateReleaseActivity.class));
|
startActivity(new Intent(RepoDetailActivity.this, CreateReleaseActivity.class));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "openWebRepo":
|
case "openWebRepo":
|
||||||
|
|
||||||
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(tinyDB.getString("repoHtmlUrl")));
|
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(tinyDB.getString("repoHtmlUrl")));
|
||||||
startActivity(i);
|
startActivity(i);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "shareRepo":
|
case "shareRepo":
|
||||||
|
|
||||||
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
|
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
|
||||||
sharingIntent.setType("text/plain");
|
sharingIntent.setType("text/plain");
|
||||||
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, tinyDB.getString("repoHtmlUrl"));
|
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, tinyDB.getString("repoHtmlUrl"));
|
||||||
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, tinyDB.getString("repoHtmlUrl"));
|
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, tinyDB.getString("repoHtmlUrl"));
|
||||||
startActivity(Intent.createChooser(sharingIntent, tinyDB.getString("repoHtmlUrl")));
|
startActivity(Intent.createChooser(sharingIntent, tinyDB.getString("repoHtmlUrl")));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "copyRepoUrl":
|
case "copyRepoUrl":
|
||||||
|
|
||||||
ClipboardManager clipboard = (ClipboardManager) Objects.requireNonNull(ctx).getSystemService(Context.CLIPBOARD_SERVICE);
|
ClipboardManager clipboard = (ClipboardManager) Objects.requireNonNull(ctx).getSystemService(Context.CLIPBOARD_SERVICE);
|
||||||
ClipData clip = ClipData.newPlainText("repoUrl", tinyDB.getString("repoHtmlUrl"));
|
ClipData clip = ClipData.newPlainText("repoUrl", tinyDB.getString("repoHtmlUrl"));
|
||||||
assert clipboard != null;
|
assert clipboard != null;
|
||||||
clipboard.setPrimaryClip(clip);
|
clipboard.setPrimaryClip(clip);
|
||||||
Toasty.info(ctx, ctx.getString(R.string.copyIssueUrlToastMsg));
|
Toasty.info(ctx, ctx.getString(R.string.copyIssueUrlToastMsg));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "newFile":
|
case "newFile":
|
||||||
|
|
||||||
startActivity(new Intent(RepoDetailActivity.this, CreateFileActivity.class));
|
startActivity(new Intent(RepoDetailActivity.this, CreateFileActivity.class));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "openIssues":
|
case "openIssues":
|
||||||
|
|
||||||
if(getFragmentRefreshListener() != null) {
|
if(getFragmentRefreshListener() != null) {
|
||||||
|
|
||||||
getFragmentRefreshListener().onRefresh("open");
|
getFragmentRefreshListener().onRefresh("open");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "closedIssues":
|
case "closedIssues":
|
||||||
|
|
||||||
if(getFragmentRefreshListener() != null) {
|
if(getFragmentRefreshListener() != null) {
|
||||||
|
|
||||||
getFragmentRefreshListener().onRefresh("closed");
|
getFragmentRefreshListener().onRefresh("closed");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "openPr":
|
case "openPr":
|
||||||
|
|
||||||
if(getFragmentRefreshListenerPr() != null) {
|
if(getFragmentRefreshListenerPr() != null) {
|
||||||
|
|
||||||
getFragmentRefreshListenerPr().onRefresh("open");
|
getFragmentRefreshListenerPr().onRefresh("open");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "closedPr":
|
case "closedPr":
|
||||||
|
|
||||||
if(getFragmentRefreshListenerPr() != null) {
|
if(getFragmentRefreshListenerPr() != null) {
|
||||||
|
|
||||||
getFragmentRefreshListenerPr().onRefresh("closed");
|
getFragmentRefreshListenerPr().onRefresh("closed");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "openMilestone":
|
case "openMilestone":
|
||||||
|
|
||||||
if(getFragmentRefreshListenerMilestone() != null) {
|
if(getFragmentRefreshListenerMilestone() != null) {
|
||||||
|
|
||||||
getFragmentRefreshListenerMilestone().onRefresh("open");
|
getFragmentRefreshListenerMilestone().onRefresh("open");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "closedMilestone":
|
case "closedMilestone":
|
||||||
|
|
||||||
if(getFragmentRefreshListenerMilestone() != null) {
|
if(getFragmentRefreshListenerMilestone() != null) {
|
||||||
|
|
||||||
getFragmentRefreshListenerMilestone().onRefresh("closed");
|
getFragmentRefreshListenerMilestone().onRefresh("closed");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "repoSettings":
|
case "repoSettings":
|
||||||
|
|
||||||
startActivity(new Intent(RepoDetailActivity.this, RepositorySettingsActivity.class));
|
startActivity(new Intent(RepoDetailActivity.this, RepositorySettingsActivity.class));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "newPullRequest":
|
case "newPullRequest":
|
||||||
|
|
||||||
startActivity(new Intent(RepoDetailActivity.this, CreatePullRequestActivity.class));
|
startActivity(new Intent(RepoDetailActivity.this, CreatePullRequestActivity.class));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void chooseBranch() {
|
private void chooseBranch() {
|
||||||
@ -470,7 +469,9 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
|||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
|
|
||||||
tinyDB.putString("repoBranch", branchesList.get(i));
|
tinyDB.putString("repoBranch", branchesList.get(i));
|
||||||
|
|
||||||
if(getFragmentRefreshListenerFiles() != null) {
|
if(getFragmentRefreshListenerFiles() != null) {
|
||||||
|
|
||||||
getFragmentRefreshListenerFiles().onRefresh(branchesList.get(i));
|
getFragmentRefreshListenerFiles().onRefresh(branchesList.get(i));
|
||||||
}
|
}
|
||||||
dialogInterface.dismiss();
|
dialogInterface.dismiss();
|
||||||
@ -479,9 +480,7 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
|||||||
pBuilder.setNeutralButton(R.string.cancelButton, null);
|
pBuilder.setNeutralButton(R.string.cancelButton, null);
|
||||||
|
|
||||||
pBuilder.create().show();
|
pBuilder.create().show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -509,37 +508,36 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
|||||||
switch(position) {
|
switch(position) {
|
||||||
|
|
||||||
case 0: // Repository details
|
case 0: // Repository details
|
||||||
|
|
||||||
return RepoInfoFragment.newInstance(repositoryOwner, repositoryName);
|
return RepoInfoFragment.newInstance(repositoryOwner, repositoryName);
|
||||||
|
|
||||||
case 1: // Files
|
case 1: // Files
|
||||||
return FilesFragment.newInstance(repositoryOwner, repositoryName, tinyDB.getString("repoBranch"));
|
|
||||||
|
|
||||||
|
return FilesFragment.newInstance(repositoryOwner, repositoryName, tinyDB.getString("repoBranch"));
|
||||||
case 2: // Issues
|
case 2: // Issues
|
||||||
|
|
||||||
fragment = new IssuesFragment();
|
fragment = new IssuesFragment();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3: // Pull requests
|
case 3: // Pull requests
|
||||||
|
|
||||||
fragment = new PullRequestsFragment();
|
fragment = new PullRequestsFragment();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4: // Releases
|
case 4: // Releases
|
||||||
return ReleasesFragment.newInstance(repositoryOwner, repositoryName);
|
|
||||||
|
|
||||||
|
return ReleasesFragment.newInstance(repositoryOwner, repositoryName);
|
||||||
case 5: // Milestones
|
case 5: // Milestones
|
||||||
|
|
||||||
fragment = new MilestonesFragment();
|
fragment = new MilestonesFragment();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6: // Labels
|
case 6: // Labels
|
||||||
|
|
||||||
return LabelsFragment.newInstance(repositoryOwner, repositoryName);
|
return LabelsFragment.newInstance(repositoryOwner, repositoryName);
|
||||||
|
|
||||||
case 7: // Collaborators
|
case 7: // Collaborators
|
||||||
return CollaboratorsFragment.newInstance(repositoryOwner, repositoryName);
|
|
||||||
|
|
||||||
|
return CollaboratorsFragment.newInstance(repositoryOwner, repositoryName);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert fragment != null;
|
assert fragment != null;
|
||||||
return fragment;
|
return fragment;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -547,7 +545,6 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
|||||||
|
|
||||||
return tabsCount;
|
return tabsCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getRepoInfo(String instanceUrl, String token, final String owner, String repo) {
|
private void getRepoInfo(String instanceUrl, String token, final String owner, String repo) {
|
||||||
@ -563,6 +560,7 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
|||||||
if(response.code() == 200) {
|
if(response.code() == 200) {
|
||||||
|
|
||||||
if(tinyDB.getBoolean("enableCounterBadges")) {
|
if(tinyDB.getBoolean("enableCounterBadges")) {
|
||||||
|
|
||||||
assert repoInfo != null;
|
assert repoInfo != null;
|
||||||
|
|
||||||
if(repoInfo.getOpen_issues_count() != null) {
|
if(repoInfo.getOpen_issues_count() != null) {
|
||||||
@ -589,7 +587,6 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
|||||||
|
|
||||||
Log.e("onFailure", String.valueOf(response.code()));
|
Log.e("onFailure", String.valueOf(response.code()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -611,7 +608,6 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
|||||||
public void onResponse(@NonNull Call<JsonElement> call, @NonNull retrofit2.Response<JsonElement> response) {
|
public void onResponse(@NonNull Call<JsonElement> call, @NonNull retrofit2.Response<JsonElement> response) {
|
||||||
|
|
||||||
tinyDB.putInt("repositoryStarStatus", response.code());
|
tinyDB.putInt("repositoryStarStatus", response.code());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -638,15 +634,14 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
|||||||
assert response.body() != null;
|
assert response.body() != null;
|
||||||
|
|
||||||
if(response.body().getSubscribed()) {
|
if(response.body().getSubscribed()) {
|
||||||
|
|
||||||
tinyDB.putBoolean("repositoryWatchStatus", true);
|
tinyDB.putBoolean("repositoryWatchStatus", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
tinyDB.putBoolean("repositoryWatchStatus", false);
|
tinyDB.putBoolean("repositoryWatchStatus", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -97,6 +97,7 @@ public class RepoForksActivity extends BaseActivity {
|
|||||||
|
|
||||||
// if gitea is 1.12 or higher use the new limit (resultLimitNewGiteaInstances)
|
// if gitea is 1.12 or higher use the new limit (resultLimitNewGiteaInstances)
|
||||||
if(new Version(tinyDb.getString("giteaVersion")).higherOrEqual("1.12")) {
|
if(new Version(tinyDb.getString("giteaVersion")).higherOrEqual("1.12")) {
|
||||||
|
|
||||||
resultLimit = StaticGlobalVariables.resultLimitNewGiteaInstances;
|
resultLimit = StaticGlobalVariables.resultLimitNewGiteaInstances;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,9 +123,7 @@ public class RepoForksActivity extends BaseActivity {
|
|||||||
|
|
||||||
int page = (forksList.size() + resultLimit) / resultLimit;
|
int page = (forksList.size() + resultLimit) / resultLimit;
|
||||||
loadMore(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), repoOwner, repoName, page, resultLimit);
|
loadMore(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), repoOwner, repoName, page, resultLimit);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
recyclerView.setHasFixedSize(true);
|
recyclerView.setHasFixedSize(true);
|
||||||
@ -132,7 +131,6 @@ public class RepoForksActivity extends BaseActivity {
|
|||||||
recyclerView.setAdapter(adapter);
|
recyclerView.setAdapter(adapter);
|
||||||
|
|
||||||
loadInitial(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), repoOwner, repoName, pageSize, resultLimit);
|
loadInitial(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), repoOwner, repoName, pageSize, resultLimit);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadInitial(String instanceUrl, String instanceToken, String repoOwner, String repoName, int pageSize, int resultLimit) {
|
private void loadInitial(String instanceUrl, String instanceToken, String repoOwner, String repoName, int pageSize, int resultLimit) {
|
||||||
@ -150,29 +148,27 @@ public class RepoForksActivity extends BaseActivity {
|
|||||||
if(response.isSuccessful()) {
|
if(response.isSuccessful()) {
|
||||||
|
|
||||||
assert response.body() != null;
|
assert response.body() != null;
|
||||||
|
|
||||||
if(response.body().size() > 0) {
|
if(response.body().size() > 0) {
|
||||||
|
|
||||||
forksList.clear();
|
forksList.clear();
|
||||||
forksList.addAll(response.body());
|
forksList.addAll(response.body());
|
||||||
adapter.notifyDataChanged();
|
adapter.notifyDataChanged();
|
||||||
noData.setVisibility(View.GONE);
|
noData.setVisibility(View.GONE);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
forksList.clear();
|
forksList.clear();
|
||||||
adapter.notifyDataChanged();
|
adapter.notifyDataChanged();
|
||||||
noData.setVisibility(View.VISIBLE);
|
noData.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Log.e(TAG, String.valueOf(response.code()));
|
Log.e(TAG, String.valueOf(response.code()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -180,7 +176,6 @@ public class RepoForksActivity extends BaseActivity {
|
|||||||
|
|
||||||
Log.e(TAG, t.toString());
|
Log.e(TAG, t.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -205,37 +200,31 @@ public class RepoForksActivity extends BaseActivity {
|
|||||||
forksList.remove(forksList.size() - 1);
|
forksList.remove(forksList.size() - 1);
|
||||||
|
|
||||||
List<UserRepositories> result = response.body();
|
List<UserRepositories> result = response.body();
|
||||||
|
|
||||||
assert result != null;
|
assert result != null;
|
||||||
|
|
||||||
if(result.size() > 0) {
|
if(result.size() > 0) {
|
||||||
|
|
||||||
pageSize = result.size();
|
pageSize = result.size();
|
||||||
forksList.addAll(result);
|
forksList.addAll(result);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
adapter.setMoreDataAvailable(false);
|
adapter.setMoreDataAvailable(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
adapter.notifyDataChanged();
|
adapter.notifyDataChanged();
|
||||||
progressLoadMore.setVisibility(View.GONE);
|
progressLoadMore.setVisibility(View.GONE);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Log.e(TAG, String.valueOf(response.code()));
|
Log.e(TAG, String.valueOf(response.code()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@NonNull Call<List<UserRepositories>> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<List<UserRepositories>> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
Log.e(TAG, t.toString());
|
Log.e(TAG, t.toString());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -270,7 +259,6 @@ public class RepoForksActivity extends BaseActivity {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return super.onCreateOptionsMenu(menu);
|
return super.onCreateOptionsMenu(menu);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void filter(String text) {
|
private void filter(String text) {
|
||||||
@ -278,7 +266,9 @@ public class RepoForksActivity extends BaseActivity {
|
|||||||
List<UserRepositories> arr = new ArrayList<>();
|
List<UserRepositories> arr = new ArrayList<>();
|
||||||
|
|
||||||
for(UserRepositories d : forksList) {
|
for(UserRepositories d : forksList) {
|
||||||
|
|
||||||
if(d.getName().toLowerCase().contains(text) || d.getDescription().toLowerCase().contains(text)) {
|
if(d.getName().toLowerCase().contains(text) || d.getDescription().toLowerCase().contains(text)) {
|
||||||
|
|
||||||
arr.add(d);
|
arr.add(d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -289,6 +279,7 @@ public class RepoForksActivity extends BaseActivity {
|
|||||||
private void initCloseListener() {
|
private void initCloseListener() {
|
||||||
|
|
||||||
onClickListener = view -> {
|
onClickListener = view -> {
|
||||||
|
|
||||||
getIntent().removeExtra("repoFullNameForForks");
|
getIntent().removeExtra("repoFullNameForForks");
|
||||||
finish();
|
finish();
|
||||||
};
|
};
|
||||||
|
@ -7,16 +7,12 @@ import android.widget.GridView;
|
|||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.lifecycle.Observer;
|
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
import org.mian.gitnex.R;
|
import org.mian.gitnex.R;
|
||||||
import org.mian.gitnex.adapters.RepoStargazersAdapter;
|
import org.mian.gitnex.adapters.RepoStargazersAdapter;
|
||||||
import org.mian.gitnex.helpers.Authorization;
|
import org.mian.gitnex.helpers.Authorization;
|
||||||
import org.mian.gitnex.helpers.TinyDB;
|
import org.mian.gitnex.helpers.TinyDB;
|
||||||
import org.mian.gitnex.models.UserInfo;
|
|
||||||
import org.mian.gitnex.viewmodels.RepoStargazersViewModel;
|
import org.mian.gitnex.viewmodels.RepoStargazersViewModel;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Author M M Arif
|
* Author M M Arif
|
||||||
@ -66,28 +62,29 @@ public class RepoStargazersActivity extends BaseActivity {
|
|||||||
toolbarTitle.setText(R.string.repoStargazersInMenu);
|
toolbarTitle.setText(R.string.repoStargazersInMenu);
|
||||||
|
|
||||||
fetchDataAsync(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), repoOwner, repoName);
|
fetchDataAsync(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), repoOwner, repoName);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fetchDataAsync(String instanceUrl, String instanceToken, String repoOwner, String repoName) {
|
private void fetchDataAsync(String instanceUrl, String instanceToken, String repoOwner, String repoName) {
|
||||||
|
|
||||||
RepoStargazersViewModel repoStargazersModel = new ViewModelProvider(this).get(RepoStargazersViewModel.class);
|
RepoStargazersViewModel repoStargazersModel = new ViewModelProvider(this).get(RepoStargazersViewModel.class);
|
||||||
|
|
||||||
repoStargazersModel.getRepoStargazers(instanceUrl, instanceToken, repoOwner, repoName, ctx).observe(this, new Observer<List<UserInfo>>() {
|
repoStargazersModel.getRepoStargazers(instanceUrl, instanceToken, repoOwner, repoName, ctx).observe(this, stargazersListMain -> {
|
||||||
@Override
|
|
||||||
public void onChanged(@Nullable List<UserInfo> stargazersListMain) {
|
adapter = new RepoStargazersAdapter(ctx, stargazersListMain);
|
||||||
adapter = new RepoStargazersAdapter(ctx, stargazersListMain);
|
|
||||||
if(adapter.getCount() > 0) {
|
if(adapter.getCount() > 0) {
|
||||||
mGridView.setAdapter(adapter);
|
|
||||||
noDataStargazers.setVisibility(View.GONE);
|
mGridView.setAdapter(adapter);
|
||||||
}
|
noDataStargazers.setVisibility(View.GONE);
|
||||||
else {
|
|
||||||
adapter.notifyDataSetChanged();
|
|
||||||
mGridView.setAdapter(adapter);
|
|
||||||
noDataStargazers.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
mProgressBar.setVisibility(View.GONE);
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
adapter.notifyDataSetChanged();
|
||||||
|
mGridView.setAdapter(adapter);
|
||||||
|
noDataStargazers.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
mProgressBar.setVisibility(View.GONE);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,16 +7,12 @@ import android.widget.GridView;
|
|||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.lifecycle.Observer;
|
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
import org.mian.gitnex.R;
|
import org.mian.gitnex.R;
|
||||||
import org.mian.gitnex.adapters.RepoWatchersAdapter;
|
import org.mian.gitnex.adapters.RepoWatchersAdapter;
|
||||||
import org.mian.gitnex.helpers.Authorization;
|
import org.mian.gitnex.helpers.Authorization;
|
||||||
import org.mian.gitnex.helpers.TinyDB;
|
import org.mian.gitnex.helpers.TinyDB;
|
||||||
import org.mian.gitnex.models.UserInfo;
|
|
||||||
import org.mian.gitnex.viewmodels.RepoWatchersViewModel;
|
import org.mian.gitnex.viewmodels.RepoWatchersViewModel;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Author M M Arif
|
* Author M M Arif
|
||||||
@ -66,28 +62,29 @@ public class RepoWatchersActivity extends BaseActivity {
|
|||||||
toolbarTitle.setText(R.string.repoWatchersInMenu);
|
toolbarTitle.setText(R.string.repoWatchersInMenu);
|
||||||
|
|
||||||
fetchDataAsync(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), repoOwner, repoName);
|
fetchDataAsync(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), repoOwner, repoName);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fetchDataAsync(String instanceUrl, String instanceToken, String repoOwner, String repoName) {
|
private void fetchDataAsync(String instanceUrl, String instanceToken, String repoOwner, String repoName) {
|
||||||
|
|
||||||
RepoWatchersViewModel repoWatchersModel = new ViewModelProvider(this).get(RepoWatchersViewModel.class);
|
RepoWatchersViewModel repoWatchersModel = new ViewModelProvider(this).get(RepoWatchersViewModel.class);
|
||||||
|
|
||||||
repoWatchersModel.getRepoWatchers(instanceUrl, instanceToken, repoOwner, repoName, ctx).observe(this, new Observer<List<UserInfo>>() {
|
repoWatchersModel.getRepoWatchers(instanceUrl, instanceToken, repoOwner, repoName, ctx).observe(this, watchersListMain -> {
|
||||||
@Override
|
|
||||||
public void onChanged(@Nullable List<UserInfo> watchersListMain) {
|
adapter = new RepoWatchersAdapter(ctx, watchersListMain);
|
||||||
adapter = new RepoWatchersAdapter(ctx, watchersListMain);
|
|
||||||
if(adapter.getCount() > 0) {
|
if(adapter.getCount() > 0) {
|
||||||
mGridView.setAdapter(adapter);
|
|
||||||
noDataWatchers.setVisibility(View.GONE);
|
mGridView.setAdapter(adapter);
|
||||||
}
|
noDataWatchers.setVisibility(View.GONE);
|
||||||
else {
|
|
||||||
adapter.notifyDataSetChanged();
|
|
||||||
mGridView.setAdapter(adapter);
|
|
||||||
noDataWatchers.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
mProgressBar.setVisibility(View.GONE);
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
adapter.notifyDataSetChanged();
|
||||||
|
mGridView.setAdapter(adapter);
|
||||||
|
noDataWatchers.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
mProgressBar.setVisibility(View.GONE);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -82,22 +82,15 @@ public class RepositorySettingsActivity extends BaseActivity {
|
|||||||
|
|
||||||
// require gitea 1.12 or higher
|
// require gitea 1.12 or higher
|
||||||
if(new Version(tinyDb.getString("giteaVersion")).higherOrEqual("1.12.0")) {
|
if(new Version(tinyDb.getString("giteaVersion")).higherOrEqual("1.12.0")) {
|
||||||
|
|
||||||
viewBinding.transferOwnerFrame.setVisibility(View.VISIBLE);
|
viewBinding.transferOwnerFrame.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
viewBinding.editProperties.setOnClickListener(editProperties -> {
|
viewBinding.editProperties.setOnClickListener(editProperties -> showRepositoryProperties());
|
||||||
showRepositoryProperties();
|
|
||||||
});
|
|
||||||
|
|
||||||
viewBinding.deleteRepository.setOnClickListener(deleteRepository -> {
|
viewBinding.deleteRepository.setOnClickListener(deleteRepository -> showDeleteRepository());
|
||||||
showDeleteRepository();
|
|
||||||
});
|
|
||||||
|
|
||||||
viewBinding.transferOwnerFrame.setOnClickListener(transferRepositoryOwnership -> {
|
|
||||||
showTransferRepository();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
viewBinding.transferOwnerFrame.setOnClickListener(transferRepositoryOwnership -> showTransferRepository());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showTransferRepository() {
|
private void showTransferRepository() {
|
||||||
@ -114,9 +107,7 @@ public class RepositorySettingsActivity extends BaseActivity {
|
|||||||
View view = transferRepoBinding.getRoot();
|
View view = transferRepoBinding.getRoot();
|
||||||
dialogTransferRepository.setContentView(view);
|
dialogTransferRepository.setContentView(view);
|
||||||
|
|
||||||
transferRepoBinding.cancel.setOnClickListener(editProperties -> {
|
transferRepoBinding.cancel.setOnClickListener(editProperties -> dialogTransferRepository.dismiss());
|
||||||
dialogTransferRepository.dismiss();
|
|
||||||
});
|
|
||||||
|
|
||||||
transferRepoBinding.transfer.setOnClickListener(deleteRepo -> {
|
transferRepoBinding.transfer.setOnClickListener(deleteRepo -> {
|
||||||
|
|
||||||
@ -197,6 +188,7 @@ public class RepositorySettingsActivity extends BaseActivity {
|
|||||||
dialogDeleteRepository = new Dialog(ctx, R.style.ThemeOverlay_MaterialComponents_Dialog_Alert);
|
dialogDeleteRepository = new Dialog(ctx, R.style.ThemeOverlay_MaterialComponents_Dialog_Alert);
|
||||||
|
|
||||||
if (dialogDeleteRepository.getWindow() != null) {
|
if (dialogDeleteRepository.getWindow() != null) {
|
||||||
|
|
||||||
dialogDeleteRepository.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
dialogDeleteRepository.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,9 +197,7 @@ public class RepositorySettingsActivity extends BaseActivity {
|
|||||||
View view = deleteRepoBinding.getRoot();
|
View view = deleteRepoBinding.getRoot();
|
||||||
dialogDeleteRepository.setContentView(view);
|
dialogDeleteRepository.setContentView(view);
|
||||||
|
|
||||||
deleteRepoBinding.cancel.setOnClickListener(editProperties -> {
|
deleteRepoBinding.cancel.setOnClickListener(editProperties -> dialogDeleteRepository.dismiss());
|
||||||
dialogDeleteRepository.dismiss();
|
|
||||||
});
|
|
||||||
|
|
||||||
deleteRepoBinding.delete.setOnClickListener(deleteRepo -> {
|
deleteRepoBinding.delete.setOnClickListener(deleteRepo -> {
|
||||||
|
|
||||||
@ -273,6 +263,7 @@ public class RepositorySettingsActivity extends BaseActivity {
|
|||||||
dialogProp = new Dialog(ctx, R.style.ThemeOverlay_MaterialComponents_Dialog_Alert);
|
dialogProp = new Dialog(ctx, R.style.ThemeOverlay_MaterialComponents_Dialog_Alert);
|
||||||
|
|
||||||
if (dialogProp.getWindow() != null) {
|
if (dialogProp.getWindow() != null) {
|
||||||
|
|
||||||
dialogProp.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
dialogProp.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,9 +272,7 @@ public class RepositorySettingsActivity extends BaseActivity {
|
|||||||
View view = propBinding.getRoot();
|
View view = propBinding.getRoot();
|
||||||
dialogProp.setContentView(view);
|
dialogProp.setContentView(view);
|
||||||
|
|
||||||
propBinding.cancel.setOnClickListener(editProperties -> {
|
propBinding.cancel.setOnClickListener(editProperties -> dialogProp.dismiss());
|
||||||
dialogProp.dismiss();
|
|
||||||
});
|
|
||||||
|
|
||||||
Call<UserRepositories> call = RetrofitClient
|
Call<UserRepositories> call = RetrofitClient
|
||||||
.getInstance(instanceUrl, ctx)
|
.getInstance(instanceUrl, ctx)
|
||||||
@ -314,19 +303,24 @@ public class RepositorySettingsActivity extends BaseActivity {
|
|||||||
propBinding.repoEnableIssues.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
propBinding.repoEnableIssues.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||||
|
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
|
|
||||||
propBinding.repoEnableTimer.setVisibility(View.VISIBLE);
|
propBinding.repoEnableTimer.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
propBinding.repoEnableTimer.setVisibility(View.GONE);
|
propBinding.repoEnableTimer.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if(repoInfo.getInternal_tracker() != null) {
|
if(repoInfo.getInternal_tracker() != null) {
|
||||||
|
|
||||||
propBinding.repoEnableTimer.setChecked(repoInfo.getInternal_tracker().isEnable_time_tracker());
|
propBinding.repoEnableTimer.setChecked(repoInfo.getInternal_tracker().isEnable_time_tracker());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
propBinding.repoEnableTimer.setVisibility(View.GONE);
|
propBinding.repoEnableTimer.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
propBinding.repoEnableWiki.setChecked(repoInfo.isHas_wiki());
|
propBinding.repoEnableWiki.setChecked(repoInfo.isHas_wiki());
|
||||||
propBinding.repoEnablePr.setChecked(repoInfo.isHas_pull_requests());
|
propBinding.repoEnablePr.setChecked(repoInfo.isHas_pull_requests());
|
||||||
propBinding.repoEnableMerge.setChecked(repoInfo.isAllow_merge_commits());
|
propBinding.repoEnableMerge.setChecked(repoInfo.isAllow_merge_commits());
|
||||||
@ -359,7 +353,6 @@ public class RepositorySettingsActivity extends BaseActivity {
|
|||||||
propBinding.repoEnableSquash.isChecked(), propBinding.repoEnableForceMerge.isChecked()));
|
propBinding.repoEnableSquash.isChecked(), propBinding.repoEnableForceMerge.isChecked()));
|
||||||
|
|
||||||
dialogProp.show();
|
dialogProp.show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveRepositoryProperties(String repoName, String repoWebsite, String repoDescription,
|
private void saveRepositoryProperties(String repoName, String repoWebsite, String repoDescription,
|
||||||
@ -370,11 +363,14 @@ public class RepositorySettingsActivity extends BaseActivity {
|
|||||||
UserRepositories.internalTimeTrackerObject repoPropsTimeTracker = new UserRepositories.internalTimeTrackerObject(repoEnableTimer);
|
UserRepositories.internalTimeTrackerObject repoPropsTimeTracker = new UserRepositories.internalTimeTrackerObject(repoEnableTimer);
|
||||||
|
|
||||||
UserRepositories repoProps;
|
UserRepositories repoProps;
|
||||||
|
|
||||||
if(!repoEnableIssues) {
|
if(!repoEnableIssues) {
|
||||||
|
|
||||||
repoProps = new UserRepositories(repoName, repoWebsite, repoDescription, repoPrivate, repoAsTemplate, repoEnableIssues, repoEnableWiki, repoEnablePr, repoEnableMerge,
|
repoProps = new UserRepositories(repoName, repoWebsite, repoDescription, repoPrivate, repoAsTemplate, repoEnableIssues, repoEnableWiki, repoEnablePr, repoEnableMerge,
|
||||||
repoEnableRebase, repoEnableSquash, repoEnableForceMerge);
|
repoEnableRebase, repoEnableSquash, repoEnableForceMerge);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
repoProps = new UserRepositories(repoName, repoWebsite, repoDescription, repoPrivate, repoAsTemplate, repoEnableIssues, repoEnableWiki, repoEnablePr, repoPropsTimeTracker, repoEnableMerge,
|
repoProps = new UserRepositories(repoName, repoWebsite, repoDescription, repoPrivate, repoAsTemplate, repoEnableIssues, repoEnableWiki, repoEnablePr, repoPropsTimeTracker, repoEnableMerge,
|
||||||
repoEnableRebase, repoEnableSquash, repoEnableForceMerge);
|
repoEnableRebase, repoEnableSquash, repoEnableForceMerge);
|
||||||
}
|
}
|
||||||
@ -406,7 +402,6 @@ public class RepositorySettingsActivity extends BaseActivity {
|
|||||||
RepositoriesApi.updateRepositoryOwnerAndName(repositoryOwner, repoName, (int) tinyDb.getLong("repositoryId", 0));
|
RepositoriesApi.updateRepositoryOwnerAndName(repositoryOwner, repoName, (int) tinyDb.getLong("repositoryId", 0));
|
||||||
Intent intent = new Intent(RepositorySettingsActivity.this, MainActivity.class);
|
Intent intent = new Intent(RepositorySettingsActivity.this, MainActivity.class);
|
||||||
RepositorySettingsActivity.this.startActivity(intent);
|
RepositorySettingsActivity.this.startActivity(intent);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -415,7 +410,6 @@ public class RepositorySettingsActivity extends BaseActivity {
|
|||||||
propBinding.processingRequest.setVisibility(View.GONE);
|
propBinding.processingRequest.setVisibility(View.GONE);
|
||||||
Toasty.error(ctx, getString(R.string.genericError));
|
Toasty.error(ctx, getString(R.string.genericError));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -5,13 +5,15 @@ import android.os.Bundle;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.Switch;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
import com.google.android.material.switchmaterial.SwitchMaterial;
|
||||||
import org.mian.gitnex.R;
|
import org.mian.gitnex.R;
|
||||||
import org.mian.gitnex.helpers.TinyDB;
|
import org.mian.gitnex.helpers.TinyDB;
|
||||||
import org.mian.gitnex.helpers.Toasty;
|
import org.mian.gitnex.helpers.Toasty;
|
||||||
import org.mian.gitnex.helpers.Version;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Author M M Arif
|
* Author M M Arif
|
||||||
@ -22,20 +24,16 @@ public class SettingsAppearanceActivity extends BaseActivity {
|
|||||||
private Context appCtx;
|
private Context appCtx;
|
||||||
private View.OnClickListener onClickListener;
|
private View.OnClickListener onClickListener;
|
||||||
|
|
||||||
private static String[] timeList = {"Pretty", "Normal"};
|
private static final String[] timeList = {"Pretty", "Normal"};
|
||||||
private static int timeSelectedChoice = 0;
|
private static int timeSelectedChoice = 0;
|
||||||
|
|
||||||
private static String[] codeBlockList = {"Green - Black", "White - Black", "Grey - Black", "White - Grey", "Dark - White"};
|
private List<String> codeBlockList;
|
||||||
private static int codeBlockSelectedChoice = 0;
|
private static int codeBlockSelectedChoice = 0;
|
||||||
|
|
||||||
private static String[] homeScreenList = {"My Repositories", "Starred Repositories", "Organizations", "Repositories", "Profile", "Explore", "Drafts"};
|
private static final String[] customFontList = {"Roboto", "Manrope", "Source Code Pro"};
|
||||||
private static String[] homeScreenListNew = {"My Repositories", "Starred Repositories", "Organizations", "Repositories", "Profile", "Explore", "Drafts", "Notifications"};
|
|
||||||
private static int homeScreenSelectedChoice = 0;
|
|
||||||
|
|
||||||
private static String[] customFontList = {"Roboto", "Manrope", "Source Code Pro"};
|
|
||||||
private static int customFontSelectedChoice = 0;
|
private static int customFontSelectedChoice = 0;
|
||||||
|
|
||||||
private static String[] themeList = {"Dark", "Light", "Auto (Light / Dark)", "Retro", "Auto (Retro / Dark)"};
|
private static final String[] themeList = {"Dark", "Light", "Auto (Light / Dark)", "Retro", "Auto (Retro / Dark)"};
|
||||||
private static int themeSelectedChoice = 0;
|
private static int themeSelectedChoice = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -56,85 +54,138 @@ public class SettingsAppearanceActivity extends BaseActivity {
|
|||||||
|
|
||||||
final TextView tvDateTimeSelected = findViewById(R.id.tvDateTimeSelected); // setter for time
|
final TextView tvDateTimeSelected = findViewById(R.id.tvDateTimeSelected); // setter for time
|
||||||
final TextView codeBlockSelected = findViewById(R.id.codeBlockSelected); // setter for code block
|
final TextView codeBlockSelected = findViewById(R.id.codeBlockSelected); // setter for code block
|
||||||
final TextView homeScreenSelected = findViewById(R.id.homeScreenSelected); // setter for home screen
|
|
||||||
final TextView customFontSelected = findViewById(R.id.customFontSelected); // setter for custom font
|
final TextView customFontSelected = findViewById(R.id.customFontSelected); // setter for custom font
|
||||||
final TextView themeSelected = findViewById(R.id.themeSelected); // setter for theme
|
final TextView themeSelected = findViewById(R.id.themeSelected); // setter for theme
|
||||||
|
|
||||||
LinearLayout timeFrame = findViewById(R.id.timeFrame);
|
LinearLayout timeFrame = findViewById(R.id.timeFrame);
|
||||||
LinearLayout codeBlockFrame = findViewById(R.id.codeBlockFrame);
|
LinearLayout codeBlockFrame = findViewById(R.id.codeBlockFrame);
|
||||||
LinearLayout homeScreenFrame = findViewById(R.id.homeScreenFrame);
|
|
||||||
LinearLayout customFontFrame = findViewById(R.id.customFontFrame);
|
LinearLayout customFontFrame = findViewById(R.id.customFontFrame);
|
||||||
LinearLayout themeFrame = findViewById(R.id.themeSelectionFrame);
|
LinearLayout themeFrame = findViewById(R.id.themeSelectionFrame);
|
||||||
|
|
||||||
Switch counterBadgesSwitch = findViewById(R.id.switchCounterBadge);
|
SwitchMaterial counterBadgesSwitch = findViewById(R.id.switchCounterBadge);
|
||||||
|
|
||||||
initCloseListener();
|
initCloseListener();
|
||||||
closeActivity.setOnClickListener(onClickListener);
|
closeActivity.setOnClickListener(onClickListener);
|
||||||
|
|
||||||
if(new Version(tinyDb.getString("giteaVersion")).higherOrEqual("1.12.3")) {
|
// code block
|
||||||
|
String[] codeBlockList_ = {getResources().getString(R.string.codeBlockGreenOnBlack), getResources().getString(R.string.codeBlockWhiteOnBlack),
|
||||||
|
getResources().getString(R.string.codeBlockGreyOnBlack), getResources().getString(R.string.codeBlockWhiteOnGrey),
|
||||||
|
getResources().getString(R.string.codeBlockDarkOnWhite)};
|
||||||
|
|
||||||
homeScreenList = homeScreenListNew;
|
codeBlockList = new ArrayList<>(Arrays.asList(codeBlockList_));
|
||||||
|
String[] codeBlockArray = new String[codeBlockList.size()];
|
||||||
|
codeBlockList.toArray(codeBlockArray);
|
||||||
|
|
||||||
|
if(codeBlockSelectedChoice == 0) {
|
||||||
|
|
||||||
|
codeBlockSelectedChoice = tinyDb.getInt("codeBlockId");
|
||||||
|
codeBlockSelected.setText(getResources().getString(R.string.codeBlockGreenOnBlack));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(codeBlockSelectedChoice == 1) {
|
||||||
|
|
||||||
|
codeBlockSelected.setText(getResources().getString(R.string.codeBlockWhiteOnBlack));
|
||||||
|
}
|
||||||
|
else if(codeBlockSelectedChoice == 2) {
|
||||||
|
|
||||||
|
codeBlockSelected.setText(getResources().getString(R.string.codeBlockGreyOnBlack));
|
||||||
|
}
|
||||||
|
else if(codeBlockSelectedChoice == 3) {
|
||||||
|
|
||||||
|
codeBlockSelected.setText(getResources().getString(R.string.codeBlockWhiteOnGrey));
|
||||||
|
}
|
||||||
|
else if(codeBlockSelectedChoice == 4) {
|
||||||
|
|
||||||
|
codeBlockSelected.setText(getResources().getString(R.string.codeBlockDarkOnWhite));
|
||||||
|
}
|
||||||
|
|
||||||
|
codeBlockFrame.setOnClickListener(codeBlock -> {
|
||||||
|
|
||||||
|
AlertDialog.Builder cBuilder = new AlertDialog.Builder(SettingsAppearanceActivity.this);
|
||||||
|
|
||||||
|
cBuilder.setTitle(R.string.settingsCodeBlockSelectorDialogTitle);
|
||||||
|
cBuilder.setCancelable(codeBlockSelectedChoice != -1);
|
||||||
|
|
||||||
|
cBuilder.setSingleChoiceItems(codeBlockList_, codeBlockSelectedChoice, (dialogInterfaceCodeBlock, i) -> {
|
||||||
|
|
||||||
|
codeBlockSelectedChoice = i;
|
||||||
|
codeBlockSelected.setText(codeBlockList_[i]);
|
||||||
|
tinyDb.putInt("codeBlockId", i);
|
||||||
|
|
||||||
|
switch(i) {
|
||||||
|
case 1: // white on black
|
||||||
|
|
||||||
|
tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.colorWhite));
|
||||||
|
tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.black));
|
||||||
|
break;
|
||||||
|
case 2: // grey on black
|
||||||
|
|
||||||
|
tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.colorAccent));
|
||||||
|
tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.black));
|
||||||
|
break;
|
||||||
|
case 3: // white on grey
|
||||||
|
|
||||||
|
tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.colorWhite));
|
||||||
|
tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.colorAccent));
|
||||||
|
break;
|
||||||
|
case 4: // dark on white
|
||||||
|
|
||||||
|
tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.colorPrimary));
|
||||||
|
tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.colorWhite));
|
||||||
|
break;
|
||||||
|
default: // green on black
|
||||||
|
|
||||||
|
tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.colorLightGreen));
|
||||||
|
tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.black));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
dialogInterfaceCodeBlock.dismiss();
|
||||||
|
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
||||||
|
});
|
||||||
|
|
||||||
|
AlertDialog cDialog = cBuilder.create();
|
||||||
|
cDialog.show();
|
||||||
|
});
|
||||||
|
// code block
|
||||||
|
|
||||||
if(!tinyDb.getString("timeStr").isEmpty()) {
|
if(!tinyDb.getString("timeStr").isEmpty()) {
|
||||||
|
|
||||||
tvDateTimeSelected.setText(tinyDb.getString("timeStr"));
|
tvDateTimeSelected.setText(tinyDb.getString("timeStr"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!tinyDb.getString("codeBlockStr").isEmpty()) {
|
|
||||||
codeBlockSelected.setText(tinyDb.getString("codeBlockStr"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!tinyDb.getString("homeScreenStr").isEmpty()) {
|
|
||||||
homeScreenSelected.setText(tinyDb.getString("homeScreenStr"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!tinyDb.getString("customFontStr").isEmpty()) {
|
if(!tinyDb.getString("customFontStr").isEmpty()) {
|
||||||
|
|
||||||
customFontSelected.setText(tinyDb.getString("customFontStr"));
|
customFontSelected.setText(tinyDb.getString("customFontStr"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!tinyDb.getString("themeStr").isEmpty()) {
|
if(!tinyDb.getString("themeStr").isEmpty()) {
|
||||||
|
|
||||||
themeSelected.setText(tinyDb.getString("themeStr"));
|
themeSelected.setText(tinyDb.getString("themeStr"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(timeSelectedChoice == 0) {
|
if(timeSelectedChoice == 0) {
|
||||||
|
|
||||||
timeSelectedChoice = tinyDb.getInt("timeId");
|
timeSelectedChoice = tinyDb.getInt("timeId");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(codeBlockSelectedChoice == 0) {
|
|
||||||
codeBlockSelectedChoice = tinyDb.getInt("codeBlockId");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(homeScreenSelectedChoice == 0) {
|
|
||||||
homeScreenSelectedChoice = tinyDb.getInt("homeScreenId");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(customFontSelectedChoice == 0) {
|
if(customFontSelectedChoice == 0) {
|
||||||
|
|
||||||
customFontSelectedChoice = tinyDb.getInt("customFontId", 1);
|
customFontSelectedChoice = tinyDb.getInt("customFontId", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(themeSelectedChoice == 0) {
|
if(themeSelectedChoice == 0) {
|
||||||
|
|
||||||
themeSelectedChoice = tinyDb.getInt("themeId");
|
themeSelectedChoice = tinyDb.getInt("themeId");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tinyDb.getBoolean("enableCounterBadges")) {
|
counterBadgesSwitch.setChecked(tinyDb.getBoolean("enableCounterBadges"));
|
||||||
counterBadgesSwitch.setChecked(true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
counterBadgesSwitch.setChecked(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// counter badge switcher
|
// counter badge switcher
|
||||||
counterBadgesSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
counterBadgesSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||||
|
|
||||||
if (isChecked) {
|
tinyDb.putBoolean("enableCounterBadges", isChecked);
|
||||||
tinyDb.putBoolean("enableCounterBadges", true);
|
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
||||||
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
tinyDb.putBoolean("enableCounterBadges", false);
|
|
||||||
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// theme selection dialog
|
// theme selection dialog
|
||||||
@ -143,12 +194,7 @@ public class SettingsAppearanceActivity extends BaseActivity {
|
|||||||
AlertDialog.Builder tsBuilder = new AlertDialog.Builder(SettingsAppearanceActivity.this);
|
AlertDialog.Builder tsBuilder = new AlertDialog.Builder(SettingsAppearanceActivity.this);
|
||||||
|
|
||||||
tsBuilder.setTitle(getResources().getString(R.string.themeSelectorDialogTitle));
|
tsBuilder.setTitle(getResources().getString(R.string.themeSelectorDialogTitle));
|
||||||
if(themeSelectedChoice != -1) {
|
tsBuilder.setCancelable(themeSelectedChoice != -1);
|
||||||
tsBuilder.setCancelable(true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
tsBuilder.setCancelable(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
tsBuilder.setSingleChoiceItems(themeList, themeSelectedChoice, (dialogInterfaceTheme, i) -> {
|
tsBuilder.setSingleChoiceItems(themeList, themeSelectedChoice, (dialogInterfaceTheme, i) -> {
|
||||||
|
|
||||||
@ -162,12 +208,10 @@ public class SettingsAppearanceActivity extends BaseActivity {
|
|||||||
this.overridePendingTransition(0, 0);
|
this.overridePendingTransition(0, 0);
|
||||||
dialogInterfaceTheme.dismiss();
|
dialogInterfaceTheme.dismiss();
|
||||||
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
AlertDialog cfDialog = tsBuilder.create();
|
AlertDialog cfDialog = tsBuilder.create();
|
||||||
cfDialog.show();
|
cfDialog.show();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// custom font dialog
|
// custom font dialog
|
||||||
@ -176,12 +220,7 @@ public class SettingsAppearanceActivity extends BaseActivity {
|
|||||||
AlertDialog.Builder cfBuilder = new AlertDialog.Builder(SettingsAppearanceActivity.this);
|
AlertDialog.Builder cfBuilder = new AlertDialog.Builder(SettingsAppearanceActivity.this);
|
||||||
|
|
||||||
cfBuilder.setTitle(R.string.settingsCustomFontSelectorDialogTitle);
|
cfBuilder.setTitle(R.string.settingsCustomFontSelectorDialogTitle);
|
||||||
if(customFontSelectedChoice != -1) {
|
cfBuilder.setCancelable(customFontSelectedChoice != -1);
|
||||||
cfBuilder.setCancelable(true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
cfBuilder.setCancelable(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
cfBuilder.setSingleChoiceItems(customFontList, customFontSelectedChoice, (dialogInterfaceCustomFont, i) -> {
|
cfBuilder.setSingleChoiceItems(customFontList, customFontSelectedChoice, (dialogInterfaceCustomFont, i) -> {
|
||||||
|
|
||||||
@ -195,95 +234,10 @@ public class SettingsAppearanceActivity extends BaseActivity {
|
|||||||
this.overridePendingTransition(0, 0);
|
this.overridePendingTransition(0, 0);
|
||||||
dialogInterfaceCustomFont.dismiss();
|
dialogInterfaceCustomFont.dismiss();
|
||||||
Toasty.success(appCtx, appCtx.getResources().getString(R.string.settingsSave));
|
Toasty.success(appCtx, appCtx.getResources().getString(R.string.settingsSave));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
AlertDialog cfDialog = cfBuilder.create();
|
AlertDialog cfDialog = cfBuilder.create();
|
||||||
cfDialog.show();
|
cfDialog.show();
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
// home screen dialog
|
|
||||||
homeScreenFrame.setOnClickListener(view -> {
|
|
||||||
|
|
||||||
AlertDialog.Builder hsBuilder = new AlertDialog.Builder(SettingsAppearanceActivity.this);
|
|
||||||
|
|
||||||
hsBuilder.setTitle(R.string.settingsHomeScreenSelectorDialogTitle);
|
|
||||||
if(homeScreenSelectedChoice != -1) {
|
|
||||||
hsBuilder.setCancelable(true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
hsBuilder.setCancelable(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
hsBuilder.setSingleChoiceItems(homeScreenList, homeScreenSelectedChoice, (dialogInterfaceHomeScreen, i) -> {
|
|
||||||
|
|
||||||
homeScreenSelectedChoice = i;
|
|
||||||
homeScreenSelected.setText(homeScreenList[i]);
|
|
||||||
tinyDb.putString("homeScreenStr", homeScreenList[i]);
|
|
||||||
tinyDb.putInt("homeScreenId", i);
|
|
||||||
|
|
||||||
dialogInterfaceHomeScreen.dismiss();
|
|
||||||
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
AlertDialog hsDialog = hsBuilder.create();
|
|
||||||
hsDialog.show();
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
// code block dialog
|
|
||||||
codeBlockFrame.setOnClickListener(view -> {
|
|
||||||
|
|
||||||
AlertDialog.Builder cBuilder = new AlertDialog.Builder(SettingsAppearanceActivity.this);
|
|
||||||
|
|
||||||
cBuilder.setTitle(R.string.settingsCodeBlockSelectorDialogTitle);
|
|
||||||
if(codeBlockSelectedChoice != -1) {
|
|
||||||
cBuilder.setCancelable(true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
cBuilder.setCancelable(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
cBuilder.setSingleChoiceItems(codeBlockList, codeBlockSelectedChoice, (dialogInterfaceCodeBlock, i) -> {
|
|
||||||
|
|
||||||
codeBlockSelectedChoice = i;
|
|
||||||
codeBlockSelected.setText(codeBlockList[i]);
|
|
||||||
tinyDb.putString("codeBlockStr", codeBlockList[i]);
|
|
||||||
tinyDb.putInt("codeBlockId", i);
|
|
||||||
|
|
||||||
switch(codeBlockList[i]) {
|
|
||||||
case "White - Black":
|
|
||||||
tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.colorWhite));
|
|
||||||
tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.black));
|
|
||||||
break;
|
|
||||||
case "Grey - Black":
|
|
||||||
tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.colorAccent));
|
|
||||||
tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.black));
|
|
||||||
break;
|
|
||||||
case "White - Grey":
|
|
||||||
tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.colorWhite));
|
|
||||||
tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.colorAccent));
|
|
||||||
break;
|
|
||||||
case "Dark - White":
|
|
||||||
tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.colorPrimary));
|
|
||||||
tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.colorWhite));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.colorLightGreen));
|
|
||||||
tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.black));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
dialogInterfaceCodeBlock.dismiss();
|
|
||||||
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
AlertDialog cDialog = cBuilder.create();
|
|
||||||
cDialog.show();
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// time and date dialog
|
// time and date dialog
|
||||||
@ -292,12 +246,7 @@ public class SettingsAppearanceActivity extends BaseActivity {
|
|||||||
AlertDialog.Builder tBuilder = new AlertDialog.Builder(SettingsAppearanceActivity.this);
|
AlertDialog.Builder tBuilder = new AlertDialog.Builder(SettingsAppearanceActivity.this);
|
||||||
|
|
||||||
tBuilder.setTitle(R.string.settingsTimeSelectorDialogTitle);
|
tBuilder.setTitle(R.string.settingsTimeSelectorDialogTitle);
|
||||||
if(timeSelectedChoice != -1) {
|
tBuilder.setCancelable(timeSelectedChoice != -1);
|
||||||
tBuilder.setCancelable(true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
tBuilder.setCancelable(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
tBuilder.setSingleChoiceItems(timeList, timeSelectedChoice, (dialogInterfaceTime, i) -> {
|
tBuilder.setSingleChoiceItems(timeList, timeSelectedChoice, (dialogInterfaceTime, i) -> {
|
||||||
|
|
||||||
@ -307,21 +256,20 @@ public class SettingsAppearanceActivity extends BaseActivity {
|
|||||||
tinyDb.putInt("timeId", i);
|
tinyDb.putInt("timeId", i);
|
||||||
|
|
||||||
if("Normal".equals(timeList[i])) {
|
if("Normal".equals(timeList[i])) {
|
||||||
|
|
||||||
tinyDb.putString("dateFormat", "normal");
|
tinyDb.putString("dateFormat", "normal");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
tinyDb.putString("dateFormat", "pretty");
|
tinyDb.putString("dateFormat", "pretty");
|
||||||
}
|
}
|
||||||
|
|
||||||
dialogInterfaceTime.dismiss();
|
dialogInterfaceTime.dismiss();
|
||||||
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
AlertDialog tDialog = tBuilder.create();
|
AlertDialog tDialog = tBuilder.create();
|
||||||
tDialog.show();
|
tDialog.show();
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,10 +4,10 @@ import android.content.Context;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.Switch;
|
import com.google.android.material.switchmaterial.SwitchMaterial;
|
||||||
import org.mian.gitnex.R;
|
import org.mian.gitnex.R;
|
||||||
import org.mian.gitnex.helpers.Toasty;
|
|
||||||
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
|
||||||
@ -37,27 +37,15 @@ public class SettingsDraftsActivity extends BaseActivity {
|
|||||||
initCloseListener();
|
initCloseListener();
|
||||||
closeActivity.setOnClickListener(onClickListener);
|
closeActivity.setOnClickListener(onClickListener);
|
||||||
|
|
||||||
Switch commentsDeletionSwitch = findViewById(R.id.commentsDeletionSwitch);
|
SwitchMaterial commentsDeletionSwitch = findViewById(R.id.commentsDeletionSwitch);
|
||||||
|
|
||||||
if(tinyDb.getBoolean("draftsCommentsDeletionEnabled")) {
|
commentsDeletionSwitch.setChecked(tinyDb.getBoolean("draftsCommentsDeletionEnabled"));
|
||||||
commentsDeletionSwitch.setChecked(true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
commentsDeletionSwitch.setChecked(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// delete comments on submit switcher
|
// delete comments on submit switcher
|
||||||
commentsDeletionSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
commentsDeletionSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||||
|
|
||||||
if(isChecked) {
|
tinyDb.putBoolean("draftsCommentsDeletionEnabled", isChecked);
|
||||||
tinyDb.putBoolean("draftsCommentsDeletionEnabled", true);
|
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
||||||
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
tinyDb.putBoolean("draftsCommentsDeletionEnabled", false);
|
|
||||||
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,9 +5,9 @@ import android.os.Bundle;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.Switch;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
import com.google.android.material.switchmaterial.SwitchMaterial;
|
||||||
import org.mian.gitnex.R;
|
import org.mian.gitnex.R;
|
||||||
import org.mian.gitnex.helpers.TinyDB;
|
import org.mian.gitnex.helpers.TinyDB;
|
||||||
import org.mian.gitnex.helpers.Toasty;
|
import org.mian.gitnex.helpers.Toasty;
|
||||||
@ -21,7 +21,7 @@ public class SettingsFileViewerActivity extends BaseActivity {
|
|||||||
private Context appCtx;
|
private Context appCtx;
|
||||||
private View.OnClickListener onClickListener;
|
private View.OnClickListener onClickListener;
|
||||||
|
|
||||||
private static String[] fileViewerSourceCodeThemesList = {"Sublime", "Arduino Light", "Github", "Far ", "Ir Black", "Android Studio"};
|
private static final String[] fileViewerSourceCodeThemesList = {"Sublime", "Arduino Light", "Github", "Far ", "Ir Black", "Android Studio"};
|
||||||
private static int fileViewerSourceCodeThemesSelectedChoice = 0;
|
private static int fileViewerSourceCodeThemesSelectedChoice = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -47,7 +47,7 @@ public class SettingsFileViewerActivity extends BaseActivity {
|
|||||||
|
|
||||||
LinearLayout sourceCodeThemeFrame = findViewById(R.id.sourceCodeThemeFrame);
|
LinearLayout sourceCodeThemeFrame = findViewById(R.id.sourceCodeThemeFrame);
|
||||||
|
|
||||||
Switch pdfModeSwitch = findViewById(R.id.switchPdfMode);
|
SwitchMaterial pdfModeSwitch = findViewById(R.id.switchPdfMode);
|
||||||
|
|
||||||
if(!tinyDb.getString("fileviewerSourceCodeThemeStr").isEmpty()) {
|
if(!tinyDb.getString("fileviewerSourceCodeThemeStr").isEmpty()) {
|
||||||
fileViewerSourceCodeThemesSelected.setText(tinyDb.getString("fileviewerSourceCodeThemeStr"));
|
fileViewerSourceCodeThemesSelected.setText(tinyDb.getString("fileviewerSourceCodeThemeStr"));
|
||||||
@ -57,12 +57,7 @@ public class SettingsFileViewerActivity extends BaseActivity {
|
|||||||
fileViewerSourceCodeThemesSelectedChoice = tinyDb.getInt("fileviewerThemeId");
|
fileViewerSourceCodeThemesSelectedChoice = tinyDb.getInt("fileviewerThemeId");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tinyDb.getBoolean("enablePdfMode")) {
|
pdfModeSwitch.setChecked(tinyDb.getBoolean("enablePdfMode"));
|
||||||
pdfModeSwitch.setChecked(true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
pdfModeSwitch.setChecked(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// fileviewer srouce code theme selection dialog
|
// fileviewer srouce code theme selection dialog
|
||||||
sourceCodeThemeFrame.setOnClickListener(view -> {
|
sourceCodeThemeFrame.setOnClickListener(view -> {
|
||||||
@ -70,12 +65,7 @@ public class SettingsFileViewerActivity extends BaseActivity {
|
|||||||
AlertDialog.Builder fvtsBuilder = new AlertDialog.Builder(SettingsFileViewerActivity.this);
|
AlertDialog.Builder fvtsBuilder = new AlertDialog.Builder(SettingsFileViewerActivity.this);
|
||||||
|
|
||||||
fvtsBuilder.setTitle(R.string.fileviewerSourceCodeThemeSelectorDialogTitle);
|
fvtsBuilder.setTitle(R.string.fileviewerSourceCodeThemeSelectorDialogTitle);
|
||||||
if(fileViewerSourceCodeThemesSelectedChoice != -1) {
|
fvtsBuilder.setCancelable(fileViewerSourceCodeThemesSelectedChoice != -1);
|
||||||
fvtsBuilder.setCancelable(true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
fvtsBuilder.setCancelable(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
fvtsBuilder.setSingleChoiceItems(fileViewerSourceCodeThemesList, fileViewerSourceCodeThemesSelectedChoice, (dialogInterfaceTheme, i) -> {
|
fvtsBuilder.setSingleChoiceItems(fileViewerSourceCodeThemesList, fileViewerSourceCodeThemesSelectedChoice, (dialogInterfaceTheme, i) -> {
|
||||||
|
|
||||||
@ -91,25 +81,15 @@ public class SettingsFileViewerActivity extends BaseActivity {
|
|||||||
|
|
||||||
AlertDialog cfDialog = fvtsBuilder.create();
|
AlertDialog cfDialog = fvtsBuilder.create();
|
||||||
cfDialog.show();
|
cfDialog.show();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// pdf night mode switcher
|
// pdf night mode switcher
|
||||||
pdfModeSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
pdfModeSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||||
|
|
||||||
if(isChecked) {
|
tinyDb.putBoolean("enablePdfMode", isChecked);
|
||||||
tinyDb.putBoolean("enablePdfMode", true);
|
tinyDb.putString("enablePdfModeInit", "yes");
|
||||||
tinyDb.putString("enablePdfModeInit", "yes");
|
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
||||||
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
tinyDb.putBoolean("enablePdfMode", false);
|
|
||||||
tinyDb.putString("enablePdfModeInit", "yes");
|
|
||||||
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initCloseListener() {
|
private void initCloseListener() {
|
||||||
|
@ -8,6 +8,7 @@ import org.mian.gitnex.R;
|
|||||||
import org.mian.gitnex.databinding.ActivitySettingsGeneralBinding;
|
import org.mian.gitnex.databinding.ActivitySettingsGeneralBinding;
|
||||||
import org.mian.gitnex.helpers.TinyDB;
|
import org.mian.gitnex.helpers.TinyDB;
|
||||||
import org.mian.gitnex.helpers.Toasty;
|
import org.mian.gitnex.helpers.Toasty;
|
||||||
|
import org.mian.gitnex.helpers.Version;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -22,8 +23,11 @@ public class SettingsGeneralActivity extends BaseActivity {
|
|||||||
private Context appCtx;
|
private Context appCtx;
|
||||||
private View.OnClickListener onClickListener;
|
private View.OnClickListener onClickListener;
|
||||||
|
|
||||||
|
private List<String> homeScreenList;
|
||||||
|
private static int homeScreenSelectedChoice = 0;
|
||||||
|
|
||||||
private List<String> defaultScreen;
|
private List<String> defaultScreen;
|
||||||
private static int defaultScreenSelectedChoice = 0;
|
private static int defaultLinkHandlerScreenSelectedChoice = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getLayoutResourceId() {
|
protected int getLayoutResourceId() {
|
||||||
@ -46,18 +50,109 @@ public class SettingsGeneralActivity extends BaseActivity {
|
|||||||
initCloseListener();
|
initCloseListener();
|
||||||
viewBinding.close.setOnClickListener(onClickListener);
|
viewBinding.close.setOnClickListener(onClickListener);
|
||||||
|
|
||||||
|
// home screen
|
||||||
|
String[] homeDefaultScreen_ = {getResources().getString(R.string.pageTitleMyRepos), getResources().getString(R.string.pageTitleStarredRepos), getResources().getString(R.string.pageTitleOrganizations),
|
||||||
|
getResources().getString(R.string.pageTitleRepositories), getResources().getString(R.string.pageTitleProfile), getResources().getString(R.string.pageTitleExplore),
|
||||||
|
getResources().getString(R.string.titleDrafts)};
|
||||||
|
|
||||||
|
String[] homeDefaultScreenNew = {getResources().getString(R.string.pageTitleMyRepos), getResources().getString(R.string.pageTitleStarredRepos), getResources().getString(R.string.pageTitleOrganizations),
|
||||||
|
getResources().getString(R.string.pageTitleRepositories), getResources().getString(R.string.pageTitleProfile), getResources().getString(R.string.pageTitleExplore),
|
||||||
|
getResources().getString(R.string.titleDrafts), getResources().getString(R.string.pageTitleNotifications)};
|
||||||
|
|
||||||
|
if(new Version(tinyDb.getString("giteaVersion")).higherOrEqual("1.12.3")) {
|
||||||
|
|
||||||
|
homeDefaultScreen_ = homeDefaultScreenNew;
|
||||||
|
}
|
||||||
|
|
||||||
|
homeScreenList = new ArrayList<>(Arrays.asList(homeDefaultScreen_));
|
||||||
|
String[] homeScreenArray = new String[homeScreenList.size()];
|
||||||
|
homeScreenList.toArray(homeScreenArray);
|
||||||
|
|
||||||
|
if(homeScreenSelectedChoice == 0) {
|
||||||
|
|
||||||
|
homeScreenSelectedChoice = tinyDb.getInt("homeScreenId");
|
||||||
|
viewBinding.homeScreenSelected.setText(getResources().getString(R.string.pageTitleMyRepos));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(homeScreenSelectedChoice == 1) {
|
||||||
|
|
||||||
|
viewBinding.homeScreenSelected.setText(getResources().getString(R.string.pageTitleStarredRepos));
|
||||||
|
}
|
||||||
|
else if(homeScreenSelectedChoice == 2) {
|
||||||
|
|
||||||
|
viewBinding.homeScreenSelected.setText(getResources().getString(R.string.pageTitleOrganizations));
|
||||||
|
}
|
||||||
|
else if(homeScreenSelectedChoice == 3) {
|
||||||
|
|
||||||
|
viewBinding.homeScreenSelected.setText(getResources().getString(R.string.pageTitleRepositories));
|
||||||
|
}
|
||||||
|
else if(homeScreenSelectedChoice == 4) {
|
||||||
|
|
||||||
|
viewBinding.homeScreenSelected.setText(getResources().getString(R.string.pageTitleProfile));
|
||||||
|
}
|
||||||
|
else if(homeScreenSelectedChoice == 5) {
|
||||||
|
|
||||||
|
viewBinding.homeScreenSelected.setText(getResources().getString(R.string.pageTitleExplore));
|
||||||
|
}
|
||||||
|
else if(homeScreenSelectedChoice == 6) {
|
||||||
|
|
||||||
|
viewBinding.homeScreenSelected.setText(getResources().getString(R.string.titleDrafts));
|
||||||
|
}
|
||||||
|
else if(homeScreenSelectedChoice == 7) {
|
||||||
|
|
||||||
|
viewBinding.homeScreenSelected.setText(getResources().getString(R.string.pageTitleNotifications));
|
||||||
|
}
|
||||||
|
|
||||||
|
viewBinding.homeScreenFrame.setOnClickListener(setDefaultHomeScreen -> {
|
||||||
|
|
||||||
|
AlertDialog.Builder hsBuilder = new AlertDialog.Builder(SettingsGeneralActivity.this);
|
||||||
|
|
||||||
|
hsBuilder.setTitle(R.string.settingsHomeScreenSelectorDialogTitle);
|
||||||
|
hsBuilder.setCancelable(homeScreenSelectedChoice != -1);
|
||||||
|
|
||||||
|
hsBuilder.setSingleChoiceItems(homeScreenArray, homeScreenSelectedChoice, (dialogInterfaceHomeScreen, i) -> {
|
||||||
|
|
||||||
|
homeScreenSelectedChoice = i;
|
||||||
|
viewBinding.homeScreenSelected.setText(homeScreenArray[i]);
|
||||||
|
tinyDb.putInt("homeScreenId", i);
|
||||||
|
|
||||||
|
dialogInterfaceHomeScreen.dismiss();
|
||||||
|
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
||||||
|
});
|
||||||
|
|
||||||
|
AlertDialog hsDialog = hsBuilder.create();
|
||||||
|
hsDialog.show();
|
||||||
|
});
|
||||||
|
// home screen
|
||||||
|
|
||||||
|
// link handler
|
||||||
String[] defaultScreen_ = {getResources().getString(R.string.generalDeepLinkSelectedText), getResources().getString(R.string.navRepos), getResources().getString(R.string.navOrgs), getResources().getString(R.string.pageTitleNotifications), getResources().getString(R.string.navExplore)};
|
String[] defaultScreen_ = {getResources().getString(R.string.generalDeepLinkSelectedText), getResources().getString(R.string.navRepos), getResources().getString(R.string.navOrgs), getResources().getString(R.string.pageTitleNotifications), getResources().getString(R.string.navExplore)};
|
||||||
defaultScreen = new ArrayList<>(Arrays.asList(defaultScreen_));
|
defaultScreen = new ArrayList<>(Arrays.asList(defaultScreen_));
|
||||||
|
|
||||||
String[] linksArray = new String[defaultScreen.size()];
|
String[] linksArray = new String[defaultScreen.size()];
|
||||||
defaultScreen.toArray(linksArray);
|
defaultScreen.toArray(linksArray);
|
||||||
|
|
||||||
if(!tinyDb.getString("defaultScreenStr").isEmpty()) {
|
if(defaultLinkHandlerScreenSelectedChoice == 0) {
|
||||||
viewBinding.generalDeepLinkSelected.setText(tinyDb.getString("defaultScreenStr"));
|
|
||||||
|
defaultLinkHandlerScreenSelectedChoice = tinyDb.getInt("defaultScreenId");
|
||||||
|
viewBinding.generalDeepLinkSelected.setText(getResources().getString(R.string.generalDeepLinkSelectedText));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(defaultScreenSelectedChoice == 0) {
|
if(defaultLinkHandlerScreenSelectedChoice == 1) {
|
||||||
defaultScreenSelectedChoice = tinyDb.getInt("defaultScreenId");
|
|
||||||
|
viewBinding.generalDeepLinkSelected.setText(getResources().getString(R.string.navRepos));
|
||||||
|
}
|
||||||
|
else if(defaultLinkHandlerScreenSelectedChoice == 2) {
|
||||||
|
|
||||||
|
viewBinding.generalDeepLinkSelected.setText(getResources().getString(R.string.navOrgs));
|
||||||
|
}
|
||||||
|
else if(defaultLinkHandlerScreenSelectedChoice == 3) {
|
||||||
|
|
||||||
|
viewBinding.generalDeepLinkSelected.setText(getResources().getString(R.string.pageTitleNotifications));
|
||||||
|
}
|
||||||
|
else if(defaultLinkHandlerScreenSelectedChoice == 4) {
|
||||||
|
|
||||||
|
viewBinding.generalDeepLinkSelected.setText(getResources().getString(R.string.navExplore));
|
||||||
}
|
}
|
||||||
|
|
||||||
viewBinding.setDefaultLinkHandler.setOnClickListener(setDefaultLinkHandler -> {
|
viewBinding.setDefaultLinkHandler.setOnClickListener(setDefaultLinkHandler -> {
|
||||||
@ -65,18 +160,12 @@ public class SettingsGeneralActivity extends BaseActivity {
|
|||||||
AlertDialog.Builder dlBuilder = new AlertDialog.Builder(SettingsGeneralActivity.this);
|
AlertDialog.Builder dlBuilder = new AlertDialog.Builder(SettingsGeneralActivity.this);
|
||||||
dlBuilder.setTitle(R.string.linkSelectorDialogTitle);
|
dlBuilder.setTitle(R.string.linkSelectorDialogTitle);
|
||||||
|
|
||||||
if(defaultScreenSelectedChoice != -1) {
|
dlBuilder.setCancelable(defaultLinkHandlerScreenSelectedChoice != -1);
|
||||||
dlBuilder.setCancelable(true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
dlBuilder.setCancelable(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
dlBuilder.setSingleChoiceItems(linksArray, defaultScreenSelectedChoice, (dialogInterfaceHomeScreen, i) -> {
|
dlBuilder.setSingleChoiceItems(linksArray, defaultLinkHandlerScreenSelectedChoice, (dialogInterfaceHomeScreen, i) -> {
|
||||||
|
|
||||||
defaultScreenSelectedChoice = i;
|
defaultLinkHandlerScreenSelectedChoice = i;
|
||||||
viewBinding.generalDeepLinkSelected.setText(linksArray[i]);
|
viewBinding.generalDeepLinkSelected.setText(linksArray[i]);
|
||||||
tinyDb.putString("defaultScreenStr", linksArray[i]);
|
|
||||||
tinyDb.putInt("defaultScreenId", i);
|
tinyDb.putInt("defaultScreenId", i);
|
||||||
|
|
||||||
dialogInterfaceHomeScreen.dismiss();
|
dialogInterfaceHomeScreen.dismiss();
|
||||||
@ -85,9 +174,8 @@ public class SettingsGeneralActivity extends BaseActivity {
|
|||||||
|
|
||||||
AlertDialog dlDialog = dlBuilder.create();
|
AlertDialog dlDialog = dlBuilder.create();
|
||||||
dlDialog.show();
|
dlDialog.show();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
// link handler
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initCloseListener() { onClickListener = view -> finish(); }
|
private void initCloseListener() { onClickListener = view -> finish(); }
|
||||||
|
@ -4,7 +4,7 @@ import android.content.Context;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.Switch;
|
import com.google.android.material.switchmaterial.SwitchMaterial;
|
||||||
import org.mian.gitnex.R;
|
import org.mian.gitnex.R;
|
||||||
import org.mian.gitnex.helpers.TinyDB;
|
import org.mian.gitnex.helpers.TinyDB;
|
||||||
import org.mian.gitnex.helpers.Toasty;
|
import org.mian.gitnex.helpers.Toasty;
|
||||||
@ -37,29 +37,16 @@ public class SettingsReportsActivity extends BaseActivity {
|
|||||||
initCloseListener();
|
initCloseListener();
|
||||||
closeActivity.setOnClickListener(onClickListener);
|
closeActivity.setOnClickListener(onClickListener);
|
||||||
|
|
||||||
Switch crashReportsSwitch = findViewById(R.id.crashReportsSwitch);
|
SwitchMaterial crashReportsSwitch = findViewById(R.id.crashReportsSwitch);
|
||||||
|
|
||||||
if(tinyDb.getBoolean("crashReportingEnabled")) {
|
crashReportsSwitch.setChecked(tinyDb.getBoolean("crashReportingEnabled"));
|
||||||
crashReportsSwitch.setChecked(true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
crashReportsSwitch.setChecked(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// crash reports switcher
|
// crash reports switcher
|
||||||
crashReportsSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
crashReportsSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||||
|
|
||||||
if(isChecked) {
|
tinyDb.putBoolean("crashReportingEnabled", isChecked);
|
||||||
tinyDb.putBoolean("crashReportingEnabled", true);
|
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
||||||
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
tinyDb.putBoolean("crashReportingEnabled", false);
|
|
||||||
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initCloseListener() {
|
private void initCloseListener() {
|
||||||
|
@ -73,22 +73,27 @@ public class SettingsSecurityActivity extends BaseActivity {
|
|||||||
LinearLayout clearCacheFrame = findViewById(R.id.clearCacheSelectionFrame);
|
LinearLayout clearCacheFrame = findViewById(R.id.clearCacheSelectionFrame);
|
||||||
|
|
||||||
if(!tinyDb.getString("cacheSizeStr").isEmpty()) {
|
if(!tinyDb.getString("cacheSizeStr").isEmpty()) {
|
||||||
|
|
||||||
cacheSizeDataSelected.setText(tinyDb.getString("cacheSizeStr"));
|
cacheSizeDataSelected.setText(tinyDb.getString("cacheSizeStr"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!tinyDb.getString("cacheSizeImagesStr").isEmpty()) {
|
if(!tinyDb.getString("cacheSizeImagesStr").isEmpty()) {
|
||||||
|
|
||||||
cacheSizeImagesSelected.setText(tinyDb.getString("cacheSizeImagesStr"));
|
cacheSizeImagesSelected.setText(tinyDb.getString("cacheSizeImagesStr"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cacheSizeDataSelectedChoice == 0) {
|
if(cacheSizeDataSelectedChoice == 0) {
|
||||||
|
|
||||||
cacheSizeDataSelectedChoice = tinyDb.getInt("cacheSizeId");
|
cacheSizeDataSelectedChoice = tinyDb.getInt("cacheSizeId");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cacheSizeImagesSelectedChoice == 0) {
|
if(cacheSizeImagesSelectedChoice == 0) {
|
||||||
|
|
||||||
cacheSizeImagesSelectedChoice = tinyDb.getInt("cacheSizeImagesId");
|
cacheSizeImagesSelectedChoice = tinyDb.getInt("cacheSizeImagesId");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(new Version(currentVersion).less("1.12.3")) {
|
if(new Version(currentVersion).less("1.12.3")) {
|
||||||
|
|
||||||
pollingDelayFrame.setVisibility(View.GONE);
|
pollingDelayFrame.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,14 +118,11 @@ public class SettingsSecurityActivity extends BaseActivity {
|
|||||||
FileUtils.mkdir(cacheDir.getAbsolutePath());
|
FileUtils.mkdir(cacheDir.getAbsolutePath());
|
||||||
this.recreate();
|
this.recreate();
|
||||||
this.overridePendingTransition(0, 0);
|
this.overridePendingTransition(0, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
|
|
||||||
Log.e("SettingsSecurity", e.toString());
|
Log.e("SettingsSecurity", e.toString());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
builder.setNeutralButton(R.string.cancelButton, (dialog, which) -> dialog.dismiss());
|
builder.setNeutralButton(R.string.cancelButton, (dialog, which) -> dialog.dismiss());
|
||||||
@ -134,12 +136,7 @@ public class SettingsSecurityActivity extends BaseActivity {
|
|||||||
AlertDialog.Builder tsBuilder = new AlertDialog.Builder(SettingsSecurityActivity.this);
|
AlertDialog.Builder tsBuilder = new AlertDialog.Builder(SettingsSecurityActivity.this);
|
||||||
|
|
||||||
tsBuilder.setTitle(getResources().getString(R.string.cacheSizeImagesDialogHeader));
|
tsBuilder.setTitle(getResources().getString(R.string.cacheSizeImagesDialogHeader));
|
||||||
if(cacheSizeImagesSelectedChoice != -1) {
|
tsBuilder.setCancelable(cacheSizeImagesSelectedChoice != -1);
|
||||||
tsBuilder.setCancelable(true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
tsBuilder.setCancelable(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
tsBuilder.setSingleChoiceItems(cacheSizeImagesList, cacheSizeImagesSelectedChoice, (dialogInterfaceTheme, i) -> {
|
tsBuilder.setSingleChoiceItems(cacheSizeImagesList, cacheSizeImagesSelectedChoice, (dialogInterfaceTheme, i) -> {
|
||||||
|
|
||||||
@ -150,12 +147,10 @@ public class SettingsSecurityActivity extends BaseActivity {
|
|||||||
|
|
||||||
dialogInterfaceTheme.dismiss();
|
dialogInterfaceTheme.dismiss();
|
||||||
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
AlertDialog cfDialog = tsBuilder.create();
|
AlertDialog cfDialog = tsBuilder.create();
|
||||||
cfDialog.show();
|
cfDialog.show();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// cache size data selection dialog
|
// cache size data selection dialog
|
||||||
@ -164,12 +159,7 @@ public class SettingsSecurityActivity extends BaseActivity {
|
|||||||
AlertDialog.Builder tsBuilder = new AlertDialog.Builder(SettingsSecurityActivity.this);
|
AlertDialog.Builder tsBuilder = new AlertDialog.Builder(SettingsSecurityActivity.this);
|
||||||
|
|
||||||
tsBuilder.setTitle(getResources().getString(R.string.cacheSizeDataDialogHeader));
|
tsBuilder.setTitle(getResources().getString(R.string.cacheSizeDataDialogHeader));
|
||||||
if(cacheSizeDataSelectedChoice != -1) {
|
tsBuilder.setCancelable(cacheSizeDataSelectedChoice != -1);
|
||||||
tsBuilder.setCancelable(true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
tsBuilder.setCancelable(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
tsBuilder.setSingleChoiceItems(cacheSizeDataList, cacheSizeDataSelectedChoice, (dialogInterfaceTheme, i) -> {
|
tsBuilder.setSingleChoiceItems(cacheSizeDataList, cacheSizeDataSelectedChoice, (dialogInterfaceTheme, i) -> {
|
||||||
|
|
||||||
@ -180,12 +170,10 @@ public class SettingsSecurityActivity extends BaseActivity {
|
|||||||
|
|
||||||
dialogInterfaceTheme.dismiss();
|
dialogInterfaceTheme.dismiss();
|
||||||
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
AlertDialog cfDialog = tsBuilder.create();
|
AlertDialog cfDialog = tsBuilder.create();
|
||||||
cfDialog.show();
|
cfDialog.show();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// certs deletion
|
// certs deletion
|
||||||
@ -206,12 +194,10 @@ public class SettingsSecurityActivity extends BaseActivity {
|
|||||||
Intent loginActivityIntent = new Intent().setClass(appCtx, LoginActivity.class);
|
Intent loginActivityIntent = new Intent().setClass(appCtx, LoginActivity.class);
|
||||||
loginActivityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
loginActivityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
appCtx.startActivity(loginActivityIntent);
|
appCtx.startActivity(loginActivityIntent);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
builder.setNeutralButton(R.string.cancelButton, (dialog, which) -> dialog.dismiss());
|
builder.setNeutralButton(R.string.cancelButton, (dialog, which) -> dialog.dismiss());
|
||||||
builder.create().show();
|
builder.create().show();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// polling delay
|
// polling delay
|
||||||
@ -237,15 +223,12 @@ public class SettingsSecurityActivity extends BaseActivity {
|
|||||||
|
|
||||||
pollingDelaySelected.setText(String.format(getString(R.string.pollingDelaySelectedText), numberPicker.getValue()));
|
pollingDelaySelected.setText(String.format(getString(R.string.pollingDelaySelectedText), numberPicker.getValue()));
|
||||||
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
builder.setNeutralButton(R.string.cancelButton, null);
|
builder.setNeutralButton(R.string.cancelButton, null);
|
||||||
builder.setView(numberPicker);
|
builder.setView(numberPicker);
|
||||||
builder.create().show();
|
builder.create().show();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initCloseListener() {
|
private void initCloseListener() {
|
||||||
|
@ -61,10 +61,12 @@ public class SettingsTranslationActivity extends BaseActivity {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if(!tinyDb.getString("localeStr").isEmpty()) {
|
if(!tinyDb.getString("localeStr").isEmpty()) {
|
||||||
|
|
||||||
tvLanguageSelected.setText(tinyDb.getString("localeStr"));
|
tvLanguageSelected.setText(tinyDb.getString("localeStr"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(langSelectedChoice == 0) {
|
if(langSelectedChoice == 0) {
|
||||||
|
|
||||||
langSelectedChoice = tinyDb.getInt("langId");
|
langSelectedChoice = tinyDb.getInt("langId");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,12 +76,7 @@ public class SettingsTranslationActivity extends BaseActivity {
|
|||||||
AlertDialog.Builder lBuilder = new AlertDialog.Builder(SettingsTranslationActivity.this);
|
AlertDialog.Builder lBuilder = new AlertDialog.Builder(SettingsTranslationActivity.this);
|
||||||
|
|
||||||
lBuilder.setTitle(R.string.settingsLanguageSelectorDialogTitle);
|
lBuilder.setTitle(R.string.settingsLanguageSelectorDialogTitle);
|
||||||
if(langSelectedChoice != -1) {
|
lBuilder.setCancelable(langSelectedChoice != -1);
|
||||||
lBuilder.setCancelable(true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
lBuilder.setCancelable(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
lBuilder.setSingleChoiceItems(langList, langSelectedChoice, (dialogInterface, i) -> {
|
lBuilder.setSingleChoiceItems(langList, langSelectedChoice, (dialogInterface, i) -> {
|
||||||
|
|
||||||
@ -90,54 +87,71 @@ public class SettingsTranslationActivity extends BaseActivity {
|
|||||||
|
|
||||||
switch(langList[i]) {
|
switch(langList[i]) {
|
||||||
case "Arabic":
|
case "Arabic":
|
||||||
|
|
||||||
tinyDb.putString("locale", "ar");
|
tinyDb.putString("locale", "ar");
|
||||||
break;
|
break;
|
||||||
case "Chinese":
|
case "Chinese":
|
||||||
|
|
||||||
tinyDb.putString("locale", "zh");
|
tinyDb.putString("locale", "zh");
|
||||||
break;
|
break;
|
||||||
case "Czech":
|
case "Czech":
|
||||||
|
|
||||||
tinyDb.putString("locale", "cs");
|
tinyDb.putString("locale", "cs");
|
||||||
break;
|
break;
|
||||||
case "Finnish":
|
case "Finnish":
|
||||||
|
|
||||||
tinyDb.putString("locale", "fi");
|
tinyDb.putString("locale", "fi");
|
||||||
break;
|
break;
|
||||||
case "French":
|
case "French":
|
||||||
|
|
||||||
tinyDb.putString("locale", "fr");
|
tinyDb.putString("locale", "fr");
|
||||||
break;
|
break;
|
||||||
case "German":
|
case "German":
|
||||||
|
|
||||||
tinyDb.putString("locale", "de");
|
tinyDb.putString("locale", "de");
|
||||||
break;
|
break;
|
||||||
case "Italian":
|
case "Italian":
|
||||||
|
|
||||||
tinyDb.putString("locale", "it");
|
tinyDb.putString("locale", "it");
|
||||||
break;
|
break;
|
||||||
case "Latvian":
|
case "Latvian":
|
||||||
|
|
||||||
tinyDb.putString("locale", "lv");
|
tinyDb.putString("locale", "lv");
|
||||||
break;
|
break;
|
||||||
case "Persian":
|
case "Persian":
|
||||||
|
|
||||||
tinyDb.putString("locale", "fa");
|
tinyDb.putString("locale", "fa");
|
||||||
break;
|
break;
|
||||||
case "Polish":
|
case "Polish":
|
||||||
|
|
||||||
tinyDb.putString("locale", "pl");
|
tinyDb.putString("locale", "pl");
|
||||||
break;
|
break;
|
||||||
case "Portuguese/Brazilian":
|
case "Portuguese/Brazilian":
|
||||||
|
|
||||||
tinyDb.putString("locale", "pt");
|
tinyDb.putString("locale", "pt");
|
||||||
break;
|
break;
|
||||||
case "Russian":
|
case "Russian":
|
||||||
|
|
||||||
tinyDb.putString("locale", "ru");
|
tinyDb.putString("locale", "ru");
|
||||||
break;
|
break;
|
||||||
case "Serbian":
|
case "Serbian":
|
||||||
|
|
||||||
tinyDb.putString("locale", "sr");
|
tinyDb.putString("locale", "sr");
|
||||||
break;
|
break;
|
||||||
case "Spanish":
|
case "Spanish":
|
||||||
|
|
||||||
tinyDb.putString("locale", "es");
|
tinyDb.putString("locale", "es");
|
||||||
break;
|
break;
|
||||||
case "Turkish":
|
case "Turkish":
|
||||||
|
|
||||||
tinyDb.putString("locale", "tr");
|
tinyDb.putString("locale", "tr");
|
||||||
break;
|
break;
|
||||||
case "Ukrainian":
|
case "Ukrainian":
|
||||||
|
|
||||||
tinyDb.putString("locale", "uk");
|
tinyDb.putString("locale", "uk");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
||||||
tinyDb.putString("locale", "en");
|
tinyDb.putString("locale", "en");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -147,16 +161,13 @@ public class SettingsTranslationActivity extends BaseActivity {
|
|||||||
this.overridePendingTransition(0, 0);
|
this.overridePendingTransition(0, 0);
|
||||||
dialogInterface.dismiss();
|
dialogInterface.dismiss();
|
||||||
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
lBuilder.setNeutralButton(getString(R.string.cancelButton), null);
|
lBuilder.setNeutralButton(getString(R.string.cancelButton), null);
|
||||||
|
|
||||||
AlertDialog lDialog = lBuilder.create();
|
AlertDialog lDialog = lBuilder.create();
|
||||||
lDialog.show();
|
lDialog.show();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initCloseListener() {
|
private void initCloseListener() {
|
||||||
|
@ -50,12 +50,13 @@ public class AssigneesListAdapter extends RecyclerView.Adapter<AssigneesListAdap
|
|||||||
private ImageView assigneesAvatar;
|
private ImageView assigneesAvatar;
|
||||||
|
|
||||||
private AssigneesViewHolder(View itemView) {
|
private AssigneesViewHolder(View itemView) {
|
||||||
|
|
||||||
super(itemView);
|
super(itemView);
|
||||||
|
this.setIsRecyclable(false);
|
||||||
|
|
||||||
assigneesSelection = itemView.findViewById(R.id.assigneesSelection);
|
assigneesSelection = itemView.findViewById(R.id.assigneesSelection);
|
||||||
assigneesName = itemView.findViewById(R.id.assigneesName);
|
assigneesName = itemView.findViewById(R.id.assigneesName);
|
||||||
assigneesAvatar = itemView.findViewById(R.id.assigneesAvatar);
|
assigneesAvatar = itemView.findViewById(R.id.assigneesAvatar);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,9 +74,11 @@ public class AssigneesListAdapter extends RecyclerView.Adapter<AssigneesListAdap
|
|||||||
Collaborators currentItem = assigneesList.get(position);
|
Collaborators currentItem = assigneesList.get(position);
|
||||||
|
|
||||||
if(currentItem.getFull_name().equals("")) {
|
if(currentItem.getFull_name().equals("")) {
|
||||||
|
|
||||||
holder.assigneesName.setText(currentItem.getLogin());
|
holder.assigneesName.setText(currentItem.getLogin());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
holder.assigneesName.setText(currentItem.getFull_name());
|
holder.assigneesName.setText(currentItem.getFull_name());
|
||||||
}
|
}
|
||||||
PicassoService
|
PicassoService
|
||||||
@ -90,6 +93,7 @@ public class AssigneesListAdapter extends RecyclerView.Adapter<AssigneesListAdap
|
|||||||
}
|
}
|
||||||
|
|
||||||
currentAssignees = new ArrayList<>(new LinkedHashSet<>(currentAssignees));
|
currentAssignees = new ArrayList<>(new LinkedHashSet<>(currentAssignees));
|
||||||
|
|
||||||
for(int i = 0; i < currentAssignees.size(); i++) {
|
for(int i = 0; i < currentAssignees.size(); i++) {
|
||||||
|
|
||||||
if(currentAssignees.contains(currentItem.getLogin())) {
|
if(currentAssignees.contains(currentItem.getLogin())) {
|
||||||
@ -98,6 +102,7 @@ public class AssigneesListAdapter extends RecyclerView.Adapter<AssigneesListAdap
|
|||||||
assigneesStrings.add(currentAssignees.get(i));
|
assigneesStrings.add(currentAssignees.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assigneesListener.assigneesInterface(assigneesStrings);
|
assigneesListener.assigneesInterface(assigneesStrings);
|
||||||
|
|
||||||
holder.assigneesSelection.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
holder.assigneesSelection.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||||
@ -119,6 +124,7 @@ public class AssigneesListAdapter extends RecyclerView.Adapter<AssigneesListAdap
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
|
|
||||||
return assigneesList.size();
|
return assigneesList.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ import android.view.ViewGroup;
|
|||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||||
@ -351,7 +352,7 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<IssueCommentsAdap
|
|||||||
|
|
||||||
final int resourceId = mCtx.getResources().getIdentifier(raw.substring("drawable://".length()), "drawable", mCtx.getPackageName());
|
final int resourceId = mCtx.getResources().getIdentifier(raw.substring("drawable://".length()), "drawable", mCtx.getPackageName());
|
||||||
|
|
||||||
final Drawable drawable = mCtx.getDrawable(resourceId);
|
final Drawable drawable = ContextCompat.getDrawable(mCtx, resourceId);
|
||||||
|
|
||||||
assert drawable != null;
|
assert drawable != null;
|
||||||
return ImageItem.withResult(drawable);
|
return ImageItem.withResult(drawable);
|
||||||
|
@ -48,12 +48,13 @@ public class LabelsListAdapter extends RecyclerView.Adapter<LabelsListAdapter.La
|
|||||||
private ImageView labelColor;
|
private ImageView labelColor;
|
||||||
|
|
||||||
private LabelsViewHolder(View itemView) {
|
private LabelsViewHolder(View itemView) {
|
||||||
|
|
||||||
super(itemView);
|
super(itemView);
|
||||||
|
this.setIsRecyclable(false);
|
||||||
|
|
||||||
labelSelection = itemView.findViewById(R.id.labelSelection);
|
labelSelection = itemView.findViewById(R.id.labelSelection);
|
||||||
labelText = itemView.findViewById(R.id.labelText);
|
labelText = itemView.findViewById(R.id.labelText);
|
||||||
labelColor = itemView.findViewById(R.id.labelColor);
|
labelColor = itemView.findViewById(R.id.labelColor);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,6 +86,7 @@ public class LabelsListAdapter extends RecyclerView.Adapter<LabelsListAdapter.La
|
|||||||
}
|
}
|
||||||
|
|
||||||
currentLabelsIds = new ArrayList<>(new LinkedHashSet<>(currentLabelsIds));
|
currentLabelsIds = new ArrayList<>(new LinkedHashSet<>(currentLabelsIds));
|
||||||
|
|
||||||
for(int i = 0; i < currentLabelsIds.size(); i++) {
|
for(int i = 0; i < currentLabelsIds.size(); i++) {
|
||||||
|
|
||||||
if(currentLabelsIds.contains(currentItem.getId())) {
|
if(currentLabelsIds.contains(currentItem.getId())) {
|
||||||
@ -93,6 +95,7 @@ public class LabelsListAdapter extends RecyclerView.Adapter<LabelsListAdapter.La
|
|||||||
labelsIds.add(currentLabelsIds.get(i));
|
labelsIds.add(currentLabelsIds.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
labelsListener.labelsIdsInterface(labelsIds);
|
labelsListener.labelsIdsInterface(labelsIds);
|
||||||
|
|
||||||
holder.labelSelection.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
holder.labelSelection.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||||
@ -117,6 +120,7 @@ public class LabelsListAdapter extends RecyclerView.Adapter<LabelsListAdapter.La
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
|
|
||||||
return labels.size();
|
return labels.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
package org.mian.gitnex.fragments;
|
package org.mian.gitnex.fragments;
|
||||||
|
|
||||||
import android.animation.ValueAnimator;
|
import android.animation.ValueAnimator;
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
@ -14,6 +16,7 @@ import android.widget.ImageButton;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||||
import org.mian.gitnex.R;
|
import org.mian.gitnex.R;
|
||||||
import org.mian.gitnex.actions.ActionResult;
|
import org.mian.gitnex.actions.ActionResult;
|
||||||
@ -54,6 +57,7 @@ public class BottomSheetReplyFragment extends BottomSheetDialogFragment {
|
|||||||
super.onAttach(context);
|
super.onAttach(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
@ -104,6 +108,25 @@ public class BottomSheetReplyFragment extends BottomSheetDialogFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
commentContent.requestFocus();
|
commentContent.requestFocus();
|
||||||
|
commentContent.setOnTouchListener((v, event) -> {
|
||||||
|
|
||||||
|
BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from((View) view.getParent());
|
||||||
|
|
||||||
|
switch(event.getAction()) {
|
||||||
|
|
||||||
|
case MotionEvent.ACTION_DOWN:
|
||||||
|
case MotionEvent.ACTION_SCROLL:
|
||||||
|
bottomSheetBehavior.setDraggable(false);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
bottomSheetBehavior.setDraggable(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
commentContent.addTextChangedListener(new TextWatcher() {
|
commentContent.addTextChangedListener(new TextWatcher() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -17,6 +17,7 @@ import android.view.inputmethod.EditorInfo;
|
|||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import org.mian.gitnex.R;
|
import org.mian.gitnex.R;
|
||||||
import org.mian.gitnex.adapters.ExploreRepositoriesAdapter;
|
import org.mian.gitnex.adapters.ExploreRepositoriesAdapter;
|
||||||
@ -96,6 +97,10 @@ public class ExploreRepositoriesFragment extends Fragment {
|
|||||||
viewBinding.recyclerViewReposSearch.setLayoutManager(linearLayoutManager);
|
viewBinding.recyclerViewReposSearch.setLayoutManager(linearLayoutManager);
|
||||||
viewBinding.recyclerViewReposSearch.setAdapter(adapter);
|
viewBinding.recyclerViewReposSearch.setAdapter(adapter);
|
||||||
|
|
||||||
|
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(viewBinding.recyclerViewReposSearch.getContext(),
|
||||||
|
DividerItemDecoration.VERTICAL);
|
||||||
|
viewBinding.recyclerViewReposSearch.addItemDecoration(dividerItemDecoration);
|
||||||
|
|
||||||
viewBinding.searchKeyword.setOnEditorActionListener((v1, actionId, event) -> {
|
viewBinding.searchKeyword.setOnEditorActionListener((v1, actionId, event) -> {
|
||||||
|
|
||||||
if(actionId == EditorInfo.IME_ACTION_SEND) {
|
if(actionId == EditorInfo.IME_ACTION_SEND) {
|
||||||
|
@ -103,6 +103,7 @@
|
|||||||
android:textColorHighlight="?attr/hintColor"
|
android:textColorHighlight="?attr/hintColor"
|
||||||
android:textColorHint="?attr/hintColor"
|
android:textColorHint="?attr/hintColor"
|
||||||
android:gravity="top|start"
|
android:gravity="top|start"
|
||||||
|
android:scrollbars="vertical"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
@ -103,6 +103,7 @@
|
|||||||
android:textColorHighlight="?attr/hintColor"
|
android:textColorHighlight="?attr/hintColor"
|
||||||
android:textColorHint="?attr/hintColor"
|
android:textColorHint="?attr/hintColor"
|
||||||
android:gravity="top|start"
|
android:gravity="top|start"
|
||||||
|
android:scrollbars="vertical"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
@ -125,6 +125,7 @@
|
|||||||
android:textColorHighlight="?attr/hintColor"
|
android:textColorHighlight="?attr/hintColor"
|
||||||
android:textColorHint="?attr/hintColor"
|
android:textColorHint="?attr/hintColor"
|
||||||
android:gravity="top|start"
|
android:gravity="top|start"
|
||||||
|
android:scrollbars="vertical"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
@ -100,6 +100,7 @@
|
|||||||
android:textColorHighlight="?attr/hintColor"
|
android:textColorHighlight="?attr/hintColor"
|
||||||
android:textColorHint="?attr/hintColor"
|
android:textColorHint="?attr/hintColor"
|
||||||
android:gravity="top|start"
|
android:gravity="top|start"
|
||||||
|
android:scrollbars="vertical"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
@ -103,6 +103,7 @@
|
|||||||
android:textColorHighlight="?attr/hintColor"
|
android:textColorHighlight="?attr/hintColor"
|
||||||
android:textColorHint="?attr/hintColor"
|
android:textColorHint="?attr/hintColor"
|
||||||
android:gravity="top|start"
|
android:gravity="top|start"
|
||||||
|
android:scrollbars="vertical"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
@ -103,6 +103,7 @@
|
|||||||
android:textColorHighlight="?attr/hintColor"
|
android:textColorHighlight="?attr/hintColor"
|
||||||
android:textColorHint="?attr/hintColor"
|
android:textColorHint="?attr/hintColor"
|
||||||
android:gravity="top|start"
|
android:gravity="top|start"
|
||||||
|
android:scrollbars="vertical"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
@ -103,6 +103,7 @@
|
|||||||
android:textColorHighlight="?attr/hintColor"
|
android:textColorHighlight="?attr/hintColor"
|
||||||
android:textColorHint="?attr/hintColor"
|
android:textColorHint="?attr/hintColor"
|
||||||
android:gravity="top|start"
|
android:gravity="top|start"
|
||||||
|
android:scrollbars="vertical"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
@ -150,11 +150,11 @@
|
|||||||
android:text="@string/settingsCounterBadges"
|
android:text="@string/settingsCounterBadges"
|
||||||
android:textColor="?attr/primaryTextColor"/>
|
android:textColor="?attr/primaryTextColor"/>
|
||||||
|
|
||||||
<Switch
|
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||||
android:id="@+id/switchCounterBadge"
|
android:id="@+id/switchCounterBadge"
|
||||||
android:layout_toEndOf="@+id/tvCounterBadgeHeader"
|
android:layout_toEndOf="@+id/tvCounterBadgeHeader"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="24dp"
|
||||||
android:switchMinWidth="56dp"
|
android:switchMinWidth="56dp"
|
||||||
android:paddingStart="0dp"
|
android:paddingStart="0dp"
|
||||||
android:paddingEnd="24dp"
|
android:paddingEnd="24dp"
|
||||||
@ -194,34 +194,4 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/homeScreenFrame"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="15dp"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/homeScreenHeaderSelector"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textSize="16sp"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:layout_marginStart="44dp"
|
|
||||||
android:layout_marginEnd="24dp"
|
|
||||||
android:text="@string/settingsHomeScreenHeaderText"
|
|
||||||
android:textColor="?attr/primaryTextColor"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/homeScreenSelected"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:layout_marginStart="44dp"
|
|
||||||
android:layout_marginEnd="24dp"
|
|
||||||
android:text="@string/settingsHomeScreenSelectedText"
|
|
||||||
android:textColor="?attr/selectedTextColor"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -61,11 +61,11 @@
|
|||||||
android:text="@string/settingsEnableCommentsDeletionText"
|
android:text="@string/settingsEnableCommentsDeletionText"
|
||||||
android:textColor="?attr/primaryTextColor" />
|
android:textColor="?attr/primaryTextColor" />
|
||||||
|
|
||||||
<Switch
|
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||||
android:id="@+id/commentsDeletionSwitch"
|
android:id="@+id/commentsDeletionSwitch"
|
||||||
android:layout_toEndOf="@+id/enableCommentsDeletionHeader"
|
android:layout_toEndOf="@+id/enableCommentsDeletionHeader"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="24dp"
|
||||||
android:switchMinWidth="56dp"
|
android:switchMinWidth="56dp"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:paddingStart="0dp"
|
android:paddingStart="0dp"
|
||||||
|
@ -91,11 +91,11 @@
|
|||||||
android:text="@string/settingsPdfModeHeaderText"
|
android:text="@string/settingsPdfModeHeaderText"
|
||||||
android:textColor="?attr/primaryTextColor"/>
|
android:textColor="?attr/primaryTextColor"/>
|
||||||
|
|
||||||
<Switch
|
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||||
android:id="@+id/switchPdfMode"
|
android:id="@+id/switchPdfMode"
|
||||||
android:layout_toEndOf="@+id/pdfModeHeader"
|
android:layout_toEndOf="@+id/pdfModeHeader"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="24dp"
|
||||||
android:switchMinWidth="56dp"
|
android:switchMinWidth="56dp"
|
||||||
android:paddingStart="0dp"
|
android:paddingStart="0dp"
|
||||||
android:paddingEnd="25dp"
|
android:paddingEnd="25dp"
|
||||||
|
@ -85,4 +85,34 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/homeScreenFrame"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/homeScreenHeaderSelector"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginStart="44dp"
|
||||||
|
android:layout_marginEnd="24dp"
|
||||||
|
android:text="@string/settingsHomeScreenHeaderText"
|
||||||
|
android:textColor="?attr/primaryTextColor"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/homeScreenSelected"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:layout_marginStart="44dp"
|
||||||
|
android:layout_marginEnd="24dp"
|
||||||
|
android:text="@string/settingsHomeScreenSelectedText"
|
||||||
|
android:textColor="?attr/selectedTextColor"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -60,11 +60,11 @@
|
|||||||
android:text="@string/settingsEnableReportsText"
|
android:text="@string/settingsEnableReportsText"
|
||||||
android:textColor="?attr/primaryTextColor" />
|
android:textColor="?attr/primaryTextColor" />
|
||||||
|
|
||||||
<Switch
|
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||||
android:id="@+id/crashReportsSwitch"
|
android:id="@+id/crashReportsSwitch"
|
||||||
android:layout_toEndOf="@+id/enableReportsHeader"
|
android:layout_toEndOf="@+id/enableReportsHeader"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="24dp"
|
||||||
android:switchMinWidth="56dp"
|
android:switchMinWidth="56dp"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:paddingStart="0dp"
|
android:paddingStart="0dp"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
@ -23,11 +24,11 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:text="@string/menuEditText"
|
android:text="@string/menuEditText"
|
||||||
android:drawableStart="@drawable/ic_edit"
|
|
||||||
android:drawablePadding="24dp"
|
android:drawablePadding="24dp"
|
||||||
android:textColor="?attr/primaryTextColor"
|
android:textColor="?attr/primaryTextColor"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:padding="12dp" />
|
android:padding="12dp"
|
||||||
|
app:drawableStartCompat="@drawable/ic_edit" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/commentMenuDelete"
|
android:id="@+id/commentMenuDelete"
|
||||||
@ -35,11 +36,11 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:text="@string/menuDeleteText"
|
android:text="@string/menuDeleteText"
|
||||||
android:drawableStart="@drawable/ic_delete"
|
|
||||||
android:drawablePadding="24dp"
|
android:drawablePadding="24dp"
|
||||||
android:textColor="?attr/primaryTextColor"
|
android:textColor="?attr/primaryTextColor"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:padding="12dp" />
|
android:padding="12dp"
|
||||||
|
app:drawableStartCompat="@drawable/ic_delete" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/commentMenuQuote"
|
android:id="@+id/commentMenuQuote"
|
||||||
@ -47,11 +48,11 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:text="@string/menuQuoteText"
|
android:text="@string/menuQuoteText"
|
||||||
android:drawableStart="@drawable/ic_comment"
|
|
||||||
android:drawablePadding="24dp"
|
android:drawablePadding="24dp"
|
||||||
android:textColor="?attr/primaryTextColor"
|
android:textColor="?attr/primaryTextColor"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:padding="12dp" />
|
android:padding="12dp"
|
||||||
|
app:drawableStartCompat="@drawable/ic_comment" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/commentMenuCopy"
|
android:id="@+id/commentMenuCopy"
|
||||||
@ -59,11 +60,11 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:text="@string/copyCommentText"
|
android:text="@string/copyCommentText"
|
||||||
android:drawableStart="@drawable/ic_copy"
|
|
||||||
android:drawablePadding="24dp"
|
android:drawablePadding="24dp"
|
||||||
android:textColor="?attr/primaryTextColor"
|
android:textColor="?attr/primaryTextColor"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:padding="12dp" />
|
android:padding="12dp"
|
||||||
|
app:drawableStartCompat="@drawable/ic_copy" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/issueCommentShare"
|
android:id="@+id/issueCommentShare"
|
||||||
@ -71,11 +72,11 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:text="@string/issueCommentShare"
|
android:text="@string/issueCommentShare"
|
||||||
android:drawableStart="@drawable/ic_share"
|
|
||||||
android:drawablePadding="24dp"
|
android:drawablePadding="24dp"
|
||||||
android:textColor="?attr/primaryTextColor"
|
android:textColor="?attr/primaryTextColor"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:padding="12dp" />
|
android:padding="12dp"
|
||||||
|
app:drawableStartCompat="@drawable/ic_share" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/issueCommentCopyUrl"
|
android:id="@+id/issueCommentCopyUrl"
|
||||||
@ -83,11 +84,11 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:text="@string/genericCopyUrl"
|
android:text="@string/genericCopyUrl"
|
||||||
android:drawableStart="@drawable/ic_link"
|
|
||||||
android:drawablePadding="24dp"
|
android:drawablePadding="24dp"
|
||||||
android:textColor="?attr/primaryTextColor"
|
android:textColor="?attr/primaryTextColor"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:padding="12dp" />
|
android:padding="12dp"
|
||||||
|
app:drawableStartCompat="@drawable/ic_link" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -73,47 +73,39 @@
|
|||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
<ScrollView
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/primaryBackgroundColor"
|
android:padding="15dp"
|
||||||
android:isScrollContainer="true"
|
android:orientation="vertical">
|
||||||
android:padding="15dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
<EditText
|
||||||
|
android:id="@+id/comment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:background="@drawable/shape_inputs"
|
||||||
|
android:inputType="textMultiLine|textImeMultiLine"
|
||||||
|
android:maxLines="5"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:scrollbars="vertical"
|
||||||
|
android:textColor="?attr/inputTextColor"
|
||||||
|
android:textColorHighlight="?attr/primaryTextColor"
|
||||||
|
android:textColorHint="?attr/primaryBackgroundColor"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:labelFor="@+id/comment"
|
||||||
|
android:autofillHints="@string/commentButtonText" />
|
||||||
|
|
||||||
<EditText
|
<TextView
|
||||||
android:id="@+id/comment"
|
android:id="@+id/drafts_hint"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/shape_inputs"
|
android:layout_marginTop="5dp"
|
||||||
android:inputType="textMultiLine|textImeMultiLine"
|
android:text="@string/draftSaved"
|
||||||
android:maxLines="5"
|
android:textColor="?attr/hintColor"
|
||||||
android:padding="10dp"
|
android:textSize="12sp"
|
||||||
android:scrollbars="vertical"
|
android:visibility="gone"
|
||||||
android:textColor="?attr/inputTextColor"
|
tools:visibility="visible" />
|
||||||
android:textColorHighlight="?attr/primaryTextColor"
|
|
||||||
android:textColorHint="?attr/primaryBackgroundColor"
|
|
||||||
android:textSize="16sp"
|
|
||||||
android:labelFor="@+id/comment"
|
|
||||||
android:autofillHints="@string/commentButtonText" />
|
|
||||||
|
|
||||||
<TextView
|
</LinearLayout>
|
||||||
android:id="@+id/drafts_hint"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:text="@string/draftSaved"
|
|
||||||
android:textColor="?attr/hintColor"
|
|
||||||
android:textSize="12sp"
|
|
||||||
android:visibility="gone"
|
|
||||||
tools:visibility="visible" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</ScrollView>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -22,38 +22,25 @@
|
|||||||
android:textColor="?attr/primaryTextColor"
|
android:textColor="?attr/primaryTextColor"
|
||||||
android:textSize="18sp" />
|
android:textSize="18sp" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/commitCommitterVw"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:textColor="?attr/primaryTextColor"
|
|
||||||
android:textSize="14sp" />
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/frameViewnDate"
|
android:id="@+id/frameCommitterAndDate"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/frameViewInBrowser"
|
android:id="@+id/frameCommitter"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_weight=".25"
|
android:layout_weight=".25"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<Button
|
<TextView
|
||||||
android:id="@+id/commitHtmlUrlVw"
|
android:id="@+id/commitCommitterVw"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="60dp"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/viewInBrowser"
|
android:textColor="?attr/primaryTextColor"
|
||||||
android:layout_marginTop="15dp"
|
android:textSize="14sp" />
|
||||||
android:textColor="@color/btnTextColor"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:minHeight="0dp"
|
|
||||||
android:minWidth="0dp"
|
|
||||||
android:padding="8dp" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@ -64,8 +51,24 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="end"
|
android:gravity="end"
|
||||||
android:textColor="?attr/primaryTextColor"
|
android:textColor="?attr/primaryTextColor"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp" />
|
||||||
android:layout_marginTop="20dp"/>
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/frameViewCommits"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/commitHtmlUrlVw"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="60dp"
|
||||||
|
android:text="@string/viewInBrowser"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:textColor="@color/btnTextColor"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/relativeLayoutFrameIssuesList"
|
android:id="@+id/relativeLayoutFrameIssuesList"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@ -80,7 +80,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="start"
|
android:gravity="start"
|
||||||
android:drawablePadding="5dp"
|
android:drawablePadding="5dp"
|
||||||
android:drawableStart="@drawable/ic_comment"
|
app:drawableStartCompat="@drawable/ic_comment"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
android:textColor="?attr/primaryTextColor"
|
android:textColor="?attr/primaryTextColor"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
@ -143,7 +143,7 @@
|
|||||||
android:layout_height="24dp"
|
android:layout_height="24dp"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_weight=".25"
|
android:layout_weight=".25"
|
||||||
android:drawableStart="@drawable/ic_issue"
|
app:drawableStartCompat="@drawable/ic_issue"
|
||||||
android:drawablePadding="6dp"
|
android:drawablePadding="6dp"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:text="@string/repoWatchers"
|
android:text="@string/repoWatchers"
|
||||||
@ -156,7 +156,7 @@
|
|||||||
android:layout_height="24dp"
|
android:layout_height="24dp"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_weight=".25"
|
android:layout_weight=".25"
|
||||||
android:drawableStart="@drawable/ic_star_unfilled"
|
app:drawableStartCompat="@drawable/ic_star_unfilled"
|
||||||
android:drawablePadding="6dp"
|
android:drawablePadding="6dp"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:text="@string/repoStars"
|
android:text="@string/repoStars"
|
||||||
@ -169,7 +169,7 @@
|
|||||||
android:layout_height="24dp"
|
android:layout_height="24dp"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_weight=".25"
|
android:layout_weight=".25"
|
||||||
android:drawableStart="@drawable/ic_fork"
|
app:drawableStartCompat="@drawable/ic_fork"
|
||||||
android:drawablePadding="6dp"
|
android:drawablePadding="6dp"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:text="@string/repoWatchers"
|
android:text="@string/repoWatchers"
|
||||||
|
@ -271,11 +271,11 @@
|
|||||||
<string name="settingsEnableCommentsDeletionText">Enable Drafts Deletion</string>
|
<string name="settingsEnableCommentsDeletionText">Enable Drafts Deletion</string>
|
||||||
<string name="settingsEnableCommentsDeletionHintText">Delete comment draft when comment is posted</string>
|
<string name="settingsEnableCommentsDeletionHintText">Delete comment draft when comment is posted</string>
|
||||||
<string name="settingsGeneralHeader">General</string>
|
<string name="settingsGeneralHeader">General</string>
|
||||||
<string name="generalHintText">Default actions</string>
|
<string name="generalHintText">Home screen, default link handler</string>
|
||||||
<string name="generalDeepLinkDefaultScreen">Default Link Handler</string>
|
<string name="generalDeepLinkDefaultScreen">Default Link Handler</string>
|
||||||
<string name="generalDeepLinkDefaultScreenHintText">Choose what screen should be loaded if the app cannot handle external links. It will redirect you automatically.</string>
|
<string name="generalDeepLinkDefaultScreenHintText">Choose what screen should be loaded if the app cannot handle external links. It will redirect you automatically.</string>
|
||||||
<string name="generalDeepLinkSelectedText">N/A</string>
|
<string name="generalDeepLinkSelectedText">N/A</string>
|
||||||
<string name="linkSelectorDialogTitle">Select Default Screen</string>
|
<string name="linkSelectorDialogTitle">Select Default Link Handler Screen</string>
|
||||||
<!-- settings -->
|
<!-- settings -->
|
||||||
|
|
||||||
<string name="noMoreData">No more data available</string>
|
<string name="noMoreData">No more data available</string>
|
||||||
@ -577,6 +577,7 @@
|
|||||||
<string name="mergeOptionSquash">Squash and Merge</string>
|
<string name="mergeOptionSquash">Squash and Merge</string>
|
||||||
<string name="mergeStrategy">Merge Strategy</string>
|
<string name="mergeStrategy">Merge Strategy</string>
|
||||||
<string name="selectMergeStrategy">Select merge strategy</string>
|
<string name="selectMergeStrategy">Select merge strategy</string>
|
||||||
|
<string name="mergeNotAllowed">Not allowed to merge [Reason: Does not have enough approvals]</string>
|
||||||
|
|
||||||
<string name="downloadFile">Download This File</string>
|
<string name="downloadFile">Download This File</string>
|
||||||
<string name="waitLoadingDownloadFile">Please wait for the file to load to memory</string>
|
<string name="waitLoadingDownloadFile">Please wait for the file to load to memory</string>
|
||||||
@ -726,4 +727,9 @@
|
|||||||
<string name="launchApp">Go to App</string>
|
<string name="launchApp">Go to App</string>
|
||||||
<string name="noActionText">GitNex cannot handle the requested resource, you can open an issue at the project repository as an improvement with providing details of the work. Just launch a default screen for now from the buttons below, it can be changed from settings.</string>
|
<string name="noActionText">GitNex cannot handle the requested resource, you can open an issue at the project repository as an improvement with providing details of the work. Just launch a default screen for now from the buttons below, it can be changed from settings.</string>
|
||||||
|
|
||||||
|
<string name="codeBlockGreenOnBlack">Green on Black</string>
|
||||||
|
<string name="codeBlockWhiteOnBlack">White on Black</string>
|
||||||
|
<string name="codeBlockGreyOnBlack">Grey on Black</string>
|
||||||
|
<string name="codeBlockWhiteOnGrey">White on Grey</string>
|
||||||
|
<string name="codeBlockDarkOnWhite">Dark on White</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<changelog>
|
<changelog>
|
||||||
|
|
||||||
<release version="3.3.0-rc1" versioncode="327">
|
<release version="3.3.0-rc2" versioncode="328">
|
||||||
<change>3.3.0 rc1 release brings new input design, new popups, open links from email and including other features with improvements and bug fixes.</change>
|
<change>A lot of bugs are squashed in this release including many UI improvements.</change>
|
||||||
</release>
|
</release>
|
||||||
|
|
||||||
</changelog>
|
</changelog>
|
||||||
|
5
fastlane/metadata/android/en-US/changelogs/328.txt
Normal file
5
fastlane/metadata/android/en-US/changelogs/328.txt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
3.3.0-rc2
|
||||||
|
|
||||||
|
A lot of bugs are squashed in this release including many UI improvements.
|
||||||
|
|
||||||
|
Detail release notes will be published with stable release.
|
Reference in New Issue
Block a user