Browse Source

Last commit before making global changes!

master
Defend 8 years ago
parent
commit
c1a2cf0f47
  1. 41
      app/src/main/java/ru/defend/defdevteam/tstu/MainActivity.java
  2. 28
      app/src/main/java/ru/defend/defdevteam/tstu/OldParser.java
  3. 40
      app/src/main/java/ru/defend/defdevteam/tstu/WebActivity.java

41
app/src/main/java/ru/defend/defdevteam/tstu/MainActivity.java

@ -28,7 +28,6 @@ public class MainActivity extends AppCompatActivity {
final String PASSWORD = "password";
final String CHECK = "check";
public CheckBox check;
static public List<MainActivity.groupList> subs;
@ -43,7 +42,6 @@ public class MainActivity extends AppCompatActivity {
//onFeedReaderComplete();
}
//TODO: Проверка авторизации здеся, хотя как ее тут пилить, когда ее нету лооол!
void saveForms() {
sPref = getPreferences(MODE_PRIVATE);
SharedPreferences.Editor ed = sPref.edit();
@ -70,35 +68,6 @@ public class MainActivity extends AppCompatActivity {
}
}
public class subsAdapter extends ArrayAdapter<groupList> {
public subsAdapter(Context context) {
super(context, android.R.layout.simple_list_item_multiple_choice, subs);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
groupList group = getItem(position);
if(convertView == null){
convertView = LayoutInflater.from(getContext()).inflate(android.R.layout.simple_list_item_multiple_choice, null);
}
((TextView) convertView.findViewById(android.R.id.text1)).setText(group.name);
return convertView;
}
}
public class groupList {
public String name, rate;
public groupList(String name, String rate){
this.name = name;
this.rate = rate;
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -107,16 +76,6 @@ public class MainActivity extends AppCompatActivity {
password = (EditText) findViewById(R.id.passEdit);
check = (CheckBox) findViewById(R.id.save);
loadForms();
//TODO: убрать потом
subs = new ArrayList<groupList>();
subs.add(new groupList("test","test"));
subs.add(new groupList("test","test"));
subs.add(new groupList("test","test"));
subs.add(new groupList("test","test"));
setContentView(R.layout.subscriptions);
ArrayAdapter<groupList> subsL = new subsAdapter(this);
ListView subsList = (ListView) findViewById(R.id.subsList);
subsList.setAdapter(subsL);
}
@Override

28
app/src/main/java/ru/defend/defdevteam/tstu/OldParser.java

@ -0,0 +1,28 @@
package ru.defend.defdevteam.tstu;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Created by itsmy on 10.02.2017.
*/
public class OldParser {
public static StringBuffer removeUTFCharacters(String data){
Pattern p = Pattern.compile("\\\\u(\\p{XDigit}{4})");
Matcher m = p.matcher(data);
StringBuffer buf = new StringBuffer(data.length());
while (m.find()) {
String ch = String.valueOf((char) Integer.parseInt(m.group(1), 16));
m.appendReplacement(buf, Matcher.quoteReplacement(ch));
}
m.appendTail(buf);
return buf;
}
public ArrayList<WebActivity.groupList> parseGroup(){
return null;
}
}

40
app/src/main/java/ru/defend/defdevteam/tstu/WebActivity.java

@ -144,16 +144,6 @@ public class WebActivity extends AppCompatActivity
final 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);
// toolbar.setNavigationOnClickListener(
// new View.OnClickListener() {
// @Override
// public void onClick(View view) {
// Log.d("Toolbar","Hmmm...");
// if(drawer.isDrawerOpen(GravityCompat.START)){
// drawer.openDrawer(GravityCompat.START);
// }
// }
// });
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
@ -161,8 +151,6 @@ public class WebActivity extends AppCompatActivity
MainA = getIntent();
browser = (WebView) findViewById(R.id.webView);
browser.setWebViewClient(new MyWebViewClient());
browserSet = browser.getSettings();
@ -187,7 +175,6 @@ public class WebActivity extends AppCompatActivity
navigationView.getMenu().getItem(1).setChecked(true);
myToolbar.setTitle(R.string.title_profile);
feedController = new FeedController(this, 1);
AuthURL = "http://web-iais.admin.tstu.ru:7777/zion/f?p=stud_main";
@ -276,18 +263,6 @@ public class WebActivity extends AppCompatActivity
public static StringBuffer removeUTFCharacters(String data){
Pattern p = Pattern.compile("\\\\u(\\p{XDigit}{4})");
Matcher m = p.matcher(data);
StringBuffer buf = new StringBuffer(data.length());
while (m.find()) {
String ch = String.valueOf((char) Integer.parseInt(m.group(1), 16));
m.appendReplacement(buf, Matcher.quoteReplacement(ch));
}
m.appendTail(buf);
return buf;
}
public void loadSite () {
browser.loadUrl(AuthURL);
}
@ -455,6 +430,10 @@ public class WebActivity extends AppCompatActivity
groupList.setAdapter(groupL);
}
public void fillGroup(ArrayList<groupList> group){
}
public void fillFaculty(){
faculty = new ArrayList<groupList>();
String n,r;
@ -480,7 +459,6 @@ public class WebActivity extends AppCompatActivity
}
//TODO: Переделать к хуям позор ниже
public void fillAll(){
String s;
String s2 = GroupRateHTML;
@ -508,14 +486,6 @@ public class WebActivity extends AppCompatActivity
positionFaculty.setText("Место в институте: " + s2);
}
public void buttonRefresh (View v) {
getHTML();
}
public void buttonLogout (View v) {
finish();
}
@TargetApi(19)
public void getHTML(){
@ -532,7 +502,7 @@ public class WebActivity extends AppCompatActivity
public void encodeHTML(){
if(siteBuf != null){
siteBuf = removeUTFCharacters(siteBuf).toString();
siteBuf = OldParser.removeUTFCharacters(siteBuf).toString();
Log.d("Response html","Загружена страница "+cutLine("<title>","</title>",siteBuf));
Log.i("encodeHTML",siteBuf);
}

Loading…
Cancel
Save