final version
@ -6,8 +6,8 @@ android {
|
|||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.github.orangegangsters.lollipin"
|
applicationId "com.github.orangegangsters.lollipin"
|
||||||
minSdkVersion 14
|
minSdkVersion 16
|
||||||
targetSdkVersion 24
|
targetSdkVersion 26
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
}
|
}
|
||||||
@ -30,6 +30,13 @@ dependencies {
|
|||||||
|
|
||||||
//test
|
//test
|
||||||
androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.5.2'
|
androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.5.2'
|
||||||
|
|
||||||
|
compile 'com.android.support:design:26.0.2'
|
||||||
|
compile 'com.android.support:recyclerview-v7:26.0.0'
|
||||||
|
compile 'com.android.support:support-v4:26.0.2'
|
||||||
|
compile "com.daimajia.swipelayout:library:1.2.0@aar"
|
||||||
|
compile 'petrov.kristiyan.colorpicker:colorpicker-library:1.1.2'
|
||||||
|
compile 'com.google.android.gms:play-services-appindexing:9.8.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
// REQUIRED: Google's new Maven repo is required for the latest
|
// REQUIRED: Google's new Maven repo is required for the latest
|
||||||
|
@ -1,339 +0,0 @@
|
|||||||
package lollipin.orangegangsters.github.com.lollipin.functional;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.hardware.fingerprint.FingerprintManager;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.preference.PreferenceManager;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import com.github.omadahealth.lollipin.CustomPinActivity;
|
|
||||||
import com.github.omadahealth.lollipin.MainActivity;
|
|
||||||
import com.github.omadahealth.lollipin.NotLockedActivity;
|
|
||||||
import com.github.omadahealth.lollipin.lib.encryption.Encryptor;
|
|
||||||
import com.github.omadahealth.lollipin.lib.enums.Algorithm;
|
|
||||||
import com.github.omadahealth.lollipin.lib.managers.AppLockImpl;
|
|
||||||
import com.github.omadahealth.lollipin.lib.managers.FingerprintUiHelper;
|
|
||||||
import com.github.omadahealth.lollipin.lib.managers.LockManager;
|
|
||||||
import com.github.omadahealth.lollipin.lib.views.PinCodeRoundView;
|
|
||||||
|
|
||||||
import lollipin.orangegangsters.github.com.lollipin.R;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author stoyan and oliviergoutay
|
|
||||||
* @version 1/13/15
|
|
||||||
*/
|
|
||||||
public class PinLockTest extends AbstractTest {
|
|
||||||
|
|
||||||
public void testMigratingFromSha1toSha256() {
|
|
||||||
//Init
|
|
||||||
removeAllPrefs();
|
|
||||||
AppLockImpl appLockImpl = (AppLockImpl) LockManager.getInstance().getAppLock();
|
|
||||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
|
||||||
|
|
||||||
//Should use sha256 if the SharedPreferences is set, by default
|
|
||||||
enablePin();
|
|
||||||
assertEquals(Algorithm.SHA256, Algorithm.getFromText(sharedPref.getString(PASSWORD_ALGORITHM_PREFERENCE_KEY, "")));
|
|
||||||
assertTrue(appLockImpl.checkPasscode("1234"));
|
|
||||||
removeAllPrefs();
|
|
||||||
|
|
||||||
//Should still use sha1 if password is stored but not the algorithm
|
|
||||||
SharedPreferences.Editor editor = sharedPref.edit();
|
|
||||||
editor.putString(PASSWORD_PREFERENCE_KEY, Encryptor.getSHA(appLockImpl.getSalt() + "test" + appLockImpl.getSalt(), Algorithm.SHA1));
|
|
||||||
editor.apply();
|
|
||||||
assertEquals(Algorithm.SHA1, Algorithm.getFromText(sharedPref.getString(PASSWORD_ALGORITHM_PREFERENCE_KEY, "")));
|
|
||||||
assertTrue(appLockImpl.checkPasscode("test"));
|
|
||||||
removeAllPrefs();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testPinClearButton() {
|
|
||||||
removePrefsAndGoToEnable();
|
|
||||||
|
|
||||||
//Enter 3 codes
|
|
||||||
clickOnView(R.id.pin_code_button_1);
|
|
||||||
clickOnView(R.id.pin_code_button_2);
|
|
||||||
clickOnView(R.id.pin_code_button_3);
|
|
||||||
|
|
||||||
//Check length 3
|
|
||||||
solo.sleep(1000);
|
|
||||||
PinCodeRoundView pinCodeRoundView = (PinCodeRoundView) solo.getCurrentActivity().findViewById(com.github.omadahealth.lollipin.lib.R.id.pin_code_round_view);
|
|
||||||
assertEquals(3, pinCodeRoundView.getCurrentLength());
|
|
||||||
|
|
||||||
//Click clear button
|
|
||||||
clickOnView(R.id.pin_code_button_clear);
|
|
||||||
|
|
||||||
//Check length 0
|
|
||||||
solo.sleep(1000);
|
|
||||||
assertEquals(2, pinCodeRoundView.getCurrentLength());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testPinEnabling() {
|
|
||||||
removePrefsAndGoToEnable();
|
|
||||||
|
|
||||||
//Test no fingerprint
|
|
||||||
assertEquals(View.GONE, solo.getView(R.id.pin_code_fingerprint_imageview).getVisibility());
|
|
||||||
assertEquals(View.GONE, solo.getView(R.id.pin_code_fingerprint_textview).getVisibility());
|
|
||||||
|
|
||||||
//--------Not the same pin--------
|
|
||||||
//Enter 4 codes
|
|
||||||
clickOnView(R.id.pin_code_button_1);
|
|
||||||
clickOnView(R.id.pin_code_button_2);
|
|
||||||
clickOnView(R.id.pin_code_button_3);
|
|
||||||
clickOnView(R.id.pin_code_button_4);
|
|
||||||
solo.sleep(1000);
|
|
||||||
clickOnView(R.id.pin_code_button_2);
|
|
||||||
clickOnView(R.id.pin_code_button_3);
|
|
||||||
clickOnView(R.id.pin_code_button_4);
|
|
||||||
clickOnView(R.id.pin_code_button_5);
|
|
||||||
solo.waitForActivity(CustomPinActivity.class);
|
|
||||||
solo.assertCurrentActivity("CustomPinActivity", CustomPinActivity.class);
|
|
||||||
solo.sleep(1000);
|
|
||||||
|
|
||||||
//--------Same pin--------
|
|
||||||
enablePin();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testPinEnablingChecking() throws SecurityException {
|
|
||||||
enablePin();
|
|
||||||
|
|
||||||
//Go to unlock
|
|
||||||
clickOnView(R.id.button_unlock_pin);
|
|
||||||
solo.waitForActivity(CustomPinActivity.class);
|
|
||||||
solo.assertCurrentActivity("CustomPinActivity", CustomPinActivity.class);
|
|
||||||
|
|
||||||
//Test fingerprint if available
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
||||||
ImageView fingerprintImageView = (ImageView) solo.getView(com.github.omadahealth.lollipin.lib.R.id.pin_code_fingerprint_imageview);
|
|
||||||
TextView fingerprintTextView = (TextView) solo.getView(com.github.omadahealth.lollipin.lib.R.id.pin_code_fingerprint_textview);
|
|
||||||
FingerprintManager fingerprintManager = (FingerprintManager) getActivity().getSystemService(Context.FINGERPRINT_SERVICE);
|
|
||||||
FingerprintUiHelper fingerprintUiHelper = new FingerprintUiHelper.FingerprintUiHelperBuilder(fingerprintManager).build(fingerprintImageView, fingerprintTextView, (CustomPinActivity) solo.getCurrentActivity());
|
|
||||||
if (fingerprintManager.isHardwareDetected() && fingerprintUiHelper.isFingerprintAuthAvailable()) {
|
|
||||||
assertEquals(View.VISIBLE, solo.getView(R.id.pin_code_fingerprint_imageview).getVisibility());
|
|
||||||
assertEquals(View.VISIBLE, solo.getView(R.id.pin_code_fingerprint_textview).getVisibility());
|
|
||||||
} else {
|
|
||||||
assertEquals(View.GONE, solo.getView(R.id.pin_code_fingerprint_imageview).getVisibility());
|
|
||||||
assertEquals(View.GONE, solo.getView(R.id.pin_code_fingerprint_textview).getVisibility());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
assertEquals(View.GONE, solo.getView(R.id.pin_code_fingerprint_imageview).getVisibility());
|
|
||||||
assertEquals(View.GONE, solo.getView(R.id.pin_code_fingerprint_textview).getVisibility());
|
|
||||||
}
|
|
||||||
|
|
||||||
//Enter the code
|
|
||||||
clickOnView(R.id.pin_code_button_1);
|
|
||||||
clickOnView(R.id.pin_code_button_2);
|
|
||||||
clickOnView(R.id.pin_code_button_3);
|
|
||||||
clickOnView(R.id.pin_code_button_4);
|
|
||||||
|
|
||||||
//Check view
|
|
||||||
solo.waitForActivity(MainActivity.class);
|
|
||||||
solo.assertCurrentActivity("MainActivity", MainActivity.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testPinEnablingChanging() {
|
|
||||||
enablePin();
|
|
||||||
|
|
||||||
//Go to change
|
|
||||||
clickOnView(R.id.button_change_pin);
|
|
||||||
solo.waitForActivity(CustomPinActivity.class);
|
|
||||||
solo.assertCurrentActivity("CustomPinActivity", CustomPinActivity.class);
|
|
||||||
|
|
||||||
//Enter previous code
|
|
||||||
clickOnView(R.id.pin_code_button_1);
|
|
||||||
clickOnView(R.id.pin_code_button_2);
|
|
||||||
clickOnView(R.id.pin_code_button_3);
|
|
||||||
clickOnView(R.id.pin_code_button_4);
|
|
||||||
solo.sleep(1000);
|
|
||||||
|
|
||||||
//Enter the new one
|
|
||||||
clickOnView(R.id.pin_code_button_2);
|
|
||||||
clickOnView(R.id.pin_code_button_3);
|
|
||||||
clickOnView(R.id.pin_code_button_4);
|
|
||||||
clickOnView(R.id.pin_code_button_5);
|
|
||||||
solo.sleep(1000);
|
|
||||||
clickOnView(R.id.pin_code_button_2);
|
|
||||||
clickOnView(R.id.pin_code_button_3);
|
|
||||||
clickOnView(R.id.pin_code_button_4);
|
|
||||||
clickOnView(R.id.pin_code_button_5);
|
|
||||||
solo.waitForActivity(MainActivity.class);
|
|
||||||
solo.assertCurrentActivity("MainActivity", MainActivity.class);
|
|
||||||
|
|
||||||
//Go to unlock
|
|
||||||
clickOnView(R.id.button_unlock_pin);
|
|
||||||
solo.waitForActivity(CustomPinActivity.class);
|
|
||||||
solo.assertCurrentActivity("CustomPinActivity", CustomPinActivity.class);
|
|
||||||
|
|
||||||
//Enter the code
|
|
||||||
clickOnView(R.id.pin_code_button_2);
|
|
||||||
clickOnView(R.id.pin_code_button_3);
|
|
||||||
clickOnView(R.id.pin_code_button_4);
|
|
||||||
clickOnView(R.id.pin_code_button_5);
|
|
||||||
|
|
||||||
//Check view
|
|
||||||
solo.waitForActivity(MainActivity.class);
|
|
||||||
solo.assertCurrentActivity("MainActivity", MainActivity.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testPinLockAfterDefaultTimeout() {
|
|
||||||
enablePin();
|
|
||||||
|
|
||||||
//Go to NotLockedActivity
|
|
||||||
solo.sleep(1000);
|
|
||||||
clickOnView(R.id.button_not_locked);
|
|
||||||
solo.waitForActivity(NotLockedActivity.class);
|
|
||||||
solo.assertCurrentActivity("NotLockedActivity", NotLockedActivity.class);
|
|
||||||
|
|
||||||
//Set the last time to now - 11sec
|
|
||||||
setMillis(System.currentTimeMillis() - (1000 * 15));
|
|
||||||
solo.getCurrentActivity().finish();
|
|
||||||
|
|
||||||
//Check view
|
|
||||||
solo.waitForActivity(CustomPinActivity.class);
|
|
||||||
solo.assertCurrentActivity("CustomPinActivity", CustomPinActivity.class);
|
|
||||||
solo.sleep(1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testPinLockAfterCustomTimeout() {
|
|
||||||
enablePin();
|
|
||||||
|
|
||||||
//Set to 3minutes
|
|
||||||
LockManager.getInstance().getAppLock().setTimeout(1000 * 60 * 3);
|
|
||||||
|
|
||||||
//Go to NotLockedActivity
|
|
||||||
clickOnView(R.id.button_not_locked);
|
|
||||||
solo.waitForActivity(NotLockedActivity.class);
|
|
||||||
solo.assertCurrentActivity("NotLockedActivity", NotLockedActivity.class);
|
|
||||||
|
|
||||||
//Set the last time to now - 11sec
|
|
||||||
setMillis(System.currentTimeMillis() - (1000 * 11));
|
|
||||||
solo.getCurrentActivity().finish();
|
|
||||||
|
|
||||||
//Check view
|
|
||||||
solo.waitForActivity(MainActivity.class);
|
|
||||||
solo.assertCurrentActivity("MainActivity", MainActivity.class);
|
|
||||||
solo.sleep(1000);
|
|
||||||
|
|
||||||
//Go to NotLockedActivity
|
|
||||||
clickOnView(R.id.button_not_locked);
|
|
||||||
solo.waitForActivity(NotLockedActivity.class);
|
|
||||||
solo.assertCurrentActivity("NotLockedActivity", NotLockedActivity.class);
|
|
||||||
|
|
||||||
//Set the last time to now - 6minutes
|
|
||||||
setMillis(System.currentTimeMillis() - (1000 * 60 * 6));
|
|
||||||
solo.getCurrentActivity().finish();
|
|
||||||
|
|
||||||
//Check view
|
|
||||||
solo.waitForActivity(CustomPinActivity.class);
|
|
||||||
solo.assertCurrentActivity("CustomPinActivity", CustomPinActivity.class);
|
|
||||||
solo.sleep(1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testPinLockWithBackgroundTimeout() {
|
|
||||||
enablePin();
|
|
||||||
|
|
||||||
// Set the option to use timeout in background only
|
|
||||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
|
||||||
SharedPreferences.Editor editor = sharedPref.edit();
|
|
||||||
editor.putBoolean(ONLY_BACKGROUND_TIMEOUT_PREFERENCE_KEY, true);
|
|
||||||
editor.apply();
|
|
||||||
|
|
||||||
//Go to NotLockedActivity
|
|
||||||
solo.sleep(1000);
|
|
||||||
clickOnView(R.id.button_not_locked);
|
|
||||||
solo.waitForActivity(NotLockedActivity.class);
|
|
||||||
solo.assertCurrentActivity("NotLockedActivity", NotLockedActivity.class);
|
|
||||||
|
|
||||||
//Set the last time to now - 15sec
|
|
||||||
setMillis(System.currentTimeMillis() - (1000 * 15));
|
|
||||||
solo.getCurrentActivity().finish();
|
|
||||||
|
|
||||||
//Check view
|
|
||||||
solo.waitForActivity(MainActivity.class);
|
|
||||||
solo.assertCurrentActivity("MainActivity", MainActivity.class);
|
|
||||||
solo.sleep(1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testBackButton() {
|
|
||||||
enablePin();
|
|
||||||
|
|
||||||
//Go to unlock
|
|
||||||
clickOnView(R.id.button_unlock_pin);
|
|
||||||
solo.waitForActivity(CustomPinActivity.class);
|
|
||||||
solo.assertCurrentActivity("CustomPinActivity", CustomPinActivity.class);
|
|
||||||
|
|
||||||
solo.goBack();
|
|
||||||
solo.assertCurrentActivity("CustomPinActivity", CustomPinActivity.class);
|
|
||||||
|
|
||||||
//reset
|
|
||||||
clickOnView(R.id.pin_code_button_1);
|
|
||||||
clickOnView(R.id.pin_code_button_2);
|
|
||||||
clickOnView(R.id.pin_code_button_3);
|
|
||||||
clickOnView(R.id.pin_code_button_4);
|
|
||||||
solo.sleep(1000);
|
|
||||||
|
|
||||||
//Go to change
|
|
||||||
clickOnView(R.id.button_change_pin);
|
|
||||||
solo.waitForActivity(CustomPinActivity.class);
|
|
||||||
solo.assertCurrentActivity("CustomPinActivity", CustomPinActivity.class);
|
|
||||||
|
|
||||||
solo.goBack();
|
|
||||||
solo.assertCurrentActivity("MainActivity", MainActivity.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testDisablingFingerprintReader() {
|
|
||||||
enablePin();
|
|
||||||
|
|
||||||
// Disable fingerprint reader.
|
|
||||||
LockManager.getInstance().getAppLock().setFingerprintAuthEnabled(false);
|
|
||||||
|
|
||||||
// Go to unlock.
|
|
||||||
clickOnView(R.id.button_unlock_pin);
|
|
||||||
solo.waitForActivity(CustomPinActivity.class);
|
|
||||||
solo.assertCurrentActivity("CustomPinActivity", CustomPinActivity.class);
|
|
||||||
|
|
||||||
// Make sure the fingerprint views are gone.
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
||||||
assertEquals(View.GONE, solo.getView(R.id.pin_code_fingerprint_imageview).getVisibility());
|
|
||||||
assertEquals(View.GONE, solo.getView(R.id.pin_code_fingerprint_textview).getVisibility());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure pin unlocking still works.
|
|
||||||
clickOnView(R.id.pin_code_button_1);
|
|
||||||
clickOnView(R.id.pin_code_button_2);
|
|
||||||
clickOnView(R.id.pin_code_button_3);
|
|
||||||
clickOnView(R.id.pin_code_button_4);
|
|
||||||
solo.waitForActivity(MainActivity.class);
|
|
||||||
solo.assertCurrentActivity("MainActivity", MainActivity.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void enablePin() {
|
|
||||||
removePrefsAndGoToEnable();
|
|
||||||
|
|
||||||
clickOnView(R.id.pin_code_button_1);
|
|
||||||
clickOnView(R.id.pin_code_button_2);
|
|
||||||
clickOnView(R.id.pin_code_button_3);
|
|
||||||
clickOnView(R.id.pin_code_button_4);
|
|
||||||
solo.sleep(1000);
|
|
||||||
clickOnView(R.id.pin_code_button_1);
|
|
||||||
clickOnView(R.id.pin_code_button_2);
|
|
||||||
clickOnView(R.id.pin_code_button_3);
|
|
||||||
clickOnView(R.id.pin_code_button_4);
|
|
||||||
solo.waitForActivity(MainActivity.class);
|
|
||||||
solo.assertCurrentActivity("MainActivity", MainActivity.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void removePrefsAndGoToEnable() {
|
|
||||||
//init
|
|
||||||
removeAllPrefs();
|
|
||||||
|
|
||||||
//Go to enable
|
|
||||||
if (solo.getCurrentActivity() instanceof MainActivity) {
|
|
||||||
clickOnView(R.id.button_enable_pin);
|
|
||||||
solo.waitForActivity(CustomPinActivity.class);
|
|
||||||
solo.assertCurrentActivity("CustomPinActivity", CustomPinActivity.class);
|
|
||||||
solo.waitForText("1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +1,21 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="lollipin.orangegangsters.github.com.lollipin" >
|
package="lollipin.orangegangsters.github.com.lollipin" >
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||||
|
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name="com.github.omadahealth.lollipin.CustomApplication"
|
android:name="com.github.omadahealth.lollipin.CustomApplication"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@drawable/icon"
|
android:icon="@mipmap/tomato"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/AppTheme" >
|
android:theme="@style/Theme.AppCompat.Light.NoActionBar" >
|
||||||
<activity
|
<activity
|
||||||
android:name="com.github.omadahealth.lollipin.MainActivity"
|
android:name="com.github.omadahealth.lollipin.MainActivity"
|
||||||
android:label="@string/app_name" >
|
android:label="@string/app_name" >
|
||||||
@ -18,16 +26,31 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="com.github.omadahealth.lollipin.NotLockedActivity"
|
android:name="com.github.omadahealth.lollipin.TimerActivity"
|
||||||
android:label="@string/app_name" >
|
android:label="@string/app_name"
|
||||||
|
android:launchMode="singleTop">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="com.github.omadahealth.lollipin.CustomPinActivity"
|
android:name="com.github.omadahealth.lollipin.CustomPinActivity"
|
||||||
android:label="@string/app_name" >
|
android:label="@string/app_name" >
|
||||||
</activity>
|
</activity>
|
||||||
<activity android:name="com.github.omadahealth.lollipin.LockedCompatActivity"
|
<activity android:name="com.github.omadahealth.todo.MainActivity">
|
||||||
android:label="@string/app_name"
|
</activity>
|
||||||
android:theme="@style/AppThemeNoActionbar">
|
|
||||||
|
<receiver android:name="com.github.omadahealth.todo.NotificationPublisher" />
|
||||||
|
|
||||||
|
<activity android:name="com.github.omadahealth.todo.AddItem" />
|
||||||
|
<activity android:name="com.github.omadahealth.lollipin.AboutPomocnik" />
|
||||||
|
<activity android:name="com.github.omadahealth.todo.EditItem" />
|
||||||
|
<activity android:name="com.github.omadahealth.todo.addCategory"></activity>
|
||||||
|
<activity android:name="com.github.omadahealth.lollipin.TimerSettings">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.github.omadahealth.lollipin;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v7.app.ActionBar;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import lollipin.orangegangsters.github.com.lollipin.R;
|
||||||
|
|
||||||
|
public class AboutPomocnik extends AppCompatActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_about_pomocnik);
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package com.github.omadahealth.lollipin;
|
package com.github.omadahealth.lollipin;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
@ -7,6 +8,7 @@ import android.graphics.drawable.ColorDrawable;
|
|||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.github.omadahealth.lollipin.lib.managers.AppLockActivity;
|
import com.github.omadahealth.lollipin.lib.managers.AppLockActivity;
|
||||||
|
import com.github.omadahealth.todo.MainActivity;
|
||||||
|
|
||||||
import lollipin.orangegangsters.github.com.lollipin.R;
|
import lollipin.orangegangsters.github.com.lollipin.R;
|
||||||
import uk.me.lewisdeane.ldialogs.BaseDialog;
|
import uk.me.lewisdeane.ldialogs.BaseDialog;
|
||||||
@ -70,7 +72,8 @@ public class CustomPinActivity extends AppLockActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPinSuccess(int attempts) {
|
public void onPinSuccess(int attempts) {
|
||||||
|
Intent intent = new Intent(this, TimerActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -14,17 +14,22 @@ import lollipin.orangegangsters.github.com.lollipin.R;
|
|||||||
public class MainActivity extends PinActivity implements View.OnClickListener {
|
public class MainActivity extends PinActivity implements View.OnClickListener {
|
||||||
|
|
||||||
private static final int REQUEST_CODE_ENABLE = 11;
|
private static final int REQUEST_CODE_ENABLE = 11;
|
||||||
|
private static boolean first = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main);
|
//setContentView(R.layout.activity_main);
|
||||||
|
Intent intent = new Intent(MainActivity.this, CustomPinActivity.class);
|
||||||
|
|
||||||
this.findViewById(R.id.button_enable_pin).setOnClickListener(this);
|
if (first) {
|
||||||
this.findViewById(R.id.button_change_pin).setOnClickListener(this);
|
intent.putExtra(AppLock.EXTRA_TYPE, AppLock.ENABLE_PINLOCK);
|
||||||
this.findViewById(R.id.button_unlock_pin).setOnClickListener(this);
|
startActivityForResult(intent, REQUEST_CODE_ENABLE);
|
||||||
this.findViewById(R.id.button_compat_locked).setOnClickListener(this);
|
first = false;
|
||||||
this.findViewById(R.id.button_not_locked).setOnClickListener(this);
|
} else {
|
||||||
|
intent.putExtra(AppLock.EXTRA_TYPE, AppLock.UNLOCK_PIN);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -44,12 +49,9 @@ public class MainActivity extends PinActivity implements View.OnClickListener {
|
|||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
break;
|
break;
|
||||||
case R.id.button_compat_locked:
|
case R.id.button_compat_locked:
|
||||||
Intent intent2 = new Intent(MainActivity.this, LockedCompatActivity.class);
|
Intent intent2 = new Intent(MainActivity.this, TimerActivity.class);
|
||||||
startActivity(intent2);
|
startActivity(intent2);
|
||||||
break;
|
break;
|
||||||
case R.id.button_not_locked:
|
|
||||||
Intent intent3 = new Intent(MainActivity.this, NotLockedActivity.class);
|
|
||||||
startActivity(intent3);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.github.omadahealth.lollipin;
|
||||||
|
|
||||||
|
import android.app.Notification;
|
||||||
|
import android.app.NotificationManager;
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
|
||||||
|
public class NotificationPublisher extends BroadcastReceiver {
|
||||||
|
public static String NOTIFICATION_ID = "notification-id";
|
||||||
|
public static String NOTIFICATION = "notification";
|
||||||
|
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
|
||||||
|
NotificationManager notificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
|
Notification notification = intent.getParcelableExtra(NOTIFICATION);
|
||||||
|
int id = intent.getIntExtra(NOTIFICATION_ID, 0);
|
||||||
|
notificationManager.notify(id, notification);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -1,84 +1,41 @@
|
|||||||
package com.github.omadahealth.lollipin;
|
package com.github.omadahealth.lollipin;
|
||||||
//
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v7.widget.Toolbar;
|
|
||||||
import com.github.omadahealth.lollipin.lib.PinCompatActivity;
|
|
||||||
import lollipin.orangegangsters.github.com.lollipin.R;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * Created by callmepeanut on 16-1-14.
|
|
||||||
// */
|
|
||||||
//public class LockedCompatActivity extends PinCompatActivity{
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
// super.onCreate(savedInstanceState);
|
|
||||||
// setContentView(R.layout.activity_compat_locked);
|
|
||||||
// initView();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void initView() {
|
|
||||||
//// // Toolbar toolbar = (Toolbar) findViewById(R.id.id_toolbar);
|
|
||||||
//// setSupportActionBar(toolbar);
|
|
||||||
////
|
|
||||||
//// toolbar.setTitle("Title");
|
|
||||||
//// toolbar.setTitleTextColor(getResources().getColor(android.R.color.white));
|
|
||||||
//// toolbar.setSubtitle("SubTitle");
|
|
||||||
//// toolbar.setSubtitleTextColor(getResources().getColor(android.R.color.white));
|
|
||||||
//// toolbar.setLogo(R.drawable.ic_launcher);
|
|
||||||
//// toolbar.setNavigationIcon(R.drawable.ic_menu_white_36dp);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import android.app.AlarmManager;
|
import android.app.AlarmManager;
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
import android.app.NotificationChannel;
|
|
||||||
import android.app.NotificationManager;
|
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Color;
|
|
||||||
import android.media.MediaPlayer;
|
|
||||||
import android.net.wifi.WifiManager;
|
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
import android.os.CountDownTimer;
|
import android.os.CountDownTimer;
|
||||||
import android.os.SystemClock;
|
|
||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
import android.preference.EditTextPreference;
|
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.annotation.NonNull;
|
|
||||||
import android.support.annotation.RequiresApi;
|
import android.support.annotation.RequiresApi;
|
||||||
//import android.support.design.widget.NavigationView;
|
import android.support.design.widget.NavigationView;
|
||||||
import android.support.v4.app.NotificationCompat;
|
|
||||||
import android.support.v4.widget.DrawerLayout;
|
import android.support.v4.widget.DrawerLayout;
|
||||||
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
import android.support.v7.app.ActionBarDrawerToggle;
|
import android.support.v7.app.ActionBarDrawerToggle;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.view.Gravity;
|
||||||
import android.os.Bundle;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.RelativeLayout;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.github.omadahealth.lollipin.lib.PinCompatActivity;
|
||||||
|
import com.github.omadahealth.todo.MainActivity;
|
||||||
|
import com.github.omadahealth.todo.addCategory;
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
//import static com.nazlcanozturk46.pomodoro.R.drawable.actionbar_background;
|
import lollipin.orangegangsters.github.com.lollipin.R;
|
||||||
|
|
||||||
public class LockedCompatActivity extends PinCompatActivity implements View.OnClickListener, SharedPreferences.OnSharedPreferenceChangeListener {
|
public class TimerActivity extends PinCompatActivity implements View.OnClickListener, SharedPreferences.OnSharedPreferenceChangeListener {
|
||||||
private long timeCountInMilliSeconds = 1 * 60000;
|
private long timeCountInMilliSeconds = 1 * 60000;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -98,7 +55,6 @@ public class LockedCompatActivity extends PinCompatActivity implements View.OnCl
|
|||||||
private ProgressBar progressBarCircle;
|
private ProgressBar progressBarCircle;
|
||||||
private TextView textViewTime;
|
private TextView textViewTime;
|
||||||
private ImageView imageViewReset;
|
private ImageView imageViewReset;
|
||||||
private ImageView imageViewStartStop;
|
|
||||||
private ImageView imageViewTomato, imageViewWork, imageViewBreak;
|
private ImageView imageViewTomato, imageViewWork, imageViewBreak;
|
||||||
private ImageView imageViewPomodora1, imageViewPomodora2, imageViewPomodora3, imageViewPomodora4;
|
private ImageView imageViewPomodora1, imageViewPomodora2, imageViewPomodora3, imageViewPomodora4;
|
||||||
private CountDownTimer countDownTimer;
|
private CountDownTimer countDownTimer;
|
||||||
@ -107,16 +63,15 @@ public class LockedCompatActivity extends PinCompatActivity implements View.OnCl
|
|||||||
private Vibrator vibrator;
|
private Vibrator vibrator;
|
||||||
|
|
||||||
//hamburger menu
|
//hamburger menu
|
||||||
//private DrawerLayout drawerLayout;
|
private DrawerLayout drawerLayout;
|
||||||
// private ActionBarDrawerToggle actionBarDrawerToggle;
|
private ActionBarDrawerToggle actionBarDrawerToggle;
|
||||||
// private NavigationView navigationView;
|
|
||||||
ImageView imageViewPic;
|
ImageView imageViewPic;
|
||||||
TextView textViewName,textViewEmail;
|
TextView textViewName,textViewEmail;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_compat_locked);
|
setContentView(R.layout.timer_activity);
|
||||||
|
|
||||||
// method call to initialize the views
|
// method call to initialize the views
|
||||||
initViews();
|
initViews();
|
||||||
@ -124,25 +79,11 @@ public class LockedCompatActivity extends PinCompatActivity implements View.OnCl
|
|||||||
//Set vibrate feature
|
//Set vibrate feature
|
||||||
vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
|
vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
|
||||||
|
|
||||||
//Toggle menu
|
|
||||||
// actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.open, R.string.close);
|
|
||||||
//// drawerLayout.setDrawerListener(actionBarDrawerToggle);
|
|
||||||
// actionBarDrawerToggle.syncState();
|
|
||||||
// getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
|
||||||
|
|
||||||
//Taking Navigation menu settings
|
|
||||||
// navigationClick();
|
|
||||||
|
|
||||||
settings = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
settings = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
||||||
|
|
||||||
//Taking to feature from the setting menu
|
//Taking to feature from the setting menu
|
||||||
loadSettings();
|
loadSettings();
|
||||||
|
|
||||||
//ActionBar set
|
|
||||||
// ActionBar actionBar = getSupportActionBar();
|
|
||||||
// actionBar.setTitle("Pomodoro");
|
|
||||||
// actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar_background));
|
|
||||||
|
|
||||||
// method call to initialize the listeners
|
// method call to initialize the listeners
|
||||||
initListeners();
|
initListeners();
|
||||||
//method call to initialize the settings menu item
|
//method call to initialize the settings menu item
|
||||||
@ -150,42 +91,30 @@ public class LockedCompatActivity extends PinCompatActivity implements View.OnCl
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public void settings(View V) {
|
||||||
* method to Navigation menu settings
|
DrawerLayout mDrawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout);
|
||||||
*/
|
mDrawerLayout.openDrawer(Gravity.LEFT);
|
||||||
// public void navigationClick() {
|
}
|
||||||
// navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
|
|
||||||
// @Override
|
public void closeMenu(View v) {
|
||||||
// public boolean onNavigationItemSelected(MenuItem item) {
|
DrawerLayout d = ((DrawerLayout) findViewById(R.id.drawerLayout));
|
||||||
//
|
d.closeDrawers();
|
||||||
// if (item.getItemId() == R.id.settings) {
|
}
|
||||||
// Intent settingsIntent = new Intent(getApplicationContext(), Settings.class);
|
|
||||||
// startActivity(settingsIntent);
|
public void goToToDoList(View view) {
|
||||||
// } else if (item.getItemId() == R.id.about) {
|
Intent intentMain = new Intent(TimerActivity.this, MainActivity.class);
|
||||||
// Intent aboutIntent = new Intent(getApplicationContext(), AboutPomodoro.class);
|
startActivityForResult(intentMain, 2);
|
||||||
// startActivity(aboutIntent);
|
}
|
||||||
//
|
|
||||||
// } else if (item.getItemId() == R.id.share) {
|
public void goToSettins(View view) {
|
||||||
// Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
Intent intentMain = new Intent(TimerActivity.this, TimerSettings.class);
|
||||||
// shareIntent.setType("Text/Plain");
|
startActivityForResult(intentMain, 2);
|
||||||
// String shareBody = "There are many improvements you can experience from successfully implementing the pomodoro technique into your life, making it one of your good habits. Here are some of the improvements you will see;\n" + "\n" +
|
}
|
||||||
// "Increased productivity.\n" +
|
|
||||||
// "Improved quality and quantity of work.\n" +
|
public void goToAbout(View view) {
|
||||||
// "Better time management.\n" +
|
Intent intentMain = new Intent(TimerActivity.this, AboutPomocnik.class);
|
||||||
// "Strengthened focus and motivation.\n" +
|
startActivityForResult(intentMain, 2);
|
||||||
// "The ability to stay fresh throughout the work day.";
|
}
|
||||||
// String shareSub = "Focus with Pomodoro";
|
|
||||||
// shareIntent.putExtra(Intent.EXTRA_TEXT, shareBody);
|
|
||||||
// shareIntent.putExtra(Intent.EXTRA_SUBJECT, shareSub);
|
|
||||||
// startActivity(Intent.createChooser(shareIntent, "Share Using"));
|
|
||||||
// } else if (item.getItemId() == R.id.account) {
|
|
||||||
// Intent accountIntent = new Intent(getApplicationContext(), Facebook.class);
|
|
||||||
// startActivity(accountIntent);
|
|
||||||
// }
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* method to initialize the settings menu item
|
* method to initialize the settings menu item
|
||||||
@ -199,20 +128,18 @@ public class LockedCompatActivity extends PinCompatActivity implements View.OnCl
|
|||||||
* Method to take settings from the setting menu
|
* Method to take settings from the setting menu
|
||||||
*/
|
*/
|
||||||
private void loadSettings() {
|
private void loadSettings() {
|
||||||
vibration = settings.getBoolean("vibration", false);
|
//vibration = settings.getBoolean("vibration", false);
|
||||||
settings.registerOnSharedPreferenceChangeListener(LockedCompatActivity.this);
|
settings.registerOnSharedPreferenceChangeListener(TimerActivity.this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* method to initialize the views
|
* method to initialize the views
|
||||||
*/
|
*/
|
||||||
private void initViews() {
|
private void initViews() {
|
||||||
//drawerLayout = findViewById(R.id.drawerLayout);
|
drawerLayout = findViewById(R.id.drawerLayout);
|
||||||
//navigationView = findViewById(R.id.navigation_view);
|
|
||||||
progressBarCircle = findViewById(R.id.progressBarCircle);
|
progressBarCircle = findViewById(R.id.progressBarCircle);
|
||||||
textViewTime = findViewById(R.id.textViewTime);
|
textViewTime = findViewById(R.id.textViewTime);
|
||||||
imageViewReset = findViewById(R.id.imageViewReset);
|
imageViewReset = findViewById(R.id.imageViewReset);
|
||||||
imageViewStartStop = findViewById(R.id.imageViewStartStop);
|
|
||||||
imageViewTomato = findViewById(R.id.imageViewTomato);
|
imageViewTomato = findViewById(R.id.imageViewTomato);
|
||||||
imageViewBreak = findViewById(R.id.imageViewBreak);
|
imageViewBreak = findViewById(R.id.imageViewBreak);
|
||||||
imageViewWork = findViewById(R.id.imageViewWork);
|
imageViewWork = findViewById(R.id.imageViewWork);
|
||||||
@ -223,7 +150,6 @@ public class LockedCompatActivity extends PinCompatActivity implements View.OnCl
|
|||||||
*/
|
*/
|
||||||
private void initListeners() {
|
private void initListeners() {
|
||||||
imageViewReset.setOnClickListener(this);
|
imageViewReset.setOnClickListener(this);
|
||||||
imageViewStartStop.setOnClickListener(this);
|
|
||||||
imageViewTomato.setOnClickListener(this);
|
imageViewTomato.setOnClickListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,9 +164,6 @@ public class LockedCompatActivity extends PinCompatActivity implements View.OnCl
|
|||||||
case R.id.imageViewReset:
|
case R.id.imageViewReset:
|
||||||
reset();
|
reset();
|
||||||
break;
|
break;
|
||||||
case R.id.imageViewStartStop:
|
|
||||||
workstartStop();
|
|
||||||
break;
|
|
||||||
case R.id.imageViewTomato:
|
case R.id.imageViewTomato:
|
||||||
visibleButton();
|
visibleButton();
|
||||||
workstartStop();
|
workstartStop();
|
||||||
@ -252,13 +175,30 @@ public class LockedCompatActivity extends PinCompatActivity implements View.OnCl
|
|||||||
* method to visible start stop icon
|
* method to visible start stop icon
|
||||||
*/
|
*/
|
||||||
public void visibleButton() {
|
public void visibleButton() {
|
||||||
imageViewStartStop.setVisibility(View.VISIBLE);
|
|
||||||
imageViewTomato.setVisibility(View.GONE);
|
imageViewTomato.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* method to reset count down timer
|
* method to reset count down timer
|
||||||
*/
|
*/
|
||||||
|
private void resetAfterBreak() {
|
||||||
|
breakCount = 0;
|
||||||
|
stopCountDownTimer();
|
||||||
|
//startCountDownTimer();
|
||||||
|
textViewTime.setText(hmsTimeFormatter(timeCountInMilliSeconds));
|
||||||
|
// call to initialize the progress bar values
|
||||||
|
setProgressBarValues();
|
||||||
|
//hiding break and work icon
|
||||||
|
imageViewBreak.setVisibility(View.GONE);
|
||||||
|
imageViewWork.setVisibility(View.GONE);
|
||||||
|
imageViewTomato.setVisibility(View.VISIBLE);
|
||||||
|
// changing the timer status to stopped
|
||||||
|
timerStatus = TimerStatus.STOPPED;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void reset() {
|
private void reset() {
|
||||||
breakCount = 0;
|
breakCount = 0;
|
||||||
stopCountDownTimer();
|
stopCountDownTimer();
|
||||||
@ -269,12 +209,15 @@ public class LockedCompatActivity extends PinCompatActivity implements View.OnCl
|
|||||||
//hiding break and work icon
|
//hiding break and work icon
|
||||||
imageViewBreak.setVisibility(View.GONE);
|
imageViewBreak.setVisibility(View.GONE);
|
||||||
imageViewWork.setVisibility(View.GONE);
|
imageViewWork.setVisibility(View.GONE);
|
||||||
// changing stop icon to start icon
|
|
||||||
imageViewStartStop.setImageResource(R.mipmap.icon_start);
|
|
||||||
// changing the timer status to stopped
|
// changing the timer status to stopped
|
||||||
timerStatus = TimerStatus.STOPPED;
|
timerStatus = TimerStatus.STOPPED;
|
||||||
}
|
//vibration = settings.getBoolean("vibration", true);
|
||||||
|
vibration = true;
|
||||||
|
if (vibration) vibrator.vibrate(1000);
|
||||||
|
|
||||||
|
//checking work and break times
|
||||||
|
checkBreakOrWork();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* method to start and stop count down timer
|
* method to start and stop count down timer
|
||||||
@ -292,8 +235,6 @@ public class LockedCompatActivity extends PinCompatActivity implements View.OnCl
|
|||||||
imageViewWork.setVisibility(View.VISIBLE);
|
imageViewWork.setVisibility(View.VISIBLE);
|
||||||
// showing the reset icon
|
// showing the reset icon
|
||||||
imageViewReset.setVisibility(View.VISIBLE);
|
imageViewReset.setVisibility(View.VISIBLE);
|
||||||
// changing play icon to stop icon
|
|
||||||
imageViewStartStop.setImageResource(R.mipmap.icon_pause);
|
|
||||||
// changing the timer status to started
|
// changing the timer status to started
|
||||||
timerStatus = TimerStatus.STARTED;
|
timerStatus = TimerStatus.STARTED;
|
||||||
// call to start the count down timer
|
// call to start the count down timer
|
||||||
@ -301,8 +242,6 @@ public class LockedCompatActivity extends PinCompatActivity implements View.OnCl
|
|||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// changing stop icon to start icon
|
|
||||||
imageViewStartStop.setImageResource(R.mipmap.icon_start);
|
|
||||||
// changing the timer status to stopped
|
// changing the timer status to stopped
|
||||||
timerStatus = TimerStatus.STOPPED;
|
timerStatus = TimerStatus.STOPPED;
|
||||||
stopCountDownTimer();
|
stopCountDownTimer();
|
||||||
@ -359,22 +298,20 @@ public class LockedCompatActivity extends PinCompatActivity implements View.OnCl
|
|||||||
imageViewWork.setVisibility(View.GONE);
|
imageViewWork.setVisibility(View.GONE);
|
||||||
// hiding the break icon
|
// hiding the break icon
|
||||||
imageViewBreak.setVisibility(View.GONE);
|
imageViewBreak.setVisibility(View.GONE);
|
||||||
// changing stop icon to start icon
|
|
||||||
imageViewStartStop.setImageResource(R.mipmap.icon_start);
|
|
||||||
// changing the timer status to stopped
|
// changing the timer status to stopped
|
||||||
timerStatus = TimerStatus.STOPPED;
|
timerStatus = TimerStatus.STOPPED;
|
||||||
//Vibration
|
//Vibration
|
||||||
vibration = settings.getBoolean("vibration", true);
|
//vibration = settings.getBoolean("vibration", true);
|
||||||
|
vibration = true;
|
||||||
if (vibration) vibrator.vibrate(1000);
|
if (vibration) vibrator.vibrate(1000);
|
||||||
|
|
||||||
//checking work and break times
|
//checking work and break times
|
||||||
checkBreakOrWork();
|
checkBreakOrWork();
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
// scheduleNotification(getNotification("Time is over!!"), timeCountInMilliSeconds);
|
scheduleNotification(getNotification("Time is over!!"), timeCountInMilliSeconds);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -383,22 +320,22 @@ public class LockedCompatActivity extends PinCompatActivity implements View.OnCl
|
|||||||
* @param notification
|
* @param notification
|
||||||
* @param delay
|
* @param delay
|
||||||
*/
|
*/
|
||||||
// private void scheduleNotification(Notification notification, long delay) {
|
private void scheduleNotification(Notification notification, long delay) {
|
||||||
// if (Build.VERSION.SDK_INT < 26) {
|
if (Build.VERSION.SDK_INT < 26) {
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// Intent notificationIntent = new Intent(this, NotificationPublisher.class);
|
Intent notificationIntent = new Intent(this, NotificationPublisher.class);
|
||||||
// notificationIntent.putExtra(NotificationPublisher.NOTIFICATION_ID, 1);
|
notificationIntent.putExtra(NotificationPublisher.NOTIFICATION_ID, 1);
|
||||||
// notificationIntent.putExtra(NotificationPublisher.NOTIFICATION, notification);
|
notificationIntent.putExtra(NotificationPublisher.NOTIFICATION, notification);
|
||||||
// PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
//
|
|
||||||
// long futureInMillis = System.currentTimeMillis() + delay;
|
long futureInMillis = System.currentTimeMillis() + delay;
|
||||||
//
|
|
||||||
// AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
|
AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
|
||||||
// alarmManager.setExact(AlarmManager.RTC_WAKEUP, futureInMillis, pendingIntent);
|
alarmManager.setExact(AlarmManager.RTC_WAKEUP, futureInMillis, pendingIntent);
|
||||||
//
|
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -406,9 +343,9 @@ public class LockedCompatActivity extends PinCompatActivity implements View.OnCl
|
|||||||
*/
|
*/
|
||||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||||
private Notification getNotification(String content) {
|
private Notification getNotification(String content) {
|
||||||
Intent notificationIntent = new Intent(this, MainActivity.class);
|
Intent notificationIntent = new Intent(this, TimerActivity.class);
|
||||||
//notificationIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||||
//notificationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
notificationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
|
||||||
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
Notification builder = new Notification.Builder(this, "default")
|
Notification builder = new Notification.Builder(this, "default")
|
||||||
@ -435,6 +372,7 @@ public class LockedCompatActivity extends PinCompatActivity implements View.OnCl
|
|||||||
// System.out.println("************************ work");
|
// System.out.println("************************ work");
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(getApplicationContext(), "Finish", Toast.LENGTH_LONG).show();
|
Toast.makeText(getApplicationContext(), "Finish", Toast.LENGTH_LONG).show();
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(getApplicationContext(), "Pomodoro is over", Toast.LENGTH_LONG).show();
|
Toast.makeText(getApplicationContext(), "Pomodoro is over", Toast.LENGTH_LONG).show();
|
||||||
@ -448,7 +386,7 @@ public class LockedCompatActivity extends PinCompatActivity implements View.OnCl
|
|||||||
* method to show alert take a break
|
* method to show alert take a break
|
||||||
*/
|
*/
|
||||||
public void breakAlert() {
|
public void breakAlert() {
|
||||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(LockedCompatActivity.this);
|
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(TimerActivity.this);
|
||||||
alertDialogBuilder.setMessage("Good job! Would you like to take a break");
|
alertDialogBuilder.setMessage("Good job! Would you like to take a break");
|
||||||
|
|
||||||
alertDialogBuilder.setPositiveButton("No", new DialogInterface.OnClickListener() {
|
alertDialogBuilder.setPositiveButton("No", new DialogInterface.OnClickListener() {
|
||||||
@ -474,7 +412,7 @@ public class LockedCompatActivity extends PinCompatActivity implements View.OnCl
|
|||||||
* method to show alert take a break
|
* method to show alert take a break
|
||||||
*/
|
*/
|
||||||
public void workAlert() {
|
public void workAlert() {
|
||||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(LockedCompatActivity.this);
|
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(TimerActivity.this);
|
||||||
alertDialogBuilder.setMessage("The break is over! Now working time");
|
alertDialogBuilder.setMessage("The break is over! Now working time");
|
||||||
alertDialogBuilder.setPositiveButton("Continue", new DialogInterface.OnClickListener() {
|
alertDialogBuilder.setPositiveButton("Continue", new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -486,7 +424,7 @@ public class LockedCompatActivity extends PinCompatActivity implements View.OnCl
|
|||||||
alertDialogBuilder.setNegativeButton("Finish", new DialogInterface.OnClickListener() {
|
alertDialogBuilder.setNegativeButton("Finish", new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
reset();
|
resetAfterBreak();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -510,9 +448,6 @@ public class LockedCompatActivity extends PinCompatActivity implements View.OnCl
|
|||||||
imageViewBreak.setVisibility(View.VISIBLE);
|
imageViewBreak.setVisibility(View.VISIBLE);
|
||||||
// showing the reset icon
|
// showing the reset icon
|
||||||
imageViewReset.setVisibility(View.VISIBLE);
|
imageViewReset.setVisibility(View.VISIBLE);
|
||||||
// changing play icon to stop icon
|
|
||||||
imageViewStartStop.setImageResource(R.mipmap.icon_pause);
|
|
||||||
// making edit text not editable
|
|
||||||
// changing the timer status to started
|
// changing the timer status to started
|
||||||
timerStatus = TimerStatus.STARTED;
|
timerStatus = TimerStatus.STARTED;
|
||||||
// call to start the count down timer
|
// call to start the count down timer
|
||||||
@ -520,14 +455,10 @@ public class LockedCompatActivity extends PinCompatActivity implements View.OnCl
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
breakCount = 0;
|
breakCount = 0;
|
||||||
// changing stop icon to start icon
|
|
||||||
imageViewStartStop.setImageResource(R.mipmap.icon_start);
|
|
||||||
// changing the timer status to stopped
|
// changing the timer status to stopped
|
||||||
timerStatus = TimerStatus.STOPPED;
|
timerStatus = TimerStatus.STOPPED;
|
||||||
stopCountDownTimer();
|
stopCountDownTimer();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -564,34 +495,10 @@ public class LockedCompatActivity extends PinCompatActivity implements View.OnCl
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
getMenuInflater().inflate(R.menu.menu_main, menu);
|
getMenuInflater().inflate(R.menu.menu_main, menu);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* method to get profile pic. and name
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public boolean onOptionsItemSelected(MenuItem item) {
|
|
||||||
// if (actionBarDrawerToggle.onOptionsItemSelected(item)) {
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// if (item.getItemId() == R.id.action_settings) {
|
|
||||||
// Intent settingsIntent = new Intent(getApplicationContext(), Settings.class);
|
|
||||||
// startActivity(settingsIntent);
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// if (item.getItemId() == R.id.question) {
|
|
||||||
// Intent questionIntent = new Intent(getApplicationContext(), Questions.class);
|
|
||||||
// startActivity(questionIntent);
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// return super.onOptionsItemSelected(item);
|
|
||||||
// }
|
|
||||||
}
|
}
|
@ -1,19 +1,20 @@
|
|||||||
package com.github.omadahealth.lollipin;
|
package com.github.omadahealth.lollipin;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.preference.PreferenceActivity;
|
||||||
|
|
||||||
import lollipin.orangegangsters.github.com.lollipin.R;
|
import lollipin.orangegangsters.github.com.lollipin.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by oliviergoutay on 1/13/15.
|
* Created by nazlican on 17.12.2017.
|
||||||
*/
|
*/
|
||||||
public class NotLockedActivity extends Activity {
|
|
||||||
|
public class TimerSettings extends PreferenceActivity {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_not_locked);
|
addPreferencesFromResource(R.xml.settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
223
app/src/main/java/com/github/omadahealth/todo/AddItem.java
Normal file
@ -0,0 +1,223 @@
|
|||||||
|
package com.github.omadahealth.todo;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.DatePickerDialog;
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.app.TimePickerDialog;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.DatePicker;
|
||||||
|
import android.widget.Spinner;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.TimePicker;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lollipin.orangegangsters.github.com.lollipin.R;
|
||||||
|
|
||||||
|
import static lollipin.orangegangsters.github.com.lollipin.R.id.date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lorsqu'on ajoute une task
|
||||||
|
*/
|
||||||
|
public class AddItem extends AppCompatActivity {
|
||||||
|
private Calendar calendar;
|
||||||
|
public Spinner spinner2;
|
||||||
|
private TextView dateView, timeView;
|
||||||
|
private int year, month, day, hour, minute;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_add_item);
|
||||||
|
dateView = (TextView) findViewById(date);
|
||||||
|
timeView = (TextView) findViewById(R.id.time);
|
||||||
|
calendar = Calendar.getInstance();
|
||||||
|
year = calendar.get(Calendar.YEAR);
|
||||||
|
|
||||||
|
month = calendar.get(Calendar.MONTH);
|
||||||
|
day = calendar.get(Calendar.DAY_OF_MONTH);
|
||||||
|
hour = calendar.get(Calendar.HOUR_OF_DAY);
|
||||||
|
minute = calendar.get(Calendar.MINUTE);
|
||||||
|
try {
|
||||||
|
showDate(year, month + 1, day);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
showTime(hour, minute);
|
||||||
|
spinner2 = (Spinner) findViewById(R.id.spinner2);
|
||||||
|
addItemsOnSpinner2();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ajoute les catégories dans le spinner
|
||||||
|
*/
|
||||||
|
public void addItemsOnSpinner2() {
|
||||||
|
List<String> list = new ArrayList<>();
|
||||||
|
int i = 0;
|
||||||
|
while (i < MainActivity.getCat().size()) {
|
||||||
|
list.add(MainActivity.getCat().get(i).getName());
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
ArrayAdapter<String> dataAdapter = new ArrayAdapter<>(this,
|
||||||
|
android.R.layout.simple_spinner_item, list);
|
||||||
|
dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
spinner2.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
findViewById(R.id.textBar).setBackgroundColor(MainActivity.getCat().get(position).getColor());
|
||||||
|
findViewById(R.id.title).setBackgroundColor(MainActivity.getCat().get(position).getColor());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNothingSelected(AdapterView<?> parent) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
spinner2.setAdapter(dataAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
/**
|
||||||
|
* Set la date
|
||||||
|
* @param view View
|
||||||
|
*/
|
||||||
|
public void setDate(View view) {
|
||||||
|
showDialog(999);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set l'heure
|
||||||
|
* @param view View
|
||||||
|
*/
|
||||||
|
public void setTime(View view) {
|
||||||
|
showDialog(998);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Dialog onCreateDialog(int id) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
if (id == 999) {
|
||||||
|
return new DatePickerDialog(this,
|
||||||
|
myDateListener, year, month, day);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (id == 998) {
|
||||||
|
return new TimePickerDialog(this, myTimeListener, hour, minute, true);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ouvre un picker de date
|
||||||
|
*/
|
||||||
|
private DatePickerDialog.OnDateSetListener myDateListener = new
|
||||||
|
DatePickerDialog.OnDateSetListener() {
|
||||||
|
@Override
|
||||||
|
public void onDateSet(DatePicker arg0,
|
||||||
|
int arg1, int arg2, int arg3) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
// arg1 = year
|
||||||
|
// arg2 = month
|
||||||
|
// arg3 = day
|
||||||
|
try {
|
||||||
|
showDate(arg1, arg2 + 1, arg3);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Ouvre un picker d'heure
|
||||||
|
*/
|
||||||
|
private TimePickerDialog.OnTimeSetListener myTimeListener = new
|
||||||
|
TimePickerDialog.OnTimeSetListener() {
|
||||||
|
@Override
|
||||||
|
public void onTimeSet(TimePicker arg0,
|
||||||
|
int arg1, int arg2) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
// arg1 = year
|
||||||
|
// arg2 = month
|
||||||
|
// arg3 = day
|
||||||
|
showTime(arg1, arg2);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Affiche la date choisie
|
||||||
|
* @param year année
|
||||||
|
* @param month mois
|
||||||
|
* @param day jour
|
||||||
|
* @throws ParseException
|
||||||
|
*/
|
||||||
|
private void showDate(int year, int month, int day) throws ParseException {
|
||||||
|
String d = (String.format("%02d", day) + "/" + String.format("%02d", month) + "/" + year);
|
||||||
|
SimpleDateFormat newDateFormat = new SimpleDateFormat("dd/MM/yyyy");
|
||||||
|
Date MyDate = newDateFormat.parse(d);
|
||||||
|
newDateFormat.applyPattern("EE d MMM yyyy");
|
||||||
|
String MySDate = newDateFormat.format(MyDate);
|
||||||
|
dateView.setText(MySDate);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Affiche le temps dans la text view time
|
||||||
|
* @param hour heure
|
||||||
|
* @param minute minute
|
||||||
|
*/
|
||||||
|
private void showTime(int hour, int minute) {
|
||||||
|
timeView.setText(String.format("%02d", hour) + ":" + String.format("%02d", minute));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ferme la vue
|
||||||
|
* @param view view
|
||||||
|
*/
|
||||||
|
public void cancel(View view)
|
||||||
|
{
|
||||||
|
Intent returnIntent = new Intent();
|
||||||
|
setResult(Activity.RESULT_CANCELED,returnIntent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sauvegarde l'item et envoies les données à la Mainactivity
|
||||||
|
* @param view view
|
||||||
|
* @throws ParseException
|
||||||
|
*/
|
||||||
|
public void save(View view) throws ParseException {
|
||||||
|
Date current = new Date();
|
||||||
|
String title = ((TextView) findViewById(R.id.title)).getText().toString();
|
||||||
|
String txt = ((TextView) findViewById(R.id.txt)).getText().toString().replace('<', ' ');
|
||||||
|
if (title.equals("") || txt.equals(""))
|
||||||
|
Toast.makeText(getApplicationContext(), "Error title and description cannot be empty !", Toast.LENGTH_SHORT).show();
|
||||||
|
else {
|
||||||
|
String d = ((TextView) findViewById(R.id.date)).getText().toString() + " " + ((TextView) findViewById(R.id.time)).getText().toString();
|
||||||
|
SimpleDateFormat newDateFormat = new SimpleDateFormat("EE d MMM yyyy k:m");
|
||||||
|
Date date = newDateFormat.parse(d);
|
||||||
|
String categorie = String.valueOf(spinner2.getSelectedItem());
|
||||||
|
if (date.after(current)) {
|
||||||
|
Intent returnIntent = new Intent();
|
||||||
|
returnIntent.putExtra("title", title);
|
||||||
|
returnIntent.putExtra("txt", txt);
|
||||||
|
returnIntent.putExtra("date", d);
|
||||||
|
returnIntent.putExtra("categorie", categorie);
|
||||||
|
returnIntent.putExtra("edit", "false");
|
||||||
|
setResult(Activity.RESULT_OK, returnIntent);
|
||||||
|
finish();
|
||||||
|
} else
|
||||||
|
Toast.makeText(getApplicationContext(), "Error you can't enter a date that is already passed !", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
package com.github.omadahealth.todo;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lollipin.orangegangsters.github.com.lollipin.R;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Le custom adapteur pour la listview catégorie
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class CatAdapter extends ArrayAdapter<Categorie> {
|
||||||
|
public CatAdapter(Context context, List<Categorie> Categorie) {
|
||||||
|
super(context, 0, Categorie);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
|
||||||
|
if (convertView == null) {
|
||||||
|
convertView = LayoutInflater.from(getContext()).inflate(R.layout.row_category, parent, false);
|
||||||
|
}
|
||||||
|
CatAdapter.CatHolder viewHolder = (CatHolder) convertView.getTag();
|
||||||
|
if (viewHolder == null) {
|
||||||
|
viewHolder = new CatAdapter.CatHolder();
|
||||||
|
viewHolder.name = (TextView) convertView.findViewById(R.id.title);
|
||||||
|
viewHolder.color = (TextView) convertView.findViewById(R.id.color);
|
||||||
|
convertView.setTag(viewHolder);
|
||||||
|
}
|
||||||
|
Categorie cat = getItem(position);
|
||||||
|
if (cat != null) {
|
||||||
|
viewHolder.name.setText(cat.getName());
|
||||||
|
viewHolder.color.setBackgroundColor(cat.getColor());
|
||||||
|
}
|
||||||
|
return convertView;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class CatHolder {
|
||||||
|
public TextView name;
|
||||||
|
public TextView color;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
75
app/src/main/java/com/github/omadahealth/todo/Categorie.java
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
package com.github.omadahealth.todo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Classe catégorie
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class Categorie {
|
||||||
|
private String name;
|
||||||
|
private int color;
|
||||||
|
private boolean show;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructeur
|
||||||
|
* @param n nom
|
||||||
|
* @param c couleur
|
||||||
|
*/
|
||||||
|
public Categorie(String n, int c)
|
||||||
|
{
|
||||||
|
this.name = n;
|
||||||
|
this.color = c;
|
||||||
|
show = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renvoie le nom de la catégorie
|
||||||
|
* @return nom de la catégorie
|
||||||
|
*/
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return (this.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renvoies la couleur de la catégorie
|
||||||
|
* @return couleur de la catégorie
|
||||||
|
*/
|
||||||
|
public int getColor()
|
||||||
|
{
|
||||||
|
return (this.color);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set le nom de la catégorie
|
||||||
|
* @param n nom
|
||||||
|
*/
|
||||||
|
public void setName(String n)
|
||||||
|
{
|
||||||
|
this.name = n;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set la couleur
|
||||||
|
* @param c couleur
|
||||||
|
*/
|
||||||
|
public void setColor(int c)
|
||||||
|
{
|
||||||
|
this.color = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pemret de savoir si la catégorie doit être affichée
|
||||||
|
* @return boolean affichage de la catgorie
|
||||||
|
*/
|
||||||
|
public boolean getShow() {
|
||||||
|
return this.show;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set la catégorie en visible ou invible
|
||||||
|
* @param show1 true ou false
|
||||||
|
*/
|
||||||
|
public void setShow(boolean show1) {
|
||||||
|
this.show = show1;
|
||||||
|
}
|
||||||
|
}
|
256
app/src/main/java/com/github/omadahealth/todo/EditItem.java
Normal file
@ -0,0 +1,256 @@
|
|||||||
|
package com.github.omadahealth.todo;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.DatePickerDialog;
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.app.TimePickerDialog;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.DatePicker;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.Spinner;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.TimePicker;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lollipin.orangegangsters.github.com.lollipin.R;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lorsqu'une task est éditée
|
||||||
|
*/
|
||||||
|
public class EditItem extends AppCompatActivity {
|
||||||
|
|
||||||
|
int year, month, day, hour, minute;
|
||||||
|
boolean cancel;
|
||||||
|
Spinner spinner2;
|
||||||
|
String previousDate;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
cancel = false;
|
||||||
|
setContentView(R.layout.activity_edit_item);
|
||||||
|
String title = getIntent().getStringExtra("title");
|
||||||
|
String txt = getIntent().getStringExtra("txt");
|
||||||
|
String date = getIntent().getStringExtra("date");
|
||||||
|
String time = getIntent().getStringExtra("time");
|
||||||
|
previousDate = date + " " + time;
|
||||||
|
String categorie = getIntent().getStringExtra("categorie");
|
||||||
|
spinner2 = (Spinner) findViewById(R.id.spinner2);
|
||||||
|
addItemsOnSpinner2();
|
||||||
|
int i = 0;
|
||||||
|
int selection = 0;
|
||||||
|
while (i < MainActivity.getCat().size()) {
|
||||||
|
if (categorie.equals(MainActivity.getCat().get(i).getName())) {
|
||||||
|
((RelativeLayout) findViewById(R.id.textBar)).setBackgroundColor(MainActivity.getCat().get(i).getColor());
|
||||||
|
((RelativeLayout) findViewById(R.id.textBar1)).setBackgroundColor(MainActivity.getCat().get(i).getColor());
|
||||||
|
((TextView) findViewById(R.id.title)).setBackgroundColor(MainActivity.getCat().get(i).getColor());
|
||||||
|
selection = i;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
spinner2.setSelection(selection);
|
||||||
|
((TextView) findViewById(R.id.time2)).setText(time);
|
||||||
|
((TextView) findViewById(R.id.date2)).setText(date);
|
||||||
|
((TextView) findViewById(R.id.title)).setText(title);
|
||||||
|
((TextView) findViewById(R.id.txt)).setText(txt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ajoute les catégories dans le spinner
|
||||||
|
*/
|
||||||
|
public void addItemsOnSpinner2() {
|
||||||
|
List<String> list = new ArrayList<String>();
|
||||||
|
int i = 0;
|
||||||
|
while (i < MainActivity.getCat().size()) {
|
||||||
|
list.add(MainActivity.getCat().get(i).getName());
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this,
|
||||||
|
android.R.layout.simple_spinner_item, list);
|
||||||
|
dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
|
spinner2.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
((RelativeLayout) findViewById(R.id.textBar)).setBackgroundColor(MainActivity.getCat().get(position).getColor());
|
||||||
|
((RelativeLayout) findViewById(R.id.textBar1)).setBackgroundColor(MainActivity.getCat().get(position).getColor());
|
||||||
|
((TextView) findViewById(R.id.title)).setBackgroundColor(MainActivity.getCat().get(position).getColor());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNothingSelected(AdapterView<?> parent) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
spinner2.setAdapter(dataAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set la date
|
||||||
|
* @param view
|
||||||
|
*/
|
||||||
|
public void setDate(View view) {
|
||||||
|
showDialog(999);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set l'heure
|
||||||
|
* @param view
|
||||||
|
*/
|
||||||
|
public void setTime(View view) {
|
||||||
|
showDialog(998);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Dialog onCreateDialog(int id) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
if (id == 999) {
|
||||||
|
return new DatePickerDialog(this,
|
||||||
|
myDateListener, year, month, day);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (id == 998) {
|
||||||
|
return new TimePickerDialog(this, myTimeListener, hour, minute, true);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private DatePickerDialog.OnDateSetListener myDateListener = new
|
||||||
|
DatePickerDialog.OnDateSetListener() {
|
||||||
|
@Override
|
||||||
|
public void onDateSet(DatePicker arg0,
|
||||||
|
int arg1, int arg2, int arg3) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
// arg1 = year
|
||||||
|
// arg2 = month
|
||||||
|
// arg3 = day
|
||||||
|
try {
|
||||||
|
showDate(arg1, arg2 + 1, arg3);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
private TimePickerDialog.OnTimeSetListener myTimeListener = new
|
||||||
|
TimePickerDialog.OnTimeSetListener() {
|
||||||
|
@Override
|
||||||
|
public void onTimeSet(TimePicker arg0,
|
||||||
|
int arg1, int arg2) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
// arg1 = year
|
||||||
|
// arg2 = month
|
||||||
|
// arg3 = day
|
||||||
|
showTime(arg1, arg2);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Aaffiche la date
|
||||||
|
* @param year
|
||||||
|
* @param month
|
||||||
|
* @param day
|
||||||
|
* @throws ParseException
|
||||||
|
*/
|
||||||
|
private void showDate(int year, int month, int day) throws ParseException {
|
||||||
|
String d = (String.format("%02d", day) + "/" + String.format("%02d", month) + "/" + year);
|
||||||
|
SimpleDateFormat newDateFormat = new SimpleDateFormat("dd/MM/yyyy");
|
||||||
|
Date MyDate = newDateFormat.parse(d);
|
||||||
|
newDateFormat.applyPattern("EE d MMM yyyy");
|
||||||
|
String MySDate = newDateFormat.format(MyDate);
|
||||||
|
((TextView) findViewById(R.id.date2)).setText(MySDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Affiche l'heure
|
||||||
|
* @param hour
|
||||||
|
* @param minute
|
||||||
|
*/
|
||||||
|
private void showTime(int hour, int minute) {
|
||||||
|
((TextView) findViewById(R.id.time2)).setText(String.format("%02d", hour) + ":" + String.format("%02d", minute));
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Supprime la tache
|
||||||
|
* @param v
|
||||||
|
*/
|
||||||
|
public void delete(View v) {
|
||||||
|
final Dialog dialog = new Dialog(this);
|
||||||
|
dialog.setContentView(R.layout.delete_task);
|
||||||
|
dialog.findViewById(R.id.cancel).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dialog.findViewById(R.id.yes).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
String title = ((TextView) findViewById(R.id.title)).getText().toString();
|
||||||
|
String txt = ((TextView) findViewById(R.id.txt)).getText().toString();
|
||||||
|
String d = ((TextView) findViewById(R.id.date2)).getText().toString() + " " + ((TextView) findViewById(R.id.time2)).getText().toString();
|
||||||
|
Intent returnIntent = new Intent();
|
||||||
|
returnIntent.putExtra("title", title);
|
||||||
|
returnIntent.putExtra("txt", txt);
|
||||||
|
returnIntent.putExtra("date", d);
|
||||||
|
returnIntent.putExtra("edit", "true");
|
||||||
|
returnIntent.putExtra("position", getIntent().getStringExtra("position"));
|
||||||
|
returnIntent.putExtra("categorie", "null");
|
||||||
|
returnIntent.putExtra("delete", "true");
|
||||||
|
setResult(Activity.RESULT_OK, returnIntent);
|
||||||
|
finish();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enregistre les modifications
|
||||||
|
* @param v
|
||||||
|
* @throws ParseException
|
||||||
|
*/
|
||||||
|
public void save(View v) throws ParseException {
|
||||||
|
Date current = new Date();
|
||||||
|
String title = ((TextView) findViewById(R.id.title)).getText().toString();
|
||||||
|
String txt = ((TextView) findViewById(R.id.txt)).getText().toString().replace('<', ' ');
|
||||||
|
String d = ((TextView) findViewById(R.id.date2)).getText().toString() + " " + ((TextView) findViewById(R.id.time2)).getText().toString();
|
||||||
|
String categorie = String.valueOf(spinner2.getSelectedItem());
|
||||||
|
SimpleDateFormat newDateFormat = new SimpleDateFormat("EE d MMM yyyy k:m");
|
||||||
|
Date date = newDateFormat.parse(d);
|
||||||
|
Date oldDate = newDateFormat.parse(previousDate);
|
||||||
|
if (date.after(current) || date.equals(oldDate)) {
|
||||||
|
Intent returnIntent = new Intent();
|
||||||
|
returnIntent.putExtra("title", title);
|
||||||
|
returnIntent.putExtra("txt", txt);
|
||||||
|
returnIntent.putExtra("date", d);
|
||||||
|
returnIntent.putExtra("edit", "true");
|
||||||
|
returnIntent.putExtra("position", getIntent().getStringExtra("position"));
|
||||||
|
returnIntent.putExtra("categorie", categorie);
|
||||||
|
returnIntent.putExtra("delete", "false");
|
||||||
|
setResult(Activity.RESULT_OK, returnIntent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Toast.makeText(getApplicationContext(), "Error you can't enter a date that is already passed !", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ferme la vue
|
||||||
|
* @param v
|
||||||
|
*/
|
||||||
|
public void cancel(View v) {
|
||||||
|
Intent returnIntent = new Intent();
|
||||||
|
setResult(Activity.RESULT_CANCELED, returnIntent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
214
app/src/main/java/com/github/omadahealth/todo/Item.java
Normal file
@ -0,0 +1,214 @@
|
|||||||
|
package com.github.omadahealth.todo;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Classe Item
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
public class Item {
|
||||||
|
private String title;
|
||||||
|
private String text;
|
||||||
|
private boolean passed;
|
||||||
|
private Date dueDate;
|
||||||
|
private Status status;
|
||||||
|
private String dateColor;
|
||||||
|
private String categorie;
|
||||||
|
public enum Status {TODO, DONE}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructeur
|
||||||
|
* @param title titre
|
||||||
|
* @param text descritpion
|
||||||
|
* @param dueDate date
|
||||||
|
*/
|
||||||
|
public Item(String title, String text, Date dueDate)
|
||||||
|
{
|
||||||
|
this.title = title;
|
||||||
|
this.text = text;
|
||||||
|
this.passed = false;
|
||||||
|
this.dueDate = dueDate;
|
||||||
|
this.status = Status.TODO;
|
||||||
|
this.dateColor = "#AFAFAF";
|
||||||
|
this.categorie = "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set la couleur de la date
|
||||||
|
* @param c couleur
|
||||||
|
*/
|
||||||
|
public void setDateColor(String c)
|
||||||
|
{
|
||||||
|
this.dateColor = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renvoie la couleur de la date
|
||||||
|
* @return la couleur de la date
|
||||||
|
*/
|
||||||
|
public String getDateColor()
|
||||||
|
{
|
||||||
|
return this.dateColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renvoie le titre de la task
|
||||||
|
* @return le titre
|
||||||
|
*/
|
||||||
|
public String getTitle()
|
||||||
|
{
|
||||||
|
return (this.title);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set le titre de la task
|
||||||
|
* @param title le titre
|
||||||
|
*/
|
||||||
|
public void setTitle(String title)
|
||||||
|
{
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renvoies la description de la task
|
||||||
|
* @return la description
|
||||||
|
*/
|
||||||
|
public String getText()
|
||||||
|
{
|
||||||
|
return (this.text);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set la description de la tache
|
||||||
|
* @param text la description
|
||||||
|
*/
|
||||||
|
public void setText(String text)
|
||||||
|
{
|
||||||
|
this.text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDueDate()
|
||||||
|
{
|
||||||
|
SimpleDateFormat newDateFormat = new SimpleDateFormat("dd/MM/yyyy\nHH:mm");
|
||||||
|
String MySDate = "due till " + newDateFormat.format(this.dueDate);
|
||||||
|
return MySDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renvoies la date au format EE d MMM yyyy
|
||||||
|
* @return la date au format EE d MMM yyyy
|
||||||
|
*/
|
||||||
|
public String getDate()
|
||||||
|
{
|
||||||
|
SimpleDateFormat newDateFormat = new SimpleDateFormat("EE d MMM yyyy");
|
||||||
|
String MySDate = newDateFormat.format(this.dueDate);
|
||||||
|
return MySDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renvoie l'heure au format HH:mm
|
||||||
|
* @return l'heure au format HH:mm
|
||||||
|
*/
|
||||||
|
public String getTime()
|
||||||
|
{
|
||||||
|
SimpleDateFormat newDateFormat = new SimpleDateFormat("HH:mm");
|
||||||
|
String MySDate = newDateFormat.format(this.dueDate);
|
||||||
|
return MySDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renvoies la date au format dd/MM
|
||||||
|
* @return la date au format dd/MM
|
||||||
|
*/
|
||||||
|
public String getMonth()
|
||||||
|
{
|
||||||
|
SimpleDateFormat newDateFormat = new SimpleDateFormat("dd/MM");
|
||||||
|
String MySDate = newDateFormat.format(this.dueDate);
|
||||||
|
return MySDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renvoies l'année au format yyyy
|
||||||
|
* @return l'année au format yyyy
|
||||||
|
*/
|
||||||
|
public String getYear()
|
||||||
|
{
|
||||||
|
SimpleDateFormat newDateFormat = new SimpleDateFormat("yyyy");
|
||||||
|
String MySDate = newDateFormat.format(this.dueDate);
|
||||||
|
return MySDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renvoie la Date
|
||||||
|
* @return la Date
|
||||||
|
*/
|
||||||
|
public Date getRealDate()
|
||||||
|
{
|
||||||
|
return this.dueDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set la date
|
||||||
|
* @param dueDate la date
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void setDueDate(Date dueDate)
|
||||||
|
{
|
||||||
|
this.dueDate = dueDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renvoie le status de la tache
|
||||||
|
* @return ToDo ou Done
|
||||||
|
*/
|
||||||
|
public Status getStatus()
|
||||||
|
{
|
||||||
|
return (this.status);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renvoie si la tache est passée dans le temps
|
||||||
|
* @return true ou false
|
||||||
|
*/
|
||||||
|
public boolean getPassed() {
|
||||||
|
return this.passed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set si la tache est passée dans le temps
|
||||||
|
* @param b true ou false
|
||||||
|
*/
|
||||||
|
public void setPassed(boolean b)
|
||||||
|
{
|
||||||
|
this.passed = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set le status de la tache
|
||||||
|
* @param status ToDo ou Done
|
||||||
|
*/
|
||||||
|
public void setStatus(Status status)
|
||||||
|
{
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set la catégorie de la tache
|
||||||
|
* @param cat la catégorie
|
||||||
|
*/
|
||||||
|
public void setCategorie(String cat)
|
||||||
|
{
|
||||||
|
this.categorie = cat;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renvoie le nom de la catégorie de la tache
|
||||||
|
* @return le nom de la catégorie
|
||||||
|
*/
|
||||||
|
public String getCategorie()
|
||||||
|
{
|
||||||
|
return this.categorie;
|
||||||
|
}
|
||||||
|
}
|
106
app/src/main/java/com/github/omadahealth/todo/ItemAdapter.java
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
package com.github.omadahealth.todo;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lollipin.orangegangsters.github.com.lollipin.R;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom adaptateur pour les Items
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class ItemAdapter extends ArrayAdapter<Item> {
|
||||||
|
|
||||||
|
public ItemAdapter(Context context, List<Item> Items) {
|
||||||
|
super(context, 0, Items);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
|
||||||
|
if (convertView == null) {
|
||||||
|
convertView = LayoutInflater.from(getContext()).inflate(R.layout.row_item, parent, false);
|
||||||
|
}
|
||||||
|
ItemViewHolder viewHolder = (ItemViewHolder) convertView.getTag();
|
||||||
|
if (viewHolder == null) {
|
||||||
|
viewHolder = new ItemViewHolder();
|
||||||
|
viewHolder.title = (TextView) convertView.findViewById(R.id.title);
|
||||||
|
viewHolder.text = (TextView) convertView.findViewById(R.id.text);
|
||||||
|
viewHolder.dateHour = (TextView) convertView.findViewById(R.id.dateHour);
|
||||||
|
viewHolder.dateMonth = (TextView) convertView.findViewById(R.id.dateMonth);
|
||||||
|
viewHolder.dateYear = (TextView) convertView.findViewById(R.id.dateYear);
|
||||||
|
viewHolder.categorie = (TextView) convertView.findViewById(R.id.categorie);
|
||||||
|
viewHolder.back = (LinearLayout) convertView.findViewById(R.id.back);
|
||||||
|
convertView.setTag(viewHolder);
|
||||||
|
}
|
||||||
|
Item Item = getItem(position);
|
||||||
|
final ArrayList<Categorie> cat = MainActivity.getCat();
|
||||||
|
viewHolder.back.setBackgroundColor(Color.WHITE);
|
||||||
|
boolean found = false;
|
||||||
|
int i = 0;
|
||||||
|
while (i < cat.size()) {
|
||||||
|
if (Item.getCategorie().equals(cat.get(i).getName())) {
|
||||||
|
found = true;
|
||||||
|
int color = cat.get(i).getColor();
|
||||||
|
String lighter = "#15" + Integer.toHexString(color).substring(2);
|
||||||
|
viewHolder.categorie.setBackgroundColor(cat.get(i).getColor());
|
||||||
|
if (Item.getStatus() == com.github.omadahealth.todo.Item.Status.DONE)
|
||||||
|
viewHolder.back.setBackgroundColor(Color.parseColor(lighter));
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
Item.setCategorie("none");
|
||||||
|
int color = cat.get(0).getColor();
|
||||||
|
String lighter = "#15" + Integer.toHexString(color).substring(2);
|
||||||
|
if (Item.getStatus() == com.github.omadahealth.todo.Item.Status.DONE)
|
||||||
|
viewHolder.back.setBackgroundColor(Color.parseColor(lighter));
|
||||||
|
viewHolder.categorie.setBackgroundColor(cat.get(0).getColor());
|
||||||
|
}
|
||||||
|
viewHolder.title.setText(Item.getTitle());
|
||||||
|
viewHolder.dateHour.setTextColor(Color.parseColor(Item.getDateColor()));
|
||||||
|
viewHolder.dateMonth.setTextColor(Color.parseColor(Item.getDateColor()));
|
||||||
|
viewHolder.dateYear.setTextColor(Color.parseColor(Item.getDateColor()));
|
||||||
|
viewHolder.text.setText(Item.getText());
|
||||||
|
viewHolder.dateMonth.setText(Item.getMonth());
|
||||||
|
viewHolder.dateYear.setText(Item.getYear());
|
||||||
|
viewHolder.dateHour.setText(Item.getTime());
|
||||||
|
|
||||||
|
return convertView;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ItemViewHolder {
|
||||||
|
public TextView title;
|
||||||
|
public TextView text;
|
||||||
|
public TextView dateHour;
|
||||||
|
public TextView dateYear;
|
||||||
|
public TextView dateMonth;
|
||||||
|
public TextView categorie;
|
||||||
|
public LinearLayout back;
|
||||||
|
}
|
||||||
|
|
||||||
|
public View getViewByPosition(int pos, ListView listView) {
|
||||||
|
final int firstListItemPosition = listView.getFirstVisiblePosition();
|
||||||
|
final int lastListItemPosition = firstListItemPosition + listView.getChildCount() - 1;
|
||||||
|
|
||||||
|
if (pos < firstListItemPosition || pos > lastListItemPosition) {
|
||||||
|
return listView.getAdapter().getView(pos, null, listView);
|
||||||
|
} else {
|
||||||
|
final int childIndex = pos - firstListItemPosition;
|
||||||
|
return listView.getChildAt(childIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
602
app/src/main/java/com/github/omadahealth/todo/MainActivity.java
Normal file
@ -0,0 +1,602 @@
|
|||||||
|
package com.github.omadahealth.todo;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.AlarmManager;
|
||||||
|
import android.app.Notification;
|
||||||
|
import android.app.PendingIntent;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.SystemClock;
|
||||||
|
import android.support.annotation.RequiresApi;
|
||||||
|
import android.support.v4.widget.DrawerLayout;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.CompoundButton;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.daimajia.swipe.SwipeLayout;
|
||||||
|
import com.github.omadahealth.lollipin.TimerActivity;
|
||||||
|
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lollipin.orangegangsters.github.com.lollipin.R;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Classe principale du projet
|
||||||
|
*/
|
||||||
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
int id;
|
||||||
|
public static ListView mListView, checkListView;
|
||||||
|
public static List<Item> items = new ArrayList<>();
|
||||||
|
public static List<Item> tmp = new ArrayList<>();
|
||||||
|
public static ArrayList<Categorie> cat = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
TextView nb_tasks;
|
||||||
|
public static boolean aff_done, aff_todo, aff_passed, aff_ondate;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_main_todo);
|
||||||
|
mListView = (ListView) findViewById(R.id.listView);
|
||||||
|
checkListView = (ListView) findViewById(R.id.checkCat);
|
||||||
|
nb_tasks = (TextView) findViewById(R.id.nb_tasks);
|
||||||
|
aff_done = true;
|
||||||
|
aff_todo = true;
|
||||||
|
aff_passed = true;
|
||||||
|
aff_ondate = true;
|
||||||
|
id = 0;
|
||||||
|
|
||||||
|
CheckBox checkToDo = (CheckBox) findViewById(R.id.switch_todo);
|
||||||
|
checkToDo.setChecked(true);
|
||||||
|
checkToDo.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
|
||||||
|
if (b)
|
||||||
|
aff_todo = true;
|
||||||
|
else
|
||||||
|
aff_todo = false;
|
||||||
|
affListCorresponding();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
CheckBox checkDone = (CheckBox) findViewById(R.id.switch_done);
|
||||||
|
checkDone.setChecked(true);
|
||||||
|
checkDone.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
|
if (isChecked)
|
||||||
|
aff_done = true;
|
||||||
|
else
|
||||||
|
aff_done = false;
|
||||||
|
affListCorresponding();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
CheckBox checkPassed = (CheckBox) findViewById(R.id.switch_passed);
|
||||||
|
checkPassed.setChecked(true);
|
||||||
|
checkPassed.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
|
if (isChecked)
|
||||||
|
aff_passed = true;
|
||||||
|
else
|
||||||
|
aff_passed = false;
|
||||||
|
affListCorresponding();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
CheckBox checkOnDate = (CheckBox) findViewById(R.id.switch_ondate);
|
||||||
|
checkOnDate.setChecked(true);
|
||||||
|
checkOnDate.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
|
if (isChecked)
|
||||||
|
aff_ondate = true;
|
||||||
|
else
|
||||||
|
aff_ondate = false;
|
||||||
|
affListCorresponding();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
getData();
|
||||||
|
getCatData();
|
||||||
|
if (cat.size() == 0)
|
||||||
|
cat.add(new Categorie("none", Color.parseColor("#262D3B")));
|
||||||
|
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
|
||||||
|
Intent intentMain = new Intent(MainActivity.this, EditItem.class);
|
||||||
|
Item item = (Item) mListView.getAdapter().getItem(position);
|
||||||
|
String title = item.getTitle();
|
||||||
|
String time = item.getTime();
|
||||||
|
String txt = item.getText();
|
||||||
|
String date = item.getDate();
|
||||||
|
String categorie = item.getCategorie();
|
||||||
|
intentMain.putExtra("position", String.valueOf(position));
|
||||||
|
intentMain.putExtra("title", title);
|
||||||
|
intentMain.putExtra("txt", txt);
|
||||||
|
intentMain.putExtra("date", date);
|
||||||
|
intentMain.putExtra("time", time);
|
||||||
|
intentMain.putExtra("categorie", categorie);
|
||||||
|
startActivityForResult(intentMain, 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ItemAdapter adapter = new ItemAdapter(MainActivity.this, items);
|
||||||
|
checkAdapter adapter1 = new checkAdapter(MainActivity.this, cat);
|
||||||
|
checkListView.setAdapter(adapter1);
|
||||||
|
mListView.setAdapter(adapter);
|
||||||
|
checkDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recup les données des tasks dans la db
|
||||||
|
*/
|
||||||
|
public void getData() {
|
||||||
|
List<Item> list = new ArrayList<>();
|
||||||
|
Item tmp;
|
||||||
|
SQLiteDatabase mydatabase = openOrCreateDatabase("todolist", MODE_PRIVATE, null);
|
||||||
|
mydatabase.execSQL("CREATE TABLE IF NOT EXISTS tasks(Titre VARCHAR, Date VARCHAR, Status VARCHAR, Txt VARCHAR, Cat VARCHAR);");
|
||||||
|
Cursor resultSet = mydatabase.rawQuery("Select * from tasks", null);
|
||||||
|
resultSet.moveToFirst();
|
||||||
|
int count = 0;
|
||||||
|
while (count < resultSet.getCount())
|
||||||
|
{
|
||||||
|
String title = resultSet.getString(resultSet.getColumnIndex("Titre"));
|
||||||
|
String date = resultSet.getString(resultSet.getColumnIndex("Date"));
|
||||||
|
String status = resultSet.getString(resultSet.getColumnIndex("Status"));
|
||||||
|
String txt = resultSet.getString(resultSet.getColumnIndex("Txt"));
|
||||||
|
String cat = resultSet.getString(resultSet.getColumnIndex("Cat"));
|
||||||
|
Date d = new Date();
|
||||||
|
SimpleDateFormat newDateFormat = new SimpleDateFormat("EE d MMM yyyyHH:mm");
|
||||||
|
try {
|
||||||
|
d = newDateFormat.parse(date);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
tmp = new Item(title, txt, d);
|
||||||
|
if (status.equals(Item.Status.DONE.toString()))
|
||||||
|
tmp.setStatus(Item.Status.DONE);
|
||||||
|
else
|
||||||
|
tmp.setStatus(Item.Status.TODO);
|
||||||
|
tmp.setCategorie(cat);
|
||||||
|
list.add(tmp);
|
||||||
|
count++;
|
||||||
|
resultSet.moveToNext();
|
||||||
|
}
|
||||||
|
items = list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recup les données des catégories dans la db
|
||||||
|
*/
|
||||||
|
public void getCatData() {
|
||||||
|
ArrayList<Categorie> list = new ArrayList<>();
|
||||||
|
Categorie tmp;
|
||||||
|
SQLiteDatabase mydatabase = openOrCreateDatabase("todolist", MODE_PRIVATE, null);
|
||||||
|
mydatabase.execSQL("CREATE TABLE IF NOT EXISTS cats(Name VARCHAR, Color VARCHAR);");
|
||||||
|
Cursor resultSet = mydatabase.rawQuery("Select * from cats", null);
|
||||||
|
resultSet.moveToFirst();
|
||||||
|
int count = 0;
|
||||||
|
while (count < resultSet.getCount()) {
|
||||||
|
String name = resultSet.getString(resultSet.getColumnIndex("Name"));
|
||||||
|
String color = resultSet.getString(resultSet.getColumnIndex("Color"));
|
||||||
|
tmp = new Categorie(name, Integer.parseInt(color));
|
||||||
|
list.add(tmp);
|
||||||
|
count++;
|
||||||
|
resultSet.moveToNext();
|
||||||
|
}
|
||||||
|
cat = list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns value to insert in db
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String addToDataBase(int i) {
|
||||||
|
Item tmp = items.get(i);
|
||||||
|
String query = "'";
|
||||||
|
query += tmp.getTitle() + "','";
|
||||||
|
query += tmp.getDate() + tmp.getTime() + "','";
|
||||||
|
query += tmp.getStatus().toString() + "','";
|
||||||
|
query += tmp.getText() + "','";
|
||||||
|
query += tmp.getCategorie() + "'";
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sauvegarde les tasks dans la db
|
||||||
|
*/
|
||||||
|
public void saveData() {
|
||||||
|
String query;
|
||||||
|
SQLiteDatabase mydatabase = openOrCreateDatabase("todolist", MODE_PRIVATE, null);
|
||||||
|
mydatabase.execSQL("DROP TABLE IF EXISTS tasks");
|
||||||
|
mydatabase.execSQL("CREATE TABLE IF NOT EXISTS tasks(Titre VARCHAR, Date VARCHAR, Status VARCHAR, Txt VARCHAR, Cat VARCHAR);");
|
||||||
|
|
||||||
|
for (int i = 0; i < items.size(); i++) {
|
||||||
|
query = addToDataBase(i);
|
||||||
|
mydatabase.execSQL("INSERT INTO tasks VALUES(" + query + ");");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sauvegarde les catégories dans la db
|
||||||
|
*/
|
||||||
|
public void saveCategory() {
|
||||||
|
String query;
|
||||||
|
SQLiteDatabase mydatabase = openOrCreateDatabase("todolist", MODE_PRIVATE, null);
|
||||||
|
mydatabase.execSQL("DROP TABLE IF EXISTS cats");
|
||||||
|
mydatabase.execSQL("CREATE TABLE IF NOT EXISTS cats(Name VARCHAR, Color VARCHAR);");
|
||||||
|
for (int i = 0; i < cat.size(); i++) {
|
||||||
|
query = "'" + cat.get(i).getName() + "','" + String.valueOf(cat.get(i).getColor()) + "'";
|
||||||
|
mydatabase.execSQL("INSERT INTO cats VALUES(" + query + ");");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ouvre le menu settings pour l'affichage et les catégories
|
||||||
|
*
|
||||||
|
* @param V
|
||||||
|
*/
|
||||||
|
public void settings(View V) {
|
||||||
|
DrawerLayout mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||||
|
mDrawerLayout.openDrawer(Gravity.LEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ouvre l'activité pour ajouter un Item
|
||||||
|
*
|
||||||
|
* @param v
|
||||||
|
*/
|
||||||
|
public void add(View v) {
|
||||||
|
Intent intentMain = new Intent(MainActivity.this, AddItem.class);
|
||||||
|
startActivityForResult(intentMain, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
|
||||||
|
if (requestCode == 1) {
|
||||||
|
if (resultCode == Activity.RESULT_OK) {
|
||||||
|
String title = data.getStringExtra("title");
|
||||||
|
String txt = data.getStringExtra("txt");
|
||||||
|
String date = data.getStringExtra("date");
|
||||||
|
String delete = data.getStringExtra("delete");
|
||||||
|
String category = data.getStringExtra("categorie");
|
||||||
|
SimpleDateFormat newDateFormat = new SimpleDateFormat("EE d MMM yyyy k:m");
|
||||||
|
Date d = null;
|
||||||
|
try {
|
||||||
|
d = newDateFormat.parse(date);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if (data.getStringExtra("edit").equals("true")) {
|
||||||
|
int position = Integer.parseInt(data.getStringExtra("position"));
|
||||||
|
try {
|
||||||
|
modifyItem(position, title, txt, d, delete, category);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Item newItem = new Item(title, txt, d);
|
||||||
|
newItem.setCategorie(category);
|
||||||
|
try {
|
||||||
|
addToList(newItem);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (resultCode == Activity.RESULT_CANCELED) {
|
||||||
|
//here goes nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (requestCode == 2) {
|
||||||
|
if (resultCode == Activity.RESULT_OK) {
|
||||||
|
saveCategory();
|
||||||
|
checkCategories();
|
||||||
|
affListCorresponding();
|
||||||
|
((checkAdapter) checkListView.getAdapter()).notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
if (resultCode == Activity.RESULT_CANCELED) {
|
||||||
|
saveCategory();
|
||||||
|
checkCategories();
|
||||||
|
affListCorresponding();
|
||||||
|
((checkAdapter) checkListView.getAdapter()).notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Affiche en rouge la date de la l'item si la date est déjà passée
|
||||||
|
*/
|
||||||
|
public void checkDate() {
|
||||||
|
int i = 0;
|
||||||
|
Date d;
|
||||||
|
|
||||||
|
d = new Date();
|
||||||
|
nb_tasks.setText(String.valueOf(items.size()) + " Tasks");
|
||||||
|
while (i < items.size()) {
|
||||||
|
if (!(items.get(i).getRealDate().after(d))) {
|
||||||
|
items.get(i).setPassed(true);
|
||||||
|
items.get(i).setDateColor("#FF0000");
|
||||||
|
} else {
|
||||||
|
items.get(i).setPassed(false);
|
||||||
|
items.get(i).setDateColor("#121212");
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ajoute un item à la liste des items
|
||||||
|
*
|
||||||
|
* @param item
|
||||||
|
* @throws ParseException
|
||||||
|
*/
|
||||||
|
public void addToList(Item item) throws ParseException {
|
||||||
|
items.add(item);
|
||||||
|
checkDate();
|
||||||
|
saveData();
|
||||||
|
Date f = new Date();
|
||||||
|
int c = 0;
|
||||||
|
int color = Color.BLUE;
|
||||||
|
while (c < cat.size()) {
|
||||||
|
if (item.getCategorie().equals(cat.get(c).getName())) {
|
||||||
|
color = cat.get(c).getColor();
|
||||||
|
}
|
||||||
|
c++;
|
||||||
|
}
|
||||||
|
int delay = (int) (item.getRealDate().getTime() - f.getTime());
|
||||||
|
if (delay > 0)
|
||||||
|
scheduleNotification(getNotification(item.getTitle(), item.getText(), color), delay);
|
||||||
|
affListCorresponding();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modifie un item déja existant
|
||||||
|
*
|
||||||
|
* @param position
|
||||||
|
* @param title
|
||||||
|
* @param txt
|
||||||
|
* @param d
|
||||||
|
* @param delete
|
||||||
|
* @param cate
|
||||||
|
* @throws ParseException
|
||||||
|
*/
|
||||||
|
public void modifyItem(int position, String title, String txt, Date d, String delete, String cate) throws ParseException {
|
||||||
|
Item item = items.get(position);
|
||||||
|
if (delete.equals("false")) {
|
||||||
|
item.setTitle(title);
|
||||||
|
item.setText(txt);
|
||||||
|
item.setDueDate(d);
|
||||||
|
item.setCategorie(cate);
|
||||||
|
} else
|
||||||
|
items.remove(item);
|
||||||
|
checkDate();
|
||||||
|
saveData();
|
||||||
|
Date f = new Date();
|
||||||
|
int delay = (int) (d.getTime() - f.getTime());
|
||||||
|
int color = Color.BLUE;
|
||||||
|
int c = 0;
|
||||||
|
while (c < cat.size()) {
|
||||||
|
if (item.getCategorie().equals(cat.get(c).getName())) {
|
||||||
|
color = cat.get(c).getColor();
|
||||||
|
}
|
||||||
|
c++;
|
||||||
|
}
|
||||||
|
if (delay > 0)
|
||||||
|
scheduleNotification(getNotification(title, txt, color), delay);
|
||||||
|
affListCorresponding();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet de savoir si l'item doit être affiché en fonction de sa catégorie
|
||||||
|
*
|
||||||
|
* @param item
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean showCatForItem(Item item) {
|
||||||
|
int i = 0;
|
||||||
|
while (i < cat.size()) {
|
||||||
|
if (cat.get(i).getName().equals(item.getCategorie())) {
|
||||||
|
return cat.get(i).getShow();
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet d'afficher les tasks en fonctions des restrictions de l'utilisateur (statut, date, catégories etc...)
|
||||||
|
*/
|
||||||
|
public void affListCorresponding() {
|
||||||
|
int nb_items = items.size();
|
||||||
|
boolean t, p;
|
||||||
|
int i = 0;
|
||||||
|
tmp.clear();
|
||||||
|
while (i < nb_items) {
|
||||||
|
t = false;
|
||||||
|
p = false;
|
||||||
|
if (aff_done && items.get(i).getStatus() == Item.Status.DONE)
|
||||||
|
t = true;
|
||||||
|
if (aff_todo && items.get(i).getStatus() == Item.Status.TODO)
|
||||||
|
t = true;
|
||||||
|
if ((aff_passed && items.get(i).getPassed()))
|
||||||
|
p = true;
|
||||||
|
if ((aff_ondate && !items.get(i).getPassed()))
|
||||||
|
p = true;
|
||||||
|
if (t && p && showCatForItem(items.get(i)))
|
||||||
|
tmp.add(items.get(i));
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
ItemAdapter adapter = new ItemAdapter(MainActivity.this, tmp);
|
||||||
|
mListView.setAdapter(adapter);
|
||||||
|
if (tmp.size() > 1)
|
||||||
|
((TextView) findViewById(R.id.nb_tasks)).setText(String.valueOf(tmp.size()) + " Tasks");
|
||||||
|
else
|
||||||
|
((TextView) findViewById(R.id.nb_tasks)).setText(String.valueOf(tmp.size()) + " Task");
|
||||||
|
adapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Passe le status d'une task en to do
|
||||||
|
*
|
||||||
|
* @param v
|
||||||
|
*/
|
||||||
|
public void todoClick(View v) {
|
||||||
|
final int position = mListView.getPositionForView((View) v.getParent());
|
||||||
|
SwipeLayout s = (SwipeLayout) mListView.getChildAt(position);
|
||||||
|
Item a = items.get(position);
|
||||||
|
a.setStatus(Item.Status.TODO);
|
||||||
|
affListCorresponding();
|
||||||
|
saveData();
|
||||||
|
s.close(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Passe une catégorie en visible ou invisible
|
||||||
|
*
|
||||||
|
* @param v
|
||||||
|
*/
|
||||||
|
public void catCheck(View v) {
|
||||||
|
final int position = checkListView.getPositionForView((View) v.getParent());
|
||||||
|
CheckBox checkBox = (CheckBox) v;
|
||||||
|
if (checkBox.isChecked())
|
||||||
|
cat.get(position).setShow(true);
|
||||||
|
else
|
||||||
|
cat.get(position).setShow(false);
|
||||||
|
affListCorresponding();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change le status de la task à Done
|
||||||
|
*
|
||||||
|
* @param v
|
||||||
|
*/
|
||||||
|
public void doneClick(View v) {
|
||||||
|
final int position = mListView.getPositionForView((View) v.getParent());
|
||||||
|
SwipeLayout s = (SwipeLayout) mListView.getChildAt(position);
|
||||||
|
Item a = items.get(position);
|
||||||
|
a.setStatus(Item.Status.DONE);
|
||||||
|
s.close(true);
|
||||||
|
ItemAdapter b = (ItemAdapter) mListView.getAdapter();
|
||||||
|
affListCorresponding();
|
||||||
|
b.notifyDataSetChanged();
|
||||||
|
saveData();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void goToTimer(View view) {
|
||||||
|
Intent intentMain = new Intent(MainActivity.this, TimerActivity.class);
|
||||||
|
startActivityForResult(intentMain, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet de preparer une notification
|
||||||
|
*
|
||||||
|
* @param notification
|
||||||
|
* @param delay
|
||||||
|
*/
|
||||||
|
private void scheduleNotification(Notification notification, int delay) {
|
||||||
|
|
||||||
|
Intent notificationIntent = new Intent(this, NotificationPublisher.class);
|
||||||
|
notificationIntent.putExtra(NotificationPublisher.NOTIFICATION_ID, 1);
|
||||||
|
notificationIntent.putExtra(NotificationPublisher.NOTIFICATION, notification);
|
||||||
|
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
|
|
||||||
|
long futureInMillis = SystemClock.elapsedRealtime() + delay;
|
||||||
|
AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
|
||||||
|
alarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, futureInMillis, pendingIntent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet à l'utilisateur de recevoir des notifications concernant ses taches
|
||||||
|
*
|
||||||
|
* @param content le contenu de la notification
|
||||||
|
* @return un builder
|
||||||
|
*/
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
|
||||||
|
private Notification getNotification(String Title, String content, int color) {
|
||||||
|
Notification.Builder builder = new Notification.Builder(this);
|
||||||
|
builder.setContentTitle(Title);
|
||||||
|
builder.setContentText(content);
|
||||||
|
builder.setSmallIcon(R.drawable.ic_notification);
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
builder.setColor(color);
|
||||||
|
}
|
||||||
|
affListCorresponding();
|
||||||
|
return builder.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renvoies l'arraylist contenant les catégries
|
||||||
|
*
|
||||||
|
* @return l'array list contenant la ou les catégories
|
||||||
|
*/
|
||||||
|
public static ArrayList<Categorie> getCatA() {
|
||||||
|
ArrayList<Categorie> tmp = new ArrayList<Categorie>();
|
||||||
|
int i = 0;
|
||||||
|
while (i < cat.size())
|
||||||
|
tmp.add(cat.get(i++));
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ferme le drawer menu
|
||||||
|
*
|
||||||
|
* @param v
|
||||||
|
*/
|
||||||
|
public void closeMenu(View v) {
|
||||||
|
DrawerLayout d = ((DrawerLayout) findViewById(R.id.drawer_layout));
|
||||||
|
d.closeDrawers();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ArrayList<Categorie> getCat() {
|
||||||
|
return (getCatA());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifie si une catégorie à été supprimé et update les tasks si c'est le cas.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void checkCategories() {
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
while (i < items.size()) {
|
||||||
|
int c = 0;
|
||||||
|
boolean found = false;
|
||||||
|
while (c < cat.size()) {
|
||||||
|
if (items.get(i).getCategorie().equals(cat.get(c).getName()))
|
||||||
|
found = true;
|
||||||
|
c++;
|
||||||
|
}
|
||||||
|
if (!found)
|
||||||
|
items.get(i).setCategorie("none");
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
affListCorresponding();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet d'ajouter une catégorie via un menu
|
||||||
|
*
|
||||||
|
* @param v
|
||||||
|
*/
|
||||||
|
public void addCategorie(View v) {
|
||||||
|
Intent intentMain = new Intent(MainActivity.this, addCategory.class);
|
||||||
|
startActivityForResult(intentMain, 2);
|
||||||
|
checkCategories();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
|||||||
|
package com.github.omadahealth.todo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reçois les notifications
|
||||||
|
*/
|
||||||
|
|
||||||
|
import android.app.Notification;
|
||||||
|
import android.app.NotificationManager;
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
|
||||||
|
public class NotificationPublisher extends BroadcastReceiver {
|
||||||
|
|
||||||
|
public static String NOTIFICATION_ID = "notification-id";
|
||||||
|
public static String NOTIFICATION = "notification";
|
||||||
|
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
|
||||||
|
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
|
|
||||||
|
Notification notification = intent.getParcelableExtra(NOTIFICATION);
|
||||||
|
int id = intent.getIntExtra(NOTIFICATION_ID, 0);
|
||||||
|
notificationManager.notify(id, notification);
|
||||||
|
}
|
||||||
|
}
|
145
app/src/main/java/com/github/omadahealth/todo/addCategory.java
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
package com.github.omadahealth.todo;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.daimajia.swipe.SwipeLayout;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import lollipin.orangegangsters.github.com.lollipin.R;
|
||||||
|
import petrov.kristiyan.colorpicker.ColorPicker;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pour ajouter une nouvelle categorie
|
||||||
|
*/
|
||||||
|
public class addCategory extends AppCompatActivity {
|
||||||
|
|
||||||
|
int finalColor;
|
||||||
|
ListView mListView;
|
||||||
|
public static ArrayList<Categorie> cat2 = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_add_category);
|
||||||
|
finalColor = Color.parseColor("#262D3B");
|
||||||
|
mListView = (ListView) findViewById(R.id.listView);
|
||||||
|
cat2 = MainActivity.getCat();
|
||||||
|
CatAdapter adapter = new CatAdapter(addCategory.this, cat2);
|
||||||
|
((TextView) findViewById(R.id.nb_cat)).setText("Categories (" + String.valueOf(cat2.size()) + ")");
|
||||||
|
mListView.setAdapter(adapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set la couleur de la catgéorie
|
||||||
|
* @param v
|
||||||
|
* @param dialog
|
||||||
|
*/
|
||||||
|
public void setColor(View v, final Dialog dialog) {
|
||||||
|
ColorPicker colorPicker = new ColorPicker(this);
|
||||||
|
colorPicker.show();
|
||||||
|
colorPicker.setOnChooseColorListener(new ColorPicker.OnChooseColorListener() {
|
||||||
|
@Override
|
||||||
|
public void onChooseColor(int position, int color) {
|
||||||
|
if (color != 0)
|
||||||
|
finalColor = color;
|
||||||
|
else
|
||||||
|
finalColor = Color.parseColor("#262D3B");
|
||||||
|
//((View) findViewById(R.id.color)).setBackgroundColor(color);
|
||||||
|
dialog.findViewById(R.id.color).setBackgroundColor(finalColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCancel() {
|
||||||
|
//here goes nothing
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Supprime la catégorie de la liste
|
||||||
|
* @param v
|
||||||
|
*/
|
||||||
|
public void delete(View v) {
|
||||||
|
final int position = mListView.getPositionForView((View) v.getParent());
|
||||||
|
if (!MainActivity.cat.get(position).getName().equals("none")) {
|
||||||
|
MainActivity.cat.remove(position);
|
||||||
|
cat2.remove(position);
|
||||||
|
CatAdapter a = (CatAdapter) mListView.getAdapter();
|
||||||
|
((TextView) findViewById(R.id.nb_cat)).setText("Categories (" + String.valueOf(cat2.size()) + ")");
|
||||||
|
a.notifyDataSetChanged();
|
||||||
|
} else
|
||||||
|
Toast.makeText(getApplicationContext(), "Error can't delete \"none\" category", Toast.LENGTH_SHORT).show();
|
||||||
|
SwipeLayout s = (SwipeLayout) mListView.getChildAt(position);
|
||||||
|
s.close(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lorsque l'utilisateur ajoute la categorie
|
||||||
|
* @param view
|
||||||
|
*/
|
||||||
|
public void dialog(View view) {
|
||||||
|
|
||||||
|
// custom dialog
|
||||||
|
//final View v = (View) this;
|
||||||
|
final Dialog dialog = new Dialog(this);
|
||||||
|
dialog.setContentView(R.layout.add_cat_layou);
|
||||||
|
dialog.setTitle("Title...");
|
||||||
|
dialog.findViewById(R.id.color).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
setColor(view, dialog);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dialog.findViewById(R.id.cancel).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dialog.findViewById(R.id.ok).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
boolean ok = true;
|
||||||
|
int i =0;
|
||||||
|
String name = ((TextView) dialog.findViewById(R.id.catName)).getText().toString();
|
||||||
|
while (i < MainActivity.getCat().size())
|
||||||
|
{
|
||||||
|
if (name.equals(MainActivity.getCat().get(i).getName()))
|
||||||
|
ok = false;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
if (ok) {
|
||||||
|
MainActivity.cat.add(new Categorie(name, finalColor));
|
||||||
|
cat2.add(new Categorie(name, finalColor));
|
||||||
|
CatAdapter a = (CatAdapter) mListView.getAdapter();
|
||||||
|
((TextView) findViewById(R.id.nb_cat)).setText("Categories (" + String.valueOf(cat2.size()) + ")");
|
||||||
|
a.notifyDataSetChanged();
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Toast.makeText(getApplicationContext(), "Error: Category " + name + " already exists", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ferme la vue
|
||||||
|
* @param v
|
||||||
|
*/
|
||||||
|
public void finish(View v)
|
||||||
|
{
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
package com.github.omadahealth.todo;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.res.ColorStateList;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.support.annotation.RequiresApi;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.CheckBox;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lollipin.orangegangsters.github.com.lollipin.R;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom adapteur pour les chckbox des catégories
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class checkAdapter extends ArrayAdapter<Categorie> {
|
||||||
|
public checkAdapter(Context context, List<Categorie> Categorie) {
|
||||||
|
super(context, 0, Categorie);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||||
|
@Override
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
|
||||||
|
if (convertView == null) {
|
||||||
|
convertView = LayoutInflater.from(getContext()).inflate(R.layout.row_check_category, parent, false);
|
||||||
|
}
|
||||||
|
checkHolder viewHolder = (checkHolder) convertView.getTag();
|
||||||
|
if (viewHolder == null) {
|
||||||
|
viewHolder = new checkHolder();
|
||||||
|
viewHolder.name = (CheckBox) convertView.findViewById(R.id.checkCat2);
|
||||||
|
convertView.setTag(viewHolder);
|
||||||
|
}
|
||||||
|
|
||||||
|
final Categorie cat = getItem(position);
|
||||||
|
viewHolder.name.setText(cat.getName());
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
viewHolder.name.setButtonTintList(ColorStateList.valueOf(cat.getColor()));
|
||||||
|
}
|
||||||
|
return convertView;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class checkHolder {
|
||||||
|
public CheckBox name;
|
||||||
|
}
|
||||||
|
}
|
BIN
app/src/main/res/drawable-xxhdpi/cancel.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/drawable-xxhdpi/clock.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
app/src/main/res/drawable-xxhdpi/close.png
Normal file
After Width: | Height: | Size: 9.7 KiB |
BIN
app/src/main/res/drawable-xxhdpi/config.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
app/src/main/res/drawable-xxhdpi/delete.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
app/src/main/res/drawable-xxhdpi/done.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
app/src/main/res/drawable-xxhdpi/donetask.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/drawable-xxhdpi/edit.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_date_range_black_24dp.png
Normal file
After Width: | Height: | Size: 855 B |
12
app/src/main/res/drawable-xxhdpi/ic_menu_camera.xml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportHeight="24.0"
|
||||||
|
android:viewportWidth="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M9,2L7.17,4H4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2H9zm3,15c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z" />
|
||||||
|
</vector>
|
9
app/src/main/res/drawable-xxhdpi/ic_menu_gallery.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportHeight="24.0"
|
||||||
|
android:viewportWidth="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M22,16V4c0,-1.1 -0.9,-2 -2,-2H8c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2zm-11,-4l2.03,2.71L16,11l4,5H8l3,-4zM2,6v14c0,1.1 0.9,2 2,2h14v-2H4V6H2z" />
|
||||||
|
</vector>
|
9
app/src/main/res/drawable-xxhdpi/ic_menu_manage.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportHeight="24.0"
|
||||||
|
android:viewportWidth="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M22.7,19l-9.1,-9.1c0.9,-2.3 0.4,-5 -1.5,-6.9 -2,-2 -5,-2.4 -7.4,-1.3L9,6 6,9 1.6,4.7C0.4,7.1 0.9,10.1 2.9,12.1c1.9,1.9 4.6,2.4 6.9,1.5l9.1,9.1c0.4,0.4 1,0.4 1.4,0l2.3,-2.3c0.5,-0.4 0.5,-1.1 0.1,-1.4z" />
|
||||||
|
</vector>
|
9
app/src/main/res/drawable-xxhdpi/ic_menu_send.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportHeight="24.0"
|
||||||
|
android:viewportWidth="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z" />
|
||||||
|
</vector>
|
9
app/src/main/res/drawable-xxhdpi/ic_menu_share.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportHeight="24.0"
|
||||||
|
android:viewportWidth="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z" />
|
||||||
|
</vector>
|
9
app/src/main/res/drawable-xxhdpi/ic_menu_slideshow.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportHeight="24.0"
|
||||||
|
android:viewportWidth="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M4,6H2v14c0,1.1 0.9,2 2,2h14v-2H4V6zm16,-4H8c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2V4c0,-1.1 -0.9,-2 -2,-2zm-8,12.5v-9l6,4.5 -6,4.5z" />
|
||||||
|
</vector>
|
BIN
app/src/main/res/drawable-xxhdpi/ic_notif.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_notification.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/drawable-xxhdpi/label.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
app/src/main/res/drawable-xxhdpi/menu.png
Normal file
After Width: | Height: | Size: 99 B |
BIN
app/src/main/res/drawable-xxhdpi/params.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
app/src/main/res/drawable-xxhdpi/plus.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
9
app/src/main/res/drawable-xxhdpi/side_nav_bar.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<gradient
|
||||||
|
android:angle="135"
|
||||||
|
android:centerColor="#4CAF50"
|
||||||
|
android:endColor="#2E7D32"
|
||||||
|
android:startColor="#81C784"
|
||||||
|
android:type="linear" />
|
||||||
|
</shape>
|
BIN
app/src/main/res/drawable-xxhdpi/trash.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
141
app/src/main/res/layout/activity_about_pomocnik.xml
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="#FFFFFF"
|
||||||
|
tools:context="com.github.omadahealth.lollipin.AboutPomocnik">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imageView2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginTop="22dp"
|
||||||
|
app:srcCompat="@mipmap/tomato" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignLeft="@+id/textView3"
|
||||||
|
android:layout_alignStart="@+id/textView3"
|
||||||
|
android:layout_below="@+id/imageView2"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:text="What is POMOcnik?"
|
||||||
|
android:textColor="@color/colorRed"
|
||||||
|
android:textSize="24sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView3"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_below="@+id/textView2"
|
||||||
|
android:layout_marginLeft="6dp"
|
||||||
|
android:layout_marginStart="6dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:text="The Pomodoro Technique is a time management method developed by Francesco Cirillo in the late 1980s. The technique uses a timer to break down work into intervals, traditionally 25 minutes in length, separated by short breaks."
|
||||||
|
android:textColor="@color/colorGreen"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView4"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignLeft="@+id/textView11"
|
||||||
|
android:layout_alignStart="@+id/textView11"
|
||||||
|
android:layout_below="@+id/textView11"
|
||||||
|
android:layout_marginTop="21dp"
|
||||||
|
android:autoText="true"
|
||||||
|
android:text="There are six steps in the original technique:"
|
||||||
|
android:textColor="@color/colorGreen"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView5"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignLeft="@+id/textView4"
|
||||||
|
android:layout_alignStart="@+id/textView4"
|
||||||
|
android:layout_below="@+id/textView4"
|
||||||
|
android:layout_marginTop="14dp"
|
||||||
|
android:text="1.Decide on the task to be done."
|
||||||
|
android:textColor="@color/colorGreen"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView6"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignLeft="@+id/textView5"
|
||||||
|
android:layout_alignStart="@+id/textView5"
|
||||||
|
android:layout_below="@+id/textView5"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:text="2.Set the pomodoro timer (traditionally to 25 minutes)"
|
||||||
|
android:textColor="@color/colorGreen"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView7"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignLeft="@+id/textView6"
|
||||||
|
android:layout_alignStart="@+id/textView6"
|
||||||
|
android:layout_below="@+id/textView6"
|
||||||
|
android:layout_marginTop="11dp"
|
||||||
|
android:text="3.Work on the task."
|
||||||
|
android:textColor="@color/colorGreen"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView8"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignLeft="@+id/textView9"
|
||||||
|
android:layout_alignStart="@+id/textView9"
|
||||||
|
android:layout_below="@+id/textView7"
|
||||||
|
android:layout_marginTop="11dp"
|
||||||
|
android:text="4.End work when the timer rings and put a checkmark on a piece of paper."
|
||||||
|
android:textColor="@color/colorGreen"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView9"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignLeft="@+id/textView10"
|
||||||
|
android:layout_alignStart="@+id/textView10"
|
||||||
|
android:layout_below="@+id/textView8"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:text="5.If you have fewer than four checkmarks, take a short break (3–5 minutes), then go to step 2."
|
||||||
|
android:textColor="@color/colorGreen"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView10"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignLeft="@+id/textView7"
|
||||||
|
android:layout_alignStart="@+id/textView7"
|
||||||
|
android:layout_below="@+id/textView9"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:text="6.After four pomodoros, take a longer break (15–30 minutes), reset your checkmark count to zero, then go to step 1."
|
||||||
|
android:textColor="@color/colorGreen"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView11"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignLeft="@+id/textView3"
|
||||||
|
android:layout_alignStart="@+id/textView3"
|
||||||
|
android:layout_below="@+id/textView3"
|
||||||
|
android:layout_marginTop="13dp"
|
||||||
|
android:text="The Pomodoro Technique can help you power through distractions, hyper-focus, and get things done in short bursts, while taking frequent breaks to come up for air and relax. Best of all, it's easy. If you have a busy job where you're expected to produce, it's a great way to get through your tasks. Let's break it down and see how you can apply it to your work."
|
||||||
|
android:textColor="@color/colorGreen"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
</RelativeLayout>
|
55
app/src/main/res/layout/activity_add_category.xml
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/activity_add_category"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
tools:context="com.github.omadahealth.todo.addCategory">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/top"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:background="@color/colorPrimary">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:paddingLeft="10dp"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:onClick="finish"
|
||||||
|
android:src="@drawable/cancel"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/nb_cat"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="Categories (nb)"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="18dp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/listView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentStart="true" />
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/add_btn"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:onClick="dialog"
|
||||||
|
android:src="@drawable/plus" />
|
||||||
|
</RelativeLayout>
|
||||||
|
</LinearLayout>
|
119
app/src/main/res/layout/activity_add_item.xml
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/activity_add_item"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
tools:context="com.github.omadahealth.todo.AddItem">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:id="@+id/textBar"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:background="@color/colorPrimary"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:onClick="cancel"
|
||||||
|
android:src="@drawable/cancel"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="20dp"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:text="Save"
|
||||||
|
android:onClick="save"/>
|
||||||
|
</RelativeLayout>
|
||||||
|
<EditText
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:textSize="22dp"
|
||||||
|
android:background="@color/colorPrimary"
|
||||||
|
android:inputType="textPersonName"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:hint="Title"
|
||||||
|
android:textColorHint="#DFDFDF"
|
||||||
|
android:ems="10"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:id="@+id/title" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:src="@drawable/clock"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textAlignment="viewEnd"
|
||||||
|
android:onClick="setDate"
|
||||||
|
android:textSize="20dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:ems="10"
|
||||||
|
android:id="@+id/date" />
|
||||||
|
<TextView
|
||||||
|
android:textSize="20dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:textAlignment="viewEnd"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:onClick="setTime"
|
||||||
|
android:layout_weight="2"
|
||||||
|
android:ems="10"
|
||||||
|
android:id="@+id/time" />
|
||||||
|
</LinearLayout>
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@android:color/darker_gray" />
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:src="@drawable/label"/>
|
||||||
|
<Spinner
|
||||||
|
android:id="@+id/spinner2"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
<!---
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Categorie"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:onClick="setColor"
|
||||||
|
android:textSize="20dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:ems="10"
|
||||||
|
android:id="@+id/categorie" />
|
||||||
|
-->
|
||||||
|
</LinearLayout>
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@android:color/darker_gray"/>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="textMultiLine"
|
||||||
|
android:hint="To do..."
|
||||||
|
android:ems="10"
|
||||||
|
android:id="@+id/txt" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -1,138 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"-->
|
|
||||||
<!--android:orientation="vertical" android:layout_width="match_parent"-->
|
|
||||||
<!--android:layout_height="match_parent">-->
|
|
||||||
|
|
||||||
<!--<android.support.v7.widget.Toolbar-->
|
|
||||||
<!--android:id="@+id/id_toolbar"-->
|
|
||||||
<!--android:layout_height="wrap_content"-->
|
|
||||||
<!--android:layout_width="match_parent"-->
|
|
||||||
<!--android:background="@color/material_blue_500"-->
|
|
||||||
<!--android:minHeight="?attr/actionBarSize"/>-->
|
|
||||||
|
|
||||||
<!--<TextView-->
|
|
||||||
<!--android:layout_width="wrap_content"-->
|
|
||||||
<!--android:layout_height="wrap_content"-->
|
|
||||||
<!--android:padding="@dimen/activity_horizontal_margin"-->
|
|
||||||
<!--android:text="@string/activity_appcompat_message"-->
|
|
||||||
<!--android:textSize="16sp"/>-->
|
|
||||||
|
|
||||||
<!--</LinearLayout>-->
|
|
||||||
|
|
||||||
|
|
||||||
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:id="@+id/drawerLayout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
tools:context="com.github.omadahealth.lollipin.LockedCompatActivity">
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:id="@+id/relativeLayout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/colorTextSize">
|
|
||||||
|
|
||||||
|
|
||||||
<ProgressBar
|
|
||||||
android:id="@+id/progressBarCircle"
|
|
||||||
style="?android:attr/progressBarStyleHorizontal"
|
|
||||||
android:layout_width="300dp"
|
|
||||||
android:layout_height="300dp"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:layout_marginTop="74dp"
|
|
||||||
android:background="@drawable/drawable_circle_green"
|
|
||||||
android:indeterminate="false"
|
|
||||||
android:max="100"
|
|
||||||
android:progress="100"
|
|
||||||
android:progressDrawable="@drawable/drawable_circle_red"
|
|
||||||
android:rotation="-90" />
|
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/textViewTime"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignTop="@+id/progressBarCircle"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:layout_marginTop="120dp"
|
|
||||||
android:text="00:00:00"
|
|
||||||
android:textColor="@color/colorGreen"
|
|
||||||
android:textSize="40sp" />
|
|
||||||
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/imageViewReset"
|
|
||||||
android:layout_width="60dp"
|
|
||||||
android:layout_height="60dp"
|
|
||||||
android:layout_alignTop="@+id/imageViewStartStop"
|
|
||||||
android:layout_alignEnd="@+id/textViewTime"
|
|
||||||
android:layout_alignRight="@+id/textViewTime"
|
|
||||||
android:src="@mipmap/icon_reset"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/imageViewStartStop"
|
|
||||||
android:layout_width="60dp"
|
|
||||||
android:layout_height="60dp"
|
|
||||||
android:layout_alignLeft="@+id/textViewTime"
|
|
||||||
android:layout_alignStart="@+id/textViewTime"
|
|
||||||
android:layout_below="@+id/progressBarCircle"
|
|
||||||
android:layout_marginTop="44dp"
|
|
||||||
android:src="@mipmap/icon_start"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/imageViewTomato"
|
|
||||||
android:layout_width="70dp"
|
|
||||||
android:layout_height="70dp"
|
|
||||||
android:layout_below="@+id/progressBarCircle"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:layout_marginTop="36dp"
|
|
||||||
android:src="@mipmap/icontomato" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/imageViewBreak"
|
|
||||||
android:layout_width="50dp"
|
|
||||||
android:layout_height="50dp"
|
|
||||||
android:layout_alignBottom="@+id/progressBarCircle"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:layout_marginBottom="62dp"
|
|
||||||
app:srcCompat="@mipmap/icon_break"
|
|
||||||
android:visibility="gone"/>
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/imageViewWork"
|
|
||||||
android:layout_width="50dp"
|
|
||||||
android:layout_height="50dp"
|
|
||||||
android:layout_alignBottom="@+id/progressBarCircle"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:layout_marginBottom="62dp"
|
|
||||||
app:srcCompat="@mipmap/icontomato"
|
|
||||||
android:visibility="gone"/>
|
|
||||||
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
|
|
||||||
<!--<android.support.design.widget.NavigationView-->
|
|
||||||
|
|
||||||
<!--android:id="@+id/navigation_view"-->
|
|
||||||
<!--android:layout_width="wrap_content"-->
|
|
||||||
<!--android:layout_height="match_parent"-->
|
|
||||||
<!--android:layout_alignParentEnd="true"-->
|
|
||||||
<!--android:layout_alignParentRight="true"-->
|
|
||||||
<!--android:layout_alignParentTop="true"-->
|
|
||||||
<!--android:layout_gravity="start"-->
|
|
||||||
<!--app:headerLayout="@layout/navigation_header"-->
|
|
||||||
<!--app:menu="@menu/navigation_bar">-->
|
|
||||||
|
|
||||||
<!--</android.support.design.widget.NavigationView>-->
|
|
||||||
|
|
||||||
</android.support.v4.widget.DrawerLayout>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
143
app/src/main/res/layout/activity_edit_item.xml
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/activity_add_item"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context="com.darkpingouin.todolist.AddItem">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:id="@+id/textBar"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@color/colorPrimary"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="10dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:onClick="cancel"
|
||||||
|
android:src="@drawable/cancel" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:onClick="save"
|
||||||
|
android:id="@+id/save"
|
||||||
|
android:text="Save"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="20dp" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:background="@color/colorPrimary"
|
||||||
|
android:id="@+id/textBar1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@color/colorPrimary"
|
||||||
|
android:ems="10"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:text="Title"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="22dp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="10dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:src="@drawable/clock" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/date2"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:ems="10"
|
||||||
|
android:onClick="setDate"
|
||||||
|
android:textAlignment="viewEnd"
|
||||||
|
android:textSize="20dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/time2"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="2"
|
||||||
|
android:ems="10"
|
||||||
|
android:onClick="setTime"
|
||||||
|
android:textAlignment="viewEnd"
|
||||||
|
android:textSize="20dp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@android:color/darker_gray" />
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:src="@drawable/label"/>
|
||||||
|
<Spinner
|
||||||
|
android:id="@+id/spinner2"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
<!---
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Categorie"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:onClick="setColor"
|
||||||
|
android:textSize="20dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:ems="10"
|
||||||
|
android:id="@+id/categorie" />
|
||||||
|
-->
|
||||||
|
</LinearLayout>
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@android:color/darker_gray"/>
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/txt"
|
||||||
|
android:inputType="textMultiLine"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ems="10"
|
||||||
|
android:text="To do..." />
|
||||||
|
</LinearLayout>
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:src="@drawable/trash"
|
||||||
|
android:id="@+id/add_btn"
|
||||||
|
android:onClick="delete"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_alignParentEnd="true" />
|
||||||
|
</RelativeLayout>
|
@ -3,7 +3,7 @@
|
|||||||
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
|
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
|
android:paddingBottom="@dimen/activity_vertical_margin" tools:context="com.github.omadahealth.lollipin.MainActivity">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/button_enable_pin"
|
android:id="@+id/button_enable_pin"
|
||||||
|
243
app/src/main/res/layout/activity_main_todo.xml
Normal file
@ -0,0 +1,243 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/drawer_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<RelativeLayout 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="match_parent"
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/top"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:background="@color/colorPrimary">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/nb_tasks"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="nb Tasks"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="18dp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:contentDescription="menu_list"
|
||||||
|
android:onClick="settings"
|
||||||
|
android:paddingLeft="10dp"
|
||||||
|
android:src="@drawable/menu" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_below="@+id/top">
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/listView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentStart="true" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/add_btn"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:onClick="add"
|
||||||
|
android:src="@drawable/plus" />
|
||||||
|
</RelativeLayout>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/left_drawer"
|
||||||
|
android:layout_width="200dp"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_gravity="start|left"
|
||||||
|
android:background="#FFFFFF"
|
||||||
|
android:fillViewport="true"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/top2"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:background="@color/colorPrimary">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="Settings"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="18dp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:onClick="closeMenu"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:src="@drawable/close" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:background="#EFEFEF"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="2dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/doneT"
|
||||||
|
android:layout_width="20dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:src="@drawable/donetask" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:clickable="false"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:text="Status"
|
||||||
|
android:textSize="20sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/switch_done"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Done" />
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/switch_todo"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="To do" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:background="#EFEFEF"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="2dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="20dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:src="@drawable/ic_date_range_black_24dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:clickable="false"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:text="Date"
|
||||||
|
android:textSize="20sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/switch_passed"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Passed" />
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/switch_ondate"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Up to Date" />
|
||||||
|
<LinearLayout
|
||||||
|
android:background="#EFEFEF"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="2dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="20dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:src="@drawable/label" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:onClick="addCategorie"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:text="Categories"
|
||||||
|
android:textSize="20sp" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="20dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:onClick="addCategorie"
|
||||||
|
android:src="@drawable/config" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/checkCat"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fillViewport="true">
|
||||||
|
|
||||||
|
|
||||||
|
</ListView>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:background="#EFEFEF"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="2dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="20dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:onClick="goToTimer"
|
||||||
|
android:src="@drawable/close" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:onClick="goToTimer"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:text="Timer"
|
||||||
|
android:textSize="20sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="#DFDFDF" />
|
||||||
|
</LinearLayout>
|
||||||
|
</android.support.v4.widget.DrawerLayout>
|
@ -1,13 +0,0 @@
|
|||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
|
|
||||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
|
||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
|
||||||
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/activity_not_locked_text" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
61
app/src/main/res/layout/add_cat_layou.xml
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="16dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/color"
|
||||||
|
android:layout_width="42dp"
|
||||||
|
android:layout_height="42dp"
|
||||||
|
android:background="#262D3B"
|
||||||
|
android:padding="10dp"></View>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/catName"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:ems="10"
|
||||||
|
android:inputType="textPersonName"
|
||||||
|
android:text="Name" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:gravity="end"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/ok"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/lite_blue"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="OK" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:textColor="@color/black_de"
|
||||||
|
android:id="@+id/cancel"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="CANCEL" />
|
||||||
|
</LinearLayout>
|
||||||
|
</RelativeLayout>
|
||||||
|
</LinearLayout>
|
46
app/src/main/res/layout/delete_task.xml
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="16dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:textColor="#B64D57"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:text="Are you sure you want to delete that Task ?"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:gravity="end"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/yes"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Yes" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:id="@+id/cancel"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Cancel" />
|
||||||
|
</LinearLayout>
|
||||||
|
</RelativeLayout>
|
||||||
|
</LinearLayout>
|
48
app/src/main/res/layout/row_category.xml
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<com.daimajia.swipe.SwipeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/swipe"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp">
|
||||||
|
<!-- Bottom View Start-->
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/bottom_wrapper"
|
||||||
|
android:layout_width="60dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="#FF4543"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<ImageView
|
||||||
|
android:contentDescription="delete"
|
||||||
|
android:id="@+id/todoB"
|
||||||
|
android:layout_width="30dp"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:layout_margin="5dp"
|
||||||
|
android:onClick="delete"
|
||||||
|
android:src="@drawable/delete" />
|
||||||
|
<!--What you want to show-->
|
||||||
|
</LinearLayout>
|
||||||
|
<!-- Bottom View End-->
|
||||||
|
|
||||||
|
<!-- Surface View Start -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:id="@+id/color"
|
||||||
|
android:layout_weight="22"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="#456345" />
|
||||||
|
<TextView
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:id="@+id/title"
|
||||||
|
android:text="Name"/>
|
||||||
|
</LinearLayout>
|
||||||
|
<!-- Surface View End -->
|
||||||
|
</com.daimajia.swipe.SwipeLayout>
|
11
app/src/main/res/layout/row_check_category.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical" android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
<CheckBox
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:id="@+id/checkCat2"
|
||||||
|
android:checked="true"
|
||||||
|
android:onClick="catCheck"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
</LinearLayout>
|
125
app/src/main/res/layout/row_item.xml
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<com.daimajia.swipe.SwipeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/swipe"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="80dp">
|
||||||
|
<!-- Bottom View Start-->
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/bottom_wrapper"
|
||||||
|
android:layout_width="120dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="#2277FF"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/doTimer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:onClick="goToTimer"
|
||||||
|
android:background="#FFFFFF"
|
||||||
|
android:src="@mipmap/tomato" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/doneB"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_margin="5dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:onClick="doneClick"
|
||||||
|
android:src="@drawable/done" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/todoB"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_margin="5dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:onClick="todoClick"
|
||||||
|
android:src="@drawable/cancel" />
|
||||||
|
<!--What you want to show-->
|
||||||
|
</LinearLayout>
|
||||||
|
<!-- Bottom View End-->
|
||||||
|
|
||||||
|
<!-- Surface View Start -->
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/back"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:id="@+id/categorie"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="22"
|
||||||
|
android:background="#456345" />
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/showItem"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:padding="10dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:id="@+id/dateView"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/dateHour"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:text="16:30"
|
||||||
|
android:textSize="17dp"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:id="@+id/dateMonth"
|
||||||
|
android:text="21/03"
|
||||||
|
android:textSize="15dp"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/dateYear"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="2017"
|
||||||
|
android:textSize="10dp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignTop="@+id/dateView"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:textSize="20dp"
|
||||||
|
android:layout_toRightOf="@+id/dateView"
|
||||||
|
android:textColor="@android:color/black"
|
||||||
|
android:textStyle="bold"
|
||||||
|
tools:text="Title" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignLeft="@+id/title"
|
||||||
|
android:layout_below="@+id/title"
|
||||||
|
android:maxHeight="40dp"
|
||||||
|
android:textColor="@android:color/black"
|
||||||
|
tools:text="To do..." />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/date"
|
||||||
|
android:visibility="invisible"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="right"
|
||||||
|
android:textColor="@android:color/darker_gray"
|
||||||
|
android:textStyle="italic"
|
||||||
|
tools:text="due to 25/11" />
|
||||||
|
</RelativeLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
<!-- Surface View End -->
|
||||||
|
</com.daimajia.swipe.SwipeLayout>
|
243
app/src/main/res/layout/timer_activity.xml
Normal file
@ -0,0 +1,243 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/drawerLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context="com.github.omadahealth.lollipin.TimerActivity">
|
||||||
|
|
||||||
|
<RelativeLayout 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="match_parent"
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/top"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:background="@color/colorPrimary">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/nb_tasks"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="POMOcnik"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="18dp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:contentDescription="menu_list"
|
||||||
|
android:onClick="settings"
|
||||||
|
android:paddingLeft="10dp"
|
||||||
|
android:src="@drawable/menu" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/relativeLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/colorTextSize"
|
||||||
|
android:layout_below="@+id/top">
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progressBarCircle"
|
||||||
|
style="?android:attr/progressBarStyleHorizontal"
|
||||||
|
android:layout_width="300dp"
|
||||||
|
android:layout_height="300dp"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginTop="74dp"
|
||||||
|
android:background="@drawable/drawable_circle_green"
|
||||||
|
android:indeterminate="false"
|
||||||
|
android:max="100"
|
||||||
|
android:progress="100"
|
||||||
|
android:progressDrawable="@drawable/drawable_circle_red"
|
||||||
|
android:rotation="-90" />
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textViewTime"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignTop="@+id/progressBarCircle"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginTop="120dp"
|
||||||
|
android:text="00:00:00"
|
||||||
|
android:textColor="@color/colorGreen"
|
||||||
|
android:textSize="40sp" />
|
||||||
|
|
||||||
|
<!--android:layout_alignTop="@+id/imageViewStartStop"-->
|
||||||
|
<!--android:layout_alignEnd="@+id/textViewTime"-->
|
||||||
|
<!--android:layout_alignRight="@+id/textViewTime"-->
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imageViewReset"
|
||||||
|
android:layout_width="60dp"
|
||||||
|
android:layout_height="60dp"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_alignStart="@+id/textViewTime"
|
||||||
|
android:layout_below="@+id/progressBarCircle"
|
||||||
|
android:layout_alignLeft="@+id/imageViewWork"
|
||||||
|
android:layout_marginTop="44dp"
|
||||||
|
android:src="@mipmap/icon_reset"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imageViewTomato"
|
||||||
|
android:layout_width="70dp"
|
||||||
|
android:layout_height="70dp"
|
||||||
|
android:layout_below="@+id/progressBarCircle"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginTop="36dp"
|
||||||
|
android:src="@mipmap/icontomato" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imageViewBreak"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:layout_alignBottom="@+id/progressBarCircle"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginBottom="62dp"
|
||||||
|
app:srcCompat="@mipmap/icon_break"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imageViewWork"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:layout_alignBottom="@+id/progressBarCircle"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginBottom="62dp"
|
||||||
|
app:srcCompat="@mipmap/icontomato"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/left_drawer"
|
||||||
|
android:layout_width="200dp"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_gravity="start|left"
|
||||||
|
android:background="#FFFFFF"
|
||||||
|
android:fillViewport="true"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/top2"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:background="@color/colorPrimary">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="Menu"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="18dp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:onClick="closeMenu"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:src="@drawable/close" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:background="#EFEFEF"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="2dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="20dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:src="@drawable/config"
|
||||||
|
android:onClick="goToSettins"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:clickable="false"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:text="Settings"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:onClick="goToSettins"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:background="#EFEFEF"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="2dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/doneT"
|
||||||
|
android:layout_width="20dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:src="@drawable/donetask"
|
||||||
|
android:onClick="goToToDoList"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:clickable="false"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:text="To Do List"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:onClick="goToToDoList"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:background="#EFEFEF"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="2dp">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="20dp"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:src="@drawable/label"
|
||||||
|
android:onClick="goToAbout"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:onClick="goToAbout"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:text="About"
|
||||||
|
android:textSize="20sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="#DFDFDF" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</android.support.v4.widget.DrawerLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
8
app/src/main/res/values-v21/drawables.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<resources xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item name="ic_menu_camera" type="drawable">@android:drawable/ic_menu_camera</item>
|
||||||
|
<item name="ic_menu_gallery" type="drawable">@android:drawable/ic_menu_gallery</item>
|
||||||
|
<item name="ic_menu_slideshow" type="drawable">@android:drawable/ic_menu_slideshow</item>
|
||||||
|
<item name="ic_menu_manage" type="drawable">@android:drawable/ic_menu_manage</item>
|
||||||
|
<item name="ic_menu_share" type="drawable">@android:drawable/ic_menu_share</item>
|
||||||
|
<item name="ic_menu_send" type="drawable">@android:drawable/ic_menu_send</item>
|
||||||
|
</resources>
|
@ -11,4 +11,6 @@
|
|||||||
<color name="colorYellow">#f5fa55</color>
|
<color name="colorYellow">#f5fa55</color>
|
||||||
<color name="colorGreen">#4caf50</color>
|
<color name="colorGreen">#4caf50</color>
|
||||||
<color name="colorRed">#f4511e</color>
|
<color name="colorRed">#f4511e</color>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<string name="app_name">Pomodoro</string>
|
<string name="app_name">POMOcnik</string>
|
||||||
<string name="hello_world">Hello world!</string>
|
<string name="hello_world">Hello world!</string>
|
||||||
<string name="action_settings">Settings</string>
|
<string name="action_settings">Settings</string>
|
||||||
<string name="activity_not_locked_text">Nothing should happen on this page, here for test purpose</string>
|
<string name="activity_not_locked_text">Nothing should happen on this page, here for test purpose</string>
|
||||||
@ -17,4 +17,8 @@
|
|||||||
<string name="hint_minute">Minute</string>
|
<string name="hint_minute">Minute</string>
|
||||||
<string name="settings_timer">Timer</string>
|
<string name="settings_timer">Timer</string>
|
||||||
<string name="settings_notifications">Notifications</string>
|
<string name="settings_notifications">Notifications</string>
|
||||||
|
|
||||||
|
<string name="navigation_drawer_open">Open navigation drawer</string>
|
||||||
|
<string name="navigation_drawer_close">Close navigation drawer</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="AppTheme" parent="AppBaseTheme">
|
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||||
<!-- Customize your theme here. -->
|
<!-- Customize your theme here. -->
|
||||||
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
@ -20,6 +23,8 @@
|
|||||||
<item name="colorAccent">@color/material_green_A200</item>
|
<item name="colorAccent">@color/material_green_A200</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||||
|
|
||||||
|
<style name="PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
25
app/src/main/res/xml/settings.xml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<PreferenceCategory
|
||||||
|
android:key="timer"
|
||||||
|
android:title="@string/settings_timer">
|
||||||
|
<EditTextPreference
|
||||||
|
android:dialogTitle="Work Duration"
|
||||||
|
android:inputType="number"
|
||||||
|
android:key="work_duration"
|
||||||
|
android:numeric="integer"
|
||||||
|
android:summary="Enter the Work Duration"
|
||||||
|
android:title="Work Duration" />
|
||||||
|
|
||||||
|
|
||||||
|
<EditTextPreference
|
||||||
|
android:defaultValue="1"
|
||||||
|
android:dialogTitle="Break Duration"
|
||||||
|
android:inputType="number"
|
||||||
|
android:key="break_duration"
|
||||||
|
android:summary="Enter the Break Duration"
|
||||||
|
android:title="Break Duration" />
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
</PreferenceScreen>
|
@ -20,7 +20,7 @@
|
|||||||
<string name="button9_small_text" translatable="false">WXYZ</string>
|
<string name="button9_small_text" translatable="false">WXYZ</string>
|
||||||
<string name="button11_large_text" translatable="false">0</string>
|
<string name="button11_large_text" translatable="false">0</string>
|
||||||
|
|
||||||
<string name="pin_code_forgot_text">Forgot?</string>
|
<string name="pin_code_forgot_text"></string>
|
||||||
<string name="pin_code_step_disable">Disable %d-digit Pincode</string>
|
<string name="pin_code_step_disable">Disable %d-digit Pincode</string>
|
||||||
<string name="pin_code_step_create">Create a %d-digit Pincode</string>
|
<string name="pin_code_step_create">Create a %d-digit Pincode</string>
|
||||||
<string name="pin_code_step_change">Enter your current %d-digit Pincode</string>
|
<string name="pin_code_step_change">Enter your current %d-digit Pincode</string>
|
||||||
|