Merge branch 'open-repo-web' of 6543/GitNex into master

This commit is contained in:
M M Arif 2019-09-11 06:26:58 +00:00 committed by Gitea
commit 1ec7ac4f9f
9 changed files with 42 additions and 0 deletions

View File

@ -34,6 +34,7 @@
<activity android:name=".activities.SponsorsActivity" />
<activity android:name=".activities.CreditsActivity" />
<activity android:name=".activities.CreateLabelActivity" />
<activity android:name=".activities.OpenWebRepoActivity" />
<activity android:name=".activities.CreateIssueActivity" />
<activity android:name=".activities.NewMilestoneActivity" />
<activity android:name=".activities.ReplyToIssueActivity" />

View File

@ -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) {

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -67,4 +67,16 @@
android:textSize="16sp"
android:padding="16dp" />
<TextView
android:id="@+id/openWebRepo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:drawableStart="@drawable/ic_language"
android:drawablePadding="24dp"
android:padding="16dp"
android:text="@string/openWebRepo"
android:textColor="@color/white"
android:textSize="16sp" />
</LinearLayout>

View File

@ -312,6 +312,7 @@
<string name="removeCollaboratorMessage">Möchtest du den Nutzer wirklich von dieser Repository entfernen?</string>
<string name="removeCollaboratorToastText">Benuter von der Repository entfernt.</string>
<string name="addCollaboratorToastText">Benutzer zu der Repository hinzugefügt.</string>
<string name="openWebRepo">Öfne mit Browser</string>
<!-- add collaborator -->
<!-- profile section -->

View File

@ -416,6 +416,7 @@
<string name="descriptionText">Description</string>
<string name="websiteText">Website</string>
<string name="locationText">Location</string>
<string name="openWebRepo">Ouvrir avec le Browser</string>
<!-- generic copy -->
</resources>

View File

@ -416,6 +416,7 @@
<string name="descriptionText">Описание</string>
<string name="websiteText">Веб-сайт</string>
<string name="locationText">Место расположения</string>
<string name="openWebRepo">Открыть с помощью браузера</string>
<!-- generic copy -->
</resources>

View File

@ -342,6 +342,7 @@
<string name="removeCollaboratorMessage">Do you want to remove this user from the repository?</string>
<string name="removeCollaboratorToastText">User removed from the repository.</string>
<string name="addCollaboratorToastText">User added to the repository.</string>
<string name="openWebRepo">Open with Browser</string>
<!-- add collaborator -->
<!-- profile section -->