Loading Android.mk +10 −0 Original line number Diff line number Diff line Loading @@ -21,9 +21,19 @@ LOCAL_SRC_FILES := $(call all-java-files-under, src) LOCAL_SRC_FILES += $(call all-java-files-under, libs/android-syntax-highlight/src) LOCAL_SRC_FILES += $(call all-java-files-under, libs/color-picker-view/src) uicommon_dir := ../../../external/uicommon LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res \ $(LOCAL_PATH)/$(uicommon_dir)/res LOCAL_AAPT_FLAGS := \ --auto-add-overlay \ --extra-packages com.cyngn.uicommon LOCAL_STATIC_JAVA_LIBRARIES += libtruezip LOCAL_STATIC_JAVA_LIBRARIES += android-support-v4 LOCAL_STATIC_JAVA_LIBRARIES += juniversalchardet LOCAL_STATIC_JAVA_LIBRARIES += uicommon LOCAL_PACKAGE_NAME := CMFileManager LOCAL_CERTIFICATE := platform Loading res/values/strings.xml +4 −1 Original line number Diff line number Diff line Loading @@ -843,6 +843,9 @@ <string name="activity_not_found_exception">Couldn\'t find an app to open this file</string> <string name="storage_permissions_denied">The app cannot run without permission to write to external storage.</string> <string name="storage_permissions_denied">Filemanager requires permission to storage in order to view your files.</string> <string name="storage_permissions_explanation">Go to Settings, and tap Permissions to grant permission.</string> <string name="snackbar_ok">Ok</string> <string name="snackbar_settings">Settings</string> </resources> src/com/cyanogenmod/filemanager/activities/NavigationActivity.java +63 −13 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import android.os.Environment; import android.os.Handler; import android.os.Parcelable; import android.os.storage.StorageVolume; import android.provider.Settings; import android.support.v4.app.ActionBarDrawerToggle; import android.support.v4.widget.DrawerLayout; import android.text.TextUtils; Loading Loading @@ -121,6 +122,7 @@ import com.cyanogenmod.filemanager.util.FileHelper; import com.cyanogenmod.filemanager.util.MimeTypeHelper.MimeTypeCategory; import com.cyanogenmod.filemanager.util.MountPointHelper; import com.cyanogenmod.filemanager.util.StorageHelper; import com.cyngn.uicommon.view.Snackbar; import java.io.File; import java.io.FileNotFoundException; Loading Loading @@ -527,10 +529,58 @@ public class NavigationActivity extends Activity mDrawerToggle.syncState(); } } else { if (shouldShowRequestPermissionRationale(Manifest.permission.WRITE_EXTERNAL_STORAGE)) { String text = getResources().getString(R.string.storage_permissions_denied); Toast.makeText(this, text, Toast.LENGTH_LONG).show(); final ViewGroup viewGroup = (ViewGroup) ((ViewGroup) this .findViewById(android.R.id.content)).getChildAt(0); if (viewGroup != null) { Snackbar snackbar = Snackbar.make(viewGroup, text, Snackbar.LENGTH_INDEFINITE, 3); snackbar.setAction(R.string.snackbar_ok, new OnClickListener() { @Override public void onClick(View v) { requestNecessaryPermissions(); } }); snackbar.show(); } } else { StringBuilder builder = new StringBuilder(getString(R.string .storage_permissions_denied)); builder.append("\n\n"); builder.append(getString(R.string.storage_permissions_explanation)); final ViewGroup viewGroup = (ViewGroup) ((ViewGroup) this .findViewById(android.R.id.content)).getChildAt(0); if (viewGroup != null) { Snackbar snackbar = Snackbar.make(viewGroup, builder.toString(), Snackbar.LENGTH_INDEFINITE, 7); snackbar.setAction(R.string.snackbar_settings, new OnClickListener() { @Override public void onClick(View v) { startInstalledAppDetailsActivity(NavigationActivity.this); finish(); } }); snackbar.show(); } } } } public static void startInstalledAppDetailsActivity(final Activity context) { if (context == null) { return; } final Intent i = new Intent(); i.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); i.addCategory(Intent.CATEGORY_DEFAULT); i.setData(Uri.parse("package:" + context.getPackageName())); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); i.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); context.startActivity(i); } private void finishOnCreate() { Loading Loading @@ -558,13 +608,6 @@ public class NavigationActivity extends Activity mImm = (InputMethodManager) this.getSystemService( Context.INPUT_METHOD_SERVICE); // Set the theme before setContentView Theme theme = ThemeManager.getCurrentTheme(this); theme.setBaseThemeNoActionBar(this); //Set the main layout of the activity setContentView(R.layout.navigation); //Initialize nfc adapter NfcAdapter mNfcAdapter = NfcAdapter.getDefaultAdapter(this); if (mNfcAdapter != null) { Loading Loading @@ -669,15 +712,22 @@ public class NavigationActivity extends Activity Log.d(TAG, "NavigationActivity.onCreate"); //$NON-NLS-1$ } // Set the theme before setContentView Theme theme = ThemeManager.getCurrentTheme(this); theme.setBaseThemeNoActionBar(this); //Set the main layout of the activity setContentView(R.layout.navigation); //Save state super.onCreate(state); if (!hasPermissions()) { requestNecessaryPermissions(); } else { finishOnCreate(); } //Save state super.onCreate(state); } @Override Loading Loading
Android.mk +10 −0 Original line number Diff line number Diff line Loading @@ -21,9 +21,19 @@ LOCAL_SRC_FILES := $(call all-java-files-under, src) LOCAL_SRC_FILES += $(call all-java-files-under, libs/android-syntax-highlight/src) LOCAL_SRC_FILES += $(call all-java-files-under, libs/color-picker-view/src) uicommon_dir := ../../../external/uicommon LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res \ $(LOCAL_PATH)/$(uicommon_dir)/res LOCAL_AAPT_FLAGS := \ --auto-add-overlay \ --extra-packages com.cyngn.uicommon LOCAL_STATIC_JAVA_LIBRARIES += libtruezip LOCAL_STATIC_JAVA_LIBRARIES += android-support-v4 LOCAL_STATIC_JAVA_LIBRARIES += juniversalchardet LOCAL_STATIC_JAVA_LIBRARIES += uicommon LOCAL_PACKAGE_NAME := CMFileManager LOCAL_CERTIFICATE := platform Loading
res/values/strings.xml +4 −1 Original line number Diff line number Diff line Loading @@ -843,6 +843,9 @@ <string name="activity_not_found_exception">Couldn\'t find an app to open this file</string> <string name="storage_permissions_denied">The app cannot run without permission to write to external storage.</string> <string name="storage_permissions_denied">Filemanager requires permission to storage in order to view your files.</string> <string name="storage_permissions_explanation">Go to Settings, and tap Permissions to grant permission.</string> <string name="snackbar_ok">Ok</string> <string name="snackbar_settings">Settings</string> </resources>
src/com/cyanogenmod/filemanager/activities/NavigationActivity.java +63 −13 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import android.os.Environment; import android.os.Handler; import android.os.Parcelable; import android.os.storage.StorageVolume; import android.provider.Settings; import android.support.v4.app.ActionBarDrawerToggle; import android.support.v4.widget.DrawerLayout; import android.text.TextUtils; Loading Loading @@ -121,6 +122,7 @@ import com.cyanogenmod.filemanager.util.FileHelper; import com.cyanogenmod.filemanager.util.MimeTypeHelper.MimeTypeCategory; import com.cyanogenmod.filemanager.util.MountPointHelper; import com.cyanogenmod.filemanager.util.StorageHelper; import com.cyngn.uicommon.view.Snackbar; import java.io.File; import java.io.FileNotFoundException; Loading Loading @@ -527,10 +529,58 @@ public class NavigationActivity extends Activity mDrawerToggle.syncState(); } } else { if (shouldShowRequestPermissionRationale(Manifest.permission.WRITE_EXTERNAL_STORAGE)) { String text = getResources().getString(R.string.storage_permissions_denied); Toast.makeText(this, text, Toast.LENGTH_LONG).show(); final ViewGroup viewGroup = (ViewGroup) ((ViewGroup) this .findViewById(android.R.id.content)).getChildAt(0); if (viewGroup != null) { Snackbar snackbar = Snackbar.make(viewGroup, text, Snackbar.LENGTH_INDEFINITE, 3); snackbar.setAction(R.string.snackbar_ok, new OnClickListener() { @Override public void onClick(View v) { requestNecessaryPermissions(); } }); snackbar.show(); } } else { StringBuilder builder = new StringBuilder(getString(R.string .storage_permissions_denied)); builder.append("\n\n"); builder.append(getString(R.string.storage_permissions_explanation)); final ViewGroup viewGroup = (ViewGroup) ((ViewGroup) this .findViewById(android.R.id.content)).getChildAt(0); if (viewGroup != null) { Snackbar snackbar = Snackbar.make(viewGroup, builder.toString(), Snackbar.LENGTH_INDEFINITE, 7); snackbar.setAction(R.string.snackbar_settings, new OnClickListener() { @Override public void onClick(View v) { startInstalledAppDetailsActivity(NavigationActivity.this); finish(); } }); snackbar.show(); } } } } public static void startInstalledAppDetailsActivity(final Activity context) { if (context == null) { return; } final Intent i = new Intent(); i.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); i.addCategory(Intent.CATEGORY_DEFAULT); i.setData(Uri.parse("package:" + context.getPackageName())); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); i.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); context.startActivity(i); } private void finishOnCreate() { Loading Loading @@ -558,13 +608,6 @@ public class NavigationActivity extends Activity mImm = (InputMethodManager) this.getSystemService( Context.INPUT_METHOD_SERVICE); // Set the theme before setContentView Theme theme = ThemeManager.getCurrentTheme(this); theme.setBaseThemeNoActionBar(this); //Set the main layout of the activity setContentView(R.layout.navigation); //Initialize nfc adapter NfcAdapter mNfcAdapter = NfcAdapter.getDefaultAdapter(this); if (mNfcAdapter != null) { Loading Loading @@ -669,15 +712,22 @@ public class NavigationActivity extends Activity Log.d(TAG, "NavigationActivity.onCreate"); //$NON-NLS-1$ } // Set the theme before setContentView Theme theme = ThemeManager.getCurrentTheme(this); theme.setBaseThemeNoActionBar(this); //Set the main layout of the activity setContentView(R.layout.navigation); //Save state super.onCreate(state); if (!hasPermissions()) { requestNecessaryPermissions(); } else { finishOnCreate(); } //Save state super.onCreate(state); } @Override Loading