|
| 1 | +package com.developer.spoti.vspot; |
| 2 | + |
| 3 | +import android.os.Bundle; |
| 4 | +import android.view.View; |
| 5 | + |
| 6 | +import androidx.appcompat.app.AppCompatActivity; |
| 7 | + |
| 8 | +import com.developer.spoti.vspoti.VSpotView; |
| 9 | +import com.developer.spoti.vspoti.VSpotView2; |
| 10 | + |
| 11 | +public class MainActivity2 extends AppCompatActivity { |
| 12 | + |
| 13 | + private VSpotView2 mVSpotView; |
| 14 | + private VSpotView2.Builder builder; |
| 15 | + |
| 16 | + @Override |
| 17 | + protected void onCreate(Bundle savedInstanceState) { |
| 18 | + super.onCreate(savedInstanceState); |
| 19 | + setContentView(R.layout.activity_main); |
| 20 | + |
| 21 | + final View view1 = findViewById(R.id.view1); |
| 22 | + final View view2 = findViewById(R.id.view2); |
| 23 | + final View view3 = findViewById(R.id.view3); |
| 24 | + final View view4 = findViewById(R.id.view4); |
| 25 | + final View view5 = findViewById(R.id.view5); |
| 26 | + |
| 27 | + |
| 28 | + builder = new VSpotView2.Builder(MainActivity2.this) |
| 29 | + .setTitle("Guide Title Text") |
| 30 | + .setContentText("Spoti Description Text\n .....Spoti Description Text\n .....Spoti Description Text .....") |
| 31 | + .setGravity(VSpotView.Gravity.center) |
| 32 | + .setDismissType(VSpotView.DismissType.outside) |
| 33 | + .setTargetView(view1) |
| 34 | + .setVSpotListener(view -> { |
| 35 | + int id = view.getId(); |
| 36 | + if (id == R.id.view1) { |
| 37 | + builder.setTargetView(view2).build(); |
| 38 | + } else if (id == R.id.view2) { |
| 39 | + builder.setTargetView(view3).build(); |
| 40 | + } else if (id == R.id.view3) { |
| 41 | + builder.setTargetView(view4).build(); |
| 42 | + } else if (id == R.id.view4) { |
| 43 | + builder.setTargetView(view5).build(); |
| 44 | + } else if (id == R.id.view5) { |
| 45 | + return; |
| 46 | + } |
| 47 | + mVSpotView = builder.build(); |
| 48 | + mVSpotView.show(); |
| 49 | + }); |
| 50 | + |
| 51 | + mVSpotView = builder.build(); |
| 52 | + mVSpotView.show(); |
| 53 | + |
| 54 | +// builder2 = new VSpotView2.Builder(MainActivity.this, view1) |
| 55 | +// .setDismissType(VSpotView2.DismissType.anywhere) |
| 56 | +// .setGravity(VSpotView2.Gravity.center); |
| 57 | +// |
| 58 | +// vSpotView2 = builder2.build(); |
| 59 | +// vSpotView2.show(); |
| 60 | + |
| 61 | + } |
| 62 | + |
| 63 | + |
| 64 | + @Override |
| 65 | + protected void onDestroy() { |
| 66 | + super.onDestroy(); |
| 67 | + |
| 68 | + } |
| 69 | +} |
0 commit comments