forked from digitapex/DerDieDas
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added: new App Icon * Added: Dark Theme comatible with System Theme * Updated: cleaner UI * and a lot of other tweaks
- Loading branch information
machiav3lli
committed
Jun 4, 2020
1 parent
bc42724
commit 87fd4ec
Showing
91 changed files
with
740 additions
and
905 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
changelog | ||
========= | ||
|
||
1.1.0 (04.06.2020) | ||
------------------- | ||
* added: new App Icon | ||
* added: Dark Theme comatible with System Theme | ||
* updated: cleaner UI | ||
* and some other tweaks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,62 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
int versionMajor = 1 | ||
int versionMinor = 1 | ||
int versionPath = 0 | ||
|
||
android { | ||
buildToolsVersion "28.0.2" | ||
compileSdkVersion 28 | ||
compileSdkVersion 29 | ||
defaultConfig { | ||
applicationId "com.spitslide.derdiedas" | ||
minSdkVersion 15 | ||
targetSdkVersion 28 | ||
versionCode 2 | ||
versionName "1.01" | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
applicationId 'com.machiav3lli.derdiedas' | ||
minSdkVersion 24 | ||
targetSdkVersion 29 | ||
versionCode = versionMajor * 1000 + versionMinor * 100 + versionPath | ||
versionName = "${versionMajor}.${versionMinor}.${versionPath}" | ||
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled true | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
dependenciesInfo { | ||
includeInApk false | ||
includeInBundle false | ||
} | ||
buildToolsVersion '29.0.3' | ||
} | ||
|
||
ext { | ||
versions = [ | ||
butterknife : "10.2.1", | ||
|
||
appcompat : "1.1.0", | ||
constraintlayout : "2.0.0-beta6", | ||
preference : "1.1.1", | ||
material : "1.3.0-alpha01", | ||
|
||
junit : "1.1.1", | ||
espresso : "3.2.0" | ||
] | ||
} | ||
|
||
dependencies { | ||
implementation fileTree(dir: 'libs', include: ['*.jar']) | ||
implementation 'com.android.support:appcompat-v7:28.0.0' | ||
implementation 'com.android.support:preference-v14:28.0.0' | ||
implementation 'com.android.support:preference-v7:28.0.0' | ||
//ButterKnife | ||
implementation "com.jakewharton:butterknife:${versions.butterknife}" | ||
annotationProcessor "com.jakewharton:butterknife-compiler:${versions.butterknife}" | ||
|
||
// UI | ||
implementation "androidx.appcompat:appcompat:${versions.appcompat}" | ||
implementation "androidx.constraintlayout:constraintlayout:${versions.constraintlayout}" | ||
implementation "androidx.preference:preference:${versions.preference}" | ||
implementation "com.google.android.material:material:${versions.material}" | ||
|
||
testImplementation 'junit:junit:4.12' | ||
androidTestImplementation 'com.android.support.test:runner:1.0.2' | ||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' | ||
// Test | ||
implementation "androidx.test.ext:junit:${versions.junit}" | ||
implementation "androidx.test.espresso:espresso-core:${versions.espresso}" | ||
} |
2 changes: 1 addition & 1 deletion
2
...de/derdiedas/ExampleInstrumentedTest.java → ...li/derdiedas/ExampleInstrumentedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,22 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.spitslide.derdiedas"> | ||
package="com.machiav3lli.derdiedas"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@drawable/germany_flag_128" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@drawable/germany_flag_128" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity android:name="com.spitslide.derdiedas.ui.MainActivity"> | ||
android:theme="@style/AppTheme.DayNight"> | ||
<activity android:name="com.machiav3lli.derdiedas.ui.MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity android:name="com.spitslide.derdiedas.ui.WordActivity"/> | ||
<activity android:name="com.spitslide.derdiedas.ui.SettingsActivity"/> | ||
<activity android:name="com.spitslide.derdiedas.ui.StatsActivity"/> | ||
<activity android:name="com.machiav3lli.derdiedas.ui.WordActivity" /> | ||
<activity android:name="com.machiav3lli.derdiedas.ui.SettingsActivity" /> | ||
<activity android:name="com.machiav3lli.derdiedas.ui.StatsActivity" /> | ||
</application> | ||
|
||
</manifest> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions
15
app/src/main/java/com/machiav3lli/derdiedas/Constants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.machiav3lli.derdiedas; | ||
|
||
public class Constants { | ||
|
||
private Constants() { | ||
} | ||
|
||
public static final String TAG = "DerDieDas"; | ||
public static final String PREFS_THEME = "themes"; | ||
|
||
public static String classTag(String tag) { | ||
return TAG + tag; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
app/src/main/java/com/machiav3lli/derdiedas/ui/MainActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
package com.machiav3lli.derdiedas.ui; | ||
|
||
import android.content.Intent; | ||
import android.content.SharedPreferences; | ||
import android.os.Bundle; | ||
|
||
import androidx.annotation.Nullable; | ||
import androidx.appcompat.app.AppCompatActivity; | ||
import androidx.appcompat.app.AppCompatDelegate; | ||
import androidx.preference.PreferenceManager; | ||
|
||
import com.machiav3lli.derdiedas.Constants; | ||
import com.machiav3lli.derdiedas.R; | ||
import com.machiav3lli.derdiedas.data.Noun; | ||
import com.machiav3lli.derdiedas.utils.DatabaseUtil; | ||
import com.machiav3lli.derdiedas.utils.FileUtils; | ||
import com.machiav3lli.derdiedas.utils.PrefsUtil; | ||
|
||
import java.io.UnsupportedEncodingException; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import butterknife.ButterKnife; | ||
import butterknife.OnClick; | ||
|
||
import static androidx.appcompat.app.AppCompatDelegate.setDefaultNightMode; | ||
|
||
public class MainActivity extends AppCompatActivity { | ||
|
||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
setDayNightTheme(PrefsUtil.getPrefsString(this, Constants.PREFS_THEME)); | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | ||
ButterKnife.bind(this); | ||
createDatabaseIfFirstRun(); | ||
} | ||
|
||
@OnClick(R.id.practice) | ||
public void startPractice() { | ||
startActivity(new Intent(this, WordActivity.class)); | ||
} | ||
|
||
@OnClick(R.id.stats) | ||
public void showStats() { | ||
startActivity(new Intent(this, StatsActivity.class)); | ||
} | ||
|
||
@OnClick(R.id.settings) | ||
public void showSettings() { | ||
startActivity(new Intent(this, SettingsActivity.class)); | ||
} | ||
|
||
@Override | ||
protected void onResume() { | ||
super.onResume(); | ||
} | ||
|
||
private void createDatabaseIfFirstRun() { | ||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); | ||
if (prefs.getBoolean("firstrun", true)) { | ||
String listNouns = null; | ||
try { | ||
listNouns = FileUtils.getNounList(this); | ||
} catch (UnsupportedEncodingException e) { | ||
e.printStackTrace(); | ||
} | ||
String[] nouns = FileUtils.getLines(listNouns); | ||
|
||
final List<Noun> nounList = new ArrayList<>(); | ||
for (String line : nouns) { | ||
String noun = line.split(",")[0]; | ||
String gender = line.split(",")[1]; | ||
Noun nounObject = new Noun(noun, gender, 0); | ||
nounList.add(nounObject); | ||
} | ||
|
||
new Thread() { | ||
@Override | ||
public void run() { | ||
new DatabaseUtil(MainActivity.this).addAllNouns(nounList); | ||
} | ||
}.start(); | ||
|
||
prefs.edit().putBoolean("firstrun", false).apply(); | ||
} | ||
} | ||
|
||
private void setDayNightTheme(String theme) { | ||
switch (theme) { | ||
case "light": | ||
setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); | ||
break; | ||
case "dark": | ||
setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); | ||
break; | ||
default: | ||
setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM); | ||
} | ||
} | ||
|
||
} |
11 changes: 6 additions & 5 deletions
11
...tslide/derdiedas/ui/SettingsActivity.java → ...av3lli/derdiedas/ui/SettingsActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.