« first day (1 day earlier)    last day (14 days later) » 

12:20 PM
Hello there @LunarWatcher
Are you free at the moment?
 
Yeah, I'm here
 
Super :) Lunar did I implement it right?
 
looks like it
 
so now the next step is this method class ScaleListener implements ScaleGestureDetector.OnScaleGestureListener?
 
12:37 PM
no, you activate the instance of Scaler and ScaleListener
initialize*
 
maybe you can give me some more info on how to do it?
 
Look in the answer, it is all there
 
1:14 PM
please just give me a hint. i can't find it.
is it this contructor? `listener = new ScaleListener();
s = new Scaler(c, listener);`
if so, do i put it in onCreate?
 
1:43 PM
In onCreate, yes
 
so this constructor initializes these two instances?
 
great:) what is the next?
(i'm really sorry Lunar for bothering you ,i just can't do it on my own.. i'm still learning)
 
Did you add the code into onTouch? (See the answer for the code to put in there)
 
 @Override
    public boolean onTouch(View v, MotionEvent event) {

        int pointers = ev.getPointerCount();

        if(pointers == 2) {
            zoom = true;
            s.onTouchEvent(ev);
        }
        return true;
}
 
1:54 PM
good. And the onTouchListener is set?
f yes you shouls be good to go (meaning you can test it)
 
let's go back a bit. should i set this onTouch in onCreate?
and i'm trying to set this onTouchListener but no luck so far :(
and this class class ScaleListener implements ScaleGestureDetector.OnScaleGestureListener not yet implemented
and this too
TextView rootView;
rootView.setScaleX(sx);
rootView.setScaleY(sx);
not yet implemented.
 
copy it in
make the fragment/activity implement View.onTouchListener
and make sure you set scale on the view you want to zoom. IT can be a textview or a RelativeLayout
 
public class MainActivity extends AppCompatActivity implements View.OnTouchListener... forgot i have it like this.
just wanna go back with you to onTouch. should it be in onCreate?
 
2:22 PM
Here I have these fields all in red
TextView rootView;
        rootView.setScaleX(sx);
        rootView.setScaleY(sx);
Here I have (sx) red. Don't know how to set it
TextView rootView;
        rootView.setScaleX(sx);
        rootView.setScaleY(sx);
Here I have in red both
listener = new ScaleListener();
        s = new Scaler(c, listener);
Here I have ev zoom and onTouchEvent red
@Override
    public boolean onTouch(View v, MotionEvent event) {

        int pointers = ev.getPointerCount();

        if(pointers == 2) {
            zoom = true;
            s.onTouchEvent(ev);
        }
        return true;
    }
And it is outside of onCreate
That's all I have so far from your post.
And this class isn't in my code yet -
class ScaleListener implements ScaleGestureDetector.OnScaleGestureListener
should this TextView rootView; rootView..... be in onCreate?
jesus, sooooo many doubts and questions :(
 
2:52 PM
sx and sy is not a part of the solution
It is just to show how scaling can be done
Look in ScaleListener and change the references there;
c is a context, if you are in a fragment, use getActivity() or getContext()
 
3:13 PM
Now I have it all in my code. But plenty of red color too.
If you had some time maybe we could go over it together?
 
If you hover over the different ones and try to eliminate some of them first yourself (when you hover over the error, you get to see what the error is). If there is something that doesn't make sense, write the error and where it is an error here and I can help you with
it
 
Thank you Lunar.Most of them are 'Can not resolve symbol`
But how to 'hover over' them ? Using debugging or...?
 
3:30 PM
You take the cursor over the red text
and hold it there until the error pops up in the IDE
 
So these three fields are red (can't find any solution)
private scaleFactor =1f;
    private Scaler s;
    private ScaleListener listener;
 
hm...
oh I see
the first field has to be written as:
private long scaleFactor = 1f;
you forgot to declare the tye
 
private long scaleFactor =1f; (now it says incompatible types - required long found float
 
oh, sorry. replace long with float (I messed up)
 
private boolean Scaler s; (ok?)
these two left
private Scaler s;
    private ScaleListener listener;
 
3:45 PM
do not write private boolean SCaler. Scaler is the type here
Are you hovering over the red text? What does it say?
 
Can not resolve symbol
in both cases.
 
s or scaler?
oh I think I know the problem
actually, nvm
pastebin.com - create a new paste with your entire class as it currently is. Copy-paste the entire class into there(you can change privacy to link only and set it to expire after 10 minutes(or more) if you want to, just for long enough for me to see it)
 
I see what you did wrong now
I think
 
uff, great :)
 
3:58 PM
Firstly, remove this:
TextView rootView;
rootView.setScaleX(sx);
rootView.setScaleY(sx);
 
done.
 
Secondly, Scaler and ScaleListener should not be in onCreate. Consider you are creating a new method. You do not put it inside an existing method. Put it outside any methods, but inside the class
 
done.
 
How are thsoe error looking now?
 
Now inside onTouch we have both ev and zoom Can not reslove method
Here we have c in red
s = new Scaler(c, listener);
and in class ScaleListener... we have tv in red Can not resolve symbol
That is all.
 
4:06 PM
c is red but it is supposed to be a context. use getActivity() or getContext instead
 
getApplicationContext works. Others two can not find in the list shown
So we have onTouch left and class ScaleListener.....
 
tv.setScale and those, is that where the errors are?
 
yes. tv is in red.
Can not resolve symbol tv
ev and zoom - 'Can not resolve symbol'
 
replace tv with the view you want to zoom
view being a textview or the root layout. It is up to you
replace ev with event
and remove zoom = true(copy-paste leftover from my project)
 
relativeLayout (?)
 
4:18 PM
If you want to, yes
 
like so relativeLayout.setScaleX(scaleFactor);?
it still gives red.
This is the last error. the rest we have ok.
 
what does the error say?
 
Cannot resolve symbol tv and the same for relativeLayout
 
hav eyou declared the relativelayout in the calss?
class*
 
implements RelativeLayout in this line?
public class MainActivity extends AppCompatActivity implements View.OnTouchListener
 
4:27 PM
no
 
setContentView(R.layout.activity_main);
 
like you write private long scaleFactor earlier, you now write private RelativeLayout relativeLayout
 
there?
ok
 
then in onCreate you write relativeLayout = (RelativeLayout) findViewById(R.id.yourIdHere);
 
so it means i have to create a field, right?
protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        buttonCheckAnswer = (Button) findViewById(R.id.button_check_answers);
        relativeLayout = (RelativeLayout) findViewById(R.id.activity_main);
like this?
public class MainActivity extends AppCompatActivity implements View.OnTouchListener {

    private static final int NUMBER_OF_QUESTIONS = 3;
    static boolean[] answer = new boolean[NUMBER_OF_QUESTIONS];
    static boolean[] checked = new boolean[NUMBER_OF_QUESTIONS];
    static boolean[] isAnswered = new boolean[NUMBER_OF_QUESTIONS];
    private float scaleFactor =1f;
    private Scaler s;
    private ScaleListener listener;
    private RelativeLayout relativeLayout;
 
4:33 PM
yes
 
Ok Lunar. I've just changed for this because I relized that my fragments have framelayout
FrameLayout = (FrameLayout) findViewById(R.id.fragment_container);
no error. running?:) keep your fingers crossed :)
 
I will be going for a while (dinner), so I will be unavailable for roughly 45 min to 1.5 hours
 
Ok. enjoy ur meal :)
 
5:39 PM
So I ran but got info on start 'Aplication has stoped. Mayby the reason of it is because I called (R.id.fragment_container);`twice
 FrameLayout = (FrameLayout) findViewById(R.id.fragment_container);


        viewPager = (ViewPager) findViewById(R.id.fragment_container);
 
6:25 PM
set the scale and such on viewPager instead
 
so how to exactly do it?
ok...i thing i got it..one second:)
think*
ok, done. will run now
 
6:44 PM
Ok. I ran it, but nothing has changed. I can not zoom in/out at all. It is as it had been before we've implemented this whole code.
 
did you set the onTouchListener for the FrameLayout?
 
how to set it?
 
Wait
The root layout isn't a framelayout it is a ViewPager
should not matter from a quick test
you write viewPager.setOnTouchListener(this);
 
Ok, let's run.
So when we used this code the app didn't even start.
 FrameLayout = (FrameLayout) findViewById(R.id.fragment_container);


        viewPager = (ViewPager) findViewById(R.id.fragment_container);
but now whith your newest solution it works but when i zoom in the very first page
with*
 
7:06 PM
So everything works?
 
1. it zooms out way beyond the screen size (original settings)..can we set it to be zoomed back max to the regular possition (as normal when you run it)
and second thing
when i zoom in or out the first fragment i cant go to the next one anymore
i mean i can't swipe page.
 
You can change that. In ScaleListener, change the if-statement where it says if(scaleFactor < 0.3f) scaleFactor = 0.3f; and change it to if(scaleFactor < 1.0f) scaleFactor = 1.0f;
 
to what values?
 
1.0f is the initial scale
 
so
else if (scaleFactor < 0)
else if (scaleFactor < 0f)
 
7:09 PM
no
1 min ago, by LunarWatcher
You can change that. In ScaleListener, change the if-statement where it says if(scaleFactor < 0.3f) scaleFactor = 0.3f; and change it to if(scaleFactor < 1.0f) scaleFactor = 1.0f;
 
ok Lunar. now i see it.
 
meaning you highlight the scaleFactor < 0.3f and paste the new ifStatement in teh comment above
 
else if (scaleFactor < 1.0f) scaleFactor = 1.0f;
 
yes
but remove the initial 0.3 if-statement
 
like so
            if (scaleFactor > 2) scaleFactor = 2;//Limit to your liking
            else if (scaleFactor < 1.0f) scaleFactor = 1.0f;//Limit to your liking
            scaleFactor = (scaleFactor * 100) /
great. it works. so this part we have set?
 
7:19 PM
what do you mean "so this part we have set?"
 
thi zoom out.
this*
i replaced it with this line and it works well else if (scaleFactor < 1.0f) scaleFactor = 1.0f;
 
yes, it is because it disallows the scaleFactor from going below 1f, which is having no zoom
 
Lunar, when I zoom out I also get shaky picture... - i mean it doesn't zoom out smoothly...
and when it is zoomed out I can not go in any way - let's say top right corrner or any other way
 
7:36 PM
maybe this shaky zoom is because of my phone?
 
7:54 PM
Lunar, if you can not work on it now, there is no rush. I'll wait.
I'll go back here on the 30th of May. Hopefully you will be here too. Will you?
 
8:07 PM
Till then. THANK YOU VERY MUCH FOR YOUR GREAT HELP AND SUPPORT! I really hope to meet you here again. If there is any way I can thank you, just let me know.
I have to go now. Have a good night. And see you here again.
 
8:37 PM
Sorry for not responding earlier, had a discussion with someone that ended up with me getting temporarily banned from chat for 30 minutes. (The other guy ended up with a 1 month ban from SO and lsot all repo though). I will see you at the end of may then, ping me when you get in
 

« first day (1 day earlier)    last day (14 days later) »