Skip to content

Commit

Permalink
version 2.0.0
Browse files Browse the repository at this point in the history
- update libs
- compile sdk = 26
- refactor project
  • Loading branch information
raphaelbussa committed Aug 22, 2017
1 parent 74c4f86 commit bee0f58
Show file tree
Hide file tree
Showing 78 changed files with 179 additions and 78 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
/gradlew.bat
/local.properties

/app/build
/sample/build
/library/build
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Join the chat at https://gitter.im/rebus007/HeaderView](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/rebus007/HeaderView?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[ ![Download](https://api.bintray.com/packages/raphaelbussa/maven/header-view/images/download.svg) ](https://bintray.com/raphaelbussa/maven/header-view/_latestVersion) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Header--View-brightgreen.svg?style=flat)](http://android-arsenal.com/details/1/2123)

![Logo](https://raw.githubusercontent.com/rebus007/HeaderView/master/img/web_hi_res_512.png)
![Logo](https://raw.githubusercontent.com/rebus007/HeaderView/master/img/ic_launcher-web.png)

This is a view for NavigationView in android.support.design library

Expand All @@ -18,7 +18,7 @@ repositories {
```
```Gradle
dependencies {
compile 'rebus:header-view:2.0.0-BETA-6'
compile 'rebus:header-view:2.0.0'
}
```
### How to use
Expand Down
Binary file removed app/src/main/res/mipmap-hdpi/ic_launcher.png
Binary file not shown.
Binary file removed app/src/main/res/mipmap-hdpi/ic_launcher_round.png
Binary file not shown.
Binary file removed app/src/main/res/mipmap-mdpi/ic_launcher.png
Binary file not shown.
Binary file removed app/src/main/res/mipmap-mdpi/ic_launcher_round.png
Binary file not shown.
Binary file removed app/src/main/res/mipmap-xhdpi/ic_launcher.png
Binary file not shown.
Binary file removed app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Binary file not shown.
Binary file removed app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Binary file not shown.
Binary file removed app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Binary file not shown.
Binary file removed app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Binary file not shown.
Binary file not shown.
5 changes: 0 additions & 5 deletions app/src/main/res/values/strings.xml

This file was deleted.

17 changes: 9 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,28 @@ buildscript {

ext {
var = [
compileSdk: 25,
buildTools: "25.0.3",
minSdk : 11,
targetSdk : 25,
version : "2.0.0-BETA-6",
supportLib: "25.3.1"
compileSdk: 26,
buildTools: "26.0.1",
minSdk : 14,
targetSdk : 26,
version : "2.0.0",
supportLib: "26.0.1"
]
}

repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
classpath 'com.novoda:bintray-release:0.4.0'
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.novoda:bintray-release:0.5.0'
}
}

allprojects {
repositories {
jcenter()
maven { url "https://maven.google.com" }
}
}

Expand Down
Binary file added img/ic_launcher-web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed img/web_hi_res_512.png
Binary file not shown.
4 changes: 4 additions & 0 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ android {
}
}

lintOptions {
abortOnError false
}

}

dependencies {
Expand Down
16 changes: 8 additions & 8 deletions library/src/main/java/rebus/header/view/HeaderView.java
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,14 @@ public boolean onAdd() {
return headerCallback.onAdd();
}

@SuppressWarnings("unused")
public void setTypeface(Typeface tf) {
typeface = tf;
username.setTypeface(tf);
email.setTypeface(tf);
invalidate();
}

@RestrictTo(LIBRARY_GROUP)
@IntDef({STYLE_NORMAL, STYLE_COMPACT})
@IntRange(from = 1, to = 2)
Expand All @@ -848,12 +856,4 @@ public boolean onAdd() {
public @interface Theme {
}

@SuppressWarnings("unused")
public void setTypeface(Typeface tf) {
typeface = tf;
username.setTypeface(tf);
email.setTypeface(tf);
invalidate();
}

}
4 changes: 4 additions & 0 deletions app/build.gradle → sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

lintOptions {
abortOnError false
}
}

dependencies {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added sample/src/main/ic_launcher-web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@

import com.bumptech.glide.Glide;

import rebus.header.view.HeaderView;
import rebus.header.view.ImageLoader;
import uk.co.chrisjenx.calligraphy.CalligraphyConfig;

/**
* Created by raphaelbussa on 13/01/17.
Expand Down Expand Up @@ -67,11 +65,11 @@ public void loadImage(Uri url, ImageView imageView, @ImageLoader.Type int type)
}

});
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
/*CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
.setDefaultFontPath("Oswald-Stencbab.ttf")
.setFontAttrId(R.attr.fontPath)
.addCustomViewWithSetTypeface(HeaderView.class)
.build()
);
);*/
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,23 @@
package rebus.header.view.sample;

import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.support.design.widget.NavigationView;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.text.Html;
import android.text.Spanned;
import android.text.method.LinkMovementMethod;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import rebus.header.view.HeaderCallback;
Expand All @@ -43,7 +50,7 @@
import rebus.header.view.Profile;
import uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper;

public class MainActivity extends AppCompatActivity {
public class MainActivity extends AppCompatActivity implements Toolbar.OnMenuItemClickListener {

private static final String TAG = MainActivity.class.getName();

Expand All @@ -57,11 +64,13 @@ public class MainActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar = findViewById(R.id.toolbar);
toolbar.setTitle(getString(R.string.app_name));
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
navigationView = (NavigationView) findViewById(R.id.nav_view);
headerView = (HeaderView) navigationView.getHeaderView(0).findViewById(R.id.header_view);
toolbar.inflateMenu(R.menu.menu_main);
toolbar.setOnMenuItemClickListener(this);
drawerLayout = findViewById(R.id.drawer_layout);
navigationView = findViewById(R.id.nav_view);
headerView = navigationView.getHeaderView(0).findViewById(R.id.header_view);
actionBarDrawerToggle = new ActionBarDrawerToggle(MainActivity.this, drawerLayout, toolbar, R.string.app_name, R.string.app_name);
drawerLayout.post(new Runnable() {
@Override
Expand Down Expand Up @@ -176,9 +185,49 @@ public boolean onAdd() {

}

@Override
public void onBackPressed() {
if (drawerLayout != null && drawerLayout.isDrawerOpen(GravityCompat.START)) {
drawerLayout.closeDrawer(GravityCompat.START);
return;
}
super.onBackPressed();
}

@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
}

@SuppressWarnings("deprecation")
private Spanned fromHtml(String value) {
if (value == null) {
value = "";
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
return Html.fromHtml(value, Html.FROM_HTML_MODE_LEGACY);
} else {
return Html.fromHtml(value);
}
}

@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_info:
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setTitle(getString(R.string.action_info));
builder.setMessage(fromHtml(getString(R.string.info_message)));
builder.setPositiveButton(getString(R.string.close), null);
AlertDialog dialog = builder.create();
dialog.show();
TextView textView = dialog.findViewById(android.R.id.message);
if (textView != null) {
textView.setMovementMethod(LinkMovementMethod.getInstance());
}
return true;
default:
return false;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,21 @@
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/toolbar"
android:gravity="center"
android:orientation="vertical">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/open_drawer" />

</LinearLayout>

</RelativeLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
app:hv_style="normal"
app:hv_theme="light" />

<!--
app:hv_add_icon="@drawable/ic_action_settings"
app:hv_profile_avatar="@drawable/ic_avatar_batman"
app:hv_profile_background="@drawable/ic_bg_batman"
app:hv_profile_email="[email protected]"
app:hv_profile_username="Bruce Wayne"
-->
<!--
app:hv_add_icon="@drawable/ic_action_settings"
app:hv_profile_avatar="@drawable/ic_avatar_batman"
app:hv_profile_background="@drawable/ic_bg_batman"
app:hv_profile_email="[email protected]"
app:hv_profile_username="Bruce Wayne"
-->
Original file line number Diff line number Diff line change
Expand Up @@ -24,41 +24,23 @@

<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group android:checkableBehavior="single">
<item
android:title="@string/nav_settings" />
<item
android:title="@string/nav_settings" />
<item
android:title="@string/nav_settings" />
<item
android:title="@string/nav_settings" />
<item
android:title="@string/nav_settings" />
<item
android:title="@string/nav_settings" />
<item
android:title="@string/nav_settings" />
<item
android:title="@string/nav_settings" />
<item
android:title="@string/nav_settings" />
<item
android:title="@string/nav_settings" />
<item
android:title="@string/nav_settings" />
<item
android:title="@string/nav_settings" />
<item
android:title="@string/nav_settings" />
<item
android:title="@string/nav_settings" />
<item
android:title="@string/nav_settings" />
<item
android:title="@string/nav_settings" />
<item
android:title="@string/nav_settings" />
<item
android:title="@string/nav_settings" />
<item android:title="@string/nav_settings" />
<item android:title="@string/nav_settings" />
<item android:title="@string/nav_settings" />
<item android:title="@string/nav_settings" />
<item android:title="@string/nav_settings" />
<item android:title="@string/nav_settings" />
<item android:title="@string/nav_settings" />
<item android:title="@string/nav_settings" />
<item android:title="@string/nav_settings" />
<item android:title="@string/nav_settings" />
<item android:title="@string/nav_settings" />
<item android:title="@string/nav_settings" />
<item android:title="@string/nav_settings" />
<item android:title="@string/nav_settings" />
<item android:title="@string/nav_settings" />
<item android:title="@string/nav_settings" />
<item android:title="@string/nav_settings" />
<item android:title="@string/nav_settings" />
</group>
</menu>
31 changes: 31 additions & 0 deletions sample/src/main/res/menu/menu_main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ The MIT License (MIT)
~
~ Copyright (c) 2017 Raphaël Bussa
~
~ Permission is hereby granted, free of charge, to any person obtaining a copy
~ of this software and associated documentation files (the "Software"), to deal
~ in the Software without restriction, including without limitation the rights
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
~ copies of the Software, and to permit persons to whom the Software is
~ furnished to do so, subject to the following conditions:
~
~ The above copyright notice and this permission notice shall be included in all
~ copies or substantial portions of the Software.
~
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
~ SOFTWARE.
-->

<menu xmlns:android="http://schemas.android.com/apk/res/android">

<item
android:id="@+id/action_info"
android:title="@string/action_info" />

</menu>
5 changes: 5 additions & 0 deletions sample/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background" />
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
</adaptive-icon>
5 changes: 5 additions & 0 deletions sample/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background" />
<foreground android:drawable="@mipmap/ic_launcher_foreground" />
</adaptive-icon>
Binary file added sample/src/main/res/mipmap-hdpi/ic_launcher.png
Binary file added sample/src/main/res/mipmap-mdpi/ic_launcher.png
Binary file added sample/src/main/res/mipmap-xhdpi/ic_launcher.png
Binary file added sample/src/main/res/mipmap-xxhdpi/ic_launcher.png
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit bee0f58

Please sign in to comment.