-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/workspace.xml | ||
/.idea/libraries | ||
.DS_Store | ||
/build | ||
/captures |
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,34 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 24 | ||
buildToolsVersion "24.0.0" | ||
|
||
defaultConfig { | ||
applicationId "com.vintech.mediaguardian" | ||
minSdkVersion 15 | ||
targetSdkVersion 24 | ||
versionCode 1 | ||
versionName "1.0" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compile fileTree(include: ['*.jar'], dir: 'libs') | ||
testCompile 'junit:junit:4.12' | ||
compile 'com.android.support:appcompat-v7:24.0.0' | ||
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5' | ||
compile 'com.android.support:support-v4:24.0.0' | ||
compile 'org.greenrobot:eventbus:3.0.0' | ||
compile 'com.j256.ormlite:ormlite-core:4.48' | ||
compile 'com.j256.ormlite:ormlite-android:4.48' | ||
compile 'com.squareup.okhttp:okhttp:2.0.0' | ||
compile 'com.android.support:design:24.0.0' | ||
compile 'com.google.android.gms:play-services:9.2.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 /Users/panguowei/Library/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,13 @@ | ||
package com.vintech.mediaguardian; | ||
|
||
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); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.vintech.mediaguardian"> | ||
|
||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | ||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | ||
|
||
<application | ||
android:name=".MainApplication" | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity | ||
android:name=".MainActivity" | ||
android:label="@string/app_name" | ||
android:screenOrientation="portrait" | ||
android:theme="@style/AppTheme.NoActionBar"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
<activity | ||
android:name=".photo.fullview.FullPhotoActivity" | ||
android:screenOrientation="portrait" | ||
android:theme="@style/Theme.AppCompat.NoActionBar" /> | ||
<activity | ||
android:name=".video.fullview.VideoPlayActivity" | ||
android:screenOrientation="landscape" | ||
android:theme="@style/Theme.AppCompat.NoActionBar" /> | ||
<!-- ATTENTION: This was auto-generated to add Google Play services to your project for | ||
App Indexing. See https://g.co/AppIndexing/AndroidStudio for more information. --> | ||
<meta-data | ||
android:name="com.google.android.gms.version" | ||
android:value="@integer/google_play_services_version" /> | ||
</application> | ||
|
||
</manifest> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
package com.vintech.mediaguardian; | ||
|
||
import android.os.Bundle; | ||
import android.support.design.widget.NavigationView; | ||
import android.support.v4.app.ActivityCompat; | ||
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 com.vintech.mediaguardian.framework.FrameEvent; | ||
import com.vintech.mediaguardian.framework.WorkspaceLayout; | ||
import com.vintech.util.tool.PermissionTool; | ||
|
||
import org.greenrobot.eventbus.EventBus; | ||
import org.greenrobot.eventbus.Subscribe; | ||
import org.greenrobot.eventbus.ThreadMode; | ||
|
||
public class MainActivity extends AppCompatActivity | ||
implements NavigationView.OnNavigationItemSelectedListener { | ||
|
||
private static final int REQUEST_PERMISSION = 100; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | ||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); | ||
setSupportActionBar(toolbar); | ||
|
||
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); | ||
|
||
EventBus.getDefault().register(this); | ||
|
||
MainApplication.getDBManager().startModel(); | ||
} | ||
|
||
@Override | ||
public void onBackPressed() { | ||
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); | ||
if (drawer.isDrawerOpen(GravityCompat.START)) { | ||
drawer.closeDrawer(GravityCompat.START); | ||
} else { | ||
WorkspaceLayout workspace = (WorkspaceLayout) findViewById(R.id.workspace); | ||
if (workspace.handleBackKey()) { | ||
return; | ||
} 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); | ||
} | ||
|
||
@SuppressWarnings("StatementWithEmptyBody") | ||
@Override | ||
public boolean onNavigationItemSelected(MenuItem item) { | ||
int id = item.getItemId(); | ||
if (id == R.id.nav_gallery) { | ||
EventBus.getDefault().post(new FrameEvent.EventSetLayout(R.id.photo_gallery_layout)); | ||
} else if (id == R.id.nav_sys_gallery) { | ||
EventBus.getDefault().post(new FrameEvent.EventSetLayout(R.id.photo_pick_layout)); | ||
} else if (id == R.id.nav_video) { | ||
EventBus.getDefault().post(new FrameEvent.EventSetLayout(R.id.video_gallery_layout)); | ||
} else if (id == R.id.nav_sys_video) { | ||
EventBus.getDefault().post(new FrameEvent.EventSetLayout(R.id.video_pick_layout)); | ||
} else if (id == R.id.nav_share) { | ||
} else if (id == R.id.nav_send) { | ||
} | ||
|
||
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); | ||
drawer.closeDrawer(GravityCompat.START); | ||
return true; | ||
} | ||
|
||
@Subscribe(threadMode = ThreadMode.MAIN) | ||
public void onEventRequestPermission(FrameEvent.EventRequestPermission event) { | ||
if (!PermissionTool.hasPermission(this, event.mPermission) && ActivityCompat.shouldShowRequestPermissionRationale(this, event.mPermission)) { | ||
ActivityCompat.requestPermissions(this, new String[]{event.mPermission}, REQUEST_PERMISSION); | ||
} | ||
} | ||
|
||
@Override | ||
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { | ||
super.onRequestPermissionsResult(requestCode, permissions, grantResults); | ||
if (requestCode == REQUEST_PERMISSION) { | ||
for (int i = 0; i < permissions.length; i++) { | ||
EventBus.getDefault().post(new FrameEvent.EventPermissionResult(permissions[i], grantResults[i])); | ||
} | ||
} | ||
} | ||
} |