Skip to content
This repository has been archived by the owner on May 9, 2018. It is now read-only.

Commit

Permalink
1st commit
Browse files Browse the repository at this point in the history
  • Loading branch information
xstar97 committed Sep 16, 2017
1 parent 114f07c commit 2cef18f
Show file tree
Hide file tree
Showing 220 changed files with 82,425 additions and 0 deletions.
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.

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

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

10 changes: 10 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.

1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
39 changes: 39 additions & 0 deletions app/build.gradle
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'
}
25 changes: 25 additions & 0 deletions app/proguard-rules.pro
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
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());
}
}
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 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>
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;
}
}
Loading

0 comments on commit 2cef18f

Please sign in to comment.