Skip to content

Commit

Permalink
Merge branch 'master' of github.com:IstrajI/Insight
Browse files Browse the repository at this point in the history
  • Loading branch information
IstrajI committed Jun 3, 2019
2 parents 1c14d64 + 60e3ad5 commit 4bfc6f1
Show file tree
Hide file tree
Showing 13 changed files with 611 additions and 29 deletions.
4 changes: 2 additions & 2 deletions MyApplication/dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
ext.versions = [

androidGradlePlugin : '3.3.1',
androidGradlePlugin : '3.4.0',
gradleVersionsPlugin : '0.14.0',
buildTools : '25.0.2',
compileSdk : 25,

moxy : '1.5.1',

butterKnife : '8.5.1',
butterKnife : '10.1.0',

supportLibs : '25.3.1',
supportConstraintLayout : '1.0.1',
Expand Down
4 changes: 4 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.npgames.insight"
minSdkVersion 16
Expand Down Expand Up @@ -53,4 +54,7 @@ dependencies {

implementation 'com.uncopt:android.justified:1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'

//MaterialTapTargetPrompt
implementation 'uk.co.samuelwall:material-tap-target-prompt:2.14.0'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
package com.npgames.insight.ui.all.fragments.infoDialog;

import android.app.ActionBar;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.npgames.insight.R;

import butterknife.BindView;
import butterknife.ButterKnife;

public class InfoDialog extends DialogFragment {
public static final String INFO_DIALOG_TAG = "INFO_DIALOG_TAG";
public static String MESSAGE = "MESSAGE";

@BindView(R.id.bottom_action_confirm_dialog_body_text_view)
protected TextView bodyTextView;
@BindView(R.id.bottom_action_confirm_dialog_deny_button_text_view)
protected TextView denyButtonTextView;


@Override
public void onStart() {
super.onStart();
getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT);
}

@Nullable
@Override
public View onCreateView(@NonNull final LayoutInflater inflater,
@Nullable final ViewGroup container,
@Nullable final Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.fragment_info_dialog, container);
ButterKnife.bind(this, view);
return view;
}

@Override
public void onViewCreated(@NonNull final View view, @Nullable final Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);

final String bodyText = getArguments().getString(MESSAGE);
bodyTextView.setText(bodyText);
denyButtonTextView.setOnTouchListener(denyButtonTouchListener);

getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
getDialog().setCancelable(false);
getDialog().setCanceledOnTouchOutside(false);
getDialog().setOnKeyListener((dialogInterface, i, keyEvent) -> {
/* if (i == KeyEvent.KEYCODE_BACK) {
deathDialogListener.onClose();
}*/

return true;
});
}

private View.OnTouchListener denyButtonTouchListener = new View.OnTouchListener() {
@Override
public boolean onTouch(final View view, final MotionEvent motionEvent) {
switch(motionEvent.getAction()) {
case MotionEvent.ACTION_DOWN:
final Drawable pressedDenyButton = getResources().getDrawable(R.drawable.confirm_dialog_button_active);
denyButtonTextView.setBackground(pressedDenyButton);
break;

case MotionEvent.ACTION_UP:
view.performClick();
dismiss();

case MotionEvent.ACTION_CANCEL:
final Drawable defaultDenyButton = getResources().getDrawable(R.drawable.confirm_dialog_button);
denyButtonTextView.setBackground(defaultDenyButton);

break;
}
return true;
}
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package com.npgames.insight.ui.book.top_panel;

import android.app.ActionBar;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.constraint.ConstraintLayout;
import android.support.constraint.ConstraintSet;
import android.support.v4.app.DialogFragment;
import android.support.v4.view.ViewCompat;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;

import com.npgames.insight.R;

import butterknife.BindView;
import butterknife.ButterKnife;

public class StatsInfoDialog extends DialogFragment {

public static final String STATS_INFO_DIALOG_TAG = "STATS_INFO_DIALOG_TAG";

@BindView(R.id.tip_dialog_root)
ConstraintLayout mConstraintLayout;

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

getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
}

@Nullable
@Override
public View onCreateView(final @NonNull LayoutInflater inflater, final @Nullable ViewGroup container,
final @Nullable Bundle savedInstanceState) {
final View statsInfoDialog = inflater.inflate(R.layout.fragment_tip_dialog, container);
ButterKnife.bind(this, statsInfoDialog);

final Window window = getDialog().getWindow();
WindowManager.LayoutParams windowParams = window.getAttributes();
windowParams.dimAmount = 0.0f;
window.setAttributes(windowParams);


final TextView textView = new TextView(getActivity());

ConstraintLayout.LayoutParams layoutParams = new ConstraintLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);

textView.setId(ViewCompat.generateViewId());
textView.setLayoutParams(layoutParams);

Log.d("TestPish", "width "+getArguments().getInt("WIDTH"));
Log.d("TestPish", "height "+getArguments().getInt("HEIGHT"));

Log.d("TestPish", "X "+getArguments().getFloat("X"));
Log.d("TestPish", "Y "+getArguments().getFloat("Y"));
/*
textView.setWidth(getArguments().getInt("WIDTH"));
textView.setHeight(getArguments().getInt("HEIGHT"));*/

textView.setLeft((int) getArguments().getFloat("X"));
textView.setTop((int) getArguments().getFloat("Y"));
textView.setTextAppearance(getContext(), R.style.D);
textView.setText(getArguments().getString("TEXT"));
textView.setTextSize(getArguments().getFloat("TEXT_SIZE"));

final ConstraintSet set = new ConstraintSet();
mConstraintLayout.addView(textView);
set.clone(mConstraintLayout);
set.connect(textView.getId(), ConstraintSet.TOP, mConstraintLayout.getId(), ConstraintSet.TOP, 0);
set.connect(textView.getId(), ConstraintSet.END, mConstraintLayout.getId(), ConstraintSet.END, 0);
set.applyTo(mConstraintLayout);

mConstraintLayout.invalidate();

return statsInfoDialog;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.npgames.insight.ui.book.top_panel;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.support.annotation.NonNull;

import uk.co.samuelwall.materialtaptargetprompt.extras.PromptOptions;
import uk.co.samuelwall.materialtaptargetprompt.extras.backgrounds.FullscreenPromptBackground;

public class TipPromptBackground extends FullscreenPromptBackground {

public TipPromptBackground() {

}

@Override
public void prepare(@NonNull PromptOptions options, boolean clipToBounds,
@NonNull Rect clipBounds) {
super.prepare(options, clipToBounds, clipBounds);


}

@Override
public void update(@NonNull PromptOptions prompt, float revealModifier, float alphaModifier) {
super.update(prompt, revealModifier, alphaModifier);
}

@Override
public void draw(@NonNull Canvas canvas) {
super.draw(canvas);

final RectF dimBounds = new RectF();
dimBounds.set(0, 0, getDisplayMetrics().widthPixels, getDisplayMetrics().heightPixels);

final Paint dimPaint = new Paint();
dimPaint.setColor(Color.BLACK);

canvas.drawRect(dimBounds, dimPaint);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package com.npgames.insight.ui.book.top_panel;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.support.annotation.NonNull;
import android.util.Log;
import android.view.View;

import uk.co.samuelwall.materialtaptargetprompt.extras.PromptFocal;
import uk.co.samuelwall.materialtaptargetprompt.extras.PromptOptions;

public class TipPromptFocal extends PromptFocal {
@Override
public void update(@NonNull PromptOptions options, float revealModifier, float alphaModifier) {

}

@Override
public void draw(final @NonNull Canvas canvas) {

final RectF dimBounds = new RectF();
dimBounds.set(left, top, left + width, top+height);

final Paint dimPaint = new Paint();
dimPaint.setColor(Color.RED);

canvas.drawRect(dimBounds, dimPaint);
}

@Override
public boolean contains(float x, float y) {
return false;
}

@Override
public void setColour(int colour) {

}

@NonNull
@Override
public RectF getBounds() {
return null;
}

private int width;
private int height;
private float left;
private float top;

@Override
public void prepare(final @NonNull PromptOptions options, final @NonNull View target,
final int[] promptViewPosition) {
Log.d("TestPish", "Ok counstructor");
width = target.getWidth();
height = target.getHeight();
left = target.getX();
top = target.getY();
}

@Override
public void prepare(@NonNull PromptOptions options, float targetX, float targetY) {
Log.d("TestPish", "NOT Ok constructor");

left = targetX;
top = targetY;

}

@Override
public void updateRipple(float revealModifier, float alphaModifier) {

}
}
Loading

0 comments on commit 4bfc6f1

Please sign in to comment.