-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
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' | ||
} |
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 *; | ||
#} |
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> |
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(); | ||
} | ||
} | ||
} |