Skip to content

Commit

Permalink
Merge pull request #2 from ajnas/master
Browse files Browse the repository at this point in the history
New Camp menu page
  • Loading branch information
naveenpf authored Aug 11, 2019
2 parents 4984309 + ed89e9b commit badf7ec
Show file tree
Hide file tree
Showing 22 changed files with 216 additions and 190 deletions.
75 changes: 0 additions & 75 deletions .idea/assetWizardSettings.xml

This file was deleted.

Binary file removed .idea/caches/build_file_checksums.ser
Binary file not shown.
29 changes: 0 additions & 29 deletions .idea/codeStyles/Project.xml

This file was deleted.

18 changes: 0 additions & 18 deletions .idea/gradle.xml

This file was deleted.

34 changes: 0 additions & 34 deletions .idea/misc.xml

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/runConfigurations.xml

This file was deleted.

5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,10 @@ You can use the default username:password (admin:admin) combination for the app
- Test Server: [http://35.202.24.11/](http://35.202.24.11/find_people/)
- Local: [http://localhost:8000/find_people/](http://localhost:8000/find_people/)

# Releasing new versions
- Use the keystore file located [here](app/keystore)
- alias - key0
- password - keralarescue

# License
MIT License
Binary file removed app-debug.apk
Binary file not shown.
Binary file added app-release.apk
Binary file not shown.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "xyz.appmaker.keralarescue"
minSdkVersion 16
targetSdkVersion 27
versionCode 7
versionName "1.0"
versionCode 8
versionName "1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
manifestPlaceholders = [
onesignal_app_id : 'f25cf16a-1d78-4406-b6fc-92c8c7222ee0',
Expand Down
Binary file added app/keystore
Binary file not shown.
Binary file removed app/release/app-release.apk
Binary file not shown.
4 changes: 4 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Activities.CampHomeActivity"
android:label="@string/title_activity_camp_home"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".Activities.FieldsActivity"
android:label="@string/title_activity_fields"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
package xyz.appmaker.keralarescue.Activities;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.crashlytics.android.Crashlytics;

import xyz.appmaker.keralarescue.MainActivity;
import xyz.appmaker.keralarescue.R;
import xyz.appmaker.keralarescue.Tools.Config;
import xyz.appmaker.keralarescue.Tools.PreferensHandler;

public class CampHomeActivity extends AppCompatActivity {

PreferensHandler pref;
Context context;
Button updateReq,addInmates,updateCamp;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_camp_home);
final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
context = getApplicationContext();
pref = new PreferensHandler(context);
updateReq = findViewById(R.id.btn_req);
updateReq.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent reqAct = new Intent(CampHomeActivity.this, RequirementActivity.class);
reqAct.putExtra("campId", getIntent().getStringExtra("campId"));
startActivity(reqAct);
}
});

addInmates = findViewById(R.id.btn_inmates);
addInmates.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent fieldIntent = new Intent(CampHomeActivity.this, FieldsActivity.class);
fieldIntent.putExtra("campId", getIntent().getStringExtra("campId"));
startActivity(fieldIntent);
}
});
updateCamp = findViewById(R.id.btn_update_camp);
updateCamp.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openUrl(Config.BASE_URL+"/camp/"+getIntent().getStringExtra("campId")+"/details/");
}
});

setTitle(getIntent().getStringExtra("campName")) ;
}

private void openUrl(String url){
Intent openUrlIntent = new Intent(Intent.ACTION_VIEW);
openUrlIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
openUrlIntent.setData(Uri.parse(url));
try {
startActivity(openUrlIntent);
}
catch (Exception e){
Crashlytics.logException(e);
Toast.makeText(this,
"Couldn't open camp details page, Please make sure you've a web browser installed",
Toast.LENGTH_LONG).show();
}
}

public String authToken() {
return "JWT " + pref.getUserToken();
}


@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_camp_home, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_logout) {
Toast.makeText(this, "Logging out", Toast.LENGTH_SHORT).show();
logoutUser();
return true;
}

return super.onOptionsItemSelected(item);
}

public void logoutUser() {
if (pref != null) {
pref.setUserToken("");
Intent actLogin = new Intent(CampHomeActivity.this, MainActivity.class);
startActivity(actLogin);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,9 @@ public void onItemClick(View v, int position) {
pref.setRecentCampID(camp.getId());
pref.setRecentCamp(camp.getName());
}
Intent fieldIntent = new Intent(CampsActivity.this, FieldsActivity.class);
Intent fieldIntent = new Intent(CampsActivity.this, CampHomeActivity.class);
fieldIntent.putExtra("campId", String.valueOf(camp.getId()));
fieldIntent.putExtra("campName",camp.getName());
startActivity(fieldIntent);
}
};
Expand Down Expand Up @@ -253,8 +254,9 @@ protected void onResume() {
btnRecent.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent fieldIntent = new Intent(CampsActivity.this, FieldsActivity.class);
Intent fieldIntent = new Intent(CampsActivity.this, CampHomeActivity.class);
fieldIntent.putExtra("campId", String.valueOf(pref.getRecentCampID()));
fieldIntent.putExtra("campName",pref.getRecentCamp());
startActivity(fieldIntent);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public class FieldsActivity extends AppCompatActivity {
String campSelectedValue = "0";
APIService apiService;
TextView titleText;
Button btnReq;
private FirebaseAnalytics mFirebaseAnalytics;

@Override
Expand All @@ -74,7 +73,6 @@ protected void onCreate(Bundle savedInstanceState) {
context = getApplicationContext();
pref = new PreferensHandler(context);
syncDetailsTextView = findViewById(R.id.syncDetails);
btnReq = (Button) findViewById(R.id.btn_req);
dbInstance = CampDatabase.getDatabase(context);
apiService = AppController.getRetrofitInstance();
campSelectedValue = getIntent().getStringExtra("campId");
Expand Down Expand Up @@ -109,14 +107,6 @@ public void onNothingSelected(AdapterView<?> parent) {
}
});

btnReq.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent reqAct = new Intent(FieldsActivity.this, RequirementActivity.class);
reqAct.putExtra("campId", getIntent().getStringExtra("campId"));
startActivity(reqAct);
}
});


ArrayAdapter<District> districtAdapter = new ArrayAdapter<District>(this,
Expand Down
Loading

0 comments on commit badf7ec

Please sign in to comment.