Skip to content

Commit

Permalink
#1 some cleanups, integration of dagger and event bus, use some thing…
Browse files Browse the repository at this point in the history
…s of u2020 template
  • Loading branch information
mgruc committed Dec 29, 2014
1 parent 32f798f commit 8038cf0
Show file tree
Hide file tree
Showing 35 changed files with 506 additions and 2,379 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ proguard/
# Log Files
*.log

# ide
.idea
*.iml
6 changes: 3 additions & 3 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<activity

android:name="com.splashScreen.SplashScreenActivity"
android:name="com.logic.SplashScreenActivity"
android:label="@string/app_name"
android:configChanges="orientation"
android:screenOrientation="portrait">
Expand All @@ -30,14 +30,14 @@
</activity>

<activity
android:name="com.roomfinder.MainActivity"
android:name="com.logic.MainActivity"
android:label="@string/app_name"
android:configChanges="orientation"
android:screenOrientation="portrait">
</activity>

<activity
android:name="com.roomfinder.RoomActivity"
android:name="com.logic.RoomActivity"
android:label="@string/app_name"
android:configChanges="orientation"
android:screenOrientation="portrait">
Expand Down
90 changes: 0 additions & 90 deletions app/app.iml

This file was deleted.

21 changes: 17 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
apply plugin: 'android-sdk-manager'
apply plugin: 'com.android.application'


repositories {
mavenCentral()
}

dependencies {
compile 'com.android.support:support-v4:21.0.+'
compile 'com.google.android.gms:play-services:6.5.+'
compile 'com.squareup.dagger:dagger:1.2.2'
provided 'com.squareup.dagger:dagger-compiler:1.2.2'
compile 'com.squareup:otto:1.3.5'
compile 'com.jakewharton:butterknife:6.0.0'
compile 'com.jakewharton.timber:timber:2.5.0'
}


android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
Expand All @@ -17,7 +34,3 @@ android {
}
}
}

dependencies {
compile 'com.android.support:support-v4:21.0.3'
}
17 changes: 12 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.roomfinder"
package="com.logic"
android:versionCode="1"
android:versionName="1.0" >

Expand All @@ -11,15 +11,21 @@
android:targetSdkVersion="21" />

<application
android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen" android:icon="@drawable/ic_luncher" android:label="@string/app_name">
android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen"
android:icon="@drawable/ic_luncher"
android:label="@string/app_name"
android:name="com.utils.RoomFinderApplication">

<!--
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
-->

<activity

android:name="com.splashScreen.SplashScreenActivity"
android:name=".SplashScreenActivity"
android:label="@string/app_name"
android:configChanges="orientation"
android:screenOrientation="portrait">
Expand All @@ -30,18 +36,19 @@
</activity>

<activity
android:name="com.roomfinder.MainActivity"
android:name="com.logic.MainActivity"
android:label="@string/app_name"
android:configChanges="orientation"
android:screenOrientation="portrait">
</activity>

<activity
android:name="com.roomfinder.RoomActivity"
android:name="com.logic.RoomActivity"
android:label="@string/app_name"
android:configChanges="orientation"
android:screenOrientation="portrait">
</activity>
</application>


</manifest>
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
package com.dataProvider;
package com.data;

import android.app.Activity;
import android.content.SharedPreferences;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

import android.app.Activity;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.util.Log;
import timber.log.Timber;

public class DataProvider {

String TAG = DataProvider.class.getName().toString();

public void addNewEntry(String line, Activity activity) {
if (line.contains(":")) {

if (line.contains(":")) {

String[] parts = line.split(":");
String name = parts[0];
String room = parts[1];

name = name.replace(name.substring(name.length()-1), "");
room = room.replace(room.substring(room.length()-2), "");
room = room.substring(1);
Expand All @@ -30,17 +29,10 @@ public void addNewEntry(String line, Activity activity) {
storeDateByRoom (room, name, activity);

}

//Log.i(TAG, "SplashScreenActivity - content of current map:" + map.toString());
}



public String getRoomByName(String name, Activity activity) {

String room = readRoomByName(name, activity);

return room;
return readRoomByName(name, activity);
}


Expand All @@ -55,20 +47,14 @@ public boolean isValueName (String value) {
}

public String[] getSearchList(Activity activity) {

Log.i(TAG, "SplashScreenActivity - getSearchList reached");

ArrayList<String> newList = new ArrayList<String>();
newList = apendNames(newList, activity);
newList = apendRooms(newList, activity);

return newList.toArray(new String[newList.size()]);
}


private ArrayList<String> apendNames(ArrayList<String> currentList, Activity activity) {
Log.i(TAG, "SplashScreenActivity - apendNames reached");

SharedPreferences settings = activity.getApplicationContext().getSharedPreferences("NAME_ROOM", 0);
Map<String, String> map = new HashMap<String, String>();
map = (Map<String, String>) settings.getAll();
Expand All @@ -78,16 +64,13 @@ private ArrayList<String> apendNames(ArrayList<String> currentList, Activity act

while (it.hasNext()) {
String currentName = it.next();
//Log.i(TAG, "SplashScreenActivity - apendNames: " + currentName);
currentList.add(currentName);
}
return currentList;
}

private ArrayList<String> apendRooms(ArrayList<String> currentList, Activity activity) {
Log.i(TAG, "SplashScreenActivity - apendRooms reached");

SharedPreferences settings = activity.getApplicationContext().getSharedPreferences("NAME_ROOM", 0);
SharedPreferences settings = activity.getApplicationContext().getSharedPreferences("NAME_ROOM", 0);
Map<String, String> map = new HashMap<String, String>();
map = (Map<String, String>) settings.getAll();

Expand All @@ -96,7 +79,6 @@ private ArrayList<String> apendRooms(ArrayList<String> currentList, Activity act

while (it.hasNext()) {
String currentRoom = map.get(it.next());
//Log.i(TAG, "SplashScreenActivity - apendRooms: " + currentRoom);
currentList.add(currentRoom);
}

Expand Down Expand Up @@ -145,18 +127,12 @@ public boolean isDataStored(Activity activity) {


if (nameRoomMap.isEmpty() || roomNameMap.isEmpty()) {
Log.i(TAG, "SplashScreenActivity - No Data stored!!! ");
Timber.d("No room map data is stored.");
return false;
}

Log.i(TAG, "SplashScreenActivity - Data already stored!!! ");

Timber.d("room map is stored.");
return true;




}



}
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
package com.dataProvider;

import com.splashScreen.SplashScreenActivity;
package com.data;

import android.app.Activity;
import android.content.SharedPreferences;
import android.util.Log;
import utils.Constants;

import com.utils.Constants;

import timber.log.Timber;

public class Login {

private String TAG = Login.class.getName();


public boolean isLogin (Activity activity) {

SharedPreferences sp_login = activity.getApplicationContext().getSharedPreferences("LOGIN", 0);
boolean bool = sp_login.getBoolean("login", false);;
Log.i(TAG, "Login - bool: " + bool);

boolean bool = sp_login.getBoolean("login", false);
Timber.d("Login " + bool);
return bool;
}


public boolean checkPassword (String password, Activity activity) {

if (password.equals(Constants.LOGIN)) {
Expand Down
Loading

0 comments on commit 8038cf0

Please sign in to comment.