Search in sources :

Example 26 with IconicsDrawable

use of com.mikepenz.iconics.IconicsDrawable in project LeafPic by HoraApps.

the class DonateActivity method setTheme.

private void setTheme() {
    /**** ToolBar *****/
    toolbar.setBackgroundColor(getPrimaryColor());
    setSupportActionBar(toolbar);
    toolbar.setNavigationIcon(new IconicsDrawable(this).icon(CommunityMaterial.Icon.cmd_arrow_left).color(Color.WHITE).sizeDp(19));
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            onBackPressed();
        }
    });
    toolbar.setTitle(getString(org.horaapps.leafpic.R.string.donate));
    setStatusBarColor();
    setNavBarColor();
    setRecentApp(getString(org.horaapps.leafpic.R.string.donate));
    final Button btnDonateIap = (Button) findViewById(R.id.button_donate_play_store);
    btnDonateIap.setText(String.format("%s %d€", getString(R.string.donate).toUpperCase(), progress));
    themeSeekBar(bar);
    bar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

        @Override
        public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
            if (i == 0)
                progress = 2;
            else
                progress = (i + 1) * 2;
            btnDonateIap.setText(String.format("%s %d€", getString(R.string.donate).toUpperCase(), progress));
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    });
    /**** Title Cards ***/
    ((TextView) findViewById(org.horaapps.leafpic.R.id.team_name)).setTextColor(getAccentColor());
    ((TextView) findViewById(org.horaapps.leafpic.R.id.donate_googleplay_item_title)).setTextColor(getAccentColor());
    ((TextView) findViewById(org.horaapps.leafpic.R.id.donate_paypal_item_title)).setTextColor(getAccentColor());
    ((TextView) findViewById(org.horaapps.leafpic.R.id.donate_bitcoin_item_title)).setTextColor(getAccentColor());
    /** BackGround **/
    findViewById(org.horaapps.leafpic.R.id.donate_background).setBackgroundColor(getBackgroundColor());
    /** Cards **/
    int color = getCardBackgroundColor();
    ((CardView) findViewById(org.horaapps.leafpic.R.id.donate_googleplay_card)).setCardBackgroundColor(color);
    ((CardView) findViewById(org.horaapps.leafpic.R.id.donate_paypal_card)).setCardBackgroundColor(color);
    ((CardView) findViewById(org.horaapps.leafpic.R.id.donate_bitcoin_card)).setCardBackgroundColor(color);
    ((CardView) findViewById(org.horaapps.leafpic.R.id.donate_header_card)).setCardBackgroundColor(color);
    /** Icons **/
    color = getIconColor();
    ((IconicsImageView) findViewById(org.horaapps.leafpic.R.id.donate_googleplay_icon_title)).setColor(color);
    ((IconicsImageView) findViewById(org.horaapps.leafpic.R.id.donate_paypal_icon_title)).setColor(color);
    ((IconicsImageView) findViewById(org.horaapps.leafpic.R.id.donate_bitcoin_icon_title)).setColor(color);
    ((IconicsImageView) findViewById(org.horaapps.leafpic.R.id.donate_header_icon)).setColor(color);
    /** TextViews **/
    color = getTextColor();
    ((TextView) findViewById(org.horaapps.leafpic.R.id.donate_googleplay_item)).setTextColor(color);
    ((TextView) findViewById(org.horaapps.leafpic.R.id.donate_paypal_item)).setTextColor(color);
    ((TextView) findViewById(org.horaapps.leafpic.R.id.donate_bitcoin_item)).setTextColor(color);
    ((TextView) findViewById(org.horaapps.leafpic.R.id.donate_header_item)).setTextColor(color);
    /***** ScrolView *****/
    setScrollViewColor(scr);
    /** ACTIONS **/
    findViewById(org.horaapps.leafpic.R.id.button_donate_paypal).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            cts.launchUrl("https://www.paypal.me/HoraApps");
        }
    });
    findViewById(org.horaapps.leafpic.R.id.donate_bitcoin_item).setOnLongClickListener(new View.OnLongClickListener() {

        @Override
        public boolean onLongClick(View v) {
            ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
            ClipData clip = ClipData.newPlainText("Copied to Clipboard", ((TextView) v).getText());
            clipboard.setPrimaryClip(clip);
            StringUtils.showToast(getApplicationContext(), getString(org.horaapps.leafpic.R.string.address_copied));
            return true;
        }
    });
    findViewById(R.id.button_donate_play_store).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            if (mHelper != null)
                mHelper.flagEndAsync();
            mHelper.launchPurchaseFlow(DonateActivity.this, "donation_" + progress, 123, new IabHelper.OnIabPurchaseFinishedListener() {

                @Override
                public void onIabPurchaseFinished(IabResult result, Purchase info) {
                    mHelper.consumeAsync(info, mPurchaseFinishedListener);
                }
            });
        }
    });
}
Also used : ClipboardManager(android.content.ClipboardManager) Purchase(org.horaapps.leafpic.util.inapppurchase.Purchase) SeekBar(android.widget.SeekBar) CardView(android.support.v7.widget.CardView) IabResult(org.horaapps.leafpic.util.inapppurchase.IabResult) CardView(android.support.v7.widget.CardView) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) IconicsImageView(com.mikepenz.iconics.view.IconicsImageView) View(android.view.View) IconicsImageView(com.mikepenz.iconics.view.IconicsImageView) Button(android.widget.Button) TextView(android.widget.TextView) IconicsDrawable(com.mikepenz.iconics.IconicsDrawable) ClipData(android.content.ClipData)

Example 27 with IconicsDrawable

use of com.mikepenz.iconics.IconicsDrawable in project Weather by Sparker0i.

the class LicenseActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_license);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    ButterKnife.bind(this);
    libID = getIntent().getExtras().getInt(Constants.LIBRARY_ID);
    switch(libID) {
        case 1:
            {
                library = getString(R.string.lib_1);
                license = getString(R.string.lib_1_license) + getString(R.string.mit_license);
                link = getString(R.string.lib_1_link);
                break;
            }
        case 2:
            {
                library = getString(R.string.lib_2);
                license = getString(R.string.lib_2_license) + getString(R.string.apache_license);
                link = getString(R.string.lib_2_link);
                break;
            }
        case 3:
            {
                library = getString(R.string.lib_3);
                license = getString(R.string.lib_3_license) + getString(R.string.apache_license);
                link = getString(R.string.lib_3_link);
                break;
            }
        case 4:
            {
                library = getString(R.string.lib_4);
                license = getString(R.string.lib_4_license) + getString(R.string.apache_license);
                link = getString(R.string.lib_4_link);
                break;
            }
        case 5:
            {
                library = getString(R.string.lib_5);
                license = getString(R.string.lib_5_license) + getString(R.string.apache_license);
                link = getString(R.string.lib_5_link);
                break;
            }
        case 6:
            {
                library = getString(R.string.lib_6);
                license = getString(R.string.lib_6_license) + getString(R.string.mit_license);
                link = getString(R.string.lib_6_link);
                break;
            }
        case 7:
            {
                library = getString(R.string.lib_7);
                license = getString(R.string.lib_7_license) + getString(R.string.mit_license);
                link = getString(R.string.lib_7_link);
                break;
            }
        case 8:
            {
                library = getString(R.string.lib_8);
                license = getString(R.string.lib_8_license) + getString(R.string.apache_license);
                link = getString(R.string.lib_8_link);
                break;
            }
        case 9:
            {
                library = getString(R.string.lib_9);
                license = getString(R.string.lib_9_license) + getString(R.string.apache_license);
                link = getString(R.string.lib_9_link);
                break;
            }
        case 10:
            {
                library = getString(R.string.lib_10);
                license = getString(R.string.lib_10_license) + getString(R.string.apache_license);
                link = getString(R.string.lib_10_link);
                break;
            }
        case 11:
            {
                library = getString(R.string.lib_11);
                license = getString(R.string.lib_11_license) + getString(R.string.apache_license);
                link = getString(R.string.lib_11_link);
                break;
            }
    }
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle(library);
    setSupportActionBar(toolbar);
    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }
    fab.setImageDrawable(new IconicsDrawable(this).icon(MaterialDesignIconic.Icon.gmi_github).color(Color.WHITE));
    licText.setText(Html.fromHtml(license));
}
Also used : IconicsDrawable(com.mikepenz.iconics.IconicsDrawable)

Example 28 with IconicsDrawable

use of com.mikepenz.iconics.IconicsDrawable in project Weather by Sparker0i.

the class WeatherActivity method initDrawer.

public void initDrawer() {
    final Context context = this;
    final IProfile profile = new ProfileDrawerItem().withName(getString(R.string.app_name)).withEmail(getString(R.string.drawer_version_header) + " : " + BuildConfig.VERSION_NAME).withIcon(R.mipmap.ic_launcher_x);
    AccountHeader headerResult = new AccountHeaderBuilder().withActivity(this).withHeaderBackground(R.drawable.header).withTextColor(ContextCompat.getColor(this, R.color.md_amber_400)).addProfiles(profile).withSelectionListEnabled(false).withProfileImagesClickable(false).build();
    SecondaryDrawerItem item1 = new SecondaryDrawerItem().withIdentifier(1).withName(R.string.drawer_item_home).withIcon(new IconicsDrawable(this).icon(WeatherIcons.Icon.wic_day_sunny));
    SecondaryDrawerItem item2 = new SecondaryDrawerItem().withIdentifier(2).withName(R.string.drawer_item_graph).withIcon(new IconicsDrawable(this).icon(GoogleMaterial.Icon.gmd_trending_up));
    SecondaryDrawerItem item3 = new SecondaryDrawerItem().withIdentifier(3).withName(R.string.drawer_item_map).withIcon(new IconicsDrawable(this).icon(GoogleMaterial.Icon.gmd_map));
    SecondaryDrawerItem item7 = new SecondaryDrawerItem().withIdentifier(7).withName(R.string.drawer_item_about).withIcon(new IconicsDrawable(this).icon(GoogleMaterial.Icon.gmd_info)).withSelectable(false);
    SecondaryDrawerItem item6 = new SecondaryDrawerItem().withIdentifier(6).withName(getString(R.string.drawer_item_custom_key)).withIcon(new IconicsDrawable(this).icon(GoogleMaterial.Icon.gmd_create)).withSelectable(false);
    SecondarySwitchDrawerItem item4 = new SecondarySwitchDrawerItem().withIdentifier(4).withName(getString(R.string.drawer_item_fahrenheit)).withChecked(preferences.getUnits().equals(Constants.IMPERIAL)).withIcon(new IconicsDrawable(this).icon(WeatherIcons.Icon.wic_fahrenheit)).withSelectable(false);
    SecondarySwitchDrawerItem item5 = new SecondarySwitchDrawerItem().withIdentifier(5).withName(getString(R.string.drawer_item_notifications)).withChecked(preferences.getNotifs()).withIcon(new IconicsDrawable(this).icon(GoogleMaterial.Icon.gmd_notifications)).withSelectable(false);
    item4.withOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(IDrawerItem drawerItem, CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                preferences.setUnits(Constants.IMPERIAL);
            } else {
                preferences.setUnits(Constants.METRIC);
            }
            Fragment f = getSupportFragmentManager().findFragmentById(R.id.fragment);
            if (f instanceof WeatherFragment) {
                wf = new WeatherFragment();
                getSupportFragmentManager().beginTransaction().replace(R.id.fragment, wf).commit();
                drawer.closeDrawer();
            }
        }
    });
    item5.withOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(IDrawerItem drawerItem, CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                preferences.setNotifs(true);
                startService(new Intent(context, AlarmTriggerService.class));
            } else {
                preferences.setNotifs(false);
                stopService(new Intent(context, AlarmTriggerService.class));
                mManager.cancelAll();
            }
        }
    });
    drawer = new DrawerBuilder().withActivity(this).withToolbar(toolbar).withSelectedItem(1).withTranslucentStatusBar(true).withAccountHeader(headerResult).withActionBarDrawerToggleAnimated(true).addDrawerItems(item1, item2, item3, new DividerDrawerItem(), item4, item5, new DividerDrawerItem(), item6, item7).withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {

        @Override
        public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
            // do something with the clicked item :D
            if (drawerItem != null) {
                switch((int) drawerItem.getIdentifier()) {
                    case 1:
                        Fragment f = getSupportFragmentManager().findFragmentById(R.id.fragment);
                        if (!(f instanceof WeatherFragment)) {
                            wf = new WeatherFragment();
                            getSupportFragmentManager().beginTransaction().replace(R.id.fragment, wf).commit();
                        }
                        break;
                    case 2:
                        f = getSupportFragmentManager().findFragmentById(R.id.fragment);
                        if (!(f instanceof GraphsFragment)) {
                            GraphsFragment graphsFragment = newGraphInstance(new ArrayList<>(wf.getDailyJson()));
                            getSupportFragmentManager().beginTransaction().replace(R.id.fragment, graphsFragment).commit();
                        }
                        break;
                    case 3:
                        f = getSupportFragmentManager().findFragmentById(R.id.fragment);
                        if (!(f instanceof MapsFragment)) {
                            MapsFragment mapsFragment = new MapsFragment();
                            getSupportFragmentManager().beginTransaction().replace(R.id.fragment, mapsFragment).commit();
                        }
                        break;
                    case 6:
                        showApiKeyBox();
                        break;
                    case 7:
                        startActivity(new Intent(WeatherActivity.this, AboutActivity.class));
                        break;
                }
            }
            return false;
        }
    }).build();
}
Also used : IDrawerItem(com.mikepenz.materialdrawer.model.interfaces.IDrawerItem) DividerDrawerItem(com.mikepenz.materialdrawer.model.DividerDrawerItem) ProfileDrawerItem(com.mikepenz.materialdrawer.model.ProfileDrawerItem) ArrayList(java.util.ArrayList) AccountHeaderBuilder(com.mikepenz.materialdrawer.AccountHeaderBuilder) WeatherFragment(com.a5corp.weather.fragment.WeatherFragment) SecondaryDrawerItem(com.mikepenz.materialdrawer.model.SecondaryDrawerItem) GraphsFragment(com.a5corp.weather.fragment.GraphsFragment) Fragment(android.support.v4.app.Fragment) MapsFragment(com.a5corp.weather.fragment.MapsFragment) WeatherFragment(com.a5corp.weather.fragment.WeatherFragment) AccountHeader(com.mikepenz.materialdrawer.AccountHeader) MapsFragment(com.a5corp.weather.fragment.MapsFragment) IProfile(com.mikepenz.materialdrawer.model.interfaces.IProfile) IconicsDrawable(com.mikepenz.iconics.IconicsDrawable) Context(android.content.Context) OnCheckedChangeListener(com.mikepenz.materialdrawer.interfaces.OnCheckedChangeListener) Intent(android.content.Intent) Drawer(com.mikepenz.materialdrawer.Drawer) BindView(butterknife.BindView) View(android.view.View) SecondarySwitchDrawerItem(com.mikepenz.materialdrawer.model.SecondarySwitchDrawerItem) DrawerBuilder(com.mikepenz.materialdrawer.DrawerBuilder) CompoundButton(android.widget.CompoundButton) GraphsFragment(com.a5corp.weather.fragment.GraphsFragment)

Aggregations

IconicsDrawable (com.mikepenz.iconics.IconicsDrawable)28 View (android.view.View)13 MenuInflater (android.view.MenuInflater)9 Toolbar (android.support.v7.widget.Toolbar)7 SearchView (android.support.v7.widget.SearchView)6 DrawerBuilder (com.mikepenz.materialdrawer.DrawerBuilder)6 SecondaryDrawerItem (com.mikepenz.materialdrawer.model.SecondaryDrawerItem)6 ImageView (android.widget.ImageView)5 TextView (android.widget.TextView)5 ProfileDrawerItem (com.mikepenz.materialdrawer.model.ProfileDrawerItem)5 Context (android.content.Context)4 Intent (android.content.Intent)4 RecyclerView (android.support.v7.widget.RecyclerView)4 AccountHeaderBuilder (com.mikepenz.materialdrawer.AccountHeaderBuilder)4 Drawer (com.mikepenz.materialdrawer.Drawer)4 PrimaryDrawerItem (com.mikepenz.materialdrawer.model.PrimaryDrawerItem)4 SectionDrawerItem (com.mikepenz.materialdrawer.model.SectionDrawerItem)4 IDrawerItem (com.mikepenz.materialdrawer.model.interfaces.IDrawerItem)4 IProfile (com.mikepenz.materialdrawer.model.interfaces.IProfile)4 Drawable (android.graphics.drawable.Drawable)3