Skip to content
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

Closed
IamHomen opened this issue Nov 29, 2022 · 14 comments
Closed

Cannot be resolved bug #663

IamHomen opened this issue Nov 29, 2022 · 14 comments
Labels
pending question(s) Further information is requested stale closed due to inactivity

Comments

@IamHomen
Copy link

Screenshot_20221129-185227
is this a bug??

@hasrat-ali
Copy link
Member

How? can you explain better?

@JavkhlanK JavkhlanK added the pending question(s) Further information is requested label Nov 29, 2022
@IamHomen
Copy link
Author

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😅

@IamHomen
Copy link
Author

How? can you explain better?

Screenshot_20221130-051523

@hasrat-ali
Copy link
Member

I think your custom blocks is broken or mis-configured.

@IamHomen
Copy link
Author

IamHomen commented Nov 30, 2022

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.

@hasrat-ali
Copy link
Member

Can you show the source code?

@IamHomen
Copy link
Author

Can you show the source code?

package com.mrcain.asura;

import android.animation.;
import android.app.
;
import android.content.;
import android.content.res.
;
import android.graphics.;
import android.graphics.drawable.
;
import android.media.;
import android.net.
;
import android.os.;
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.LinearLayout;
import android.widget.TextView;
import androidx.annotation.
;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.RecyclerView.Adapter;
import androidx.recyclerview.widget.RecyclerView.ViewHolder;
import com.bumptech.glide.Glide;
import com.google.android.material.appbar.AppBarLayout;
import java.io.
;
import java.text.;
import java.util.
;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.regex.;
import meorg.jsoup.
;
import org.json.*;
import androidx.core.widget.NestedScrollView;
import androidx.core.view.MenuItemCompat;

public class MainActivity extends AppCompatActivity {

private Toolbar _toolbar;
private AppBarLayout _app_bar;
private CoordinatorLayout _coordinator;
private DrawerLayout _drawer;
private HashMap<String, Object> popular_map = new HashMap<>();

private ArrayList<HashMap<String, Object>> popular_today_listmap = new ArrayList<>();

private NestedScrollView nsv1;
private LinearLayout linear2;
private TextView textview1;
private RecyclerView recyclerview1;

private RequestNetwork rn_asura_popular;
private RequestNetwork.RequestListener _rn_asura_popular_request_listener;

@Override
protected void onCreate(Bundle _savedInstanceState) {
	super.onCreate(_savedInstanceState);
	setContentView(R.layout.main);
	initialize(_savedInstanceState);
	initializeLogic();
}

private void initialize(Bundle _savedInstanceState) {
	_app_bar = findViewById(R.id._app_bar);
	_coordinator = findViewById(R.id._coordinator);
	_toolbar = findViewById(R.id._toolbar);
	setSupportActionBar(_toolbar);
	getSupportActionBar().setDisplayHomeAsUpEnabled(true);
	getSupportActionBar().setHomeButtonEnabled(true);
	_toolbar.setNavigationOnClickListener(new View.OnClickListener() {
		@Override
		public void onClick(View _v) {
			onBackPressed();
		}
	});
	_drawer = findViewById(R.id._drawer);
	ActionBarDrawerToggle _toggle = new ActionBarDrawerToggle(MainActivity.this, _drawer, _toolbar, R.string.app_name, R.string.app_name);
	_drawer.addDrawerListener(_toggle);
	_toggle.syncState();
	
	LinearLayout _nav_view = findViewById(R.id._nav_view);
	
	nsv1 = findViewById(R.id.nsv1);
	linear2 = findViewById(R.id.linear2);
	textview1 = findViewById(R.id.textview1);
	recyclerview1 = findViewById(R.id.recyclerview1);
	rn_asura_popular = new RequestNetwork(this);
	
	_rn_asura_popular_request_listener = new RequestNetwork.RequestListener() {
		@Override
		public void onResponse(String _param1, String _param2, HashMap<String, Object> _param3) {
			final String _tag = _param1;
			final String _response = _param2;
			final HashMap<String, Object> _responseHeaders = _param3;
			try {
				org.jsoup.nodes.Document listupd = org.jsoup.Jsoup.parse(_response);
				org.jsoup.select.Elements div1 = listupd.getElementsByClass("tt");
				org.jsoup.select.Elements div2 = listupd.getElementsByClass("epxs");
				org.jsoup.select.Elements img = listupd.select("img[src*=asura.gg]");
				org.jsoup.select.Elements a = listupd.select("div.bsx a[href]");
				org.jsoup.select.Elements span = listupd.getElementsByClass("type");
				recyclerview1.setAdapter(new Recyclerview1Adapter(popular_today_listmap));
				recyclerview1.setLayoutManager(new LinearLayoutManager(MainActivity.this));
				recyclerview1.setLayoutManager(new LinearLayoutManager(MainActivity.this,LinearLayoutManager.HORIZONTAL, false));
				
				for (int i = 0; i < (int)(div1.size()); i++) {
					popular_map = new HashMap<>();
					popular_map.put("title", div1.get(i).text());
					popular_map.put("chapter", div2.get(i).text());
					popular_map.put("cover", img.get(i).attr("src"));
					popular_map.put("link", a.get(i).attr("href"));
					popular_map.put("type", span.get(i).text());
					popular_today_listmap.add(popular_map);
				}
			} catch (Exception e) {
				SketchwareUtil.showMessage(getApplicationContext(), e.toString());
			}
		}
		
		@Override
		public void onErrorResponse(String _param1, String _param2) {
			final String _tag = _param1;
			final String _message = _param2;
			SketchwareUtil.showMessage(getApplicationContext(), _message);
		}
	};
}

private void initializeLogic() {
	_rn();
}


@Override
public boolean onCreateOptionsMenu(Menu menu) {
	MenuInflater inflater = getMenuInflater();  
	        inflater.inflate(R.menu.menu, menu);  
	        MenuItem searchViewItem = menu.findItem(R.id.app_bar_search);  
	        final SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchViewItem);  
	        searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {  
		            @Override  
		            public boolean onQueryTextSubmit(String query) {  
			                searchView.clearFocus();  
			         _search(query);
			               
			                return false;  
			  }
		  
		            @Override  
		            public boolean onQueryTextChange(String newText) {  
			                
			                return false;  
			            }  
		        }); 
	return super.onCreateOptionsMenu(menu);
}

@Override
public void onBackPressed() {
	if (_drawer.isDrawerOpen(GravityCompat.START)) {
		_drawer.closeDrawer(GravityCompat.START);
	} else {
		super.onBackPressed();
	}
}
public void _rn() {
	rn_asura_popular.startRequestNetwork(RequestNetworkController.GET, "https://asura.gg/manga/?page=1&order=update", "A", _rn_asura_popular_request_listener);
}


public void _search(final String _query) {
	SketchwareUtil.showMessage(getApplicationContext(), _query);
}

public class Recyclerview1Adapter extends RecyclerView.Adapter<Recyclerview1Adapter.ViewHolder> {
	
	ArrayList<HashMap<String, Object>> _data;
	
	public Recyclerview1Adapter(ArrayList<HashMap<String, Object>> _arr) {
		_data = _arr;
	}
	
	@Override
	public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
		LayoutInflater _inflater = getLayoutInflater();
		View _v = _inflater.inflate(R.layout.popular_items, null);
		RecyclerView.LayoutParams _lp = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
		_v.setLayoutParams(_lp);
		return new ViewHolder(_v);
	}
	
	@Override
	public void onBindViewHolder(ViewHolder _holder, final int _position) {
		View _view = _holder.itemView;
		
		final androidx.cardview.widget.CardView cardview1 = _view.findViewById(R.id.cardview1);
		final LinearLayout linear1 = _view.findViewById(R.id.linear1);
		final ImageView imageview1 = _view.findViewById(R.id.imageview1);
		final TextView title = _view.findViewById(R.id.title);
		final TextView type = _view.findViewById(R.id.type);
		final TextView chapter = _view.findViewById(R.id.chapter);
		
		title.setSelected(true);
		cardview1.setRadius((float)10);
		cardview1.setCardElevation((float)3);
		cardview1.setPreventCornerOverlap(true);
		type.setBackground(new GradientDrawable() { public GradientDrawable getIns(int a, int b) { this.setCornerRadius(a); this.setColor(b); return this; } }.getIns((int)8, 0xFF9C27B0));
		try {
			if (popular_today_listmap.get((int)_position).containsKey("title")) {
				title.setText(popular_today_listmap.get((int)_position).get("title").toString());
			}
			else {
				
			}
			if (popular_today_listmap.get((int)_position).containsKey("chapter")) {
				chapter.setText(popular_today_listmap.get((int)_position).get("chapter").toString());
			}
			else {
				
			}
			if (popular_today_listmap.get((int)_position).containsKey("cover")) {
				Glide.with(getApplicationContext()).load(Uri.parse(popular_today_listmap.get((int)_position).get("cover").toString())).into(imageview1);
			}
			else {
				imageview1.setImageResource(R.drawable.default_image);
			}
			if (popular_today_listmap.get((int)_position).containsKey("type")) {
				type.setText(popular_today_listmap.get((int)_position).get("type").toString().toUpperCase());
			}
			else {
				
			}
			cardview1.setOnClickListener(new View.OnClickListener() {
				@Override
				public void onClick(View _view) {
					if (popular_today_listmap.get((int)_position).containsKey("link")) {
						SketchwareUtil.showMessage(getApplicationContext(), popular_today_listmap.get((int)_position).get("link").toString());
					}
					else {
						
					}
				}
			});
		} catch (Exception e) {
			SketchwareUtil.showMessage(getApplicationContext(), e.toString());
		}
		RecyclerView.LayoutParams _lp = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
			_view.setLayoutParams(_lp);
	}
	
	@Override
	public int getItemCount() {
		return _data.size();
	}
	
	public class ViewHolder extends RecyclerView.ViewHolder {
		public ViewHolder(View v) {
			super(v);
		}
	}
}

@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;
}

}

@hasrat-ali
Copy link
Member

Did you a added any custom import statement?

@hasrat-ali
Copy link
Member

Did you notice a . before ; in import statement?

@hasrat-ali
Copy link
Member

There should be a * or a qualifier name after . and before ;

@IamHomen
Copy link
Author

There should be a * or a qualifier name after . and before ;

it seems like theres a problem in copy paste, but on my source code it has * and this is my only custom import
Screenshot_20221130-134245

@seifaldeen1
Copy link

seifaldeen1 commented Feb 14, 2023 via email

@JavkhlanK
Copy link
Member

@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.

@JavkhlanK JavkhlanK added the stale closed due to inactivity label Jun 30, 2023
@JavkhlanK JavkhlanK closed this as not planned Won't fix, can't repro, duplicate, stale Jun 30, 2023
@JavkhlanK
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending question(s) Further information is requested stale closed due to inactivity
Projects
None yet
Development

No branches or pull requests

4 participants