This repository has been archived by the owner on Feb 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Działająca nawigacja * Wprowadzenie MVP * Wstępne UI dla podsumowania
- Loading branch information
0 parents
commit dfc24d4
Showing
44 changed files
with
1,133 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
# Default | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/workspace.xml | ||
/.idea/libraries | ||
.DS_Store | ||
/build | ||
/captures | ||
|
||
|
||
# Created by https://www.gitignore.io/api/windows,linux,osx,android,intellij | ||
|
||
### Windows ### | ||
# Windows image file caches | ||
Thumbs.db | ||
ehthumbs.db | ||
|
||
# Folder config file | ||
Desktop.ini | ||
|
||
# Recycle Bin used on file shares | ||
$RECYCLE.BIN/ | ||
|
||
# Windows Installer files | ||
*.cab | ||
*.msi | ||
*.msm | ||
*.msp | ||
|
||
# Windows shortcuts | ||
*.lnk | ||
|
||
|
||
### Linux ### | ||
*~ | ||
|
||
# KDE directory preferences | ||
.directory | ||
|
||
# Linux trash folder which might appear on any partition or disk | ||
.Trash-* | ||
|
||
|
||
### OSX ### | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
|
||
### Android ### | ||
# Built application files | ||
*.apk | ||
*.ap_ | ||
|
||
# Files for the Dalvik VM | ||
*.dex | ||
|
||
# Java class files | ||
*.class | ||
|
||
# Generated files | ||
bin/ | ||
gen/ | ||
|
||
# Gradle files | ||
.gradle/ | ||
build/ | ||
|
||
# Local configuration file (sdk path, etc) | ||
local.properties | ||
|
||
# Proguard folder generated by Eclipse | ||
proguard/ | ||
|
||
# Log Files | ||
*.log | ||
|
||
# Android Studio Navigation editor temp files | ||
.navigation/ | ||
|
||
# Android Studio captures folder | ||
captures/ | ||
|
||
### Android Patch ### | ||
gen-external-apklibs | ||
|
||
|
||
### Intellij ### | ||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm | ||
|
||
*.iml | ||
|
||
## Directory-based project format: | ||
.idea/ | ||
# if you remove the above rule, at least ignore the following: | ||
|
||
# User-specific stuff: | ||
# .idea/workspace.xml | ||
# .idea/tasks.xml | ||
# .idea/dictionaries | ||
# .idea/shelf | ||
|
||
# Sensitive or high-churn files: | ||
# .idea/dataSources.ids | ||
# .idea/dataSources.xml | ||
# .idea/sqlDataSources.xml | ||
# .idea/dynamic.xml | ||
# .idea/uiDesigner.xml | ||
|
||
# Gradle: | ||
# .idea/gradle.xml | ||
# .idea/libraries | ||
|
||
# Mongo Explorer plugin: | ||
# .idea/mongoSettings.xml | ||
|
||
## File-based project format: | ||
*.ipr | ||
*.iws | ||
|
||
## Plugin-specific files: | ||
|
||
# IntelliJ | ||
/out/ | ||
|
||
# mpeltonen/sbt-idea plugin | ||
.idea_modules/ | ||
|
||
# JIRA plugin | ||
atlassian-ide-plugin.xml | ||
|
||
# Crashlytics plugin (for Android Studio and IntelliJ) | ||
com_crashlytics_export_strings.xml | ||
crashlytics.properties | ||
crashlytics-build.properties | ||
fabric.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 23 | ||
buildToolsVersion "23.0.1" | ||
|
||
defaultConfig { | ||
applicationId "net.kacpak.batterychargingmonitor" | ||
minSdkVersion 16 | ||
targetSdkVersion 23 | ||
versionCode 1 | ||
versionName "1.0" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
def supportLibrary = "23.1.1" | ||
|
||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
testCompile 'junit:junit:4.12' | ||
|
||
// Support Libraries | ||
compile "com.android.support:appcompat-v7:$supportLibrary" | ||
compile "com.android.support:design:$supportLibrary" | ||
compile "com.android.support:support-annotations:$supportLibrary" | ||
|
||
// Circle Progress | ||
compile 'com.github.lzyzsd:circleprogress:1.1.0@aar' | ||
|
||
// Butter Knife | ||
compile 'com.jakewharton:butterknife:7.0.1' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in D:\Tools\android-sdk/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the proguardFiles | ||
# directive in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} |
13 changes: 13 additions & 0 deletions
13
app/src/androidTest/java/net/kacpak/batterychargingmonitor/ApplicationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package net.kacpak.batterychargingmonitor; | ||
|
||
import android.app.Application; | ||
import android.test.ApplicationTestCase; | ||
|
||
/** | ||
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> | ||
*/ | ||
public class ApplicationTest extends ApplicationTestCase<Application> { | ||
public ApplicationTest() { | ||
super(Application.class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="net.kacpak.batterychargingmonitor"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme.NoActionBar"> | ||
<activity | ||
android:name=".ui.MainActivity" | ||
android:label="@string/app_name"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
9 changes: 9 additions & 0 deletions
9
app/src/main/java/net/kacpak/batterychargingmonitor/data/BatteryDataRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package net.kacpak.batterychargingmonitor.data; | ||
|
||
public class BatteryDataRepository { | ||
|
||
static int p = 0; | ||
public BatteryStatus getStatus() { | ||
return new BatteryStatus(++p); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
app/src/main/java/net/kacpak/batterychargingmonitor/data/BatteryStatus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package net.kacpak.batterychargingmonitor.data; | ||
|
||
public class BatteryStatus { | ||
private final int percentage; | ||
|
||
public BatteryStatus(int percentage) { | ||
this.percentage = percentage; | ||
} | ||
|
||
public int getPercentage() { | ||
return percentage; | ||
} | ||
} |
97 changes: 97 additions & 0 deletions
97
app/src/main/java/net/kacpak/batterychargingmonitor/ui/MainActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
package net.kacpak.batterychargingmonitor.ui; | ||
|
||
import android.app.Fragment; | ||
import android.os.Bundle; | ||
import android.support.design.widget.FloatingActionButton; | ||
import android.support.design.widget.Snackbar; | ||
import android.view.View; | ||
import android.support.design.widget.NavigationView; | ||
import android.support.v4.view.GravityCompat; | ||
import android.support.v4.widget.DrawerLayout; | ||
import android.support.v7.app.ActionBarDrawerToggle; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.support.v7.widget.Toolbar; | ||
import android.view.Menu; | ||
import android.view.MenuItem; | ||
|
||
import net.kacpak.batterychargingmonitor.R; | ||
import net.kacpak.batterychargingmonitor.ui.history.HistoryFragment; | ||
import net.kacpak.batterychargingmonitor.ui.summary.SummaryFragment; | ||
|
||
public class MainActivity extends AppCompatActivity | ||
implements NavigationView.OnNavigationItemSelectedListener { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity); | ||
|
||
// Toolbar | ||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); | ||
setSupportActionBar(toolbar); | ||
|
||
// Navigation Drawer | ||
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); | ||
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( | ||
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); | ||
drawer.setDrawerListener(toggle); | ||
toggle.syncState(); | ||
|
||
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); | ||
navigationView.setNavigationItemSelectedListener(this); | ||
|
||
// Initialize fragment | ||
if (savedInstanceState == null) { | ||
getFragmentManager().beginTransaction() | ||
.replace(R.id.content, new SummaryFragment()) | ||
.commit(); | ||
navigationView.setCheckedItem(R.id.nav_summary); | ||
} | ||
} | ||
|
||
@Override | ||
public void onBackPressed() { | ||
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); | ||
if (drawer.isDrawerOpen(GravityCompat.START)) | ||
drawer.closeDrawer(GravityCompat.START); | ||
else | ||
super.onBackPressed(); | ||
} | ||
|
||
@Override | ||
public boolean onCreateOptionsMenu(Menu menu) { | ||
getMenuInflater().inflate(R.menu.main, menu); | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean onOptionsItemSelected(MenuItem item) { | ||
int id = item.getItemId(); | ||
|
||
if (id == R.id.action_settings) { | ||
return true; | ||
} | ||
|
||
return super.onOptionsItemSelected(item); | ||
} | ||
|
||
@Override | ||
public boolean onNavigationItemSelected(MenuItem item) { | ||
final int id = item.getItemId(); | ||
Fragment fragment = null; | ||
|
||
if (id == R.id.nav_summary) | ||
fragment = new SummaryFragment(); | ||
else if (id == R.id.nav_history) | ||
fragment = new HistoryFragment(); | ||
|
||
if (fragment != null) | ||
getFragmentManager().beginTransaction() | ||
.replace(R.id.content, fragment) | ||
.commit(); | ||
|
||
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); | ||
drawer.closeDrawer(GravityCompat.START); | ||
return true; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
app/src/main/java/net/kacpak/batterychargingmonitor/ui/history/HistoryContract.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package net.kacpak.batterychargingmonitor.ui.history; | ||
|
||
public interface HistoryContract { | ||
interface View { | ||
} | ||
|
||
interface UserActionsListener { | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
app/src/main/java/net/kacpak/batterychargingmonitor/ui/history/HistoryFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package net.kacpak.batterychargingmonitor.ui.history; | ||
|
||
import android.app.Fragment; | ||
|
||
public class HistoryFragment extends Fragment implements HistoryContract.View { | ||
|
||
} |
Oops, something went wrong.