This file contains hidden or 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
| TapTargetView.showFor(this, // `this` is an Activity | |
| TapTarget.forView(findViewById(R.id.target), "This is a target", "We have the best targets, believe me") | |
| // All options below are optional | |
| .outerCircleColor(R.color.red) // Specify a color for the outer circle | |
| .targetCircleColor(R.color.white) // Specify a color for the target circle | |
| .titleTextSize(20) // Specify the size (in sp) of the title text | |
| .titleTextColor(R.color.white) // Specify the color of the title text | |
| .descriptionTextSize(10) // Specify the size (in sp) of the description text | |
| .descriptionTextColor(R.color.red) // Specify the color of the description text | |
| .textColor(R.color.blue) // Specify a color for both the title and description text |
This file contains hidden or 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
| new TapTargetSequence(this) | |
| .targets( | |
| TapTarget.forView(findViewById(R.id.never), "Gonna"), | |
| TapTarget.forView(findViewById(R.id.give), "You", "Up") | |
| .dimColor(android.R.color.never) | |
| .outerCircleColor(R.color.gonna) | |
| .targetCircleColor(R.color.let) | |
| .textColor(android.R.color.you), | |
| TapTarget.forBounds(rickTarget, "Down", ":^)") | |
| .cancelable(false) |
This file contains hidden or 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
| ViewTreeObserver viewTreeObserver = lvRoot.getViewTreeObserver(); | |
| viewTreeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { | |
| @Override | |
| public void onGlobalLayout() { | |
| listView.getViewTreeObserver().removeOnGlobalLayoutListener(this); | |
| View view = listView.getChildAt(1).findViewById(R.id.icon); | |
| TapTargetView.showFor(TutorialActivity.this, TapTarget.forView(view | |
| , "New Feature", "Click me!!!") |
This file contains hidden or 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
| private void generateView() throws IOException { | |
| TypeSpec mvpView = TypeSpec.interfaceBuilder(featureName + "View") | |
| .build(); | |
| JavaFile javaFile = JavaFile.builder(packageName + "." + featureName.toLowerCase(), mvpView) | |
| .build(); | |
| File file = new File("app/src/main/java"); | |
| javaFile.writeTo(file); | |
| } |
This file contains hidden or 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
| private void generateView() throws IOException { | |
| TypeSpec mvpView = TypeSpec.interfaceBuilder(featureName + "View") | |
| .build(); | |
| JavaFile javaFile = JavaFile.builder(packageName + "." + featureName.toLowerCase(), mvpView) | |
| .build(); | |
| File file = new File("app/src/main/java"); | |
| javaFile.writeTo(file); | |
| } |
This file contains hidden or 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
| private void generatePresenter() throws IOException { | |
| MethodSpec attachView = MethodSpec.methodBuilder("attachView") | |
| .addJavadoc(CodeBlock.of("Attach View")) | |
| .addParameter(getViewType(), "view") | |
| .addStatement("mView = view") | |
| .build(); | |
| TypeSpec mvpPresenter = TypeSpec.classBuilder(featureName + "Presenter") | |
| .addMethod(attachView) | |
| .addField(getViewType(), "mView", Modifier.PRIVATE) |
This file contains hidden or 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
| package com.babedev.javapoetcodelab.sample; | |
| interface SampleView { | |
| } |
This file contains hidden or 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
| ClassName.bestGuess(packageName + "." + featureName.toLowerCase() + "." + featureName + "View"); |
This file contains hidden or 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
| package com.babedev.javapoetcodelab.sample; | |
| class SamplePresenter { | |
| private SampleView mView; | |
| /** | |
| * Attach View | |
| */ | |
| void attachView(SampleView view) { |
This file contains hidden or 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
| private void generateActivity() throws IOException { | |
| MethodSpec onCreate = MethodSpec.methodBuilder("onCreate") | |
| .addAnnotation(Override.class) | |
| .addModifiers(Modifier.PUBLIC) | |
| .returns(void.class) | |
| .addParameter(Bundle.class, "savedInstanceState") | |
| .addComment("TODO setContentView()") | |
| .addStatement("mPresenter = new $T()", getPresenterType()) | |
| .addStatement("mPresenter.attachView(this)") | |
| .build(); |
OlderNewer