mikepenz / Android-Iconics

Android-Iconics - Use any icon font, or vector (.svg) as drawable in your application.
https://mikepenz.dev
Apache License 2.0
5.18k stars 617 forks source link

strange problem #133

Closed sytolk closed 8 years ago

sytolk commented 8 years ago

I have try to switch from Iconify (XML icons is missing) but in this library Icons not displayed in API16 this is the screenshot with emulator API 23 icons displayed but:

  1. the black icon in the menu with app:showAsAction="always" is created prorgammatically in onCreateOptionsMenu:
@EActivity(R.layout.main)
public class MainActivity extends AppCompatActivity{

@Override
protected void onCreate(Bundle savedInstanceState) {
        LayoutInflaterCompat.setFactory(getLayoutInflater(), new IconicsLayoutInflater(getDelegate()));
        super.onCreate(savedInstanceState);
}

public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.main_menu, menu);
        menu.findItem(R.id.options_server).setIcon(new IconicsDrawable(this, GoogleMaterial.Icon.gmd_3d_rotation).actionBar().color(Color.BLACK));
                //.setIcon(R.drawable.icon); - this works
        return super.onCreateOptionsMenu(menu);
    }
}

The icon is gmd_3d_rotation but it is displayed unknown icon. Only the color is the same BLACK.

2.The button and red icon is automatically created in XML. The color is the same but the icon is gmd-speaker but its appear the same icon like the black one..

<Button
        android:layout_width="160dp"
        android:layout_height="60dp"
        android:text="{gmd-ac-unit} Button"
        android:textAllCaps="false"
        android:layout_gravity="center|start"/>

    <ImageView
        android:layout_width="48dp"
        android:layout_height="48dp"
        app:ico_color="@color/red_color"
        app:ico_contour_color="@color/yellow_color"
        app:ico_contour_width="1dp"
        app:ico_icon="gmd-speaker"
        app:ico_padding="12dp"
        app:ico_size="48dp"
        android:layout_gravity="center|end"/>

    <com.getbase.floatingactionbutton.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        fab:fab_icon="@drawable/travel59"
        fab:fab_colorNormal="@color/yellow_color"
        fab:fab_colorPressed="@color/white_color"
        fab:fab_size="normal"
        android:layout_gravity="bottom|end"
        android:layout_margin="@dimen/fab_margin"/>
</android.support.design.widget.CoordinatorLayout>

I have use AA (androidannotations) too.

device-2016-01-28-161344

I have try example application and it works in the same emulators but don`t have any idea why Iconics not displayed in my application its have not exceptions.

mikepenz commented 8 years ago

what are your dependencies? do you have a custom applicationId set? do you use proguard? Do you have any log output?

sytolk commented 8 years ago

this is my dependencies

<dependency>
            <groupId>android</groupId>
            <artifactId>android</artifactId>
            <version>6.0_r2</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.google.android.gms</groupId>
            <artifactId>play-services-location</artifactId>
            <version>${play-service-version}</version>
            <type>aar</type>
            <exclusions>
                <exclusion>
                    <groupId>com.google.android.gms</groupId>
                    <artifactId>play-services-base</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.google.android.gms</groupId>
                    <artifactId>play-services-maps</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>com.google.android.gms</groupId>
            <artifactId>play-services-base</artifactId>
            <version>${play-service-version}</version>
            <type>aar</type>
            <exclusions>
                <exclusion>
                    <groupId>com.android.support</groupId>
                    <artifactId>support-v4</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>com.google.android.gms</groupId>
            <artifactId>play-services-gcm</artifactId>
            <version>${play-service-version}</version>
            <type>aar</type>
        </dependency>

        <dependency>
            <groupId>com.google.android.gms</groupId>
            <artifactId>play-services-plus</artifactId>
            <version>${play-service-version}</version>
            <type>aar</type>
        </dependency>

        <dependency>
            <groupId>com.android.support</groupId>
            <artifactId>appcompat-v7</artifactId>
            <version>23.1.1</version>
            <type>aar</type>
        </dependency>

        <dependency>
            <groupId>com.android.support</groupId>
            <artifactId>design</artifactId>
            <version>23.1.1</version>
            <type>aar</type>
        </dependency>

        <dependency>
            <groupId>pl.charmas.android</groupId>
            <artifactId>android-reactive-location</artifactId>
            <version>0.8</version>
            <type>aar</type>
            <exclusions>
                <exclusion>
                    <groupId>com.google.android.gms</groupId>
                    <artifactId>play-services-location</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>com.taxi-bulgaria.map</groupId>
            <artifactId>mapsforge</artifactId>
            <type>aar</type>
            <version>0.6.0</version>
            <exclusions>
                <exclusion>
                    <groupId>android.support</groupId>
                    <artifactId>compatibility-v4</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>com.mobsandgeeks</groupId>
            <artifactId>android-saripaar</artifactId>
            <version>1.0.7-SNAPSHOT</version>
        </dependency>

        <dependency>
            <groupId>org.androidannotations</groupId>
            <artifactId>androidannotations</artifactId>
            <version>3.3.2</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.androidannotations</groupId>
            <artifactId>androidannotations-api</artifactId>
            <version>3.3.2</version>
        </dependency>

        <dependency>
            <groupId>ch.acra</groupId>
            <artifactId>acra</artifactId>
            <version>4.7.0</version>
            <type>aar</type>
        </dependency>

        <dependency>
            <groupId>de.greenrobot</groupId>
            <artifactId>eventbus</artifactId>
            <version>2.4.1</version>
        </dependency>

        <dependency>
            <groupId>com.getbase</groupId>
            <artifactId>floatingactionbutton</artifactId>
            <version>1.10.1</version>
            <type>aar</type>
        </dependency>

        <dependency>
            <groupId>com.facebook.android</groupId>
            <artifactId>facebook-android-sdk</artifactId>
            <version>4.5.0</version>
            <type>aar</type>
            <exclusions>
                <exclusion>
                    <groupId>com.android.support</groupId>
                    <artifactId>support-v4</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.android.support</groupId>
                    <artifactId>multidex</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>com.github.nicolasjafelle</groupId>
            <artifactId>paginglistview</artifactId>
            <version>1.3</version>
            <type>aar</type>
        </dependency>

        <dependency>
            <groupId>it.sephiroth.android.library.targettooltip</groupId>
            <artifactId>target-tooltip-library</artifactId>
            <version>1.3.11</version>
            <type>aar</type>
            <exclusions>
                <exclusion>
                    <groupId>com.android.support</groupId>
                    <artifactId>appcompat-v7</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>com.mikepenz</groupId>
            <artifactId>iconics-core</artifactId>
            <version>2.5.5</version>
            <type>aar</type>
            <exclusions>
                <exclusion>
                    <groupId>com.android.support</groupId>
                    <artifactId>appcompat-v7</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>com.mikepenz</groupId>
            <artifactId>google-material-typeface</artifactId>
            <!--<artifactId>material-design-iconic-typeface</artifactId>-->
            <version>2.2.0.1</version>
            <type>aar</type>
            <exclusions>
                <exclusion>
                    <groupId>Android-Iconics</groupId>
                    <artifactId>library-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

I dont have applicationId only package name in my manifest. I have in my proguard.cnf

# Iconics Exclude R from ProGuard to enable the font addon auto detection
-keep class .R
-keep class **.R$* {
    <fields>;
}
-keep class com.mikepenz.google_material_typeface_library.GoogleMaterial { *; }

In log its have only: 01-28 18:38:51.593 27825-27825/com.opentaxi.android I/AppCompatDelegate﹕ The Activity's LayoutInflater already has a Factory installed so we can not install AppCompat's 01-28 18:38:51.593 27825-27825/com.opentaxi.android E/Iconics﹕ Wrong icon name: gmd_ac_unit

sytolk commented 8 years ago

Actually I cant run my application without proguard its have many methods: Error:Android Dex: [TaxiAndroidOpen] com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536

maybe this is proguard issue..

mikepenz commented 8 years ago

@sytolk if it can not automatically detect the font, just register it before first usage (or within the Application)

https://github.com/mikepenz/Android-Iconics/blob/develop/app/src/main/java/com/mikepenz/iconics/sample/CustomApplication.java#L17

So it will be Iconics.registerFont(new GoogleMaterial())

sytolk commented 8 years ago

I have add it but its not change anything

sytolk commented 8 years ago

The problem is in my maven project it not copy assets if I copy fonts/material.design.ttf in my project assets dir and icons appears.. only Button dont have icon in text

<Button
        android:layout_width="160dp"
        android:layout_height="60dp"
        android:text="{gmd-ac-unit} Button"
        android:textAllCaps="false"
        android:layout_gravity="center|start"/>

but it not exist in GoogleMaterial.java and in log its have: Wrong icon name: gmd_ac_unit

The question is why in the same maven project .ttf font in assets dir is included with Iconify lib but in Iconics not ??

mikepenz commented 8 years ago

@sytolk I do not know sorry. As i use the gradle build system from Android I can only can support and test the official one.

As of your pom.xml you use the wrong dependency. The correct one for the GoogleMaterial font is the following:

compile 'com.mikepenz:google-material-typeface:2.1.0.1.original@aar'