com.wang.avi.AVLoadingIndicatorView Java Examples

The following examples show how to use com.wang.avi.AVLoadingIndicatorView. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LoaderCreator.java    From FastWaiMai with MIT License 6 votes vote down vote up
private static Indicator getIndicator(String name){
    if(name == null || name.isEmpty()){
        return null;
    }
    final StringBuilder drawableClassName = new StringBuilder();
    if(!name.contains(".")){
        final String defaultPackageName = AVLoadingIndicatorView.class.getPackage().getName();
        drawableClassName.append(defaultPackageName)
                .append(".indicators")
                .append(".");
    }
    drawableClassName.append(name);
    Log.d("getIndicator", "getIndicator: "+drawableClassName.toString());
    try {
        final Class<?> drawableClass = Class.forName(drawableClassName.toString());
        return (Indicator) drawableClass.newInstance();
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}
 
Example #2
Source File: LatteLoader.java    From FastWaiMai with MIT License 6 votes vote down vote up
public static void showLoading(Context context,String type){

        final AppCompatDialog dialog = new AppCompatDialog(context, R.style.dialog);
        final AVLoadingIndicatorView avLoadingIndicatorView = LoaderCreator.create(type, context);
        dialog.setContentView(avLoadingIndicatorView);

        int deviceWidth = DimenUtil.getScreenWidth();
        int deviceHeigth = DimenUtil.getScreenHeight();

        final Window dialogWindow = dialog.getWindow();
        if(dialogWindow != null){
            WindowManager.LayoutParams lp = dialogWindow.getAttributes();
            lp.width = deviceWidth/LOADER_SIZE_SCALE;
            lp.height = deviceHeigth/LOADER_SIZE_SCALE;
            lp.height = lp.height + LOADER_OFFSIZE;
            lp.gravity = Gravity.CENTER;

        }
        LOADERS.add(dialog);
        dialog.show();
    }
 
Example #3
Source File: MainActivity.java    From OpenCircle with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    dbHelper = new DBHelper(MainActivity.this);

    progressBar = (AVLoadingIndicatorView) findViewById(R.id.progressBar);
    fullBody = (FrameLayout) findViewById(R.id.full_body);

    progressBar.setVisibility(View.VISIBLE);
    fullBody.setVisibility(View.GONE);

    connectGoogleApiClient();

    sms = dbHelper.getSMS();
    init();


    askForContactPermission(Manifest.permission.SEND_SMS);
    askForContactPermission(Manifest.permission.READ_PHONE_STATE);
    askForContactPermission(Manifest.permission.ACCESS_FINE_LOCATION);

}
 
Example #4
Source File: ReqStatsFragment.java    From NanoIconPack with Apache License 2.0 6 votes vote down vote up
@Override
protected void onPostExecute(List<AppBean> list) {
    super.onPostExecute(list);

    retainedFragment.setReqTopList(list);

    ((AVLoadingIndicatorView) contentView.findViewById(R.id.view_loading)).hide();

    reqStatsAdapter.refresh(list);

    swipeRefreshLayout.setRefreshing(false);

    if (getUserVisibleHint()) {
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                if (!isAdded() || lazyLoadTask != null) {
                    return;
                }
                lazyLoadTask = new LazyLoadTask();
                lazyLoadTask.execute(layoutManager.findFirstVisibleItemPosition(),
                        layoutManager.findLastVisibleItemPosition());
            }
        }, 400);
    }
}
 
Example #5
Source File: LoaderCreator.java    From FastWaiMai with MIT License 5 votes vote down vote up
static AVLoadingIndicatorView create(String type, Context context){

        final AVLoadingIndicatorView avLoadingIndicatorView = new AVLoadingIndicatorView(context);
        if(LOADING_MAP.get(type) == null) {
            final Indicator indicator = getIndicator(type);
            LOADING_MAP.put(type, indicator);
        }

        avLoadingIndicatorView.setIndicator(LOADING_MAP.get(type));
        return avLoadingIndicatorView;
    }
 
Example #6
Source File: MusicListActivity.java    From MusicPlayer_XiangDa with GNU General Public License v3.0 5 votes vote down vote up
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
    View v;

    //复用
    if (view == null) {
        v = View.inflate(MusicListActivity.this, R.layout.item_musiclist_adapter, null);
    } else {
        v = view;
    }

    TextView songName = v.findViewById(R.id.item_musicList_songName);
    TextView songer = v.findViewById(R.id.item_musicList_songer);
    AVLoadingIndicatorView loadingView = v.findViewById(R.id.item_loadingView);

    //获取歌曲文件地址
    File f = (File) getItem(i);

    //设置歌曲名字
    String name = f.getName();
    songName.setText(name.substring(0, name.length() - 4));

    //获取当前的播放位置,使得歌曲列表中的loadingView显示出来,表示其正在播放
    int currPlayingNum = Utils.getInt(MusicListActivity.this, Constant.PLAYINGNUM, 0);
    if (currPlayingNum == i) {
        loadingView.setVisibility(View.VISIBLE);
    } else {
        loadingView.setVisibility(View.GONE);
    }


    return v;
}
 
Example #7
Source File: AppsFragment.java    From NanoIconPack with Apache License 2.0 5 votes vote down vote up
@Override
protected void onPostExecute(List<AppBean> list) {
    super.onPostExecute(list);

    retainedFragment.setAppList(list);

    ((AVLoadingIndicatorView) contentView.findViewById(R.id.view_loading)).hide();

    appAdapter.refresh(list);

    swipeRefreshLayout.setRefreshing(false);

    if (getUserVisibleHint()) {
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                if (!isAdded() || lazyLoadTask != null) {
                    return;
                }
                lazyLoadTask = new LazyLoadTask();
                lazyLoadTask.execute(layoutManager.findFirstVisibleItemPosition(),
                        layoutManager.findLastVisibleItemPosition());
            }
        }, 400);
    }

    if (onLoadDoneListener != null) {
        onLoadDoneListener.onLoadDone(pageId, list.size());
    }
}
 
Example #8
Source File: IconsFragment.java    From NanoIconPack with Apache License 2.0 5 votes vote down vote up
@Override
protected void onPostExecute(List<IconBean> list) {
    super.onPostExecute(list);

    retainedFragment.setIconList(pageId, list);

    ((AVLoadingIndicatorView) contentView.findViewById(R.id.view_loading)).hide();

    iconAdapter.refresh(list);

    if (onLoadDoneListener != null) {
        onLoadDoneListener.onLoadDone(pageId, list.size());
    }
}
 
Example #9
Source File: SearchActivity.java    From NanoIconPack with Apache License 2.0 5 votes vote down vote up
@Override
protected void onPostExecute(List<IconBean> list) {
    super.onPostExecute(list);

    dataList = list;

    ((AVLoadingIndicatorView) findViewById(R.id.view_loading)).hide();
}
 
Example #10
Source File: PersonDetailActivity.java    From PopCorn with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_person_detail);
    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(mToolbar);

    setTitle("");

    Intent receivedIntent = getIntent();
    mPersonId = receivedIntent.getIntExtra(Constants.PERSON_ID, -1);

    if (mPersonId == -1) finish();

    mCollapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.toolbar_layout);
    mAppBarLayout = (AppBarLayout) findViewById(R.id.app_bar);

    mCastImageCardView = (CardView) findViewById(R.id.card_view_cast_detail);
    mCastImageSideSize = (int) (getResources().getDisplayMetrics().widthPixels * 0.33);
    mCastImageCardView.getLayoutParams().height = mCastImageSideSize;
    mCastImageCardView.getLayoutParams().width = mCastImageSideSize;
    mCastImageCardView.setRadius(mCastImageSideSize / 2);
    mCastImageView = (ImageView) findViewById(R.id.image_view_cast_detail);
    mProgressBar = (AVLoadingIndicatorView) findViewById(R.id.progress_bar_cast_detail);
    mProgressBar.setVisibility(View.GONE);
    mCastNameTextView = (TextView) findViewById(R.id.text_view_name_cast_detail);
    ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) mCastNameTextView.getLayoutParams();
    params.setMargins(params.leftMargin, mCastImageSideSize / 2, params.rightMargin, params.bottomMargin);
    mCastAgeTextView = (TextView) findViewById(R.id.text_view_age_cast_detail);
    mCastBirthPlaceTextView = (TextView) findViewById(R.id.text_view_birthplace_cast_detail);

    mBackImageButton = (ImageButton) findViewById(R.id.image_button_back_cast_detail);
    mBackImageButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            onBackPressed();
        }
    });

    mCastBioHeaderTextView = (TextView) findViewById(R.id.text_view_bio_header_person_detail);
    mCastBioTextView = (TextView) findViewById(R.id.text_view_bio_person_detail);
    mCastReadMoreBioTextView = (TextView) findViewById(R.id.text_view_read_more_person_detail);

    mMovieCastTextView = (TextView) findViewById(R.id.text_view_movie_cast_person_detail);
    mMovieCastRecyclerView = (RecyclerView) findViewById(R.id.recycler_view_movie_cast_person_detail);
    mMovieCastOfPersons = new ArrayList<>();
    mMovieCastsOfPersonAdapter = new MovieCastsOfPersonAdapter(PersonDetailActivity.this, mMovieCastOfPersons);
    mMovieCastRecyclerView.setAdapter(mMovieCastsOfPersonAdapter);
    mMovieCastRecyclerView.setLayoutManager(new LinearLayoutManager(PersonDetailActivity.this, LinearLayoutManager.HORIZONTAL, false));

    mTVCastTextView = (TextView) findViewById(R.id.text_view_tv_cast_person_detail);
    mTVCastRecyclerView = (RecyclerView) findViewById(R.id.recycler_view_tv_cast_person_detail);
    mTVCastOfPersons = new ArrayList<>();
    mTVCastsOfPersonAdapter = new TVCastsOfPersonAdapter(PersonDetailActivity.this, mTVCastOfPersons);
    mTVCastRecyclerView.setAdapter(mTVCastsOfPersonAdapter);
    mTVCastRecyclerView.setLayoutManager(new LinearLayoutManager(PersonDetailActivity.this, LinearLayoutManager.HORIZONTAL, false));

    if (NetworkConnection.isConnected(PersonDetailActivity.this)) {
        isActivityLoaded = true;
        loadActivity();
    }

}
 
Example #11
Source File: TVShowDetailActivity.java    From PopCorn with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tvshow_detail);
    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(mToolbar);

    setTitle("");

    Intent receivedIntent = getIntent();
    mTVShowId = receivedIntent.getIntExtra(Constants.TV_SHOW_ID, -1);

    if (mTVShowId == -1) finish();

    mCollapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.toolbar_layout);
    mAppBarLayout = (AppBarLayout) findViewById(R.id.app_bar);

    mPosterWidth = (int) (getResources().getDisplayMetrics().widthPixels * 0.25);
    mPosterHeight = (int) (mPosterWidth / 0.66);
    mBackdropWidth = getResources().getDisplayMetrics().widthPixels;
    mBackdropHeight = (int) (mBackdropWidth / 1.77);

    mTVShowTabLayout = (ConstraintLayout) findViewById(R.id.layout_toolbar_tv_show);
    mTVShowTabLayout.getLayoutParams().height = mBackdropHeight + (int) (mPosterHeight * 0.9);

    mPosterImageView = (ImageView) findViewById(R.id.image_view_poster);
    mPosterImageView.getLayoutParams().width = mPosterWidth;
    mPosterImageView.getLayoutParams().height = mPosterHeight;
    mPosterProgressBar = (AVLoadingIndicatorView) findViewById(R.id.progress_bar_poster);
    mPosterProgressBar.setVisibility(View.GONE);

    mBackdropImageView = (ImageView) findViewById(R.id.image_view_backdrop);
    mBackdropImageView.getLayoutParams().height = mBackdropHeight;
    mBackdropProgressBar = (AVLoadingIndicatorView) findViewById(R.id.progress_bar_backdrop);
    mBackdropProgressBar.setVisibility(View.GONE);

    mTitleTextView = (TextView) findViewById(R.id.text_view_title_tv_show_detail);
    mGenreTextView = (TextView) findViewById(R.id.text_view_genre_tv_show_detail);
    mYearTextView = (TextView) findViewById(R.id.text_view_year_tv_show_detail);

    mBackImageButton = (ImageButton) findViewById(R.id.image_button_back_tv_show_detail);
    mBackImageButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            onBackPressed();
        }
    });
    mFavImageButton = (ImageButton) findViewById(R.id.image_button_fav_tv_show_detail);
    mShareImageButton = (ImageButton) findViewById(R.id.image_button_share_tv_show_detail);

    mRatingLayout = (LinearLayout) findViewById(R.id.layout_rating_tv_show_detail);
    mRatingTextView = (TextView) findViewById(R.id.text_view_rating_tv_show_detail);

    mOverviewTextView = (TextView) findViewById(R.id.text_view_overview_tv_show_detail);
    mOverviewReadMoreTextView = (TextView) findViewById(R.id.text_view_read_more_tv_show_detail);
    mDetailsLayout = (LinearLayout) findViewById(R.id.layout_details_tv_show_detail);
    mDetailsTextView = (TextView) findViewById(R.id.text_view_details_tv_show_detail);

    mVideosTextView = (TextView) findViewById(R.id.text_view_trailer_tv_show_detail);
    mVideosRecyclerView = (RecyclerView) findViewById(R.id.recycler_view_trailers_tv_show_detail);
    (new LinearSnapHelper()).attachToRecyclerView(mVideosRecyclerView);
    mVideos = new ArrayList<>();
    mVideosAdapter = new VideoAdapter(TVShowDetailActivity.this, mVideos);
    mVideosRecyclerView.setAdapter(mVideosAdapter);
    mVideosRecyclerView.setLayoutManager(new LinearLayoutManager(TVShowDetailActivity.this, LinearLayoutManager.HORIZONTAL, false));

    mHorizontalLine = (View) findViewById(R.id.view_horizontal_line);

    mCastTextView = (TextView) findViewById(R.id.text_view_cast_tv_show_detail);
    mCastRecyclerView = (RecyclerView) findViewById(R.id.recycler_view_cast_tv_show_detail);
    mCasts = new ArrayList<>();
    mCastAdapter = new TVShowCastAdapter(TVShowDetailActivity.this, mCasts);
    mCastRecyclerView.setAdapter(mCastAdapter);
    mCastRecyclerView.setLayoutManager(new LinearLayoutManager(TVShowDetailActivity.this, LinearLayoutManager.HORIZONTAL, false));

    mSimilarTVShowsTextView = (TextView) findViewById(R.id.text_view_similar_tv_show_detail);
    mSimilarTVShowsRecyclerView = (RecyclerView) findViewById(R.id.recycler_view_similar_tv_show_detail);
    mSimilarTVShows = new ArrayList<>();
    mSimilarTVShowsAdapter = new TVShowBriefsSmallAdapter(TVShowDetailActivity.this, mSimilarTVShows);
    mSimilarTVShowsRecyclerView.setAdapter(mSimilarTVShowsAdapter);
    mSimilarTVShowsRecyclerView.setLayoutManager(new LinearLayoutManager(TVShowDetailActivity.this, LinearLayoutManager.HORIZONTAL, false));

    if (NetworkConnection.isConnected(TVShowDetailActivity.this)) {
        isActivityLoaded = true;
        loadActivity();
    }

}
 
Example #12
Source File: MovieDetailActivity.java    From PopCorn with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_movie_detail);
    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(mToolbar);

    setTitle("");

    Intent receivedIntent = getIntent();
    mMovieId = receivedIntent.getIntExtra(Constants.MOVIE_ID, -1);

    if (mMovieId == -1) finish();

    mCollapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.toolbar_layout);
    mAppBarLayout = (AppBarLayout) findViewById(R.id.app_bar);

    mPosterWidth = (int) (getResources().getDisplayMetrics().widthPixels * 0.25);
    mPosterHeight = (int) (mPosterWidth / 0.66);
    mBackdropWidth = getResources().getDisplayMetrics().widthPixels;
    mBackdropHeight = (int) (mBackdropWidth / 1.77);

    mMovieTabLayout = (ConstraintLayout) findViewById(R.id.layout_toolbar_movie);
    mMovieTabLayout.getLayoutParams().height = mBackdropHeight + (int) (mPosterHeight * 0.9);

    mPosterImageView = (ImageView) findViewById(R.id.image_view_poster);
    mPosterImageView.getLayoutParams().width = mPosterWidth;
    mPosterImageView.getLayoutParams().height = mPosterHeight;
    mPosterProgressBar = (AVLoadingIndicatorView) findViewById(R.id.progress_bar_poster);
    mPosterProgressBar.setVisibility(View.GONE);

    mBackdropImageView = (ImageView) findViewById(R.id.image_view_backdrop);
    mBackdropImageView.getLayoutParams().height = mBackdropHeight;
    mBackdropProgressBar = (AVLoadingIndicatorView) findViewById(R.id.progress_bar_backdrop);
    mBackdropProgressBar.setVisibility(View.GONE);

    mTitleTextView = (TextView) findViewById(R.id.text_view_title_movie_detail);
    mGenreTextView = (TextView) findViewById(R.id.text_view_genre_movie_detail);
    mYearTextView = (TextView) findViewById(R.id.text_view_year_movie_detail);

    mBackImageButton = (ImageButton) findViewById(R.id.image_button_back_movie_detail);
    mBackImageButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            onBackPressed();
        }
    });
    mFavImageButton = (ImageButton) findViewById(R.id.image_button_fav_movie_detail);
    mShareImageButton = (ImageButton) findViewById(R.id.image_button_share_movie_detail);

    mRatingLayout = (LinearLayout) findViewById(R.id.layout_rating_movie_detail);
    mRatingTextView = (TextView) findViewById(R.id.text_view_rating_movie_detail);

    mOverviewTextView = (TextView) findViewById(R.id.text_view_overview_movie_detail);
    mOverviewReadMoreTextView = (TextView) findViewById(R.id.text_view_read_more_movie_detail);
    mDetailsLayout = (LinearLayout) findViewById(R.id.layout_details_movie_detail);
    mDetailsTextView = (TextView) findViewById(R.id.text_view_details_movie_detail);

    mTrailerTextView = (TextView) findViewById(R.id.text_view_trailer_movie_detail);
    mTrailerRecyclerView = (RecyclerView) findViewById(R.id.recycler_view_trailers_movie_detail);
    (new LinearSnapHelper()).attachToRecyclerView(mTrailerRecyclerView);
    mTrailers = new ArrayList<>();
    mTrailerAdapter = new VideoAdapter(MovieDetailActivity.this, mTrailers);
    mTrailerRecyclerView.setAdapter(mTrailerAdapter);
    mTrailerRecyclerView.setLayoutManager(new LinearLayoutManager(MovieDetailActivity.this, LinearLayoutManager.HORIZONTAL, false));

    mHorizontalLine = (View) findViewById(R.id.view_horizontal_line);

    mCastTextView = (TextView) findViewById(R.id.text_view_cast_movie_detail);
    mCastRecyclerView = (RecyclerView) findViewById(R.id.recycler_view_cast_movie_detail);
    mCasts = new ArrayList<>();
    mCastAdapter = new MovieCastsAdapter(MovieDetailActivity.this, mCasts);
    mCastRecyclerView.setAdapter(mCastAdapter);
    mCastRecyclerView.setLayoutManager(new LinearLayoutManager(MovieDetailActivity.this, LinearLayoutManager.HORIZONTAL, false));

    mSimilarMoviesTextView = (TextView) findViewById(R.id.text_view_similar_movie_detail);
    mSimilarMoviesRecyclerView = (RecyclerView) findViewById(R.id.recycler_view_similar_movie_detail);
    mSimilarMovies = new ArrayList<>();
    mSimilarMoviesAdapter = new MovieBriefsSmallAdapter(MovieDetailActivity.this, mSimilarMovies);
    mSimilarMoviesRecyclerView.setAdapter(mSimilarMoviesAdapter);
    mSimilarMoviesRecyclerView.setLayoutManager(new LinearLayoutManager(MovieDetailActivity.this, LinearLayoutManager.HORIZONTAL, false));

    if (NetworkConnection.isConnected(MovieDetailActivity.this)) {
        isActivityLoaded = true;
        loadActivity();
    }

}
 
Example #13
Source File: TransfersTableAdapter.java    From smartcoins-wallet with MIT License 4 votes vote down vote up
private View renderDateView(HistoricalTransferEntry historicalTransfer) {
    LayoutInflater layoutInflater = getLayoutInflater();
    View v = layoutInflater.inflate(R.layout.transactionsdateview, null);
    TextView dateTextView = (TextView) v.findViewById(R.id.transactiondate);
    TextView timeTextView = (TextView) v.findViewById(R.id.transactiontime);
    TextView timeZoneTextView = (TextView) v.findViewById(R.id.transactionttimezone);
    LinearLayout dateTimeView = (LinearLayout) v.findViewById(R.id.transaction_datetime);
    AVLoadingIndicatorView dateTimeLoadingView = (AVLoadingIndicatorView) v.findViewById(R.id.datetime_loading);

    if (historicalTransfer.getTimestamp() > 0) {
        //Hide loading
        dateTimeLoadingView.smoothToHide();

        Date date = new Date(historicalTransfer.getTimestamp() * 1000);

        SimpleDateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy");
        SimpleDateFormat timeFormat = new SimpleDateFormat("hh:mm");
        SimpleDateFormat timeZone = new SimpleDateFormat("zzz");

        TimeZone tz = TimeZone.getTimeZone(timeZone.format(date));
        String formattedTimeZone = tz.getDisplayName(false, TimeZone.SHORT);

        // It was requested that we omit the last part of the time zone information
        // turning GMT-02:00 into GMT-2 for instance.
        // The following code does just that.
        Pattern pattern = Pattern.compile("(GMT[+-])(\\d)(\\d):(\\d\\d)");
        Matcher m = pattern.matcher(formattedTimeZone);
        if (m.matches()) {
            if (m.group(4).equals("00")) {
                formattedTimeZone = m.group(1) + m.group(3);
            }
        }

        dateTextView.setText(dateFormat.format(date));
        timeTextView.setText(timeFormat.format(date));
        timeZoneTextView.setText(formattedTimeZone);
        //Show datetime
        dateTimeView.setVisibility(View.VISIBLE);
    }
    return v;
}