Skip to content
Snippets Groups Projects
Commit cee32e48 authored by r0adkll's avatar r0adkll
Browse files

Many visual improvements

 - Modified several margins and padding to comply more with the Material Design Spec
 - Fixed the navigation drawer to render under the status bar
parent e6b9ef1e
No related branches found
No related tags found
No related merge requests found
Showing
with 264 additions and 89 deletions
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'com.neenbedankt.android-apt'
 
android {
Loading
Loading
Loading
Loading
@@ -15,14 +15,21 @@
android:theme="@style/AppTheme" >
 
<activity
android:name=".activities.MainActivity">
android:name=".activities.GitlabActivity"
android:theme="@android:style/Theme.NoDisplay"
android:noHistory="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activities.MainActivity" />
<activity
android:name=".activities.LoginActivity" />
<activity
android:name=".activities.FileActivity"
android:configChanges="orientation|screenSize"
Loading
Loading
package com.commit451.gitlab.activities;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import com.commit451.gitlab.tools.Prefs;
/**
* This activity acts as switching platform for the application directing the user to the appropriate
* activity based on their logged in state
*
* Created by r0adkll on 9/18/15.
*/
public class GitlabActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(!Prefs.isLoggedIn(this)) {
Intent login = new Intent(this, LoginActivity.class);
login.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(login);
}
else {
// Load MainActivity
Intent main = new Intent(this, MainActivity.class);
main.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(main);
}
// Always finish this activity
finish();
}
}
Loading
Loading
@@ -164,9 +164,9 @@ public class LoginActivity extends BaseActivity {
Prefs.setUserId(LoginActivity.this, response.body().getId());
Prefs.setPrivateToken(LoginActivity.this, response.body().getPrivateToken());
 
Intent i = new Intent(LoginActivity.this, MainActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Intent i = new Intent(LoginActivity.this, GitlabActivity.class);
startActivity(i);
finish();
}
 
@Override
Loading
Loading
package com.commit451.gitlab.activities;
 
import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.design.widget.TabLayout;
Loading
Loading
@@ -14,6 +16,8 @@ import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
Loading
Loading
@@ -89,9 +93,18 @@ public class MainActivity extends BaseActivity {
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
 
// Setup window flags if Lollipop
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.TRANSPARENT);
}
eventReceiver = new EventReceiver();
GitLabApp.bus().register(eventReceiver);
 
drawerLayout.setStatusBarBackgroundColor(getResources().getColor(R.color.purple_dark));
toolbar.setNavigationIcon(R.drawable.ic_menu);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
Loading
Loading
@@ -102,14 +115,9 @@ public class MainActivity extends BaseActivity {
toolbar.inflateMenu(R.menu.main);
toolbar.setOnMenuItemClickListener(mMenuItemClickListener);
if(!Prefs.isLoggedIn(this)) {
startActivity(new Intent(this, LoginActivity.class));
}
else {
navigationView.loadCurrentUser();
connect();
}
navigationView.loadCurrentUser();
connect();
// Create the adapter that will return a fragment for each of the three
// primary sections of the app.
SectionsPagerAdapter sectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
Loading
Loading
Loading
Loading
@@ -2,9 +2,18 @@ package com.commit451.gitlab.views;
 
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.support.v4.graphics.ColorUtils;
import android.support.v4.view.ViewCompat;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
Loading
Loading
@@ -31,14 +40,19 @@ import timber.log.Timber;
* Our very own navigation view
* Created by Jawn on 7/28/2015.
*/
public class GitLabNavigationView extends FrameLayout{
public class GitLabNavigationView extends FrameLayout {
 
@Bind(R.id.profile_image) ImageView profileImage;
@Bind(R.id.profile_user) TextView userName;
@Bind(R.id.profile_email) TextView userEmail;
@Bind(R.id.list) RecyclerView projectList;
@Bind(R.id.drawer_header) FrameLayout header;
ProjectsAdapter mAdapter;
 
private Drawable mInsetForeground;
private Rect mInsets;
private Rect mTempRect = new Rect();
@OnClick(R.id.drawer_header)
void onHeaderClick() {
new LogoutDialog(getContext()).show();
Loading
Loading
@@ -87,6 +101,7 @@ public class GitLabNavigationView extends FrameLayout{
mAdapter = new ProjectsAdapter();
projectList.setAdapter(mAdapter);
projectList.setLayoutManager(new LinearLayoutManager(getContext()));
mInsetForeground = new ColorDrawable(Color.parseColor("#44000000"));
}
 
public void setProjects(List<Project> projects) {
Loading
Loading
@@ -114,4 +129,73 @@ public class GitLabNavigationView extends FrameLayout{
.load(url)
.into(profileImage);
}
@Override
protected boolean fitSystemWindows(Rect insets) {
mInsets = new Rect(insets);
setWillNotDraw(mInsetForeground == null);
ViewCompat.postInvalidateOnAnimation(this);
int headerHeight = getResources().getDimensionPixelSize(R.dimen.navigation_drawer_header_height);
ViewGroup.LayoutParams lp2 = header.getLayoutParams();
lp2.height = headerHeight + insets.top;
header.setLayoutParams(lp2);
MarginLayoutParams params = (MarginLayoutParams) profileImage.getLayoutParams();
params.topMargin = (int) (insets.top + TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16, getResources().getDisplayMetrics()));
profileImage.setLayoutParams(params);
return true; // consume insets
}
@Override
public void draw(Canvas canvas) {
super.draw(canvas);
int width = getWidth();
int height = getHeight();
if (mInsets != null && mInsetForeground != null) {
int sc = canvas.save();
canvas.translate(getScrollX(), getScrollY());
// Top
mTempRect.set(0, 0, width, mInsets.top);
mInsetForeground.setBounds(mTempRect);
mInsetForeground.draw(canvas);
// Bottom
mTempRect.set(0, height - mInsets.bottom, width, height);
mInsetForeground.setBounds(mTempRect);
mInsetForeground.draw(canvas);
// Left
mTempRect.set(0, mInsets.top, mInsets.left, height - mInsets.bottom);
mInsetForeground.setBounds(mTempRect);
mInsetForeground.draw(canvas);
// Right
mTempRect.set(width - mInsets.right, mInsets.top, width, height - mInsets.bottom);
mInsetForeground.setBounds(mTempRect);
mInsetForeground.draw(canvas);
canvas.restoreToCount(sc);
}
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
if (mInsetForeground != null) {
mInsetForeground.setCallback(this);
}
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
if (mInsetForeground != null) {
mInsetForeground.setCallback(null);
}
}
}
app/src/main/res/drawable-hdpi/ic_add_white_24dp.png

156 B

app/src/main/res/drawable-mdpi/ic_add_white_24dp.png

103 B

app/src/main/res/drawable-xhdpi/ic_add_white_24dp.png

135 B

app/src/main/res/drawable-xxhdpi/ic_add_white_24dp.png

180 B

app/src/main/res/drawable-xxxhdpi/ic_add_white_24dp.png

243 B

Loading
Loading
@@ -4,7 +4,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:layout_height="match_parent"
android:fitsSystemWindows="true">
 
<LinearLayout
android:id="@+id/main_content_container"
Loading
Loading
@@ -54,10 +55,12 @@
 
<com.commit451.gitlab.views.GitLabNavigationView
android:id="@+id/navigation_view"
android:layout_width="300dp"
android:layout_width="304dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:clickable="true"
android:background="@color/window_background_color"/>
android:background="@color/window_background_color"
android:fitsSystemWindows="true"
/>
 
</android.support.v4.widget.DrawerLayout>
\ No newline at end of file
Loading
Loading
@@ -13,7 +13,12 @@
<android.support.v7.widget.RecyclerView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="match_parent"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:clipToPadding="false"
/>
 
</com.commit451.gitlab.views.GitLabSwipeRefreshLayout>
 
Loading
Loading
Loading
Loading
@@ -12,7 +12,12 @@
<android.support.v7.widget.RecyclerView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="match_parent"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:clipToPadding="false"
/>
 
</com.commit451.gitlab.views.GitLabSwipeRefreshLayout>
 
Loading
Loading
Loading
Loading
@@ -12,7 +12,12 @@
<android.support.v7.widget.RecyclerView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="match_parent"
android:paddingTop="8dp"
android:paddingBottom="88dp"
android:clipToPadding="false"
/>
 
</com.commit451.gitlab.views.GitLabSwipeRefreshLayout>
 
Loading
Loading
@@ -22,6 +27,6 @@
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="@dimen/padding_normal"
android:src="@drawable/ic_add" />
android:src="@drawable/ic_add_white_24dp" />
 
</FrameLayout>
Loading
Loading
@@ -31,7 +31,7 @@
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="bottom|right"
android:src="@drawable/ic_add"
android:src="@drawable/ic_add_white_24dp"
android:layout_margin="@dimen/padding_normal"/>
 
</FrameLayout >
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/list_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="8dp"
android:minHeight="?android:attr/listPreferredItemHeight"
android:background="?attr/selectableItemBackground">
 
Loading
Loading
@@ -14,23 +12,30 @@
android:id="@+id/commit_image"
android:layout_width="@dimen/image_size"
android:layout_height="@dimen/image_size"
android:layout_marginRight="8dp"
android:layout_gravity="center_vertical"
android:layout_centerVertical="true"
android:layout_marginRight="16dp"
android:layout_marginLeft="16dp"
android:contentDescription="@null"
tools:src="@drawable/ic_doc"
/>
 
<LinearLayout
android:layout_width="0dp"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
android:orientation="vertical"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/commit_image"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:layout_marginRight="16dp"
>
 
<TextView
android:id="@+id/commit_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/text_size_small"
android:textColor="?android:attr/textColorPrimary"
android:maxLines="2"
android:ellipsize="end"
tools:text="I commited all the code at once cause I am cool. So sorry"/>
Loading
Loading
@@ -39,19 +44,22 @@
android:id="@+id/commit_author"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/commit_message"
android:textSize="@dimen/text_size_tiny"
android:textColor="@color/white_60"
android:textColor="?android:attr/textColorSecondary"
tools:text="Jawnnypoo"/>
 
</LinearLayout>
<TextView
android:id="@+id/commit_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/text_size_tiny"
android:layout_gravity="bottom"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
tools:text="Max 25, 2019"/>
<TextView
android:id="@+id/commit_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/commit_message"
android:layout_alignParentRight="true"
android:textSize="@dimen/text_size_tiny"
android:textColor="?android:attr/textColorSecondary"
tools:text="Max 25, 2019"/>
</RelativeLayout>
 
</LinearLayout>
\ No newline at end of file
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground">
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="?attr/selectableItemBackground"
>
 
<ImageView
android:id="@+id/file_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
android:layout_gravity="center_vertical"/>
android:layout_gravity="center_vertical"
android:layout_marginLeft="16dp"
android:layout_marginRight="8dp"
tools:src="@drawable/ic_folder"
/>
 
<TextView
android:id="@+id/file_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textSize="@dimen/text_size_small"
android:padding="@dimen/padding_normal"
android:ellipsize="marquee"/>
android:ellipsize="marquee"
tools:text="build.gradle"
/>
 
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/list_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="8dp"
android:minHeight="?android:attr/listPreferredItemHeight"
android:background="?attr/selectableItemBackground">
 
Loading
Loading
@@ -14,23 +12,30 @@
android:id="@+id/issue_image"
android:layout_width="@dimen/image_size"
android:layout_height="@dimen/image_size"
android:layout_marginRight="8dp"
android:layout_gravity="center_vertical"
android:layout_centerVertical="true"
android:layout_marginRight="16dp"
android:layout_marginLeft="16dp"
android:contentDescription="@null"
tools:src="@drawable/ic_doc"
/>
 
<LinearLayout
android:layout_width="0dp"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
android:orientation="vertical"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/issue_image"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:layout_marginRight="16dp"
>
 
<TextView
android:id="@+id/issue_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/text_size_small"
android:textColor="?android:attr/textColorPrimary"
android:maxLines="2"
android:ellipsize="end"
tools:text="I commited all the code at once cause I am cool. So sorry"/>
Loading
Loading
@@ -39,19 +44,22 @@
android:id="@+id/issue_creator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/issue_message"
android:textSize="@dimen/text_size_tiny"
android:textColor="@color/white_60"
tools:text="Created by Jawnnypoo"/>
android:textColor="?android:attr/textColorSecondary"
tools:text="Jawnnypoo"/>
 
</LinearLayout>
<TextView
android:id="@+id/issue_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/text_size_tiny"
android:layout_gravity="bottom"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
tools:text="Closed"/>
<TextView
android:id="@+id/issue_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/issue_message"
android:layout_alignParentRight="true"
android:textSize="@dimen/text_size_tiny"
android:textColor="?android:attr/textColorSecondary"
tools:text="Closed"/>
</RelativeLayout>
 
</LinearLayout>
\ No newline at end of file
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:foreground="?attr/selectableItemBackground">
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:foreground="?attr/selectableItemBackground"
>
 
<TextView
android:id="@+id/project_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="48dp"
android:textSize="14sp"
android:padding="@dimen/padding_normal"/>
android:gravity="center_vertical"
android:paddingLeft="16dp"
android:layout_gravity="center_vertical"
android:fontFamily="sans-serif-medium"
tools:text="Project"
/>
 
</FrameLayout>
\ No newline at end of file
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