Skip to content

Commit

Permalink
Added Java as example
Browse files Browse the repository at this point in the history
  • Loading branch information
tehras committed Apr 12, 2017
1 parent 595e1c5 commit 5c7c007
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 5 deletions.
1 change: 1 addition & 0 deletions loading-skeleton-sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".InstantLoadActivity" />
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.github.tehras.loadingskeletonapp;

import android.os.Bundle;
import android.view.View;

import com.github.tehras.loadingskeleton.LoadingSkeleton;
import com.github.tehras.loadingskeleton.helpers.LoadingSkeletonViewConverter;

import org.jetbrains.annotations.Nullable;

public class InstantLoadActivity extends MainActivity {


@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

LoadingSkeleton shimmerView = (LoadingSkeleton) findViewById(R.id.include_2);

//call this instantly
shimmerView.skeletonViewConverter(new LoadingSkeletonViewConverter.Builder()
.color(R.color.colorPrimary)
.shimmer(true)
.cornerRadius(10)
.build()).start();
}

@Override
protected void onStart() {
super.onStart();

findViewById(R.id.instant_activity).setVisibility(View.GONE);
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
package com.github.tehras.loadingskeletonapp

import android.content.Intent
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.view.View
import android.widget.Button
import com.github.tehras.loadingskeleton.LoadingSkeleton
import com.github.tehras.loadingskeleton.helpers.LoadingSkeletonViewConverter
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {

open class MainActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand All @@ -30,5 +34,13 @@ class MainActivity : AppCompatActivity() {
shimmerView.stop()
normalView.stop()
}

instant_activity.setOnClickListener { startActivity(Intent(this, InstantLoadActivity::class.java)) }
}

override fun onStart() {
super.onStart()

instant_activity.visibility = View.VISIBLE
}
}
23 changes: 19 additions & 4 deletions loading-skeleton-sample/src/main/res/layout-v21/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,28 @@
tools:layout_constraintRight_creator="1"
tools:layout_constraintTop_creator="1" />

<android.support.v7.widget.AppCompatButton
android:id="@+id/instant_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:backgroundTint="@android:color/holo_blue_dark"
android:text="Java"
android:textColor="@android:color/white" />

<android.support.v7.widget.AppCompatButton
android:id="@+id/start_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/stop_button"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal"
android:layout_alignParentBottom="true"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_toStartOf="@+id/stop_button"
android:backgroundTint="@android:color/holo_green_dark"
android:text="Start"
android:textColor="@android:color/white" />
Expand All @@ -59,9 +73,10 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_alignParentEnd="true"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:backgroundTint="@android:color/holo_red_dark"
android:text="Stop"
android:textColor="@android:color/white" />
Expand Down

0 comments on commit 5c7c007

Please sign in to comment.