Browse Source

Removed double tap to exit, up gradle

pull/71/merge
Ezerous 4 years ago
parent
commit
916e8734a0
  1. 16
      app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java
  2. 2
      build.gradle
  3. 4
      gradle/wrapper/gradle-wrapper.properties

16
app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java

@ -5,8 +5,6 @@ import android.content.SharedPreferences;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast; import android.widget.Toast;
import androidx.appcompat.app.AppCompatDelegate; import androidx.appcompat.app.AppCompatDelegate;
@ -52,10 +50,8 @@ import static gr.thmmy.mthmmy.activities.topic.TopicActivity.BUNDLE_TOPIC_URL;
public class MainActivity extends BaseActivity implements RecentFragment.RecentFragmentInteractionListener, ForumFragment.ForumFragmentInteractionListener, UnreadFragment.UnreadFragmentInteractionListener { public class MainActivity extends BaseActivity implements RecentFragment.RecentFragmentInteractionListener, ForumFragment.ForumFragmentInteractionListener, UnreadFragment.UnreadFragmentInteractionListener {
//-----------------------------------------CLASS VARIABLES------------------------------------------ //-----------------------------------------CLASS VARIABLES------------------------------------------
private static final int TIME_INTERVAL = 2000;
private SharedPreferences sharedPrefs; private SharedPreferences sharedPrefs;
private static final String DRAWER_INTRO = "DRAWER_INTRO"; private static final String DRAWER_INTRO = "DRAWER_INTRO";
private long mBackPressed;
private SectionsPagerAdapter sectionsPagerAdapter; private SectionsPagerAdapter sectionsPagerAdapter;
private ViewPager viewPager; private ViewPager viewPager;
private TabLayout tabLayout; private TabLayout tabLayout;
@ -138,17 +134,9 @@ public class MainActivity extends BaseActivity implements RecentFragment.RecentF
@Override @Override
public void onBackPressed() { public void onBackPressed() {
if (drawer.isDrawerOpen()) { if (drawer.isDrawerOpen())
drawer.closeDrawer(); drawer.closeDrawer();
return; super.onBackPressed();
} else if (mBackPressed + TIME_INTERVAL > System.currentTimeMillis()) {
super.onBackPressed();
return;
} else {
Toast.makeText(BaseApplication.getInstance().getApplicationContext(), "Press back again to exit!"
, Toast.LENGTH_SHORT).show();
}
mBackPressed = System.currentTimeMillis();
} }
@Override @Override

2
build.gradle

@ -8,7 +8,7 @@ buildscript {
maven { url "https://jitpack.io" } maven { url "https://jitpack.io" }
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:4.0.1' classpath 'com.android.tools.build:gradle:4.1.1'
classpath 'com.google.gms:google-services:4.3.3' classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0'
classpath 'org.ajoberstar.grgit:grgit-core:3.1.1' // Also change in app/gradle/grgit.gradle classpath 'org.ajoberstar.grgit:grgit-core:3.1.1' // Also change in app/gradle/grgit.gradle

4
gradle/wrapper/gradle-wrapper.properties

@ -1,6 +1,6 @@
#Mon Jul 20 13:59:13 EEST 2020 #Wed Nov 11 12:38:13 EET 2020
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip

Loading…
Cancel
Save