Commit dc570cbc authored by Luboš Horáček's avatar Luboš Horáček

Zoomování novinových článků

parent 60019eaa
......@@ -54,7 +54,7 @@ configurations {
repositories {
mavenCentral()
maven{url 'http://www.bugsense.com/gradle/'} // bugsense gradle repository
maven{url 'https://mint.splunk.com/gradle/'} // bugsense gradle repository
maven{url 'https://repository-achartengine.forge.cloudbees.com/snapshot/'} // achartengine repository
}
......@@ -70,7 +70,7 @@ dependencies {
compile 'com.android.support:support-v4:19.0.1'
//compile 'com.google.android.gms:play-services:4.+'
compile 'org.achartengine:achartengine:1.2.0'
compile 'com.bugsense.trace:bugsense:3.6'
compile "com.splunk.mint:mint:4.0.6"
compile 'com.google.code.gson:gson:2.2.4'
compile 'org.roboguice:roboguice:2.0'
compile 'org.apache.commons:commons-lang3:3.1'
......
<!--
Tablexia
Copyright (C) 2013 CZ NIC z.s.p.o. <podpora at nic dot cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:id="@+id/frame_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipChildren="false" >
<ImageView
android:id="@+id/imageView_column"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerInside"
android:src="@color/transparent" />
<cz.nic.tablexia.widget.RatioPositionTextView
android:id="@+id/newuseranim_bubble_beard"
android:layout_width="@dimen/newuseranim_newspaper_topicbubble_width"
android:layout_height="@dimen/newuseranim_newspaper_topicbubble_height"
android:background="@drawable/newuser_helpbubble_straight"
android:gravity="center"
android:minEms="2"
android:text="@string/newuseranim_topic_1"
android:textColor="@android:color/black"
android:textSize="@dimen/newuseranim_newspaper_topic_fontsize"
android:visibility="gone"
custom:displayRatioType="height"
custom:xPositionRatio="0.00"
custom:yPositionRatio="0.1" />
<cz.nic.tablexia.widget.RatioPositionTextView
android:id="@+id/newuseranim_bubble_balloon"
android:layout_width="@dimen/newuseranim_newspaper_topicbubble_width"
android:layout_height="@dimen/newuseranim_newspaper_topicbubble_height"
android:background="@drawable/newuser_helpbubble_straight"
android:gravity="center"
android:minEms="2"
android:text="@string/newuseranim_topic_2"
android:textColor="@android:color/black"
android:textSize="@dimen/newuseranim_newspaper_topic_fontsize"
android:visibility="gone"
custom:displayRatioType="height"
custom:xPositionRatio="0.00"
custom:yPositionRatio="0.1" />
<cz.nic.tablexia.widget.RatioPositionTextView
android:id="@+id/newuseranim_bubble_motocycle"
android:layout_width="@dimen/newuseranim_newspaper_topicbubble_width"
android:layout_height="@dimen/newuseranim_newspaper_topicbubble_height"
android:background="@drawable/newuser_helpbubble_straight"
android:gravity="center"
android:minEms="2"
android:text="@string/newuseranim_topic_3"
android:textColor="@android:color/black"
android:textSize="@dimen/newuseranim_newspaper_topic_fontsize"
android:visibility="gone"
custom:displayRatioType="height"
custom:xPositionRatio="0.00"
custom:yPositionRatio="0.1" />
<cz.nic.tablexia.widget.RatioPositionTextView
android:id="@+id/newuseranim_bubble_swimsuit"
android:layout_width="@dimen/newuseranim_newspaper_topicbubble_width"
android:layout_height="@dimen/newuseranim_newspaper_topicbubble_height"
android:background="@drawable/newuser_helpbubble_straight"
android:gravity="center"
android:minEms="2"
android:text="@string/newuseranim_topic_4"
android:textColor="@android:color/black"
android:textSize="@dimen/newuseranim_newspaper_topic_fontsize"
android:visibility="gone"
custom:displayRatioType="height"
custom:xPositionRatio="0.00"
custom:yPositionRatio="0.1" />
<cz.nic.tablexia.widget.RatioPositionTextView
android:id="@+id/newuseranim_bubble_detective"
android:layout_width="@dimen/newuseranim_newspaper_topicbubble_width"
android:layout_height="@dimen/newuseranim_newspaper_topicbubble_height"
android:background="@drawable/newuseranim_detectiveoffice_bubble"
android:gravity="center"
android:minEms="2"
android:text="@string/newuseranim_topic_5"
android:textColor="@android:color/black"
android:textSize="@dimen/newuseranim_newspaper_topic_fontsize"
android:visibility="gone"
custom:displayRatioType="height"
custom:xPositionRatio="0.00"
custom:yPositionRatio="0.1" />
</RelativeLayout>
\ No newline at end of file
......@@ -40,7 +40,7 @@ import android.widget.RelativeLayout;
import com.activeandroid.ActiveAndroid;
import com.activeandroid.util.Log;
import com.android.vending.expansion.zipfile.ZipResourceFile;
import com.bugsense.trace.BugSenseHandler;
import com.splunk.mint.Mint;
import cz.nic.tablexia.audio.SoundControl;
import cz.nic.tablexia.export.ExportControl;
......@@ -138,7 +138,7 @@ public class Tablexia extends com.activeandroid.app.Application {
try {
zipResourceFile = new ZipResourceFile(ObbHelper.getExpansionFileName(this, true));
} catch (IOException e) {
BugSenseHandler.sendException(e);
Mint.logException(e);
}
globalSoundControl.loadPermanentSounds();
}
......
......@@ -87,7 +87,7 @@ import cz.nic.tablexia.menu.usermenu.User;
import cz.nic.tablexia.trophy.GameTrophy;
import cz.nic.tablexia.trophy.TrophyEnum;
import cz.nic.tablexia.trophy.UserTrophyDefinition;
import cz.nic.tablexia.util.BugSenseHelper;
import cz.nic.tablexia.util.MintHelper;
import cz.nic.tablexia.widget.TablexiaDrawerLayout;
import cz.nic.tablexia.widget.TablexiaQuestionBannerDialog;
......@@ -395,7 +395,7 @@ public abstract class GameActivity extends LayoutGameActivity implements MenuAct
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
BugSenseHelper.startBugSense(this);
MintHelper.startBugSense(this);
getTablexiaContext().setCurreActivity(this);
getTablexiaContext().hideScreenContentFast(false);
......
/*******************************************************************************
* Tablexia
*
*
* Copyright (C) 2013 CZ NIC z.s.p.o. <podpora at nic dot cz>
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
......@@ -37,7 +37,7 @@ import android.media.MediaPlayer.OnCompletionListener;
import android.os.AsyncTask;
import com.activeandroid.util.Log;
import com.bugsense.trace.BugSenseHandler;
import com.splunk.mint.Mint;
import cz.nic.tablexia.Tablexia;
import cz.nic.tablexia.game.games.unos.UnosActivity;
......@@ -106,7 +106,7 @@ public class MfxManager {
/**
* Prehraje zvuk z enumu, ktery muze byt preloadovan
*
*
* @param sound
* @param onCompletionListener
*/
......@@ -127,7 +127,7 @@ public class MfxManager {
/**
* Prehraje zvuk z assetu definovany nazvem souboru
*
*
* @param sound
* @param onCompletionListener
*/
......@@ -137,7 +137,7 @@ public class MfxManager {
/**
* Prehraje zvuk z assetu definovany nazvem souboru, pokud je parametr isRetry true, tak uz se nepokusi prehrat pri chybe znovu
*
*
* @param sound
* @param onCompletionListener
*/
......@@ -162,7 +162,7 @@ public class MfxManager {
e.printStackTrace();
if (!isRetry) {
// FIX hack propripad chyby prehravani zvuku
BugSenseHandler.sendException(e);
Mint.logException(e);
new AsyncTask<Void, Void, Void>() {
@Override
......@@ -179,10 +179,10 @@ public class MfxManager {
sound.play();
} catch (SoundReleasedException e1) {
e1.printStackTrace();
BugSenseHandler.sendException(e1);
Mint.logException(e1);
} catch (IOException e1) {
e1.printStackTrace();
BugSenseHandler.sendException(e1);
Mint.logException(e1);
}
try {
......
......@@ -49,7 +49,7 @@ import cz.nic.tablexia.menu.mainmenu.screen.AbstractMenuFragment.MenuFragmentVis
import cz.nic.tablexia.menu.mainmenu.screen.LoaderFragment;
import cz.nic.tablexia.menu.usermenu.User;
import cz.nic.tablexia.newusers.fragment.AnimationContainerFragment;
import cz.nic.tablexia.util.BugSenseHelper;
import cz.nic.tablexia.util.MintHelper;
import cz.nic.tablexia.util.MediaPlayerHelper;
import cz.nic.tablexia.widget.TablexiaDrawerLayout;
......@@ -81,7 +81,7 @@ public class MainActivity extends FragmentActivity implements MenuActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
BugSenseHelper.startBugSense(this);
MintHelper.startBugSense(this);
getTablexiaContext().setCurreActivity(this);
if (savedInstanceState != null) {
getTablexiaContext().restore();
......
......@@ -21,7 +21,7 @@ package cz.nic.tablexia.menu.usermenu;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.support.v4.app.FragmentActivity;
import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
......@@ -163,9 +163,9 @@ public class UserMenu extends AbstractMenu implements OnItemClickListener, OnIte
protected int getBannerResource() {
return R.drawable.dialog_banner_pozor;
}
}.show(((FragmentActivity) tablexiaContext.getCurrentMenuActivity()).getFragmentManager(), null);
}.show(((Activity) tablexiaContext.getCurrentMenuActivity()).getFragmentManager(), null);
};
}.show(((FragmentActivity) tablexiaContext.getCurrentMenuActivity()).getFragmentManager(), null);
}.show(((Activity) tablexiaContext.getCurrentMenuActivity()).getFragmentManager(), null);
return true;
}
......
......@@ -30,7 +30,7 @@ import android.view.View;
import cz.nic.tablexia.R;
import cz.nic.tablexia.Tablexia;
import cz.nic.tablexia.newusers.fragment.NewUserFormFragment;
import cz.nic.tablexia.util.BugSenseHelper;
import cz.nic.tablexia.util.MintHelper;
import cz.nic.tablexia.util.Utility;
import cz.nic.tablexia.widget.TablexiaQuestionBannerDialog;
......@@ -46,7 +46,7 @@ public class NewUserActivity extends RoboFragmentActivity {
Log.i(TAG, "onCreate");
super.onCreate(savedInstance);
// init bugsense
BugSenseHelper.startBugSense(this);
MintHelper.startBugSense(this);
setContentView(R.layout.newuser_activity);
findViewById(R.id.newuser_hiderLayer).setVisibility(View.VISIBLE);
if (savedInstance == null) {
......
/**
*
*/
package cz.nic.tablexia.newusers.fragment;
import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import cz.nic.tablexia.R;
import cz.nic.tablexia.widget.TablexiaDialog;
/**
* @author lhoracek
*/
public class NewspaperDialog extends TablexiaDialog {
public static final String BUBBLE_KEY = "VIEW_TEXT_BUBBLE";
public static final String IMAGE_KEY = "IMAGE_CONTENT";
public static final String DETECTIVE_KEY = "DETECTIVE";
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final Dialog dialog = super.onCreateDialog(savedInstanceState);
return dialog;
}
@Override
protected int getLayourId() {
return R.layout.newuser_dialog_newspaper;
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
int idBubble = getArguments().getInt(BUBBLE_KEY);
int idImage = getArguments().getInt(IMAGE_KEY);
view.findViewById(idBubble).setVisibility(View.VISIBLE);
ImageView iv = (ImageView) view.findViewById(R.id.imageView_column);
iv.setImageResource(idImage);
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
boolean detective = getArguments().getBoolean(DETECTIVE_KEY);
if (detective) {
LocalBroadcastManager.getInstance(getActivity()).sendBroadcast(new Intent("cz.nic.tablexia.action.SLIDE_NEWSPAPER"));
}
}
});
}
}
/*******************************************************************************
* Tablexia
*
*
* Copyright (C) 2013 CZ NIC z.s.p.o. <podpora at nic dot cz>
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
......@@ -22,6 +22,7 @@ package cz.nic.tablexia.newusers.fragment;
import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
import android.animation.AnimatorListenerAdapter;
import android.app.DialogFragment;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
......@@ -196,36 +197,45 @@ public class NewspaperFragment extends Fragment implements OnTouchListener, OnCl
Log.d("R: " + Color.red(pixel) + " G: " + Color.green(pixel) + " B: " + Color.blue(pixel));
// CERNA-inzerat detektiv
if ((Color.red(pixel) == 0) && (Color.blue(pixel) == 0) && (Color.green(pixel) == 0) && (Color.alpha(pixel) == 255)) {
topicDetective.setVisibility(View.VISIBLE);
MediaPlayerHelper.playSound("newuser/mfx/noviny_tobymohlobyt.mp3", true, getActivity());
detectveBubbleOn = true;
// ZLUTA-plavky
} else if ((Color.red(pixel) == 255) && (Color.green(pixel) == 255)) {
Log.d("YELLOW");
topicSwimwear.setVisibility(View.VISIBLE);
MediaPlayerHelper.playSound("newuser/mfx/noviny_nakoupanibude.mp3", true, getActivity());
// MODRA-motokolo
} else if (Color.blue(pixel) == 255) {
Log.d("BLUE");
topicMotocycle.setVisibility(View.VISIBLE);
MediaPlayerHelper.playSound("newuser/mfx/noviny_peknyalekde.mp3", true, getActivity());
// CERVENA - vousy
} else if (Color.red(pixel) == 255) {
Log.d("RED");
topicBeard.setVisibility(View.VISIBLE);
MediaPlayerHelper.playSound("newuser/mfx/noviny_radsisipockam.mp3", true, getActivity());
// ZELENA - vzduchoplavec
} else if (Color.green(pixel) == 255) {
Log.d("GREEN");
topicBalloon.setVisibility(View.VISIBLE);
MediaPlayerHelper.playSound("newuser/mfx/noviny_tenpriletiaz.mp3", true, getActivity());
} else {
hideAllTopics();
}
if (event.getAction() == MotionEvent.ACTION_DOWN) {
// CERNA-inzerat detektiv
if ((Color.red(pixel) == 0) && (Color.blue(pixel) == 0) && (Color.green(pixel) == 0) && (Color.alpha(pixel) == 255)) {
showNewspaperDialog(R.drawable.newuser_noviny_detail05, R.id.newuseranim_bubble_detective, true);
// topicDetective.setVisibility(View.VISIBLE);
MediaPlayerHelper.playSound("newuser/mfx/noviny_tobymohlobyt.mp3", true, getActivity());
// detectveBubbleOn = true;
// ZLUTA-plavky
} else if ((Color.red(pixel) == 255) && (Color.green(pixel) == 255)) {
Log.d("YELLOW");
showNewspaperDialog(R.drawable.newuser_noviny_detail04, R.id.newuseranim_bubble_swimsuit);
// topicSwimwear.setVisibility(View.VISIBLE);
MediaPlayerHelper.playSound("newuser/mfx/noviny_nakoupanibude.mp3", true, getActivity());
// MODRA-motokolo
} else if (Color.blue(pixel) == 255) {
Log.d("BLUE");
showNewspaperDialog(R.drawable.newuser_noviny_detail03, R.id.newuseranim_bubble_motocycle);
// topicMotocycle.setVisibility(View.VISIBLE);
MediaPlayerHelper.playSound("newuser/mfx/noviny_peknyalekde.mp3", true, getActivity());
// CERVENA - vousy
} else if (Color.red(pixel) == 255) {
Log.d("RED");
showNewspaperDialog(R.drawable.newuser_noviny_detail01, R.id.newuseranim_bubble_beard);
// topicBeard.setVisibility(View.VISIBLE);
MediaPlayerHelper.playSound("newuser/mfx/noviny_radsisipockam.mp3", true, getActivity());
// ZELENA - vzduchoplavec
} else if (Color.green(pixel) == 255) {
Log.d("GREEN");
showNewspaperDialog(R.drawable.newuser_noviny_detail02, R.id.newuseranim_bubble_balloon);
// topicBalloon.setVisibility(View.VISIBLE);
MediaPlayerHelper.playSound("newuser/mfx/noviny_tenpriletiaz.mp3", true, getActivity());
} else {
hideAllTopics();
}
return true;
return true;
}
return false;
}
});
......@@ -284,6 +294,22 @@ public class NewspaperFragment extends Fragment implements OnTouchListener, OnCl
return pageLayout;
}
private void showNewspaperDialog(int imageResource, int bubbleId) {
showNewspaperDialog(imageResource, bubbleId, false);
}
private void showNewspaperDialog(int imageResource, int bubbleId, boolean detective) {
DialogFragment newDialogFragment = new NewspaperDialog();
Bundle bundle = new Bundle();
bundle.putInt(NewspaperDialog.BUBBLE_KEY, bubbleId);
bundle.putInt(NewspaperDialog.IMAGE_KEY, imageResource);
bundle.putBoolean(NewspaperDialog.DETECTIVE_KEY, detective);
newDialogFragment.setArguments(bundle);
newDialogFragment.show(getActivity().getFragmentManager(), NewspaperDialog.class.getName());
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
......@@ -327,8 +353,8 @@ public class NewspaperFragment extends Fragment implements OnTouchListener, OnCl
nPAnim.setDuration(500);
Animation ani = new RotateAnimation(0, /* from degree */
360, /* to degree */
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
360, /* to degree */
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
ani.setDuration(100);
ani.setFillAfter(false);
ani.setRepeatCount(10);
......@@ -668,7 +694,7 @@ public class NewspaperFragment extends Fragment implements OnTouchListener, OnCl
}
};
//TODO obnovit v onResume
// TODO obnovit v onResume
@Override
public void onPause() {
stopFingersAnimation();
......
/**
*
*
*/
package cz.nic.tablexia.util;
import android.content.Context;
import com.bugsense.trace.BugSenseHandler;
import com.splunk.mint.Mint;
import cz.nic.tablexia.Tablexia;
/**
* @author lhoracek
*/
public class BugSenseHelper {
public class MintHelper {
public static void startBugSense(Context context) {
if (Tablexia.BUGSENSE_ENABLED) {
BugSenseHandler.initAndStartSession(context, Tablexia.BUGSENSE_KEY);
Mint.initAndStartSession(context, Tablexia.BUGSENSE_KEY);
}
}
}
/*******************************************************************************
* Tablexia
*
*
* Copyright (C) 2013 CZ NIC z.s.p.o. <podpora at nic dot cz>
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
......@@ -77,7 +77,9 @@ public abstract class TablexiaDialog extends DialogFragment {
View view = inflater.inflate(getLayourId(), null);
View backgroundView = view.findViewById(R.id.tablexiadialog_content);
backgroundView.setBackgroundResource(getBackgroundResource());
if (backgroundView != null) {
backgroundView.setBackgroundResource(getBackgroundResource());
}
prepareDialogContent(inflater, (ViewGroup) view.findViewById(R.id.tablexiadialog_content));
......@@ -93,7 +95,9 @@ public abstract class TablexiaDialog extends DialogFragment {
}
protected void prepareDialogContent(LayoutInflater inflater, ViewGroup contenView) {
addTextView(inflater, contenView);
if (contenView != null) {
addTextView(inflater, contenView);
}
/*
* FIX proč připravujeme textView, pro který ani nevíme text, pro někoho kdo to chce rozšířit je to nečekané chování
* Buď to má mít abstraktní funkce, které mě donutí to implementovat (getTextResource, getTextString), nebo to dělá na pozadí magii.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment