-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
1,860 additions
and
1,947 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 |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
|
||
# Generated files | ||
.gradle | ||
.kotlin | ||
/build | ||
bin/ | ||
gen/ | ||
|
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,27 +1,30 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:installLocation="auto"> | ||
android:installLocation="auto"> | ||
|
||
<uses-permission android:name="android.permission.VIBRATE" /> | ||
|
||
<application | ||
android:name=".CounterApplication" | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
android:name=".CounterApplication" | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
|
||
<activity | ||
android:name=".activities.MainActivity" | ||
android:exported="true"> | ||
android:name=".activities.MainActivity" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
<activity | ||
android:name=".activities.SettingsActivity" | ||
android:label="@string/settings_title" /> | ||
android:name=".activities.SettingsActivity" | ||
android:label="@string/settings_title" /> | ||
|
||
</application> | ||
|
||
</manifest> |
51 changes: 27 additions & 24 deletions
51
app/src/main/java/me/tsukanov/counter/CounterApplication.kt
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,34 +1,37 @@ | ||
package me.tsukanov.counter; | ||
package me.tsukanov.counter | ||
|
||
import android.app.Activity; | ||
import android.app.Application; | ||
import com.google.android.material.color.DynamicColors; | ||
import dagger.android.DispatchingAndroidInjector; | ||
import javax.inject.Inject; | ||
import me.tsukanov.counter.domain.CounterApplicationComponent; | ||
import me.tsukanov.counter.domain.CounterModule; | ||
import me.tsukanov.counter.domain.DaggerCounterApplicationComponent; | ||
import android.app.Activity | ||
import android.app.Application | ||
import com.google.android.material.color.DynamicColors | ||
import dagger.android.DispatchingAndroidInjector | ||
import me.tsukanov.counter.domain.CounterApplicationComponent | ||
import me.tsukanov.counter.domain.CounterModule | ||
import me.tsukanov.counter.domain.DaggerCounterApplicationComponent | ||
import javax.inject.Inject | ||
|
||
public class CounterApplication extends Application { | ||
public static String PACKAGE_NAME; | ||
class CounterApplication : Application() { | ||
|
||
@Inject DispatchingAndroidInjector<Activity> dispatchingAndroidInjector; | ||
@JvmField | ||
@Inject | ||
var dispatchingAndroidInjector: DispatchingAndroidInjector<Activity>? = null | ||
|
||
private static CounterApplicationComponent component; | ||
override fun onCreate() { | ||
super.onCreate() | ||
|
||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
DynamicColors.applyToActivitiesIfAvailable(this) | ||
|
||
DynamicColors.applyToActivitiesIfAvailable(this); | ||
component = DaggerCounterApplicationComponent.builder() | ||
.counterModule(CounterModule(this)) | ||
.build() | ||
|
||
component = | ||
DaggerCounterApplicationComponent.builder().counterModule(new CounterModule(this)).build(); | ||
PACKAGE_NAME = applicationContext.packageName | ||
} | ||
|
||
PACKAGE_NAME = getApplicationContext().getPackageName(); | ||
} | ||
companion object { | ||
var PACKAGE_NAME: String? = null | ||
|
||
var component: CounterApplicationComponent? = null | ||
private set | ||
} | ||
|
||
public static CounterApplicationComponent getComponent() { | ||
return component; | ||
} | ||
} |
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,24 +1,11 @@ | ||
package me.tsukanov.counter; | ||
|
||
import androidx.annotation.NonNull; | ||
|
||
public enum SharedPrefKeys { | ||
ACTIVE_COUNTER("activeKey"), | ||
KEEP_SCREEN_ON("keepScreenOn"), | ||
LABEL_CONTROL_ON("labelControlOn"), | ||
HARDWARE_BTN_CONTROL_ON("hardControlOn"), | ||
VIBRATION_ON("vibrationOn"), | ||
SOUNDS_ON("soundsOn"), | ||
THEME("theme"); | ||
|
||
@NonNull private final String name; | ||
|
||
SharedPrefKeys(@NonNull final String name) { | ||
this.name = name; | ||
} | ||
|
||
@NonNull | ||
public String getName() { | ||
return name; | ||
} | ||
package me.tsukanov.counter | ||
|
||
enum class SharedPrefKeys(val key: String) { | ||
ACTIVE_COUNTER("activeKey"), | ||
KEEP_SCREEN_ON("keepScreenOn"), | ||
LABEL_CONTROL_ON("labelControlOn"), | ||
HARDWARE_BTN_CONTROL_ON("hardControlOn"), | ||
VIBRATION_ON("vibrationOn"), | ||
SOUNDS_ON("soundsOn"), | ||
THEME("theme"), | ||
} |
Oops, something went wrong.