Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IntroView #7

Open
Danishbutt1122 opened this issue Jun 23, 2016 · 16 comments
Open

IntroView #7

Danishbutt1122 opened this issue Jun 23, 2016 · 16 comments

Comments

@Danishbutt1122
Copy link

Intro View didnot display when application start.

@michelelacorte
Copy link
Owner

Have you call mElasticDownloadView.startIntro(); ??

@Danishbutt1122
Copy link
Author

sorry
the download image didnot show when app run. when i click on the tick button then the progress bar display
screenshot_2016-06-24-18-08-44

@michelelacorte
Copy link
Owner

Provide me a code of your activity

@Danishbutt1122
Copy link
Author

ok

@Danishbutt1122
Copy link
Author

import android.os.Bundle;
import android.os.Handler;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;

import it.michelelacorte.elasticprogressbar.ElasticDownloadView;
import it.michelelacorte.elasticprogressbar.OptionView;

public class MainActivity extends AppCompatActivity {
ElasticDownloadView mElasticDownloadView;
CoordinatorLayout mCoordinatorLayout;
FloatingActionButton fabStart;
FloatingActionButton fabCancel;

/*

Fake download file
*/
private int progressStatus = 0;
private Handler handler = new Handler();
private long fileSize = 0;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    /*
    VARIOUS OPTION
     */
   // OptionView.setBackgroundColorSquare(R.color.colorAccent);
    OptionView.noBackground = true;
   // OptionView.setColorCloud(R.color.colorPrimary);
    //OptionView.setColorProgressBar(R.color.red);
    //OptionView.setColorProgressBarInProgress(R.color.darkblue);
    //OptionView.setColorProgressBarText(R.color.darkblue);
    //OptionView.setColorSuccess(R.color.darkblue);
    //OptionView.setColorFail(R.color.orange);
    //OptionView.noIntro = true;


    setContentView(R.layout.activity_main);
    mElasticDownloadView = (ElasticDownloadView)findViewById(R.id.elastic_download_view);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    mCoordinatorLayout = (CoordinatorLayout)findViewById(R.id.coordinatorLayout);
    mElasticDownloadView = (ElasticDownloadView)findViewById(R.id.elastic_download_view);
    fabStart = (FloatingActionButton) findViewById(R.id.fabStart);
    fabCancel = (FloatingActionButton) findViewById(R.id.fabCancel);
    assert fabCancel != null;
    fabCancel.setVisibility(View.INVISIBLE);

    fabCancel.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Snackbar.make(mCoordinatorLayout, "Progress Bar Reloaded!", Snackbar.LENGTH_LONG).show();
            mElasticDownloadView.setProgress(0);
            fabCancel.setVisibility(View.INVISIBLE);
            fabStart.setVisibility(View.VISIBLE);
        }
    });

    fabStart.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Snackbar.make(mCoordinatorLayout, "Progress Bar Started!", Snackbar.LENGTH_LONG).show();
            mElasticDownloadView.startIntro();
            fabCancel.setVisibility(View.VISIBLE);
            fabStart.setVisibility(View.INVISIBLE);
            new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
                    while (progressStatus < 100) {
                        progressStatus = downloadFile();
                        handler.post(new Runnable() {
                            public void run() {
                                //Set progress dinamically
                                mElasticDownloadView.setProgress(progressStatus);
                                Log.d("Progress:", "" + mElasticDownloadView.getProgress());
                            }
                        });
                    }
                    if (progressStatus >= 100) {
                        mElasticDownloadView.success();
                    }
                }
            }, 1000);
        }
    });

}


//Fake download file example
public int downloadFile() {

    while (fileSize <= 1000000) {

        fileSize++;

        if (fileSize == 100000) {
            return 10;

        } else if (fileSize == 200000) {
            return 20;

        } else if (fileSize == 300000) {
            return 30;

        } else if (fileSize == 400000) {
            return 40;

        } else if (fileSize == 500000) {

            return 50;
        } else if (fileSize == 700000) {

            return 70;
        } else if (fileSize == 800000) {

            return 80;
        } else if (fileSize == 900000) {

            return 90;
        }
    }

    return 100;

}

@Danishbutt1122
Copy link
Author

please solve this

@michelelacorte
Copy link
Owner

Comment this line and try:

OptionView.noBackground = true;

@Danishbutt1122
Copy link
Author

when i comment this line then whole screen turn to primarycolor
screenshot_2016-06-24-20-35-59

@Danishbutt1122
Copy link
Author

this is the main_acitvity.xml

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".MainActivity">

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/AppTheme.AppBarOverlay">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:popupTheme="@style/AppTheme.PopupOverlay" />

</android.support.design.widget.AppBarLayout>

<include layout="@layout/content_main" />

<android.support.design.widget.FloatingActionButton
    android:id="@+id/fabStart"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom|end"
    android:layout_margin="@dimen/fab_margin"
    android:src="@drawable/ic_action" />

<android.support.design.widget.FloatingActionButton
    android:id="@+id/fabCancel"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom|start"
    android:layout_margin="@dimen/fab_margin"
    android:src="@drawable/ic_action_cancel" />

<it.michelelacorte.elasticprogressbar.ElasticDownloadView
    android:id="@+id/elastic_download_view"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerInParent="true"
    />

</android.support.design.widget.CoordinatorLayout>

@Danishbutt1122
Copy link
Author

hello ????

@michelelacorte
Copy link
Owner

Please send me by email your zip project

@mahendrushivam
Copy link

Unable to change the red color in background how to change that red color at back

@michelelacorte
Copy link
Owner

michelelacorte commented Mar 15, 2017

@mahendrushivam use this method:

OptionView.setBackgroundColorSquare(int color);

call this before setContentView() of Activity

@mahendrushivam
Copy link

mahendrushivam commented Mar 15, 2017 via email

@michelelacorte
Copy link
Owner

Before set view of fragment!

@sakshiigoyal
Copy link

what about adapter?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants