[go: up one dir, main page]

Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
viniciusthiengo committed Mar 26, 2017
1 parent 9930d76 commit 074cc21
Show file tree
Hide file tree
Showing 30 changed files with 91 additions and 59 deletions.
Binary file modified .gradle/3.3/taskArtifacts/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/3.3/taskArtifacts/fileSnapshots.bin
Binary file not shown.
Binary file modified .gradle/3.3/taskArtifacts/taskArtifacts.bin
Binary file not shown.
Binary file modified .gradle/3.3/taskArtifacts/taskArtifacts.lock
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
14 changes: 7 additions & 7 deletions app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,20 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
Expand Down
Binary file modified app/src/main/assets/AmaticSC.ttf
Binary file not shown.
Binary file modified app/src/main/assets/FascinateInline.ttf
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.squareup.picasso.Picasso;

import br.com.thiengo.cinemalocalapp.domain.Filme;
import br.com.thiengo.cinemalocalapp.util.Font;

public class DetalhesActivity extends AppCompatActivity {

Expand All @@ -30,8 +31,8 @@ protected void onCreate(Bundle savedInstanceState) {

CollapsingToolbarLayout collapsing = (CollapsingToolbarLayout) findViewById(R.id.toolbar_layout) ;
collapsing.setTitle( filme.getNome() );
//collapsing.setCollapsedTitleTypeface( Font.getFascinateInline(this) );
//collapsing.setExpandedTitleTypeface( Font.getFascinateInline(this) );
collapsing.setCollapsedTitleTypeface( Font.getFascinateInline(this) );
collapsing.setExpandedTitleTypeface( Font.getFascinateInline(this) );

ImageView ivHeader = (ImageView) findViewById(R.id.iv_header);
Picasso
Expand All @@ -41,7 +42,7 @@ protected void onCreate(Bundle savedInstanceState) {

TextView tvSinopse = (TextView) findViewById(R.id.tv_sinopse);
tvSinopse.setText( filme.getSinopse() );
//Font.setAmaticSC( tvSinopse );
Font.setAmaticSC( tvSinopse );
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ private ViewHolder(View itemView) {
ivFilme = (ImageView) itemView.findViewById(R.id.iv_filme);
tvNome = (TextView) itemView.findViewById(R.id.tv_nome);
tvQtdSalas = (TextView) itemView.findViewById(R.id.tv_qtd_salas);
Font.setFascinateInline( tvNome );
Font.setAmaticSC( tvQtdSalas );
Font.setFascinateInline( tvNome );

itemView.setOnClickListener(this);
}
Expand Down
62 changes: 38 additions & 24 deletions app/src/main/java/br/com/thiengo/cinemalocalapp/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package br.com.thiengo.cinemalocalapp;


import android.graphics.Typeface;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.internal.NavigationMenuView;
Expand All @@ -13,13 +14,20 @@
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.text.Spannable;
import android.text.SpannableString;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import br.com.thiengo.cinemalocalapp.data.Mock;
import br.com.thiengo.cinemalocalapp.util.CustomTypefaceSpan;
import br.com.thiengo.cinemalocalapp.util.Font;

public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {

private Toolbar toolbar;

Expand All @@ -30,7 +38,7 @@ protected void onCreate(Bundle savedInstanceState) {

toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
//applyToolbarCustomFont();
applyToolbarCustomFont();

DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
Expand All @@ -42,13 +50,13 @@ protected void onCreate(Bundle savedInstanceState) {
navigationView.setNavigationItemSelectedListener(this);
NavigationMenuView navMenuView = (NavigationMenuView) navigationView.getChildAt(0);
navMenuView.addItemDecoration(new DividerItemDecoration( MainActivity.this,DividerItemDecoration.VERTICAL) );
//customFontNavigationView();
customFontNavigationViewMenu();

initRecycler();

LinearLayout ll = (LinearLayout) navigationView.getHeaderView(0);
TextView tvNavHeaderTitle = (TextView) ll.getChildAt(0);
//Font.setFascinateInline( tvNavHeaderTitle );
Font.setFascinateInline( tvNavHeaderTitle );
}

private void initRecycler(){
Expand Down Expand Up @@ -79,7 +87,7 @@ public void onBackPressed() {
}
}

/*public void applyToolbarCustomFont(){
public void applyToolbarCustomFont(){
for(int i = 0; i < toolbar.getChildCount(); i++){
View view = toolbar.getChildAt(i);
if(view instanceof TextView){
Expand All @@ -93,29 +101,35 @@ public void onBackPressed() {
}
}

private void customFontNavigationView(){
NavigationView navView = (NavigationView) findViewById(R.id.nav_view);
Menu m = navView.getMenu();
for (int i=0;i<m.size();i++) {
MenuItem mi = m.getItem(i);
private void customFontNavigationViewMenu(){
NavigationView navView = (NavigationView) findViewById( R.id.nav_view );
Menu menu = navView.getMenu();

//for aapplying a font to subMenu ...
SubMenu subMenu = mi.getSubMenu();
if (subMenu!=null && subMenu.size() >0 ) {
for (int j=0; j <subMenu.size();j++) {
for( int i = 0; i < menu.size(); i++ ) {
MenuItem menuItem = menu.getItem(i);

/*SubMenu subMenu = menuItem.getSubMenu();
if( subMenu != null && subMenu.size() > 0 ) {
for( int j = 0; j < subMenu.size(); j++ ) {
MenuItem subMenuItem = subMenu.getItem(j);
applyFontToMenuItem(subMenuItem);
setCustomFontMenuItem(subMenuItem);
}
}
//the method we have create in activity
applyFontToMenuItem(mi);
}*/

setCustomFontMenuItem( menuItem );
}
}

private void applyFontToMenuItem(MenuItem mi) {
Typeface font = Typeface.createFromAsset(getAssets(), "AmaticSC.ttf");
SpannableString mNewTitle = new SpannableString(mi.getTitle());
mNewTitle.setSpan(new CustomTypefaceSpan("" , font), 0 , mNewTitle.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
mi.setTitle(mNewTitle);
}*/
private void setCustomFontMenuItem(MenuItem menuItem) {
Typeface font = Font.getAmaticSC( this );
SpannableString textItem = new SpannableString( menuItem.getTitle() );

textItem.setSpan(
new CustomTypefaceSpan("" , font),
0,
textItem.length(),
Spannable.SPAN_INCLUSIVE_INCLUSIVE );

menuItem.setTitle(textItem);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,57 @@

public class CustomTypefaceSpan extends TypefaceSpan {

private final Typeface newType;
private final Typeface newTypeFace;

public CustomTypefaceSpan(String family, Typeface type) {
public CustomTypefaceSpan( String family, Typeface type ) {
super(family);
newType = type;
newTypeFace = type;
}

@Override
public void updateDrawState(TextPaint ds) {
applyCustomTypeFace(ds, newType);
public void updateDrawState( TextPaint paint ) {
paint.setTypeface( newTypeFace );
//applyCustomTypeFace( textPaint, newTypeFace );
}

@Override
public void updateMeasureState(TextPaint paint) {
applyCustomTypeFace(paint, newType);
paint.setTypeface( newTypeFace );
//applyCustomTypeFace( paint, newTypeFace );
}

private static void applyCustomTypeFace(Paint paint, Typeface tf) {
int oldStyle;
Typeface old = paint.getTypeface();
if (old == null) {
oldStyle = 0;
private static void applyCustomTypeFace(Paint paint, Typeface typeface) {
int styleAnterior;
Typeface typefaceAnterior = paint.getTypeface();

if( typefaceAnterior == null ) {
styleAnterior = 0;
} else {
oldStyle = old.getStyle();
styleAnterior = typefaceAnterior.getStyle();
}

int fake = oldStyle & ~tf.getStyle();
if ((fake & Typeface.BOLD) != 0) {
// PARA VERIFICAR A COMPATIBILIDADE DE ESTILOS
int fake = styleAnterior & ~typeface.getStyle();

/*
* VERIFICA SE A FONTE MAIS ATUAL JÁ ESTÁ DE ACORDO
* COM A ANTERIOR EM TERMOS DE "TEXTO EM NEGRITO",
* CASO NÃO, ATUALIZA.
* */
if ( (fake & Typeface.BOLD) != 0 ) {
paint.setFakeBoldText(true);
}

if ((fake & Typeface.ITALIC) != 0) {
/*
* VERIFICA SE A FONTE MAIS ATUAL JÁ ESTÁ DE ACORDO
* COM A ANTERIOR EM TERMOS DE "TEXTO EM ITÁLICO",
* CASO NÃO, ATUALIZA.
* */
if ( (fake & Typeface.ITALIC) != 0 ) {
paint.setTextSkewX(-0.25f);
}

paint.setTypeface(tf);
// APLICA A FONTE
paint.setTypeface( typeface );
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,8 @@ public static void setAmaticSC(TextView tv){
Typeface face = Typeface.createFromAsset( tv.getContext().getAssets(), "AmaticSC.ttf");
tv.setTypeface( face );
}

public static Typeface getAmaticSC(Context context){
return Typeface.createFromAsset( context.getAssets(), "AmaticSC.ttf");
}
}
6 changes: 2 additions & 4 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
app:headerLayout="@layout/nav_header_main"
app:itemIconTint="@android:color/white"
app:itemTextColor="@android:color/white"
app:menu="@menu/activity_main_drawer" />

<!-- app:theme="@style/AppTheme.NavigationItem" -->

app:menu="@menu/activity_main_drawer"
app:theme="@style/AppTheme.NavigationItem"/>
</android.support.v4.widget.DrawerLayout>
4 changes: 2 additions & 2 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

<!-- style name="AppTheme.NavigationItem">
<style name="AppTheme.NavigationItem">
<item name="android:textSize">20sp</item>
</style -->
</style>
</resources>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion build/intermediates/dex-cache/cache.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
jumboMode="true"
optimize="true"
revision="25.0.0"
sha1="3e9f88bac411b00b63c04084e5547d435c111b71">
sha1="c4018decefb834643a7102f25670a7dd1287f1df">
<dex dex="/Users/viniciusthiengo/Desktop/CinemaLocalApp/app/build/intermediates/transforms/dex/debug/folders/1000/10000/instant-run-bootstrap_f17137b9fd92b4f3078136059be57a916c50b905/classes.dex" />
</item>
<item
Expand Down

0 comments on commit 074cc21

Please sign in to comment.