-
Notifications
You must be signed in to change notification settings - Fork 261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot be resolved bug #663
Comments
How? can you explain better? |
im just making the project and when i added SwipeRefreshLayout and run the project this happen and remove the SwipeRefreshLayout but this is not fix😅 |
I think your custom blocks is broken or mis-configured. |
no its all okay until i add SwipeRefreshLayout and this happen😔 even the map variable is cannot be resolved. |
Can you show the source code? |
package com.mrcain.asura; import android.animation.; public class MainActivity extends AppCompatActivity {
} |
Did you a added any custom import statement? |
Did you notice a |
There should be a |
How do I add an array parameter?
في الثلاثاء، ١٤ فبراير ٢٠٢٣, ١٢:٤٨ م Hakan ***@***.***> كتب:
… i have the same problem.. i just added swiperefreshlayout (and code to
hide the spinner when it loads) and got this:
[image: Screenshot_2023-02-14-12-40-14]
<https://user-images.githubusercontent.com/103432992/218697762-3d38d644-8e11-4f99-8bd3-7a72d5734f19.jpg>
entire source code:
import android.Manifest;
import android.animation.*;
import android.app.*;
import android.app.Activity;
import android.app.DialogFragment;
import android.app.Fragment;
import android.app.FragmentManager;
import android.content.*;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.*;
import android.graphics.*;
import android.graphics.drawable.*;
import android.media.*;
import android.net.*;
import android.net.Uri;
import android.os.*;
import android.os.Bundle;
import android.text.*;
import android.text.style.*;
import android.util.*;
import android.view.*;
import android.view.View.*;
import android.view.animation.*;
import android.webkit.*;
import android.widget.*;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.ListView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout.OnRefreshListener;
import java.io.*;
import java.io.InputStream;
import java.text.*;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.regex.*;
import org.json.*;
public class MainActivity extends Activity {
private double TempCounter = 0;
private String CurrentDir = "";
private String FilePath = "";
private double FileSize = 0;
private String tempString = "";
private ArrayList<HashMap<String, Object>> FileList = new ArrayList<>();
private ArrayList<String> Files = new ArrayList<>();
private ListView listview1;
private SwipeRefreshLayout swiperefreshlayout1;
private Intent ActivityStarter = new Intent();
@OverRide
protected void onCreate(Bundle _savedInstanceState) {
super.onCreate(_savedInstanceState);
setContentView(R.layout.main);
initialize(_savedInstanceState);
if (Build.VERSION.SDK_INT >= 23) {
if (checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_DENIED) {
requestPermissions(new String[] {Manifest.permission.READ_EXTERNAL_STORAGE}, 1000);
} else {
initializeLogic();
}
} else {
initializeLogic();
}
}
@OverRide
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == 1000) {
initializeLogic();
}
}
private void initialize(Bundle _savedInstanceState) {
listview1 = findViewById(R.id.listview1);
swiperefreshlayout1 = findViewById(R.id.swiperefreshlayout1);
listview1.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@OverRide
public void onItemClick(AdapterView<?> _param1, View _param2, int _param3, long _param4) {
final int _position = _param3;
if (FileUtil.isDirectory(FileList.get((int)_position).get("FilePath").toString())) {
_LoadDir(FileList.get((int)_position).get("FilePath").toString());
}
else {
try{
ActivityStarter.setAction(Intent.ACTION_VIEW);
ActivityStarter.setData(Uri.parse("file://".concat(FileList.get((int)_position).get("FilePath").toString())));
ActivityStarter.setType(_GetMimeType(FileList.get((int)_position).get("FilePath").toString()));
SketchwareUtil.showMessage(getApplicationContext(), "file://".concat(FileList.get((int)_position).get("FilePath").toString()));
startActivity(ActivityStarter);
}catch(Exception e){
SketchwareUtil.showMessage(getApplicationContext(), "Cannot view file");
}
}
}
});
listview1.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@OverRide
public boolean onItemLongClick(AdapterView<?> _param1, View _param2, int _param3, long _param4) {
final int _position = _param3;
return true;
}
});
swiperefreshlayout1.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@OverRide
public void onRefresh() {
_LoadDir(CurrentDir);
swiperefreshlayout1.setRefreshing(false);
}
});
}
private void initializeLogic() {
_LoadDir("/storage/emulated/0");
}
@OverRide
public void onBackPressed() {
_LoadDir(CurrentDir.substring((int)(0), (int)((CurrentDir.length() - Uri.parse(CurrentDir).getLastPathSegment().length()) - 0)));
}
public void _AddFile(final String _FilePath) {
{
HashMap<String, Object> _item = new HashMap<>();
_item.put("FilePath", _FilePath);
FileList.add(_item);
}
listview1.setAdapter(new Listview1Adapter(FileList));
((BaseAdapter)listview1.getAdapter()).notifyDataSetChanged();
}
public void _LoadDir(final String _Path) {
CurrentDir = _Path;
FileList.clear();
listview1.setAdapter(new Listview1Adapter(FileList));
((BaseAdapter)listview1.getAdapter()).notifyDataSetChanged();
FileUtil.listDir(_Path, Files);
TempCounter = 0;
for(int _repeat12 = 0; _repeat12 < (int)(Files.size()); _repeat12++) {
if (FileUtil.isDirectory(Files.get((int)(TempCounter)))) {
_AddFile(Files.get((int)(TempCounter)));
TempCounter++;
}
}
TempCounter = 0;
for(int _repeat26 = 0; _repeat26 < (int)(Files.size()); _repeat26++) {
if (!FileUtil.isDirectory(Files.get((int)(TempCounter)))) {
_AddFile(Files.get((int)(TempCounter)));
}
TempCounter++;
}
}
public boolean _IsExtension(final String _Path, final String _Extension) {
return (_Path.substring((int)(_Path.length() - _Extension.length()), (int)(_Path.length())).equals(_Extension));
}
public String _GetMimeType(final String _Path) {
String extension = _Path.substring(_Path.lastIndexOf("."));
String mimeTypeMap = MimeTypeMap.getFileExtensionFromUrl(extension);
String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(mimeTypeMap);
return mimeType;
}
public class Listview1Adapter extends BaseAdapter {
ArrayList<HashMap<String, Object>> _data;
public Listview1Adapter(ArrayList<HashMap<String, Object>> _arr) {
_data = _arr;
}
@OverRide
public int getCount() {
return _data.size();
}
@OverRide
public HashMap<String, Object> getItem(int _index) {
return _data.get(_index);
}
@OverRide
public long getItemId(int _index) {
return _index;
}
@OverRide
public View getView(final int _position, View _v, ViewGroup _container) {
LayoutInflater _inflater = getLayoutInflater();
View _view = _v;
if (_view == null) {
_view = _inflater.inflate(R.layout.filelistitem, null);
}
final LinearLayout linear1 = _view.findViewById(R.id.linear1);
final ImageView Icon = _view.findViewById(R.id.Icon);
final LinearLayout linear2 = _view.findViewById(R.id.linear2);
final TextView Filename = _view.findViewById(R.id.Filename);
final TextView Info = _view.findViewById(R.id.Info);
FilePath = _data.get((int)_position).get("FilePath").toString();
Filename.setText(Uri.parse(_data.get((int)_position).get("FilePath").toString()).getLastPathSegment());
if (FileUtil.isDirectory(_data.get((int)_position).get("FilePath").toString())) {
Icon.setImageResource(R.drawable.folder);
Info.setText("Folder");
}
else {
Icon.setImageResource(R.drawable.file);
java.io.File file = new java.io.File(FilePath);
FileSize = file.length();
Info.setText(String.valueOf((long)(Math.floor(FileSize / 1024))).concat("KB"));
}
return _view;
}
}
@deprecated
public void showMessage(String _s) {
Toast.makeText(getApplicationContext(), _s, Toast.LENGTH_SHORT).show();
}
@deprecated
public int getLocationX(View _v) {
int _location[] = new int[2];
_v.getLocationInWindow(_location);
return _location[0];
}
@deprecated
public int getLocationY(View _v) {
int _location[] = new int[2];
_v.getLocationInWindow(_location);
return _location[1];
}
@deprecated
public int getRandom(int _min, int _max) {
Random random = new Random();
return random.nextInt(_max - _min + 1) + _min;
}
@deprecated
public ArrayList<Double> getCheckedItemPositionsToArray(ListView _list) {
ArrayList<Double> _result = new ArrayList<Double>();
SparseBooleanArray _arr = _list.getCheckedItemPositions();
for (int _iIdx = 0; _iIdx < _arr.size(); _iIdx++) {
if (_arr.valueAt(_iIdx))
_result.add((double)_arr.keyAt(_iIdx));
}
return _result;
}
@deprecated
public float getDip(int _input) {
return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, _input, getResources().getDisplayMetrics());
}
@deprecated
public int getDisplayWidthPixels() {
return getResources().getDisplayMetrics().widthPixels;
}
@deprecated
public int getDisplayHeightPixels() {
return getResources().getDisplayMetrics().heightPixels;
}
}```
—
Reply to this email directly, view it on GitHub
<#663 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A3MW3UYTUVK5JK7GHAP3QKDWXNIHFANCNFSM6AAAAAASOKW3CU>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
@HAKANKOKCU your problem isn't related to this one, and neither is a bug. You just have to enable AppCompat. @seifaldeen1 don't ask in more than one opened Issue about a problem, otherwise you're spamming. |
It doesn't look like any more info about the issue will be sent anytime soon, so I'll close this. Please re-open this or a new Issue only with more details. |
is this a bug??
The text was updated successfully, but these errors were encountered: