|
@ -11,8 +11,10 @@ import android.view.LayoutInflater; |
|
|
import android.view.View; |
|
|
import android.view.View; |
|
|
import android.webkit.WebView; |
|
|
import android.webkit.WebView; |
|
|
import android.widget.FrameLayout; |
|
|
import android.widget.FrameLayout; |
|
|
|
|
|
import android.widget.ImageView; |
|
|
import android.widget.ScrollView; |
|
|
import android.widget.ScrollView; |
|
|
import android.widget.TextView; |
|
|
import android.widget.TextView; |
|
|
|
|
|
import android.widget.Toast; |
|
|
|
|
|
|
|
|
import androidx.appcompat.app.AlertDialog; |
|
|
import androidx.appcompat.app.AlertDialog; |
|
|
import androidx.coordinatorlayout.widget.CoordinatorLayout; |
|
|
import androidx.coordinatorlayout.widget.CoordinatorLayout; |
|
@ -23,6 +25,7 @@ import com.google.android.material.appbar.AppBarLayout; |
|
|
import gr.thmmy.mthmmy.BuildConfig; |
|
|
import gr.thmmy.mthmmy.BuildConfig; |
|
|
import gr.thmmy.mthmmy.R; |
|
|
import gr.thmmy.mthmmy.R; |
|
|
import gr.thmmy.mthmmy.base.BaseActivity; |
|
|
import gr.thmmy.mthmmy.base.BaseActivity; |
|
|
|
|
|
import gr.thmmy.mthmmy.base.BaseApplication; |
|
|
|
|
|
|
|
|
public class AboutActivity extends BaseActivity { |
|
|
public class AboutActivity extends BaseActivity { |
|
|
private static final int TIME_INTERVAL = 1000; |
|
|
private static final int TIME_INTERVAL = 1000; |
|
@ -32,8 +35,9 @@ public class AboutActivity extends BaseActivity { |
|
|
|
|
|
|
|
|
private AppBarLayout appBar; |
|
|
private AppBarLayout appBar; |
|
|
private CoordinatorLayout coordinatorLayout; |
|
|
private CoordinatorLayout coordinatorLayout; |
|
|
|
|
|
private ScrollView mainContent; |
|
|
private AlertDialog alertDialog; |
|
|
private AlertDialog alertDialog; |
|
|
private FrameLayout trollGif; |
|
|
private FrameLayout easterEggImage; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
protected void onCreate(Bundle savedInstanceState) { |
|
|
protected void onCreate(Bundle savedInstanceState) { |
|
@ -70,33 +74,15 @@ public class AboutActivity extends BaseActivity { |
|
|
createDrawer(); |
|
|
createDrawer(); |
|
|
drawer.setSelection(ABOUT_ID); |
|
|
drawer.setSelection(ABOUT_ID); |
|
|
|
|
|
|
|
|
final ScrollView mainContent = findViewById(R.id.scrollview); |
|
|
mainContent = findViewById(R.id.scrollview); |
|
|
trollGif = findViewById(R.id.trollPicFrame); |
|
|
easterEggImage = findViewById(R.id.trollPicFrame); |
|
|
|
|
|
|
|
|
TextView tv = findViewById(R.id.version); |
|
|
// Set Easter egg on logo image
|
|
|
if (tv != null) { |
|
|
ImageView logoImageView = findViewById(R.id.logoView); |
|
|
if (BuildConfig.DEBUG) |
|
|
logoImageView.setOnClickListener(view -> { |
|
|
tv.setText(getString(R.string.version, versionName + versionInfo)); |
|
|
|
|
|
else |
|
|
|
|
|
tv.setText(getString(R.string.version, versionName)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(BuildConfig.DEBUG && gitExists){ |
|
|
|
|
|
tv.setOnClickListener(view -> { |
|
|
|
|
|
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/ThmmyNoLife/mTHMMY/commit/" + BuildConfig.COMMIT_HASH)); |
|
|
|
|
|
startActivity(intent); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
else{ // Easter Egg
|
|
|
|
|
|
tv.setOnClickListener(view -> { |
|
|
|
|
|
if (mVersionLastPressedTime + TIME_INTERVAL > System.currentTimeMillis()) { |
|
|
if (mVersionLastPressedTime + TIME_INTERVAL > System.currentTimeMillis()) { |
|
|
if (mVersionPressedCounter == TIMES_TO_PRESS) { |
|
|
if (mVersionPressedCounter == TIMES_TO_PRESS) |
|
|
appBar.setVisibility(View.INVISIBLE); |
|
|
showEasterEgg(); |
|
|
mainContent.setVisibility(View.INVISIBLE); |
|
|
|
|
|
trollGif.setVisibility(View.VISIBLE); |
|
|
|
|
|
drawer.getDrawerLayout().setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); |
|
|
|
|
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); |
|
|
|
|
|
} |
|
|
|
|
|
mVersionLastPressedTime = System.currentTimeMillis(); |
|
|
mVersionLastPressedTime = System.currentTimeMillis(); |
|
|
++mVersionPressedCounter; |
|
|
++mVersionPressedCounter; |
|
|
} else { |
|
|
} else { |
|
@ -104,7 +90,25 @@ public class AboutActivity extends BaseActivity { |
|
|
mVersionPressedCounter = 0; |
|
|
mVersionPressedCounter = 0; |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
TextView versionTextView = findViewById(R.id.version); |
|
|
|
|
|
if (versionTextView != null) { |
|
|
|
|
|
if (BuildConfig.DEBUG) |
|
|
|
|
|
versionTextView.setText(getString(R.string.version, versionName + versionInfo)); |
|
|
|
|
|
else |
|
|
|
|
|
versionTextView.setText(getString(R.string.version, versionName)); |
|
|
|
|
|
|
|
|
|
|
|
if(gitExists){ |
|
|
|
|
|
versionTextView.setOnClickListener(view -> { |
|
|
|
|
|
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/ThmmyNoLife/mTHMMY/commit/" + BuildConfig.COMMIT_HASH)); |
|
|
|
|
|
startActivity(intent); |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
versionTextView.setOnLongClickListener(view -> { |
|
|
|
|
|
Toast.makeText(getApplicationContext(), BaseApplication.getFirebaseProjectId(), Toast.LENGTH_SHORT).show(); |
|
|
|
|
|
return true; |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
TextView privacyPolicy = findViewById(R.id.privacy_policy_header); |
|
|
TextView privacyPolicy = findViewById(R.id.privacy_policy_header); |
|
@ -122,6 +126,14 @@ public class AboutActivity extends BaseActivity { |
|
|
super.onResume(); |
|
|
super.onResume(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void onBackPressed() { |
|
|
|
|
|
if(easterEggImage.getVisibility()==View.INVISIBLE) |
|
|
|
|
|
super.onBackPressed(); |
|
|
|
|
|
else |
|
|
|
|
|
hideEasterEgg(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public void displayApacheLibraries(View v) { |
|
|
public void displayApacheLibraries(View v) { |
|
|
LayoutInflater inflater = LayoutInflater.from(this); |
|
|
LayoutInflater inflater = LayoutInflater.from(this); |
|
|
WebView webView = (WebView) inflater.inflate(R.layout.dialog_licenses, coordinatorLayout, false); |
|
|
WebView webView = (WebView) inflater.inflate(R.layout.dialog_licenses, coordinatorLayout, false); |
|
@ -152,4 +164,21 @@ public class AboutActivity extends BaseActivity { |
|
|
alertDialog.getWindow().setLayout(width, height); |
|
|
alertDialog.getWindow().setLayout(width, height); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void showEasterEgg(){ |
|
|
|
|
|
if(getResources().getConfiguration().orientation==ActivityInfo.SCREEN_ORIENTATION_PORTRAIT){ |
|
|
|
|
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); |
|
|
|
|
|
appBar.setVisibility(View.INVISIBLE); |
|
|
|
|
|
mainContent.setVisibility(View.INVISIBLE); |
|
|
|
|
|
easterEggImage.setVisibility(View.VISIBLE); |
|
|
|
|
|
drawer.getDrawerLayout().setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void hideEasterEgg(){ |
|
|
|
|
|
appBar.setVisibility(View.VISIBLE); |
|
|
|
|
|
mainContent.setVisibility(View.VISIBLE); |
|
|
|
|
|
easterEggImage.setVisibility(View.INVISIBLE); |
|
|
|
|
|
drawer.getDrawerLayout().setDrawerLockMode(DrawerLayout.LOCK_MODE_UNDEFINED); |
|
|
|
|
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|