Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
3eacfe91fe | |||
e38d141d38 | |||
7c40c049d4 | |||
b4b7981722 | |||
96fad2d73e | |||
24064192e4 | |||
12a7b6040b | |||
30921ea330 | |||
ea36a3f6d6 | |||
f1ecc42876 | |||
73e7acfbdf | |||
a9ad91d954 | |||
ff537b79ff | |||
7efc8650fa | |||
a171abc0b8 |
@ -6,8 +6,8 @@ android {
|
|||||||
applicationId "org.mian.gitnex"
|
applicationId "org.mian.gitnex"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode 300
|
versionCode 307
|
||||||
versionName "3.0.0"
|
versionName "3.1.0-rc1"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
buildFeatures {
|
buildFeatures {
|
||||||
@ -36,14 +36,14 @@ configurations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
def lifecycle_version = "2.3.0-alpha05"
|
def lifecycle_version = "2.3.0-alpha06"
|
||||||
def markwon_version = "4.4.0"
|
def markwon_version = "4.4.0"
|
||||||
def work_version = "2.4.0"
|
def work_version = "2.4.0"
|
||||||
def acra = "5.5.0"
|
def acra = "5.5.0"
|
||||||
|
|
||||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
implementation "androidx.appcompat:appcompat:1.3.0-alpha01"
|
implementation "androidx.appcompat:appcompat:1.3.0-alpha01"
|
||||||
implementation "com.google.android.material:material:1.3.0-alpha01"
|
implementation "com.google.android.material:material:1.3.0-alpha02"
|
||||||
implementation "androidx.constraintlayout:constraintlayout:1.1.3"
|
implementation "androidx.constraintlayout:constraintlayout:1.1.3"
|
||||||
implementation "androidx.legacy:legacy-support-v4:1.0.0"
|
implementation "androidx.legacy:legacy-support-v4:1.0.0"
|
||||||
implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version"
|
implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version"
|
||||||
@ -81,7 +81,7 @@ dependencies {
|
|||||||
implementation "com.hendraanggrian.appcompat:socialview-commons:0.2"
|
implementation "com.hendraanggrian.appcompat:socialview-commons:0.2"
|
||||||
implementation "com.github.HamidrezaAmz:BreadcrumbsView:0.2.9"
|
implementation "com.github.HamidrezaAmz:BreadcrumbsView:0.2.9"
|
||||||
implementation "commons-io:commons-io:20030203.000550"
|
implementation "commons-io:commons-io:20030203.000550"
|
||||||
implementation "org.apache.commons:commons-lang3:3.10"
|
implementation 'org.apache.commons:commons-lang3:3.11'
|
||||||
implementation "com.github.chrisbanes:PhotoView:2.3.0"
|
implementation "com.github.chrisbanes:PhotoView:2.3.0"
|
||||||
implementation "com.github.barteksc:android-pdf-viewer:3.2.0-beta.1"
|
implementation "com.github.barteksc:android-pdf-viewer:3.2.0-beta.1"
|
||||||
implementation "ch.acra:acra-mail:$acra"
|
implementation "ch.acra:acra-mail:$acra"
|
||||||
|
@ -84,6 +84,8 @@
|
|||||||
<activity android:name=".activities.SettingsReportsActivity" />
|
<activity android:name=".activities.SettingsReportsActivity" />
|
||||||
<activity android:name=".activities.AddNewTeamMemberActivity" />
|
<activity android:name=".activities.AddNewTeamMemberActivity" />
|
||||||
<activity android:name=".activities.SettingsDraftsActivity" />
|
<activity android:name=".activities.SettingsDraftsActivity" />
|
||||||
|
<activity android:name=".activities.RepoForksActivity" />
|
||||||
|
<activity android:name=".activities.AddNewAccountActivity" />
|
||||||
|
|
||||||
<!-- Version < 3.0. DeX Mode and Screen Mirroring support -->
|
<!-- Version < 3.0. DeX Mode and Screen Mirroring support -->
|
||||||
<meta-data android:name="com.samsung.android.keepalive.density" android:value="true"/>
|
<meta-data android:name="com.samsung.android.keepalive.density" android:value="true"/>
|
||||||
|
@ -47,7 +47,7 @@ public class CollaboratorActions {
|
|||||||
if(response.isSuccessful()) {
|
if(response.isSuccessful()) {
|
||||||
if(response.code() == 204) {
|
if(response.code() == 204) {
|
||||||
|
|
||||||
Toasty.info(context, context.getString(R.string.removeCollaboratorToastText));
|
Toasty.success(context, context.getString(R.string.removeCollaboratorToastText));
|
||||||
((AddCollaboratorToRepositoryActivity)context).finish();
|
((AddCollaboratorToRepositoryActivity)context).finish();
|
||||||
//Log.i("addCollaboratorSearch", addCollaboratorSearch.getText().toString());
|
//Log.i("addCollaboratorSearch", addCollaboratorSearch.getText().toString());
|
||||||
//tinyDb.putBoolean("updateDataSet", true);
|
//tinyDb.putBoolean("updateDataSet", true);
|
||||||
@ -66,17 +66,17 @@ public class CollaboratorActions {
|
|||||||
}
|
}
|
||||||
else if(response.code() == 403) {
|
else if(response.code() == 403) {
|
||||||
|
|
||||||
Toasty.info(context, context.getString(R.string.authorizeError));
|
Toasty.error(context, context.getString(R.string.authorizeError));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 404) {
|
else if(response.code() == 404) {
|
||||||
|
|
||||||
Toasty.info(context, context.getString(R.string.apiNotFound));
|
Toasty.warning(context, context.getString(R.string.apiNotFound));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.info(context, context.getString(R.string.genericError));
|
Toasty.error(context, context.getString(R.string.genericError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ public class CollaboratorActions {
|
|||||||
if(response.isSuccessful()) {
|
if(response.isSuccessful()) {
|
||||||
if(response.code() == 204) {
|
if(response.code() == 204) {
|
||||||
|
|
||||||
Toasty.info(context, context.getString(R.string.addCollaboratorToastText));
|
Toasty.success(context, context.getString(R.string.addCollaboratorToastText));
|
||||||
((AddCollaboratorToRepositoryActivity)context).finish();
|
((AddCollaboratorToRepositoryActivity)context).finish();
|
||||||
//AddCollaboratorToRepositoryActivity usersSearchData = new AddCollaboratorToRepositoryActivity();
|
//AddCollaboratorToRepositoryActivity usersSearchData = new AddCollaboratorToRepositoryActivity();
|
||||||
//usersSearchData.loadUserSearchList(instanceUrl, instanceToken, searchKeyword, context);
|
//usersSearchData.loadUserSearchList(instanceUrl, instanceToken, searchKeyword, context);
|
||||||
@ -134,17 +134,17 @@ public class CollaboratorActions {
|
|||||||
}
|
}
|
||||||
else if(response.code() == 403) {
|
else if(response.code() == 403) {
|
||||||
|
|
||||||
Toasty.info(context, context.getString(R.string.authorizeError));
|
Toasty.error(context, context.getString(R.string.authorizeError));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 404) {
|
else if(response.code() == 404) {
|
||||||
|
|
||||||
Toasty.info(context, context.getString(R.string.apiNotFound));
|
Toasty.warning(context, context.getString(R.string.apiNotFound));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.info(context, context.getString(R.string.genericError));
|
Toasty.error(context, context.getString(R.string.genericError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ public class IssueActions {
|
|||||||
if(response.code() == 200) {
|
if(response.code() == 200) {
|
||||||
|
|
||||||
tinyDb.putBoolean("commentEdited", true);
|
tinyDb.putBoolean("commentEdited", true);
|
||||||
Toasty.info(ctx, ctx.getString(R.string.editCommentUpdatedText));
|
Toasty.success(ctx, ctx.getString(R.string.editCommentUpdatedText));
|
||||||
((ReplyToIssueActivity) ctx).finish();
|
((ReplyToIssueActivity) ctx).finish();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -59,17 +59,17 @@ public class IssueActions {
|
|||||||
}
|
}
|
||||||
else if(response.code() == 403) {
|
else if(response.code() == 403) {
|
||||||
|
|
||||||
Toasty.info(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.info(ctx, ctx.getString(R.string.apiNotFound));
|
Toasty.warning(ctx, ctx.getString(R.string.apiNotFound));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.info(ctx, ctx.getString(R.string.genericError));
|
Toasty.error(ctx, ctx.getString(R.string.genericError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,13 +113,13 @@ public class IssueActions {
|
|||||||
|
|
||||||
if(issueState.equals("closed")) {
|
if(issueState.equals("closed")) {
|
||||||
|
|
||||||
Toasty.info(ctx, ctx.getString(R.string.issueStateClosed));
|
Toasty.success(ctx, ctx.getString(R.string.issueStateClosed));
|
||||||
tinyDb.putString("issueState", "closed");
|
tinyDb.putString("issueState", "closed");
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(issueState.equals("open")) {
|
else if(issueState.equals("open")) {
|
||||||
|
|
||||||
Toasty.info(ctx, ctx.getString(R.string.issueStateReopened));
|
Toasty.success(ctx, ctx.getString(R.string.issueStateReopened));
|
||||||
tinyDb.putString("issueState", "open");
|
tinyDb.putString("issueState", "open");
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -133,17 +133,17 @@ public class IssueActions {
|
|||||||
}
|
}
|
||||||
else if(response.code() == 403) {
|
else if(response.code() == 403) {
|
||||||
|
|
||||||
Toasty.info(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.info(ctx, ctx.getString(R.string.apiNotFound));
|
Toasty.warning(ctx, ctx.getString(R.string.apiNotFound));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.info(ctx, ctx.getString(R.string.genericError));
|
Toasty.error(ctx, ctx.getString(R.string.genericError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,14 +184,14 @@ public class IssueActions {
|
|||||||
|
|
||||||
if(response.code() == 201) {
|
if(response.code() == 201) {
|
||||||
|
|
||||||
Toasty.info(ctx, ctx.getString(R.string.subscribedSuccessfully));
|
Toasty.success(ctx, ctx.getString(R.string.subscribedSuccessfully));
|
||||||
tinyDB.putBoolean("issueSubscribed", true);
|
tinyDB.putBoolean("issueSubscribed", true);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 200) {
|
else if(response.code() == 200) {
|
||||||
|
|
||||||
tinyDB.putBoolean("issueSubscribed", true);
|
tinyDB.putBoolean("issueSubscribed", true);
|
||||||
Toasty.info(ctx, ctx.getString(R.string.alreadySubscribed));
|
Toasty.success(ctx, ctx.getString(R.string.alreadySubscribed));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,7 +203,7 @@ public class IssueActions {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.info(ctx, ctx.getString(R.string.subscriptionError));
|
Toasty.error(ctx, ctx.getString(R.string.subscriptionError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ public class IssueActions {
|
|||||||
@Override
|
@Override
|
||||||
public void onFailure(@NonNull Call<Void> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<Void> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
Toasty.info(ctx, ctx.getString(R.string.unsubscribedSuccessfully));
|
Toasty.success(ctx, ctx.getString(R.string.unsubscribedSuccessfully));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -244,14 +244,14 @@ public class IssueActions {
|
|||||||
|
|
||||||
if(response.code() == 201) {
|
if(response.code() == 201) {
|
||||||
|
|
||||||
Toasty.info(ctx, ctx.getString(R.string.unsubscribedSuccessfully));
|
Toasty.success(ctx, ctx.getString(R.string.unsubscribedSuccessfully));
|
||||||
tinyDB.putBoolean("issueSubscribed", false);
|
tinyDB.putBoolean("issueSubscribed", false);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 200) {
|
else if(response.code() == 200) {
|
||||||
|
|
||||||
tinyDB.putBoolean("issueSubscribed", false);
|
tinyDB.putBoolean("issueSubscribed", false);
|
||||||
Toasty.info(ctx, ctx.getString(R.string.alreadyUnsubscribed));
|
Toasty.success(ctx, ctx.getString(R.string.alreadyUnsubscribed));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,7 +263,7 @@ public class IssueActions {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.info(ctx, ctx.getString(R.string.unsubscriptionError));
|
Toasty.error(ctx, ctx.getString(R.string.unsubscriptionError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,7 +272,7 @@ public class IssueActions {
|
|||||||
@Override
|
@Override
|
||||||
public void onFailure(@NonNull Call<Void> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<Void> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
Toasty.info(ctx, ctx.getString(R.string.unsubscriptionError));
|
Toasty.error(ctx, ctx.getString(R.string.unsubscriptionError));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ public class MilestoneActions {
|
|||||||
|
|
||||||
if(response.isSuccessful()) {
|
if(response.isSuccessful()) {
|
||||||
|
|
||||||
Toasty.info(ctx, ctx.getString(R.string.milestoneStatusUpdate));
|
Toasty.success(ctx, ctx.getString(R.string.milestoneStatusUpdate));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 401) {
|
else if(response.code() == 401) {
|
||||||
@ -61,7 +61,7 @@ public class MilestoneActions {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.info(ctx, ctx.getString(R.string.genericError));
|
Toasty.error(ctx, ctx.getString(R.string.genericError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ public class MilestoneActions {
|
|||||||
|
|
||||||
if(response.isSuccessful()) {
|
if(response.isSuccessful()) {
|
||||||
|
|
||||||
Toasty.info(ctx, ctx.getString(R.string.milestoneStatusUpdate));
|
Toasty.success(ctx, ctx.getString(R.string.milestoneStatusUpdate));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 401) {
|
else if(response.code() == 401) {
|
||||||
@ -119,7 +119,7 @@ public class MilestoneActions {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.info(ctx, ctx.getString(R.string.genericError));
|
Toasty.error(ctx, ctx.getString(R.string.genericError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ public class RepositoryActions {
|
|||||||
if(response.code() == 204) {
|
if(response.code() == 204) {
|
||||||
|
|
||||||
tinyDb.putBoolean("repoCreated", true);
|
tinyDb.putBoolean("repoCreated", true);
|
||||||
Toasty.info(context, context.getString(R.string.starRepositorySuccess));
|
Toasty.success(context, context.getString(R.string.starRepositorySuccess));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -60,17 +60,17 @@ public class RepositoryActions {
|
|||||||
}
|
}
|
||||||
else if(response.code() == 403) {
|
else if(response.code() == 403) {
|
||||||
|
|
||||||
Toasty.info(context, context.getString(R.string.authorizeError));
|
Toasty.error(context, context.getString(R.string.authorizeError));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 404) {
|
else if(response.code() == 404) {
|
||||||
|
|
||||||
Toasty.info(context, context.getString(R.string.apiNotFound));
|
Toasty.warning(context, context.getString(R.string.apiNotFound));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.info(context, context.getString(R.string.genericError));
|
Toasty.error(context, context.getString(R.string.genericError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ public class RepositoryActions {
|
|||||||
if(response.code() == 204) {
|
if(response.code() == 204) {
|
||||||
|
|
||||||
tinyDb.putBoolean("repoCreated", true);
|
tinyDb.putBoolean("repoCreated", true);
|
||||||
Toasty.info(context, context.getString(R.string.unStarRepositorySuccess));
|
Toasty.success(context, context.getString(R.string.unStarRepositorySuccess));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -125,17 +125,17 @@ public class RepositoryActions {
|
|||||||
}
|
}
|
||||||
else if(response.code() == 403) {
|
else if(response.code() == 403) {
|
||||||
|
|
||||||
Toasty.info(context, context.getString(R.string.authorizeError));
|
Toasty.error(context, context.getString(R.string.authorizeError));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 404) {
|
else if(response.code() == 404) {
|
||||||
|
|
||||||
Toasty.info(context, context.getString(R.string.apiNotFound));
|
Toasty.warning(context, context.getString(R.string.apiNotFound));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.info(context, context.getString(R.string.genericError));
|
Toasty.error(context, context.getString(R.string.genericError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ public class RepositoryActions {
|
|||||||
if(response.code() == 200) {
|
if(response.code() == 200) {
|
||||||
|
|
||||||
tinyDb.putBoolean("repoCreated", true);
|
tinyDb.putBoolean("repoCreated", true);
|
||||||
Toasty.info(context, context.getString(R.string.watchRepositorySuccess));
|
Toasty.success(context, context.getString(R.string.watchRepositorySuccess));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -190,17 +190,17 @@ public class RepositoryActions {
|
|||||||
}
|
}
|
||||||
else if(response.code() == 403) {
|
else if(response.code() == 403) {
|
||||||
|
|
||||||
Toasty.info(context, context.getString(R.string.authorizeError));
|
Toasty.error(context, context.getString(R.string.authorizeError));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 404) {
|
else if(response.code() == 404) {
|
||||||
|
|
||||||
Toasty.info(context, context.getString(R.string.apiNotFound));
|
Toasty.warning(context, context.getString(R.string.apiNotFound));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.info(context, context.getString(R.string.genericError));
|
Toasty.error(context, context.getString(R.string.genericError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,7 +240,7 @@ public class RepositoryActions {
|
|||||||
if(response.code() == 204) {
|
if(response.code() == 204) {
|
||||||
|
|
||||||
tinyDb.putBoolean("repoCreated", true);
|
tinyDb.putBoolean("repoCreated", true);
|
||||||
Toasty.info(context, context.getString(R.string.unWatchRepositorySuccess));
|
Toasty.success(context, context.getString(R.string.unWatchRepositorySuccess));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 401) {
|
else if(response.code() == 401) {
|
||||||
@ -253,17 +253,17 @@ public class RepositoryActions {
|
|||||||
}
|
}
|
||||||
else if(response.code() == 403) {
|
else if(response.code() == 403) {
|
||||||
|
|
||||||
Toasty.info(context, context.getString(R.string.authorizeError));
|
Toasty.error(context, context.getString(R.string.authorizeError));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 404) {
|
else if(response.code() == 404) {
|
||||||
|
|
||||||
Toasty.info(context, context.getString(R.string.apiNotFound));
|
Toasty.warning(context, context.getString(R.string.apiNotFound));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.info(context, context.getString(R.string.genericError));
|
Toasty.error(context, context.getString(R.string.genericError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public class TeamActions {
|
|||||||
if(response.code() == 204) {
|
if(response.code() == 204) {
|
||||||
|
|
||||||
tinyDb.putBoolean("teamActionFlag", true);
|
tinyDb.putBoolean("teamActionFlag", true);
|
||||||
Toasty.info(context, context.getString(R.string.memberRemovedMessage));
|
Toasty.success(context, context.getString(R.string.memberRemovedMessage));
|
||||||
((AddNewTeamMemberActivity)context).finish();
|
((AddNewTeamMemberActivity)context).finish();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -59,17 +59,17 @@ public class TeamActions {
|
|||||||
}
|
}
|
||||||
else if(response.code() == 403) {
|
else if(response.code() == 403) {
|
||||||
|
|
||||||
Toasty.info(context, context.getString(R.string.authorizeError));
|
Toasty.error(context, context.getString(R.string.authorizeError));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 404) {
|
else if(response.code() == 404) {
|
||||||
|
|
||||||
Toasty.info(context, context.getString(R.string.apiNotFound));
|
Toasty.warning(context, context.getString(R.string.apiNotFound));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.info(context, context.getString(R.string.genericError));
|
Toasty.error(context, context.getString(R.string.genericError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ public class TeamActions {
|
|||||||
if(response.code() == 204) {
|
if(response.code() == 204) {
|
||||||
|
|
||||||
tinyDb.putBoolean("teamActionFlag", true);
|
tinyDb.putBoolean("teamActionFlag", true);
|
||||||
Toasty.info(context, context.getString(R.string.memberAddedMessage));
|
Toasty.success(context, context.getString(R.string.memberAddedMessage));
|
||||||
((AddNewTeamMemberActivity)context).finish();
|
((AddNewTeamMemberActivity)context).finish();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -125,17 +125,17 @@ public class TeamActions {
|
|||||||
}
|
}
|
||||||
else if(response.code() == 403) {
|
else if(response.code() == 403) {
|
||||||
|
|
||||||
Toasty.info(context, context.getString(R.string.authorizeError));
|
Toasty.error(context, context.getString(R.string.authorizeError));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 404) {
|
else if(response.code() == 404) {
|
||||||
|
|
||||||
Toasty.info(context, context.getString(R.string.apiNotFound));
|
Toasty.warning(context, context.getString(R.string.apiNotFound));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.info(context, context.getString(R.string.genericError));
|
Toasty.error(context, context.getString(R.string.genericError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,267 @@
|
|||||||
|
package org.mian.gitnex.activities;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
import org.mian.gitnex.R;
|
||||||
|
import org.mian.gitnex.clients.RetrofitClient;
|
||||||
|
import org.mian.gitnex.database.api.UserAccountsApi;
|
||||||
|
import org.mian.gitnex.databinding.ActivityAddNewAccountBinding;
|
||||||
|
import org.mian.gitnex.helpers.AppUtil;
|
||||||
|
import org.mian.gitnex.helpers.PathsHelper;
|
||||||
|
import org.mian.gitnex.helpers.TinyDB;
|
||||||
|
import org.mian.gitnex.helpers.Toasty;
|
||||||
|
import org.mian.gitnex.helpers.UrlHelper;
|
||||||
|
import org.mian.gitnex.helpers.Version;
|
||||||
|
import org.mian.gitnex.models.GiteaVersion;
|
||||||
|
import org.mian.gitnex.models.UserInfo;
|
||||||
|
import java.net.URI;
|
||||||
|
import io.mikael.urlbuilder.UrlBuilder;
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.Callback;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Author M M Arif
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class AddNewAccountActivity extends BaseActivity {
|
||||||
|
|
||||||
|
final Context ctx = this;
|
||||||
|
private Context appCtx;
|
||||||
|
private TinyDB tinyDB;
|
||||||
|
|
||||||
|
private View.OnClickListener onClickListener;
|
||||||
|
private ActivityAddNewAccountBinding viewBinding;
|
||||||
|
|
||||||
|
private enum Protocol {HTTPS, HTTP}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getLayoutResourceId(){
|
||||||
|
return R.layout.activity_add_new_account;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
appCtx = getApplicationContext();
|
||||||
|
tinyDB = new TinyDB(appCtx);
|
||||||
|
|
||||||
|
viewBinding = ActivityAddNewAccountBinding.inflate(getLayoutInflater());
|
||||||
|
View view = viewBinding.getRoot();
|
||||||
|
setContentView(view);
|
||||||
|
|
||||||
|
getWindow().getDecorView().setBackground(new ColorDrawable(Color.TRANSPARENT));
|
||||||
|
|
||||||
|
initCloseListener();
|
||||||
|
viewBinding.close.setOnClickListener(onClickListener);
|
||||||
|
|
||||||
|
ArrayAdapter<AddNewAccountActivity.Protocol> adapterProtocols = new ArrayAdapter<>(AddNewAccountActivity.this, R.layout.spinner_item, AddNewAccountActivity.Protocol.values());
|
||||||
|
adapterProtocols.setDropDownViewResource(R.layout.spinner_dropdown_item);
|
||||||
|
|
||||||
|
viewBinding.protocolSpinner.setAdapter(adapterProtocols);
|
||||||
|
|
||||||
|
viewBinding.addNewAccount.setOnClickListener(login -> {
|
||||||
|
|
||||||
|
boolean connToInternet = AppUtil.hasNetworkConnection(appCtx);
|
||||||
|
|
||||||
|
if(!connToInternet) {
|
||||||
|
|
||||||
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
processLogin();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processLogin() {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
String instanceUrlET = viewBinding.instanceUrl.getText().toString();
|
||||||
|
String loginToken = viewBinding.loginToken.getText().toString();
|
||||||
|
Protocol protocol = (Protocol) viewBinding.protocolSpinner.getSelectedItem();
|
||||||
|
|
||||||
|
if(instanceUrlET.equals("")) {
|
||||||
|
|
||||||
|
Toasty.error(ctx, getResources().getString(R.string.emptyFieldURL));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(loginToken.equals("")) {
|
||||||
|
|
||||||
|
Toasty.error(ctx, getResources().getString(R.string.loginTokenError));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
URI rawInstanceUrl = UrlBuilder.fromString(UrlHelper.fixScheme(instanceUrlET, "http")).toUri();
|
||||||
|
|
||||||
|
URI instanceUrlWithProtocol = UrlBuilder.fromUri(rawInstanceUrl).withPath(PathsHelper.join(rawInstanceUrl.getPath()))
|
||||||
|
.withScheme(protocol.name().toLowerCase()).toUri();
|
||||||
|
|
||||||
|
URI instanceUrl = UrlBuilder.fromUri(instanceUrlWithProtocol).withPath(PathsHelper.join(instanceUrlWithProtocol.getPath(), "/api/v1/"))
|
||||||
|
.toUri();
|
||||||
|
|
||||||
|
versionCheck(instanceUrl.toString(), loginToken);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch(Exception e) {
|
||||||
|
|
||||||
|
Log.e("onFailure-login", e.toString());
|
||||||
|
Toasty.error(ctx, getResources().getString(R.string.malformedUrl));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void versionCheck(final String instanceUrl, final String loginToken) {
|
||||||
|
|
||||||
|
Call<GiteaVersion> callVersion;
|
||||||
|
|
||||||
|
callVersion = RetrofitClient.getInstance(instanceUrl, ctx).getApiInterface().getGiteaVersionWithToken(loginToken);
|
||||||
|
|
||||||
|
callVersion.enqueue(new Callback<GiteaVersion>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull final Call<GiteaVersion> callVersion, @NonNull retrofit2.Response<GiteaVersion> responseVersion) {
|
||||||
|
|
||||||
|
if(responseVersion.code() == 200) {
|
||||||
|
|
||||||
|
GiteaVersion version = responseVersion.body();
|
||||||
|
Version giteaVersion;
|
||||||
|
|
||||||
|
assert version != null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
giteaVersion = new Version(version.getVersion());
|
||||||
|
}
|
||||||
|
catch(Exception e) {
|
||||||
|
|
||||||
|
Toasty.error(ctx, getResources().getString(R.string.versionUnknown));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(giteaVersion.less(getString(R.string.versionLow))) {
|
||||||
|
|
||||||
|
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(ctx).setTitle(getString(R.string.versionAlertDialogHeader))
|
||||||
|
.setMessage(getResources().getString(R.string.versionUnsupportedOld, version.getVersion())).setIcon(R.drawable.ic_warning)
|
||||||
|
.setCancelable(true);
|
||||||
|
|
||||||
|
alertDialogBuilder.setNegativeButton(getString(R.string.cancelButton), (dialog, which) -> {
|
||||||
|
|
||||||
|
dialog.dismiss();
|
||||||
|
//enableProcessButton();
|
||||||
|
});
|
||||||
|
|
||||||
|
alertDialogBuilder.setPositiveButton(getString(R.string.textContinue), (dialog, which) -> {
|
||||||
|
|
||||||
|
dialog.dismiss();
|
||||||
|
login(instanceUrl, loginToken);
|
||||||
|
});
|
||||||
|
|
||||||
|
alertDialogBuilder.create().show();
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(giteaVersion.lessOrEqual(getString(R.string.versionHigh))) {
|
||||||
|
|
||||||
|
login(instanceUrl, loginToken);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
Toasty.warning(ctx, getResources().getString(R.string.versionUnsupportedNew));
|
||||||
|
login(instanceUrl, loginToken);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(responseVersion.code() == 403) {
|
||||||
|
|
||||||
|
login(instanceUrl, loginToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void login(String instanceUrl, String loginToken) {
|
||||||
|
|
||||||
|
setupNewAccountWithToken(instanceUrl, loginToken);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Call<GiteaVersion> callVersion, @NonNull Throwable t) {
|
||||||
|
|
||||||
|
Log.e("onFailure-versionCheck", t.toString());
|
||||||
|
Toasty.error(ctx, getResources().getString(R.string.errorOnLogin));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupNewAccountWithToken(String instanceUrl, final String loginToken) {
|
||||||
|
|
||||||
|
Call<UserInfo> call = RetrofitClient.getInstance(instanceUrl, ctx).getApiInterface().getUserInfo("token " + loginToken);
|
||||||
|
|
||||||
|
call.enqueue(new Callback<UserInfo>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<UserInfo> call, @NonNull retrofit2.Response<UserInfo> response) {
|
||||||
|
|
||||||
|
UserInfo userDetails = response.body();
|
||||||
|
|
||||||
|
switch(response.code()) {
|
||||||
|
|
||||||
|
case 200:
|
||||||
|
|
||||||
|
assert userDetails != null;
|
||||||
|
// insert new account to db if does not exist
|
||||||
|
String accountName = userDetails.getUsername() + "@" + instanceUrl;
|
||||||
|
UserAccountsApi userAccountsApi = new UserAccountsApi(ctx);
|
||||||
|
int checkAccount = userAccountsApi.getCount(accountName);
|
||||||
|
|
||||||
|
if(checkAccount == 0) {
|
||||||
|
|
||||||
|
userAccountsApi.insertNewAccount(accountName, instanceUrl, userDetails.getUsername(), loginToken, "");
|
||||||
|
Toasty.success(ctx, getResources().getString(R.string.accountAddedMessage));
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
Toasty.warning(ctx, getResources().getString(R.string.accountAlreadyExistsError));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 401:
|
||||||
|
|
||||||
|
Toasty.error(ctx,getResources().getString(R.string.unauthorizedApiError));
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
|
||||||
|
Toasty.error(ctx,getResources().getString(R.string.genericApiStatusError) + response.code());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Call<UserInfo> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
|
Log.e("onFailure", t.toString());
|
||||||
|
Toasty.error(ctx,getResources().getString(R.string.genericError));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initCloseListener() {
|
||||||
|
|
||||||
|
onClickListener = view -> finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -28,6 +28,10 @@ import retrofit2.Call;
|
|||||||
import retrofit2.Callback;
|
import retrofit2.Callback;
|
||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Author M M Arif
|
||||||
|
*/
|
||||||
|
|
||||||
public class AddNewTeamMemberActivity extends BaseActivity {
|
public class AddNewTeamMemberActivity extends BaseActivity {
|
||||||
|
|
||||||
private View.OnClickListener onClickListener;
|
private View.OnClickListener onClickListener;
|
||||||
|
@ -207,17 +207,17 @@ public class AddRemoveAssigneesActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
else if(response.code() == 403) {
|
else if(response.code() == 403) {
|
||||||
|
|
||||||
Toasty.info(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.info(ctx, ctx.getString(R.string.apiNotFound));
|
Toasty.warning(ctx, ctx.getString(R.string.apiNotFound));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.genericError));
|
Toasty.error(ctx, getString(R.string.genericError));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -254,7 +254,7 @@ public class AddRemoveAssigneesActivity extends BaseActivity {
|
|||||||
|
|
||||||
if(response2.code() == 201) {
|
if(response2.code() == 201) {
|
||||||
|
|
||||||
Toasty.info(ctx, ctx.getString(R.string.assigneesUpdated));
|
Toasty.success(ctx, ctx.getString(R.string.assigneesUpdated));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response2.code() == 401) {
|
else if(response2.code() == 401) {
|
||||||
@ -267,17 +267,17 @@ public class AddRemoveAssigneesActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
else if(response2.code() == 403) {
|
else if(response2.code() == 403) {
|
||||||
|
|
||||||
Toasty.info(ctx, ctx.getString(R.string.authorizeError));
|
Toasty.error(ctx, ctx.getString(R.string.authorizeError));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response2.code() == 404) {
|
else if(response2.code() == 404) {
|
||||||
|
|
||||||
Toasty.info(ctx, ctx.getString(R.string.apiNotFound));
|
Toasty.warning(ctx, ctx.getString(R.string.apiNotFound));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.genericError));
|
Toasty.error(ctx, getString(R.string.genericError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,17 +224,17 @@ public class AddRemoveLabelsActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
else if(response.code() == 403) {
|
else if(response.code() == 403) {
|
||||||
|
|
||||||
Toasty.info(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.info(ctx, ctx.getString(R.string.apiNotFound));
|
Toasty.warning(ctx, ctx.getString(R.string.apiNotFound));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.genericError));
|
Toasty.error(ctx, getString(R.string.genericError));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -265,7 +265,7 @@ public class AddRemoveLabelsActivity extends BaseActivity {
|
|||||||
|
|
||||||
if(response.code() == 200) {
|
if(response.code() == 200) {
|
||||||
|
|
||||||
Toasty.info(ctx, ctx.getString(R.string.labelsUpdated));
|
Toasty.success(ctx, ctx.getString(R.string.labelsUpdated));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 401) {
|
else if(response.code() == 401) {
|
||||||
@ -278,17 +278,17 @@ public class AddRemoveLabelsActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
else if(response.code() == 403) {
|
else if(response.code() == 403) {
|
||||||
|
|
||||||
Toasty.info(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.info(ctx, ctx.getString(R.string.apiNotFound));
|
Toasty.warning(ctx, ctx.getString(R.string.apiNotFound));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.genericError));
|
Toasty.error(ctx, getString(R.string.genericError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ package org.mian.gitnex.activities;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
import android.graphics.drawable.GradientDrawable;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -95,7 +94,7 @@ public class CreateFileActivity extends BaseActivity {
|
|||||||
closeActivity.setOnClickListener(onClickListener);
|
closeActivity.setOnClickListener(onClickListener);
|
||||||
|
|
||||||
newFileBranchesSpinner = findViewById(R.id.newFileBranchesSpinner);
|
newFileBranchesSpinner = findViewById(R.id.newFileBranchesSpinner);
|
||||||
newFileBranchesSpinner.getBackground().setColorFilter(getResources().getColor(R.color.white), PorterDuff.Mode.SRC_ATOP);
|
newFileBranchesSpinner.getBackground().setColorFilter(getResources().getColor(R.color.colorWhite), PorterDuff.Mode.SRC_ATOP);
|
||||||
getBranches(instanceUrl, instanceToken, repoOwner, repoName, loginUid);
|
getBranches(instanceUrl, instanceToken, repoOwner, repoName, loginUid);
|
||||||
|
|
||||||
newFileBranchesSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener()
|
newFileBranchesSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener()
|
||||||
@ -129,15 +128,10 @@ public class CreateFileActivity extends BaseActivity {
|
|||||||
if(!connToInternet) {
|
if(!connToInternet) {
|
||||||
|
|
||||||
newFileCreate.setEnabled(false);
|
newFileCreate.setEnabled(false);
|
||||||
GradientDrawable shape = new GradientDrawable();
|
}
|
||||||
shape.setCornerRadius( 8 );
|
else {
|
||||||
shape.setColor(getResources().getColor(R.color.hintColor));
|
|
||||||
newFileCreate.setBackground(shape);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
newFileCreate.setOnClickListener(createFileListener);
|
newFileCreate.setOnClickListener(createFileListener);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -166,14 +160,14 @@ public class CreateFileActivity extends BaseActivity {
|
|||||||
|
|
||||||
if(!connToInternet) {
|
if(!connToInternet) {
|
||||||
|
|
||||||
Toasty.info(ctx, getResources().getString(R.string.checkNetConnection));
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(newFileName_.equals("") || newFileContent_.equals("") || newFileCommitMessage_.equals("")) {
|
if(newFileName_.equals("") || newFileContent_.equals("") || newFileCommitMessage_.equals("")) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.newFileRequiredFields));
|
Toasty.error(ctx, getString(R.string.newFileRequiredFields));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -181,13 +175,13 @@ public class CreateFileActivity extends BaseActivity {
|
|||||||
if(currentBranch.toString().equals("No branch")) {
|
if(currentBranch.toString().equals("No branch")) {
|
||||||
|
|
||||||
if(newFileBranchName_.equals("")) {
|
if(newFileBranchName_.equals("")) {
|
||||||
Toasty.info(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.info(ctx, getString(R.string.newFileInvalidBranchName));
|
Toasty.error(ctx, getString(R.string.newFileInvalidBranchName));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -197,7 +191,7 @@ public class CreateFileActivity extends BaseActivity {
|
|||||||
|
|
||||||
if(appUtil.charactersLength(newFileCommitMessage_) > 255) {
|
if(appUtil.charactersLength(newFileCommitMessage_) > 255) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.newFileCommitMessageError));
|
Toasty.warning(ctx, getString(R.string.newFileCommitMessageError));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -232,7 +226,7 @@ public class CreateFileActivity extends BaseActivity {
|
|||||||
if(response.code() == 201) {
|
if(response.code() == 201) {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.info(ctx, getString(R.string.newFileSuccessMessage));
|
Toasty.success(ctx, getString(R.string.newFileSuccessMessage));
|
||||||
finish();
|
finish();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -249,11 +243,11 @@ public class CreateFileActivity extends BaseActivity {
|
|||||||
|
|
||||||
if(response.code() == 404) {
|
if(response.code() == 404) {
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.info(ctx, getString(R.string.apiNotFound));
|
Toasty.warning(ctx, getString(R.string.apiNotFound));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.info(ctx, getString(R.string.orgCreatedError));
|
Toasty.error(ctx, getString(R.string.orgCreatedError));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -326,21 +320,11 @@ public class CreateFileActivity extends BaseActivity {
|
|||||||
private void disableProcessButton() {
|
private void disableProcessButton() {
|
||||||
|
|
||||||
newFileCreate.setEnabled(false);
|
newFileCreate.setEnabled(false);
|
||||||
GradientDrawable shape = new GradientDrawable();
|
|
||||||
shape.setCornerRadius( 8 );
|
|
||||||
shape.setColor(getResources().getColor(R.color.hintColor));
|
|
||||||
newFileCreate.setBackground(shape);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableProcessButton() {
|
private void enableProcessButton() {
|
||||||
|
|
||||||
newFileCreate.setEnabled(true);
|
newFileCreate.setEnabled(true);
|
||||||
GradientDrawable shape = new GradientDrawable();
|
|
||||||
shape.setCornerRadius( 8 );
|
|
||||||
shape.setColor(getResources().getColor(R.color.btnBackground));
|
|
||||||
newFileCreate.setBackground(shape);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package org.mian.gitnex.activities;
|
|||||||
import android.app.DatePickerDialog;
|
import android.app.DatePickerDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
import android.graphics.drawable.GradientDrawable;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -127,7 +126,7 @@ public class CreateIssueActivity extends BaseActivity implements View.OnClickLis
|
|||||||
newIssueDueDate.setOnClickListener(this);
|
newIssueDueDate.setOnClickListener(this);
|
||||||
|
|
||||||
newIssueMilestoneSpinner = findViewById(R.id.newIssueMilestoneSpinner);
|
newIssueMilestoneSpinner = findViewById(R.id.newIssueMilestoneSpinner);
|
||||||
newIssueMilestoneSpinner.getBackground().setColorFilter(getResources().getColor(R.color.white), PorterDuff.Mode.SRC_ATOP);
|
newIssueMilestoneSpinner.getBackground().setColorFilter(getResources().getColor(R.color.colorWhite), PorterDuff.Mode.SRC_ATOP);
|
||||||
getMilestones(instanceUrl, instanceToken, repoOwner, repoName, loginUid, resultLimit);
|
getMilestones(instanceUrl, instanceToken, repoOwner, repoName, loginUid, resultLimit);
|
||||||
|
|
||||||
getLabels(instanceUrl, instanceToken, repoOwner, repoName, loginUid);
|
getLabels(instanceUrl, instanceToken, repoOwner, repoName, loginUid);
|
||||||
@ -138,15 +137,10 @@ public class CreateIssueActivity extends BaseActivity implements View.OnClickLis
|
|||||||
if(!connToInternet) {
|
if(!connToInternet) {
|
||||||
|
|
||||||
createNewIssueButton.setEnabled(false);
|
createNewIssueButton.setEnabled(false);
|
||||||
GradientDrawable shape = new GradientDrawable();
|
}
|
||||||
shape.setCornerRadius( 8 );
|
else {
|
||||||
shape.setColor(getResources().getColor(R.color.hintColor));
|
|
||||||
createNewIssueButton.setBackground(shape);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
createNewIssueButton.setOnClickListener(this);
|
createNewIssueButton.setOnClickListener(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -175,21 +169,21 @@ public class CreateIssueActivity extends BaseActivity implements View.OnClickLis
|
|||||||
|
|
||||||
if(!connToInternet) {
|
if(!connToInternet) {
|
||||||
|
|
||||||
Toasty.info(ctx, getResources().getString(R.string.checkNetConnection));
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newIssueTitleForm.equals("")) {
|
if (newIssueTitleForm.equals("")) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.issueTitleEmpty));
|
Toasty.error(ctx, getString(R.string.issueTitleEmpty));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (newIssueDescriptionForm.equals("")) {
|
/*if (newIssueDescriptionForm.equals("")) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.issueDescriptionEmpty));
|
Toasty.error(ctx, getString(R.string.issueDescriptionEmpty));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}*/
|
}*/
|
||||||
@ -299,7 +293,7 @@ public class CreateIssueActivity extends BaseActivity implements View.OnClickLis
|
|||||||
TinyDB tinyDb = new TinyDB(appCtx);
|
TinyDB tinyDb = new TinyDB(appCtx);
|
||||||
tinyDb.putBoolean("resumeIssues", true);
|
tinyDb.putBoolean("resumeIssues", true);
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.issueCreated));
|
Toasty.success(ctx, getString(R.string.issueCreated));
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
finish();
|
finish();
|
||||||
|
|
||||||
@ -317,7 +311,7 @@ public class CreateIssueActivity extends BaseActivity implements View.OnClickLis
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.issueCreatedError));
|
Toasty.error(ctx, getString(R.string.issueCreatedError));
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
//Log.i("isSuccessful2", String.valueOf(response2.body()));
|
//Log.i("isSuccessful2", String.valueOf(response2.body()));
|
||||||
|
|
||||||
@ -335,12 +329,8 @@ public class CreateIssueActivity extends BaseActivity implements View.OnClickLis
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initCloseListener() {
|
private void initCloseListener() {
|
||||||
onClickListener = new View.OnClickListener() {
|
|
||||||
@Override
|
onClickListener = view -> finish();
|
||||||
public void onClick(View view) {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getMilestones(String instanceUrl, String instanceToken, String repoOwner, String repoName, String loginUid, int resultLimit) {
|
private void getMilestones(String instanceUrl, String instanceToken, String repoOwner, String repoName, String loginUid, int resultLimit) {
|
||||||
@ -541,7 +531,7 @@ public class CreateIssueActivity extends BaseActivity implements View.OnClickLis
|
|||||||
multiSelectDialog.show(getSupportFragmentManager(), "multiSelectDialog");
|
multiSelectDialog.show(getSupportFragmentManager(), "multiSelectDialog");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Toasty.info(ctx, getResources().getString(R.string.noAssigneesFound));
|
Toasty.warning(ctx, getResources().getString(R.string.noAssigneesFound));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (v == newIssueLabels) {
|
else if (v == newIssueLabels) {
|
||||||
@ -549,7 +539,7 @@ public class CreateIssueActivity extends BaseActivity implements View.OnClickLis
|
|||||||
multiSelectDialogLabels.show(getSupportFragmentManager(), "multiSelectDialogLabels");
|
multiSelectDialogLabels.show(getSupportFragmentManager(), "multiSelectDialogLabels");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Toasty.info(ctx, getResources().getString(R.string.noLabelsFound));
|
Toasty.warning(ctx, getResources().getString(R.string.noLabelsFound));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (v == newIssueDueDate) {
|
else if (v == newIssueDueDate) {
|
||||||
@ -581,20 +571,10 @@ public class CreateIssueActivity extends BaseActivity implements View.OnClickLis
|
|||||||
private void disableProcessButton() {
|
private void disableProcessButton() {
|
||||||
|
|
||||||
createNewIssueButton.setEnabled(false);
|
createNewIssueButton.setEnabled(false);
|
||||||
GradientDrawable shape = new GradientDrawable();
|
|
||||||
shape.setCornerRadius( 8 );
|
|
||||||
shape.setColor(getResources().getColor(R.color.hintColor));
|
|
||||||
createNewIssueButton.setBackground(shape);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableProcessButton() {
|
private void enableProcessButton() {
|
||||||
|
|
||||||
createNewIssueButton.setEnabled(true);
|
createNewIssueButton.setEnabled(true);
|
||||||
GradientDrawable shape = new GradientDrawable();
|
|
||||||
shape.setCornerRadius( 8 );
|
|
||||||
shape.setColor(getResources().getColor(R.color.btnBackground));
|
|
||||||
createNewIssueButton.setBackground(shape);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package org.mian.gitnex.activities;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.drawable.GradientDrawable;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -118,38 +117,23 @@ public class CreateLabelActivity extends BaseActivity {
|
|||||||
createLabelButton.setText(getResources().getString(R.string.newUpdateButtonCopy));
|
createLabelButton.setText(getResources().getString(R.string.newUpdateButtonCopy));
|
||||||
|
|
||||||
createLabelButton.setOnClickListener(updateLabelListener);
|
createLabelButton.setOnClickListener(updateLabelListener);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!connToInternet) {
|
if(!connToInternet) {
|
||||||
|
|
||||||
createLabelButton.setEnabled(false);
|
createLabelButton.setEnabled(false);
|
||||||
GradientDrawable shape = new GradientDrawable();
|
}
|
||||||
shape.setCornerRadius( 8 );
|
else {
|
||||||
shape.setColor(getResources().getColor(R.color.hintColor));
|
|
||||||
createLabelButton.setBackground(shape);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
createLabelButton.setOnClickListener(createLabelListener);
|
createLabelButton.setOnClickListener(createLabelListener);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private View.OnClickListener createLabelListener = new View.OnClickListener() {
|
private View.OnClickListener createLabelListener = v -> processCreateLabel();
|
||||||
public void onClick(View v) {
|
|
||||||
processCreateLabel();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private View.OnClickListener updateLabelListener = new View.OnClickListener() {
|
private View.OnClickListener updateLabelListener = v -> processUpdateLabel();
|
||||||
public void onClick(View v) {
|
|
||||||
processUpdateLabel();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private void processUpdateLabel() {
|
private void processUpdateLabel() {
|
||||||
|
|
||||||
@ -176,27 +160,28 @@ public class CreateLabelActivity extends BaseActivity {
|
|||||||
|
|
||||||
if(!connToInternet) {
|
if(!connToInternet) {
|
||||||
|
|
||||||
Toasty.info(ctx, getResources().getString(R.string.checkNetConnection));
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(updateLabelName.equals("")) {
|
if(updateLabelName.equals("")) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.labelEmptyError));
|
Toasty.error(ctx, getString(R.string.labelEmptyError));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!appUtil.checkStrings(updateLabelName)) {
|
if(!appUtil.checkStrings(updateLabelName)) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.labelNameError));
|
Toasty.error(ctx, getString(R.string.labelNameError));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
disableProcessButton();
|
disableProcessButton();
|
||||||
patchLabel(instanceUrl, instanceToken, repoOwner, repoName, updateLabelName, updateLabelColor, Integer.valueOf(getIntent().getStringExtra("labelId")), loginUid);
|
patchLabel(instanceUrl, instanceToken, repoOwner, repoName, updateLabelName, updateLabelColor, Integer.parseInt(
|
||||||
|
Objects.requireNonNull(getIntent().getStringExtra("labelId"))), loginUid);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,21 +209,21 @@ public class CreateLabelActivity extends BaseActivity {
|
|||||||
|
|
||||||
if(!connToInternet) {
|
if(!connToInternet) {
|
||||||
|
|
||||||
Toasty.info(ctx, getResources().getString(R.string.checkNetConnection));
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(newLabelName.equals("")) {
|
if(newLabelName.equals("")) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.labelEmptyError));
|
Toasty.error(ctx, getString(R.string.labelEmptyError));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!appUtil.checkStrings(newLabelName)) {
|
if(!appUtil.checkStrings(newLabelName)) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.labelNameError));
|
Toasty.error(ctx, getString(R.string.labelNameError));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -267,7 +252,7 @@ public class CreateLabelActivity extends BaseActivity {
|
|||||||
|
|
||||||
if(response.code() == 201) {
|
if(response.code() == 201) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.labelCreated));
|
Toasty.success(ctx, getString(R.string.labelCreated));
|
||||||
tinyDb.putString("labelColor", "");
|
tinyDb.putString("labelColor", "");
|
||||||
tinyDb.putBoolean("labelsRefresh", true);
|
tinyDb.putBoolean("labelsRefresh", true);
|
||||||
finish();
|
finish();
|
||||||
@ -286,7 +271,7 @@ public class CreateLabelActivity extends BaseActivity {
|
|||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
tinyDb.putString("labelColor", "");
|
tinyDb.putString("labelColor", "");
|
||||||
Toasty.info(ctx, getString(R.string.labelGeneralError));
|
Toasty.error(ctx, getString(R.string.labelGeneralError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,6 +279,7 @@ public class CreateLabelActivity extends BaseActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@NonNull Call<CreateLabel> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<CreateLabel> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
tinyDb.putString("labelColor", "");
|
tinyDb.putString("labelColor", "");
|
||||||
Log.e("onFailure", t.toString());
|
Log.e("onFailure", t.toString());
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
@ -322,7 +308,7 @@ public class CreateLabelActivity extends BaseActivity {
|
|||||||
if(response.isSuccessful()) {
|
if(response.isSuccessful()) {
|
||||||
if(response.code() == 200) {
|
if(response.code() == 200) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.labelUpdated));
|
Toasty.success(ctx, getString(R.string.labelUpdated));
|
||||||
tinyDb.putString("labelColor", "");
|
tinyDb.putString("labelColor", "");
|
||||||
tinyDb.putBoolean("labelsRefresh", true);
|
tinyDb.putBoolean("labelsRefresh", true);
|
||||||
tinyDb.putString("labelColorDefault", "");
|
tinyDb.putString("labelColorDefault", "");
|
||||||
@ -348,7 +334,7 @@ public class CreateLabelActivity extends BaseActivity {
|
|||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
tinyDb.putString("labelColor", "");
|
tinyDb.putString("labelColor", "");
|
||||||
tinyDb.putString("labelColorDefault", "");
|
tinyDb.putString("labelColorDefault", "");
|
||||||
Toasty.info(ctx, getString(R.string.labelGeneralError));
|
Toasty.error(ctx, getString(R.string.labelGeneralError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,6 +342,7 @@ public class CreateLabelActivity extends BaseActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@NonNull Call<CreateLabel> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<CreateLabel> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
tinyDb.putString("labelColor", "");
|
tinyDb.putString("labelColor", "");
|
||||||
tinyDb.putString("labelColorDefault", "");
|
tinyDb.putString("labelColorDefault", "");
|
||||||
Log.e("onFailure", t.toString());
|
Log.e("onFailure", t.toString());
|
||||||
@ -395,7 +382,7 @@ public class CreateLabelActivity extends BaseActivity {
|
|||||||
if(response.isSuccessful()) {
|
if(response.isSuccessful()) {
|
||||||
if(response.code() == 204) {
|
if(response.code() == 204) {
|
||||||
|
|
||||||
Toasty.info(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");
|
||||||
@ -412,7 +399,7 @@ public class CreateLabelActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.labelDeleteErrorText));
|
Toasty.error(ctx, getString(R.string.labelDeleteErrorText));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -429,21 +416,11 @@ public class CreateLabelActivity extends BaseActivity {
|
|||||||
private void disableProcessButton() {
|
private void disableProcessButton() {
|
||||||
|
|
||||||
createLabelButton.setEnabled(false);
|
createLabelButton.setEnabled(false);
|
||||||
GradientDrawable shape = new GradientDrawable();
|
|
||||||
shape.setCornerRadius( 8 );
|
|
||||||
shape.setColor(getResources().getColor(R.color.hintColor));
|
|
||||||
createLabelButton.setBackground(shape);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableProcessButton() {
|
private void enableProcessButton() {
|
||||||
|
|
||||||
createLabelButton.setEnabled(true);
|
createLabelButton.setEnabled(true);
|
||||||
GradientDrawable shape = new GradientDrawable();
|
|
||||||
shape.setCornerRadius( 8 );
|
|
||||||
shape.setColor(getResources().getColor(R.color.btnBackground));
|
|
||||||
createLabelButton.setBackground(shape);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package org.mian.gitnex.activities;
|
|||||||
|
|
||||||
import android.app.DatePickerDialog;
|
import android.app.DatePickerDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.drawable.GradientDrawable;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -71,24 +70,15 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic
|
|||||||
if(!connToInternet) {
|
if(!connToInternet) {
|
||||||
|
|
||||||
createNewMilestoneButton.setEnabled(false);
|
createNewMilestoneButton.setEnabled(false);
|
||||||
GradientDrawable shape = new GradientDrawable();
|
}
|
||||||
shape.setCornerRadius( 8 );
|
else {
|
||||||
shape.setColor(getResources().getColor(R.color.hintColor));
|
|
||||||
createNewMilestoneButton.setBackground(shape);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
createNewMilestoneButton.setOnClickListener(createMilestoneListener);
|
createNewMilestoneButton.setOnClickListener(createMilestoneListener);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private View.OnClickListener createMilestoneListener = new View.OnClickListener() {
|
private View.OnClickListener createMilestoneListener = v -> processNewMilestone();
|
||||||
public void onClick(View v) {
|
|
||||||
processNewMilestone();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private void processNewMilestone() {
|
private void processNewMilestone() {
|
||||||
|
|
||||||
@ -110,14 +100,14 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic
|
|||||||
|
|
||||||
if(!connToInternet) {
|
if(!connToInternet) {
|
||||||
|
|
||||||
Toasty.info(ctx, getResources().getString(R.string.checkNetConnection));
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(newMilestoneTitle.equals("")) {
|
if(newMilestoneTitle.equals("")) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.milestoneNameErrorEmpty));
|
Toasty.error(ctx, getString(R.string.milestoneNameErrorEmpty));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -125,7 +115,7 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic
|
|||||||
if(!newMilestoneDescription.equals("")) {
|
if(!newMilestoneDescription.equals("")) {
|
||||||
if (appUtil.charactersLength(newMilestoneDescription) > 255) {
|
if (appUtil.charactersLength(newMilestoneDescription) > 255) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.milestoneDescError));
|
Toasty.warning(ctx, getString(R.string.milestoneDescError));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -133,10 +123,13 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic
|
|||||||
|
|
||||||
String finalMilestoneDueDate = null;
|
String finalMilestoneDueDate = null;
|
||||||
if(!newMilestoneDueDate.isEmpty()) {
|
if(!newMilestoneDueDate.isEmpty()) {
|
||||||
|
|
||||||
finalMilestoneDueDate = (AppUtil.customDateCombine(AppUtil.customDateFormat(newMilestoneDueDate)));
|
finalMilestoneDueDate = (AppUtil.customDateCombine(AppUtil.customDateFormat(newMilestoneDueDate)));
|
||||||
} else if (new Version(tinyDb.getString("giteaVersion")).less("1.10.0")) {
|
}
|
||||||
|
else if (new Version(tinyDb.getString("giteaVersion")).less("1.10.0")) {
|
||||||
|
|
||||||
// if Gitea version is less than 1.10.0 DueDate is required
|
// if Gitea version is less than 1.10.0 DueDate is required
|
||||||
Toasty.info(ctx, getString(R.string.milestoneDateEmpty));
|
Toasty.warning(ctx, getString(R.string.milestoneDateEmpty));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,7 +159,7 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic
|
|||||||
|
|
||||||
TinyDB tinyDb = new TinyDB(appCtx);
|
TinyDB tinyDb = new TinyDB(appCtx);
|
||||||
tinyDb.putBoolean("milestoneCreated", true);
|
tinyDb.putBoolean("milestoneCreated", true);
|
||||||
Toasty.info(ctx, getString(R.string.milestoneCreated));
|
Toasty.success(ctx, getString(R.string.milestoneCreated));
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
finish();
|
finish();
|
||||||
|
|
||||||
@ -184,7 +177,7 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic
|
|||||||
else {
|
else {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.info(ctx, getString(R.string.milestoneCreatedError));
|
Toasty.error(ctx, getString(R.string.milestoneCreatedError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,32 +219,18 @@ public class CreateMilestoneActivity extends BaseActivity implements View.OnClic
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initCloseListener() {
|
private void initCloseListener() {
|
||||||
onClickListener = new View.OnClickListener() {
|
|
||||||
@Override
|
onClickListener = view -> finish();
|
||||||
public void onClick(View view) {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void disableProcessButton() {
|
private void disableProcessButton() {
|
||||||
|
|
||||||
createNewMilestoneButton.setEnabled(false);
|
createNewMilestoneButton.setEnabled(false);
|
||||||
GradientDrawable shape = new GradientDrawable();
|
|
||||||
shape.setCornerRadius( 8 );
|
|
||||||
shape.setColor(getResources().getColor(R.color.hintColor));
|
|
||||||
createNewMilestoneButton.setBackground(shape);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableProcessButton() {
|
private void enableProcessButton() {
|
||||||
|
|
||||||
createNewMilestoneButton.setEnabled(true);
|
createNewMilestoneButton.setEnabled(true);
|
||||||
GradientDrawable shape = new GradientDrawable();
|
|
||||||
shape.setCornerRadius( 8 );
|
|
||||||
shape.setColor(getResources().getColor(R.color.btnBackground));
|
|
||||||
createNewMilestoneButton.setBackground(shape);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.mian.gitnex.activities;
|
package org.mian.gitnex.activities;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.drawable.GradientDrawable;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.Patterns;
|
import android.util.Patterns;
|
||||||
@ -69,11 +68,10 @@ public class CreateNewUserActivity extends BaseActivity {
|
|||||||
if(!connToInternet) {
|
if(!connToInternet) {
|
||||||
|
|
||||||
disableProcessButton();
|
disableProcessButton();
|
||||||
|
}
|
||||||
} else {
|
else {
|
||||||
|
|
||||||
createUserButton.setOnClickListener(createNewUserListener);
|
createUserButton.setOnClickListener(createNewUserListener);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -94,35 +92,35 @@ public class CreateNewUserActivity extends BaseActivity {
|
|||||||
|
|
||||||
if(!connToInternet) {
|
if(!connToInternet) {
|
||||||
|
|
||||||
Toasty.info(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.info(ctx, getString(R.string.emptyFields));
|
Toasty.error(ctx, getString(R.string.emptyFields));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!appUtil.checkStrings(newFullName)) {
|
if(!appUtil.checkStrings(newFullName)) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.userInvalidFullName));
|
Toasty.error(ctx, getString(R.string.userInvalidFullName));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!appUtil.checkStringsWithAlphaNumeric(newUserName)) {
|
if(!appUtil.checkStringsWithAlphaNumeric(newUserName)) {
|
||||||
|
|
||||||
Toasty.info(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.info(ctx, getString(R.string.userInvalidEmail));
|
Toasty.error(ctx, getString(R.string.userInvalidEmail));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -150,7 +148,7 @@ public class CreateNewUserActivity extends BaseActivity {
|
|||||||
|
|
||||||
if(response.code() == 201) {
|
if(response.code() == 201) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.userCreatedText));
|
Toasty.success(ctx, getString(R.string.userCreatedText));
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
finish();
|
finish();
|
||||||
|
|
||||||
@ -167,25 +165,25 @@ public class CreateNewUserActivity extends BaseActivity {
|
|||||||
else if(response.code() == 403) {
|
else if(response.code() == 403) {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.info(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.info(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.info(ctx, ctx.getString(R.string.userExistsError));
|
Toasty.warning(ctx, ctx.getString(R.string.userExistsError));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.info(ctx, getString(R.string.genericError));
|
Toasty.error(ctx, getString(R.string.genericError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,6 +191,7 @@ public class CreateNewUserActivity extends BaseActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@NonNull Call<UserInfo> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<UserInfo> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
Log.e("onFailure", t.toString());
|
Log.e("onFailure", t.toString());
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
}
|
}
|
||||||
@ -200,39 +199,21 @@ public class CreateNewUserActivity extends BaseActivity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private View.OnClickListener createNewUserListener = new View.OnClickListener() {
|
private View.OnClickListener createNewUserListener = v -> processCreateNewUser();
|
||||||
public void onClick(View v) {
|
|
||||||
processCreateNewUser();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private void initCloseListener() {
|
private void initCloseListener() {
|
||||||
onClickListener = new View.OnClickListener() {
|
|
||||||
@Override
|
onClickListener = view -> finish();
|
||||||
public void onClick(View view) {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void disableProcessButton() {
|
private void disableProcessButton() {
|
||||||
|
|
||||||
createUserButton.setEnabled(false);
|
createUserButton.setEnabled(false);
|
||||||
GradientDrawable shape = new GradientDrawable();
|
|
||||||
shape.setCornerRadius( 8 );
|
|
||||||
shape.setColor(getResources().getColor(R.color.hintColor));
|
|
||||||
createUserButton.setBackground(shape);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableProcessButton() {
|
private void enableProcessButton() {
|
||||||
|
|
||||||
createUserButton.setEnabled(true);
|
createUserButton.setEnabled(true);
|
||||||
GradientDrawable shape = new GradientDrawable();
|
|
||||||
shape.setCornerRadius( 8 );
|
|
||||||
shape.setColor(getResources().getColor(R.color.btnBackground));
|
|
||||||
createUserButton.setBackground(shape);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.mian.gitnex.activities;
|
package org.mian.gitnex.activities;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.drawable.GradientDrawable;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -67,15 +66,10 @@ public class CreateOrganizationActivity extends BaseActivity {
|
|||||||
if(!connToInternet) {
|
if(!connToInternet) {
|
||||||
|
|
||||||
createOrganizationButton.setEnabled(false);
|
createOrganizationButton.setEnabled(false);
|
||||||
GradientDrawable shape = new GradientDrawable();
|
}
|
||||||
shape.setCornerRadius( 8 );
|
else {
|
||||||
shape.setColor(getResources().getColor(R.color.hintColor));
|
|
||||||
createOrganizationButton.setBackground(shape);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
createOrganizationButton.setOnClickListener(createOrgListener);
|
createOrganizationButton.setOnClickListener(createOrgListener);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -109,7 +103,7 @@ public class CreateOrganizationActivity extends BaseActivity {
|
|||||||
|
|
||||||
if(!connToInternet) {
|
if(!connToInternet) {
|
||||||
|
|
||||||
Toasty.info(ctx, getResources().getString(R.string.checkNetConnection));
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -117,7 +111,7 @@ public class CreateOrganizationActivity extends BaseActivity {
|
|||||||
if(!newOrgDesc.equals("")) {
|
if(!newOrgDesc.equals("")) {
|
||||||
if (appUtil.charactersLength(newOrgDesc) > 255) {
|
if (appUtil.charactersLength(newOrgDesc) > 255) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.orgDescError));
|
Toasty.warning(ctx, getString(R.string.orgDescError));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -125,12 +119,12 @@ public class CreateOrganizationActivity extends BaseActivity {
|
|||||||
|
|
||||||
if(newOrgName.equals("")) {
|
if(newOrgName.equals("")) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.orgNameErrorEmpty));
|
Toasty.error(ctx, getString(R.string.orgNameErrorEmpty));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(!appUtil.checkStrings(newOrgName)) {
|
else if(!appUtil.checkStrings(newOrgName)) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.orgNameErrorInvalid));
|
Toasty.warning(ctx, getString(R.string.orgNameErrorInvalid));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -161,7 +155,7 @@ public class CreateOrganizationActivity extends BaseActivity {
|
|||||||
TinyDB tinyDb = new TinyDB(appCtx);
|
TinyDB tinyDb = new TinyDB(appCtx);
|
||||||
tinyDb.putBoolean("orgCreated", true);
|
tinyDb.putBoolean("orgCreated", true);
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.info(ctx, getString(R.string.orgCreated));
|
Toasty.success(ctx, getString(R.string.orgCreated));
|
||||||
finish();
|
finish();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -177,24 +171,24 @@ public class CreateOrganizationActivity extends BaseActivity {
|
|||||||
else if(response.code() == 409) {
|
else if(response.code() == 409) {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.info(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.info(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.info(ctx, getString(R.string.apiNotFound));
|
Toasty.warning(ctx, getString(R.string.apiNotFound));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.info(ctx, getString(R.string.orgCreatedError));
|
Toasty.error(ctx, getString(R.string.orgCreatedError));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -213,21 +207,11 @@ public class CreateOrganizationActivity extends BaseActivity {
|
|||||||
private void disableProcessButton() {
|
private void disableProcessButton() {
|
||||||
|
|
||||||
createOrganizationButton.setEnabled(false);
|
createOrganizationButton.setEnabled(false);
|
||||||
GradientDrawable shape = new GradientDrawable();
|
|
||||||
shape.setCornerRadius( 8 );
|
|
||||||
shape.setColor(getResources().getColor(R.color.hintColor));
|
|
||||||
createOrganizationButton.setBackground(shape);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableProcessButton() {
|
private void enableProcessButton() {
|
||||||
|
|
||||||
createOrganizationButton.setEnabled(true);
|
createOrganizationButton.setEnabled(true);
|
||||||
GradientDrawable shape = new GradientDrawable();
|
|
||||||
shape.setCornerRadius( 8 );
|
|
||||||
shape.setColor(getResources().getColor(R.color.btnBackground));
|
|
||||||
createOrganizationButton.setBackground(shape);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package org.mian.gitnex.activities;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
import android.graphics.drawable.GradientDrawable;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -88,7 +87,7 @@ public class CreateReleaseActivity extends BaseActivity {
|
|||||||
closeActivity.setOnClickListener(onClickListener);
|
closeActivity.setOnClickListener(onClickListener);
|
||||||
|
|
||||||
releaseBranch = findViewById(R.id.releaseBranch);
|
releaseBranch = findViewById(R.id.releaseBranch);
|
||||||
releaseBranch.getBackground().setColorFilter(getResources().getColor(R.color.white), PorterDuff.Mode.SRC_ATOP);
|
releaseBranch.getBackground().setColorFilter(getResources().getColor(R.color.colorWhite), PorterDuff.Mode.SRC_ATOP);
|
||||||
getBranches(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), repoOwner, repoName);
|
getBranches(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), repoOwner, repoName);
|
||||||
releaseBranch.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
releaseBranch.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -108,20 +107,15 @@ public class CreateReleaseActivity extends BaseActivity {
|
|||||||
if(!connToInternet) {
|
if(!connToInternet) {
|
||||||
|
|
||||||
disableProcessButton();
|
disableProcessButton();
|
||||||
|
}
|
||||||
} else {
|
else {
|
||||||
|
|
||||||
createNewRelease.setOnClickListener(createReleaseListener);
|
createNewRelease.setOnClickListener(createReleaseListener);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private View.OnClickListener createReleaseListener = new View.OnClickListener() {
|
private View.OnClickListener createReleaseListener = v -> processNewRelease();
|
||||||
public void onClick(View v) {
|
|
||||||
processNewRelease();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private void processNewRelease() {
|
private void processNewRelease() {
|
||||||
|
|
||||||
@ -145,21 +139,21 @@ public class CreateReleaseActivity extends BaseActivity {
|
|||||||
|
|
||||||
if(!connToInternet) {
|
if(!connToInternet) {
|
||||||
|
|
||||||
Toasty.info(ctx, getResources().getString(R.string.checkNetConnection));
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(newReleaseTagName.equals("")) {
|
if(newReleaseTagName.equals("")) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.tagNameErrorEmpty));
|
Toasty.error(ctx, getString(R.string.tagNameErrorEmpty));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(newReleaseTitle.equals("")) {
|
if(newReleaseTitle.equals("")) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.titleErrorEmpty));
|
Toasty.error(ctx, getString(R.string.titleErrorEmpty));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -189,7 +183,7 @@ public class CreateReleaseActivity extends BaseActivity {
|
|||||||
|
|
||||||
TinyDB tinyDb = new TinyDB(appCtx);
|
TinyDB tinyDb = new TinyDB(appCtx);
|
||||||
tinyDb.putBoolean("updateReleases", true);
|
tinyDb.putBoolean("updateReleases", true);
|
||||||
Toasty.info(ctx, getString(R.string.releaseCreatedText));
|
Toasty.success(ctx, getString(R.string.releaseCreatedText));
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
finish();
|
finish();
|
||||||
|
|
||||||
@ -206,19 +200,19 @@ public class CreateReleaseActivity extends BaseActivity {
|
|||||||
else if(response.code() == 403) {
|
else if(response.code() == 403) {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.info(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.info(ctx, ctx.getString(R.string.apiNotFound));
|
Toasty.warning(ctx, ctx.getString(R.string.apiNotFound));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.info(ctx, ctx.getString(R.string.genericError));
|
Toasty.error(ctx, ctx.getString(R.string.genericError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,21 +296,11 @@ public class CreateReleaseActivity extends BaseActivity {
|
|||||||
private void disableProcessButton() {
|
private void disableProcessButton() {
|
||||||
|
|
||||||
createNewRelease.setEnabled(false);
|
createNewRelease.setEnabled(false);
|
||||||
GradientDrawable shape = new GradientDrawable();
|
|
||||||
shape.setCornerRadius( 8 );
|
|
||||||
shape.setColor(getResources().getColor(R.color.hintColor));
|
|
||||||
createNewRelease.setBackground(shape);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableProcessButton() {
|
private void enableProcessButton() {
|
||||||
|
|
||||||
createNewRelease.setEnabled(true);
|
createNewRelease.setEnabled(true);
|
||||||
GradientDrawable shape = new GradientDrawable();
|
|
||||||
shape.setCornerRadius( 8 );
|
|
||||||
shape.setColor(getResources().getColor(R.color.btnBackground));
|
|
||||||
createNewRelease.setBackground(shape);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package org.mian.gitnex.activities;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
import android.graphics.drawable.GradientDrawable;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -87,8 +86,9 @@ public class CreateRepoActivity extends BaseActivity {
|
|||||||
closeActivity.setOnClickListener(onClickListener);
|
closeActivity.setOnClickListener(onClickListener);
|
||||||
|
|
||||||
spinner = findViewById(R.id.ownerSpinner);
|
spinner = findViewById(R.id.ownerSpinner);
|
||||||
spinner.getBackground().setColorFilter(getResources().getColor(R.color.white), PorterDuff.Mode.SRC_ATOP);
|
spinner.getBackground().setColorFilter(getResources().getColor(R.color.colorWhite), PorterDuff.Mode.SRC_ATOP);
|
||||||
getOrganizations(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), userLogin);
|
getOrganizations(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), userLogin);
|
||||||
|
|
||||||
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||||
@ -107,12 +107,10 @@ public class CreateRepoActivity extends BaseActivity {
|
|||||||
if(!connToInternet) {
|
if(!connToInternet) {
|
||||||
|
|
||||||
disableProcessButton();
|
disableProcessButton();
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
createRepo.setOnClickListener(createRepoListener);
|
createRepo.setOnClickListener(createRepoListener);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,45 +136,38 @@ public class CreateRepoActivity extends BaseActivity {
|
|||||||
|
|
||||||
if(!connToInternet) {
|
if(!connToInternet) {
|
||||||
|
|
||||||
Toasty.info(ctx, getResources().getString(R.string.checkNetConnection));
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!newRepoDesc.equals("")) {
|
if(!newRepoDesc.equals("")) {
|
||||||
if (appUtil.charactersLength(newRepoDesc) > 255) {
|
if (appUtil.charactersLength(newRepoDesc) > 255) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.repoDescError));
|
Toasty.warning(ctx, getString(R.string.repoDescError));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(newRepoName.equals("")) {
|
if(newRepoName.equals("")) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.repoNameErrorEmpty));
|
Toasty.error(ctx, getString(R.string.repoNameErrorEmpty));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(!appUtil.checkStrings(newRepoName)) {
|
else if(!appUtil.checkStrings(newRepoName)) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.repoNameErrorInvalid));
|
Toasty.warning(ctx, getString(R.string.repoNameErrorInvalid));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (reservedRepoNames.contains(newRepoName)) {
|
else if (reservedRepoNames.contains(newRepoName)) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.repoNameErrorReservedName));
|
Toasty.warning(ctx, getString(R.string.repoNameErrorReservedName));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (reservedRepoPatterns.matcher(newRepoName).find()) {
|
else if (reservedRepoPatterns.matcher(newRepoName).find()) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.repoNameErrorReservedPatterns));
|
Toasty.warning(ctx, getString(R.string.repoNameErrorReservedPatterns));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
disableProcessButton();
|
disableProcessButton();
|
||||||
createNewRepository(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), loginUid, newRepoName, newRepoDesc, repoOwner, newRepoAccess);
|
createNewRepository(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), loginUid, newRepoName, newRepoDesc, repoOwner, newRepoAccess);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,7 +182,6 @@ public class CreateRepoActivity extends BaseActivity {
|
|||||||
.getInstance(instanceUrl, ctx)
|
.getInstance(instanceUrl, ctx)
|
||||||
.getApiInterface()
|
.getApiInterface()
|
||||||
.createNewUserRepository(token, createRepository);
|
.createNewUserRepository(token, createRepository);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
@ -199,7 +189,6 @@ public class CreateRepoActivity extends BaseActivity {
|
|||||||
.getInstance(instanceUrl, ctx)
|
.getInstance(instanceUrl, ctx)
|
||||||
.getApiInterface()
|
.getApiInterface()
|
||||||
.createNewUserOrgRepository(token, repoOwner, createRepository);
|
.createNewUserOrgRepository(token, repoOwner, createRepository);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
call.enqueue(new Callback<OrganizationRepository>() {
|
call.enqueue(new Callback<OrganizationRepository>() {
|
||||||
@ -211,7 +200,7 @@ public class CreateRepoActivity extends BaseActivity {
|
|||||||
|
|
||||||
TinyDB tinyDb = new TinyDB(appCtx);
|
TinyDB tinyDb = new TinyDB(appCtx);
|
||||||
tinyDb.putBoolean("repoCreated", true);
|
tinyDb.putBoolean("repoCreated", true);
|
||||||
Toasty.info(ctx, getString(R.string.repoCreated));
|
Toasty.success(ctx, getString(R.string.repoCreated));
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
@ -222,25 +211,23 @@ public class CreateRepoActivity 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.info(ctx, getString(R.string.repoExistsError));
|
Toasty.warning(ctx, getString(R.string.repoExistsError));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.info(ctx, getString(R.string.repoCreatedError));
|
Toasty.error(ctx, getString(R.string.repoCreatedError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@NonNull Call<OrganizationRepository> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<OrganizationRepository> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
Log.e("onFailure", t.toString());
|
Log.e("onFailure", t.toString());
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
}
|
}
|
||||||
@ -271,13 +258,16 @@ 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++) {
|
||||||
|
|
||||||
if(!tinyDb.getString("organizationId").isEmpty()) {
|
if(!tinyDb.getString("organizationId").isEmpty()) {
|
||||||
|
|
||||||
if (Integer.parseInt(tinyDb.getString("organizationId")) == organizationsList_.get(i).getId()) {
|
if (Integer.parseInt(tinyDb.getString("organizationId")) == organizationsList_.get(i).getId()) {
|
||||||
organizationId = i + 1;
|
organizationId = i + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OrgOwner data = new OrgOwner(
|
OrgOwner data = new OrgOwner(
|
||||||
organizationsList_.get(i).getUsername()
|
organizationsList_.get(i).getUsername()
|
||||||
);
|
);
|
||||||
@ -293,6 +283,7 @@ public class CreateRepoActivity extends BaseActivity {
|
|||||||
spinner.setAdapter(adapter);
|
spinner.setAdapter(adapter);
|
||||||
|
|
||||||
if (tinyDb.getBoolean("organizationAction") & organizationId != 0) {
|
if (tinyDb.getBoolean("organizationAction") & organizationId != 0) {
|
||||||
|
|
||||||
spinner.setSelection(organizationId);
|
spinner.setSelection(organizationId);
|
||||||
tinyDb.putBoolean("organizationAction", false);
|
tinyDb.putBoolean("organizationAction", false);
|
||||||
}
|
}
|
||||||
@ -308,13 +299,13 @@ public class CreateRepoActivity 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));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@NonNull Call<List<OrgOwner>> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<List<OrgOwner>> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
Log.e("onFailure", t.toString());
|
Log.e("onFailure", t.toString());
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
}
|
}
|
||||||
@ -322,32 +313,18 @@ public class CreateRepoActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initCloseListener() {
|
private void initCloseListener() {
|
||||||
onClickListener = new View.OnClickListener() {
|
|
||||||
@Override
|
onClickListener = view -> finish();
|
||||||
public void onClick(View view) {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void disableProcessButton() {
|
private void disableProcessButton() {
|
||||||
|
|
||||||
createRepo.setEnabled(false);
|
createRepo.setEnabled(false);
|
||||||
GradientDrawable shape = new GradientDrawable();
|
|
||||||
shape.setCornerRadius( 8 );
|
|
||||||
shape.setColor(getResources().getColor(R.color.hintColor));
|
|
||||||
createRepo.setBackground(shape);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableProcessButton() {
|
private void enableProcessButton() {
|
||||||
|
|
||||||
createRepo.setEnabled(true);
|
createRepo.setEnabled(true);
|
||||||
GradientDrawable shape = new GradientDrawable();
|
|
||||||
shape.setCornerRadius( 8 );
|
|
||||||
shape.setColor(getResources().getColor(R.color.btnBackground));
|
|
||||||
createRepo.setBackground(shape);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.mian.gitnex.activities;
|
package org.mian.gitnex.activities;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.graphics.drawable.GradientDrawable;
|
import android.graphics.drawable.GradientDrawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@ -98,134 +97,120 @@ public class CreateTeamByOrgActivity extends BaseActivity implements View.OnClic
|
|||||||
initCloseListener();
|
initCloseListener();
|
||||||
closeActivity.setOnClickListener(onClickListener);
|
closeActivity.setOnClickListener(onClickListener);
|
||||||
|
|
||||||
teamPermission.setOnClickListener(new View.OnClickListener() {
|
teamPermission.setOnClickListener(view -> {
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
|
|
||||||
AlertDialog.Builder pBuilder = new AlertDialog.Builder(ctx);
|
AlertDialog.Builder pBuilder = new AlertDialog.Builder(ctx);
|
||||||
|
|
||||||
pBuilder.setTitle(R.string.newTeamPermission);
|
|
||||||
if(permissionSelectedChoice != -1) {
|
|
||||||
pBuilder.setCancelable(true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
pBuilder.setCancelable(false);
|
|
||||||
}
|
|
||||||
pBuilder.setSingleChoiceItems(permissionList, permissionSelectedChoice, new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
|
||||||
|
|
||||||
permissionSelectedChoice = i;
|
|
||||||
teamPermission.setText(permissionList[i]);
|
|
||||||
|
|
||||||
if(permissionList[i].equals("Read")) {
|
|
||||||
teamPermissionDetail.setVisibility(View.VISIBLE);
|
|
||||||
teamPermissionDetail.setText(R.string.newTeamPermissionRead);
|
|
||||||
}
|
|
||||||
else if(permissionList[i].equals("Write")) {
|
|
||||||
teamPermissionDetail.setVisibility(View.VISIBLE);
|
|
||||||
teamPermissionDetail.setText(R.string.newTeamPermissionWrite);
|
|
||||||
}
|
|
||||||
else if(permissionList[i].equals("Admin")) {
|
|
||||||
teamPermissionDetail.setVisibility(View.VISIBLE);
|
|
||||||
teamPermissionDetail.setText(R.string.newTeamPermissionAdmin);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
teamPermissionDetail.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
dialogInterface.dismiss();
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
AlertDialog pDialog = pBuilder.create();
|
|
||||||
pDialog.show();
|
|
||||||
|
|
||||||
|
pBuilder.setTitle(R.string.newTeamPermission);
|
||||||
|
if(permissionSelectedChoice != -1) {
|
||||||
|
pBuilder.setCancelable(true);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
pBuilder.setCancelable(false);
|
||||||
|
}
|
||||||
|
pBuilder.setSingleChoiceItems(permissionList, permissionSelectedChoice, (dialogInterface, i) -> {
|
||||||
|
|
||||||
|
permissionSelectedChoice = i;
|
||||||
|
teamPermission.setText(permissionList[i]);
|
||||||
|
|
||||||
|
switch(permissionList[i]) {
|
||||||
|
case "Read":
|
||||||
|
|
||||||
|
teamPermissionDetail.setVisibility(View.VISIBLE);
|
||||||
|
teamPermissionDetail.setText(R.string.newTeamPermissionRead);
|
||||||
|
break;
|
||||||
|
case "Write":
|
||||||
|
|
||||||
|
teamPermissionDetail.setVisibility(View.VISIBLE);
|
||||||
|
teamPermissionDetail.setText(R.string.newTeamPermissionWrite);
|
||||||
|
break;
|
||||||
|
case "Admin":
|
||||||
|
|
||||||
|
teamPermissionDetail.setVisibility(View.VISIBLE);
|
||||||
|
teamPermissionDetail.setText(R.string.newTeamPermissionAdmin);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
|
||||||
|
teamPermissionDetail.setVisibility(View.GONE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
dialogInterface.dismiss();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
AlertDialog pDialog = pBuilder.create();
|
||||||
|
pDialog.show();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
teamAccessControls.setOnClickListener(new View.OnClickListener() {
|
teamAccessControls.setOnClickListener(v -> {
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
|
|
||||||
teamAccessControls.setText("");
|
teamAccessControls.setText("");
|
||||||
teamAccessControlsArray.setText("");
|
teamAccessControlsArray.setText("");
|
||||||
pushAccessList = Arrays.asList(accessControlsList);
|
pushAccessList = Arrays.asList(accessControlsList);
|
||||||
|
|
||||||
AlertDialog.Builder aDialogBuilder = new AlertDialog.Builder(ctx);
|
AlertDialog.Builder aDialogBuilder = new AlertDialog.Builder(ctx);
|
||||||
|
|
||||||
aDialogBuilder.setMultiChoiceItems(accessControlsList, selectedAccessControlsTrueFalse, new DialogInterface.OnMultiChoiceClickListener() {
|
aDialogBuilder.setMultiChoiceItems(accessControlsList, selectedAccessControlsTrueFalse, (dialog, which, isChecked) -> {
|
||||||
|
|
||||||
@Override
|
})
|
||||||
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
|
.setCancelable(false)
|
||||||
|
.setTitle(R.string.newTeamAccessControls)
|
||||||
|
.setPositiveButton(R.string.okButton, (dialog, which) -> {
|
||||||
|
|
||||||
|
int selectedVal = 0;
|
||||||
|
while(selectedVal < selectedAccessControlsTrueFalse.length)
|
||||||
|
{
|
||||||
|
boolean value = selectedAccessControlsTrueFalse[selectedVal];
|
||||||
|
|
||||||
|
String repoCode = "";
|
||||||
|
if(selectedVal == 0) {
|
||||||
|
repoCode = "repo.code";
|
||||||
|
}
|
||||||
|
if(selectedVal == 1) {
|
||||||
|
repoCode = "repo.issues";
|
||||||
|
}
|
||||||
|
if(selectedVal == 2) {
|
||||||
|
repoCode = "repo.pulls";
|
||||||
|
}
|
||||||
|
if(selectedVal == 3) {
|
||||||
|
repoCode = "repo.releases";
|
||||||
|
}
|
||||||
|
if(selectedVal == 4) {
|
||||||
|
repoCode = "repo.wiki";
|
||||||
|
}
|
||||||
|
if(selectedVal == 5) {
|
||||||
|
repoCode = "repo.ext_wiki";
|
||||||
|
}
|
||||||
|
if(selectedVal == 6) {
|
||||||
|
repoCode = "repo.ext_issues";
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
if(value){
|
||||||
.setCancelable(false)
|
teamAccessControls.setText(getString(R.string.newTeamPermissionValues, teamAccessControls.getText(), pushAccessList.get(selectedVal)));
|
||||||
.setTitle(R.string.newTeamAccessControls)
|
teamAccessControlsArray.setText(getString(R.string.newTeamPermissionValuesFinal, teamAccessControlsArray.getText(), repoCode));
|
||||||
.setPositiveButton(R.string.okButton, new DialogInterface.OnClickListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
|
|
||||||
int selectedVal = 0;
|
|
||||||
while(selectedVal < selectedAccessControlsTrueFalse.length)
|
|
||||||
{
|
|
||||||
boolean value = selectedAccessControlsTrueFalse[selectedVal];
|
|
||||||
|
|
||||||
String repoCode = "";
|
|
||||||
if(selectedVal == 0) {
|
|
||||||
repoCode = "repo.code";
|
|
||||||
}
|
|
||||||
if(selectedVal == 1) {
|
|
||||||
repoCode = "repo.issues";
|
|
||||||
}
|
|
||||||
if(selectedVal == 2) {
|
|
||||||
repoCode = "repo.pulls";
|
|
||||||
}
|
|
||||||
if(selectedVal == 3) {
|
|
||||||
repoCode = "repo.releases";
|
|
||||||
}
|
|
||||||
if(selectedVal == 4) {
|
|
||||||
repoCode = "repo.wiki";
|
|
||||||
}
|
|
||||||
if(selectedVal == 5) {
|
|
||||||
repoCode = "repo.ext_wiki";
|
|
||||||
}
|
|
||||||
if(selectedVal == 6) {
|
|
||||||
repoCode = "repo.ext_issues";
|
|
||||||
}
|
|
||||||
|
|
||||||
if(value){
|
|
||||||
teamAccessControls.setText(getString(R.string.newTeamPermissionValues, teamAccessControls.getText(), pushAccessList.get(selectedVal)));
|
|
||||||
teamAccessControlsArray.setText(getString(R.string.newTeamPermissionValuesFinal, teamAccessControlsArray.getText(), repoCode));
|
|
||||||
}
|
|
||||||
|
|
||||||
selectedVal++;
|
|
||||||
}
|
|
||||||
|
|
||||||
String data = String.valueOf(teamAccessControls.getText());
|
|
||||||
if(!data.equals("")) {
|
|
||||||
teamAccessControls.setText(data.substring(0, data.length() - 2));
|
|
||||||
}
|
|
||||||
|
|
||||||
String dataArray = String.valueOf(teamAccessControlsArray.getText());
|
|
||||||
if(!dataArray.equals("")) {
|
|
||||||
teamAccessControlsArray.setText(dataArray.substring(0, dataArray.length() - 2));
|
|
||||||
}
|
|
||||||
//Log.i("orgName", String.valueOf(teamAccessControlsArray.getText()));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
selectedVal++;
|
||||||
|
}
|
||||||
|
|
||||||
});
|
String data = String.valueOf(teamAccessControls.getText());
|
||||||
|
if(!data.equals("")) {
|
||||||
|
teamAccessControls.setText(data.substring(0, data.length() - 2));
|
||||||
|
}
|
||||||
|
|
||||||
AlertDialog aDialog = aDialogBuilder.create();
|
String dataArray = String.valueOf(teamAccessControlsArray.getText());
|
||||||
aDialog.show();
|
if(!dataArray.equals("")) {
|
||||||
}
|
teamAccessControlsArray.setText(dataArray.substring(0, dataArray.length() - 2));
|
||||||
|
}
|
||||||
|
//Log.i("orgName", String.valueOf(teamAccessControlsArray.getText()));
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
AlertDialog aDialog = aDialogBuilder.create();
|
||||||
|
aDialog.show();
|
||||||
});
|
});
|
||||||
|
|
||||||
createTeamButton.setEnabled(false);
|
createTeamButton.setEnabled(false);
|
||||||
@ -264,21 +249,21 @@ public class CreateTeamByOrgActivity extends BaseActivity implements View.OnClic
|
|||||||
|
|
||||||
if(!connToInternet) {
|
if(!connToInternet) {
|
||||||
|
|
||||||
Toasty.info(ctx, getResources().getString(R.string.checkNetConnection));
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newTeamName.equals("")) {
|
if (newTeamName.equals("")) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.teamNameEmpty));
|
Toasty.error(ctx, getString(R.string.teamNameEmpty));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!appUtil.checkStringsWithAlphaNumericDashDotUnderscore(newTeamName)) {
|
if(!appUtil.checkStringsWithAlphaNumericDashDotUnderscore(newTeamName)) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.teamNameError));
|
Toasty.warning(ctx, getString(R.string.teamNameError));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -286,12 +271,12 @@ public class CreateTeamByOrgActivity extends BaseActivity implements View.OnClic
|
|||||||
if(!newTeamDesc.equals("")) {
|
if(!newTeamDesc.equals("")) {
|
||||||
|
|
||||||
if(!appUtil.checkStrings(newTeamDesc)) {
|
if(!appUtil.checkStrings(newTeamDesc)) {
|
||||||
Toasty.info(ctx, getString(R.string.teamDescError));
|
Toasty.warning(ctx, getString(R.string.teamDescError));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(newTeamDesc.length() > 100) {
|
if(newTeamDesc.length() > 100) {
|
||||||
Toasty.info(ctx, getString(R.string.teamDescLimit));
|
Toasty.warning(ctx, getString(R.string.teamDescLimit));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,7 +284,7 @@ public class CreateTeamByOrgActivity extends BaseActivity implements View.OnClic
|
|||||||
|
|
||||||
if (newTeamPermission.equals("")) {
|
if (newTeamPermission.equals("")) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.teamPermissionEmpty));
|
Toasty.error(ctx, getString(R.string.teamPermissionEmpty));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -336,16 +321,14 @@ public class CreateTeamByOrgActivity extends BaseActivity implements View.OnClic
|
|||||||
TinyDB tinyDb = new TinyDB(appCtx);
|
TinyDB tinyDb = new TinyDB(appCtx);
|
||||||
tinyDb.putBoolean("resumeTeams", true);
|
tinyDb.putBoolean("resumeTeams", true);
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.teamCreated));
|
Toasty.success(ctx, getString(R.string.teamCreated));
|
||||||
finish();
|
finish();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response2.code() == 404) {
|
else if(response2.code() == 404) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.apiNotFound));
|
Toasty.warning(ctx, getString(R.string.apiNotFound));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response2.code() == 401) {
|
else if(response2.code() == 401) {
|
||||||
|
|
||||||
@ -353,12 +336,10 @@ public class CreateTeamByOrgActivity 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 {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.teamCreatedError));
|
Toasty.error(ctx, getString(R.string.teamCreatedError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -373,19 +354,15 @@ public class CreateTeamByOrgActivity extends BaseActivity implements View.OnClic
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
|
||||||
if(v == createTeamButton) {
|
if(v == createTeamButton) {
|
||||||
processCreateTeam();
|
processCreateTeam();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initCloseListener() {
|
private void initCloseListener() {
|
||||||
onClickListener = new View.OnClickListener() {
|
|
||||||
@Override
|
onClickListener = view -> finish();
|
||||||
public void onClick(View view) {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -58,11 +58,7 @@ public class CreditsActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initCloseListener() {
|
private void initCloseListener() {
|
||||||
onClickListener = new View.OnClickListener() {
|
|
||||||
@Override
|
onClickListener = view -> finish();
|
||||||
public void onClick(View view) {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import android.annotation.SuppressLint;
|
|||||||
import android.app.DatePickerDialog;
|
import android.app.DatePickerDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
import android.graphics.drawable.GradientDrawable;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -109,7 +108,7 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
|
|||||||
loadCollaboratorsList();
|
loadCollaboratorsList();
|
||||||
|
|
||||||
editIssueMilestoneSpinner = findViewById(R.id.editIssueMilestoneSpinner);
|
editIssueMilestoneSpinner = findViewById(R.id.editIssueMilestoneSpinner);
|
||||||
editIssueMilestoneSpinner.getBackground().setColorFilter(getResources().getColor(R.color.white), PorterDuff.Mode.SRC_ATOP);
|
editIssueMilestoneSpinner.getBackground().setColorFilter(getResources().getColor(R.color.colorWhite), PorterDuff.Mode.SRC_ATOP);
|
||||||
|
|
||||||
editIssueDescription.setMentionAdapter(defaultMentionAdapter);
|
editIssueDescription.setMentionAdapter(defaultMentionAdapter);
|
||||||
|
|
||||||
@ -217,14 +216,14 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
|
|||||||
|
|
||||||
if(!connToInternet) {
|
if(!connToInternet) {
|
||||||
|
|
||||||
Toasty.info(ctx, getResources().getString(R.string.checkNetConnection));
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (editIssueTitleForm.equals("")) {
|
if (editIssueTitleForm.equals("")) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.issueTitleEmpty));
|
Toasty.error(ctx, getString(R.string.issueTitleEmpty));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -267,10 +266,10 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
|
|||||||
if(response.code() == 201) {
|
if(response.code() == 201) {
|
||||||
|
|
||||||
if(tinyDb.getString("issueType").equalsIgnoreCase("Pull")) {
|
if(tinyDb.getString("issueType").equalsIgnoreCase("Pull")) {
|
||||||
Toasty.info(ctx, getString(R.string.editPrSuccessMessage));
|
Toasty.success(ctx, getString(R.string.editPrSuccessMessage));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Toasty.info(ctx, getString(R.string.editIssueSuccessMessage));
|
Toasty.success(ctx, getString(R.string.editIssueSuccessMessage));
|
||||||
}
|
}
|
||||||
|
|
||||||
tinyDb.putBoolean("issueEdited", true);
|
tinyDb.putBoolean("issueEdited", true);
|
||||||
@ -290,7 +289,7 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
|
|||||||
else {
|
else {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.info(ctx, getString(R.string.genericError));
|
Toasty.error(ctx, getString(R.string.genericError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -427,7 +426,6 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
|
|||||||
@SuppressLint("SimpleDateFormat") DateFormat formatter = new SimpleDateFormat("yyyy-M-dd");
|
@SuppressLint("SimpleDateFormat") DateFormat formatter = new SimpleDateFormat("yyyy-M-dd");
|
||||||
String dueDate = formatter.format(response.body().getDue_date());
|
String dueDate = formatter.format(response.body().getDue_date());
|
||||||
editIssueDueDate.setText(dueDate);
|
editIssueDueDate.setText(dueDate);
|
||||||
|
|
||||||
}
|
}
|
||||||
//enableProcessButton();
|
//enableProcessButton();
|
||||||
|
|
||||||
@ -438,12 +436,10 @@ 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 {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.genericError));
|
Toasty.error(ctx, getString(R.string.genericError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -459,21 +455,11 @@ public class EditIssueActivity extends BaseActivity implements View.OnClickListe
|
|||||||
private void disableProcessButton() {
|
private void disableProcessButton() {
|
||||||
|
|
||||||
editIssueButton.setEnabled(false);
|
editIssueButton.setEnabled(false);
|
||||||
GradientDrawable shape = new GradientDrawable();
|
|
||||||
shape.setCornerRadius( 8 );
|
|
||||||
shape.setColor(getResources().getColor(R.color.hintColor));
|
|
||||||
editIssueButton.setBackground(shape);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableProcessButton() {
|
private void enableProcessButton() {
|
||||||
|
|
||||||
editIssueButton.setEnabled(true);
|
editIssueButton.setEnabled(true);
|
||||||
GradientDrawable shape = new GradientDrawable();
|
|
||||||
shape.setCornerRadius( 8 );
|
|
||||||
shape.setColor(getResources().getColor(R.color.btnBackground));
|
|
||||||
editIssueButton.setBackground(shape);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -139,17 +139,17 @@ public class FileDiffActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
else if(response.code() == 403) {
|
else if(response.code() == 403) {
|
||||||
|
|
||||||
Toasty.info(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.info(ctx, ctx.getString(R.string.apiNotFound));
|
Toasty.warning(ctx, ctx.getString(R.string.apiNotFound));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.labelGeneralError));
|
Toasty.error(ctx, getString(R.string.labelGeneralError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,14 +166,10 @@ public class FileDiffActivity extends BaseActivity {
|
|||||||
|
|
||||||
private void initCloseListener() {
|
private void initCloseListener() {
|
||||||
|
|
||||||
onClickListener = new View.OnClickListener() {
|
onClickListener = view -> {
|
||||||
|
|
||||||
@Override
|
getIntent().removeExtra("singleFileName");
|
||||||
public void onClick(View view) {
|
finish();
|
||||||
|
|
||||||
getIntent().removeExtra("singleFileName");
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import android.graphics.drawable.BitmapDrawable;
|
|||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.Spanned;
|
||||||
import android.text.method.ScrollingMovementMethod;
|
import android.text.method.ScrollingMovementMethod;
|
||||||
import android.util.Base64;
|
import android.util.Base64;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@ -42,7 +43,24 @@ import java.io.IOException;
|
|||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import io.noties.markwon.AbstractMarkwonPlugin;
|
||||||
|
import io.noties.markwon.Markwon;
|
||||||
|
import io.noties.markwon.core.CorePlugin;
|
||||||
|
import io.noties.markwon.core.MarkwonTheme;
|
||||||
|
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
||||||
|
import io.noties.markwon.ext.tables.TablePlugin;
|
||||||
|
import io.noties.markwon.ext.tasklist.TaskListPlugin;
|
||||||
|
import io.noties.markwon.html.HtmlPlugin;
|
||||||
|
import io.noties.markwon.image.DefaultMediaDecoder;
|
||||||
|
import io.noties.markwon.image.ImageItem;
|
||||||
|
import io.noties.markwon.image.ImagesPlugin;
|
||||||
|
import io.noties.markwon.image.SchemeHandler;
|
||||||
|
import io.noties.markwon.image.gif.GifMediaDecoder;
|
||||||
|
import io.noties.markwon.image.svg.SvgMediaDecoder;
|
||||||
|
import io.noties.markwon.linkify.LinkifyPlugin;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
import retrofit2.Callback;
|
||||||
|
|
||||||
@ -65,6 +83,9 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
|
|||||||
private LinearLayout pdfViewFrame;
|
private LinearLayout pdfViewFrame;
|
||||||
private byte[] decodedPdf;
|
private byte[] decodedPdf;
|
||||||
private Boolean pdfNightMode;
|
private Boolean pdfNightMode;
|
||||||
|
private String singleFileName;
|
||||||
|
private AppUtil appUtil;
|
||||||
|
private TinyDB tinyDb;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getLayoutResourceId() {
|
protected int getLayoutResourceId() {
|
||||||
@ -77,11 +98,12 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
|
|||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
appCtx = getApplicationContext();
|
appCtx = getApplicationContext();
|
||||||
|
appUtil = new AppUtil();
|
||||||
|
tinyDb = new TinyDB(appCtx);
|
||||||
|
|
||||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
final TinyDB tinyDb = new TinyDB(appCtx);
|
|
||||||
String repoFullName = tinyDb.getString("repoFullName");
|
String repoFullName = tinyDb.getString("repoFullName");
|
||||||
String repoBranch = tinyDb.getString("repoBranch");
|
String repoBranch = tinyDb.getString("repoBranch");
|
||||||
String[] parts = repoFullName.split("/");
|
String[] parts = repoFullName.split("/");
|
||||||
@ -91,6 +113,8 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
|
|||||||
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");
|
||||||
|
|
||||||
|
tinyDb.putBoolean("enableMarkdownInFileView", false);
|
||||||
|
|
||||||
ImageView closeActivity = findViewById(R.id.close);
|
ImageView closeActivity = findViewById(R.id.close);
|
||||||
singleFileContents = findViewById(R.id.singleFileContents);
|
singleFileContents = findViewById(R.id.singleFileContents);
|
||||||
singleCodeContents = findViewById(R.id.singleCodeContents);
|
singleCodeContents = findViewById(R.id.singleCodeContents);
|
||||||
@ -100,7 +124,7 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
|
|||||||
pdfViewFrame = findViewById(R.id.pdfViewFrame);
|
pdfViewFrame = findViewById(R.id.pdfViewFrame);
|
||||||
singleFileContentsFrame = findViewById(R.id.singleFileContentsFrame);
|
singleFileContentsFrame = findViewById(R.id.singleFileContentsFrame);
|
||||||
|
|
||||||
String singleFileName = getIntent().getStringExtra("singleFileName");
|
singleFileName = getIntent().getStringExtra("singleFileName");
|
||||||
|
|
||||||
TextView toolbar_title = findViewById(R.id.toolbar_title);
|
TextView toolbar_title = findViewById(R.id.toolbar_title);
|
||||||
toolbar_title.setMovementMethod(new ScrollingMovementMethod());
|
toolbar_title.setMovementMethod(new ScrollingMovementMethod());
|
||||||
@ -119,7 +143,6 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
|
|||||||
}
|
}
|
||||||
catch(UnsupportedEncodingException e) {
|
catch(UnsupportedEncodingException e) {
|
||||||
|
|
||||||
assert singleFileName != null;
|
|
||||||
Log.i("singleFileName", singleFileName);
|
Log.i("singleFileName", singleFileName);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -132,8 +155,6 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
|
|||||||
|
|
||||||
private void getSingleFileContents(String instanceUrl, String token, final String owner, String repo, final String filename, String ref) {
|
private void getSingleFileContents(String instanceUrl, String token, final String owner, String repo, final String filename, String ref) {
|
||||||
|
|
||||||
final TinyDB tinyDb = new TinyDB(appCtx);
|
|
||||||
|
|
||||||
Call<Files> call = RetrofitClient.getInstance(instanceUrl, ctx).getApiInterface().getSingleFileContents(token, owner, repo, filename, ref);
|
Call<Files> call = RetrofitClient.getInstance(instanceUrl, ctx).getApiInterface().getSingleFileContents(token, owner, repo, filename, ref);
|
||||||
|
|
||||||
call.enqueue(new Callback<Files>() {
|
call.enqueue(new Callback<Files>() {
|
||||||
@ -143,7 +164,6 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
|
|||||||
|
|
||||||
if(response.code() == 200) {
|
if(response.code() == 200) {
|
||||||
|
|
||||||
AppUtil appUtil = new AppUtil();
|
|
||||||
assert response.body() != null;
|
assert response.body() != null;
|
||||||
|
|
||||||
if(!response.body().getContent().equals("")) {
|
if(!response.body().getContent().equals("")) {
|
||||||
@ -247,17 +267,17 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
|
|||||||
}
|
}
|
||||||
else if(response.code() == 403) {
|
else if(response.code() == 403) {
|
||||||
|
|
||||||
Toasty.info(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.info(ctx, ctx.getString(R.string.apiNotFound));
|
Toasty.warning(ctx, ctx.getString(R.string.apiNotFound));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.labelGeneralError));
|
Toasty.error(ctx, getString(R.string.labelGeneralError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,6 +297,13 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
|
|||||||
|
|
||||||
MenuInflater inflater = getMenuInflater();
|
MenuInflater inflater = getMenuInflater();
|
||||||
inflater.inflate(R.menu.generic_nav_dotted_menu, menu);
|
inflater.inflate(R.menu.generic_nav_dotted_menu, menu);
|
||||||
|
inflater.inflate(R.menu.files_view_menu, menu);
|
||||||
|
|
||||||
|
String fileExtension = FileUtils.getExtension(singleFileName);
|
||||||
|
if(!fileExtension.equalsIgnoreCase("md")) {
|
||||||
|
menu.getItem(0).setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,11 +314,82 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
|
|||||||
|
|
||||||
switch(id) {
|
switch(id) {
|
||||||
case android.R.id.home:
|
case android.R.id.home:
|
||||||
|
|
||||||
finish();
|
finish();
|
||||||
return true;
|
return true;
|
||||||
case R.id.genericMenu:
|
case R.id.genericMenu:
|
||||||
|
|
||||||
BottomSheetFileViewerFragment bottomSheet = new BottomSheetFileViewerFragment();
|
BottomSheetFileViewerFragment bottomSheet = new BottomSheetFileViewerFragment();
|
||||||
bottomSheet.show(getSupportFragmentManager(), "fileViewerBottomSheet");
|
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;
|
return true;
|
||||||
default:
|
default:
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
@ -312,8 +410,6 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
|
|||||||
|
|
||||||
private void requestFileDownload() {
|
private void requestFileDownload() {
|
||||||
|
|
||||||
final TinyDB tinyDb = new TinyDB(appCtx);
|
|
||||||
|
|
||||||
if(!tinyDb.getString("downloadFileContents").isEmpty()) {
|
if(!tinyDb.getString("downloadFileContents").isEmpty()) {
|
||||||
|
|
||||||
int CREATE_REQUEST_CODE = 40;
|
int CREATE_REQUEST_CODE = 40;
|
||||||
@ -330,7 +426,7 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
|
|||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Toasty.error(ctx, getString(R.string.waitLoadingDownloadFile));
|
Toasty.warning(ctx, getString(R.string.waitLoadingDownloadFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -340,9 +436,7 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
|
|||||||
|
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
|
||||||
final TinyDB tinyDb = new TinyDB(appCtx);
|
if(requestCode == 40 && resultCode == RESULT_OK) {
|
||||||
|
|
||||||
if (requestCode == 40 && resultCode == RESULT_OK) {
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
@ -358,10 +452,10 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
|
|||||||
outputStream.write(dataAsBytes);
|
outputStream.write(dataAsBytes);
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.downloadFileSaved));
|
Toasty.success(ctx, getString(R.string.downloadFileSaved));
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch(IOException e) {
|
||||||
Log.e("errorFileDownloading", Objects.requireNonNull(e.getMessage()));
|
Log.e("errorFileDownloading", Objects.requireNonNull(e.getMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
|||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||||
import com.amulyakhare.textdrawable.TextDrawable;
|
import com.amulyakhare.textdrawable.TextDrawable;
|
||||||
|
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
|
||||||
import com.vdurmont.emoji.EmojiParser;
|
import com.vdurmont.emoji.EmojiParser;
|
||||||
import org.mian.gitnex.R;
|
import org.mian.gitnex.R;
|
||||||
import org.mian.gitnex.adapters.IssueCommentsAdapter;
|
import org.mian.gitnex.adapters.IssueCommentsAdapter;
|
||||||
@ -96,7 +97,7 @@ public class IssueDetailActivity extends BaseActivity {
|
|||||||
private HorizontalScrollView assigneesScrollView;
|
private HorizontalScrollView assigneesScrollView;
|
||||||
private ScrollView scrollViewComments;
|
private ScrollView scrollViewComments;
|
||||||
private TextView issueModified;
|
private TextView issueModified;
|
||||||
private ImageView createNewComment;
|
private ExtendedFloatingActionButton createNewComment;
|
||||||
final Context ctx = this;
|
final Context ctx = this;
|
||||||
private Context appCtx;
|
private Context appCtx;
|
||||||
private LinearLayout labelsLayout;
|
private LinearLayout labelsLayout;
|
||||||
|
@ -2,7 +2,6 @@ package org.mian.gitnex.activities;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.drawable.GradientDrawable;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
@ -13,7 +12,6 @@ import android.widget.Button;
|
|||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.RadioGroup;
|
import android.widget.RadioGroup;
|
||||||
import android.widget.ScrollView;
|
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@ -22,11 +20,12 @@ import com.tooltip.Tooltip;
|
|||||||
import org.mian.gitnex.R;
|
import org.mian.gitnex.R;
|
||||||
import org.mian.gitnex.clients.RetrofitClient;
|
import org.mian.gitnex.clients.RetrofitClient;
|
||||||
import org.mian.gitnex.database.api.UserAccountsApi;
|
import org.mian.gitnex.database.api.UserAccountsApi;
|
||||||
|
import org.mian.gitnex.database.models.UserAccount;
|
||||||
import org.mian.gitnex.helpers.AppUtil;
|
import org.mian.gitnex.helpers.AppUtil;
|
||||||
import org.mian.gitnex.helpers.NetworkObserver;
|
import org.mian.gitnex.helpers.NetworkObserver;
|
||||||
import org.mian.gitnex.helpers.PathsHelper;
|
import org.mian.gitnex.helpers.PathsHelper;
|
||||||
import org.mian.gitnex.helpers.SnackBar;
|
|
||||||
import org.mian.gitnex.helpers.TinyDB;
|
import org.mian.gitnex.helpers.TinyDB;
|
||||||
|
import org.mian.gitnex.helpers.Toasty;
|
||||||
import org.mian.gitnex.helpers.UrlHelper;
|
import org.mian.gitnex.helpers.UrlHelper;
|
||||||
import org.mian.gitnex.helpers.Version;
|
import org.mian.gitnex.helpers.Version;
|
||||||
import org.mian.gitnex.models.GiteaVersion;
|
import org.mian.gitnex.models.GiteaVersion;
|
||||||
@ -47,8 +46,9 @@ import retrofit2.Callback;
|
|||||||
|
|
||||||
public class LoginActivity extends BaseActivity {
|
public class LoginActivity extends BaseActivity {
|
||||||
|
|
||||||
private enum Protocol { HTTPS, HTTP }
|
private enum Protocol {HTTPS, HTTP}
|
||||||
private enum LoginType { BASIC, TOKEN }
|
|
||||||
|
private enum LoginType {BASIC, TOKEN}
|
||||||
|
|
||||||
private Context appCtx;
|
private Context appCtx;
|
||||||
private Context ctx = this;
|
private Context ctx = this;
|
||||||
@ -60,7 +60,6 @@ public class LoginActivity extends BaseActivity {
|
|||||||
private TextView otpInfo;
|
private TextView otpInfo;
|
||||||
private RadioGroup loginMethod;
|
private RadioGroup loginMethod;
|
||||||
private String device_id = "token";
|
private String device_id = "token";
|
||||||
private ScrollView layoutView;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getLayoutResourceId() {
|
protected int getLayoutResourceId() {
|
||||||
@ -87,7 +86,6 @@ public class LoginActivity extends BaseActivity {
|
|||||||
protocolSpinner = findViewById(R.id.httpsSpinner);
|
protocolSpinner = findViewById(R.id.httpsSpinner);
|
||||||
loginMethod = findViewById(R.id.loginMethod);
|
loginMethod = findViewById(R.id.loginMethod);
|
||||||
loginTokenCode = findViewById(R.id.loginTokenCode);
|
loginTokenCode = findViewById(R.id.loginTokenCode);
|
||||||
layoutView = findViewById(R.id.loginForm);
|
|
||||||
|
|
||||||
((TextView) findViewById(R.id.appVersion)).setText(AppUtil.getAppVersion(appCtx));
|
((TextView) findViewById(R.id.appVersion)).setText(AppUtil.getAppVersion(appCtx));
|
||||||
|
|
||||||
@ -100,23 +98,20 @@ public class LoginActivity extends BaseActivity {
|
|||||||
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
|
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
|
||||||
|
|
||||||
if(protocolSpinner.getSelectedItem() == Protocol.HTTP) {
|
if(protocolSpinner.getSelectedItem() == Protocol.HTTP) {
|
||||||
SnackBar.warning(ctx, layoutView, getResources().getString(R.string.protocolError));
|
Toasty.warning(ctx, getResources().getString(R.string.protocolError));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onNothingSelected(AdapterView<?> parent) {}
|
public void onNothingSelected(AdapterView<?> parent) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
info_button.setOnClickListener(view -> new Tooltip.Builder(view)
|
info_button.setOnClickListener(
|
||||||
.setText(R.string.urlInfoTooltip)
|
view -> new Tooltip.Builder(view).setText(R.string.urlInfoTooltip).setTextColor(getResources().getColor(R.color.colorWhite))
|
||||||
.setTextColor(getResources().getColor(R.color.white))
|
.setBackgroundColor(getResources().getColor(R.color.tooltipBackground)).setCancelable(true).setDismissOnClick(true).setPadding(30)
|
||||||
.setBackgroundColor(getResources().getColor(R.color.tooltipBackground))
|
.setCornerRadius(R.dimen.tooltipCornor).setGravity(Gravity.BOTTOM).show());
|
||||||
.setCancelable(true)
|
|
||||||
.setDismissOnClick(true)
|
|
||||||
.setPadding(30)
|
|
||||||
.setCornerRadius(R.dimen.tooltipCornor)
|
|
||||||
.setGravity(Gravity.BOTTOM).show());
|
|
||||||
|
|
||||||
loginMethod.setOnCheckedChangeListener((group, checkedId) -> {
|
loginMethod.setOnCheckedChangeListener((group, checkedId) -> {
|
||||||
|
|
||||||
@ -139,13 +134,12 @@ public class LoginActivity extends BaseActivity {
|
|||||||
if(isAvailable) {
|
if(isAvailable) {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
SnackBar.success(ctx, layoutView, getResources().getString(R.string.netConnectionIsBack));
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
disableProcessButton();
|
disableProcessButton();
|
||||||
loginButton.setText(getResources().getString(R.string.btnLogin));
|
loginButton.setText(getResources().getString(R.string.btnLogin));
|
||||||
SnackBar.error(ctx, layoutView, getResources().getString(R.string.checkNetConnection));
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -171,16 +165,12 @@ public class LoginActivity extends BaseActivity {
|
|||||||
Protocol protocol = (Protocol) protocolSpinner.getSelectedItem();
|
Protocol protocol = (Protocol) protocolSpinner.getSelectedItem();
|
||||||
LoginType loginType = (loginMethod.getCheckedRadioButtonId() == R.id.loginUsernamePassword) ? LoginType.BASIC : LoginType.TOKEN;
|
LoginType loginType = (loginMethod.getCheckedRadioButtonId() == R.id.loginUsernamePassword) ? LoginType.BASIC : LoginType.TOKEN;
|
||||||
|
|
||||||
URI rawInstanceUrl = UrlBuilder.fromString(UrlHelper.fixScheme(instanceUrlET.getText().toString(), "http"))
|
URI rawInstanceUrl = UrlBuilder.fromString(UrlHelper.fixScheme(instanceUrlET.getText().toString(), "http")).toUri();
|
||||||
.toUri();
|
|
||||||
|
|
||||||
URI instanceUrlWithProtocol = UrlBuilder.fromUri(rawInstanceUrl)
|
URI instanceUrlWithProtocol = UrlBuilder.fromUri(rawInstanceUrl).withPath(PathsHelper.join(rawInstanceUrl.getPath()))
|
||||||
.withPath(PathsHelper.join(rawInstanceUrl.getPath()))
|
.withScheme(protocol.name().toLowerCase()).toUri();
|
||||||
.withScheme(protocol.name().toLowerCase())
|
|
||||||
.toUri();
|
|
||||||
|
|
||||||
URI instanceUrl = UrlBuilder.fromUri(instanceUrlWithProtocol)
|
URI instanceUrl = UrlBuilder.fromUri(instanceUrlWithProtocol).withPath(PathsHelper.join(instanceUrlWithProtocol.getPath(), "/api/v1/"))
|
||||||
.withPath(PathsHelper.join(instanceUrlWithProtocol.getPath(), "/api/v1/"))
|
|
||||||
.toUri();
|
.toUri();
|
||||||
|
|
||||||
tinyDB.putString("loginType", loginType.name().toLowerCase());
|
tinyDB.putString("loginType", loginType.name().toLowerCase());
|
||||||
@ -190,7 +180,7 @@ public class LoginActivity extends BaseActivity {
|
|||||||
|
|
||||||
if(instanceUrlET.getText().toString().equals("")) {
|
if(instanceUrlET.getText().toString().equals("")) {
|
||||||
|
|
||||||
SnackBar.warning(ctx, layoutView, getResources().getString(R.string.emptyFieldURL));
|
Toasty.error(ctx, getResources().getString(R.string.emptyFieldURL));
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -200,7 +190,7 @@ public class LoginActivity extends BaseActivity {
|
|||||||
|
|
||||||
if(otpCode.length() != 0 && otpCode.length() != 6) {
|
if(otpCode.length() != 0 && otpCode.length() != 6) {
|
||||||
|
|
||||||
SnackBar.warning(ctx, layoutView, getResources().getString(R.string.loginOTPTypeError));
|
Toasty.warning(ctx, getResources().getString(R.string.loginOTPTypeError));
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -215,7 +205,7 @@ public class LoginActivity extends BaseActivity {
|
|||||||
|
|
||||||
if(loginUid.equals("")) {
|
if(loginUid.equals("")) {
|
||||||
|
|
||||||
SnackBar.warning(ctx, layoutView, getResources().getString(R.string.emptyFieldUsername));
|
Toasty.error(ctx, getResources().getString(R.string.emptyFieldUsername));
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -223,7 +213,7 @@ public class LoginActivity extends BaseActivity {
|
|||||||
|
|
||||||
if(loginPass.equals("")) {
|
if(loginPass.equals("")) {
|
||||||
|
|
||||||
SnackBar.warning(ctx, layoutView, getResources().getString(R.string.emptyFieldPassword));
|
Toasty.error(ctx, getResources().getString(R.string.emptyFieldPassword));
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -232,33 +222,35 @@ public class LoginActivity extends BaseActivity {
|
|||||||
int loginOTP = (otpCode.length() > 0) ? Integer.parseInt(otpCode.getText().toString().trim()) : 0;
|
int loginOTP = (otpCode.length() > 0) ? Integer.parseInt(otpCode.getText().toString().trim()) : 0;
|
||||||
tinyDB.putString("loginUid", loginUid);
|
tinyDB.putString("loginUid", loginUid);
|
||||||
|
|
||||||
versionCheck(instanceUrl.toString(), loginUid, loginPass, loginOTP, loginToken, 1);
|
versionCheck(instanceUrl.toString(), loginUid, loginPass, loginOTP, loginToken, loginType);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
if(loginToken.equals("")) {
|
if(loginToken.equals("")) {
|
||||||
|
|
||||||
SnackBar.warning(ctx, layoutView, getResources().getString(R.string.loginTokenError));
|
Toasty.error(ctx, getResources().getString(R.string.loginTokenError));
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
versionCheck(instanceUrl.toString(), loginUid, loginPass, 123, loginToken, 2);
|
versionCheck(instanceUrl.toString(), loginUid, loginPass, 123, loginToken, loginType);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
}
|
||||||
|
catch(Exception e) {
|
||||||
|
|
||||||
Log.e("onFailure-login", e.toString());
|
Log.e("onFailure-login", e.toString());
|
||||||
SnackBar.error(ctx, layoutView, getResources().getString(R.string.malformedUrl));
|
Toasty.error(ctx, getResources().getString(R.string.malformedUrl));
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void versionCheck(final String instanceUrl, final String loginUid, final String loginPass, final int loginOTP, final String loginToken, final int loginType) {
|
private void versionCheck(final String instanceUrl, final String loginUid, final String loginPass, final int loginOTP, final String loginToken,
|
||||||
|
final LoginType loginType) {
|
||||||
|
|
||||||
Call<GiteaVersion> callVersion;
|
Call<GiteaVersion> callVersion;
|
||||||
|
|
||||||
@ -270,9 +262,9 @@ public class LoginActivity extends BaseActivity {
|
|||||||
|
|
||||||
String credential = Credentials.basic(loginUid, loginPass, StandardCharsets.UTF_8);
|
String credential = Credentials.basic(loginUid, loginPass, StandardCharsets.UTF_8);
|
||||||
|
|
||||||
callVersion = (loginOTP != 0) ?
|
callVersion =
|
||||||
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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,17 +285,15 @@ public class LoginActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
catch(Exception e) {
|
catch(Exception e) {
|
||||||
|
|
||||||
SnackBar.error(ctx, layoutView, getResources().getString(R.string.versionUnknown));
|
Toasty.error(ctx, getResources().getString(R.string.versionUnknown));
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(gitea_version.less(getString(R.string.versionLow))) {
|
if(gitea_version.less(getString(R.string.versionLow))) {
|
||||||
|
|
||||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(ctx)
|
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(ctx).setTitle(getString(R.string.versionAlertDialogHeader))
|
||||||
.setTitle(getString(R.string.versionAlertDialogHeader))
|
.setMessage(getResources().getString(R.string.versionUnsupportedOld, version.getVersion())).setIcon(R.drawable.ic_warning)
|
||||||
.setMessage(getResources().getString(R.string.versionUnsupportedOld, version.getVersion()))
|
|
||||||
.setIcon(R.drawable.ic_warning)
|
|
||||||
.setCancelable(true);
|
.setCancelable(true);
|
||||||
|
|
||||||
alertDialogBuilder.setNegativeButton(getString(R.string.cancelButton), (dialog, which) -> {
|
alertDialogBuilder.setNegativeButton(getString(R.string.cancelButton), (dialog, which) -> {
|
||||||
@ -327,7 +317,7 @@ public class LoginActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
SnackBar.info(ctx, layoutView, getResources().getString(R.string.versionUnsupportedNew));
|
Toasty.warning(ctx, getResources().getString(R.string.versionUnsupportedNew));
|
||||||
login(loginType, instanceUrl, loginUid, loginPass, loginOTP, loginToken);
|
login(loginType, instanceUrl, loginUid, loginPass, loginOTP, loginToken);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -339,12 +329,15 @@ public class LoginActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void login(int loginType, String instanceUrl, String loginUid, String loginPass, int loginOTP, String loginToken) {
|
private void login(LoginType loginType, String instanceUrl, String loginUid, String loginPass, int loginOTP, String loginToken) {
|
||||||
|
|
||||||
if(loginType == 1) {
|
// ToDo: before store/create token: get UserInfo to check DB/AccountManager if there already exist a token
|
||||||
|
// the setup methods then can better handle all different cases
|
||||||
|
|
||||||
|
if(loginType == LoginType.BASIC) {
|
||||||
setup(instanceUrl, loginUid, loginPass, loginOTP);
|
setup(instanceUrl, loginUid, loginPass, loginOTP);
|
||||||
}
|
}
|
||||||
else if(loginType == 2) { // Token
|
else if(loginType == LoginType.TOKEN) { // Token
|
||||||
setupUsingExistingToken(instanceUrl, loginToken);
|
setupUsingExistingToken(instanceUrl, loginToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -353,7 +346,7 @@ public class LoginActivity extends BaseActivity {
|
|||||||
public void onFailure(@NonNull Call<GiteaVersion> callVersion, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<GiteaVersion> callVersion, @NonNull Throwable t) {
|
||||||
|
|
||||||
Log.e("onFailure-versionCheck", t.toString());
|
Log.e("onFailure-versionCheck", t.toString());
|
||||||
SnackBar.error(ctx, layoutView, getResources().getString(R.string.errorOnLogin));
|
Toasty.error(ctx, getResources().getString(R.string.errorOnLogin));
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -361,9 +354,7 @@ public class LoginActivity extends BaseActivity {
|
|||||||
|
|
||||||
private void setupUsingExistingToken(String instanceUrl, final String loginToken) {
|
private void setupUsingExistingToken(String instanceUrl, final String loginToken) {
|
||||||
|
|
||||||
Call<UserInfo> call = RetrofitClient.getInstance(instanceUrl, ctx)
|
Call<UserInfo> call = RetrofitClient.getInstance(instanceUrl, ctx).getApiInterface().getUserInfo("token " + loginToken);
|
||||||
.getApiInterface()
|
|
||||||
.getUserInfo("token " + loginToken);
|
|
||||||
|
|
||||||
call.enqueue(new Callback<UserInfo>() {
|
call.enqueue(new Callback<UserInfo>() {
|
||||||
|
|
||||||
@ -385,9 +376,18 @@ public class LoginActivity extends BaseActivity {
|
|||||||
String accountName = userDetails.getUsername() + "@" + instanceUrl;
|
String accountName = userDetails.getUsername() + "@" + instanceUrl;
|
||||||
UserAccountsApi userAccountsApi = new UserAccountsApi(ctx);
|
UserAccountsApi userAccountsApi = new UserAccountsApi(ctx);
|
||||||
int checkAccount = userAccountsApi.getCount(accountName);
|
int checkAccount = userAccountsApi.getCount(accountName);
|
||||||
|
long accountId;
|
||||||
|
|
||||||
if(checkAccount == 0) {
|
if(checkAccount == 0) {
|
||||||
userAccountsApi.insertNewAccount(accountName, instanceUrl, userDetails.getUsername(), loginToken, "");
|
|
||||||
|
accountId = userAccountsApi.insertNewAccount(accountName, instanceUrl, userDetails.getUsername(), loginToken, "");
|
||||||
|
tinyDB.putInt("currentActiveAccountId", (int) accountId);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
userAccountsApi.updateTokenByAccountName(accountName, loginToken);
|
||||||
|
UserAccount data = userAccountsApi.getAccountData(accountName);
|
||||||
|
tinyDB.putInt("currentActiveAccountId", data.getAccountId());
|
||||||
}
|
}
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
@ -396,12 +396,12 @@ public class LoginActivity extends BaseActivity {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 401:
|
case 401:
|
||||||
SnackBar.error(ctx, layoutView, getResources().getString(R.string.unauthorizedApiError));
|
Toasty.error(ctx, getResources().getString(R.string.unauthorizedApiError));
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
SnackBar.error(ctx, layoutView, getResources().getString(R.string.genericApiStatusError) + response.code());
|
Toasty.error(ctx, getResources().getString(R.string.genericApiStatusError) + response.code());
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -412,7 +412,7 @@ public class LoginActivity extends BaseActivity {
|
|||||||
public void onFailure(@NonNull Call<UserInfo> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<UserInfo> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
Log.e("onFailure", t.toString());
|
Log.e("onFailure", t.toString());
|
||||||
SnackBar.error(ctx, layoutView, getResources().getString(R.string.genericError));
|
Toasty.error(ctx, getResources().getString(R.string.genericError));
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -423,19 +423,16 @@ public class LoginActivity extends BaseActivity {
|
|||||||
private void setup(final String instanceUrl, final String loginUid, final String loginPass, final int loginOTP) {
|
private void setup(final String instanceUrl, final String loginUid, final String loginPass, final int loginOTP) {
|
||||||
|
|
||||||
final String credential = Credentials.basic(loginUid, loginPass, StandardCharsets.UTF_8);
|
final String credential = Credentials.basic(loginUid, loginPass, StandardCharsets.UTF_8);
|
||||||
|
final String tokenName = "gitnex-app-" + device_id;
|
||||||
|
|
||||||
Call<List<UserTokens>> call;
|
Call<List<UserTokens>> call;
|
||||||
if(loginOTP != 0) {
|
if(loginOTP != 0) {
|
||||||
|
|
||||||
call = RetrofitClient.getInstance(instanceUrl, ctx)
|
call = RetrofitClient.getInstance(instanceUrl, ctx).getApiInterface().getUserTokensWithOTP(credential, loginOTP, loginUid);
|
||||||
.getApiInterface()
|
|
||||||
.getUserTokensWithOTP(credential, loginOTP, loginUid);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
call = RetrofitClient.getInstance(instanceUrl, ctx)
|
call = RetrofitClient.getInstance(instanceUrl, ctx).getApiInterface().getUserTokens(credential, loginUid);
|
||||||
.getApiInterface()
|
|
||||||
.getUserTokens(credential, loginUid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
call.enqueue(new Callback<List<UserTokens>>() {
|
call.enqueue(new Callback<List<UserTokens>>() {
|
||||||
@ -445,149 +442,110 @@ public class LoginActivity extends BaseActivity {
|
|||||||
|
|
||||||
List<UserTokens> userTokens = response.body();
|
List<UserTokens> userTokens = response.body();
|
||||||
|
|
||||||
AppUtil appUtil = new AppUtil();
|
|
||||||
|
|
||||||
if(response.code() == 200) {
|
if(response.code() == 200) {
|
||||||
|
|
||||||
assert userTokens != null;
|
assert userTokens != null;
|
||||||
boolean setTokenFlag = false;
|
for(UserTokens t : userTokens) {
|
||||||
|
if(t.getName().equals(tokenName)) {
|
||||||
|
|
||||||
if(userTokens.size() > 0) { // FIXME This is in need of a refactor, but i don't understand what the code is used for.
|
// this app had created an token on this instance before
|
||||||
|
// -> since it looks like GitNex forgot the secret we have to delete it first
|
||||||
|
|
||||||
if(userTokens.get(0).getToken_last_eight() != null) {
|
Call<Void> delcall;
|
||||||
|
if(loginOTP != 0) {
|
||||||
|
|
||||||
for(int i = 0; i < userTokens.size(); i++) {
|
delcall = RetrofitClient.getInstance(instanceUrl, ctx).getApiInterface()
|
||||||
|
.deleteTokenWithOTP(credential, loginOTP, loginUid, t.getId());
|
||||||
if(userTokens.get(i).getToken_last_eight().equals(tinyDB.getString(loginUid + "-token-last-eight"))) {
|
|
||||||
setTokenFlag = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
else {
|
||||||
else {
|
|
||||||
|
|
||||||
for(int i = 0; i < userTokens.size(); i++) {
|
delcall = RetrofitClient.getInstance(instanceUrl, ctx).getApiInterface().deleteToken(credential, loginUid, t.getId());
|
||||||
|
|
||||||
if(userTokens.get(i).getSha1().equals(tinyDB.getString(loginUid + "-token"))) {
|
|
||||||
setTokenFlag = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
delcall.enqueue(new Callback<Void>() {
|
||||||
}
|
|
||||||
|
|
||||||
if(tinyDB.getString(loginUid + "-token").isEmpty() || !setTokenFlag) {
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<Void> delcall, @NonNull retrofit2.Response<Void> response) {
|
||||||
|
|
||||||
UserTokens createUserToken = new UserTokens("gitnex-app-" + device_id);
|
if(response.code() == 204) {
|
||||||
Call<UserTokens> callCreateToken;
|
|
||||||
|
|
||||||
if(loginOTP != 0) {
|
setupToken(instanceUrl, loginUid, loginPass, loginOTP, tokenName);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
callCreateToken = RetrofitClient.getInstance(instanceUrl, ctx)
|
Toasty.error(ctx, getResources().getString(R.string.genericApiStatusError) + response.code());
|
||||||
.getApiInterface()
|
enableProcessButton();
|
||||||
.createNewTokenWithOTP(credential, loginOTP, loginUid, createUserToken);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
callCreateToken = RetrofitClient.getInstance(instanceUrl, ctx)
|
|
||||||
.getApiInterface()
|
|
||||||
.createNewToken(credential, loginUid, createUserToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
callCreateToken.enqueue(new Callback<UserTokens>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onResponse(@NonNull Call<UserTokens> callCreateToken, @NonNull retrofit2.Response<UserTokens> responseCreate) {
|
|
||||||
|
|
||||||
if(responseCreate.code() == 201) {
|
|
||||||
|
|
||||||
UserTokens newToken = responseCreate.body();
|
|
||||||
assert newToken != null;
|
|
||||||
|
|
||||||
if(!newToken.getSha1().equals("")) {
|
|
||||||
|
|
||||||
Call<UserInfo> call = RetrofitClient.getInstance(instanceUrl, ctx)
|
|
||||||
.getApiInterface()
|
|
||||||
.getUserInfo("token " + newToken.getSha1());
|
|
||||||
|
|
||||||
call.enqueue(new Callback<UserInfo>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onResponse(@NonNull Call<UserInfo> call, @NonNull retrofit2.Response<UserInfo> response) {
|
|
||||||
|
|
||||||
UserInfo userDetails = response.body();
|
|
||||||
|
|
||||||
switch(response.code()) {
|
|
||||||
|
|
||||||
case 200:
|
|
||||||
assert userDetails != null;
|
|
||||||
tinyDB.remove("loginPass");
|
|
||||||
tinyDB.putBoolean("loggedInMode", true);
|
|
||||||
tinyDB.putString("userLogin", userDetails.getUsername());
|
|
||||||
tinyDB.putString(loginUid + "-token", newToken.getSha1());
|
|
||||||
tinyDB.putString(loginUid + "-token-last-eight", appUtil.getLastCharactersOfWord(newToken.getSha1(), 8));
|
|
||||||
|
|
||||||
// insert new account to db if does not exist
|
|
||||||
String accountName = userDetails.getUsername() + "@" + instanceUrl;
|
|
||||||
UserAccountsApi userAccountsApi = new UserAccountsApi(ctx);
|
|
||||||
int checkAccount = userAccountsApi.getCount(accountName);
|
|
||||||
|
|
||||||
if(checkAccount == 0) {
|
|
||||||
userAccountsApi.insertNewAccount(accountName, instanceUrl, userDetails.getUsername(), newToken.getSha1(), "");
|
|
||||||
}
|
|
||||||
|
|
||||||
startActivity(new Intent(LoginActivity.this, MainActivity.class));
|
|
||||||
finish();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 401:
|
|
||||||
SnackBar.error(ctx, layoutView, getResources().getString(R.string.unauthorizedApiError));
|
|
||||||
enableProcessButton();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
SnackBar.error(ctx, layoutView, getResources().getString(R.string.genericApiStatusError) + response.code());
|
|
||||||
enableProcessButton();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(@NonNull Call<UserInfo> call, @NonNull Throwable t) {
|
|
||||||
|
|
||||||
Log.e("onFailure", t.toString());
|
|
||||||
SnackBar.error(ctx, layoutView, getResources().getString(R.string.genericError));
|
|
||||||
enableProcessButton();
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(responseCreate.code() == 500) {
|
|
||||||
|
|
||||||
SnackBar.error(ctx, layoutView, getResources().getString(R.string.genericApiStatusError) + responseCreate.code());
|
@Override
|
||||||
|
public void onFailure(@NonNull Call<Void> delcall, @NonNull Throwable t) {
|
||||||
|
|
||||||
|
Log.e("onFailure-login", t.toString());
|
||||||
|
Toasty.error(ctx, getResources().getString(R.string.malformedJson));
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
return;
|
||||||
@Override
|
}
|
||||||
public void onFailure(@NonNull Call<UserTokens> createUserToken, @NonNull Throwable t) {
|
|
||||||
|
|
||||||
Log.e("onFailure-token", t.toString());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
|
|
||||||
String instanceToken = "token " + tinyDB.getString(loginUid + "-token");
|
setupToken(instanceUrl, loginUid, loginPass, loginOTP, tokenName);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
Call<UserInfo> callGetUsername = RetrofitClient.getInstance(instanceUrl, ctx)
|
Toasty.error(ctx, getResources().getString(R.string.genericApiStatusError) + response.code());
|
||||||
.getApiInterface()
|
enableProcessButton();
|
||||||
.getUserInfo(instanceToken);
|
|
||||||
|
|
||||||
callGetUsername.enqueue(new Callback<UserInfo>() {
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Call<List<UserTokens>> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
|
Log.e("onFailure-login", t.toString());
|
||||||
|
Toasty.error(ctx, getResources().getString(R.string.malformedJson));
|
||||||
|
enableProcessButton();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupToken(final String instanceUrl, final String loginUid, final String loginPass, final int loginOTP, final String tokenName) {
|
||||||
|
|
||||||
|
final String credential = Credentials.basic(loginUid, loginPass, StandardCharsets.UTF_8);
|
||||||
|
|
||||||
|
UserTokens createUserToken = new UserTokens(tokenName);
|
||||||
|
Call<UserTokens> callCreateToken;
|
||||||
|
|
||||||
|
if(loginOTP != 0) {
|
||||||
|
|
||||||
|
callCreateToken = RetrofitClient.getInstance(instanceUrl, ctx).getApiInterface()
|
||||||
|
.createNewTokenWithOTP(credential, loginOTP, loginUid, createUserToken);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
callCreateToken = RetrofitClient.getInstance(instanceUrl, ctx).getApiInterface().createNewToken(credential, loginUid, createUserToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
callCreateToken.enqueue(new Callback<UserTokens>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<UserTokens> callCreateToken, @NonNull retrofit2.Response<UserTokens> responseCreate) {
|
||||||
|
|
||||||
|
if(responseCreate.code() == 201) {
|
||||||
|
|
||||||
|
UserTokens newToken = responseCreate.body();
|
||||||
|
assert newToken != null;
|
||||||
|
|
||||||
|
if(!newToken.getSha1().equals("")) {
|
||||||
|
|
||||||
|
Call<UserInfo> call = RetrofitClient.getInstance(instanceUrl, ctx).getApiInterface()
|
||||||
|
.getUserInfo("token " + newToken.getSha1());
|
||||||
|
|
||||||
|
call.enqueue(new Callback<UserInfo>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(@NonNull Call<UserInfo> call, @NonNull retrofit2.Response<UserInfo> response) {
|
public void onResponse(@NonNull Call<UserInfo> call, @NonNull retrofit2.Response<UserInfo> response) {
|
||||||
@ -598,16 +556,28 @@ public class LoginActivity extends BaseActivity {
|
|||||||
|
|
||||||
case 200:
|
case 200:
|
||||||
assert userDetails != null;
|
assert userDetails != null;
|
||||||
tinyDB.putString("userLogin", userDetails.getUsername());
|
tinyDB.remove("loginPass");
|
||||||
tinyDB.putBoolean("loggedInMode", true);
|
tinyDB.putBoolean("loggedInMode", true);
|
||||||
|
tinyDB.putString("userLogin", userDetails.getUsername());
|
||||||
|
tinyDB.putString(loginUid + "-token", newToken.getSha1());
|
||||||
|
tinyDB.putString(loginUid + "-token-last-eight", newToken.getToken_last_eight());
|
||||||
|
|
||||||
// insert new account to db if does not exist
|
// insert new account to db if does not exist
|
||||||
String accountName = userDetails.getUsername() + "@" + instanceUrl;
|
String accountName = userDetails.getUsername() + "@" + instanceUrl;
|
||||||
UserAccountsApi userAccountsApi = new UserAccountsApi(ctx);
|
UserAccountsApi userAccountsApi = new UserAccountsApi(ctx);
|
||||||
int checkAccount = userAccountsApi.getCount(accountName);
|
int checkAccount = userAccountsApi.getCount(accountName);
|
||||||
|
long accountId;
|
||||||
|
|
||||||
if(checkAccount == 0) {
|
if(checkAccount == 0) {
|
||||||
userAccountsApi.insertNewAccount(accountName, instanceUrl, userDetails.getUsername(), instanceToken, "");
|
|
||||||
|
accountId = userAccountsApi.insertNewAccount(accountName, instanceUrl, userDetails.getUsername(), newToken.getSha1(), "");
|
||||||
|
tinyDB.putInt("currentActiveAccountId", (int) accountId);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
userAccountsApi.updateTokenByAccountName(accountName, newToken.getSha1());
|
||||||
|
UserAccount data = userAccountsApi.getAccountData(accountName);
|
||||||
|
tinyDB.putInt("currentActiveAccountId", data.getAccountId());
|
||||||
}
|
}
|
||||||
|
|
||||||
startActivity(new Intent(LoginActivity.this, MainActivity.class));
|
startActivity(new Intent(LoginActivity.this, MainActivity.class));
|
||||||
@ -615,12 +585,12 @@ public class LoginActivity extends BaseActivity {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 401:
|
case 401:
|
||||||
SnackBar.error(ctx, layoutView, getResources().getString(R.string.unauthorizedApiError));
|
Toasty.error(ctx, getResources().getString(R.string.unauthorizedApiError));
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
SnackBar.error(ctx, layoutView, getResources().getString(R.string.genericApiStatusError) + response.code());
|
Toasty.error(ctx, getResources().getString(R.string.genericApiStatusError) + response.code());
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -631,33 +601,30 @@ public class LoginActivity extends BaseActivity {
|
|||||||
public void onFailure(@NonNull Call<UserInfo> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<UserInfo> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
Log.e("onFailure", t.toString());
|
Log.e("onFailure", t.toString());
|
||||||
SnackBar.error(ctx, layoutView, getResources().getString(R.string.genericError));
|
Toasty.error(ctx, getResources().getString(R.string.genericError));
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else if(responseCreate.code() == 500) {
|
||||||
|
|
||||||
SnackBar.error(ctx, layoutView, getResources().getString(R.string.genericApiStatusError) + response.code());
|
Toasty.error(ctx, getResources().getString(R.string.genericApiStatusError) + responseCreate.code());
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(@NonNull Call<List<UserTokens>> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<UserTokens> createUserToken, @NonNull Throwable t) {
|
||||||
|
|
||||||
Log.e("onFailure-login", t.toString());
|
|
||||||
SnackBar.error(ctx, layoutView, getResources().getString(R.string.malformedJson));
|
|
||||||
enableProcessButton();
|
|
||||||
|
|
||||||
|
Log.e("onFailure-token", t.toString());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void loadDefaults() {
|
private void loadDefaults() {
|
||||||
|
|
||||||
if(tinyDB.getString("loginType").equals(LoginType.BASIC.name().toLowerCase())) {
|
if(tinyDB.getString("loginType").equals(LoginType.BASIC.name().toLowerCase())) {
|
||||||
@ -692,26 +659,14 @@ public class LoginActivity extends BaseActivity {
|
|||||||
|
|
||||||
private void disableProcessButton() {
|
private void disableProcessButton() {
|
||||||
|
|
||||||
GradientDrawable shape = new GradientDrawable();
|
|
||||||
shape.setCornerRadius(8);
|
|
||||||
shape.setColor(getResources().getColor(R.color.hintColor));
|
|
||||||
|
|
||||||
loginButton.setText(R.string.processingText);
|
loginButton.setText(R.string.processingText);
|
||||||
loginButton.setBackground(shape);
|
|
||||||
loginButton.setEnabled(false);
|
loginButton.setEnabled(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableProcessButton() {
|
private void enableProcessButton() {
|
||||||
|
|
||||||
GradientDrawable shape = new GradientDrawable();
|
|
||||||
shape.setCornerRadius(8);
|
|
||||||
shape.setColor(getResources().getColor(R.color.btnBackground));
|
|
||||||
|
|
||||||
loginButton.setText(R.string.btnLogin);
|
loginButton.setText(R.string.btnLogin);
|
||||||
loginButton.setBackground(shape);
|
|
||||||
loginButton.setEnabled(true);
|
loginButton.setEnabled(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,6 @@ import com.google.android.material.navigation.NavigationView;
|
|||||||
import org.mian.gitnex.R;
|
import org.mian.gitnex.R;
|
||||||
import org.mian.gitnex.clients.PicassoService;
|
import org.mian.gitnex.clients.PicassoService;
|
||||||
import org.mian.gitnex.clients.RetrofitClient;
|
import org.mian.gitnex.clients.RetrofitClient;
|
||||||
import org.mian.gitnex.database.api.UserAccountsApi;
|
|
||||||
import org.mian.gitnex.database.models.UserAccount;
|
|
||||||
import org.mian.gitnex.fragments.AboutFragment;
|
import org.mian.gitnex.fragments.AboutFragment;
|
||||||
import org.mian.gitnex.fragments.AdministrationFragment;
|
import org.mian.gitnex.fragments.AdministrationFragment;
|
||||||
import org.mian.gitnex.fragments.BottomSheetDraftsFragment;
|
import org.mian.gitnex.fragments.BottomSheetDraftsFragment;
|
||||||
@ -123,8 +121,9 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String accountName = loginUid + "@" + instanceUrl;
|
if(tinyDb.getInt("currentActiveAccountId") <= 0) {
|
||||||
getAccountData(accountName);
|
AlertDialogs.forceLogoutDialog(ctx, getResources().getString(R.string.forceLogoutDialogHeader), getResources().getString(R.string.forceLogoutDialogDescription), getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
||||||
|
}
|
||||||
|
|
||||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
toolbarTitle = toolbar.findViewById(R.id.toolbar_title);
|
toolbarTitle = toolbar.findViewById(R.id.toolbar_title);
|
||||||
@ -199,7 +198,7 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
|
|||||||
public void onDrawerOpened(@NonNull View drawerView) {
|
public void onDrawerOpened(@NonNull View drawerView) {
|
||||||
|
|
||||||
if(tinyDb.getBoolean("noConnection")) {
|
if(tinyDb.getBoolean("noConnection")) {
|
||||||
Toasty.info(ctx, getResources().getString(R.string.checkNetConnection));
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
||||||
tinyDb.putBoolean("noConnection", false);
|
tinyDb.putBoolean("noConnection", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -369,7 +368,7 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
|
|||||||
if(!connToInternet) {
|
if(!connToInternet) {
|
||||||
|
|
||||||
if(!tinyDb.getBoolean("noConnection")) {
|
if(!tinyDb.getBoolean("noConnection")) {
|
||||||
Toasty.info(ctx, getResources().getString(R.string.checkNetConnection));
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
||||||
}
|
}
|
||||||
|
|
||||||
tinyDb.putBoolean("noConnection", true);
|
tinyDb.putBoolean("noConnection", true);
|
||||||
@ -421,12 +420,18 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
|
|||||||
|
|
||||||
if(frag != null) {
|
if(frag != null) {
|
||||||
|
|
||||||
new AlertDialog.Builder(ctx).setTitle(R.string.deleteAllDrafts).setIcon(R.drawable.ic_delete).setCancelable(false).setMessage(R.string.deleteAllDraftsDialogMessage).setPositiveButton(R.string.menuDeleteText, (dialog, which) -> {
|
new AlertDialog.Builder(ctx)
|
||||||
|
.setTitle(R.string.deleteAllDrafts)
|
||||||
|
.setIcon(R.drawable.ic_delete)
|
||||||
|
.setCancelable(false)
|
||||||
|
.setMessage(R.string.deleteAllDraftsDialogMessage)
|
||||||
|
.setPositiveButton(R.string.menuDeleteText, (dialog, which) -> {
|
||||||
|
|
||||||
frag.deleteAllDrafts(currentActiveAccountId);
|
frag.deleteAllDrafts(currentActiveAccountId);
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
|
|
||||||
}).setNegativeButton(R.string.cancelButton, (dialog, which) -> dialog.dismiss()).show();
|
})
|
||||||
|
.setNeutralButton(R.string.cancelButton, null).show();
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -442,20 +447,6 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getAccountData(String accountName) {
|
|
||||||
|
|
||||||
UserAccountsApi accountData = new UserAccountsApi(ctx);
|
|
||||||
UserAccount data = accountData.getAccountData(accountName);
|
|
||||||
|
|
||||||
if(data != null) {
|
|
||||||
TinyDB tinyDb = new TinyDB(ctx.getApplicationContext());
|
|
||||||
tinyDb.putInt("currentActiveAccountId", data.getAccountId());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
AlertDialogs.forceLogoutDialog(ctx, getResources().getString(R.string.forceLogoutDialogHeader), getResources().getString(R.string.forceLogoutDialogDescription), getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
|
|
||||||
@ -665,7 +656,7 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
|
|||||||
else {
|
else {
|
||||||
|
|
||||||
String toastError = getResources().getString(R.string.genericApiStatusError) + response.code();
|
String toastError = getResources().getString(R.string.genericApiStatusError) + response.code();
|
||||||
Toasty.info(ctx, toastError);
|
Toasty.error(ctx, toastError);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,12 +126,10 @@ public class MergePullRequestActivity extends BaseActivity {
|
|||||||
if(!connToInternet) {
|
if(!connToInternet) {
|
||||||
|
|
||||||
disableProcessButton();
|
disableProcessButton();
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
viewBinding.mergeButton.setOnClickListener(mergePullRequest);
|
viewBinding.mergeButton.setOnClickListener(mergePullRequest);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -221,7 +219,7 @@ public class MergePullRequestActivity extends BaseActivity {
|
|||||||
|
|
||||||
if(!connToInternet) {
|
if(!connToInternet) {
|
||||||
|
|
||||||
Toasty.info(ctx, getResources().getString(R.string.checkNetConnection));
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -266,7 +264,7 @@ public class MergePullRequestActivity extends BaseActivity {
|
|||||||
|
|
||||||
deleteBranchFunction(repoOwner, repoName);
|
deleteBranchFunction(repoOwner, repoName);
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.mergePRSuccessMsg));
|
Toasty.success(ctx, getString(R.string.mergePRSuccessMsg));
|
||||||
tinyDb.putBoolean("prMerged", true);
|
tinyDb.putBoolean("prMerged", true);
|
||||||
tinyDb.putBoolean("resumePullRequests", true);
|
tinyDb.putBoolean("resumePullRequests", true);
|
||||||
finish();
|
finish();
|
||||||
@ -281,7 +279,7 @@ public class MergePullRequestActivity extends BaseActivity {
|
|||||||
|
|
||||||
deleteBranchFunction(repoOwner, repoName);
|
deleteBranchFunction(repoOwner, repoName);
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.mergePRSuccessMsg));
|
Toasty.success(ctx, getString(R.string.mergePRSuccessMsg));
|
||||||
tinyDb.putBoolean("prMerged", true);
|
tinyDb.putBoolean("prMerged", true);
|
||||||
tinyDb.putBoolean("resumePullRequests", true);
|
tinyDb.putBoolean("resumePullRequests", true);
|
||||||
finish();
|
finish();
|
||||||
@ -291,7 +289,7 @@ public class MergePullRequestActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.mergePRSuccessMsg));
|
Toasty.success(ctx, getString(R.string.mergePRSuccessMsg));
|
||||||
tinyDb.putBoolean("prMerged", true);
|
tinyDb.putBoolean("prMerged", true);
|
||||||
tinyDb.putBoolean("resumePullRequests", true);
|
tinyDb.putBoolean("resumePullRequests", true);
|
||||||
finish();
|
finish();
|
||||||
@ -308,13 +306,13 @@ public class MergePullRequestActivity extends BaseActivity {
|
|||||||
else if(response.code() == 404) {
|
else if(response.code() == 404) {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.info(ctx, getString(R.string.mergePR404ErrorMsg));
|
Toasty.warning(ctx, getString(R.string.mergePR404ErrorMsg));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.info(ctx, getString(R.string.genericError));
|
Toasty.error(ctx, getString(R.string.genericError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -373,15 +371,11 @@ public class MergePullRequestActivity extends BaseActivity {
|
|||||||
private void disableProcessButton() {
|
private void disableProcessButton() {
|
||||||
|
|
||||||
viewBinding.mergeButton.setEnabled(false);
|
viewBinding.mergeButton.setEnabled(false);
|
||||||
viewBinding.mergeButton.setBackground(getResources().getDrawable(R.drawable.shape_buttons_disabled));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableProcessButton() {
|
private void enableProcessButton() {
|
||||||
|
|
||||||
viewBinding.mergeButton.setEnabled(true);
|
viewBinding.mergeButton.setEnabled(true);
|
||||||
viewBinding.mergeButton.setBackground(getResources().getDrawable(R.drawable.shape_buttons));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,9 @@ public class OpenRepoInBrowserActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
URI instanceUrl = new URI(tinyDb.getString("instanceUrlWithProtocol"));
|
URI instanceUrl = new URI(UrlBuilder.fromString(tinyDb.getString("instanceUrl"))
|
||||||
|
.withPath("/")
|
||||||
|
.toString());
|
||||||
|
|
||||||
String browserPath = PathsHelper.join(instanceUrl.getPath(), getIntent().getStringExtra("repoFullNameBrowser"));
|
String browserPath = PathsHelper.join(instanceUrl.getPath(), getIntent().getStringExtra("repoFullNameBrowser"));
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package org.mian.gitnex.activities;
|
package org.mian.gitnex.activities;
|
||||||
|
|
||||||
|
import android.content.ClipData;
|
||||||
|
import android.content.ClipboardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
@ -24,7 +26,9 @@ import org.mian.gitnex.fragments.OrganizationInfoFragment;
|
|||||||
import org.mian.gitnex.fragments.RepositoriesByOrgFragment;
|
import org.mian.gitnex.fragments.RepositoriesByOrgFragment;
|
||||||
import org.mian.gitnex.fragments.TeamsByOrgFragment;
|
import org.mian.gitnex.fragments.TeamsByOrgFragment;
|
||||||
import org.mian.gitnex.helpers.TinyDB;
|
import org.mian.gitnex.helpers.TinyDB;
|
||||||
|
import org.mian.gitnex.helpers.Toasty;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import io.mikael.urlbuilder.UrlBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Author M M Arif
|
* Author M M Arif
|
||||||
@ -34,6 +38,7 @@ public class OrganizationDetailActivity extends BaseActivity implements BottomSh
|
|||||||
|
|
||||||
final Context ctx = this;
|
final Context ctx = this;
|
||||||
private Context appCtx;
|
private Context appCtx;
|
||||||
|
private TinyDB tinyDb;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getLayoutResourceId(){
|
protected int getLayoutResourceId(){
|
||||||
@ -45,6 +50,7 @@ public class OrganizationDetailActivity extends BaseActivity implements BottomSh
|
|||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
appCtx = getApplicationContext();
|
appCtx = getApplicationContext();
|
||||||
|
tinyDb = new TinyDB(appCtx);
|
||||||
|
|
||||||
TinyDB tinyDb = new TinyDB(appCtx);
|
TinyDB tinyDb = new TinyDB(appCtx);
|
||||||
String orgName = tinyDb.getString("orgName");
|
String orgName = tinyDb.getString("orgName");
|
||||||
@ -105,6 +111,7 @@ public class OrganizationDetailActivity extends BaseActivity implements BottomSh
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
|
||||||
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;
|
||||||
@ -132,19 +139,28 @@ public class OrganizationDetailActivity extends BaseActivity implements BottomSh
|
|||||||
@Override
|
@Override
|
||||||
public void onButtonClicked(String text) {
|
public void onButtonClicked(String text) {
|
||||||
|
|
||||||
TinyDB tinyDb = new TinyDB(appCtx);
|
|
||||||
|
|
||||||
switch (text) {
|
switch (text) {
|
||||||
case "repository":
|
case "repository":
|
||||||
|
|
||||||
tinyDb.putBoolean("organizationAction", true);
|
tinyDb.putBoolean("organizationAction", true);
|
||||||
startActivity(new Intent(OrganizationDetailActivity.this, CreateRepoActivity.class));
|
startActivity(new Intent(OrganizationDetailActivity.this, CreateRepoActivity.class));
|
||||||
break;
|
break;
|
||||||
case "team":
|
case "team":
|
||||||
|
|
||||||
startActivity(new Intent(OrganizationDetailActivity.this, CreateTeamByOrgActivity.class));
|
startActivity(new Intent(OrganizationDetailActivity.this, CreateTeamByOrgActivity.class));
|
||||||
break;
|
break;
|
||||||
}
|
case "copyOrgUrl":
|
||||||
//Log.i("clicked", text);
|
|
||||||
|
|
||||||
|
String url = UrlBuilder.fromString(tinyDb.getString("instanceUrl"))
|
||||||
|
.withPath("/")
|
||||||
|
.toString();
|
||||||
|
ClipboardManager clipboard = (ClipboardManager) Objects.requireNonNull(ctx).getSystemService(Context.CLIPBOARD_SERVICE);
|
||||||
|
ClipData clip = ClipData.newPlainText("orgUrl", url + tinyDb.getString("orgName"));
|
||||||
|
assert clipboard != null;
|
||||||
|
clipboard.setPrimaryClip(clip);
|
||||||
|
Toasty.info(ctx, ctx.getString(R.string.copyIssueUrlToastMsg));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SectionsPagerAdapter extends FragmentPagerAdapter {
|
public class SectionsPagerAdapter extends FragmentPagerAdapter {
|
||||||
@ -157,7 +173,6 @@ public class OrganizationDetailActivity extends BaseActivity implements BottomSh
|
|||||||
@Override
|
@Override
|
||||||
public Fragment getItem(int position) {
|
public Fragment getItem(int position) {
|
||||||
|
|
||||||
TinyDB tinyDb = new TinyDB(appCtx);
|
|
||||||
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");
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.mian.gitnex.activities;
|
package org.mian.gitnex.activities;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.drawable.GradientDrawable;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.Patterns;
|
import android.util.Patterns;
|
||||||
@ -67,11 +66,9 @@ public class ProfileEmailActivity extends BaseActivity {
|
|||||||
if(!connToInternet) {
|
if(!connToInternet) {
|
||||||
|
|
||||||
disableProcessButton();
|
disableProcessButton();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
addEmailButton.setOnClickListener(addEmailListener);
|
addEmailButton.setOnClickListener(addEmailListener);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -94,20 +91,20 @@ public class ProfileEmailActivity extends BaseActivity {
|
|||||||
|
|
||||||
if(!connToInternet) {
|
if(!connToInternet) {
|
||||||
|
|
||||||
Toasty.info(ctx, getResources().getString(R.string.checkNetConnection));
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(newUserEmail.equals("")) {
|
if(newUserEmail.equals("")) {
|
||||||
|
|
||||||
Toasty.info(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.info(ctx, getString(R.string.emailErrorInvalid));
|
Toasty.warning(ctx, getString(R.string.emailErrorInvalid));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -138,7 +135,7 @@ public class ProfileEmailActivity extends BaseActivity {
|
|||||||
|
|
||||||
if(response.code() == 201) {
|
if(response.code() == 201) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.emailAddedText));
|
Toasty.success(ctx, getString(R.string.emailAddedText));
|
||||||
tinyDb.putBoolean("emailsRefresh", true);
|
tinyDb.putBoolean("emailsRefresh", true);
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
finish();
|
finish();
|
||||||
@ -156,25 +153,25 @@ public class ProfileEmailActivity extends BaseActivity {
|
|||||||
else if(response.code() == 403) {
|
else if(response.code() == 403) {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.info(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.info(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.info(ctx, ctx.getString(R.string.emailErrorInUse));
|
Toasty.warning(ctx, ctx.getString(R.string.emailErrorInUse));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.info(ctx, getString(R.string.labelGeneralError));
|
Toasty.error(ctx, getString(R.string.labelGeneralError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,32 +187,18 @@ public class ProfileEmailActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initCloseListener() {
|
private void initCloseListener() {
|
||||||
onClickListener = new View.OnClickListener() {
|
|
||||||
@Override
|
onClickListener = view -> finish();
|
||||||
public void onClick(View view) {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void disableProcessButton() {
|
private void disableProcessButton() {
|
||||||
|
|
||||||
addEmailButton.setEnabled(false);
|
addEmailButton.setEnabled(false);
|
||||||
GradientDrawable shape = new GradientDrawable();
|
|
||||||
shape.setCornerRadius( 8 );
|
|
||||||
shape.setColor(getResources().getColor(R.color.hintColor));
|
|
||||||
addEmailButton.setBackground(shape);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableProcessButton() {
|
private void enableProcessButton() {
|
||||||
|
|
||||||
addEmailButton.setEnabled(true);
|
addEmailButton.setEnabled(true);
|
||||||
GradientDrawable shape = new GradientDrawable();
|
|
||||||
shape.setCornerRadius( 8 );
|
|
||||||
shape.setColor(getResources().getColor(R.color.btnBackground));
|
|
||||||
addEmailButton.setBackground(shape);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package org.mian.gitnex.activities;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.drawable.GradientDrawable;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
@ -272,14 +271,14 @@ public class ReplyToIssueActivity extends BaseActivity {
|
|||||||
|
|
||||||
if(!connToInternet) {
|
if(!connToInternet) {
|
||||||
|
|
||||||
Toasty.info(ctx, getResources().getString(R.string.checkNetConnection));
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(newReplyDT.equals("")) {
|
if(newReplyDT.equals("")) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.commentEmptyError));
|
Toasty.error(ctx, getString(R.string.commentEmptyError));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -318,7 +317,7 @@ public class ReplyToIssueActivity extends BaseActivity {
|
|||||||
|
|
||||||
if(response.code() == 201) {
|
if(response.code() == 201) {
|
||||||
|
|
||||||
Toasty.info(ctx, getString(R.string.commentSuccess));
|
Toasty.success(ctx, getString(R.string.commentSuccess));
|
||||||
tinyDb.putBoolean("commentPosted", true);
|
tinyDb.putBoolean("commentPosted", true);
|
||||||
tinyDb.putBoolean("resumeIssues", true);
|
tinyDb.putBoolean("resumeIssues", true);
|
||||||
tinyDb.putBoolean("resumePullRequests", true);
|
tinyDb.putBoolean("resumePullRequests", true);
|
||||||
@ -349,7 +348,7 @@ public class ReplyToIssueActivity extends BaseActivity {
|
|||||||
else {
|
else {
|
||||||
|
|
||||||
enableProcessButton();
|
enableProcessButton();
|
||||||
Toasty.info(ctx, getString(R.string.commentError));
|
Toasty.error(ctx, getString(R.string.commentError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -397,21 +396,11 @@ public class ReplyToIssueActivity extends BaseActivity {
|
|||||||
private void disableProcessButton() {
|
private void disableProcessButton() {
|
||||||
|
|
||||||
replyButton.setEnabled(false);
|
replyButton.setEnabled(false);
|
||||||
GradientDrawable shape = new GradientDrawable();
|
|
||||||
shape.setCornerRadius(8);
|
|
||||||
shape.setColor(getResources().getColor(R.color.hintColor));
|
|
||||||
replyButton.setBackground(shape);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableProcessButton() {
|
private void enableProcessButton() {
|
||||||
|
|
||||||
replyButton.setEnabled(true);
|
replyButton.setEnabled(true);
|
||||||
GradientDrawable shape = new GradientDrawable();
|
|
||||||
shape.setCornerRadius(8);
|
|
||||||
shape.setColor(getResources().getColor(R.color.btnBackground));
|
|
||||||
replyButton.setBackground(shape);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package org.mian.gitnex.activities;
|
package org.mian.gitnex.activities;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.ClipData;
|
||||||
|
import android.content.ClipboardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -42,6 +44,7 @@ import org.mian.gitnex.fragments.ReleasesFragment;
|
|||||||
import org.mian.gitnex.fragments.RepoInfoFragment;
|
import org.mian.gitnex.fragments.RepoInfoFragment;
|
||||||
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.helpers.Toasty;
|
||||||
import org.mian.gitnex.helpers.Version;
|
import org.mian.gitnex.helpers.Version;
|
||||||
import org.mian.gitnex.models.Branches;
|
import org.mian.gitnex.models.Branches;
|
||||||
import org.mian.gitnex.models.UserRepositories;
|
import org.mian.gitnex.models.UserRepositories;
|
||||||
@ -81,6 +84,7 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
|||||||
private String repositoryOwner;
|
private String repositoryOwner;
|
||||||
private String repositoryName;
|
private String repositoryName;
|
||||||
|
|
||||||
|
public static ViewPager mViewPager;
|
||||||
private int tabsCount;
|
private int tabsCount;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -172,7 +176,7 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewPager mViewPager = findViewById(R.id.container);
|
mViewPager = findViewById(R.id.container);
|
||||||
|
|
||||||
mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
|
mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
|
||||||
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager));
|
tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mViewPager));
|
||||||
@ -345,6 +349,14 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
|||||||
startActivity(Intent.createChooser(sharingIntent, tinyDB.getString("repoHtmlUrl")));
|
startActivity(Intent.createChooser(sharingIntent, tinyDB.getString("repoHtmlUrl")));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "copyRepoUrl":
|
||||||
|
ClipboardManager clipboard = (ClipboardManager) Objects.requireNonNull(ctx).getSystemService(Context.CLIPBOARD_SERVICE);
|
||||||
|
ClipData clip = ClipData.newPlainText("repoUrl", tinyDB.getString("repoHtmlUrl"));
|
||||||
|
assert clipboard != null;
|
||||||
|
clipboard.setPrimaryClip(clip);
|
||||||
|
Toasty.info(ctx, ctx.getString(R.string.copyIssueUrlToastMsg));
|
||||||
|
break;
|
||||||
|
|
||||||
case "newFile":
|
case "newFile":
|
||||||
startActivity(new Intent(RepoDetailActivity.this, CreateFileActivity.class));
|
startActivity(new Intent(RepoDetailActivity.this, CreateFileActivity.class));
|
||||||
break;
|
break;
|
||||||
@ -432,6 +444,7 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
|||||||
dialogInterface.dismiss();
|
dialogInterface.dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
pBuilder.setNeutralButton(R.string.cancelButton, null);
|
||||||
|
|
||||||
pBuilder.create().show();
|
pBuilder.create().show();
|
||||||
|
|
||||||
|
@ -0,0 +1,295 @@
|
|||||||
|
package org.mian.gitnex.activities;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.text.method.ScrollingMovementMethod;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.inputmethod.EditorInfo;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.widget.SearchView;
|
||||||
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||||
|
import org.mian.gitnex.R;
|
||||||
|
import org.mian.gitnex.adapters.RepoForksAdapter;
|
||||||
|
import org.mian.gitnex.clients.RetrofitClient;
|
||||||
|
import org.mian.gitnex.helpers.Authorization;
|
||||||
|
import org.mian.gitnex.helpers.StaticGlobalVariables;
|
||||||
|
import org.mian.gitnex.helpers.TinyDB;
|
||||||
|
import org.mian.gitnex.helpers.Version;
|
||||||
|
import org.mian.gitnex.models.UserRepositories;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.Callback;
|
||||||
|
import retrofit2.Response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Author M M Arif
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class RepoForksActivity extends BaseActivity {
|
||||||
|
|
||||||
|
final Context ctx = this;
|
||||||
|
private Context appCtx;
|
||||||
|
private View.OnClickListener onClickListener;
|
||||||
|
private TextView noData;
|
||||||
|
private ProgressBar progressBar;
|
||||||
|
private String TAG = "RepositoryForks";
|
||||||
|
private int resultLimit = StaticGlobalVariables.resultLimitOldGiteaInstances;
|
||||||
|
private int pageSize = 1;
|
||||||
|
|
||||||
|
private RecyclerView recyclerView;
|
||||||
|
private List<UserRepositories> forksList;
|
||||||
|
private RepoForksAdapter adapter;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getLayoutResourceId() {
|
||||||
|
|
||||||
|
return R.layout.activity_forks;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("DefaultLocale")
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
appCtx = getApplicationContext();
|
||||||
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
|
TinyDB tinyDb = new TinyDB(appCtx);
|
||||||
|
final String instanceUrl = tinyDb.getString("instanceUrl");
|
||||||
|
final String loginUid = tinyDb.getString("loginUid");
|
||||||
|
final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
|
||||||
|
|
||||||
|
String repoFullNameForForks = getIntent().getStringExtra("repoFullNameForForks");
|
||||||
|
assert repoFullNameForForks != null;
|
||||||
|
String[] parts = repoFullNameForForks.split("/");
|
||||||
|
final String repoOwner = parts[0];
|
||||||
|
final String repoName = parts[1];
|
||||||
|
|
||||||
|
TextView toolbar_title = findViewById(R.id.toolbar_title);
|
||||||
|
toolbar_title.setMovementMethod(new ScrollingMovementMethod());
|
||||||
|
toolbar_title.setText(String.format("%s : %s", ctx.getResources().getString(R.string.infoTabRepoForksCount), repoName));
|
||||||
|
|
||||||
|
ImageView closeActivity = findViewById(R.id.close);
|
||||||
|
noData = findViewById(R.id.noData);
|
||||||
|
progressBar = findViewById(R.id.progress_bar);
|
||||||
|
SwipeRefreshLayout swipeRefresh = findViewById(R.id.pullToRefresh);
|
||||||
|
|
||||||
|
initCloseListener();
|
||||||
|
closeActivity.setOnClickListener(onClickListener);
|
||||||
|
|
||||||
|
// if gitea is 1.12 or higher use the new limit (resultLimitNewGiteaInstances)
|
||||||
|
if(new Version(tinyDb.getString("giteaVersion")).higherOrEqual("1.12")) {
|
||||||
|
resultLimit = StaticGlobalVariables.resultLimitNewGiteaInstances;
|
||||||
|
}
|
||||||
|
|
||||||
|
recyclerView = findViewById(R.id.recyclerView);
|
||||||
|
forksList = new ArrayList<>();
|
||||||
|
|
||||||
|
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(),
|
||||||
|
DividerItemDecoration.VERTICAL);
|
||||||
|
recyclerView.addItemDecoration(dividerItemDecoration);
|
||||||
|
|
||||||
|
swipeRefresh.setOnRefreshListener(() -> new Handler().postDelayed(() -> {
|
||||||
|
|
||||||
|
swipeRefresh.setRefreshing(false);
|
||||||
|
loadInitial(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), repoOwner, repoName, pageSize, resultLimit);
|
||||||
|
adapter.notifyDataChanged();
|
||||||
|
|
||||||
|
}, 200));
|
||||||
|
|
||||||
|
adapter = new RepoForksAdapter(ctx, forksList);
|
||||||
|
adapter.setLoadMoreListener(() -> recyclerView.post(() -> {
|
||||||
|
|
||||||
|
if(forksList.size() == resultLimit || pageSize == resultLimit) {
|
||||||
|
|
||||||
|
int page = (forksList.size() + resultLimit) / resultLimit;
|
||||||
|
loadMore(instanceUrl, Authorization.returnAuthentication(ctx, loginUid, instanceToken), repoOwner, repoName, page, resultLimit);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}));
|
||||||
|
|
||||||
|
recyclerView.setHasFixedSize(true);
|
||||||
|
recyclerView.setLayoutManager(new LinearLayoutManager(ctx));
|
||||||
|
recyclerView.setAdapter(adapter);
|
||||||
|
|
||||||
|
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) {
|
||||||
|
|
||||||
|
Call<List<UserRepositories>> call = RetrofitClient
|
||||||
|
.getInstance(instanceUrl, ctx)
|
||||||
|
.getApiInterface()
|
||||||
|
.getRepositoryForks(instanceToken, repoOwner, repoName, pageSize, resultLimit);
|
||||||
|
|
||||||
|
call.enqueue(new Callback<List<UserRepositories>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<List<UserRepositories>> call, @NonNull Response<List<UserRepositories>> response) {
|
||||||
|
|
||||||
|
if(response.isSuccessful()) {
|
||||||
|
|
||||||
|
assert response.body() != null;
|
||||||
|
if(response.body().size() > 0) {
|
||||||
|
|
||||||
|
forksList.clear();
|
||||||
|
forksList.addAll(response.body());
|
||||||
|
adapter.notifyDataChanged();
|
||||||
|
noData.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
forksList.clear();
|
||||||
|
adapter.notifyDataChanged();
|
||||||
|
noData.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
progressBar.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
Log.e(TAG, String.valueOf(response.code()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Call<List<UserRepositories>> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
|
Log.e(TAG, t.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadMore(String instanceUrl, String instanceToken, String repoOwner, String repoName, int page, int resultLimit) {
|
||||||
|
|
||||||
|
//add loading progress view
|
||||||
|
forksList.add(new UserRepositories("load"));
|
||||||
|
adapter.notifyItemInserted((forksList.size() - 1));
|
||||||
|
|
||||||
|
Call<List<UserRepositories>> call = RetrofitClient
|
||||||
|
.getInstance(instanceUrl, ctx)
|
||||||
|
.getApiInterface()
|
||||||
|
.getRepositoryForks(instanceToken, repoOwner, repoName, page, resultLimit);
|
||||||
|
|
||||||
|
call.enqueue(new Callback<List<UserRepositories>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<List<UserRepositories>> call, @NonNull Response<List<UserRepositories>> response) {
|
||||||
|
|
||||||
|
if(response.isSuccessful()) {
|
||||||
|
|
||||||
|
//remove loading view
|
||||||
|
forksList.remove(forksList.size() - 1);
|
||||||
|
|
||||||
|
List<UserRepositories> result = response.body();
|
||||||
|
|
||||||
|
assert result != null;
|
||||||
|
if(result.size() > 0) {
|
||||||
|
|
||||||
|
pageSize = result.size();
|
||||||
|
forksList.addAll(result);
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
adapter.setMoreDataAvailable(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
adapter.notifyDataChanged();
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
Log.e(TAG, String.valueOf(response.code()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Call<List<UserRepositories>> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
|
Log.e(TAG, t.toString());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
|
||||||
|
MenuInflater inflater = getMenuInflater();
|
||||||
|
inflater.inflate(R.menu.search_menu, menu);
|
||||||
|
|
||||||
|
MenuItem searchItem = menu.findItem(R.id.action_search);
|
||||||
|
SearchView searchView = (SearchView) searchItem.getActionView();
|
||||||
|
searchView.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
||||||
|
|
||||||
|
searchView.setOnQueryTextListener(new androidx.appcompat.widget.SearchView.OnQueryTextListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onQueryTextSubmit(String query) {
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onQueryTextChange(String newText) {
|
||||||
|
|
||||||
|
filter(newText);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
return super.onCreateOptionsMenu(menu);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void filter(String text) {
|
||||||
|
|
||||||
|
List<UserRepositories> arr = new ArrayList<>();
|
||||||
|
|
||||||
|
for(UserRepositories d : forksList) {
|
||||||
|
if(d.getName().toLowerCase().contains(text) || d.getDescription().toLowerCase().contains(text)) {
|
||||||
|
arr.add(d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
adapter.updateList(arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initCloseListener() {
|
||||||
|
|
||||||
|
onClickListener = view -> {
|
||||||
|
getIntent().removeExtra("repoFullNameForForks");
|
||||||
|
finish();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -93,12 +93,8 @@ public class RepoStargazersActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initCloseListener() {
|
private void initCloseListener() {
|
||||||
onClickListener = new View.OnClickListener() {
|
|
||||||
@Override
|
onClickListener = view -> finish();
|
||||||
public void onClick(View view) {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -93,12 +93,8 @@ public class RepoWatchersActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initCloseListener() {
|
private void initCloseListener() {
|
||||||
onClickListener = new View.OnClickListener() {
|
|
||||||
@Override
|
onClickListener = view -> finish();
|
||||||
public void onClick(View view) {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -121,11 +121,11 @@ public class SettingsAppearanceActivity extends BaseActivity {
|
|||||||
|
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
tinyDb.putBoolean("enableCounterBadges", true);
|
tinyDb.putBoolean("enableCounterBadges", true);
|
||||||
Toasty.info(appCtx, getResources().getString(R.string.settingsSave));
|
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tinyDb.putBoolean("enableCounterBadges", false);
|
tinyDb.putBoolean("enableCounterBadges", false);
|
||||||
Toasty.info(appCtx, getResources().getString(R.string.settingsSave));
|
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -154,7 +154,7 @@ public class SettingsAppearanceActivity extends BaseActivity {
|
|||||||
this.recreate();
|
this.recreate();
|
||||||
this.overridePendingTransition(0, 0);
|
this.overridePendingTransition(0, 0);
|
||||||
dialogInterfaceTheme.dismiss();
|
dialogInterfaceTheme.dismiss();
|
||||||
Toasty.info(appCtx, getResources().getString(R.string.settingsSave));
|
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ public class SettingsAppearanceActivity extends BaseActivity {
|
|||||||
this.recreate();
|
this.recreate();
|
||||||
this.overridePendingTransition(0, 0);
|
this.overridePendingTransition(0, 0);
|
||||||
dialogInterfaceCustomFont.dismiss();
|
dialogInterfaceCustomFont.dismiss();
|
||||||
Toasty.info(appCtx, appCtx.getResources().getString(R.string.settingsSave));
|
Toasty.success(appCtx, appCtx.getResources().getString(R.string.settingsSave));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -217,7 +217,7 @@ public class SettingsAppearanceActivity extends BaseActivity {
|
|||||||
tinyDb.putInt("homeScreenId", i);
|
tinyDb.putInt("homeScreenId", i);
|
||||||
|
|
||||||
dialogInterfaceHomeScreen.dismiss();
|
dialogInterfaceHomeScreen.dismiss();
|
||||||
Toasty.info(appCtx, getResources().getString(R.string.settingsSave));
|
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -248,7 +248,7 @@ public class SettingsAppearanceActivity extends BaseActivity {
|
|||||||
|
|
||||||
switch(codeBlockList[i]) {
|
switch(codeBlockList[i]) {
|
||||||
case "White - Black":
|
case "White - Black":
|
||||||
tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.white));
|
tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.colorWhite));
|
||||||
tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.black));
|
tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.black));
|
||||||
break;
|
break;
|
||||||
case "Grey - Black":
|
case "Grey - Black":
|
||||||
@ -256,12 +256,12 @@ public class SettingsAppearanceActivity extends BaseActivity {
|
|||||||
tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.black));
|
tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.black));
|
||||||
break;
|
break;
|
||||||
case "White - Grey":
|
case "White - Grey":
|
||||||
tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.white));
|
tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.colorWhite));
|
||||||
tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.colorAccent));
|
tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.colorAccent));
|
||||||
break;
|
break;
|
||||||
case "Dark - White":
|
case "Dark - White":
|
||||||
tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.colorPrimary));
|
tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.colorPrimary));
|
||||||
tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.white));
|
tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.colorWhite));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.colorLightGreen));
|
tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.colorLightGreen));
|
||||||
@ -270,7 +270,7 @@ public class SettingsAppearanceActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dialogInterfaceCodeBlock.dismiss();
|
dialogInterfaceCodeBlock.dismiss();
|
||||||
Toasty.info(appCtx, getResources().getString(R.string.settingsSave));
|
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -307,7 +307,7 @@ public class SettingsAppearanceActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dialogInterfaceTime.dismiss();
|
dialogInterfaceTime.dismiss();
|
||||||
Toasty.info(appCtx, getResources().getString(R.string.settingsSave));
|
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -320,9 +320,7 @@ public class SettingsAppearanceActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initCloseListener() {
|
private void initCloseListener() {
|
||||||
onClickListener = view -> {
|
onClickListener = view -> finish();
|
||||||
finish();
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -51,11 +51,11 @@ public class SettingsDraftsActivity extends BaseActivity {
|
|||||||
|
|
||||||
if(isChecked) {
|
if(isChecked) {
|
||||||
tinyDb.putBoolean("draftsCommentsDeletionEnabled", true);
|
tinyDb.putBoolean("draftsCommentsDeletionEnabled", true);
|
||||||
Toasty.info(appCtx, getResources().getString(R.string.settingsSave));
|
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tinyDb.putBoolean("draftsCommentsDeletionEnabled", false);
|
tinyDb.putBoolean("draftsCommentsDeletionEnabled", false);
|
||||||
Toasty.info(appCtx, getResources().getString(R.string.settingsSave));
|
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -85,7 +85,7 @@ public class SettingsFileViewerActivity extends BaseActivity {
|
|||||||
tinyDb.putInt("fileviewerSourceCodeThemeId", i);
|
tinyDb.putInt("fileviewerSourceCodeThemeId", i);
|
||||||
|
|
||||||
dialogInterfaceTheme.dismiss();
|
dialogInterfaceTheme.dismiss();
|
||||||
Toasty.info(appCtx, getResources().getString(R.string.settingsSave));
|
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -100,12 +100,12 @@ public class SettingsFileViewerActivity extends BaseActivity {
|
|||||||
if(isChecked) {
|
if(isChecked) {
|
||||||
tinyDb.putBoolean("enablePdfMode", true);
|
tinyDb.putBoolean("enablePdfMode", true);
|
||||||
tinyDb.putString("enablePdfModeInit", "yes");
|
tinyDb.putString("enablePdfModeInit", "yes");
|
||||||
Toasty.info(appCtx, getResources().getString(R.string.settingsSave));
|
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tinyDb.putBoolean("enablePdfMode", false);
|
tinyDb.putBoolean("enablePdfMode", false);
|
||||||
tinyDb.putString("enablePdfModeInit", "yes");
|
tinyDb.putString("enablePdfModeInit", "yes");
|
||||||
Toasty.info(appCtx, getResources().getString(R.string.settingsSave));
|
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -51,11 +51,11 @@ public class SettingsReportsActivity extends BaseActivity {
|
|||||||
|
|
||||||
if(isChecked) {
|
if(isChecked) {
|
||||||
tinyDb.putBoolean("crashReportingEnabled", true);
|
tinyDb.putBoolean("crashReportingEnabled", true);
|
||||||
Toasty.info(appCtx, getResources().getString(R.string.settingsSave));
|
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tinyDb.putBoolean("crashReportingEnabled", false);
|
tinyDb.putBoolean("crashReportingEnabled", false);
|
||||||
Toasty.info(appCtx, getResources().getString(R.string.settingsSave));
|
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -63,9 +63,7 @@ public class SettingsReportsActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initCloseListener() {
|
private void initCloseListener() {
|
||||||
onClickListener = view -> {
|
onClickListener = view -> finish();
|
||||||
finish();
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ public class SettingsSecurityActivity extends BaseActivity {
|
|||||||
tinyDb.putInt("cacheSizeImagesId", i);
|
tinyDb.putInt("cacheSizeImagesId", i);
|
||||||
|
|
||||||
dialogInterfaceTheme.dismiss();
|
dialogInterfaceTheme.dismiss();
|
||||||
Toasty.info(appCtx, getResources().getString(R.string.settingsSave));
|
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ public class SettingsSecurityActivity extends BaseActivity {
|
|||||||
tinyDb.putInt("cacheSizeId", i);
|
tinyDb.putInt("cacheSizeId", i);
|
||||||
|
|
||||||
dialogInterfaceTheme.dismiss();
|
dialogInterfaceTheme.dismiss();
|
||||||
Toasty.info(appCtx, getResources().getString(R.string.settingsSave));
|
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -242,11 +242,11 @@ public class SettingsSecurityActivity extends BaseActivity {
|
|||||||
NotificationsMaster.hireWorker(ctx);
|
NotificationsMaster.hireWorker(ctx);
|
||||||
|
|
||||||
pollingDelaySelected.setText(String.format(getString(R.string.pollingDelaySelectedText), numberPicker.getValue()));
|
pollingDelaySelected.setText(String.format(getString(R.string.pollingDelaySelectedText), numberPicker.getValue()));
|
||||||
Toasty.info(appCtx, getResources().getString(R.string.settingsSave));
|
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
builder.setNegativeButton(R.string.cancelButton, (dialog, which) -> dialog.dismiss());
|
builder.setNeutralButton(R.string.cancelButton, null);
|
||||||
builder.setView(numberPicker);
|
builder.setView(numberPicker);
|
||||||
builder.create().show();
|
builder.create().show();
|
||||||
|
|
||||||
|
@ -143,11 +143,11 @@ public class SettingsTranslationActivity extends BaseActivity {
|
|||||||
this.recreate();
|
this.recreate();
|
||||||
this.overridePendingTransition(0, 0);
|
this.overridePendingTransition(0, 0);
|
||||||
dialogInterface.dismiss();
|
dialogInterface.dismiss();
|
||||||
Toasty.info(appCtx, getResources().getString(R.string.settingsSave));
|
Toasty.success(appCtx, getResources().getString(R.string.settingsSave));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
lBuilder.setNegativeButton(getString(R.string.cancelButton), (dialog, which) -> dialog.dismiss());
|
lBuilder.setNeutralButton(getString(R.string.cancelButton), null);
|
||||||
|
|
||||||
AlertDialog lDialog = lBuilder.create();
|
AlertDialog lDialog = lBuilder.create();
|
||||||
lDialog.show();
|
lDialog.show();
|
||||||
@ -157,9 +157,7 @@ public class SettingsTranslationActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initCloseListener() {
|
private void initCloseListener() {
|
||||||
onClickListener = view -> {
|
onClickListener = view -> finish();
|
||||||
finish();
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -59,12 +59,8 @@ public class SponsorsActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initCloseListener() {
|
private void initCloseListener() {
|
||||||
onClickListener = new View.OnClickListener() {
|
|
||||||
@Override
|
onClickListener = view -> finish();
|
||||||
public void onClick(View view) {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ public class AdminGetUsersAdapter extends RecyclerView.Adapter<AdminGetUsersAdap
|
|||||||
holder.userRole.setVisibility(View.VISIBLE);
|
holder.userRole.setVisibility(View.VISIBLE);
|
||||||
TextDrawable drawable = TextDrawable.builder()
|
TextDrawable drawable = TextDrawable.builder()
|
||||||
.beginConfig()
|
.beginConfig()
|
||||||
.textColor(mCtx.getResources().getColor(R.color.white))
|
.textColor(mCtx.getResources().getColor(R.color.colorWhite))
|
||||||
.fontSize(44)
|
.fontSize(44)
|
||||||
.width(180)
|
.width(180)
|
||||||
.height(60)
|
.height(60)
|
||||||
|
@ -93,7 +93,7 @@ public class DraftsAdapter extends RecyclerView.Adapter<DraftsAdapter.DraftsView
|
|||||||
draftsList.remove(position);
|
draftsList.remove(position);
|
||||||
notifyItemRemoved(position);
|
notifyItemRemoved(position);
|
||||||
notifyItemRangeChanged(position, draftsList.size());
|
notifyItemRangeChanged(position, draftsList.size());
|
||||||
Toasty.info(mCtx, mCtx.getResources().getString(R.string.draftsSingleDeleteSuccess));
|
Toasty.success(mCtx, mCtx.getResources().getString(R.string.draftsSingleDeleteSuccess));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package org.mian.gitnex.adapters;
|
package org.mian.gitnex.adapters;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.ClipData;
|
||||||
|
import android.content.ClipboardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
@ -19,6 +21,7 @@ import com.google.android.material.bottomsheet.BottomSheetDialog;
|
|||||||
import org.mian.gitnex.R;
|
import org.mian.gitnex.R;
|
||||||
import org.mian.gitnex.activities.OpenRepoInBrowserActivity;
|
import org.mian.gitnex.activities.OpenRepoInBrowserActivity;
|
||||||
import org.mian.gitnex.activities.RepoDetailActivity;
|
import org.mian.gitnex.activities.RepoDetailActivity;
|
||||||
|
import org.mian.gitnex.activities.RepoForksActivity;
|
||||||
import org.mian.gitnex.activities.RepoStargazersActivity;
|
import org.mian.gitnex.activities.RepoStargazersActivity;
|
||||||
import org.mian.gitnex.activities.RepoWatchersActivity;
|
import org.mian.gitnex.activities.RepoWatchersActivity;
|
||||||
import org.mian.gitnex.clients.PicassoService;
|
import org.mian.gitnex.clients.PicassoService;
|
||||||
@ -31,6 +34,7 @@ import org.mian.gitnex.helpers.Toasty;
|
|||||||
import org.mian.gitnex.models.UserRepositories;
|
import org.mian.gitnex.models.UserRepositories;
|
||||||
import org.mian.gitnex.models.WatchInfo;
|
import org.mian.gitnex.models.WatchInfo;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
import retrofit2.Callback;
|
||||||
|
|
||||||
@ -40,7 +44,6 @@ import retrofit2.Callback;
|
|||||||
|
|
||||||
public class ExploreRepositoriesAdapter extends RecyclerView.Adapter<ExploreRepositoriesAdapter.ReposSearchViewHolder> {
|
public class ExploreRepositoriesAdapter extends RecyclerView.Adapter<ExploreRepositoriesAdapter.ReposSearchViewHolder> {
|
||||||
|
|
||||||
|
|
||||||
private List<UserRepositories> searchedReposList;
|
private List<UserRepositories> searchedReposList;
|
||||||
private Context mCtx;
|
private Context mCtx;
|
||||||
|
|
||||||
@ -64,6 +67,7 @@ public class ExploreRepositoriesAdapter extends RecyclerView.Adapter<ExploreRepo
|
|||||||
private TextView repoType;
|
private TextView repoType;
|
||||||
private LinearLayout archiveRepo;
|
private LinearLayout archiveRepo;
|
||||||
private TextView repoBranch;
|
private TextView repoBranch;
|
||||||
|
private TextView htmlUrl;
|
||||||
|
|
||||||
private ReposSearchViewHolder(View itemView) {
|
private ReposSearchViewHolder(View itemView) {
|
||||||
|
|
||||||
@ -82,6 +86,7 @@ public class ExploreRepositoriesAdapter extends RecyclerView.Adapter<ExploreRepo
|
|||||||
repoType = itemView.findViewById(R.id.repoType);
|
repoType = itemView.findViewById(R.id.repoType);
|
||||||
archiveRepo = itemView.findViewById(R.id.archiveRepoFrame);
|
archiveRepo = itemView.findViewById(R.id.archiveRepoFrame);
|
||||||
repoBranch = itemView.findViewById(R.id.repoBranch);
|
repoBranch = itemView.findViewById(R.id.repoBranch);
|
||||||
|
htmlUrl = itemView.findViewById(R.id.htmlUrl);
|
||||||
|
|
||||||
itemView.setOnClickListener(v -> {
|
itemView.setOnClickListener(v -> {
|
||||||
|
|
||||||
@ -148,7 +153,7 @@ public class ExploreRepositoriesAdapter extends RecyclerView.Adapter<ExploreRepo
|
|||||||
|
|
||||||
if(response.code() != 404) {
|
if(response.code() != 404) {
|
||||||
|
|
||||||
Toasty.info(context, context.getString(R.string.genericApiStatusError));
|
Toasty.error(context, context.getString(R.string.genericApiStatusError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,7 +165,7 @@ public class ExploreRepositoriesAdapter extends RecyclerView.Adapter<ExploreRepo
|
|||||||
public void onFailure(@NonNull Call<WatchInfo> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<WatchInfo> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
tinyDb.putBoolean("repoWatch", false);
|
tinyDb.putBoolean("repoWatch", false);
|
||||||
Toasty.info(context, context.getString(R.string.genericApiStatusError));
|
Toasty.error(context, context.getString(R.string.genericApiStatusError));
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -180,6 +185,8 @@ public class ExploreRepositoriesAdapter extends RecyclerView.Adapter<ExploreRepo
|
|||||||
TextView repoOpenInBrowser = view.findViewById(R.id.repoOpenInBrowser);
|
TextView repoOpenInBrowser = view.findViewById(R.id.repoOpenInBrowser);
|
||||||
TextView repoStargazers = view.findViewById(R.id.repoStargazers);
|
TextView repoStargazers = view.findViewById(R.id.repoStargazers);
|
||||||
TextView repoWatchers = view.findViewById(R.id.repoWatchers);
|
TextView repoWatchers = view.findViewById(R.id.repoWatchers);
|
||||||
|
TextView repoForksList = view.findViewById(R.id.repoForksList);
|
||||||
|
TextView repoCopyUrl = view.findViewById(R.id.repoCopyUrl);
|
||||||
TextView bottomSheetHeader = view.findViewById(R.id.bottomSheetHeader);
|
TextView bottomSheetHeader = view.findViewById(R.id.bottomSheetHeader);
|
||||||
|
|
||||||
bottomSheetHeader.setText(String.format("%s / %s", fullName.getText().toString().split("/")[0], fullName.getText().toString().split("/")[1]));
|
bottomSheetHeader.setText(String.format("%s / %s", fullName.getText().toString().split("/")[0], fullName.getText().toString().split("/")[1]));
|
||||||
@ -187,6 +194,17 @@ public class ExploreRepositoriesAdapter extends RecyclerView.Adapter<ExploreRepo
|
|||||||
dialog.setContentView(view);
|
dialog.setContentView(view);
|
||||||
dialog.show();
|
dialog.show();
|
||||||
|
|
||||||
|
repoCopyUrl.setOnClickListener(openInBrowser -> {
|
||||||
|
|
||||||
|
ClipboardManager clipboard = (ClipboardManager) Objects.requireNonNull(context).getSystemService(Context.CLIPBOARD_SERVICE);
|
||||||
|
ClipData clip = ClipData.newPlainText("repoUrl", htmlUrl.getText().toString());
|
||||||
|
assert clipboard != null;
|
||||||
|
clipboard.setPrimaryClip(clip);
|
||||||
|
|
||||||
|
Toasty.info(context, context.getString(R.string.copyIssueUrlToastMsg));
|
||||||
|
dialog.dismiss();
|
||||||
|
});
|
||||||
|
|
||||||
repoOpenInBrowser.setOnClickListener(openInBrowser -> {
|
repoOpenInBrowser.setOnClickListener(openInBrowser -> {
|
||||||
|
|
||||||
Intent intentOpenInBrowser = new Intent(context, OpenRepoInBrowserActivity.class);
|
Intent intentOpenInBrowser = new Intent(context, OpenRepoInBrowserActivity.class);
|
||||||
@ -214,6 +232,15 @@ public class ExploreRepositoriesAdapter extends RecyclerView.Adapter<ExploreRepo
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
repoForksList.setOnClickListener(forks -> {
|
||||||
|
|
||||||
|
Intent intentW = new Intent(context, RepoForksActivity.class);
|
||||||
|
intentW.putExtra("repoFullNameForForks", fullName.getText());
|
||||||
|
context.startActivity(intentW);
|
||||||
|
dialog.dismiss();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -234,6 +261,7 @@ public class ExploreRepositoriesAdapter extends RecyclerView.Adapter<ExploreRepo
|
|||||||
UserRepositories currentItem = searchedReposList.get(position);
|
UserRepositories currentItem = searchedReposList.get(position);
|
||||||
holder.repoDescription.setVisibility(View.GONE);
|
holder.repoDescription.setVisibility(View.GONE);
|
||||||
holder.repoBranch.setText(currentItem.getDefault_branch());
|
holder.repoBranch.setText(currentItem.getDefault_branch());
|
||||||
|
holder.htmlUrl.setText(currentItem.getHtml_url());
|
||||||
|
|
||||||
ColorGenerator generator = ColorGenerator.MATERIAL;
|
ColorGenerator generator = ColorGenerator.MATERIAL;
|
||||||
int color = generator.getColor(currentItem.getName());
|
int color = generator.getColor(currentItem.getName());
|
||||||
@ -264,7 +292,7 @@ public class ExploreRepositoriesAdapter extends RecyclerView.Adapter<ExploreRepo
|
|||||||
holder.repoType.setText(R.string.strPrivate);
|
holder.repoType.setText(R.string.strPrivate);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
holder.repoPrivatePublic.setImageResource(R.drawable.ic_unlock);
|
holder.repoPrivatePublic.setVisibility(View.GONE);
|
||||||
holder.repoType.setText(R.string.strPublic);
|
holder.repoType.setText(R.string.strPublic);
|
||||||
}
|
}
|
||||||
holder.repoStars.setText(currentItem.getStars_count());
|
holder.repoStars.setText(currentItem.getStars_count());
|
||||||
|
@ -62,7 +62,7 @@ public class FilesAdapter extends RecyclerView.Adapter<FilesAdapter.FilesViewHol
|
|||||||
filesListener.onClickDir(fileName.getText().toString());
|
filesListener.onClickDir(fileName.getText().toString());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Toasty.info(context, context.getString(R.string.filesGenericError));
|
Toasty.warning(context, context.getString(R.string.filesGenericError));
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -242,7 +242,7 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<IssueCommentsAdap
|
|||||||
if(response.code() == 204) {
|
if(response.code() == 204) {
|
||||||
|
|
||||||
updateAdapter(position);
|
updateAdapter(position);
|
||||||
Toasty.info(ctx, ctx.getResources().getString(R.string.deleteCommentSuccess));
|
Toasty.success(ctx, ctx.getResources().getString(R.string.deleteCommentSuccess));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(response.code() == 401) {
|
else if(response.code() == 401) {
|
||||||
@ -255,17 +255,17 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<IssueCommentsAdap
|
|||||||
}
|
}
|
||||||
else if(response.code() == 403) {
|
else if(response.code() == 403) {
|
||||||
|
|
||||||
Toasty.info(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.info(ctx, ctx.getString(R.string.apiNotFound));
|
Toasty.warning(ctx, ctx.getString(R.string.apiNotFound));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.info(ctx, ctx.getString(R.string.genericError));
|
Toasty.error(ctx, ctx.getString(R.string.genericError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package org.mian.gitnex.adapters;
|
package org.mian.gitnex.adapters;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.ClipData;
|
||||||
|
import android.content.ClipboardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
@ -21,6 +23,7 @@ import com.google.android.material.bottomsheet.BottomSheetDialog;
|
|||||||
import org.mian.gitnex.R;
|
import org.mian.gitnex.R;
|
||||||
import org.mian.gitnex.activities.OpenRepoInBrowserActivity;
|
import org.mian.gitnex.activities.OpenRepoInBrowserActivity;
|
||||||
import org.mian.gitnex.activities.RepoDetailActivity;
|
import org.mian.gitnex.activities.RepoDetailActivity;
|
||||||
|
import org.mian.gitnex.activities.RepoForksActivity;
|
||||||
import org.mian.gitnex.activities.RepoStargazersActivity;
|
import org.mian.gitnex.activities.RepoStargazersActivity;
|
||||||
import org.mian.gitnex.activities.RepoWatchersActivity;
|
import org.mian.gitnex.activities.RepoWatchersActivity;
|
||||||
import org.mian.gitnex.clients.PicassoService;
|
import org.mian.gitnex.clients.PicassoService;
|
||||||
@ -34,6 +37,7 @@ import org.mian.gitnex.models.UserRepositories;
|
|||||||
import org.mian.gitnex.models.WatchInfo;
|
import org.mian.gitnex.models.WatchInfo;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
import retrofit2.Callback;
|
||||||
|
|
||||||
@ -61,6 +65,7 @@ public class MyReposListAdapter extends RecyclerView.Adapter<MyReposListAdapter.
|
|||||||
private CheckBox isRepoAdmin;
|
private CheckBox isRepoAdmin;
|
||||||
private LinearLayout archiveRepo;
|
private LinearLayout archiveRepo;
|
||||||
private TextView repoBranch;
|
private TextView repoBranch;
|
||||||
|
private TextView htmlUrl;
|
||||||
|
|
||||||
private MyReposViewHolder(View itemView) {
|
private MyReposViewHolder(View itemView) {
|
||||||
|
|
||||||
@ -78,6 +83,7 @@ public class MyReposListAdapter extends RecyclerView.Adapter<MyReposListAdapter.
|
|||||||
isRepoAdmin = itemView.findViewById(R.id.repoIsAdmin);
|
isRepoAdmin = itemView.findViewById(R.id.repoIsAdmin);
|
||||||
archiveRepo = itemView.findViewById(R.id.archiveRepoFrame);
|
archiveRepo = itemView.findViewById(R.id.archiveRepoFrame);
|
||||||
repoBranch = itemView.findViewById(R.id.repoBranch);
|
repoBranch = itemView.findViewById(R.id.repoBranch);
|
||||||
|
htmlUrl = itemView.findViewById(R.id.htmlUrl);
|
||||||
|
|
||||||
itemView.setOnClickListener(v -> {
|
itemView.setOnClickListener(v -> {
|
||||||
|
|
||||||
@ -145,7 +151,7 @@ public class MyReposListAdapter extends RecyclerView.Adapter<MyReposListAdapter.
|
|||||||
|
|
||||||
if(response.code() != 404) {
|
if(response.code() != 404) {
|
||||||
|
|
||||||
Toasty.info(context, context.getString(R.string.genericApiStatusError));
|
Toasty.error(context, context.getString(R.string.genericApiStatusError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +163,7 @@ public class MyReposListAdapter extends RecyclerView.Adapter<MyReposListAdapter.
|
|||||||
public void onFailure(@NonNull Call<WatchInfo> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<WatchInfo> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
tinyDb.putBoolean("repoWatch", false);
|
tinyDb.putBoolean("repoWatch", false);
|
||||||
Toasty.info(context, context.getString(R.string.genericApiStatusError));
|
Toasty.error(context, context.getString(R.string.genericApiStatusError));
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -177,6 +183,8 @@ public class MyReposListAdapter extends RecyclerView.Adapter<MyReposListAdapter.
|
|||||||
TextView repoOpenInBrowser = view.findViewById(R.id.repoOpenInBrowser);
|
TextView repoOpenInBrowser = view.findViewById(R.id.repoOpenInBrowser);
|
||||||
TextView repoStargazers = view.findViewById(R.id.repoStargazers);
|
TextView repoStargazers = view.findViewById(R.id.repoStargazers);
|
||||||
TextView repoWatchers = view.findViewById(R.id.repoWatchers);
|
TextView repoWatchers = view.findViewById(R.id.repoWatchers);
|
||||||
|
TextView repoForksList = view.findViewById(R.id.repoForksList);
|
||||||
|
TextView repoCopyUrl = view.findViewById(R.id.repoCopyUrl);
|
||||||
TextView bottomSheetHeader = view.findViewById(R.id.bottomSheetHeader);
|
TextView bottomSheetHeader = view.findViewById(R.id.bottomSheetHeader);
|
||||||
|
|
||||||
bottomSheetHeader.setText(String.format("%s / %s", repoFullName.getText().toString().split("/")[0], repoFullName.getText().toString().split("/")[1]));
|
bottomSheetHeader.setText(String.format("%s / %s", repoFullName.getText().toString().split("/")[0], repoFullName.getText().toString().split("/")[1]));
|
||||||
@ -184,6 +192,17 @@ public class MyReposListAdapter extends RecyclerView.Adapter<MyReposListAdapter.
|
|||||||
dialog.setContentView(view);
|
dialog.setContentView(view);
|
||||||
dialog.show();
|
dialog.show();
|
||||||
|
|
||||||
|
repoCopyUrl.setOnClickListener(openInBrowser -> {
|
||||||
|
|
||||||
|
ClipboardManager clipboard = (ClipboardManager) Objects.requireNonNull(context).getSystemService(Context.CLIPBOARD_SERVICE);
|
||||||
|
ClipData clip = ClipData.newPlainText("repoUrl", htmlUrl.getText().toString());
|
||||||
|
assert clipboard != null;
|
||||||
|
clipboard.setPrimaryClip(clip);
|
||||||
|
|
||||||
|
Toasty.info(context, context.getString(R.string.copyIssueUrlToastMsg));
|
||||||
|
dialog.dismiss();
|
||||||
|
});
|
||||||
|
|
||||||
repoOpenInBrowser.setOnClickListener(openInBrowser -> {
|
repoOpenInBrowser.setOnClickListener(openInBrowser -> {
|
||||||
|
|
||||||
Intent intentOpenInBrowser = new Intent(context, OpenRepoInBrowserActivity.class);
|
Intent intentOpenInBrowser = new Intent(context, OpenRepoInBrowserActivity.class);
|
||||||
@ -211,6 +230,15 @@ public class MyReposListAdapter extends RecyclerView.Adapter<MyReposListAdapter.
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
repoForksList.setOnClickListener(forks -> {
|
||||||
|
|
||||||
|
Intent intentW = new Intent(context, RepoForksActivity.class);
|
||||||
|
intentW.putExtra("repoFullNameForForks", repoFullName.getText());
|
||||||
|
context.startActivity(intentW);
|
||||||
|
dialog.dismiss();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -238,6 +266,7 @@ public class MyReposListAdapter extends RecyclerView.Adapter<MyReposListAdapter.
|
|||||||
UserRepositories currentItem = reposList.get(position);
|
UserRepositories currentItem = reposList.get(position);
|
||||||
holder.repoDescription.setVisibility(View.GONE);
|
holder.repoDescription.setVisibility(View.GONE);
|
||||||
holder.repoBranch.setText(currentItem.getDefault_branch());
|
holder.repoBranch.setText(currentItem.getDefault_branch());
|
||||||
|
holder.htmlUrl.setText(currentItem.getHtml_url());
|
||||||
|
|
||||||
ColorGenerator generator = ColorGenerator.MATERIAL;
|
ColorGenerator generator = ColorGenerator.MATERIAL;
|
||||||
int color = generator.getColor(currentItem.getName());
|
int color = generator.getColor(currentItem.getName());
|
||||||
@ -268,7 +297,7 @@ public class MyReposListAdapter extends RecyclerView.Adapter<MyReposListAdapter.
|
|||||||
holder.repoType.setText(R.string.strPrivate);
|
holder.repoType.setText(R.string.strPrivate);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
holder.repoPrivatePublic.setImageResource(R.drawable.ic_unlock);
|
holder.repoPrivatePublic.setVisibility(View.GONE);
|
||||||
holder.repoType.setText(R.string.strPublic);
|
holder.repoType.setText(R.string.strPublic);
|
||||||
}
|
}
|
||||||
holder.repoStars.setText(currentItem.getStars_count());
|
holder.repoStars.setText(currentItem.getStars_count());
|
||||||
|
@ -11,6 +11,9 @@ import android.widget.TextView;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import org.mian.gitnex.R;
|
import org.mian.gitnex.R;
|
||||||
|
import org.mian.gitnex.database.api.RepositoriesApi;
|
||||||
|
import org.mian.gitnex.database.models.Repository;
|
||||||
|
import org.mian.gitnex.helpers.TinyDB;
|
||||||
import org.mian.gitnex.models.NotificationThread;
|
import org.mian.gitnex.models.NotificationThread;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -24,9 +27,11 @@ public class NotificationsAdapter extends RecyclerView.Adapter<NotificationsAdap
|
|||||||
private List<NotificationThread> notificationThreads;
|
private List<NotificationThread> notificationThreads;
|
||||||
private OnMoreClickedListener onMoreClickedListener;
|
private OnMoreClickedListener onMoreClickedListener;
|
||||||
private OnNotificationClickedListener onNotificationClickedListener;
|
private OnNotificationClickedListener onNotificationClickedListener;
|
||||||
|
private TinyDB tinyDb;
|
||||||
|
|
||||||
public NotificationsAdapter(Context context, List<NotificationThread> notificationThreads, OnMoreClickedListener onMoreClickedListener, OnNotificationClickedListener onNotificationClickedListener) {
|
public NotificationsAdapter(Context context, List<NotificationThread> notificationThreads, OnMoreClickedListener onMoreClickedListener, OnNotificationClickedListener onNotificationClickedListener) {
|
||||||
|
|
||||||
|
this.tinyDb = new TinyDB(context);
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.notificationThreads = notificationThreads;
|
this.notificationThreads = notificationThreads;
|
||||||
this.onMoreClickedListener = onMoreClickedListener;
|
this.onMoreClickedListener = onMoreClickedListener;
|
||||||
@ -101,7 +106,33 @@ public class NotificationsAdapter extends RecyclerView.Adapter<NotificationsAdap
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
holder.frame.setOnClickListener(v -> onNotificationClickedListener.onNotificationClicked(notificationThread));
|
holder.frame.setOnClickListener(v -> {
|
||||||
|
|
||||||
|
onNotificationClickedListener.onNotificationClicked(notificationThread);
|
||||||
|
|
||||||
|
String[] parts = notificationThread.getRepository().getFullname().split("/");
|
||||||
|
final String repoOwner = parts[0];
|
||||||
|
final String repoName = parts[1];
|
||||||
|
|
||||||
|
int currentActiveAccountId = tinyDb.getInt("currentActiveAccountId");
|
||||||
|
RepositoriesApi repositoryData = new RepositoriesApi(context);
|
||||||
|
|
||||||
|
Integer count = repositoryData.checkRepository(currentActiveAccountId, repoOwner, repoName);
|
||||||
|
|
||||||
|
if(count == 0) {
|
||||||
|
|
||||||
|
long id = repositoryData.insertRepository(currentActiveAccountId, repoOwner, repoName);
|
||||||
|
tinyDb.putLong("repositoryId", id);
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
Repository data = repositoryData.getRepository(currentActiveAccountId, repoOwner, repoName);
|
||||||
|
tinyDb.putLong("repositoryId", data.getRepositoryId());
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
holder.more.setOnClickListener(v -> onMoreClickedListener.onMoreClicked(notificationThread));
|
holder.more.setOnClickListener(v -> onMoreClickedListener.onMoreClicked(notificationThread));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ public class ProfileEmailsAdapter extends RecyclerView.Adapter<ProfileEmailsAdap
|
|||||||
if(currentItem.getPrimary()) {
|
if(currentItem.getPrimary()) {
|
||||||
TextDrawable drawable = TextDrawable.builder()
|
TextDrawable drawable = TextDrawable.builder()
|
||||||
.beginConfig()
|
.beginConfig()
|
||||||
.textColor(mCtx.getResources().getColor(R.color.white))
|
.textColor(mCtx.getResources().getColor(R.color.colorWhite))
|
||||||
.fontSize(36)
|
.fontSize(36)
|
||||||
.width(220)
|
.width(220)
|
||||||
.height(60)
|
.height(60)
|
||||||
|
396
app/src/main/java/org/mian/gitnex/adapters/RepoForksAdapter.java
Normal file
396
app/src/main/java/org/mian/gitnex/adapters/RepoForksAdapter.java
Normal file
@ -0,0 +1,396 @@
|
|||||||
|
package org.mian.gitnex.adapters;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.graphics.Typeface;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
import com.amulyakhare.textdrawable.TextDrawable;
|
||||||
|
import com.amulyakhare.textdrawable.util.ColorGenerator;
|
||||||
|
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||||
|
import org.mian.gitnex.R;
|
||||||
|
import org.mian.gitnex.activities.OpenRepoInBrowserActivity;
|
||||||
|
import org.mian.gitnex.activities.RepoDetailActivity;
|
||||||
|
import org.mian.gitnex.activities.RepoForksActivity;
|
||||||
|
import org.mian.gitnex.activities.RepoStargazersActivity;
|
||||||
|
import org.mian.gitnex.activities.RepoWatchersActivity;
|
||||||
|
import org.mian.gitnex.clients.PicassoService;
|
||||||
|
import org.mian.gitnex.clients.RetrofitClient;
|
||||||
|
import org.mian.gitnex.database.api.RepositoriesApi;
|
||||||
|
import org.mian.gitnex.database.models.Repository;
|
||||||
|
import org.mian.gitnex.helpers.RoundedTransformation;
|
||||||
|
import org.mian.gitnex.helpers.TinyDB;
|
||||||
|
import org.mian.gitnex.helpers.Toasty;
|
||||||
|
import org.mian.gitnex.models.UserRepositories;
|
||||||
|
import org.mian.gitnex.models.WatchInfo;
|
||||||
|
import java.util.List;
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.Callback;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Author M M Arif
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class RepoForksAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
|
|
||||||
|
private Context ctx;
|
||||||
|
private final int TYPE_LOAD = 0;
|
||||||
|
private List<UserRepositories> forksList;
|
||||||
|
private OnLoadMoreListener loadMoreListener;
|
||||||
|
private boolean isLoading = false;
|
||||||
|
private boolean isMoreDataAvailable = true;
|
||||||
|
|
||||||
|
public RepoForksAdapter(Context ctx, List<UserRepositories> forksListMain) {
|
||||||
|
|
||||||
|
this.ctx = ctx;
|
||||||
|
this.forksList = forksListMain;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
|
||||||
|
LayoutInflater inflater = LayoutInflater.from(ctx);
|
||||||
|
|
||||||
|
if(viewType == TYPE_LOAD) {
|
||||||
|
return new RepoForksAdapter.ForksHolder(inflater.inflate(R.layout.list_repositories, parent, false));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return new LoadHolder(inflater.inflate(R.layout.row_load, parent, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||||
|
|
||||||
|
if(position >= getItemCount() - 1 && isMoreDataAvailable && !isLoading && loadMoreListener != null) {
|
||||||
|
|
||||||
|
isLoading = true;
|
||||||
|
loadMoreListener.onLoadMore();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(getItemViewType(position) == TYPE_LOAD) {
|
||||||
|
|
||||||
|
((RepoForksAdapter.ForksHolder) holder).bindData(forksList.get(position));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemViewType(int position) {
|
||||||
|
|
||||||
|
if(forksList.get(position).getName() != null) {
|
||||||
|
return TYPE_LOAD;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
|
||||||
|
return forksList.size();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class ForksHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
|
private ImageView image;
|
||||||
|
private TextView repoName;
|
||||||
|
private TextView repoDescription;
|
||||||
|
private TextView fullName;
|
||||||
|
private CheckBox isRepoAdmin;
|
||||||
|
private ImageView repoPrivatePublic;
|
||||||
|
private TextView repoStars;
|
||||||
|
private TextView repoForks;
|
||||||
|
private TextView repoOpenIssuesCount;
|
||||||
|
private TextView repoType;
|
||||||
|
private LinearLayout archiveRepo;
|
||||||
|
private TextView repoBranch;
|
||||||
|
private ImageView reposDropdownMenu;
|
||||||
|
|
||||||
|
ForksHolder(View itemView) {
|
||||||
|
|
||||||
|
super(itemView);
|
||||||
|
|
||||||
|
repoName = itemView.findViewById(R.id.repoName);
|
||||||
|
repoDescription = itemView.findViewById(R.id.repoDescription);
|
||||||
|
isRepoAdmin = itemView.findViewById(R.id.repoIsAdmin);
|
||||||
|
image = itemView.findViewById(R.id.imageAvatar);
|
||||||
|
fullName = itemView.findViewById(R.id.repoFullName);
|
||||||
|
repoPrivatePublic = itemView.findViewById(R.id.imageRepoType);
|
||||||
|
repoStars = itemView.findViewById(R.id.repoStars);
|
||||||
|
repoForks = itemView.findViewById(R.id.repoForks);
|
||||||
|
repoOpenIssuesCount = itemView.findViewById(R.id.repoOpenIssuesCount);
|
||||||
|
reposDropdownMenu = itemView.findViewById(R.id.reposDropdownMenu);
|
||||||
|
repoType = itemView.findViewById(R.id.repoType);
|
||||||
|
archiveRepo = itemView.findViewById(R.id.archiveRepoFrame);
|
||||||
|
repoBranch = itemView.findViewById(R.id.repoBranch);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
|
void bindData(UserRepositories forksModel) {
|
||||||
|
|
||||||
|
repoDescription.setVisibility(View.GONE);
|
||||||
|
repoBranch.setText(forksModel.getDefault_branch());
|
||||||
|
|
||||||
|
ColorGenerator generator = ColorGenerator.MATERIAL;
|
||||||
|
int color = generator.getColor(forksModel.getName());
|
||||||
|
String firstCharacter = String.valueOf(forksModel.getName().charAt(0));
|
||||||
|
|
||||||
|
TextDrawable drawable = TextDrawable.builder().beginConfig().useFont(Typeface.DEFAULT).fontSize(18).toUpperCase().width(28).height(28)
|
||||||
|
.endConfig().buildRoundRect(firstCharacter, color, 3);
|
||||||
|
|
||||||
|
if(forksModel.getAvatar_url() != null) {
|
||||||
|
if(!forksModel.getAvatar_url().equals("")) {
|
||||||
|
PicassoService.getInstance(ctx).get().load(forksModel.getAvatar_url()).placeholder(R.drawable.loader_animated)
|
||||||
|
.transform(new RoundedTransformation(8, 0)).resize(120, 120).centerCrop().into(image);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
image.setImageDrawable(drawable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
image.setImageDrawable(drawable);
|
||||||
|
}
|
||||||
|
|
||||||
|
repoName.setText(forksModel.getName());
|
||||||
|
|
||||||
|
if(!forksModel.getDescription().equals("")) {
|
||||||
|
repoDescription.setVisibility(View.VISIBLE);
|
||||||
|
repoDescription.setText(forksModel.getDescription());
|
||||||
|
}
|
||||||
|
fullName.setText(forksModel.getFullname());
|
||||||
|
|
||||||
|
if(forksModel.getPrivateFlag()) {
|
||||||
|
repoPrivatePublic.setImageResource(R.drawable.ic_lock);
|
||||||
|
repoType.setText(R.string.strPrivate);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
repoPrivatePublic.setVisibility(View.GONE);
|
||||||
|
repoType.setText(R.string.strPublic);
|
||||||
|
}
|
||||||
|
|
||||||
|
repoStars.setText(forksModel.getStars_count());
|
||||||
|
repoForks.setText(forksModel.getForks_count());
|
||||||
|
repoOpenIssuesCount.setText(forksModel.getOpen_issues_count());
|
||||||
|
|
||||||
|
if(isRepoAdmin == null) {
|
||||||
|
isRepoAdmin = new CheckBox(ctx);
|
||||||
|
}
|
||||||
|
isRepoAdmin.setChecked(forksModel.getPermissions().isAdmin());
|
||||||
|
|
||||||
|
if(forksModel.isArchived()) {
|
||||||
|
archiveRepo.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
archiveRepo.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
itemView.setOnClickListener(v -> {
|
||||||
|
|
||||||
|
Context context = v.getContext();
|
||||||
|
TextView repoFullName = v.findViewById(R.id.repoFullName);
|
||||||
|
TextView repoType_ = v.findViewById(R.id.repoType);
|
||||||
|
|
||||||
|
Intent intent = new Intent(context, RepoDetailActivity.class);
|
||||||
|
intent.putExtra("repoFullName", repoFullName.getText().toString());
|
||||||
|
|
||||||
|
TinyDB tinyDb = new TinyDB(context);
|
||||||
|
tinyDb.putString("repoFullName", repoFullName.getText().toString());
|
||||||
|
tinyDb.putString("repoType", repoType_.getText().toString());
|
||||||
|
//tinyDb.putBoolean("resumeIssues", true);
|
||||||
|
tinyDb.putBoolean("isRepoAdmin", isRepoAdmin.isChecked());
|
||||||
|
tinyDb.putString("repoBranch", repoBranch.getText().toString());
|
||||||
|
|
||||||
|
String[] parts = repoFullName.getText().toString().split("/");
|
||||||
|
final String repoOwner = parts[0];
|
||||||
|
final String repoName = parts[1];
|
||||||
|
|
||||||
|
int currentActiveAccountId = tinyDb.getInt("currentActiveAccountId");
|
||||||
|
RepositoriesApi repositoryData = new RepositoriesApi(context);
|
||||||
|
|
||||||
|
//RepositoriesRepository.deleteRepositoriesByAccount(currentActiveAccountId);
|
||||||
|
Integer count = repositoryData.checkRepository(currentActiveAccountId, repoOwner, repoName);
|
||||||
|
|
||||||
|
if(count == 0) {
|
||||||
|
|
||||||
|
long id = repositoryData.insertRepository(currentActiveAccountId, repoOwner, repoName);
|
||||||
|
tinyDb.putLong("repositoryId", id);
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
Repository data = repositoryData.getRepository(currentActiveAccountId, repoOwner, repoName);
|
||||||
|
tinyDb.putLong("repositoryId", data.getRepositoryId());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//store if user is watching this repo
|
||||||
|
{
|
||||||
|
|
||||||
|
final String instanceUrl = tinyDb.getString("instanceUrl");
|
||||||
|
final String token = "token " + tinyDb.getString(tinyDb.getString("loginUid") + "-token");
|
||||||
|
|
||||||
|
WatchInfo watch = new WatchInfo();
|
||||||
|
|
||||||
|
Call<WatchInfo> call;
|
||||||
|
|
||||||
|
call = RetrofitClient.getInstance(instanceUrl, context).getApiInterface().checkRepoWatchStatus(token, repoOwner, repoName);
|
||||||
|
|
||||||
|
call.enqueue(new Callback<WatchInfo>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponse(@NonNull Call<WatchInfo> call, @NonNull retrofit2.Response<WatchInfo> response) {
|
||||||
|
|
||||||
|
if(response.isSuccessful()) {
|
||||||
|
|
||||||
|
assert response.body() != null;
|
||||||
|
tinyDb.putBoolean("repoWatch", response.body().getSubscribed());
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
tinyDb.putBoolean("repoWatch", false);
|
||||||
|
|
||||||
|
if(response.code() != 404) {
|
||||||
|
|
||||||
|
Toasty.error(context, context.getString(R.string.genericApiStatusError));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(@NonNull Call<WatchInfo> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
|
tinyDb.putBoolean("repoWatch", false);
|
||||||
|
Toasty.error(context, context.getString(R.string.genericApiStatusError));
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
context.startActivity(intent);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
reposDropdownMenu.setOnClickListener(v -> {
|
||||||
|
|
||||||
|
final Context context = v.getContext();
|
||||||
|
|
||||||
|
@SuppressLint("InflateParams") View view = LayoutInflater.from(context).inflate(R.layout.bottom_sheet_repository_in_list, null);
|
||||||
|
|
||||||
|
TextView repoOpenInBrowser = view.findViewById(R.id.repoOpenInBrowser);
|
||||||
|
TextView repoStargazers = view.findViewById(R.id.repoStargazers);
|
||||||
|
TextView repoWatchers = view.findViewById(R.id.repoWatchers);
|
||||||
|
TextView repoForksList = view.findViewById(R.id.repoForksList);
|
||||||
|
TextView bottomSheetHeader = view.findViewById(R.id.bottomSheetHeader);
|
||||||
|
|
||||||
|
bottomSheetHeader
|
||||||
|
.setText(String.format("%s / %s", fullName.getText().toString().split("/")[0], fullName.getText().toString().split("/")[1]));
|
||||||
|
BottomSheetDialog dialog = new BottomSheetDialog(context);
|
||||||
|
dialog.setContentView(view);
|
||||||
|
dialog.show();
|
||||||
|
|
||||||
|
repoOpenInBrowser.setOnClickListener(openInBrowser -> {
|
||||||
|
|
||||||
|
Intent intentOpenInBrowser = new Intent(context, OpenRepoInBrowserActivity.class);
|
||||||
|
intentOpenInBrowser.putExtra("repoFullNameBrowser", fullName.getText());
|
||||||
|
context.startActivity(intentOpenInBrowser);
|
||||||
|
dialog.dismiss();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
repoStargazers.setOnClickListener(stargazers -> {
|
||||||
|
|
||||||
|
Intent intent = new Intent(context, RepoStargazersActivity.class);
|
||||||
|
intent.putExtra("repoFullNameForStars", fullName.getText());
|
||||||
|
context.startActivity(intent);
|
||||||
|
dialog.dismiss();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
repoWatchers.setOnClickListener(watchers -> {
|
||||||
|
|
||||||
|
Intent intentW = new Intent(context, RepoWatchersActivity.class);
|
||||||
|
intentW.putExtra("repoFullNameForWatchers", fullName.getText());
|
||||||
|
context.startActivity(intentW);
|
||||||
|
dialog.dismiss();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
repoForksList.setOnClickListener(watchers -> {
|
||||||
|
|
||||||
|
Intent intentW = new Intent(context, RepoForksActivity.class);
|
||||||
|
intentW.putExtra("repoFullNameForForks", fullName.getText());
|
||||||
|
context.startActivity(intentW);
|
||||||
|
dialog.dismiss();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static class LoadHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
|
LoadHolder(View itemView) {
|
||||||
|
|
||||||
|
super(itemView);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMoreDataAvailable(boolean moreDataAvailable) {
|
||||||
|
|
||||||
|
isMoreDataAvailable = moreDataAvailable;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void notifyDataChanged() {
|
||||||
|
|
||||||
|
notifyDataSetChanged();
|
||||||
|
isLoading = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnLoadMoreListener {
|
||||||
|
|
||||||
|
void onLoadMore();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLoadMoreListener(RepoForksAdapter.OnLoadMoreListener loadMoreListener) {
|
||||||
|
|
||||||
|
this.loadMoreListener = loadMoreListener;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateList(List<UserRepositories> list) {
|
||||||
|
|
||||||
|
forksList = list;
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,6 +1,8 @@
|
|||||||
package org.mian.gitnex.adapters;
|
package org.mian.gitnex.adapters;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.ClipData;
|
||||||
|
import android.content.ClipboardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
@ -23,6 +25,7 @@ import org.mian.gitnex.activities.OpenRepoInBrowserActivity;
|
|||||||
import org.mian.gitnex.activities.RepoDetailActivity;
|
import org.mian.gitnex.activities.RepoDetailActivity;
|
||||||
import org.mian.gitnex.activities.RepoStargazersActivity;
|
import org.mian.gitnex.activities.RepoStargazersActivity;
|
||||||
import org.mian.gitnex.activities.RepoWatchersActivity;
|
import org.mian.gitnex.activities.RepoWatchersActivity;
|
||||||
|
import org.mian.gitnex.activities.RepoForksActivity;
|
||||||
import org.mian.gitnex.clients.PicassoService;
|
import org.mian.gitnex.clients.PicassoService;
|
||||||
import org.mian.gitnex.clients.RetrofitClient;
|
import org.mian.gitnex.clients.RetrofitClient;
|
||||||
import org.mian.gitnex.database.api.RepositoriesApi;
|
import org.mian.gitnex.database.api.RepositoriesApi;
|
||||||
@ -34,6 +37,7 @@ import org.mian.gitnex.models.UserRepositories;
|
|||||||
import org.mian.gitnex.models.WatchInfo;
|
import org.mian.gitnex.models.WatchInfo;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
import retrofit2.Callback;
|
||||||
|
|
||||||
@ -61,6 +65,7 @@ public class ReposListAdapter extends RecyclerView.Adapter<ReposListAdapter.Repo
|
|||||||
private TextView repoType;
|
private TextView repoType;
|
||||||
private LinearLayout archiveRepo;
|
private LinearLayout archiveRepo;
|
||||||
private TextView repoBranch;
|
private TextView repoBranch;
|
||||||
|
private TextView htmlUrl;
|
||||||
|
|
||||||
private ReposViewHolder(View itemView) {
|
private ReposViewHolder(View itemView) {
|
||||||
|
|
||||||
@ -78,6 +83,7 @@ public class ReposListAdapter extends RecyclerView.Adapter<ReposListAdapter.Repo
|
|||||||
repoType = itemView.findViewById(R.id.repoType);
|
repoType = itemView.findViewById(R.id.repoType);
|
||||||
archiveRepo = itemView.findViewById(R.id.archiveRepoFrame);
|
archiveRepo = itemView.findViewById(R.id.archiveRepoFrame);
|
||||||
repoBranch = itemView.findViewById(R.id.repoBranch);
|
repoBranch = itemView.findViewById(R.id.repoBranch);
|
||||||
|
htmlUrl = itemView.findViewById(R.id.htmlUrl);
|
||||||
|
|
||||||
itemView.setOnClickListener(v -> {
|
itemView.setOnClickListener(v -> {
|
||||||
|
|
||||||
@ -146,7 +152,7 @@ public class ReposListAdapter extends RecyclerView.Adapter<ReposListAdapter.Repo
|
|||||||
|
|
||||||
if(response.code() != 404) {
|
if(response.code() != 404) {
|
||||||
|
|
||||||
Toasty.info(context, context.getString(R.string.genericApiStatusError));
|
Toasty.error(context, context.getString(R.string.genericApiStatusError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +164,7 @@ public class ReposListAdapter extends RecyclerView.Adapter<ReposListAdapter.Repo
|
|||||||
public void onFailure(@NonNull Call<WatchInfo> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<WatchInfo> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
tinyDb.putBoolean("repoWatch", false);
|
tinyDb.putBoolean("repoWatch", false);
|
||||||
Toasty.info(context, context.getString(R.string.genericApiStatusError));
|
Toasty.error(context, context.getString(R.string.genericApiStatusError));
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -178,6 +184,8 @@ public class ReposListAdapter extends RecyclerView.Adapter<ReposListAdapter.Repo
|
|||||||
TextView repoOpenInBrowser = view.findViewById(R.id.repoOpenInBrowser);
|
TextView repoOpenInBrowser = view.findViewById(R.id.repoOpenInBrowser);
|
||||||
TextView repoStargazers = view.findViewById(R.id.repoStargazers);
|
TextView repoStargazers = view.findViewById(R.id.repoStargazers);
|
||||||
TextView repoWatchers = view.findViewById(R.id.repoWatchers);
|
TextView repoWatchers = view.findViewById(R.id.repoWatchers);
|
||||||
|
TextView repoForksList = view.findViewById(R.id.repoForksList);
|
||||||
|
TextView repoCopyUrl = view.findViewById(R.id.repoCopyUrl);
|
||||||
TextView bottomSheetHeader = view.findViewById(R.id.bottomSheetHeader);
|
TextView bottomSheetHeader = view.findViewById(R.id.bottomSheetHeader);
|
||||||
|
|
||||||
bottomSheetHeader.setText(String.format("%s / %s", fullName.getText().toString().split("/")[0], fullName.getText().toString().split("/")[1]));
|
bottomSheetHeader.setText(String.format("%s / %s", fullName.getText().toString().split("/")[0], fullName.getText().toString().split("/")[1]));
|
||||||
@ -185,6 +193,17 @@ public class ReposListAdapter extends RecyclerView.Adapter<ReposListAdapter.Repo
|
|||||||
dialog.setContentView(view);
|
dialog.setContentView(view);
|
||||||
dialog.show();
|
dialog.show();
|
||||||
|
|
||||||
|
repoCopyUrl.setOnClickListener(openInBrowser -> {
|
||||||
|
|
||||||
|
ClipboardManager clipboard = (ClipboardManager) Objects.requireNonNull(context).getSystemService(Context.CLIPBOARD_SERVICE);
|
||||||
|
ClipData clip = ClipData.newPlainText("repoUrl", htmlUrl.getText().toString());
|
||||||
|
assert clipboard != null;
|
||||||
|
clipboard.setPrimaryClip(clip);
|
||||||
|
|
||||||
|
Toasty.info(context, context.getString(R.string.copyIssueUrlToastMsg));
|
||||||
|
dialog.dismiss();
|
||||||
|
});
|
||||||
|
|
||||||
repoOpenInBrowser.setOnClickListener(openInBrowser -> {
|
repoOpenInBrowser.setOnClickListener(openInBrowser -> {
|
||||||
|
|
||||||
Intent intentOpenInBrowser = new Intent(context, OpenRepoInBrowserActivity.class);
|
Intent intentOpenInBrowser = new Intent(context, OpenRepoInBrowserActivity.class);
|
||||||
@ -212,6 +231,15 @@ public class ReposListAdapter extends RecyclerView.Adapter<ReposListAdapter.Repo
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
repoForksList.setOnClickListener(forks -> {
|
||||||
|
|
||||||
|
Intent intentW = new Intent(context, RepoForksActivity.class);
|
||||||
|
intentW.putExtra("repoFullNameForForks", fullName.getText());
|
||||||
|
context.startActivity(intentW);
|
||||||
|
dialog.dismiss();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -239,6 +267,7 @@ public class ReposListAdapter extends RecyclerView.Adapter<ReposListAdapter.Repo
|
|||||||
UserRepositories currentItem = reposList.get(position);
|
UserRepositories currentItem = reposList.get(position);
|
||||||
holder.repoDescription.setVisibility(View.GONE);
|
holder.repoDescription.setVisibility(View.GONE);
|
||||||
holder.repoBranch.setText(currentItem.getDefault_branch());
|
holder.repoBranch.setText(currentItem.getDefault_branch());
|
||||||
|
holder.htmlUrl.setText(currentItem.getHtml_url());
|
||||||
|
|
||||||
ColorGenerator generator = ColorGenerator.MATERIAL;
|
ColorGenerator generator = ColorGenerator.MATERIAL;
|
||||||
int color = generator.getColor(currentItem.getName());
|
int color = generator.getColor(currentItem.getName());
|
||||||
@ -269,7 +298,7 @@ public class ReposListAdapter extends RecyclerView.Adapter<ReposListAdapter.Repo
|
|||||||
holder.repoType.setText(R.string.strPrivate);
|
holder.repoType.setText(R.string.strPrivate);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
holder.repoPrivatePublic.setImageResource(R.drawable.ic_unlock);
|
holder.repoPrivatePublic.setVisibility(View.GONE);
|
||||||
holder.repoType.setText(R.string.strPublic);
|
holder.repoType.setText(R.string.strPublic);
|
||||||
}
|
}
|
||||||
holder.repoStars.setText(currentItem.getStars_count());
|
holder.repoStars.setText(currentItem.getStars_count());
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package org.mian.gitnex.adapters;
|
package org.mian.gitnex.adapters;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.ClipData;
|
||||||
|
import android.content.ClipboardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
@ -23,6 +25,7 @@ import org.mian.gitnex.activities.OpenRepoInBrowserActivity;
|
|||||||
import org.mian.gitnex.activities.RepoDetailActivity;
|
import org.mian.gitnex.activities.RepoDetailActivity;
|
||||||
import org.mian.gitnex.activities.RepoStargazersActivity;
|
import org.mian.gitnex.activities.RepoStargazersActivity;
|
||||||
import org.mian.gitnex.activities.RepoWatchersActivity;
|
import org.mian.gitnex.activities.RepoWatchersActivity;
|
||||||
|
import org.mian.gitnex.activities.RepoForksActivity;
|
||||||
import org.mian.gitnex.clients.PicassoService;
|
import org.mian.gitnex.clients.PicassoService;
|
||||||
import org.mian.gitnex.clients.RetrofitClient;
|
import org.mian.gitnex.clients.RetrofitClient;
|
||||||
import org.mian.gitnex.database.api.RepositoriesApi;
|
import org.mian.gitnex.database.api.RepositoriesApi;
|
||||||
@ -34,6 +37,7 @@ import org.mian.gitnex.models.UserRepositories;
|
|||||||
import org.mian.gitnex.models.WatchInfo;
|
import org.mian.gitnex.models.WatchInfo;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
import retrofit2.Callback;
|
||||||
|
|
||||||
@ -61,6 +65,7 @@ public class RepositoriesByOrgAdapter extends RecyclerView.Adapter<RepositoriesB
|
|||||||
private TextView repoType;
|
private TextView repoType;
|
||||||
private LinearLayout archiveRepo;
|
private LinearLayout archiveRepo;
|
||||||
private TextView repoBranch;
|
private TextView repoBranch;
|
||||||
|
private TextView htmlUrl;
|
||||||
|
|
||||||
private OrgReposViewHolder(View itemView) {
|
private OrgReposViewHolder(View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
@ -77,6 +82,7 @@ public class RepositoriesByOrgAdapter extends RecyclerView.Adapter<RepositoriesB
|
|||||||
repoType = itemView.findViewById(R.id.repoType);
|
repoType = itemView.findViewById(R.id.repoType);
|
||||||
archiveRepo = itemView.findViewById(R.id.archiveRepoFrame);
|
archiveRepo = itemView.findViewById(R.id.archiveRepoFrame);
|
||||||
repoBranch = itemView.findViewById(R.id.repoBranch);
|
repoBranch = itemView.findViewById(R.id.repoBranch);
|
||||||
|
htmlUrl = itemView.findViewById(R.id.htmlUrl);
|
||||||
|
|
||||||
itemView.setOnClickListener(v -> {
|
itemView.setOnClickListener(v -> {
|
||||||
|
|
||||||
@ -141,7 +147,7 @@ public class RepositoriesByOrgAdapter extends RecyclerView.Adapter<RepositoriesB
|
|||||||
|
|
||||||
if(response.code() != 404) {
|
if(response.code() != 404) {
|
||||||
|
|
||||||
Toasty.info(context, context.getString(R.string.genericApiStatusError));
|
Toasty.error(context, context.getString(R.string.genericApiStatusError));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +159,7 @@ public class RepositoriesByOrgAdapter extends RecyclerView.Adapter<RepositoriesB
|
|||||||
public void onFailure(@NonNull Call<WatchInfo> call, @NonNull Throwable t) {
|
public void onFailure(@NonNull Call<WatchInfo> call, @NonNull Throwable t) {
|
||||||
|
|
||||||
tinyDb.putBoolean("repoWatch", false);
|
tinyDb.putBoolean("repoWatch", false);
|
||||||
Toasty.info(context, context.getString(R.string.genericApiStatusError));
|
Toasty.error(context, context.getString(R.string.genericApiStatusError));
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -173,6 +179,8 @@ public class RepositoriesByOrgAdapter extends RecyclerView.Adapter<RepositoriesB
|
|||||||
TextView repoOpenInBrowser = view.findViewById(R.id.repoOpenInBrowser);
|
TextView repoOpenInBrowser = view.findViewById(R.id.repoOpenInBrowser);
|
||||||
TextView repoStargazers = view.findViewById(R.id.repoStargazers);
|
TextView repoStargazers = view.findViewById(R.id.repoStargazers);
|
||||||
TextView repoWatchers = view.findViewById(R.id.repoWatchers);
|
TextView repoWatchers = view.findViewById(R.id.repoWatchers);
|
||||||
|
TextView repoForksList = view.findViewById(R.id.repoForksList);
|
||||||
|
TextView repoCopyUrl = view.findViewById(R.id.repoCopyUrl);
|
||||||
TextView bottomSheetHeader = view.findViewById(R.id.bottomSheetHeader);
|
TextView bottomSheetHeader = view.findViewById(R.id.bottomSheetHeader);
|
||||||
|
|
||||||
bottomSheetHeader.setText(String.format("%s / %s", fullName.getText().toString().split("/")[0], fullName.getText().toString().split("/")[1]));
|
bottomSheetHeader.setText(String.format("%s / %s", fullName.getText().toString().split("/")[0], fullName.getText().toString().split("/")[1]));
|
||||||
@ -180,6 +188,17 @@ public class RepositoriesByOrgAdapter extends RecyclerView.Adapter<RepositoriesB
|
|||||||
dialog.setContentView(view);
|
dialog.setContentView(view);
|
||||||
dialog.show();
|
dialog.show();
|
||||||
|
|
||||||
|
repoCopyUrl.setOnClickListener(openInBrowser -> {
|
||||||
|
|
||||||
|
ClipboardManager clipboard = (ClipboardManager) Objects.requireNonNull(context).getSystemService(Context.CLIPBOARD_SERVICE);
|
||||||
|
ClipData clip = ClipData.newPlainText("repoUrl", htmlUrl.getText().toString());
|
||||||
|
assert clipboard != null;
|
||||||
|
clipboard.setPrimaryClip(clip);
|
||||||
|
|
||||||
|
Toasty.info(context, context.getString(R.string.copyIssueUrlToastMsg));
|
||||||
|
dialog.dismiss();
|
||||||
|
});
|
||||||
|
|
||||||
repoOpenInBrowser.setOnClickListener(openInBrowser -> {
|
repoOpenInBrowser.setOnClickListener(openInBrowser -> {
|
||||||
|
|
||||||
Intent intentOpenInBrowser = new Intent(context, OpenRepoInBrowserActivity.class);
|
Intent intentOpenInBrowser = new Intent(context, OpenRepoInBrowserActivity.class);
|
||||||
@ -189,7 +208,7 @@ public class RepositoriesByOrgAdapter extends RecyclerView.Adapter<RepositoriesB
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
repoStargazers.setOnClickListener(openInBrowser -> {
|
repoStargazers.setOnClickListener(stargazers -> {
|
||||||
|
|
||||||
Intent intent = new Intent(context, RepoStargazersActivity.class);
|
Intent intent = new Intent(context, RepoStargazersActivity.class);
|
||||||
intent.putExtra("repoFullNameForStars", fullName.getText());
|
intent.putExtra("repoFullNameForStars", fullName.getText());
|
||||||
@ -198,7 +217,7 @@ public class RepositoriesByOrgAdapter extends RecyclerView.Adapter<RepositoriesB
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
repoWatchers.setOnClickListener(openInBrowser -> {
|
repoWatchers.setOnClickListener(watchers -> {
|
||||||
|
|
||||||
Intent intentW = new Intent(context, RepoWatchersActivity.class);
|
Intent intentW = new Intent(context, RepoWatchersActivity.class);
|
||||||
intentW.putExtra("repoFullNameForWatchers", fullName.getText());
|
intentW.putExtra("repoFullNameForWatchers", fullName.getText());
|
||||||
@ -207,6 +226,15 @@ public class RepositoriesByOrgAdapter extends RecyclerView.Adapter<RepositoriesB
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
repoForksList.setOnClickListener(forks -> {
|
||||||
|
|
||||||
|
Intent intentW = new Intent(context, RepoForksActivity.class);
|
||||||
|
intentW.putExtra("repoFullNameForForks", fullName.getText());
|
||||||
|
context.startActivity(intentW);
|
||||||
|
dialog.dismiss();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -232,6 +260,7 @@ public class RepositoriesByOrgAdapter extends RecyclerView.Adapter<RepositoriesB
|
|||||||
UserRepositories currentItem = reposList.get(position);
|
UserRepositories currentItem = reposList.get(position);
|
||||||
holder.repoDescription.setVisibility(View.GONE);
|
holder.repoDescription.setVisibility(View.GONE);
|
||||||
holder.repoBranch.setText(currentItem.getDefault_branch());
|
holder.repoBranch.setText(currentItem.getDefault_branch());
|
||||||
|
holder.htmlUrl.setText(currentItem.getHtml_url());
|
||||||
|
|
||||||
ColorGenerator generator = ColorGenerator.MATERIAL;
|
ColorGenerator generator = ColorGenerator.MATERIAL;
|
||||||
int color = generator.getColor(currentItem.getName());
|
int color = generator.getColor(currentItem.getName());
|
||||||
@ -269,7 +298,7 @@ public class RepositoriesByOrgAdapter extends RecyclerView.Adapter<RepositoriesB
|
|||||||
holder.repoType.setText(R.string.strPrivate);
|
holder.repoType.setText(R.string.strPrivate);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
holder.repoPrivatePublic.setImageResource(R.drawable.ic_unlock);
|
holder.repoPrivatePublic.setVisibility(View.GONE);
|
||||||
holder.repoType.setText(R.string.strPublic);
|
holder.repoType.setText(R.string.strPublic);
|
||||||
}
|
}
|
||||||
holder.repoStars.setText(currentItem.getStars_count());
|
holder.repoStars.setText(currentItem.getStars_count());
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package org.mian.gitnex.adapters;
|
package org.mian.gitnex.adapters;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.ClipData;
|
||||||
|
import android.content.ClipboardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
@ -23,6 +25,7 @@ import org.mian.gitnex.activities.OpenRepoInBrowserActivity;
|
|||||||
import org.mian.gitnex.activities.RepoDetailActivity;
|
import org.mian.gitnex.activities.RepoDetailActivity;
|
||||||
import org.mian.gitnex.activities.RepoStargazersActivity;
|
import org.mian.gitnex.activities.RepoStargazersActivity;
|
||||||
import org.mian.gitnex.activities.RepoWatchersActivity;
|
import org.mian.gitnex.activities.RepoWatchersActivity;
|
||||||
|
import org.mian.gitnex.activities.RepoForksActivity;
|
||||||
import org.mian.gitnex.clients.PicassoService;
|
import org.mian.gitnex.clients.PicassoService;
|
||||||
import org.mian.gitnex.clients.RetrofitClient;
|
import org.mian.gitnex.clients.RetrofitClient;
|
||||||
import org.mian.gitnex.database.api.RepositoriesApi;
|
import org.mian.gitnex.database.api.RepositoriesApi;
|
||||||
@ -34,6 +37,7 @@ import org.mian.gitnex.models.UserRepositories;
|
|||||||
import org.mian.gitnex.models.WatchInfo;
|
import org.mian.gitnex.models.WatchInfo;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
import retrofit2.Callback;
|
||||||
|
|
||||||
@ -61,6 +65,7 @@ public class StarredReposListAdapter extends RecyclerView.Adapter<StarredReposLi
|
|||||||
private TextView repoType;
|
private TextView repoType;
|
||||||
private LinearLayout archiveRepo;
|
private LinearLayout archiveRepo;
|
||||||
private TextView repoBranch;
|
private TextView repoBranch;
|
||||||
|
private TextView htmlUrl;
|
||||||
|
|
||||||
private StarredReposViewHolder(View itemView) {
|
private StarredReposViewHolder(View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
@ -77,6 +82,7 @@ public class StarredReposListAdapter extends RecyclerView.Adapter<StarredReposLi
|
|||||||
repoType = itemView.findViewById(R.id.repoType);
|
repoType = itemView.findViewById(R.id.repoType);
|
||||||
archiveRepo = itemView.findViewById(R.id.archiveRepoFrame);
|
archiveRepo = itemView.findViewById(R.id.archiveRepoFrame);
|
||||||
repoBranch = itemView.findViewById(R.id.repoBranch);
|
repoBranch = itemView.findViewById(R.id.repoBranch);
|
||||||
|
htmlUrl = itemView.findViewById(R.id.htmlUrl);
|
||||||
|
|
||||||
itemView.setOnClickListener(v -> {
|
itemView.setOnClickListener(v -> {
|
||||||
|
|
||||||
@ -176,6 +182,8 @@ public class StarredReposListAdapter extends RecyclerView.Adapter<StarredReposLi
|
|||||||
TextView repoOpenInBrowser = view.findViewById(R.id.repoOpenInBrowser);
|
TextView repoOpenInBrowser = view.findViewById(R.id.repoOpenInBrowser);
|
||||||
TextView repoStargazers = view.findViewById(R.id.repoStargazers);
|
TextView repoStargazers = view.findViewById(R.id.repoStargazers);
|
||||||
TextView repoWatchers = view.findViewById(R.id.repoWatchers);
|
TextView repoWatchers = view.findViewById(R.id.repoWatchers);
|
||||||
|
TextView repoForksList = view.findViewById(R.id.repoForksList);
|
||||||
|
TextView repoCopyUrl = view.findViewById(R.id.repoCopyUrl);
|
||||||
TextView bottomSheetHeader = view.findViewById(R.id.bottomSheetHeader);
|
TextView bottomSheetHeader = view.findViewById(R.id.bottomSheetHeader);
|
||||||
|
|
||||||
bottomSheetHeader.setText(String.format("%s / %s", fullName.getText().toString().split("/")[0], fullName.getText().toString().split("/")[1]));
|
bottomSheetHeader.setText(String.format("%s / %s", fullName.getText().toString().split("/")[0], fullName.getText().toString().split("/")[1]));
|
||||||
@ -183,6 +191,17 @@ public class StarredReposListAdapter extends RecyclerView.Adapter<StarredReposLi
|
|||||||
dialog.setContentView(view);
|
dialog.setContentView(view);
|
||||||
dialog.show();
|
dialog.show();
|
||||||
|
|
||||||
|
repoCopyUrl.setOnClickListener(openInBrowser -> {
|
||||||
|
|
||||||
|
ClipboardManager clipboard = (ClipboardManager) Objects.requireNonNull(context).getSystemService(Context.CLIPBOARD_SERVICE);
|
||||||
|
ClipData clip = ClipData.newPlainText("repoUrl", htmlUrl.getText().toString());
|
||||||
|
assert clipboard != null;
|
||||||
|
clipboard.setPrimaryClip(clip);
|
||||||
|
|
||||||
|
Toasty.info(context, context.getString(R.string.copyIssueUrlToastMsg));
|
||||||
|
dialog.dismiss();
|
||||||
|
});
|
||||||
|
|
||||||
repoOpenInBrowser.setOnClickListener(openInBrowser -> {
|
repoOpenInBrowser.setOnClickListener(openInBrowser -> {
|
||||||
|
|
||||||
Intent intentOpenInBrowser = new Intent(context, OpenRepoInBrowserActivity.class);
|
Intent intentOpenInBrowser = new Intent(context, OpenRepoInBrowserActivity.class);
|
||||||
@ -210,6 +229,15 @@ public class StarredReposListAdapter extends RecyclerView.Adapter<StarredReposLi
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
repoForksList.setOnClickListener(forks -> {
|
||||||
|
|
||||||
|
Intent intentW = new Intent(context, RepoForksActivity.class);
|
||||||
|
intentW.putExtra("repoFullNameForForks", fullName.getText());
|
||||||
|
context.startActivity(intentW);
|
||||||
|
dialog.dismiss();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -235,6 +263,7 @@ public class StarredReposListAdapter extends RecyclerView.Adapter<StarredReposLi
|
|||||||
UserRepositories currentItem = reposList.get(position);
|
UserRepositories currentItem = reposList.get(position);
|
||||||
holder.repoDescription.setVisibility(View.GONE);
|
holder.repoDescription.setVisibility(View.GONE);
|
||||||
holder.repoBranch.setText(currentItem.getDefault_branch());
|
holder.repoBranch.setText(currentItem.getDefault_branch());
|
||||||
|
holder.htmlUrl.setText(currentItem.getHtml_url());
|
||||||
|
|
||||||
ColorGenerator generator = ColorGenerator.MATERIAL;
|
ColorGenerator generator = ColorGenerator.MATERIAL;
|
||||||
int color = generator.getColor(currentItem.getName());
|
int color = generator.getColor(currentItem.getName());
|
||||||
@ -272,7 +301,7 @@ public class StarredReposListAdapter extends RecyclerView.Adapter<StarredReposLi
|
|||||||
holder.repoType.setText(R.string.strPrivate);
|
holder.repoType.setText(R.string.strPrivate);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
holder.repoPrivatePublic.setImageResource(R.drawable.ic_unlock);
|
holder.repoPrivatePublic.setVisibility(View.GONE);
|
||||||
holder.repoType.setText(R.string.strPublic);
|
holder.repoType.setText(R.string.strPublic);
|
||||||
}
|
}
|
||||||
holder.repoStars.setText(currentItem.getStars_count());
|
holder.repoStars.setText(currentItem.getStars_count());
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.mian.gitnex.adapters;
|
package org.mian.gitnex.adapters;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -8,9 +9,11 @@ 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.appcompat.app.AlertDialog;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import org.mian.gitnex.R;
|
import org.mian.gitnex.R;
|
||||||
import org.mian.gitnex.clients.PicassoService;
|
import org.mian.gitnex.clients.PicassoService;
|
||||||
|
import org.mian.gitnex.database.api.UserAccountsApi;
|
||||||
import org.mian.gitnex.database.models.UserAccount;
|
import org.mian.gitnex.database.models.UserAccount;
|
||||||
import org.mian.gitnex.helpers.RoundedTransformation;
|
import org.mian.gitnex.helpers.RoundedTransformation;
|
||||||
import org.mian.gitnex.helpers.TinyDB;
|
import org.mian.gitnex.helpers.TinyDB;
|
||||||
@ -28,13 +31,15 @@ public class UserAccountsAdapter extends RecyclerView.Adapter<UserAccountsAdapte
|
|||||||
private Context mCtx;
|
private Context mCtx;
|
||||||
private TinyDB tinyDB;
|
private TinyDB tinyDB;
|
||||||
|
|
||||||
static class UserAccountsViewHolder extends RecyclerView.ViewHolder {
|
class UserAccountsViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
private TextView accountUrl;
|
private TextView accountUrl;
|
||||||
private TextView userId;
|
private TextView userId;
|
||||||
private ImageView activeAccount;
|
private ImageView activeAccount;
|
||||||
private ImageView deleteAccount;
|
private ImageView deleteAccount;
|
||||||
private ImageView repoAvatar;
|
private ImageView repoAvatar;
|
||||||
|
private TextView accountId;
|
||||||
|
private TextView accountName;
|
||||||
|
|
||||||
private UserAccountsViewHolder(View itemView) {
|
private UserAccountsViewHolder(View itemView) {
|
||||||
|
|
||||||
@ -45,14 +50,46 @@ public class UserAccountsAdapter extends RecyclerView.Adapter<UserAccountsAdapte
|
|||||||
activeAccount = itemView.findViewById(R.id.activeAccount);
|
activeAccount = itemView.findViewById(R.id.activeAccount);
|
||||||
deleteAccount = itemView.findViewById(R.id.deleteAccount);
|
deleteAccount = itemView.findViewById(R.id.deleteAccount);
|
||||||
repoAvatar = itemView.findViewById(R.id.repoAvatar);
|
repoAvatar = itemView.findViewById(R.id.repoAvatar);
|
||||||
|
accountId = itemView.findViewById(R.id.accountId);
|
||||||
|
accountName = itemView.findViewById(R.id.accountName);
|
||||||
|
|
||||||
deleteAccount.setOnClickListener(itemDelete -> {
|
deleteAccount.setOnClickListener(itemDelete -> {
|
||||||
// use later to delete an account
|
|
||||||
|
new AlertDialog.Builder(mCtx)
|
||||||
|
.setIcon(mCtx.getDrawable(R.drawable.ic_delete))
|
||||||
|
.setTitle(mCtx.getResources().getString(R.string.removeAccountPopupTitle))
|
||||||
|
.setMessage(mCtx.getResources().getString(R.string.removeAccountPopupMessage))
|
||||||
|
.setPositiveButton(mCtx.getResources().getString(R.string.removeButton), (dialog, which) -> {
|
||||||
|
|
||||||
|
updateLayoutByPosition(getAdapterPosition());
|
||||||
|
UserAccountsApi userAccountsApi = new UserAccountsApi(mCtx);
|
||||||
|
userAccountsApi.deleteAccount(Integer.parseInt(accountId.getText().toString()));
|
||||||
|
}).setNeutralButton(mCtx.getResources().getString(R.string.cancelButton), null)
|
||||||
|
.show();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
itemView.setOnClickListener(itemEdit -> {
|
itemView.setOnClickListener(itemEdit -> {
|
||||||
// use later to switch account
|
|
||||||
|
String accountNameSwitch = accountName.getText().toString();
|
||||||
|
UserAccountsApi userAccountsApi = new UserAccountsApi(mCtx);
|
||||||
|
UserAccount userAccount = userAccountsApi.getAccountData(accountNameSwitch);
|
||||||
|
|
||||||
|
if(tinyDB.getInt("currentActiveAccountId") != userAccount.getAccountId()) {
|
||||||
|
|
||||||
|
String url = UrlBuilder.fromString(userAccount.getInstanceUrl())
|
||||||
|
.withPath("/")
|
||||||
|
.toString();
|
||||||
|
|
||||||
|
tinyDB.putString("loginUid", userAccount.getUserName());
|
||||||
|
tinyDB.putString("userLogin", userAccount.getUserName());
|
||||||
|
tinyDB.putString(userAccount.getUserName() + "-token", userAccount.getToken());
|
||||||
|
tinyDB.putString("instanceUrl", userAccount.getInstanceUrl());
|
||||||
|
tinyDB.putInt("currentActiveAccountId", userAccount.getAccountId());
|
||||||
|
|
||||||
|
Toasty.success(mCtx, mCtx.getResources().getString(R.string.switchAccountSuccess, userAccount.getUserName(), url));
|
||||||
|
((Activity) mCtx).recreate();
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -66,12 +103,12 @@ public class UserAccountsAdapter extends RecyclerView.Adapter<UserAccountsAdapte
|
|||||||
this.userAccountsList = userAccountsListMain;
|
this.userAccountsList = userAccountsListMain;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteAccount(int position) {
|
private void updateLayoutByPosition(int position) {
|
||||||
|
|
||||||
userAccountsList.remove(position);
|
userAccountsList.remove(position);
|
||||||
notifyItemRemoved(position);
|
notifyItemRemoved(position);
|
||||||
notifyItemRangeChanged(position, userAccountsList.size());
|
notifyItemRangeChanged(position, userAccountsList.size());
|
||||||
Toasty.info(mCtx, mCtx.getResources().getString(R.string.accountDeletedMessage));
|
Toasty.success(mCtx, mCtx.getResources().getString(R.string.accountDeletedMessage));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,6 +131,8 @@ public class UserAccountsAdapter extends RecyclerView.Adapter<UserAccountsAdapte
|
|||||||
.withPath("/")
|
.withPath("/")
|
||||||
.toString();
|
.toString();
|
||||||
|
|
||||||
|
holder.accountId.setText(String.valueOf(currentItem.getAccountId()));
|
||||||
|
holder.accountName.setText(currentItem.getAccountName());
|
||||||
holder.userId.setText(String.format("@%s", currentItem.getUserName()));
|
holder.userId.setText(String.format("@%s", currentItem.getUserName()));
|
||||||
holder.accountUrl.setText(url);
|
holder.accountUrl.setText(url);
|
||||||
|
|
||||||
@ -103,7 +142,7 @@ public class UserAccountsAdapter extends RecyclerView.Adapter<UserAccountsAdapte
|
|||||||
holder.activeAccount.setVisibility(View.VISIBLE);
|
holder.activeAccount.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
holder.deleteAccount.setVisibility(View.GONE);
|
holder.deleteAccount.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ public class UserAccountsApi {
|
|||||||
private static UserAccountsDao userAccountsDao;
|
private static UserAccountsDao userAccountsDao;
|
||||||
private static UserAccount userAccount;
|
private static UserAccount userAccount;
|
||||||
private static Integer checkAccount;
|
private static Integer checkAccount;
|
||||||
|
private static long accountId;
|
||||||
|
|
||||||
public UserAccountsApi(Context context) {
|
public UserAccountsApi(Context context) {
|
||||||
|
|
||||||
@ -26,7 +27,7 @@ public class UserAccountsApi {
|
|||||||
userAccountsDao = db.userAccountsDao();
|
userAccountsDao = db.userAccountsDao();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void insertNewAccount(String accountName, String instanceUrl, String userName, String token, String serverVersion) {
|
public long insertNewAccount(String accountName, String instanceUrl, String userName, String token, String serverVersion) {
|
||||||
|
|
||||||
UserAccount userAccount = new UserAccount();
|
UserAccount userAccount = new UserAccount();
|
||||||
userAccount.setAccountName(accountName);
|
userAccount.setAccountName(accountName);
|
||||||
@ -35,12 +36,23 @@ public class UserAccountsApi {
|
|||||||
userAccount.setToken(token);
|
userAccount.setToken(token);
|
||||||
userAccount.setServerVersion(serverVersion);
|
userAccount.setServerVersion(serverVersion);
|
||||||
|
|
||||||
insertNewAccountAsync(userAccount);
|
return insertNewAccountAsync(userAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void insertNewAccountAsync(final UserAccount userAccount) {
|
private static long insertNewAccountAsync(final UserAccount userAccount) {
|
||||||
|
|
||||||
new Thread(() -> userAccountsDao.newAccount(userAccount)).start();
|
try {
|
||||||
|
|
||||||
|
Thread thread = new Thread(() -> accountId = userAccountsDao.newAccount(userAccount));
|
||||||
|
thread.start();
|
||||||
|
thread.join();
|
||||||
|
}
|
||||||
|
catch(InterruptedException e) {
|
||||||
|
|
||||||
|
Log.e(StaticGlobalVariables.userAccountsRepository, e.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return accountId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updateServerVersion(final String serverVersion, final int accountId) {
|
public static void updateServerVersion(final String serverVersion, final int accountId) {
|
||||||
@ -48,11 +60,16 @@ public class UserAccountsApi {
|
|||||||
new Thread(() -> userAccountsDao.updateServerVersion(serverVersion, accountId)).start();
|
new Thread(() -> userAccountsDao.updateServerVersion(serverVersion, accountId)).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updateToken(final int accountId, final String token) {
|
public void updateToken(final int accountId, final String token) {
|
||||||
|
|
||||||
new Thread(() -> userAccountsDao.updateAccountToken(accountId, token)).start();
|
new Thread(() -> userAccountsDao.updateAccountToken(accountId, token)).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateTokenByAccountName(final String accountName, final String token) {
|
||||||
|
|
||||||
|
new Thread(() -> userAccountsDao.updateAccountTokenByAccountName(accountName, token)).start();
|
||||||
|
}
|
||||||
|
|
||||||
public UserAccount getAccountData(String accountName) {
|
public UserAccount getAccountData(String accountName) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -90,7 +107,7 @@ public class UserAccountsApi {
|
|||||||
return userAccountsDao.fetchAllAccounts();
|
return userAccountsDao.fetchAllAccounts();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void deleteAccount(final int accountId) {
|
public void deleteAccount(final int accountId) {
|
||||||
|
|
||||||
new Thread(() -> userAccountsDao.deleteAccount(accountId)).start();
|
new Thread(() -> userAccountsDao.deleteAccount(accountId)).start();
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ import java.util.List;
|
|||||||
public interface UserAccountsDao {
|
public interface UserAccountsDao {
|
||||||
|
|
||||||
@Insert
|
@Insert
|
||||||
void newAccount(UserAccount userAccounts);
|
long newAccount(UserAccount userAccounts);
|
||||||
|
|
||||||
@Query("SELECT * FROM UserAccounts ORDER BY accountId ASC")
|
@Query("SELECT * FROM UserAccounts ORDER BY accountId ASC")
|
||||||
LiveData<List<UserAccount>> fetchAllAccounts();
|
LiveData<List<UserAccount>> fetchAllAccounts();
|
||||||
@ -38,6 +38,9 @@ public interface UserAccountsDao {
|
|||||||
@Query("UPDATE UserAccounts SET token = :token WHERE accountId = :accountId")
|
@Query("UPDATE UserAccounts SET token = :token WHERE accountId = :accountId")
|
||||||
void updateAccountToken(int accountId, String token);
|
void updateAccountToken(int accountId, String token);
|
||||||
|
|
||||||
|
@Query("UPDATE UserAccounts SET token = :token WHERE accountName = :accountName")
|
||||||
|
void updateAccountTokenByAccountName(String accountName, String token);
|
||||||
|
|
||||||
@Query("UPDATE UserAccounts SET instanceUrl = :instanceUrl, token = :token WHERE accountId = :accountId")
|
@Query("UPDATE UserAccounts SET instanceUrl = :instanceUrl, token = :token WHERE accountId = :accountId")
|
||||||
void updateHostInfo(String instanceUrl, String token, int accountId);
|
void updateHostInfo(String instanceUrl, String token, int accountId);
|
||||||
|
|
||||||
|
@ -26,12 +26,10 @@ public class BottomSheetAdminUsersFragment extends BottomSheetDialogFragment {
|
|||||||
|
|
||||||
TextView createNewUser = v.findViewById(R.id.createNewUser);
|
TextView createNewUser = v.findViewById(R.id.createNewUser);
|
||||||
|
|
||||||
createNewUser.setOnClickListener(new View.OnClickListener() {
|
createNewUser.setOnClickListener(v1 -> {
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
bmListener.onButtonClicked("newUser");
|
||||||
bmListener.onButtonClicked("newUser");
|
dismiss();
|
||||||
dismiss();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
@ -47,9 +45,9 @@ public class BottomSheetAdminUsersFragment extends BottomSheetDialogFragment {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
bmListener = (BottomSheetAdminUsersFragment.BottomSheetListener) context;
|
bmListener = (BottomSheetAdminUsersFragment.BottomSheetListener) context;
|
||||||
} catch (ClassCastException e) {
|
}
|
||||||
throw new ClassCastException(context.toString()
|
catch (ClassCastException e) {
|
||||||
+ " must implement BottomSheetListener");
|
throw new ClassCastException(context.toString() + " must implement BottomSheetListener");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,9 +48,9 @@ public class BottomSheetFileViewerFragment extends BottomSheetDialogFragment {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
bmListener = (BottomSheetFileViewerFragment.BottomSheetListener) context;
|
bmListener = (BottomSheetFileViewerFragment.BottomSheetListener) context;
|
||||||
} catch (ClassCastException e) {
|
}
|
||||||
throw new ClassCastException(context.toString()
|
catch (ClassCastException e) {
|
||||||
+ " must implement BottomSheetListener");
|
throw new ClassCastException(context.toString() + " must implement BottomSheetListener");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ public class BottomSheetOrganizationFragment extends BottomSheetDialogFragment {
|
|||||||
|
|
||||||
TextView createTeam = v.findViewById(R.id.createTeam);
|
TextView createTeam = v.findViewById(R.id.createTeam);
|
||||||
TextView createRepository = v.findViewById(R.id.createRepository);
|
TextView createRepository = v.findViewById(R.id.createRepository);
|
||||||
|
TextView copyOrgUrl = v.findViewById(R.id.copyOrgUrl);
|
||||||
|
|
||||||
createTeam.setOnClickListener(v1 -> {
|
createTeam.setOnClickListener(v1 -> {
|
||||||
|
|
||||||
@ -40,6 +41,12 @@ public class BottomSheetOrganizationFragment extends BottomSheetDialogFragment {
|
|||||||
dismiss();
|
dismiss();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
copyOrgUrl.setOnClickListener(v1 -> {
|
||||||
|
|
||||||
|
bmListener.onButtonClicked("copyOrgUrl");
|
||||||
|
dismiss();
|
||||||
|
});
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,12 +25,10 @@ public class BottomSheetProfileFragment extends BottomSheetDialogFragment {
|
|||||||
|
|
||||||
TextView addNewEmailAddress = v.findViewById(R.id.addNewEmailAddress);
|
TextView addNewEmailAddress = v.findViewById(R.id.addNewEmailAddress);
|
||||||
|
|
||||||
addNewEmailAddress.setOnClickListener(new View.OnClickListener() {
|
addNewEmailAddress.setOnClickListener(v1 -> {
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
startActivity(new Intent(getContext(), ProfileEmailActivity.class));
|
||||||
startActivity(new Intent(getContext(), ProfileEmailActivity.class));
|
dismiss();
|
||||||
dismiss();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
|
@ -40,6 +40,7 @@ public class BottomSheetRepoFragment extends BottomSheetDialogFragment {
|
|||||||
TextView watchRepository = v.findViewById(R.id.watchRepository);
|
TextView watchRepository = v.findViewById(R.id.watchRepository);
|
||||||
TextView unWatchRepository = v.findViewById(R.id.unWatchRepository);
|
TextView unWatchRepository = v.findViewById(R.id.unWatchRepository);
|
||||||
TextView shareRepository = v.findViewById(R.id.shareRepository);
|
TextView shareRepository = v.findViewById(R.id.shareRepository);
|
||||||
|
TextView copyRepoUrl = v.findViewById(R.id.copyRepoUrl);
|
||||||
|
|
||||||
createLabel.setOnClickListener(v112 -> {
|
createLabel.setOnClickListener(v112 -> {
|
||||||
|
|
||||||
@ -93,6 +94,12 @@ public class BottomSheetRepoFragment extends BottomSheetDialogFragment {
|
|||||||
dismiss();
|
dismiss();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
copyRepoUrl.setOnClickListener(copyUrl -> {
|
||||||
|
|
||||||
|
bmListener.onButtonClicked("copyRepoUrl");
|
||||||
|
dismiss();
|
||||||
|
});
|
||||||
|
|
||||||
newFile.setOnClickListener(v17 -> {
|
newFile.setOnClickListener(v17 -> {
|
||||||
|
|
||||||
bmListener.onButtonClicked("newFile");
|
bmListener.onButtonClicked("newFile");
|
||||||
@ -162,9 +169,9 @@ public class BottomSheetRepoFragment extends BottomSheetDialogFragment {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
bmListener = (BottomSheetListener) context;
|
bmListener = (BottomSheetListener) context;
|
||||||
} catch (ClassCastException e) {
|
}
|
||||||
throw new ClassCastException(context.toString()
|
catch (ClassCastException e) {
|
||||||
+ " must implement BottomSheetListener");
|
throw new ClassCastException(context.toString() + " must implement BottomSheetListener");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,59 +85,39 @@ public class BottomSheetSingleIssueFragment extends BottomSheetDialogFragment {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mergePullRequest.setOnClickListener(new View.OnClickListener() {
|
mergePullRequest.setOnClickListener(v13 -> {
|
||||||
|
|
||||||
@Override
|
startActivity(new Intent(ctx, MergePullRequestActivity.class));
|
||||||
public void onClick(View v) {
|
dismiss();
|
||||||
|
|
||||||
startActivity(new Intent(ctx, MergePullRequestActivity.class));
|
|
||||||
dismiss();
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
openFilesDiff.setOnClickListener(new View.OnClickListener() {
|
openFilesDiff.setOnClickListener(v14 -> {
|
||||||
|
|
||||||
@Override
|
startActivity(new Intent(ctx, FileDiffActivity.class));
|
||||||
public void onClick(View v) {
|
dismiss();
|
||||||
|
|
||||||
startActivity(new Intent(ctx, FileDiffActivity.class));
|
|
||||||
dismiss();
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
editIssue.setOnClickListener(new View.OnClickListener() {
|
editIssue.setOnClickListener(v15 -> {
|
||||||
|
|
||||||
@Override
|
startActivity(new Intent(ctx, EditIssueActivity.class));
|
||||||
public void onClick(View v) {
|
dismiss();
|
||||||
|
|
||||||
startActivity(new Intent(ctx, EditIssueActivity.class));
|
|
||||||
dismiss();
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
editLabels.setOnClickListener(new View.OnClickListener() {
|
editLabels.setOnClickListener(v16 -> {
|
||||||
|
|
||||||
@Override
|
startActivity(new Intent(ctx, AddRemoveLabelsActivity.class));
|
||||||
public void onClick(View v) {
|
dismiss();
|
||||||
|
|
||||||
startActivity(new Intent(ctx, AddRemoveLabelsActivity.class));
|
|
||||||
dismiss();
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
addRemoveAssignees.setOnClickListener(new View.OnClickListener() {
|
addRemoveAssignees.setOnClickListener(v17 -> {
|
||||||
|
|
||||||
@Override
|
startActivity(new Intent(ctx, AddRemoveAssigneesActivity.class));
|
||||||
public void onClick(View v) {
|
dismiss();
|
||||||
|
|
||||||
startActivity(new Intent(ctx, AddRemoveAssigneesActivity.class));
|
|
||||||
dismiss();
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
shareIssue.setOnClickListener(v1 -> {
|
shareIssue.setOnClickListener(v1 -> {
|
||||||
|
@ -122,11 +122,11 @@ public class DraftsFragment extends Fragment {
|
|||||||
DraftsApi.deleteAllDrafts(accountId);
|
DraftsApi.deleteAllDrafts(accountId);
|
||||||
draftsList_.clear();
|
draftsList_.clear();
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
Toasty.info(ctx, getResources().getString(R.string.draftsDeleteSuccess));
|
Toasty.success(ctx, getResources().getString(R.string.draftsDeleteSuccess));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Toasty.error(ctx, getResources().getString(R.string.draftsListEmpty));
|
Toasty.warning(ctx, getResources().getString(R.string.draftsListEmpty));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -253,7 +253,7 @@ public class IssuesFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.info(context, getString(R.string.noMoreData));
|
Toasty.warning(context, getString(R.string.noMoreData));
|
||||||
adapter.setMoreDataAvailable(false);
|
adapter.setMoreDataAvailable(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ import android.view.MenuItem;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@ -23,6 +22,7 @@ import androidx.recyclerview.widget.DividerItemDecoration;
|
|||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||||
|
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
|
||||||
import org.mian.gitnex.R;
|
import org.mian.gitnex.R;
|
||||||
import org.mian.gitnex.activities.CreateRepoActivity;
|
import org.mian.gitnex.activities.CreateRepoActivity;
|
||||||
import org.mian.gitnex.adapters.MyReposListAdapter;
|
import org.mian.gitnex.adapters.MyReposListAdapter;
|
||||||
@ -45,7 +45,7 @@ public class MyRepositoriesFragment extends Fragment {
|
|||||||
private ProgressBar mProgressBar;
|
private ProgressBar mProgressBar;
|
||||||
private RecyclerView mRecyclerView;
|
private RecyclerView mRecyclerView;
|
||||||
private MyReposListAdapter adapter;
|
private MyReposListAdapter adapter;
|
||||||
private ImageView createNewRepo;
|
private ExtendedFloatingActionButton createNewRepo;
|
||||||
private TextView noDataMyRepo;
|
private TextView noDataMyRepo;
|
||||||
|
|
||||||
private int pageSize = 1;
|
private int pageSize = 1;
|
||||||
@ -105,15 +105,10 @@ public class MyRepositoriesFragment extends Fragment {
|
|||||||
mRecyclerView.addItemDecoration(dividerItemDecoration);
|
mRecyclerView.addItemDecoration(dividerItemDecoration);
|
||||||
|
|
||||||
createNewRepo = v.findViewById(R.id.addNewRepo);
|
createNewRepo = v.findViewById(R.id.addNewRepo);
|
||||||
createNewRepo.setOnClickListener(new View.OnClickListener() {
|
createNewRepo.setOnClickListener(view -> {
|
||||||
|
|
||||||
@Override
|
Intent intent = new Intent(view.getContext(), CreateRepoActivity.class);
|
||||||
public void onClick(View view) {
|
startActivity(intent);
|
||||||
|
|
||||||
Intent intent = new Intent(view.getContext(), CreateRepoActivity.class);
|
|
||||||
startActivity(intent);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -135,18 +130,11 @@ public class MyRepositoriesFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
swipeRefresh.setOnRefreshListener(() -> new Handler().postDelayed(() -> {
|
||||||
@Override
|
|
||||||
public void onRefresh() {
|
swipeRefresh.setRefreshing(false);
|
||||||
new Handler().postDelayed(new Runnable() {
|
MyRepositoriesViewModel.loadMyReposList(instanceUrl, Authorization.returnAuthentication(getContext(), loginUid, instanceToken), userLogin, getContext(), pageSize, resultLimit);
|
||||||
@Override
|
}, 50));
|
||||||
public void run() {
|
|
||||||
swipeRefresh.setRefreshing(false);
|
|
||||||
MyRepositoriesViewModel.loadMyReposList(instanceUrl, Authorization.returnAuthentication(getContext(), loginUid, instanceToken), userLogin, getContext(), pageSize, resultLimit);
|
|
||||||
}
|
|
||||||
}, 50);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
fetchDataAsync(instanceUrl, Authorization.returnAuthentication(getContext(), loginUid, instanceToken), userLogin, pageSize, resultLimit);
|
fetchDataAsync(instanceUrl, Authorization.returnAuthentication(getContext(), loginUid, instanceToken), userLogin, pageSize, resultLimit);
|
||||||
|
|
||||||
|
@ -11,9 +11,7 @@ import android.view.MenuInflater;
|
|||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.RelativeLayout;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
@ -21,6 +19,7 @@ import androidx.fragment.app.Fragment;
|
|||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||||
|
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.mian.gitnex.R;
|
import org.mian.gitnex.R;
|
||||||
import org.mian.gitnex.actions.NotificationsActions;
|
import org.mian.gitnex.actions.NotificationsActions;
|
||||||
@ -29,9 +28,9 @@ import org.mian.gitnex.adapters.NotificationsAdapter;
|
|||||||
import org.mian.gitnex.clients.RetrofitClient;
|
import org.mian.gitnex.clients.RetrofitClient;
|
||||||
import org.mian.gitnex.helpers.AppUtil;
|
import org.mian.gitnex.helpers.AppUtil;
|
||||||
import org.mian.gitnex.helpers.InfiniteScrollListener;
|
import org.mian.gitnex.helpers.InfiniteScrollListener;
|
||||||
import org.mian.gitnex.helpers.SnackBar;
|
|
||||||
import org.mian.gitnex.helpers.StaticGlobalVariables;
|
import org.mian.gitnex.helpers.StaticGlobalVariables;
|
||||||
import org.mian.gitnex.helpers.TinyDB;
|
import org.mian.gitnex.helpers.TinyDB;
|
||||||
|
import org.mian.gitnex.helpers.Toasty;
|
||||||
import org.mian.gitnex.models.NotificationThread;
|
import org.mian.gitnex.models.NotificationThread;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -52,9 +51,8 @@ public class NotificationsFragment extends Fragment implements NotificationsAdap
|
|||||||
private NotificationsAdapter notificationsAdapter;
|
private NotificationsAdapter notificationsAdapter;
|
||||||
private NotificationsActions notificationsActions;
|
private NotificationsActions notificationsActions;
|
||||||
|
|
||||||
private ImageView markAllAsRead;
|
private ExtendedFloatingActionButton markAllAsRead;
|
||||||
private ProgressBar progressBar;
|
private ProgressBar progressBar;
|
||||||
private RelativeLayout mainLayout;
|
|
||||||
private ProgressBar loadingMoreView;
|
private ProgressBar loadingMoreView;
|
||||||
private TextView noDataNotifications;
|
private TextView noDataNotifications;
|
||||||
private SwipeRefreshLayout pullToRefresh;
|
private SwipeRefreshLayout pullToRefresh;
|
||||||
@ -88,7 +86,6 @@ public class NotificationsFragment extends Fragment implements NotificationsAdap
|
|||||||
pageResultLimit = StaticGlobalVariables.getCurrentResultLimit(context);
|
pageResultLimit = StaticGlobalVariables.getCurrentResultLimit(context);
|
||||||
tinyDB.putString("notificationsFilterState", currentFilterMode);
|
tinyDB.putString("notificationsFilterState", currentFilterMode);
|
||||||
|
|
||||||
mainLayout = v.findViewById(R.id.mainLayout);
|
|
||||||
markAllAsRead = v.findViewById(R.id.markAllAsRead);
|
markAllAsRead = v.findViewById(R.id.markAllAsRead);
|
||||||
noDataNotifications = v.findViewById(R.id.noDataNotifications);
|
noDataNotifications = v.findViewById(R.id.noDataNotifications);
|
||||||
loadingMoreView = v.findViewById(R.id.loadingMoreView);
|
loadingMoreView = v.findViewById(R.id.loadingMoreView);
|
||||||
@ -150,7 +147,7 @@ public class NotificationsFragment extends Fragment implements NotificationsAdap
|
|||||||
|
|
||||||
activity.runOnUiThread(() -> {
|
activity.runOnUiThread(() -> {
|
||||||
|
|
||||||
SnackBar.info(context, mainLayout, getString(R.string.markedNotificationsAsRead));
|
Toasty.success(context, getString(R.string.markedNotificationsAsRead));
|
||||||
loadNotifications(true);
|
loadNotifications(true);
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -158,7 +155,7 @@ public class NotificationsFragment extends Fragment implements NotificationsAdap
|
|||||||
}
|
}
|
||||||
catch(IOException e) {
|
catch(IOException e) {
|
||||||
|
|
||||||
activity.runOnUiThread(() -> SnackBar.error(context, mainLayout, getString(R.string.genericError)));
|
activity.runOnUiThread(() -> Toasty.error(context, getString(R.string.genericError)));
|
||||||
Log.e("onError", e.toString());
|
Log.e("onError", e.toString());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@ import android.view.MenuItem;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@ -22,6 +21,7 @@ import androidx.recyclerview.widget.DividerItemDecoration;
|
|||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||||
|
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
|
||||||
import org.mian.gitnex.R;
|
import org.mian.gitnex.R;
|
||||||
import org.mian.gitnex.activities.CreateOrganizationActivity;
|
import org.mian.gitnex.activities.CreateOrganizationActivity;
|
||||||
import org.mian.gitnex.adapters.OrganizationsListAdapter;
|
import org.mian.gitnex.adapters.OrganizationsListAdapter;
|
||||||
@ -42,7 +42,7 @@ public class OrganizationsFragment extends Fragment {
|
|||||||
private ProgressBar mProgressBar;
|
private ProgressBar mProgressBar;
|
||||||
private OrganizationsListAdapter adapter;
|
private OrganizationsListAdapter adapter;
|
||||||
private RecyclerView mRecyclerView;
|
private RecyclerView mRecyclerView;
|
||||||
private ImageView createNewOrganization;
|
private ExtendedFloatingActionButton createNewOrganization;
|
||||||
private TextView noDataOrg;
|
private TextView noDataOrg;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.mian.gitnex.fragments;
|
package org.mian.gitnex.fragments;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -19,6 +20,10 @@ import androidx.annotation.Nullable;
|
|||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import org.mian.gitnex.R;
|
import org.mian.gitnex.R;
|
||||||
|
import org.mian.gitnex.activities.RepoDetailActivity;
|
||||||
|
import org.mian.gitnex.activities.RepoForksActivity;
|
||||||
|
import org.mian.gitnex.activities.RepoStargazersActivity;
|
||||||
|
import org.mian.gitnex.activities.RepoWatchersActivity;
|
||||||
import org.mian.gitnex.clients.RetrofitClient;
|
import org.mian.gitnex.clients.RetrofitClient;
|
||||||
import org.mian.gitnex.helpers.AlertDialogs;
|
import org.mian.gitnex.helpers.AlertDialogs;
|
||||||
import org.mian.gitnex.helpers.AppUtil;
|
import org.mian.gitnex.helpers.AppUtil;
|
||||||
@ -143,6 +148,9 @@ public class RepoInfoFragment extends Fragment {
|
|||||||
repoFilenameExpandCollapse = v.findViewById(R.id.repoFilenameExpandCollapse);
|
repoFilenameExpandCollapse = v.findViewById(R.id.repoFilenameExpandCollapse);
|
||||||
fileContentsFrameHeader = v.findViewById(R.id.fileContentsFrameHeader);
|
fileContentsFrameHeader = v.findViewById(R.id.fileContentsFrameHeader);
|
||||||
fileContentsFrame = v.findViewById(R.id.fileContentsFrame);
|
fileContentsFrame = v.findViewById(R.id.fileContentsFrame);
|
||||||
|
LinearLayout repoMetaStarsFrame = v.findViewById(R.id.repoMetaStarsFrame);
|
||||||
|
LinearLayout repoMetaForksFrame = v.findViewById(R.id.repoMetaForksFrame);
|
||||||
|
LinearLayout repoMetaWatchersFrame = v.findViewById(R.id.repoMetaWatchersFrame);
|
||||||
|
|
||||||
repoMetaFrame.setVisibility(View.GONE);
|
repoMetaFrame.setVisibility(View.GONE);
|
||||||
|
|
||||||
@ -169,6 +177,29 @@ public class RepoInfoFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
repoMetaStarsFrame.setOnClickListener(metaStars -> {
|
||||||
|
|
||||||
|
Intent intent = new Intent(ctx, RepoStargazersActivity.class);
|
||||||
|
intent.putExtra("repoFullNameForStars", repoOwner + "/" + repoName);
|
||||||
|
ctx.startActivity(intent);
|
||||||
|
});
|
||||||
|
|
||||||
|
repoMetaForksFrame.setOnClickListener(metaForks -> {
|
||||||
|
|
||||||
|
Intent intent = new Intent(ctx, RepoForksActivity.class);
|
||||||
|
intent.putExtra("repoFullNameForForks", repoOwner + "/" + repoName);
|
||||||
|
ctx.startActivity(intent);
|
||||||
|
});
|
||||||
|
|
||||||
|
repoMetaWatchersFrame.setOnClickListener(metaWatchers -> {
|
||||||
|
|
||||||
|
Intent intent = new Intent(ctx, RepoWatchersActivity.class);
|
||||||
|
intent.putExtra("repoFullNameForWatchers", repoOwner + "/" + repoName);
|
||||||
|
ctx.startActivity(intent);
|
||||||
|
});
|
||||||
|
|
||||||
|
repoMetaPullRequestsFrame.setOnClickListener(metaPR -> RepoDetailActivity.mViewPager.setCurrentItem(3));
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,7 +358,7 @@ public class RepoInfoFragment extends Fragment {
|
|||||||
|
|
||||||
alertDialog.setTitle(getResources().getString(R.string.infoMoreInformation));
|
alertDialog.setTitle(getResources().getString(R.string.infoMoreInformation));
|
||||||
alertDialog.setView(view);
|
alertDialog.setView(view);
|
||||||
alertDialog.setPositiveButton(getResources().getString(R.string.close), (dialog, which) -> dialog.dismiss());
|
alertDialog.setNeutralButton(getResources().getString(R.string.close), null);
|
||||||
alertDialog.create().show();
|
alertDialog.create().show();
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -456,7 +487,7 @@ public class RepoInfoFragment extends Fragment {
|
|||||||
|
|
||||||
} else if (response.code() == 403) {
|
} else if (response.code() == 403) {
|
||||||
|
|
||||||
Toasty.info(ctx, ctx.getString(R.string.authorizeError));
|
Toasty.error(ctx, ctx.getString(R.string.authorizeError));
|
||||||
|
|
||||||
} else if (response.code() == 404) {
|
} else if (response.code() == 404) {
|
||||||
|
|
||||||
@ -465,7 +496,7 @@ public class RepoInfoFragment extends Fragment {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
Toasty.info(getContext(), getString(R.string.genericError));
|
Toasty.error(getContext(), getString(R.string.genericError));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@ import android.view.MenuItem;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@ -22,6 +21,7 @@ import androidx.recyclerview.widget.DividerItemDecoration;
|
|||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||||
|
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
|
||||||
import org.mian.gitnex.R;
|
import org.mian.gitnex.R;
|
||||||
import org.mian.gitnex.activities.CreateRepoActivity;
|
import org.mian.gitnex.activities.CreateRepoActivity;
|
||||||
import org.mian.gitnex.adapters.ReposListAdapter;
|
import org.mian.gitnex.adapters.ReposListAdapter;
|
||||||
@ -42,7 +42,7 @@ public class RepositoriesFragment extends Fragment {
|
|||||||
private ProgressBar mProgressBar;
|
private ProgressBar mProgressBar;
|
||||||
private RecyclerView mRecyclerView;
|
private RecyclerView mRecyclerView;
|
||||||
private ReposListAdapter adapter;
|
private ReposListAdapter adapter;
|
||||||
private ImageView createNewRepo;
|
private ExtendedFloatingActionButton createNewRepo;
|
||||||
private TextView noDataRepo;
|
private TextView noDataRepo;
|
||||||
private int pageSize = 1;
|
private int pageSize = 1;
|
||||||
private int resultLimit = 50;
|
private int resultLimit = 50;
|
||||||
@ -75,14 +75,10 @@ public class RepositoriesFragment extends Fragment {
|
|||||||
|
|
||||||
createNewRepo = v.findViewById(R.id.addNewRepo);
|
createNewRepo = v.findViewById(R.id.addNewRepo);
|
||||||
|
|
||||||
createNewRepo.setOnClickListener(new View.OnClickListener() {
|
createNewRepo.setOnClickListener(view -> {
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
Intent intent = new Intent(view.getContext(), CreateRepoActivity.class);
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Intent intent = new Intent(view.getContext(), CreateRepoActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
});
|
});
|
||||||
|
|
||||||
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||||
@ -102,18 +98,11 @@ public class RepositoriesFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
swipeRefresh.setOnRefreshListener(() -> new Handler().postDelayed(() -> {
|
||||||
@Override
|
|
||||||
public void onRefresh() {
|
swipeRefresh.setRefreshing(false);
|
||||||
new Handler().postDelayed(new Runnable() {
|
RepositoriesListViewModel.loadReposList(instanceUrl, Authorization.returnAuthentication(getContext(), loginUid, instanceToken), getContext(), pageSize, resultLimit);
|
||||||
@Override
|
}, 50));
|
||||||
public void run() {
|
|
||||||
swipeRefresh.setRefreshing(false);
|
|
||||||
RepositoriesListViewModel.loadReposList(instanceUrl, Authorization.returnAuthentication(getContext(), loginUid, instanceToken), getContext(), pageSize, resultLimit);
|
|
||||||
}
|
|
||||||
}, 50);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
fetchDataAsync(instanceUrl, Authorization.returnAuthentication(getContext(), loginUid, instanceToken), pageSize, resultLimit);
|
fetchDataAsync(instanceUrl, Authorization.returnAuthentication(getContext(), loginUid, instanceToken), pageSize, resultLimit);
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ import android.view.MenuItem;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@ -23,6 +22,7 @@ import androidx.recyclerview.widget.DividerItemDecoration;
|
|||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||||
|
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
|
||||||
import org.mian.gitnex.R;
|
import org.mian.gitnex.R;
|
||||||
import org.mian.gitnex.activities.CreateRepoActivity;
|
import org.mian.gitnex.activities.CreateRepoActivity;
|
||||||
import org.mian.gitnex.adapters.StarredReposListAdapter;
|
import org.mian.gitnex.adapters.StarredReposListAdapter;
|
||||||
@ -45,7 +45,7 @@ public class StarredRepositoriesFragment extends Fragment {
|
|||||||
private ProgressBar mProgressBar;
|
private ProgressBar mProgressBar;
|
||||||
private RecyclerView mRecyclerView;
|
private RecyclerView mRecyclerView;
|
||||||
private StarredReposListAdapter adapter;
|
private StarredReposListAdapter adapter;
|
||||||
private ImageView createNewRepo;
|
private ExtendedFloatingActionButton createNewRepo;
|
||||||
private TextView noData;
|
private TextView noData;
|
||||||
private int pageSize = 1;
|
private int pageSize = 1;
|
||||||
private int resultLimit = 50;
|
private int resultLimit = 50;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.mian.gitnex.fragments;
|
package org.mian.gitnex.fragments;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@ -11,7 +12,9 @@ import androidx.recyclerview.widget.DividerItemDecoration;
|
|||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||||
|
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
|
||||||
import org.mian.gitnex.R;
|
import org.mian.gitnex.R;
|
||||||
|
import org.mian.gitnex.activities.AddNewAccountActivity;
|
||||||
import org.mian.gitnex.adapters.UserAccountsAdapter;
|
import org.mian.gitnex.adapters.UserAccountsAdapter;
|
||||||
import org.mian.gitnex.database.api.UserAccountsApi;
|
import org.mian.gitnex.database.api.UserAccountsApi;
|
||||||
import org.mian.gitnex.database.models.UserAccount;
|
import org.mian.gitnex.database.models.UserAccount;
|
||||||
@ -29,6 +32,7 @@ public class UserAccountsFragment extends Fragment {
|
|||||||
private RecyclerView mRecyclerView;
|
private RecyclerView mRecyclerView;
|
||||||
private UserAccountsApi userAccountsApi;
|
private UserAccountsApi userAccountsApi;
|
||||||
private List<UserAccount> userAccountsList;
|
private List<UserAccount> userAccountsList;
|
||||||
|
private ExtendedFloatingActionButton addNewAccount;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
@ -61,6 +65,13 @@ public class UserAccountsFragment extends Fragment {
|
|||||||
|
|
||||||
}, 250));
|
}, 250));
|
||||||
|
|
||||||
|
addNewAccount = v.findViewById(R.id.addNewAccount);
|
||||||
|
addNewAccount.setOnClickListener(view -> {
|
||||||
|
|
||||||
|
Intent intent = new Intent(view.getContext(), AddNewAccountActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
});
|
||||||
|
|
||||||
fetchDataAsync();
|
fetchDataAsync();
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
|
@ -22,7 +22,7 @@ public class AlertDialogs {
|
|||||||
.setMessage(message)
|
.setMessage(message)
|
||||||
.setCancelable(true)
|
.setCancelable(true)
|
||||||
.setIcon(R.drawable.ic_warning)
|
.setIcon(R.drawable.ic_warning)
|
||||||
.setNegativeButton(copyNegativeButton, (dialog, which) -> dialog.dismiss())
|
.setNeutralButton(copyNegativeButton, (dialog, which) -> dialog.dismiss())
|
||||||
.setPositiveButton(copyPositiveButton, (dialog, which) -> {
|
.setPositiveButton(copyPositiveButton, (dialog, which) -> {
|
||||||
|
|
||||||
final TinyDB tinyDb = new TinyDB(context);
|
final TinyDB tinyDb = new TinyDB(context);
|
||||||
@ -76,7 +76,7 @@ public class AlertDialogs {
|
|||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
|
|
||||||
})
|
})
|
||||||
.setNegativeButton(negativeButton, null).show();
|
.setNeutralButton(negativeButton, null).show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ public class AlertDialogs {
|
|||||||
.setTitle(title + userNameMain)
|
.setTitle(title + userNameMain)
|
||||||
.setMessage(message)
|
.setMessage(message)
|
||||||
.setPositiveButton(positiveButton, (dialog, whichButton) -> CollaboratorActions.deleteCollaborator(context, searchKeyword, userNameMain))
|
.setPositiveButton(positiveButton, (dialog, whichButton) -> CollaboratorActions.deleteCollaborator(context, searchKeyword, userNameMain))
|
||||||
.setNegativeButton(negativeButton, null).show();
|
.setNeutralButton(negativeButton, null).show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ public class AlertDialogs {
|
|||||||
.setTitle(title + userNameMain)
|
.setTitle(title + userNameMain)
|
||||||
.setMessage(message)
|
.setMessage(message)
|
||||||
.setPositiveButton(positiveButton, (dialog, whichButton) -> TeamActions.addTeamMember(context, userNameMain, teamId))
|
.setPositiveButton(positiveButton, (dialog, whichButton) -> TeamActions.addTeamMember(context, userNameMain, teamId))
|
||||||
.setNegativeButton(negativeButton, null).show();
|
.setNeutralButton(negativeButton, null).show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ public class AlertDialogs {
|
|||||||
.setTitle(title + userNameMain)
|
.setTitle(title + userNameMain)
|
||||||
.setMessage(message)
|
.setMessage(message)
|
||||||
.setPositiveButton(positiveButton, (dialog, whichButton) -> TeamActions.removeTeamMember(context, userNameMain, teamId))
|
.setPositiveButton(positiveButton, (dialog, whichButton) -> TeamActions.removeTeamMember(context, userNameMain, teamId))
|
||||||
.setNegativeButton(negativeButton, null).show();
|
.setNeutralButton(negativeButton, null).show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ public class ClickListener implements View.OnClickListener {
|
|||||||
{
|
{
|
||||||
|
|
||||||
LayoutInflater inflater1 = LayoutInflater.from(mCtx);
|
LayoutInflater inflater1 = LayoutInflater.from(mCtx);
|
||||||
View layout = inflater1.inflate(R.layout.custom_toast,
|
View layout = inflater1.inflate(R.layout.custom_toast_success,
|
||||||
(ViewGroup) v.findViewById(R.id.custom_toast_container));
|
(ViewGroup) v.findViewById(R.id.custom_toast_container));
|
||||||
|
|
||||||
TextView text = layout.findViewById(R.id.toastText);
|
TextView text = layout.findViewById(R.id.toastText);
|
||||||
|
@ -1,63 +0,0 @@
|
|||||||
package org.mian.gitnex.helpers;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
|
||||||
import org.mian.gitnex.R;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Author M M Arif
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class SnackBar {
|
|
||||||
|
|
||||||
public static void info(Context context, View createRepository, String message) {
|
|
||||||
|
|
||||||
Snackbar snackBar = Snackbar.make(createRepository, message, Snackbar.LENGTH_LONG);
|
|
||||||
|
|
||||||
View sbView = snackBar.getView();
|
|
||||||
TextView textView = sbView.findViewById(R.id.snackbar_text);
|
|
||||||
textView.setTextColor(context.getResources().getColor(R.color.lightBlue));
|
|
||||||
|
|
||||||
snackBar.show();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void success(Context context, View createRepository, String message) {
|
|
||||||
|
|
||||||
Snackbar snackBar = Snackbar.make(createRepository, message, Snackbar.LENGTH_LONG);
|
|
||||||
|
|
||||||
View sbView = snackBar.getView();
|
|
||||||
TextView textView = sbView.findViewById(R.id.snackbar_text);
|
|
||||||
textView.setTextColor(context.getResources().getColor(R.color.white));
|
|
||||||
|
|
||||||
snackBar.show();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void warning(Context context, View createRepository, String message) {
|
|
||||||
|
|
||||||
Snackbar snackBar = Snackbar.make(createRepository, message, Snackbar.LENGTH_LONG);
|
|
||||||
|
|
||||||
View sbView = snackBar.getView();
|
|
||||||
TextView textView = sbView.findViewById(R.id.snackbar_text);
|
|
||||||
textView.setTextColor(context.getResources().getColor(R.color.lightYellow));
|
|
||||||
|
|
||||||
snackBar.show();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void error(Context context, View createRepository, String message) {
|
|
||||||
|
|
||||||
Snackbar snackBar = Snackbar.make(createRepository, message, Snackbar.LENGTH_LONG);
|
|
||||||
|
|
||||||
View sbView = snackBar.getView();
|
|
||||||
TextView textView = sbView.findViewById(R.id.snackbar_text);
|
|
||||||
textView.setTextColor(context.getResources().getColor(R.color.darkRed));
|
|
||||||
|
|
||||||
snackBar.show();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -16,7 +16,7 @@ public class Toasty {
|
|||||||
public static void info(Context context, String message) {
|
public static void info(Context context, String message) {
|
||||||
|
|
||||||
LayoutInflater inflater = LayoutInflater.from(context);
|
LayoutInflater inflater = LayoutInflater.from(context);
|
||||||
View view = inflater.inflate(context.getResources().getLayout(R.layout.custom_toast), null);
|
View view = inflater.inflate(context.getResources().getLayout(R.layout.custom_toast_info), null);
|
||||||
|
|
||||||
TextView text = view.findViewById(R.id.toastText);
|
TextView text = view.findViewById(R.id.toastText);
|
||||||
text.setText(message);
|
text.setText(message);
|
||||||
@ -43,4 +43,34 @@ public class Toasty {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void warning(Context context, String message) {
|
||||||
|
|
||||||
|
LayoutInflater inflater = LayoutInflater.from(context);
|
||||||
|
View view = inflater.inflate(context.getResources().getLayout(R.layout.custom_toast_warning), null);
|
||||||
|
|
||||||
|
TextView text = view.findViewById(R.id.toastText);
|
||||||
|
text.setText(message);
|
||||||
|
|
||||||
|
Toast toast = new Toast(context);
|
||||||
|
toast.setDuration(Toast.LENGTH_LONG);
|
||||||
|
toast.setView(view);
|
||||||
|
toast.show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void success(Context context, String message) {
|
||||||
|
|
||||||
|
LayoutInflater inflater = LayoutInflater.from(context);
|
||||||
|
View view = inflater.inflate(context.getResources().getLayout(R.layout.custom_toast_success), null);
|
||||||
|
|
||||||
|
TextView text = view.findViewById(R.id.toastText);
|
||||||
|
text.setText(message);
|
||||||
|
|
||||||
|
Toast toast = new Toast(context);
|
||||||
|
toast.setDuration(Toast.LENGTH_LONG);
|
||||||
|
toast.setView(view);
|
||||||
|
toast.show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,12 @@ public interface ApiInterface {
|
|||||||
@POST("users/{username}/tokens") // create new token with 2fa otp
|
@POST("users/{username}/tokens") // create new token with 2fa otp
|
||||||
Call<UserTokens> createNewTokenWithOTP(@Header("Authorization") String authorization, @Header("X-Gitea-OTP") int loginOTP, @Path("username") String loginUid, @Body UserTokens jsonStr);
|
Call<UserTokens> createNewTokenWithOTP(@Header("Authorization") String authorization, @Header("X-Gitea-OTP") int loginOTP, @Path("username") String loginUid, @Body UserTokens jsonStr);
|
||||||
|
|
||||||
|
@DELETE("users/{username}/tokens/{token}") // delete token by ID
|
||||||
|
Call<Void> deleteToken(@Header("Authorization") String authorization, @Path("username") String loginUid, @Path("token") int tokenID);
|
||||||
|
|
||||||
|
@DELETE("users/{username}/tokens/{token}") // delete token by ID with 2fa otp
|
||||||
|
Call<Void> deleteTokenWithOTP(@Header("Authorization") String authorization, @Header("X-Gitea-OTP") int loginOTP, @Path("username") String loginUid, @Path("token") int tokenID);
|
||||||
|
|
||||||
@GET("notifications") // List users's notification threads
|
@GET("notifications") // List users's notification threads
|
||||||
Call<List<NotificationThread>> getNotificationThreads(@Header("Authorization") String token, @Query("all") Boolean all, @Query("status-types") String[] statusTypes, @Query("since") String since, @Query("before") String before, @Query("page") Integer page, @Query("limit") Integer limit);
|
Call<List<NotificationThread>> getNotificationThreads(@Header("Authorization") String token, @Query("all") Boolean all, @Query("status-types") String[] statusTypes, @Query("since") String since, @Query("before") String before, @Query("page") Integer page, @Query("limit") Integer limit);
|
||||||
|
|
||||||
@ -315,4 +321,7 @@ public interface ApiInterface {
|
|||||||
|
|
||||||
@DELETE("repos/{owner}/{repo}/branches/{branch}") // delete branch
|
@DELETE("repos/{owner}/{repo}/branches/{branch}") // delete branch
|
||||||
Call<JsonElement> deleteBranch(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Path("branch") String branchName);
|
Call<JsonElement> deleteBranch(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Path("branch") String branchName);
|
||||||
|
|
||||||
|
@GET("repos/{owner}/{repo}/forks") // get all repo forks
|
||||||
|
Call<List<UserRepositories>> getRepositoryForks(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Query("page") int page, @Query("limit") int limit);
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ public class Issues {
|
|||||||
this.body = body;
|
this.body = body;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class userObject {
|
public static class userObject {
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
private String login;
|
private String login;
|
||||||
@ -71,7 +71,7 @@ public class Issues {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class labelsObject {
|
public static class labelsObject {
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
private String name;
|
private String name;
|
||||||
@ -95,7 +95,7 @@ public class Issues {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class pullRequestObject {
|
public static class pullRequestObject {
|
||||||
|
|
||||||
private boolean merged;
|
private boolean merged;
|
||||||
private String merged_at;
|
private String merged_at;
|
||||||
@ -109,7 +109,7 @@ public class Issues {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class milestoneObject {
|
public static class milestoneObject {
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
private String title;
|
private String title;
|
||||||
@ -153,7 +153,7 @@ public class Issues {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class assigneesObject {
|
public static class assigneesObject {
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
private String login;
|
private String login;
|
||||||
|
@ -33,9 +33,13 @@ public class UserRepositories {
|
|||||||
private String avatar_url;
|
private String avatar_url;
|
||||||
private boolean archived;
|
private boolean archived;
|
||||||
|
|
||||||
|
public UserRepositories(String body) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
private permissionsObject permissions;
|
private permissionsObject permissions;
|
||||||
|
|
||||||
public class permissionsObject {
|
public static class permissionsObject {
|
||||||
|
|
||||||
private boolean admin;
|
private boolean admin;
|
||||||
private boolean push;
|
private boolean push;
|
||||||
|
@ -58,17 +58,17 @@ public class AdminGetUsersViewModel extends ViewModel {
|
|||||||
}
|
}
|
||||||
else if(response.code() == 403) {
|
else if(response.code() == 403) {
|
||||||
|
|
||||||
Toasty.info(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.info(ctx, ctx.getString(R.string.apiNotFound));
|
Toasty.warning(ctx, ctx.getString(R.string.apiNotFound));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Toasty.info(ctx, ctx.getString(R.string.genericError));
|
Toasty.error(ctx, ctx.getString(R.string.genericError));
|
||||||
Log.i("onResponse", String.valueOf(response.code()));
|
Log.i("onResponse", String.valueOf(response.code()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ public class FilesViewModel extends ViewModel {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
Toasty.info(ctx, ctx.getString(R.string.noDataFilesTab));
|
Toasty.warning(ctx, ctx.getString(R.string.noDataFilesTab));
|
||||||
Log.i("onResponse", String.valueOf(response.code()));
|
Log.i("onResponse", String.valueOf(response.code()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ public class FilesViewModel extends ViewModel {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
Toasty.info(ctx, ctx.getString(R.string.noDataFilesTab));
|
Toasty.warning(ctx, ctx.getString(R.string.noDataFilesTab));
|
||||||
Log.i("onResponse", String.valueOf(response.code()));
|
Log.i("onResponse", String.valueOf(response.code()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
app/src/main/res/drawable/ic_markdown.xml
Normal file
4
app/src/main/res/drawable/ic_markdown.xml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<vector android:height="24dp" android:viewportHeight="16"
|
||||||
|
android:viewportWidth="16" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="#368f73" android:fillType="evenOdd" android:pathData="M14.85,3L1.15,3C0.52,3 0,3.52 0,4.15v7.69C0,12.48 0.52,13 1.15,13h13.69c0.64,0 1.15,-0.52 1.15,-1.15v-7.7C16,3.52 15.48,3 14.85,3zM9,11L7,11L7,8L5.5,9.92 4,8v3L2,11L2,5h2l1.5,2L7,5h2v6zM11.99,11.5L9.5,8L11,8L11,5h2v3h1.5l-2.51,3.5z"/>
|
||||||
|
</vector>
|
@ -1,39 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:color="@color/colorPrimaryDark">
|
|
||||||
|
|
||||||
<item android:id="@android:id/mask">
|
|
||||||
|
|
||||||
<shape android:shape="rectangle">
|
|
||||||
|
|
||||||
<solid android:color="@color/btnBackground" />
|
|
||||||
<corners android:radius="3dp" />
|
|
||||||
|
|
||||||
</shape>
|
|
||||||
|
|
||||||
</item>
|
|
||||||
|
|
||||||
<item android:id="@android:id/background">
|
|
||||||
|
|
||||||
<shape android:shape="rectangle">
|
|
||||||
|
|
||||||
<gradient
|
|
||||||
android:angle="90"
|
|
||||||
android:endColor="@color/btnBackground"
|
|
||||||
android:startColor="@color/btnBackground"
|
|
||||||
android:type="linear" />
|
|
||||||
|
|
||||||
<corners android:radius="3dp" />
|
|
||||||
|
|
||||||
<padding
|
|
||||||
android:top="0dp"
|
|
||||||
android:bottom="0dp"
|
|
||||||
android:left="10dp"
|
|
||||||
android:right="10dp"
|
|
||||||
/>
|
|
||||||
|
|
||||||
</shape>
|
|
||||||
|
|
||||||
</item>
|
|
||||||
|
|
||||||
</ripple>
|
|
@ -1,21 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<shape
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:shape="rectangle">
|
|
||||||
|
|
||||||
<solid
|
|
||||||
android:color="@color/hintColor">
|
|
||||||
</solid>
|
|
||||||
|
|
||||||
<corners
|
|
||||||
android:radius="3dp">
|
|
||||||
</corners>
|
|
||||||
|
|
||||||
<padding
|
|
||||||
android:top="0dp"
|
|
||||||
android:right="10dp"
|
|
||||||
android:left="10dp"
|
|
||||||
android:bottom="0dp">
|
|
||||||
</padding>
|
|
||||||
|
|
||||||
</shape>
|
|
@ -7,6 +7,6 @@
|
|||||||
android:width="36dp"
|
android:width="36dp"
|
||||||
android:height="36dp" />
|
android:height="36dp" />
|
||||||
<solid
|
<solid
|
||||||
android:color="@color/white" />
|
android:color="@color/colorWhite" />
|
||||||
|
|
||||||
</shape>
|
</shape>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:shape="rectangle" >
|
android:shape="rectangle" >
|
||||||
<corners android:radius="5dp"/>
|
<corners android:radius="8dp"/>
|
||||||
|
|
||||||
</shape>
|
</shape>
|
||||||
|
127
app/src/main/res/layout/activity_add_new_account.xml
Normal file
127
app/src/main/res/layout/activity_add_new_account.xml
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/layoutNewAccount"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:background="?attr/primaryBackgroundColor"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
|
android:id="@+id/appBar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:theme="@style/Widget.AppCompat.SearchView"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/primaryBackgroundColor"
|
||||||
|
tools:ignore="UnusedAttribute">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/close"
|
||||||
|
android:layout_width="@dimen/close_button_size"
|
||||||
|
android:layout_height="@dimen/close_button_size"
|
||||||
|
android:layout_marginRight="15dp"
|
||||||
|
android:layout_marginLeft="15dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:contentDescription="@string/close"
|
||||||
|
android:src="@drawable/ic_arrow_back" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/toolbarTitle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:text="@string/addNewAccount"
|
||||||
|
android:textColor="?attr/primaryTextColor"
|
||||||
|
android:ellipsize="none"
|
||||||
|
android:scrollbars="horizontal"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:layout_marginEnd="20dp"
|
||||||
|
android:textSize="18sp" />
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.Toolbar>
|
||||||
|
|
||||||
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="20dp"
|
||||||
|
android:layout_marginTop="50dp"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:background="@drawable/shape_dropdown">
|
||||||
|
|
||||||
|
<Spinner
|
||||||
|
android:id="@+id/protocolSpinner"
|
||||||
|
android:layout_width="120dp"
|
||||||
|
android:layout_height="44dp"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:spinnerMode="dropdown" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/instanceUrl"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:background="@drawable/shape_inputs"
|
||||||
|
android:drawableStart="@drawable/ic_link"
|
||||||
|
android:drawablePadding="10dp"
|
||||||
|
android:hint="@string/instanceUrl"
|
||||||
|
android:inputType="textUri"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:textColor="?attr/inputTextColor"
|
||||||
|
android:textColorHighlight="?attr/hintColor"
|
||||||
|
android:textColorHint="?attr/hintColor"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:autofillHints="@string/instanceUrl" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/loginToken"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:background="@drawable/shape_inputs"
|
||||||
|
android:drawableStart="@drawable/ic_lock"
|
||||||
|
android:drawablePadding="10dp"
|
||||||
|
android:hint="@string/copyToken"
|
||||||
|
android:inputType="text"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:textColor="?attr/inputTextColor"
|
||||||
|
android:textColorHighlight="?attr/hintColor"
|
||||||
|
android:textColorHint="?attr/hintColor"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:visibility="visible"
|
||||||
|
android:autofillHints="@string/copyToken" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/addNewAccount"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="60dp"
|
||||||
|
android:layout_marginStart="10dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:layout_marginBottom="15dp"
|
||||||
|
android:text="@string/addNewAccountText"
|
||||||
|
android:textColor="@color/btnTextColor"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -213,9 +213,8 @@
|
|||||||
android:layout_gravity="end"
|
android:layout_gravity="end"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="20dp"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="40dp"
|
android:layout_height="60dp"
|
||||||
android:text="@string/newCreateButtonCopy"
|
android:text="@string/newCreateButtonCopy"
|
||||||
android:background="@drawable/shape_buttons"
|
|
||||||
android:textColor="@color/btnTextColor" />
|
android:textColor="@color/btnTextColor" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -103,11 +103,10 @@
|
|||||||
android:layout_gravity="end"
|
android:layout_gravity="end"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="20dp"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="40dp"
|
android:layout_height="60dp"
|
||||||
android:text="@string/newCreateButtonCopy"
|
android:text="@string/newCreateButtonCopy"
|
||||||
android:background="@drawable/shape_buttons"
|
|
||||||
android:textColor="@color/btnTextColor" />
|
android:textColor="@color/btnTextColor" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -152,9 +152,8 @@
|
|||||||
android:layout_gravity="end"
|
android:layout_gravity="end"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="20dp"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="40dp"
|
android:layout_height="60dp"
|
||||||
android:text="@string/newCreateButtonCopy"
|
android:text="@string/newCreateButtonCopy"
|
||||||
android:background="@drawable/shape_buttons"
|
|
||||||
android:textColor="@color/btnTextColor" />
|
android:textColor="@color/btnTextColor" />
|
||||||
|
|
||||||
<View
|
<View
|
||||||
@ -165,4 +164,4 @@
|
|||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -181,9 +181,8 @@
|
|||||||
android:layout_gravity="end"
|
android:layout_gravity="end"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="20dp"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="40dp"
|
android:layout_height="60dp"
|
||||||
android:text="@string/newCreateButtonCopy"
|
android:text="@string/newCreateButtonCopy"
|
||||||
android:background="@drawable/shape_buttons"
|
|
||||||
android:textColor="@color/btnTextColor" />
|
android:textColor="@color/btnTextColor" />
|
||||||
|
|
||||||
<View
|
<View
|
||||||
|
@ -164,9 +164,8 @@
|
|||||||
android:layout_gravity="end"
|
android:layout_gravity="end"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="20dp"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="40dp"
|
android:layout_height="60dp"
|
||||||
android:text="@string/newCreateButtonCopy"
|
android:text="@string/newCreateButtonCopy"
|
||||||
android:background="@drawable/shape_buttons"
|
|
||||||
android:textColor="@color/btnTextColor" />
|
android:textColor="@color/btnTextColor" />
|
||||||
|
|
||||||
<View
|
<View
|
||||||
|
@ -164,9 +164,8 @@
|
|||||||
android:layout_gravity="end"
|
android:layout_gravity="end"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="20dp"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="40dp"
|
android:layout_height="60dp"
|
||||||
android:text="@string/saveButton"
|
android:text="@string/saveButton"
|
||||||
android:background="@drawable/shape_buttons"
|
|
||||||
android:textColor="@color/btnTextColor" />
|
android:textColor="@color/btnTextColor" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
85
app/src/main/res/layout/activity_forks.xml
Normal file
85
app/src/main/res/layout/activity_forks.xml
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:background="?attr/primaryBackgroundColor">
|
||||||
|
|
||||||
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
|
android:id="@+id/appbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:theme="@style/Widget.AppCompat.SearchView">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/primaryBackgroundColor"
|
||||||
|
tools:ignore="UnusedAttribute">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/close"
|
||||||
|
android:layout_width="@dimen/close_button_size"
|
||||||
|
android:layout_height="@dimen/close_button_size"
|
||||||
|
android:layout_marginRight="15dp"
|
||||||
|
android:layout_marginLeft="15dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:contentDescription="@string/close"
|
||||||
|
android:src="@drawable/ic_close" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/toolbar_title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:text="@string/commitTitle"
|
||||||
|
android:textColor="?attr/primaryTextColor"
|
||||||
|
android:ellipsize="none"
|
||||||
|
android:scrollbars="horizontal"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:layout_marginEnd="20dp"
|
||||||
|
android:textSize="18sp" />
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.Toolbar>
|
||||||
|
|
||||||
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
|
android:id="@+id/pullToRefresh"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_marginTop="50dp"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/recyclerView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="?attr/primaryBackgroundColor"
|
||||||
|
android:scrollbars="vertical" />
|
||||||
|
|
||||||
|
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/noData"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_margin="15dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/noDataFound"
|
||||||
|
android:textColor="?attr/primaryTextColor"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progress_bar"
|
||||||
|
style="@style/Base.Widget.AppCompat.ProgressBar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:indeterminate="true"
|
||||||
|
android:visibility="visible" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -38,6 +38,7 @@
|
|||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/relativeMainLayoutFrame"
|
android:id="@+id/relativeMainLayoutFrame"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
android:layout_marginTop="50dp"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
@ -225,19 +226,6 @@
|
|||||||
|
|
||||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/addNewComment"
|
|
||||||
android:src="@drawable/ic_reply"
|
|
||||||
android:tint="@color/white"
|
|
||||||
android:layout_width="54dp"
|
|
||||||
android:layout_height="54dp"
|
|
||||||
android:layout_margin="15dp"
|
|
||||||
android:layout_alignParentBottom="true"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:background="@drawable/shape_circle"
|
|
||||||
android:padding="@dimen/fab_padding"
|
|
||||||
android:contentDescription="@string/addNewContent" />
|
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/progressBar"
|
android:id="@+id/progressBar"
|
||||||
style="@style/Base.Widget.AppCompat.ProgressBar"
|
style="@style/Base.Widget.AppCompat.ProgressBar"
|
||||||
@ -248,4 +236,18 @@
|
|||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||||
|
android:id="@+id/addNewComment"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="end|bottom"
|
||||||
|
android:layout_margin="16dp"
|
||||||
|
android:text="@string/commentButtonText"
|
||||||
|
android:contentDescription="@string/commentButtonText"
|
||||||
|
android:textColor="@color/colorWhite"
|
||||||
|
android:backgroundTint="@color/darkGreen"
|
||||||
|
app:layout_behavior="com.google.android.material.behavior.HideBottomViewOnScrollBehavior"
|
||||||
|
app:iconTint="@color/colorWhite"
|
||||||
|
app:icon="@drawable/ic_reply" />
|
||||||
|
|
||||||
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
|
@ -202,7 +202,7 @@
|
|||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="60dp"
|
||||||
android:text="@string/btnLogin"
|
android:text="@string/btnLogin"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="10dp"
|
||||||
@ -210,7 +210,6 @@
|
|||||||
android:layout_marginTop="15dp"
|
android:layout_marginTop="15dp"
|
||||||
android:textColor="@color/btnTextColor"
|
android:textColor="@color/btnTextColor"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:background="@drawable/shape_buttons"
|
|
||||||
android:id="@+id/login_button"/>
|
android:id="@+id/login_button"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -160,9 +160,8 @@
|
|||||||
android:layout_gravity="end"
|
android:layout_gravity="end"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="20dp"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="40dp"
|
android:layout_height="60dp"
|
||||||
android:text="@string/mergePullRequestButtonText"
|
android:text="@string/mergePullRequestButtonText"
|
||||||
android:background="@drawable/shape_buttons"
|
|
||||||
android:textColor="@color/btnTextColor" />
|
android:textColor="@color/btnTextColor" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -228,10 +228,8 @@
|
|||||||
android:layout_gravity="end"
|
android:layout_gravity="end"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="20dp"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="40dp"
|
android:layout_height="60dp"
|
||||||
android:width="140dp"
|
|
||||||
android:text="@string/newFileButtonCopy"
|
android:text="@string/newFileButtonCopy"
|
||||||
android:background="@drawable/shape_buttons"
|
|
||||||
android:textColor="@color/btnTextColor" />
|
android:textColor="@color/btnTextColor" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -144,9 +144,8 @@
|
|||||||
android:layout_gravity="end"
|
android:layout_gravity="end"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="20dp"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="40dp"
|
android:layout_height="6dp"
|
||||||
android:text="@string/newCreateButtonCopy"
|
android:text="@string/newCreateButtonCopy"
|
||||||
android:background="@drawable/shape_buttons"
|
|
||||||
android:textColor="@color/btnTextColor" />
|
android:textColor="@color/btnTextColor" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user