From ce63cde4eef6efb971b29c59bb35c6f9c115b6dd Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Tue, 3 Sep 2019 16:46:38 +0200 Subject: [PATCH 1/7] add menue entry and strings --- app/src/main/res/layout/repo_bottom_sheet_layout.xml | 12 ++++++++++++ app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 3 files changed, 14 insertions(+) diff --git a/app/src/main/res/layout/repo_bottom_sheet_layout.xml b/app/src/main/res/layout/repo_bottom_sheet_layout.xml index e91b1282..776cecbd 100644 --- a/app/src/main/res/layout/repo_bottom_sheet_layout.xml +++ b/app/src/main/res/layout/repo_bottom_sheet_layout.xml @@ -67,4 +67,16 @@ android:textSize="16sp" android:padding="16dp" /> + + \ No newline at end of file diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index a4cfdf23..89acc17f 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -312,6 +312,7 @@ Möchtest du den Nutzer wirklich von dieser Repository entfernen? Benuter von der Repository entfernt. Benutzer zu der Repository hinzugefügt. + Öfne Repository mit einem Browser. diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9489b4d3..8c398b2c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -342,6 +342,7 @@ Do you want to remove this user from the repository? User removed from the repository. User added to the repository. + Open repository with a browser. From 6bc13ad4fe21b77cea189d4da07d073a2c64ee0d Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Thu, 5 Sep 2019 22:06:23 +0200 Subject: [PATCH 2/7] ues language icon also to indicate webbrowser open action --- app/src/main/res/layout/repo_bottom_sheet_layout.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/layout/repo_bottom_sheet_layout.xml b/app/src/main/res/layout/repo_bottom_sheet_layout.xml index 776cecbd..3d7539ee 100644 --- a/app/src/main/res/layout/repo_bottom_sheet_layout.xml +++ b/app/src/main/res/layout/repo_bottom_sheet_layout.xml @@ -72,7 +72,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_vertical" - android:drawableStart="@drawable/ic_web_open" + android:drawableStart="@drawable/ic_language" android:drawablePadding="24dp" android:padding="16dp" android:text="@string/openWebRepo" From 7977aaa2be93376de5a21f62e1ae12125789e545 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Thu, 5 Sep 2019 22:19:26 +0200 Subject: [PATCH 3/7] shorter text --- app/src/main/res/values-de/strings.xml | 2 +- app/src/main/res/values/strings.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 89acc17f..63fbc0a7 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -312,7 +312,7 @@ Möchtest du den Nutzer wirklich von dieser Repository entfernen? Benuter von der Repository entfernt. Benutzer zu der Repository hinzugefügt. - Öfne Repository mit einem Browser. + Öfne mit Browser diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8c398b2c..1c5fd94b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -342,7 +342,7 @@ Do you want to remove this user from the repository? User removed from the repository. User added to the repository. - Open repository with a browser. + Open with browser From 83e3564c136d4ee1e947c11951680aff3b834526 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Fri, 6 Sep 2019 01:01:46 +0200 Subject: [PATCH 4/7] try to implement OpenWebRepoActivity --- app/src/main/AndroidManifest.xml | 1 + .../activities/OpenWebRepoActivity.java | 29 +++++++++++++++++++ .../fragments/RepoBottomSheetFragment.java | 9 ++++++ 3 files changed, 39 insertions(+) create mode 100644 app/src/main/java/org/mian/gitnex/activities/OpenWebRepoActivity.java diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ea556b0b..9e25b314 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,6 +34,7 @@ + diff --git a/app/src/main/java/org/mian/gitnex/activities/OpenWebRepoActivity.java b/app/src/main/java/org/mian/gitnex/activities/OpenWebRepoActivity.java new file mode 100644 index 00000000..3a431379 --- /dev/null +++ b/app/src/main/java/org/mian/gitnex/activities/OpenWebRepoActivity.java @@ -0,0 +1,29 @@ +package org.mian.gitnex.activities; + +import androidx.appcompat.app.AppCompatActivity; + +/** + * Author 6543 + */ + +import android.view.View; +import org.mian.gitnex.util.TinyDB; +import android.content.Intent; +import android.net.Uri; + + +public class OpenWebRepoActivity extends AppCompatActivity implements View.OnClickListener { + + @Override + public void onClick(View v) { + TinyDB tinyDb = new TinyDB(getApplicationContext()); + String repoFullName = tinyDb.getString("repoFullName"); + String instanceUrl = tinyDb.getString("instanceUrl"); + + String url = instanceUrl + "/" + repoFullName; + Intent i = new Intent(Intent.ACTION_VIEW); + i.setData(Uri.parse(url)); + startActivity(i); + + } +} \ No newline at end of file diff --git a/app/src/main/java/org/mian/gitnex/fragments/RepoBottomSheetFragment.java b/app/src/main/java/org/mian/gitnex/fragments/RepoBottomSheetFragment.java index f1435fa9..efa9ab81 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/RepoBottomSheetFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/RepoBottomSheetFragment.java @@ -29,6 +29,7 @@ public class RepoBottomSheetFragment extends BottomSheetDialogFragment { TextView createMilestone = v.findViewById(R.id.createNewMilestone); TextView addCollaborator = v.findViewById(R.id.addCollaborator); TextView createRelease = v.findViewById(R.id.createRelease); + TextView openWebRepo = v.findViewById(R.id.openWebRepo); createLabel.setOnClickListener(new View.OnClickListener() { @Override @@ -70,6 +71,14 @@ public class RepoBottomSheetFragment extends BottomSheetDialogFragment { } }); + openWebRepo.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + bmListener.onButtonClicked("openWebRepo"); + dismiss(); + } + }); + return v; } From 20f687e30e5d2cb9ba62b289c8f1ecd5d72ec988 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Tue, 10 Sep 2019 19:48:44 +0200 Subject: [PATCH 5/7] add sugestions of mmarif * delete OpenWebRepoActivity (function is handled in RepoDetailActivity ) * add&handle case "openWebRepo" in RepoDetailActivity * add new Value "instanceUrlWithProtocol" to tinyDb --- .../mian/gitnex/activities/LoginActivity.java | 4 +++ .../activities/OpenWebRepoActivity.java | 29 ------------------- .../gitnex/activities/RepoDetailActivity.java | 12 ++++++++ 3 files changed, 16 insertions(+), 29 deletions(-) delete mode 100644 app/src/main/java/org/mian/gitnex/activities/OpenWebRepoActivity.java diff --git a/app/src/main/java/org/mian/gitnex/activities/LoginActivity.java b/app/src/main/java/org/mian/gitnex/activities/LoginActivity.java index 9974ad53..2ccd58be 100644 --- a/app/src/main/java/org/mian/gitnex/activities/LoginActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/LoginActivity.java @@ -194,16 +194,20 @@ public class LoginActivity extends AppCompatActivity implements View.OnClickList instanceHost = instanceUrl; } + String instanceUrlWithProtocol; if(protocol.toLowerCase().equals("https")) { instanceUrl = "https://" + instanceHost + "/api/v1/"; + instanceUrlWithProtocol = "https://" + instanceHost; } else { instanceUrl = "http://" + instanceHost + "/api/v1/"; + instanceUrlWithProtocol = "https://" + instanceHost; } tinyDb.putString("instanceUrlRaw", instanceHost); tinyDb.putString("loginUid", loginUid); tinyDb.putString("instanceUrl", instanceUrl); + tinyDb.putString("instanceUrlWithProtocol", instanceUrlWithProtocol); if(connToInternet) { diff --git a/app/src/main/java/org/mian/gitnex/activities/OpenWebRepoActivity.java b/app/src/main/java/org/mian/gitnex/activities/OpenWebRepoActivity.java deleted file mode 100644 index 3a431379..00000000 --- a/app/src/main/java/org/mian/gitnex/activities/OpenWebRepoActivity.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.mian.gitnex.activities; - -import androidx.appcompat.app.AppCompatActivity; - -/** - * Author 6543 - */ - -import android.view.View; -import org.mian.gitnex.util.TinyDB; -import android.content.Intent; -import android.net.Uri; - - -public class OpenWebRepoActivity extends AppCompatActivity implements View.OnClickListener { - - @Override - public void onClick(View v) { - TinyDB tinyDb = new TinyDB(getApplicationContext()); - String repoFullName = tinyDb.getString("repoFullName"); - String instanceUrl = tinyDb.getString("instanceUrl"); - - String url = instanceUrl + "/" + repoFullName; - Intent i = new Intent(Intent.ACTION_VIEW); - i.setData(Uri.parse(url)); - startActivity(i); - - } -} \ No newline at end of file diff --git a/app/src/main/java/org/mian/gitnex/activities/RepoDetailActivity.java b/app/src/main/java/org/mian/gitnex/activities/RepoDetailActivity.java index 0a42adcd..c0003bc8 100644 --- a/app/src/main/java/org/mian/gitnex/activities/RepoDetailActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/RepoDetailActivity.java @@ -35,6 +35,7 @@ import org.mian.gitnex.models.UserRepositories; import org.mian.gitnex.util.AppUtil; import org.mian.gitnex.util.TinyDB; import java.util.Objects; +import android.net.Uri; /** * Author M M Arif @@ -153,6 +154,17 @@ public class RepoDetailActivity extends AppCompatActivity implements RepoBottomS case "createRelease": startActivity(new Intent(RepoDetailActivity.this, CreateReleaseActivity.class)); break; + case "openWebRepo": + TinyDB tinyDb = new TinyDB(getApplicationContext()); + String repoFullName = tinyDb.getString("repoFullName"); + String instanceUrlWithProtocol = "https://" + tinyDb.getString("instanceUrlRaw"); + if(!tinyDb.getString("instanceUrlWithProtocol").isEmpty()) { + instanceUrlWithProtocol = tinyDb.getString("instanceUrlWithProtocol"); + } + Uri url = Uri.parse(instanceUrlWithProtocol + "/" + repoFullName); + Intent i = new Intent(Intent.ACTION_VIEW, url); + startActivity(i); + break; } } From 498bf7a72c7d8097cca28a6ec3ac4da31e113336 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Tue, 10 Sep 2019 19:51:43 +0200 Subject: [PATCH 6/7] spelling corection --- app/src/main/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 1c5fd94b..7691dc75 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -342,7 +342,7 @@ Do you want to remove this user from the repository? User removed from the repository. User added to the repository. - Open with browser + Open with Browser From 25f8277f0a0b7cb9973483f0d766374cddc94460 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Tue, 10 Sep 2019 19:56:54 +0200 Subject: [PATCH 7/7] translate missing with deepl --- app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values-ru/strings.xml | 1 + 2 files changed, 2 insertions(+) diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index cd8801a0..5d5dbfa4 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -416,6 +416,7 @@ Description Website Location + Ouvrir avec le Browser \ No newline at end of file diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 7b046da8..4534a4f2 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -416,6 +416,7 @@ Описание Веб-сайт Место расположения + Открыть с помощью браузера \ No newline at end of file