-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add example activity for combine view
- Loading branch information
1 parent
7dea576
commit c630ce1
Showing
5 changed files
with
189 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
app/src/main/java/com/erif/contentloader/example/ActivityCombine.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package com.erif.contentloader.example; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.appcompat.app.AppCompatActivity; | ||
import androidx.recyclerview.widget.LinearLayoutManager; | ||
import androidx.recyclerview.widget.RecyclerView; | ||
|
||
import android.os.Bundle; | ||
import android.view.MenuItem; | ||
import android.widget.RelativeLayout; | ||
import android.widget.Toast; | ||
|
||
import com.erif.contentloader.ContentLoaderFrameLayout; | ||
import com.erif.contentloader.R; | ||
import com.erif.contentloader.helper.DataAdapterVertical; | ||
import com.erif.contentloader.helper.DelayTimer; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class ActivityCombine extends AppCompatActivity { | ||
|
||
private final DataAdapterVertical adapter = new DataAdapterVertical(); | ||
private final List<Integer> list = new ArrayList<>(); | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_combine); | ||
if (getSupportActionBar() != null) { | ||
getSupportActionBar().setTitle("Combine Loader"); | ||
getSupportActionBar().setDisplayHomeAsUpEnabled(true); | ||
} | ||
Toast.makeText(this, "Loading simulation...", Toast.LENGTH_SHORT).show(); | ||
|
||
ContentLoaderFrameLayout loader = findViewById(R.id.act_combine_loader); | ||
RelativeLayout image = findViewById(R.id.act_combine_layoutImage); | ||
loader.startAndHideContent(image, true); | ||
|
||
RecyclerView recyclerView = findViewById(R.id.act_combine_recyclerView); | ||
setupList(recyclerView); | ||
|
||
ContentLoaderFrameLayout loaderVertical = findViewById(R.id.content_combine_vertical); | ||
loaderVertical.startAndHideContent(recyclerView, true); | ||
|
||
new DelayTimer(2, () -> { | ||
loader.stopAndShowContent(image, true); | ||
}).start(); | ||
|
||
new DelayTimer(3, () -> { | ||
adapter.setList(list); | ||
loaderVertical.stopAndShowContent(recyclerView, true); | ||
}).start(); | ||
|
||
} | ||
|
||
private void setupList(RecyclerView recyclerView) { | ||
recyclerView.setAdapter(adapter); | ||
LinearLayoutManager manager = new LinearLayoutManager(this); | ||
recyclerView.setLayoutManager(manager); | ||
for (int i=0; i<20; i++) { | ||
list.add(i); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean onOptionsItemSelected(@NonNull MenuItem item) { | ||
if (item.getItemId() == android.R.id.home) { | ||
finish(); | ||
return true; | ||
} | ||
return super.onOptionsItemSelected(item); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.coordinatorlayout.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:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".example.ActivityCombine"> | ||
|
||
<androidx.core.widget.NestedScrollView | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content"> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:orientation="vertical"> | ||
|
||
<RelativeLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content"> | ||
|
||
<com.erif.contentloader.ContentLoaderFrameLayout | ||
android:id="@+id/act_combine_loader" | ||
style="@style/ContentLoader.Match.AutoStart" | ||
android:layout_height="150dp"> | ||
|
||
<com.erif.contentloader.ContentLoaderViewBanner | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
app:bannerPeep="leftAndRight" | ||
android:padding="12dp" | ||
app:peepPaddingVertical="18dp"/> | ||
|
||
</com.erif.contentloader.ContentLoaderFrameLayout> | ||
|
||
<RelativeLayout | ||
android:id="@+id/act_combine_layoutImage" | ||
android:layout_width="match_parent" | ||
android:layout_height="150dp" | ||
android:visibility="gone"> | ||
|
||
<ImageView | ||
android:id="@+id/act_frame_imgLeft" | ||
android:layout_width="15dp" | ||
android:layout_height="match_parent" | ||
android:src="@drawable/ic_launcher_background" | ||
android:scaleType="fitXY" | ||
android:layout_marginTop="18dp" | ||
android:layout_marginBottom="18dp" | ||
tools:ignore="ContentDescription" /> | ||
|
||
<ImageView | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:src="@mipmap/ic_launcher" | ||
android:scaleType="centerCrop" | ||
android:layout_margin="12dp" | ||
android:layout_toEndOf="@id/act_frame_imgLeft" | ||
android:layout_toStartOf="@id/act_frame_imgRight" | ||
tools:ignore="ContentDescription" /> | ||
|
||
<ImageView | ||
android:id="@+id/act_frame_imgRight" | ||
android:layout_width="15dp" | ||
android:layout_height="match_parent" | ||
android:src="@drawable/ic_launcher_background" | ||
android:layout_alignParentEnd="true" | ||
android:scaleType="fitXY" | ||
android:layout_marginTop="18dp" | ||
android:layout_marginBottom="18dp" | ||
tools:ignore="ContentDescription" /> | ||
|
||
</RelativeLayout> | ||
|
||
</RelativeLayout> | ||
|
||
<RelativeLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content"> | ||
|
||
<com.erif.contentloader.ContentLoaderFrameLayout | ||
android:id="@+id/content_combine_vertical" | ||
style="@style/ContentLoader.AutoStart"> | ||
|
||
<include layout="@layout/content_loader_vertical"/> | ||
|
||
</com.erif.contentloader.ContentLoaderFrameLayout> | ||
|
||
<androidx.recyclerview.widget.RecyclerView | ||
android:id="@+id/act_combine_recyclerView" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
tools:itemCount="10" | ||
tools:listitem="@layout/item_data_vertical"/> | ||
|
||
</RelativeLayout> | ||
|
||
</LinearLayout> | ||
|
||
</androidx.core.widget.NestedScrollView> | ||
|
||
</androidx.coordinatorlayout.widget.CoordinatorLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters