Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Timer to Firebase and Implement Waves theme. #82

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@
import com.macbitsgoa.events.timeline.TimelineCardFragment;
import com.macbitsgoa.events.timer.TimerCardFragment;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
Expand Down Expand Up @@ -185,7 +186,7 @@ protected void onCreate(final Bundle savedInstanceState) {
}

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
public void onRequestPermissionsResult(int requestCode, @Nonnull String[] permissions, @Nonnull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode){
case My_Camera_Request_Code:{
Expand All @@ -206,7 +207,7 @@ private void initViews() {
}

@Override
public boolean onNavigationItemSelected(@NonNull final MenuItem menuItem) {
public boolean onNavigationItemSelected(@Nonnull final MenuItem menuItem) {

switch (menuItem.getItemId()) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.os.Bundle;
import android.os.CountDownTimer;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -10,10 +11,17 @@
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.drawee.view.SimpleDraweeView;
import com.google.android.material.card.MaterialCardView;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.macbitsgoa.events.BuildConfig;
import com.macbitsgoa.events.R;
import com.macbitsgoa.events.home.HomeCardInterface;

import org.w3c.dom.Text;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
Expand All @@ -28,7 +36,11 @@
public class TimerCardFragment extends Fragment
implements HomeCardInterface {


String endTime = "31.10.2019, 17:30:00";
TextView tv1, tv2;
SimpleDraweeView q19;
private static final String TAG = TimerCardFragment.class.getSimpleName();
CountDownTimer backcounter;

@Override
public View onCreateView(final LayoutInflater inflater,
Expand All @@ -37,15 +49,44 @@ public View onCreateView(final LayoutInflater inflater,
final MaterialCardView selfCard =
(MaterialCardView) inflater.inflate(R.layout.fragment_timer_card,
container, false);
final TextView tv1= (TextView) selfCard.findViewById(R.id.timer_text_day);
final TextView tv2= (TextView) selfCard.findViewById(R.id.timer_text_time);
final SimpleDraweeView q19= selfCard.findViewById(R.id.item_timer_image);
tv1= (TextView) selfCard.findViewById(R.id.timer_text_day);
tv2= (TextView) selfCard.findViewById(R.id.timer_text_time);
q19= selfCard.findViewById(R.id.item_timer_image);


DatabaseReference databaseReference;
databaseReference = FirebaseDatabase.getInstance().getReference().child("timer");

databaseReference.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
endTime = dataSnapshot.child("endTime").getValue().toString();
reconfigureClock(endTime);
Log.v(TAG,endTime);
}

@Override
public void onCancelled(DatabaseError databaseError) {
Log.e(TAG, databaseError.getMessage(), databaseError.toException());
}
});
Log.v(TAG,endTime+"chage");



return selfCard;
}

public void reconfigureClock(String endTime)
{
try
{backcounter.cancel();}
catch(Exception e)
{}

SimpleDateFormat formatter = new SimpleDateFormat("dd.MM.yyyy, HH:mm:ss");
formatter.setLenient(false);


String endTime = "31.01.2019, 17:30:00";
long milliseconds=0;
Date endDate;
try {
Expand All @@ -61,7 +102,7 @@ public View onCreateView(final LayoutInflater inflater,

long diff = milliseconds - startTime;

new CountDownTimer(diff,1) {
backcounter = new CountDownTimer(diff,1) {

@Override
public void onTick(long millis) {
Expand All @@ -82,7 +123,5 @@ public void onFinish() {
q19.setVisibility(View.VISIBLE);
}
}.start();

return selfCard;
}
}
Binary file added app/src/main/res/drawable-anydpi/bg2.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/src/main/res/drawable/animz.gif
Binary file not shown.
Binary file modified app/src/main/res/drawable/bg1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/src/main/res/drawable/bg2.jpeg
Binary file not shown.
Binary file added app/src/main/res/drawable/bg3.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 10 additions & 4 deletions app/src/main/res/drawable/splash.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
android:opacity="opaque"
>
<item android:drawable="@drawable/bg2" />
<item>
<item android:drawable="@drawable/bg2"
android:width="1080px"
android:height="1920px"
android:gravity="center"/>
<item android:drawable="@drawable/bg3"
android:width="1080px"
android:height="1920px"/>
<!--<item>
<bitmap
android:gravity="center"
android:src="@drawable/quark" />
</item>
android:src="@drawable/wc" />
</item>-->
</layer-list>
Binary file added app/src/main/res/drawable/wc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions app/src/main/res/layout/activity_about_app.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="0dp"
android:background="#00000000"
android:background="#FF230E00"
app:layout_scrollFlags="enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay">

Expand Down Expand Up @@ -67,8 +67,9 @@
android:layout_width="match_parent"
android:layout_height="160dp"
android:layout_gravity="center_horizontal"
android:foregroundGravity="center"
android:background="#00000000"
fresco:actualImageResource="@drawable/quarks"
fresco:actualImageResource="@drawable/wc"
fresco:actualImageScaleType="fitCenter"
tools:background="#00000000" />

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_about_mac.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
android:id="@+id/mac_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#00000000"
android:background="#FF230E00"
android:elevation="0dp"
app:layout_scrollFlags="enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay">
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_eateries.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/eateries_appbar"
android:background="#00000000"
android:background="#FF230E00"
android:elevation="0dp"
android:theme="@style/AppTheme.AppBarOverlay">

Expand All @@ -19,7 +19,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="0dp"
android:background="#00000000"
android:background="#FF230E00"
app:layout_scrollFlags="enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay">

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_festmerch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="0dp"
android:background="#00000000"
android:background="#FF230E00"
app:layout_scrollFlags="enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay">

Expand Down
19 changes: 15 additions & 4 deletions app/src/main/res/layout/activity_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="@drawable/bg2"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".home.HomeActivity">

Expand All @@ -36,7 +37,7 @@

android:layout_height="@dimen/action_bar_height"
android:elevation="0dp"
android:background="#00000000"
android:background="#FF230E00"
app:popupTheme="@style/AppTheme.PopupOverlay">

</androidx.appcompat.widget.Toolbar>
Expand All @@ -49,14 +50,24 @@
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<pl.droidsonroids.gif.GifImageView
<!--<pl.droidsonroids.gif.GifImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
android:scaleType="fitXY"
android:src="@drawable/animz"
/>

/>-->
<!--<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg2"
android:scaleType="fitXY" />-->
<com.facebook.drawee.view.SimpleDraweeView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00000000"
app:actualImageResource="@drawable/bg2"
app:actualImageScaleType="fitXY"/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_nights.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="0dp"
android:background="#00000000"
android:background="#FF230E00"
app:layout_scrollFlags="enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay">

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_profile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="0dp"
android:background="#00000000"
android:background="#FF230E00"
app:layout_scrollFlags="enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay">

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_social.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="0dp"
android:background="#00000000"
android:background="#FF230E00"
app:layout_scrollFlags="enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay">

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_speakers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="0dp"
android:background="#00000000"
android:background="#FF230E00"
app:layout_scrollFlags="enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay">

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_sponsor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="0dp"
android:background="#00000000"
android:background="#FF230E00"
app:layout_scrollFlags="enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay">

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_timeline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="0dp"
android:background="#00000000"
android:background="#FF230E00"
app:layout_scrollFlags="enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay">

Expand Down
15 changes: 8 additions & 7 deletions app/src/main/res/layout/fragment_timer_card.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="200dp"
android:orientation="vertical"
android:gravity="center"
android:paddingBottom="20dp"
Expand All @@ -31,8 +31,8 @@
android:id="@+id/timer_text_day"
android:text="@string/timer"
android:textAlignment="gravity"
android:textColor="#cecece"
android:textSize="60sp"
android:textColor="#FF301300"
android:textSize="55sp"
android:background="#00000000"
android:fontFamily="@font/bgothm"
android:layout_gravity="center"/>
Expand All @@ -43,22 +43,23 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/timer_text_time"
android:text="@string/timer"
android:text="@string/timersubtext"
android:textAlignment="gravity"
android:textColor="#cecece"
android:textColor="#FF301300"
android:textSize="50sp"
android:background="#00000000"
android:fontFamily="@font/bgothm"
android:layout_gravity="center"/>
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/item_timer_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="200dp"
app:roundedCornerRadius="0dp"
android:paddingHorizontal="22dp"
android:paddingBottom="22dp"
android:visibility="gone"
app:actualImageResource="@drawable/q19"
app:placeholderImage="@drawable/bg1"
app:actualImageResource="@drawable/wc"
/>
</LinearLayout>

Expand Down
22 changes: 17 additions & 5 deletions app/src/main/res/layout/nav_header_main.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="@dimen/nav_header_height"
android:layout_gravity="center"
android:orientation="vertical"
android:theme="@style/Theme.AppCompat.Light">

<ImageView
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/q19"
android:background="@drawable/bg1"
/>
android:layout_height="match_parent">
<!--<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg1"
android:src="@drawable/q19" />-->
<com.facebook.drawee.view.SimpleDraweeView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg1"
app:backgroundImage="@drawable/bg1"
app:actualImageResource="@drawable/wc"
app:actualImageScaleType="fitXY"/>
</FrameLayout>

</LinearLayout>
Loading