Skip to content
Snippets Groups Projects
Commit 12bc5826 authored by Michi302's avatar Michi302
Browse files

Merge branch 'master' into fdroid

# Conflicts:
#	app/build.gradle
#	app/src/main/java/com/commit451/gitlab/App.java
parents b7633464 230cbe28
No related branches found
No related tags found
No related merge requests found
Pipeline #
Showing with 86 additions and 26 deletions
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Loading
Loading
@@ -40,6 +42,6 @@
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@null"
android:padding="2dp"
android:src="@drawable/ic_overflow_24dp" />
app:srcCompat="@drawable/ic_overflow_24dp" />
 
</LinearLayout>
\ No newline at end of file
Loading
Loading
@@ -6,6 +6,7 @@
android:layout_height="wrap_content"
android:foreground="?attr/selectableItemBackground"
android:minHeight="?android:attr/listPreferredItemHeight"
android:minWidth="256dp"
android:orientation="vertical"
android:padding="16dp"
android:layout_margin="16dp">
Loading
Loading
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="@dimen/user_list_image_size"
Loading
Loading
@@ -20,7 +22,7 @@
android:layout_gravity="right"
android:padding="8dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:src="@drawable/ic_overflow_24dp"
app:srcCompat="@drawable/ic_overflow_24dp"
android:contentDescription="@null"/>
 
<LinearLayout
Loading
Loading
Loading
Loading
@@ -15,10 +15,10 @@
android:id="@+id/icon"
android:layout_width="@dimen/image_size"
android:layout_height="@dimen/image_size"
android:src="@mipmap/ic_launcher"
android:layout_marginLeft="@dimen/padding_normal"
android:layout_gravity="center_vertical"
android:contentDescription="@null"/>
android:contentDescription="@null"
tools:src="@drawable/ic_logo"/>
 
<LinearLayout
android:layout_width="match_parent"
Loading
Loading
Loading
Loading
@@ -26,7 +26,7 @@
android:id="@+id/icon_gallery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_gallery_24dp"
app:srcCompat="@drawable/ic_gallery_24dp"
android:layout_gravity="center_vertical"
android:padding="8dp"
android:background="?attr/selectableItemBackgroundBorderless"
Loading
Loading
@@ -37,7 +37,7 @@
android:id="@+id/icon_camera"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_camera_24dp"
app:srcCompat="@drawable/ic_camera_24dp"
android:layout_gravity="center_vertical"
android:padding="8dp"
android:background="?attr/selectableItemBackgroundBorderless"
Loading
Loading
@@ -55,7 +55,7 @@
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:src="@drawable/ic_send_24dp"
app:srcCompat="@drawable/ic_send_24dp"
app:fabSize="mini"/>
 
</LinearLayout>
Loading
Loading
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_add_label"
app:showAsAction="ifRoom"
android:icon="@drawable/ic_add_24dp"
android:title="@string/action_create"/>
</menu>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_create"
app:showAsAction="ifRoom"
android:title="@string/action_create"/>
</menu>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_private_token"
app:showAsAction="never"
android:title="@string/token_link"/>
</menu>
\ No newline at end of file
Loading
Loading
@@ -79,14 +79,14 @@
<string name="token_hint">Private token</string>
<string name="login_activity">Login</string>
<string name="login_progress_dialog">Logging in. Please wait</string>
<string name="token_link"><u>Login using private token</u></string>
<string name="normal_link"><u>Login using username or email</u></string>
<string name="token_link">Login using private token</string>
<string name="normal_link">Login using username or email</string>
<string name="certificate_title">Certificate not trusted</string>
<string name="certificate_message">The certificate the server used was not issued by a trusted authority.\n\nThis could mean a hacker is trying to intercept your communications.\n\nIf you trust the certificate, press OK to continue.\n\nFingerprint (SHA-1):\n%1$s</string>
<string name="hostname_title">Hostname did not match</string>
<string name="hostname_message">The hostname in the certificate did not match the hostname you are connecting to.\n\nThis could mean a hacker is trying to intercept your communications.\n\nIf you trust the certificate, press OK to continue.</string>
<string name="not_a_valid_url">Not a valid URL</string>
<string name="please_end_your_url_with_a_slash">Please end your url with a "/"</string>
<string name="please_end_your_url_with_a_slash">Please end your URL with a "/"</string>
<string name="not_a_valid_private_token">Not a valid private token</string>
<string name="realm_message">A username and password are being requested by the server.\nThe server says: \"%1$s\"</string>
<string name="already_logged_in">This account is already logged in</string>
Loading
Loading
@@ -204,11 +204,21 @@
<string name="milestone">Milestone</string>
<string name="no_milestone">No Milestone</string>
<string name="add_labels">+ Add Labels</string>
<string name="label_already_added">Label already added</string>
 
<!-- Labels -->
<string name="labels">Labels</string>
<string name="no_labels">No labels</string>
 
<!-- Add New Label -->
<string name="add_new_label_title">Title</string>
<string name="add_new_label_description">Description</string>
<string name="add_new_label_color">Color</string>
<string name="add_new_label_choose_color">Choose color</string>
<string name="add_new_label_color_is_required">Color is required</string>
<string name="label_already_exists">Label already exists</string>
<string name="failed_to_create_label">Failed to create label</string>
<!-- User -->
<string name="remove_user_dialog_title">Remove user?</string>
<string name="add_user">Add user to group</string>
Loading
Loading
Loading
Loading
@@ -14,6 +14,10 @@
 
<style name="Activity" parent="AppTheme"/>
 
<style name="Activity.Login">
<item name="android:windowBackground">?attr/colorPrimary</item>
</style>
<style name="Activity.Projects">
<!--Check v21 for the good bits-->
</style>
Loading
Loading
Loading
Loading
@@ -3,7 +3,7 @@ package com.commit451.gitlab;
import android.net.Uri;
 
import com.bluelinelabs.logansquare.LoganSquare;
import com.commit451.gitlab.api.GitLabClient;
import com.commit451.gitlab.api.GitLab;
import com.commit451.gitlab.model.api.Group;
import com.commit451.gitlab.model.api.Issue;
import com.commit451.gitlab.model.api.MergeRequest;
Loading
Loading
@@ -37,6 +37,7 @@ public class ApiTests {
private static final long FAKE_GROUP_PROJECT_ID = 376651;
 
private static Project sFakeProject;
private static GitLab gitLab;
 
@BeforeClass
public static void setUp() throws Exception {
Loading
Loading
@@ -45,9 +46,9 @@ public class ApiTests {
 
LoganSquare.registerTypeConverter(Uri.class, new NullTypeConverter());
 
TestUtil.login();
gitLab = TestUtil.login();
 
Response<Project> projectResponse = GitLabClient.instance()
Response<Project> projectResponse = gitLab
.getProject(String.valueOf(FAKE_GROUP_PROJECT_ID))
.execute();
assertTrue(projectResponse.isSuccessful());
Loading
Loading
@@ -58,7 +59,7 @@ public class ApiTests {
 
@Test
public void getProjects() throws Exception {
Response<List<Project>> projectsResponse = GitLabClient.instance()
Response<List<Project>> projectsResponse = gitLab
.getAllProjects()
.execute();
assertTrue(projectsResponse.isSuccessful());
Loading
Loading
@@ -67,7 +68,7 @@ public class ApiTests {
 
@Test
public void getGroups() throws Exception {
Response<List<Group>> groupResponse = GitLabClient.instance()
Response<List<Group>> groupResponse = gitLab
.getGroups()
.execute();
assertTrue(groupResponse.isSuccessful());
Loading
Loading
@@ -77,7 +78,7 @@ public class ApiTests {
@Test
public void getIssues() throws Exception {
String defaultState = RuntimeEnvironment.application.getResources().getString(R.string.issue_state_value_default);
Response<List<Issue>> issuesResponse = GitLabClient.instance()
Response<List<Issue>> issuesResponse = gitLab
.getIssues(sFakeProject.getId(), defaultState)
.execute();
assertTrue(issuesResponse.isSuccessful());
Loading
Loading
@@ -88,7 +89,7 @@ public class ApiTests {
public void getFiles() throws Exception {
String defaultBranch = "master";
String currentPath = "";
Response<List<RepositoryTreeObject>> treeResponse = GitLabClient.instance()
Response<List<RepositoryTreeObject>> treeResponse = gitLab
.getTree(sFakeProject.getId(), defaultBranch, currentPath)
.execute();
assertTrue(treeResponse.isSuccessful());
Loading
Loading
@@ -98,7 +99,7 @@ public class ApiTests {
@Test
public void getCommits() throws Exception {
String defaultBranch = "master";
Response<List<RepositoryCommit>> commitsResponse = GitLabClient.instance()
Response<List<RepositoryCommit>> commitsResponse = gitLab
.getCommits(sFakeProject.getId(), defaultBranch, 0)
.execute();
assertTrue(commitsResponse.isSuccessful());
Loading
Loading
@@ -108,7 +109,7 @@ public class ApiTests {
@Test
public void getMergeRequests() throws Exception {
String defaultState = RuntimeEnvironment.application.getResources().getString(R.string.merge_request_state_value_default);
Response<List<MergeRequest>> mergeRequestResponse = GitLabClient.instance()
Response<List<MergeRequest>> mergeRequestResponse = gitLab
.getMergeRequests(sFakeProject.getId(), defaultState)
.execute();
assertTrue(mergeRequestResponse.isSuccessful());
Loading
Loading
@@ -117,7 +118,7 @@ public class ApiTests {
 
@Test
public void getCurrentUser() throws Exception {
Response<UserFull> userFullResponse = GitLabClient.instance()
Response<UserFull> userFullResponse = gitLab
.getThisUser()
.execute();
assertTrue(userFullResponse.isSuccessful());
Loading
Loading
Loading
Loading
@@ -2,10 +2,14 @@ package com.commit451.gitlab;
 
import android.net.Uri;
 
import com.commit451.gitlab.api.GitLabClient;
import com.commit451.gitlab.api.GitLab;
import com.commit451.gitlab.api.GitLabFactory;
import com.commit451.gitlab.api.OkHttpClientFactory;
import com.commit451.gitlab.model.Account;
import com.commit451.gitlab.model.api.UserLogin;
 
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Response;
 
import static org.junit.Assert.assertNotNull;
Loading
Loading
@@ -16,18 +20,23 @@ import static org.junit.Assert.assertTrue;
*/
public class TestUtil {
 
public static void login() throws Exception {
public static GitLab login() throws Exception {
//log in
Account account = new Account();
account.setServerUrl(Uri.parse("https://gitlab.com/"));
 
Response<UserLogin> loginResponse = GitLabClient.create(account)
OkHttpClient.Builder gitlabClientBuilder = OkHttpClientFactory.create(account);
if (BuildConfig.DEBUG) {
gitlabClientBuilder.addInterceptor(new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY));
}
GitLab gitLab = GitLabFactory.create(account, gitlabClientBuilder.build());
Response<UserLogin> loginResponse = gitLab
.loginWithUsername("TestAllTheThings", "testing123")
.execute();
assertTrue(loginResponse.isSuccessful());
assertNotNull(loginResponse.body().getPrivateToken());
//attach the newly retrieved private token
account.setPrivateToken(loginResponse.body().getPrivateToken());
GitLabClient.setAccount(account);
return gitLab;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment