Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
KorHsien committed Jan 19, 2016
1 parent 5a3279b commit ce12c71
Show file tree
Hide file tree
Showing 48 changed files with 1,107 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
# Built application files
*.apk
*.ap_
Expand Down Expand Up @@ -29,4 +37,4 @@ proguard/
.navigation/

# Android Studio captures folder
captures/
captures/
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 62 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
28 changes: 28 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
applicationId "com.loopeer.fastandroid"
minSdkVersion 12
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'de.greenrobot:eventbus:2.4.0'
}
17 changes: 17 additions & 0 deletions app/proguard-rules.pro
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:\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 *;
#}
30 changes: 30 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.loopeer.fastandroid"
xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:name=".FastAndroidApp"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".ui.activity.SplashActivity"
android:theme="@style/AppTheme.Splash">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".ui.activity.MainActivity"
android:theme="@style/AppTheme.NoActionBar">
</activity>
<activity
android:name=".ui.activity.WizardActivity"
android:theme="@style/AppTheme.NoActionBar.Translucent">
</activity>
</application>

</manifest>
15 changes: 15 additions & 0 deletions app/src/main/java/com/loopeer/fastandroid/FastAndroidApp.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.loopeer.fastandroid;

import android.app.Application;

import com.loopeer.fastandroid.event.SplashDisplayEvent;

import de.greenrobot.event.EventBus;

public class FastAndroidApp extends Application {
@Override
public void onCreate() {
super.onCreate();
EventBus.getDefault().postSticky(new SplashDisplayEvent());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.loopeer.fastandroid.event;

public class SplashDisplayEvent {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
package com.loopeer.fastandroid.ui.activity;

import android.content.Intent;
import android.content.pm.PackageManager;
import android.support.annotation.Nullable;
import android.support.v4.app.NavUtils;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.widget.TextView;

import com.loopeer.fastandroid.R;

import butterknife.Bind;
import butterknife.ButterKnife;

public abstract class BaseActivity extends AppCompatActivity {

@Nullable
@Bind(R.id.toolbar)
Toolbar mToolbar;
@Nullable
@Bind(R.id.toolbar_title)
TextView mToolbarTitle;

private boolean mUpAsFinish;

@Override
public void onContentChanged() {
super.onContentChanged();
ButterKnife.bind(this);

if (mToolbar != null) {
onSetupToolbar(mToolbar);
}

String title = getIntent().getStringExtra(Intent.EXTRA_TITLE);
if (!TextUtils.isEmpty(title)) {
setTitle(title);
}
}

protected void onSetupToolbar(Toolbar toolbar) {
setSupportActionBar(toolbar);
try {
if (NavUtils.getParentActivityName(this, getComponentName()) != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
} catch (PackageManager.NameNotFoundException e) {
// ignore
}
if (mToolbarTitle != null) {
getSupportActionBar().setDisplayShowTitleEnabled(false);
}
}

@Override
protected void onTitleChanged(CharSequence title, int color) {
super.onTitleChanged(title, color);
if (mToolbarTitle != null) {
mToolbarTitle.setText(title);
} else if (mToolbar != null) {
mToolbar.setTitle(title);
}
}

public void setUpAsFinish(boolean homeAsFinish) {
if (getSupportActionBar() == null) {
return;
}

getSupportActionBar().setDisplayHomeAsUpEnabled(homeAsFinish);
mUpAsFinish = homeAsFinish;
}

@Override
public boolean onNavigateUp() {
if (mUpAsFinish) {
finish();
return true;
} else {
return super.onNavigateUp();
}
}
}
Loading

0 comments on commit ce12c71

Please sign in to comment.