-
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.
Merge branch 'master' of github.com:IstrajI/Insight
- Loading branch information
Showing
13 changed files
with
611 additions
and
29 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
91 changes: 91 additions & 0 deletions
91
app/src/main/java/com/npgames/insight/ui/all/fragments/infoDialog/InfoDialog.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,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; | ||
} | ||
}; | ||
} |
88 changes: 88 additions & 0 deletions
88
app/src/main/java/com/npgames/insight/ui/book/top_panel/StatsInfoDialog.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,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; | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
app/src/main/java/com/npgames/insight/ui/book/top_panel/TipPromptBackground.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,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); | ||
} | ||
} |
76 changes: 76 additions & 0 deletions
76
app/src/main/java/com/npgames/insight/ui/book/top_panel/TipPromptFocal.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,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) { | ||
|
||
} | ||
} |
Oops, something went wrong.