Reformated the code and optimized imports
This commit is contained in:
parent
fca3410f26
commit
474ce28737
@ -66,6 +66,7 @@ public class HomeActivity extends Activity {
|
||||
*/
|
||||
protected DrawerLayout mDrawerLayout;
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@ -102,6 +103,7 @@ public class HomeActivity extends Activity {
|
||||
mDrawerToggle.syncState();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@ -112,6 +114,7 @@ public class HomeActivity extends Activity {
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@ -122,6 +125,7 @@ public class HomeActivity extends Activity {
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@ -135,6 +139,7 @@ public class HomeActivity extends Activity {
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@ -144,6 +149,7 @@ public class HomeActivity extends Activity {
|
||||
mDrawerToggle.onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@ -153,6 +159,7 @@ public class HomeActivity extends Activity {
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@ -176,6 +183,7 @@ public class HomeActivity extends Activity {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@ -190,6 +198,9 @@ public class HomeActivity extends Activity {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
@ -197,7 +208,6 @@ public class HomeActivity extends Activity {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
public void onEvent(FileSelectedEvent event) {
|
||||
@ -213,6 +223,7 @@ public class HomeActivity extends Activity {
|
||||
/**
|
||||
* When a file is saved
|
||||
* Invoked by the EditorFragment
|
||||
*
|
||||
* @param event The event called
|
||||
*/
|
||||
public void onEvent(FileSavedEvent event) {
|
||||
@ -252,6 +263,7 @@ public class HomeActivity extends Activity {
|
||||
/**
|
||||
* When a file can't be opened
|
||||
* Invoked by the EditorFragment
|
||||
*
|
||||
* @param event The event called
|
||||
*/
|
||||
public void onEvent(ErrorOpeningFileEvent event) {
|
||||
@ -299,11 +311,17 @@ public class HomeActivity extends Activity {
|
||||
R.string.nome_app_turbo_editor,
|
||||
R.string.nome_app_turbo_editor) {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void onDrawerClosed(View view) {
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void onDrawerOpened(View drawerView) {
|
||||
invalidateOptionsMenu();
|
||||
|
@ -14,6 +14,7 @@ import com.vmihalachi.turboeditor.R;
|
||||
|
||||
public class LicensesActivity extends Activity implements AdapterView.OnItemClickListener {
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@ -27,6 +28,7 @@ public class LicensesActivity extends Activity implements AdapterView.OnItemClic
|
||||
listView.setAdapter(adapter);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -30,6 +30,9 @@ import com.vmihalachi.turboeditor.fragment.ChangelogDialogFragment;
|
||||
import com.vmihalachi.turboeditor.helper.AppInfoHelper;
|
||||
|
||||
public class PreferenceAbout extends PreferenceActivity {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@ -44,6 +47,9 @@ public class PreferenceAbout extends PreferenceActivity {
|
||||
market = findPreference("aboutactivity_authormarket");
|
||||
if (email != null) {
|
||||
email.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean onPreferenceClick(final Preference preference) {
|
||||
Intent i = new Intent(Intent.ACTION_SEND);
|
||||
@ -61,6 +67,9 @@ public class PreferenceAbout extends PreferenceActivity {
|
||||
}
|
||||
if (changelog != null) {
|
||||
changelog.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean onPreferenceClick(final Preference preference) {
|
||||
ChangelogDialogFragment.showChangeLogDialog(getFragmentManager());
|
||||
@ -70,6 +79,9 @@ public class PreferenceAbout extends PreferenceActivity {
|
||||
}
|
||||
if (open_source_licenses != null) {
|
||||
open_source_licenses.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean onPreferenceClick(final Preference preference) {
|
||||
startActivity(new Intent(PreferenceAbout.this, LicensesActivity.class));
|
||||
@ -79,6 +91,9 @@ public class PreferenceAbout extends PreferenceActivity {
|
||||
}
|
||||
if (market != null) {
|
||||
market.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean onPreferenceClick(final Preference preference) {
|
||||
try {
|
||||
|
@ -57,6 +57,9 @@ public class SelectFileActivity extends Activity implements AdapterView.OnItemCl
|
||||
.getAbsolutePath();
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@ -85,6 +88,9 @@ public class SelectFileActivity extends Activity implements AdapterView.OnItemCl
|
||||
finish();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent,
|
||||
View view, int position, long id) {
|
||||
@ -106,6 +112,9 @@ public class SelectFileActivity extends Activity implements AdapterView.OnItemCl
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.activity_select_file, menu);
|
||||
@ -114,6 +123,9 @@ public class SelectFileActivity extends Activity implements AdapterView.OnItemCl
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
int i = item.getItemId();
|
||||
@ -145,6 +157,9 @@ public class SelectFileActivity extends Activity implements AdapterView.OnItemCl
|
||||
private class UpdateList extends
|
||||
AsyncTask<String, Void, LinkedList<AdapterDetailedList.FileDetail>> {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected LinkedList<AdapterDetailedList.FileDetail> doInBackground(final String... params) {
|
||||
try {
|
||||
@ -196,6 +211,9 @@ public class SelectFileActivity extends Activity implements AdapterView.OnItemCl
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void onPostExecute(final LinkedList<AdapterDetailedList.FileDetail> names) {
|
||||
boolean isRoot = currentFolder.equals("/");
|
||||
@ -207,6 +225,9 @@ public class SelectFileActivity extends Activity implements AdapterView.OnItemCl
|
||||
|
||||
public final Comparator<File> getFileNameComparator() {
|
||||
return new AlphanumComparator() {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getTheString(Object obj) {
|
||||
return ((File) obj).getName()
|
||||
|
@ -73,6 +73,9 @@ public class AdapterDetailedList extends
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public View getView(final int position,
|
||||
View convertView, final ViewGroup parent) {
|
||||
@ -109,29 +112,22 @@ public class AdapterDetailedList extends
|
||||
final String ext = FilenameUtils.getExtension(fileName);
|
||||
if (fileDetail.isFolder()) {
|
||||
viewHolder.icon.setImageResource(R.color.file_folder);
|
||||
}
|
||||
else if (Arrays.asList(MimeTypes.MIME_HTML).contains(ext) || ext.endsWith("html")) {
|
||||
} else if (Arrays.asList(MimeTypes.MIME_HTML).contains(ext) || ext.endsWith("html")) {
|
||||
viewHolder.icon.setImageResource(R.color.file_html);
|
||||
}
|
||||
else if (Arrays.asList(MimeTypes.MIME_CODE).contains(ext)
|
||||
} else if (Arrays.asList(MimeTypes.MIME_CODE).contains(ext)
|
||||
|| fileName.endsWith("css")
|
||||
|| fileName.endsWith("js")) {
|
||||
viewHolder.icon.setImageResource(R.color.file_code);
|
||||
}
|
||||
else if (Arrays.asList(MimeTypes.MIME_ARCHIVE).contains(ext)) {
|
||||
} else if (Arrays.asList(MimeTypes.MIME_ARCHIVE).contains(ext)) {
|
||||
viewHolder.icon.setImageResource(R.color.file_archive);
|
||||
}
|
||||
else if (Arrays.asList(MimeTypes.MIME_MUSIC)
|
||||
} else if (Arrays.asList(MimeTypes.MIME_MUSIC)
|
||||
.contains(ext)) {
|
||||
viewHolder.icon.setImageResource(R.color.file_media_music);
|
||||
}
|
||||
else if (Arrays.asList(MimeTypes.MIME_PICTURE).contains(ext)) {
|
||||
} else if (Arrays.asList(MimeTypes.MIME_PICTURE).contains(ext)) {
|
||||
viewHolder.icon.setImageResource(R.color.file_media_picture);
|
||||
}
|
||||
else if (Arrays.asList(MimeTypes.MIME_VIDEO).contains(ext)) {
|
||||
} else if (Arrays.asList(MimeTypes.MIME_VIDEO).contains(ext)) {
|
||||
viewHolder.icon.setImageResource(R.color.file_media_video);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
viewHolder.icon.setImageResource(R.color.file_text);
|
||||
}
|
||||
}
|
||||
|
@ -37,6 +37,9 @@ public class ChangelogDialogFragment extends DialogFragment {
|
||||
public ChangelogDialogFragment() {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
|
||||
@ -54,6 +57,9 @@ public class ChangelogDialogFragment extends DialogFragment {
|
||||
}
|
||||
)
|
||||
.setPositiveButton(R.string.vota, new DialogInterface.OnClickListener() {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void onClick(final DialogInterface dialog, final int which) {
|
||||
try {
|
||||
|
@ -89,6 +89,7 @@ public class EditorFragment extends Fragment implements EncodingDialogFragment.E
|
||||
return frag;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@ -98,6 +99,7 @@ public class EditorFragment extends Fragment implements EncodingDialogFragment.E
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@ -110,6 +112,7 @@ public class EditorFragment extends Fragment implements EncodingDialogFragment.E
|
||||
return rootView;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@ -151,6 +154,7 @@ public class EditorFragment extends Fragment implements EncodingDialogFragment.E
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@ -185,6 +189,7 @@ public class EditorFragment extends Fragment implements EncodingDialogFragment.E
|
||||
dialogFrag.show(getFragmentManager().beginTransaction(), "encodingDialog");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@ -237,6 +242,9 @@ public class EditorFragment extends Fragment implements EncodingDialogFragment.E
|
||||
|
||||
class SaveFile extends AsyncTask<Void, Void, Void> {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected Void doInBackground(final Void... voids) {
|
||||
try {
|
||||
@ -249,6 +257,9 @@ public class EditorFragment extends Fragment implements EncodingDialogFragment.E
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void onPostExecute(final Void aVoid) {
|
||||
super.onPostExecute(aVoid);
|
||||
@ -257,7 +268,6 @@ public class EditorFragment extends Fragment implements EncodingDialogFragment.E
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static class Editor extends EditText {
|
||||
|
||||
protected static final int
|
||||
@ -300,6 +310,9 @@ public class EditorFragment extends Fragment implements EncodingDialogFragment.E
|
||||
|
||||
private final Runnable updateRunnable =
|
||||
new Runnable() {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
replaceTextKeepCursor(getText());
|
||||
@ -332,6 +345,9 @@ public class EditorFragment extends Fragment implements EncodingDialogFragment.E
|
||||
// Syntax editor
|
||||
setFilters(new InputFilter[]{
|
||||
new InputFilter() {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public CharSequence filter(
|
||||
CharSequence source,
|
||||
@ -355,6 +371,9 @@ public class EditorFragment extends Fragment implements EncodingDialogFragment.E
|
||||
}});
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean onKeyShortcut(
|
||||
final int keyCode, final KeyEvent event) {
|
||||
@ -383,6 +402,9 @@ public class EditorFragment extends Fragment implements EncodingDialogFragment.E
|
||||
return super.onKeyShortcut(keyCode, event);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean onTextContextMenuItem(
|
||||
final int id) {
|
||||
@ -397,6 +419,9 @@ public class EditorFragment extends Fragment implements EncodingDialogFragment.E
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void onDraw(final Canvas canvas) {
|
||||
if (!EditorFragment.sWrapText) {
|
||||
|
@ -48,6 +48,9 @@ public class EncodingDialogFragment extends DialogFragment implements TextView.O
|
||||
return f;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
|
||||
final Bundle savedInstanceState) {
|
||||
@ -68,6 +71,9 @@ public class EncodingDialogFragment extends DialogFragment implements TextView.O
|
||||
|
||||
final Button button = (Button) view.findViewById(android.R.id.button1);
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void onClick(final View v) {
|
||||
returnData();
|
||||
@ -86,6 +92,9 @@ public class EncodingDialogFragment extends DialogFragment implements TextView.O
|
||||
this.dismiss();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean onEditorAction(final TextView v, final int actionId, final KeyEvent event) {
|
||||
if (EditorInfo.IME_ACTION_DONE == actionId) {
|
||||
|
@ -51,6 +51,7 @@ public class NavigationDrawerListFragment extends ListFragment implements AbsLis
|
||||
private List<String> fileNames;
|
||||
private ArrayAdapter<String> arrayAdapter;
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@ -61,6 +62,7 @@ public class NavigationDrawerListFragment extends ListFragment implements AbsLis
|
||||
return rootView;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@ -70,6 +72,7 @@ public class NavigationDrawerListFragment extends ListFragment implements AbsLis
|
||||
getListView().setMultiChoiceModeListener(this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@ -82,6 +85,7 @@ public class NavigationDrawerListFragment extends ListFragment implements AbsLis
|
||||
refreshList();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@ -92,6 +96,7 @@ public class NavigationDrawerListFragment extends ListFragment implements AbsLis
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@ -106,6 +111,7 @@ public class NavigationDrawerListFragment extends ListFragment implements AbsLis
|
||||
EventBus.getDefault().post(new FileSelectedEvent(filePath));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@ -113,6 +119,7 @@ public class NavigationDrawerListFragment extends ListFragment implements AbsLis
|
||||
public void onItemCheckedStateChanged(ActionMode actionMode, int position, long l, boolean isChecked) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@ -123,6 +130,7 @@ public class NavigationDrawerListFragment extends ListFragment implements AbsLis
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@ -131,6 +139,7 @@ public class NavigationDrawerListFragment extends ListFragment implements AbsLis
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@ -162,6 +171,7 @@ public class NavigationDrawerListFragment extends ListFragment implements AbsLis
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@ -174,6 +184,7 @@ public class NavigationDrawerListFragment extends ListFragment implements AbsLis
|
||||
/**
|
||||
* When a new file is opened
|
||||
* Invoked by the main activity which receive the intent
|
||||
*
|
||||
* @param event The event called
|
||||
*/
|
||||
public void onEvent(NewFileOpened event) {
|
||||
|
@ -29,6 +29,7 @@ import com.vmihalachi.turboeditor.R;
|
||||
|
||||
public class NoFileOpenedFragment extends Fragment {
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -37,6 +37,9 @@ public class CapitalizedTextView extends TextView {
|
||||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setText(final CharSequence text, final BufferType type) {
|
||||
super.setText(text.toString().toUpperCase(), type);
|
||||
|
Loading…
x
Reference in New Issue
Block a user