Search in sources :

Example 6 with IconicsImageView

use of com.mikepenz.iconics.view.IconicsImageView in project LeafPic by HoraApps.

the class SettingsActivity method baseThemeDialog.

private void baseThemeDialog() {
    final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(SettingsActivity.this, getDialogStyle());
    final View dialogLayout = getLayoutInflater().inflate(R.layout.dialog_basic_theme, null);
    final TextView dialogTitle = (TextView) dialogLayout.findViewById(R.id.basic_theme_title);
    final CardView dialogCardView = (CardView) dialogLayout.findViewById(R.id.basic_theme_card);
    final IconicsImageView whiteSelect = (IconicsImageView) dialogLayout.findViewById(R.id.white_basic_theme_select);
    final IconicsImageView darkSelect = (IconicsImageView) dialogLayout.findViewById(R.id.dark_basic_theme_select);
    final IconicsImageView darkAmoledSelect = (IconicsImageView) dialogLayout.findViewById(R.id.dark_amoled_basic_theme_select);
    switch(getBaseTheme()) {
        case LIGHT_THEME:
            whiteSelect.setVisibility(View.VISIBLE);
            darkSelect.setVisibility(View.GONE);
            darkAmoledSelect.setVisibility(View.GONE);
            break;
        case DARK_THEME:
            whiteSelect.setVisibility(View.GONE);
            darkSelect.setVisibility(View.VISIBLE);
            darkAmoledSelect.setVisibility(View.GONE);
            break;
        case AMOLED_THEME:
            whiteSelect.setVisibility(View.GONE);
            darkSelect.setVisibility(View.GONE);
            darkAmoledSelect.setVisibility(View.VISIBLE);
            break;
    }
    /** SET OBJ THEME **/
    dialogTitle.setBackgroundColor(getPrimaryColor());
    dialogCardView.setCardBackgroundColor(getCardBackgroundColor());
    dialogLayout.findViewById(R.id.ll_white_basic_theme).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            whiteSelect.setVisibility(View.VISIBLE);
            darkSelect.setVisibility(View.GONE);
            darkAmoledSelect.setVisibility(View.GONE);
            setBaseTheme(LIGHT_THEME, false);
        //dialogCardView.setCardBackgroundColor(getCardBackgroundColor());
        //setTheme();
        }
    });
    dialogLayout.findViewById(R.id.ll_dark_basic_theme).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            whiteSelect.setVisibility(View.GONE);
            darkSelect.setVisibility(View.VISIBLE);
            darkAmoledSelect.setVisibility(View.GONE);
            setBaseTheme(DARK_THEME, false);
        //dialogCardView.setCardBackgroundColor(getCardBackgroundColor());
        //setTheme();
        }
    });
    dialogLayout.findViewById(R.id.ll_dark_amoled_basic_theme).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            whiteSelect.setVisibility(View.GONE);
            darkSelect.setVisibility(View.GONE);
            darkAmoledSelect.setVisibility(View.VISIBLE);
            setBaseTheme(AMOLED_THEME, false);
        //dialogCardView.setCardBackgroundColor(getCardBackgroundColor());
        //setTheme();
        }
    });
    dialogBuilder.setView(dialogLayout);
    dialogBuilder.setPositiveButton(getString(R.string.ok_action).toUpperCase(), new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int which) {
            SP.putInt(getString(org.horaapps.leafpic.R.string.preference_base_theme), getBaseTheme());
            setTheme();
        }
    });
    dialogBuilder.setNegativeButton(getString(R.string.cancel).toUpperCase(), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            setBaseTheme(ThemeHelper.getBaseTheme(getApplicationContext()), false);
            setTheme();
        }
    });
    dialogBuilder.setView(dialogLayout);
    dialogBuilder.show();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) IconicsImageView(com.mikepenz.iconics.view.IconicsImageView) DialogInterface(android.content.DialogInterface) CardView(android.support.v7.widget.CardView) TextView(android.widget.TextView) View(android.view.View) CardView(android.support.v7.widget.CardView) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) IconicsImageView(com.mikepenz.iconics.view.IconicsImageView)

Example 7 with IconicsImageView

use of com.mikepenz.iconics.view.IconicsImageView 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 8 with IconicsImageView

use of com.mikepenz.iconics.view.IconicsImageView in project LeafPic by HoraApps.

the class VideoFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(org.horaapps.leafpic.R.layout.fragment_video, container, false);
    ImageView picture = (ImageView) view.findViewById(org.horaapps.leafpic.R.id.media_view);
    IconicsImageView videoInd = (IconicsImageView) view.findViewById(org.horaapps.leafpic.R.id.icon);
    videoInd.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent intent = PreferenceUtil.getInstance(getContext()).getBoolean("set_internal_player", false) ? new Intent(getActivity(), PlayerActivity.class) : new Intent(Intent.ACTION_VIEW);
            intent.setDataAndType(ContentHelper.getUriForFile(getContext(), video.getFile()), video.getMimeType());
            startActivity(intent);
        }
    });
    Glide.with(getContext()).load(video.getUri()).asBitmap().signature(video.getSignature()).centerCrop().diskCacheStrategy(DiskCacheStrategy.RESULT).thumbnail(0.5f).animate(org.horaapps.leafpic.R.anim.fade_in).into(picture);
    picture.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            ((SingleMediaActivity) getActivity()).toggleSystemUI();
        }
    });
    return view;
}
Also used : IconicsImageView(com.mikepenz.iconics.view.IconicsImageView) Intent(android.content.Intent) ImageView(android.widget.ImageView) IconicsImageView(com.mikepenz.iconics.view.IconicsImageView) ImageView(android.widget.ImageView) IconicsImageView(com.mikepenz.iconics.view.IconicsImageView) View(android.view.View)

Aggregations

View (android.view.View)8 IconicsImageView (com.mikepenz.iconics.view.IconicsImageView)8 TextView (android.widget.TextView)7 CardView (android.support.v7.widget.CardView)6 DialogInterface (android.content.DialogInterface)5 AlertDialog (android.support.v7.app.AlertDialog)5 ScrollView (android.widget.ScrollView)5 Intent (android.content.Intent)3 RecyclerView (android.support.v7.widget.RecyclerView)3 EditText (android.widget.EditText)3 SearchView (android.support.v7.widget.SearchView)2 SwitchCompat (android.support.v7.widget.SwitchCompat)2 CompoundButton (android.widget.CompoundButton)2 SeekBar (android.widget.SeekBar)2 IconicsDrawable (com.mikepenz.iconics.IconicsDrawable)2 ClipData (android.content.ClipData)1 ClipboardManager (android.content.ClipboardManager)1 Bitmap (android.graphics.Bitmap)1 PorterDuffColorFilter (android.graphics.PorterDuffColorFilter)1 Uri (android.net.Uri)1