This repository has been archived by the owner on May 9, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
220 changed files
with
82,425 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,39 @@ | ||
apply plugin: 'com.android.application' | ||
apply plugin: 'com.jakewharton.butterknife' | ||
|
||
android { | ||
compileSdkVersion 25 | ||
buildToolsVersion "25.0.3" | ||
defaultConfig { | ||
applicationId "com.xstar97.easyutils.sample" | ||
minSdkVersion 14 | ||
targetSdkVersion 25 | ||
versionCode 1 | ||
versionName "1.0" | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { | ||
exclude group: 'com.android.support', module: 'support-annotations' | ||
}) | ||
compile project(":library") | ||
|
||
compile 'com.jakewharton:butterknife:8.8.1' | ||
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1' | ||
|
||
compile 'com.rohit.recycleritemclicksupport:recycleritemclicksupport:1.0.1' | ||
|
||
compile 'com.android.support:appcompat-v7:25.3.1' | ||
compile 'com.android.support:design:25.3.1' | ||
compile 'com.android.support:recyclerview-v7:25.3.1' | ||
|
||
testCompile 'junit:junit:4.12' | ||
} |
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,25 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in A:\AppData\Local\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 *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
26 changes: 26 additions & 0 deletions
26
app/src/androidTest/java/com/xstar97/easyutils/ExampleInstrumentedTest.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,26 @@ | ||
package com.xstar97.easyutils; | ||
|
||
import android.content.Context; | ||
import android.support.test.InstrumentationRegistry; | ||
import android.support.test.runner.AndroidJUnit4; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
*/ | ||
@RunWith(AndroidJUnit4.class) | ||
public class ExampleInstrumentedTest { | ||
@Test | ||
public void useAppContext() throws Exception { | ||
// Context of the app under test. | ||
Context appContext = InstrumentationRegistry.getTargetContext(); | ||
|
||
assertEquals("com.xstar97.easyutils", appContext.getPackageName()); | ||
} | ||
} |
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,30 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
package="com.xstar97.easyutils.sample"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
<uses-permission android:name="android.permission.BLUETOOTH" /> | ||
|
||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | ||
|
||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
tools:ignore="AllowBackup,GoogleAppIndexingWarning"> | ||
<activity android:name="com.xstar97.easyutils.activities.MainActivity" android:label="@string/app_name" android:theme="@style/AppTheme.NoActionBar"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
143 changes: 143 additions & 0 deletions
143
app/src/main/java/com/xstar97/easyutils/activities/BaseDrawerActivity.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,143 @@ | ||
package com.xstar97.easyutils.activities; | ||
|
||
import android.annotation.SuppressLint; | ||
import android.support.annotation.NonNull; | ||
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.MenuItem; | ||
import android.widget.Toast; | ||
|
||
import com.xstar97.easyutils.mods.EasyLogMod; | ||
import com.xstar97.easyutils.sample.R; | ||
|
||
@SuppressLint("Registered") | ||
@SuppressWarnings({"FieldCanBeLocal", "unused"}) | ||
public class BaseDrawerActivity extends AppCompatActivity | ||
implements NavigationView.OnNavigationItemSelectedListener | ||
{ | ||
private String TAG = "BaseDrawerActivity"; | ||
|
||
private Toolbar toolBar; | ||
private DrawerLayout drawerLayout; | ||
private NavigationView navView; | ||
|
||
public void initOnCreate(Toolbar toolbar, DrawerLayout drawer, NavigationView navigationView){ | ||
try { | ||
toolBar = toolbar; | ||
drawerLayout = drawer; | ||
navView = navigationView; | ||
|
||
setSupportActionBar(toolbar); | ||
|
||
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( | ||
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); | ||
drawer.addDrawerListener(toggle); | ||
toggle.syncState(); | ||
|
||
navigationView.setNavigationItemSelectedListener(this); | ||
}catch (Exception e){ | ||
error(e.getMessage()); | ||
} | ||
} | ||
public void initOnCreate(int toolbarID, int drawerID, int navigationViewID){ | ||
try{ | ||
|
||
Toolbar toolbar = (Toolbar) findViewById(toolbarID); | ||
DrawerLayout drawer = (DrawerLayout) findViewById(drawerID); | ||
NavigationView navigationView = (NavigationView) findViewById(navigationViewID); | ||
|
||
toolBar = toolbar; | ||
drawerLayout = drawer; | ||
navView = navigationView; | ||
|
||
setSupportActionBar(toolbar); | ||
|
||
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( | ||
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); | ||
drawer.addDrawerListener(toggle); | ||
toggle.syncState(); | ||
|
||
navigationView.setNavigationItemSelectedListener(this); | ||
}catch (Exception e){ | ||
error(e.getMessage()); | ||
} | ||
} | ||
|
||
public void unCheckedMenu(){ | ||
int size = getNavView().getMenu().size(); | ||
for (int i = 0; i < size; i++) { | ||
getNavView().getMenu().getItem(i).setChecked(false); | ||
} | ||
} | ||
|
||
public void closerDrawer(){ | ||
try{ | ||
getDrawerLayout().closeDrawer(GravityCompat.START); | ||
}catch (Exception e){ | ||
error(e.getMessage()); | ||
} | ||
} | ||
|
||
public void openDrawer(){ | ||
try { | ||
getDrawerLayout().openDrawer(GravityCompat.START); | ||
}catch (Exception e){ | ||
error(e.getMessage()); | ||
} | ||
} | ||
|
||
public boolean isDrawerOpen(){ | ||
try{ | ||
return getDrawerLayout().isDrawerOpen(GravityCompat.START); | ||
}catch (Exception e){ | ||
error(e.getMessage()); | ||
return false; | ||
} | ||
} | ||
|
||
public Toolbar getToolBar(){ | ||
try{ | ||
return toolBar; | ||
}catch (Exception e){ | ||
error(e.getMessage()); | ||
return null; | ||
} | ||
} | ||
public DrawerLayout getDrawerLayout(){ | ||
try{ | ||
return drawerLayout; | ||
}catch (Exception e){ | ||
error(e.getMessage()); | ||
return null; | ||
} | ||
} | ||
public NavigationView getNavView(){ | ||
try{ | ||
return navView; | ||
}catch (Exception e){ | ||
error(e.getMessage()); | ||
return null; | ||
} | ||
} | ||
|
||
public void toast(String t){ | ||
Toast.makeText(this, t, Toast.LENGTH_SHORT).show(); | ||
} | ||
|
||
public void error(String e){ | ||
new EasyLogMod.logBuilder() | ||
.setTag(TAG) | ||
.setLog(e) | ||
.error(); | ||
} | ||
|
||
@SuppressWarnings("StatementWithEmptyBody") | ||
@Override | ||
public boolean onNavigationItemSelected(@NonNull MenuItem item) { | ||
return false; | ||
} | ||
} |
Oops, something went wrong.